On Form Preview field's modal & drag (#159)

* On Form Preview field's modal & drag

* fix typo

* remove extra code

* fix page break
This commit is contained in:
formsdev
2023-08-16 14:14:52 +05:30
committed by GitHub
parent 7e75343495
commit 11ad626a72
7 changed files with 395 additions and 199 deletions

View File

@@ -2,12 +2,37 @@ export const namespaced = true
// state
export const state = {
content: null
content: null,
// Field being edited
selectedFieldIndex: null,
showEditFieldModal: null
}
// mutations
export const mutations = {
set (state, form) {
state.content = form
},
setProperties (state, properties) {
state.content.properties = properties
},
openSettingsForField (state, index) {
// If field is passed, compute index
if (typeof index === 'object') {
index = state.content.properties.findIndex(prop => prop.id === index.id)
}
state.selectedFieldIndex = index
state.showEditFieldModal = true
},
setSelectedFieldIndex (state, index) {
state.selectedFieldIndex = index
},
openEditFieldModal (state) {
state.showEditFieldModal = true
},
closeEditFieldModal (state) {
state.showEditFieldModal = false
this.selectedFieldIndex = null
}
}