mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 00:29:12 +08:00
31 lines
946 B
TypeScript
31 lines
946 B
TypeScript
|
import createReactContext from '@ant-design/create-react-context';
|
||
|
import defaultRenderEmpty, { RenderEmptyHandler } from './renderEmpty';
|
||
|
import { Locale } from '../locale-provider';
|
||
|
|
||
|
export interface CSPConfig {
|
||
|
nonce?: string;
|
||
|
}
|
||
|
|
||
|
export interface ConfigConsumerProps {
|
||
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
||
|
rootPrefixCls?: string;
|
||
|
getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => string;
|
||
|
renderEmpty: RenderEmptyHandler;
|
||
|
csp?: CSPConfig;
|
||
|
autoInsertSpaceInButton?: boolean;
|
||
|
locale?: Locale;
|
||
|
}
|
||
|
|
||
|
export const ConfigContext = createReactContext<ConfigConsumerProps>({
|
||
|
// We provide a default function for Context without provider
|
||
|
getPrefixCls: (suffixCls: string, customizePrefixCls?: string) => {
|
||
|
if (customizePrefixCls) return customizePrefixCls;
|
||
|
|
||
|
return `ant-${suffixCls}`;
|
||
|
},
|
||
|
|
||
|
renderEmpty: defaultRenderEmpty,
|
||
|
});
|
||
|
|
||
|
export const ConfigConsumer = ConfigContext.Consumer;
|