@chaoswise/ui 2.2.6 → 2.2.8
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/lib/CWTable/CWTable.js +10 -5
- package/lib/QuickTransfer/CheckList.js +9 -3
- package/lib/QuickTransfer/NoDrag.js +50 -0
- package/lib/QuickTransfer/NotDragList.js +73 -21
- package/lib/QuickTransfer/TopicList.js +4 -2
- package/lib/QuickTransfer/index.js +11 -6
- package/lib/TooltipText/index.js +4 -2
- package/package.json +2 -2
package/lib/CWTable/CWTable.js
CHANGED
|
@@ -301,16 +301,20 @@ var CWTable = function CWTable(_ref, ref) {
|
|
|
301
301
|
watcher.current.observe(paginationContainerRef.current);
|
|
302
302
|
return function () {
|
|
303
303
|
if (outContainerRef.current) {
|
|
304
|
-
|
|
304
|
+
var _watcher$current;
|
|
305
|
+
(_watcher$current = watcher.current) === null || _watcher$current === void 0 ? void 0 : _watcher$current.unobserve(outContainerRef.current);
|
|
305
306
|
}
|
|
306
307
|
if (extraHeaderContainerRef.current) {
|
|
307
|
-
|
|
308
|
+
var _watcher$current2;
|
|
309
|
+
(_watcher$current2 = watcher.current) === null || _watcher$current2 === void 0 ? void 0 : _watcher$current2.unobserve(extraHeaderContainerRef.current);
|
|
308
310
|
}
|
|
309
311
|
if (searchContainerRef.current) {
|
|
310
|
-
|
|
312
|
+
var _watcher$current3;
|
|
313
|
+
(_watcher$current3 = watcher.current) === null || _watcher$current3 === void 0 ? void 0 : _watcher$current3.unobserve(searchContainerRef.current);
|
|
311
314
|
}
|
|
312
315
|
if (paginationContainerRef.current) {
|
|
313
|
-
|
|
316
|
+
var _watcher$current4;
|
|
317
|
+
(_watcher$current4 = watcher.current) === null || _watcher$current4 === void 0 ? void 0 : _watcher$current4.unobserve(paginationContainerRef.current);
|
|
314
318
|
}
|
|
315
319
|
};
|
|
316
320
|
}, [autoHeight]);
|
|
@@ -325,7 +329,8 @@ var CWTable = function CWTable(_ref, ref) {
|
|
|
325
329
|
}
|
|
326
330
|
return function () {
|
|
327
331
|
if (tableHeaderDom) {
|
|
328
|
-
|
|
332
|
+
var _watcher$current5;
|
|
333
|
+
(_watcher$current5 = watcher.current) === null || _watcher$current5 === void 0 ? void 0 : _watcher$current5.unobserve(tableHeaderDom);
|
|
329
334
|
}
|
|
330
335
|
};
|
|
331
336
|
}, [showHeader, autoHeight]);
|
|
@@ -7,6 +7,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
7
7
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
8
|
import React, { Fragment } from 'react';
|
|
9
9
|
import TopicList from './TopicList';
|
|
10
|
+
import { DndProvider } from "react-dnd";
|
|
11
|
+
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
10
12
|
var CheckList = function CheckList(props) {
|
|
11
13
|
var checkValue = props.checkValue,
|
|
12
14
|
handleDelete = props.handleDelete,
|
|
@@ -14,7 +16,8 @@ var CheckList = function CheckList(props) {
|
|
|
14
16
|
type = props.type,
|
|
15
17
|
render = props.render,
|
|
16
18
|
renderColumns = props.renderColumns,
|
|
17
|
-
dragList = props.dragList
|
|
19
|
+
dragList = props.dragList,
|
|
20
|
+
useDndProvider = props.useDndProvider;
|
|
18
21
|
var moveList = function moveList(dragIndex, hoverIndex) {
|
|
19
22
|
var tmp = checkValue[dragIndex]; //临时储存文件
|
|
20
23
|
checkValue.splice(dragIndex, 1); //移除拖拽项
|
|
@@ -38,11 +41,14 @@ var CheckList = function CheckList(props) {
|
|
|
38
41
|
handleDelete: handleDelete,
|
|
39
42
|
moveList: moveList,
|
|
40
43
|
dragList: dragList,
|
|
44
|
+
useDndProvider: useDndProvider,
|
|
41
45
|
isLockSort: isLockSort
|
|
42
46
|
}, item));
|
|
43
47
|
};
|
|
44
|
-
return /*#__PURE__*/React.createElement(Fragment, null,
|
|
48
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DndProvider, {
|
|
49
|
+
backend: HTML5Backend
|
|
50
|
+
}, checkValue.map(function (item, index) {
|
|
45
51
|
return renderList(item, index);
|
|
46
|
-
}));
|
|
52
|
+
})));
|
|
47
53
|
};
|
|
48
54
|
export default CheckList;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
import React, { Fragment } from 'react';
|
|
9
|
+
import NotDragList from "./NotDragList";
|
|
10
|
+
var NoDrag = function NoDrag(props) {
|
|
11
|
+
var checkValue = props.checkValue,
|
|
12
|
+
handleDelete = props.handleDelete,
|
|
13
|
+
handlePreviewList = props.handlePreviewList,
|
|
14
|
+
type = props.type,
|
|
15
|
+
render = props.render,
|
|
16
|
+
renderColumns = props.renderColumns,
|
|
17
|
+
dragList = props.dragList,
|
|
18
|
+
useDndProvider = props.useDndProvider;
|
|
19
|
+
var moveList = function moveList(dragIndex, hoverIndex) {
|
|
20
|
+
var tmp = checkValue[dragIndex]; //临时储存文件
|
|
21
|
+
checkValue.splice(dragIndex, 1); //移除拖拽项
|
|
22
|
+
checkValue.splice(hoverIndex, 0, tmp); //插入放置项
|
|
23
|
+
handlePreviewList(_toConsumableArray(checkValue)); //更新修改后的列表
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var isLockSort = type === "list" && checkValue.filter(function (item) {
|
|
27
|
+
return item.disabled;
|
|
28
|
+
}).length;
|
|
29
|
+
var renderList = function renderList(item, index) {
|
|
30
|
+
return /*#__PURE__*/React.createElement(NotDragList, _extends({
|
|
31
|
+
labelValue: item,
|
|
32
|
+
type: type,
|
|
33
|
+
renderColumns: renderColumns,
|
|
34
|
+
label: item.key,
|
|
35
|
+
value: item.title && item.title,
|
|
36
|
+
index: index,
|
|
37
|
+
render: render,
|
|
38
|
+
key: item.key,
|
|
39
|
+
handleDelete: handleDelete,
|
|
40
|
+
moveList: moveList,
|
|
41
|
+
dragList: dragList,
|
|
42
|
+
useDndProvider: useDndProvider,
|
|
43
|
+
isLockSort: isLockSort
|
|
44
|
+
}, item));
|
|
45
|
+
};
|
|
46
|
+
return /*#__PURE__*/React.createElement(Fragment, null, checkValue.map(function (item, index) {
|
|
47
|
+
return renderList(item, index);
|
|
48
|
+
}));
|
|
49
|
+
};
|
|
50
|
+
export default NoDrag;
|
|
@@ -1,32 +1,84 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import _Icon from "@chaoswise/ui/lib/Antd/Icon";
|
|
2
|
+
import "@chaoswise/ui/lib/Tooltip/index.less";
|
|
3
|
+
import _Tooltip from "@chaoswise/ui/lib/Tooltip";
|
|
4
|
+
import _ConfigProvider from "@chaoswise/ui/lib/ConfigProvider";
|
|
5
|
+
var _excluded = ["label", "value", "index", "handleDelete", "labelValue", "moveList", "type", "renderColumns", "render", "dragList", "disabled", "isLockSort"];
|
|
6
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
import React, { Fragment, useRef } from "react";
|
|
10
|
+
import { useDrag, useDrop } from "react-dnd";
|
|
11
|
+
import classnames from "classnames";
|
|
12
|
+
import { getLocale } from "./locale";
|
|
13
|
+
import LockSvg from "./assets/LockSvg";
|
|
14
|
+
import DragSvg from "./assets/DragSvg";
|
|
15
|
+
import { DndProvider } from "react-dnd";
|
|
16
|
+
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
17
|
+
var NotDragList = function NotDragList(_ref) {
|
|
18
|
+
var label = _ref.label,
|
|
19
|
+
value = _ref.value,
|
|
20
|
+
index = _ref.index,
|
|
4
21
|
handleDelete = _ref.handleDelete,
|
|
22
|
+
labelValue = _ref.labelValue,
|
|
23
|
+
moveList = _ref.moveList,
|
|
5
24
|
type = _ref.type,
|
|
6
25
|
renderColumns = _ref.renderColumns,
|
|
7
|
-
render = _ref.render
|
|
8
|
-
|
|
26
|
+
render = _ref.render,
|
|
27
|
+
dragList = _ref.dragList,
|
|
28
|
+
disabled = _ref.disabled,
|
|
29
|
+
isLockSort = _ref.isLockSort,
|
|
30
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
// 获取当前语言
|
|
32
|
+
var _ConfigProvider$useLo = _ConfigProvider.useLocale(),
|
|
33
|
+
_ConfigProvider$useLo2 = _ConfigProvider$useLo.locale,
|
|
34
|
+
locale = _ConfigProvider$useLo2 === void 0 ? "zh" : _ConfigProvider$useLo2;
|
|
35
|
+
var localeObj = getLocale(locale);
|
|
36
|
+
var handleDeleted = function handleDeleted(labelValue) {
|
|
37
|
+
handleDelete(labelValue);
|
|
38
|
+
};
|
|
39
|
+
var renderTable = function renderTable(labelValue) {
|
|
9
40
|
return /*#__PURE__*/React.createElement("div", null, renderColumns.map(function (item, index) {
|
|
10
41
|
return /*#__PURE__*/React.createElement("span", {
|
|
11
42
|
style: {
|
|
12
|
-
marginRight:
|
|
43
|
+
marginRight: "8px"
|
|
13
44
|
},
|
|
14
45
|
key: index
|
|
15
|
-
}, render(
|
|
46
|
+
}, render(labelValue[item]));
|
|
16
47
|
}));
|
|
17
48
|
};
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
var dragProps = dragList && !disabled ? {
|
|
50
|
+
style: {
|
|
51
|
+
cursor: "move"
|
|
52
|
+
}
|
|
53
|
+
} : {};
|
|
54
|
+
var listLockSortContent = /*#__PURE__*/React.createElement("div", {
|
|
55
|
+
className: "cw-transfer-right-content-item"
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: "cw-transfer-right-content-item-drag-wrapper"
|
|
58
|
+
}, disabled ? /*#__PURE__*/React.createElement(LockSvg, null) : /*#__PURE__*/React.createElement(_Tooltip, {
|
|
59
|
+
title: localeObj["dragAndDrop"]
|
|
60
|
+
}, /*#__PURE__*/React.createElement(DragSvg, null))), /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
className: "cw-transfer-right-content-item-text-wrapper"
|
|
62
|
+
}, render(value)), !disabled && /*#__PURE__*/React.createElement(_Icon, {
|
|
63
|
+
type: "close",
|
|
64
|
+
className: "cw-transfer-right-content-del",
|
|
65
|
+
onClick: function onClick() {
|
|
66
|
+
return handleDeleted(labelValue);
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
var renderItemContent = type == "list" && isLockSort ? listLockSortContent : /*#__PURE__*/React.createElement(Fragment, null, dragList && /*#__PURE__*/React.createElement(_Tooltip, {
|
|
70
|
+
title: localeObj["dragAndDrop"]
|
|
71
|
+
}, /*#__PURE__*/React.createElement(DragSvg, {
|
|
72
|
+
className: "cw-transfer-right-content-drag"
|
|
73
|
+
})), /*#__PURE__*/React.createElement("div", null, type === "table" ? renderTable(labelValue) : render(value)), /*#__PURE__*/React.createElement(_Icon, {
|
|
74
|
+
type: "close",
|
|
75
|
+
className: "cw-transfer-right-content-del",
|
|
76
|
+
onClick: function onClick() {
|
|
77
|
+
return handleDeleted(labelValue);
|
|
78
|
+
}
|
|
31
79
|
}));
|
|
32
|
-
|
|
80
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", _extends({
|
|
81
|
+
className: classnames("cw-transfer-right-content-main")
|
|
82
|
+
}, dragProps), renderItemContent));
|
|
83
|
+
};
|
|
84
|
+
export default NotDragList;
|
|
@@ -146,8 +146,10 @@ var TopicList = function TopicList(_ref) {
|
|
|
146
146
|
return handleDeleted(labelValue);
|
|
147
147
|
}
|
|
148
148
|
}));
|
|
149
|
-
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(
|
|
149
|
+
return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(DndProvider, {
|
|
150
|
+
backend: HTML5Backend
|
|
151
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
150
152
|
className: classnames("cw-transfer-right-content-main")
|
|
151
|
-
}, dragProps), renderItemContent));
|
|
153
|
+
}, dragProps), renderItemContent)));
|
|
152
154
|
};
|
|
153
155
|
export default TopicList;
|
|
@@ -37,13 +37,12 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
37
37
|
import React, { useState, useEffect, Fragment, forwardRef, useMemo } from "react";
|
|
38
38
|
import { filterTreeByName, filterTreeByNameTable, filterObj, getNotSelectKeys, getKeysAndTitle, getBottomKey, renderLeafNodetree, renderRelationNode } from "./utils";
|
|
39
39
|
import classnames from "classnames";
|
|
40
|
-
import { DndProvider } from "react-dnd";
|
|
41
|
-
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
42
40
|
import CheckList from "./CheckList";
|
|
43
41
|
import PropTypes from "prop-types";
|
|
44
42
|
import { getLocale } from "./locale";
|
|
45
43
|
import "./index.less";
|
|
46
44
|
import { isEqual } from "@chaoswise/utils";
|
|
45
|
+
import NoDrag from "./NoDrag";
|
|
47
46
|
var Search = _Input.Search;
|
|
48
47
|
|
|
49
48
|
/**
|
|
@@ -687,7 +686,15 @@ var QuickTransfer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
687
686
|
};
|
|
688
687
|
var list = searchCheckedValue.length === 0 ? /*#__PURE__*/React.createElement(_Empty, {
|
|
689
688
|
description: localeObj["pleaseSelectFromLeft"]
|
|
690
|
-
}) : /*#__PURE__*/React.createElement(CheckList, {
|
|
689
|
+
}) : useDndProvider ? /*#__PURE__*/React.createElement(CheckList, {
|
|
690
|
+
checkValue: searchCheckedValue,
|
|
691
|
+
handleDelete: handleDelete,
|
|
692
|
+
type: type,
|
|
693
|
+
render: render,
|
|
694
|
+
renderColumns: renderColumns ? renderColumns : newRenderColumns,
|
|
695
|
+
dragList: dragList,
|
|
696
|
+
handlePreviewList: handlePreviewList
|
|
697
|
+
}) : /*#__PURE__*/React.createElement(NoDrag, {
|
|
691
698
|
checkValue: searchCheckedValue,
|
|
692
699
|
handleDelete: handleDelete,
|
|
693
700
|
type: type,
|
|
@@ -747,9 +754,7 @@ var QuickTransfer = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
747
754
|
className: "cw-transfer-right-header-clear"
|
|
748
755
|
}, localeObj.clear)) : /*#__PURE__*/React.createElement(Fragment, null, rightHeader)), /*#__PURE__*/React.createElement("div", {
|
|
749
756
|
className: "cw-transfer-right-main-wrapper"
|
|
750
|
-
},
|
|
751
|
-
backend: HTML5Backend
|
|
752
|
-
}, list) : list)), rightFooter && /*#__PURE__*/React.createElement("div", {
|
|
757
|
+
}, list)), rightFooter && /*#__PURE__*/React.createElement("div", {
|
|
753
758
|
className: "cw-transfer-footer"
|
|
754
759
|
}, rightFooter))));
|
|
755
760
|
});
|
package/lib/TooltipText/index.js
CHANGED
|
@@ -65,10 +65,12 @@ var TooltipText = function TooltipText(_ref) {
|
|
|
65
65
|
watcher.current.observe(cloneDom.current);
|
|
66
66
|
return function () {
|
|
67
67
|
if (wrapperDom.current) {
|
|
68
|
-
|
|
68
|
+
var _watcher$current;
|
|
69
|
+
(_watcher$current = watcher.current) === null || _watcher$current === void 0 ? void 0 : _watcher$current.unobserve(wrapperDom.current);
|
|
69
70
|
}
|
|
70
71
|
if (cloneDom.current) {
|
|
71
|
-
|
|
72
|
+
var _watcher$current2;
|
|
73
|
+
(_watcher$current2 = watcher.current) === null || _watcher$current2 === void 0 ? void 0 : _watcher$current2.unobserve(cloneDom.current);
|
|
72
74
|
}
|
|
73
75
|
};
|
|
74
76
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chaoswise/ui",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"description": "公共UI库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -139,5 +139,5 @@
|
|
|
139
139
|
"access": "public"
|
|
140
140
|
},
|
|
141
141
|
"license": "MIT",
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "40263412634d4c05cae0d1ee6de1fbe180cf4eb6"
|
|
143
143
|
}
|