UNPKG

2.13 kBTypeScriptView Raw
1/// <reference types="react" />
2
3import * as React from 'react';
4
5export interface ConfigProviderProps {
6 /**
7 * 样式类名的品牌前缀
8 */
9 prefix?: string;
10
11 /**
12 * 国际化文案对象,属性为组件的 displayName
13 */
14 locale?: Record<string, unknown>;
15
16 /**
17 * 是否开启错误捕捉 errorBoundary
18 * 如需自定义参数,请传入对象 对象接受参数列表如下:
19 *
20 * fallbackUI `Function(error?: {}, errorInfo?: {}) => Element` 捕获错误后的展示
21 * afterCatch `Function(error?: {}, errorInfo?: {})` 捕获错误后的行为, 比如埋点上传
22 */
23 errorBoundary?: boolean | {
24 afterCatch?: (error: Error, errorInfo: React.ErrorInfo) => void;
25 fallbackUI?: (error: Error, errorInfo: React.ErrorInfo) => React.ReactElement<any>;
26 };
27
28 /**
29 * 是否开启 Pure Render 模式,会提高性能,但是也会带来副作用
30 */
31 pure?: boolean;
32
33 /**
34 * 是否在开发模式下显示组件属性被废弃的 warning 提示
35 */
36 warning?: boolean;
37
38 /**
39 * 是否开启 rtl 模式
40 */
41
42 rtl?: boolean;
43 /**
44 * 设备类型,针对不同的设备类型组件做出对应的响应式变化
45 */
46 device?: 'tablet' | 'desktop' | 'phone';
47 /**
48 * 组件树
49 */
50 children?: React.ReactNode;
51 /**
52 * 弹层挂载的容器节点
53 */
54 popupContainer?: string | HTMLElement | ((target: HTMLElement) => HTMLElement);
55}
56
57export default class ConfigProvider extends React.Component<
58 ConfigProviderProps,
59 any
60> {
61 static config(Component: any, options?: any): any;
62 static getContextProps(props: {}, displayName: string): any;
63 static initLocales(locales: any): any;
64 static setLanguage(language: string): any;
65 static setLocale(locale: any): any;
66 static setDirection(dir: string): any;
67 static getLocale(): any;
68 static getLanguage(): string;
69 static getDirection(): string;
70 static clearCache(): any;
71 static Consumer(props: { children: (ctx: ConfigProviderProps) => React.ReactNode }): JSX.Element;
72}
73
\No newline at end of file