/******************************************************************************** * Copyright (C) 2024-2025 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the MIT License as outlined in the LICENSE File ********************************************************************************/ import '../../../style/tree/tree-common.css'; import '../../../style/tree/tree.css'; import { ExpandableConfig } from 'antd/es/table/interface'; import { default as React } from 'react'; import { CommandDefinition } from '../../vscode/webview-types'; import { CDTTreeItem, CDTTreeItemResource, CDTTreeTableColumnDefinition } from '../common/index'; export interface CDTTreeApi { selectRow: (record: CDTTreeItem) => void; setEditRowKey: (key: string | undefined) => void; } /** * Component to render a tree table. */ export type CDTTreeProps = { /** * Information about the columns to be rendered. * If a single column is provided, then it will be rendered as a tree. */ columnDefinitions?: CDTTreeTableColumnDefinition[]; /** * Data source to be rendered. */ dataSource?: CDTTreeItem[]; /** * Whether the tree data is still loading. * Defaults to true while the data source or column definitions are undefined. */ loading?: boolean; /** * Function to sort the data source. */ dataSourceSorter?: (dataSource: CDTTreeItem[]) => CDTTreeItem[]; /** * Configuration for search behavior. */ search?: { /** * Search mode. * - 'client': filter locally in the webview (default) * - 'backend': keep current content until backend returns updated data */ mode?: 'client' | 'backend'; }; /** * Configuration for the expansion of the tree table. */ expansion?: { /** * List of expanded row keys. */ expandedRowKeys?: string[]; /** * Callback to be called when a row is expanded or collapsed. */ onExpand?: ExpandableConfig>['onExpand']; }; /** * Configuration for the pinning of the tree table. */ pin?: { /** * List of pinned row keys. */ pinnedRowKeys?: string[]; /** * Callback to be called when a row is pinned or unpinned. */ onPin?: (event: React.UIEvent, pinned: boolean, record: CDTTreeItem, api: CDTTreeApi) => void; }; /** * Configuration for the actions of the tree table. */ action?: { /** * Callback to be called when an action is triggered. */ onAction?: (event: React.UIEvent, command: CommandDefinition, value: unknown, record: CDTTreeItem, api: CDTTreeApi) => void; }; edit?: { /** * Callback to be called when a row is edited. */ onEdit?: (record: CDTTreeItem, value: string, api: CDTTreeApi) => void; }; }; export declare const CDTTree: (props: CDTTreeProps) => React.JSX.Element; //# sourceMappingURL=tree.d.ts.map