@limble/limble-tree 6.1.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/limble-limble-tree.mjs +43 -43
- package/fesm2022/limble-limble-tree.mjs.map +1 -1
- package/index.d.ts +823 -3
- package/package.json +3 -3
- package/lib/components/branch/branch.component.d.ts +0 -26
- package/lib/components/branch/index.d.ts +0 -1
- package/lib/components/dragover-no-change-detect.d.ts +0 -18
- package/lib/components/dropzone/dropzone.component.d.ts +0 -13
- package/lib/components/dropzone/index.d.ts +0 -1
- package/lib/components/host-component.interface.d.ts +0 -6
- package/lib/components/index.d.ts +0 -6
- package/lib/components/node-component.interface.d.ts +0 -5
- package/lib/components/root/index.d.ts +0 -1
- package/lib/components/root/root.component.d.ts +0 -14
- package/lib/core/branch-options.interface.d.ts +0 -14
- package/lib/core/branchable.interface.d.ts +0 -8
- package/lib/core/component-container.interface.d.ts +0 -8
- package/lib/core/configuration/configuration.d.ts +0 -11
- package/lib/core/configuration/index.d.ts +0 -2
- package/lib/core/configuration/tree-options.interface.d.ts +0 -54
- package/lib/core/index.d.ts +0 -10
- package/lib/core/tree-branch/branch-controller.d.ts +0 -25
- package/lib/core/tree-branch/graftable.interface.d.ts +0 -7
- package/lib/core/tree-branch/index.d.ts +0 -3
- package/lib/core/tree-branch/tree-branch.d.ts +0 -223
- package/lib/core/tree-node-base.d.ts +0 -26
- package/lib/core/tree-node.interface.d.ts +0 -16
- package/lib/core/tree-plot.interface.d.ts +0 -1
- package/lib/core/tree-root/index.d.ts +0 -2
- package/lib/core/tree-root/root-controller.d.ts +0 -19
- package/lib/core/tree-root/tree-root.d.ts +0 -125
- package/lib/core/tree-service/index.d.ts +0 -1
- package/lib/core/tree-service/tree.service.d.ts +0 -15
- package/lib/errors/index.d.ts +0 -1
- package/lib/errors/tree-error.d.ts +0 -2
- package/lib/events/drag/drag-end-event.d.ts +0 -25
- package/lib/events/drag/drag-start-event.d.ts +0 -8
- package/lib/events/drag/drop-event.d.ts +0 -12
- package/lib/events/drag/index.d.ts +0 -3
- package/lib/events/general/destruction-event.d.ts +0 -8
- package/lib/events/general/index.d.ts +0 -1
- package/lib/events/index.d.ts +0 -4
- package/lib/events/relational/graft-event.d.ts +0 -15
- package/lib/events/relational/index.d.ts +0 -4
- package/lib/events/relational/prune-event.d.ts +0 -15
- package/lib/events/relational/relational-tree-event.interface.d.ts +0 -11
- package/lib/events/relational/tree-relationship.interface.d.ts +0 -6
- package/lib/events/tree-event.interface.d.ts +0 -5
- package/lib/extras/collapse/collapse.d.ts +0 -11
- package/lib/extras/collapse/collapse.module.d.ts +0 -7
- package/lib/extras/collapse/collapse.service.d.ts +0 -34
- package/lib/extras/collapse/index.d.ts +0 -3
- package/lib/extras/drag-and-drop/drag-and-drop.d.ts +0 -14
- package/lib/extras/drag-and-drop/drag-and-drop.module.d.ts +0 -11
- package/lib/extras/drag-and-drop/drag-and-drop.service.d.ts +0 -35
- package/lib/extras/drag-and-drop/drag-state.d.ts +0 -23
- package/lib/extras/drag-and-drop/draggable.directive.d.ts +0 -11
- package/lib/extras/drag-and-drop/dropzone-renderer.d.ts +0 -27
- package/lib/extras/drag-and-drop/index.d.ts +0 -6
- package/lib/legacy/index.d.ts +0 -6
- package/lib/legacy/legacy-component-obj.interface.d.ts +0 -13
- package/lib/legacy/legacy-tree-data.interface.d.ts +0 -18
- package/lib/legacy/legacy-tree-options.interface.d.ts +0 -34
- package/lib/legacy/legacy-tree.d.ts +0 -14
- package/lib/legacy/limble-tree-legacy.module.d.ts +0 -8
- package/lib/legacy/limble-tree-root/limble-tree-root.component.d.ts +0 -28
- package/lib/limble-tree.module.d.ts +0 -13
- package/public-api.d.ts +0 -8
- package/shared/assert.d.ts +0 -1
- package/shared/has-property.d.ts +0 -3
- package/shared/index.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limble/limble-tree",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
5
|
+
"@angular/common": "^20.0.0",
|
|
6
|
+
"@angular/core": "^20.0.0",
|
|
7
7
|
"rxjs": "^7.8.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type AfterViewInit, ApplicationRef, type ComponentRef, EventEmitter, type OnDestroy, type QueryList, type Type, ViewContainerRef } from "@angular/core";
|
|
2
|
-
import type { HostComponent } from "../host-component.interface";
|
|
3
|
-
import type { NodeComponent } from "../node-component.interface";
|
|
4
|
-
import { DropzoneComponent } from "../dropzone";
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class BranchComponent<T> implements NodeComponent, HostComponent<T>, AfterViewInit, OnDestroy {
|
|
7
|
-
private readonly appRef;
|
|
8
|
-
branchesContainer: ViewContainerRef | undefined;
|
|
9
|
-
contentContainer: ViewContainerRef | undefined;
|
|
10
|
-
dropzones: QueryList<DropzoneComponent> | undefined;
|
|
11
|
-
contentToHost?: Type<T>;
|
|
12
|
-
readonly contentCreated: EventEmitter<T>;
|
|
13
|
-
readonly showDropzones: EventEmitter<"upper" | "lower">;
|
|
14
|
-
readonly dropped: EventEmitter<"inner" | "lateral">;
|
|
15
|
-
showInnerDropzone: boolean;
|
|
16
|
-
showLateralDropzone: boolean;
|
|
17
|
-
private hostedContent?;
|
|
18
|
-
constructor(appRef: ApplicationRef);
|
|
19
|
-
ngAfterViewInit(): void;
|
|
20
|
-
getHostedContent(): ComponentRef<T> | undefined;
|
|
21
|
-
triggerChangeDetection(): void;
|
|
22
|
-
protected dragoverHandler(event: DragEvent): void;
|
|
23
|
-
ngOnDestroy(): void;
|
|
24
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<BranchComponent<any>, never>;
|
|
25
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<BranchComponent<any>, "branch", never, { "contentToHost": { "alias": "contentToHost"; "required": false; }; }, { "contentCreated": "contentCreated"; "showDropzones": "showDropzones"; "dropped": "dropped"; }, never, never, true, never>;
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./branch.component";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ElementRef, EventEmitter, NgZone, type OnDestroy, type OnInit } from "@angular/core";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* Works just like Angular's built-in `(dragover)` event binding, but is much
|
|
5
|
-
* more performant. It throttles the event to a configurable rate (default once
|
|
6
|
-
* every 25ms) and runs outside of Angular's change detection.
|
|
7
|
-
*/
|
|
8
|
-
export declare class DragoverNoChangeDetectDirective implements OnInit, OnDestroy {
|
|
9
|
-
private readonly ngZone;
|
|
10
|
-
private readonly el;
|
|
11
|
-
readonly dragoverNoChangeDetect: EventEmitter<DragEvent>;
|
|
12
|
-
private eventSubscription;
|
|
13
|
-
constructor(ngZone: NgZone, el: ElementRef<Element>);
|
|
14
|
-
ngOnInit(): void;
|
|
15
|
-
ngOnDestroy(): void;
|
|
16
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DragoverNoChangeDetectDirective, never>;
|
|
17
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DragoverNoChangeDetectDirective, "[dragoverNoChangeDetect]", never, {}, { "dragoverNoChangeDetect": "dragoverNoChangeDetect"; }, never, never, true, never>;
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "@angular/core";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class DropzoneComponent {
|
|
4
|
-
placement?: "inner" | "lateral";
|
|
5
|
-
readonly dropped: EventEmitter<DragEvent>;
|
|
6
|
-
protected active: boolean;
|
|
7
|
-
dragenterHandler(): void;
|
|
8
|
-
dragleaveHandler(): void;
|
|
9
|
-
dragoverHandler(event: DragEvent): void;
|
|
10
|
-
dropHandler(event: DragEvent): void;
|
|
11
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DropzoneComponent, never>;
|
|
12
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DropzoneComponent, "dropzone", never, { "placement": { "alias": "placement"; "required": false; }; }, { "dropped": "dropped"; }, never, never, true, never>;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dropzone.component";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ComponentRef, EventEmitter, Type } from "@angular/core";
|
|
2
|
-
export interface HostComponent<UserlandComponent> {
|
|
3
|
-
contentCreated: EventEmitter<UserlandComponent>;
|
|
4
|
-
contentToHost?: Type<UserlandComponent>;
|
|
5
|
-
getHostedContent: () => ComponentRef<UserlandComponent> | undefined;
|
|
6
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./root.component";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type AfterViewInit, EventEmitter, ViewContainerRef } from "@angular/core";
|
|
2
|
-
import { DropzoneComponent } from "../dropzone";
|
|
3
|
-
import type { NodeComponent } from "../node-component.interface";
|
|
4
|
-
import * as i0 from "@angular/core";
|
|
5
|
-
export declare class RootComponent implements NodeComponent, AfterViewInit {
|
|
6
|
-
branchesContainer: ViewContainerRef | undefined;
|
|
7
|
-
dropzone: DropzoneComponent | undefined;
|
|
8
|
-
readonly afterViewInit: EventEmitter<void>;
|
|
9
|
-
readonly dropped: EventEmitter<void>;
|
|
10
|
-
showInnerDropzone: boolean;
|
|
11
|
-
ngAfterViewInit(): void;
|
|
12
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RootComponent, never>;
|
|
13
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<RootComponent, "root", never, {}, { "afterViewInit": "afterViewInit"; "dropped": "dropped"; }, never, never, true, never>;
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { EventEmitter, Type } from "@angular/core";
|
|
2
|
-
export interface BranchOptions<Component> {
|
|
3
|
-
inputBindings?: {
|
|
4
|
-
[K in keyof Component]?: Component[K];
|
|
5
|
-
};
|
|
6
|
-
outputBindings?: {
|
|
7
|
-
[K in keyof Component]?: Component[K] extends EventEmitter<infer T> ? (value: T) => void : never;
|
|
8
|
-
};
|
|
9
|
-
defaultCollapsed?: boolean;
|
|
10
|
-
meta?: Record<string, any>;
|
|
11
|
-
}
|
|
12
|
-
export interface FullBranchOptions<Component> extends BranchOptions<Component> {
|
|
13
|
-
component: Type<Component>;
|
|
14
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Type } from "@angular/core";
|
|
2
|
-
import type { TreeBranch } from "./tree-branch";
|
|
3
|
-
import type { BranchOptions } from "./branch-options.interface";
|
|
4
|
-
export interface Branchable<UserlandComponent> {
|
|
5
|
-
branches: () => Array<TreeBranch<UserlandComponent>>;
|
|
6
|
-
getBranch: (index: number) => TreeBranch<UserlandComponent> | undefined;
|
|
7
|
-
grow: (component: Type<UserlandComponent>, options?: BranchOptions<UserlandComponent>) => TreeBranch<UserlandComponent>;
|
|
8
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ViewContainerRef, ViewRef } from "@angular/core";
|
|
2
|
-
export interface ComponentContainer<Component> {
|
|
3
|
-
detectChanges: () => void;
|
|
4
|
-
getBranchesContainer: () => ViewContainerRef | undefined;
|
|
5
|
-
getComponentInstance: () => Component;
|
|
6
|
-
getHostView: () => ViewRef;
|
|
7
|
-
getNativeElement: () => HTMLElement;
|
|
8
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { TreeRoot } from "../tree-root";
|
|
2
|
-
import type { TreeOptions } from "./tree-options.interface";
|
|
3
|
-
declare class Configuration {
|
|
4
|
-
private readonly configStorage;
|
|
5
|
-
constructor();
|
|
6
|
-
setConfig<T>(root: TreeRoot<T>, options: TreeOptions): void;
|
|
7
|
-
getConfig(root: any): TreeOptions | undefined;
|
|
8
|
-
delete(root: any): void;
|
|
9
|
-
}
|
|
10
|
-
export declare const config: Configuration;
|
|
11
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { TreeBranch } from "../tree-branch";
|
|
2
|
-
import type { TreeRoot } from "../tree-root";
|
|
3
|
-
/** The configuration options for a tree, as identified by a TreeRoot */
|
|
4
|
-
export interface TreeOptions {
|
|
5
|
-
dragAndDrop?: {
|
|
6
|
-
/**
|
|
7
|
-
* A function that determines whether to allow a node to be dragged.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Runs when a drag begins, but before the branch is pruned from the tree.
|
|
11
|
-
*
|
|
12
|
-
* @param treeBranch - The node of the tree that is about to be dragged.
|
|
13
|
-
*
|
|
14
|
-
* @defaultValue A function that always returns true.
|
|
15
|
-
*
|
|
16
|
-
* @returns `true` if the node can be dragged; `false` if it cannot.
|
|
17
|
-
*/
|
|
18
|
-
allowDragging?: <T>(treeBranch: TreeBranch<T>) => boolean;
|
|
19
|
-
/**
|
|
20
|
-
* A function to determine whether a sourceNode can be dropped at a
|
|
21
|
-
* particular location.
|
|
22
|
-
*
|
|
23
|
-
* @remarks
|
|
24
|
-
* This function runs just before displaying a family of dropzones.
|
|
25
|
-
*
|
|
26
|
-
* @param sourceBranch - The branch that is being dragged.
|
|
27
|
-
* @param proposedParent - The proposed new parent of the sourceBranch.
|
|
28
|
-
* @param proposedIndex - The proposed new index of the sourceBranch.
|
|
29
|
-
*
|
|
30
|
-
* @defaultValue A function that always returns true.
|
|
31
|
-
*/
|
|
32
|
-
allowDrop?: <T>(sourceBranch: TreeBranch<T>, proposedParent: TreeBranch<T> | TreeRoot<T>, proposedIndex: number) => boolean;
|
|
33
|
-
/**
|
|
34
|
-
* A function to indicate whether to allow "nesting" (placing a branch as
|
|
35
|
-
* a child) of a particular branch.
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* This function runs just before displaying a family of dropzones.
|
|
39
|
-
*
|
|
40
|
-
* @param treeBranch - The node of the tree whose nesting capability is being
|
|
41
|
-
* checked.
|
|
42
|
-
*
|
|
43
|
-
* @defaultValue A function that always returns true.
|
|
44
|
-
*/
|
|
45
|
-
allowNesting?: <T>(treeBranch: TreeBranch<T>) => boolean;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* The number of pixels each level of the tree will be indented relative to
|
|
49
|
-
* its parent.
|
|
50
|
-
*
|
|
51
|
-
* @defaultValue 16
|
|
52
|
-
*/
|
|
53
|
-
indentation?: number;
|
|
54
|
-
}
|
package/lib/core/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./configuration";
|
|
2
|
-
export * from "./tree-branch";
|
|
3
|
-
export * from "./tree-root";
|
|
4
|
-
export * from "./tree-service";
|
|
5
|
-
export type * from "./branch-options.interface";
|
|
6
|
-
export type * from "./branchable.interface";
|
|
7
|
-
export type * from "./component-container.interface";
|
|
8
|
-
export * from "./tree-node-base";
|
|
9
|
-
export type * from "./tree-node.interface";
|
|
10
|
-
export type * from "./tree-plot.interface";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type ComponentRef, type ViewContainerRef, type ViewRef } from "@angular/core";
|
|
2
|
-
import { BranchComponent } from "../../components";
|
|
3
|
-
import type { ComponentContainer } from "../component-container.interface";
|
|
4
|
-
import type { TreeBranch } from "./tree-branch";
|
|
5
|
-
/**
|
|
6
|
-
* A wrapper around the BranchComponent that helps instantiate it and handles its events.
|
|
7
|
-
*/
|
|
8
|
-
export declare class BranchController<UserlandComponent> implements ComponentContainer<BranchComponent<UserlandComponent>> {
|
|
9
|
-
private readonly treeBranch;
|
|
10
|
-
private readonly branchComponentRef;
|
|
11
|
-
private readonly instanceSubscriptions;
|
|
12
|
-
private readonly outputBindingSubscriptions;
|
|
13
|
-
constructor(treeBranch: TreeBranch<UserlandComponent>, parentBranchesContainer: ViewContainerRef);
|
|
14
|
-
destroy(): void;
|
|
15
|
-
detectChanges(): void;
|
|
16
|
-
getBranchesContainer(): ViewContainerRef | undefined;
|
|
17
|
-
getComponentInstance(): BranchComponent<UserlandComponent>;
|
|
18
|
-
getHostView(): ViewRef;
|
|
19
|
-
getNativeElement(): HTMLElement;
|
|
20
|
-
getUserlandComponentRef(): ComponentRef<UserlandComponent> | undefined;
|
|
21
|
-
private getContentCreatedSub;
|
|
22
|
-
private getInstanceSubscriptions;
|
|
23
|
-
private getShowLowerZonesSub;
|
|
24
|
-
private getShowUpperZonesSub;
|
|
25
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TreeNode } from "../tree-node.interface";
|
|
2
|
-
export interface Graftable<UserlandComponent> {
|
|
3
|
-
graftTo: (newParent: TreeNode<UserlandComponent>, index?: number) => number;
|
|
4
|
-
index: () => number | undefined;
|
|
5
|
-
parent: () => TreeNode<UserlandComponent> | undefined;
|
|
6
|
-
prune: () => void;
|
|
7
|
-
}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import type { Observable } from "rxjs";
|
|
2
|
-
import type { ComponentRef, Type, ViewContainerRef, ViewRef } from "@angular/core";
|
|
3
|
-
import { BranchComponent } from "../../components";
|
|
4
|
-
import { TreeRoot } from "../tree-root";
|
|
5
|
-
import type { TreeNode } from "../tree-node.interface";
|
|
6
|
-
import type { TreePlot } from "../tree-plot.interface";
|
|
7
|
-
import type { BranchOptions, FullBranchOptions } from "../branch-options.interface";
|
|
8
|
-
import type { Graftable } from "./graftable.interface";
|
|
9
|
-
import { type TreeEvent } from "../../events";
|
|
10
|
-
/** Represents a standard node in a tree. Renders a BranchComponent.
|
|
11
|
-
*
|
|
12
|
-
* @remarks
|
|
13
|
-
* This class renders a branch component, which does the following:
|
|
14
|
-
* 1. Renders a component provided by the user
|
|
15
|
-
* 2. Provides a container in which child branches may be rendered
|
|
16
|
-
* 3. Contains two Dropzones: one for dropping branches below this branch (as a
|
|
17
|
-
* sibling), and one for dropping branches as a first child of this branch.
|
|
18
|
-
*/
|
|
19
|
-
export declare class TreeBranch<UserlandComponent> implements TreeNode<UserlandComponent>, Graftable<UserlandComponent> {
|
|
20
|
-
readonly branchOptions: FullBranchOptions<UserlandComponent>;
|
|
21
|
-
private readonly branchController;
|
|
22
|
-
private detachedView;
|
|
23
|
-
private _parent;
|
|
24
|
-
private readonly treeNodeBase;
|
|
25
|
-
constructor(parent: TreeNode<UserlandComponent>, branchOptions: FullBranchOptions<UserlandComponent>);
|
|
26
|
-
/** @returns All child branches as an array of TreeBranch instances, in order. */
|
|
27
|
-
branches(): Array<TreeBranch<UserlandComponent>>;
|
|
28
|
-
/**
|
|
29
|
-
* Recursively destroys all descendant branches, as well as itself. This
|
|
30
|
-
* releases all resources held or consumed by this branch and its descendants.
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* It is important to call this method when a branch is discarded, otherwise
|
|
34
|
-
* the branch will remain in memory and continue to consume resources.
|
|
35
|
-
*/
|
|
36
|
-
destroy(): void;
|
|
37
|
-
/** Run Angular change detection on this branch */
|
|
38
|
-
detectChanges(): void;
|
|
39
|
-
/**
|
|
40
|
-
* Emits the specified TreeEvent.
|
|
41
|
-
*
|
|
42
|
-
* @remarks
|
|
43
|
-
* Caution: It is not recommended to manually emit TreeEvents that are already
|
|
44
|
-
* provided by the library. For example, it is not recommended to emit a
|
|
45
|
-
* `GraftEvent`, `DestructionEvent`, etc. These events may be used by the tree,
|
|
46
|
-
* and emitting them manually may cause unexpected behavior. Instead, we
|
|
47
|
-
* recommend implementing the TreeEvent interface with your own custom events
|
|
48
|
-
* and dispatching those.
|
|
49
|
-
*
|
|
50
|
-
* @param event - The TreeEvent that will be emitted.
|
|
51
|
-
*/
|
|
52
|
-
dispatch(event: TreeEvent<UserlandComponent>): void;
|
|
53
|
-
/**
|
|
54
|
-
* @returns
|
|
55
|
-
* An observable that emits TreeEvents whenever an event is dispatched
|
|
56
|
-
* in this branch or any of its descendant branches.
|
|
57
|
-
*/
|
|
58
|
-
events(): Observable<TreeEvent<UserlandComponent>>;
|
|
59
|
-
/**
|
|
60
|
-
* @param index - The index of the child branch to retrieve.
|
|
61
|
-
*
|
|
62
|
-
* @returns
|
|
63
|
-
* The child branch at the specified index, or undefined if there is
|
|
64
|
-
* no child branch at the specified index.
|
|
65
|
-
*/
|
|
66
|
-
getBranch(index: number): TreeBranch<UserlandComponent> | undefined;
|
|
67
|
-
/** @returns The ViewContainerRef in which child branches are rendered */
|
|
68
|
-
getBranchesContainer(): ViewContainerRef | undefined;
|
|
69
|
-
/** @returns The instance of BranchComponent that is rendered by this class. */
|
|
70
|
-
getComponentInstance(): BranchComponent<UserlandComponent>;
|
|
71
|
-
/** @returns The Host View in which the BranchComponent is rendered */
|
|
72
|
-
getHostView(): ViewRef;
|
|
73
|
-
/** @returns The BranchComponent as a native HTML Element */
|
|
74
|
-
getNativeElement(): HTMLElement;
|
|
75
|
-
/**
|
|
76
|
-
* @returns
|
|
77
|
-
* A ComponentRef containing the instance of the user-provided
|
|
78
|
-
* component which is rendered by this branch.
|
|
79
|
-
*/
|
|
80
|
-
getUserlandComponentRef(): ComponentRef<UserlandComponent> | undefined;
|
|
81
|
-
/**
|
|
82
|
-
* Attaches a branch to a new parent node.
|
|
83
|
-
*
|
|
84
|
-
* @remarks
|
|
85
|
-
* If not already pruned, this method prunes (removes) this branch from its
|
|
86
|
-
* current position in the tree; then grafts (reattaches) it as a child of the
|
|
87
|
-
* specified parent branch at the specified index. If no index is specified,
|
|
88
|
-
* the branch is appended as the last child of the parent. This causes this
|
|
89
|
-
* branch's associated BranchComponent to be re-rendered in the DOM at the
|
|
90
|
-
* new location.
|
|
91
|
-
*
|
|
92
|
-
* @param newParent - The new parent branch unto which this branch will be grafted.
|
|
93
|
-
* @param index - The index at which this branch will be grafted. If not specified,
|
|
94
|
-
* this branch will be appended as the last child of the new parent.
|
|
95
|
-
*
|
|
96
|
-
* @returns The index at which this branch was grafted.
|
|
97
|
-
*/
|
|
98
|
-
graftTo(newParent: TreeNode<UserlandComponent>, index?: number): number;
|
|
99
|
-
/**
|
|
100
|
-
* Appends a new child branch to this branch. The child branch will render
|
|
101
|
-
* the specified component according to the (optional) configuration parameter.
|
|
102
|
-
*
|
|
103
|
-
* @param component - The component to render in the new child branch.
|
|
104
|
-
* @param options - Configuration options for the new child branch.
|
|
105
|
-
*
|
|
106
|
-
* @returns
|
|
107
|
-
* The newly-created child branch.
|
|
108
|
-
*/
|
|
109
|
-
grow(component: Type<UserlandComponent>, options?: BranchOptions<UserlandComponent>): TreeBranch<UserlandComponent>;
|
|
110
|
-
/**
|
|
111
|
-
* Determines this branch's index in relation to its sibling branches.
|
|
112
|
-
*
|
|
113
|
-
* @remarks
|
|
114
|
-
* For example, if it is the first child of its parent, this method will return
|
|
115
|
-
* 0. If it is the second child of its parent, this method will return 1.
|
|
116
|
-
*
|
|
117
|
-
* If this branch has no parent, (eg, if this branch has been pruned) this
|
|
118
|
-
* method will return undefined.
|
|
119
|
-
*
|
|
120
|
-
* @returns
|
|
121
|
-
* The index of this branch in relation to its sibling branches, or undefined.
|
|
122
|
-
*/
|
|
123
|
-
index(): number | undefined;
|
|
124
|
-
/** @returns `true` if the branch is destroyed, `false` otherwise */
|
|
125
|
-
isDestroyed(): boolean;
|
|
126
|
-
/**
|
|
127
|
-
* @returns
|
|
128
|
-
* The data that was passed into the `branchOptions`' `meta` property
|
|
129
|
-
* at construction.
|
|
130
|
-
*/
|
|
131
|
-
meta(): Record<string, any>;
|
|
132
|
-
/**
|
|
133
|
-
* @returns
|
|
134
|
-
* This branch's parent node (which may be a TreeBranch or TreeRoot).
|
|
135
|
-
* If this branch has no parent, (eg, if this branch has been pruned) this
|
|
136
|
-
* method will return undefined.
|
|
137
|
-
*/
|
|
138
|
-
parent(): TreeNode<UserlandComponent> | undefined;
|
|
139
|
-
/**
|
|
140
|
-
* Provides a model describing this branch's descendants.
|
|
141
|
-
*
|
|
142
|
-
* @returns
|
|
143
|
-
* A multi-dimensional Map which describes the shape of this branch's
|
|
144
|
-
* descendants.
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* A branch with no children will return an empty Map. A branch with
|
|
148
|
-
* a single child will return a Map with a single entry, where the key is the index
|
|
149
|
-
* of the branch (zero) and the value is an empty Map. A Tree like this:
|
|
150
|
-
*
|
|
151
|
-
* ```
|
|
152
|
-
* ---Branch-------Branch
|
|
153
|
-
* /
|
|
154
|
-
* Branch-------Branch
|
|
155
|
-
* \
|
|
156
|
-
* ---Branch
|
|
157
|
-
* ```
|
|
158
|
-
* Will return a Map of matching shape:
|
|
159
|
-
* ```
|
|
160
|
-
* Map {
|
|
161
|
-
* 0: Map { 0: Map {}},
|
|
162
|
-
* 1: Map {},
|
|
163
|
-
* 2: Map {}
|
|
164
|
-
* }
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
plot(): TreePlot;
|
|
168
|
-
/**
|
|
169
|
-
* Calculates the branch's position in the tree relative to the Root.
|
|
170
|
-
*
|
|
171
|
-
* @remarks
|
|
172
|
-
* The position is described as an array of numbers, where each number
|
|
173
|
-
* represents the index of the branch at that level of the tree.
|
|
174
|
-
*
|
|
175
|
-
* For example, if this branch is the first child of the Root, this method
|
|
176
|
-
* will return [0]. If this branch is the second child of the first child
|
|
177
|
-
* of the Root, this method will return [0, 1].
|
|
178
|
-
*
|
|
179
|
-
* If the branch is not related to a TreeRoot, (such as when it has been
|
|
180
|
-
* pruned,) this method will throw an error.
|
|
181
|
-
*
|
|
182
|
-
* @returns
|
|
183
|
-
* An array of numbers which describe the branch's position in the tree
|
|
184
|
-
* relative to the Root.
|
|
185
|
-
*/
|
|
186
|
-
position(): Array<number>;
|
|
187
|
-
/**
|
|
188
|
-
* Removes a branch from its tree without destroying it.
|
|
189
|
-
*
|
|
190
|
-
* @remarks
|
|
191
|
-
* Removes this branch from its parent and detaches its associated
|
|
192
|
-
* BranchComponent from the DOM. This puts the branch in a "pruned" state,
|
|
193
|
-
* which may affect the behavior of other methods.
|
|
194
|
-
*
|
|
195
|
-
* A pruned branch can be reattached to any other node using the `graftTo` method.
|
|
196
|
-
*
|
|
197
|
-
* @returns
|
|
198
|
-
* Itself, or undefined if it is already in a pruned state.
|
|
199
|
-
*/
|
|
200
|
-
prune(): this | undefined;
|
|
201
|
-
/**
|
|
202
|
-
* Get the root of the tree to which this Branch is attached.
|
|
203
|
-
*
|
|
204
|
-
* @returns
|
|
205
|
-
* The TreeRoot of the tree this branch is in. If this branch is
|
|
206
|
-
* does not have a root (such as when it has been pruned) this method will
|
|
207
|
-
* return undefined.
|
|
208
|
-
*/
|
|
209
|
-
root(): TreeRoot<UserlandComponent> | undefined;
|
|
210
|
-
/**
|
|
211
|
-
* Traverses this branch's descendants in depth-first pre-order, executing
|
|
212
|
-
* the provided callback function on each node. Traversal includes this branch.
|
|
213
|
-
*
|
|
214
|
-
* @param callback - A function to execute on each node.
|
|
215
|
-
*/
|
|
216
|
-
traverse(callback: (node: TreeBranch<UserlandComponent>) => void): void;
|
|
217
|
-
private checkGraftLocationValidity;
|
|
218
|
-
private handleUserlandError;
|
|
219
|
-
private indexIsOutOfRange;
|
|
220
|
-
private furthestAncestor;
|
|
221
|
-
private reattachView;
|
|
222
|
-
private setIndentation;
|
|
223
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { type Observable } from "rxjs";
|
|
2
|
-
import { TreeError } from "../errors";
|
|
3
|
-
import { type TreeEvent } from "../events";
|
|
4
|
-
import { TreeBranch } from "./tree-branch";
|
|
5
|
-
import type { TreePlot } from "./tree-plot.interface";
|
|
6
|
-
import type { TreeNode } from "./tree-node.interface";
|
|
7
|
-
export declare class TreeNodeBase<UserlandComponent> implements Partial<TreeNode<UserlandComponent>> {
|
|
8
|
-
private readonly _branches;
|
|
9
|
-
private readonly events$;
|
|
10
|
-
private destroyed;
|
|
11
|
-
private readonly subscriptions;
|
|
12
|
-
constructor();
|
|
13
|
-
branches(): Array<TreeBranch<UserlandComponent>>;
|
|
14
|
-
destroy(): void;
|
|
15
|
-
dispatch(event: TreeEvent<UserlandComponent>): void;
|
|
16
|
-
events(): Observable<TreeEvent<UserlandComponent>>;
|
|
17
|
-
getBranch(index: number): TreeBranch<UserlandComponent> | undefined;
|
|
18
|
-
handleUserlandError(error: unknown): TreeError;
|
|
19
|
-
isDestroyed(): boolean;
|
|
20
|
-
plot(): TreePlot;
|
|
21
|
-
traverse(callback: (node: TreeBranch<UserlandComponent>) => void): void;
|
|
22
|
-
private deregisterChildRelationship;
|
|
23
|
-
private graftsToSelf;
|
|
24
|
-
private prunesToSelf;
|
|
25
|
-
private registerChildRelationship;
|
|
26
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { TreeRoot } from "./tree-root";
|
|
2
|
-
import type { TreePlot } from "./tree-plot.interface";
|
|
3
|
-
import type { Branchable } from "./branchable.interface";
|
|
4
|
-
import type { ComponentContainer } from "./component-container.interface";
|
|
5
|
-
import type { Observable } from "rxjs";
|
|
6
|
-
import type { TreeEvent } from "../events";
|
|
7
|
-
import type { NodeComponent } from "../components";
|
|
8
|
-
export interface TreeNode<UserlandComponent> extends Branchable<UserlandComponent>, ComponentContainer<NodeComponent> {
|
|
9
|
-
destroy: () => void;
|
|
10
|
-
dispatch: (event: TreeEvent<UserlandComponent>) => void;
|
|
11
|
-
events: () => Observable<TreeEvent<UserlandComponent>>;
|
|
12
|
-
isDestroyed: () => boolean;
|
|
13
|
-
plot: () => TreePlot;
|
|
14
|
-
root: () => TreeRoot<any> | undefined;
|
|
15
|
-
traverse: (callback: (node: TreeNode<UserlandComponent>) => void) => void;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type TreePlot = Map<number, TreePlot>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ViewContainerRef, ViewRef } from "@angular/core";
|
|
2
|
-
import { RootComponent } from "../../components";
|
|
3
|
-
import type { TreeRoot } from "./tree-root";
|
|
4
|
-
import type { ComponentContainer } from "../component-container.interface";
|
|
5
|
-
/**
|
|
6
|
-
* A wrapper around the BranchComponent that helps instantiate it and handles its events.
|
|
7
|
-
*/
|
|
8
|
-
export declare class RootController<T> implements ComponentContainer<RootComponent> {
|
|
9
|
-
private readonly treeRoot;
|
|
10
|
-
private readonly rootComponentRef;
|
|
11
|
-
private readonly instanceSubscriptions;
|
|
12
|
-
constructor(treeRoot: TreeRoot<T>, viewContainerRef: ViewContainerRef);
|
|
13
|
-
destroy(): void;
|
|
14
|
-
detectChanges(): void;
|
|
15
|
-
getBranchesContainer(): ViewContainerRef | undefined;
|
|
16
|
-
getComponentInstance(): RootComponent;
|
|
17
|
-
getHostView(): ViewRef;
|
|
18
|
-
getNativeElement(): HTMLElement;
|
|
19
|
-
}
|