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

View File

@ -47,7 +47,10 @@ export function useArrayData(key, userOptions) {
if (isEmpty || !allowedOptions.includes(option)) continue;
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"
:expr-builder="exprBuilder"
:user-params="params"
:keep-opts="['userParams']"
:offset="50"
auto-load
>

View File

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