@canlooks/can-ui 0.0.82 → 0.0.84

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.
@@ -87,7 +87,7 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
87
87
  onDelete?(row: R): any;
88
88
  /** 行数据转换为表单值的方法,若不指定,行数据会直接填入表单 */
89
89
  rowToForm?(row: R): F | Promise<F>;
90
- dialogProps?: CurdDialogProps<R, F>;
90
+ dialogProps?: Partial<CurdDialogProps<R, F>>;
91
91
  formProps?: FormProps<F>;
92
92
  formRef?: Ref<FormRef<F>>;
93
93
  }
@@ -25,12 +25,18 @@ export interface DialogProps extends Omit<ModalProps, 'title' | 'prefix'> {
25
25
  cancelText?: ReactNode;
26
26
  cancelProps?: ButtonProps;
27
27
  onCancel?(e: React.MouseEvent<HTMLButtonElement | HTMLDivElement> | KeyboardEvent): void;
28
+ /**
29
+ * 滚动的行为,默认为`card`
30
+ * @enum 'card' 卡片内部滚动
31
+ * @enum 'body' 对话框整体滚动
32
+ */
33
+ scrollBehavior?: 'card' | 'body';
28
34
  draggable?: boolean;
29
- /** 是否可通过点击遮罩层关闭对话框,默认为true */
35
+ /** 是否可通过点击遮罩层关闭对话框,默认为`true` */
30
36
  maskClosable?: boolean;
31
- /** 是否可通过键盘的【ESC】键关闭对话框,默认为true */
37
+ /** 是否可通过键盘的【ESC】键关闭对话框,默认为`true` */
32
38
  escapeClosable?: boolean;
33
39
  defaultOpen?: boolean;
34
40
  onClose?(closeReason: DialogCloseReason): void;
35
41
  }
