diff --git a/README.ja-JP.md b/README.ja-JP.md index f1f90487083..baa4cc44868 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -125,6 +125,10 @@ pnpm build [@Vben](https://github.com/anncwb) +## スター歴史 + +[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) + ## 寄付 このプロジェクトが役に立つと思われた場合、作者にコーヒーを一杯おごってサポートを示すことができます! @@ -133,10 +137,6 @@ pnpm build Paypal Me -## スター歴史 - -[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) - ## 貢献者 diff --git a/README.md b/README.md index 727e8df2b7b..a65213ab9ac 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,10 @@ Support modern browsers, not IE [@Vben](https://github.com/anncwb) +## Star History + +[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) + ## Donate If you think this project is helpful to you, you can help the author buy a cup of coffee to show your support! @@ -132,10 +136,6 @@ If you think this project is helpful to you, you can help the author buy a cup o Paypal Me -## Star History - -[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) - ## Contributor diff --git a/README.zh-CN.md b/README.zh-CN.md index 5ad579f5b57..e2f05bb98be 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -77,6 +77,10 @@ pnpm dev pnpm build ``` +## 更新日志 + +[CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases) + ## 如何贡献 非常欢迎你的加入![提一个 Issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) 或者提交一个 Pull Request。 @@ -120,6 +124,10 @@ pnpm build [@Vben](https://github.com/anncwb) +## Star History + +[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) + ## 捐赠 如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! @@ -128,14 +136,6 @@ pnpm build Paypal Me -## 更新日志 - -[CHANGELOG](https://github.com/vbenjs/vue-vben-admin/releases) - -## Star History - -[![Star History Chart](https://api.star-history.com/svg?repos=vbenjs/vue-vben-admin&type=Date)](https://star-history.com/#vbenjs/vue-vben-admin&Date) - ## Contributor diff --git a/apps/web-antd/src/api/request.ts b/apps/web-antd/src/api/request.ts index 3c7ad767866..101fb5eb2d5 100644 --- a/apps/web-antd/src/api/request.ts +++ b/apps/web-antd/src/api/request.ts @@ -93,7 +93,10 @@ function createRequestClient(baseURL: string) { // 通用的错误处理,如果没有进入上面的错误处理逻辑,就会进入这里 client.addResponseInterceptor( - errorMessageResponseInterceptor((msg: string) => message.error(msg)), + errorMessageResponseInterceptor((msg: string, _error) => { + // 这里可以根据业务进行定制,你可以拿到 error 内的信息进行定制化处理,根据不同的 code 做不同的提示,而不是直接使用 message.error 提示 msg + message.error(msg); + }), ); return client; diff --git a/apps/web-ele/src/api/request.ts b/apps/web-ele/src/api/request.ts index 448dc28d06c..639b75c61c2 100644 --- a/apps/web-ele/src/api/request.ts +++ b/apps/web-ele/src/api/request.ts @@ -93,7 +93,10 @@ function createRequestClient(baseURL: string) { // 通用的错误处理,如果没有进入上面的错误处理逻辑,就会进入这里 client.addResponseInterceptor( - errorMessageResponseInterceptor((msg: string) => ElMessage.error(msg)), + errorMessageResponseInterceptor((msg: string, _error) => { + // 这里可以根据业务进行定制,你可以拿到 error 内的信息进行定制化处理,根据不同的 code 做不同的提示,而不是直接使用 message.error 提示 msg + ElMessage.error(msg); + }), ); return client; diff --git a/apps/web-naive/src/api/request.ts b/apps/web-naive/src/api/request.ts index 87207037669..55236ca4610 100644 --- a/apps/web-naive/src/api/request.ts +++ b/apps/web-naive/src/api/request.ts @@ -92,7 +92,10 @@ function createRequestClient(baseURL: string) { // 通用的错误处理,如果没有进入上面的错误处理逻辑,就会进入这里 client.addResponseInterceptor( - errorMessageResponseInterceptor((msg: string) => message.error(msg)), + errorMessageResponseInterceptor((msg: string, _error) => { + // 这里可以根据业务进行定制,你可以拿到 error 内的信息进行定制化处理,根据不同的 code 做不同的提示,而不是直接使用 message.error 提示 msg + message.error(msg); + }), ); return client; diff --git a/packages/@core/ui-kit/form-ui/src/form-api.ts b/packages/@core/ui-kit/form-ui/src/form-api.ts index 220b8c36c23..459ba0805a9 100644 --- a/packages/@core/ui-kit/form-ui/src/form-api.ts +++ b/packages/@core/ui-kit/form-ui/src/form-api.ts @@ -43,11 +43,11 @@ function getDefaultState(): VbenFormProps { } export class FormApi { + private prevState: null | VbenFormProps = null; // private api: Pick; public form = {} as FormActions; - isMounted = false; - // private prevState!: ModalState; + isMounted = false; public state: null | VbenFormProps = null; stateHandler: StateHandler; @@ -66,7 +66,9 @@ export class FormApi { }, { onUpdate: () => { + this.prevState = this.state; this.state = this.store.state; + this.updateState(); }, }, ); @@ -87,6 +89,24 @@ export class FormApi { return this.form; } + private updateState() { + const currentSchema = this.state?.schema ?? []; + const prevSchema = this.prevState?.schema ?? []; + // 进行了删除schema操作 + if (currentSchema.length < prevSchema.length) { + const currentFields = new Set( + currentSchema.map((item) => item.fieldName), + ); + const deletedSchema = prevSchema.filter( + (item) => !currentFields.has(item.fieldName), + ); + + for (const schema of deletedSchema) { + this.form?.setFieldValue(schema.fieldName, undefined); + } + } + } + // 如果需要多次更新状态,可以使用 batch 方法 batchStore(cb: () => void) { this.store.batch(cb); diff --git a/playground/src/api/request.ts b/playground/src/api/request.ts index 840542e1d64..7952def2bce 100644 --- a/playground/src/api/request.ts +++ b/playground/src/api/request.ts @@ -94,7 +94,10 @@ function createRequestClient(baseURL: string) { // 通用的错误处理,如果没有进入上面的错误处理逻辑,就会进入这里 client.addResponseInterceptor( - errorMessageResponseInterceptor((msg: string) => message.error(msg)), + errorMessageResponseInterceptor((msg: string, _error) => { + // 这里可以根据业务进行定制,你可以拿到 error 内的信息进行定制化处理,根据不同的 code 做不同的提示,而不是直接使用 message.error 提示 msg + message.error(msg); + }), ); return client; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db41406f391..2bbc7157b5e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,8 +28,8 @@ catalogs: specifier: ^9.11.0 version: 9.11.0 '@iconify/json': - specifier: ^2.2.251 - version: 2.2.251 + specifier: ^2.2.252 + version: 2.2.252 '@iconify/tailwind': specifier: ^1.1.3 version: 1.1.3 @@ -37,10 +37,10 @@ catalogs: specifier: ^4.1.2 version: 4.1.2 '@intlify/core-base': - specifier: ^10.0.2 + specifier: ^10.0.3 version: 10.0.3 '@intlify/unplugin-vue-i18n': - specifier: ^5.0.0 + specifier: ^5.2.0 version: 5.2.0 '@jspm/generator': specifier: ^2.3.1 @@ -58,8 +58,8 @@ catalogs: specifier: ^1.0.0 version: 1.0.0 '@stylistic/stylelint-plugin': - specifier: ^3.0.1 - version: 3.0.1 + specifier: ^3.1.0 + version: 3.1.0 '@tailwindcss/nesting': specifier: 0.0.0-insiders.565cd3e version: 0.0.0-insiders.565cd3e @@ -220,8 +220,8 @@ catalogs: specifier: ^3.2.0 version: 3.2.0 eslint-plugin-import-x: - specifier: ^4.2.1 - version: 4.2.1 + specifier: ^4.3.0 + version: 4.3.0 eslint-plugin-jsdoc: specifier: ^50.2.4 version: 50.2.4 @@ -337,8 +337,8 @@ catalogs: specifier: ^16.1.0 version: 16.1.0 postcss-preset-env: - specifier: ^10.0.3 - version: 10.0.4 + specifier: ^10.0.5 + version: 10.0.5 postcss-scss: specifier: ^4.0.9 version: 4.0.9 @@ -463,7 +463,7 @@ catalogs: specifier: ^9.4.3 version: 9.4.3 vue-i18n: - specifier: ^10.0.2 + specifier: ^10.0.3 version: 10.0.3 vue-router: specifier: ^4.4.5 @@ -880,7 +880,7 @@ importers: version: 0.2.5(eslint@9.11.0(jiti@1.21.6)) eslint-plugin-import-x: specifier: 'catalog:' - version: 4.2.1(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) + version: 4.3.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) devDependencies: '@eslint/js': specifier: 'catalog:' @@ -956,7 +956,7 @@ importers: dependencies: '@stylistic/stylelint-plugin': specifier: 'catalog:' - version: 3.0.1(stylelint@16.9.0(typescript@5.6.2)) + version: 3.1.0(stylelint@16.9.0(typescript@5.6.2)) stylelint-config-recess-order: specifier: 'catalog:' version: 5.1.1(stylelint@16.9.0(typescript@5.6.2)) @@ -1045,7 +1045,7 @@ importers: dependencies: '@iconify/json': specifier: 'catalog:' - version: 2.2.251 + version: 2.2.252 '@iconify/tailwind': specifier: 'catalog:' version: 1.1.3 @@ -1072,7 +1072,7 @@ importers: version: 16.1.0(postcss@8.4.47) postcss-preset-env: specifier: 'catalog:' - version: 10.0.4(postcss@8.4.47) + version: 10.0.5(postcss@8.4.47) tailwindcss: specifier: 'catalog:' version: 3.4.12 @@ -3088,8 +3088,8 @@ packages: peerDependencies: postcss: ^8.4 - '@csstools/postcss-light-dark-function@2.0.3': - resolution: {integrity: sha512-8+lV5IKySJGtBXOwRVBPzwnTsVGKdsjnszsC/21DdKI+F279HcOfWgwTNpE0+NvX78bTlDD2kMqTaJ4T0VYzvA==} + '@csstools/postcss-light-dark-function@2.0.4': + resolution: {integrity: sha512-yHUt5DZ61Irvp72notmAl3Zt4Me50EWToWNocazyIFTVYFwwo/EucmV3hWi9zJehu3rOSvMclL7DzvRDfbak/A==} engines: {node: '>=18'} peerDependencies: postcss: ^8.4 @@ -3886,8 +3886,8 @@ packages: '@iconify-json/vscode-icons@1.2.2': resolution: {integrity: sha512-bTpT0HJDRqGkxQv8oiETNHLEnBZpnA1QaRD35CQyO7M7qgWVLx2xwn/lK6e4waojmlPC3ckMBx3WFIUUn0/Jdg==} - '@iconify/json@2.2.251': - resolution: {integrity: sha512-QltbOmMpDbjHG7F7shvkmnLu7UTEmf96Vuz+Mt7iWnr8V6bUTv9KSv5fuaZaYWL7zUN5FM4AZlY68/8JgQlRWg==} + '@iconify/json@2.2.252': + resolution: {integrity: sha512-AtdDjLhN4aBEncnWghiw9JdBRxKAXFcaQmwDFDWPL1UF/cPuuC8BADZzfHIoVcVlEvEbv69tFrzmhj1z/+PGlA==} '@iconify/tailwind@1.1.3': resolution: {integrity: sha512-SfyeT+2b/aKWA6DjwdevXdLUqaEqJ5xWTegD92KItaWc47IYsGuqrt/GOz4dJCPcTVCrsUjlvMpy8cNd+uV5nQ==} @@ -4454,8 +4454,8 @@ packages: resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} engines: {node: '>=18'} - '@stylistic/stylelint-plugin@3.0.1': - resolution: {integrity: sha512-j3mH8HSw2Rob/KJFWZ627w3CQ8gQqVHtzCdPeEffUg5vOgpz4rgrR+Xw2kU0OQCDcdW8Y1nKfdXKKjM5Rn8X0g==} + '@stylistic/stylelint-plugin@3.1.0': + resolution: {integrity: sha512-NU2XR6i1x163KdyDj3zqblA13890fBzHNZYqZ13aor/sB3Yq8kU/0NKCudv5pfl9Kb/UAteo/D7vKMHtaror/A==} engines: {node: ^18.12 || >=20.9} peerDependencies: stylelint: ^16.8.0 @@ -6264,8 +6264,8 @@ packages: peerDependencies: eslint: '>=4.19.1' - eslint-plugin-import-x@4.2.1: - resolution: {integrity: sha512-WWi2GedccIJa0zXxx3WDnTgouGQTtdYK1nhXMwywbqqAgB0Ov+p1pYBsWh3VaB0bvBOwLse6OfVII7jZD9xo5Q==} + eslint-plugin-import-x@4.3.0: + resolution: {integrity: sha512-PxGzP7gAjF2DLeRnQtbYkkgZDg1intFyYr/XS1LgTYXUDrSXMHGkXx8++6i2eDv2jMs0jfeO6G6ykyeWxiFX7w==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -8580,8 +8580,8 @@ packages: peerDependencies: postcss: ^8.4 - postcss-preset-env@10.0.4: - resolution: {integrity: sha512-FKwHOV7NHxu7PNhAhhOSwbAQrHTcvF/yfrObNMr4iTljmPYzsM7eRr9sYhSFq2if1GahrAv1SmmhFrcNWdFIuA==} + postcss-preset-env@10.0.5: + resolution: {integrity: sha512-ipPOgr3RY0utgJDbNoCX2dxKoQ4e4WO1pC21QhDlxCAX8+qC8O2Ezkzb54fd+8XtZ1UveA5gLjBsVo6dJDoWIg==} engines: {node: '>=18'} peerDependencies: postcss: ^8.4 @@ -12060,7 +12060,7 @@ snapshots: postcss: 8.4.47 postcss-selector-parser: 6.1.2 - '@csstools/postcss-light-dark-function@2.0.3(postcss@8.4.47)': + '@csstools/postcss-light-dark-function@2.0.4(postcss@8.4.47)': dependencies: '@csstools/css-parser-algorithms': 3.0.1(@csstools/css-tokenizer@3.0.1) '@csstools/css-tokenizer': 3.0.1 @@ -12581,7 +12581,7 @@ snapshots: dependencies: '@iconify/types': 2.0.0 - '@iconify/json@2.2.251': + '@iconify/json@2.2.252': dependencies: '@iconify/types': 2.0.0 pathe: 1.1.2 @@ -13358,7 +13358,7 @@ snapshots: '@sindresorhus/merge-streams@4.0.0': {} - '@stylistic/stylelint-plugin@3.0.1(stylelint@16.9.0(typescript@5.6.2))': + '@stylistic/stylelint-plugin@3.1.0(stylelint@16.9.0(typescript@5.6.2))': dependencies: '@csstools/css-parser-algorithms': 3.0.1(@csstools/css-tokenizer@3.0.1) '@csstools/css-tokenizer': 3.0.1 @@ -15559,7 +15559,7 @@ snapshots: eslint: 9.11.0(jiti@1.21.6) ignore: 5.3.2 - eslint-plugin-import-x@4.2.1(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2): + eslint-plugin-import-x@4.3.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2): dependencies: '@typescript-eslint/utils': 8.6.0(eslint@9.11.0(jiti@1.21.6))(typescript@5.6.2) debug: 4.3.7 @@ -18026,7 +18026,7 @@ snapshots: postcss: 8.4.47 postcss-value-parser: 4.2.0 - postcss-preset-env@10.0.4(postcss@8.4.47): + postcss-preset-env@10.0.5(postcss@8.4.47): dependencies: '@csstools/postcss-cascade-layers': 5.0.0(postcss@8.4.47) '@csstools/postcss-color-function': 4.0.2(postcss@8.4.47) @@ -18040,7 +18040,7 @@ snapshots: '@csstools/postcss-ic-unit': 4.0.0(postcss@8.4.47) '@csstools/postcss-initial': 2.0.0(postcss@8.4.47) '@csstools/postcss-is-pseudo-class': 5.0.0(postcss@8.4.47) - '@csstools/postcss-light-dark-function': 2.0.3(postcss@8.4.47) + '@csstools/postcss-light-dark-function': 2.0.4(postcss@8.4.47) '@csstools/postcss-logical-float-and-clear': 3.0.0(postcss@8.4.47) '@csstools/postcss-logical-overflow': 2.0.0(postcss@8.4.47) '@csstools/postcss-logical-overscroll-behavior': 2.0.0(postcss@8.4.47) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 8a02c71c0cb..49ea61ad635 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -21,17 +21,17 @@ catalog: '@commitlint/config-conventional': ^19.5.0 '@ctrl/tinycolor': ^4.1.0 '@eslint/js': ^9.11.0 - '@iconify/json': ^2.2.251 + '@iconify/json': ^2.2.252 '@iconify/tailwind': ^1.1.3 '@iconify/vue': ^4.1.2 - '@intlify/core-base': ^10.0.2 - '@intlify/unplugin-vue-i18n': ^5.0.0 + '@intlify/core-base': ^10.0.3 + '@intlify/unplugin-vue-i18n': ^5.2.0 '@jspm/generator': ^2.3.1 '@manypkg/get-packages': ^2.2.2 '@nolebase/vitepress-plugin-git-changelog': ^2.5.0 '@playwright/test': ^1.47.2 '@radix-icons/vue': ^1.0.0 - '@stylistic/stylelint-plugin': ^3.0.1 + '@stylistic/stylelint-plugin': ^3.1.0 '@tailwindcss/nesting': 0.0.0-insiders.565cd3e '@tailwindcss/typography': ^0.5.15 '@tanstack/vue-query': ^5.56.2 @@ -86,7 +86,7 @@ catalog: eslint-config-turbo: ^2.1.2 eslint-plugin-command: ^0.2.5 eslint-plugin-eslint-comments: ^3.2.0 - eslint-plugin-import-x: ^4.2.1 + eslint-plugin-import-x: ^4.3.0 eslint-plugin-jsdoc: ^50.2.4 eslint-plugin-jsonc: ^2.16.0 eslint-plugin-n: ^17.10.3 @@ -126,7 +126,7 @@ catalog: postcss-antd-fixes: ^0.2.0 postcss-html: ^1.7.0 postcss-import: ^16.1.0 - postcss-preset-env: ^10.0.3 + postcss-preset-env: ^10.0.5 postcss-scss: ^4.0.9 prettier: ^3.3.3 prettier-plugin-tailwindcss: ^0.6.6 @@ -169,7 +169,7 @@ catalog: vitest: ^2.1.1 vue: ^3.5.8 vue-eslint-parser: ^9.4.3 - vue-i18n: ^10.0.2 + vue-i18n: ^10.0.3 vue-router: ^4.4.5 vue-tsc: ^2.1.6 watermark-js-plus: ^1.5.6