Skip to content

Commit 3e156b0

Browse files
authored
docs: add more JSDoc (ant-design#48101)
1 parent 7ec9e68 commit 3e156b0

File tree

4 files changed

+64
-7
lines changed

4 files changed

+64
-7
lines changed

components/_util/warning.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ type TypeWarning = BaseTypeWarning & {
4141
};
4242

4343
export interface WarningContextProps {
44+
/**
45+
* @descCN 设置警告等级,设置 `false` 时会将废弃相关信息聚合为单条信息。
46+
* @descEN Set the warning level. When set to `false`, discard related information will be aggregated into a single message.
47+
* @since 5.10.0
48+
*/
4449
strict?: boolean;
4550
}
4651

components/config-provider/context.ts

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,52 @@ type ComponentsConfig = {
5050
};
5151

5252
export interface ThemeConfig {
53+
/**
54+
* @descCN 用于修改 Design Token。
55+
* @descEN Modify Design Token.
56+
*/
5357
token?: Partial<AliasToken>;
58+
/**
59+
* @descCN 用于修改各个组件的 Component Token 以及覆盖该组件消费的 Alias Token。
60+
* @descEN Modify Component Token and Alias Token applied to components.
61+
*/
5462
components?: ComponentsConfig;
63+
/**
64+
* @descCN 用于修改 Seed Token 到 Map Token 的算法。
65+
* @descEN Modify the algorithms of theme.
66+
* @default defaultAlgorithm
67+
*/
5568
algorithm?: MappingAlgorithm | MappingAlgorithm[];
69+
/**
70+
* @descCN 是否继承外层 `ConfigProvider` 中配置的主题。
71+
* @descEN Whether to inherit the theme configured in the outer layer `ConfigProvider`.
72+
* @default true
73+
*/
5674
inherit?: boolean;
5775
/**
58-
* @descCN 是否开启 `hashed` 属性。如果你的应用中只存在一个版本的 antd,你可以设置为 `false` 来进一步减小样式体积。默认值为 `ture`。
59-
* @descEN Whether to enable the `hashed` attribute. If there is only one version of antd in your application, you can set `false` to reduce the bundle size. defaults to `true`.
76+
* @descCN 是否开启 `hashed` 属性。如果你的应用中只存在一个版本的 antd,你可以设置为 `false` 来进一步减小样式体积。
77+
* @descEN Whether to enable the `hashed` attribute. If there is only one version of antd in your application, you can set `false` to reduce the bundle size.
78+
* @default true
79+
* @since 5.12.0
6080
*/
6181
hashed?: boolean;
6282
/**
63-
* @descCN 通过 `cssVar` 配置来开启 CSS 变量模式,这个配置会被继承。默认值为 `false`。
64-
* @descEN Enable CSS variable mode through `cssVar` configuration, This configuration will be inherited. defaults to `false`.
83+
* @descCN 通过 `cssVar` 配置来开启 CSS 变量模式,这个配置会被继承。
84+
* @descEN Enable CSS variable mode through `cssVar` configuration, This configuration will be inherited.
85+
* @default false
86+
* @since 5.12.0
6587
*/
6688
cssVar?:
6789
| {
6890
/**
69-
* Prefix for css variable, default to `ant`.
91+
* @descCN css 变量的前缀
92+
* @descEN Prefix for css variable.
93+
* @default ant
7094
*/
7195
prefix?: string;
7296
/**
73-
* Unique key for theme, should be set manually < react@18.
97+
* @descCN 主题的唯一 key,版本低于 react@18 时需要手动设置。
98+
* @descEN Unique key for theme, should be set manually < react@18.
7499
*/
75100
key?: string;
76101
}
@@ -141,7 +166,16 @@ export type SpaceConfig = ComponentStyleConfig & Pick<SpaceProps, 'size' | 'clas
141166
export type PopupOverflow = 'viewport' | 'scroll';
142167

143168
export interface WaveConfig {
169+
/**
170+
* @descCN 是否开启水波纹效果。如果需要关闭,可以设置为 `false`。
171+
* @descEN Whether to use wave effect. If it needs to close, set to `false`.
172+
* @default true
173+
*/
144174
disabled?: boolean;
175+
/**
176+
* @descCN 自定义水波纹效果。
177+
* @descEN Customized wave effect.
178+
*/
145179
showEffect?: ShowWaveEffect;
146180
}
147181

@@ -152,6 +186,10 @@ export interface ConfigConsumerProps {
152186
iconPrefixCls: string;
153187
getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
154188
renderEmpty?: RenderEmptyHandler;
189+
/**
190+
* @descCN 设置 [Content Security Policy](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CSP) 配置。
191+
* @descEN Set the [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) config.
192+
*/
155193
csp?: CSPConfig;
156194
autoInsertSpaceInButton?: boolean;
157195
input?: InputConfig;

components/config-provider/index.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,25 @@ export interface ConfigProviderProps {
127127
textArea?: TextAreaConfig;
128128
select?: SelectConfig;
129129
pagination?: PaginationConfig;
130+
/**
131+
* @descCN 语言包配置,语言包可到 `antd/locale` 目录下寻找。
132+
* @descEN Language package setting, you can find the packages in `antd/locale`.
133+
*/
130134
locale?: Locale;
131135
componentSize?: SizeType;
132136
componentDisabled?: boolean;
137+
/**
138+
* @descCN 设置布局展示方向。
139+
* @descEN Set direction of layout.
140+
* @default ltr
141+
*/
133142
direction?: DirectionType;
134143
space?: SpaceConfig;
144+
/**
145+
* @descCN 设置 `false` 时关闭虚拟滚动。
146+
* @descEN Close the virtual scrolling when setting `false`.
147+
* @default true
148+
*/
135149
virtual?: boolean;
136150
/** @deprecated Please use `popupMatchSelectWidth` instead */
137151
dropdownMatchSelectWidth?: boolean;

components/config-provider/index.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default Demo;
5656
| autoInsertSpaceInButton | 设置为 `false` 时,移除按钮中 2 个汉字之间的空格 | boolean | true | |
5757
| componentDisabled | 设置 antd 组件禁用状态 | boolean | - | 4.21.0 |
5858
| componentSize | 设置 antd 组件大小 | `small` \| `middle` \| `large` | - | |
59-
| csp | 设置 [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) 配置 | { nonce: string } | - | |
59+
| csp | 设置 [Content Security Policy](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/CSP) 配置 | { nonce: string } | - | |
6060
| direction | 设置文本展示方向。 [示例](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | |
6161
| getPopupContainer | 弹出框(Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | function(triggerNode) | () => document.body | |
6262
| getTargetContainer | 配置 Affix、Anchor 滚动监听容器。 | () => HTMLElement | () => window | 4.2.0 |

0 commit comments

Comments
 (0)