refactor(adapter): separate form and component adapters so that components adapt to components other than the form (#4628)

* refactor: global components can be customized

* refactor: remove use Toast and reconstruct the form adapter
This commit is contained in:
Vben
2024-10-13 18:33:43 +08:00
committed by GitHub
parent 8b961a9d7f
commit 24d14c2841
63 changed files with 1798 additions and 2136 deletions

View File

@@ -24,11 +24,11 @@ import {
} from '@vben/preferences';
import { useVbenDrawer } from '@vben-core/popup-ui';
import {
useToast,
VbenButton,
VbenIconButton,
VbenSegmented,
} from '@vben-core/shadcn-ui';
import { globalShareState } from '@vben-core/shared/global-state';
import { useClipboard } from '@vueuse/core';
@@ -54,7 +54,9 @@ import {
} from './blocks';
const emit = defineEmits<{ clearPreferencesAndLogout: [] }>();
const { toast } = useToast();
const message = globalShareState.getMessage();
const appLocale = defineModel<SupportedLanguagesType>('appLocale');
const appDynamicTitle = defineModel<boolean>('appDynamicTitle');
const appLayout = defineModel<LayoutType>('appLayout');
@@ -196,10 +198,10 @@ const showBreadcrumbConfig = computed(() => {
async function handleCopy() {
await copy(JSON.stringify(diffPreference.value, null, 2));
toast({
description: $t('preferences.copyPreferences'),
title: $t('preferences.copyPreferencesSuccess'),
});
message.copyPreferencesSuccess?.(
$t('preferences.copyPreferencesSuccessTitle'),
$t('preferences.copyPreferencesSuccess'),
);
}
async function handleClearCache() {
@@ -214,10 +216,6 @@ async function handleReset() {
}
resetPreferences();
await loadLocaleMessages(preferences.app.locale);
toast({
description: $t('preferences.resetTitle'),
title: $t('preferences.resetSuccess'),
});
}
</script>