@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/DynamicMultiBox/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { _ as _defineProperty } from '../_verture/defineProperty-1d116156.js';
|
|
2
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
|
|
3
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
4
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
2
|
import React__default, { useState, useRef, useEffect, useMemo } from 'react';
|
|
6
3
|
import { Popover } from '../Popover/index.js';
|
|
@@ -21,29 +18,27 @@ import DatePicker from '../DatePicker/index.js';
|
|
|
21
18
|
import AutoTips from '../AutoTips/index.js';
|
|
22
19
|
import { UUID } from '@paraview/lib';
|
|
23
20
|
import { s as sortable_esm } from '../_verture/sortable.esm-49896035.js';
|
|
24
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
25
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
21
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
22
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
26
23
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
27
|
-
import '../
|
|
28
|
-
import '../_verture/
|
|
29
|
-
import '../Tooltip/index.js';
|
|
30
|
-
import 'rc-tooltip';
|
|
31
|
-
import 'rc-tooltip/lib/placements';
|
|
24
|
+
import { Tooltip } from '../Tooltip/index.js';
|
|
25
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
32
26
|
import 'clsx';
|
|
33
|
-
import '@para-ui/icons/Forbid';
|
|
34
|
-
import '../_verture/usePopupContainer-87febeb9.js';
|
|
35
27
|
import '../Help/index.js';
|
|
36
28
|
import '@para-ui/icons/Help';
|
|
37
29
|
import '../Checkbox/index.js';
|
|
30
|
+
import 'rc-tooltip';
|
|
31
|
+
import 'rc-tooltip/lib/placements';
|
|
32
|
+
import '@para-ui/icons/Forbid';
|
|
38
33
|
import '../HelperText/index.js';
|
|
39
34
|
import '@para-ui/icons/PreviewClose';
|
|
40
35
|
import '@para-ui/icons/PreviewOpen';
|
|
41
36
|
import '@para-ui/icons/CloseCircleF';
|
|
42
37
|
import '../Loading/index.js';
|
|
43
38
|
import '@para-ui/icons/LoadingF';
|
|
44
|
-
import '../_verture/useGlobalProps-
|
|
39
|
+
import '../_verture/useGlobalProps-1e416658.js';
|
|
45
40
|
import '@para-ui/core/GlobalContext';
|
|
46
|
-
import '../_verture/index-
|
|
41
|
+
import '../_verture/index-da9097d3.js';
|
|
47
42
|
import 'rc-dropdown';
|
|
48
43
|
import 'dayjs';
|
|
49
44
|
import '../Empty/index.js';
|
|
@@ -56,8 +51,6 @@ import 'rc-input-number';
|
|
|
56
51
|
import '@para-ui/icons/Up';
|
|
57
52
|
import '../MultiBox/index.js';
|
|
58
53
|
import '@para-ui/icons/Internet';
|
|
59
|
-
import '../_verture/index-232d890b.js';
|
|
60
|
-
import '../_verture/typeof-c310ee4a.js';
|
|
61
54
|
import '../Table/index.js';
|
|
62
55
|
import '../Button/index.js';
|
|
63
56
|
import '@para-ui/icons/ScreenF';
|
|
@@ -66,6 +59,10 @@ import '@para-ui/icons/DownTriangleF';
|
|
|
66
59
|
import '../Radio/index.js';
|
|
67
60
|
import '../OperateBtn/index.js';
|
|
68
61
|
import '@para-ui/icons/More';
|
|
62
|
+
import '../PopConfirm/index.js';
|
|
63
|
+
import '@para-ui/icons/CheckCircleF';
|
|
64
|
+
import '@para-ui/icons/WarningCircle';
|
|
65
|
+
import '@para-ui/icons/WarningCircleF';
|
|
69
66
|
import '@para-ui/icons/Refresh';
|
|
70
67
|
import '../Pagination/index.js';
|
|
71
68
|
import '@para-ui/icons/Left';
|
|
@@ -73,20 +70,23 @@ import 'rc-pagination';
|
|
|
73
70
|
import '@para-ui/icons/Right';
|
|
74
71
|
import '@para-ui/icons/DoubleLeft';
|
|
75
72
|
import '@para-ui/icons/DoubleRight';
|
|
76
|
-
import '../_verture/index-
|
|
73
|
+
import '../_verture/index-f186b5e8.js';
|
|
77
74
|
import 'rc-tree';
|
|
75
|
+
import '../_verture/typeof-adeedc13.js';
|
|
78
76
|
import '@para-ui/icons/Document';
|
|
77
|
+
import '../_verture/slicedToArray-8223a2ef.js';
|
|
79
78
|
import 'react-dom';
|
|
80
79
|
import '@para-ui/icons/EditFile';
|
|
81
80
|
import '@para-ui/icons/PlusCircle';
|
|
82
81
|
import '@para-ui/icons/MoreCircle';
|
|
83
|
-
import '../_verture/utils-
|
|
82
|
+
import '../_verture/utils-46e99c9a.js';
|
|
84
83
|
import '../Search/index.js';
|
|
85
84
|
import 'rc-picker/es/generate/dayjs';
|
|
86
85
|
import '../Tag/index.js';
|
|
87
86
|
import '@para-ui/icons/EditOutline';
|
|
88
87
|
import '../_verture/tinycolor-ece3542d.js';
|
|
89
88
|
import '@para-ui/icons/Plus';
|
|
89
|
+
import '../_verture/defineProperty-1d116156.js';
|
|
90
90
|
import 'rc-picker';
|
|
91
91
|
import '@para-ui/icons/Calendar';
|
|
92
92
|
import '@para-ui/icons/Time';
|
|
@@ -134,8 +134,10 @@ var FormItem = function FormItem(props) {
|
|
|
134
134
|
_a.isFixed;
|
|
135
135
|
_a.selected;
|
|
136
136
|
var text = _a.text,
|
|
137
|
-
|
|
137
|
+
otherProps = _a.otherProps,
|
|
138
|
+
rest = __rest(_a, ["name", "inputType", "customRender", "rowIndex", "id", "list", "isDisabled", "isFixed", "selected", "text", "otherProps"]);
|
|
138
139
|
var disabled = typeof isDisabled === 'function' ? isDisabled(rowIndex, name, valueList) : isDisabled;
|
|
140
|
+
var otherPropsCom = otherProps && otherProps(rowIndex, name, valueList);
|
|
139
141
|
var getComponent = function getComponent() {
|
|
140
142
|
switch (inputType) {
|
|
141
143
|
case 'TextField':
|
|
@@ -186,7 +188,7 @@ var FormItem = function FormItem(props) {
|
|
|
186
188
|
onChange: function onChange(e) {
|
|
187
189
|
return inputChange(e.target.value);
|
|
188
190
|
}
|
|
189
|
-
}));
|
|
191
|
+
}, otherPropsCom));
|
|
190
192
|
};
|
|
191
193
|
/**
|
|
192
194
|
* @description: 返回下拉框组件
|
|
@@ -205,7 +207,7 @@ var FormItem = function FormItem(props) {
|
|
|
205
207
|
getPopupContainer: function getPopupContainer() {
|
|
206
208
|
return document.body;
|
|
207
209
|
}
|
|
208
|
-
}));
|
|
210
|
+
}, otherPropsCom));
|
|
209
211
|
};
|
|
210
212
|
/**
|
|
211
213
|
* @description: 返回开关组件
|
|
@@ -232,7 +234,7 @@ var FormItem = function FormItem(props) {
|
|
|
232
234
|
onChange: function onChange(checked) {
|
|
233
235
|
return inputChange(checked);
|
|
234
236
|
}
|
|
235
|
-
}))
|
|
237
|
+
}, otherPropsCom))
|
|
236
238
|
}))]
|
|
237
239
|
}));
|
|
238
240
|
};
|
|
@@ -248,7 +250,7 @@ var FormItem = function FormItem(props) {
|
|
|
248
250
|
onChange: function onChange(value) {
|
|
249
251
|
return inputChange(value);
|
|
250
252
|
}
|
|
251
|
-
}));
|
|
253
|
+
}, otherPropsCom));
|
|
252
254
|
};
|
|
253
255
|
/**
|
|
254
256
|
* @description: 返回国际化输入框
|
|
@@ -261,7 +263,7 @@ var FormItem = function FormItem(props) {
|
|
|
261
263
|
onChange: function onChange(value) {
|
|
262
264
|
return inputChange(value);
|
|
263
265
|
}
|
|
264
|
-
}));
|
|
266
|
+
}, otherPropsCom));
|
|
265
267
|
};
|
|
266
268
|
/**
|
|
267
269
|
* @description: 返回日期选择框组件
|
|
@@ -276,7 +278,7 @@ var FormItem = function FormItem(props) {
|
|
|
276
278
|
getPopupContainer: function getPopupContainer() {
|
|
277
279
|
return document.body;
|
|
278
280
|
}
|
|
279
|
-
}));
|
|
281
|
+
}, otherPropsCom));
|
|
280
282
|
};
|
|
281
283
|
/**
|
|
282
284
|
* @description: 返回组合选择器下拉框
|
|
@@ -290,7 +292,7 @@ var FormItem = function FormItem(props) {
|
|
|
290
292
|
onChange: function onChange(options) {
|
|
291
293
|
return inputChange(options);
|
|
292
294
|
}
|
|
293
|
-
}));
|
|
295
|
+
}, otherPropsCom));
|
|
294
296
|
};
|
|
295
297
|
/**
|
|
296
298
|
* @description: 返回自定义组件
|
|
@@ -306,48 +308,48 @@ var FormItem = function FormItem(props) {
|
|
|
306
308
|
});
|
|
307
309
|
};
|
|
308
310
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
rowKey =
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
rowIndex = props.rowIndex,
|
|
321
|
-
icon = props.icon;
|
|
311
|
+
const RowForm = props => {
|
|
312
|
+
const {
|
|
313
|
+
rowKey = 'id',
|
|
314
|
+
valueList = [],
|
|
315
|
+
rowError,
|
|
316
|
+
errors = [],
|
|
317
|
+
onFormItemChange,
|
|
318
|
+
config = [],
|
|
319
|
+
rowIndex,
|
|
320
|
+
icon
|
|
321
|
+
} = props;
|
|
322
322
|
/**
|
|
323
323
|
* @desc 回调
|
|
324
324
|
* @param id 表单所处行中的id
|
|
325
325
|
* @param value 表单值
|
|
326
326
|
* @param name 表单名
|
|
327
327
|
* */
|
|
328
|
-
|
|
328
|
+
const onChange = (id, value, name) => {
|
|
329
329
|
onFormItemChange && onFormItemChange(name, id, value);
|
|
330
330
|
};
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
const handStyle = style => {
|
|
332
|
+
const obj = Object.assign({}, style);
|
|
333
333
|
if (!(style === null || style === void 0 ? void 0 : style.width) && !(style === null || style === void 0 ? void 0 : style.flex)) obj.flex = 1;
|
|
334
334
|
return obj;
|
|
335
335
|
};
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
const renderFormItem = () => {
|
|
337
|
+
const rowValue = valueList === null || valueList === void 0 ? void 0 : valueList[rowIndex];
|
|
338
|
+
const len = config === null || config === void 0 ? void 0 : config.length;
|
|
339
339
|
return jsx(Fragment, {
|
|
340
|
-
children: (config === null || config === void 0 ? void 0 : config.length) > 0 && config.map(
|
|
341
|
-
|
|
340
|
+
children: (config === null || config === void 0 ? void 0 : config.length) > 0 && config.map((data, index) => {
|
|
341
|
+
const {
|
|
342
|
+
style
|
|
343
|
+
} = data,
|
|
342
344
|
othersData = __rest(data, ["style"]);
|
|
343
|
-
|
|
344
|
-
rowIndex
|
|
345
|
+
const formItemProps = (data === null || data === void 0 ? void 0 : data.inputType) !== 'Switch' ? Object.assign({
|
|
346
|
+
rowIndex,
|
|
345
347
|
id: rowValue[rowKey],
|
|
346
348
|
value: rowValue === null || rowValue === void 0 ? void 0 : rowValue[data.name || ''],
|
|
347
349
|
error: !!(rowError === null || rowError === void 0 ? void 0 : rowError[data.name || '']),
|
|
348
350
|
helperText: rowError === null || rowError === void 0 ? void 0 : rowError[data.name || '']
|
|
349
351
|
}, othersData) : Object.assign({
|
|
350
|
-
rowIndex
|
|
352
|
+
rowIndex,
|
|
351
353
|
id: rowValue[rowKey],
|
|
352
354
|
checked: rowValue === null || rowValue === void 0 ? void 0 : rowValue[data.name || '']
|
|
353
355
|
}, othersData);
|
|
@@ -359,9 +361,7 @@ var RowForm = function RowForm(props) {
|
|
|
359
361
|
valueList: valueList,
|
|
360
362
|
errors: errors,
|
|
361
363
|
formItemProps: formItemProps,
|
|
362
|
-
onChange:
|
|
363
|
-
return _onChange(id, value, (data === null || data === void 0 ? void 0 : data.name) || '');
|
|
364
|
-
}
|
|
364
|
+
onChange: (id, value) => onChange(id, value, (data === null || data === void 0 ? void 0 : data.name) || '')
|
|
365
365
|
}), index !== len - 1 && icon && jsx("div", Object.assign({
|
|
366
366
|
className: 'form-item-icon'
|
|
367
367
|
}, {
|
|
@@ -925,98 +925,79 @@ var zh = {
|
|
|
925
925
|
};
|
|
926
926
|
|
|
927
927
|
var localeJson = {
|
|
928
|
-
zh
|
|
929
|
-
en
|
|
928
|
+
zh,
|
|
929
|
+
en
|
|
930
930
|
};
|
|
931
931
|
|
|
932
932
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-dynamic-multi-box {\n width: 100%;\n}\n.paraui-v4-dynamic-multi-box svg {\n overflow: hidden;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content {\n width: 100%;\n position: relative;\n overflow-x: auto;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .title-config {\n width: 100%;\n display: flex;\n align-items: center;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .title-config .title-config-row {\n display: flex;\n flex: 1;\n align-items: center;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .title-config .title-config-row .title-config-row-item {\n display: flex;\n align-items: center;\n min-width: 180px;\n margin-right: 10px;\n flex-shrink: 0;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .title-config .title-config-row .row-form-switch {\n flex: 0;\n min-width: 80px;\n align-items: center;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 {\n width: 32px;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon-panel {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 32px;\n cursor: pointer;\n margin-right: 4px;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon-panel .svg-box {\n height: 24px;\n width: 24px;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgb(247, 248, 250);\n border-radius: 2px;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon-panel .svg-box svg {\n font-size: 20px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon-panel .svg-box svg:hover {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 32px;\n height: 32px;\n cursor: pointer;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon svg {\n font-size: 20px;\n color: rgb(92, 101, 115);\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon:hover {\n background: rgb(247, 248, 250);\n border-radius: 4px;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .operator-column-icon:hover svg {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .hidden-icon {\n display: none;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-40 .center-line {\n width: 1px;\n height: 12px;\n background-color: rgb(212, 218, 227);\n margin: 0 3px;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .operator-column-80 {\n width: 72px;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .content-row-form {\n width: 100%;\n display: flex;\n align-items: flex-start;\n min-height: 42px;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .content-row-form .paraui-v4-select {\n overflow: hidden;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .content-row-form .form-item {\n display: flex;\n align-items: flex-start;\n min-width: 180px;\n margin-right: 10px;\n flex-shrink: 0;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .content-row-form .form-item-icon {\n margin-left: 10px;\n}\n.paraui-v4-dynamic-multi-box .multi-value-content .content-row-form .row-form-switch {\n flex: 0;\n box-sizing: content-box;\n align-items: center;\n height: 32px;\n min-width: 80px;\n}\n.paraui-v4-dynamic-multi-box .add-button {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 32px;\n background: rgb(247, 248, 250);\n border: 1px dashed rgb(212, 218, 227);\n border-radius: 4px;\n}\n.paraui-v4-dynamic-multi-box .add-button .text {\n font-size: 14px;\n margin-left: 4px;\n}\n.paraui-v4-dynamic-multi-box .add-button.add-button-scroll {\n margin-top: 14px;\n}\n.paraui-v4-dynamic-multi-box .add-button.normal-button {\n cursor: pointer;\n}\n.paraui-v4-dynamic-multi-box .add-button.normal-button .text {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-dynamic-multi-box .add-button.normal-button:hover {\n background: rgb(240, 245, 255);\n border: 1px dashed rgb(87, 131, 235);\n}\n.paraui-v4-dynamic-multi-box .add-button.disabled-add {\n cursor: not-allowed;\n}\n.paraui-v4-dynamic-multi-box .add-button.disabled-add .text {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-dynamic-multi-box .add-button.disabled-add svg {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-dynamic-multi-box .paraui-v4-comboselect,\n.paraui-v4-dynamic-multi-box .paraui-v4-picker-wrapper {\n width: 100%;\n}\n.paraui-v4-dynamic-multi-box .multi-value-switch {\n width: 100%;\n display: flex;\n align-items: center;\n}\n.paraui-v4-dynamic-multi-box .multi-value-switch .switch-text {\n color: rgb(161, 168, 179);\n margin-right: 4px;\n overflow: hidden;\n}\n.paraui-v4-dynamic-multi-box .multi-value-switch .switch {\n flex: 1;\n}\n\n.paraui-v4-dynamic-multi-box-popover .filter-config {\n width: 140px;\n padding-top: 4px;\n}\n.paraui-v4-dynamic-multi-box-popover .filter-config .check-list .title {\n font-size: 12px;\n color: rgb(161, 168, 179);\n line-height: 30px;\n padding: 0 10px;\n}\n.paraui-v4-dynamic-multi-box-popover .filter-config .check-list .paraui-v4-checkbox-group {\n max-height: 320px;\n overflow-y: auto;\n}\n.paraui-v4-dynamic-multi-box-popover .filter-config .check-list .paraui-v4-checkbox-group.paraui-v4-checkbox-group-column .checkbox-group-content > span {\n padding: 0 10px;\n margin-bottom: 0;\n line-height: 30px;\n}\n.paraui-v4-dynamic-multi-box-popover .filter-config .restore-default {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 36px;\n color: rgb(46, 101, 230);\n cursor: pointer;\n border-top: 1px solid rgb(247, 248, 250);\n}\n.paraui-v4-dynamic-multi-box-popover .no-other-property {\n width: 200px;\n padding: 16px 0;\n text-align: center;\n font-size: 12px;\n color: rgb(161, 168, 179);\n}";
|
|
933
933
|
styleInject(css_248z);
|
|
934
934
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
rowKey =
|
|
938
|
-
valueList
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
970
|
-
checked = _useState2[0],
|
|
971
|
-
setChecked = _useState2[1];
|
|
972
|
-
var domRef = useRef(null);
|
|
973
|
-
var panelRef = useRef(null);
|
|
974
|
-
var _useState3 = useState([]),
|
|
975
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
976
|
-
fixedConfig = _useState4[0],
|
|
977
|
-
setFixedConfig = _useState4[1];
|
|
978
|
-
var _useState5 = useState([]),
|
|
979
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
980
|
-
selectedConfig = _useState6[0],
|
|
981
|
-
setSelectedConfig = _useState6[1];
|
|
982
|
-
var constData = useRef({});
|
|
983
|
-
useEffect(function () {
|
|
935
|
+
const DynamicMultiBox = props => {
|
|
936
|
+
const {
|
|
937
|
+
rowKey = 'id',
|
|
938
|
+
valueList,
|
|
939
|
+
config = [],
|
|
940
|
+
errors = [],
|
|
941
|
+
isSort = false,
|
|
942
|
+
isFilter = false,
|
|
943
|
+
className,
|
|
944
|
+
disabledAdd = false,
|
|
945
|
+
disabledAddTooltip,
|
|
946
|
+
titleMode = 'all',
|
|
947
|
+
checkedValue,
|
|
948
|
+
icon,
|
|
949
|
+
deleteDisable = [],
|
|
950
|
+
singleTitle,
|
|
951
|
+
initValue,
|
|
952
|
+
popoverClassName,
|
|
953
|
+
onChange,
|
|
954
|
+
onAdd,
|
|
955
|
+
onFilter,
|
|
956
|
+
onDelete,
|
|
957
|
+
deleteRender,
|
|
958
|
+
onSort,
|
|
959
|
+
keepLastItem = true
|
|
960
|
+
} = props;
|
|
961
|
+
const intl = useFormatMessage('DynamicMultiBox', localeJson);
|
|
962
|
+
const [checked, setChecked] = useState([]);
|
|
963
|
+
const domRef = useRef(null);
|
|
964
|
+
const panelRef = useRef(null);
|
|
965
|
+
const [fixedConfig, setFixedConfig] = useState([]);
|
|
966
|
+
const [selectedConfig, setSelectedConfig] = useState([]);
|
|
967
|
+
const constData = useRef({});
|
|
968
|
+
useEffect(() => {
|
|
984
969
|
window.addEventListener('resize', monitorScroll);
|
|
985
|
-
return
|
|
970
|
+
return () => {
|
|
986
971
|
window.removeEventListener('resize', monitorScroll);
|
|
987
972
|
clearTimeout(constData.current.timerScroll);
|
|
988
973
|
};
|
|
989
974
|
}, []);
|
|
990
|
-
useEffect(
|
|
975
|
+
useEffect(() => {
|
|
991
976
|
if (checkedValue) setChecked(checkedValue);
|
|
992
977
|
}, [checkedValue]);
|
|
993
|
-
useEffect(
|
|
978
|
+
useEffect(() => {
|
|
994
979
|
if (!(config === null || config === void 0 ? void 0 : config.length)) return;
|
|
995
980
|
// 筛选出固定字段
|
|
996
|
-
|
|
997
|
-
return item.isFixed;
|
|
998
|
-
})) || [];
|
|
981
|
+
const fixedArr = (config === null || config === void 0 ? void 0 : config.filter(item => item.isFixed)) || [];
|
|
999
982
|
setFixedConfig(fixedArr);
|
|
1000
983
|
}, [config]);
|
|
1001
|
-
useEffect(
|
|
984
|
+
useEffect(() => {
|
|
1002
985
|
if (!(config === null || config === void 0 ? void 0 : config.length)) return;
|
|
1003
986
|
// 通过透传的checkedValue映射出对应的配置
|
|
1004
|
-
|
|
1005
|
-
return !item.isFixed && (checked === null || checked === void 0 ? void 0 : checked.includes(item.name));
|
|
1006
|
-
})) || [];
|
|
987
|
+
const selectedArr = (config === null || config === void 0 ? void 0 : config.filter(item => !item.isFixed && (checked === null || checked === void 0 ? void 0 : checked.includes(item.name)))) || [];
|
|
1007
988
|
setSelectedConfig(selectedArr);
|
|
1008
989
|
}, [config, checked]);
|
|
1009
990
|
/**
|
|
1010
991
|
* @desc 筛选回调
|
|
1011
992
|
* */
|
|
1012
|
-
|
|
993
|
+
const onCheckChange = val => {
|
|
1013
994
|
// 1、更新selectedConfig配置 2、更新valueList 3、更新error
|
|
1014
995
|
// 区分正选反选
|
|
1015
|
-
|
|
996
|
+
const bool = (val === null || val === void 0 ? void 0 : val.length) > (checked === null || checked === void 0 ? void 0 : checked.length);
|
|
1016
997
|
// 当前选中数据和上一次选择数据取差值
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
998
|
+
const currentVal = getArrDiffSet(val, checked);
|
|
999
|
+
let valueArr = [...valueList];
|
|
1000
|
+
let errorArr = [...errors];
|
|
1020
1001
|
if (bool) {
|
|
1021
1002
|
valueArr = handleCheckedConfig(valueArr, currentVal);
|
|
1022
1003
|
errorArr = handleCheckedConfig(errorArr, currentVal);
|
|
@@ -1034,15 +1015,15 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1034
1015
|
monitorScroll();
|
|
1035
1016
|
};
|
|
1036
1017
|
/** 监听内容是否产生横向滚动*/
|
|
1037
|
-
|
|
1038
|
-
|
|
1018
|
+
const monitorScroll = () => {
|
|
1019
|
+
const domRefEle = domRef === null || domRef === void 0 ? void 0 : domRef.current;
|
|
1039
1020
|
if (!domRefEle) return;
|
|
1040
|
-
|
|
1021
|
+
const contentDomEle = domRefEle.querySelector('.multi-value-content');
|
|
1041
1022
|
if (!contentDomEle) return;
|
|
1042
|
-
|
|
1023
|
+
const btnDomEle = domRefEle.querySelector('.add-button');
|
|
1043
1024
|
if (!btnDomEle) return;
|
|
1044
1025
|
clearTimeout(constData.current.timerScroll);
|
|
1045
|
-
constData.current.timerScroll = setTimeout(
|
|
1026
|
+
constData.current.timerScroll = setTimeout(() => {
|
|
1046
1027
|
if (contentDomEle.offsetWidth < contentDomEle.scrollWidth) {
|
|
1047
1028
|
btnDomEle.classList.add('add-button-scroll');
|
|
1048
1029
|
} else {
|
|
@@ -1053,10 +1034,10 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1053
1034
|
/**
|
|
1054
1035
|
* @desc 筛选恢复默认,
|
|
1055
1036
|
* */
|
|
1056
|
-
|
|
1037
|
+
const onRestoreDefault = () => {
|
|
1057
1038
|
if (!(checked === null || checked === void 0 ? void 0 : checked.length)) return;
|
|
1058
|
-
|
|
1059
|
-
|
|
1039
|
+
const valueArr = [...valueList];
|
|
1040
|
+
const errorArr = [...errors];
|
|
1060
1041
|
restoreData(valueArr, checked);
|
|
1061
1042
|
restoreData(errorArr, checked);
|
|
1062
1043
|
setChecked([]);
|
|
@@ -1070,9 +1051,9 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1070
1051
|
/**
|
|
1071
1052
|
* @desc 数据重置
|
|
1072
1053
|
* */
|
|
1073
|
-
|
|
1074
|
-
data.forEach(
|
|
1075
|
-
for (
|
|
1054
|
+
const restoreData = (data, checked) => {
|
|
1055
|
+
data.forEach(item => {
|
|
1056
|
+
for (const key in item) {
|
|
1076
1057
|
if (checked.includes(key)) delete item[key];
|
|
1077
1058
|
}
|
|
1078
1059
|
});
|
|
@@ -1082,11 +1063,11 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1082
1063
|
* @param dataArr 错误集合errors或者valueList集合
|
|
1083
1064
|
* @param currentVal 反选值
|
|
1084
1065
|
* */
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
dataArr.forEach(
|
|
1089
|
-
for (
|
|
1066
|
+
const handleUncheckedConfig = function () {
|
|
1067
|
+
let dataArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1068
|
+
let currentVal = arguments.length > 1 ? arguments[1] : undefined;
|
|
1069
|
+
dataArr.forEach(item => {
|
|
1070
|
+
for (const itemKey in item) {
|
|
1090
1071
|
if (itemKey === currentVal) delete item[itemKey];
|
|
1091
1072
|
}
|
|
1092
1073
|
});
|
|
@@ -1096,18 +1077,16 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1096
1077
|
* @param dataArr 错误集合errors或者valueList集合
|
|
1097
1078
|
* @param currentVal 正选值
|
|
1098
1079
|
* */
|
|
1099
|
-
|
|
1100
|
-
return dataArr.map(
|
|
1101
|
-
|
|
1102
|
-
});
|
|
1080
|
+
const handleCheckedConfig = (dataArr, currentVal) => {
|
|
1081
|
+
return dataArr.map(item => Object.assign(Object.assign({}, item), {
|
|
1082
|
+
[currentVal]: ''
|
|
1083
|
+
}));
|
|
1103
1084
|
};
|
|
1104
1085
|
/**
|
|
1105
1086
|
* 弹窗筛选器内容
|
|
1106
1087
|
* */
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
return !item.isFixed;
|
|
1110
|
-
});
|
|
1088
|
+
const renderPopoverContent = () => {
|
|
1089
|
+
const filterConfig = config.filter(item => !item.isFixed);
|
|
1111
1090
|
return jsx(Fragment, {
|
|
1112
1091
|
children: filterConfig && (filterConfig === null || filterConfig === void 0 ? void 0 : filterConfig.length) > 0 ? jsxs("div", Object.assign({
|
|
1113
1092
|
className: "filter-config"
|
|
@@ -1144,16 +1123,16 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1144
1123
|
}))
|
|
1145
1124
|
});
|
|
1146
1125
|
};
|
|
1147
|
-
|
|
1148
|
-
|
|
1126
|
+
const popoverHandClass = () => {
|
|
1127
|
+
let str = "".concat($prefixCls, "-dynamic-multi-box-popover");
|
|
1149
1128
|
if (popoverClassName) str += " ".concat(popoverClassName);
|
|
1150
1129
|
return str;
|
|
1151
1130
|
};
|
|
1152
1131
|
/**
|
|
1153
1132
|
* 渲染表头
|
|
1154
1133
|
* */
|
|
1155
|
-
|
|
1156
|
-
|
|
1134
|
+
const renderTitle = useMemo(() => {
|
|
1135
|
+
const config = [...fixedConfig, ...selectedConfig];
|
|
1157
1136
|
if (!(config === null || config === void 0 ? void 0 : config.length)) return null;
|
|
1158
1137
|
return jsxs("div", Object.assign({
|
|
1159
1138
|
className: 'title-config'
|
|
@@ -1161,17 +1140,19 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1161
1140
|
children: [titleMode === 'all' ? jsx("div", Object.assign({
|
|
1162
1141
|
className: 'title-config-row'
|
|
1163
1142
|
}, {
|
|
1164
|
-
children: config === null || config === void 0 ? void 0 : config.map(
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1143
|
+
children: config === null || config === void 0 ? void 0 : config.map((item, index) => {
|
|
1144
|
+
const {
|
|
1145
|
+
label,
|
|
1146
|
+
required,
|
|
1147
|
+
className,
|
|
1148
|
+
inputType,
|
|
1149
|
+
style,
|
|
1150
|
+
labelProps
|
|
1151
|
+
} = item;
|
|
1152
|
+
let str = 'title-config-row-item';
|
|
1172
1153
|
if (inputType === 'Switch') str += ' row-form-switch';
|
|
1173
1154
|
if (className) str += " ".concat(className);
|
|
1174
|
-
|
|
1155
|
+
const styleCom = Object.assign({}, style);
|
|
1175
1156
|
if (!(style === null || style === void 0 ? void 0 : style.width) && !(style === null || style === void 0 ? void 0 : style.flex)) styleCom.flex = 1;
|
|
1176
1157
|
return jsx("div", Object.assign({
|
|
1177
1158
|
className: str,
|
|
@@ -1194,9 +1175,7 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1194
1175
|
}), isFilter && jsx(Popover, Object.assign({
|
|
1195
1176
|
placement: 'bottom-end',
|
|
1196
1177
|
content: renderPopoverContent(),
|
|
1197
|
-
getPopupContainer:
|
|
1198
|
-
return panelRef.current;
|
|
1199
|
-
},
|
|
1178
|
+
getPopupContainer: () => panelRef.current,
|
|
1200
1179
|
overlayClassName: popoverHandClass()
|
|
1201
1180
|
}, {
|
|
1202
1181
|
children: jsx("div", Object.assign({
|
|
@@ -1217,14 +1196,14 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1217
1196
|
* 判断是否全部隐藏删除
|
|
1218
1197
|
* 默认全部隐藏
|
|
1219
1198
|
* */
|
|
1220
|
-
|
|
1199
|
+
const isAllHideDelete = () => {
|
|
1221
1200
|
var _a;
|
|
1222
|
-
|
|
1201
|
+
let bol = true;
|
|
1223
1202
|
if (valueList.length > deleteDisable.length) {
|
|
1224
1203
|
return false;
|
|
1225
1204
|
}
|
|
1226
|
-
for (
|
|
1227
|
-
|
|
1205
|
+
for (let i = 0, l = valueList === null || valueList === void 0 ? void 0 : valueList.length; i < l; i++) {
|
|
1206
|
+
const id = (_a = valueList[i]) === null || _a === void 0 ? void 0 : _a[rowKey];
|
|
1228
1207
|
if (id && deleteDisable.indexOf(id) === -1) {
|
|
1229
1208
|
bol = false;
|
|
1230
1209
|
break;
|
|
@@ -1235,18 +1214,16 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1235
1214
|
/**
|
|
1236
1215
|
*@desc 渲染内容
|
|
1237
1216
|
* */
|
|
1238
|
-
|
|
1217
|
+
const renderContent = useMemo(() => {
|
|
1239
1218
|
if (valueList && (valueList === null || valueList === void 0 ? void 0 : valueList.length) > 0) {
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1219
|
+
const showDeleteIcon = keepLastItem ? valueList.length > 1 : true;
|
|
1220
|
+
const config = [...fixedConfig, ...selectedConfig];
|
|
1221
|
+
const isAllHideDelBol = isAllHideDelete();
|
|
1243
1222
|
return jsx(Fragment, {
|
|
1244
|
-
children: valueList.map(
|
|
1223
|
+
children: valueList.map((item, rowIndex) => {
|
|
1245
1224
|
var _a;
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
return item[rowKey] === id;
|
|
1249
|
-
})) === null || _a === void 0 ? void 0 : _a[0];
|
|
1225
|
+
const id = item[rowKey];
|
|
1226
|
+
const rowError = (_a = errors === null || errors === void 0 ? void 0 : errors.filter(item => item[rowKey] === id)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1250
1227
|
return jsxs("div", Object.assign({
|
|
1251
1228
|
className: 'content-row-form'
|
|
1252
1229
|
}, {
|
|
@@ -1255,19 +1232,15 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1255
1232
|
valueList: valueList,
|
|
1256
1233
|
errors: errors,
|
|
1257
1234
|
rowError: rowError,
|
|
1258
|
-
onFormItemChange:
|
|
1259
|
-
return _onFormItemChange(name, id, value, rowIndex);
|
|
1260
|
-
},
|
|
1235
|
+
onFormItemChange: (name, id, value) => onFormItemChange(name, id, value, rowIndex),
|
|
1261
1236
|
icon: icon,
|
|
1262
|
-
config:
|
|
1237
|
+
config: config
|
|
1263
1238
|
}), jsxs("div", Object.assign({
|
|
1264
1239
|
className: "operator-column-40 ".concat(isSort && showDeleteIcon && !isAllHideDelBol ? 'operator-column-80' : '')
|
|
1265
1240
|
}, {
|
|
1266
1241
|
children: [jsx("div", Object.assign({
|
|
1267
1242
|
className: "operator-column-icon delete-icon ".concat(!showDeleteIcon || deleteDisable.includes(id) ? 'hidden-icon' : ''),
|
|
1268
|
-
onClick:
|
|
1269
|
-
return onDeleteEvent(rowIndex);
|
|
1270
|
-
}
|
|
1243
|
+
onClick: () => onDeleteEvent(rowIndex)
|
|
1271
1244
|
}, {
|
|
1272
1245
|
children: deleteRender ? deleteRender(rowIndex, item, valueList) : jsx(Delete, {})
|
|
1273
1246
|
})), isSort && jsx("div", Object.assign({
|
|
@@ -1290,9 +1263,9 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1290
1263
|
/**
|
|
1291
1264
|
* @desc 删除事件
|
|
1292
1265
|
* */
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1266
|
+
const onDeleteEvent = rowIndex => {
|
|
1267
|
+
const valueArr = [...valueList];
|
|
1268
|
+
const errorArr = [...errors];
|
|
1296
1269
|
valueArr.splice(rowIndex, 1);
|
|
1297
1270
|
errorArr.splice(rowIndex, 1);
|
|
1298
1271
|
onDelete && onDelete(valueArr, errorArr);
|
|
@@ -1304,31 +1277,35 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1304
1277
|
* @param rowIndex 表单所处行下标
|
|
1305
1278
|
* @param id 表单所处行中的id
|
|
1306
1279
|
* */
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
Object.keys(valueArr[rowIndex]).forEach(
|
|
1280
|
+
const onFormItemChange = (name, id, value, rowIndex) => {
|
|
1281
|
+
const valueArr = [...valueList];
|
|
1282
|
+
Object.keys(valueArr[rowIndex]).forEach(key => {
|
|
1310
1283
|
if (name === key) valueArr[rowIndex][key] = value;
|
|
1311
1284
|
});
|
|
1312
1285
|
onChange && onChange(valueArr, {
|
|
1313
|
-
name
|
|
1314
|
-
id
|
|
1315
|
-
value
|
|
1316
|
-
rowIndex
|
|
1286
|
+
name,
|
|
1287
|
+
id,
|
|
1288
|
+
value,
|
|
1289
|
+
rowIndex
|
|
1317
1290
|
});
|
|
1318
1291
|
};
|
|
1319
1292
|
/**
|
|
1320
1293
|
* @desc 新增事件
|
|
1321
1294
|
* */
|
|
1322
|
-
|
|
1295
|
+
const onAddEvent = () => {
|
|
1323
1296
|
if (disabledAdd) return;
|
|
1324
1297
|
// 根据配置进行valueList更新
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1298
|
+
const valueArr = [...(valueList || [])];
|
|
1299
|
+
const errorArr = [...errors];
|
|
1300
|
+
const id = UUID();
|
|
1328
1301
|
// 取出已经筛选的配置数据
|
|
1329
|
-
|
|
1330
|
-
valueArr.push(Object.assign(Object.assign({}, getNewItem(configArr, 'value')),
|
|
1331
|
-
|
|
1302
|
+
const configArr = [...fixedConfig, ...selectedConfig];
|
|
1303
|
+
valueArr.push(Object.assign(Object.assign({}, getNewItem(configArr, 'value')), {
|
|
1304
|
+
[rowKey]: id
|
|
1305
|
+
}));
|
|
1306
|
+
errorArr.push(Object.assign(Object.assign({}, getNewItem(configArr, 'error')), {
|
|
1307
|
+
[rowKey]: id
|
|
1308
|
+
}));
|
|
1332
1309
|
onAdd && onAdd(valueArr, errorArr);
|
|
1333
1310
|
};
|
|
1334
1311
|
/**
|
|
@@ -1336,23 +1313,23 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1336
1313
|
* @param configArr 配置表
|
|
1337
1314
|
* @param type 区分值和错误
|
|
1338
1315
|
* */
|
|
1339
|
-
|
|
1340
|
-
return configArr.reduce(
|
|
1341
|
-
|
|
1342
|
-
}, {});
|
|
1316
|
+
const getNewItem = (configArr, type) => {
|
|
1317
|
+
return configArr.reduce((acc, cur) => Object.assign(Object.assign({}, acc), {
|
|
1318
|
+
[cur.name]: type === 'value' ? initValue === null || initValue === void 0 ? void 0 : initValue[cur.name] : ''
|
|
1319
|
+
}), {});
|
|
1343
1320
|
};
|
|
1344
1321
|
/**
|
|
1345
1322
|
* @desc 排序
|
|
1346
1323
|
* @param newValueList 排序后的数组
|
|
1347
1324
|
* */
|
|
1348
|
-
|
|
1325
|
+
const onDragSort = newValueList => {
|
|
1349
1326
|
// 获取排序后 id映射下标集合
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
}, {});
|
|
1327
|
+
const idMapIndex = newValueList.reduce((acc, cur, index) => Object.assign(Object.assign({}, acc), {
|
|
1328
|
+
[cur[rowKey]]: index
|
|
1329
|
+
}), {});
|
|
1353
1330
|
// 需要交换的下标集合
|
|
1354
|
-
|
|
1355
|
-
valueList.forEach(
|
|
1331
|
+
const swapIds = [];
|
|
1332
|
+
valueList.forEach((item, idx) => {
|
|
1356
1333
|
if (idx !== idMapIndex[item[rowKey]]) swapIds.push(idx);
|
|
1357
1334
|
});
|
|
1358
1335
|
onSort && onSort(newValueList, swapIds);
|
|
@@ -1362,16 +1339,45 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1362
1339
|
* @param {string} currentVal
|
|
1363
1340
|
* @param {string} preVal
|
|
1364
1341
|
*/
|
|
1365
|
-
|
|
1366
|
-
return currentVal.concat(preVal).filter(
|
|
1367
|
-
|
|
1368
|
-
|
|
1342
|
+
const getArrDiffSet = (currentVal, preVal) => {
|
|
1343
|
+
return currentVal.concat(preVal).filter(v => !currentVal.includes(v) || !preVal.includes(v))[0];
|
|
1344
|
+
};
|
|
1345
|
+
/**
|
|
1346
|
+
* 处理添加按钮
|
|
1347
|
+
* */
|
|
1348
|
+
const handleAddBtn = () => {
|
|
1349
|
+
return jsxs("div", Object.assign({
|
|
1350
|
+
className: "add-button ".concat(disabledAdd ? 'disabled-add' : 'normal-button'),
|
|
1351
|
+
onClick: onAddEvent
|
|
1352
|
+
}, {
|
|
1353
|
+
children: [jsx(PlusCircleF, {}), jsx("span", Object.assign({
|
|
1354
|
+
className: "text"
|
|
1355
|
+
}, {
|
|
1356
|
+
children: intl({
|
|
1357
|
+
id: 'add'
|
|
1358
|
+
})
|
|
1359
|
+
}))]
|
|
1360
|
+
}));
|
|
1361
|
+
};
|
|
1362
|
+
/**
|
|
1363
|
+
* 处理添加按钮是否带提示
|
|
1364
|
+
* */
|
|
1365
|
+
const handleAddBtnTooltip = () => {
|
|
1366
|
+
if (disabledAddTooltip) {
|
|
1367
|
+
return jsx(Tooltip, Object.assign({
|
|
1368
|
+
disabled: true,
|
|
1369
|
+
placement: disabledAddTooltip.placement || 'top'
|
|
1370
|
+
}, disabledAddTooltip, {
|
|
1371
|
+
children: handleAddBtn()
|
|
1372
|
+
}));
|
|
1373
|
+
}
|
|
1374
|
+
return handleAddBtn();
|
|
1369
1375
|
};
|
|
1370
1376
|
/**
|
|
1371
1377
|
* @desc 处理className
|
|
1372
1378
|
* */
|
|
1373
|
-
|
|
1374
|
-
|
|
1379
|
+
const handClass = () => {
|
|
1380
|
+
let str = "".concat($prefixCls, "-dynamic-multi-box");
|
|
1375
1381
|
if (className) str += " ".concat(className);
|
|
1376
1382
|
return str;
|
|
1377
1383
|
};
|
|
@@ -1391,18 +1397,7 @@ var DynamicMultiBox = function DynamicMultiBox(props) {
|
|
|
1391
1397
|
}, {
|
|
1392
1398
|
children: renderContent
|
|
1393
1399
|
})) : renderContent]
|
|
1394
|
-
})),
|
|
1395
|
-
className: "add-button ".concat(disabledAdd ? 'disabled-add' : 'normal-button'),
|
|
1396
|
-
onClick: onAddEvent
|
|
1397
|
-
}, {
|
|
1398
|
-
children: [jsx(PlusCircleF, {}), jsx("span", Object.assign({
|
|
1399
|
-
className: "text"
|
|
1400
|
-
}, {
|
|
1401
|
-
children: intl({
|
|
1402
|
-
id: 'add'
|
|
1403
|
-
})
|
|
1404
|
-
}))]
|
|
1405
|
-
}))]
|
|
1400
|
+
})), handleAddBtnTooltip()]
|
|
1406
1401
|
}));
|
|
1407
1402
|
};
|
|
1408
1403
|
|