@para-ui/core 4.0.54 → 4.0.56

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 (72) hide show
  1. package/Argv/index.js +5 -4
  2. package/AutoButton/index.d.ts +3 -0
  3. package/AutoButton/index.js +30 -14
  4. package/Button/SplitButton.d.ts +5 -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 +9 -9
  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 +8 -8
  15. package/FieldForm/FieldFormItem/index.d.ts +1 -0
  16. package/FieldForm/FormItemInput.d.ts +2 -0
  17. package/FieldForm/index.js +15 -7
  18. package/Form/index.js +8 -8
  19. package/FormItem/index.js +8 -8
  20. package/FunctionModal/index.js +7 -6
  21. package/InputCode/index.js +4 -1
  22. package/Modal/index.js +2 -1
  23. package/OperateBtn/index.js +5 -6
  24. package/PageHeader/index.js +5 -1
  25. package/Pagination/index.js +4 -1
  26. package/PopConfirm/index.js +14 -213
  27. package/QuickReply/index.js +6 -7
  28. package/README.md +14 -0
  29. package/Selector/index.js +3 -2
  30. package/Stepper/index.js +1 -1
  31. package/Table/index.js +502 -488
  32. package/Tabs/index.js +6 -7
  33. package/TimePicker/index.js +5 -2
  34. package/ToggleButton/index.js +5 -1
  35. package/Transfer/index.js +5 -2
  36. package/Upload/index.js +3 -4
  37. package/_verture/{index-43c653bb.js → index-7558fb61.js} +1 -1
  38. package/_verture/index-cd9ede02.js +596 -0
  39. package/_verture/useResizeObserver-960e470e.js +54 -0
  40. package/index.js +9 -9
  41. package/package.json +1 -1
  42. package/umd/Argv.js +4 -4
  43. package/umd/AutoButton.js +7 -7
  44. package/umd/Button.js +7 -7
  45. package/umd/ButtonGroup.js +7 -7
  46. package/umd/ComboSelect.js +1 -1
  47. package/umd/CycleSelector.js +5 -5
  48. package/umd/DatePicker.js +5 -5
  49. package/umd/Descriptions.js +7 -7
  50. package/umd/Desktop.js +5 -5
  51. package/umd/Drawer.js +7 -7
  52. package/umd/DynamicMultiBox.js +1 -1
  53. package/umd/FieldForm.js +2 -2
  54. package/umd/Form.js +1 -1
  55. package/umd/FormItem.js +1 -1
  56. package/umd/FunctionModal.js +7 -7
  57. package/umd/InputCode.js +6 -6
  58. package/umd/Modal.js +5 -5
  59. package/umd/OperateBtn.js +6 -6
  60. package/umd/PageHeader.js +7 -7
  61. package/umd/Pagination.js +5 -5
  62. package/umd/PopConfirm.js +2 -2
  63. package/umd/QuickReply.js +1 -1
  64. package/umd/Selector.js +1 -1
  65. package/umd/SelectorPicker.js +1 -1
  66. package/umd/Table.js +1 -1
  67. package/umd/Tabs.js +1 -1
  68. package/umd/TimePicker.js +5 -5
  69. package/umd/ToggleButton.js +7 -7
  70. package/umd/Transfer.js +8 -8
  71. package/umd/Upload.js +1 -1
  72. /package/_verture/{modalContext-6ac2e323.js → modalContext-ce07f2de.js} +0 -0
