@kne/react-modal 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- import { useEffect, useRef, useState, useCallback, memo, forwardRef, useImperativeHandle, createRef, Children } from 'react';
2
- import { Modal as Modal$1, App, Button, Drawer as Drawer$1, Tabs } from 'antd';
1
+ import { useEffect, useState, useCallback, createContext, useContext, useMemo, useRef, createRef, forwardRef, useImperativeHandle, memo, Children } from 'react';
2
+ import { Modal as Modal$1, Button, Drawer as Drawer$1, App, Tabs } from 'antd';
3
3
  import { CloseOutlined, InfoCircleFilled, ExclamationCircleFilled, CloseCircleFilled, CheckCircleFilled } from '@ant-design/icons';
4
4
  import classnames from 'classnames';
5
- import { usePopupMount, useScrollElement, hoistOutOfModalRoot } from '@kne/responsive-utils';
5
+ import { usePopupMount, useScrollElement, hoistOutOfModalRoot, findExamplePhoneMountNode } from '@kne/responsive-utils';
6
6
  import { createWithIntlProvider, useIntl } from '@kne/react-intl';
7
7
  import ButtonGroup from '@kne/button-group';
8
8
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -51,7 +51,7 @@ const withLocale = createWithIntlProvider({
51
51
 
52
52
  var modalStyle = {"kne-responsive-boundary":"kne-react-modal_gh14z","kne-responsive-scroll":"kne-react-modal_Kfn6L","modal":"kne-react-modal_Bk7-B","small":"kne-react-modal_DZGD6","large":"kne-react-modal_9sz-n","modal-body-inner":"kne-react-modal_fFnva","is-mobile":"kne-react-modal_LtgJz","modal-container":"kne-react-modal_aEoZq","modal-antd-header":"kne-react-modal_54n8W","modal-antd-footer":"kne-react-modal_AJ9pV","modal-antd-body":"kne-react-modal_u2IjN","modal-outer":"kne-react-modal_kkILR","no-title":"kne-react-modal_8Iysr","no-footer":"kne-react-modal_VMxik","no-padding":"kne-react-modal_Fof-N","modal-title":"kne-react-modal_tG9MF","modal-body":"kne-react-modal_W-QFz","modal-footer":"kne-react-modal_meVfy","body-scroll-off":"kne-react-modal_l627I","is-embedded-footer":"kne-react-modal_17Eih","modal-footer-extra":"kne-react-modal_Fx8Z-","modal-footer-actions":"kne-react-modal_V3ZrX","modal-close":"kne-react-modal_-EK8N","modal-host":"kne-react-modal_eNb-h","modal-form-host":"kne-react-modal_Js8cf","modal-wrap":"kne-react-modal_3Sju5","modal-wrap-centered":"kne-react-modal_-qCIk","modal-wrap-fullscreen":"kne-react-modal_8lS2G","modal-mask-fullscreen":"kne-react-modal_XfLOC"};
53
53
 
54
- const _excluded$7 = ["ButtonComponent", "onClick", "autoClose", "display"];
54
+ const _excluded$8 = ["ButtonComponent", "onClick", "autoClose", "display"];
55
55
  const Footer = ({
56
56
  footer,
57
57
  footerButtons,
@@ -90,7 +90,7 @@ const Footer = ({
90
90
  onClick,
91
91
  autoClose = true
92
92
  } = _ref,
93
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
93
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
94
94
  return _extends({}, props, {
95
95
  buttonComponent: ButtonComponent,
96
96
  onClick: async (...args) => {
@@ -173,11 +173,52 @@ const useLockParentScroll = (enabled, getScrollElement) => {
173
173
  }, [enabled, getScrollElement]);
174
174
  };
175
175
 
176
- const _excluded$6 = ["children", "footer", "footerButtons", "className", "size", "title", "onClose", "onConfirm", "confirmText", "onCancel", "cancelText", "closable", "noPadding", "bodyScroll", "isMobile", "mobileFullscreen", "fixedModeClass", "wrapClassName", "classNames", "styles", "style", "modalRender"],
177
- _excluded2$3 = ["width"],
178
- _excluded3$1 = ["size", "getContainer", "open", "mobileFullscreen", "bodyScroll"],
179
- _excluded4 = ["afterClose", "getContainer", "onClose", "onConfirm", "onCancel"],
180
- _excluded5 = ["children", "getContainer", "afterClose"];
176
+ const usePatchElement = () => {
177
+ const [elements, setElements] = useState([]);
178
+ const patchElement = useCallback(element => {
179
+ setElements(originElements => [...originElements, element]);
180
+ return () => {
181
+ setElements(originElements => originElements.filter(ele => ele !== element));
182
+ };
183
+ }, []);
184
+ return [elements, patchElement];
185
+ };
186
+
187
+ const ModalLayerContext = /*#__PURE__*/createContext(null);
188
+ const useModalLayer = () => useContext(ModalLayerContext);
189
+
190
+ /**
191
+ * 挂在 Modal 内容树内(antd ZIndexContext 之下),
192
+ * 使就近 useModal 打开的内层成为本层 React 子树,从而自动叠层。
193
+ */
194
+ const ModalLayerProvider = ({
195
+ children
196
+ }) => {
197
+ const [elements, patchElement] = usePatchElement();
198
+ const value = useMemo(() => ({
199
+ patchElement
200
+ }), [patchElement]);
201
+ return /*#__PURE__*/jsxs(ModalLayerContext.Provider, {
202
+ value: value,
203
+ children: [children, elements]
204
+ });
205
+ };
206
+
207
+ /** 根级命令式打开(页面首次弹层);不包 ModalLayerContext。 */
208
+ const rootModalPatchRef = {
209
+ current: null
210
+ };
211
+ const ModalContextHolder = () => {
212
+ const [elements, patchElement] = usePatchElement();
213
+ rootModalPatchRef.current = patchElement;
214
+ return /*#__PURE__*/jsx(Fragment, {
215
+ children: elements
216
+ });
217
+ };
218
+
219
+ const _excluded$7 = ["children", "footer", "footerButtons", "className", "size", "title", "onClose", "onConfirm", "confirmText", "onCancel", "cancelText", "closable", "noPadding", "bodyScroll", "isMobile", "mobileFullscreen", "fixedModeClass", "wrapClassName", "classNames", "styles", "style", "modalRender"],
220
+ _excluded2$4 = ["width"],
221
+ _excluded3$1 = ["size", "getContainer", "open", "mobileFullscreen", "bodyScroll", "isMobile", "fixedModeClass"];
181
222
  const ModalLocaleRoot = withLocale(({
182
223
  children
183
224
  }) => children);
@@ -196,10 +237,10 @@ const wrapCustomGetContainer$2 = customGetContainer => {
196
237
  }
197
238
  return () => customGetContainer;
198
239
  };
199
- const VIEWPORT_EXAMPLE_SELECTORS$3 = ['.example-driver-device-scroll'];
240
+ const VIEWPORT_EXAMPLE_SELECTORS$4 = ['.example-driver-device-scroll'];
200
241
  const viewportPopupMountOptions$3 = {
201
242
  cover: 'viewport',
202
- exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS$3
243
+ exampleSelectors: VIEWPORT_EXAMPLE_SELECTORS$4
203
244
  };
204
245
  const resolveModalGetContainer = ({
205
246
  customGetContainer,
@@ -223,6 +264,7 @@ const resolveModalGetContainer = ({
223
264
  };
224
265
  };
225
266
  const sizeStyleVars$1 = (size, hasFooter) => {
267
+ // body 最低高度随 size:small 基准 300,default/large 基准 500(再扣 title/footer chrome)
226
268
  const minBase = size === 'small' ? 300 : 500;
227
269
  const chrome = 48 + (hasFooter ? 58 : 0);
228
270
  const minHeight = `${Math.max(0, minBase - chrome)}px`;
@@ -268,11 +310,15 @@ const ModalOuter = ({
268
310
  });
269
311
  const bodyClassName = classnames(modalStyle['modal-body'], 'modal-body');
270
312
  // 移动端全屏:body 用 flex 吃满 title/footer 之间剩余高度,footer 才能贴底;
271
- // 勿写死 --kne-modal-body-height(高度受限类会把该值压矮,footer 悬在中间)
313
+ // 桌面默认:height:auto + max-height,短内容不撑满;bodyScroll=false 仍写死满高供 Tabs/分栏
272
314
  const bodyStyle = isMobile ? {
273
315
  flex: '1 1 auto',
274
316
  minHeight: 0,
275
317
  height: 'auto'
318
+ } : bodyScroll !== false ? {
319
+ height: 'auto',
320
+ maxHeight: 'var(--kne-modal-body-max-height)',
321
+ minHeight: 'var(--kne-modal-body-min-height)'
276
322
  } : {
277
323
  height: 'var(--kne-modal-body-height)'
278
324
  };
@@ -302,10 +348,7 @@ const ModalOuter = ({
302
348
  children: bodyInner
303
349
  }) : /*#__PURE__*/jsx("div", {
304
350
  className: classnames(bodyClassName, modalStyle['body-scroll-off']),
305
- style: isMobile ? {
306
- flex: '1 1 auto',
307
- minHeight: 0
308
- } : undefined,
351
+ style: bodyStyle,
309
352
  children: bodyInner
310
353
  }), footer === null && footerButtons === undefined ? null : /*#__PURE__*/jsx(Footer, {
311
354
  footer: footer,
@@ -346,14 +389,14 @@ const computedCommonProps = _ref => {
346
389
  style: propsStyle,
347
390
  modalRender
348
391
  } = _ref,
349
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
392
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
350
393
  const useMobileLayout = isMobile && mobileFullscreen !== false;
351
394
  const hasFooter = !(footer === null && footerButtons === undefined);
352
395
  const sizeVars = sizeStyleVars$1(size, hasFooter);
353
396
  const {
354
397
  width
355
398
  } = sizeVars,
356
- cssVars = _objectWithoutPropertiesLoose(sizeVars, _excluded2$3);
399
+ cssVars = _objectWithoutPropertiesLoose(sizeVars, _excluded2$4);
357
400
  const runChildren = options => {
358
401
  const opts = Object.assign({}, options, {
359
402
  close: onClose
@@ -428,8 +471,11 @@ const computedCommonProps = _ref => {
428
471
  overflow: 'hidden'
429
472
  } : null)
430
473
  }),
474
+ // LayerProvider 须在 antd Modal 内容树内(ZIndexContext 下),内层命令式才能自动 +100
431
475
  children: /*#__PURE__*/jsx(ModalLocaleRoot, {
432
- children: runChildren({})
476
+ children: /*#__PURE__*/jsx(ModalLayerProvider, {
477
+ children: runChildren({})
478
+ })
433
479
  })
434
480
  });
435
481
  };
@@ -439,18 +485,23 @@ const Modal = withLocale(_ref2 => {
439
485
  getContainer,
440
486
  open,
441
487
  mobileFullscreen = true,
442
- bodyScroll = true
488
+ bodyScroll = true,
489
+ isMobile: isMobileProp,
490
+ fixedModeClass: fixedModeClassProp
443
491
  } = _ref2,
444
492
  props = _objectWithoutPropertiesLoose(_ref2, _excluded3$1);
445
493
  const hostRef = useRef(null);
446
494
  const {
447
- isMobile,
448
- fixedModeClass,
495
+ isMobile: detectedIsMobile,
496
+ fixedModeClass: detectedFixedModeClass,
449
497
  getPopupContainer,
450
498
  anchorRef
451
499
  } = usePopupMount(_extends({}, viewportPopupMountOptions$3, {
452
500
  getPopupContainer: wrapCustomGetContainer$2(getContainer)
453
501
  }));
502
+ // useModal 打开时可能已按 activeElement 解析出示例手机框,优先用调用方传入的 isMobile / fixedModeClass
503
+ const isMobile = isMobileProp != null ? isMobileProp : detectedIsMobile;
504
+ const fixedModeClass = fixedModeClassProp != null ? fixedModeClassProp : detectedFixedModeClass;
454
505
  const getScrollElement = useScrollElement();
455
506
  useLockParentScroll(!!open, getScrollElement);
456
507
  const setAnchorRef = node => {
@@ -480,77 +531,138 @@ const Modal = withLocale(_ref2 => {
480
531
  }))]
481
532
  });
482
533
  });
483
- const useModal = () => {
484
- const {
485
- modal
486
- } = App.useApp();
534
+
535
+ const _excluded$6 = ["afterClose", "onClose", "onConfirm", "onCancel"],
536
+ _excluded2$3 = ["afterClose", "getContainer"];
537
+ let hookModalUuid = 0;
538
+
539
+ /** 与 Modal / useDrawer 一致:示例手机框挂载根 */
540
+ const VIEWPORT_EXAMPLE_SELECTORS$3 = ['.example-driver-device-scroll'];
541
+ const HookModal = /*#__PURE__*/forwardRef(({
542
+ config,
543
+ afterClose: hookAfterClose
544
+ }, ref) => {
545
+ const [open, setOpen] = useState(true);
546
+ const [innerConfig, setInnerConfig] = useState(config);
547
+ const close = () => {
548
+ setOpen(false);
549
+ };
550
+ useImperativeHandle(ref, () => ({
551
+ destroy: close,
552
+ update: newConfig => {
553
+ setInnerConfig(origin => Object.assign({}, origin, typeof newConfig === 'function' ? newConfig(origin) : newConfig));
554
+ }
555
+ }));
487
556
  const {
488
- resolveMount,
489
- getPopupContainer
490
- } = usePopupMount(viewportPopupMountOptions$3);
557
+ afterClose: userAfterClose,
558
+ onClose: userOnClose,
559
+ onConfirm: userOnConfirm,
560
+ onCancel: userOnCancel
561
+ } = innerConfig,
562
+ restConfig = _objectWithoutPropertiesLoose(innerConfig, _excluded$6);
563
+ return /*#__PURE__*/jsx(Modal, _extends({}, restConfig, {
564
+ open: open,
565
+ onClose: () => {
566
+ userOnClose == null || userOnClose();
567
+ close();
568
+ },
569
+ onCancel: (...args) => {
570
+ userOnCancel == null || userOnCancel(...args);
571
+ close();
572
+ },
573
+ onConfirm: async (...args) => {
574
+ const res = await Promise.resolve(userOnConfirm == null ? void 0 : userOnConfirm(...args));
575
+ if (res !== false) {
576
+ close();
577
+ }
578
+ return res;
579
+ },
580
+ afterClose: (...args) => {
581
+ hookAfterClose == null || hookAfterClose(...args);
582
+ userAfterClose == null || userAfterClose(...args);
583
+ }
584
+ }));
585
+ });
586
+
587
+ /**
588
+ * 命令式内容弹窗:就近 patch 到 ModalLayerProvider(多层)或根 ModalContextHolder。
589
+ * 不走 App.modal.info / ConfirmDialog,层级交给 antd ZIndexContext。
590
+ *
591
+ * 打开时用 document.activeElement 解析示例手机框(与 useDrawer 一致),
592
+ * 使 useFormModal 在手机预览内也能挂进 `.example-driver-device-scroll`,
593
+ * 而不是落到 Global Holder 所在的外层 body。
594
+ */
595
+ const useModal = () => {
596
+ const layer = useContext(ModalLayerContext);
491
597
  const getScrollElement = useScrollElement();
492
- return props => {
493
- const anchor = typeof document !== 'undefined' ? document.activeElement : null;
494
- const {
495
- isMobile,
496
- fixedModeClass
497
- } = resolveMount(anchor);
498
- const unlock = lockParentScroll(getScrollElement);
598
+ const [actionQueue, setActionQueue] = useState([]);
599
+ useEffect(() => {
600
+ if (actionQueue.length) {
601
+ const cloneQueue = [...actionQueue];
602
+ cloneQueue.forEach(action => action());
603
+ setActionQueue([]);
604
+ }
605
+ }, [actionQueue]);
606
+ return useCallback(props => {
607
+ hookModalUuid += 1;
608
+ const modalRef = /*#__PURE__*/createRef();
499
609
  const api = {};
500
- const {
501
- afterClose: userAfterClose,
502
- getContainer: customGetContainer,
503
- onClose: userOnClose,
504
- onConfirm: userOnConfirm,
505
- onCancel: userOnCancel
506
- } = props,
507
- restProps = _objectWithoutPropertiesLoose(props, _excluded4);
508
- const closeModal = () => {
509
- api.close == null || api.close();
510
- };
511
- const _computedCommonProps = computedCommonProps(_extends({}, restProps, {
512
- isMobile,
513
- fixedModeClass,
514
- onClose: () => {
515
- userOnClose == null || userOnClose();
516
- closeModal();
517
- },
518
- onCancel: (...args) => {
519
- userOnCancel == null || userOnCancel(...args);
520
- closeModal();
521
- },
522
- onConfirm: async (...args) => {
523
- const res = await Promise.resolve(userOnConfirm == null ? void 0 : userOnConfirm(...args));
524
- if (res !== false) {
525
- closeModal();
610
+ let closeFunc;
611
+ let unlock = () => {};
612
+ const resolvePatch = () => (layer == null ? void 0 : layer.patchElement) || rootModalPatchRef.current;
613
+ const runOpen = () => {
614
+ const patch = resolvePatch();
615
+ if (typeof patch !== 'function') {
616
+ throw new Error('useModal requires <ModalContextHolder /> mounted inside <App> before calling useModal()');
617
+ }
618
+ unlock = lockParentScroll(getScrollElement);
619
+ const {
620
+ afterClose: userAfterClose,
621
+ getContainer: customGetContainer
622
+ } = props,
623
+ restProps = _objectWithoutPropertiesLoose(props, _excluded2$3);
624
+
625
+ // Holder 在 Global 外层;用点击焦点定位示例手机框(对齐 useDrawer / FileModal)
626
+ const openAnchor = typeof document !== 'undefined' ? document.activeElement : null;
627
+ const exampleMount = findExamplePhoneMountNode(openAnchor, VIEWPORT_EXAMPLE_SELECTORS$3);
628
+ const examplePhoneProps = exampleMount && !customGetContainer ? {
629
+ getContainer: () => exampleMount,
630
+ isMobile: true,
631
+ fixedModeClass: 'kne-is-boundary'
632
+ } : customGetContainer ? {
633
+ getContainer: customGetContainer
634
+ } : {};
635
+ const modalEl = /*#__PURE__*/jsx(HookModal, {
636
+ ref: modalRef,
637
+ config: _extends({}, restProps, examplePhoneProps, {
638
+ afterClose: (...args) => {
639
+ unlock();
640
+ userAfterClose == null || userAfterClose(...args);
526
641
  }
527
- return res;
528
- },
529
- afterClose: (...args) => {
530
- unlock();
531
- userAfterClose == null || userAfterClose(...args);
642
+ }),
643
+ afterClose: () => {
644
+ closeFunc && closeFunc();
532
645
  }
533
- })),
534
- {
535
- children,
536
- getContainer,
537
- afterClose
538
- } = _computedCommonProps,
539
- otherProps = _objectWithoutPropertiesLoose(_computedCommonProps, _excluded5);
540
- const {
541
- destroy
542
- } = modal.info(_extends({}, otherProps, {
543
- afterClose,
544
- content: children,
545
- getContainer: resolveModalGetContainer({
546
- customGetContainer: customGetContainer != null ? customGetContainer : getContainer,
547
- getPopupContainer,
548
- getHostNode: () => anchor
549
- })
550
- }));
551
- api.close = destroy;
646
+ }, `react-modal-${hookModalUuid}`);
647
+ closeFunc = patch(modalEl);
648
+ };
649
+ if (resolvePatch()) {
650
+ runOpen();
651
+ } else {
652
+ setActionQueue(prev => [...prev, runOpen]);
653
+ }
654
+ api.close = () => {
655
+ if (modalRef.current) {
656
+ modalRef.current.destroy();
657
+ } else {
658
+ setActionQueue(prev => [...prev, () => {
659
+ var _modalRef$current;
660
+ return (_modalRef$current = modalRef.current) == null ? void 0 : _modalRef$current.destroy();
661
+ }]);
662
+ }
663
+ };
552
664
  return api;
553
- };
665
+ }, [getScrollElement, layer]);
554
666
  };
555
667
 
556
668
  var style = {"kne-responsive-boundary":"kne-react-modal_qwqLr","kne-responsive-scroll":"kne-react-modal_vmry7","drawer":"kne-react-modal_cDsbq","small":"kne-react-modal_3QgK-","is-mobile":"kne-react-modal_FFf73","large":"kne-react-modal_8lell","drawer-body-inner":"kne-react-modal_xgX4D","drawer-antd-header":"kne-react-modal_3EUxr","drawer-antd-footer":"kne-react-modal_2G81L","drawer-antd-body":"kne-react-modal_eKVMu","drawer-outer":"kne-react-modal_P3Cw8","no-title":"kne-react-modal_upRot","no-footer":"kne-react-modal_j4sGu","no-padding":"kne-react-modal_pg37M","drawer-title":"kne-react-modal_-hw5V","drawer-body":"kne-react-modal_nJj7Y","body-scroll-off":"kne-react-modal_2Wh1H","modal-footer-extra":"kne-react-modal_M4hy9","drawer-close":"kne-react-modal_dVh38","drawer-host":"kne-react-modal_Nsxi9","drawer-host-render":"kne-react-modal_iGDWP","drawer-panel-host":"kne-react-modal_A0h-2","drawer-panel-body":"kne-react-modal_E4tcc","drawer-form-host":"kne-react-modal_vKkQW","drawer-wrapper-mobile":"kne-react-modal_vsxOs","drawer-wrapper-mobile-vertical":"kne-react-modal_HG8Vz","drawer-root-mobile":"kne-react-modal_G-qXe"};
@@ -884,17 +996,6 @@ const Drawer = withLocale(_ref2 => {
884
996
  });
885
997
  });
886
998
 
887
- const usePatchElement = () => {
888
- const [elements, setElements] = useState([]);
889
- const patchElement = useCallback(element => {
890
- setElements(originElements => [...originElements, element]);
891
- return () => {
892
- setElements(originElements => originElements.filter(ele => ele !== element));
893
- };
894
- }, []);
895
- return [elements, patchElement];
896
- };
897
-
898
999
  const _excluded$4 = ["getContainer", "afterClose"],
899
1000
  _excluded2$1 = ["afterClose", "getContainer"];
900
1001
  const VIEWPORT_EXAMPLE_SELECTORS$1 = ['.example-driver-device-scroll'];
@@ -1212,41 +1313,46 @@ const mapConfirmProps = (props, {
1212
1313
  icon,
1213
1314
  isMobile
1214
1315
  });
1316
+
1317
+ // Confirm 走 antd ConfirmDialog:未传 zIndex 时用 static 顶层,适合真确认框盖住内容弹窗
1318
+ const config = _extends({}, otherProps, {
1319
+ okText: confirmText != null ? confirmText : otherProps.okText,
1320
+ cancelText: cancelText != null ? cancelText : otherProps.cancelText,
1321
+ onOk: onConfirm != null ? onConfirm : otherProps.onOk,
1322
+ onCancel: onCancel != null ? onCancel : otherProps.onCancel,
1323
+ getContainer: resolveModalGetContainer({
1324
+ customGetContainer,
1325
+ getPopupContainer,
1326
+ getHostNode: () => anchor
1327
+ }),
1328
+ centered: true,
1329
+ afterClose: (...args) => {
1330
+ unlock();
1331
+ userAfterClose && userAfterClose(...args);
1332
+ afterClose && afterClose(...args);
1333
+ },
1334
+ icon: null,
1335
+ classNames: {
1336
+ mask: classnames(isMobile && modalStyle['modal-mask-fullscreen'], isMobile && fixedModeClass, (_otherProps$className = otherProps.classNames) == null ? void 0 : _otherProps$className.mask)
1337
+ },
1338
+ wrapClassName: classnames(modalStyle['modal-wrap'], modalStyle['modal-wrap-centered'], confirmStyle['confirm-modal-wrap'], wrapClassName, {
1339
+ [confirmStyle['is-danger']]: danger,
1340
+ [confirmStyle['is-mobile']]: isMobile,
1341
+ [fixedModeClass]: isMobile
1342
+ }),
1343
+ title: confirmTitle ? /*#__PURE__*/jsx(ConfirmLocaleRoot, {
1344
+ children: confirmTitle
1345
+ }) : null,
1346
+ content: /*#__PURE__*/jsx(ConfirmLocaleRoot, {
1347
+ children: content
1348
+ })
1349
+ });
1350
+ if (zIndex !== undefined) {
1351
+ config.zIndex = zIndex;
1352
+ }
1215
1353
  return {
1216
1354
  modalMethod: type,
1217
- config: _extends({}, otherProps, {
1218
- zIndex: zIndex != null ? zIndex : 1100,
1219
- okText: confirmText != null ? confirmText : otherProps.okText,
1220
- cancelText: cancelText != null ? cancelText : otherProps.cancelText,
1221
- onOk: onConfirm != null ? onConfirm : otherProps.onOk,
1222
- onCancel: onCancel != null ? onCancel : otherProps.onCancel,
1223
- getContainer: resolveModalGetContainer({
1224
- customGetContainer,
1225
- getPopupContainer,
1226
- getHostNode: () => anchor
1227
- }),
1228
- centered: true,
1229
- afterClose: (...args) => {
1230
- unlock();
1231
- userAfterClose && userAfterClose(...args);
1232
- afterClose && afterClose(...args);
1233
- },
1234
- icon: null,
1235
- classNames: {
1236
- mask: classnames(isMobile && modalStyle['modal-mask-fullscreen'], isMobile && fixedModeClass, (_otherProps$className = otherProps.classNames) == null ? void 0 : _otherProps$className.mask)
1237
- },
1238
- wrapClassName: classnames(modalStyle['modal-wrap'], modalStyle['modal-wrap-centered'], confirmStyle['confirm-modal-wrap'], wrapClassName, {
1239
- [confirmStyle['is-danger']]: danger,
1240
- [confirmStyle['is-mobile']]: isMobile,
1241
- [fixedModeClass]: isMobile
1242
- }),
1243
- title: confirmTitle ? /*#__PURE__*/jsx(ConfirmLocaleRoot, {
1244
- children: confirmTitle
1245
- }) : null,
1246
- content: /*#__PURE__*/jsx(ConfirmLocaleRoot, {
1247
- children: content
1248
- })
1249
- })
1355
+ config
1250
1356
  };
1251
1357
  };
1252
1358
  const useConfirmModal = () => {
@@ -1369,5 +1475,5 @@ const modalClassNames = {
1369
1475
  splitter: 'react-modal-splitter'
1370
1476
  };
1371
1477
 
1372
- export { ColumnsLayout, Drawer, DrawerContextHolder, ScrollRegion, TabsLayout, createDrawerRender, createModalRender, Modal as default, modalClassNames, useConfirmModal, useDrawer, useModal };
1478
+ export { ColumnsLayout, Drawer, DrawerContextHolder, ModalContextHolder, ModalLayerContext, ScrollRegion, TabsLayout, createDrawerRender, createModalRender, Modal as default, modalClassNames, useConfirmModal, useDrawer, useModal, useModalLayer };
1373
1479
  //# sourceMappingURL=index.modern.js.map