feat: refs #6891 keep arrayData opts

This commit is contained in:
Jorge Penadés 2024-05-08 12:30:44 +02:00
parent b5a599c8e7
commit 07c67b0df2
4 changed files with 11 additions and 1 deletions

View File

@ -42,6 +42,10 @@ const props = defineProps({
type: Object, type: Object,
default: null, default: null,
}, },
keepOpts: {
type: Array,
default: () => [],
},
offset: { offset: {
type: Number, type: Number,
default: 0, default: 0,
@ -76,6 +80,7 @@ const arrayData = useArrayData(props.dataKey, {
order: props.order, order: props.order,
userParams: props.userParams, userParams: props.userParams,
exprBuilder: props.exprBuilder, exprBuilder: props.exprBuilder,
keepOpts: props.keepOpts,
}); });
const store = arrayData.store; const store = arrayData.store;

View File

@ -47,7 +47,10 @@ export function useArrayData(key, userOptions) {
if (isEmpty || !allowedOptions.includes(option)) continue; if (isEmpty || !allowedOptions.includes(option)) continue;
if (Object.prototype.hasOwnProperty.call(store, option)) { if (Object.prototype.hasOwnProperty.call(store, option)) {
store[option] = userOptions[option]; const defaultOpts = userOptions[option];
store[option] = userOptions.keepOpts?.includes(option)
? Object.assign(defaultOpts, store[option])
: defaultOpts;
} }
} }
} }

View File

@ -457,6 +457,7 @@ onUnmounted(() => (stateStore.rightDrawer = false));
:limit="12" :limit="12"
:expr-builder="exprBuilder" :expr-builder="exprBuilder"
:user-params="params" :user-params="params"
:keep-opts="['userParams']"
:offset="50" :offset="50"
auto-load auto-load
> >

View File

@ -61,6 +61,7 @@ function navigate(id) {
:limit="20" :limit="20"
:order="['landed DESC', 'clientFk', 'id DESC']" :order="['landed DESC', 'clientFk', 'id DESC']"
:user-params="{ showEmpty: false }" :user-params="{ showEmpty: false }"
:keep-opts="['userParams']"
auto-load auto-load
> >
<template #body="{ rows }"> <template #body="{ rows }">