55 v-for =" componentData in activeRouteArray"
66 :key =" componentData.componentName"
77 :x =" componentData.x"
8- :y =" componentData.y"
8+ :y =" componentData.y + 20 "
99 :w =" componentData.w"
1010 :h =" componentData.h"
1111 :parent =" true"
12- class-name-resizable =" my-resizable-class"
1312 @activated =" onActivated(componentData)"
1413 @deactivated =" onDeactivated(componentData)"
1514 @dragging =" onDrag"
1615 @resizing =" onResize"
16+ @dblclick.native =" onDoubleClick(componentData)"
1717 >
18-
19- <div class =" component-title" >
18+ <div class =" component-title" >
2019 <p >{{ componentData.componentName }}</p >
2120 </div >
2221 <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 >
2424 <!-- <p v-for="child in childList" :key="childList.indexOf(child)"> {{ child.text }}</p> -->
2525 </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 >
2638 </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 >
2755 </div >
2856</template >
2957<script >
3058import { mapState , mapActions } from ' vuex'
3159import VueDraggableResizable from ' vue-draggable-resizable'
60+ // import ChildrenMultiselect from '../components/ChildrenMultiselect'
3261import ' vue-draggable-resizable/dist/VueDraggableResizable.css'
3362
3463export default {
@@ -38,7 +67,10 @@ export default {
3867 },
3968 data () {
4069 return {
41- abilityToDelete: false
70+ modalOpen: false ,
71+ abilityToDelete: false ,
72+ testOptions: [' parent' , ' child' , ' grandchild' ],
73+ testModel: []
4274 }
4375 },
4476 mounted () {
@@ -52,7 +84,8 @@ export default {
5284 })
5385 },
5486 computed: {
55- ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' ]),
87+ ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' , ' componentChildrenMultiselectValue' ]),
88+ // used in VueDraggableResizeable component
5689 activeRouteArray () {
5790 console .log (' active route array method' , this .routes [this .activeRoute ])
5891 return this .routes [this .activeRoute ]
@@ -65,10 +98,21 @@ export default {
6598 },
6699 childList () {
67100 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+ })
68109 }
69110 },
70111 methods: {
71- ... mapActions ([' setActiveComponent' ]),
112+ ... mapActions ([
113+ ' setActiveComponent' ,
114+ ' updateComponentChildrenMultiselectValue' ,
115+ ' updateActiveComponentChildrenValue' ]),
72116 onResize : function (x , y , width , height ) {
73117 this .activeComponentData .x = x
74118 this .activeComponentData .y = y
@@ -93,6 +137,20 @@ export default {
93137 },
94138 onDeactivated () {
95139 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)
96154 }
97155 // @dblclick.native="onDoubleClick(componentData)"
98156 // onDoubleClick (compData) {
@@ -164,7 +222,6 @@ export default {
164222 -ms-transition : background-color 200ms linear ;
165223 transition : background-color 200ms linear ;
166224}
167-
168225.active {
169226 background-color : rgba (57 , 63 , 84 , 0.5 );
170227 border : 1px dashed rgb (227 , 203 , 71 );
0 commit comments