index.d.ts 5.9 KB

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