context.d.ts 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. import type { ComputedRef, ExtractPropTypes, InjectionKey, PropType, Ref } from 'vue';
  2. import type { ValidateMessages } from '../form/interface';
  3. import type { RequiredMark } from '../form/Form';
  4. import type { TransformCellTextProps } from '../table/interface';
  5. import type { Locale } from '../locale-provider';
  6. import type { DerivativeFunc } from '../_util/cssinjs';
  7. import type { AliasToken, SeedToken } from '../theme/internal';
  8. import type { MapToken, OverrideToken } from '../theme/interface';
  9. import type { VueNode } from '../_util/type';
  10. export declare const defaultIconPrefixCls = "anticon";
  11. type GlobalFormCOntextProps = {
  12. validateMessages?: Ref<ValidateMessages>;
  13. };
  14. export type DirectionType = 'ltr' | 'rtl' | undefined;
  15. export declare const GlobalFormContextKey: InjectionKey<GlobalFormCOntextProps>;
  16. export declare const useProvideGlobalForm: (state: GlobalFormCOntextProps) => void;
  17. export declare const useInjectGlobalForm: () => GlobalFormCOntextProps;
  18. export declare const GlobalConfigContextKey: InjectionKey<GlobalFormCOntextProps>;
  19. export interface CSPConfig {
  20. nonce?: string;
  21. }
  22. export interface Theme {
  23. primaryColor?: string;
  24. infoColor?: string;
  25. successColor?: string;
  26. processingColor?: string;
  27. errorColor?: string;
  28. warningColor?: string;
  29. }
  30. export type SizeType = 'small' | 'middle' | 'large' | undefined;
  31. export type Direction = 'ltr' | 'rtl';
  32. export type MappingAlgorithm = DerivativeFunc<SeedToken, MapToken>;
  33. export interface ThemeConfig {
  34. token?: Partial<AliasToken>;
  35. components?: OverrideToken;
  36. algorithm?: MappingAlgorithm | MappingAlgorithm[];
  37. hashed?: boolean;
  38. inherit?: boolean;
  39. }
  40. export declare const configProviderProps: () => {
  41. iconPrefixCls: StringConstructor;
  42. getTargetContainer: {
  43. type: PropType<() => HTMLElement | Window>;
  44. };
  45. getPopupContainer: {
  46. type: PropType<(triggerNode?: HTMLElement) => HTMLElement>;
  47. };
  48. prefixCls: StringConstructor;
  49. getPrefixCls: {
  50. type: PropType<(suffixCls?: string, customizePrefixCls?: string) => string>;
  51. };
  52. renderEmpty: {
  53. type: PropType<typeof import("./renderEmpty").default>;
  54. };
  55. transformCellText: {
  56. type: PropType<(tableProps: TransformCellTextProps) => any>;
  57. };
  58. csp: {
  59. type: PropType<CSPConfig>;
  60. default: CSPConfig;
  61. };
  62. input: {
  63. type: PropType<{
  64. autocomplete?: string;
  65. }>;
  66. default: {
  67. autocomplete?: string;
  68. };
  69. };
  70. autoInsertSpaceInButton: {
  71. type: BooleanConstructor;
  72. default: any;
  73. };
  74. locale: {
  75. type: PropType<Locale>;
  76. default: Locale;
  77. };
  78. pageHeader: {
  79. type: PropType<{
  80. ghost?: boolean;
  81. }>;
  82. default: {
  83. ghost?: boolean;
  84. };
  85. };
  86. componentSize: {
  87. type: PropType<SizeType>;
  88. };
  89. componentDisabled: {
  90. type: BooleanConstructor;
  91. default: any;
  92. };
  93. direction: {
  94. type: PropType<"rtl" | "ltr">;
  95. default: string;
  96. };
  97. space: {
  98. type: PropType<{
  99. size?: SizeType | number;
  100. }>;
  101. default: {
  102. size?: SizeType | number;
  103. };
  104. };
  105. virtual: {
  106. type: BooleanConstructor;
  107. default: any;
  108. };
  109. dropdownMatchSelectWidth: {
  110. type: (BooleanConstructor | NumberConstructor)[];
  111. default: boolean;
  112. };
  113. form: {
  114. type: PropType<{
  115. validateMessages?: ValidateMessages;
  116. requiredMark?: RequiredMark;
  117. colon?: boolean;
  118. }>;
  119. default: {
  120. validateMessages?: ValidateMessages;
  121. requiredMark?: RequiredMark;
  122. colon?: boolean;
  123. };
  124. };
  125. pagination: {
  126. type: PropType<{
  127. showSizeChanger?: boolean;
  128. }>;
  129. default: {
  130. showSizeChanger?: boolean;
  131. };
  132. };
  133. theme: {
  134. type: PropType<ThemeConfig>;
  135. default: ThemeConfig;
  136. };
  137. select: {
  138. type: PropType<{
  139. showSearch?: boolean;
  140. }>;
  141. default: {
  142. showSearch?: boolean;
  143. };
  144. };
  145. wave: {
  146. type: PropType<{
  147. disabled?: boolean;
  148. }>;
  149. default: {
  150. disabled?: boolean;
  151. };
  152. };
  153. };
  154. export type ConfigProviderProps = Partial<ExtractPropTypes<ReturnType<typeof configProviderProps>>>;
  155. export interface ConfigProviderInnerProps {
  156. csp?: ComputedRef<CSPConfig>;
  157. autoInsertSpaceInButton?: ComputedRef<boolean>;
  158. locale?: ComputedRef<Locale>;
  159. direction?: ComputedRef<'ltr' | 'rtl'>;
  160. space?: ComputedRef<{
  161. size?: number | SizeType;
  162. }>;
  163. virtual?: ComputedRef<boolean>;
  164. dropdownMatchSelectWidth?: ComputedRef<number | boolean>;
  165. getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => string;
  166. iconPrefixCls: ComputedRef<string>;
  167. theme?: ComputedRef<ThemeConfig>;
  168. renderEmpty?: (name?: string) => VueNode;
  169. getTargetContainer?: ComputedRef<() => HTMLElement | Window>;
  170. getPopupContainer?: ComputedRef<(triggerNode?: HTMLElement) => HTMLElement>;
  171. pageHeader?: ComputedRef<{
  172. ghost?: boolean;
  173. }>;
  174. input?: ComputedRef<{
  175. autocomplete?: string;
  176. }>;
  177. pagination?: ComputedRef<{
  178. showSizeChanger?: boolean;
  179. }>;
  180. form?: ComputedRef<{
  181. validateMessages?: ValidateMessages;
  182. requiredMark?: RequiredMark;
  183. colon?: boolean;
  184. }>;
  185. select?: ComputedRef<{
  186. showSearch?: boolean;
  187. }>;
  188. componentSize?: ComputedRef<SizeType>;
  189. componentDisabled?: ComputedRef<boolean>;
  190. transformCellText?: ComputedRef<(tableProps: TransformCellTextProps) => any>;
  191. wave?: ComputedRef<{
  192. disabled?: boolean;
  193. }>;
  194. flex?: ComputedRef<{
  195. vertical?: boolean;
  196. }>;
  197. }
  198. export declare const configProviderKey: InjectionKey<ConfigProviderInnerProps>;
  199. export declare const defaultConfigProvider: ConfigProviderInnerProps;
  200. export declare const useConfigContextInject: () => ConfigProviderInnerProps;
  201. export declare const useConfigContextProvider: (props: ConfigProviderInnerProps) => void;
  202. export {};