Skip to content

Commit

Permalink
Logic Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
formsdev committed Sep 18, 2023
1 parent 08db014 commit 223af2b
Showing 1 changed file with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<template>
<collapse v-if="logic" :key="resetKey" :default-value="isCollapseOpen" @click="onClickCollapse">
<template #title>
<h3 class="font-semibold block text-lg">
Logic
</h3>
</template>
<div v-if="logic" :key="resetKey">
<h3 class="font-semibold block text-lg">
Logic
</h3>
<p class="text-gray-400 text-xs mb-3">
Add some logic to this block. Start by adding some conditions, and then add some actions.
</p>
Expand Down Expand Up @@ -65,7 +63,7 @@
</div>
</div>
</modal>
</collapse>
</div>
</template>

<script>
Expand All @@ -74,11 +72,10 @@ import ConditionEditor from './ConditionEditor.vue'
import Modal from '../../../../Modal.vue'
import SelectInput from '../../../../forms/SelectInput.vue'
import clonedeep from 'clone-deep'
import Collapse from "../../../../common/Collapse.vue";
export default {
name: 'FormBlockLogicEditor',
components: {Collapse, SelectInput, Modal, ProTag, ConditionEditor},
components: {SelectInput, Modal, ProTag, ConditionEditor},
props: {
field: {
type: Object,
Expand All @@ -92,7 +89,6 @@ export default {
data() {
return {
isCollapseOpen: false,
resetKey: 0,
logic: this.field.logic || {
conditions: null,
Expand Down Expand Up @@ -157,6 +153,15 @@ export default {
},
deep: true
},
'field.id': {
handler (field, oldField) {
// On field change, reset logic
this.logic = this.field.logic || {
conditions: null,
actions: []
}
}
},
'field.required': 'cleanConditions',
'field.disabled': 'cleanConditions',
'field.hidden': 'cleanConditions',
Expand Down Expand Up @@ -203,9 +208,6 @@ export default {
}
}
this.showCopyFormModal = false
},
onClickCollapse (e) {
this.isCollapseOpen = e
}
}
}
Expand Down

0 comments on commit 223af2b

Please sign in to comment.