acud 0.0.63 → 0.0.66

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.
Files changed (115) hide show
  1. package/dist/acud.css +164 -53
  2. package/dist/acud.css.map +1 -1
  3. package/dist/acud.js +817 -213
  4. package/dist/acud.js.map +1 -1
  5. package/dist/acud.min.css +1 -1
  6. package/dist/acud.min.css.map +1 -1
  7. package/dist/acud.min.js +10 -4
  8. package/dist/acud.min.js.map +1 -1
  9. package/es/alert/style/index.css +1 -1
  10. package/es/alert/style/index.less +150 -147
  11. package/es/alert/style/rtl.less +27 -27
  12. package/es/breadcrumb/BreadcrumbItem.d.ts +1 -1
  13. package/es/breadcrumb/BreadcrumbItem.js +16 -4
  14. package/es/date-picker/src/Picker.js +1 -1
  15. package/es/date-picker/src/RangePicker.js +1 -1
  16. package/es/date-picker/style/index.css +43 -11
  17. package/es/date-picker/style/index.less +13 -2
  18. package/es/date-picker/style/panel.less +32 -10
  19. package/es/dialog-box/style/index.css +4 -4
  20. package/es/dropdown/dropdown-button.js +11 -2
  21. package/es/dropdown/style/index.css +6 -1
  22. package/es/dropdown/style/index.less +6 -1
  23. package/es/modal/DialogBox.d.ts +46 -0
  24. package/es/modal/DialogBox.js +152 -0
  25. package/es/modal/Modal.d.ts +5 -0
  26. package/es/modal/Modal.js +6 -4
  27. package/es/modal/dialog.d.ts +17 -0
  28. package/es/modal/dialog.js +123 -0
  29. package/es/modal/index.d.ts +11 -2
  30. package/es/modal/index.js +10 -1
  31. package/es/modal/style/index.css +62 -16
  32. package/es/modal/style/index.less +76 -5
  33. package/es/modal/style/mixin.less +2 -2
  34. package/es/progress/style/common.less +5 -3
  35. package/es/progress/style/index.css +2 -1
  36. package/es/radio/index.d.ts +3 -0
  37. package/es/style/themes/dark/components/modal.less +14 -9
  38. package/es/style/themes/default/components/datePicker.less +1 -1
  39. package/es/style/themes/default/components/modal.less +14 -14
  40. package/es/time-picker/style/index.css +1 -0
  41. package/es/time-picker/style/index.less +1 -0
  42. package/es/transfer/{dataSource.d.ts → DataSource.d.ts} +1 -1
  43. package/es/transfer/{dataSource.js → DataSource.js} +37 -6
  44. package/{lib/transfer/sourceList.d.ts → es/transfer/SourceList.d.ts} +2 -2
  45. package/es/transfer/{sourceList.js → SourceList.js} +0 -0
  46. package/es/transfer/{target.d.ts → Target.d.ts} +1 -1
  47. package/es/transfer/{target.js → Target.js} +60 -4
  48. package/{lib/transfer/targetList.d.ts → es/transfer/TargetList.d.ts} +2 -2
  49. package/es/transfer/{targetList.js → TargetList.js} +0 -0
  50. package/es/transfer/index.d.ts +3 -0
  51. package/es/transfer/index.js +9 -4
  52. package/es/transfer/style/css.js +3 -1
  53. package/es/transfer/style/index.css +27 -5
  54. package/es/transfer/style/index.d.ts +1 -0
  55. package/es/transfer/style/index.js +3 -1
  56. package/es/transfer/style/index.less +32 -5
  57. package/es/upload/UploadList/ListItem.js +7 -2
  58. package/es/upload/UploadList/index.js +4 -7
  59. package/es/upload/style/index.css +17 -13
  60. package/es/upload/style/index.less +25 -20
  61. package/es/upload/utils.js +1 -1
  62. package/lib/alert/style/index.css +1 -1
  63. package/lib/alert/style/index.less +150 -147
  64. package/lib/alert/style/rtl.less +27 -27
  65. package/lib/breadcrumb/BreadcrumbItem.d.ts +1 -1
  66. package/lib/breadcrumb/BreadcrumbItem.js +21 -8
  67. package/lib/date-picker/src/Picker.js +1 -1
  68. package/lib/date-picker/src/RangePicker.js +1 -1
  69. package/lib/date-picker/style/index.css +43 -11
  70. package/lib/date-picker/style/index.less +13 -2
  71. package/lib/date-picker/style/panel.less +32 -10
  72. package/lib/dialog-box/style/index.css +4 -4
  73. package/lib/dropdown/dropdown-button.js +11 -2
  74. package/lib/dropdown/style/index.css +6 -1
  75. package/lib/dropdown/style/index.less +6 -1
  76. package/lib/modal/DialogBox.d.ts +46 -0
  77. package/lib/modal/DialogBox.js +179 -0
  78. package/lib/modal/Modal.d.ts +5 -0
  79. package/lib/modal/Modal.js +6 -4
  80. package/lib/modal/dialog.d.ts +17 -0
  81. package/lib/modal/dialog.js +145 -0
  82. package/lib/modal/index.d.ts +11 -2
  83. package/lib/modal/index.js +13 -1
  84. package/lib/modal/style/index.css +62 -16
  85. package/lib/modal/style/index.less +76 -5
  86. package/lib/modal/style/mixin.less +2 -2
  87. package/lib/progress/style/common.less +5 -3
  88. package/lib/progress/style/index.css +2 -1
  89. package/lib/radio/index.d.ts +3 -0
  90. package/lib/style/themes/dark/components/modal.less +14 -9
  91. package/lib/style/themes/default/components/datePicker.less +1 -1
  92. package/lib/style/themes/default/components/modal.less +14 -14
  93. package/lib/time-picker/style/index.css +1 -0
  94. package/lib/time-picker/style/index.less +1 -0
  95. package/lib/transfer/{dataSource.d.ts → DataSource.d.ts} +1 -1
  96. package/lib/transfer/{dataSource.js → DataSource.js} +38 -6
  97. package/{es/transfer/sourceList.d.ts → lib/transfer/SourceList.d.ts} +2 -2
  98. package/lib/transfer/{sourceList.js → SourceList.js} +0 -0
  99. package/lib/transfer/{target.d.ts → Target.d.ts} +1 -1
  100. package/lib/transfer/{target.js → Target.js} +63 -5
  101. package/{es/transfer/targetList.d.ts → lib/transfer/TargetList.d.ts} +2 -2
  102. package/lib/transfer/{targetList.js → TargetList.js} +0 -0
  103. package/lib/transfer/index.d.ts +3 -0
  104. package/lib/transfer/index.js +11 -7
  105. package/lib/transfer/style/css.js +3 -1
  106. package/lib/transfer/style/index.css +27 -5
  107. package/lib/transfer/style/index.d.ts +1 -0
  108. package/lib/transfer/style/index.js +3 -1
  109. package/lib/transfer/style/index.less +32 -5
  110. package/lib/upload/UploadList/ListItem.js +7 -2
  111. package/lib/upload/UploadList/index.js +4 -7
  112. package/lib/upload/style/index.css +17 -13
  113. package/lib/upload/style/index.less +25 -20
  114. package/lib/upload/utils.js +1 -1
  115. package/package.json +1 -1
@@ -61,16 +61,27 @@
61
61
  background: @picker-basic-cell-active-with-range-color;
62
62
  }
63
63
  }
64
- .@{picker-prefix-cls}-cell-in-view.@{picker-prefix-cls}-cell-range-hover-end {
65
- &:hover {
66
- background-color: @picker-basic-cell-active-with-range-color;
64
+ .@{picker-prefix-cls}-cell-in-view {
65
+ &.@{picker-prefix-cls}-cell-in-range {
66
+ &.@{picker-prefix-cls}-cell-range-hover-end, &.@{picker-prefix-cls}-cell-range-hover-start {
67
+ &:hover {
68
+ background-color: @B2;
69
+ }
70
+ }
71
+ }
72
+
73
+ &.@{picker-prefix-cls}-cell-range-hover-end, &.@{picker-prefix-cls}-cell-range-hover-start {
74
+ &:hover {
75
+ background: @picker-basic-cell-active-with-range-color;
76
+ }
67
77
  }
68
78
  }
69
79
 
70
- .@{picker-prefix-cls}-cell-range-hover-start {
71
- &:hover {
72
- background-color: @picker-date-hover-range-color;
73
- border-radius: @R2;
80
+ .@{picker-prefix-cls}-cell-disabled {
81
+ &:not(:first-child) {
82
+ &::before {
83
+ left: -3*@P;
84
+ }
74
85
  }
75
86
  }
76
87
  }
@@ -248,7 +259,7 @@
248
259
  &:hover:not(&-in-view),
249
260
  &:hover:not(&-selected):not(&-range-start):not(&-range-end):not(&-range-hover-start):not(&-range-hover-end) {
250
261
  .@{cellClassName} {
251
- background: @B1;
262
+ background: @G10;
252
263
  border-radius: @R2;
253
264
  }
254
265
  }
@@ -459,7 +470,7 @@
459
470
  &:not(:first-child) {
460
471
  &::before {
461
472
  width: 3*@P;
462
- left: -3*@P;
473
+ left: -3*@P + 2;
463
474
  background: @G10;
464
475
  }
465
476
  }
@@ -518,7 +529,6 @@
518
529
 
519
530
  &-date-panel {
520
531
  .@{picker-prefix-cls}-content td:hover {
521
- background-color: @B1;
522
532
  border-radius: @R2;
523
533
 
524
534
  // &:not(.@{picker-prefix-cls}-cell-in-range) {
@@ -557,6 +567,14 @@
557
567
  width: 60*@P - 2*3*@P;
558
568
  }
559
569
  }
570
+
571
+ .@{picker-prefix-cls}-cell-in-view {
572
+ &.@{picker-prefix-cls}-cell-range-hover-end, &.@{picker-prefix-cls}-cell-range-hover-start {
573
+ &:hover {
574
+ background-color: @picker-basic-cell-active-with-range-color;
575
+ }
576
+ }
577
+ }
560
578
  }
561
579
 
562
580
  // ======================== Footer ========================
@@ -673,6 +691,10 @@
673
691
  .@{picker-prefix-cls}-month-panel {
674
692
  width: 186px;
675
693
  }
694
+
695
+ .@{picker-prefix-cls}-date-panel {
696
+ width: 234px;
697
+ }
676
698
  }
677
699
 
678
700
  // ====================== Week Panel ======================
@@ -58,19 +58,19 @@
58
58
  }
59
59
  .acud-dialogbox-sm {
60
60
  width: 520px;
61
- max-height: 240px;
61
+ max-height: 560px;
62
62
  }
63
63
  .acud-dialogbox-md {
64
64
  width: 800px;
65
- max-height: 400px;
65
+ max-height: 560px;
66
66
  }
67
67
  .acud-dialogbox-lg {
68
68
  width: 1120px;
69
- max-height: 480px;
69
+ max-height: 560px;
70
70
  }
71
71
  .acud-dialogbox-xl {
72
72
  width: 1200px;
73
- max-height: 480px;
73
+ max-height: 560px;
74
74
  }
75
75
  .acud-dialogbox-content {
76
76
  position: relative;
@@ -31,10 +31,14 @@ var DropdownButton = function DropdownButton(props) {
31
31
 
32
32
  var children = props.children,
33
33
  overlay = props.overlay,
34
- visible = props.visible,
35
34
  disabled = props.disabled,
35
+ trigger = props.trigger,
36
+ visible = props.visible,
36
37
  onVisibleChange = props.onVisibleChange,
37
- restProps = __rest(props, ["children", "overlay", "visible", "disabled", "onVisibleChange"]); // 菜单可见,需要将ICON旋转
38
+ overlayClassName = props.overlayClassName,
39
+ overlayStyle = props.overlayStyle,
40
+ getPopupContainer = props.getPopupContainer,
41
+ restProps = __rest(props, ["children", "overlay", "disabled", "trigger", "visible", "onVisibleChange", "overlayClassName", "overlayStyle", "getPopupContainer"]); // 菜单可见,需要将ICON旋转
38
42
 
39
43
 
40
44
  var _useState = useState(!!visible),
@@ -55,7 +59,12 @@ var DropdownButton = function DropdownButton(props) {
55
59
  }, restProps), children), /*#__PURE__*/React.createElement(Dropdown, {
56
60
  disabled: disabled,
57
61
  placement: "bottomRight",
62
+ trigger: trigger,
58
63
  overlay: overlay,
64
+ overlayClassName: overlayClassName,
65
+ overlayStyle: overlayStyle,
66
+ getPopupContainer: getPopupContainer,
67
+ visible: popupVisible,
59
68
  onVisibleChange: handleVisibleChange
60
69
  }, /*#__PURE__*/React.createElement(Button, _extends({
61
70
  disabled: disabled,
@@ -93,9 +93,10 @@
93
93
  margin-top: -8px;
94
94
  font-size: 12px;
95
95
  line-height: 16px;
96
+ transition: transform 0.48s;
96
97
  }
97
98
  .acud-dropdown-trigger-arrow-expand {
98
- transform: rotate(-180deg);
99
+ transform: rotate(180deg);
99
100
  }
100
101
  .acud-dropdown-trigger-arrow > svg {
101
102
  width: 16px;
@@ -220,6 +221,10 @@ li.acud-dropdown-menu-submenu-disabled:active,
220
221
  .acud-dropdown-menu-item-disabled:active {
221
222
  border-color: transparent;
222
223
  }
224
+ li.acud-dropdown-menu-submenu-active:hover,
225
+ .acud-dropdown-menu-item-active:hover {
226
+ background-color: #E6F0FF;
227
+ }
223
228
  .acud-dropdown-menu-submenu-title,
224
229
  .acud-dropdown-menu-item {
225
230
  padding-left: 12px;
@@ -72,9 +72,10 @@
72
72
  margin-top: -2 * @P;
73
73
  font-size: @T2;
74
74
  line-height: 4 * @P;
75
+ transition: transform .48s;
75
76
 
76
77
  &-expand {
77
- transform: rotate(-180deg);
78
+ transform: rotate(180deg);
78
79
  }
79
80
 
80
81
  & > svg {
@@ -105,6 +106,10 @@
105
106
  cursor: not-allowed;
106
107
  .basic-disabled-config(@dropdown-menu-tp, @dropdown-menu-p);
107
108
  }
109
+
110
+ &-active:hover {
111
+ background-color: @B1;
112
+ }
108
113
  }
109
114
 
110
115
  &-submenu-title,
@@ -0,0 +1,46 @@
1
+ import * as React from 'react';
2
+ export interface ModalFuncProps {
3
+ /** 对话框标题 */
4
+ title?: string;
5
+ /** 对话框内容 */
6
+ content?: React.ReactNode;
7
+ /** 点击确定回调 */
8
+ onOk?: (e: React.MouseEvent<HTMLElement>) => (void | Promise<any>);
9
+ /** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */
10
+ onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
11
+ afterClose?: () => void;
12
+ /** 弹框宽度 */
13
+ width?: number;
14
+ /** 弹框高度 */
15
+ height?: number;
16
+ /** 确认按钮文字 */
17
+ okText?: string;
18
+ /** 取消按钮文字 */
19
+ cancelText?: string;
20
+ /** 点击蒙层是否允许关闭 */
21
+ maskClosable?: boolean;
22
+ /** 是否强制渲染 DialogBox */
23
+ forceRender?: boolean;
24
+ /** 关闭时是否销毁 DialogBox 里的子元素 */
25
+ destroyOnClose?: boolean;
26
+ style?: React.CSSProperties;
27
+ className?: string;
28
+ /** 指定DialogBox挂载的html节点 */
29
+ getContainer?: string | HTMLElement | (() => HTMLElement) | false | null;
30
+ /** 设置 DialogBox 的 z-index */
31
+ zIndex?: number;
32
+ /** 是否支持键盘 esc 关闭 */
33
+ keyboard?: boolean;
34
+ /** 自定义关闭图标 */
35
+ closeIcon?: React.ReactNode;
36
+ }
37
+ export interface DialogBoxProps extends ModalFuncProps {
38
+ /** 是否有取消按钮 */
39
+ cancelBtn?: boolean;
40
+ onClose?: (...args: any[]) => void;
41
+ visible?: boolean;
42
+ type: 'confirm' | 'success' | 'info' | 'error' | 'warning';
43
+ confirmLoading?: boolean;
44
+ }
45
+ declare const DialogBox: React.FC<DialogBoxProps>;
46
+ export default DialogBox;
@@ -0,0 +1,152 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+
4
+ var __rest = this && this.__rest || function (s, e) {
5
+ var t = {};
6
+
7
+ for (var p in s) {
8
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
9
+ }
10
+
11
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
12
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
13
+ }
14
+ return t;
15
+ };
16
+
17
+ import * as React from 'react';
18
+ import FilledError from "acud-icon/es/icons/FilledError";
19
+ import OutlinedClose from "acud-icon/es/icons/OutlinedClose";
20
+ import FilledSuccess from "acud-icon/es/icons/FilledSuccess";
21
+ import FilledWarn from "acud-icon/es/icons/FilledWarn";
22
+ import FilledInfo from "acud-icon/es/icons/FilledInfo";
23
+ import classNames from 'classnames';
24
+ import { ConfigContext } from '../config-provider';
25
+ import Button from '../button';
26
+ import Modal from './Modal';
27
+ var DialogType = {
28
+ success: {
29
+ className: 'sucess',
30
+ icon: /*#__PURE__*/React.createElement(FilledSuccess, {
31
+ color: "@S6"
32
+ })
33
+ },
34
+ warning: {
35
+ className: 'warning',
36
+ icon: /*#__PURE__*/React.createElement(FilledWarn, {
37
+ color: "@W6"
38
+ })
39
+ },
40
+ confirm: {
41
+ className: 'confirm',
42
+ icon: /*#__PURE__*/React.createElement(FilledWarn, {
43
+ color: "@W6"
44
+ })
45
+ },
46
+ info: {
47
+ className: 'info',
48
+ icon: /*#__PURE__*/React.createElement(FilledInfo, {
49
+ color: "@B6"
50
+ })
51
+ },
52
+ error: {
53
+ className: 'error',
54
+ icon: /*#__PURE__*/React.createElement(FilledError, {
55
+ color: "@E6"
56
+ })
57
+ }
58
+ };
59
+
60
+ var DialogBox = function DialogBox(props) {
61
+ var _React$useContext = React.useContext(ConfigContext),
62
+ getPopupContainer = _React$useContext.getPopupContainer,
63
+ getPrefixCls = _React$useContext.getPrefixCls;
64
+
65
+ var prefixCls = getPrefixCls('modal-dialogbox');
66
+ var closeIconToRender = /*#__PURE__*/React.createElement("span", {
67
+ className: "".concat(prefixCls, "-close-x")
68
+ }, /*#__PURE__*/React.createElement(OutlinedClose, {
69
+ className: "".concat(prefixCls, "-close-icon")
70
+ }));
71
+
72
+ var visible = props.visible,
73
+ className = props.className,
74
+ title = props.title,
75
+ content = props.content,
76
+ type = props.type,
77
+ cancelBtn = props.cancelBtn,
78
+ okText = props.okText,
79
+ confirmLoading = props.confirmLoading,
80
+ onOk = props.onOk,
81
+ onClose = props.onClose,
82
+ restProps = __rest(props, ["visible", "className", "title", "content", "type", "cancelBtn", "okText", "confirmLoading", "onOk", "onClose"]);
83
+
84
+ var _React$useState = React.useState(false),
85
+ _React$useState2 = _slicedToArray(_React$useState, 2),
86
+ loading = _React$useState2[0],
87
+ toggleLoading = _React$useState2[1];
88
+
89
+ var okBtnLoading = React.useMemo(function () {
90
+ if (typeof confirmLoading === 'boolean') {
91
+ return confirmLoading;
92
+ }
93
+
94
+ return loading;
95
+ }, [confirmLoading, loading]);
96
+ var handleOk = React.useCallback(function (e) {
97
+ var okResult = onOk === null || onOk === void 0 ? void 0 : onOk(e);
98
+
99
+ if (okResult && typeof okResult.then === 'function') {
100
+ toggleLoading(true);
101
+ okResult.then(function () {
102
+ console.log('then: close');
103
+ toggleLoading(false);
104
+ onClose === null || onClose === void 0 ? void 0 : onClose.apply(void 0, arguments);
105
+ }, function (e) {
106
+ console.error(e);
107
+ toggleLoading(false);
108
+ });
109
+ } else {
110
+ onClose === null || onClose === void 0 ? void 0 : onClose(e);
111
+ }
112
+ }, [onOk, onClose]);
113
+ var handleCancel = React.useCallback(function () {
114
+ onClose === null || onClose === void 0 ? void 0 : onClose({
115
+ triggerCancel: true
116
+ });
117
+ }, [onClose]);
118
+ var titleNode = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
119
+ className: "".concat(prefixCls, "-icon")
120
+ }, DialogType[type].icon), /*#__PURE__*/React.createElement("div", {
121
+ className: "".concat(prefixCls, "-title")
122
+ }, title));
123
+ var footer = React.useMemo(function () {
124
+ if (!cancelBtn) {
125
+ return /*#__PURE__*/React.createElement(Button, {
126
+ type: "primary",
127
+ loading: okBtnLoading,
128
+ onClick: handleOk
129
+ }, okText);
130
+ }
131
+ }, [okText, cancelBtn, okBtnLoading, handleOk]);
132
+ return /*#__PURE__*/React.createElement(Modal, _extends({}, restProps, {
133
+ confirmLoading: okBtnLoading,
134
+ footer: footer,
135
+ title: titleNode,
136
+ className: classNames(className, "".concat(prefixCls), "".concat(prefixCls, "-").concat(type)),
137
+ getContainer: getPopupContainer,
138
+ visible: visible,
139
+ closeIcon: closeIconToRender,
140
+ onCancel: handleCancel,
141
+ onOk: handleOk,
142
+ okText: okText
143
+ }), /*#__PURE__*/React.createElement("div", {
144
+ className: "".concat(prefixCls, "-content")
145
+ }, content));
146
+ };
147
+
148
+ DialogBox.defaultProps = {
149
+ visible: true,
150
+ type: 'info'
151
+ };
152
+ export default DialogBox;
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { ButtonProps } from '../button';
2
3
  declare enum SizeType {
3
4
  'small' = "sm",
4
5
  'normal' = "md",
@@ -14,8 +15,12 @@ export interface ModalProps {
14
15
  confirmLoading?: boolean;
15
16
  /** 弹框标题 */
16
17
  title?: React.ReactNode;
18
+ /** 确认按钮 props */
19
+ okButtonProps?: ButtonProps;
17
20
  /** 点击确定回调 */
18
21
  onOk?: (e: React.MouseEvent<HTMLElement>) => void;
22
+ /** 取消按钮 props */
23
+ cancelButtonProps?: ButtonProps;
19
24
  /** 点击模态框右上角叉、取消按钮、Props.maskClosable 值为 true 时的遮罩层或键盘按下 Esc 时的回调 */
20
25
  onCancel?: (e: React.MouseEvent<HTMLElement>) => void;
21
26
  afterClose?: () => void;
package/es/modal/Modal.js CHANGED
@@ -63,15 +63,17 @@ var Modal = function Modal(props) {
63
63
  var renderFooter = function renderFooter() {
64
64
  var okText = props.okText,
65
65
  cancelText = props.cancelText,
66
- confirmLoading = props.confirmLoading;
67
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
66
+ confirmLoading = props.confirmLoading,
67
+ okButtonProps = props.okButtonProps,
68
+ cancelButtonProps = props.cancelButtonProps;
69
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
68
70
  onClick: handleCancel,
69
71
  type: "default"
70
- }, cancelText || '取消'), /*#__PURE__*/React.createElement(Button, {
72
+ }, cancelButtonProps), cancelText || '取消'), /*#__PURE__*/React.createElement(Button, _extends({
71
73
  onClick: handleOk,
72
74
  loading: confirmLoading,
73
75
  type: "primary"
74
- }, okText || '确定'));
76
+ }, okButtonProps), okText || '确定'));
75
77
  };
76
78
 
77
79
  var visible = props.visible,
@@ -0,0 +1,17 @@
1
+ import { ModalFuncProps } from './DialogBox';
2
+ export declare function destroyAll(): void;
3
+ export declare function confirm(config: ModalFuncProps): {
4
+ destroy: (...args: any[]) => void;
5
+ };
6
+ export declare function success(config: ModalFuncProps): {
7
+ destroy: (...args: any[]) => void;
8
+ };
9
+ export declare function info(config: ModalFuncProps): {
10
+ destroy: (...args: any[]) => void;
11
+ };
12
+ export declare function warning(config: ModalFuncProps): {
13
+ destroy: (...args: any[]) => void;
14
+ };
15
+ export declare function error(config: ModalFuncProps): {
16
+ destroy: (...args: any[]) => void;
17
+ };
@@ -0,0 +1,123 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React from 'react';
3
+ import { render as reactRender, unmountComponentAtNode } from 'react-dom';
4
+ import DialogBox from './DialogBox';
5
+ var destroyFns = [];
6
+
7
+ function renderDialogBox(config) {
8
+ var currentConfig = _extends(_extends({}, config), {
9
+ visible: true,
10
+ onClose: close
11
+ });
12
+
13
+ var container = document.createDocumentFragment();
14
+
15
+ function render(dialogConfig) {
16
+ setTimeout(function () {
17
+ reactRender( /*#__PURE__*/React.createElement(DialogBox, dialogConfig), container);
18
+ });
19
+ }
20
+
21
+ function destroy() {
22
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
+ args[_key] = arguments[_key];
24
+ }
25
+
26
+ var triggerCancel = args.some(function (param) {
27
+ return param && param.triggerCancel;
28
+ });
29
+
30
+ if (config.onCancel && triggerCancel) {
31
+ // @ts-ignore
32
+ config.onCancel.apply(config, args);
33
+ }
34
+
35
+ for (var i = 0; i < destroyFns.length; i++) {
36
+ var fn = destroyFns[i];
37
+
38
+ if (fn === close) {
39
+ destroyFns.splice(i, 1);
40
+ break;
41
+ }
42
+ }
43
+
44
+ unmountComponentAtNode(container);
45
+ }
46
+
47
+ function close() {
48
+ var _this = this;
49
+
50
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
51
+ args[_key2] = arguments[_key2];
52
+ }
53
+
54
+ render(_extends(_extends({}, currentConfig), {
55
+ visible: false,
56
+ afterClose: function afterClose() {
57
+ if (typeof config.afterClose === 'function') {
58
+ config.afterClose();
59
+ }
60
+
61
+ destroy.apply(_this, args);
62
+ }
63
+ }));
64
+ }
65
+
66
+ render(currentConfig);
67
+ destroyFns.push(close);
68
+ return {
69
+ destroy: close
70
+ };
71
+ }
72
+
73
+ export function destroyAll() {
74
+ while (destroyFns.length) {
75
+ var close = destroyFns.pop();
76
+
77
+ if (close) {
78
+ close();
79
+ }
80
+ }
81
+ }
82
+ export function confirm(config) {
83
+ return renderDialogBox(_extends(_extends({}, config), {
84
+ type: 'confirm',
85
+ cancelBtn: true
86
+ }));
87
+ }
88
+ export function success(config) {
89
+ var _a;
90
+
91
+ return renderDialogBox(_extends(_extends({}, config), {
92
+ type: 'success',
93
+ cancelBtn: false,
94
+ okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '关闭'
95
+ }));
96
+ }
97
+ export function info(config) {
98
+ var _a;
99
+
100
+ return renderDialogBox(_extends(_extends({}, config), {
101
+ type: 'info',
102
+ cancelBtn: false,
103
+ okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '确定'
104
+ }));
105
+ }
106
+ export function warning(config) {
107
+ var _a;
108
+
109
+ return renderDialogBox(_extends(_extends({}, config), {
110
+ type: 'warning',
111
+ cancelBtn: false,
112
+ okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '关闭'
113
+ }));
114
+ }
115
+ export function error(config) {
116
+ var _a;
117
+
118
+ return renderDialogBox(_extends(_extends({}, config), {
119
+ type: 'error',
120
+ cancelBtn: false,
121
+ okText: (_a = config.okText) !== null && _a !== void 0 ? _a : '重试'
122
+ }));
123
+ }
@@ -1,2 +1,11 @@
1
- import Modal from './Modal';
2
- export default Modal;
1
+ /// <reference types="react" />
2
+ import { confirm, success, info, error, warning, destroyAll } from './dialog';
3
+ declare const _default: import("react").FC<import("./Modal").ModalProps> & {
4
+ confirm: typeof confirm;
5
+ success: typeof success;
6
+ info: typeof info;
7
+ error: typeof error;
8
+ warning: typeof warning;
9
+ destroyAll: typeof destroyAll;
10
+ };
11
+ export default _default;
package/es/modal/index.js CHANGED
@@ -1,2 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import Modal from './Modal';
2
- export default Modal;
3
+ import { confirm, success, info, error, warning, destroyAll } from './dialog';
4
+ export default _extends(Modal, {
5
+ confirm: confirm,
6
+ success: success,
7
+ info: info,
8
+ error: error,
9
+ warning: warning,
10
+ destroyAll: destroyAll
11
+ });