Skip to content

Commit 4881e72

Browse files
Shanon LeeShanon Lee
authored andcommitted
Fix ParentMultiselect.vue to allow children to be added properly; exports checked & OK
1 parent 3dd2895 commit 4881e72

File tree

6 files changed

+39
-18
lines changed

6 files changed

+39
-18
lines changed

src/components/ComponentDisplay.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,11 @@ export default {
212212
},
213213
},
214214
updated() {
215-
// console.log(this.$refs.boxes);
216215
// if there are no active components, all boxes are unhighlighted
217216
if (this.activeComponent === "") {
218217
if (this.$refs.boxes) {
219218
this.$refs.boxes.forEach((element) => {
220219
element.enabled = false;
221-
222220
element.$emit("deactivated");
223221
element.$emit("update:active", false);
224222
// this.$emit("deactivated");
@@ -229,8 +227,6 @@ export default {
229227
// if a component is set to active, highlight it
230228
this.$refs.boxes.forEach((element) => {
231229
if (
232-
// this.activeComponent === element.$attrs.id &&
233-
// element.enabled === false
234230
this.activeComponent === element.$attrs.id &&
235231
element.enabled === false
236232
) {
@@ -353,9 +349,10 @@ export default {
353349
this.setActiveComponent(componentData.componentName);
354350
}
355351
this.activeComponentData.isActive = true;
352+
356353
},
357354
// deactivated is emitted before activated
358-
onDeactivated(type) {
355+
onDeactivated() {
359356
// console.log("This is DEACTIVATED");
360357
if (this.activeComponent !== "") {
361358
this.activeComponentData.isActive = false;
@@ -401,7 +398,7 @@ export default {
401398
if (this.activeComponent) {
402399
this.onActivated(this.activeComponentObj);
403400
} else {
404-
this.onDeactivated("bgClick");
401+
this.onDeactivated();
405402
}
406403
},
407404
},

src/components/dashboard_items/CodeSnippet.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ export default {
164164
},
165165
// Creates boiler text for <script> and <style>
166166
createBoiler (componentName, children) {
167+
console.log('CreateBoiler componentName: ' + componentName)
168+
console.log('CreateBoiler children: ' + children)
167169
// add import mapstate and mapactions if they exist
168170
let imports = ''
169171
if (
@@ -248,7 +250,7 @@ export default {
248250
}
249251
},
250252
watch: {
251-
// watches activeComponentObj for changes to make it reactive upon mutation
253+
// // watches activeComponentObj for changes to make it reactive upon mutation
252254
// activeComponentObj: {
253255
// handler () {
254256
// // console.log(this.activeComponentObj.children)
@@ -258,7 +260,7 @@ export default {
258260
// )
259261
// }
260262
// },
261-
// watches componentMap for changes to make it reactive upon mutation
263+
// // // // watches componentMap for changes to make it reactive upon mutation
262264
// componentMap: {
263265
// handler () {
264266
// this.code = this.createCodeSnippet(
@@ -304,7 +306,7 @@ export default {
304306
// }
305307
// }
306308
// },
307-
// If HTML elements or components are added, rerenders Code Snippet
309+
// // If HTML elements or components are added, rerenders Code Snippet
308310
// componentMap: {
309311
// deep: true,
310312
// handler () {

src/components/file_system_interface/ExportProject.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export default {
270270
}
271271
// concat all code within script tags
272272
let output = "\n\n<script>\n";
273-
output += imports + "\nexport default {\n name: " + componentName;
273+
output += imports + "\nexport default {\n name: '" + componentName + "\'";
274274
output += ",\n components: {\n";
275275
output += childrenComponentNames + " },\n";
276276
output += data;

src/components/home_sidebar_items/ComponentTab/EditDeleteComponents.vue

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Description:
3939
:multiple="false"
4040
:close-on-select="true"
4141
:options="childOptions"
42-
@input="handleAddChild"
42+
@select="handleAddChild"
4343
:max-height="90"
4444
:option-height="20"
4545
:searchable="false"
@@ -130,7 +130,7 @@ Description:
130130
:close-on-select="true"
131131
:max-height="90"
132132
:option-height="20"
133-
@input="handleSelect(value)"
133+
@select="handleSelect"
134134
placeholder="Select/Search component"
135135
>
136136
<span slot="noResult">No components found.</span>
@@ -150,6 +150,7 @@ import Icons from "../Icons.vue";
150150
import AddProps from "./AddProps.vue";
151151
import ComponentState from "./ComponentState.vue";
152152
import ComponentActions from "./ComponentActions.vue";
153+
const cloneDeep = require("lodash.clonedeep");
153154
154155
export default {
155156
data() {
@@ -189,7 +190,8 @@ export default {
189190
},
190191
191192
activeComponentData() {
192-
return this.activeComponentObj;
193+
return cloneDeep(this.activeComponentObj);
194+
// return this.activeComponentObj;
193195
},
194196
195197
// returns options for component multiselect
@@ -251,8 +253,9 @@ export default {
251253
]),
252254
253255
handleAddChild(value) {
254-
console.log('selected child component: ', value)
255-
this.updateActiveComponentChildrenValue(value);
256+
const valueArray = [value];
257+
this.updateActiveComponentChildrenValue(valueArray);
258+
// this.updateActiveComponentChildrenValue(value);
256259
},
257260
258261
// delete selected state from active component
@@ -274,8 +277,11 @@ export default {
274277
// },
275278
// Set component as active component from left side dropdown
276279
onActivated(componentData) {
277-
this.setActiveComponent(componentData.componentName);
278-
this.activeComponentData.isActive = true;
280+
if (componentData) {
281+
this.setActiveComponent(componentData.componentName);
282+
this.activeComponentData.isActive = true;
283+
console.log('onActivated Triggered')
284+
}
279285
},
280286
//
281287
// deleteCircumvent (e) {
@@ -306,6 +312,7 @@ export default {
306312
307313
// Select active component from multi-select input
308314
handleSelect(componentName) {
315+
console.log('handleSelect ' + componentName)
309316
this.setActiveComponent(componentName);
310317
this.value = "";
311318
this.activeComponentData.isActive = true;

src/components/home_sidebar_items/ParentMultiselect.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Description:
77
<template>
88
<div id="parent-select">
99
<br />
10-
<VueMultiselect
10+
<!-- <VueMultiselect
1111
v-model="value"
1212
placeholder="Parent Component"
1313
:multiple="false"
@@ -18,6 +18,18 @@ Description:
1818
:max-height="90"
1919
:option-height="20"
2020
:searchable="true"
21+
> -->
22+
<VueMultiselect
23+
v-model="value"
24+
placeholder="Parent Component"
25+
:multiple="false"
26+
:close-on-select="true"
27+
:options="options"
28+
@select="selectParent"
29+
@open="resetActiveComponent"
30+
:max-height="90"
31+
:option-height="20"
32+
:searchable="true"
2133
>
2234
<!-- refactor slot syntax here -->
2335
<span slot='noResult'>No components found.</span>
@@ -55,7 +67,9 @@ export default {
5567
methods: {
5668
...mapActions(['parentSelected', 'setActiveComponent']),
5769
selectParent (value) {
70+
// console.log('Select parent triggered with value: ' + value)
5871
this.parentSelected(value);
72+
// console.log('Parent selected: ' + this.$store.state.parentSelected)
5973
},
6074
// when multiselect is opened activeComponent is deselected to allow for parentSelected action
6175
resetActiveComponent () {

src/store/actions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const actions = {
5454
[types.setActiveComponent]: ({ commit }, payload) => {
5555
commit(types.SET_ACTIVE_COMPONENT, payload)
5656
},
57+
5758

5859
[types.updateActiveComponentChildrenValue]: ({ commit }, payload) => {
5960
// console.log('payload', payload)

0 commit comments

Comments
 (0)