Basic logic for intersection filters without range by now. #887.
This commit is contained in:
parent
cd15cd1b78
commit
0ff12f3b67
|
@ -6,9 +6,11 @@
|
||||||
:message="metadataMessage">
|
:message="metadataMessage">
|
||||||
<label class="label is-inline">
|
<label class="label is-inline">
|
||||||
{{ $i18n.getHelperTitle('tainacan-filter-dates-intersection', 'secondary_filter_metadatum_id') }}<span :class="metadataType"> * </span>
|
{{ $i18n.getHelperTitle('tainacan-filter-dates-intersection', 'secondary_filter_metadatum_id') }}<span :class="metadataType"> * </span>
|
||||||
<help-button
|
<span style="font-size: 1.35em;">
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'secondary_filter_metadatum_id')"
|
<help-button
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-dates-intersection', 'secondary_filter_metadatum_id')" />
|
:title="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'secondary_filter_metadatum_id')"
|
||||||
|
:message="$i18n.getHelperMessage('tainacan-filter-dates-intersection', 'secondary_filter_metadatum_id')" />
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<b-select
|
<b-select
|
||||||
v-model="secondDateMetadatumId"
|
v-model="secondDateMetadatumId"
|
||||||
|
@ -29,17 +31,22 @@
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<div style="column-count: 2;">
|
<fieldset
|
||||||
|
v-if="secondDateMetadatumId"
|
||||||
|
class="intersection-explainer-section">
|
||||||
|
<legend>
|
||||||
|
<p>
|
||||||
|
<strong>{{ $i18n.get('info_intersection_explainer') }}</strong>
|
||||||
|
<span style="font-size: 1.35em;">
|
||||||
|
<help-button
|
||||||
|
:title="$i18n.get('label_comparators')"
|
||||||
|
:message="$i18n.get('info_intersection_rules')" />
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</legend>
|
||||||
<b-field :addons="false">
|
<b-field :addons="false">
|
||||||
<label
|
|
||||||
style="line-height: normal;"
|
|
||||||
class="label is-inline">
|
|
||||||
{{ $i18n.getHelperTitle('tainacan-filter-dates-intersection', 'first_comparator') }}<span> * </span>
|
|
||||||
<help-button
|
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'first_comparator')"
|
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-dates-intersection', 'first_comparator')" />
|
|
||||||
</label>
|
|
||||||
<b-select
|
<b-select
|
||||||
|
v-if="showEditFirstComparatorOptions"
|
||||||
v-model="firstComparator"
|
v-model="firstComparator"
|
||||||
@update:model-value="emitValues()">
|
@update:model-value="emitValues()">
|
||||||
<option
|
<option
|
||||||
|
@ -48,17 +55,50 @@
|
||||||
:value="comparatorKey"
|
:value="comparatorKey"
|
||||||
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
||||||
</b-select>
|
</b-select>
|
||||||
|
<strong
|
||||||
|
v-else
|
||||||
|
v-html="comparatorsObject[firstComparator].symbol" />
|
||||||
|
<p v-if="filter.metadatum">
|
||||||
|
|
||||||
|
<em>{{ filter.metadatum.metadatum_name }}</em>
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
v-if="!showEditFirstComparatorOptions"
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditFirstComparatorOptions = true">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('edit'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-edit has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditFirstComparatorOptions = false">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('close'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-approved has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
<div class="logic-divider">
|
||||||
|
<span>{{ $i18n.get('label_and') }}</span>
|
||||||
|
</div>
|
||||||
<b-field :addons="false">
|
<b-field :addons="false">
|
||||||
<label
|
|
||||||
style="line-height: normal;"
|
|
||||||
class="label is-inline">
|
|
||||||
{{ $i18n.getHelperTitle('tainacan-filter-dates-intersection', 'second_comparator') }}<span> * </span>
|
|
||||||
<help-button
|
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'second_comparator')"
|
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-dates-intersection', 'second_comparator')" />
|
|
||||||
</label>
|
|
||||||
<b-select
|
<b-select
|
||||||
|
v-if="showEditSecondComparatorOptions"
|
||||||
v-model="secondComparator"
|
v-model="secondComparator"
|
||||||
@update:model-value="emitValues()">
|
@update:model-value="emitValues()">
|
||||||
<option
|
<option
|
||||||
|
@ -67,9 +107,44 @@
|
||||||
:value="comparatorKey"
|
:value="comparatorKey"
|
||||||
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
||||||
</b-select>
|
</b-select>
|
||||||
|
<strong
|
||||||
|
v-else
|
||||||
|
v-html="comparatorsObject[secondComparator].symbol" />
|
||||||
|
<p> <em>{{ secondDateMetadatumName }}</em></p>
|
||||||
|
<button
|
||||||
|
v-if="!showEditSecondComparatorOptions"
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditSecondComparatorOptions = true">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('edit'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-edit has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditSecondComparatorOptions = false">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('close'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-approved has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</fieldset>
|
||||||
<b-field
|
<!-- Much more complicated logic, will be possible if we implement #889 -->
|
||||||
|
<!-- <b-field
|
||||||
:addons="false"
|
:addons="false"
|
||||||
:label="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'accept_date_interval')"
|
:label="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'accept_date_interval')"
|
||||||
style="margin-top: 1.125rem;"
|
style="margin-top: 1.125rem;"
|
||||||
|
@ -88,7 +163,7 @@
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'accept_date_interval')"
|
:title="$i18n.getHelperTitle('tainacan-filter-dates-intersection', 'accept_date_interval')"
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-dates-intersection', 'accept_date_interval')" />
|
:message="$i18n.getHelperMessage('tainacan-filter-dates-intersection', 'accept_date_interval')" />
|
||||||
</b-switch>
|
</b-switch>
|
||||||
</b-field>
|
</b-field> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -115,7 +190,9 @@
|
||||||
firstComparator: String,
|
firstComparator: String,
|
||||||
secondComparator: String,
|
secondComparator: String,
|
||||||
comparatorsObject: {},
|
comparatorsObject: {},
|
||||||
acceptDateInterval: String
|
acceptDateInterval: String,
|
||||||
|
showEditFirstComparatorOptions: false,
|
||||||
|
showEditSecondComparatorOptions: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -132,7 +209,7 @@
|
||||||
this.firstComparator = this.modelValue && this.modelValue.first_comparator ? this.modelValue.first_comparator : '>=';
|
this.firstComparator = this.modelValue && this.modelValue.first_comparator ? this.modelValue.first_comparator : '>=';
|
||||||
this.secondComparator = this.modelValue && this.modelValue.second_comparator ? this.modelValue.second_comparator : '<=';
|
this.secondComparator = this.modelValue && this.modelValue.second_comparator ? this.modelValue.second_comparator : '<=';
|
||||||
this.acceptDateInterval = this.modelValue && this.modelValue.accept_date_interval ? this.modelValue.accept_date_interval : 'no';
|
this.acceptDateInterval = this.modelValue && this.modelValue.accept_date_interval ? this.modelValue.accept_date_interval : 'no';
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.fetchMetadata();
|
this.fetchMetadata();
|
||||||
|
|
||||||
|
@ -204,4 +281,38 @@
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.intersection-explainer-section {
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
padding: 0.75em 0.75em 0.25em 0.75em;
|
||||||
|
border: 1px solid var(--tainacan-gray1);
|
||||||
|
|
||||||
|
legend {
|
||||||
|
margin: -0.75em 0 0em 0;
|
||||||
|
background-color: var(--tainacan-background-color);
|
||||||
|
padding: 5px 5px 5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5em;
|
||||||
|
margin: 0 -0.5em 0.5em 0em;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
strong {
|
||||||
|
margin-left: 0.75em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 100em !important;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logic-divider {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -159,11 +159,16 @@
|
||||||
|
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
let metadata = this.query.metaquery[ index ];
|
let metadata = this.query.metaquery[ index ];
|
||||||
if (metadata.value && metadata.value.length > 0) {
|
if (metadata.value ) {
|
||||||
const dateValueInit = new Date(metadata.value[0].replace(/-/g, '/'));
|
if ( Array.isArray(metadata.value) && metadata.value.length > 0 ) {
|
||||||
this.dateInit = moment(dateValueInit, moment.ISO_8601).toDate();
|
const dateValueInit = new Date(metadata.value[0].replace(/-/g, '/'));
|
||||||
const dateValueEnd = new Date(metadata.value[1].replace(/-/g, '/'));
|
this.dateInit = moment(dateValueInit, moment.ISO_8601).toDate();
|
||||||
this.dateEnd = moment(dateValueEnd, moment.ISO_8601).toDate();
|
const dateValueEnd = new Date(metadata.value[1].replace(/-/g, '/'));
|
||||||
|
this.dateEnd = moment(dateValueEnd, moment.ISO_8601).toDate();
|
||||||
|
} else {
|
||||||
|
const dateValueInit = new Date(metadata.value.replace(/-/g, '/'));
|
||||||
|
this.dateInit = moment(dateValueInit, moment.ISO_8601).toDate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.dateInit = null;
|
this.dateInit = null;
|
||||||
|
@ -186,23 +191,27 @@
|
||||||
values = [ dateInit, dateEnd ];
|
values = [ dateInit, dateEnd ];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('input', {
|
if ( this.filterTypeOptions.accept_date_interval !== 'yes' ) {
|
||||||
filter: 'intersection',
|
this.$emit('input', {
|
||||||
type: 'DATE',
|
filter: 'intersection',
|
||||||
compare: this.filterTypeOptions.first_comparator,
|
type: 'DATE',
|
||||||
metadatum_id: this.metadatumId,
|
compare: this.filterTypeOptions.first_comparator,
|
||||||
collection_id: this.collectionId,
|
metadatum_id: this.metadatumId,
|
||||||
value: this.filterTypeOptions.accept_date_interval === 'yes' ? values : values[0]
|
collection_id: this.collectionId,
|
||||||
});
|
value: values[0]
|
||||||
this.$emit('input', {
|
});
|
||||||
filter: 'intersection',
|
this.$emit('input', {
|
||||||
type: 'DATE',
|
filter: 'intersection',
|
||||||
compare: this.filterTypeOptions.second_comparator,
|
type: 'DATE',
|
||||||
metadatum_id: this.filterTypeOptions.secondary_filter_metadatum_id,
|
compare: this.filterTypeOptions.second_comparator,
|
||||||
collection_id: this.collectionId,
|
metadatum_id: this.filterTypeOptions.secondary_filter_metadatum_id,
|
||||||
value: this.filterTypeOptions.accept_date_interval === 'yes' ? values : values[0],
|
collection_id: this.collectionId,
|
||||||
secondary: true
|
value: values[0],
|
||||||
});
|
secondary: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Much more complicated logic to be implemented in the future. See #889
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,6 @@ class Dates_Intersection extends Filter_Type {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="is-size-7 has-text-centered is-marginless">until</p>
|
|
||||||
<div class="datepicker control is-small">
|
|
||||||
<div class="dropdown is-bottom-left is-mobile-modal">
|
|
||||||
<div role="button" class="dropdown-trigger">
|
|
||||||
<div class="control has-icons-left is-small is-clearfix">
|
|
||||||
<input type="text" autocomplete="off" placeholder=" '. __('Select a date', 'tainacan') .'" class="input is-small">
|
|
||||||
<span class="icon is-left is-small"><i class="mdi mdi-calendar-today"></i></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
');
|
');
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
<b-field :addons="false">
|
<b-field :addons="false">
|
||||||
<label class="label is-inline">
|
<label class="label is-inline">
|
||||||
{{ $i18n.getHelperTitle('tainacan-filter-numeric-interval', 'step') }}<span> * </span>
|
{{ $i18n.getHelperTitle('tainacan-filter-numeric-interval', 'step') }}<span> * </span>
|
||||||
<help-button
|
<span style="font-size: 1.35em;">
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-numeric-interval', 'step')"
|
<help-button
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-numeric-interval', 'step')" />
|
:title="$i18n.getHelperTitle('tainacan-filter-numeric-interval', 'step')"
|
||||||
|
:message="$i18n.getHelperMessage('tainacan-filter-numeric-interval', 'step')" />
|
||||||
|
</span>
|
||||||
</label>
|
</label>
|
||||||
<div
|
<div
|
||||||
v-if="!showEditStepOptions"
|
v-if="!showEditStepOptions"
|
||||||
|
@ -116,17 +118,22 @@
|
||||||
</option>
|
</option>
|
||||||
</b-select>
|
</b-select>
|
||||||
</b-field>
|
</b-field>
|
||||||
<div style="column-count: 2;">
|
<fieldset
|
||||||
|
v-if="secondNumericMetadatumId"
|
||||||
|
class="intersection-explainer-section">
|
||||||
|
<legend>
|
||||||
|
<p>
|
||||||
|
<strong>{{ $i18n.get('info_intersection_explainer') }}</strong>
|
||||||
|
<span style="font-size: 1.35em;">
|
||||||
|
<help-button
|
||||||
|
:title="$i18n.get('label_comparators')"
|
||||||
|
:message="$i18n.get('info_intersection_rules')" />
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</legend>
|
||||||
<b-field :addons="false">
|
<b-field :addons="false">
|
||||||
<label
|
|
||||||
style="line-height: normal;"
|
|
||||||
class="label is-inline">
|
|
||||||
{{ $i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'first_comparator') }}<span> * </span>
|
|
||||||
<help-button
|
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'first_comparator')"
|
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-numerics-intersection', 'first_comparator')" />
|
|
||||||
</label>
|
|
||||||
<b-select
|
<b-select
|
||||||
|
v-if="showEditFirstComparatorOptions"
|
||||||
v-model="firstComparator"
|
v-model="firstComparator"
|
||||||
@update:model-value="emitValues()">
|
@update:model-value="emitValues()">
|
||||||
<option
|
<option
|
||||||
|
@ -135,17 +142,50 @@
|
||||||
:value="comparatorKey"
|
:value="comparatorKey"
|
||||||
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
||||||
</b-select>
|
</b-select>
|
||||||
|
<strong
|
||||||
|
v-else
|
||||||
|
v-html="comparatorsObject[firstComparator].symbol" />
|
||||||
|
<p v-if="filter.metadatum">
|
||||||
|
|
||||||
|
<em>{{ filter.metadatum.metadatum_name }}</em>
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
v-if="!showEditFirstComparatorOptions"
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditFirstComparatorOptions = true">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('edit'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-edit has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditFirstComparatorOptions = false">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('close'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-approved has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</b-field>
|
</b-field>
|
||||||
|
<div class="logic-divider">
|
||||||
|
<span>{{ $i18n.get('label_and') }}</span>
|
||||||
|
</div>
|
||||||
<b-field :addons="false">
|
<b-field :addons="false">
|
||||||
<label
|
|
||||||
style="line-height: normal;"
|
|
||||||
class="label is-inline">
|
|
||||||
{{ $i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'second_comparator') }}<span> * </span>
|
|
||||||
<help-button
|
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'second_comparator')"
|
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-numerics-intersection', 'second_comparator')" />
|
|
||||||
</label>
|
|
||||||
<b-select
|
<b-select
|
||||||
|
v-if="showEditSecondComparatorOptions"
|
||||||
v-model="secondComparator"
|
v-model="secondComparator"
|
||||||
@update:model-value="emitValues()">
|
@update:model-value="emitValues()">
|
||||||
<option
|
<option
|
||||||
|
@ -154,9 +194,45 @@
|
||||||
:value="comparatorKey"
|
:value="comparatorKey"
|
||||||
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
v-html="comparatorObject.symbol + ' ' + comparatorObject.label" />
|
||||||
</b-select>
|
</b-select>
|
||||||
|
<strong
|
||||||
|
v-else
|
||||||
|
v-html="comparatorsObject[secondComparator].symbol" />
|
||||||
|
<p> <em>{{ secondNumericMetadatumName }}</em></p>
|
||||||
|
<button
|
||||||
|
v-if="!showEditSecondComparatorOptions"
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditSecondComparatorOptions = true">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('edit'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-edit has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
class="button is-white is-pulled-right"
|
||||||
|
@click.prevent="showEditSecondComparatorOptions = false">
|
||||||
|
<span
|
||||||
|
v-tooltip="{
|
||||||
|
content: $i18n.get('close'),
|
||||||
|
autoHide: true,
|
||||||
|
placement: 'bottom',
|
||||||
|
popperClass: ['tainacan-tooltip', 'tooltip']
|
||||||
|
}"
|
||||||
|
class="icon">
|
||||||
|
<i class="tainacan-icon tainacan-icon-18px tainacan-icon-approved has-text-secondary" />
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</fieldset>
|
||||||
<b-field
|
|
||||||
|
<!-- Much more complicated logic, will be possible if we implement #889 -->
|
||||||
|
<!-- <b-field
|
||||||
:addons="false"
|
:addons="false"
|
||||||
:label="$i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'accept_numeric_interval')"
|
:label="$i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'accept_numeric_interval')"
|
||||||
style="margin-top: 1.125rem;"
|
style="margin-top: 1.125rem;"
|
||||||
|
@ -175,7 +251,7 @@
|
||||||
:title="$i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'accept_numeric_interval')"
|
:title="$i18n.getHelperTitle('tainacan-filter-numerics-intersection', 'accept_numeric_interval')"
|
||||||
:message="$i18n.getHelperMessage('tainacan-filter-numerics-intersection', 'accept_numeric_interval')" />
|
:message="$i18n.getHelperMessage('tainacan-filter-numerics-intersection', 'accept_numeric_interval')" />
|
||||||
</b-switch>
|
</b-switch>
|
||||||
</b-field>
|
</b-field> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -204,7 +280,9 @@
|
||||||
firstComparator: String,
|
firstComparator: String,
|
||||||
secondComparator: String,
|
secondComparator: String,
|
||||||
comparatorsObject: {},
|
comparatorsObject: {},
|
||||||
acceptNumericInterval: String
|
acceptNumericInterval: String,
|
||||||
|
showEditFirstComparatorOptions: false,
|
||||||
|
showEditSecondComparatorOptions: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -295,4 +373,38 @@
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.intersection-explainer-section {
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
padding: 0.75em 0.75em 0.25em 0.75em;
|
||||||
|
border: 1px solid var(--tainacan-gray1);
|
||||||
|
|
||||||
|
legend {
|
||||||
|
margin: -0.75em 0 0em 0;
|
||||||
|
background-color: var(--tainacan-background-color);
|
||||||
|
padding: 5px 5px 5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5em;
|
||||||
|
margin: 0 -0.5em 0.5em 0em;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
strong {
|
||||||
|
margin-left: 0.75em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 100em !important;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.logic-divider {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -94,22 +94,26 @@
|
||||||
let values = [ this.valueInit, this.valueEnd ];
|
let values = [ this.valueInit, this.valueEnd ];
|
||||||
let type = ! Number.isInteger( this.valueInit ) || ! Number.isInteger( this.valueEnd ) ? 'DECIMAL(20,3)' : 'NUMERIC';
|
let type = ! Number.isInteger( this.valueInit ) || ! Number.isInteger( this.valueEnd ) ? 'DECIMAL(20,3)' : 'NUMERIC';
|
||||||
|
|
||||||
this.$emit('input', {
|
if ( this.filterTypeOptions.accept_numeric_interval !== 'yes' ) {
|
||||||
filter: 'intersection',
|
this.$emit('input', {
|
||||||
type: type,
|
filter: 'intersection',
|
||||||
compare: this.filterTypeOptions.first_comparator,
|
type: type,
|
||||||
metadatum_id: this.metadatumId,
|
compare: this.filterTypeOptions.first_comparator,
|
||||||
collection_id: this.collectionId,
|
metadatum_id: this.metadatumId,
|
||||||
value: this.filterTypeOptions.accept_numeric_interval === 'yes' ? values : values[0]
|
collection_id: this.collectionId,
|
||||||
});
|
value: this.filterTypeOptions.accept_numeric_interval === 'yes' ? values : values[0]
|
||||||
this.$emit('input', {
|
});
|
||||||
filter: 'intersection',
|
this.$emit('input', {
|
||||||
type: type,
|
filter: 'intersection',
|
||||||
compare: this.filterTypeOptions.second_comparator,
|
type: type,
|
||||||
metadatum_id: this.filterTypeOptions.secondary_filter_metadatum_id,
|
compare: this.filterTypeOptions.second_comparator,
|
||||||
collection_id: this.collectionId,
|
metadatum_id: this.filterTypeOptions.secondary_filter_metadatum_id,
|
||||||
value: this.filterTypeOptions.accept_numeric_interval === 'yes' ? values : values[0]
|
collection_id: this.collectionId,
|
||||||
});
|
value: this.filterTypeOptions.accept_numeric_interval === 'yes' ? values : values[0]
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Much more complicated logic to be implemented in the future. See #889
|
||||||
|
}
|
||||||
},
|
},
|
||||||
updateSelectedValues(){
|
updateSelectedValues(){
|
||||||
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) )
|
||||||
|
@ -119,9 +123,13 @@
|
||||||
if ( index >= 0 ) {
|
if ( index >= 0 ) {
|
||||||
|
|
||||||
let metaquery = this.query.metaquery[ index ];
|
let metaquery = this.query.metaquery[ index ];
|
||||||
if ( metaquery.value && metaquery.value.length > 1 ) {
|
if ( metaquery.value ) {
|
||||||
this.valueInit = new Number(metaquery.value[0]);
|
if ( Array.isArray(metaquery.value) && metaquery.value.length > 1 ) {
|
||||||
this.valueEnd = new Number(metaquery.value[1]);
|
this.valueInit = new Number(metaquery.value[0]);
|
||||||
|
this.valueEnd = new Number(metaquery.value[1]);
|
||||||
|
} else {
|
||||||
|
this.valueInit = new Number(metaquery.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.valueInit = null;
|
this.valueInit = null;
|
||||||
|
|
|
@ -44,26 +44,6 @@ class Numerics_Intersection extends Filter_Type {
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<p class="is-size-7 has-text-centered is-marginless">until</p>
|
|
||||||
<div class="b-numberinput field is-grouped">
|
|
||||||
<p class="control">
|
|
||||||
<button type="button" class="button is-primary is-small">
|
|
||||||
<span class="icon is-small">
|
|
||||||
<i class="mdi mdi-minus"></i>
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
<div class="control is-small is-clearfix">
|
|
||||||
<input type="number" step="0.01" class="input is-small" value="10">
|
|
||||||
</div>
|
|
||||||
<p class="control">
|
|
||||||
<button type="button" class="button is-primary is-small">
|
|
||||||
<span class="icon is-small">
|
|
||||||
<i class="mdi mdi-plus"></i>
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
');
|
');
|
||||||
}
|
}
|
||||||
|
|
|
@ -976,7 +976,7 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
&:not(.available-metadata-area){
|
&:not(.available-metadata-area){
|
||||||
margin-right: var(--tainacan-one-column);
|
margin-right: 30px;
|
||||||
flex-grow: 2;
|
flex-grow: 2;
|
||||||
|
|
||||||
@media screen and (max-width: 769px) {
|
@media screen and (max-width: 769px) {
|
||||||
|
|
|
@ -529,6 +529,7 @@ return apply_filters( 'tainacan-i18n', [
|
||||||
'label_view_all_%s_collections' => __( 'View all %s collections', 'tainacan' ),
|
'label_view_all_%s_collections' => __( 'View all %s collections', 'tainacan' ),
|
||||||
'label_view_collections_list' => __( 'View collections list', 'tainacan' ),
|
'label_view_collections_list' => __( 'View collections list', 'tainacan' ),
|
||||||
'label_comparator' => __( 'Comparator', 'tainacan' ),
|
'label_comparator' => __( 'Comparator', 'tainacan' ),
|
||||||
|
'label_comparators' => __( 'Comparators', 'tainacan' ),
|
||||||
'label_table_of_items' => __( 'Table of Items', 'tainacan' ),
|
'label_table_of_items' => __( 'Table of Items', 'tainacan' ),
|
||||||
'label_create_another_item' => __( 'Create another item', 'tainacan' ),
|
'label_create_another_item' => __( 'Create another item', 'tainacan' ),
|
||||||
'label_recent_collections' => __( 'Recent Collections', 'tainacan' ),
|
'label_recent_collections' => __( 'Recent Collections', 'tainacan' ),
|
||||||
|
@ -1066,6 +1067,8 @@ return apply_filters( 'tainacan-i18n', [
|
||||||
'info_terms_creation_failed_due_to_value_%s' => __( 'Terms creation failed due to value: %s.', 'tainacan' ),
|
'info_terms_creation_failed_due_to_value_%s' => __( 'Terms creation failed due to value: %s.', 'tainacan' ),
|
||||||
'info_terms_creation_failed_due_to_values_%s' => __( 'Terms creation failed due to values: %s.', 'tainacan' ),
|
'info_terms_creation_failed_due_to_values_%s' => __( 'Terms creation failed due to values: %s.', 'tainacan' ),
|
||||||
'info_autodraft_updated' => __( 'Autodraft updated. Please create the item to keep your changes.', 'tainacan' ),
|
'info_autodraft_updated' => __( 'Autodraft updated. Please create the item to keep your changes.', 'tainacan' ),
|
||||||
|
'info_intersection_explainer' => __( 'Will show items if the selected value is:', 'tainacan' ),
|
||||||
|
'info_intersection_rules' => __( 'The value must match both rules to appear in the filter.', 'tainacan' ),
|
||||||
|
|
||||||
/* Activity actions */
|
/* Activity actions */
|
||||||
'action_update-metadata-value' => __( 'Item Metadata Value Updates', 'tainacan'),
|
'action_update-metadata-value' => __( 'Item Metadata Value Updates', 'tainacan'),
|
||||||
|
|
Loading…
Reference in New Issue