sculp-js 1.13.6 → 1.15.0

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.
Files changed (66) hide show
  1. package/README.md +3 -1
  2. package/dist/cjs/_virtual/_commonjsHelpers.js +1 -1
  3. package/dist/cjs/array.js +1 -1
  4. package/dist/cjs/async.js +1 -1
  5. package/dist/cjs/base64.js +1 -1
  6. package/dist/cjs/clipboard.js +1 -1
  7. package/dist/cjs/cloneDeep.js +1 -1
  8. package/dist/cjs/concurrentLimit.js +179 -0
  9. package/dist/cjs/cookie.js +1 -1
  10. package/dist/cjs/date.js +1 -1
  11. package/dist/cjs/dom.js +1 -1
  12. package/dist/cjs/download.js +1 -1
  13. package/dist/cjs/easing.js +1 -1
  14. package/dist/cjs/file.js +1 -1
  15. package/dist/cjs/func.js +1 -1
  16. package/dist/cjs/index.js +6 -1
  17. package/dist/cjs/math.js +1 -1
  18. package/dist/cjs/node_modules/bezier-easing/src/index.js +1 -1
  19. package/dist/cjs/number.js +2 -4
  20. package/dist/cjs/object.js +1 -1
  21. package/dist/cjs/path.js +1 -1
  22. package/dist/cjs/qs.js +1 -1
  23. package/dist/cjs/random.js +1 -1
  24. package/dist/cjs/string.js +1 -1
  25. package/dist/cjs/tooltip.js +1 -1
  26. package/dist/cjs/tree.js +73 -5
  27. package/dist/cjs/type.js +1 -1
  28. package/dist/cjs/unique.js +1 -1
  29. package/dist/cjs/url.js +1 -1
  30. package/dist/cjs/validator.js +1 -1
  31. package/dist/cjs/variable.js +1 -1
  32. package/dist/cjs/watermark.js +1 -1
  33. package/dist/esm/array.js +1 -1
  34. package/dist/esm/async.js +1 -1
  35. package/dist/esm/base64.js +1 -1
  36. package/dist/esm/clipboard.js +1 -1
  37. package/dist/esm/cloneDeep.js +1 -1
  38. package/dist/esm/concurrentLimit.js +176 -0
  39. package/dist/esm/cookie.js +1 -1
  40. package/dist/esm/date.js +1 -1
  41. package/dist/esm/dom.js +1 -1
  42. package/dist/esm/download.js +1 -1
  43. package/dist/esm/easing.js +1 -1
  44. package/dist/esm/file.js +1 -1
  45. package/dist/esm/func.js +1 -1
  46. package/dist/esm/index.js +12 -2
  47. package/dist/esm/math.js +1 -1
  48. package/dist/esm/number.js +3 -5
  49. package/dist/esm/object.js +1 -1
  50. package/dist/esm/path.js +1 -1
  51. package/dist/esm/qs.js +1 -1
  52. package/dist/esm/random.js +1 -1
  53. package/dist/esm/string.js +1 -1
  54. package/dist/esm/tooltip.js +1 -1
  55. package/dist/esm/tree.js +73 -7
  56. package/dist/esm/type.js +1 -1
  57. package/dist/esm/unique.js +1 -1
  58. package/dist/esm/url.js +1 -1
  59. package/dist/esm/validator.js +1 -1
  60. package/dist/esm/variable.js +1 -1
  61. package/dist/esm/watermark.js +1 -1
  62. package/dist/types/concurrentLimit.d.ts +65 -0
  63. package/dist/types/index.d.ts +1 -0
  64. package/dist/types/tree.d.ts +36 -0
  65. package/dist/umd/index.min.js +2 -2
  66. package/package.json +1 -2
