You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
988 B
33 lines
988 B
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;
|
|
pageHeader?: {
|
|
ghost: boolean;
|
|
};
|
|
}
|
|
|
|
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;
|
|
|