Disables comparator dropdown if only one option is available. #886.
This commit is contained in:
parent
161fc5cc9f
commit
658789e2bb
|
@ -12,7 +12,8 @@
|
|||
v-for="(comparatorObject, comparatorKey) in comparatorsObject"
|
||||
:key="comparatorKey"
|
||||
v-model="comparators"
|
||||
:native-value="comparatorObject.key"
|
||||
:native-value="comparatorKey"
|
||||
:disabled="comparators.indexOf(comparatorKey) >= 0 && comparators.length <= 1"
|
||||
name="metadata_type_relationship[display_related_item_metadata]"
|
||||
@update:model-value="emitValues()">
|
||||
<span v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
||||
|
@ -33,7 +34,8 @@
|
|||
],
|
||||
data() {
|
||||
return {
|
||||
comparatorsObject: Object
|
||||
comparatorsObject: Object,
|
||||
comparators: Array
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -72,8 +74,9 @@
|
|||
};
|
||||
},
|
||||
methods: {
|
||||
onUpdateComparators(value) {
|
||||
this.$emit('update:model-value', { comparators: value });
|
||||
emitValues() {
|
||||
console.log(this.comparators)
|
||||
this.$emit('update:model-value', { comparators: this.comparators });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div class="date-filter-container">
|
||||
<b-dropdown
|
||||
v-if="filterTypeOptions.comparators.length > 1"
|
||||
:mobile-modal="true"
|
||||
aria-role="list"
|
||||
trap-focus
|
||||
|
@ -138,6 +139,7 @@
|
|||
enabled: this.filterTypeOptions.comparators.indexOf('<=') < 0 ? 'no' : 'yes'
|
||||
},
|
||||
};
|
||||
this.comparator = this.filterTypeOptions.comparators[0];
|
||||
},
|
||||
mounted() {
|
||||
this.updateSelectedValues();
|
||||
|
|
Loading…
Reference in New Issue