1
This commit is contained in:
29
20220330_Vote/Ewide.Web.Entry/wwwroot/lib/xe-utils/findTree.d.ts
vendored
Normal file
29
20220330_Vote/Ewide.Web.Entry/wwwroot/lib/xe-utils/findTree.d.ts
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
export interface FindTerrResult<T = any> {
|
||||
index: number;
|
||||
item: T;
|
||||
path: Array<string>;
|
||||
items: T[];
|
||||
parent: T;
|
||||
nodes: T[];
|
||||
}
|
||||
|
||||
export interface FindTreeOptions {
|
||||
children?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从树结构中查找匹配第一条数据的键、值、路径
|
||||
* @param {Object} list 数组
|
||||
* @param {Function} iterate(item, index, items, path, parent, nodes) 回调
|
||||
* @param {Object} options {children: 'children'}
|
||||
* @param {Object} context 上下文
|
||||
*/
|
||||
export declare function findTree<T, C>(list: T[], iterate: (this: C, item: T, index: number, items: T[], path: string[], parent: T, nodes: T[]) => boolean, options?: FindTreeOptions, context?: C): FindTerrResult<T>;
|
||||
|
||||
declare module './ctor' {
|
||||
interface XEUtilsMethods {
|
||||
findTree: typeof findTree;
|
||||
}
|
||||
}
|
||||
|
||||
export default findTree
|
||||
Reference in New Issue
Block a user