36
- export declare function Dialog({ icon, title, footer, prefix, suffix, width, minWidth, maxWidth, showClose, closeProps, showConfirm, confirmText, confirmProps, onConfirm, confirmLoading, showCancel, cancelText, cancelProps, onCancel, draggable, maskClosable, escapeClosable, defaultOpen, open, onClose, ...props }: DialogProps): import("@emotion/react/jsx-runtime").JSX.Element;
42
+ export declare function Dialog({ icon, title, footer, prefix, suffix, width, minWidth, maxWidth, showClose, closeProps, showConfirm, confirmText, confirmProps, onConfirm, confirmLoading, showCancel, cancelText, cancelProps, onCancel, scrollBehavior, draggable, maskClosable, escapeClosable, defaultOpen, open, onClose, ...props }: DialogProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -10,7 +10,7 @@ const button_1 = require("../button");
10
10
  const draggable_1 = require("../draggable");
11
11
  const icon_1 = require("../icon");
12
12
  const faXmark_1 = require("@fortawesome/free-solid-svg-icons/faXmark");
13
- function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, maxWidth = '100%', showClose = true, closeProps, showConfirm = true, confirmText = '确 定', confirmProps, onConfirm, confirmLoading = false, showCancel = true, cancelText = '取 消', cancelProps, onCancel, draggable = true, maskClosable = true, escapeClosable = true, defaultOpen = false, open, onClose, ...props }) {
13
+ function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, maxWidth = '100%', showClose = true, closeProps, showConfirm = true, confirmText = '确 定', confirmProps, onConfirm, confirmLoading = false, showCancel = true, cancelText = '取 消', cancelProps, onCancel, scrollBehavior = 'card', draggable = true, maskClosable = true, escapeClosable = true, defaultOpen = false, open, onClose, ...props }) {
14
14
  const [innerOpen, _setInnerOpen] = (0, utils_1.useControlled)(defaultOpen, open);
15
15
  const close = (closeReason) => {
16
16
  if (!innerLoading.current || closeReason === 'confirmed') {
@@ -81,7 +81,7 @@ function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, ma
81
81
  }
82
82
  return footer;
83
83
  };
84
- return ((0, jsx_runtime_1.jsx)(modal_1.Modal, { ...props, ref: (0, utils_1.cloneRef)(overlayRef, props.ref), css: dialog_style_1.style, className: (0, utils_1.clsx)(dialog_style_1.classes.root, props.className), open: innerOpen.current, onMaskClick: onMaskClick, "data-draggable": draggable, children: (0, jsx_runtime_1.jsx)(draggable_1.Draggable, { container: () => overlayRef.current, children: (targetProps, handleProps) => (0, jsx_runtime_1.jsxs)("div", { className: dialog_style_1.classes.card, ...targetProps, style: { width, minWidth, maxWidth, ...targetProps.style }, children: [!!icon &&
84
+ return ((0, jsx_runtime_1.jsx)(modal_1.Modal, { ...props, ref: (0, utils_1.cloneRef)(overlayRef, props.ref), css: dialog_style_1.style, className: (0, utils_1.clsx)(dialog_style_1.classes.root, props.className), open: innerOpen.current, onMaskClick: onMaskClick, "data-scroll-behavior": scrollBehavior, "data-draggable": draggable, children: (0, jsx_runtime_1.jsx)(draggable_1.Draggable, { container: () => overlayRef.current, children: (targetProps, handleProps) => (0, jsx_runtime_1.jsxs)("div", { className: dialog_style_1.classes.card, ...targetProps, style: { width, minWidth, maxWidth, ...targetProps.style }, children: [!!icon &&
85
85
  (0, jsx_runtime_1.jsx)("div", { className: dialog_style_1.classes.icon, children: icon }), (0, jsx_runtime_1.jsxs)("div", { className: dialog_style_1.classes.content, children: [!!(title || showClose) &&
86
86
  (0, jsx_runtime_1.jsxs)("div", { className: dialog_style_1.classes.titleRow, ...handleProps, children: [(0, jsx_runtime_1.jsx)("div", { className: dialog_style_1.classes.title, children: title }), showClose &&
87
87
  (0, jsx_runtime_1.jsx)(button_1.Button, { shape: "circular", variant: "text", color: "text.secondary", ...closeProps, className: (0, utils_1.clsx)(dialog_style_1.classes.close, closeProps?.className), onClick: closeHandler, children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faXmark_1.faXmark }) })] }), (0, jsx_runtime_1.jsxs)("div", { ref: bodyRef, className: dialog_style_1.classes.body, onScroll: onScroll, children: [!!prefix &&
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.style = exports.classes = void 0;
4
4
  const react_1 = require("@emotion/react");
5
5
  const utils_1 = require("../../utils");
6
+ const modal_style_1 = require("../modal/modal.style");
7
+ const overlayBase_style_1 = require("../overlayBase/overlayBase.style");
6
8
  exports.classes = (0, utils_1.defineInnerClasses)('dialog', [
7
9
  'card',
8
10
  'icon',
@@ -18,13 +20,36 @@ exports.classes = (0, utils_1.defineInnerClasses)('dialog', [
18
20
  ]);
19
21
  exports.style = (0, utils_1.defineCss)(({ background, borderRadius, boxShadow, spacing, colors, divider }) => (0, react_1.css) `
20
22
  .${exports.classes.card} {
21
- max-height: 100%;
22
23
  display: flex;
23
24
  background-color: ${background.content};
24
25
  border-radius: ${borderRadius}px;
25
26
  box-shadow: ${boxShadow[0]};
26
27
  }
27
28
 
29
+ .${modal_style_1.classes.childrenWrap} {
30
+ padding: 40px;
31
+ }
32
+
33
+ &[data-scroll-behavior=card] {
34
+ .${modal_style_1.classes.childrenWrap} {
35
+ height: 100%;
36
+ }
37
+
38
+ .${exports.classes.card} {
39
+ max-height: 100%;
40
+ }
41
+ }
42
+
43
+ &[data-scroll-behavior=body] {
44
+ .${modal_style_1.classes.modal} {
45
+ height: auto;
46
+ }
47
+
48
+ .${overlayBase_style_1.classes.childrenWrap} {
49
+ overflow: hidden auto;
50
+ }
51
+ }
52
+
28
53
  .${exports.classes.icon} {
29
54
  color: ${colors.primary.main};
30
55
  font-size: ${21 / 14}em;
@@ -51,7 +76,7 @@ exports.style = (0, utils_1.defineCss)(({ background, borderRadius, boxShadow, s
51
76
  font-size: ${16 / 14}em;
52
77
  font-weight: bold;
53
78
  margin-right: -${spacing[8]}px;
54
-
79
+
55
80
  .${exports.classes.title} {
56
81
  flex: 1;
57
82
  padding: ${spacing[6]}px 0 ${spacing[3]}px;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.style = exports.classes = void 0;
4
4
  const react_1 = require("@emotion/react");
5
5
  const utils_1 = require("../../utils");
6
- const modal_style_1 = require("../modal/modal.style");
7
6
  exports.classes = (0, utils_1.defineInnerClasses)('image-preview', [
8
7
  'button',
9
8
  'control',
@@ -69,10 +68,6 @@ exports.style = (0, utils_1.defineCss)(({ spacing, easing, breakpoints }) => (0,
69
68
  }
70
69
  }
71
70
 
72
- .${modal_style_1.classes.modal} {
73
- padding: 0;
74
- }
75
-
76
71
  .${exports.classes.galleryContainer} {
77
72
  &, .${exports.classes.galleryWrapper}, .${exports.classes.imageItem}, .${exports.classes.image} {
78
73
  width: 100%;
@@ -22,5 +22,5 @@ function Modal({ modalProps, ...props }) {
22
22
  return ((0, jsx_runtime_1.jsx)(overlayBase_1.OverlayBase, { ...props, css: modal_style_1.style, className: (0, utils_1.clsx)(modal_style_1.classes.root, props.className), children: (0, jsx_runtime_1.jsx)(transitionBase_1.Grow, { timeout: overlayBase_1.overlayBaseTransitionDuration, ...modalProps, in: props.open, className: (0, utils_1.clsx)(modal_style_1.classes.modal, modalProps?.className), style: {
23
23
  transformOrigin: transformOrigin.current,
24
24
  ...modalProps?.style
25
- }, children: props.children }) }));
25
+ }, children: (0, jsx_runtime_1.jsx)("div", { className: modal_style_1.classes.childrenWrap, onClick: e => e.stopPropagation(), children: props.children }) }) }));
26
26
  }
@@ -1,4 +1,5 @@
1
1
  export declare const classes: {
2
+ childrenWrap: string;
2
3
  modal: string;
3
4
  } & {
4
5
  root: string;
@@ -4,20 +4,15 @@ exports.style = exports.classes = void 0;
4
4
  const react_1 = require("@emotion/react");
5
5
  const utils_1 = require("../../utils");
6
6
  exports.classes = (0, utils_1.defineInnerClasses)('modal', [
7
- 'modal'
7
+ 'modal',
8
+ 'childrenWrap'
8
9
  ]);
9
10
  exports.style = (0, react_1.css) `
10
11
  .${exports.classes.modal} {
11
12
  width: 100%;
12
13
  height: 100%;
13
- padding: 40px;
14
- pointer-events: none;
15
14
  display: flex;
16
15
  align-items: center;
17
16
  justify-content: center;
18
-
19
- > * {
20
- pointer-events: all;
21
- }
22
17
  }
23
18
  `;
@@ -37,11 +37,11 @@ function OverlayBase({ container, effectContainer, forceRender, open, onMaskClic
37
37
  onClosed?.();
38
38
  forceRender === false && setShouldRender(false);
39
39
  };
40
- return shouldRender.current && (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", { ...props, css: overlayBase_style_1.style, className: (0, utils_1.clsx)(overlayBase_style_1.classes.root, props.className), "data-open": open, "data-custom-container": containerEl.current !== document.body, children: [(0, jsx_runtime_1.jsx)(transitionBase_1.Fade, { timeout: exports.overlayBaseTransitionDuration, ...(0, utils_1.mergeComponentProps)(maskProps, {
41
- in: open,
42
- className: overlayBase_style_1.classes.mask,
43
- onClick,
44
- onEntered,
45
- onExited
46
- }) }), props.children] }), containerEl.current);
40
+ return shouldRender.current && (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { ...props, css: overlayBase_style_1.style, className: (0, utils_1.clsx)(overlayBase_style_1.classes.root, props.className), "data-open": open, "data-custom-container": containerEl.current !== document.body, children: (0, jsx_runtime_1.jsx)(transitionBase_1.Fade, { timeout: exports.overlayBaseTransitionDuration, ...(0, utils_1.mergeComponentProps)(maskProps, {
41
+ in: open,
42
+ className: overlayBase_style_1.classes.mask,
43
+ onClick,
44
+ onEntered,
45
+ onExited
46
+ }), children: (0, jsx_runtime_1.jsx)("div", { className: overlayBase_style_1.classes.childrenWrap, children: props.children }) }) }), containerEl.current);
47
47
  }
@@ -1,5 +1,6 @@
1
1
  export declare const classes: {
2
2
  mask: string;
3
+ childrenWrap: string;
3
4
  } & {
4
5
  root: string;
5
6
  };
@@ -6,29 +6,35 @@ const utils_1 = require("../../utils");
6
6
  const app_style_1 = require("../app/app.style");
7
7
  const theme_1 = require("../theme");
8
8
  exports.classes = (0, utils_1.defineInnerClasses)('overlay-base', [
9
- 'mask'
9
+ 'mask',
10
+ 'childrenWrap'
10
11
  ]);
11
12
  exports.style = (0, utils_1.defineCss)(theme => {
12
13
  return [
13
14
  (0, app_style_1.appStyleCallback)(theme),
14
15
  (0, react_1.css) `
15
- position: fixed;
16
- inset: 0;
17
- z-index: ${theme_1.zIndex.overlay};
18
-
19
- &[data-custom-container=true] {
20
- position: absolute;
21
- }
22
-
23
- .${exports.classes.mask} {
24
- background-color: rgba(0, 0, 0, .5);
25
- position: absolute;
16
+ position: fixed;
26
17
  inset: 0;
27
- }
18
+ z-index: ${theme_1.zIndex.overlay};
19
+
20
+ &[data-custom-container=true] {
21
+ position: absolute;
22
+ }
23
+
24
+ .${exports.classes.mask} {
25
+ background-color: rgba(0, 0, 0, .5);
26
+ position: absolute;
27
+ inset: 0;
28
+ }
28
29
 
29
- &:not([data-open=true]) {
30
- pointer-events: none;
31
- }
32
- `
30
+ &:not([data-open=true]) {
31
+ pointer-events: none;
32
+ }
33
+
34
+ .${exports.classes.childrenWrap} {
35
+ height: 100%;
36
+ position: relative;
37
+ }
38
+ `
33
39
  ];
34
40
  });
@@ -87,7 +87,7 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
87
87
  onDelete?(row: R): any;
88
88
  /** 行数据转换为表单值的方法,若不指定,行数据会直接填入表单 */
89
89
  rowToForm?(row: R): F | Promise<F>;
90
- dialogProps?: CurdDialogProps<R, F>;
90
+ dialogProps?: Partial<CurdDialogProps<R, F>>;
91
91
  formProps?: FormProps<F>;
92
92
  formRef?: Ref<FormRef<F>>;
93
93
  }
@@ -25,12 +25,18 @@ export interface DialogProps extends Omit<ModalProps, 'title' | 'prefix'> {
25
25
  cancelText?: ReactNode;
26
26
  cancelProps?: ButtonProps;
27
27
  onCancel?(e: React.MouseEvent<HTMLButtonElement | HTMLDivElement> | KeyboardEvent): void;
28
+ /**
29
+ * 滚动的行为,默认为`card`
30
+ * @enum 'card' 卡片内部滚动
31
+ * @enum 'body' 对话框整体滚动
32
+ */
33
+ scrollBehavior?: 'card' | 'body';
28
34
  draggable?: boolean;
29
- /** 是否可通过点击遮罩层关闭对话框,默认为true */
35
+ /** 是否可通过点击遮罩层关闭对话框,默认为`true` */
30
36
  maskClosable?: boolean;
31
- /** 是否可通过键盘的【ESC】键关闭对话框,默认为true */
37
+ /** 是否可通过键盘的【ESC】键关闭对话框,默认为`true` */
32
38
  escapeClosable?: boolean;
33
39
  defaultOpen?: boolean;
34
40
  onClose?(closeReason: DialogCloseReason): void;
35
41
  }
36
- export declare function Dialog({ icon, title, footer, prefix, suffix, width, minWidth, maxWidth, showClose, closeProps, showConfirm, confirmText, confirmProps, onConfirm, confirmLoading, showCancel, cancelText, cancelProps, onCancel, draggable, maskClosable, escapeClosable, defaultOpen, open, onClose, ...props }: DialogProps): import("@emotion/react/jsx-runtime").JSX.Element;
42
+ export declare function Dialog({ icon, title, footer, prefix, suffix, width, minWidth, maxWidth, showClose, closeProps, showConfirm, confirmText, confirmProps, onConfirm, confirmLoading, showCancel, cancelText, cancelProps, onCancel, scrollBehavior, draggable, maskClosable, escapeClosable, defaultOpen, open, onClose, ...props }: DialogProps): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -7,7 +7,7 @@ import { Button } from '../button';
7
7
  import { Draggable } from '../draggable';
8
8
  import { Icon } from '../icon';
9
9
  import { faXmark } from '@fortawesome/free-solid-svg-icons/faXmark';
10
- export function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, maxWidth = '100%', showClose = true, closeProps, showConfirm = true, confirmText = '确 定', confirmProps, onConfirm, confirmLoading = false, showCancel = true, cancelText = '取 消', cancelProps, onCancel, draggable = true, maskClosable = true, escapeClosable = true, defaultOpen = false, open, onClose, ...props }) {
10
+ export function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, maxWidth = '100%', showClose = true, closeProps, showConfirm = true, confirmText = '确 定', confirmProps, onConfirm, confirmLoading = false, showCancel = true, cancelText = '取 消', cancelProps, onCancel, scrollBehavior = 'card', draggable = true, maskClosable = true, escapeClosable = true, defaultOpen = false, open, onClose, ...props }) {
11
11
  const [innerOpen, _setInnerOpen] = useControlled(defaultOpen, open);
12
12
  const close = (closeReason) => {
13
13
  if (!innerLoading.current || closeReason === 'confirmed') {
@@ -78,7 +78,7 @@ export function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWi
78
78
  }
79
79
  return footer;
80
80
  };
81
- return (_jsx(Modal, { ...props, ref: cloneRef(overlayRef, props.ref), css: style, className: clsx(classes.root, props.className), open: innerOpen.current, onMaskClick: onMaskClick, "data-draggable": draggable, children: _jsx(Draggable, { container: () => overlayRef.current, children: (targetProps, handleProps) => _jsxs("div", { className: classes.card, ...targetProps, style: { width, minWidth, maxWidth, ...targetProps.style }, children: [!!icon &&
81
+ return (_jsx(Modal, { ...props, ref: cloneRef(overlayRef, props.ref), css: style, className: clsx(classes.root, props.className), open: innerOpen.current, onMaskClick: onMaskClick, "data-scroll-behavior": scrollBehavior, "data-draggable": draggable, children: _jsx(Draggable, { container: () => overlayRef.current, children: (targetProps, handleProps) => _jsxs("div", { className: classes.card, ...targetProps, style: { width, minWidth, maxWidth, ...targetProps.style }, children: [!!icon &&
82
82
  _jsx("div", { className: classes.icon, children: icon }), _jsxs("div", { className: classes.content, children: [!!(title || showClose) &&
83
83
  _jsxs("div", { className: classes.titleRow, ...handleProps, children: [_jsx("div", { className: classes.title, children: title }), showClose &&
84
84
  _jsx(Button, { shape: "circular", variant: "text", color: "text.secondary", ...closeProps, className: clsx(classes.close, closeProps?.className), onClick: closeHandler, children: _jsx(Icon, { icon: faXmark }) })] }), _jsxs("div", { ref: bodyRef, className: classes.body, onScroll: onScroll, children: [!!prefix &&
@@ -1,5 +1,7 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { defineInnerClasses, defineCss } from '../../utils';
3
+ import { classes as modalClasses } from '../modal/modal.style';
4
+ import { classes as overlayBaseClasses } from '../overlayBase/overlayBase.style';
3
5
  export const classes = defineInnerClasses('dialog', [
4
6
  'card',
5
7
  'icon',
@@ -15,13 +17,36 @@ export const classes = defineInnerClasses('dialog', [
15
17
  ]);
16
18
  export const style = defineCss(({ background, borderRadius, boxShadow, spacing, colors, divider }) => css `
17
19
  .${classes.card} {
18
- max-height: 100%;
19
20
  display: flex;
20
21
  background-color: ${background.content};
21
22
  border-radius: ${borderRadius}px;
22
23
  box-shadow: ${boxShadow[0]};
23
24
  }
24
25
 
26
+ .${modalClasses.childrenWrap} {
27
+ padding: 40px;
28
+ }
29
+
30
+ &[data-scroll-behavior=card] {
31
+ .${modalClasses.childrenWrap} {
32
+ height: 100%;
33
+ }
34
+
35
+ .${classes.card} {
36
+ max-height: 100%;
37
+ }
38
+ }
39
+
40
+ &[data-scroll-behavior=body] {
41
+ .${modalClasses.modal} {
42
+ height: auto;
43
+ }
44
+
45
+ .${overlayBaseClasses.childrenWrap} {
46
+ overflow: hidden auto;
47
+ }
48
+ }
49
+
25
50
  .${classes.icon} {
26
51
  color: ${colors.primary.main};
27
52
  font-size: ${21 / 14}em;
@@ -48,7 +73,7 @@ export const style = defineCss(({ background, borderRadius, boxShadow, spacing,
48
73
  font-size: ${16 / 14}em;
49
74
  font-weight: bold;
50
75
  margin-right: -${spacing[8]}px;
51
-
76
+
52
77
  .${classes.title} {
53
78
  flex: 1;
54
79
  padding: ${spacing[6]}px 0 ${spacing[3]}px;
@@ -1,6 +1,5 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { defineInnerClasses, defineCss } from '../../utils';
3
- import { classes as modalClasses } from '../modal/modal.style';
4
3
  export const classes = defineInnerClasses('image-preview', [
5
4
  'button',
6
5
  'control',
@@ -66,10 +65,6 @@ export const style = defineCss(({ spacing, easing, breakpoints }) => css `
66
65
  }
67
66
  }
68
67
 
69
- .${modalClasses.modal} {
70
- padding: 0;
71
- }
72
-
73
68
  .${classes.galleryContainer} {
74
69
  &, .${classes.galleryWrapper}, .${classes.imageItem}, .${classes.image} {
75
70
  width: 100%;
@@ -19,5 +19,5 @@ export function Modal({ modalProps, ...props }) {
19
19
  return (_jsx(OverlayBase, { ...props, css: style, className: clsx(classes.root, props.className), children: _jsx(Grow, { timeout: overlayBaseTransitionDuration, ...modalProps, in: props.open, className: clsx(classes.modal, modalProps?.className), style: {
20
20
  transformOrigin: transformOrigin.current,
21
21
  ...modalProps?.style
22
- }, children: props.children }) }));
22
+ }, children: _jsx("div", { className: classes.childrenWrap, onClick: e => e.stopPropagation(), children: props.children }) }) }));
23
23
  }
@@ -1,4 +1,5 @@
1
1
  export declare const classes: {
2
+ childrenWrap: string;
2
3
  modal: string;
3
4
  } & {
4
5
  root: string;
@@ -1,20 +1,15 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { defineInnerClasses } from '../../utils';
3
3
  export const classes = defineInnerClasses('modal', [
4
- 'modal'
4
+ 'modal',
5
+ 'childrenWrap'
5
6
  ]);
6
7
  export const style = css `
7
8
  .${classes.modal} {
8
9
  width: 100%;
9
10
  height: 100%;
10
- padding: 40px;
11
- pointer-events: none;
12
11
  display: flex;
13
12
  align-items: center;
14
13
  justify-content: center;
15
-
16
- > * {
17
- pointer-events: all;
18
- }
19
14
  }
20
15
  `;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
2
  import { useEffect } from 'react';
3
3
  import { classes, style } from './overlayBase.style';
4
4
  import { clsx, mergeComponentProps, useContainer, useDerivedState } from '../../utils';
@@ -33,11 +33,11 @@ export function OverlayBase({ container, effectContainer, forceRender, open, onM
33
33
  onClosed?.();
34
34
  forceRender === false && setShouldRender(false);
35
35
  };
36
- return shouldRender.current && createPortal(_jsxs("div", { ...props, css: style, className: clsx(classes.root, props.className), "data-open": open, "data-custom-container": containerEl.current !== document.body, children: [_jsx(Fade, { timeout: overlayBaseTransitionDuration, ...mergeComponentProps(maskProps, {
37
- in: open,
38
- className: classes.mask,
39
- onClick,
40
- onEntered,
41
- onExited
42
- }) }), props.children] }), containerEl.current);
36
+ return shouldRender.current && createPortal(_jsx("div", { ...props, css: style, className: clsx(classes.root, props.className), "data-open": open, "data-custom-container": containerEl.current !== document.body, children: _jsx(Fade, { timeout: overlayBaseTransitionDuration, ...mergeComponentProps(maskProps, {
37
+ in: open,
38
+ className: classes.mask,
39
+ onClick,
40
+ onEntered,
41
+ onExited
42
+ }), children: _jsx("div", { className: classes.childrenWrap, children: props.children }) }) }), containerEl.current);
43
43
  }
@@ -1,5 +1,6 @@
1
1
  export declare const classes: {
2
2
  mask: string;
3
+ childrenWrap: string;
3
4
  } & {
4
5
  root: string;
5
6
  };
@@ -3,29 +3,35 @@ import { defineInnerClasses, defineCss } from '../../utils';
3
3
  import { appStyleCallback } from '../app/app.style';
4
4
  import { zIndex } from '../theme';
5
5
  export const classes = defineInnerClasses('overlay-base', [
6
- 'mask'
6
+ 'mask',
7
+ 'childrenWrap'
7
8
  ]);
8
9
  export const style = defineCss(theme => {
9
10
  return [
10
11
  appStyleCallback(theme),
11
12
  css `
12
- position: fixed;
13
- inset: 0;
14
- z-index: ${zIndex.overlay};
15
-
16
- &[data-custom-container=true] {
17
- position: absolute;
18
- }
19
-
20
- .${classes.mask} {
21
- background-color: rgba(0, 0, 0, .5);
22
- position: absolute;
13
+ position: fixed;
23
14
  inset: 0;
24
- }
15
+ z-index: ${zIndex.overlay};
16
+
17
+ &[data-custom-container=true] {
18
+ position: absolute;
19
+ }
20
+
21
+ .${classes.mask} {
22
+ background-color: rgba(0, 0, 0, .5);
23
+ position: absolute;
24
+ inset: 0;
25
+ }
25
26
 
26
- &:not([data-open=true]) {
27
- pointer-events: none;
28
- }
29
- `
27
+ &:not([data-open=true]) {
28
+ pointer-events: none;
29
+ }
30
+
31
+ .${classes.childrenWrap} {
32
+ height: 100%;
33
+ position: relative;
34
+ }
35
+ `
30
36
  ];
31
37
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",