forked from verdnatura/salix-front
feat(VnFilter): merge objects
This commit is contained in:
parent
02f8288b22
commit
702b031650
|
@ -16,10 +16,11 @@ function stopEventPropagation(event) {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
|
<slot name="beforeChip" :row="row"></slot>
|
||||||
<span
|
<span
|
||||||
v-for="col of columns"
|
v-for="col of columns"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
@click="stopEventPropagation($event)"
|
@click="stopEventPropagation"
|
||||||
class="cursor-text"
|
class="cursor-text"
|
||||||
>
|
>
|
||||||
<QChip
|
<QChip
|
||||||
|
|
|
@ -36,45 +36,44 @@ const enterEvent = {
|
||||||
'keyup.enter': () => addFilter(model.value),
|
'keyup.enter': () => addFilter(model.value),
|
||||||
remove: () => addFilter(null),
|
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 = {
|
const components = {
|
||||||
input: {
|
input: {
|
||||||
component: markRaw(VnInput),
|
component: markRaw(VnInput),
|
||||||
event: enterEvent,
|
event: enterEvent,
|
||||||
attrs: {
|
attrs: {
|
||||||
class: 'q-px-sm q-pb-xs q-pt-none',
|
...defaultAttrs,
|
||||||
dense: true,
|
|
||||||
filled: !$props.showTitle,
|
|
||||||
clearable: true,
|
clearable: true,
|
||||||
},
|
},
|
||||||
forceAttrs: {
|
forceAttrs,
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
number: {
|
number: {
|
||||||
component: markRaw(VnInput),
|
component: markRaw(VnInput),
|
||||||
event: enterEvent,
|
event: enterEvent,
|
||||||
attrs: {
|
attrs: {
|
||||||
dense: true,
|
...defaultAttrs,
|
||||||
class: 'q-px-sm q-pb-xs q-pt-none',
|
|
||||||
clearable: true,
|
clearable: true,
|
||||||
filled: !$props.showTitle,
|
|
||||||
},
|
|
||||||
forceAttrs: {
|
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
|
||||||
},
|
},
|
||||||
|
forceAttrs,
|
||||||
},
|
},
|
||||||
date: {
|
date: {
|
||||||
component: markRaw(VnInputDate),
|
component: markRaw(VnInputDate),
|
||||||
event: updateEvent,
|
event: updateEvent,
|
||||||
attrs: {
|
attrs: {
|
||||||
dense: true,
|
...defaultAttrs,
|
||||||
class: 'q-px-sm q-pb-xs q-pt-none',
|
|
||||||
filled: !$props.showTitle,
|
|
||||||
style: 'min-width: 150px',
|
style: 'min-width: 150px',
|
||||||
},
|
},
|
||||||
forceAttrs: {
|
forceAttrs,
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
checkbox: {
|
checkbox: {
|
||||||
component: markRaw(QCheckbox),
|
component: markRaw(QCheckbox),
|
||||||
|
@ -84,9 +83,7 @@ const components = {
|
||||||
class: $props.showTitle ? 'q-py-sm q-mt-md' : 'q-px-md q-py-xs',
|
class: $props.showTitle ? 'q-py-sm q-mt-md' : 'q-px-md q-py-xs',
|
||||||
'toggle-indeterminate': true,
|
'toggle-indeterminate': true,
|
||||||
},
|
},
|
||||||
forceAttrs: {
|
forceAttrs,
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
select: {
|
select: {
|
||||||
component: markRaw(VnSelect),
|
component: markRaw(VnSelect),
|
||||||
|
@ -96,12 +93,10 @@ const components = {
|
||||||
dense: true,
|
dense: true,
|
||||||
filled: !$props.showTitle,
|
filled: !$props.showTitle,
|
||||||
},
|
},
|
||||||
forceAttrs: {
|
forceAttrs,
|
||||||
label: $props.showTitle ? '' : $props.column.label,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
console.log(components);
|
||||||
async function addFilter(value) {
|
async function addFilter(value) {
|
||||||
value ??= undefined;
|
value ??= undefined;
|
||||||
if (value && typeof value === 'object') value = model.value;
|
if (value && typeof value === 'object') value = model.value;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import CustomerFilter from '../CustomerFilter.vue';
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<VnCard
|
<VnCard
|
||||||
data-key="Customer"
|
data-key="Client"
|
||||||
base-url="Clients"
|
base-url="Clients"
|
||||||
:descriptor="CustomerDescriptor"
|
:descriptor="CustomerDescriptor"
|
||||||
:filter-panel="CustomerFilter"
|
:filter-panel="CustomerFilter"
|
||||||
|
|
Loading…
Reference in New Issue