feat: modalLoading and DrawerLoading

This commit is contained in:
dap 2024-09-12 08:04:31 +08:00
parent e1a1a23923
commit 530ec6c4fb
4 changed files with 54 additions and 117 deletions

View File

@ -100,13 +100,11 @@ const [BasicModal, modalApi] = useVbenModal({
},
});
function modalLoading(loading: boolean) {
modalApi.setState({ confirmLoading: loading, loading });
}
async function handleConfirm() {
try {
modalLoading(true);
modalApi.modalLoading(true);
const a = await formApi.validate();
console.log(a);
const { valid } = await formApi.validate();
if (!valid) {
return;
@ -119,7 +117,7 @@ async function handleConfirm() {
} catch (error) {
console.error(error);
} finally {
modalLoading(false);
modalApi.modalLoading(false);
}
}

View File

@ -86,6 +86,14 @@ export class DrawerApi {
}
}
drawerLoading(loading: boolean) {
this.store.setState((prev) => ({
...prev,
confirmLoading: loading,
loading,
}));
}
getData<T extends object = Record<string, any>>() {
return (this.sharedData?.payload ?? {}) as T;
}

View File

@ -99,6 +99,14 @@ export class ModalApi {
return (this.sharedData?.payload ?? {}) as T;
}
modalLoading(loading: boolean) {
this.store.setState((prev) => ({
...prev,
confirmLoading: loading,
loading,
}));
}
/**
*
*/

View File

@ -131,7 +131,7 @@ importers:
dependencies:
'@tinymce/tinymce-vue':
specifier: ^6.0.1
version: 6.0.1(vue@3.5.3(typescript@5.6.2))
version: 6.0.1(vue@3.5.4(typescript@5.6.2))
'@vben/access':
specifier: workspace:*
version: link:../../packages/effects/access
@ -179,17 +179,13 @@ importers:
version: 11.0.3(vue@3.5.4(typescript@5.6.2))
ant-design-vue:
specifier: ^4.2.3
<<<<<<< HEAD
version: 4.2.3(vue@3.5.3(typescript@5.6.2))
version: 4.2.3(vue@3.5.4(typescript@5.6.2))
cropperjs:
specifier: ^1.6.2
version: 1.6.2
crypto-js:
specifier: ^4.2.0
version: 4.2.0
=======
version: 4.2.3(vue@3.5.4(typescript@5.6.2))
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
dayjs:
specifier: ^1.11.13
version: 1.11.13
@ -204,21 +200,16 @@ importers:
version: 4.17.21
pinia:
specifier: 2.2.2
<<<<<<< HEAD
version: 2.2.2(typescript@5.6.2)(vue@3.5.3(typescript@5.6.2))
version: 2.2.2(typescript@5.6.2)(vue@3.5.4(typescript@5.6.2))
tinymce:
specifier: ^7.3.0
version: 7.3.0
=======
version: 2.2.2(typescript@5.6.2)(vue@3.5.4(typescript@5.6.2))
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
vue:
specifier: 3.5.4
version: 3.5.4(typescript@5.6.2)
vue-router:
<<<<<<< HEAD
specifier: ^4.4.3
version: 4.4.3(vue@3.5.3(typescript@5.6.2))
specifier: ^4.4.4
version: 4.4.4(vue@3.5.4(typescript@5.6.2))
devDependencies:
'@types/crypto-js':
specifier: ^4.2.2
@ -228,11 +219,7 @@ importers:
version: 4.17.12
unplugin-vue-components:
specifier: ^0.27.3
version: 0.27.4(@babel/parser@7.25.6)(rollup@4.21.2)(vue@3.5.3(typescript@5.6.2))
=======
specifier: ^4.4.4
version: 4.4.4(vue@3.5.4(typescript@5.6.2))
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
version: 0.27.4(@babel/parser@7.25.6)(rollup@4.21.2)(vue@3.5.4(typescript@5.6.2))
apps/web-ele:
dependencies:
@ -652,11 +639,7 @@ importers:
dependencies:
'@intlify/unplugin-vue-i18n':
specifier: ^4.0.0
<<<<<<< HEAD
version: 4.0.0(rollup@4.21.2)(vue-i18n@9.14.0(vue@3.5.3(typescript@5.6.2)))(webpack-sources@3.2.3)
=======
version: 4.0.0(rollup@4.21.2)(vue-i18n@9.14.0(vue@3.5.4(typescript@5.6.2)))
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
version: 4.0.0(rollup@4.21.2)(vue-i18n@9.14.0(vue@3.5.4(typescript@5.6.2)))(webpack-sources@3.2.3)
'@jspm/generator':
specifier: ^2.3.0
version: 2.3.0
@ -1057,31 +1040,22 @@ importers:
version: link:../../types
'@vueuse/integrations':
specifier: ^11.0.3
<<<<<<< HEAD
version: 11.0.3(async-validator@4.2.5)(axios@1.7.7)(focus-trap@7.5.4)(nprogress@0.2.0)(qrcode@1.5.4)(sortablejs@1.15.3)(vue@3.5.3(typescript@5.6.2))
version: 11.0.3(async-validator@4.2.5)(axios@1.7.7)(focus-trap@7.5.4)(nprogress@0.2.0)(qrcode@1.5.4)(sortablejs@1.15.3)(vue@3.5.4(typescript@5.6.2))
codemirror:
specifier: ^6.0.1
version: 6.0.1(@lezer/common@1.2.1)
=======
version: 11.0.3(async-validator@4.2.5)(axios@1.7.7)(focus-trap@7.5.4)(nprogress@0.2.0)(qrcode@1.5.4)(sortablejs@1.15.3)(vue@3.5.4(typescript@5.6.2))
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
qrcode:
specifier: ^1.5.4
version: 1.5.4
vue:
<<<<<<< HEAD
specifier: 3.5.3
version: 3.5.3(typescript@5.6.2)
vue-codemirror6:
specifier: ^1.3.4
version: 1.3.4(@lezer/common@1.2.1)(vue@3.5.3(typescript@5.6.2))
vue-json-pretty:
specifier: ^2.4.0
version: 2.4.0(vue@3.5.3(typescript@5.6.2))
=======
specifier: 3.5.4
version: 3.5.4(typescript@5.6.2)
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
vue-codemirror6:
specifier: ^1.3.4
version: 1.3.4(@lezer/common@1.2.1)(vue@3.5.4(typescript@5.6.2))
vue-json-pretty:
specifier: ^2.4.0
version: 2.4.0(vue@3.5.4(typescript@5.6.2))
vue-router:
specifier: ^4.4.4
version: 4.4.4(vue@3.5.4(typescript@5.6.2))
@ -2279,7 +2253,6 @@ packages:
resolution: {integrity: sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==}
engines: {node: '>=16.13'}
<<<<<<< HEAD
'@codemirror/autocomplete@6.18.0':
resolution: {integrity: sha512-5DbOvBbY4qW5l57cjDsmmpDh3/TeK1vXfTHa+BUMrRzdWdcxKZ4U4V7vQaTtOpApNU4kLS4FQ6cINtLg245LXA==}
peerDependencies:
@ -2330,12 +2303,8 @@ packages:
'@codemirror/view@6.33.0':
resolution: {integrity: sha512-AroaR3BvnjRW8fiZBalAaK+ZzB5usGgI014YKElYZvQdNH5ZIidHlO+cyf/2rWzyBFRkvG6VhiXeAEbC53P2YQ==}
'@commitlint/cli@19.4.1':
resolution: {integrity: sha512-EerFVII3ZcnhXsDT9VePyIdCJoh3jEzygN1L37MjQXgPfGS6fJTWL/KHClVMod1d8w94lFC3l4Vh/y5ysVAz2A==}
=======
'@commitlint/cli@19.5.0':
resolution: {integrity: sha512-gaGqSliGwB86MDmAAKAtV9SV1SHdmN8pnGq4EJU4+hLisQ7IFfx4jvU4s+pk6tl0+9bv6yT+CaZkufOinkSJIQ==}
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
engines: {node: '>=v18'}
hasBin: true
@ -4134,7 +4103,7 @@ packages:
'@tinymce/tinymce-vue@6.0.1':
resolution: {integrity: sha512-VzjI8AKlNrrsosIk3WuBez6kubqPsPMeaButkRLuts77uo4e2EwPRFX+VyB6fHbMGHwUPK22zNjOUGMvJFZFCw==}
peerDependencies:
vue: 3.5.3
vue: 3.5.4
'@tootallnate/once@1.1.2':
resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==}
@ -9535,14 +9504,13 @@ packages:
resolution: {integrity: sha512-jByUGY3FG2B8RJKFryqxx4eNtSTj+Hjlo8edcOdJymewndDQjThZ1pRUQHRjQsbKhTV2jEctJV7t7RJ405UL4g==}
engines: {node: '>=14.19.0'}
<<<<<<< HEAD
unplugin-vue-components@0.27.4:
resolution: {integrity: sha512-1XVl5iXG7P1UrOMnaj2ogYa5YTq8aoh5jwDPQhemwO/OrXW+lPQKDXd1hMz15qxQPxgb/XXlbgo3HQ2rLEbmXQ==}
engines: {node: '>=14'}
peerDependencies:
'@babel/parser': ^7.15.8
'@nuxt/kit': ^3.2.2
vue: 3.5.3
vue: 3.5.4
peerDependenciesMeta:
'@babel/parser':
optional: true
@ -9553,12 +9521,8 @@ packages:
resolution: {integrity: sha512-bEqQxeC7rxtxPZ3M5V4Djcc4lQqKPgGe3mAWZvxcSmX5jhGxll19NliaRzQSQPrk4xJZSGniK3puLWpRuZN7VQ==}
engines: {node: '>=14.0.0'}
unplugin@1.14.0:
resolution: {integrity: sha512-cfkZeALGyW7tKYjZbi0G+pn0XnUFa0QvLIeLJEUUlnU0R8YYsBQnt5+h9Eu1B7AB7KETld+UBFI5lOeBL+msoQ==}
=======
unplugin@1.14.1:
resolution: {integrity: sha512-lBlHbfSFPToDYp9pjXlUEFVxYLaue9f9T1HC+4OHlmj+HnMDdz9oZY+erXfoCe/5V/7gKUSY2jpXPb9S7f0f/w==}
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
engines: {node: '>=14.0.0'}
peerDependencies:
webpack-sources: ^3
@ -9820,7 +9784,7 @@ packages:
resolution: {integrity: sha512-Gmu2t4Exz3pQdtAsb7wINREx2nswNW+FV+q8S1wmsmeC3OLio5RkybRLsErP1b8+suqsVD/7t0Cx/XmBpQnHJA==}
engines: {yarn: '>=1.22.19'}
peerDependencies:
vue: 3.5.3
vue: 3.5.4
vue-component-type-helpers@2.1.6:
resolution: {integrity: sha512-ng11B8B/ZADUMMOsRbqv0arc442q7lifSubD0v8oDXIFoMg/mXwAPUunrroIDkY+mcD0dHKccdaznSVp8EoX3w==}
@ -9848,19 +9812,14 @@ packages:
peerDependencies:
vue: 3.5.4
<<<<<<< HEAD
vue-json-pretty@2.4.0:
resolution: {integrity: sha512-e9bP41DYYIc2tWaB6KuwqFJq5odZ8/GkE6vHQuGcbPn37kGk4a3n1RNw3ZYeDrl66NWXgTlOfS+M6NKkowmkWw==}
engines: {node: '>= 10.0.0', npm: '>= 5.0.0'}
peerDependencies:
vue: 3.5.3
vue: 3.5.4
vue-router@4.4.3:
resolution: {integrity: sha512-sv6wmNKx2j3aqJQDMxLFzs/u/mjA9Z5LCgy6BE0f7yFWMjrPLnS/sPNn8ARY/FXw6byV18EFutn5lTO6+UsV5A==}
=======
vue-router@4.4.4:
resolution: {integrity: sha512-3MlnDqwRwZwCQVbtVfpsU+nrNymNjnXSsQtXName5925NVC1+326VVfYH9vSrA0N13teGEo8z5x7gbRnGjCDiQ==}
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
peerDependencies:
vue: 3.5.4
@ -11354,7 +11313,6 @@ snapshots:
dependencies:
mime: 3.0.0
<<<<<<< HEAD
'@codemirror/autocomplete@6.18.0(@codemirror/language@6.10.2)(@codemirror/state@6.4.1)(@codemirror/view@6.33.0)(@lezer/common@1.2.1)':
dependencies:
'@codemirror/language': 6.10.2
@ -11471,10 +11429,7 @@ snapshots:
style-mod: 4.1.2
w3c-keyname: 2.2.8
'@commitlint/cli@19.4.1(@types/node@22.5.4)(typescript@5.6.2)':
=======
'@commitlint/cli@19.5.0(@types/node@22.5.4)(typescript@5.6.2)':
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
dependencies:
'@commitlint/format': 19.5.0
'@commitlint/lint': 19.5.0
@ -12459,11 +12414,7 @@ snapshots:
'@intlify/shared@9.14.0': {}
<<<<<<< HEAD
'@intlify/unplugin-vue-i18n@4.0.0(rollup@4.21.2)(vue-i18n@9.14.0(vue@3.5.3(typescript@5.6.2)))(webpack-sources@3.2.3)':
=======
'@intlify/unplugin-vue-i18n@4.0.0(rollup@4.21.2)(vue-i18n@9.14.0(vue@3.5.4(typescript@5.6.2)))':
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
'@intlify/unplugin-vue-i18n@4.0.0(rollup@4.21.2)(vue-i18n@9.14.0(vue@3.5.4(typescript@5.6.2)))(webpack-sources@3.2.3)':
dependencies:
'@intlify/bundle-utils': 8.0.0(vue-i18n@9.14.0(vue@3.5.4(typescript@5.6.2)))
'@intlify/shared': 9.14.0
@ -12476,11 +12427,7 @@ snapshots:
pathe: 1.1.2
picocolors: 1.1.0
source-map-js: 1.2.1
<<<<<<< HEAD
unplugin: 1.14.0(webpack-sources@3.2.3)
=======
unplugin: 1.14.1
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
unplugin: 1.14.1(webpack-sources@3.2.3)
optionalDependencies:
vue-i18n: 9.14.0(vue@3.5.4(typescript@5.6.2))
transitivePeerDependencies:
@ -13214,10 +13161,10 @@ snapshots:
'@tanstack/virtual-core': 3.10.7
vue: 3.5.4(typescript@5.6.2)
'@tinymce/tinymce-vue@6.0.1(vue@3.5.3(typescript@5.6.2))':
'@tinymce/tinymce-vue@6.0.1(vue@3.5.4(typescript@5.6.2))':
dependencies:
tinymce: 7.3.0
vue: 3.5.3(typescript@5.6.2)
vue: 3.5.4(typescript@5.6.2)
'@tootallnate/once@1.1.2': {}
@ -19181,11 +19128,7 @@ snapshots:
acorn: 8.12.1
estree-walker: 3.0.3
magic-string: 0.30.11
<<<<<<< HEAD
unplugin: 1.14.0(webpack-sources@3.2.3)
=======
unplugin: 1.14.1
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
unplugin: 1.14.1(webpack-sources@3.2.3)
transitivePeerDependencies:
- webpack-sources
@ -19232,11 +19175,7 @@ snapshots:
pkg-types: 1.2.0
scule: 1.3.0
strip-literal: 2.1.0
<<<<<<< HEAD
unplugin: 1.14.0(webpack-sources@3.2.3)
=======
unplugin: 1.14.1
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
unplugin: 1.14.1(webpack-sources@3.2.3)
transitivePeerDependencies:
- rollup
- webpack-sources
@ -19287,17 +19226,12 @@ snapshots:
'@rollup/pluginutils': 5.1.0(rollup@4.21.2)
es-module-lexer: 1.5.4
magic-string: 0.30.11
<<<<<<< HEAD
unplugin: 1.14.0(webpack-sources@3.2.3)
=======
unplugin: 1.14.1
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
unplugin: 1.14.1(webpack-sources@3.2.3)
transitivePeerDependencies:
- rollup
- webpack-sources
<<<<<<< HEAD
unplugin-vue-components@0.27.4(@babel/parser@7.25.6)(rollup@4.21.2)(vue@3.5.3(typescript@5.6.2)):
unplugin-vue-components@0.27.4(@babel/parser@7.25.6)(rollup@4.21.2)(vue@3.5.4(typescript@5.6.2)):
dependencies:
'@antfu/utils': 0.7.10
'@rollup/pluginutils': 5.1.0(rollup@4.21.2)
@ -19309,7 +19243,7 @@ snapshots:
minimatch: 9.0.5
mlly: 1.7.1
unplugin: 1.12.2
vue: 3.5.3(typescript@5.6.2)
vue: 3.5.4(typescript@5.6.2)
optionalDependencies:
'@babel/parser': 7.25.6
transitivePeerDependencies:
@ -19323,10 +19257,7 @@ snapshots:
webpack-sources: 3.2.3
webpack-virtual-modules: 0.6.2
unplugin@1.14.0(webpack-sources@3.2.3):
=======
unplugin@1.14.1:
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
unplugin@1.14.1(webpack-sources@3.2.3):
dependencies:
acorn: 8.12.1
webpack-virtual-modules: 0.6.2
@ -19375,11 +19306,7 @@ snapshots:
mlly: 1.7.1
pathe: 1.1.2
pkg-types: 1.2.0
<<<<<<< HEAD
unplugin: 1.14.0(webpack-sources@3.2.3)
=======
unplugin: 1.14.1
>>>>>>> 855ac026221c809a1dad786c43fb619b4d8f9094
unplugin: 1.14.1(webpack-sources@3.2.3)
transitivePeerDependencies:
- webpack-sources
@ -19679,11 +19606,11 @@ snapshots:
vscode-uri@3.0.8: {}
vue-codemirror6@1.3.4(@lezer/common@1.2.1)(vue@3.5.3(typescript@5.6.2)):
vue-codemirror6@1.3.4(@lezer/common@1.2.1)(vue@3.5.4(typescript@5.6.2)):
dependencies:
codemirror: 6.0.1(@lezer/common@1.2.1)
vue: 3.5.3(typescript@5.6.2)
vue-demi: 0.14.10(vue@3.5.3(typescript@5.6.2))
vue: 3.5.4(typescript@5.6.2)
vue-demi: 0.14.10(vue@3.5.4(typescript@5.6.2))
transitivePeerDependencies:
- '@lezer/common'
- '@vue/composition-api'
@ -19714,15 +19641,11 @@ snapshots:
'@vue/devtools-api': 6.6.4
vue: 3.5.4(typescript@5.6.2)
<<<<<<< HEAD
vue-json-pretty@2.4.0(vue@3.5.3(typescript@5.6.2)):
vue-json-pretty@2.4.0(vue@3.5.4(typescript@5.6.2)):
dependencies:
vue: 3.5.3(typescript@5.6.2)
vue: 3.5.4(typescript@5.6.2)
vue-router@4.4.3(vue@3.5.3(typescript@5.6.2)):
=======
vue-router@4.4.4(vue@3.5.4(typescript@5.6.2)):
>>>>>>> 8f6bf6add3bc0f28df3f2269cbdb2f32fa72470d
dependencies:
'@vue/devtools-api': 6.6.4
vue: 3.5.4(typescript@5.6.2)