@para-ui/core 4.0.0-rc.4 → 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 +17 -16
- 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/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 +80 -95
- 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 +104 -113
- 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 +60 -77
- package/Popover/index.js +12 -12
- package/Progress/index.js +72 -74
- package/Querying/index.js +22 -23
- package/README.md +2 -0
- package/Radio/index.js +27 -34
- package/RadioGroup/index.js +38 -52
- package/Search/index.js +34 -43
- package/Select/index.js +281 -345
- 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 +159 -201
- package/Tree/index.js +7 -12
- package/Upload/index.js +523 -758
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-0ced30f7.js} +1127 -1079
- 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-9331b116.js → index-ef1235fb.js} +125 -134
- package/_verture/{index-b1f80962.js → index-f186b5e8.js} +314 -398
- 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-418da0a4.js → utils-46e99c9a.js} +34 -25
- package/index.js +21 -22
- package/locale/index.js +6 -6
- 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/Transfer/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { _ as _toConsumableArray } from '../_verture/toConsumableArray-8f4c9589.js';
|
|
2
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.js';
|
|
3
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
2
|
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
5
3
|
import clsx from 'clsx';
|
|
@@ -8,26 +6,24 @@ import NavigateBefore from '@para-ui/icons/Left';
|
|
|
8
6
|
import Right from '@para-ui/icons/Right';
|
|
9
7
|
import ExpandLess from '@para-ui/icons/Up';
|
|
10
8
|
import Down from '@para-ui/icons/Down';
|
|
11
|
-
import { u as useFormatMessage } from '../_verture/useFormatMessage-
|
|
12
|
-
import { $ as $prefixCls } from '../_verture/constant-
|
|
9
|
+
import { u as useFormatMessage } from '../_verture/useFormatMessage-eb13cf56.js';
|
|
10
|
+
import { $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
13
11
|
import { Search } from '../Search/index.js';
|
|
14
12
|
import SearchIcon from '@para-ui/icons/Search';
|
|
15
13
|
import AutoTips from '../AutoTips/index.js';
|
|
16
14
|
import Drag from '@para-ui/icons/Drag';
|
|
17
15
|
import { S as Sortable } from '../_verture/sortable.esm-49896035.js';
|
|
18
|
-
import { d as debounce } from '../_verture/utils-
|
|
16
|
+
import { d as debounce } from '../_verture/utils-46e99c9a.js';
|
|
19
17
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
20
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
21
|
-
import '../_verture/typeof-adeedc13.js';
|
|
22
18
|
import '../_verture/tslib.es6-55ed4bd2.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
|
-
import '../_verture/index-
|
|
24
|
+
import '../_verture/index-da9097d3.js';
|
|
29
25
|
import 'rc-dropdown';
|
|
30
|
-
import '../_verture/usePopupContainer-
|
|
26
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
31
27
|
import 'dayjs';
|
|
32
28
|
import '@paraview/lib';
|
|
33
29
|
import '@para-ui/core/GlobalContext';
|
|
@@ -40,8 +36,7 @@ import '@para-ui/icons/PreviewOpen';
|
|
|
40
36
|
import '@para-ui/icons/CloseCircleF';
|
|
41
37
|
import '../Loading/index.js';
|
|
42
38
|
import '../HelperText/index.js';
|
|
43
|
-
import '../_verture/useGlobalProps-
|
|
44
|
-
import '../_verture/defineProperty-1d116156.js';
|
|
39
|
+
import '../_verture/useGlobalProps-1e416658.js';
|
|
45
40
|
|
|
46
41
|
var en = {
|
|
47
42
|
left: 'Left',
|
|
@@ -64,8 +59,8 @@ var zh = {
|
|
|
64
59
|
};
|
|
65
60
|
|
|
66
61
|
var localeJson = {
|
|
67
|
-
zh
|
|
68
|
-
en
|
|
62
|
+
zh,
|
|
63
|
+
en
|
|
69
64
|
};
|
|
70
65
|
|
|
71
66
|
var useClick = function useClick(callback, doubleCallback) {
|
|
@@ -93,36 +88,32 @@ var useClick = function useClick(callback, doubleCallback) {
|
|
|
93
88
|
};
|
|
94
89
|
};
|
|
95
90
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
useEffect(function () {
|
|
123
|
-
var arr = [];
|
|
124
|
-
var count = 0;
|
|
125
|
-
data.forEach(function (item, index) {
|
|
91
|
+
const Box = props => {
|
|
92
|
+
const {
|
|
93
|
+
title,
|
|
94
|
+
data,
|
|
95
|
+
onSearch,
|
|
96
|
+
onchange,
|
|
97
|
+
onMove,
|
|
98
|
+
queryAll,
|
|
99
|
+
inverse,
|
|
100
|
+
direction,
|
|
101
|
+
fluctuationPosition,
|
|
102
|
+
fluctuationOrther,
|
|
103
|
+
onEndSort,
|
|
104
|
+
multiple,
|
|
105
|
+
rightIcon,
|
|
106
|
+
style,
|
|
107
|
+
customKey
|
|
108
|
+
} = props;
|
|
109
|
+
const intl = useFormatMessage('Transfer', localeJson);
|
|
110
|
+
const [checkCount, setCheckCount] = useState([]);
|
|
111
|
+
const [disabledCount, setDisabledCount] = useState(0);
|
|
112
|
+
const ref = useRef();
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
const arr = [];
|
|
115
|
+
let count = 0;
|
|
116
|
+
data.forEach((item, index) => {
|
|
126
117
|
if (item.checked && !item.hide) {
|
|
127
118
|
arr.push(index);
|
|
128
119
|
}
|
|
@@ -133,29 +124,29 @@ var Box = function Box(props) {
|
|
|
133
124
|
setDisabledCount(count);
|
|
134
125
|
setCheckCount(arr);
|
|
135
126
|
}, [data]);
|
|
136
|
-
useEffect(
|
|
127
|
+
useEffect(() => {
|
|
137
128
|
if (direction == 'right') {
|
|
138
129
|
new Sortable(ref.current, {
|
|
139
130
|
animation: 180,
|
|
140
131
|
ghostClass: 'blue-background-class',
|
|
141
132
|
dragClass: 'drag-item',
|
|
142
133
|
easing: 'step-start',
|
|
143
|
-
onEnd:
|
|
134
|
+
onEnd: evt => {
|
|
144
135
|
onEndSort === null || onEndSort === void 0 ? void 0 : onEndSort(evt.oldIndex, evt.newIndex);
|
|
145
136
|
}
|
|
146
137
|
});
|
|
147
138
|
}
|
|
148
139
|
}, []);
|
|
149
|
-
|
|
140
|
+
const handler = useClick((e, index, item) => {
|
|
150
141
|
if (item.disabled) return;
|
|
151
142
|
onchange(e, !item.checked, index, direction, multiple);
|
|
152
|
-
},
|
|
143
|
+
}, (e, index, item) => {
|
|
153
144
|
if (item === null || item === void 0 ? void 0 : item.disabled) return;
|
|
154
145
|
onchange(e, true, index, direction, false);
|
|
155
146
|
onMove(direction === 'right' ? 'left' : 'right');
|
|
156
147
|
});
|
|
157
|
-
|
|
158
|
-
|
|
148
|
+
const itemStyle = data => {
|
|
149
|
+
const stlye = {};
|
|
159
150
|
if (data === null || data === void 0 ? void 0 : data.tagColor) {
|
|
160
151
|
stlye.borderLeft = "4px solid ".concat(data.tagColor);
|
|
161
152
|
}
|
|
@@ -180,15 +171,15 @@ var Box = function Box(props) {
|
|
|
180
171
|
showBtn: false,
|
|
181
172
|
rightIcon: jsx(SearchIcon, {}),
|
|
182
173
|
rightIconExist: true,
|
|
183
|
-
onChange:
|
|
174
|
+
onChange: val => {
|
|
184
175
|
onSearch(val, direction);
|
|
185
176
|
},
|
|
186
|
-
onClickRightIcon:
|
|
177
|
+
onClickRightIcon: val => {
|
|
187
178
|
onSearch(val, direction);
|
|
188
179
|
},
|
|
189
|
-
onEnter:
|
|
180
|
+
onEnter: event => {
|
|
190
181
|
var _a;
|
|
191
|
-
|
|
182
|
+
const val = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
192
183
|
onSearch(val, direction);
|
|
193
184
|
},
|
|
194
185
|
allowClear: false
|
|
@@ -196,11 +187,11 @@ var Box = function Box(props) {
|
|
|
196
187
|
className: "context",
|
|
197
188
|
ref: ref
|
|
198
189
|
}, {
|
|
199
|
-
children: data.map(
|
|
190
|
+
children: data.map((item, index) => {
|
|
200
191
|
return jsxs("div", Object.assign({
|
|
201
192
|
className: clsx('item', (item === null || item === void 0 ? void 0 : item.tagColor) && 'item-border', (item === null || item === void 0 ? void 0 : item.disabled) && 'item-disabled', (item === null || item === void 0 ? void 0 : item.checked) && 'item-checked', fluctuationPosition === index && 'item-fluctuation', fluctuationOrther === index && 'item-fluctuationOrther'),
|
|
202
193
|
style: itemStyle(item),
|
|
203
|
-
onClick:
|
|
194
|
+
onClick: e => {
|
|
204
195
|
handler(e, index, item);
|
|
205
196
|
}
|
|
206
197
|
}, {
|
|
@@ -232,7 +223,7 @@ var Box = function Box(props) {
|
|
|
232
223
|
children: [jsx(Button, Object.assign({
|
|
233
224
|
variant: "text",
|
|
234
225
|
className: "".concat(checkCount.length === data.length - disabledCount && data.length > 0 ? 'btn-on' : ''),
|
|
235
|
-
onClick:
|
|
226
|
+
onClick: () => {
|
|
236
227
|
queryAll(checkCount.length !== data.length - disabledCount, direction);
|
|
237
228
|
}
|
|
238
229
|
}, {
|
|
@@ -243,7 +234,7 @@ var Box = function Box(props) {
|
|
|
243
234
|
variant: "text",
|
|
244
235
|
className: "".concat(checkCount.length === 0 || checkCount.length === data.length - disabledCount ? 'btn-off' : ''),
|
|
245
236
|
disabled: checkCount.length === 0 || checkCount.length === data.length - disabledCount,
|
|
246
|
-
onClick:
|
|
237
|
+
onClick: () => {
|
|
247
238
|
inverse(direction);
|
|
248
239
|
}
|
|
249
240
|
}, {
|
|
@@ -259,117 +250,85 @@ var Box = function Box(props) {
|
|
|
259
250
|
}))]
|
|
260
251
|
}));
|
|
261
252
|
};
|
|
262
|
-
|
|
253
|
+
const Sortablejs = Sortable;
|
|
263
254
|
|
|
264
255
|
var css_248z = "@charset \"UTF-8\";\n/**\n* @author linhd\n* @date 2023/4/11 14:16\n* @description 最新色卡\n*/\n.paraui-v4-transfer {\n display: flex;\n font-size: 14px;\n user-select: none;\n}\n.paraui-v4-transfer .blue-background-class {\n background-color: rgb(240, 245, 255);\n}\n.paraui-v4-transfer .drag-item {\n background: rgb(255, 255, 255) !important;\n box-shadow: rgba(212, 218, 227, 0.4);\n}\n.paraui-v4-transfer .box {\n border-radius: 4px;\n border: 1px solid rgb(212, 218, 227);\n overflow: hidden;\n}\n.paraui-v4-transfer .box .box-header {\n background: rgb(247, 248, 250);\n color: rgb(29, 33, 38);\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding-left: 10px;\n height: 36px;\n border-bottom: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-transfer .box .count {\n color: rgb(29, 33, 38);\n letter-spacing: 1px;\n}\n.paraui-v4-transfer .box .context {\n height: 400px;\n overflow: auto;\n scrollbar-base-color: red;\n margin-top: 4px;\n}\n.paraui-v4-transfer .box .context .item-fluctuation {\n animation: flucturation 0.4s forwards;\n}\n.paraui-v4-transfer .box .context .item-fluctuationOrther {\n animation: flucturationOrther 0.5s forwards;\n}\n.paraui-v4-transfer .box .context .item {\n padding: 0px 10px;\n height: 30px;\n display: flex;\n align-items: center;\n cursor: pointer;\n}\n.paraui-v4-transfer .box .context .item.item-checked:hover {\n background-color: rgb(247, 248, 250) !important;\n}\n.paraui-v4-transfer .box .context .item.item-checked > .item-label {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .context .item > .item-label {\n flex: 1;\n overflow: hidden;\n color: rgb(29, 33, 38);\n}\n.paraui-v4-transfer .box .context .item:hover {\n background-color: rgb(247, 248, 250);\n}\n.paraui-v4-transfer .box .context .item.item-disabled:hover {\n background: inherit;\n cursor: no-drop;\n}\n.paraui-v4-transfer .box .context .item.item-disabled > .item-label {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .context .item .handle {\n margin-left: 8px;\n display: flex;\n align-content: center;\n}\n.paraui-v4-transfer .box .context .item .handle .handle-line {\n height: 12px;\n border-left: 1px solid rgb(212, 218, 227);\n margin: auto 10px auto 0;\n}\n.paraui-v4-transfer .box .context .item .handle svg {\n color: rgb(92, 101, 115);\n}\n.paraui-v4-transfer .box .context .item .handle:hover svg {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .context .item-border {\n padding-left: 6px;\n}\n.paraui-v4-transfer .box .text-field-content {\n border: none;\n border-radius: 0;\n border-bottom: 1px solid rgb(212, 218, 227);\n}\n.paraui-v4-transfer .box .footer {\n display: flex;\n align-items: center;\n border-top: 1px solid rgb(212, 218, 227);\n height: 36px;\n justify-content: space-between;\n padding: 0 10px;\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) button {\n color: rgb(46, 101, 230);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) button:hover {\n color: rgb(87, 131, 235);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) .btn-off {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) .btn-off:hover {\n color: rgb(161, 168, 179);\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) > button {\n padding: 0;\n}\n.paraui-v4-transfer .box .footer > div:nth-child(1) > button:nth-child(2) {\n margin-left: 16px;\n}\n.paraui-v4-transfer ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: rgba(255, 255, 255, 0.5);\n}\n.paraui-v4-transfer .moveBtn {\n display: flex;\n height: 500px;\n flex-direction: column;\n justify-content: center;\n margin: 0 20px;\n}\n.paraui-v4-transfer .moveBtn > button {\n background-color: rgb(46, 101, 230);\n color: rgb(255, 255, 255);\n}\n.paraui-v4-transfer .moveBtn .btn-left {\n margin-top: 16px;\n}\n\n@keyframes flucturation {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(36px);\n }\n}\n@keyframes flucturationOrther {\n 0% {\n transform: translateY(0);\n }\n 100% {\n transform: translateY(-36px);\n }\n}";
|
|
265
256
|
styleInject(css_248z);
|
|
266
257
|
|
|
267
|
-
|
|
258
|
+
const Transfer = props => {
|
|
268
259
|
var _a, _b, _c, _d;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
data =
|
|
272
|
-
value
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
_props$titles = props.titles,
|
|
277
|
-
titles = _props$titles === void 0 ? [intl({
|
|
260
|
+
const intl = useFormatMessage('Transfer', localeJson);
|
|
261
|
+
const {
|
|
262
|
+
data = [],
|
|
263
|
+
value,
|
|
264
|
+
customKey = 'key',
|
|
265
|
+
onChange,
|
|
266
|
+
titles = [intl({
|
|
278
267
|
id: 'left'
|
|
279
268
|
}), intl({
|
|
280
269
|
id: 'right'
|
|
281
|
-
})]
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
style =
|
|
270
|
+
})],
|
|
271
|
+
// ['左侧', '右侧']
|
|
272
|
+
className,
|
|
273
|
+
style = {
|
|
285
274
|
width: '298px'
|
|
286
|
-
}
|
|
287
|
-
onSort
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
setLeftData = _useState4[1];
|
|
303
|
-
var _useState5 = useState([]),
|
|
304
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
305
|
-
rightData = _useState6[0],
|
|
306
|
-
setRightData = _useState6[1];
|
|
307
|
-
var _useState7 = useState([]),
|
|
308
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
309
|
-
leftCount = _useState8[0],
|
|
310
|
-
setLeftCount = _useState8[1];
|
|
311
|
-
var _useState9 = useState([]),
|
|
312
|
-
_useState10 = _slicedToArray(_useState9, 2),
|
|
313
|
-
rightCount = _useState10[0],
|
|
314
|
-
setRightCount = _useState10[1];
|
|
315
|
-
var _useState11 = useState(),
|
|
316
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
317
|
-
fluctuationPosition = _useState12[0];
|
|
318
|
-
_useState12[1];
|
|
319
|
-
var _useState13 = useState(),
|
|
320
|
-
_useState14 = _slicedToArray(_useState13, 2),
|
|
321
|
-
fluctuationOrther = _useState14[0];
|
|
322
|
-
_useState14[1];
|
|
323
|
-
var _useState15 = useState(false),
|
|
324
|
-
_useState16 = _slicedToArray(_useState15, 2),
|
|
325
|
-
animationsLock = _useState16[0],
|
|
326
|
-
setAnimationLock = _useState16[1];
|
|
327
|
-
var onchange = useCallback(function (e, bol, index, direction, multiple) {
|
|
275
|
+
},
|
|
276
|
+
onSort,
|
|
277
|
+
trim = false,
|
|
278
|
+
multiple = true,
|
|
279
|
+
rightIcon,
|
|
280
|
+
render = item => {}
|
|
281
|
+
} = props;
|
|
282
|
+
const [transData, setTransData] = useState({});
|
|
283
|
+
const [leftData, setLeftData] = useState([]);
|
|
284
|
+
const [rightData, setRightData] = useState([]);
|
|
285
|
+
const [leftCount, setLeftCount] = useState([]);
|
|
286
|
+
const [rightCount, setRightCount] = useState([]);
|
|
287
|
+
const [fluctuationPosition, setFluctuationPosition] = useState();
|
|
288
|
+
const [fluctuationOrther, setFluctuationOrther] = useState();
|
|
289
|
+
const [animationsLock, setAnimationLock] = useState(false);
|
|
290
|
+
const onchange = useCallback((e, bol, index, direction, multiple) => {
|
|
328
291
|
if (direction === 'left') {
|
|
329
|
-
!multiple && leftData.forEach(
|
|
330
|
-
return item.checked = false;
|
|
331
|
-
});
|
|
292
|
+
!multiple && leftData.forEach(item => item.checked = false);
|
|
332
293
|
leftData[index].checked = bol;
|
|
333
|
-
setLeftData(
|
|
294
|
+
setLeftData([...leftData]);
|
|
334
295
|
} else {
|
|
335
|
-
!multiple && rightData.forEach(
|
|
336
|
-
return item.checked = false;
|
|
337
|
-
});
|
|
296
|
+
!multiple && rightData.forEach(item => item.checked = false);
|
|
338
297
|
rightData[index].checked = bol;
|
|
339
|
-
setRightData(
|
|
298
|
+
setRightData([...rightData]);
|
|
340
299
|
}
|
|
341
300
|
}, [leftData, rightData]);
|
|
342
|
-
|
|
301
|
+
const queryAll = useCallback((checked, direction) => {
|
|
343
302
|
if (direction === 'left') {
|
|
344
|
-
leftData.forEach(
|
|
303
|
+
leftData.forEach(item => {
|
|
345
304
|
if (!item.disabled && !item.hide) item.checked = checked;
|
|
346
305
|
});
|
|
347
|
-
setLeftData(
|
|
306
|
+
setLeftData([...leftData]);
|
|
348
307
|
} else {
|
|
349
|
-
rightData.forEach(
|
|
308
|
+
rightData.forEach(item => {
|
|
350
309
|
if (!item.disabled && !item.hide) item.checked = checked;
|
|
351
310
|
});
|
|
352
|
-
setRightData(
|
|
311
|
+
setRightData([...rightData]);
|
|
353
312
|
}
|
|
354
313
|
}, [leftData, rightData]);
|
|
355
|
-
|
|
314
|
+
const inverse = useCallback(direction => {
|
|
356
315
|
if (direction === 'left') {
|
|
357
|
-
leftData.forEach(
|
|
316
|
+
leftData.forEach(item => {
|
|
358
317
|
if (!item.disabled && !item.hide) item.checked = !item.checked;
|
|
359
318
|
});
|
|
360
|
-
setLeftData(
|
|
319
|
+
setLeftData([...leftData]);
|
|
361
320
|
} else {
|
|
362
|
-
rightData.forEach(
|
|
321
|
+
rightData.forEach(item => {
|
|
363
322
|
if (!item.disabled && !item.hide) item.checked = !item.checked;
|
|
364
323
|
});
|
|
365
|
-
setRightData(
|
|
324
|
+
setRightData([...rightData]);
|
|
366
325
|
}
|
|
367
326
|
}, [leftData, rightData]);
|
|
368
|
-
|
|
369
|
-
|
|
327
|
+
const onMove = direction => {
|
|
328
|
+
let newData = [];
|
|
370
329
|
if (direction === 'left') {
|
|
371
|
-
newData =
|
|
372
|
-
newData.forEach(
|
|
330
|
+
newData = [...rightData];
|
|
331
|
+
newData.forEach(item => {
|
|
373
332
|
if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
|
|
374
333
|
item.checked = false;
|
|
375
334
|
leftData.push(item);
|
|
@@ -377,8 +336,8 @@ var Transfer = function Transfer(props) {
|
|
|
377
336
|
}
|
|
378
337
|
});
|
|
379
338
|
} else {
|
|
380
|
-
newData =
|
|
381
|
-
newData.forEach(
|
|
339
|
+
newData = [...leftData];
|
|
340
|
+
newData.forEach(item => {
|
|
382
341
|
if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
|
|
383
342
|
item.checked = false;
|
|
384
343
|
rightData.push(item);
|
|
@@ -386,132 +345,131 @@ var Transfer = function Transfer(props) {
|
|
|
386
345
|
}
|
|
387
346
|
});
|
|
388
347
|
}
|
|
389
|
-
setLeftData(
|
|
390
|
-
setRightData(
|
|
391
|
-
|
|
392
|
-
rightData.forEach(
|
|
348
|
+
setLeftData([...leftData]);
|
|
349
|
+
setRightData([...rightData]);
|
|
350
|
+
const rArr = [];
|
|
351
|
+
rightData.forEach(item => {
|
|
393
352
|
rArr.push(item[customKey]);
|
|
394
353
|
});
|
|
395
354
|
onChange === null || onChange === void 0 ? void 0 : onChange(rArr);
|
|
396
355
|
};
|
|
397
356
|
// 上下移动
|
|
398
|
-
|
|
357
|
+
const fluctuation = direction => {
|
|
399
358
|
setAnimationLock(true);
|
|
400
359
|
if (direction == 'up') {
|
|
401
360
|
// setFluctuationPosition(rightCount[0] - 1)
|
|
402
361
|
// setFluctuationOrther(rightCount[0])
|
|
403
362
|
// setTimeout(() => {
|
|
404
|
-
setRightData(
|
|
363
|
+
setRightData(pre => {
|
|
405
364
|
// setFluctuationPosition(undefined)
|
|
406
365
|
// setFluctuationOrther(undefined)
|
|
407
|
-
rightCount.forEach(
|
|
408
|
-
pre.splice
|
|
366
|
+
rightCount.forEach(item => {
|
|
367
|
+
pre.splice(item - 1, 0, ...pre.splice(item, 1));
|
|
409
368
|
});
|
|
410
369
|
setAnimationLock(false);
|
|
411
|
-
|
|
412
|
-
pre.forEach(
|
|
370
|
+
const rArr = [];
|
|
371
|
+
pre.forEach(item => {
|
|
413
372
|
rArr.push(item[customKey]);
|
|
414
373
|
});
|
|
415
|
-
onSort === null || onSort === void 0 ? void 0 : onSort([]
|
|
416
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([]
|
|
417
|
-
return
|
|
374
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
|
|
375
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
|
|
376
|
+
return [...pre];
|
|
418
377
|
});
|
|
419
378
|
// }, 400)
|
|
420
379
|
} else {
|
|
421
380
|
// setFluctuationPosition(rightCount[0])
|
|
422
381
|
// setFluctuationOrther(rightCount[0] + 1)
|
|
423
382
|
// setTimeout(() => {
|
|
424
|
-
setRightData(
|
|
383
|
+
setRightData(pre => {
|
|
425
384
|
// setFluctuationPosition(undefined)
|
|
426
385
|
// setFluctuationOrther(undefined)
|
|
427
|
-
rightCount.reverse().forEach(
|
|
428
|
-
pre.splice
|
|
386
|
+
rightCount.reverse().forEach(item => {
|
|
387
|
+
pre.splice(item + 1, 0, ...pre.splice(item, 1));
|
|
429
388
|
});
|
|
430
389
|
setAnimationLock(false);
|
|
431
|
-
|
|
432
|
-
pre.forEach(
|
|
390
|
+
const rArr = [];
|
|
391
|
+
pre.forEach(item => {
|
|
433
392
|
rArr.push(item[customKey]);
|
|
434
393
|
});
|
|
435
|
-
onSort === null || onSort === void 0 ? void 0 : onSort([]
|
|
436
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([]
|
|
437
|
-
return
|
|
394
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
|
|
395
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
|
|
396
|
+
return [...pre];
|
|
438
397
|
});
|
|
439
398
|
// }, 400)
|
|
440
399
|
}
|
|
441
400
|
};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
var str = trim ? e.toUpperCase().trim() : e.toUpperCase();
|
|
401
|
+
const onSearch = debounce((e, direction) => {
|
|
402
|
+
const str = trim ? e.toUpperCase().trim() : e.toUpperCase();
|
|
445
403
|
if (direction === 'left') {
|
|
446
|
-
leftData.forEach(
|
|
404
|
+
leftData.forEach(item => {
|
|
447
405
|
item.hide = false;
|
|
448
|
-
|
|
449
|
-
|
|
406
|
+
const name = (item.name || '').toUpperCase();
|
|
407
|
+
const description = (item.description || '').toUpperCase();
|
|
450
408
|
if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
|
|
451
409
|
item.hide = true;
|
|
452
410
|
}
|
|
453
411
|
});
|
|
454
|
-
setLeftData(
|
|
412
|
+
setLeftData([...leftData]);
|
|
455
413
|
} else {
|
|
456
|
-
rightData.filter(
|
|
414
|
+
rightData.filter(item => {
|
|
457
415
|
item.hide = false;
|
|
458
|
-
|
|
459
|
-
|
|
416
|
+
const name = (item.name || '').toUpperCase();
|
|
417
|
+
const description = (item.description || '').toUpperCase();
|
|
460
418
|
if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
|
|
461
419
|
item.hide = true;
|
|
462
420
|
}
|
|
463
421
|
});
|
|
464
|
-
setRightData(
|
|
422
|
+
setRightData([...rightData]);
|
|
465
423
|
}
|
|
466
424
|
}, 500);
|
|
467
|
-
|
|
468
|
-
setRightData(
|
|
469
|
-
pre.splice
|
|
470
|
-
|
|
471
|
-
pre.forEach(
|
|
425
|
+
const onEndSort = useCallback((oldIndex, newIndex) => {
|
|
426
|
+
setRightData(pre => {
|
|
427
|
+
pre.splice(newIndex, 0, ...pre.splice(oldIndex, 1));
|
|
428
|
+
const rArr = [];
|
|
429
|
+
pre.forEach(item => {
|
|
472
430
|
rArr.push(item[customKey]);
|
|
473
431
|
});
|
|
474
|
-
onSort === null || onSort === void 0 ? void 0 : onSort([]
|
|
475
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([]
|
|
476
|
-
return
|
|
432
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
|
|
433
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
|
|
434
|
+
return [...pre];
|
|
477
435
|
});
|
|
478
436
|
}, []);
|
|
479
|
-
useEffect(
|
|
437
|
+
useEffect(() => {
|
|
480
438
|
if (data.length) {
|
|
481
|
-
|
|
482
|
-
data.forEach(
|
|
483
|
-
|
|
439
|
+
const leftData = {};
|
|
440
|
+
data.forEach(item => {
|
|
441
|
+
const key = item[customKey];
|
|
484
442
|
render(item);
|
|
485
|
-
|
|
443
|
+
leftData[key] = item;
|
|
486
444
|
});
|
|
487
|
-
setTransData(Object.assign({},
|
|
445
|
+
setTransData(Object.assign({}, leftData));
|
|
488
446
|
}
|
|
489
447
|
}, [data]);
|
|
490
|
-
useEffect(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
value === null || value === void 0 ? void 0 : value.forEach(
|
|
448
|
+
useEffect(() => {
|
|
449
|
+
const rData = [];
|
|
450
|
+
const lData = [];
|
|
451
|
+
value === null || value === void 0 ? void 0 : value.forEach(item => {
|
|
494
452
|
if (transData[item]) {
|
|
495
453
|
rData.push(transData[item]);
|
|
496
454
|
delete transData[item];
|
|
497
455
|
}
|
|
498
456
|
});
|
|
499
|
-
for (
|
|
457
|
+
for (const key in transData) {
|
|
500
458
|
lData.push(transData[key]);
|
|
501
459
|
}
|
|
502
|
-
setRightData([]
|
|
503
|
-
setLeftData([]
|
|
460
|
+
setRightData([...rData]);
|
|
461
|
+
setLeftData([...lData]);
|
|
504
462
|
}, [value, transData]);
|
|
505
|
-
useEffect(
|
|
506
|
-
|
|
507
|
-
leftData.forEach(
|
|
463
|
+
useEffect(() => {
|
|
464
|
+
const arr = [];
|
|
465
|
+
leftData.forEach((item, index) => {
|
|
508
466
|
if (item.checked && !item.hide) {
|
|
509
467
|
arr.push(index);
|
|
510
468
|
}
|
|
511
469
|
});
|
|
512
470
|
setLeftCount(arr);
|
|
513
|
-
|
|
514
|
-
rightData.forEach(
|
|
471
|
+
const rArr = [];
|
|
472
|
+
rightData.forEach((item, index) => {
|
|
515
473
|
if (item.checked && !item.hide) {
|
|
516
474
|
rArr.push(index);
|
|
517
475
|
}
|
|
@@ -547,7 +505,7 @@ var Transfer = function Transfer(props) {
|
|
|
547
505
|
arrow: false,
|
|
548
506
|
placement: 'bottomLeft'
|
|
549
507
|
},
|
|
550
|
-
onClick:
|
|
508
|
+
onClick: () => {
|
|
551
509
|
onMove('right');
|
|
552
510
|
}
|
|
553
511
|
}, {
|
|
@@ -562,7 +520,7 @@ var Transfer = function Transfer(props) {
|
|
|
562
520
|
arrow: false,
|
|
563
521
|
placement: 'bottomLeft'
|
|
564
522
|
},
|
|
565
|
-
onClick:
|
|
523
|
+
onClick: () => {
|
|
566
524
|
fluctuation('up');
|
|
567
525
|
}
|
|
568
526
|
}, {
|
|
@@ -577,7 +535,7 @@ var Transfer = function Transfer(props) {
|
|
|
577
535
|
arrow: false,
|
|
578
536
|
placement: 'bottomLeft'
|
|
579
537
|
},
|
|
580
|
-
onClick:
|
|
538
|
+
onClick: () => {
|
|
581
539
|
fluctuation('down');
|
|
582
540
|
}
|
|
583
541
|
}, {
|
|
@@ -592,7 +550,7 @@ var Transfer = function Transfer(props) {
|
|
|
592
550
|
arrow: false,
|
|
593
551
|
placement: 'bottomLeft'
|
|
594
552
|
},
|
|
595
|
-
onClick:
|
|
553
|
+
onClick: () => {
|
|
596
554
|
onMove('left');
|
|
597
555
|
}
|
|
598
556
|
}, {
|
|
@@ -617,6 +575,6 @@ var Transfer = function Transfer(props) {
|
|
|
617
575
|
})]
|
|
618
576
|
}));
|
|
619
577
|
};
|
|
620
|
-
|
|
578
|
+
const SSortablejs = Sortablejs;
|
|
621
579
|
|
|
622
580
|
export { SSortablejs, Transfer, Transfer as default };
|