hy-virtual-tree 1.1.61 → 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 +7 -0
- package/dist/index.js +16 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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) {
|
|
@@ -8907,6 +8908,7 @@ class VirtualTree {
|
|
|
8907
8908
|
maxLevel: 0,
|
|
8908
8909
|
hiddenNodeKeySet: new Set()
|
|
8909
8910
|
};
|
|
8911
|
+
_rowSelection = {};
|
|
8910
8912
|
_business;
|
|
8911
8913
|
_expandedKeySet = new Set(); // 展开的key
|
|
8912
8914
|
_hiddenExpandIconKeySet = new Set(); // 隐藏展开图标
|
|
@@ -8921,6 +8923,8 @@ class VirtualTree {
|
|
|
8921
8923
|
_getKey;
|
|
8922
8924
|
_updateTree;
|
|
8923
8925
|
_updateCheckedKeys = () => { };
|
|
8926
|
+
_isChecked;
|
|
8927
|
+
_isIndeterminate;
|
|
8924
8928
|
_businessConfig = {};
|
|
8925
8929
|
_isDestroy = false;
|
|
8926
8930
|
getChecked;
|
|
@@ -8946,6 +8950,7 @@ class VirtualTree {
|
|
|
8946
8950
|
const { getKey } = useHandleFun(config);
|
|
8947
8951
|
this._getKey = getKey;
|
|
8948
8952
|
this._businessConfig = config.businessConfig;
|
|
8953
|
+
this._rowSelection = config.rowSelection;
|
|
8949
8954
|
this._render(config);
|
|
8950
8955
|
}
|
|
8951
8956
|
/** 创建树数据 */
|
|
@@ -9067,8 +9072,13 @@ class VirtualTree {
|
|
|
9067
9072
|
}
|
|
9068
9073
|
while (stack.length) {
|
|
9069
9074
|
const node = stack.pop();
|
|
9070
|
-
if (
|
|
9075
|
+
if (
|
|
9076
|
+
// 是否隐藏节点
|
|
9077
|
+
hiddenKeys.has(node.key) ||
|
|
9071
9078
|
this._tree.hiddenNodeKeySet.has(node.key) ||
|
|
9079
|
+
// 是否只显示已选中的节点,仅在关闭 rowSelection?.checkStrictly 时生效
|
|
9080
|
+
(this._businessConfig?.isOnlyShowSelected && !this._rowSelection?.checkStrictly && !(this._isChecked?.(node) || this._isIndeterminate?.(node))) ||
|
|
9081
|
+
// 开启显示仅在线数据,隐藏没有在线设备的部门、群组节点
|
|
9072
9082
|
(this._businessConfig?.showOnlineState &&
|
|
9073
9083
|
/^(1|4)$/.test(node.data.dataType) &&
|
|
9074
9084
|
!node.count)) {
|
|
@@ -9184,6 +9194,8 @@ class VirtualTree {
|
|
|
9184
9194
|
// getHalfCheckedNodes,
|
|
9185
9195
|
setChecked, setCheckedKeys, setCheckedNodes, getSwitchCheckedValue, } = useCheck(config, this);
|
|
9186
9196
|
this._updateCheckedKeys = updateCheckedKeys;
|
|
9197
|
+
this._isChecked = isChecked;
|
|
9198
|
+
this._isIndeterminate = isIndeterminate;
|
|
9187
9199
|
this.getChecked = getChecked;
|
|
9188
9200
|
this.getCheckedKeys = getCheckedKeys;
|
|
9189
9201
|
this.getCheckedNodes = getCheckedNodes;
|
|
@@ -9204,10 +9216,11 @@ class VirtualTree {
|
|
|
9204
9216
|
if (!rowSelection)
|
|
9205
9217
|
return;
|
|
9206
9218
|
Object.assign(config.rowSelection, rowSelection);
|
|
9219
|
+
this._rowSelection = config.rowSelection;
|
|
9207
9220
|
if (checkedKeys.size) {
|
|
9208
9221
|
setCheckedKeys([]);
|
|
9209
9222
|
}
|
|
9210
|
-
this.
|
|
9223
|
+
this._refreshVirtualScroll();
|
|
9211
9224
|
};
|
|
9212
9225
|
const useRenderItems = (config) => {
|
|
9213
9226
|
/** 生成展开图标 */
|
|
@@ -9842,6 +9855,7 @@ class VirtualTree {
|
|
|
9842
9855
|
this._virtualScroll = null;
|
|
9843
9856
|
this._business = undefined;
|
|
9844
9857
|
this._businessConfig = undefined;
|
|
9858
|
+
this._rowSelection = {};
|
|
9845
9859
|
};
|
|
9846
9860
|
}
|
|
9847
9861
|
|