Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mth-grid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetaboHUB
web-components
mth-grid
Commits
0ccdd6e1
Commit
0ccdd6e1
authored
1 month ago
by
LIOTIER MARION
Browse files
Options
Downloads
Patches
Plain Diff
clean
parent
7fc79172
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/GridSearchBar.vue
+10
-1
10 additions, 1 deletion
src/components/GridSearchBar.vue
src/components/MthGrid.vue
+1
-6
1 addition, 6 deletions
src/components/MthGrid.vue
with
11 additions
and
7 deletions
src/components/GridSearchBar.vue
+
10
−
1
View file @
0ccdd6e1
...
...
@@ -20,7 +20,7 @@
</
template
>
<
script
setup
lang=
"ts"
>
import
{
computed
,
ref
}
from
"
vue
"
;
import
{
computed
,
ref
,
watch
}
from
"
vue
"
;
import
{
useDisplay
}
from
'
vuetify
'
;
import
{
MthSearchBar
,
type
SearchType
}
from
"
@metabohub/mth-search-bar
"
;
import
"
@metabohub/mth-search-bar/dist/style.css
"
;
...
...
@@ -37,17 +37,26 @@ const emits = defineEmits(["submit"]);
// DATA
const
{
smAndDown
}
=
useDisplay
();
const
searchVSelectVModel
=
ref
<
string
>
(
"
All
"
);
const
searchValue
=
ref
<
string
>
(
""
);
const
searchType
=
ref
<
SearchType
>
(
"
EXACT
"
);
// COMPUTED
const
searchVSelectItems
=
computed
(()
=>
{
return
[
"
All
"
,
...
props
.
searchableHeadersTitles
];
});
// WATCHERS
watch
(
searchVSelectVModel
,
(
newValue
)
=>
{
emits
(
"
submit
"
,
{
searchValue
:
searchValue
.
value
,
searchType
:
searchType
.
value
,
searchField
:
newValue
});
});
// METHODS
const
emitEvent
=
(
searchObj
:
{
searchInput
:
string
;
searchType
:
SearchType
},
field
:
string
)
=>
{
emits
(
"
submit
"
,
{
searchValue
:
searchObj
.
searchInput
,
searchType
:
searchObj
.
searchType
,
searchField
:
field
});
searchValue
.
value
=
searchObj
.
searchInput
;
searchType
.
value
=
searchObj
.
searchType
;
};
</
script
>
This diff is collapsed.
Click to expand it.
src/components/MthGrid.vue
+
1
−
6
View file @
0ccdd6e1
...
...
@@ -179,14 +179,12 @@ const isHoverColumnKey = ref<string | undefined>();
const
slots
=
useSlots
();
const
displayActions
=
ref
<
boolean
>
(
"
actions
"
in
slots
);
const
searchVSelectVModel
=
ref
<
string
>
(
"
All
"
);
const
searchValue
=
ref
<
string
>
(
""
);
const
searchField
=
reactive
<
string
[]
>
([]);
const
searchType
=
ref
<
SearchType
>
(
"
EXACT
"
);
const
itemsSelected
=
ref
<
(
string
|
number
)[]
>
();
// the headers displayed in the table
const
trueHeaders
=
ref
<
MthGridHeader
[]
>
([]);
const
headersVSelectModel
=
ref
<
MthGridHeader
[]
>
([]);
...
...
@@ -228,8 +226,8 @@ const trueItems = computed((): MthGridItem[] => {
});
// HOOKS -------------------------------------------------------
// init the headers to display with all the headers
onMounted
(()
=>
{
// init the headers with the props
trueHeaders
.
value
=
[...
props
.
headers
];
if
(
displayActions
.
value
)
{
trueHeaders
.
value
.
push
({
...
...
@@ -278,9 +276,6 @@ watch(itemsSelected, (newValue) => {
return
newValue
!
.
includes
(
item
[
props
.
itemSelectKey
]);
}));
});
watch
(
searchVSelectVModel
,
(
newValue
)
=>
{
updateSearchFields
(
newValue
);
});
// METHODS -------------------------------------------------------
const
getSortBadge
=
(
sortBy
:
{
key
:
string
,
order
:
string
}[],
key
:
string
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment