hy-virtual-tree 1.1.60 → 1.1.62
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 +14 -0
- package/dist/index.js +19 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 1.1.62
|
|
4
|
+
|
|
5
|
+
_2026-01-09_
|
|
6
|
+
|
|
7
|
+
- 扩展[VirtualTree] 功能
|
|
8
|
+
(1)新增 BusinessConfig.isOnlyShowSelected, 是否仅显示选中的节点,仅在关闭 RowSelection.checkStrictly 时生效
|
|
9
|
+
|
|
10
|
+
### 1.1.61
|
|
11
|
+
|
|
12
|
+
_2026-01-07_
|
|
13
|
+
|
|
14
|
+
- 扩展[VirtualTree] 功能
|
|
15
|
+
(1)修复单选时调用选中方法时会触发选中回调
|
|
16
|
+
|
|
3
17
|
### 1.1.60
|
|
4
18
|
|
|
5
19
|
_2026-01-04_
|
package/dist/index.js
CHANGED
|
@@ -862,6 +862,7 @@ const useConfig = (config) => {
|
|
|
862
862
|
sortByStatus: true,
|
|
863
863
|
clearEmptyBusiness: false,
|
|
864
864
|
isShowChannelSelect: true,
|
|
865
|
+
isOnlyShowSelected: false,
|
|
865
866
|
...(config.businessConfig || {})
|
|
866
867
|
};
|
|
867
868
|
if (config.business) {
|
|
@@ -1211,7 +1212,9 @@ function useCheck(props, instance) {
|
|
|
1211
1212
|
if (isChecked) {
|
|
1212
1213
|
checkedKeySet.add(node.key);
|
|
1213
1214
|
}
|
|
1214
|
-
|
|
1215
|
+
if (nodeClick) {
|
|
1216
|
+
afterNodeCheck(node, isChecked);
|
|
1217
|
+
}
|
|
1215
1218
|
return;
|
|
1216
1219
|
}
|
|
1217
1220
|
// 多选
|
|
@@ -8905,6 +8908,7 @@ class VirtualTree {
|
|
|
8905
8908
|
maxLevel: 0,
|
|
8906
8909
|
hiddenNodeKeySet: new Set()
|
|
8907
8910
|
};
|
|
8911
|
+
_rowSelection = {};
|
|
8908
8912
|
_business;
|
|
8909
8913
|
_expandedKeySet = new Set(); // 展开的key
|
|
8910
8914
|
_hiddenExpandIconKeySet = new Set(); // 隐藏展开图标
|
|
@@ -8919,6 +8923,8 @@ class VirtualTree {
|
|
|
8919
8923
|
_getKey;
|
|
8920
8924
|
_updateTree;
|
|
8921
8925
|
_updateCheckedKeys = () => { };
|
|
8926
|
+
_isChecked;
|
|
8927
|
+
_isIndeterminate;
|
|
8922
8928
|
_businessConfig = {};
|
|
8923
8929
|
_isDestroy = false;
|
|
8924
8930
|
getChecked;
|
|
@@ -8944,6 +8950,7 @@ class VirtualTree {
|
|
|
8944
8950
|
const { getKey } = useHandleFun(config);
|
|
8945
8951
|
this._getKey = getKey;
|
|
8946
8952
|
this._businessConfig = config.businessConfig;
|
|
8953
|
+
this._rowSelection = config.rowSelection;
|
|
8947
8954
|
this._render(config);
|
|
8948
8955
|
}
|
|
8949
8956
|
/** 创建树数据 */
|
|
@@ -9065,8 +9072,13 @@ class VirtualTree {
|
|
|
9065
9072
|
}
|
|
9066
9073
|
while (stack.length) {
|
|
9067
9074
|
const node = stack.pop();
|
|
9068
|
-
if (
|
|
9075
|
+
if (
|
|
9076
|
+
// 是否隐藏节点
|
|
9077
|
+
hiddenKeys.has(node.key) ||
|
|
9069
9078
|
this._tree.hiddenNodeKeySet.has(node.key) ||
|
|
9079
|
+
// 是否只显示已选中的节点,仅在关闭 rowSelection?.checkStrictly 时生效
|
|
9080
|
+
(this._businessConfig?.isOnlyShowSelected && !this._rowSelection?.checkStrictly && !(this._isChecked?.(node) || this._isIndeterminate?.(node))) ||
|
|
9081
|
+
// 开启显示仅在线数据,隐藏没有在线设备的部门、群组节点
|
|
9070
9082
|
(this._businessConfig?.showOnlineState &&
|
|
9071
9083
|
/^(1|4)$/.test(node.data.dataType) &&
|
|
9072
9084
|
!node.count)) {
|
|
@@ -9182,6 +9194,8 @@ class VirtualTree {
|
|
|
9182
9194
|
// getHalfCheckedNodes,
|
|
9183
9195
|
setChecked, setCheckedKeys, setCheckedNodes, getSwitchCheckedValue, } = useCheck(config, this);
|
|
9184
9196
|
this._updateCheckedKeys = updateCheckedKeys;
|
|
9197
|
+
this._isChecked = isChecked;
|
|
9198
|
+
this._isIndeterminate = isIndeterminate;
|
|
9185
9199
|
this.getChecked = getChecked;
|
|
9186
9200
|
this.getCheckedKeys = getCheckedKeys;
|
|
9187
9201
|
this.getCheckedNodes = getCheckedNodes;
|
|
@@ -9202,10 +9216,11 @@ class VirtualTree {
|
|
|
9202
9216
|
if (!rowSelection)
|
|
9203
9217
|
return;
|
|
9204
9218
|
Object.assign(config.rowSelection, rowSelection);
|
|
9219
|
+
this._rowSelection = config.rowSelection;
|
|
9205
9220
|
if (checkedKeys.size) {
|
|
9206
9221
|
setCheckedKeys([]);
|
|
9207
9222
|
}
|
|
9208
|
-
this.
|
|
9223
|
+
this._refreshVirtualScroll();
|
|
9209
9224
|
};
|
|
9210
9225
|
const useRenderItems = (config) => {
|
|
9211
9226
|
/** 生成展开图标 */
|
|
@@ -9840,6 +9855,7 @@ class VirtualTree {
|
|
|
9840
9855
|
this._virtualScroll = null;
|
|
9841
9856
|
this._business = undefined;
|
|
9842
9857
|
this._businessConfig = undefined;
|
|
9858
|
+
this._rowSelection = {};
|
|
9843
9859
|
};
|
|
9844
9860
|
}
|
|
9845
9861
|
|