7
7
:key =" componentData.componentName"
8
8
:x =" componentData.x"
9
9
:y =" componentData.y + 20"
10
+ :z =" componentData.z"
10
11
:w =" componentData.w"
11
12
:h =" componentData.h"
12
13
:parent =" true"
25
26
<!-- <p v-for="child in childList" :key="childList.indexOf(child)"> {{ child.text }}</p> -->
26
27
</ul >
27
28
<q-menu context-menu >
28
- <q-list class =" menu" >
29
+ <q-list color = ' black ' class =" menu" >
29
30
<q-item clickable v-ripple v-close-popup @click =" handleAddChild" >
30
31
<q-item-section style =" color : white " >Update Children</q-item-section >
31
32
<q-item-section avatar >
32
33
<q-icon color =" primary" name =" add" />
33
34
</q-item-section >
34
35
</q-item >
35
- <!-- <q-item clickable v-ripple v-close-popup auto-close>
36
- <q-item-section style="color: pink">Delete Children</q-item-section>
37
- <q-item-section avatar>
38
- <q-icon color="primary" name="delete" />
39
- </q-item-section>
40
- </q-item> -->
36
+ <q-item clickable v-ripple v-close-popup >
37
+ <q-item-section class =' layer' style =" color : pink " >Layer</q-item-section >
38
+ <q-btn class =' btn' color =' transparent' text-color =' primary' label =' -' @click =' (e)=>handleLayer(e)' />
39
+ <p id =' counter' style =" color : white " > {{componentData.z}} </p >
40
+ <q-btn class =' btn' color =' transparent' text-color =' primary' label =' +' @click =' (e)=>handleLayer(e)' />
41
+ <!-- <q-item-section avatar>
42
+ <q-icon color="primary" name="layer" />
43
+ </q-item-section> -->
44
+ </q-item >
41
45
</q-list >
42
46
</q-menu >
43
47
</VueDraggableResizable >
@@ -77,7 +81,8 @@ export default {
77
81
abilityToDelete: false ,
78
82
testOptions: [" parent" , " child" , " grandchild" ],
79
83
testModel: [],
80
- mockImg: false
84
+ mockImg: false ,
85
+ counter: 0
81
86
};
82
87
},
83
88
mounted () {
@@ -116,16 +121,37 @@ export default {
116
121
return this .componentMap [componentData .componentName ].children ;
117
122
},
118
123
options () {
124
+ const checkParents = (component , lineage = [component .componentName ]) => {
125
+ // console.log('component', component)
126
+ // component parent is an object of parents
127
+ // console.log('component parent',component.parent)
128
+ // console.log('component parent parent', component.parent.parent)
129
+ if (! Object .keys (component .parent ).length ) return lineage;
130
+ for (var parents in component .parent ){
131
+ // for each parent in our component
132
+ console .log (' parents' , parents)
133
+ lineage .push (parents); // push the parent into lineage
134
+ console .log (' lineage pre push' , component, lineage)
135
+ checkParents (component .parent [parents], lineage);
136
+ console .log (' lineage post recursive call' , lineage)
137
+ }
138
+ // lineage.push(component.parent[component.componentName]);
139
+ // return checkParents(component.parent, lineage);
140
+ return lineage
141
+ };
142
+ let lineage = [this .activeComponent ];
119
143
// PROBLEM: the objects on childrenmultiselectvalue are applied
120
144
// check to see if there are any existing children
121
145
if (this .componentMap [this .activeComponent ]) {
122
146
// console.log('active component', this.activeComponent)
123
147
// console.log('testmodel', this.testModel)
124
148
// console.log(this.componentMap[this.activeComponent].children)
125
149
this .testModel = this .componentMap [this .activeComponent ].children ;
150
+ lineage = checkParents (this .componentMap [this .activeComponent ]);
151
+ console .log (' Lineage' , lineage);
126
152
}
127
153
const routes = Object .keys (this .routes );
128
- const exceptions = new Set ([" App" , this . activeComponent , ... routes, ... this .testModel ]);
154
+ const exceptions = new Set ([" App" , ... lineage , ... routes, ... this .testModel ]);
129
155
return Object .keys (this .componentMap ).filter (component => {
130
156
if (! exceptions .has (component)) return component;
131
157
});
@@ -170,6 +196,9 @@ export default {
170
196
this .componentMap [this .activeComponent ].y = y;
171
197
this .userImage ;
172
198
},
199
+ onLayer : function (z ) {
200
+ this .activeComponentData .z = z;
201
+ },
173
202
onActivated (componentData ) {
174
203
this .setActiveComponent (componentData .componentName );
175
204
this .activeComponentData .isActive = true ;
@@ -190,6 +219,23 @@ export default {
190
219
console .log (" Multiselect: " , value);
191
220
this .updateActiveComponentChildrenValue (value);
192
221
// this.updateComponentChildrenMultiselectValue(value)
222
+ },
223
+ handleLayer (e ){
224
+ e .preventDefault ()
225
+ console .log (' event object' , e .target .innerText )
226
+ console .log (' Layer handled' )
227
+
228
+ if (e .target .innerText === ' +' ){
229
+ this .counter ++ ;
230
+ // this.activeComponentData.z = z;
231
+ }
232
+ if (e .target .innerText === ' -' && this .counter > 0 ){
233
+ this .counter -- ;
234
+ }
235
+ console .log (' counter' , this .counter )
236
+ this .activeComponentData .z = this .counter ;
237
+ this .componentMap [this .activeComponent ].z = this .counter ;
238
+
193
239
}
194
240
// @dblclick.native="onDoubleClick(componentData)"
195
241
// onDoubleClick (compData) {
@@ -212,6 +258,7 @@ export default {
212
258
/* width: 1rem; */
213
259
line-height : 1.2 ;
214
260
/* margin: 10px; */
261
+ z-index : 0 ;
215
262
}
216
263
.component-children {
217
264
position : absolute ;
@@ -272,4 +319,23 @@ export default {
272
319
background-color : rgba (105 , 179 , 190 , 0.514 );
273
320
border : 1px dashed rgb (227 , 203 , 71 );
274
321
}
322
+ .btn {
323
+ font-size : 25px ;
324
+ /* margin-top: 0;
325
+ margin-bottom: 0; */
326
+ padding : 0 20px ;
327
+ width : 10px ;
328
+ height : 10px ;
329
+ transition : none ;
330
+ }
331
+ .btn :hover , .btn :focus , .btn :active {
332
+ color : white ;
333
+ background-color : transparent ;
334
+ }
335
+ #counter {
336
+ margin-top : 20px ;
337
+ }
338
+ /* .layer {
339
+ padding: 0 20px;
340
+ } */
275
341
</style >
0 commit comments