|
|
@ -7,7 +7,7 @@ import { comparisonOpList } from '~/utils/filterUtils' |
|
|
|
import { ActiveViewInj, MetaInj, ReloadViewDataHookInj } from '~/context' |
|
|
|
import { ActiveViewInj, MetaInj, ReloadViewDataHookInj } from '~/context' |
|
|
|
import useViewFilters from '~/composables/useViewFilters' |
|
|
|
import useViewFilters from '~/composables/useViewFilters' |
|
|
|
import MdiDeleteIcon from '~icons/mdi/close-box' |
|
|
|
import MdiDeleteIcon from '~icons/mdi/close-box' |
|
|
|
|
|
|
|
import MdiAddIcon from '~icons/mdi/plus' |
|
|
|
const { nested = false, parentId } = defineProps<{ nested?: boolean; parentId?: string }>() |
|
|
|
const { nested = false, parentId } = defineProps<{ nested?: boolean; parentId?: string }>() |
|
|
|
|
|
|
|
|
|
|
|
const meta = inject(MetaInj) |
|
|
|
const meta = inject(MetaInj) |
|
|
@ -72,13 +72,13 @@ watch( |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div class="backgroundColor pa-2 menu-filter-dropdown bg-background" :style="{ width: nested ? '100%' : '630px' }"> |
|
|
|
<div class="bg-white shadow pa-2 menu-filter-dropdown" :style="{ width: nested ? '100%' : '630px' }"> |
|
|
|
<div v-if="filters && filters.length" class="grid" @click.stop> |
|
|
|
<div v-if="filters && filters.length" class="grid" @click.stop> |
|
|
|
<template v-for="(filter, i) in filters" :key="filter.id || i"> |
|
|
|
<template v-for="(filter, i) in filters" :key="filter.id || i"> |
|
|
|
<template v-if="filter.status !== 'delete'"> |
|
|
|
<template v-if="filter.status !== 'delete'"> |
|
|
|
<div v-if="filter.is_group" :key="i" style="grid-column: span 4; padding: 6px" class="elevation-4"> |
|
|
|
<div v-if="filter.is_group" :key="i" style="grid-column: span 4; padding: 6px" class="elevation-4"> |
|
|
|
<div class="d-flex" style="gap: 6px; padding: 0 6px"> |
|
|
|
<div class="d-flex" style="gap: 6px; padding: 0 6px"> |
|
|
|
<v-icon |
|
|
|
<!-- <v-icon |
|
|
|
v-if="!filter.readOnly" |
|
|
|
v-if="!filter.readOnly" |
|
|
|
:key="`${i}_3`" |
|
|
|
:key="`${i}_3`" |
|
|
|
small |
|
|
|
small |
|
|
@ -86,10 +86,18 @@ watch( |
|
|
|
@click.stop="deleteFilter(filter, i)" |
|
|
|
@click.stop="deleteFilter(filter, i)" |
|
|
|
> |
|
|
|
> |
|
|
|
mdi-close-box |
|
|
|
mdi-close-box |
|
|
|
</v-icon> |
|
|
|
</v-icon> --> |
|
|
|
|
|
|
|
<MdiDeleteIcon |
|
|
|
|
|
|
|
v-if="!filter.readOnly" |
|
|
|
|
|
|
|
small |
|
|
|
|
|
|
|
class="nc-filter-item-remove-btn" |
|
|
|
|
|
|
|
@click.stop="deleteFilter(filter, i)" |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<span v-else :key="`${i}_1`" /> |
|
|
|
<span v-else :key="`${i}_1`" /> |
|
|
|
<v-select |
|
|
|
|
|
|
|
v-model="filter.logical_op" |
|
|
|
<a-select |
|
|
|
|
|
|
|
v-model:value="filter.logical_op" |
|
|
|
class="flex-shrink-1 flex-grow-0 elevation-0 caption" |
|
|
|
class="flex-shrink-1 flex-grow-0 elevation-0 caption" |
|
|
|
:items="['and', 'or']" |
|
|
|
:items="['and', 'or']" |
|
|
|
density="compact" |
|
|
|
density="compact" |
|
|
@ -102,7 +110,7 @@ watch( |
|
|
|
<!-- <template #item="{ item }"> --> |
|
|
|
<!-- <template #item="{ item }"> --> |
|
|
|
<!-- <span class="caption font-weight-regular">{{ item }}</span> --> |
|
|
|
<!-- <span class="caption font-weight-regular">{{ item }}</span> --> |
|
|
|
<!-- </template> --> |
|
|
|
<!-- </template> --> |
|
|
|
</v-select> |
|
|
|
</a-select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- <column-filter |
|
|
|
<!-- <column-filter |
|
|
|
v-if="filter.id || shared" |
|
|
|
v-if="filter.id || shared" |
|
|
@ -134,28 +142,24 @@ watch( |
|
|
|
v-if="!filter.readOnly" |
|
|
|
v-if="!filter.readOnly" |
|
|
|
class="nc-filter-item-remove-btn text-grey align-self-center" |
|
|
|
class="nc-filter-item-remove-btn text-grey align-self-center" |
|
|
|
@click.stop="deleteFilter(filter, i)" |
|
|
|
@click.stop="deleteFilter(filter, i)" |
|
|
|
></MdiDeleteIcon> |
|
|
|
/> |
|
|
|
<span v-else /> |
|
|
|
<span v-else /> |
|
|
|
|
|
|
|
|
|
|
|
<span v-if="!i" :key="`${i}_2`" class="text-xs d-flex align-center">{{ $t('labels.where') }}</span> |
|
|
|
<span v-if="!i" class="text-xs d-flex align-center">{{ $t('labels.where') }}</span> |
|
|
|
|
|
|
|
|
|
|
|
<v-select |
|
|
|
<a-select |
|
|
|
v-else |
|
|
|
v-else |
|
|
|
:key="`${i}_4`" |
|
|
|
v-model:value="filter.logical_op" |
|
|
|
v-model="filter.logical_op" |
|
|
|
class="h-full" |
|
|
|
class="w-full elevation-0 caption" |
|
|
|
:options="[ |
|
|
|
:items="['and', 'or']" |
|
|
|
{ value: 'and', text: 'AND' }, |
|
|
|
density="compact" |
|
|
|
{ value: 'or', text: 'OR' }, |
|
|
|
variant="solo" |
|
|
|
]" |
|
|
|
hide-details |
|
|
|
hide-details |
|
|
|
:disabled="filter.readOnly" |
|
|
|
:disabled="filter.readOnly" |
|
|
|
@click.stop |
|
|
|
@click.stop |
|
|
|
@change="filterUpdateCondition(filter, i)" |
|
|
|
@change="filterUpdateCondition(filter, i)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<!-- <template #item="{ item }"> |
|
|
|
|
|
|
|
<span class="caption font-weight-regular">{{ item }}</span> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</v-select> --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<FieldListAutoCompleteDropdown |
|
|
|
<FieldListAutoCompleteDropdown |
|
|
|
:key="`${i}_6`" |
|
|
|
:key="`${i}_6`" |
|
|
@ -167,10 +171,10 @@ watch( |
|
|
|
@change="saveOrUpdate(filter, i)" |
|
|
|
@change="saveOrUpdate(filter, i)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
<v-select |
|
|
|
<a-select |
|
|
|
v-model="filter.comparison_op" |
|
|
|
v-model:value="filter.comparison_op" |
|
|
|
class="caption nc-filter-operation-select text-sm" |
|
|
|
class="caption nc-filter-operation-select text-sm" |
|
|
|
:items="comparisonOpList.map((it) => it.value)" |
|
|
|
:options="comparisonOpList" |
|
|
|
:placeholder="$t('labels.operation')" |
|
|
|
:placeholder="$t('labels.operation')" |
|
|
|
density="compact" |
|
|
|
density="compact" |
|
|
|
variant="solo" |
|
|
|
variant="solo" |
|
|
@ -189,21 +193,17 @@ watch( |
|
|
|
<!-- </template> --> |
|
|
|
<!-- </template> --> |
|
|
|
<!-- </v-select> --> |
|
|
|
<!-- </v-select> --> |
|
|
|
<span v-if="['null', 'notnull', 'empty', 'notempty'].includes(filter.comparison_op)" :key="`span${i}`" /> |
|
|
|
<span v-if="['null', 'notnull', 'empty', 'notempty'].includes(filter.comparison_op)" :key="`span${i}`" /> |
|
|
|
<v-checkbox |
|
|
|
<a-checkbox |
|
|
|
v-else-if="types[filter.field] === 'boolean'" |
|
|
|
v-else-if="types[filter.field] === 'boolean'" |
|
|
|
:key="`${i}_7`" |
|
|
|
v-model:value="filter.value" |
|
|
|
v-model="filter.value" |
|
|
|
|
|
|
|
dense |
|
|
|
dense |
|
|
|
:disabled="filter.readOnly" |
|
|
|
:disabled="filter.readOnly" |
|
|
|
@change="saveOrUpdate(filter, i)" |
|
|
|
@change="saveOrUpdate(filter, i)" |
|
|
|
/> |
|
|
|
/> |
|
|
|
<v-text-field |
|
|
|
<a-input |
|
|
|
v-else |
|
|
|
v-else |
|
|
|
:key="`${i}_7`" |
|
|
|
:key="`${i}_7`" |
|
|
|
v-model="filter.value" |
|
|
|
v-model="filter.value" |
|
|
|
density="compact" |
|
|
|
|
|
|
|
variant="solo" |
|
|
|
|
|
|
|
hide-details |
|
|
|
|
|
|
|
class="caption text-sm nc-filter-value-select" |
|
|
|
class="caption text-sm nc-filter-value-select" |
|
|
|
:disabled="filter.readOnly" |
|
|
|
:disabled="filter.readOnly" |
|
|
|
@click.stop |
|
|
|
@click.stop |
|
|
@ -214,11 +214,14 @@ watch( |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<v-btn small class="elevation-0 text-sm text-capitalize text-grey my-3" @click.stop="addFilter"> |
|
|
|
<a-button small class="elevation-0 text-sm text-capitalize text-grey my-3" @click.stop="addFilter"> |
|
|
|
<!-- <v-icon small color="grey"> mdi-plus </v-icon> --> |
|
|
|
<div class="flex align-center gap-1"> |
|
|
|
<!-- Add Filter --> |
|
|
|
<!-- <v-icon small color="grey"> mdi-plus </v-icon> --> |
|
|
|
{{ $t('activity.addFilter') }} |
|
|
|
<MdiAddIcon /> |
|
|
|
</v-btn> |
|
|
|
<!-- Add Filter --> |
|
|
|
|
|
|
|
{{ $t('activity.addFilter') }} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</a-button> |
|
|
|
<slot /> |
|
|
|
<slot /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|