@para-ui/core 4.0.54 → 4.0.55

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 (64) hide show
  1. package/Argv/index.js +5 -4
  2. package/AutoButton/index.d.ts +3 -0
  3. package/AutoButton/index.js +19 -6
  4. package/Button/SplitButton.d.ts +3 -0
  5. package/Button/index.d.ts +4 -0
  6. package/Button/index.js +17 -352
  7. package/ButtonGroup/index.js +5 -1
  8. package/ComboSelect/index.js +5 -6
  9. package/CycleSelector/index.js +3 -1
  10. package/DatePicker/index.js +6 -3
  11. package/Descriptions/index.js +5 -1
  12. package/Desktop/index.js +4 -1
  13. package/Drawer/index.js +5 -1
  14. package/DynamicMultiBox/index.js +4 -5
  15. package/Form/index.js +5 -6
  16. package/FormItem/index.js +5 -6
  17. package/FunctionModal/index.js +7 -6
  18. package/InputCode/index.js +4 -1
  19. package/Modal/index.js +2 -1
  20. package/OperateBtn/index.js +5 -6
  21. package/PageHeader/index.js +5 -1
  22. package/Pagination/index.js +4 -1
  23. package/PopConfirm/index.js +14 -213
  24. package/QuickReply/index.js +6 -7
  25. package/README.md +7 -0
  26. package/Switch/index.js +2 -2
  27. package/Table/index.js +4 -5
  28. package/Tabs/index.js +6 -7
  29. package/TimePicker/index.js +5 -2
  30. package/ToggleButton/index.js +5 -1
  31. package/Transfer/index.js +5 -2
  32. package/Upload/index.js +3 -4
  33. package/_verture/{index-43c653bb.js → index-0e866545.js} +1 -1
  34. package/_verture/index-7e60b72c.js +593 -0
  35. package/index.js +8 -9
  36. package/package.json +1 -1
  37. package/umd/Argv.js +4 -4
  38. package/umd/AutoButton.js +7 -7
  39. package/umd/Button.js +7 -7
  40. package/umd/ButtonGroup.js +7 -7
  41. package/umd/ComboSelect.js +1 -1
  42. package/umd/CycleSelector.js +5 -5
  43. package/umd/DatePicker.js +5 -5
  44. package/umd/Descriptions.js +7 -7
  45. package/umd/Desktop.js +5 -5
  46. package/umd/Drawer.js +7 -7
  47. package/umd/DynamicMultiBox.js +1 -1
  48. package/umd/Form.js +1 -1
  49. package/umd/FormItem.js +1 -1
  50. package/umd/FunctionModal.js +7 -7
  51. package/umd/InputCode.js +6 -6
  52. package/umd/Modal.js +5 -5
  53. package/umd/OperateBtn.js +6 -6
  54. package/umd/PageHeader.js +7 -7
  55. package/umd/Pagination.js +5 -5
  56. package/umd/PopConfirm.js +2 -2
  57. package/umd/QuickReply.js +1 -1
  58. package/umd/Table.js +1 -1
  59. package/umd/Tabs.js +1 -1
  60. package/umd/TimePicker.js +5 -5
  61. package/umd/ToggleButton.js +7 -7
  62. package/umd/Transfer.js +8 -8
  63. package/umd/Upload.js +1 -1
  64. /package/_verture/{modalContext-6ac2e323.js → modalContext-3ed7e7f6.js} +0 -0
