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