Skip to content

Commit 4f09256

Browse files
committed
working on edit functionality
1 parent c2fba64 commit 4f09256

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

src/components/ComponentDisplay.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ export default {
131131
'activeComponent',
132132
'componentMap',
133133
'componentChildrenMultiselectValue',
134-
'imagePath'
134+
'imagePath',
135+
'activeComponentObj'
135136
]),
136137
137138
// used in VueDraggableResizeable component
@@ -377,6 +378,14 @@ export default {
377378
if (!(this.activeComponent === '')) this.setActiveComponent('')
378379
}
379380
}
381+
},
382+
watch: {
383+
activeComponentObj: {
384+
handler () {
385+
// console.log('componentMap has changed')
386+
this.value = ''
387+
}
388+
}
380389
}
381390
}
382391
</script>
@@ -462,4 +471,4 @@ export default {
462471
#counter {
463472
margin-top: 20px;
464473
}
465-
</style>
474+
</style>

src/components/HomeSideDropDownItems/ComponentList.vue

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,11 @@ export default {
6464
// console.log('component', component)
6565
return component
6666
},
67-
activeComponentData () {
67+
activeComponentData() {
6868
return this.activeComponentObj
69+
// set(name){
70+
// this.editComponentName(name)
71+
// }
6972
},
7073
options () {
7174
const val = this.activeRouteDisplay.map(component => component.componentName)
@@ -77,7 +80,8 @@ export default {
7780
...mapActions([
7881
'setActiveComponent',
7982
'deleteComponent',
80-
'deleteActiveComponent'
83+
'deleteActiveComponent',
84+
'editComponentName'
8185
]),
8286
// Set component as active component from left side dropdown
8387
// onActivated (componentData) {
@@ -106,11 +110,17 @@ export default {
106110
if (this.activeComponent !== '') {
107111
this.setActiveComponent('')
108112
}
113+
},
114+
editCompName(name){
115+
if (name) this.editComponentName(name)
116+
console.log(this.routes[this.activeRoute])
117+
console.log(this.activeComponentObj)
118+
console.log(this.activeComponent)
109119
}
110120
},
111121
watch: {
112122
activeComponentObj: function () {
113-
this.newName = this.activeComponentObj.componentName
123+
if (this.activeComponentObj) this.newName = this.activeComponentObj.componentName
114124
}
115125
}
116126
}

src/components/HomeSideDropDownItems/VuexForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Description:
5151
id="add-actions-btn"
5252
class="add-btn"
5353
color="secondary"
54-
label="Add Action(s)"
54+
label="Map Action(s)"
5555
@click="addActionToComp"
5656
/>
5757
</div>
@@ -95,7 +95,7 @@ Description:
9595
id="add-state-btn"
9696
class="add-btn"
9797
color="secondary"
98-
label="Add State"
98+
label="Map State"
9999
@click="addStateToComp"
100100
/>
101101
</div>
@@ -107,7 +107,7 @@ Description:
107107
standout="bg-secondary text-white"
108108
bottom-slots
109109
v-model="textProps"
110-
label="Create Prop in Store"
110+
label="Create Prop"
111111
dense
112112
class="input-add"
113113
>

src/store/mutations.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,14 @@ const mutations = {
170170
// *** EDIT FUNCTIONALITY *** //////////////////////////////////////////////
171171

172172
[types.EDIT_COMPONENT_NAME]: (state, payload) => {
173-
173+
// let temp = state.activeComponentObj
174+
// temp.componentName = payload
175+
let active = (state.routes[state.activeRoute].filter(comp => {
176+
return comp.componentName === state.activeComponent
177+
})[0])
178+
active.componentName = payload
179+
state.activeComponentObj = Object.assign({},
180+
state.activeComponentObj, {componentName: payload})
174181
},
175182

176183
// *** HTML ELEMENTS *** //////////////////////////////////////////////

0 commit comments

Comments
 (0)