#8036 - arrayData_exprBuilder_after #845

Merged
alexm merged 7 commits from 8036-arrayData_exprBuilder_after into dev 2024-11-19 09:03:50 +00:00
2 changed files with 18 additions and 13 deletions
Showing only changes of commit 8381a25017 - Show all commits

View File

@ -37,7 +37,7 @@ const $props = defineProps({
},
hiddenTags: {
type: Array,
default: () => ['filter', 'search', 'or', 'and'],
default: () => ['filter', 'or', 'and'],
},
customTags: {
type: Array,
@ -62,7 +62,6 @@ const emit = defineEmits([
'update:modelValue',
'refresh',
'clear',
'search',
Outdated
Review

Como ahora se muestra bien, se puede mostrar

Como ahora se muestra bien, se puede mostrar
'init',
'remove',
'setUserParams',

View File

@ -74,18 +74,10 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
limit: store.limit,
};
let exprFilter;
let userParams = { ...store.userParams };
if (store?.exprBuilder) {
Outdated
Review

La solucion era ejecutar el exprBuilder despues de todo, y guardar el filtro antes de aplicarlo

La solucion era ejecutar el exprBuilder despues de todo, y guardar el filtro antes de aplicarlo
const where = buildFilter(userParams, (param, value) => {
const res = store.exprBuilder(param, value);
if (res) delete userParams[param];
return res;
});
exprFilter = where ? { where } : null;
}
Object.assign(filter, store.userFilter, exprFilter);
Object.assign(filter, store.userFilter);
let where;
if (filter?.where || store.filter?.where)
where = Object.assign(filter?.where ?? {}, store.filter?.where ?? {});
@ -98,8 +90,22 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
if (store.order && store.order.length) params.filter.order = store.order;
else delete params.filter.order;
store.currentFilter = JSON.parse(JSON.stringify(params));
Outdated
Review

Usar structuredClone

Usar structuredClone
store.currentFilter.filter = JSON.stringify(store.currentFilter.filter);
Outdated
Review

No se pot fer sense JSON.parse(JSON.stringify , he provat en structuredClone, pero no permitix gastar dins Proxys. I la opcio de fer {...params} mantendria la refernecia de 2n nivell

No se pot fer sense JSON.parse(JSON.stringify , he provat en structuredClone, pero no permitix gastar dins Proxys. I la opcio de fer {...params} mantendria la refernecia de 2n nivell
Outdated
Review

Els borre per a que no moleste en la url

Els borre per a que no moleste en la url
let exprFilter;
if (store?.exprBuilder) {
exprFilter = buildFilter(params, (param, value) => {
if (param == 'filter') return;
const res = store.exprBuilder(param, value);
if (res) delete params[param];
return res;
});
}
params.filter.where = { ...params.filter.where, ...exprFilter };
params.filter = JSON.stringify(params.filter);
store.currentFilter = params;
store.isLoading = true;
const response = await axios.get(store.url, {
signal: canceller.signal,