Commit 09fbb326 authored by Yoran Hillion's avatar Yoran Hillion
Browse files

️ (formbuilder) : Handles excluded controls with provide/inject

parent 784d5253
{
"name": "@vue-unistra/unistra-formbuilder",
"version": "2.0.10-test",
"version": "2.0.11-test",
"main": "dist/index.js",
"files": [
"dist/*",
......
......@@ -52,10 +52,10 @@ export default {
required: false,
default: () => [],
},
controls: {
type: Object,
excludedControls: {
type: Array,
required: false,
default: () => ({}),
default: () => [],
},
fields: {
type: Array,
......@@ -122,6 +122,12 @@ export default {
},
},
provide: function() {
return {
excludedControls: this.excludedControls,
};
},
data: () => ({
settingsModal: false,
modalContext: {
......@@ -162,12 +168,12 @@ export default {
this.$store.dispatch('formBuilder/controls/setAdmin', value);
},
},
controls: {
immediate: true,
handler(value) {
this.$store.dispatch('formBuilder/controls/setControls', value);
},
},
// controls: {
// immediate: true,
// handler(value) {
// this.$store.dispatch('formBuilder/controls/setControls', value);
// },
// },
},
methods:{
......
......@@ -11,7 +11,7 @@
:sort="draggable.sort"
:clone="clone"
@end="atEnd">
<usf-control v-for="control in controlsGroup.controls"
<usf-control v-for="control in controls"
:key="control"
:control-id="control">
</usf-control>
......@@ -36,6 +36,7 @@ export default {
draggable,
UsfControl,
},
inject: ['excludedControls'],
data: () => ({
draggable: {
group: {
......@@ -53,6 +54,9 @@ export default {
controlsGroup() {
return this.$store.getters['formBuilder/controls/getControlsGroupById'](this.group);
},
controls() {
return this.controlsGroup.controls.filter((control) => !this.excludedControls.includes(control));
},
},
methods: {
getControl(controlId) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment