Skip to content

feat: globalconfig 0625 #972

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

Merged
merged 7 commits into from
Jun 27, 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/ConfigContext.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createContext } from 'react';
import merge from 'lodash/merge';
import defaultLocale from '../locale/zh_CN';
import DEFAULT_GLOBAL_CONFIG from './zh_CN_config';
import defaultConfig from '../_common/js/global-config/default-config';
import { GlobalConfigProvider } from './type';

export enum EAnimationType {
Expand All @@ -20,7 +20,7 @@ export const defaultAnimation = {
export const defaultGlobalConfig = {
animation: defaultAnimation,
classPrefix: defaultClassPrefix,
...merge(defaultLocale, DEFAULT_GLOBAL_CONFIG),
...merge(defaultLocale, defaultConfig),
};

export type Locale = typeof defaultLocale;
Expand Down
7 changes: 7 additions & 0 deletions src/config-provider/config-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ upload | Object | - | 上传组件全局配置。TS 类型:`UploadConfig` | N

名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
autocomplete | String | - | 是否开启自动填充功能 | N
placeholder | String | - | 语言配置,“请输入”占位符描述文本 | N

### PaginationConfig
Expand Down Expand Up @@ -129,6 +130,8 @@ yearAriaLabel | String | - | 语言配置,“年” 描述文本 | N
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
cancel | Object | - | 取消按钮风格。TS 类型:`string | ButtonProps`,[Button API Documents](./button?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/config-provider/type.ts) | N
closeOnEscKeydown | Boolean | - | 按下 ESC 时是否触发对话框关闭事件 | N
closeOnOverlayClick | Boolean | - | 点击蒙层时是否触发关闭事件 | N
confirm | Object | - | 确认按钮风格。TS 类型:`string | ButtonProps` | N
confirmBtnTheme | Object | - | 确认按钮主题色,即 Dialog 的 `theme` 和 确认按钮的 `theme` 映射关系。示例:{ danger: 'danger' }。TS 类型:`{ default: string; info: string; warning: string; danger: string; success: string; }` | N

Expand All @@ -137,7 +140,10 @@ confirmBtnTheme | Object | - | 确认按钮主题色,即 Dialog 的 `theme`
名称 | 类型 | 默认值 | 说明 | 必传
-- | -- | -- | -- | --
cancel | String | - | 语言配置,“取消”描述文本。TS 类型:`string | ButtonProps` | N
closeOnEscKeydown | Boolean | - | 按下 ESC 时是否触发抽屉关闭事件 | N
closeOnOverlayClick | Boolean | - | 点击蒙层时是否触发关闭事件 | N
confirm | String | - | 语言配置,“确认”描述文本。TS 类型:`string | ButtonProps` | N
size | String | - | 尺寸配置,配置Drawer尺寸 | N

### PopconfirmConfig

Expand Down Expand Up @@ -178,6 +184,7 @@ treeExpandAndFoldIcon | Function | undefined | 树形结构,展开和折叠图
-- | -- | -- | -- | --
clearIcon | Function | - | 清除图标,【注意】使用渲染函数输出图标组件。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
empty | String | - | 语言配置,“暂无数据”描述文本 | N
filterable | Boolean | - | 全局配置是否可筛选 | N
loadingText | String | - | 语言配置,“加载中”描述文本 | N
placeholder | String | - | 语言配置,“请选择”占位符描述文本 | N

Expand Down
146 changes: 0 additions & 146 deletions src/config-provider/en_US_config.ts

This file was deleted.

30 changes: 30 additions & 0 deletions src/config-provider/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ export interface GlobalConfigProvider {
}

export interface InputConfig {
/**
* 是否开启自动填充功能
* @default ''
*/
autocomplete?: string;
/**
* 语言配置,“请输入”占位符描述文本
* @default ''
Expand Down Expand Up @@ -403,6 +408,14 @@ export interface DialogConfig {
* 取消按钮风格
*/
cancel?: string | ButtonProps;
/**
* 按下 ESC 时是否触发对话框关闭事件
*/
closeOnEscKeydown?: boolean;
/**
* 点击蒙层时是否触发关闭事件
*/
closeOnOverlayClick?: boolean;
/**
* 确认按钮风格
*/
Expand All @@ -419,11 +432,24 @@ export interface DrawerConfig {
* @default ''
*/
cancel?: string | ButtonProps;
/**
* 按下 ESC 时是否触发抽屉关闭事件
*/
closeOnEscKeydown?: boolean;
/**
* 点击蒙层时是否触发关闭事件
*/
closeOnOverlayClick?: boolean;
/**
* 语言配置,“确认”描述文本
* @default ''
*/
confirm?: string | ButtonProps;
/**
* 尺寸配置,配置Drawer尺寸
* @default ''
*/
size?: string;
}

export interface PopconfirmConfig {
Expand Down Expand Up @@ -549,6 +575,10 @@ export interface SelectConfig {
* @default ''
*/
empty?: string;
/**
* 全局配置是否可筛选
*/
filterable?: boolean;
/**
* 语言配置,“加载中”描述文本
* @default ''
Expand Down
Loading