mirror of
https://github.com/Lissy93/dashy.git
synced 2025-12-15 13:03:28 +01:00
add searchTerm prop to receive search state from parent component; modify sortedItems so that it hides hidden items during normal browsing mode.
This commit is contained in:
parent
66c83a9b8c
commit
30a8f3397e
1 changed files with 9 additions and 1 deletions
|
|
@ -128,6 +128,7 @@ export default {
|
|||
widgets: Array,
|
||||
index: Number,
|
||||
isWide: Boolean,
|
||||
searchTerm: String,
|
||||
},
|
||||
components: {
|
||||
Collapsable,
|
||||
|
|
@ -178,7 +179,14 @@ export default {
|
|||
},
|
||||
/* If the sortBy attribute is specified, then return sorted data */
|
||||
sortedItems() {
|
||||
const items = [...this.items];
|
||||
// Filter out items with hidden: true, unless in edit mode or searching
|
||||
let items = [...this.items];
|
||||
if (!this.isEditMode) {
|
||||
// Include hidden items only when there's an active search term
|
||||
if (!this.searchTerm || this.searchTerm.trim() === '') {
|
||||
items = items.filter(item => !item.hidden);
|
||||
}
|
||||
}
|
||||
if (this.appConfig.disableSmartSort) return items;
|
||||
if (this.sortOrder === 'alphabetical') {
|
||||
return this.sortAlphabetically(items);
|
||||
|
|
|
|||
Loading…
Reference in a new issue