UNPKG

1.42 kBTypeScriptView Raw
1import { ReactNode } from 'react';
2import { Disposable, DisposableCollection, Emitter, Event, MaybePromise } from '../../common';
3import { TreeWidget } from '../tree';
4export interface TreeElement {
5 /** default: parent id + position among siblings */
6 readonly id?: number | string | undefined;
7 /** default: true */
8 readonly visible?: boolean;
9 render(host: TreeWidget): ReactNode;
10 open?(): MaybePromise<any>;
11}
12export interface CompositeTreeElement extends TreeElement {
13 /** default: true */
14 readonly hasElements?: boolean;
15 getElements(): MaybePromise<IterableIterator<TreeElement>>;
16}
17export declare namespace CompositeTreeElement {
18 function is(element: unknown): element is CompositeTreeElement;
19 function hasElements(element: unknown): element is CompositeTreeElement;
20}
21export declare abstract class TreeSource implements Disposable {
22 protected readonly onDidChangeEmitter: Emitter<void>;
23 readonly onDidChange: Event<void>;
24 protected fireDidChange(): void;
25 readonly id: string | undefined;
26 readonly placeholder: string | undefined;
27 constructor(options?: TreeSourceOptions);
28 protected readonly toDispose: DisposableCollection;
29 dispose(): void;
30 abstract getElements(): MaybePromise<IterableIterator<TreeElement>>;
31}
32export interface TreeSourceOptions {
33 id?: string;
34 placeholder?: string;
35}
36//# sourceMappingURL=tree-source.d.ts.map
\No newline at end of file