@vope/utils 1.7.4 → 1.7.5

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.
@@ -79,8 +79,9 @@ export declare class FlatTree<K extends string, T extends {
79
79
  getSup(value: Value): T | undefined;
80
80
  /**
81
81
  * 获取子级节点
82
+ * @description 当value === null时则获取所有顶级节点
82
83
  */
83
- getSub(value: Value, callback?: (data: T) => void): T[] | undefined;
84
+ getSub(value: Value | null, callback?: (data: T) => void): T[] | undefined;
84
85
  /**
85
86
  * 是否含有节点
86
87
  */
package/dist/flat-tree.js CHANGED
@@ -134,10 +134,11 @@ class FlatTree {
134
134
  }
135
135
  /**
136
136
  * 获取子级节点
137
+ * @description 当value === null时则获取所有顶级节点
137
138
  */
138
139
  getSub(value, callback) {
139
140
  const { memory } = this;
140
- const tmp = this.downs.get(value);
141
+ const tmp = value === null ? this.list : this.downs.get(value);
141
142
  if (!tmp) return;
142
143
  const list = [];
143
144
  for (const id of tmp) {
package/dist/index.cjs.js CHANGED
@@ -1389,10 +1389,11 @@ var FlatTree = class {
1389
1389
  }
1390
1390
  /**
1391
1391
  * 获取子级节点
1392
+ * @description 当value === null时则获取所有顶级节点
1392
1393
  */
1393
1394
  getSub(value, callback) {
1394
1395
  const { memory } = this;
1395
- const tmp = this.downs.get(value);
1396
+ const tmp = value === null ? this.list : this.downs.get(value);
1396
1397
  if (!tmp) return;
1397
1398
  const list = [];
1398
1399
  for (const id of tmp) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vope/utils",
3
- "version": "1.7.4",
3
+ "version": "1.7.5",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "access": "public",