@afeefa/vue-app 0.0.202 → 0.0.204
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.204
|
package/package.json
CHANGED
@@ -85,6 +85,14 @@ export default class ADialog extends Mixins(UsesPositionServiceMixin, ComponentW
|
|
85
85
|
}
|
86
86
|
onFocusin(e)
|
87
87
|
}
|
88
|
+
|
89
|
+
// catch click events if activator's first element is set to be disabled
|
90
|
+
const activator = document.getElementsByClassName(this.activatorClass)[0]
|
91
|
+
activator.addEventListener('click', e => {
|
92
|
+
if (activator.children[0]?.getAttribute('disabled')) {
|
93
|
+
e.stopPropagation()
|
94
|
+
}
|
95
|
+
}, true) // capture phase, stop event before v-dialog receives it
|
88
96
|
}
|
89
97
|
|
90
98
|
coe_cancelOnEsc () {
|
@@ -20,14 +20,15 @@
|
|
20
20
|
<hr>
|
21
21
|
</template>
|
22
22
|
|
23
|
-
<
|
24
|
-
v-if="
|
23
|
+
<a-text-field
|
24
|
+
v-if="!nestLevel && numItemsWithChildren > 8"
|
25
25
|
v-model="filterTerm"
|
26
|
+
class="mt-1 mb-2"
|
26
27
|
type="text"
|
27
|
-
class="inputElement inputElement--filter"
|
28
28
|
placeholder="Filtern"
|
29
|
-
|
30
|
-
|
29
|
+
focus
|
30
|
+
hide-details
|
31
|
+
/>
|
31
32
|
|
32
33
|
<div
|
33
34
|
v-for="item in filteredItems"
|
@@ -57,6 +58,7 @@
|
|
57
58
|
<popup-menu-list
|
58
59
|
v-if="item.children?.length && selectedItem === item"
|
59
60
|
:parent="canSelectParent && item"
|
61
|
+
:parentFilterTerm="filterTerm"
|
60
62
|
:items="item.children"
|
61
63
|
:level="nestLevel + 1"
|
62
64
|
:position="getPosition(item)"
|
@@ -75,7 +77,7 @@
|
|
75
77
|
v-if="filteredItems.length === 0"
|
76
78
|
class="noItems"
|
77
79
|
>
|
78
|
-
Keine Einträge
|
80
|
+
Keine Einträge gefunden
|
79
81
|
</p>
|
80
82
|
</a-popup>
|
81
83
|
</template>
|
@@ -86,7 +88,7 @@ import { Component, Vue } from '@a-vue'
|
|
86
88
|
import { PositionConfig } from '../../services/PositionService'
|
87
89
|
|
88
90
|
@Component({
|
89
|
-
props: ['items', 'parent', 'level', 'position', {canSelectParent: true}],
|
91
|
+
props: ['items', 'parent', 'level', 'position', {canSelectParent: true}, 'parentFilterTerm'],
|
90
92
|
name: 'popup-menu-list'
|
91
93
|
})
|
92
94
|
export default class PopupMenuList extends Vue {
|
@@ -98,15 +100,32 @@ export default class PopupMenuList extends Vue {
|
|
98
100
|
}
|
99
101
|
|
100
102
|
get filteredItems () {
|
101
|
-
|
103
|
+
const filterTerm = this.parentFilterTerm || this.filterTerm
|
104
|
+
if (!filterTerm) {
|
102
105
|
return this.items
|
103
106
|
} else {
|
104
107
|
return this.items.filter(item => {
|
105
|
-
|
108
|
+
// find parent only if it has no children
|
109
|
+
const itemFound = item.title.toLowerCase().includes(filterTerm.toLowerCase())
|
110
|
+
if (itemFound && !item.children?.length) {
|
111
|
+
return true
|
112
|
+
}
|
113
|
+
|
114
|
+
// find a child
|
115
|
+
const childFound = item.children?.some(item => {
|
116
|
+
return item.title.toLowerCase().includes(filterTerm.toLowerCase())
|
117
|
+
})
|
118
|
+
return childFound
|
106
119
|
})
|
107
120
|
}
|
108
121
|
}
|
109
122
|
|
123
|
+
get numItemsWithChildren () {
|
124
|
+
return this.items.reduce((num, i) => {
|
125
|
+
return num + 1 + (i.children?.length || 0)
|
126
|
+
}, 0)
|
127
|
+
}
|
128
|
+
|
110
129
|
click (item) {
|
111
130
|
if (item === this.parent) { // parent item
|
112
131
|
this.$emit('click', item)
|
@@ -150,18 +169,11 @@ export default class PopupMenuList extends Vue {
|
|
150
169
|
}
|
151
170
|
|
152
171
|
.noItems {
|
153
|
-
font-size: .
|
154
|
-
|
155
|
-
margin: .5em 0;
|
172
|
+
font-size: .9rem;
|
173
|
+
margin: .2rem;
|
156
174
|
white-space: nowrap;
|
157
175
|
}
|
158
176
|
|
159
|
-
.inputElement--filter {
|
160
|
-
font-size: .8rem;
|
161
|
-
margin-bottom: .5em;
|
162
|
-
padding: .5em;
|
163
|
-
}
|
164
|
-
|
165
177
|
.item {
|
166
178
|
display: flex;
|
167
179
|
align-items: center;
|