mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
fix: Modal static func (#47010)
* fix: Modal static func * chore: clean up * chore: clean up
This commit is contained in:
parent
85fb745bd1
commit
be058e4794
@ -266,6 +266,12 @@ const setGlobalConfig = (props: GlobalConfigProps) => {
|
||||
};
|
||||
|
||||
export const globalConfig = () => ({
|
||||
getPrefixCls: (suffixCls?: string, customizePrefixCls?: string) => {
|
||||
if (customizePrefixCls) {
|
||||
return customizePrefixCls;
|
||||
}
|
||||
return suffixCls ? `${getGlobalPrefixCls()}-${suffixCls}` : getGlobalPrefixCls();
|
||||
},
|
||||
getIconPrefixCls: getGlobalIconPrefixCls,
|
||||
getRootPrefixCls: () => {
|
||||
// If Global prefixCls provided, use this
|
||||
|
@ -468,7 +468,7 @@ describe('Modal.confirm triggers callbacks correctly', () => {
|
||||
expect($$('.custom-modal-wrap')).toHaveLength(1);
|
||||
expect($$('.custom-modal-confirm')).toHaveLength(1);
|
||||
expect($$('.custom-modal-confirm-body-wrapper')).toHaveLength(1);
|
||||
expect($$('.custom-modal-btn')).toHaveLength(2);
|
||||
expect($$('.ant-btn')).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('should be Modal.confirm without mask', async () => {
|
||||
|
@ -29,7 +29,7 @@ const ConfirmDialogWrapper: React.FC<ConfirmDialogProps> = (props) => {
|
||||
const runtimeLocale = getConfirmLocale();
|
||||
|
||||
const config = useContext(ConfigContext);
|
||||
const rootPrefixCls = customizePrefixCls || getRootPrefixCls() || config.getPrefixCls();
|
||||
const rootPrefixCls = getRootPrefixCls() || config.getPrefixCls();
|
||||
// because Modal.config set rootPrefixCls, which is different from other components
|
||||
const prefixCls = customizePrefixCls || `${rootPrefixCls}-modal`;
|
||||
|
||||
@ -98,7 +98,7 @@ export default function confirm(config: ModalFuncProps) {
|
||||
* Sync render blocks React event. Let's make this async.
|
||||
*/
|
||||
timeoutId = setTimeout(() => {
|
||||
const rootPrefixCls = global.getRootPrefixCls();
|
||||
const rootPrefixCls = global.getPrefixCls(undefined, getRootPrefixCls());
|
||||
const iconPrefixCls = global.getIconPrefixCls();
|
||||
const theme = global.getTheme();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user