mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-14 08:09:13 +08:00
34 lines
955 B
TypeScript
34 lines
955 B
TypeScript
import { createContext } from 'react';
|
|
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 = createContext<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;
|