Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple sections #2

Merged
merged 2 commits into from
Dec 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/components/form_elements/formbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,19 +342,19 @@ export const FormBuilder = new Vue({
}
},
methods: {
deleteElement(index) {
vm.$store.activeForm = [];
deleteElement(index, form) {
vm.$store.activeField = [];
vm.$store.activeTabForFields = "elements";
vm.$delete(vm.$store.forms, index);
vm.$delete(form, index);
},

cloneElement(index, form) {
var cloned = _.cloneDeep(form) // clone deep lodash
vm.$store.forms.splice(index, 0, cloned)
cloneElement(index, field, form) {
var cloned = _.cloneDeep(field) // clone deep lodash
form.splice(index, 0, cloned)
},

editElementProperties(form) {
vm.$store.activeForm = form;
editElementProperties(field) {
vm.$store.activeField = field;
vm.$store.activeTabForFields = "properties";
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/form_elements/properties/HtmlAdvancedProps.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template>
<el-form-item label="Html Content" v-show="activeForm.hasOwnProperty('htmlContent')">
<el-input :rows="16" type="textarea" v-model="activeForm.htmlContent">{{activeForm.htmlContent}}</el-input>
<el-form-item label="Html Content" v-show="activeField.hasOwnProperty('htmlContent')">
<el-input :rows="16" type="textarea" v-model="activeField.htmlContent">{{activeField.htmlContent}}</el-input>
</el-form-item>
</template>
<script>

export default {
name: 'HtmlAdvancedProp',
store: ['activeForm']
store: ['activeField']
}

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
<el-row>
<el-col :span="8">
<el-form-item label="Disabled">
<el-switch v-model="activeForm.disabled"></el-switch>
<el-switch v-model="activeField.disabled"></el-switch>
</el-form-item>
</el-col>

<el-col :span="8">
<el-form-item label="Step">
<el-input-number v-model="activeForm.step" controls-position="right"></el-input-number>
<el-input-number v-model="activeField.step" controls-position="right"></el-input-number>
</el-form-item>
</el-col>

<el-col :span="8">
<el-form-item label="Step Strictly">
<el-switch v-model="activeForm.stepStrictly"></el-switch>
<el-switch v-model="activeField.stepStrictly"></el-switch>
</el-form-item>
</el-col>
</el-row>
Expand All @@ -24,10 +24,10 @@
<el-form-item label="Min Value">
<el-row>
<el-col :span="6">
<el-switch v-model="activeForm.hasMinValue"></el-switch>
<el-switch v-model="activeField.hasMinValue"></el-switch>
</el-col>
<el-col :span="18">
<el-input-number v-show="activeForm.hasMinValue" v-model="activeForm.mix" controls-position="right"></el-input-number>
<el-input-number v-show="activeField.hasMinValue" v-model="activeField.mix" controls-position="right"></el-input-number>
</el-col>
</el-row>
</el-form-item>
Expand All @@ -36,10 +36,10 @@
<el-form-item label="Max Value">
<el-row>
<el-col :span="6">
<el-switch v-model="activeForm.hasMaxValue"></el-switch>
<el-switch v-model="activeField.hasMaxValue"></el-switch>
</el-col>
<el-col :span="18">
<el-input-number v-show="activeForm.hasMaxValue" v-model="activeForm.max" controls-position="right"></el-input-number>
<el-input-number v-show="activeField.hasMaxValue" v-model="activeField.max" controls-position="right"></el-input-number>
</el-col>
</el-row>
</el-form-item>
Expand All @@ -50,6 +50,6 @@
<script>
export default {
name: 'RatingAdvancedProp',
store: ['activeForm']
store: ['activeField']
}
</script>
28 changes: 14 additions & 14 deletions src/components/form_elements/properties/OptionsAdvancedProps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@
<el-row>
<el-col :span="6">
<el-form-item label="Remote Data Source">
<el-switch v-model="activeForm.isFromUrl">{{activeForm.htmlContent}}</el-switch>
<el-switch v-model="activeField.isFromUrl">{{activeField.htmlContent}}</el-switch>
</el-form-item>
</el-col>
<el-col :span="18">
<el-form-item label="Url" v-show="activeForm.isFromUrl" prop="dataUrl">
<el-input v-model="activeForm.dataUrl"></el-input>
<el-form-item label="Url" v-show="activeField.isFromUrl" prop="dataUrl">
<el-input v-model="activeField.dataUrl"></el-input>
</el-form-item>
</el-col>
</el-row>

<el-row v-show="activeForm.isFromUrl">
<el-row v-show="activeField.isFromUrl">
<el-col :span="4">
<el-form-item label="Fetch Data" v-show="activeForm.labelField">
<el-form-item label="Fetch Data" v-show="activeField.labelField">
<el-button type="success" plain @click="fetchData">Fetch Data</el-button>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="Label Field" v-show="activeForm.labelField">
<el-input v-model="activeForm.labelField"></el-input>
<el-form-item label="Label Field" v-show="activeField.labelField">
<el-input v-model="activeField.labelField"></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="Value Field" v-show="activeForm.valueField">
<el-input v-model="activeForm.valueField"></el-input>
<el-form-item label="Value Field" v-show="activeField.valueField">
<el-input v-model="activeField.valueField"></el-input>
</el-form-item>
</el-col>
</el-row>
Expand All @@ -38,12 +38,12 @@ import fetchData from '@/api/fetch-data';

export default {
name: 'SelectListAdvancedProp',
store: ['activeForm'],
store: ['activeField'],
methods: {
fetchData() {
let dataUrl = this.activeForm.dataUrl;
let valueField = this.activeForm.valueField;
let labelField = this.activeForm.labelField;
let dataUrl = this.activeField.dataUrl;
let valueField = this.activeField.valueField;
let labelField = this.activeField.labelField;
if (!dataUrl) {
this.$message.error('Url can not be empty');
return;
Expand All @@ -59,7 +59,7 @@ export default {

let promise = fetchData.fetchOptionsData(dataUrl, labelField, valueField);
promise.then((data) => {
this.activeForm.options = data;
this.activeField.options = data;
});
this.$message({
showClose: true,
Expand Down
Loading