react-admin-kit
Version:
A react based UI components for admin system
31 lines (30 loc) • 1.01 kB
TypeScript
type PatchFunctionType = (item: any) => Record<string, any> | undefined | void;
/**
* 利用一个 patchItem 方法来处理 tree item
* @param data
* @param patchFunction
* @param options patch 结果是否覆盖
* @returns
*/
export declare function normalizeTree(data?: any[], patchFunction?: PatchFunctionType, options?: {
replace: boolean;
}): any[];
type FilterType = (item: any) => boolean;
/**
* 通过传入一个函数来过滤树, 不符合条件的tree item 会被过滤掉
* @param data
* @param filter
* @returns
*/
export declare function filterTree(_data: any, filter: FilterType, depth?: number): any;
/**
* 寻找树中的目标节点.
* 如果找不到返回 []
* 如果找到返回从头到目标节点的数组链
* @param {Array} data
* @param {string | number} value
* @param {string} keyName
* @returns
*/
export declare function getTreeChain(_data: never[] | undefined, findFunction: (node: any) => boolean, chain?: never[], depth?: number): any;
export {};