Adjust styles for NumeriListInterval form and fixes insertion error.
This commit is contained in:
parent
fc0696751d
commit
eddd56c403
|
@ -1,71 +1,74 @@
|
|||
<template>
|
||||
<div>
|
||||
<b-field :addons="false">
|
||||
<label class="label is-inline">
|
||||
{{ $i18n.getHelperTitle('tainacan-filter-numeric-list-interval', 'predefined_intervals') }}<span> </span>
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-filter-numeric-list-interval', 'predefined_intervals')"
|
||||
:message="$i18n.getHelperMessage('tainacan-filter-numeric-list-interval', 'predefined_intervals')"/>
|
||||
</label>
|
||||
<div>
|
||||
<b-field :addons="false">
|
||||
<label class="label is-inline">
|
||||
{{ $i18n.getHelperTitle('tainacan-filter-numeric-list-interval', 'predefined_intervals') }}<span> </span>
|
||||
<help-button
|
||||
:title="$i18n.getHelperTitle('tainacan-filter-numeric-list-interval', 'predefined_intervals')"
|
||||
:message="$i18n.getHelperMessage('tainacan-filter-numeric-list-interval', 'predefined_intervals')"/>
|
||||
</label>
|
||||
<div v-if="intervals.length == 0" >
|
||||
<br>
|
||||
<a
|
||||
role="button"
|
||||
@click="addInterval()"
|
||||
class="is-inline add-link">
|
||||
<span class="icon is-small">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-add"/>
|
||||
</span>
|
||||
{{ $i18n.get('add_value') }}
|
||||
</a>
|
||||
</div>
|
||||
<transition-group name="filter-item">
|
||||
<div
|
||||
class="options-input"
|
||||
v-for="(interval, index) of intervals"
|
||||
:key="index">
|
||||
<b-field>
|
||||
<b-input
|
||||
expanded="true"
|
||||
:placeholder="$i18n.get('label')"
|
||||
@input="onUpdate"
|
||||
v-model="interval.label" />
|
||||
</b-field>
|
||||
<b-field>
|
||||
<b-input
|
||||
type="number"
|
||||
:placeholder="$i18n.get('info_initial_value')"
|
||||
@input="onUpdate"
|
||||
v-model="interval.from" />
|
||||
<b-input
|
||||
type="number"
|
||||
:placeholder="$i18n.get('info_final_value')"
|
||||
@input="onUpdate"
|
||||
v-model="interval.to" />
|
||||
</b-field>
|
||||
<p class="control">
|
||||
<a
|
||||
role="button"
|
||||
v-if="intervals.length == 0"
|
||||
@click="addInterval()"
|
||||
class="is-inline add-link">
|
||||
@click="addInterval(index)"
|
||||
class="is-inline add-link"
|
||||
:title="$i18n.get('add_value')">
|
||||
<span class="icon is-small">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-add"/>
|
||||
</span>
|
||||
{{ $i18n.get('add_value') }}
|
||||
{{ $i18n.get('add_value') }}
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
v-for="(interval, index) of intervals"
|
||||
:key="index">
|
||||
|
||||
<b-field>
|
||||
<b-input
|
||||
:placeholder="$i18n.get('label')"
|
||||
@input="onUpdate"
|
||||
v-model="interval.label" />
|
||||
<b-input
|
||||
class="input-number"
|
||||
type="number"
|
||||
:placeholder="$i18n.get('info_initial_value')"
|
||||
@input="onUpdate"
|
||||
v-model="interval.from" />
|
||||
<b-input
|
||||
class="input-number"
|
||||
type="number"
|
||||
:placeholder="$i18n.get('info_final_value')"
|
||||
@input="onUpdate"
|
||||
v-model="interval.to" />
|
||||
<p class="control">
|
||||
<a
|
||||
role="button"
|
||||
@click="addInterval(index)"
|
||||
class="is-inline add-link"
|
||||
:title="$i18n.get('add_value')">
|
||||
<span class="icon is-small">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-add"/>
|
||||
</span>
|
||||
</a>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a
|
||||
role="button"
|
||||
@click="removeInterval(index)"
|
||||
class="is-inline add-link"
|
||||
:title="$i18n.get('remove_value')">
|
||||
<span class="icon is-small">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-minus"/>
|
||||
</span>
|
||||
</a>
|
||||
</p>
|
||||
</b-field>
|
||||
</div>
|
||||
</b-field>
|
||||
</div>
|
||||
</p>
|
||||
<p class="control">
|
||||
<a
|
||||
role="button"
|
||||
@click="removeInterval(index)"
|
||||
class="is-inline add-link"
|
||||
:title="$i18n.get('remove_value')">
|
||||
<span class="icon is-small">
|
||||
<i class="tainacan-icon has-text-secondary tainacan-icon-repprovedcircle"/>
|
||||
</span>
|
||||
{{ $i18n.get('remove_value') }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</transition-group>
|
||||
</b-field>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -94,7 +97,7 @@
|
|||
this.intervals.splice(index, 1);
|
||||
},
|
||||
addInterval(index) {
|
||||
if (index) {
|
||||
if (index != undefined) {
|
||||
this.intervals.splice(index + 1, 0, {
|
||||
label: '',
|
||||
to: null,
|
||||
|
@ -115,9 +118,22 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
input.input-number {
|
||||
line-height: 1.5;
|
||||
height: 2.25em;
|
||||
<style scoped lang="scss">
|
||||
@import '../../scss/_variables.scss';
|
||||
|
||||
.options-input {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
|
||||
.field:first-child {
|
||||
width: 100%;
|
||||
margin-top: 1rem;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.field.has-addons {
|
||||
margin-bottom: 0.125rem;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue