wargerm 0.7.84 → 0.7.86
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/dist/index.esm.js +20 -18
- package/dist/index.js +20 -18
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -3451,9 +3451,9 @@ var findParent = function findParent(data, id) {
|
|
3451
3451
|
var parent = null;
|
3452
3452
|
var loop = function loop(node, arr) {
|
3453
3453
|
for (var i = 0; i < arr.length; i++) {
|
3454
|
-
var _item$children;
|
3454
|
+
var _item$origin, _item$children;
|
3455
3455
|
var item = arr[i];
|
3456
|
-
if (item.id == id) return parent = node;
|
3456
|
+
if ((item.key || item.id || ((_item$origin = item.origin) === null || _item$origin === void 0 ? void 0 : _item$origin.id)) == id) return parent = node;
|
3457
3457
|
if ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) {
|
3458
3458
|
loop(item, item.children);
|
3459
3459
|
}
|
@@ -3492,10 +3492,11 @@ var handleCheck = function handleCheck(_ref) {
|
|
3492
3492
|
var currentId = id;
|
3493
3493
|
while (currentId) {
|
3494
3494
|
var _ref2 = findParent(treeData, currentId) || {},
|
3495
|
+
key = _ref2.key,
|
3495
3496
|
_id = _ref2.id,
|
3496
3497
|
children = _ref2.children;
|
3497
3498
|
var ids = children === null || children === void 0 ? void 0 : children.map(function (item) {
|
3498
|
-
return item.id;
|
3499
|
+
return item.key || item.id;
|
3499
3500
|
});
|
3500
3501
|
if (!ids) {
|
3501
3502
|
currentId = null;
|
@@ -3505,21 +3506,21 @@ var handleCheck = function handleCheck(_ref) {
|
|
3505
3506
|
return values.checked.includes(item);
|
3506
3507
|
})) {
|
3507
3508
|
// 检查每个父 id 都在 checked list 里面,不在则 push半选
|
3508
|
-
if (!values.halfChecked.includes(_id)) {
|
3509
|
+
if (!values.halfChecked.includes(key || _id)) {
|
3509
3510
|
// 判断是否存在
|
3510
|
-
values.halfChecked.push(_id);
|
3511
|
+
values.halfChecked.push(key || _id);
|
3511
3512
|
}
|
3512
|
-
removeId(values.checked, _id);
|
3513
|
-
} else if (!values.checked.includes(_id)) {
|
3513
|
+
removeId(values.checked, key || _id);
|
3514
|
+
} else if (!values.checked.includes(key || _id)) {
|
3514
3515
|
// 每个父 id 是否已存在 checked list ,不在则 push checked list, 并且清空 半选
|
3515
|
-
values.checked.push(_id);
|
3516
|
-
removeId(values.halfChecked, _id);
|
3516
|
+
values.checked.push(key || _id);
|
3517
|
+
removeId(values.halfChecked, key || _id);
|
3517
3518
|
}
|
3518
3519
|
if (!ids.some(function (item) {
|
3519
3520
|
return [].concat(_toConsumableArray(values.checked), _toConsumableArray(values.halfChecked)).includes(item);
|
3520
3521
|
})) {
|
3521
3522
|
// 检查每个父 id 都不在 checked list 里面,不在则 清空半选
|
3522
|
-
removeId(values.halfChecked, _id);
|
3523
|
+
removeId(values.halfChecked, key || _id);
|
3523
3524
|
}
|
3524
3525
|
currentId = parentIds.pop();
|
3525
3526
|
}
|
@@ -3559,6 +3560,7 @@ var WTree = function WTree(props, ref) {
|
|
3559
3560
|
expandedKeys: expandedKeys,
|
3560
3561
|
treeData: treeData,
|
3561
3562
|
setTreeData: setTreeData,
|
3563
|
+
allKeysRef: allKeysRef.current,
|
3562
3564
|
setExpandedKeys: setExpandedKeys,
|
3563
3565
|
setCheckedKeys: setCheckedKeys,
|
3564
3566
|
value: selectedData
|
@@ -3592,14 +3594,14 @@ var WTree = function WTree(props, ref) {
|
|
3592
3594
|
};
|
3593
3595
|
deepFn = function deepFn(arr) {
|
3594
3596
|
return arr.map(function (item) {
|
3595
|
-
var _item$children3, _ref4, _item$
|
3597
|
+
var _item$children3, _ref4, _item$origin2, _item$origin3;
|
3596
3598
|
if (((_item$children3 = item.children) === null || _item$children3 === void 0 ? void 0 : _item$children3.length) > 0) {
|
3597
3599
|
item.children = deepFn(item.children);
|
3598
3600
|
}
|
3599
3601
|
allKeysRef.current = [].concat(_toConsumableArray(allKeysRef.current), [item.key]);
|
3600
3602
|
handleCheck({
|
3601
|
-
parentIds: (_ref4 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$
|
3602
|
-
id: (item === null || item === void 0 ? void 0 : item.id) || ((_item$
|
3603
|
+
parentIds: (_ref4 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$origin2 = item.origin) === null || _item$origin2 === void 0 ? void 0 : _item$origin2.parentIds)) === null || _ref4 === void 0 ? void 0 : _ref4.split(',').slice(1),
|
3604
|
+
id: (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.id) || ((_item$origin3 = item.origin) === null || _item$origin3 === void 0 ? void 0 : _item$origin3.id),
|
3603
3605
|
values: values,
|
3604
3606
|
treeData: data
|
3605
3607
|
});
|
@@ -3621,14 +3623,14 @@ var WTree = function WTree(props, ref) {
|
|
3621
3623
|
};
|
3622
3624
|
_deepFn = function _deepFn(arr) {
|
3623
3625
|
return arr.map(function (item) {
|
3624
|
-
var _item$children4, _ref5, _item$
|
3626
|
+
var _item$children4, _ref5, _item$origin4, _item$origin5;
|
3625
3627
|
if (((_item$children4 = item.children) === null || _item$children4 === void 0 ? void 0 : _item$children4.length) > 0) {
|
3626
3628
|
item.children = _deepFn(item.children);
|
3627
3629
|
}
|
3628
3630
|
allKeysRef.current = [].concat(_toConsumableArray(allKeysRef.current), [item.key]);
|
3629
3631
|
handleCheck({
|
3630
|
-
parentIds: (_ref5 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$
|
3631
|
-
id: (item === null || item === void 0 ? void 0 : item.id) || ((_item$
|
3632
|
+
parentIds: (_ref5 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$origin4 = item.origin) === null || _item$origin4 === void 0 ? void 0 : _item$origin4.parentIds)) === null || _ref5 === void 0 ? void 0 : _ref5.split(',').slice(1),
|
3633
|
+
id: (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.id) || ((_item$origin5 = item.origin) === null || _item$origin5 === void 0 ? void 0 : _item$origin5.id),
|
3632
3634
|
values: _values,
|
3633
3635
|
treeData: dataSource
|
3634
3636
|
});
|
@@ -3666,7 +3668,7 @@ var WTree = function WTree(props, ref) {
|
|
3666
3668
|
var _info$node, _info$node$parentIds, _info$node2;
|
3667
3669
|
var checked = info === null || info === void 0 ? void 0 : info.checked;
|
3668
3670
|
var parentIds = info === null || info === void 0 ? void 0 : (_info$node = info.node) === null || _info$node === void 0 ? void 0 : (_info$node$parentIds = _info$node.parentIds) === null || _info$node$parentIds === void 0 ? void 0 : _info$node$parentIds.split(',').slice(1);
|
3669
|
-
var currentId = info === null || info === void 0 ? void 0 : info.node.id;
|
3671
|
+
var currentId = (info === null || info === void 0 ? void 0 : info.node.key) || (info === null || info === void 0 ? void 0 : info.node.id);
|
3670
3672
|
handleCheck({
|
3671
3673
|
parentIds: parentIds,
|
3672
3674
|
id: currentId,
|
@@ -3674,7 +3676,7 @@ var WTree = function WTree(props, ref) {
|
|
3674
3676
|
treeData: treeData
|
3675
3677
|
});
|
3676
3678
|
var childrenIds = flatChildren((info === null || info === void 0 ? void 0 : (_info$node2 = info.node) === null || _info$node2 === void 0 ? void 0 : _info$node2.children) || []).map(function (item) {
|
3677
|
-
return item.id;
|
3679
|
+
return item.key || item.id;
|
3678
3680
|
});
|
3679
3681
|
// TODO 全选反选
|
3680
3682
|
if (checked) {
|
package/dist/index.js
CHANGED
@@ -3495,9 +3495,9 @@ var findParent = function findParent(data, id) {
|
|
3495
3495
|
var parent = null;
|
3496
3496
|
var loop = function loop(node, arr) {
|
3497
3497
|
for (var i = 0; i < arr.length; i++) {
|
3498
|
-
var _item$children;
|
3498
|
+
var _item$origin, _item$children;
|
3499
3499
|
var item = arr[i];
|
3500
|
-
if (item.id == id) return parent = node;
|
3500
|
+
if ((item.key || item.id || ((_item$origin = item.origin) === null || _item$origin === void 0 ? void 0 : _item$origin.id)) == id) return parent = node;
|
3501
3501
|
if ((_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) {
|
3502
3502
|
loop(item, item.children);
|
3503
3503
|
}
|
@@ -3536,10 +3536,11 @@ var handleCheck = function handleCheck(_ref) {
|
|
3536
3536
|
var currentId = id;
|
3537
3537
|
while (currentId) {
|
3538
3538
|
var _ref2 = findParent(treeData, currentId) || {},
|
3539
|
+
key = _ref2.key,
|
3539
3540
|
_id = _ref2.id,
|
3540
3541
|
children = _ref2.children;
|
3541
3542
|
var ids = children === null || children === void 0 ? void 0 : children.map(function (item) {
|
3542
|
-
return item.id;
|
3543
|
+
return item.key || item.id;
|
3543
3544
|
});
|
3544
3545
|
if (!ids) {
|
3545
3546
|
currentId = null;
|
@@ -3549,21 +3550,21 @@ var handleCheck = function handleCheck(_ref) {
|
|
3549
3550
|
return values.checked.includes(item);
|
3550
3551
|
})) {
|
3551
3552
|
// 检查每个父 id 都在 checked list 里面,不在则 push半选
|
3552
|
-
if (!values.halfChecked.includes(_id)) {
|
3553
|
+
if (!values.halfChecked.includes(key || _id)) {
|
3553
3554
|
// 判断是否存在
|
3554
|
-
values.halfChecked.push(_id);
|
3555
|
+
values.halfChecked.push(key || _id);
|
3555
3556
|
}
|
3556
|
-
removeId(values.checked, _id);
|
3557
|
-
} else if (!values.checked.includes(_id)) {
|
3557
|
+
removeId(values.checked, key || _id);
|
3558
|
+
} else if (!values.checked.includes(key || _id)) {
|
3558
3559
|
// 每个父 id 是否已存在 checked list ,不在则 push checked list, 并且清空 半选
|
3559
|
-
values.checked.push(_id);
|
3560
|
-
removeId(values.halfChecked, _id);
|
3560
|
+
values.checked.push(key || _id);
|
3561
|
+
removeId(values.halfChecked, key || _id);
|
3561
3562
|
}
|
3562
3563
|
if (!ids.some(function (item) {
|
3563
3564
|
return [].concat(_toConsumableArray(values.checked), _toConsumableArray(values.halfChecked)).includes(item);
|
3564
3565
|
})) {
|
3565
3566
|
// 检查每个父 id 都不在 checked list 里面,不在则 清空半选
|
3566
|
-
removeId(values.halfChecked, _id);
|
3567
|
+
removeId(values.halfChecked, key || _id);
|
3567
3568
|
}
|
3568
3569
|
currentId = parentIds.pop();
|
3569
3570
|
}
|
@@ -3603,6 +3604,7 @@ var WTree = function WTree(props, ref) {
|
|
3603
3604
|
expandedKeys: expandedKeys,
|
3604
3605
|
treeData: treeData,
|
3605
3606
|
setTreeData: setTreeData,
|
3607
|
+
allKeysRef: allKeysRef.current,
|
3606
3608
|
setExpandedKeys: setExpandedKeys,
|
3607
3609
|
setCheckedKeys: setCheckedKeys,
|
3608
3610
|
value: selectedData
|
@@ -3636,14 +3638,14 @@ var WTree = function WTree(props, ref) {
|
|
3636
3638
|
};
|
3637
3639
|
deepFn = function deepFn(arr) {
|
3638
3640
|
return arr.map(function (item) {
|
3639
|
-
var _item$children3, _ref4, _item$
|
3641
|
+
var _item$children3, _ref4, _item$origin2, _item$origin3;
|
3640
3642
|
if (((_item$children3 = item.children) === null || _item$children3 === void 0 ? void 0 : _item$children3.length) > 0) {
|
3641
3643
|
item.children = deepFn(item.children);
|
3642
3644
|
}
|
3643
3645
|
allKeysRef.current = [].concat(_toConsumableArray(allKeysRef.current), [item.key]);
|
3644
3646
|
handleCheck({
|
3645
|
-
parentIds: (_ref4 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$
|
3646
|
-
id: (item === null || item === void 0 ? void 0 : item.id) || ((_item$
|
3647
|
+
parentIds: (_ref4 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$origin2 = item.origin) === null || _item$origin2 === void 0 ? void 0 : _item$origin2.parentIds)) === null || _ref4 === void 0 ? void 0 : _ref4.split(',').slice(1),
|
3648
|
+
id: (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.id) || ((_item$origin3 = item.origin) === null || _item$origin3 === void 0 ? void 0 : _item$origin3.id),
|
3647
3649
|
values: values,
|
3648
3650
|
treeData: data
|
3649
3651
|
});
|
@@ -3665,14 +3667,14 @@ var WTree = function WTree(props, ref) {
|
|
3665
3667
|
};
|
3666
3668
|
_deepFn = function _deepFn(arr) {
|
3667
3669
|
return arr.map(function (item) {
|
3668
|
-
var _item$children4, _ref5, _item$
|
3670
|
+
var _item$children4, _ref5, _item$origin4, _item$origin5;
|
3669
3671
|
if (((_item$children4 = item.children) === null || _item$children4 === void 0 ? void 0 : _item$children4.length) > 0) {
|
3670
3672
|
item.children = _deepFn(item.children);
|
3671
3673
|
}
|
3672
3674
|
allKeysRef.current = [].concat(_toConsumableArray(allKeysRef.current), [item.key]);
|
3673
3675
|
handleCheck({
|
3674
|
-
parentIds: (_ref5 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$
|
3675
|
-
id: (item === null || item === void 0 ? void 0 : item.id) || ((_item$
|
3676
|
+
parentIds: (_ref5 = (item === null || item === void 0 ? void 0 : item.parentIds) || ((_item$origin4 = item.origin) === null || _item$origin4 === void 0 ? void 0 : _item$origin4.parentIds)) === null || _ref5 === void 0 ? void 0 : _ref5.split(',').slice(1),
|
3677
|
+
id: (item === null || item === void 0 ? void 0 : item.key) || (item === null || item === void 0 ? void 0 : item.id) || ((_item$origin5 = item.origin) === null || _item$origin5 === void 0 ? void 0 : _item$origin5.id),
|
3676
3678
|
values: _values,
|
3677
3679
|
treeData: dataSource
|
3678
3680
|
});
|
@@ -3710,7 +3712,7 @@ var WTree = function WTree(props, ref) {
|
|
3710
3712
|
var _info$node, _info$node$parentIds, _info$node2;
|
3711
3713
|
var checked = info === null || info === void 0 ? void 0 : info.checked;
|
3712
3714
|
var parentIds = info === null || info === void 0 ? void 0 : (_info$node = info.node) === null || _info$node === void 0 ? void 0 : (_info$node$parentIds = _info$node.parentIds) === null || _info$node$parentIds === void 0 ? void 0 : _info$node$parentIds.split(',').slice(1);
|
3713
|
-
var currentId = info === null || info === void 0 ? void 0 : info.node.id;
|
3715
|
+
var currentId = (info === null || info === void 0 ? void 0 : info.node.key) || (info === null || info === void 0 ? void 0 : info.node.id);
|
3714
3716
|
handleCheck({
|
3715
3717
|
parentIds: parentIds,
|
3716
3718
|
id: currentId,
|
@@ -3718,7 +3720,7 @@ var WTree = function WTree(props, ref) {
|
|
3718
3720
|
treeData: treeData
|
3719
3721
|
});
|
3720
3722
|
var childrenIds = flatChildren((info === null || info === void 0 ? void 0 : (_info$node2 = info.node) === null || _info$node2 === void 0 ? void 0 : _info$node2.children) || []).map(function (item) {
|
3721
|
-
return item.id;
|
3723
|
+
return item.key || item.id;
|
3722
3724
|
});
|
3723
3725
|
// TODO 全选反选
|
3724
3726
|
if (checked) {
|