@@ -0,0 +1,596 @@
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
+ startIcon = jsx(Down, {})
253
+ } = props;
254
+ const intl = useFormatMessage('Button', localeJson$1);
255
+ const btnRef = useRef();
256
+ // const [selectedIndex, setSelectedIndex] = useState<number | string>();
257
+ // button click
258
+ const handleButtonClick = (opt, index, event) => {
259
+ var _a;
260
+ if (opt.disabled) {
261
+ event.stopPropagation();
262
+ return;
263
+ }
264
+ // setSelectedIndex(index);
265
+ (_a = btnRef.current) === null || _a === void 0 ? void 0 : _a.classList.remove("".concat($prefixCls, "-button-split--active"));
266
+ onClick === null || onClick === void 0 ? void 0 : onClick(opt, event);
267
+ };
268
+ /** 处理PopConfirm内容 */
269
+ const handlePopConfirm = (option, children) => {
270
+ if (option.popConfirmProps && !option.disabled) {
271
+ return jsx(PopConfirm, Object.assign({}, option.popConfirmProps, {
272
+ children: children
273
+ }), option === null || option === void 0 ? void 0 : option.idx);
274
+ }
275
+ return children;
276
+ };
277
+ //渲染按钮列表
278
+ const renderButtonList = () => {
279
+ // 渲染item
280
+ const renderItem = item => {
281
+ const com = (optionRender === null || optionRender === void 0 ? void 0 : optionRender(item)) || jsx(AutoTips, Object.assign({
282
+ placement: optionTipsPlacement
283
+ }, {
284
+ children: item.label
285
+ }));
286
+ const {
287
+ disabled,
288
+ disabledTooltip
289
+ } = item;
290
+ if (disabled && disabledTooltip) {
291
+ return jsx(Tooltip, Object.assign({
292
+ disabled: true
293
+ }, disabledTooltip, {
294
+ children: (optionRender === null || optionRender === void 0 ? void 0 : optionRender(item)) || item.label
295
+ }));
296
+ }
297
+ return com;
298
+ };
299
+ //分组列表
300
+ const generateLiGroup = (opt, index) => {
301
+ return jsx("li", Object.assign({
302
+ className: 'split-li-group'
303
+ }, {
304
+ children: opt.map((gItem, gIndex) => {
305
+ const idx = "".concat(index, "-").concat(gIndex);
306
+ gItem.idx = idx;
307
+ return handlePopConfirm(gItem, jsx("div", Object.assign({
308
+ className: clsx('split-li',
309
+ // idx === selectedIndex && 'split-li--active',
310
+ gItem.disabled ? 'split-li--disabled' : 'split-li--hover'),
311
+ style: {
312
+ maxWidth: optionMaxWidth
313
+ },
314
+ onClick: evt => handleButtonClick(gItem, idx, evt)
315
+ }, {
316
+ children: renderItem(gItem)
317
+ }), idx));
318
+ })
319
+ }), index);
320
+ };
321
+ return jsx("div", Object.assign({
322
+ className: "".concat($prefixCls, "-button-split-list")
323
+ }, {
324
+ children: jsx("ul", {
325
+ children: options.map((opt, index) => {
326
+ if (Array.isArray(opt)) {
327
+ //分组
328
+ return generateLiGroup(opt, index);
329
+ }
330
+ opt.idx = index;
331
+ return handlePopConfirm(opt, jsx("li", Object.assign({
332
+ className: clsx('split-li',
333
+ // index === selectedIndex && 'split-li--active',
334
+ opt.disabled ? 'split-li--disabled' : 'split-li--hover'),
335
+ style: {
336
+ maxWidth: optionMaxWidth
337
+ },
338
+ onClick: evt => handleButtonClick(opt, index, evt)
339
+ }, {
340
+ children: renderItem(opt)
341
+ }), index));
342
+ })
343
+ })
344
+ }));
345
+ };
346
+ //渲染button
347
+ const renderButton = () => {
348
+ if (iconButton) {
349
+ if (variant) {
350
+ return jsx(Button.IconButton, Object.assign({
351
+ variant: variant,
352
+ size: 'small',
353
+ disabled: disabled
354
+ }, buttonProps, {
355
+ children: buttonText !== null && buttonText !== void 0 ? buttonText : intl({
356
+ id: 'moreActions'
357
+ })
358
+ }));
359
+ }
360
+ return jsx(Button.IconButton, Object.assign({
361
+ variant: 'text',
362
+ size: 'small',
363
+ disabled: disabled
364
+ }, buttonProps, {
365
+ children: buttonText !== null && buttonText !== void 0 ? buttonText : intl({
366
+ id: 'moreActions'
367
+ })
368
+ }));
369
+ }
370
+ return jsx(Button, Object.assign({
371
+ variant: variant || 'outlined',
372
+ size: 'large',
373
+ startIcon: hideStartIcon ? null : startIcon,
374
+ disabled: disabled
375
+ }, buttonProps, {
376
+ children: buttonText !== null && buttonText !== void 0 ? buttonText : intl({
377
+ id: 'moreActions'
378
+ })
379
+ }));
380
+ };
381
+ return jsx("div", Object.assign({
382
+ className: clsx("".concat($prefixCls, "-button-split"), className),
383
+ style: style
384
+ }, {
385
+ children: jsx(Dropdown, Object.assign({
386
+ overlay: renderButtonList(),
387
+ placement: placement,
388
+ overlayStyle: popperStyle,
389
+ overlayClassName: popperClassName,
390
+ getPopupContainer: getPopupContainer
391
+ }, {
392
+ children: renderButton()
393
+ }))
394
+ }));
395
+ }
396
+
397
+ //按钮
398
+ const InternalButton = props => {
399
+ const {
400
+ variant = 'contained',
401
+ size = 'large',
402
+ className,
403
+ disabled = false,
404
+ children,
405
+ startIcon,
406
+ endIcon,
407
+ loading = false,
408
+ toolTipTitle = '',
409
+ TooltipProps,
410
+ danger = false,
411
+ href,
412
+ target,
413
+ disabledTooltip
414
+ } = props,
415
+ restProps = __rest(props, ["variant", "size", "className", "disabled", "children", "startIcon", "endIcon", "loading", "toolTipTitle", "TooltipProps", "danger", "href", "target", "disabledTooltip"]);
416
+ const [hasLoading, setHasLoading] = useState(false);
417
+ const isLinkBtn = ('href' in props);
418
+ //cls
419
+ const makeCls = () => {
420
+ 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"));
421
+ };
422
+ //渲染按钮图标
423
+ const renderBtnIcon = pos => {
424
+ if (!hasLoading) {
425
+ if (pos === 'start' && startIcon) return jsx("span", Object.assign({
426
+ className: 'button-icon'
427
+ }, {
428
+ children: startIcon
429
+ }));
430
+ if (pos === 'end' && endIcon) return jsx("span", Object.assign({
431
+ className: 'button-icon button-icon-end'
432
+ }, {
433
+ children: endIcon
434
+ }));
435
+ return null;
436
+ }
437
+ if (typeof loading === 'object') {
438
+ const delay = loading.delay || 0;
439
+ setTimeout(() => setHasLoading(false), delay);
440
+ }
441
+ if (pos === 'start') return jsx("span", Object.assign({
442
+ className: 'button-icon button-icon-loading'
443
+ }, {
444
+ children: jsx(LoadingOutlined, {})
445
+ }));
446
+ return null;
447
+ };
448
+ //按钮
449
+ const renderButton = () => {
450
+ if (isLinkBtn) {
451
+ return jsxs("a", Object.assign({}, restProps, {
452
+ href: href,
453
+ target: target,
454
+ className: makeCls()
455
+ }, {
456
+ children: [renderBtnIcon('start'), children && jsx("span", Object.assign({
457
+ className: 'button-label'
458
+ }, {
459
+ children: children
460
+ })), renderBtnIcon('end')]
461
+ }));
462
+ }
463
+ return jsxs("button", Object.assign({
464
+ disabled: disabled,
465
+ type: "button",
466
+ className: makeCls()
467
+ }, restProps, {
468
+ children: [renderBtnIcon('start'), children && jsx("span", Object.assign({
469
+ className: 'button-label'
470
+ }, {
471
+ children: children
472
+ })), renderBtnIcon('end')]
473
+ }));
474
+ };
475
+ useEffect(() => {
476
+ setHasLoading(!!loading);
477
+ }, [loading]);
478
+ if (disabled && disabledTooltip) {
479
+ return jsx(Tooltip, Object.assign({
480
+ disabled: true
481
+ }, disabledTooltip, {
482
+ children: jsx("span", Object.assign({
483
+ className: "".concat($prefixCls, "-button--disabled")
484
+ }, {
485
+ children: renderButton()
486
+ }))
487
+ }));
488
+ }
489
+ if (!!toolTipTitle) {
490
+ return jsx(Tooltip, Object.assign({
491
+ arrow: false,
492
+ placement: 'bottomLeft'
493
+ }, TooltipProps, {
494
+ disabled: disabled,
495
+ title: toolTipTitle
496
+ }, {
497
+ children: disabled ? jsx("span", Object.assign({
498
+ className: "".concat($prefixCls, "-button--disabled")
499
+ }, {
500
+ children: renderButton()
501
+ })) : renderButton()
502
+ }));
503
+ }
504
+ return renderButton();
505
+ };
506
+ //icon button
507
+ const IconButton = props => {
508
+ const {
509
+ variant = 'contained',
510
+ size = 'large',
511
+ toolTipTitle = '',
512
+ children,
513
+ className,
514
+ disabled = false,
515
+ loading = false,
516
+ TooltipProps,
517
+ danger = false,
518
+ href,
519
+ target,
520
+ disabledTooltip
521
+ } = props,
522
+ restProps = __rest(props, ["variant", "size", "toolTipTitle", "children", "className", "disabled", "loading", "TooltipProps", "danger", "href", "target", "disabledTooltip"]);
523
+ const [hasLoading, setHasLoading] = useState(false);
524
+ const isLinkBtn = ('href' in props);
525
+ //cls
526
+ const makeCls = () => {
527
+ 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"));
528
+ };
529
+ //渲染图标
530
+ const renderIcon = () => {
531
+ if (!hasLoading) return children;
532
+ if (typeof loading === 'object') {
533
+ const delay = loading.delay || 0;
534
+ setTimeout(() => setHasLoading(false), delay);
535
+ }
536
+ return jsx("span", Object.assign({
537
+ className: 'button-loading-icon'
538
+ }, {
539
+ children: jsx(LoadingOutlined, {})
540
+ }));
541
+ };
542
+ //icon button
543
+ const renderIconButton = () => {
544
+ if (isLinkBtn) {
545
+ return jsx("a", Object.assign({}, restProps, {
546
+ href: href,
547
+ target: target,
548
+ className: makeCls()
549
+ }, {
550
+ children: renderIcon()
551
+ }));
552
+ }
553
+ return jsx("button", Object.assign({}, restProps, {
554
+ disabled: disabled,
555
+ type: "button",
556
+ className: makeCls()
557
+ }, {
558
+ children: renderIcon()
559
+ }));
560
+ };
561
+ useEffect(() => {
562
+ setHasLoading(!!loading);
563
+ }, [loading]);
564
+ if (disabled && disabledTooltip) {
565
+ return jsx(Tooltip, Object.assign({
566
+ disabled: true
567
+ }, disabledTooltip, {
568
+ children: jsx("span", Object.assign({
569
+ className: "".concat($prefixCls, "-button--disabled")
570
+ }, {
571
+ children: renderIconButton()
572
+ }))
573
+ }));
574
+ }
575
+ if (!!toolTipTitle) {
576
+ return jsx(Tooltip, Object.assign({
577
+ arrow: false,
578
+ placement: 'bottomLeft'
579
+ }, TooltipProps, {
580
+ disabled: disabled,
581
+ title: toolTipTitle
582
+ }, {
583
+ children: disabled ? jsx("span", Object.assign({
584
+ className: "".concat($prefixCls, "-button--disabled")
585
+ }, {
586
+ children: renderIconButton()
587
+ })) : renderIconButton()
588
+ }), +hasLoading);
589
+ }
590
+ return renderIconButton();
591
+ };
592
+ const Button = InternalButton;
593
+ Button.IconButton = IconButton;
594
+ Button.SplitButton = SplitButton;
595
+
596
+ export { Button as B, PopConfirm as P };
@@ -0,0 +1,54 @@
1
+ import { useRef, useEffect } from 'react';
2
+
3
+ /**
4
+ * @author linhd
5
+ * @date 2024/12/23 10:45
6
+ * @description 监听元素发生变化
7
+ */
8
+ const useResizeObserver = props => {
9
+ const constData = useRef({});
10
+ useEffect(() => {
11
+ resizeObserverDom();
12
+ return () => {
13
+ clearInterval(constData.current.resizeTimer);
14
+ clearTimeout(constData.current.resizeLimit);
15
+ };
16
+ }, [props.dom]);
17
+ // 判断宽高发生变化
18
+ const isChangeSize = rect => {
19
+ const width = rect.width;
20
+ const height = rect.height;
21
+ if (width === constData.current.width && height === constData.current.height) {
22
+ return;
23
+ }
24
+ constData.current.width = width;
25
+ constData.current.height = height;
26
+ clearTimeout(constData.current.resizeLimit);
27
+ constData.current.resizeLimit = setTimeout(() => {
28
+ props.cb();
29
+ }, 100);
30
+ };
31
+ // 监听表格容器宽高发生变化
32
+ const resizeObserverDom = () => {
33
+ const dom = props.dom;
34
+ if (!dom) return;
35
+ if (window.ResizeObserver === undefined) {
36
+ clearInterval(constData.current.resizeTimer);
37
+ constData.current.resizeTimer = setInterval(() => {
38
+ const tableRefEleRect = dom.getBoundingClientRect();
39
+ isChangeSize(tableRefEleRect);
40
+ });
41
+ } else {
42
+ // 创建一个ResizeObserver实例并传入回调函数
43
+ const resizeObserver = new ResizeObserver(entries => {
44
+ var _a;
45
+ const contentRect = (_a = entries[0]) === null || _a === void 0 ? void 0 : _a.contentRect;
46
+ isChangeSize(contentRect);
47
+ });
48
+ // 开始观察元素
49
+ resizeObserver.observe(dom);
50
+ }
51
+ };
52
+ };
53
+
54
+ export { useResizeObserver as u };