@ucloud-fe/react-components 1.3.18 → 1.3.19
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/CHANGELOG.md +6 -0
- package/dist/main.min.js +9 -4
- package/lib/components/Tree/Tree.js +17 -17
- package/package.json +2 -2
|
@@ -64,8 +64,8 @@ var groupDataSource = function groupDataSource(dataSource) {
|
|
|
64
64
|
|
|
65
65
|
(0, _newArrowCheck2.default)(this, _this);
|
|
66
66
|
var group = {};
|
|
67
|
-
var
|
|
68
|
-
var
|
|
67
|
+
var validKeys = [];
|
|
68
|
+
var disabledKeys = [];
|
|
69
69
|
if (!dataSource) dataSource = [];
|
|
70
70
|
|
|
71
71
|
var _groupData2 = function _groupData(children, disabled) {
|
|
@@ -96,10 +96,10 @@ var groupDataSource = function groupDataSource(dataSource) {
|
|
|
96
96
|
} else {
|
|
97
97
|
if (finalDisabled) {
|
|
98
98
|
disabledKeys.push(key);
|
|
99
|
-
|
|
99
|
+
disabledKeys.push(key);
|
|
100
100
|
} else {
|
|
101
101
|
keys.push(key);
|
|
102
|
-
|
|
102
|
+
validKeys.push(key);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}.bind(this));
|
|
@@ -108,7 +108,7 @@ var groupDataSource = function groupDataSource(dataSource) {
|
|
|
108
108
|
|
|
109
109
|
_groupData2(dataSource);
|
|
110
110
|
|
|
111
|
-
return [group,
|
|
111
|
+
return [group, validKeys, disabledKeys];
|
|
112
112
|
}.bind(void 0);
|
|
113
113
|
|
|
114
114
|
var keysToMap = function keysToMap() {
|
|
@@ -213,8 +213,8 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
213
213
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
214
214
|
_useState2$ = (0, _slicedToArray2.default)(_useState2[0], 3),
|
|
215
215
|
group = _useState2$[0],
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
validKeys = _useState2$[1],
|
|
217
|
+
disabledKeys = _useState2$[2],
|
|
218
218
|
setGroup = _useState2[1];
|
|
219
219
|
|
|
220
220
|
var _useUncontrolled = (0, _useUncontrolled7.default)(_selectedKeys, defaultSelectedKeys || [], _onChange),
|
|
@@ -240,11 +240,11 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
240
240
|
var selectKeys = [];
|
|
241
241
|
var unselectKeys = [];
|
|
242
242
|
var newSelectedMap = keysToMap(newSelectedKeys);
|
|
243
|
-
var
|
|
243
|
+
var validMap = keysToMap(validKeys);
|
|
244
244
|
|
|
245
245
|
for (var newKey in newSelectedMap) {
|
|
246
246
|
// don't in dataSource, ignore
|
|
247
|
-
if (!(newKey in
|
|
247
|
+
if (!(newKey in validMap)) continue;
|
|
248
248
|
|
|
249
249
|
if (!(newKey in selectedMap)) {
|
|
250
250
|
selectKeys.push(newKey);
|
|
@@ -253,7 +253,7 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
253
253
|
|
|
254
254
|
for (var oldKey in selectedMap) {
|
|
255
255
|
// don't in dataSource, ignore
|
|
256
|
-
if (!(oldKey in
|
|
256
|
+
if (!(oldKey in validMap)) continue;
|
|
257
257
|
|
|
258
258
|
if (!(oldKey in newSelectedMap)) {
|
|
259
259
|
unselectKeys.push(oldKey);
|
|
@@ -264,7 +264,7 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
264
264
|
select: selectKeys,
|
|
265
265
|
unselect: unselectKeys
|
|
266
266
|
});
|
|
267
|
-
}.bind(this), [
|
|
267
|
+
}.bind(this), [validKeys, onDiff, selectedMap]);
|
|
268
268
|
var finalOnChange = (0, _react.useCallback)(function (selectedKeys) {
|
|
269
269
|
(0, _newArrowCheck2.default)(this, _this7);
|
|
270
270
|
onChange(selectedKeys);
|
|
@@ -299,11 +299,11 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
var disabledSelectedKeys = [];
|
|
302
|
-
|
|
302
|
+
disabledKeys.forEach(function (v) {
|
|
303
303
|
(0, _newArrowCheck2.default)(this, _this9);
|
|
304
304
|
if (selectedMap[v]) disabledSelectedKeys.push(v);
|
|
305
305
|
}.bind(this));
|
|
306
|
-
var selectedKeys = [].concat((0, _toConsumableArray2.default)(
|
|
306
|
+
var selectedKeys = [].concat((0, _toConsumableArray2.default)(validKeys), disabledSelectedKeys);
|
|
307
307
|
finalOnChange(selectedKeys);
|
|
308
308
|
}.bind(this),
|
|
309
309
|
unSelectAll: function unSelectAll() {
|
|
@@ -311,7 +311,7 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
311
311
|
|
|
312
312
|
(0, _newArrowCheck2.default)(this, _this8);
|
|
313
313
|
var disabledSelectedKeys = [];
|
|
314
|
-
|
|
314
|
+
disabledKeys.forEach(function (v) {
|
|
315
315
|
(0, _newArrowCheck2.default)(this, _this10);
|
|
316
316
|
if (selectedMap[v]) disabledSelectedKeys.push(v);
|
|
317
317
|
}.bind(this));
|
|
@@ -328,12 +328,12 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
328
328
|
}
|
|
329
329
|
|
|
330
330
|
var disabledSelectedKeys = [];
|
|
331
|
-
|
|
331
|
+
disabledKeys.forEach(function (v) {
|
|
332
332
|
(0, _newArrowCheck2.default)(this, _this11);
|
|
333
333
|
if (selectedMap[v]) disabledSelectedKeys.push(v);
|
|
334
334
|
}.bind(this));
|
|
335
335
|
var selectedKeys = [].concat(disabledSelectedKeys);
|
|
336
|
-
|
|
336
|
+
validKeys.forEach(function (v) {
|
|
337
337
|
(0, _newArrowCheck2.default)(this, _this11);
|
|
338
338
|
|
|
339
339
|
if (!selectedMap[v]) {
|
|
@@ -343,7 +343,7 @@ var CommonTree = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
343
343
|
finalOnChange(selectedKeys);
|
|
344
344
|
}.bind(this)
|
|
345
345
|
};
|
|
346
|
-
}.bind(this), [multiple,
|
|
346
|
+
}.bind(this), [multiple, disabledKeys, validKeys, finalOnChange, selectedMap]);
|
|
347
347
|
var onSelect = (0, _react.useCallback)(function (_selectedMap) {
|
|
348
348
|
(0, _newArrowCheck2.default)(this, _this7);
|
|
349
349
|
var selectedKeys;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ucloud-fe/react-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.19",
|
|
4
4
|
"title": "UCloud react components",
|
|
5
5
|
"description": "UCloud react components",
|
|
6
6
|
"keywords": [
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"mini-store": "^1.0.2",
|
|
73
73
|
"moment": "^2.22.2",
|
|
74
74
|
"prop-types": "^15.7.2",
|
|
75
|
-
"rc-dialog": "
|
|
75
|
+
"rc-dialog": "8.5.1",
|
|
76
76
|
"rc-form": "2.4.12",
|
|
77
77
|
"rc-slider": "8.6.13",
|
|
78
78
|
"rc-trigger": "2.5.3",
|