11<template >
22 <div class =" component-display" >
3- <!-- <context-menu ref="component-options">
4- <context-menu-item :action="handleAddChild"><button>Add a Child</button></context-menu-item>
5- <context-menu-item><button>Delete a Child</button></context-menu-item>
6- </context-menu> -->
73 <VueDraggableResizable
84 class-name =" component-box"
95 v-for =" componentData in activeRouteArray"
1814 @dragging =" onDrag"
1915 @resizing =" onResize"
2016 @dblclick.native =" onDoubleClick(componentData)"
21- v-context-menu =" 'component-options'"
2217 >
2318 <h3 >{{ componentData.componentName }}</h3 >
2419 <q-menu context-menu >
2520 <q-list >
26- <q-item clickable v-ripple @click =" handleAddChild" >
21+ <q-item clickable v-ripple v-close-popup @click =" handleAddChild" >
2722 <q-item-section >Add Children</q-item-section >
2823 <q-item-section avatar ><q-icon color =" primary" name =" add" /></q-item-section >
2924 </q-item >
30- <q-item clickable v-ripple >
25+ <q-item clickable v-ripple v-close-popup auto-close >
3126 <q-item-section >Delete Children</q-item-section >
3227 <q-item-section avatar ><q-icon color =" primary" name =" delete" /></q-item-section >
3328 </q-item >
3429 </q-list >
3530 </q-menu >
3631 </VueDraggableResizable >
37- <q-dialog id =" select-child-modal" v-model =" modalOpen" >
38- <ChildrenMultiselect />
39- </q-dialog >
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 "
45+ />
46+ </q-dialog >
47+ </div >
4048 </div >
4149</template >
4250<script >
4351import { mapState , mapActions } from ' vuex'
4452import VueDraggableResizable from ' vue-draggable-resizable'
45- import ChildrenMultiselect from ' ../components/ChildrenMultiselect'
53+ // import ChildrenMultiselect from '../components/ChildrenMultiselect'
4654import ' vue-draggable-resizable/dist/VueDraggableResizable.css'
4755
4856export default {
4957 name: ' ComponentDisplay' ,
5058 components: {
51- VueDraggableResizable,
52- ChildrenMultiselect
59+ VueDraggableResizable
5360 },
5461 data () {
5562 return {
5663 modalOpen: false ,
57- abilityToDelete: false
64+ abilityToDelete: false ,
65+ testOptions: [' parent' , ' child' , ' grandchild' ],
66+ testModel: []
5867 }
5968 },
6069 mounted () {
@@ -68,7 +77,7 @@ export default {
6877 })
6978 },
7079 computed: {
71- ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' ]),
80+ ... mapState ([' routes' , ' activeRoute' , ' activeComponent' , ' componentMap' , ' componentChildrenMultiselectValue ' ]),
7281 // used in VueDraggableResizeable component
7382 activeRouteArray () {
7483 // console.log('active route array method', this.routes[this.activeRoute])
@@ -80,10 +89,21 @@ export default {
8089 return this .activeRouteArray .filter (componentData => {
8190 return componentData .componentName === this .activeComponent
8291 })[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+ })
83100 }
84101 },
85102 methods: {
86- ... mapActions ([' setActiveComponent' ]),
103+ ... mapActions ([
104+ ' setActiveComponent' ,
105+ ' updateComponentChildrenMultiselectValue' ,
106+ ' updateActiveComponentChildrenValue' ]),
87107 onResize : function (x , y , width , height ) {
88108 this .activeComponentData .x = x
89109 this .activeComponentData .y = y
@@ -108,6 +128,12 @@ export default {
108128 handleAddChild () {
109129 // render modal with childrenmultiselect in it
110130 this .modalOpen = true
131+ },
132+ handleSelect (value ) {
133+ // if (this.modalOpen) this.updateActiveComponentChildrenValue(value)
134+ console .log (' Multiselect: ' , value)
135+ this .updateActiveComponentChildrenValue (value)
136+ // this.updateComponentChildrenMultiselectValue(value)
111137 }
112138 // @dblclick.native="onDoubleClick(componentData)"
113139 // onDoubleClick (compData) {
@@ -155,11 +181,10 @@ export default {
155181
156182.component-box {
157183 color : white ;
158- border : 3 px dashed rgb (227 , 203 , 71 );
184+ border : 1 px dashed rgb (227 , 203 , 71 );
159185 background-color : rgba (186 , 99 , 99 , 0.529 );
160186}
161-
162- .select-child-modal {
163- background-color : red ;
187+ .active {
188+ background-color : rgba (57 , 63 , 84 , 0.5 );
164189}
165190 </style >
0 commit comments