Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

国际化配置迁移至common,相关代码优化 #492

Merged
merged 4 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/config-provider/config-receiver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent } from 'vue';
import defaultConfig from './zh_CN_config';
import { defaultGlobalConfig } from './context';
import { GlobalConfigProvider } from './type';

export type ValueOf<T> = T[keyof T];
Expand All @@ -24,7 +24,7 @@ export default function getConfigReceiverMixins<C extends ComponentConfigType>(c

computed: {
global(): C {
const defaultData = defaultConfig[componentName];
const defaultData = defaultGlobalConfig[componentName];
if (this.globalConfig && this.globalConfig[componentName]) {
return {
...defaultData,
Expand Down
29 changes: 5 additions & 24 deletions src/config-provider/context.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,14 @@
import defaultConfig from './zh_CN_config';

// TODO 替换 zh_CN_config 配置拆分,local内未走查,走查后更换,暂时使用现有配置
// import defaultLocale from '../_common/js/locale/zh_CN';
// export type Locale = typeof defaultLocale;
import merge from 'lodash/merge';
import defaultConfig from '../_common/js/global-config/default-config';
import defaultZhLocale from '../_common/js/global-config/locale/zh_CN';

export enum EAnimationType {
ripple = 'ripple',
expand = 'expand',
fade = 'fade',
}

export const defaultClassPrefix = 't';

export const defaultAnimation: {
include: string[];
exclude: string[];
} = {
include: [EAnimationType.ripple, EAnimationType.expand, EAnimationType.fade],
exclude: [],
};

export const defaultGlobalConfig = {
animation: defaultAnimation,
classPrefix: defaultClassPrefix,
...defaultConfig,
};
export const defaultGlobalConfig = merge(defaultConfig, defaultZhLocale);

export type Locale = typeof defaultZhLocale;
export type GlobalConfig = typeof defaultGlobalConfig;

export interface Config {
globalConfig?: GlobalConfig;
}
151 changes: 0 additions & 151 deletions src/config-provider/en_US_config.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/config-provider/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { withInstall, WithInstallType } from '../utils/withInstall';
import _ConfigProvider from './config-provider';

export * from './type';

export * from './useConfig';

export type { GlobalConfig, Locale } from './context';

export const ConfigProvider: WithInstallType<typeof _ConfigProvider> = withInstall(_ConfigProvider);
export default ConfigProvider;
Loading