@@ -0,0 +1,593 @@
1
+ import { _ as __rest } from './tslib.es6-55ed4bd2.js';
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useRef, useState, useMemo, useEffect } from 'react';
4
+ import clsx from 'clsx';
5
+ import LoadingOutlined from '@para-ui/icons/LoadingF';
6
+ import { Tooltip } from '../Tooltip/index.js';
7
+ import Down from '@para-ui/icons/Down';
8
+ import { $ as $prefixCls } from './constant-5317fc89.js';
9
+ import { s as styleInject } from './style-inject.es-300983ab.js';
10
+ import { D as Dropdown } from './index-bde7aabe.js';
11
+ import { u as useFormatMessage } from './useFormatMessage-1fc7c957.js';
12
+ import AutoTips from '../AutoTips/index.js';
13
+ import CheckCircleF from '@para-ui/icons/CheckCircleF';
14
+ import InfoOutlined from '@para-ui/icons/WarningCircle';
15
+ import CloseCircleF from '@para-ui/icons/CloseCircleF';
16
+ import WarningCircleF from '@para-ui/icons/WarningCircleF';
17
+ import { u as usePopupContainer } from './usePopupContainer-635f66f4.js';
18
+
19
+ var en$1 = {
20
+ moreActions: 'More actions'
21
+ };
22
+
23
+ var zh$1 = {
24
+ moreActions: '更多操作'
25
+ };
26
+
27
+ var localeJson$1 = {
28
+ zh: zh$1,
29
+ en: en$1
30
+ };
31
+
32
+ var en = {
33
+ cancel: 'Cancel',
34
+ ok: 'Ok'
35
+ };
36
+
37
+ var zh = {
38
+ cancel: '取 消',
39
+ ok: '确 认'
40
+ };
41
+
42
+ var localeJson = {
43
+ zh,
44
+ en
45
+ };
46
+
47
+ var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/2 下午1:44\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-popconfirm.paraui-v4-tooltip {\n position: absolute;\n width: 440px;\n padding: 0;\n font-size: 14px;\n color: initial;\n background-color: rgb(255, 255, 255);\n box-shadow: 1px 1px 10px 2px rgba(212, 218, 227, 0.4);\n border-radius: 8px;\n border: 1px solid rgba(212, 218, 227, 0.4);\n}\n.paraui-v4-popconfirm.component-tooltip-hidden.paraui-v4-tooltip {\n border: none;\n}\n.paraui-v4-popconfirm.paraui-v4-tooltip .component-tooltip-inner {\n padding: 0;\n color: initial;\n background-color: transparent;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper {\n padding: 16px;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message {\n position: relative;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-icon {\n position: absolute;\n top: 1px;\n color: rgb(255, 147, 38);\n line-height: 0;\n font-size: 18px;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-icon svg {\n color: inherit;\n font-size: inherit;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-body {\n padding-left: 24px;\n line-height: 20px;\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-title {\n font-weight: 600;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-content {\n font-weight: 400;\n margin-top: 8px;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-content.without-title {\n margin-top: 0;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-description {\n margin-top: 4px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-message-description.without-title-or-content {\n margin-top: 0;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-btns {\n margin-top: 12px;\n text-align: right;\n}\n.paraui-v4-popconfirm .popconfirm-wrapper .popconfirm-btns > button + button {\n margin-left: 12px;\n}\n.paraui-v4-popconfirm .paraui-v4-popconfirm-btn {\n min-width: 54px;\n}";
48
+ styleInject(css_248z$1);
49
+
50
+ //图标
51
+ const iconMapping = {
52
+ success: jsx(CheckCircleF, {}),
53
+ warning: jsx(WarningCircleF, {}),
54
+ error: jsx(CloseCircleF, {}),
55
+ info: jsx(InfoOutlined, {})
56
+ };
57
+ //popConfirm
58
+ const PopConfirm = props => {
59
+ const {
60
+ trigger = 'click',
61
+ type = 'warning',
62
+ title,
63
+ content,
64
+ description,
65
+ icon,
66
+ okText,
67
+ cancelText,
68
+ onOk,
69
+ onCancel,
70
+ okButtonProps,
71
+ cancelButtonProps,
72
+ placement = 'top-start',
73
+ className,
74
+ overlayClassName,
75
+ style,
76
+ children,
77
+ open = false,
78
+ controllable = false,
79
+ showCancel = true,
80
+ bubble = true,
81
+ okButtonDanger,
82
+ countdown,
83
+ countdownTime = 5,
84
+ actions,
85
+ onClose,
86
+ onCountdownFinish,
87
+ getPopupContainer: customizeContainer
88
+ } = props,
89
+ restProps = __rest(props, ["trigger", "type", "title", "content", "description", "icon", "okText", "cancelText", "onOk", "onCancel", "okButtonProps", "cancelButtonProps", "placement", "className", "overlayClassName", "style", "children", "open", "controllable", "showCancel", "bubble", "okButtonDanger", "countdown", "countdownTime", "actions", "onClose", "onCountdownFinish", "getPopupContainer"]);
90
+ const intl = useFormatMessage('PopConfirm', localeJson);
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ const wrapRef = useRef();
93
+ const getPopupContainer = usePopupContainer(wrapRef, customizeContainer);
94
+ //打开
95
+ const [inOpen, setInOpen] = useState(false);
96
+ const countdownTimer = useRef();
97
+ const [inCountdownTime, setInCountdownTime] = useState(countdownTime);
98
+ const isCountting = useMemo(() => countdown && inCountdownTime >= 1, [countdown, inCountdownTime]);
99
+ useEffect(() => {
100
+ if (countdown) {
101
+ if (inOpen) {
102
+ setInCountdownTime(countdownTime);
103
+ countdownTimer.current = setInterval(() => {
104
+ setInCountdownTime(pre => {
105
+ if (pre <= 1) {
106
+ onCountdownFinish === null || onCountdownFinish === void 0 ? void 0 : onCountdownFinish();
107
+ clearInterval(countdownTimer.current);
108
+ return 0;
109
+ }
110
+ return pre - 1;
111
+ });
112
+ }, 1000);
113
+ } else {
114
+ clearInterval(countdownTimer.current);
115
+ }
116
+ }
117
+ return () => {
118
+ clearInterval(countdownTimer.current);
119
+ };
120
+ }, [inOpen, countdown]);
121
+ //取消
122
+ const handleCancel = () => {
123
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
124
+ handleClose();
125
+ };
126
+ //确认
127
+ const handleOk = () => {
128
+ onOk === null || onOk === void 0 ? void 0 : onOk();
129
+ handleClose();
130
+ };
131
+ //关闭
132
+ const handleClose = () => {
133
+ if (!controllable) {
134
+ setInOpen(false);
135
+ onClose === null || onClose === void 0 ? void 0 : onClose();
136
+ }
137
+ };
138
+ //tooltip vis
139
+ const onVisibleChange = vis => {
140
+ if (!controllable) {
141
+ setInOpen(vis);
142
+ if (!vis) onClose === null || onClose === void 0 ? void 0 : onClose();
143
+ } else {
144
+ if (open) onClose === null || onClose === void 0 ? void 0 : onClose();
145
+ }
146
+ };
147
+ useEffect(() => {
148
+ controllable && setInOpen(open);
149
+ }, [open]);
150
+ //渲染内容
151
+ const renderOverlay = () => {
152
+ const btns = jsxs(Fragment, {
153
+ children: [showCancel && jsx(Button, Object.assign({
154
+ className: "".concat($prefixCls, "-popconfirm-btn"),
155
+ onClick: handleCancel,
156
+ variant: 'outlined',
157
+ size: 'small'
158
+ }, cancelButtonProps, {
159
+ children: cancelText !== null && cancelText !== void 0 ? cancelText : intl({
160
+ id: 'cancel'
161
+ })
162
+ })), jsx(Button, Object.assign({
163
+ className: "".concat($prefixCls, "-popconfirm-btn"),
164
+ onClick: handleOk,
165
+ variant: 'contained',
166
+ size: 'small'
167
+ }, okButtonProps, {
168
+ danger: okButtonDanger !== null && okButtonDanger !== void 0 ? okButtonDanger : okButtonProps === null || okButtonProps === void 0 ? void 0 : okButtonProps.danger,
169
+ disabled: isCountting ? true : okButtonProps === null || okButtonProps === void 0 ? void 0 : okButtonProps.disabled
170
+ }, {
171
+ children: isCountting ? "".concat(inCountdownTime, "s") : okText !== null && okText !== void 0 ? okText : intl({
172
+ id: 'ok'
173
+ })
174
+ }))]
175
+ });
176
+ return jsxs("div", Object.assign({
177
+ className: clsx('popconfirm-wrapper'),
178
+ style: style,
179
+ onClick: evt => {
180
+ if (!bubble) evt.stopPropagation();
181
+ }
182
+ }, {
183
+ children: [jsxs("div", Object.assign({
184
+ className: 'popconfirm-message'
185
+ }, {
186
+ children: [jsx("span", Object.assign({
187
+ className: 'popconfirm-message-icon'
188
+ }, {
189
+ children: icon || iconMapping[type]
190
+ })), jsxs("div", Object.assign({
191
+ className: 'popconfirm-message-body'
192
+ }, {
193
+ children: [title && jsx("div", Object.assign({
194
+ className: "popconfirm-message-title"
195
+ }, {
196
+ children: title
197
+ })), content && jsx("div", Object.assign({
198
+ className: clsx('popconfirm-message-content', title ? '' : 'without-title')
199
+ }, {
200
+ children: content
201
+ })), description && jsx("div", Object.assign({
202
+ className: clsx('popconfirm-message-description', title || content ? '' : 'without-title-or-content')
203
+ }, {
204
+ children: description
205
+ }))]
206
+ }))]
207
+ })), jsx("div", Object.assign({
208
+ className: 'popconfirm-btns'
209
+ }, {
210
+ children: actions !== null && actions !== void 0 ? actions : btns
211
+ }))]
212
+ }));
213
+ };
214
+ return jsx(Tooltip, Object.assign({}, restProps, {
215
+ ref: wrapRef,
216
+ trigger: trigger,
217
+ open: inOpen,
218
+ arrow: false,
219
+ placement: placement,
220
+ title: renderOverlay(),
221
+ onVisibleChange: onVisibleChange,
222
+ overlayClassName: clsx("".concat($prefixCls, "-popconfirm"), overlayClassName, className),
223
+ getPopupContainer: getPopupContainer
224
+ }, {
225
+ children: children
226
+ }));
227
+ };
228
+
229
+ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/10/21 下午5:16\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n@keyframes buttonLoadingSpin {\n 0% {\n transform: rotate(0);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.paraui-v4-button {\n border: 0;\n cursor: pointer;\n display: inline-flex;\n outline: 0;\n position: relative;\n align-items: center;\n user-select: none;\n vertical-align: middle;\n justify-content: center;\n text-decoration: none;\n background-color: transparent;\n appearance: none;\n -webkit-tap-highlight-color: transparent;\n padding: 0 10px;\n line-height: 1.5715;\n border-radius: 4px;\n font-family: -apple-system, BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;\n font-size: 14px;\n font-weight: 400;\n white-space: nowrap;\n color: rgb(255, 255, 255);\n box-sizing: border-box;\n letter-spacing: 0.02857em;\n transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.paraui-v4-button .button-label {\n width: 100%;\n display: inherit;\n align-items: inherit;\n justify-content: inherit;\n}\n.paraui-v4-button .button-icon {\n display: inherit;\n margin-right: 4px;\n}\n.paraui-v4-button .button-icon svg {\n color: inherit;\n font-weight: 500;\n}\n.paraui-v4-button .button-icon-end {\n margin-right: 0;\n margin-left: 4px;\n}\n.paraui-v4-button .button-icon-loading {\n animation: buttonLoadingSpin 1s infinite linear;\n}\n.paraui-v4-button-loading {\n pointer-events: none;\n}\n.paraui-v4-button-contained {\n color: rgb(255, 255, 255);\n background-color: rgb(46, 101, 230);\n border: 1px solid rgb(46, 101, 230);\n}\n.paraui-v4-button-contained:hover {\n background-color: rgb(87, 131, 235);\n border: 1px solid rgba(255, 255, 255, 0);\n}\n.paraui-v4-button-contained.paraui-v4-button-link-disabled {\n color: rgb(29, 33, 38);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-button-contained.paraui-v4-button-link-disabled:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-contained[disabled] {\n color: rgb(92, 101, 115);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-button-contained[disabled]:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-contained.paraui-v4-button-dangerous {\n background-color: rgb(244, 66, 66);\n border: 1px solid rgb(244, 66, 66);\n}\n.paraui-v4-button-contained.paraui-v4-button-dangerous:hover {\n background-color: rgb(246, 103, 103);\n border: 1px solid rgba(255, 255, 255, 0);\n}\n.paraui-v4-button-outlined {\n color: rgb(29, 33, 38);\n background-color: rgb(255, 255, 255);\n border: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-button-outlined:hover {\n color: rgb(46, 101, 230);\n border-color: rgb(87, 131, 235);\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-button-outlined.paraui-v4-button-link-disabled {\n color: rgb(29, 33, 38);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-button-outlined.paraui-v4-button-link-disabled:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-outlined[disabled] {\n color: rgb(92, 101, 115);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-button-outlined[disabled]:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-outlined.paraui-v4-button-dangerous {\n color: rgb(244, 66, 66);\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-button-outlined.paraui-v4-button-dangerous:hover {\n color: rgb(244, 66, 66);\n border-color: rgb(246, 103, 103);\n}\n.paraui-v4-button-text {\n color: rgb(46, 101, 230);\n background-color: transparent;\n border: none;\n padding: unset;\n margin: 0 10px;\n}\n.paraui-v4-button-text:hover {\n color: rgb(87, 131, 235);\n background-color: transparent;\n}\n.paraui-v4-button-text.paraui-v4-button-link-disabled {\n color: rgb(29, 33, 38);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-button-text.paraui-v4-button-link-disabled:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-text[disabled] {\n color: rgb(92, 101, 115);\n background-color: transparent;\n border: none;\n cursor: not-allowed;\n}\n.paraui-v4-button-text[disabled]:hover {\n background-color: transparent;\n}\n.paraui-v4-button-text.paraui-v4-button-dangerous {\n color: rgb(244, 66, 66);\n}\n.paraui-v4-button-text.paraui-v4-button-dangerous:hover {\n color: rgb(246, 103, 103);\n}\n.paraui-v4-button-large {\n height: 32px;\n}\n.paraui-v4-button-medium {\n height: 28px;\n}\n.paraui-v4-button-small {\n height: 28px;\n}\n.paraui-v4-button--disabled {\n display: inline-block;\n cursor: not-allowed;\n}\n.paraui-v4-button--disabled button {\n pointer-events: none;\n}\n\n.paraui-v4-icon-button {\n flex: 0 0 auto;\n overflow: visible;\n text-align: center;\n transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n padding: 0;\n border-radius: 4px;\n}\n.paraui-v4-icon-button-loading {\n pointer-events: none;\n}\n.paraui-v4-icon-button-loading .button-loading-icon {\n display: inline-flex;\n animation: buttonLoadingSpin 1s infinite linear;\n}\n.paraui-v4-icon-button svg {\n color: inherit;\n font-size: 16px;\n}\n.paraui-v4-icon-button-contained {\n color: rgb(255, 255, 255);\n background-color: rgb(46, 101, 230);\n}\n.paraui-v4-icon-button-contained:hover {\n background-color: rgb(87, 131, 235);\n box-shadow: none;\n}\n.paraui-v4-icon-button-contained.paraui-v4-button-link-disabled {\n color: rgb(29, 33, 38);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-icon-button-contained.paraui-v4-button-link-disabled:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-icon-button-contained[disabled] {\n color: rgb(92, 101, 115);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-icon-button-contained[disabled]:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-icon-button-contained.paraui-v4-icon-button-dangerous {\n background-color: rgb(244, 66, 66);\n}\n.paraui-v4-icon-button-contained.paraui-v4-icon-button-dangerous:hover {\n background-color: rgb(246, 103, 103);\n}\n.paraui-v4-icon-button-outlined {\n color: rgb(29, 33, 38);\n background-color: rgb(255, 255, 255);\n border: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-icon-button-outlined:hover {\n color: rgb(46, 101, 230);\n border-color: rgb(87, 131, 235);\n box-shadow: none;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-icon-button-outlined.paraui-v4-button-link-disabled {\n color: rgb(29, 33, 38);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-icon-button-outlined.paraui-v4-button-link-disabled:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-icon-button-outlined[disabled] {\n color: rgb(92, 101, 115);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-icon-button-outlined[disabled]:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-icon-button-outlined.paraui-v4-icon-button-dangerous {\n color: rgb(244, 66, 66);\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-icon-button-outlined.paraui-v4-icon-button-dangerous:hover {\n color: rgb(244, 66, 66);\n border-color: rgb(246, 103, 103);\n}\n.paraui-v4-icon-button-text {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-icon-button-text:hover {\n color: rgb(87, 131, 235);\n background-color: transparent;\n}\n.paraui-v4-icon-button-text.paraui-v4-button-link-disabled {\n pointer-events: none;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-icon-button-text.paraui-v4-button-link-disabled:hover {\n background-color: transparent;\n}\n.paraui-v4-icon-button-text[disabled] {\n color: rgb(161, 168, 179);\n pointer-events: none;\n}\n.paraui-v4-icon-button-text[disabled]:hover {\n background-color: transparent;\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-dangerous {\n color: rgb(244, 66, 66);\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-dangerous:hover {\n color: rgb(246, 103, 103);\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-large {\n width: auto;\n height: auto;\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-large svg {\n font-size: 24px;\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-medium {\n width: auto;\n height: auto;\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-medium svg {\n font-size: 20px;\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-small {\n width: auto;\n height: auto;\n}\n.paraui-v4-icon-button-text.paraui-v4-icon-button-small svg {\n font-size: 20px;\n}\n.paraui-v4-icon-button-activate {\n color: rgb(29, 33, 38);\n background-color: rgb(255, 255, 255);\n border: 1px solid rgb(212, 218, 227);\n color: rgb(46, 101, 230);\n border-color: rgb(46, 101, 230);\n box-shadow: none;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-icon-button-activate.paraui-v4-button-link-disabled {\n color: rgb(29, 33, 38);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-icon-button-activate.paraui-v4-button-link-disabled:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-icon-button-activate[disabled] {\n color: rgb(92, 101, 115);\n background-color: rgb(247, 248, 250);\n border: 1px solid rgb(212, 218, 227);\n cursor: not-allowed;\n}\n.paraui-v4-icon-button-activate[disabled]:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-icon-button-activate.paraui-v4-icon-button-dangerous {\n color: rgb(244, 66, 66);\n border-color: rgb(244, 66, 66);\n}\n.paraui-v4-icon-button-activate.paraui-v4-icon-button-dangerous:hover {\n color: rgb(244, 66, 66);\n border-color: rgb(246, 103, 103);\n}\n.paraui-v4-icon-button-large {\n width: 32px;\n height: 32px;\n}\n.paraui-v4-icon-button-medium {\n width: 28px;\n height: 28px;\n}\n.paraui-v4-icon-button-small {\n width: 28px;\n height: 28px;\n}\n\n.paraui-v4-button-split {\n display: inline-block;\n}\n.paraui-v4-button-split .paraui-v4-button-split--active {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-button-split-list {\n padding: 4px 0;\n border-radius: 4px;\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-button-split-list ul .split-li {\n padding: 5px 10px;\n color: rgb(29, 33, 38);\n font-size: 14px;\n line-height: 20px;\n cursor: pointer;\n transition: background-color 0.3s, color 0.3s;\n white-space: nowrap;\n}\n.paraui-v4-button-split-list ul .split-li:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-split-list ul .split-li.split-li--active {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-button-split-list ul .split-li.split-li--active:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-split-list ul .split-li.split-li--hover:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-button-split-list ul .split-li.split-li--disabled {\n color: rgb(161, 168, 179);\n cursor: not-allowed;\n}\n.paraui-v4-button-split-list ul .split-li.split-li--disabled:hover {\n background-color: rgb(255, 255, 255);\n}\n.paraui-v4-button-split-list ul .split-li-group:not(:first-child) {\n position: relative;\n margin-top: 8px;\n}\n.paraui-v4-button-split-list ul .split-li-group:not(:first-child):before {\n content: \"\";\n position: absolute;\n top: -4px;\n left: 8px;\n right: 8px;\n border-top: 1px solid rgb(234, 236, 241);\n}";
230
+ styleInject(css_248z);
231
+
232
+ //分体式按钮
233
+ function SplitButton(props) {
234
+ const {
235
+ buttonText,
236
+ options = [],
237
+ className,
238
+ style,
239
+ disabled = false,
240
+ onClick,
241
+ optionRender,
242
+ placement = 'bottomLeft',
243
+ buttonProps,
244
+ iconButton = false,
245
+ popperStyle,
246
+ popperClassName = '',
247
+ getPopupContainer,
248
+ variant,
249
+ hideStartIcon,
250
+ optionMaxWidth = '500px',
251
+ optionTipsPlacement = 'top-start'
252
+ } = props;
253
+ const intl = useFormatMessage('Button', localeJson$1);
254
+ const btnRef = useRef();
255
+ // const [selectedIndex, setSelectedIndex] = useState<number | string>();
256
+ // button click
257
+ const handleButtonClick = (opt, index, event) => {
258
+ var _a;
259
+ if (opt.disabled) {
260
+ event.stopPropagation();
261
+ return;
262
+ }
263
+ // setSelectedIndex(index);
264
+ (_a = btnRef.current) === null || _a === void 0 ? void 0 : _a.classList.remove("".concat($prefixCls, "-button-split--active"));
265
+ onClick === null || onClick === void 0 ? void 0 : onClick(opt, event);
266
+ };
267
+ /** 处理PopConfirm内容 */
268
+ const handlePopConfirm = (option, children) => {
269
+ if (option.popConfirmProps && !option.disabled) {
270
+ return jsx(PopConfirm, Object.assign({}, option.popConfirmProps, {
271
+ children: children
272
+ }));
273
+ }
274
+ return children;
275
+ };
276
+ //渲染按钮列表
277
+ const renderButtonList = () => {
278
+ // 渲染item
279
+ const renderItem = item => {
280
+ const com = (optionRender === null || optionRender === void 0 ? void 0 : optionRender(item)) || jsx(AutoTips, Object.assign({
281
+ placement: optionTipsPlacement
282
+ }, {
283
+ children: item.label
284
+ }));
285
+ const {
286
+ disabled,
287
+ disabledTooltip
288
+ } = item;
289
+ if (disabled && disabledTooltip) {
290
+ return jsx(Tooltip, Object.assign({
291
+ disabled: true
292
+ }, disabledTooltip, {
293
+ children: (optionRender === null || optionRender === void 0 ? void 0 : optionRender(item)) || item.label
294
+ }));
295
+ }
296
+ return com;
297
+ };
298
+ //分组列表
299
+ const generateLiGroup = (opt, index) => {
300
+ return jsx("li", Object.assign({
301
+ className: 'split-li-group'
302
+ }, {
303
+ children: opt.map((gItem, gIndex) => {
304
+ const idx = "".concat(index, "-").concat(gIndex);
305
+ return handlePopConfirm(gItem, jsx("div", Object.assign({
306
+ className: clsx('split-li',
307
+ // idx === selectedIndex && 'split-li--active',
308
+ gItem.disabled ? 'split-li--disabled' : 'split-li--hover'),
309
+ style: {
310
+ maxWidth: optionMaxWidth
311
+ },
312
+ onClick: evt => handleButtonClick(gItem, idx, evt)
313
+ }, {
314
+ children: renderItem(gItem)
315
+ }), idx));
316
+ })
317
+ }), index);
318
+ };
319
+ return jsx("div", Object.assign({
320
+ className: "".concat($prefixCls, "-button-split-list")
321
+ }, {
322
+ children: jsx("ul", {
323
+ children: options.map((opt, index) => {
324
+ if (Array.isArray(opt)) {
325
+ //分组
326
+ return generateLiGroup(opt, index);
327
+ }
328
+ return handlePopConfirm(opt, jsx("li", Object.assign({
329
+ className: clsx('split-li',
330
+ // index === selectedIndex && 'split-li--active',
331
+ opt.disabled ? 'split-li--disabled' : 'split-li--hover'),
332
+ style: {
333
+ maxWidth: optionMaxWidth
334
+ },
335
+ onClick: evt => handleButtonClick(opt, index, evt)
336
+ }, {
337
+ children: renderItem(opt)
338
+ }), index));
339
+ })
340
+ })
341
+ }));
342
+ };
343
+ //渲染button
344
+ const renderButton = () => {
345
+ if (iconButton) {
346
+ if (variant) {
347
+ return jsx(Button.IconButton, Object.assign({
348
+ variant: variant,
349
+ size: 'small',
350
+ disabled: disabled
351
+ }, buttonProps, {
352
+ children: buttonText !== null && buttonText !== void 0 ? buttonText : intl({
353
+ id: 'moreActions'
354
+ })
355
+ }));
356
+ }
357
+ return jsx(Button.IconButton, Object.assign({
358
+ variant: 'text',
359
+ size: 'small',
360
+ disabled: disabled
361
+ }, buttonProps, {
362
+ children: buttonText !== null && buttonText !== void 0 ? buttonText : intl({
363
+ id: 'moreActions'
364
+ })
365
+ }));
366
+ }
367
+ return jsx(Button, Object.assign({
368
+ variant: variant || 'outlined',
369
+ size: 'large',
370
+ startIcon: hideStartIcon ? null : jsx(Down, {}),
371
+ disabled: disabled
372
+ }, buttonProps, {
373
+ children: buttonText !== null && buttonText !== void 0 ? buttonText : intl({
374
+ id: 'moreActions'
375
+ })
376
+ }));
377
+ };
378
+ return jsx("div", Object.assign({
379
+ className: clsx("".concat($prefixCls, "-button-split"), className),
380
+ style: style
381
+ }, {
382
+ children: jsx(Dropdown, Object.assign({
383
+ overlay: renderButtonList(),
384
+ placement: placement,
385
+ overlayStyle: popperStyle,
386
+ overlayClassName: popperClassName,
387
+ getPopupContainer: getPopupContainer
388
+ }, {
389
+ children: renderButton()
390
+ }))
391
+ }));
392
+ }
393
+
394
+ //按钮
395
+ const InternalButton = props => {
396
+ const {
397
+ variant = 'contained',
398
+ size = 'large',
399
+ className,
400
+ disabled = false,
401
+ children,
402
+ startIcon,
403
+ endIcon,
404
+ loading = false,
405
+ toolTipTitle = '',
406
+ TooltipProps,
407
+ danger = false,
408
+ href,
409
+ target,
410
+ disabledTooltip
411
+ } = props,
412
+ restProps = __rest(props, ["variant", "size", "className", "disabled", "children", "startIcon", "endIcon", "loading", "toolTipTitle", "TooltipProps", "danger", "href", "target", "disabledTooltip"]);
413
+ const [hasLoading, setHasLoading] = useState(false);
414
+ const isLinkBtn = ('href' in props);
415
+ //cls
416
+ const makeCls = () => {
417
+ return clsx("".concat($prefixCls, "-button"), className, "".concat($prefixCls, "-button-").concat(variant), "".concat($prefixCls, "-button-").concat(size), hasLoading && "".concat($prefixCls, "-button-loading"), danger && !disabled && "".concat($prefixCls, "-button-dangerous"), isLinkBtn && "".concat($prefixCls, "-button-link"), isLinkBtn && disabled && "".concat($prefixCls, "-button-link-disabled"));
418
+ };
419
+ //渲染按钮图标
420
+ const renderBtnIcon = pos => {
421
+ if (!hasLoading) {
422
+ if (pos === 'start' && startIcon) return jsx("span", Object.assign({
423
+ className: 'button-icon'
424
+ }, {
425
+ children: startIcon
426
+ }));
427
+ if (pos === 'end' && endIcon) return jsx("span", Object.assign({
428
+ className: 'button-icon button-icon-end'
429
+ }, {
430
+ children: endIcon
431
+ }));
432
+ return null;
433
+ }
434
+ if (typeof loading === 'object') {
435
+ const delay = loading.delay || 0;
436
+ setTimeout(() => setHasLoading(false), delay);
437
+ }
438
+ if (pos === 'start') return jsx("span", Object.assign({
439
+ className: 'button-icon button-icon-loading'
440
+ }, {
441
+ children: jsx(LoadingOutlined, {})
442
+ }));
443
+ return null;
444
+ };
445
+ //按钮
446
+ const renderButton = () => {
447
+ if (isLinkBtn) {
448
+ return jsxs("a", Object.assign({}, restProps, {
449
+ href: href,
450
+ target: target,
451
+ className: makeCls()
452
+ }, {
453
+ children: [renderBtnIcon('start'), children && jsx("span", Object.assign({
454
+ className: 'button-label'
455
+ }, {
456
+ children: children
457
+ })), renderBtnIcon('end')]
458
+ }));
459
+ }
460
+ return jsxs("button", Object.assign({
461
+ disabled: disabled,
462
+ type: "button",
463
+ className: makeCls()
464
+ }, restProps, {
465
+ children: [renderBtnIcon('start'), children && jsx("span", Object.assign({
466
+ className: 'button-label'
467
+ }, {
468
+ children: children
469
+ })), renderBtnIcon('end')]
470
+ }));
471
+ };
472
+ useEffect(() => {
473
+ setHasLoading(!!loading);
474
+ }, [loading]);
475
+ if (disabled && disabledTooltip) {
476
+ return jsx(Tooltip, Object.assign({
477
+ disabled: true
478
+ }, disabledTooltip, {
479
+ children: jsx("span", Object.assign({
480
+ className: "".concat($prefixCls, "-button--disabled")
481
+ }, {
482
+ children: renderButton()
483
+ }))
484
+ }));
485
+ }
486
+ if (!!toolTipTitle) {
487
+ return jsx(Tooltip, Object.assign({
488
+ arrow: false,
489
+ placement: 'bottomLeft'
490
+ }, TooltipProps, {
491
+ disabled: disabled,
492
+ title: toolTipTitle
493
+ }, {
494
+ children: disabled ? jsx("span", Object.assign({
495
+ className: "".concat($prefixCls, "-button--disabled")
496
+ }, {
497
+ children: renderButton()
498
+ })) : renderButton()
499
+ }));
500
+ }
501
+ return renderButton();
502
+ };
503
+ //icon button
504
+ const IconButton = props => {
505
+ const {
506
+ variant = 'contained',
507
+ size = 'large',
508
+ toolTipTitle = '',
509
+ children,
510
+ className,
511
+ disabled = false,
512
+ loading = false,
513
+ TooltipProps,
514
+ danger = false,
515
+ href,
516
+ target,
517
+ disabledTooltip
518
+ } = props,
519
+ restProps = __rest(props, ["variant", "size", "toolTipTitle", "children", "className", "disabled", "loading", "TooltipProps", "danger", "href", "target", "disabledTooltip"]);
520
+ const [hasLoading, setHasLoading] = useState(false);
521
+ const isLinkBtn = ('href' in props);
522
+ //cls
523
+ const makeCls = () => {
524
+ return clsx("".concat($prefixCls, "-button ").concat($prefixCls, "-icon-button"), className, "".concat($prefixCls, "-icon-button-").concat(variant), "".concat($prefixCls, "-icon-button-").concat(size), hasLoading && "".concat($prefixCls, "-icon-button-loading"), danger && !disabled && "".concat($prefixCls, "-icon-button-dangerous"), isLinkBtn && "".concat($prefixCls, "-button-link"), isLinkBtn && disabled && "".concat($prefixCls, "-button-link-disabled"));
525
+ };
526
+ //渲染图标
527
+ const renderIcon = () => {
528
+ if (!hasLoading) return children;
529
+ if (typeof loading === 'object') {
530
+ const delay = loading.delay || 0;
531
+ setTimeout(() => setHasLoading(false), delay);
532
+ }
533
+ return jsx("span", Object.assign({
534
+ className: 'button-loading-icon'
535
+ }, {
536
+ children: jsx(LoadingOutlined, {})
537
+ }));
538
+ };
539
+ //icon button
540
+ const renderIconButton = () => {
541
+ if (isLinkBtn) {
542
+ return jsx("a", Object.assign({}, restProps, {
543
+ href: href,
544
+ target: target,
545
+ className: makeCls()
546
+ }, {
547
+ children: renderIcon()
548
+ }));
549
+ }
550
+ return jsx("button", Object.assign({}, restProps, {
551
+ disabled: disabled,
552
+ type: "button",
553
+ className: makeCls()
554
+ }, {
555
+ children: renderIcon()
556
+ }));
557
+ };
558
+ useEffect(() => {
559
+ setHasLoading(!!loading);
560
+ }, [loading]);
561
+ if (disabled && disabledTooltip) {
562
+ return jsx(Tooltip, Object.assign({
563
+ disabled: true
564
+ }, disabledTooltip, {
565
+ children: jsx("span", Object.assign({
566
+ className: "".concat($prefixCls, "-button--disabled")
567
+ }, {
568
+ children: renderIconButton()
569
+ }))
570
+ }));
571
+ }
572
+ if (!!toolTipTitle) {
573
+ return jsx(Tooltip, Object.assign({
574
+ arrow: false,
575
+ placement: 'bottomLeft'
576
+ }, TooltipProps, {
577
+ disabled: disabled,
578
+ title: toolTipTitle
579
+ }, {
580
+ children: disabled ? jsx("span", Object.assign({
581
+ className: "".concat($prefixCls, "-button--disabled")
582
+ }, {
583
+ children: renderIconButton()
584
+ })) : renderIconButton()
585
+ }), +hasLoading);
586
+ }
587
+ return renderIconButton();
588
+ };
589
+ const Button = InternalButton;
590
+ Button.IconButton = IconButton;
591
+ Button.SplitButton = SplitButton;
592
+
593
+ export { Button as B, PopConfirm as P };
package/index.js CHANGED
@@ -6,7 +6,7 @@ export { AutoButton } from './AutoButton/index.js';
6
6
  export { default as AutoTips, AutoTipsMultiline } from './AutoTips/index.js';
7
7
  export { Badge } from './Badge/index.js';
8
8
  export { Breadcrumbs } from './Breadcrumbs/index.js';
9
- export { Button } from './Button/index.js';
9
+ export { B as Button, P as PopConfirm } from './_verture/index-7e60b72c.js';
10
10
  export { ButtonGroup } from './ButtonGroup/index.js';
11
11
  export { Card } from './Card/index.js';
12
12
  export { Carousel } from './Carousel/index.js';
@@ -33,8 +33,8 @@ export { default as DynamicMultiBox } from './DynamicMultiBox/index.js';
33
33
  export { default as Empty } from './Empty/index.js';
34
34
  export { default as FieldForm } from './FieldForm/index.js';
35
35
  export { default as Form } from './Form/index.js';
36
- export { F as FormItem } from './_verture/index-43c653bb.js';
37
- export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-6ac2e323.js';
36
+ export { F as FormItem } from './_verture/index-0e866545.js';
37
+ export { u as FunctionModal, F as FunctionModalProvider, a as useClose } from './_verture/modalContext-3ed7e7f6.js';
38
38
  export { G as GlobalContext, c as changeConfirmLocale, g as getConfirmLocale } from './_verture/index-ca413216.js';
39
39
  export { default as Help } from './Help/index.js';
40
40
  export { default as HelperText } from './HelperText/index.js';
@@ -54,7 +54,6 @@ export { PageHeader } from './PageHeader/index.js';
54
54
  export { Pagination } from './Pagination/index.js';
55
55
  export { ParauiProvider } from './ParauiProvider/index.js';
56
56
  export { default as PasswordRules } from './PasswordRules/index.js';
57
- export { PopConfirm } from './PopConfirm/index.js';
58
57
  export { PopMenu } from './PopMenu/index.js';
59
58
  export { Popover } from './Popover/index.js';
60
59
  export { Progress } from './Progress/index.js';
@@ -112,6 +111,11 @@ import '@para-ui/icons/More';
112
111
  import '@para-ui/icons/MoreVert';
113
112
  import '@para-ui/icons/Return';
114
113
  import '@para-ui/icons/LoadingF';
114
+ import '@para-ui/icons/CheckCircleF';
115
+ import '@para-ui/icons/WarningCircle';
116
+ import '@para-ui/icons/CloseCircleF';
117
+ import '@para-ui/icons/WarningCircleF';
118
+ import './_verture/usePopupContainer-635f66f4.js';
115
119
  import 'react-slick';
116
120
  import '@para-ui/icons/RightCircleF';
117
121
  import '@para-ui/icons/LeftCircleF';
@@ -126,7 +130,6 @@ import './_verture/typeof-6ec38efd.js';
126
130
  import 'rc-motion';
127
131
  import 'rc-tree/lib/utils/conductUtil';
128
132
  import '@para-ui/icons/Right';
129
- import '@para-ui/icons/CloseCircleF';
130
133
  import 'rc-tree/lib/utils/treeUtil';
131
134
  import '@para-ui/icons';
132
135
  import 'rc-collapse';
@@ -142,7 +145,6 @@ import './_verture/useGlobalProps-4ae1a007.js';
142
145
  import '@para-ui/icons/Copy';
143
146
  import '@para-ui/icons/CheckS';
144
147
  import 'dayjs';
145
- import '@para-ui/icons/WarningCircleF';
146
148
  import 'rc-picker/es/generate/dayjs';
147
149
  import 'rc-picker';
148
150
  import '@para-ui/icons/Calendar';
@@ -156,14 +158,12 @@ import '@para-ui/icons/Check';
156
158
  import '@para-ui/icons/Refresh';
157
159
  import 'rc-drawer';
158
160
  import 'rc-dropdown';
159
- import './_verture/usePopupContainer-635f66f4.js';
160
161
  import '@para-ui/icons/Panel';
161
162
  import '@para-ui/icons/Drag';
162
163
  import './_verture/index-0f5ee6f7.js';
163
164
  import './_verture/sortable.esm-76fe46a4.js';
164
165
  import './_verture/isEqual-30b6f859.js';
165
166
  import '@para-ui/icons/Loading';
166
- import '@para-ui/icons/CheckCircleF';
167
167
  import '@para-ui/icons/LinkGroup';
168
168
  import '@para-ui/icons/UploadFile';
169
169
  import '@para-ui/icons/Help';
@@ -182,7 +182,6 @@ import '@para-ui/icons/IndentLeftFill';
182
182
  import 'rc-notification';
183
183
  import 'rc-pagination';
184
184
  import '@para-ui/icons/DoubleLeft';
185
- import '@para-ui/icons/WarningCircle';
186
185
  import 'rc-progress';
187
186
  import '@para-ui/icons/Plus';
188
187
  import '@para-ui/icons/EditOutline';