Skip to content

Commit c3243dc

Browse files
authored
Merge branch 'main' into rounded
2 parents 66796a4 + 3f0d308 commit c3243dc

File tree

10 files changed

+73
-38
lines changed

10 files changed

+73
-38
lines changed

packages/@core/base/shared/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"lodash.clonedeep": "catalog:",
8989
"lodash.get": "catalog:",
9090
"lodash.isequal": "catalog:",
91+
"lodash.set": "catalog:",
9192
"nprogress": "catalog:",
9293
"tailwind-merge": "catalog:",
9394
"theme-colors": "catalog:"
@@ -96,6 +97,7 @@
9697
"@types/lodash.clonedeep": "catalog:",
9798
"@types/lodash.get": "catalog:",
9899
"@types/lodash.isequal": "catalog:",
100+
"@types/lodash.set": "catalog:",
99101
"@types/nprogress": "catalog:"
100102
}
101103
}

packages/@core/base/shared/src/utils/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ export * from './window';
1717
export { default as cloneDeep } from 'lodash.clonedeep';
1818
export { default as get } from 'lodash.get';
1919
export { default as isEqual } from 'lodash.isequal';
20+
export { default as set } from 'lodash.set';

packages/@core/ui-kit/form-ui/src/use-form-context.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { ExtendedFormApi, FormActions, VbenFormProps } from './types';
77
import { computed, unref, useSlots } from 'vue';
88

99
import { createContext } from '@vben-core/shadcn-ui';
10-
import { isString } from '@vben-core/shared/utils';
10+
import { isString, mergeWithArrayOverride, set } from '@vben-core/shared/utils';
1111

1212
import { useForm } from 'vee-validate';
1313
import { object } from 'zod';
@@ -50,15 +50,19 @@ export function useFormInitial(
5050
const zodObject: ZodRawShape = {};
5151
(unref(props).schema || []).forEach((item) => {
5252
if (Reflect.has(item, 'defaultValue')) {
53-
initialValues[item.fieldName] = item.defaultValue;
53+
set(initialValues, item.fieldName, item.defaultValue);
5454
} else if (item.rules && !isString(item.rules)) {
5555
zodObject[item.fieldName] = item.rules;
5656
}
5757
});
5858

5959
const schemaInitialValues = getDefaultsForSchema(object(zodObject));
6060

61-
return { ...initialValues, ...schemaInitialValues };
61+
const zodDefaults: Record<string, any> = {};
62+
for (const key in schemaInitialValues) {
63+
set(zodDefaults, key, schemaInitialValues[key]);
64+
}
65+
return mergeWithArrayOverride(initialValues, zodDefaults);
6266
}
6367

