@para-ui/core 4.0.53 → 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.
- package/Argv/index.js +5 -4
- package/AutoButton/index.d.ts +3 -0
- package/AutoButton/index.js +19 -6
- package/Button/SplitButton.d.ts +3 -0
- package/Button/index.d.ts +4 -0
- package/Button/index.js +17 -352
- package/ButtonGroup/index.js +5 -1
- package/Cascader/Cascader.d.ts +3 -0
- package/Cascader/index.js +11 -7
- package/ComboSelect/index.js +10 -10
- package/CycleSelector/index.js +7 -2
- package/DatePicker/index.js +10 -4
- package/Descriptions/index.js +5 -1
- package/Desktop/index.js +4 -1
- package/Drawer/index.js +5 -1
- package/DynamicMultiBox/index.js +11 -11
- package/DynamicMultiBox/interface.d.ts +1 -1
- package/FieldForm/ErrorList.d.ts +16 -0
- package/FieldForm/FieldFormItem/ItemHolder.d.ts +18 -0
- package/FieldForm/FieldFormItem/MemoInput.d.ts +14 -0
- package/FieldForm/FieldFormItem/StatusProvider.d.ts +20 -0
- package/FieldForm/FieldFormItem/index.d.ts +58 -0
- package/FieldForm/Form.d.ts +36 -0
- package/FieldForm/FormItemInput.d.ts +21 -0
- package/FieldForm/FormItemLabel.d.ts +21 -0
- package/FieldForm/FormList.d.ts +23 -0
- package/FieldForm/context.d.ts +33 -0
- package/FieldForm/hooks/useChildren.d.ts +2 -0
- package/FieldForm/hooks/useDebounce.d.ts +1 -0
- package/FieldForm/hooks/useForm.d.ts +6 -0
- package/FieldForm/hooks/useFormInstance.d.ts +2 -0
- package/FieldForm/hooks/useFormItemStatus.d.ts +9 -0
- package/FieldForm/hooks/useFrameState.d.ts +3 -0
- package/FieldForm/hooks/useItemRef.d.ts +3 -0
- package/FieldForm/index.d.ts +30 -0
- package/FieldForm/index.js +5326 -0
- package/FieldForm/interface.d.ts +2 -0
- package/FieldForm/lang/en_US.d.ts +51 -0
- package/FieldForm/lang/index.d.ts +105 -0
- package/FieldForm/lang/zh_CN.d.ts +51 -0
- package/FieldForm/util.d.ts +21 -0
- package/Form/index.js +10 -10
- package/FormItem/index.js +10 -10
- package/FunctionModal/index.js +7 -6
- package/Image/index.js +7 -56
- package/InputCode/index.js +4 -1
- package/Modal/index.js +2 -1
- package/OperateBtn/index.js +5 -6
- package/PageHeader/index.js +5 -1
- package/Pagination/index.js +4 -1
- package/PopConfirm/index.js +14 -213
- package/PopMenu/index.js +2 -2
- package/QuickReply/index.js +6 -7
- package/README.md +17 -0
- package/Result/index.js +2 -2
- package/Selector/index.js +1 -1
- package/SelectorPicker/index.js +1 -1
- package/Stepper/index.js +1 -1
- package/Switch/index.d.ts +4 -0
- package/Switch/index.js +5 -4
- package/Table/index.js +4 -5
- package/Tabs/index.js +8 -9
- package/Tag/index.js +87 -55
- package/TextEditor/index.d.ts +2 -0
- package/TextEditor/index.js +27 -6
- package/TimePicker/index.js +9 -3
- package/Timeline/index.js +2 -1
- package/ToggleButton/index.js +7 -2
- package/Transfer/index.d.ts +1 -0
- package/Transfer/index.js +125 -121
- package/Tree/index.js +6 -5
- package/Upload/index.js +13 -11
- package/_verture/{Portal-42560ff0.js → Portal-502bb85e.js} +30 -481
- package/_verture/{defineProperty-f0e15205.js → defineProperty-6f62bb2a.js} +2 -10
- package/_verture/{index-063009f8.js → index-0a300edb.js} +388 -700
- package/_verture/{index-f30ae73e.js → index-0e866545.js} +2 -2
- package/_verture/index-1856bbeb.js +480 -0
- package/_verture/{index-d728b0ce.js → index-320d67c4.js} +4 -3
- package/_verture/index-7e60b72c.js +593 -0
- package/_verture/isEqual-30b6f859.js +56 -0
- package/_verture/{slicedToArray-75fa4188.js → slicedToArray-61604a6c.js} +1 -1
- package/_verture/{toConsumableArray-c7a8028f.js → toConsumableArray-599cd94a.js} +1 -1
- package/_verture/typeof-adeedc13.js +11 -0
- package/_verture/useState-f2419d68.js +353 -0
- package/index.d.ts +2 -0
- package/index.js +21 -17
- package/locale/en-US.d.ts +46 -0
- package/locale/index.d.ts +92 -0
- package/locale/index.js +92 -0
- package/locale/zh-CN.d.ts +46 -0
- package/package.json +3 -1
- package/umd/Anchor.js +5 -5
- package/umd/Argv.js +6 -6
- package/umd/AutoBox.js +5 -5
- package/umd/AutoButton.js +7 -7
- package/umd/AutoTips.js +5 -5
- package/umd/Breadcrumbs.js +4 -4
- package/umd/Button.js +7 -7
- package/umd/ButtonGroup.js +7 -7
- package/umd/Cascader.js +5 -5
- package/umd/Checkbox.js +4 -4
- package/umd/CheckboxGroup.js +4 -4
- package/umd/Collapse.js +1 -1
- package/umd/ComboSelect.js +4 -4
- package/umd/CopyText.js +5 -5
- package/umd/CycleSelector.js +7 -7
- package/umd/DatePicker.js +7 -7
- package/umd/Descriptions.js +6 -6
- package/umd/Desktop.js +7 -7
- package/umd/Drawer.js +7 -7
- package/umd/Dropdown.js +4 -4
- package/umd/DynamicMultiBox.js +4 -4
- package/umd/FieldForm.js +43 -0
- package/umd/Form.js +4 -4
- package/umd/FormItem.js +4 -4
- package/umd/FunctionModal.js +7 -7
- package/umd/Help.js +5 -5
- package/umd/Image.js +3 -3
- package/umd/InputCode.js +7 -7
- package/umd/InputLang.js +5 -5
- package/umd/InputNumber.js +4 -4
- package/umd/Label.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Modal.js +6 -6
- package/umd/MultiBox.js +6 -6
- package/umd/Notification.js +3 -3
- package/umd/OperateBtn.js +6 -6
- package/umd/PageHeader.js +7 -7
- package/umd/Pagination.js +7 -7
- package/umd/PopConfirm.js +5 -5
- package/umd/PopMenu.js +5 -5
- package/umd/Popover.js +5 -5
- package/umd/QuickReply.js +5 -5
- package/umd/Radio.js +4 -4
- package/umd/RadioGroup.js +4 -4
- package/umd/RangeInput.js +5 -5
- package/umd/Result.js +4 -4
- package/umd/Search.js +5 -5
- package/umd/Select.js +5 -5
- package/umd/SelectInput.js +5 -5
- package/umd/Selector.js +5 -5
- package/umd/SelectorPicker.js +5 -5
- package/umd/SingleBox.js +5 -5
- package/umd/Slider.js +4 -4
- package/umd/Stepper.js +4 -4
- package/umd/Switch.js +4 -4
- package/umd/Table.js +5 -5
- package/umd/Tabs.js +4 -4
- package/umd/Tag.js +5 -5
- package/umd/TextEditor.js +6 -6
- package/umd/TextField.js +5 -5
- package/umd/TimePicker.js +7 -7
- package/umd/Title.js +3 -3
- package/umd/ToggleButton.js +7 -7
- package/umd/Tooltip.js +4 -4
- package/umd/Transfer.js +8 -8
- package/umd/Tree.js +3 -3
- package/umd/Upload.js +5 -5
- package/umd/locale.js +1 -1
- /package/_verture/{modalContext-8a48c400.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 };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { _ as _typeof } from './typeof-adeedc13.js';
|
|
2
|
+
import { d as warningOnce } from './index-1856bbeb.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Deeply compares two object literals.
|
|
6
|
+
* @param obj1 object 1
|
|
7
|
+
* @param obj2 object 2
|
|
8
|
+
* @param shallow shallow compare
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
function isEqual(obj1, obj2) {
|
|
12
|
+
var shallow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
13
|
+
// https://github.com/mapbox/mapbox-gl-js/pull/5979/files#diff-fde7145050c47cc3a306856efd5f9c3016e86e859de9afbd02c879be5067e58f
|
|
14
|
+
var refSet = new Set();
|
|
15
|
+
function deepEqual(a, b) {
|
|
16
|
+
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
17
|
+
var circular = refSet.has(a);
|
|
18
|
+
warningOnce(!circular, 'Warning: There may be circular references');
|
|
19
|
+
if (circular) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (a === b) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if (shallow && level > 1) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
refSet.add(a);
|
|
29
|
+
var newLevel = level + 1;
|
|
30
|
+
if (Array.isArray(a)) {
|
|
31
|
+
if (!Array.isArray(b) || a.length !== b.length) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
for (var i = 0; i < a.length; i++) {
|
|
35
|
+
if (!deepEqual(a[i], b[i], newLevel)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
if (a && b && _typeof(a) === 'object' && _typeof(b) === 'object') {
|
|
42
|
+
var keys = Object.keys(a);
|
|
43
|
+
if (keys.length !== Object.keys(b).length) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
return keys.every(function (key) {
|
|
47
|
+
return deepEqual(a[key], b[key], newLevel);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// other
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return deepEqual(obj1, obj2);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { isEqual as i };
|
|
@@ -53,4 +53,4 @@ function _slicedToArray(arr, i) {
|
|
|
53
53
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
export { _slicedToArray as _,
|
|
56
|
+
export { _slicedToArray as _, _arrayLikeToArray as a, _unsupportedIterableToArray as b, _arrayWithHoles as c, _nonIterableRest as d };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as _arrayLikeToArray, b as _unsupportedIterableToArray } from './slicedToArray-61604a6c.js';
|
|
2
2
|
|
|
3
3
|
function _arrayWithoutHoles(arr) {
|
|
4
4
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|