hy-virtual-tree 1.1.36 → 1.1.37

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Changelog
2
2
 
3
+ ### 1.1.37
4
+
5
+ _2025-09-25_
6
+
7
+ - 扩展[VirtualTree] 功能
8
+ (1)修复更新设备数据时,统计数据出错问题
9
+
3
10
  ### 1.1.36
4
11
 
5
12
  _2025-09-25_
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
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-virtual-tree",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",