@atlaskit/table-tree
Version:
A table tree is an expandable table for showing nested hierarchies of information.
26 lines (25 loc) • 614 B
TypeScript
/**
* This helper class will create a cache of all the id's in the items object and
* path to the object.
* Example:
* [{
* // item 1,
* id: 1,
* children:[{
* // item 1.1,
* id: '2'
* }]
* }]
*
* Cache will look something like:
* {1: 0, 2: '0.children[0]'}
*/
export default class TableTreeDataHelper<T extends any = any> {
key: keyof T;
keysCache: any;
constructor({ key, }?: {
key?: keyof T | undefined;
});
updateItems(items: T[], allItems?: T[], parentItem?: T | null): T[];
appendItems(items: T[], allItems?: T[], parentItem?: T | null): T[];
}