Add block shortcut (#200)
* Add block shortcut * Add block shortcut * Add block modal as sidebar * add block sidebar UI changes * Clean spacing add form block sidebar --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
28
resources/js/store/modules/open/working_form.js
vendored
28
resources/js/store/modules/open/working_form.js
vendored
@@ -6,7 +6,8 @@ export const state = {
|
||||
|
||||
// Field being edited
|
||||
selectedFieldIndex: null,
|
||||
showEditFieldSidebar: null
|
||||
showEditFieldSidebar: null,
|
||||
showAddFieldSidebar: null
|
||||
}
|
||||
|
||||
// mutations
|
||||
@@ -24,12 +25,25 @@ export const mutations = {
|
||||
}
|
||||
state.selectedFieldIndex = index
|
||||
state.showEditFieldSidebar = true
|
||||
},
|
||||
setSelectedFieldIndex (state, index) {
|
||||
state.selectedFieldIndex = index
|
||||
},
|
||||
state.showAddFieldSidebar = false
|
||||
},
|
||||
closeEditFieldSidebar (state) {
|
||||
state.showEditFieldSidebar = false
|
||||
state.selectedFieldIndex = null
|
||||
}
|
||||
state.showEditFieldSidebar = false
|
||||
state.showAddFieldSidebar = false
|
||||
},
|
||||
openAddFieldSidebar (state, index) {
|
||||
// If field is passed, compute index
|
||||
if (index !== null && typeof index === 'object') {
|
||||
index = state.content.properties.findIndex(prop => prop.id === index.id)
|
||||
}
|
||||
state.selectedFieldIndex = index
|
||||
state.showAddFieldSidebar = true
|
||||
state.showEditFieldSidebar = false
|
||||
},
|
||||
closeAddFieldSidebar (state) {
|
||||
state.selectedFieldIndex = null
|
||||
state.showAddFieldSidebar = false
|
||||
state.showEditFieldSidebar = false
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user