二货机器人
5 years ago
committed by
GitHub
2 changed files with 33 additions and 30 deletions
@ -0,0 +1,30 @@ |
|||
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; |
Loading…
Reference in new issue