9
9
:w =" componentData.w"
10
10
:h =" componentData.h"
11
11
:parent =" true"
12
- class-name-resizable =" my-resizable-class"
13
12
@activated =" onActivated(componentData)"
14
13
@deactivated =" onDeactivated(componentData)"
15
14
@dragging =" onDrag"
16
15
@resizing =" onResize"
16
+ @dblclick.native =" onDoubleClick(componentData)"
17
17
>
18
18
<h3 >{{ componentData.componentName }}</h3 >
19
+ <q-menu context-menu >
20
+ <q-list >
21
+ <q-item clickable v-ripple v-close-popup @click =" handleAddChild" >
22
+ <q-item-section >Add Children</q-item-section >
23
+ <q-item-section avatar ><q-icon color =" primary" name =" add" /></q-item-section >
24
+ </q-item >
25
+ <q-item clickable v-ripple v-close-popup auto-close >
26
+ <q-item-section >Delete Children</q-item-section >
27
+ <q-item-section avatar ><q-icon color =" primary" name =" delete" /></q-item-section >
28
+ </q-item >
29
+ </q-list >
30
+ </q-menu >
19
31
</VueDraggableResizable >
32
+ <div >
33
+ <q-dialog v-model =" modalOpen" >
34
+ <q-select
35
+ @input =" handleSelect"
36
+ id =" dropdown"
37
+ filled
38
+ v-model =" testModel"
39
+ multiple
40
+ :options =" options"
41
+ use-chips
42
+ stack-label
43
+ label =" Select children"
44
+ style =" width : 250px ; background-color : #fd5f00 "
45
+ />
46
+ </q-dialog >
47
+ </div >
20
48
</div >
21
49
</template >
22
50
<script >
23
51
import { mapState , mapActions } from ' vuex'
24
52
import VueDraggableResizable from ' vue-draggable-resizable'
53
+ // import ChildrenMultiselect from '../components/ChildrenMultiselect'
25
54
import ' vue-draggable-resizable/dist/VueDraggableResizable.css'
26
55
27
56
export default {
@@ -31,7 +60,10 @@ export default {
31
60
},
32
61
data () {
33
62
return {
34
- abilityToDelete: false
63
+ modalOpen: false ,
64
+ abilityToDelete: false ,
65
+ testOptions: [' parent' , ' child' , ' grandchild' ],
66
+ testModel: []
35
67
}
36
68
},
37
69
mounted () {
@@ -45,7 +77,7 @@ export default {
45
77
})
46
78
},
47
79
computed: {
48
- ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' ]),
80
+ ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' , ' componentChildrenMultiselectValue ' ]),
49
81
// used in VueDraggableResizeable component
50
82
activeRouteArray () {
51
83
// console.log('active route array method', this.routes[this.activeRoute])
@@ -57,10 +89,21 @@ export default {
57
89
return this .activeRouteArray .filter (componentData => {
58
90
return componentData .componentName === this .activeComponent
59
91
})[0 ]
92
+ },
93
+ options () {
94
+ // PROBLEM: the objects on childrenmultiselectvalue are applied
95
+ const routes = Object .keys (this .routes )
96
+ const exceptions = new Set ([' App' , this .activeComponent , ... routes])
97
+ return Object .keys (this .componentMap ).filter (component => {
98
+ if (! exceptions .has (component)) return component
99
+ })
60
100
}
61
101
},
62
102
methods: {
63
- ... mapActions ([' setActiveComponent' ]),
103
+ ... mapActions ([
104
+ ' setActiveComponent' ,
105
+ ' updateComponentChildrenMultiselectValue' ,
106
+ ' updateActiveComponentChildrenValue' ]),
64
107
onResize : function (x , y , width , height ) {
65
108
this .activeComponentData .x = x
66
109
this .activeComponentData .y = y
@@ -85,6 +128,20 @@ export default {
85
128
},
86
129
onDeactivated () {
87
130
this .activeComponentData .isActive = false
131
+ },
132
+ onDoubleClick (compData ) {
133
+ this .setActiveComponent (compData .componentName )
134
+ this .activeComponentData .isActive = true
135
+ },
136
+ handleAddChild () {
137
+ // render modal with childrenmultiselect in it
138
+ this .modalOpen = true
139
+ },
140
+ handleSelect (value ) {
141
+ // if (this.modalOpen) this.updateActiveComponentChildrenValue(value)
142
+ console .log (' Multiselect: ' , value)
143
+ this .updateActiveComponentChildrenValue (value)
144
+ // this.updateComponentChildrenMultiselectValue(value)
88
145
}
89
146
// @dblclick.native="onDoubleClick(componentData)"
90
147
// onDoubleClick (compData) {
@@ -136,7 +193,6 @@ export default {
136
193
border : 1px dashed rgb (227 , 203 , 71 );
137
194
background-color : rgba (186 , 99 , 99 , 0.529 );
138
195
}
139
-
140
196
.active {
141
197
background-color : rgba (57 , 63 , 84 , 0.5 );
142
198
}
0 commit comments