@para-ui/core 4.0.0-rc.3 → 4.0.0-rc.5
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/AutoBox/index.js +72 -85
- package/AutoTips/index.js +72 -95
- package/Badge/index.js +18 -17
- package/Breadcrumbs/index.js +57 -73
- package/Button/index.js +89 -117
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +7 -9
- package/Checkbox/index.js +28 -35
- package/CheckboxGroup/index.js +43 -58
- package/Collapse/index.js +52 -49
- package/CollapseBox/index.js +65 -70
- package/CollapseLayout/index.js +106 -101
- package/ColorPicker/index.js +3 -3
- package/ComboSelect/index.js +242 -330
- package/ComboSelect/utils.d.ts +0 -5
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +22 -27
- package/Descriptions/index.js +50 -59
- package/Desktop/index.js +161 -180
- package/DragVerify/index.js +77 -113
- package/Drawer/index.js +82 -97
- package/Dropdown/index.js +3 -3
- package/DynamicMultiBox/index.js +219 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +66 -74
- package/FormItem/index.js +14 -15
- package/FunctionModal/index.js +7 -14
- package/GlobalContext/index.js +17 -20
- package/Help/index.js +9 -12
- package/HelperText/index.js +11 -11
- package/InputLang/index.js +104 -124
- package/InputNumber/index.js +62 -81
- package/Label/index.js +19 -21
- package/Loading/index.js +11 -10
- package/Menu/index.js +302 -371
- package/Message/index.js +105 -114
- package/Modal/index.js +122 -148
- package/MultiBox/index.d.ts +5 -0
- package/MultiBox/index.js +111 -115
- package/Notification/index.js +105 -103
- package/OperateBtn/index.d.ts +3 -0
- package/OperateBtn/index.js +77 -107
- package/PageHeader/index.js +327 -406
- package/Pagination/index.js +107 -137
- package/ParauiProvider/index.js +20 -22
- package/PasswordRules/index.js +36 -40
- package/PopConfirm/index.js +62 -79
- package/Popover/index.js +12 -12
- package/Progress/index.js +72 -74
- package/Querying/index.js +52 -59
- package/README.md +2 -0
- package/Radio/index.js +27 -34
- package/RadioGroup/index.js +38 -52
- package/Search/index.js +35 -44
- package/Select/index.js +323 -364
- package/SelectInput/index.js +8 -13
- package/Selector/index.js +905 -796
- package/SelectorPicker/index.js +111 -133
- package/SingleBox/index.d.ts +5 -0
- package/SingleBox/index.js +92 -88
- package/Slider/index.js +46 -57
- package/Status/index.js +14 -13
- package/Stepper/index.js +25 -26
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +767 -963
- package/Tabs/index.js +102 -102
- package/Tag/index.js +115 -162
- package/TextEditor/index.js +81 -103
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +27 -28
- package/Timeline/index.js +67 -58
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +53 -52
- package/Tooltip/index.js +79 -82
- package/Transfer/index.js +160 -203
- package/Tree/index.js +7 -12
- package/Upload/index.js +527 -759
- package/Upload/interface.d.ts +5 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-f48d5ce6.js → index-0ced30f7.js} +1128 -1080
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-56601c94.js → index-ef1235fb.js} +125 -134
- package/_verture/{index-de8f4428.js → index-f186b5e8.js} +315 -399
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-5df08980.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-8223a2ef.js} +15 -2
- package/_verture/{useFormatMessage-703f8b20.js → useFormatMessage-eb13cf56.js} +5 -4
- package/_verture/{useGlobalProps-1b846a65.js → useGlobalProps-1e416658.js} +4 -3
- package/_verture/{usePopupContainer-87febeb9.js → usePopupContainer-635f66f4.js} +16 -15
- package/_verture/{util-7e1fb1e2.js → util-82646c4f.js} +5 -4
- package/_verture/{utils-06d86594.js → utils-46e99c9a.js} +34 -26
- package/index.js +21 -22
- package/locale/index.js +10 -10
- package/package.json +1 -1
- package/umd/AutoBox.js +9 -8
- package/umd/AutoTips.js +9 -8
- package/umd/Badge.js +1 -1
- package/umd/Breadcrumbs.js +9 -8
- package/umd/Button.js +9 -8
- package/umd/ButtonGroup.js +9 -8
- package/umd/Carousel.js +5 -5
- package/umd/Cascader.js +9 -8
- package/umd/Checkbox.js +9 -8
- package/umd/CheckboxGroup.js +9 -8
- package/umd/Collapse.js +8 -7
- package/umd/CollapseBox.js +1 -1
- package/umd/CollapseLayout.js +4 -4
- package/umd/ColorPicker.js +1 -1
- package/umd/ComboSelect.js +9 -8
- package/umd/Container.js +1 -1
- package/umd/CopyText.js +9 -8
- package/umd/DatePicker.js +9 -8
- package/umd/Descriptions.js +9 -8
- package/umd/Desktop.js +9 -8
- package/umd/DragVerify.js +4 -4
- package/umd/Drawer.js +9 -8
- package/umd/Dropdown.js +6 -5
- package/umd/DynamicMultiBox.js +11 -10
- package/umd/Empty.js +1 -1
- package/umd/Form.js +9 -8
- package/umd/FormItem.js +9 -8
- package/umd/FunctionModal.js +9 -8
- package/umd/GlobalContext.js +1 -1
- package/umd/Help.js +9 -8
- package/umd/HelperText.js +1 -1
- package/umd/InputLang.js +9 -8
- package/umd/InputNumber.js +9 -8
- package/umd/Label.js +9 -8
- package/umd/Loading.js +4 -4
- package/umd/Menu.js +4 -4
- package/umd/Message.js +4 -4
- package/umd/Modal.js +9 -8
- package/umd/MultiBox.js +9 -8
- package/umd/Notification.js +8 -7
- package/umd/OperateBtn.js +9 -8
- package/umd/PageHeader.js +9 -8
- package/umd/Pagination.js +9 -8
- package/umd/ParauiProvider.js +1 -1
- package/umd/PasswordRules.js +4 -4
- package/umd/PopConfirm.js +9 -8
- package/umd/Popover.js +9 -8
- package/umd/Progress.js +5 -5
- package/umd/Querying.js +1 -1
- package/umd/Radio.js +9 -8
- package/umd/RadioGroup.js +9 -8
- package/umd/Search.js +9 -8
- package/umd/Select.js +9 -8
- package/umd/SelectInput.js +9 -8
- package/umd/Selector.js +9 -8
- package/umd/SelectorPicker.js +9 -8
- package/umd/SingleBox.js +9 -8
- package/umd/Slider.js +6 -5
- package/umd/Status.js +4 -4
- package/umd/Stepper.js +9 -8
- package/umd/Switch.js +9 -8
- package/umd/Table.js +9 -8
- package/umd/Tabs.js +9 -8
- package/umd/Tag.js +9 -8
- package/umd/TextEditor.js +22 -21
- package/umd/TextField.js +9 -8
- package/umd/TimePicker.js +9 -8
- package/umd/Timeline.js +1 -1
- package/umd/Title.js +9 -8
- package/umd/ToggleButton.js +9 -8
- package/umd/Tooltip.js +9 -8
- package/umd/Transfer.js +10 -9
- package/umd/Tree.js +9 -8
- package/umd/Upload.js +10 -9
- package/umd/locale.js +1 -1
- package/_verture/index-232d890b.js +0 -327
- package/_verture/index-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/toConsumableArray-8f4c9589.js +0 -19
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
package/Modal/index.js
CHANGED
|
@@ -1,88 +1,82 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-1d116156.js';
|
|
2
1
|
import { _ as __rest } from '../_verture/tslib.es6-55ed4bd2.js';
|
|
3
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
3
|
import React__default from 'react';
|
|
5
4
|
import Dialog from 'rc-dialog';
|
|
6
5
|
import { Button } from '../Button/index.js';
|
|
7
6
|
import CloseIcon from '@para-ui/icons/Close';
|
|
8
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
9
|
-
import { d as defaultModalLocale } from '../_verture/index-
|
|
7
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
8
|
+
import { d as defaultModalLocale } from '../_verture/index-c568f272.js';
|
|
10
9
|
import ReactDOM from 'react-dom';
|
|
11
10
|
import clsx from 'clsx';
|
|
12
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
11
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
13
12
|
import AutoTips from '../AutoTips/index.js';
|
|
14
13
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
15
|
-
import
|
|
14
|
+
import SuccessOutlined from '@para-ui/icons/CheckCircleF';
|
|
16
15
|
import WarningCircleF from '@para-ui/icons/WarningCircleF';
|
|
17
16
|
import CloseCircleF from '@para-ui/icons/CloseCircleF';
|
|
18
17
|
import { UUID } from '@paraview/lib';
|
|
19
18
|
import { getConfirmLocale } from '@para-ui/core/GlobalContext';
|
|
20
|
-
import '../_verture/typeof-adeedc13.js';
|
|
21
|
-
import '../_verture/slicedToArray-a8206399.js';
|
|
22
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
23
19
|
import '@para-ui/icons/LoadingF';
|
|
24
20
|
import '../Tooltip/index.js';
|
|
25
21
|
import 'rc-tooltip';
|
|
26
22
|
import 'rc-tooltip/lib/placements';
|
|
27
23
|
import '@para-ui/icons/Forbid';
|
|
28
24
|
import '@para-ui/icons/Down';
|
|
29
|
-
import '../_verture/index-
|
|
25
|
+
import '../_verture/index-da9097d3.js';
|
|
30
26
|
import 'rc-dropdown';
|
|
31
|
-
import '../_verture/usePopupContainer-
|
|
27
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
32
28
|
import 'dayjs';
|
|
33
29
|
|
|
34
30
|
var css_248z$1 = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2021/11/2 下午7:00\n* @description\n*/\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-confirm.paraui-v4-modal .paraui-v4-modal-body {\n padding: 0;\n}\n.paraui-v4-confirm .confirm-wrapper {\n width: 416px;\n outline: none;\n}\n.paraui-v4-confirm .confirm-content {\n position: relative;\n padding: 16px;\n border-radius: 8px;\n}\n.paraui-v4-confirm .confirm-content-close {\n position: absolute;\n top: 16px;\n right: 16px;\n border: none;\n}\n.paraui-v4-confirm .confirm-content-close svg {\n font-size: 18px;\n}\n.paraui-v4-confirm .confirm-content-icon {\n float: left;\n margin-top: 2px;\n color: rgb(255, 147, 38);\n}\n.paraui-v4-confirm .confirm-content-icon svg {\n font-size: 18px;\n color: inherit;\n}\n.paraui-v4-confirm .confirm-content-icon--warn, .paraui-v4-confirm .confirm-content-icon-warning {\n color: rgb(255, 147, 38);\n}\n.paraui-v4-confirm .confirm-content-icon--error {\n color: rgb(244, 66, 66);\n}\n.paraui-v4-confirm .confirm-content-icon--success {\n color: rgb(19, 191, 76);\n}\n.paraui-v4-confirm .confirm-content-icon--info {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-confirm .confirm-content-body {\n margin: 0 16px 0 26px;\n font-size: 14px;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-confirm .confirm-content-body .confirm-body-title {\n display: block;\n margin-bottom: 10px;\n font-size: 14px;\n font-weight: 700;\n}\n.paraui-v4-confirm .confirm-content-actions {\n margin-top: 12px;\n text-align: right;\n}\n.paraui-v4-confirm .confirm-content-actions > button + button {\n margin-left: 16px;\n}";
|
|
35
31
|
styleInject(css_248z$1);
|
|
36
32
|
|
|
37
33
|
//图标
|
|
38
|
-
|
|
39
|
-
success: jsx(
|
|
34
|
+
const iconMap = {
|
|
35
|
+
success: jsx(SuccessOutlined, {}),
|
|
40
36
|
warn: jsx(WarningCircleF, {}),
|
|
41
37
|
warning: jsx(WarningCircleF, {}),
|
|
42
38
|
error: jsx(CloseCircleF, {}),
|
|
43
39
|
info: jsx(WarningCircleF, {})
|
|
44
40
|
};
|
|
45
41
|
//confirm modal
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
_props$showActions = props.showActions,
|
|
68
|
-
showActions = _props$showActions === void 0 ? true : _props$showActions,
|
|
42
|
+
const ConfirmDialog = props => {
|
|
43
|
+
const {
|
|
44
|
+
type = 'warning',
|
|
45
|
+
title,
|
|
46
|
+
content,
|
|
47
|
+
icon,
|
|
48
|
+
okText,
|
|
49
|
+
cancelText,
|
|
50
|
+
onOk,
|
|
51
|
+
onCancel,
|
|
52
|
+
className,
|
|
53
|
+
showCancel = true,
|
|
54
|
+
closable = false,
|
|
55
|
+
okButtonProps,
|
|
56
|
+
cancelButtonProps,
|
|
57
|
+
resolveFn,
|
|
58
|
+
callback,
|
|
59
|
+
destroy,
|
|
60
|
+
actions,
|
|
61
|
+
showActions = true
|
|
62
|
+
} = props,
|
|
69
63
|
restProps = __rest(props, ["type", "title", "content", "icon", "okText", "cancelText", "onOk", "onCancel", "className", "showCancel", "closable", "okButtonProps", "cancelButtonProps", "resolveFn", "callback", "destroy", "actions", "showActions"]);
|
|
70
|
-
|
|
64
|
+
const prefixCls = "".concat($prefixCls, "-confirm");
|
|
71
65
|
//取消
|
|
72
|
-
|
|
66
|
+
const handleCancel = () => {
|
|
73
67
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
74
68
|
resolveFn === null || resolveFn === void 0 ? void 0 : resolveFn(false);
|
|
75
69
|
destroy === null || destroy === void 0 ? void 0 : destroy();
|
|
76
70
|
};
|
|
77
71
|
//确认
|
|
78
|
-
|
|
72
|
+
const handleOk = () => {
|
|
79
73
|
onOk === null || onOk === void 0 ? void 0 : onOk();
|
|
80
74
|
resolveFn === null || resolveFn === void 0 ? void 0 : resolveFn(true);
|
|
81
75
|
callback === null || callback === void 0 ? void 0 : callback();
|
|
82
76
|
destroy === null || destroy === void 0 ? void 0 : destroy();
|
|
83
77
|
};
|
|
84
78
|
//render actions
|
|
85
|
-
|
|
79
|
+
const renderActions = () => {
|
|
86
80
|
if (!showActions) return null;
|
|
87
81
|
if (actions) {
|
|
88
82
|
return jsx("div", Object.assign({
|
|
@@ -158,16 +152,16 @@ var ConfirmDialog = function ConfirmDialog(props) {
|
|
|
158
152
|
}));
|
|
159
153
|
};
|
|
160
154
|
//销毁方法map
|
|
161
|
-
|
|
155
|
+
const $destroyFnsMap = new Map();
|
|
162
156
|
//confirm
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
157
|
+
const confirm = (props, resolveFn, callback) => {
|
|
158
|
+
const box = document.createElement('div');
|
|
159
|
+
const uuid = props.uuid || UUID();
|
|
166
160
|
if (props.uuid) box.setAttribute('data-confirm-cid', props.uuid);
|
|
167
161
|
document.body.appendChild(box);
|
|
168
162
|
//销毁组件
|
|
169
|
-
|
|
170
|
-
|
|
163
|
+
const destroy = () => {
|
|
164
|
+
const unmountResult = ReactDOM.unmountComponentAtNode(box);
|
|
171
165
|
if (unmountResult && box.parentNode) {
|
|
172
166
|
box.parentNode.removeChild(box);
|
|
173
167
|
}
|
|
@@ -175,9 +169,9 @@ var confirm = function confirm(props, resolveFn, callback) {
|
|
|
175
169
|
};
|
|
176
170
|
$destroyFnsMap.set(uuid, destroy);
|
|
177
171
|
//渲染组件
|
|
178
|
-
setTimeout(
|
|
172
|
+
setTimeout(() => {
|
|
179
173
|
var _a, _b;
|
|
180
|
-
|
|
174
|
+
const runtimeLocale = getConfirmLocale();
|
|
181
175
|
ReactDOM.render(jsx(ConfirmDialog, Object.assign({}, props, {
|
|
182
176
|
okText: (_a = props.okText) !== null && _a !== void 0 ? _a : runtimeLocale.ok,
|
|
183
177
|
cancelText: (_b = props.cancelText) !== null && _b !== void 0 ? _b : runtimeLocale.cancel,
|
|
@@ -189,44 +183,36 @@ var confirm = function confirm(props, resolveFn, callback) {
|
|
|
189
183
|
});
|
|
190
184
|
};
|
|
191
185
|
//promise factory
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
type
|
|
186
|
+
const promiseFactory = (config, type, callback) => {
|
|
187
|
+
let opts = {
|
|
188
|
+
type
|
|
195
189
|
};
|
|
196
190
|
if (typeof config === 'string') opts.content = config;else opts = Object.assign(Object.assign({}, config), {
|
|
197
|
-
type
|
|
191
|
+
type
|
|
198
192
|
});
|
|
199
|
-
return new Promise(
|
|
193
|
+
return new Promise(resolve => {
|
|
200
194
|
confirm(opts, resolve, callback);
|
|
201
195
|
});
|
|
202
196
|
};
|
|
203
197
|
//销毁弹框
|
|
204
|
-
|
|
198
|
+
const destroyAllConfirm = uuid => {
|
|
205
199
|
if (uuid) {
|
|
206
|
-
|
|
200
|
+
const close = $destroyFnsMap.get(uuid);
|
|
207
201
|
if (close) close();
|
|
208
202
|
$destroyFnsMap.delete(uuid);
|
|
209
203
|
return;
|
|
210
204
|
}
|
|
211
|
-
$destroyFnsMap.forEach(
|
|
205
|
+
$destroyFnsMap.forEach(close => {
|
|
212
206
|
if (close) close();
|
|
213
207
|
});
|
|
214
208
|
$destroyFnsMap.clear();
|
|
215
209
|
};
|
|
216
210
|
//confirm 方法对象
|
|
217
|
-
|
|
218
|
-
info:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return promiseFactory(config, 'warn', callback);
|
|
223
|
-
},
|
|
224
|
-
error: function error(config, callback) {
|
|
225
|
-
return promiseFactory(config, 'error', callback);
|
|
226
|
-
},
|
|
227
|
-
success: function success(config, callback) {
|
|
228
|
-
return promiseFactory(config, 'success', callback);
|
|
229
|
-
},
|
|
211
|
+
const Confirm = {
|
|
212
|
+
info: (config, callback) => promiseFactory(config, 'info', callback),
|
|
213
|
+
warn: (config, callback) => promiseFactory(config, 'warn', callback),
|
|
214
|
+
error: (config, callback) => promiseFactory(config, 'error', callback),
|
|
215
|
+
success: (config, callback) => promiseFactory(config, 'success', callback),
|
|
230
216
|
destroyAll: destroyAllConfirm
|
|
231
217
|
};
|
|
232
218
|
|
|
@@ -234,13 +220,13 @@ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/6/13 下
|
|
|
234
220
|
styleInject(css_248z);
|
|
235
221
|
|
|
236
222
|
//鼠标位置内部使用
|
|
237
|
-
|
|
238
|
-
|
|
223
|
+
let mousePosition;
|
|
224
|
+
const getClickPosition = e => {
|
|
239
225
|
mousePosition = {
|
|
240
226
|
x: e.pageX,
|
|
241
227
|
y: e.pageY
|
|
242
228
|
};
|
|
243
|
-
setTimeout(
|
|
229
|
+
setTimeout(() => {
|
|
244
230
|
mousePosition = null;
|
|
245
231
|
}, 100);
|
|
246
232
|
};
|
|
@@ -249,64 +235,53 @@ if (window.document.documentElement) {
|
|
|
249
235
|
document.documentElement.addEventListener('click', getClickPosition, true);
|
|
250
236
|
}
|
|
251
237
|
//Modal
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
bodyStyle = props.bodyStyle,
|
|
283
|
-
contentWidth = props.contentWidth,
|
|
284
|
-
contentHeight = props.contentHeight,
|
|
285
|
-
contentStyle = props.contentStyle,
|
|
286
|
-
_props$size = props.size,
|
|
287
|
-
size = _props$size === void 0 ? 'md' : _props$size,
|
|
288
|
-
children = props.children,
|
|
289
|
-
_props$closable = props.closable,
|
|
290
|
-
closable = _props$closable === void 0 ? true : _props$closable,
|
|
291
|
-
_props$mask = props.mask,
|
|
292
|
-
mask = _props$mask === void 0 ? true : _props$mask,
|
|
238
|
+
const Modal = props => {
|
|
239
|
+
const {
|
|
240
|
+
open,
|
|
241
|
+
visible = false,
|
|
242
|
+
closeIcon,
|
|
243
|
+
centered = true,
|
|
244
|
+
focusTriggerAfterClose = true,
|
|
245
|
+
title,
|
|
246
|
+
footer,
|
|
247
|
+
showActions = true,
|
|
248
|
+
actions,
|
|
249
|
+
header,
|
|
250
|
+
hideHeader = false,
|
|
251
|
+
showCancel = true,
|
|
252
|
+
maskClosable = false,
|
|
253
|
+
disableBackdropClick = true,
|
|
254
|
+
keyboard = false,
|
|
255
|
+
disableEscapeKeyDown = true,
|
|
256
|
+
fullScreen,
|
|
257
|
+
customizeSize,
|
|
258
|
+
style,
|
|
259
|
+
bodyStyle,
|
|
260
|
+
contentWidth,
|
|
261
|
+
contentHeight,
|
|
262
|
+
contentStyle,
|
|
263
|
+
size = 'md',
|
|
264
|
+
children,
|
|
265
|
+
closable = true,
|
|
266
|
+
mask = true
|
|
267
|
+
} = props,
|
|
293
268
|
restProps = __rest(props, ["open", "visible", "closeIcon", "centered", "focusTriggerAfterClose", "title", "footer", "showActions", "actions", "header", "hideHeader", "showCancel", "maskClosable", "disableBackdropClick", "keyboard", "disableEscapeKeyDown", "fullScreen", "customizeSize", "style", "bodyStyle", "contentWidth", "contentHeight", "contentStyle", "size", "children", "closable", "mask"]);
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
269
|
+
const isFullScreen = fullScreen || size === 'fullScreen'; //是否全屏
|
|
270
|
+
const intl = useFormatMessage('Modal', defaultModalLocale);
|
|
271
|
+
const prefixCls = "".concat($prefixCls, "-modal");
|
|
297
272
|
//关闭回调
|
|
298
|
-
|
|
273
|
+
const handleCancel = e => {
|
|
299
274
|
var _a;
|
|
300
275
|
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
301
276
|
};
|
|
302
277
|
//确定回调
|
|
303
|
-
|
|
278
|
+
const handleOk = e => {
|
|
304
279
|
var _a;
|
|
305
280
|
(_a = props.onOk) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
306
281
|
};
|
|
307
282
|
//modal size class
|
|
308
|
-
|
|
309
|
-
|
|
283
|
+
const makeSizeCls = () => {
|
|
284
|
+
const sizeMap = {
|
|
310
285
|
sm: "".concat(prefixCls, "-sm"),
|
|
311
286
|
md: "".concat(prefixCls, "-md"),
|
|
312
287
|
lg: "".concat(prefixCls, "-lg"),
|
|
@@ -317,16 +292,16 @@ var Modal = function Modal(props) {
|
|
|
317
292
|
if (isFullScreen) return sizeMap['fullScreen'];
|
|
318
293
|
return sizeMap[size];
|
|
319
294
|
};
|
|
320
|
-
|
|
295
|
+
const getModalCls = () => {
|
|
321
296
|
if (mask) return "".concat(prefixCls, "-with-mask");
|
|
322
297
|
return "".concat(prefixCls, "-without-mask");
|
|
323
298
|
};
|
|
324
299
|
//自定义样式
|
|
325
|
-
|
|
300
|
+
const getCStyle = () => {
|
|
326
301
|
return Object.assign(Object.assign({}, customizeSize), style);
|
|
327
302
|
};
|
|
328
303
|
//自定义内容样式
|
|
329
|
-
|
|
304
|
+
const getContentStyle = () => {
|
|
330
305
|
return Object.assign(Object.assign({
|
|
331
306
|
maxHeight: 478,
|
|
332
307
|
minHeight: 118,
|
|
@@ -335,11 +310,11 @@ var Modal = function Modal(props) {
|
|
|
335
310
|
}, bodyStyle), contentStyle);
|
|
336
311
|
};
|
|
337
312
|
//header
|
|
338
|
-
|
|
313
|
+
const renderHeader = () => {
|
|
339
314
|
if (hideHeader) return null;
|
|
340
315
|
if (header) return header;
|
|
341
316
|
//
|
|
342
|
-
|
|
317
|
+
const closeNode = closable && jsx(Button.IconButton, Object.assign({
|
|
343
318
|
onClick: handleCancel,
|
|
344
319
|
className: "".concat(prefixCls, "-close"),
|
|
345
320
|
variant: 'outlined',
|
|
@@ -358,15 +333,16 @@ var Modal = function Modal(props) {
|
|
|
358
333
|
});
|
|
359
334
|
};
|
|
360
335
|
//footer
|
|
361
|
-
|
|
336
|
+
const renderFooter = () => {
|
|
362
337
|
if (!showActions) return null;
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
confirmLoading =
|
|
369
|
-
|
|
338
|
+
const {
|
|
339
|
+
okText,
|
|
340
|
+
cancelText,
|
|
341
|
+
okButtonProps,
|
|
342
|
+
cancelButtonProps,
|
|
343
|
+
confirmLoading = false
|
|
344
|
+
} = props;
|
|
345
|
+
const okBtn = jsx(Button, Object.assign({
|
|
370
346
|
variant: "contained",
|
|
371
347
|
size: "large",
|
|
372
348
|
loading: confirmLoading,
|
|
@@ -376,7 +352,7 @@ var Modal = function Modal(props) {
|
|
|
376
352
|
id: 'ok'
|
|
377
353
|
})
|
|
378
354
|
}));
|
|
379
|
-
|
|
355
|
+
const cancelBtn = showCancel && jsx(Button, Object.assign({
|
|
380
356
|
variant: "outlined",
|
|
381
357
|
size: "large",
|
|
382
358
|
onClick: handleCancel
|
|
@@ -385,32 +361,30 @@ var Modal = function Modal(props) {
|
|
|
385
361
|
id: 'cancel'
|
|
386
362
|
})
|
|
387
363
|
}));
|
|
388
|
-
|
|
389
|
-
|
|
364
|
+
const buttons = [cancelBtn, okBtn];
|
|
365
|
+
const tActions = actions !== null && actions !== void 0 ? actions : footer;
|
|
390
366
|
if (typeof tActions === 'function') {
|
|
391
|
-
|
|
367
|
+
const btns = tActions(buttons);
|
|
392
368
|
return jsx(Fragment, {
|
|
393
|
-
children: Array.isArray(btns) ? btns.map(
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}, idx);
|
|
397
|
-
}) : btns
|
|
369
|
+
children: Array.isArray(btns) ? btns.map((btn, idx) => jsx(React__default.Fragment, {
|
|
370
|
+
children: btn
|
|
371
|
+
}, idx)) : btns
|
|
398
372
|
});
|
|
399
373
|
} else if (tActions) {
|
|
400
374
|
return tActions;
|
|
401
375
|
}
|
|
402
376
|
return jsx(Fragment, {
|
|
403
|
-
children: buttons.map(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}, idx);
|
|
407
|
-
})
|
|
377
|
+
children: buttons.map((btn, idx) => jsx(React__default.Fragment, {
|
|
378
|
+
children: btn
|
|
379
|
+
}, idx))
|
|
408
380
|
});
|
|
409
381
|
};
|
|
410
382
|
//wrap cls
|
|
411
|
-
|
|
383
|
+
const makeWrapClassName = clsx(props.wrapClassName, {
|
|
384
|
+
["".concat(prefixCls, "-centered")]: centered
|
|
385
|
+
});
|
|
412
386
|
//modal cls
|
|
413
|
-
|
|
387
|
+
const makeModalClassName = clsx(props.className, "".concat($prefixCls, "-scrollbar-small"), makeSizeCls(), getModalCls());
|
|
414
388
|
return jsx(Dialog, Object.assign({}, restProps, {
|
|
415
389
|
mask: mask,
|
|
416
390
|
visible: open !== null && open !== void 0 ? open : visible,
|
package/MultiBox/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import React, { FunctionComponent, ReactNode } from 'react';
|
|
|
7
7
|
import { TextFieldProps } from '../TextField';
|
|
8
8
|
import { LabelTooltipProps } from '../Label';
|
|
9
9
|
import { HelperTextDetailProps } from '../HelperText';
|
|
10
|
+
import { TooltipProps } from "../Tooltip";
|
|
10
11
|
import './index.scss';
|
|
11
12
|
interface ReplaceFieldsProps {
|
|
12
13
|
/** key索引 */
|
|
@@ -37,6 +38,10 @@ export interface MultiBoxProps extends HelperTextDetailProps {
|
|
|
37
38
|
disabled?: boolean | {
|
|
38
39
|
[name: string]: boolean;
|
|
39
40
|
}[];
|
|
41
|
+
/**
|
|
42
|
+
* 禁用提示
|
|
43
|
+
*/
|
|
44
|
+
disabledTooltip?: TooltipProps;
|
|
40
45
|
/** 是否必填 */
|
|
41
46
|
required?: boolean;
|
|
42
47
|
/** 默认值 不受控 */
|