fix: resolve issue with grid reload parameter not working (#4888)

pull/48/MERGE
Vben 2024-11-13 22:06:04 +08:00 committed by vben
parent 8cc73cf59c
commit 5b079471b9
4 changed files with 361 additions and 120 deletions

View File

@ -99,7 +99,7 @@
"node": ">=20.10.0", "node": ">=20.10.0",
"pnpm": ">=9.12.0" "pnpm": ">=9.12.0"
}, },
"packageManager": "pnpm@9.12.3", "packageManager": "pnpm@9.13.0",
"pnpm": { "pnpm": {
"peerDependencyRules": { "peerDependencyRules": {
"allowedVersions": { "allowedVersions": {

View File

@ -1,3 +1,4 @@
import type { Recordable } from '@vben/types';
import type { VxeGridProps, VxeUIExport } from 'vxe-table'; import type { VxeGridProps, VxeUIExport } from 'vxe-table';
import type { VxeGridApi } from './api'; import type { VxeGridApi } from './api';
@ -7,7 +8,7 @@ import { formatDate, formatDateTime, isFunction } from '@vben/utils';
export function extendProxyOptions( export function extendProxyOptions(
api: VxeGridApi, api: VxeGridApi,
options: VxeGridProps, options: VxeGridProps,
getFormValues: () => Record<string, any>, getFormValues: () => Recordable<any>,
) { ) {
[ [
'query', 'query',
@ -25,17 +26,28 @@ function extendProxyOption(
key: string, key: string,
api: VxeGridApi, api: VxeGridApi,
options: VxeGridProps, options: VxeGridProps,
getFormValues: () => Record<string, any>, getFormValues: () => Recordable<any>,
) { ) {
const { proxyConfig } = options; const { proxyConfig } = options;
const configFn = (proxyConfig?.ajax as any)?.[key]; const configFn = (proxyConfig?.ajax as Recordable<any>)?.[key];
if (!isFunction(configFn)) { if (!isFunction(configFn)) {
return options; return options;
} }
const wrapperFn = async (params: any, _formValues: any, ...args: any[]) => { const wrapperFn = async (
params: Recordable<any>,
customValues: Recordable<any>,
...args: Recordable<any>[]
) => {
const formValues = getFormValues(); const formValues = getFormValues();
const data = await configFn(params, formValues, ...args); const data = await configFn(
params,
{
...customValues,
...formValues,
},
...args,
);
return data; return data;
}; };
api.setState({ api.setState({

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,7 @@ catalog:
'@ctrl/tinycolor': ^4.1.0 '@ctrl/tinycolor': ^4.1.0
'@eslint/js': ^9.14.0 '@eslint/js': ^9.14.0
'@faker-js/faker': ^9.2.0 '@faker-js/faker': ^9.2.0
'@iconify/json': ^2.2.270 '@iconify/json': ^2.2.271
'@iconify/tailwind': ^1.1.3 '@iconify/tailwind': ^1.1.3
'@iconify/vue': ^4.1.2 '@iconify/vue': ^4.1.2
'@intlify/core-base': ^10.0.4 '@intlify/core-base': ^10.0.4
@ -37,7 +37,7 @@ catalog:
'@tailwindcss/nesting': 0.0.0-insiders.565cd3e '@tailwindcss/nesting': 0.0.0-insiders.565cd3e
'@tailwindcss/typography': ^0.5.15 '@tailwindcss/typography': ^0.5.15
'@tanstack/vue-query': ^5.59.20 '@tanstack/vue-query': ^5.59.20
'@tanstack/vue-store': ^0.5.6 '@tanstack/vue-store': ^0.5.7
'@types/archiver': ^6.0.3 '@types/archiver': ^6.0.3
'@types/eslint': ^9.6.1 '@types/eslint': ^9.6.1
'@types/html-minifier-terser': ^7.0.2 '@types/html-minifier-terser': ^7.0.2
@ -53,7 +53,7 @@ catalog:
'@typescript-eslint/parser': ^8.14.0 '@typescript-eslint/parser': ^8.14.0
'@vee-validate/zod': ^4.14.7 '@vee-validate/zod': ^4.14.7
'@vite-pwa/vitepress': ^0.5.3 '@vite-pwa/vitepress': ^0.5.3
'@vitejs/plugin-vue': ^5.1.5 '@vitejs/plugin-vue': ^5.2.0
'@vitejs/plugin-vue-jsx': ^4.1.0 '@vitejs/plugin-vue-jsx': ^4.1.0
'@vue/reactivity': ^3.5.12 '@vue/reactivity': ^3.5.12
'@vue/shared': ^3.5.12 '@vue/shared': ^3.5.12
@ -89,7 +89,7 @@ catalog:
eslint-plugin-command: ^0.2.6 eslint-plugin-command: ^0.2.6
eslint-plugin-eslint-comments: ^3.2.0 eslint-plugin-eslint-comments: ^3.2.0
eslint-plugin-import-x: ^4.4.2 eslint-plugin-import-x: ^4.4.2
eslint-plugin-jsdoc: ^50.4.3 eslint-plugin-jsdoc: ^50.5.0
eslint-plugin-jsonc: ^2.18.1 eslint-plugin-jsonc: ^2.18.1
eslint-plugin-n: ^17.13.1 eslint-plugin-n: ^17.13.1
eslint-plugin-no-only-tests: ^3.3.0 eslint-plugin-no-only-tests: ^3.3.0
@ -105,7 +105,7 @@ catalog:
get-port: ^7.1.0 get-port: ^7.1.0
globals: ^15.12.0 globals: ^15.12.0
h3: ^1.13.0 h3: ^1.13.0
happy-dom: ^15.11.2 happy-dom: ^15.11.4
html-minifier-terser: ^7.2.0 html-minifier-terser: ^7.2.0
husky: ^9.1.6 husky: ^9.1.6
is-ci: ^3.0.1 is-ci: ^3.0.1
@ -137,7 +137,7 @@ catalog:
radix-vue: ^1.9.9 radix-vue: ^1.9.9
resolve.exports: ^2.0.2 resolve.exports: ^2.0.2
rimraf: ^6.0.1 rimraf: ^6.0.1
rollup: ^4.25.0 rollup: ^4.26.0
rollup-plugin-visualizer: ^5.12.0 rollup-plugin-visualizer: ^5.12.0
sass: 1.80.6 sass: 1.80.6
sortablejs: ^1.15.3 sortablejs: ^1.15.3
@ -164,7 +164,7 @@ catalog:
vite-plugin-dts: 4.2.1 vite-plugin-dts: 4.2.1
vite-plugin-html: ^3.2.2 vite-plugin-html: ^3.2.2
vite-plugin-lazy-import: ^1.0.7 vite-plugin-lazy-import: ^1.0.7
vite-plugin-pwa: ^0.20.5 vite-plugin-pwa: ^0.21.0
vite-plugin-vue-devtools: ^7.6.4 vite-plugin-vue-devtools: ^7.6.4
vitepress: ^1.5.0 vitepress: ^1.5.0
vitepress-plugin-group-icons: ^1.3.0 vitepress-plugin-group-icons: ^1.3.0
@ -174,8 +174,8 @@ catalog:
vue-i18n: ^10.0.4 vue-i18n: ^10.0.4
vue-router: ^4.4.5 vue-router: ^4.4.5
vue-tsc: ^2.1.10 vue-tsc: ^2.1.10
vxe-pc-ui: ^4.2.51 vxe-pc-ui: ^4.2.53
vxe-table: ^4.8.10 vxe-table: ^4.8.14
watermark-js-plus: ^1.5.7 watermark-js-plus: ^1.5.7
zod: ^3.23.8 zod: ^3.23.8
zod-defaults: ^0.1.3 zod-defaults: ^0.1.3