0
0
Fork 0

feat(VnFilter): merge objects

This commit is contained in:
Alex Moreno 2024-06-19 15:18:38 +02:00
parent 02f8288b22
commit 702b031650
3 changed files with 23 additions and 27 deletions

View File

@ -16,10 +16,11 @@ function stopEventPropagation(event) {
}
</script>
<template>
<slot name="beforeChip" :row="row"></slot>
<span
v-for="col of columns"
:key="col.name"
@click="stopEventPropagation($event)"
@click="stopEventPropagation"
class="cursor-text"
>
<QChip

View File

@ -36,45 +36,44 @@ const enterEvent = {
'keyup.enter': () => addFilter(model.value),
remove: () => addFilter(null),
};
const defaultAttrs = {
filled: !$props.showTitle,
class: 'q-px-sm q-pb-xs q-pt-none',
dense: true,
};
const forceAttrs = {
label: $props.showTitle ? '' : $props.column.label,
};
const components = {
input: {
component: markRaw(VnInput),
event: enterEvent,
attrs: {
class: 'q-px-sm q-pb-xs q-pt-none',
dense: true,
filled: !$props.showTitle,
...defaultAttrs,
clearable: true,
},
forceAttrs: {
label: $props.showTitle ? '' : $props.column.label,
},
forceAttrs,
},
number: {
component: markRaw(VnInput),
event: enterEvent,
attrs: {
dense: true,
class: 'q-px-sm q-pb-xs q-pt-none',
...defaultAttrs,
clearable: true,
filled: !$props.showTitle,
},
forceAttrs: {
label: $props.showTitle ? '' : $props.column.label,
},
forceAttrs,
},
date: {
component: markRaw(VnInputDate),
event: updateEvent,
attrs: {
dense: true,
class: 'q-px-sm q-pb-xs q-pt-none',
filled: !$props.showTitle,
...defaultAttrs,
style: 'min-width: 150px',
},
forceAttrs: {
label: $props.showTitle ? '' : $props.column.label,
},
forceAttrs,
},
checkbox: {
component: markRaw(QCheckbox),
@ -84,9 +83,7 @@ const components = {
class: $props.showTitle ? 'q-py-sm q-mt-md' : 'q-px-md q-py-xs',
'toggle-indeterminate': true,
},
forceAttrs: {
label: $props.showTitle ? '' : $props.column.label,
},
forceAttrs,
},
select: {
component: markRaw(VnSelect),
@ -96,12 +93,10 @@ const components = {
dense: true,
filled: !$props.showTitle,
},
forceAttrs: {
label: $props.showTitle ? '' : $props.column.label,
},
forceAttrs,
},
};
console.log(components);
async function addFilter(value) {
value ??= undefined;
if (value && typeof value === 'object') value = model.value;

View File

@ -5,7 +5,7 @@ import CustomerFilter from '../CustomerFilter.vue';
</script>
<template>
<VnCard
data-key="Customer"
data-key="Client"
base-url="Clients"
:descriptor="CustomerDescriptor"
:filter-panel="CustomerFilter"