/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2026 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { SortDescriptor, FilterDescriptor, CompositeFilterDescriptor } from '@progress/kendo-data-query'; import { DataItemWrapper } from './DataItemWrapper.js'; /** * Orders the specified tree according to the provided sort descriptors. * * @param {T[]} data - The data that will be sorted. * @param {SortDescriptor[]} descriptors - The descriptors by which the data will be sorted. * @param {string} subItemsField - The field which points to the subitems collection of each data item. * @returns {T[]} - The sorted data. */ export declare function orderBy(data: any[], descriptors: SortDescriptor[], subItemsField: string): any[]; /** * Filters the provided data tree according to the specified `Array`. * * @param {T[]} data - The data that will be filtered. * @param {FilterDescriptor[]|CompositeFilterDescriptor[]} descriptors - The filter criteria that will be applied. * @param {string} subItemsField - The field which points to the subitems collection of each data item. * @returns {T[]} - The filtered data. */ export declare function filterBy(data: any[], descriptors: FilterDescriptor[] | CompositeFilterDescriptor[], subItemsField: string): any[]; /** * @hidden */ export declare function flatData(data: any[], getChildren: (dataItem: any) => any[], itemMap: (item: any) => any): DataItemWrapper[]; /** * Creates a flat data array from the passed tree dataset. * * @param {object[]} dataset - The source dataset of data items. * @param {string} expandField - The field which points to the expanded value of each data item. * @param {string} subItemsField - The field which points to the subitems collection of each data item. * @returns {object[]} - A collection of the generated data items that are in a flat structure. */ export declare const treeToFlat: (data: any[], expandField: string, subItemsField: string) => any[]; /** * Creates a tree from the passed dataset. * * @param {object[]} dataset - The source dataset of data items. * @param {(item: object) => any} getId - A function which will return the id of the data item. * @param {(item: object) => any} getParentId - A function which will return the data item id of its parent data item. * @param {string} subItemsField - The field which points to the subitems collection of each data item. * @returns {object[]} - A collection of the generated data items that are structured in a tree. */ export declare const createDataTree: (dataset: any[], getId: (item: any) => any, getParentId: (item: any) => any, subItemsField: string) => any[]; /** * 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; /** * Removes the items from the passed `data` which match the passed `condition`. * * @param {any[]} data - The data tree. * @param {string} subItemsField - The field which points to the subitems collection of each data item. * @param {(item: object) => Boolean} condition - A function that will be executed for each data item * in the tree data and the items for which returns true will be removed. * @returns {any[]} - The new data tree. */ export declare const removeItems: (data: any[], subItemsField: string, condition: (item: any) => boolean) => any[]; /** * Changes the `subItems` collection of each data item which matches the passed `condition`. * * @param {any[]} data - The data tree. * @param {string} subItemsField - The field which points to the subitems collection of each data item. * @param {(item: object) => Boolean} condition - A function that will be executed for each data item and * will return `true` for items that have to change the subitems collection. * @param {(subItems: object[]) => object[]} change - A function which * has as a parameter the subitems collection of the matched items and which will return the new subitems collection. * @returns {any[]} - The new data tree. */ export declare const modifySubItems: (data: any[], subItemsField: string, condition: (item: any) => boolean, change: (subItems: any[]) => 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[]; /** * Moves the targeted item in the tree to another position. * * @param {any[]} data - The data tree. * @param {number[]} target - The level of the target tree item which will be moved. * @param {number[] | null} destination - The level of the destination tree item where the target item will be moved in. * If it is null, the target item will be added at the root level. * @param {string} subItemsField - The field which points to the subitems collection of each data item. * @returns {any[]} - The new data tree. */ export declare const moveTreeItem: (data: any[], target: number[], destination: number[] | null, subItemsField: string) => any[]; /** @hidden */ export declare const getSearchFromString: (search: CompositeFilterDescriptor, value: string) => CompositeFilterDescriptor; /** @hidden */ export declare const getStringFromSearch: (search: CompositeFilterDescriptor | undefined) => string; /** @hidden */ export declare const combineFilters: (first?: CompositeFilterDescriptor, second?: CompositeFilterDescriptor) => CompositeFilterDescriptor | undefined;