6468
return {

packages/effects/layouts/src/authentication/authentication.vue

+7-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface Props {
1717
toolbar?: boolean;
1818
copyright?: boolean;
1919
toolbarList?: ToolbarType[];
20+
clickLogo?: () => void;
2021
}
2122
2223
withDefaults(defineProps<Props>(), {
@@ -28,6 +29,7 @@ withDefaults(defineProps<Props>(), {
2829
sloganImage: '',
2930
toolbar: true,
3031
toolbarList: () => ['color', 'language', 'layout', 'theme'],
32+
clickLogo: () => {},
3133
});
3234
3335
const { authPanelCenter, authPanelLeft, authPanelRight, isDark } =
@@ -61,7 +63,11 @@ const { authPanelCenter, authPanelLeft, authPanelRight, isDark } =
6163
</AuthenticationFormView>
6264

6365
<!-- 头部 Logo 和应用名称 -->
64-
<div v-if="logo || appName" class="absolute left-0 top-0 z-10 flex flex-1">
66+
<div
67+
v-if="logo || appName"
68+
class="absolute left-0 top-0 z-10 flex flex-1"
69+
@click="clickLogo"
70+
>
6571
<div
6672
class="text-foreground lg:text-foreground ml-4 mt-4 flex flex-1 items-center sm:left-6 sm:top-6"
6773
>

packages/effects/layouts/src/basic/layout.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { LayoutTabbar } from './tabbar';
3434
3535
defineOptions({ name: 'BasicLayout' });
3636
37-
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>();
37+
const emit = defineEmits<{ clearPreferencesAndLogout: []; clickLogo: [] }>();
3838
3939
const {
4040
isDark,
@@ -149,6 +149,10 @@ function clearPreferencesAndLogout() {
149149
emit('clearPreferencesAndLogout');
150150
}
151151
152+
function clickLogo() {
153+
emit('clickLogo');
154+
}
155+
152156
watch(
153157
() => preferences.app.layout,
154158
async (val) => {
@@ -221,6 +225,7 @@ const headerSlots = computed(() => {
221225
:src="preferences.logo.source"
222226
:text="preferences.app.name"
223227
:theme="showHeaderNav ? headerTheme : theme"
228+
@click="clickLogo"
224229
/>
225230
</template>
226231
<!-- 头部区域 -->

playground/src/layouts/auth.vue

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { $t } from '#/locales';
88
99
const appName = computed(() => preferences.app.name);
1010
const logo = computed(() => preferences.logo.source);
11+
const clickLogo = () => {};
1112
</script>
1213

1314
<template>
@@ -16,6 +17,7 @@ const logo = computed(() => preferences.logo.source);
1617
:logo="logo"
1718
:page-description="$t('authentication.pageDesc')"
1819
:page-title="$t('authentication.pageTitle')"
20+
:click-logo="clickLogo"
1921
>
2022
<!-- 自定义工具栏 -->
2123
<!-- <template #toolbar></template> -->

playground/src/layouts/basic.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ function handleMakeAll() {
106106
notifications.value.forEach((item) => (item.isRead = true));
107107
}
108108
109+
function handleClickLogo() {}
110+
109111
watch(
110112
() => preferences.app.watermark,
111113
async (enable) => {
@@ -124,7 +126,10 @@ watch(
124126
</script>
125127

126128
<template>
127-
<BasicLayout @clear-preferences-and-logout="handleLogout">
129+
<BasicLayout
130+
@clear-preferences-and-logout="handleLogout"
131+
@click-logo="handleClickLogo"
132+
>
128133
<template #user-dropdown>
129134
<UserDropdown
130135
:avatar

playground/src/views/system/menu/modules/form.vue

+2-18
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const emit = defineEmits<{
3232
success: [];
3333
}>();
3434
const formData = ref<SystemMenuApi.SystemMenu>();
35-
const loading = ref(false);
3635
const titleSuffix = ref<string>();
3736
const schema: VbenFormSchema[] = [
3837
{
@@ -445,9 +444,6 @@ const [Form, formApi] = useVbenForm({
445444
});
446445
447446
const [Drawer, drawerApi] = useVbenDrawer({
448-
onBeforeClose() {
449-
if (loading.value) return false;
450-
},
451447
onConfirm: onSubmit,
452448
onOpenChange(isOpen) {
453449
if (isOpen) {
@@ -474,13 +470,7 @@ const [Drawer, drawerApi] = useVbenDrawer({
474470
async function onSubmit() {
475471
const { valid } = await formApi.validate();
476472
if (valid) {
477-
loading.value = true;
478-
drawerApi.setState({
479-
closeOnClickModal: false,
480-
closeOnPressEscape: false,
481-
confirmLoading: true,
482-
loading: true,
483-
});
473+
drawerApi.lock();
484474
const data =
485475
await formApi.getValues<
486476
Omit<SystemMenuApi.SystemMenu, 'children' | 'id'>
@@ -498,13 +488,7 @@ async function onSubmit() {
498488
drawerApi.close();
499489
emit('success');
500490
} finally {
501-
loading.value = false;
502-
drawerApi.setState({
503-
closeOnClickModal: true,
504-
closeOnPressEscape: true,
505-
confirmLoading: false,
506-
loading: false,
507-
});
491+
drawerApi.unlock();
508492
}
509493
}
510494
}

pnpm-lock.yaml

+38-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ catalog:
4545
'@types/lodash.clonedeep': ^4.5.9
4646
'@types/lodash.get': ^4.4.9
4747
'@types/lodash.isequal': ^4.5.8
48+
'@types/lodash.set': ^4.3.2
4849
'@types/node': ^22.13.10
4950
'@types/nprogress': ^0.2.3
5051
'@types/postcss-import': ^14.0.3
@@ -116,6 +117,7 @@ catalog:
116117
lint-staged: ^15.4.3
117118
lodash.clonedeep: ^4.5.0
118119
lodash.get: ^4.4.2
120+
lodash.set: ^4.3.2
119121
lodash.isequal: ^4.5.0
120122
lucide-vue-next: ^0.469.0
121123
medium-zoom: ^1.1.0

0 commit comments

Comments
 (0)