UNPKG

2.89 kBTypeScriptView Raw
1import { NodeMenuItem } from './menu/node-menu.component';
2export declare class FoldingType {
3 private _cssClass;
4 static Expanded: FoldingType;
5 static Collapsed: FoldingType;
6 static Empty: FoldingType;
7 static Leaf: FoldingType;
8 constructor(_cssClass: string);
9 readonly cssClass: string;
10}
11export declare type ChildrenLoadingFunction = (callback: (children: TreeModel[]) => void) => void;
12export interface TreeModel {
13 value: string | RenamableNode;
14 id?: string | number;
15 children?: TreeModel[];
16 loadChildren?: ChildrenLoadingFunction;
17 settings?: TreeModelSettings;
18 emitLoadNextLevel?: boolean;
19 _status?: TreeStatus;
20 _foldingType?: FoldingType;
21 [additionalData: string]: any;
22}
23export interface CssClasses {
24 expanded?: string;
25 collapsed?: string;
26 empty?: string;
27 leaf?: string;
28}
29export interface Templates {
30 node?: string;
31 leaf?: string;
32 leftMenu?: string;
33}
34export declare class TreeModelSettings {
35 cssClasses?: CssClasses;
36 templates?: Templates;
37 /**
38 * "leftMenu" property when set to true makes left menu available.
39 * @name TreeModelSettings#leftMenu
40 * @type boolean
41 * @default false
42 */
43 leftMenu?: boolean;
44 /**
45 * "rightMenu" property when set to true makes right menu available.
46 * @name TreeModelSettings#rightMenu
47 * @type boolean
48 * @default true
49 */
50 rightMenu?: boolean;
51 /**
52 * "menu" property when set will be available as custom context menu.
53 * @name TreeModelSettings#MenuItems
54 * @type NodeMenuItem
55 */
56 menuItems?: NodeMenuItem[];
57 /**
58 * "static" property when set to true makes it impossible to drag'n'drop tree or call a menu on it.
59 * @name TreeModelSettings#static
60 * @type boolean
61 * @default false
62 */
63 static?: boolean;
64 isCollapsedOnInit?: boolean;
65 checked?: boolean;
66 selectionAllowed?: boolean;
67 keepNodesInDOM?: boolean;
68 static readonly NOT_CASCADING_SETTINGS: string[];
69 static merge(child: TreeModel, parent: TreeModel): TreeModelSettings;
70}
71export declare class Ng2TreeSettings {
72 /**
73 * Indicates root visibility in the tree. When true - root is invisible.
74 * @name Ng2TreeSettings#rootIsVisible
75 * @type boolean
76 */
77 rootIsVisible?: boolean;
78 showCheckboxes?: boolean;
79 enableCheckboxes?: boolean;
80}
81export declare enum TreeStatus {
82 New = 0,
83 Modified = 1,
84 IsBeingRenamed = 2,
85}
86export interface RenamableNode {
87 /**
88 * Set new value of the renamable node. Implementation of this method is up to user.
89 * @param {string} name - A new value of the node.
90 */
91 setName(name: string): void;
92 /**
93 * Get string representation of the node. Implementation of this method is up to user.
94 * @returns {string} - A node string representation.
95 */
96 toString(): string;
97}