0
0
Fork 0

fix(VnFilterPanel): remove key

This commit is contained in:
Alex Moreno 2024-06-17 12:58:58 +02:00
parent fb1bd5ca72
commit 3394eb10b0
3 changed files with 39 additions and 40 deletions

View File

@ -134,6 +134,7 @@ const col = computed(() => {
const components = computed(() => $props.components ?? defaultComponents); const components = computed(() => $props.components ?? defaultComponents);
</script> </script>
<template> <template>
<div class="row no-wrap fit">
<VnComponent <VnComponent
v-if="col.before" v-if="col.before"
:prop="col.before" :prop="col.before"
@ -156,4 +157,5 @@ const components = computed(() => $props.components ?? defaultComponents);
:value="model" :value="model"
v-model="model" v-model="model"
/> />
</div>
</template> </template>

View File

@ -147,7 +147,7 @@ const tagsList = computed(() => {
const tagList = []; const tagList = [];
for (const key of Object.keys(params.value)) { for (const key of Object.keys(params.value)) {
const value = params.value[key]; const value = params.value[key];
if (!value || ($props.hiddenTags || []).includes(key)) continue; if (value == null || ($props.hiddenTags || []).includes(key)) continue;
tagList.push({ label: key, value }); tagList.push({ label: key, value });
} }
return tagList; return tagList;
@ -161,21 +161,14 @@ const customTags = computed(() =>
); );
async function remove(key) { async function remove(key) {
delete params.value[key];
delete params.value.filter?.where?.[key];
params.value[key] = undefined; params.value[key] = undefined;
await arrayData.applyFilter({ params: params.value }); search();
emit('remove', key); emit('remove', key);
} }
function formatValue(value) { function formatValue(value) {
if (typeof value === 'boolean') { if (typeof value === 'boolean') return value ? t('Yes') : t('No');
return value ? t('Yes') : t('No'); if (isNaN(value) && !isNaN(Date.parse(value))) return toDate(value);
}
if (isNaN(value) && !isNaN(Date.parse(value))) {
return toDate(value);
}
return `"${value}"`; return `"${value}"`;
} }
@ -236,7 +229,7 @@ function formatValue(value) {
<slot name="tags" :tag="chip" :format-fn="formatValue"> <slot name="tags" :tag="chip" :format-fn="formatValue">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ chip.label }}:</strong> <strong>{{ chip.label }}:</strong>
<span>"{{ chip.value }}"</span> <span>"{{ formatValue(chip.value) }}"</span>
</div> </div>
</slot> </slot>
</VnFilterPanelChip> </VnFilterPanelChip>

View File

@ -94,15 +94,19 @@ const columns = computed(() => [
label: t('customer.extendedList.tableVisibleColumns.phone'), label: t('customer.extendedList.tableVisibleColumns.phone'),
name: 'phone', name: 'phone',
cardVisible: true, cardVisible: true,
after: { columnFilter: {
component: markRaw(VnLinkPhone),
props: (prop) => ({
'phone-number': prop.phone,
}),
},
component: 'number', component: 'number',
},
columnField: { columnField: {
component: null, component: null,
after: {
component: markRaw(VnLinkPhone),
attrs: (prop) => {
return {
'phone-number': prop,
};
},
},
}, },
}, },
{ {