hy-virtual-tree 1.1.38 → 1.1.40
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 +30 -23
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1217,7 +1217,6 @@ function useFilter(config, filterMethod, tree = {
|
|
|
1217
1217
|
nodes.forEach((node) => {
|
|
1218
1218
|
const businessList = [];
|
|
1219
1219
|
family.push(node);
|
|
1220
|
-
// if (tree.hiddenNodeKeySet.has(node.key)) return
|
|
1221
1220
|
if (isShow || (filterMethod && filterMethod(params, node.data, node))) {
|
|
1222
1221
|
family.forEach((member) => {
|
|
1223
1222
|
expandKeySet.add(member.key);
|
|
@@ -1251,12 +1250,14 @@ function useFilter(config, filterMethod, tree = {
|
|
|
1251
1250
|
else if (!hiddenKeys.has(node.key)) {
|
|
1252
1251
|
node.count = 0;
|
|
1253
1252
|
node.total = 0;
|
|
1254
|
-
//
|
|
1255
|
-
if (
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1253
|
+
// 统计,当仅展示在线时,不统计离线的设备
|
|
1254
|
+
if (!tree.hiddenNodeKeySet.has(node.key)) {
|
|
1255
|
+
if (isCountFiler && countFilter) {
|
|
1256
|
+
count += countFilter(node.data) ? 1 : 0;
|
|
1257
|
+
}
|
|
1258
|
+
if (isTotalFiler && totalFilter) {
|
|
1259
|
+
total += totalFilter(node.data) ? 1 : 0;
|
|
1260
|
+
}
|
|
1260
1261
|
}
|
|
1261
1262
|
}
|
|
1262
1263
|
if (!node.isLeaf) {
|
|
@@ -1325,9 +1326,11 @@ function useFilter(config, filterMethod, tree = {
|
|
|
1325
1326
|
node.count = 0;
|
|
1326
1327
|
node.total = 0;
|
|
1327
1328
|
}
|
|
1328
|
-
//
|
|
1329
|
-
|
|
1330
|
-
|
|
1329
|
+
// 统计,当仅展示在线时,不统计离线的设备
|
|
1330
|
+
if (!tree.hiddenNodeKeySet.has(node.key)) {
|
|
1331
|
+
count += node.count || 0;
|
|
1332
|
+
total += node.total || 0;
|
|
1333
|
+
}
|
|
1331
1334
|
}
|
|
1332
1335
|
if (!node.isLeaf) {
|
|
1333
1336
|
if (!expandKeySet.has(node.key)) {
|
|
@@ -1461,7 +1464,6 @@ var WorkerFactory = /*#__PURE__*/createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdp
|
|
|
1461
1464
|
function updateDeviceTree(tree, data, config) {
|
|
1462
1465
|
const deviceMap = tree.deviceMap || new Map();
|
|
1463
1466
|
let beOnlineList = [], beOfflineList = [];
|
|
1464
|
-
const { hiddenNodeKeySet } = config;
|
|
1465
1467
|
const { countFilter, totalFilter, setDeviceStatus } = useHandleFun(config);
|
|
1466
1468
|
const { sortByStatus, showOnlineState, integratedBusiness } = config.businessConfig;
|
|
1467
1469
|
// 更新父节点统计
|
|
@@ -1471,7 +1473,7 @@ function updateDeviceTree(tree, data, config) {
|
|
|
1471
1473
|
const parentKeySet = new Set();
|
|
1472
1474
|
for (const key of keySet) {
|
|
1473
1475
|
const target = tree.treeNodeMap.get(key);
|
|
1474
|
-
if (!target
|
|
1476
|
+
if (!target)
|
|
1475
1477
|
continue;
|
|
1476
1478
|
let count = isCountFiler ? 0 : target.data.count;
|
|
1477
1479
|
let total = isTotalFiler ? 0 : target.data.total;
|
|
@@ -1481,8 +1483,6 @@ function updateDeviceTree(tree, data, config) {
|
|
|
1481
1483
|
let children = target.children || [];
|
|
1482
1484
|
for (let i = 0; i < children.length; i++) {
|
|
1483
1485
|
const item = target.children[i];
|
|
1484
|
-
if (hiddenNodeKeySet.has(item.key))
|
|
1485
|
-
continue;
|
|
1486
1486
|
count =
|
|
1487
1487
|
isCountFiler && !tree.hiddenNodeKeySet.has(item.key) && countFilter
|
|
1488
1488
|
? count + (item.children ? item.count : countFilter(item.data))
|
|
@@ -1509,9 +1509,9 @@ function updateDeviceTree(tree, data, config) {
|
|
|
1509
1509
|
}
|
|
1510
1510
|
target.data.childrenDeviceList = businessList;
|
|
1511
1511
|
}
|
|
1512
|
-
//
|
|
1513
|
-
if (showOnlineState) {
|
|
1514
|
-
tree.hiddenNodeKeySet
|
|
1512
|
+
// 在仅显示设备时,设置 部门/群组 显示状态
|
|
1513
|
+
if (showOnlineState && count > 0) {
|
|
1514
|
+
tree.hiddenNodeKeySet.delete(target.key);
|
|
1515
1515
|
}
|
|
1516
1516
|
target.count = count;
|
|
1517
1517
|
target.total = total;
|
|
@@ -1825,8 +1825,13 @@ class VirtualTree {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
while (stack.length) {
|
|
1827
1827
|
const node = stack.pop();
|
|
1828
|
-
if (hiddenKeys.has(node.key) ||
|
|
1828
|
+
if (hiddenKeys.has(node.key) ||
|
|
1829
|
+
this._tree.hiddenNodeKeySet.has(node.key) ||
|
|
1830
|
+
(this._businessConfig?.showOnlineState &&
|
|
1831
|
+
/^(1|4)$/.test(node.data.dataType) &&
|
|
1832
|
+
!node.count)) {
|
|
1829
1833
|
continue;
|
|
1834
|
+
}
|
|
1830
1835
|
flattenNodes.push(node);
|
|
1831
1836
|
if (node.children && expandedKeys.has(node.key)) {
|
|
1832
1837
|
for (let i = node.children.length - 1; i >= 0; --i) {
|
|
@@ -2307,7 +2312,6 @@ class VirtualTree {
|
|
|
2307
2312
|
count: this._props.count,
|
|
2308
2313
|
total: this._props.total
|
|
2309
2314
|
},
|
|
2310
|
-
hiddenNodeKeySet: this._hiddenNodeKeySet,
|
|
2311
2315
|
businessConfig: this._businessConfig
|
|
2312
2316
|
});
|
|
2313
2317
|
Object.assign(this._tree, tree);
|
|
@@ -2372,6 +2376,10 @@ class VirtualTree {
|
|
|
2372
2376
|
Object.assign(this._tree, tree);
|
|
2373
2377
|
this._hiddenExpandIconKeySet = new Set();
|
|
2374
2378
|
this._hiddenNodeKeySet = new Set();
|
|
2379
|
+
for (const $destroy of this._destroyDomSet) {
|
|
2380
|
+
$destroy && $destroy();
|
|
2381
|
+
}
|
|
2382
|
+
this._destroyDomSet.clear();
|
|
2375
2383
|
this._isForceHiddenExpandIcon = undefined;
|
|
2376
2384
|
this._updateCheckedKeys();
|
|
2377
2385
|
this._refreshVirtualScroll();
|
|
@@ -2491,16 +2499,15 @@ class VirtualTree {
|
|
|
2491
2499
|
/** 销毁组件 */
|
|
2492
2500
|
destroy = () => {
|
|
2493
2501
|
this._el = null;
|
|
2494
|
-
for (const $destroy of this._destroyDomSet) {
|
|
2495
|
-
$destroy && $destroy();
|
|
2496
|
-
}
|
|
2497
|
-
this._destroyDomSet.clear();
|
|
2498
2502
|
this.setData([]);
|
|
2499
2503
|
this.setCheckedKeys && this.setCheckedKeys([]);
|
|
2500
2504
|
this._expandedKeySet = new Set();
|
|
2501
2505
|
this._virtualScroll && this._virtualScroll.destroy();
|
|
2502
2506
|
this._virtualScroll = null;
|
|
2503
2507
|
this._isDestroy = true;
|
|
2508
|
+
this._virtualScroll = null;
|
|
2509
|
+
this._business = undefined;
|
|
2510
|
+
this._businessConfig = undefined;
|
|
2504
2511
|
};
|
|
2505
2512
|
}
|
|
2506
2513
|
|