0.0.9 • Published 5 months ago

@talrace/ngx-tree v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Ngx-tree

Ngx-tree is a custom Angular package that provides a tree component for displaying hierarchical data in a collapsible, expandable, and customizable format, making it easier for users to navigate and interact with the data. It offers various features such as drag and drop and keyboard navigation, and can be easily integrated into Angular applications.

Installation

Add NgxTreeModule to your AppModule:

...
import { NgxTreeModule } from '@talrace/ngx-tree';
...

@NgModule({
    ...
    imports: [
        ...
        NgxMediaModule,
        ...
    ],
    ...
})
export class AppModule {}

Usage

Template

<tlr-flat-tree
    [isEditMode]="true"
    [title]="title"
    [menuTitle]="menuTitle"
    [data]="data"
    [selectedItem]="selectedItem | async"
    [canAddChild]="true"
    [canEdit]="true"
    [canDelete]="true"
    [canDuplicate]="true"
    [emptyTitle]="emptyTitle"
    (createItem)="addNewItem($event)"
    (editItem)="onEditItem($event)"
    (deleteItem)="onDeleteItem($event)"
    (moveItemAbove)="onMoveItemAbove($event)"
    (moveItemBelow)="onMoveItemBelow($event)"
    (moveItem)="onMoveItem($event)"
    (selectItem)="onSelectItem($event)"
    (duplicateItem)="onDuplicateItem($event)">
</<tlr-flat-tree>

Ts controller

...
import { TreeNodeModel } from '@talrace/ngx-tree/src';
...
    data = new BehaviorSubject<TreeNodeModel[]>([]);

    selectedItem = new BehaviorSubject<TreeNodeModel>(new TreeNodeModel());
    
    title = 'Add new item';
    
    menuTitle = 'item';
    
    emptyTitle = 'New Page';

    addNewItem(node?: TreeNodeModel): void {
        //implementation
    }

    onDuplicateItem(node: TreeNodeModel): void {
        //implementation
    }

    onEditItem(node: TreeNodeModel): void {
        //implementation
    }

    onDeleteItem(node: TreeNodeModel): void {
        //implementation
    }

    onMoveItemAbove(item: any): void {
        //implementation
    }

    onMoveItemBelow(item: any): void {
        //implementation
    }

    onMoveItem(item: any): void {
        //implementation
    }

    onSelectItem(node: TreeNodeModel): void {
        //implementation
    }
...
0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.3

1 year ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.6

12 months ago

0.0.2

1 year ago