1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat(UI): BaseSelect in table filters

This commit is contained in:
Giulio Ganci
2022-05-08 13:15:39 +02:00
parent 5582a12bbf
commit a037d0cc01
2 changed files with 18 additions and 21 deletions

View File

@ -128,12 +128,12 @@ export default defineComponent({
const getOptionValue = (opt) => { const getOptionValue = (opt) => {
const key = typeof props.optionTrackBy === 'function' ? props.optionTrackBy() : props.optionTrackBy; const key = typeof props.optionTrackBy === 'function' ? props.optionTrackBy() : props.optionTrackBy;
return opt[key]; return key ? opt[key] : opt;
}; };
const getOptionLabel = (opt) => { const getOptionLabel = (opt) => {
const key = typeof props.optionLabel === 'function' ? props.optionLabel() : props.optionLabel; const key = typeof props.optionLabel === 'function' ? props.optionLabel() : props.optionLabel;
return opt[key]; return key ? opt[key] : opt;
}; };
const currentOptionLabel = computed(() => { const currentOptionLabel = computed(() => {
@ -221,7 +221,6 @@ export default defineComponent({
<style lang="scss" scoped> <style lang="scss" scoped>
.select { .select {
position: relative; position: relative;
width: 100%;
display: block; display: block;
&__search-input { &__search-input {

View File

@ -12,24 +12,18 @@
@change="doFilter" @change="doFilter"
><i class="form-icon" /> ><i class="form-icon" />
</label> </label>
<select v-model="row.field" class="form-select col-auto select-sm"> <BaseSelect
<option v-model="row.field"
v-for="(item, j) of fields" class="form-select ml-2 col-auto select-sm"
:key="j" :options="fields"
:value="item.name" option-track-by="name"
> option-label="name"
{{ item.name }} />
</option> <BaseSelect
</select> v-model="row.op"
<select v-model="row.op" class="form-select ml-2 col-auto select-sm"> class="form-select ml-2 col-auto select-sm"
<option :options="operators"
v-for="(operator, k) of operators" />
:key="k"
:value="operator"
>
{{ operator }}
</option>
</select>
<div class="workspace-table-filters-row-value ml-2"> <div class="workspace-table-filters-row-value ml-2">
<input <input
v-if="!row.op.includes('NULL')" v-if="!row.op.includes('NULL')"
@ -73,8 +67,12 @@
<script> <script>
import customizations from 'common/customizations'; import customizations from 'common/customizations';
import { NUMBER, FLOAT } from 'common/fieldTypes'; import { NUMBER, FLOAT } from 'common/fieldTypes';
import BaseSelect from '@/components/BaseSelect.vue';
export default { export default {
components: {
BaseSelect
},
props: { props: {
fields: Array, fields: Array,
connClient: String connClient: String