UNPKG

5.43 kBTypeScriptView Raw
1import * as React from 'react';
2import type { WarningContextProps } from '../_util/warning';
3import type { Locale } from '../locale';
4import type { AlertConfig, BadgeConfig, ButtonConfig, CardConfig, CollapseConfig, ComponentStyleConfig, ConfigConsumerProps, CSPConfig, DirectionType, DrawerConfig, FlexConfig, FloatButtonGroupConfig, FormConfig, ImageConfig, InputConfig, MenuConfig, ModalConfig, NotificationConfig, PaginationConfig, PopupOverflow, SelectConfig, SpaceConfig, TableConfig, TabsConfig, TagConfig, TextAreaConfig, Theme, ThemeConfig, TourConfig, TransferConfig, WaveConfig } from './context';
5import { ConfigConsumer, ConfigContext, defaultIconPrefixCls } from './context';
6import type { RenderEmptyHandler } from './defaultRenderEmpty';
7import useConfig from './hooks/useConfig';
8import type { SizeType } from './SizeContext';
9import SizeContext from './SizeContext';
10export declare const warnContext: (componentName: string) => void;
11export { ConfigConsumer, ConfigContext, defaultIconPrefixCls, type ConfigConsumerProps, type CSPConfig, type DirectionType, type RenderEmptyHandler, type ThemeConfig, };
12export declare const configConsumerProps: string[];
13export interface ConfigProviderProps {
14 getTargetContainer?: () => HTMLElement | Window;
15 getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
16 prefixCls?: string;
17 iconPrefixCls?: string;
18 children?: React.ReactNode;
19 renderEmpty?: RenderEmptyHandler;
20 csp?: CSPConfig;
21 autoInsertSpaceInButton?: boolean;
22 form?: FormConfig;
23 input?: InputConfig;
24 textArea?: TextAreaConfig;
25 select?: SelectConfig;
26 pagination?: PaginationConfig;
27 /**
28 * @descCN 语言包配置,语言包可到 `antd/locale` 目录下寻找。
29 * @descEN Language package setting, you can find the packages in `antd/locale`.
30 */
31 locale?: Locale;
32 componentSize?: SizeType;
33 componentDisabled?: boolean;
34 /**
35 * @descCN 设置布局展示方向。
36 * @descEN Set direction of layout.
37 * @default ltr
38 */
39 direction?: DirectionType;
40 space?: SpaceConfig;
41 /**
42 * @descCN 设置 `false` 时关闭虚拟滚动。
43 * @descEN Close the virtual scrolling when setting `false`.
44 * @default true
45 */
46 virtual?: boolean;
47 /** @deprecated Please use `popupMatchSelectWidth` instead */
48 dropdownMatchSelectWidth?: boolean;
49 popupMatchSelectWidth?: boolean;
50 popupOverflow?: PopupOverflow;
51 theme?: ThemeConfig;
52 warning?: WarningContextProps;
53 alert?: AlertConfig;
54 anchor?: ComponentStyleConfig;
55 button?: ButtonConfig;
56 calendar?: ComponentStyleConfig;
57 carousel?: ComponentStyleConfig;
58 cascader?: ComponentStyleConfig;
59 collapse?: CollapseConfig;
60 divider?: ComponentStyleConfig;
61 drawer?: DrawerConfig;
62 typography?: ComponentStyleConfig;
63 skeleton?: ComponentStyleConfig;
64 spin?: ComponentStyleConfig;
65 segmented?: ComponentStyleConfig;
66 statistic?: ComponentStyleConfig;
67 steps?: ComponentStyleConfig;
68 image?: ImageConfig;
69 layout?: ComponentStyleConfig;
70 list?: ComponentStyleConfig;
71 mentions?: ComponentStyleConfig;
72 modal?: ModalConfig;
73 progress?: ComponentStyleConfig;
74 result?: ComponentStyleConfig;
75 slider?: ComponentStyleConfig;
76 breadcrumb?: ComponentStyleConfig;
77 menu?: MenuConfig;
78 floatButtonGroup?: FloatButtonGroupConfig;
79 checkbox?: ComponentStyleConfig;
80 descriptions?: ComponentStyleConfig;
81 empty?: ComponentStyleConfig;
82 badge?: BadgeConfig;
83 radio?: ComponentStyleConfig;
84 rate?: ComponentStyleConfig;
85 switch?: ComponentStyleConfig;
86 transfer?: TransferConfig;
87 avatar?: ComponentStyleConfig;
88 message?: ComponentStyleConfig;
89 tag?: TagConfig;
90 table?: TableConfig;
91 card?: CardConfig;
92 tabs?: TabsConfig;
93 timeline?: ComponentStyleConfig;
94 timePicker?: ComponentStyleConfig;
95 upload?: ComponentStyleConfig;
96 notification?: NotificationConfig;
97 tree?: ComponentStyleConfig;
98 colorPicker?: ComponentStyleConfig;
99 datePicker?: ComponentStyleConfig;
100 rangePicker?: ComponentStyleConfig;
101 dropdown?: ComponentStyleConfig;
102 flex?: FlexConfig;
103 /**
104 * Wave is special component which only patch on the effect of component interaction.
105 */
106 wave?: WaveConfig;
107 tour?: TourConfig;
108}
109type holderRenderType = (children: React.ReactNode) => React.ReactNode;
110export declare const defaultPrefixCls = "ant";
111declare function getGlobalIconPrefixCls(): string;
112interface GlobalConfigProps {
113 prefixCls?: string;
114 iconPrefixCls?: string;
115 theme?: Theme | ThemeConfig;
116 holderRender?: holderRenderType;
117}
118declare const setGlobalConfig: (props: GlobalConfigProps) => void;
119export declare const globalConfig: () => {
120 getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
121 getIconPrefixCls: typeof getGlobalIconPrefixCls;
122 getRootPrefixCls: () => string;
123 getTheme: () => ThemeConfig;
124 holderRender: holderRenderType | undefined;
125};
126declare const ConfigProvider: React.FC<ConfigProviderProps> & {
127 /** @private internal Usage. do not use in your production */
128 ConfigContext: typeof ConfigContext;
129 /** @deprecated Please use `ConfigProvider.useConfig().componentSize` instead */
130 SizeContext: typeof SizeContext;
131 config: typeof setGlobalConfig;
132 useConfig: typeof useConfig;
133};
134export default ConfigProvider;