hy-virtual-tree 1.1.61 → 1.1.63
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 +26 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 1.1.63
|
|
4
|
+
|
|
5
|
+
_2026-01-16_
|
|
6
|
+
|
|
7
|
+
- 扩展[VirtualTree] 功能
|
|
8
|
+
(1)优化树形的空数据占位图渲染逻辑为每次显示动态刷新元素
|
|
9
|
+
|
|
10
|
+
### 1.1.62
|
|
11
|
+
|
|
12
|
+
_2026-01-09_
|
|
13
|
+
|
|
14
|
+
- 扩展[VirtualTree] 功能
|
|
15
|
+
(1)新增 BusinessConfig.isOnlyShowSelected, 是否仅显示选中的节点,仅在关闭 RowSelection.checkStrictly 时生效
|
|
16
|
+
|
|
3
17
|
### 1.1.61
|
|
4
18
|
|
|
5
19
|
_2026-01-07_
|
package/dist/index.js
CHANGED
|
@@ -425,8 +425,6 @@ class VirtualScroll {
|
|
|
425
425
|
this.contentWrapper.appendChild(this.contentContainer);
|
|
426
426
|
this.scrollContainer.appendChild(this.contentWrapper);
|
|
427
427
|
this.container.appendChild(this.scrollContainer);
|
|
428
|
-
this.emptyContainer = this.renderEmpty();
|
|
429
|
-
this.scrollContainer.appendChild(this.emptyContainer);
|
|
430
428
|
// Render initial visible items
|
|
431
429
|
this.renderVisibleItems(0, Math.min(100, this.items.length));
|
|
432
430
|
}
|
|
@@ -626,10 +624,17 @@ class VirtualScroll {
|
|
|
626
624
|
*/
|
|
627
625
|
switchEmpty(show = true) {
|
|
628
626
|
if (show) {
|
|
629
|
-
|
|
627
|
+
const newEmptyContainer = this.renderEmpty();
|
|
628
|
+
if (this.emptyContainer) {
|
|
629
|
+
this.scrollContainer.removeChild(this.emptyContainer);
|
|
630
|
+
this.emptyContainer = null;
|
|
631
|
+
}
|
|
632
|
+
this.emptyContainer = newEmptyContainer;
|
|
633
|
+
this.scrollContainer.appendChild(this.emptyContainer);
|
|
630
634
|
}
|
|
631
|
-
else {
|
|
632
|
-
this.
|
|
635
|
+
else if (this.emptyContainer) {
|
|
636
|
+
this.scrollContainer.removeChild(this.emptyContainer);
|
|
637
|
+
this.emptyContainer = null;
|
|
633
638
|
}
|
|
634
639
|
}
|
|
635
640
|
}
|
|
@@ -862,6 +867,7 @@ const useConfig = (config) => {
|
|
|
862
867
|
sortByStatus: true,
|
|
863
868
|
clearEmptyBusiness: false,
|
|
864
869
|
isShowChannelSelect: true,
|
|
870
|
+
isOnlyShowSelected: false,
|
|
865
871
|
...(config.businessConfig || {})
|
|
866
872
|
};
|
|
867
873
|
if (config.business) {
|
|
@@ -8907,6 +8913,7 @@ class VirtualTree {
|
|
|
8907
8913
|
maxLevel: 0,
|
|
8908
8914
|
hiddenNodeKeySet: new Set()
|
|
8909
8915
|
};
|
|
8916
|
+
_rowSelection = {};
|
|
8910
8917
|
_business;
|
|
8911
8918
|
_expandedKeySet = new Set(); // 展开的key
|
|
8912
8919
|
_hiddenExpandIconKeySet = new Set(); // 隐藏展开图标
|
|
@@ -8921,6 +8928,8 @@ class VirtualTree {
|
|
|
8921
8928
|
_getKey;
|
|
8922
8929
|
_updateTree;
|
|
8923
8930
|
_updateCheckedKeys = () => { };
|
|
8931
|
+
_isChecked;
|
|
8932
|
+
_isIndeterminate;
|
|
8924
8933
|
_businessConfig = {};
|
|
8925
8934
|
_isDestroy = false;
|
|
8926
8935
|
getChecked;
|
|
@@ -8946,6 +8955,7 @@ class VirtualTree {
|
|
|
8946
8955
|
const { getKey } = useHandleFun(config);
|
|
8947
8956
|
this._getKey = getKey;
|
|
8948
8957
|
this._businessConfig = config.businessConfig;
|
|
8958
|
+
this._rowSelection = config.rowSelection;
|
|
8949
8959
|
this._render(config);
|
|
8950
8960
|
}
|
|
8951
8961
|
/** 创建树数据 */
|
|
@@ -9067,8 +9077,13 @@ class VirtualTree {
|
|
|
9067
9077
|
}
|
|
9068
9078
|
while (stack.length) {
|
|
9069
9079
|
const node = stack.pop();
|
|
9070
|
-
if (
|
|
9080
|
+
if (
|
|
9081
|
+
// 是否隐藏节点
|
|
9082
|
+
hiddenKeys.has(node.key) ||
|
|
9071
9083
|
this._tree.hiddenNodeKeySet.has(node.key) ||
|
|
9084
|
+
// 是否只显示已选中的节点,仅在关闭 rowSelection?.checkStrictly 时生效
|
|
9085
|
+
(this._businessConfig?.isOnlyShowSelected && !this._rowSelection?.checkStrictly && !(this._isChecked?.(node) || this._isIndeterminate?.(node))) ||
|
|
9086
|
+
// 开启显示仅在线数据,隐藏没有在线设备的部门、群组节点
|
|
9072
9087
|
(this._businessConfig?.showOnlineState &&
|
|
9073
9088
|
/^(1|4)$/.test(node.data.dataType) &&
|
|
9074
9089
|
!node.count)) {
|
|
@@ -9184,6 +9199,8 @@ class VirtualTree {
|
|
|
9184
9199
|
// getHalfCheckedNodes,
|
|
9185
9200
|
setChecked, setCheckedKeys, setCheckedNodes, getSwitchCheckedValue, } = useCheck(config, this);
|
|
9186
9201
|
this._updateCheckedKeys = updateCheckedKeys;
|
|
9202
|
+
this._isChecked = isChecked;
|
|
9203
|
+
this._isIndeterminate = isIndeterminate;
|
|
9187
9204
|
this.getChecked = getChecked;
|
|
9188
9205
|
this.getCheckedKeys = getCheckedKeys;
|
|
9189
9206
|
this.getCheckedNodes = getCheckedNodes;
|
|
@@ -9204,10 +9221,11 @@ class VirtualTree {
|
|
|
9204
9221
|
if (!rowSelection)
|
|
9205
9222
|
return;
|
|
9206
9223
|
Object.assign(config.rowSelection, rowSelection);
|
|
9224
|
+
this._rowSelection = config.rowSelection;
|
|
9207
9225
|
if (checkedKeys.size) {
|
|
9208
9226
|
setCheckedKeys([]);
|
|
9209
9227
|
}
|
|
9210
|
-
this.
|
|
9228
|
+
this._refreshVirtualScroll();
|
|
9211
9229
|
};
|
|
9212
9230
|
const useRenderItems = (config) => {
|
|
9213
9231
|
/** 生成展开图标 */
|
|
@@ -9842,6 +9860,7 @@ class VirtualTree {
|
|
|
9842
9860
|
this._virtualScroll = null;
|
|
9843
9861
|
this._business = undefined;
|
|
9844
9862
|
this._businessConfig = undefined;
|
|
9863
|
+
this._rowSelection = {};
|
|
9845
9864
|
};
|
|
9846
9865
|
}
|
|
9847
9866
|
|