hy-virtual-tree 1.1.36 → 1.1.38
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 +15 -6
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1217,8 +1217,7 @@ 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))
|
|
1221
|
-
return;
|
|
1220
|
+
// if (tree.hiddenNodeKeySet.has(node.key)) return
|
|
1222
1221
|
if (isShow || (filterMethod && filterMethod(params, node.data, node))) {
|
|
1223
1222
|
family.forEach((member) => {
|
|
1224
1223
|
expandKeySet.add(member.key);
|
|
@@ -1304,8 +1303,7 @@ function useFilter(config, filterMethod, tree = {
|
|
|
1304
1303
|
let total = 0;
|
|
1305
1304
|
nodes.forEach((node) => {
|
|
1306
1305
|
family.push(node);
|
|
1307
|
-
if (tree.hiddenNodeKeySet.has(node.key))
|
|
1308
|
-
return;
|
|
1306
|
+
// if (tree.hiddenNodeKeySet.has(node.key)) return
|
|
1309
1307
|
if (isShow || (filterMethod && filterMethod(params, node.data, node))) {
|
|
1310
1308
|
family.forEach((member) => {
|
|
1311
1309
|
expandKeySet.add(member.key);
|
|
@@ -1463,6 +1461,7 @@ var WorkerFactory = /*#__PURE__*/createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdp
|
|
|
1463
1461
|
function updateDeviceTree(tree, data, config) {
|
|
1464
1462
|
const deviceMap = tree.deviceMap || new Map();
|
|
1465
1463
|
let beOnlineList = [], beOfflineList = [];
|
|
1464
|
+
const { hiddenNodeKeySet } = config;
|
|
1466
1465
|
const { countFilter, totalFilter, setDeviceStatus } = useHandleFun(config);
|
|
1467
1466
|
const { sortByStatus, showOnlineState, integratedBusiness } = config.businessConfig;
|
|
1468
1467
|
// 更新父节点统计
|
|
@@ -1472,7 +1471,7 @@ function updateDeviceTree(tree, data, config) {
|
|
|
1472
1471
|
const parentKeySet = new Set();
|
|
1473
1472
|
for (const key of keySet) {
|
|
1474
1473
|
const target = tree.treeNodeMap.get(key);
|
|
1475
|
-
if (!target)
|
|
1474
|
+
if (!target || hiddenNodeKeySet.has(target.key))
|
|
1476
1475
|
continue;
|
|
1477
1476
|
let count = isCountFiler ? 0 : target.data.count;
|
|
1478
1477
|
let total = isTotalFiler ? 0 : target.data.total;
|
|
@@ -1482,6 +1481,8 @@ function updateDeviceTree(tree, data, config) {
|
|
|
1482
1481
|
let children = target.children || [];
|
|
1483
1482
|
for (let i = 0; i < children.length; i++) {
|
|
1484
1483
|
const item = target.children[i];
|
|
1484
|
+
if (hiddenNodeKeySet.has(item.key))
|
|
1485
|
+
continue;
|
|
1485
1486
|
count =
|
|
1486
1487
|
isCountFiler && !tree.hiddenNodeKeySet.has(item.key) && countFilter
|
|
1487
1488
|
? count + (item.children ? item.count : countFilter(item.data))
|
|
@@ -2306,6 +2307,7 @@ class VirtualTree {
|
|
|
2306
2307
|
count: this._props.count,
|
|
2307
2308
|
total: this._props.total
|
|
2308
2309
|
},
|
|
2310
|
+
hiddenNodeKeySet: this._hiddenNodeKeySet,
|
|
2309
2311
|
businessConfig: this._businessConfig
|
|
2310
2312
|
});
|
|
2311
2313
|
Object.assign(this._tree, tree);
|
|
@@ -2386,6 +2388,9 @@ class VirtualTree {
|
|
|
2386
2388
|
return async (data, callback) => {
|
|
2387
2389
|
if (!this._tree || !this._updateTree)
|
|
2388
2390
|
return;
|
|
2391
|
+
if (!cacheData.length) {
|
|
2392
|
+
cacheTime = Date.now();
|
|
2393
|
+
}
|
|
2389
2394
|
cacheTimer && clearTimeout(cacheTimer);
|
|
2390
2395
|
if (Array.isArray(data)) {
|
|
2391
2396
|
data.forEach((item) => {
|
|
@@ -2406,7 +2411,7 @@ class VirtualTree {
|
|
|
2406
2411
|
// 若仅更新一次,cacheInterval毫秒后也会强制更新数据
|
|
2407
2412
|
else {
|
|
2408
2413
|
cacheTimer = setTimeout(() => {
|
|
2409
|
-
this.updateData([], callback);
|
|
2414
|
+
this.updateData([...cacheData], callback);
|
|
2410
2415
|
}, cacheInterval);
|
|
2411
2416
|
}
|
|
2412
2417
|
};
|
|
@@ -2486,6 +2491,10 @@ class VirtualTree {
|
|
|
2486
2491
|
/** 销毁组件 */
|
|
2487
2492
|
destroy = () => {
|
|
2488
2493
|
this._el = null;
|
|
2494
|
+
for (const $destroy of this._destroyDomSet) {
|
|
2495
|
+
$destroy && $destroy();
|
|
2496
|
+
}
|
|
2497
|
+
this._destroyDomSet.clear();
|
|
2489
2498
|
this.setData([]);
|
|
2490
2499
|
this.setCheckedKeys && this.setCheckedKeys([]);
|
|
2491
2500
|
this._expandedKeySet = new Set();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hy-virtual-tree",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.38",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
".": "./dist/index.js",
|
|
19
19
|
"./style": "./dist/index.css"
|
|
20
20
|
},
|
|
21
|
-
"dependencies": {
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"vue-router": "^4.6.3"
|
|
23
|
+
},
|
|
22
24
|
"devDependencies": {
|
|
23
25
|
"@babel/core": "^7.28.0",
|
|
24
26
|
"@babel/preset-env": "^7.28.0",
|