added controls for remove and duplicate criteria

This commit is contained in:
Joel McKinnon 2020-02-20 07:23:38 -08:00
parent d425bd564c
commit fa6dd84945
3 changed files with 37 additions and 1 deletions

View File

@ -96,6 +96,7 @@
:criterion="criterion"
:index="index"
:trigger="trigger"
:is-default="domainObject.configuration.criteria.length === 1"
@persist="persist"
/>
</ul>
@ -214,7 +215,7 @@ export default {
this.domainObject.configuration.criteria.push(criteriaObject);
},
dragStart(e) {
this.$emit('set-move-index', Number(e.target.getAttribute('data-condition-index')));
this.$emit('setMoveIndex', Number(e.target.getAttribute('data-condition-index')));
},
destroy() {
if (this.conditionClass) {

View File

@ -46,6 +46,15 @@
>
</span>
</span>
<div class="temp">
<span class="is-enabled c-c__duplicate"
@click="cloneCriterion"
></span>
<span v-if="!isDefault"
class="is-enabled c-c__trash"
@click="removeCriterion"
></span>
</div>
</li>
</template>
@ -72,6 +81,10 @@ export default {
trigger: {
type: String,
required: true
},
isDefault: {
type: Boolean,
default: false
}
},
data() {
@ -91,6 +104,7 @@ export default {
mounted() {
this.updateMetadataOptions();
this.updateOperationInputVisibility();
console.log('this.isDefault', this.isDefault);
},
methods: {
updateMetadataOptions() {
@ -113,6 +127,18 @@ export default {
updateMetadataSelection() {
this.updateOperationInputVisibility();
},
removeCriterion(ev) {
console.log('removeCriterion', this.index);
// this.$emit('removeCondition', this.conditionIdentifier);
},
cloneCriterion(ev) {
console.log('cloneCriterion')
// this.$emit('cloneCondition', {
// identifier: this.conditionIdentifier,
// index: Number(ev.target.closest('.widget-condition').getAttribute('data-condition-index'))
// });
},
persist() {
this.$emit('persist', this.criterion);
}

View File

@ -197,3 +197,12 @@
border-radius: 2px;
}
}
.temp {
width: 24px;
.c-c__duplicate,
.c-c__trash {
display: inline-block;
}
}