5
5
v-for =" componentData in activeRouteArray"
6
6
:key =" componentData.componentName"
7
7
:x =" componentData.x"
8
- :y =" componentData.y"
8
+ :y =" componentData.y + 20 "
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
-
19
- <div class =" component-title" >
18
+ <div class =" component-title" >
20
19
<p >{{ componentData.componentName }}</p >
21
20
</div >
22
21
<div class =" component-children" >
23
- <p >children: </p >
22
+ <p ># of children: {{ componentMap[componentData.componentName].children.length }} </p >
23
+ <p >children: {{ componentMap[componentData.componentName].children }}</p >
24
24
<!-- <p v-for="child in childList" :key="childList.indexOf(child)"> {{ child.text }}</p> -->
25
25
</div >
26
+ <q-menu context-menu >
27
+ <q-list >
28
+ <q-item clickable v-ripple v-close-popup @click =" handleAddChild" >
29
+ <q-item-section >Add Children</q-item-section >
30
+ <q-item-section avatar ><q-icon color =" primary" name =" add" /></q-item-section >
31
+ </q-item >
32
+ <q-item clickable v-ripple v-close-popup auto-close >
33
+ <q-item-section >Delete Children</q-item-section >
34
+ <q-item-section avatar ><q-icon color =" primary" name =" delete" /></q-item-section >
35
+ </q-item >
36
+ </q-list >
37
+ </q-menu >
26
38
</VueDraggableResizable >
39
+ <div >
40
+ <q-dialog v-model =" modalOpen" >
41
+ <q-select
42
+ @input =" handleSelect"
43
+ id =" dropdown"
44
+ filled
45
+ v-model =" testModel"
46
+ multiple
47
+ :options =" options"
48
+ use-chips
49
+ stack-label
50
+ label =" Select children"
51
+ style =" width : 250px ; background-color : #fd5f00 "
52
+ />
53
+ </q-dialog >
54
+ </div >
27
55
</div >
28
56
</template >
29
57
<script >
30
58
import { mapState , mapActions } from ' vuex'
31
59
import VueDraggableResizable from ' vue-draggable-resizable'
60
+ // import ChildrenMultiselect from '../components/ChildrenMultiselect'
32
61
import ' vue-draggable-resizable/dist/VueDraggableResizable.css'
33
62
34
63
export default {
@@ -38,7 +67,10 @@ export default {
38
67
},
39
68
data () {
40
69
return {
41
- abilityToDelete: false
70
+ modalOpen: false ,
71
+ abilityToDelete: false ,
72
+ testOptions: [' parent' , ' child' , ' grandchild' ],
73
+ testModel: []
42
74
}
43
75
},
44
76
mounted () {
@@ -52,7 +84,8 @@ export default {
52
84
})
53
85
},
54
86
computed: {
55
- ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' ]),
87
+ ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' , ' componentChildrenMultiselectValue' ]),
88
+ // used in VueDraggableResizeable component
56
89
activeRouteArray () {
57
90
console .log (' active route array method' , this .routes [this .activeRoute ])
58
91
return this .routes [this .activeRoute ]
@@ -65,10 +98,21 @@ export default {
65
98
},
66
99
childList () {
67
100
return this .componentMap [componentData .componentName ].children
101
+ },
102
+ options () {
103
+ // PROBLEM: the objects on childrenmultiselectvalue are applied
104
+ const routes = Object .keys (this .routes )
105
+ const exceptions = new Set ([' App' , this .activeComponent , ... routes])
106
+ return Object .keys (this .componentMap ).filter (component => {
107
+ if (! exceptions .has (component)) return component
108
+ })
68
109
}
69
110
},
70
111
methods: {
71
- ... mapActions ([' setActiveComponent' ]),
112
+ ... mapActions ([
113
+ ' setActiveComponent' ,
114
+ ' updateComponentChildrenMultiselectValue' ,
115
+ ' updateActiveComponentChildrenValue' ]),
72
116
onResize : function (x , y , width , height ) {
73
117
this .activeComponentData .x = x
74
118
this .activeComponentData .y = y
@@ -93,6 +137,20 @@ export default {
93
137
},
94
138
onDeactivated () {
95
139
this .activeComponentData .isActive = false
140
+ },
141
+ onDoubleClick (compData ) {
142
+ this .setActiveComponent (compData .componentName )
143
+ this .activeComponentData .isActive = true
144
+ },
145
+ handleAddChild () {
146
+ // render modal with childrenmultiselect in it
147
+ this .modalOpen = true
148
+ },
149
+ handleSelect (value ) {
150
+ // if (this.modalOpen) this.updateActiveComponentChildrenValue(value)
151
+ console .log (' Multiselect: ' , value)
152
+ this .updateActiveComponentChildrenValue (value)
153
+ // this.updateComponentChildrenMultiselectValue(value)
96
154
}
97
155
// @dblclick.native="onDoubleClick(componentData)"
98
156
// onDoubleClick (compData) {
@@ -164,7 +222,6 @@ export default {
164
222
-ms-transition : background-color 200ms linear ;
165
223
transition : background-color 200ms linear ;
166
224
}
167
-
168
225
.active {
169
226
background-color : rgba (57 , 63 , 84 , 0.5 );
170
227
border : 1px dashed rgb (227 , 203 , 71 );
0 commit comments