@progress/kendo-react-common
Version:
React Common package delivers common utilities that can be used with the KendoReact UI components. KendoReact Common Utilities package
47 lines (46 loc) • 2.45 kB
TypeScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
/**
* Creates a new array with the results of calling the provided callback function
* on every element in the provided data tree.
*
* @param {any[]} tree - The data tree.
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
* @param {(value: any) => any} callback - The callback function.
* @returns {any[]} - The new data tree.
*/
export declare const mapTree: (tree: any[], subItemsField: string, callback: (value: any) => any) => any[];
/**
* Creates a new array with the results of calling the provided callback function
* on the element which match the `level` in the provided data tree.
*
* @param {any[]} tree - The data tree.
* @param {number[]} level - An array of indexes of each parent and current item in the data tree.
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
* @param {(value: any) => any} callback - The callback function.
* @returns {any[]} - The new data tree.
*/
export declare const mapTreeItem: (tree: any[], level: number[], subItemsField: string, callback: (value: any) => any) => void;
/**
* Similar to the `Object.assign` function. Additionally, creates a new array for the subitems.
*
* @param {object} item - The source data item.
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
* @param {object} propsToExtend - The props with which the source data item will be extended.
* @returns {object} - The target data item.
*/
export declare const extendDataItem: (item: any, subItemsField: string, propsToExtend?: any) => any;
/**
* Returns the data item path in the tree based on the level parameter.
*
* @param {any[]} tree - The data tree.
* @param {number[]} level - The level of the target tree item.
* @param {string} subItemsField - The field which points to the subitems collection of each data item.
* @returns {any[]} - The path of the data item.
*/
export declare const getItemPath: (tree: any[], level: number[], subItemsField?: string) => any[];