@@ -0,0 +1,176 @@
1
+ /*!
2
+ * sculp-js v1.15.0
3
+ * (c) 2023-present chandq
4
+ * Released under the MIT License.
5
+ */
6
+
7
+ /**
8
+ * 并发限制执行器
9
+ * @param {Array<Function>} tasks - 返回Promise的任务函数数组
10
+ * @param {number} limit - 最大并发数
11
+ * @returns {Promise<Array>} - 按任务顺序返回结果数组
12
+ */
13
+ async function concurrentLimit(tasks, limit) {
14
+ if (!Array.isArray(tasks)) {
15
+ throw new Error('tasks must be an array of functions');
16
+ }
17
+ if (typeof limit !== 'number' || limit <= 0) {
18
+ throw new Error('limit must be a positive number');
19
+ }
20
+ // Validate each task is a function
21
+ for (let i = 0; i < tasks.length; i++) {
22
+ if (typeof tasks[i] !== 'function') {
23
+ throw new Error(`task at index ${i} must be a function`);
24
+ }
25
+ }
26
+ if (tasks.length === 0) {
27
+ return [];
28
+ }
29
+ const results = new Array(tasks.length);
30
+ let currentIndex = 0;
31
+ return new Promise(resolve => {
32
+ let running = 0;
33
+ let completed = 0;
34
+ const executeNext = () => {
35
+ // 启动新任务直到达到并发限制
36
+ while (running < limit && currentIndex < tasks.length) {
37
+ const taskIndex = currentIndex;
38
+ const task = tasks[currentIndex];
39
+ currentIndex++;
40
+ running++;
41
+ // 将函数包装在 Promise 中以处理同步错误
42
+ Promise.resolve()
43
+ .then(() => task())
44
+ .then(value => {
45
+ results[taskIndex] = { status: 'fulfilled', value };
46
+ })
47
+ .catch(reason => {
48
+ results[taskIndex] = { status: 'rejected', reason };
49
+ })
50
+ // eslint-disable-next-line no-loop-func
51
+ .finally(() => {
52
+ running--;
53
+ completed++;
54
+ if (completed === tasks.length) {
55
+ resolve(results);
56
+ } else {
57
+ // 继续执行下一个任务
58
+ executeNext();
59
+ }
60
+ });
61
+ }
62
+ };
63
+ // 开始执行
64
+ executeNext();
65
+ });
66
+ }
67
+ /**
68
+ * 增强版:支持取消和进度回调
69
+ */
70
+ class ConcurrentExecutor {
71
+ limit;
72
+ active;
73
+ queue;
74
+ results;
75
+ isStopped;
76
+ onProgress;
77
+ onTaskComplete;
78
+ constructor(limit = 5) {
79
+ this.limit = limit;
80
+ this.active = new Map();
81
+ this.queue = [];
82
+ this.results = [];
83
+ this.isStopped = false;
84
+ this.onProgress = null;
85
+ this.onTaskComplete = null;
86
+ }
87
+ /**
88
+ * 添加任务
89
+ * @param {Function} task - 返回Promise的任务函数
90
+ * @param {any} meta - 任务元数据
91
+ */
92
+ add(task, meta = {}) {
93
+ const taskId = this.queue.length;
94
+ this.queue.push({ task, meta, id: taskId });
95
+ return taskId;
96
+ }
97
+ /**
98
+ * 批量添加任务
99
+ */
100
+ addAll(tasks) {
101
+ return tasks.map((task, i) => this.add(task, { index: i }));
102
+ }
103
+ /**
104
+ * 执行所有任务
105
+ */
106
+ async run() {
107
+ if (this.isStopped) {
108
+ throw new Error('Executor has been stopped');
109
+ }
110
+ this.results = new Array(this.queue.length);
111
+ let completed = 0;
112
+ // 更新进度
113
+ const updateProgress = () => {
114
+ if (this.onProgress) {
115
+ this.onProgress({
116
+ completed,
117
+ total: this.queue.length,
118
+ active: this.active.size,
119
+ percent: (completed / this.queue.length) * 100
120
+ });
121
+ }
122
+ };
123
+ // 执行单个任务
124
+ const runTask = async taskInfo => {
125
+ if (this.isStopped) return;
126
+ const { task, id, meta } = taskInfo;
127
+ const taskPromise = Promise.resolve().then(() => task(meta));
128
+ this.active.set(id, taskPromise);
129
+ try {
130
+ const result = await taskPromise;
131
+ this.results[id] = { status: 'fulfilled', value: result };
132
+ } catch (error) {
133
+ this.results[id] = { status: 'rejected', reason: error };
134
+ } finally {
135
+ this.active.delete(id);
136
+ completed++;
137
+ updateProgress();
138
+ if (this.onTaskComplete) {
139
+ this.onTaskComplete(id, this.results[id]);
140
+ }
141
+ // 执行队列中的下一个任务
142
+ if (this.queue.length > 0 && !this.isStopped) {
143
+ const nextTask = this.queue.shift();
144
+ runTask(nextTask);
145
+ }
146
+ }
147
+ };
148
+ // 启动初始任务
149
+ const initialTasks = this.queue.splice(0, this.limit);
150
+ initialTasks.forEach(runTask);
151
+ // 等待所有任务完成
152
+ while (this.active.size > 0 && !this.isStopped) {
153
+ await Promise.race(this.active.values());
154
+ }
155
+ if (this.isStopped) {
156
+ throw new Error('Execution was stopped');
157
+ }
158
+ return this.results;
159
+ }
160
+ /**
161
+ * 停止执行
162
+ */
163
+ stop() {
164
+ this.isStopped = true;
165
+ this.active.clear();
166
+ this.queue = [];
167
+ }
168
+ /**
169
+ * 清空队列
170
+ */
171
+ clear() {
172
+ this.queue = [];
173
+ }
174
+ }
175
+
176
+ export { ConcurrentExecutor, concurrentLimit };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/date.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/file.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/func.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -95,7 +95,16 @@ export {
95
95
  } from './number.js';
