@afeefa/vue-app 0.0.204 → 0.0.205
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.205
|
package/package.json
CHANGED
@@ -104,19 +104,35 @@ export default class PopupMenuList extends Vue {
|
|
104
104
|
if (!filterTerm) {
|
105
105
|
return this.items
|
106
106
|
} else {
|
107
|
-
|
108
|
-
|
107
|
+
const selectableItems = [] // this list of children is shown instead of the root list in case of max 5 selectable filter results
|
108
|
+
|
109
|
+
const items = this.items.filter(item => {
|
110
|
+
// count parent only if it has no children
|
109
111
|
const itemFound = item.title.toLowerCase().includes(filterTerm.toLowerCase())
|
110
112
|
if (itemFound && !item.children?.length) {
|
113
|
+
selectableItems.push(item)
|
111
114
|
return true
|
112
115
|
}
|
113
116
|
|
114
|
-
// find
|
115
|
-
const
|
116
|
-
|
117
|
+
// find all filtered children
|
118
|
+
const filteredChildren = item.children?.filter(item => {
|
119
|
+
if (item.title.toLowerCase().includes(filterTerm.toLowerCase())) {
|
120
|
+
selectableItems.push(item)
|
121
|
+
return true
|
122
|
+
}
|
123
|
+
return false
|
117
124
|
})
|
118
|
-
|
125
|
+
|
126
|
+
// count parent only if it has min 1 filtered child
|
127
|
+
return filteredChildren?.length || false
|
119
128
|
})
|
129
|
+
|
130
|
+
// return the list of children instead the root list
|
131
|
+
if (selectableItems.length <= 5) {
|
132
|
+
return selectableItems
|
133
|
+
}
|
134
|
+
|
135
|
+
return items
|
120
136
|
}
|
121
137
|
}
|
122
138
|
|