@para-ui/core 4.0.0-rc.4 → 4.0.0-rc.6
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 +90 -118
- package/ButtonGroup/index.js +30 -33
- package/Carousel/index.js +29 -33
- package/Cascader/index.js +9 -10
- 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 +260 -337
- package/ComboSelect/lang/en_US.d.ts +1 -0
- package/ComboSelect/lang/index.d.ts +2 -0
- package/ComboSelect/lang/zh_CN.d.ts +1 -0
- package/ComboSelect/utils.d.ts +6 -0
- package/Container/index.js +17 -21
- package/CopyText/index.js +50 -83
- package/DatePicker/index.js +24 -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 +222 -224
- package/DynamicMultiBox/interface.d.ts +7 -0
- package/Empty/index.js +26 -28
- package/Form/index.js +70 -74
- package/FormItem/index.js +18 -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 +582 -796
- package/SelectorPicker/index.js +113 -134
- 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 +24 -25
- package/Styles/theme.scss +9 -9
- package/Switch/index.js +32 -35
- package/Table/index.js +360 -494
- package/Tabs/index.js +100 -100
- package/Tag/index.js +64 -82
- package/TextEditor/index.js +78 -100
- package/TextField/index.js +142 -183
- package/TimePicker/index.js +29 -28
- package/Timeline/index.js +50 -47
- package/Title/index.js +32 -34
- package/ToggleButton/index.js +29 -29
- package/Tooltip/index.js +52 -56
- package/Transfer/index.js +117 -154
- package/Tree/index.js +9 -10
- package/Upload/index.js +125 -143
- package/Upload/interface.d.ts +2 -0
- package/_verture/{constant-0d9802f7.js → constant-5317fc89.js} +2 -2
- package/_verture/{index-5a7e2438.js → index-3cdaba96.js} +967 -934
- package/_verture/{index-b1f80962.js → index-4fafd0a0.js} +6 -8
- package/_verture/{index-024bbc9b.js → index-775ad32d.js} +29 -25
- package/_verture/{index-05f7bf11.js → index-c568f272.js} +2 -2
- package/_verture/{index-232d890b.js → index-d63bd287.js} +1 -1
- package/_verture/index-da9097d3.js +239 -0
- package/_verture/{index-9331b116.js → index-e0f9064d.js} +125 -134
- package/_verture/intl-f2f27722.js +69 -0
- package/_verture/{modalContext-736ff215.js → modalContext-8534f23d.js} +36 -64
- package/_verture/{slicedToArray-a8206399.js → slicedToArray-75fa4188.js} +15 -2
- package/_verture/{toConsumableArray-8f4c9589.js → toConsumableArray-c7a8028f.js} +1 -1
- 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-c17b5265.js +97 -0
- package/index.js +24 -23
- package/locale/en-US.d.ts +1 -0
- package/locale/index.d.ts +2 -0
- package/locale/index.js +10 -8
- package/locale/zh-CN.d.ts +1 -0
- package/package.json +11 -10
- 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-e9007d6a.js +0 -236
- package/_verture/intl-5c1ec055.js +0 -81
- package/_verture/unsupportedIterableToArray-cb478f24.js +0 -16
- package/_verture/utils-418da0a4.js +0 -73
- /package/_verture/{typeof-c310ee4a.js → typeof-b240b062.js} +0 -0
package/Tooltip/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { _ as _slicedToArray } from '../_verture/slicedToArray-a8206399.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 RcTooltip from 'rc-tooltip';
|
|
6
5
|
import { placements } from 'rc-tooltip/lib/placements';
|
|
7
6
|
import clsx from 'clsx';
|
|
8
|
-
import { a as $rcPrefixCls, $ as $prefixCls } from '../_verture/constant-
|
|
7
|
+
import { a as $rcPrefixCls, $ as $prefixCls } from '../_verture/constant-5317fc89.js';
|
|
9
8
|
import Forbid from '@para-ui/icons/Forbid';
|
|
10
9
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
11
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
12
10
|
|
|
13
11
|
//自动调整位置
|
|
14
12
|
var autoAdjustOverflowEnabled = {
|
|
@@ -200,31 +198,27 @@ var css_248z = "@charset \"UTF-8\";\n/**\n* @author Hanz\n* @date 2022/5/25 下
|
|
|
200
198
|
styleInject(css_248z);
|
|
201
199
|
|
|
202
200
|
//tooltip
|
|
203
|
-
|
|
201
|
+
const Tooltip = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
204
202
|
var _a;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var tRef = React__default.useRef(); //实例
|
|
211
|
-
var _React$useState3 = React__default.useState([0, 0]),
|
|
212
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
213
|
-
targetOffset = _React$useState4[0],
|
|
214
|
-
setTargetOffset = _React$useState4[1];
|
|
215
|
-
React__default.useEffect(function () {
|
|
203
|
+
const [visible, setVisible] = React__default.useState(props.defaultVisible); //是否显示
|
|
204
|
+
const wrapRef = React__default.useRef(); //锚点
|
|
205
|
+
const tRef = React__default.useRef(); //实例
|
|
206
|
+
const [targetOffset, setTargetOffset] = React__default.useState([0, 0]);
|
|
207
|
+
React__default.useEffect(() => {
|
|
216
208
|
var _a;
|
|
217
209
|
if ('visible' in props || 'open' in props) {
|
|
218
210
|
setVisible(!!((_a = props.visible) !== null && _a !== void 0 ? _a : props.open));
|
|
219
211
|
}
|
|
220
212
|
}, [(_a = props.visible) !== null && _a !== void 0 ? _a : props.open]);
|
|
221
213
|
//no title
|
|
222
|
-
|
|
223
|
-
|
|
214
|
+
const isUntitled = () => {
|
|
215
|
+
const {
|
|
216
|
+
title
|
|
217
|
+
} = props;
|
|
224
218
|
return !title && title !== 0;
|
|
225
219
|
};
|
|
226
220
|
//浮层切换时回调
|
|
227
|
-
|
|
221
|
+
const onVisibleChange = vis => {
|
|
228
222
|
var _a;
|
|
229
223
|
if (!('visible' in props || 'open' in props)) {
|
|
230
224
|
setVisible(isUntitled() ? false : vis);
|
|
@@ -234,26 +228,26 @@ var Tooltip = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
234
228
|
}
|
|
235
229
|
};
|
|
236
230
|
//tooltip 弹出位置
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
231
|
+
const getTooltipPlacements = () => {
|
|
232
|
+
const {
|
|
233
|
+
builtinPlacements,
|
|
234
|
+
autoAdjustOverflow
|
|
235
|
+
} = props;
|
|
240
236
|
return builtinPlacements || getPlacements({
|
|
241
|
-
autoAdjustOverflow
|
|
237
|
+
autoAdjustOverflow
|
|
242
238
|
});
|
|
243
239
|
};
|
|
244
240
|
// 动态设置动画点
|
|
245
|
-
|
|
246
|
-
|
|
241
|
+
const onPopupAlign = (domNode, align) => {
|
|
242
|
+
const placements = getTooltipPlacements();
|
|
247
243
|
// 当前返回的位置
|
|
248
|
-
|
|
249
|
-
return placements[key].points[0] === align.points[0] && placements[key].points[1] === align.points[1];
|
|
250
|
-
});
|
|
244
|
+
const placement = Object.keys(placements).find(key => placements[key].points[0] === align.points[0] && placements[key].points[1] === align.points[1]);
|
|
251
245
|
if (!placement) {
|
|
252
246
|
return;
|
|
253
247
|
}
|
|
254
248
|
// 根据当前坐标设置动画点
|
|
255
|
-
|
|
256
|
-
|
|
249
|
+
const rect = domNode.getBoundingClientRect();
|
|
250
|
+
const transformOrigin = {
|
|
257
251
|
top: '50%',
|
|
258
252
|
left: '50%'
|
|
259
253
|
};
|
|
@@ -270,44 +264,46 @@ var Tooltip = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
270
264
|
domNode.style.transformOrigin = "".concat(transformOrigin.left, " ").concat(transformOrigin.top);
|
|
271
265
|
};
|
|
272
266
|
//跟随光标
|
|
273
|
-
|
|
267
|
+
const handleMouseMove = e => {
|
|
274
268
|
var _a, _b, _c, _d;
|
|
275
269
|
if (wrapRef.current) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
x
|
|
280
|
-
y
|
|
281
|
-
width
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
270
|
+
const popupHeight = ((_d = (_c = (_b = (_a = tRef.current) === null || _a === void 0 ? void 0 : _a.popupRef) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.getElement()) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
|
|
271
|
+
const cursorSpace = popupHeight === 0 ? 60 : 30;
|
|
272
|
+
const {
|
|
273
|
+
x,
|
|
274
|
+
y,
|
|
275
|
+
width
|
|
276
|
+
} = wrapRef.current.getBoundingClientRect();
|
|
277
|
+
const newX = e.clientX - (x + width / 2);
|
|
278
|
+
const newY = e.clientY - y + popupHeight + cursorSpace;
|
|
279
|
+
setTimeout(() => {
|
|
285
280
|
setTargetOffset([-newX, -newY]);
|
|
286
281
|
});
|
|
287
282
|
}
|
|
288
283
|
};
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
284
|
+
const {
|
|
285
|
+
prefixCls = "".concat($rcPrefixCls, "-tooltip"),
|
|
286
|
+
getPopupContainer,
|
|
287
|
+
overlayClassName,
|
|
288
|
+
overlayInnerStyle,
|
|
289
|
+
overlayStyle,
|
|
290
|
+
children,
|
|
291
|
+
title,
|
|
292
|
+
placement,
|
|
293
|
+
isPopover,
|
|
294
|
+
followCursor,
|
|
295
|
+
maxWidth,
|
|
296
|
+
disabled
|
|
297
|
+
} = props,
|
|
302
298
|
restProps = __rest(props, ["prefixCls", "getPopupContainer", "overlayClassName", "overlayInnerStyle", "overlayStyle", "children", "title", "placement", "isPopover", "followCursor", "maxWidth", "disabled"]);
|
|
303
|
-
|
|
299
|
+
let tempVisible = visible;
|
|
304
300
|
if (!('visible' in props || 'open' in props) && isUntitled()) {
|
|
305
301
|
//没有title必然不可见
|
|
306
302
|
tempVisible = false;
|
|
307
303
|
}
|
|
308
304
|
//overlayCls
|
|
309
|
-
|
|
310
|
-
|
|
305
|
+
const overlayCls = clsx(!isPopover && "".concat($prefixCls, "-tooltip"), overlayClassName);
|
|
306
|
+
const mergeOverlayStyle = Object.assign({}, overlayStyle);
|
|
311
307
|
if (maxWidth) {
|
|
312
308
|
mergeOverlayStyle.maxWidth = maxWidth;
|
|
313
309
|
}
|
|
@@ -325,7 +321,7 @@ var Tooltip = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
|
325
321
|
}),
|
|
326
322
|
visible: tempVisible,
|
|
327
323
|
align: {
|
|
328
|
-
targetOffset
|
|
324
|
+
targetOffset
|
|
329
325
|
},
|
|
330
326
|
onVisibleChange: onVisibleChange,
|
|
331
327
|
onPopupAlign: onPopupAlign,
|
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,25 @@ 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';
|
|
11
|
+
import { _ as _slicedToArray } from '../_verture/slicedToArray-75fa4188.js';
|
|
13
12
|
import { Search } from '../Search/index.js';
|
|
14
13
|
import SearchIcon from '@para-ui/icons/Search';
|
|
15
14
|
import AutoTips from '../AutoTips/index.js';
|
|
16
15
|
import Drag from '@para-ui/icons/Drag';
|
|
17
16
|
import { S as Sortable } from '../_verture/sortable.esm-49896035.js';
|
|
18
|
-
import { d as debounce } from '../_verture/utils-
|
|
17
|
+
import { d as debounce } from '../_verture/utils-c17b5265.js';
|
|
19
18
|
import { s as styleInject } from '../_verture/style-inject.es-300983ab.js';
|
|
20
|
-
import '../_verture/unsupportedIterableToArray-cb478f24.js';
|
|
21
|
-
import '../_verture/typeof-adeedc13.js';
|
|
22
19
|
import '../_verture/tslib.es6-55ed4bd2.js';
|
|
23
20
|
import '@para-ui/icons/LoadingF';
|
|
24
21
|
import '../Tooltip/index.js';
|
|
25
22
|
import 'rc-tooltip';
|
|
26
23
|
import 'rc-tooltip/lib/placements';
|
|
27
24
|
import '@para-ui/icons/Forbid';
|
|
28
|
-
import '../_verture/index-
|
|
25
|
+
import '../_verture/index-da9097d3.js';
|
|
29
26
|
import 'rc-dropdown';
|
|
30
|
-
import '../_verture/usePopupContainer-
|
|
27
|
+
import '../_verture/usePopupContainer-635f66f4.js';
|
|
31
28
|
import 'dayjs';
|
|
32
29
|
import '@paraview/lib';
|
|
33
30
|
import '@para-ui/core/GlobalContext';
|
|
@@ -40,8 +37,7 @@ import '@para-ui/icons/PreviewOpen';
|
|
|
40
37
|
import '@para-ui/icons/CloseCircleF';
|
|
41
38
|
import '../Loading/index.js';
|
|
42
39
|
import '../HelperText/index.js';
|
|
43
|
-
import '../_verture/useGlobalProps-
|
|
44
|
-
import '../_verture/defineProperty-1d116156.js';
|
|
40
|
+
import '../_verture/useGlobalProps-1e416658.js';
|
|
45
41
|
|
|
46
42
|
var en = {
|
|
47
43
|
left: 'Left',
|
|
@@ -264,112 +260,80 @@ var Sortablejs = Sortable;
|
|
|
264
260
|
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
261
|
styleInject(css_248z);
|
|
266
262
|
|
|
267
|
-
|
|
263
|
+
const Transfer = props => {
|
|
268
264
|
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({
|
|
265
|
+
const intl = useFormatMessage('Transfer', localeJson);
|
|
266
|
+
const {
|
|
267
|
+
data = [],
|
|
268
|
+
value,
|
|
269
|
+
customKey = 'key',
|
|
270
|
+
onChange,
|
|
271
|
+
titles = [intl({
|
|
278
272
|
id: 'left'
|
|
279
273
|
}), intl({
|
|
280
274
|
id: 'right'
|
|
281
|
-
})]
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
style =
|
|
275
|
+
})],
|
|
276
|
+
// ['左侧', '右侧']
|
|
277
|
+
className,
|
|
278
|
+
style = {
|
|
285
279
|
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) {
|
|
280
|
+
},
|
|
281
|
+
onSort,
|
|
282
|
+
trim = false,
|
|
283
|
+
multiple = true,
|
|
284
|
+
rightIcon,
|
|
285
|
+
render = item => {}
|
|
286
|
+
} = props;
|
|
287
|
+
const [transData, setTransData] = useState({});
|
|
288
|
+
const [leftData, setLeftData] = useState([]);
|
|
289
|
+
const [rightData, setRightData] = useState([]);
|
|
290
|
+
const [leftCount, setLeftCount] = useState([]);
|
|
291
|
+
const [rightCount, setRightCount] = useState([]);
|
|
292
|
+
const [fluctuationPosition, setFluctuationPosition] = useState();
|
|
293
|
+
const [fluctuationOrther, setFluctuationOrther] = useState();
|
|
294
|
+
const [animationsLock, setAnimationLock] = useState(false);
|
|
295
|
+
const onchange = useCallback((e, bol, index, direction, multiple) => {
|
|
328
296
|
if (direction === 'left') {
|
|
329
|
-
!multiple && leftData.forEach(
|
|
330
|
-
return item.checked = false;
|
|
331
|
-
});
|
|
297
|
+
!multiple && leftData.forEach(item => item.checked = false);
|
|
332
298
|
leftData[index].checked = bol;
|
|
333
|
-
setLeftData(
|
|
299
|
+
setLeftData([...leftData]);
|
|
334
300
|
} else {
|
|
335
|
-
!multiple && rightData.forEach(
|
|
336
|
-
return item.checked = false;
|
|
337
|
-
});
|
|
301
|
+
!multiple && rightData.forEach(item => item.checked = false);
|
|
338
302
|
rightData[index].checked = bol;
|
|
339
|
-
setRightData(
|
|
303
|
+
setRightData([...rightData]);
|
|
340
304
|
}
|
|
341
305
|
}, [leftData, rightData]);
|
|
342
|
-
|
|
306
|
+
const queryAll = useCallback((checked, direction) => {
|
|
343
307
|
if (direction === 'left') {
|
|
344
|
-
leftData.forEach(
|
|
308
|
+
leftData.forEach(item => {
|
|
345
309
|
if (!item.disabled && !item.hide) item.checked = checked;
|
|
346
310
|
});
|
|
347
|
-
setLeftData(
|
|
311
|
+
setLeftData([...leftData]);
|
|
348
312
|
} else {
|
|
349
|
-
rightData.forEach(
|
|
313
|
+
rightData.forEach(item => {
|
|
350
314
|
if (!item.disabled && !item.hide) item.checked = checked;
|
|
351
315
|
});
|
|
352
|
-
setRightData(
|
|
316
|
+
setRightData([...rightData]);
|
|
353
317
|
}
|
|
354
318
|
}, [leftData, rightData]);
|
|
355
|
-
|
|
319
|
+
const inverse = useCallback(direction => {
|
|
356
320
|
if (direction === 'left') {
|
|
357
|
-
leftData.forEach(
|
|
321
|
+
leftData.forEach(item => {
|
|
358
322
|
if (!item.disabled && !item.hide) item.checked = !item.checked;
|
|
359
323
|
});
|
|
360
|
-
setLeftData(
|
|
324
|
+
setLeftData([...leftData]);
|
|
361
325
|
} else {
|
|
362
|
-
rightData.forEach(
|
|
326
|
+
rightData.forEach(item => {
|
|
363
327
|
if (!item.disabled && !item.hide) item.checked = !item.checked;
|
|
364
328
|
});
|
|
365
|
-
setRightData(
|
|
329
|
+
setRightData([...rightData]);
|
|
366
330
|
}
|
|
367
331
|
}, [leftData, rightData]);
|
|
368
|
-
|
|
369
|
-
|
|
332
|
+
const onMove = direction => {
|
|
333
|
+
let newData = [];
|
|
370
334
|
if (direction === 'left') {
|
|
371
|
-
newData =
|
|
372
|
-
newData.forEach(
|
|
335
|
+
newData = [...rightData];
|
|
336
|
+
newData.forEach(item => {
|
|
373
337
|
if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
|
|
374
338
|
item.checked = false;
|
|
375
339
|
leftData.push(item);
|
|
@@ -377,8 +341,8 @@ var Transfer = function Transfer(props) {
|
|
|
377
341
|
}
|
|
378
342
|
});
|
|
379
343
|
} else {
|
|
380
|
-
newData =
|
|
381
|
-
newData.forEach(
|
|
344
|
+
newData = [...leftData];
|
|
345
|
+
newData.forEach(item => {
|
|
382
346
|
if ((item === null || item === void 0 ? void 0 : item.checked) && !(item === null || item === void 0 ? void 0 : item.hide)) {
|
|
383
347
|
item.checked = false;
|
|
384
348
|
rightData.push(item);
|
|
@@ -386,132 +350,131 @@ var Transfer = function Transfer(props) {
|
|
|
386
350
|
}
|
|
387
351
|
});
|
|
388
352
|
}
|
|
389
|
-
setLeftData(
|
|
390
|
-
setRightData(
|
|
391
|
-
|
|
392
|
-
rightData.forEach(
|
|
353
|
+
setLeftData([...leftData]);
|
|
354
|
+
setRightData([...rightData]);
|
|
355
|
+
const rArr = [];
|
|
356
|
+
rightData.forEach(item => {
|
|
393
357
|
rArr.push(item[customKey]);
|
|
394
358
|
});
|
|
395
359
|
onChange === null || onChange === void 0 ? void 0 : onChange(rArr);
|
|
396
360
|
};
|
|
397
361
|
// 上下移动
|
|
398
|
-
|
|
362
|
+
const fluctuation = direction => {
|
|
399
363
|
setAnimationLock(true);
|
|
400
364
|
if (direction == 'up') {
|
|
401
365
|
// setFluctuationPosition(rightCount[0] - 1)
|
|
402
366
|
// setFluctuationOrther(rightCount[0])
|
|
403
367
|
// setTimeout(() => {
|
|
404
|
-
setRightData(
|
|
368
|
+
setRightData(pre => {
|
|
405
369
|
// setFluctuationPosition(undefined)
|
|
406
370
|
// setFluctuationOrther(undefined)
|
|
407
|
-
rightCount.forEach(
|
|
408
|
-
pre.splice
|
|
371
|
+
rightCount.forEach(item => {
|
|
372
|
+
pre.splice(item - 1, 0, ...pre.splice(item, 1));
|
|
409
373
|
});
|
|
410
374
|
setAnimationLock(false);
|
|
411
|
-
|
|
412
|
-
pre.forEach(
|
|
375
|
+
const rArr = [];
|
|
376
|
+
pre.forEach(item => {
|
|
413
377
|
rArr.push(item[customKey]);
|
|
414
378
|
});
|
|
415
|
-
onSort === null || onSort === void 0 ? void 0 : onSort([]
|
|
416
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([]
|
|
417
|
-
return
|
|
379
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
|
|
380
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
|
|
381
|
+
return [...pre];
|
|
418
382
|
});
|
|
419
383
|
// }, 400)
|
|
420
384
|
} else {
|
|
421
385
|
// setFluctuationPosition(rightCount[0])
|
|
422
386
|
// setFluctuationOrther(rightCount[0] + 1)
|
|
423
387
|
// setTimeout(() => {
|
|
424
|
-
setRightData(
|
|
388
|
+
setRightData(pre => {
|
|
425
389
|
// setFluctuationPosition(undefined)
|
|
426
390
|
// setFluctuationOrther(undefined)
|
|
427
|
-
rightCount.reverse().forEach(
|
|
428
|
-
pre.splice
|
|
391
|
+
rightCount.reverse().forEach(item => {
|
|
392
|
+
pre.splice(item + 1, 0, ...pre.splice(item, 1));
|
|
429
393
|
});
|
|
430
394
|
setAnimationLock(false);
|
|
431
|
-
|
|
432
|
-
pre.forEach(
|
|
395
|
+
const rArr = [];
|
|
396
|
+
pre.forEach(item => {
|
|
433
397
|
rArr.push(item[customKey]);
|
|
434
398
|
});
|
|
435
|
-
onSort === null || onSort === void 0 ? void 0 : onSort([]
|
|
436
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([]
|
|
437
|
-
return
|
|
399
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
|
|
400
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
|
|
401
|
+
return [...pre];
|
|
438
402
|
});
|
|
439
403
|
// }, 400)
|
|
440
404
|
}
|
|
441
405
|
};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
var str = trim ? e.toUpperCase().trim() : e.toUpperCase();
|
|
406
|
+
const onSearch = debounce((e, direction) => {
|
|
407
|
+
const str = trim ? e.toUpperCase().trim() : e.toUpperCase();
|
|
445
408
|
if (direction === 'left') {
|
|
446
|
-
leftData.forEach(
|
|
409
|
+
leftData.forEach(item => {
|
|
447
410
|
item.hide = false;
|
|
448
|
-
|
|
449
|
-
|
|
411
|
+
const name = (item.name || '').toUpperCase();
|
|
412
|
+
const description = (item.description || '').toUpperCase();
|
|
450
413
|
if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
|
|
451
414
|
item.hide = true;
|
|
452
415
|
}
|
|
453
416
|
});
|
|
454
|
-
setLeftData(
|
|
417
|
+
setLeftData([...leftData]);
|
|
455
418
|
} else {
|
|
456
|
-
rightData.filter(
|
|
419
|
+
rightData.filter(item => {
|
|
457
420
|
item.hide = false;
|
|
458
|
-
|
|
459
|
-
|
|
421
|
+
const name = (item.name || '').toUpperCase();
|
|
422
|
+
const description = (item.description || '').toUpperCase();
|
|
460
423
|
if (!(name.indexOf(str) !== -1 || description.indexOf(str) !== -1)) {
|
|
461
424
|
item.hide = true;
|
|
462
425
|
}
|
|
463
426
|
});
|
|
464
|
-
setRightData(
|
|
427
|
+
setRightData([...rightData]);
|
|
465
428
|
}
|
|
466
429
|
}, 500);
|
|
467
|
-
|
|
468
|
-
setRightData(
|
|
469
|
-
pre.splice
|
|
470
|
-
|
|
471
|
-
pre.forEach(
|
|
430
|
+
const onEndSort = useCallback((oldIndex, newIndex) => {
|
|
431
|
+
setRightData(pre => {
|
|
432
|
+
pre.splice(newIndex, 0, ...pre.splice(oldIndex, 1));
|
|
433
|
+
const rArr = [];
|
|
434
|
+
pre.forEach(item => {
|
|
472
435
|
rArr.push(item[customKey]);
|
|
473
436
|
});
|
|
474
|
-
onSort === null || onSort === void 0 ? void 0 : onSort([]
|
|
475
|
-
onChange === null || onChange === void 0 ? void 0 : onChange([]
|
|
476
|
-
return
|
|
437
|
+
onSort === null || onSort === void 0 ? void 0 : onSort([...rArr]);
|
|
438
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([...rArr]);
|
|
439
|
+
return [...pre];
|
|
477
440
|
});
|
|
478
441
|
}, []);
|
|
479
|
-
useEffect(
|
|
442
|
+
useEffect(() => {
|
|
480
443
|
if (data.length) {
|
|
481
|
-
|
|
482
|
-
data.forEach(
|
|
483
|
-
|
|
444
|
+
const leftData = {};
|
|
445
|
+
data.forEach(item => {
|
|
446
|
+
const key = item[customKey];
|
|
484
447
|
render(item);
|
|
485
|
-
|
|
448
|
+
leftData[key] = item;
|
|
486
449
|
});
|
|
487
|
-
setTransData(Object.assign({},
|
|
450
|
+
setTransData(Object.assign({}, leftData));
|
|
488
451
|
}
|
|
489
452
|
}, [data]);
|
|
490
|
-
useEffect(
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
value === null || value === void 0 ? void 0 : value.forEach(
|
|
453
|
+
useEffect(() => {
|
|
454
|
+
const rData = [];
|
|
455
|
+
const lData = [];
|
|
456
|
+
value === null || value === void 0 ? void 0 : value.forEach(item => {
|
|
494
457
|
if (transData[item]) {
|
|
495
458
|
rData.push(transData[item]);
|
|
496
459
|
delete transData[item];
|
|
497
460
|
}
|
|
498
461
|
});
|
|
499
|
-
for (
|
|
462
|
+
for (const key in transData) {
|
|
500
463
|
lData.push(transData[key]);
|
|
501
464
|
}
|
|
502
|
-
setRightData([]
|
|
503
|
-
setLeftData([]
|
|
465
|
+
setRightData([...rData]);
|
|
466
|
+
setLeftData([...lData]);
|
|
504
467
|
}, [value, transData]);
|
|
505
|
-
useEffect(
|
|
506
|
-
|
|
507
|
-
leftData.forEach(
|
|
468
|
+
useEffect(() => {
|
|
469
|
+
const arr = [];
|
|
470
|
+
leftData.forEach((item, index) => {
|
|
508
471
|
if (item.checked && !item.hide) {
|
|
509
472
|
arr.push(index);
|
|
510
473
|
}
|
|
511
474
|
});
|
|
512
475
|
setLeftCount(arr);
|
|
513
|
-
|
|
514
|
-
rightData.forEach(
|
|
476
|
+
const rArr = [];
|
|
477
|
+
rightData.forEach((item, index) => {
|
|
515
478
|
if (item.checked && !item.hide) {
|
|
516
479
|
rArr.push(index);
|
|
517
480
|
}
|
|
@@ -547,7 +510,7 @@ var Transfer = function Transfer(props) {
|
|
|
547
510
|
arrow: false,
|
|
548
511
|
placement: 'bottomLeft'
|
|
549
512
|
},
|
|
550
|
-
onClick:
|
|
513
|
+
onClick: () => {
|
|
551
514
|
onMove('right');
|
|
552
515
|
}
|
|
553
516
|
}, {
|
|
@@ -562,7 +525,7 @@ var Transfer = function Transfer(props) {
|
|
|
562
525
|
arrow: false,
|
|
563
526
|
placement: 'bottomLeft'
|
|
564
527
|
},
|
|
565
|
-
onClick:
|
|
528
|
+
onClick: () => {
|
|
566
529
|
fluctuation('up');
|
|
567
530
|
}
|
|
568
531
|
}, {
|
|
@@ -577,7 +540,7 @@ var Transfer = function Transfer(props) {
|
|
|
577
540
|
arrow: false,
|
|
578
541
|
placement: 'bottomLeft'
|
|
579
542
|
},
|
|
580
|
-
onClick:
|
|
543
|
+
onClick: () => {
|
|
581
544
|
fluctuation('down');
|
|
582
545
|
}
|
|
583
546
|
}, {
|
|
@@ -592,7 +555,7 @@ var Transfer = function Transfer(props) {
|
|
|
592
555
|
arrow: false,
|
|
593
556
|
placement: 'bottomLeft'
|
|
594
557
|
},
|
|
595
|
-
onClick:
|
|
558
|
+
onClick: () => {
|
|
596
559
|
onMove('left');
|
|
597
560
|
}
|
|
598
561
|
}, {
|
|
@@ -617,6 +580,6 @@ var Transfer = function Transfer(props) {
|
|
|
617
580
|
})]
|
|
618
581
|
}));
|
|
619
582
|
};
|
|
620
|
-
|
|
583
|
+
const SSortablejs = Sortablejs;
|
|
621
584
|
|
|
622
585
|
export { SSortablejs, Transfer, Transfer as default };
|