96
96
  export { UNIQUE_NUMBER_SAFE_LENGTH, uniqueNumber, uniqueString } from './unique.js';
97
97
  export { tooltipEvent } from './tooltip.js';
98
- export { flatTree, forEachDeep, formatTree, fuzzySearchTree, mapDeep, searchTreeById } from './tree.js';
98
+ export {
99
+ filterDeep,
100
+ findDeep,
101
+ flatTree,
102
+ forEachDeep,
103
+ formatTree,
104
+ fuzzySearchTree,
105
+ mapDeep,
106
+ searchTreeById
107
+ } from './tree.js';
99
108
  export { add, divide, multiply, strip, subtract } from './math.js';
100
109
  export { b64decode, b64encode, weAtob, weBtoa } from './base64.js';
101
110
  export {
@@ -119,3 +128,4 @@ export {
119
128
  export { escapeRegExp, executeInScope, parseVarFromString, replaceVarFromString, uniqueSymbol } from './variable.js';
120
129
  export { cloneDeep } from './cloneDeep.js';
121
130
  export { easingFunctional, easingStringify, getEasing, setEasing } from './easing.js';
131
+ export { ConcurrentExecutor, concurrentLimit } from './concurrentLimit.js';
package/dist/esm/math.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
7
  import { getGlobal } from './func.js';
8
8
  import { STRING_ARABIC_NUMERALS, STRING_UPPERCASE_ALPHA, STRING_LOWERCASE_ALPHA } from './string.js';
9
- import { isNullOrUnDef, isNumber } from './type.js';
9
+ import { isNullOrUnDef } from './type.js';
10
10
 
11
11
  const HEX_POOL = `${STRING_ARABIC_NUMERALS}${STRING_UPPERCASE_ALPHA}${STRING_LOWERCASE_ALPHA}`;
12
12
  const supportBigInt = typeof BigInt !== 'undefined';
@@ -104,9 +104,7 @@ function formatNumber(num, decimals) {
104
104
  return parseInt(String(num)).toLocaleString();
105
105
  }
106
106
  let prec = 0;
107
- if (!isNumber(decimals)) {
108
- throw new Error('Decimals must be a positive number not less than zero');
109
- } else if (decimals > 0) {
107
+ if (decimals > 0) {
110
108
  prec = decimals;
111
109
  }
112
110
  return Number(Number(num).toFixed(prec)).toLocaleString('en-US');
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/path.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/qs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/tree.js CHANGED
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
6
6
 
7
7
  import { objectOmit } from './object.js';
8
- import { isObject, objectHas, isEmpty, isNodeList } from './type.js';
8
+ import { isObject, objectHas, isNodeList } from './type.js';
9
9
 
10
10
  const defaultFieldOptions = { keyField: 'key', childField: 'children', pidField: 'pid' };
11
11
  const defaultSearchTreeOptions = {
@@ -129,6 +129,75 @@ function forEachDeep(
129
129
  // @ts-ignore
130
130
  tree = null;
131
131
  }
132
+ /**
133
+ * 树查找函数, 可用于查找Array和NodeList类型的数据
134
+ * @param {ArrayLike<V>} tree 树形数据
135
+ * @param {Function} predicate 断言函数
136
+ * @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
137
+ childField: 'children',
138
+ reverse: false,
139
+ breadthFirst: false,
140
+ isDomNode: false,
141
+ }
142
+ * @returns {V|null}
143
+ */
144
+ function findDeep(
145
+ tree,
146
+ predicate,
147
+ options = {
148
+ childField: 'children',
149
+ reverse: false,
150
+ breadthFirst: false,
151
+ isDomNode: false
152
+ }
153
+ ) {
154
+ let result = null;
155
+ forEachDeep(
156
+ tree,
157
+ (...args) => {
158
+ if (predicate(...args)) {
159
+ result = args[0];
160
+ return false;
161
+ }
162
+ },
163
+ options
164
+ );
165
+ return result;
166
+ }
167
+ /**
168
+ * 树过滤函数, 可用于过滤Array和NodeList类型的数据
169
+ * @param {ArrayLike<V>} tree 树形数据
170
+ * @param {Function} predicate 断言函数
171
+ * @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
172
+ childField: 'children',
173
+ reverse: false,
174
+ breadthFirst: false,
175
+ isDomNode: false,
176
+ }
177
+ * @returns {V[]}
178
+ */
179
+ function filterDeep(
180
+ tree,
181
+ predicate,
182
+ options = {
183
+ childField: 'children',
184
+ reverse: false,
185
+ breadthFirst: false,
186
+ isDomNode: false
187
+ }
188
+ ) {
189
+ const result = [];
190
+ forEachDeep(
191
+ tree,
192
+ (...args) => {
193
+ if (predicate(...args)) {
194
+ result.push(args[0]);
195
+ }
196
+ },
197
+ options
198
+ );
199
+ return result;
200
+ }
132
201
  /**
133
202
  * 创建一个新数组, 深度优先遍历的Map函数(支持continue和break操作), 可用于insert tree item 和 remove tree item
134
203
  *
@@ -314,10 +383,7 @@ function flatTree(treeList, options = defaultFieldOptions) {
314
383
  * @returns {V[]}
315
384
  */
316
385
  function fuzzySearchTree(nodes, filterCondition, options = defaultSearchTreeOptions) {
317
- if (
318
- !objectHas(filterCondition, 'filter') &&
319
- (!objectHas(filterCondition, 'keyword') || isEmpty(filterCondition.keyword))
320
- ) {
386
+ if (!objectHas(filterCondition, 'filter') && !filterCondition.keyword) {
321
387
  return nodes;
322
388
  }
323
389
  const result = [];
@@ -362,4 +428,4 @@ function fuzzySearchTree(nodes, filterCondition, options = defaultSearchTreeOpti
362
428
  return result;
363
429
  }
364
430
 
365
- export { flatTree, forEachDeep, formatTree, fuzzySearchTree, mapDeep, searchTreeById };
431
+ export { filterDeep, findDeep, flatTree, forEachDeep, formatTree, fuzzySearchTree, mapDeep, searchTreeById };
package/dist/esm/type.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
package/dist/esm/url.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * sculp-js v1.13.6
2
+ * sculp-js v1.15.0
3
3
  * (c) 2023-present chandq
4
4
  * Released under the MIT License.
5
5
  */
@@ -0,0 +1,65 @@
1
+ /**
2
+ * 并发限制执行器
3
+ * @param {Array<Function>} tasks - 返回Promise的任务函数数组
4
+ * @param {number} limit - 最大并发数
5
+ * @returns {Promise<Array>} - 按任务顺序返回结果数组
6
+ */
7
+ declare function concurrentLimit<T>(tasks: Array<() => Promise<T> | T>, limit: number): Promise<Array<{
8
+ status: 'fulfilled';
9
+ value: T;
10
+ } | {
11
+ status: 'rejected';
12
+ reason: any;
13
+ }>>;
14
+ export interface TaskInfo<T> {
15
+ task: () => Promise<T> | T;
16
+ meta: any;
17
+ id: number;
18
+ }
19
+ export interface ProgressInfo {
20
+ completed: number;
21
+ total: number;
22
+ active: number;
23
+ percent: number;
24
+ }
25
+ export interface TaskResult<T> {
26
+ status: 'fulfilled' | 'rejected';
27
+ value?: T;
28
+ reason?: any;
29
+ }
30
+ /**
31
+ * 增强版:支持取消和进度回调
32
+ */
33
+ declare class ConcurrentExecutor<T = any> {
34
+ private limit;
35
+ private active;
36
+ private queue;
37
+ private results;
38
+ private isStopped;
39
+ onProgress: ((progress: ProgressInfo) => void) | null;
40
+ onTaskComplete: ((taskId: number, result: TaskResult<T>) => void) | null;
41
+ constructor(limit?: number);
42
+ /**
43
+ * 添加任务
44
+ * @param {Function} task - 返回Promise的任务函数
45
+ * @param {any} meta - 任务元数据
46
+ */
47
+ add(task: any, meta?: {}): number;
48
+ /**
49
+ * 批量添加任务
50
+ */
51
+ addAll(tasks: any): any;
52
+ /**
53
+ * 执行所有任务
54
+ */
55
+ run(): Promise<TaskResult<T>[]>;
56
+ /**
57
+ * 停止执行
58
+ */
59
+ stop(): void;
60
+ /**
61
+ * 清空队列
62
+ */
63
+ clear(): void;
64
+ }
65
+ export { concurrentLimit, ConcurrentExecutor };
@@ -25,3 +25,4 @@ export * from './validator';
25
25
  export * from './variable';
26
26
  export * from './cloneDeep';
27
27
  export * from './easing';
28
+ export * from './concurrentLimit';
@@ -31,6 +31,42 @@ export declare function forEachDeep<V>(tree: ArrayLike<V>, iterator: (val: V, in
31
31
  breadthFirst?: boolean;
32
32
  isDomNode?: boolean;
33
33
  }): void;
34
+ /**
35
+ * 树查找函数, 可用于查找Array和NodeList类型的数据
36
+ * @param {ArrayLike<V>} tree 树形数据
37
+ * @param {Function} predicate 断言函数
38
+ * @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
39
+ childField: 'children',
40
+ reverse: false,
41
+ breadthFirst: false,
42
+ isDomNode: false,
43
+ }
44
+ * @returns {V|null}
45
+ */
46
+ export declare function findDeep<V>(tree: ArrayLike<V>, predicate: (val: V, index: number, currentArr: ArrayLike<V>, tree: ArrayLike<V>, parent: V | null, level: number) => boolean | void, options?: {
47
+ childField?: string;
48
+ reverse?: boolean;
49
+ breadthFirst?: boolean;
50
+ isDomNode?: boolean;
51
+ }): V | null;
52
+ /**
53
+ * 树过滤函数, 可用于过滤Array和NodeList类型的数据
54
+ * @param {ArrayLike<V>} tree 树形数据
55
+ * @param {Function} predicate 断言函数
56
+ * @param {options} options 支持定制子元素名称、反向遍历、广度优先遍历,默认{
57
+ childField: 'children',
58
+ reverse: false,
59
+ breadthFirst: false,
60
+ isDomNode: false,
61
+ }
62
+ * @returns {V[]}
63
+ */
64
+ export declare function filterDeep<V>(tree: ArrayLike<V>, predicate: (val: V, index: number, currentArr: ArrayLike<V>, tree: ArrayLike<V>, parent: V | null, level: number) => boolean | void, options?: {
65
+ childField?: string;
66
+ reverse?: boolean;
67
+ breadthFirst?: boolean;
68
+ isDomNode?: boolean;
69
+ }): V[];
34
70
  /**
35
71
  * 创建一个新数组, 深度优先遍历的Map函数(支持continue和break操作), 可用于insert tree item 和 remove tree item
36
72
  *