@@ -49,6 +49,21 @@ Description:
49
49
<q-btn id =" deleteButton" @click =" deleteSelectedComp(activeComponentData)" label = ' Delete currently selected' />
50
50
<div v-if =" this.activeComponentData" >
51
51
<br />
52
+ <!-- @input="selectParent"
53
+ @open="resetActiveComponent" -->
54
+ <multiselect
55
+ v-model =" testModel"
56
+ placeholder =" Add/Remove Children"
57
+ :multiple =" true"
58
+ :close-on-select =" false"
59
+ :options =" childOptions"
60
+ @input =" handleAddChild"
61
+ :max-height =" 90"
62
+ :option-height =" 20"
63
+ :searchable =" false"
64
+ />
65
+ <br />
66
+
52
67
<section id =" counter" style =" color : white " > Layer:
53
68
<q-btn
54
69
class =" btn"
@@ -66,14 +81,18 @@ Description:
66
81
@click =" e => handleLayer(e)"
67
82
/>
68
83
</section >
69
- <br />
84
+ <br />
70
85
<p > Toggle to edit: </p >
71
- <section class =" toggleText" > HTML elements
72
- <toggle-button v-model =" showHTML" /> </section >
86
+ <div class =" toggleRow" >
87
+ <section class =" toggleText" > HTML elements</section >
88
+ <toggle-button v-model =" showHTML" class =" toggle" />
89
+ </div >
73
90
<HTMLQueue v-if =" showHTML" />
74
91
<br />
75
- <section class =" toggleText" > State
76
- <toggle-button v-model =" showState" /> </section >
92
+ <div class =" toggleRow" >
93
+ <section class =" toggleText" > State</section >
94
+ <toggle-button v-model =" showState" class =" toggle" />
95
+ </div >
77
96
<hr v-if =" showState" >
78
97
<a
79
98
v-for =" s in this.activeComponentData.state"
@@ -93,8 +112,10 @@ Description:
93
112
</q-list >
94
113
</a >
95
114
<br />
96
- <section class =" toggleText" > Actions
97
- <toggle-button v-model =" showActions" /> </section >
115
+ <div class =" toggleRow" >
116
+ <section class =" toggleText" > Actions</section >
117
+ <toggle-button v-model =" showActions" class =" toggle" />
118
+ </div >
98
119
<hr v-if =" showActions" >
99
120
<a
100
121
v-for =" action in this.activeComponentData.actions"
@@ -114,9 +135,10 @@ Description:
114
135
</q-list >
115
136
</a >
116
137
<br />
117
- <section class =" toggleText" >
118
- Props
119
- <toggle-button v-model =" showProps" /> </section >
138
+ <div class =" toggleRow" >
139
+ <section class =" toggleText" >Props </section >
140
+ <toggle-button v-model =" showProps" class =" toggle" justify =' end' />
141
+ </div >
120
142
<hr v-if =" showProps" >
121
143
<a
122
144
v-for =" prop in this.activeComponentData.props"
@@ -152,6 +174,7 @@ export default {
152
174
data () {
153
175
return {
154
176
value: ' ' ,
177
+ testModel: [],
155
178
newName: ' ' ,
156
179
showState: false ,
157
180
showActions: false ,
@@ -185,8 +208,40 @@ export default {
185
208
(component ) => component .componentName
186
209
)
187
210
return val
211
+ },
212
+
213
+ childOptions () {
214
+ // checks if component has any parents and pushes them into lineage
215
+ const checkParents = (component , lineage = [component .componentName ]) => {
216
+ if (! Object .keys (component .parent ).length ) return lineage
217
+ for (var parents in component .parent ) {
218
+ lineage .push (parents)
219
+ checkParents (component .parent [parents], lineage)
220
+ }
221
+ return lineage
222
+ }
223
+ let lineage = [this .activeComponent ]
224
+ // checks to see if there are any existing children
225
+ if (this .componentMap [this .activeComponent ]) {
226
+ // console.log('testmodel', this.testModel)
227
+ // console.log(this.componentMap[this.activeComponent].children)
228
+ this .testModel = this .componentMap [this .activeComponent ].children
229
+ lineage = checkParents (this .componentMap [this .activeComponent ])
230
+ // console.log('Lineage', lineage);
231
+ }
232
+ const routes = Object .keys (this .routes )
233
+ const exceptions = new Set ([
234
+ ' App' ,
235
+ ... lineage,
236
+ ... routes,
237
+ ... this .testModel
238
+ ])
239
+ return Object .keys (this .componentMap ).filter (component => {
240
+ if (! exceptions .has (component)) return component
241
+ })
188
242
}
189
243
},
244
+
190
245
methods: {
191
246
... mapActions ([
192
247
' setActiveComponent' ,
@@ -196,9 +251,15 @@ export default {
196
251
' deleteActionFromComponent' ,
197
252
' deletePropsFromComponent' ,
198
253
' deleteStateFromComponent' ,
199
- ' updateComponentLayer'
254
+ ' updateComponentLayer' ,
255
+ ' updateActiveComponentChildrenValue'
200
256
]),
201
257
258
+ handleAddChild (value ) {
259
+ // console.log('selected child component: ', value)
260
+ this .updateActiveComponentChildrenValue (value)
261
+ },
262
+
202
263
// delete selected state from active component
203
264
deleteState (state ) {
204
265
this .deleteStateFromComponent (state)
@@ -279,6 +340,12 @@ export default {
279
340
</script >
280
341
281
342
<style >
343
+
344
+ .toggleRow {
345
+ display : flex ;
346
+ /* align-items: center; */
347
+ justify-content : space-between ;
348
+ }
282
349
/* modifies entire container */
283
350
.edit-sidebar {
284
351
padding : 0.5rem ;
314
381
color : white ;
315
382
}
316
383
384
+ .toggle {
385
+ align-self : flex-end ;
386
+ }
387
+
317
388
.editName {
318
389
color : white ;
319
390
}
0 commit comments