1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-03-07 04:47:44 +01: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

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

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