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 >
1818 <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 >
1931 </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 >
2048 </div >
2149</template >
2250<script >
2351import { mapState , mapActions } from ' vuex'
2452import VueDraggableResizable from ' vue-draggable-resizable'
53+ // import ChildrenMultiselect from '../components/ChildrenMultiselect'
2554import ' vue-draggable-resizable/dist/VueDraggableResizable.css'
2655
2756export default {
@@ -31,7 +60,10 @@ export default {
3160 },
3261 data () {
3362 return {
34- abilityToDelete: false
63+ modalOpen: false ,
64+ abilityToDelete: false ,
65+ testOptions: [' parent' , ' child' , ' grandchild' ],
66+ testModel: []
3567 }
3668 },
3769 mounted () {
@@ -45,7 +77,7 @@ export default {
4577 })
4678 },
4779 computed: {
48- ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' ]),
80+ ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' , ' componentChildrenMultiselectValue ' ]),
4981 // used in VueDraggableResizeable component
5082 activeRouteArray () {
5183 // console.log('active route array method', this.routes[this.activeRoute])
@@ -57,10 +89,21 @@ export default {
5789 return this .activeRouteArray .filter (componentData => {
5890 return componentData .componentName === this .activeComponent
5991 })[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+ })
60100 }
61101 },
62102 methods: {
63- ... mapActions ([' setActiveComponent' ]),
103+ ... mapActions ([
104+ ' setActiveComponent' ,
105+ ' updateComponentChildrenMultiselectValue' ,
106+ ' updateActiveComponentChildrenValue' ]),
64107 onResize : function (x , y , width , height ) {
65108 this .activeComponentData .x = x
66109 this .activeComponentData .y = y
@@ -85,6 +128,20 @@ export default {
85128 },
86129 onDeactivated () {
87130 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)
88145 }
89146 // @dblclick.native="onDoubleClick(componentData)"
90147 // onDoubleClick (compData) {
@@ -136,7 +193,6 @@ export default {
136193 border : 1px dashed rgb (227 , 203 , 71 );
137194 background-color : rgba (186 , 99 , 99 , 0.529 );
138195}
139-
140196.active {
141197 background-color : rgba (57 , 63 , 84 , 0.5 );
142198}
0 commit comments