9
9
:id =" componentData.componentName"
10
10
:x =" componentData.x"
11
11
:y =" componentData.y + 20"
12
+ :z =" componentData.z"
12
13
:w =" componentData.w"
13
14
:h =" componentData.h"
14
15
:parent =" true"
28
29
<!-- <p v-for="child in childList" :key="childList.indexOf(child)"> {{ child.text }}</p> -->
29
30
</ul >
30
31
<q-menu context-menu >
31
- <q-list class =" menu" >
32
+ <q-list color = ' black ' class =" menu" >
32
33
<q-item clickable v-ripple v-close-popup @click =" handleAddChild" >
33
34
<q-item-section style =" color : white " >Update Children</q-item-section >
34
35
<q-item-section avatar >
35
36
<q-icon color =" primary" name =" add" />
36
37
</q-item-section >
37
38
</q-item >
38
- <!-- <q-item clickable v-ripple v-close-popup auto-close>
39
- <q-item-section style="color: pink">Delete Children</q-item-section>
40
- <q-item-section avatar>
41
- <q-icon color="primary" name="delete" />
42
- </q-item-section>
43
- </q-item> -->
39
+ <q-item clickable v-ripple v-close-popup >
40
+ <q-item-section class =' layer' style =" color : pink " >Layer</q-item-section >
41
+ <q-btn class =' btn' color =' transparent' text-color =' primary' label =' -' @click =' (e)=>handleLayer(e)' />
42
+ <p id =' counter' style =" color : white " > {{componentData.z}} </p >
43
+ <q-btn class =' btn' color =' transparent' text-color =' primary' label =' +' @click =' (e)=>handleLayer(e)' />
44
+ <!-- <q-item-section avatar>
45
+ <q-icon color="primary" name="layer" />
46
+ </q-item-section> -->
47
+ </q-item >
44
48
</q-list >
45
49
</q-menu >
46
50
</VueDraggableResizable >
@@ -80,7 +84,8 @@ export default {
80
84
abilityToDelete: false ,
81
85
testOptions: [" parent" , " child" , " grandchild" ],
82
86
testModel: [],
83
- mockImg: false
87
+ mockImg: false ,
88
+ counter: 0
84
89
};
85
90
},
86
91
mounted () {
@@ -119,16 +124,37 @@ export default {
119
124
return this .componentMap [componentData .componentName ].children ;
120
125
},
121
126
options () {
127
+ const checkParents = (component , lineage = [component .componentName ]) => {
128
+ // console.log('component', component)
129
+ // component parent is an object of parents
130
+ // console.log('component parent',component.parent)
131
+ // console.log('component parent parent', component.parent.parent)
132
+ if (! Object .keys (component .parent ).length ) return lineage;
133
+ for (var parents in component .parent ){
134
+ // for each parent in our component
135
+ console .log (' parents' , parents)
136
+ lineage .push (parents); // push the parent into lineage
137
+ console .log (' lineage pre push' , component, lineage)
138
+ checkParents (component .parent [parents], lineage);
139
+ console .log (' lineage post recursive call' , lineage)
140
+ }
141
+ // lineage.push(component.parent[component.componentName]);
142
+ // return checkParents(component.parent, lineage);
143
+ return lineage
144
+ };
145
+ let lineage = [this .activeComponent ];
122
146
// PROBLEM: the objects on childrenmultiselectvalue are applied
123
147
// check to see if there are any existing children
124
148
if (this .componentMap [this .activeComponent ]) {
125
149
// console.log('active component', this.activeComponent)
126
150
// console.log('testmodel', this.testModel)
127
151
// console.log(this.componentMap[this.activeComponent].children)
128
152
this .testModel = this .componentMap [this .activeComponent ].children ;
153
+ lineage = checkParents (this .componentMap [this .activeComponent ]);
154
+ console .log (' Lineage' , lineage);
129
155
}
130
156
const routes = Object .keys (this .routes );
131
- const exceptions = new Set ([" App" , this . activeComponent , ... routes, ... this .testModel ]);
157
+ const exceptions = new Set ([" App" , ... lineage , ... routes, ... this .testModel ]);
132
158
return Object .keys (this .componentMap ).filter (component => {
133
159
if (! exceptions .has (component)) return component;
134
160
});
@@ -197,6 +223,9 @@ export default {
197
223
this .componentMap [this .activeComponent ].y = y;
198
224
this .userImage ;
199
225
},
226
+ onLayer : function (z ) {
227
+ this .activeComponentData .z = z;
228
+ },
200
229
onActivated (componentData ) {
201
230
this .$refs .boxes .forEach ((element )=> {
202
231
if (element .$attrs .id !== componentData .componentName ){
@@ -237,6 +266,23 @@ export default {
237
266
this .updateActiveComponentChildrenValue (value);
238
267
// this.updateComponentChildrenMultiselectValue(value)
239
268
},
269
+ handleLayer (e ){
270
+ e .preventDefault ()
271
+ console .log (' event object' , e .target .innerText )
272
+ console .log (' Layer handled' )
273
+
274
+ if (e .target .innerText === ' +' ){
275
+ this .counter ++ ;
276
+ // this.activeComponentData.z = z;
277
+ }
278
+ if (e .target .innerText === ' -' && this .counter > 0 ){
279
+ this .counter -- ;
280
+ }
281
+ console .log (' counter' , this .counter )
282
+ this .activeComponentData .z = this .counter ;
283
+ this .componentMap [this .activeComponent ].z = this .counter ;
284
+
285
+ },
240
286
// @dblclick.native="onDoubleClick(componentData)"
241
287
// onDoubleClick (compData) {
242
288
// this.setActiveComponent(compData.componentName)
@@ -247,11 +293,6 @@ export default {
247
293
{
248
294
this .setActiveComponent (' ' )
249
295
}
250
- // console.log(this.$children)
251
- // this.$children[1].
252
- // this.$children[1].enabled = false;
253
- // this.$children[1].$emit('deactivated')
254
- // this.$children[1].$emit('update:active', false)
255
296
}
256
297
}
257
298
};
@@ -269,6 +310,7 @@ export default {
269
310
/* width: 1rem; */
270
311
line-height : 1.2 ;
271
312
/* margin: 10px; */
313
+ z-index : 0 ;
272
314
}
273
315
.component-children {
274
316
position : absolute ;
@@ -329,4 +371,23 @@ export default {
329
371
background-color : rgba (105 , 179 , 190 , 0.514 );
330
372
border : 1px dashed rgb (227 , 203 , 71 );
331
373
}
374
+ .btn {
375
+ font-size : 25px ;
376
+ /* margin-top: 0;
377
+ margin-bottom: 0; */
378
+ padding : 0 20px ;
379
+ width : 10px ;
380
+ height : 10px ;
381
+ transition : none ;
382
+ }
383
+ .btn :hover , .btn :focus , .btn :active {
384
+ color : white ;
385
+ background-color : transparent ;
386
+ }
387
+ #counter {
388
+ margin-top : 20px ;
389
+ }
390
+ /* .layer {
391
+ padding: 0 20px;
392
+ } */
332
393
</style >
0 commit comments