@@ -30,7 +30,33 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30
30
class =" control"
31
31
:data-cy =" `control-${iControl.key}`"
32
32
>
33
- <v-btn
33
+ <v-menu
34
+ v-if =" iControl.action==='select-tree'"
35
+ :close-on-content-click =" false"
36
+ >
37
+ <template v-slot :activator =" { props } " >
38
+ <v-btn
39
+ v-bind =" {...$attrs, ...props, ...btnProps}"
40
+ :disabled =" iControl.disabled"
41
+ :color =" iControl.color"
42
+ >
43
+ <v-icon >{{ iControl.icon }}</v-icon >
44
+ <v-tooltip >{{ iControl.title }}</v-tooltip >
45
+ </v-btn >
46
+ </template >
47
+ <v-treeview
48
+ v-model:selected =" iControl.value"
49
+ v-on:update:selected =" iControl.callback"
50
+ :items =" iControl.items"
51
+ item-props
52
+ select-strategy =' independent'
53
+ item-title =" name"
54
+ item-value =" name"
55
+ selectable
56
+ open-all
57
+ ></v-treeview >
58
+ </v-menu >
59
+ <v-btn v-else
34
60
v-bind =" btnProps"
35
61
:disabled =" iControl.disabled"
36
62
:color =" iControl.color"
@@ -46,10 +72,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
46
72
47
73
<script >
48
74
import { btnProps } from ' @/utils/viewToolbar'
75
+ import { VTreeview } from ' vuetify/labs/VTreeview'
49
76
50
77
export default {
51
78
name: ' ViewToolbar' ,
52
79
80
+ components: {
81
+ VTreeview,
82
+ },
83
+
53
84
emits: [
54
85
' setOption'
55
86
],
@@ -120,7 +151,6 @@ export default {
120
151
color = null
121
152
callback = null
122
153
disabled = false
123
-
124
154
// set callback and color
125
155
switch (control .action ) {
126
156
case ' toggle' :
@@ -132,6 +162,12 @@ export default {
132
162
case ' callback' :
133
163
callback = (e ) => this .call (control, e)
134
164
break
165
+ case ' select-tree' :
166
+ callback = (e ) => this .select (control, e)
167
+ if (control .value .length ) {
168
+ color = ' blue'
169
+ }
170
+ break
135
171
}
136
172
137
173
// set disabled
@@ -178,6 +214,10 @@ export default {
178
214
control .callback ()
179
215
e .currentTarget .blur ()
180
216
},
217
+ select (control , value ) {
218
+ // call a control's callback
219
+ this .$emit (' setOption' , control .key , value)
220
+ },
181
221
getValues () {
182
222
// an object with all defined values
183
223
const vars = {}
0 commit comments