19.0.22 • Published 4 months ago

flexi-treeview v19.0.22

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Flexi Treeview

Flexi Treeview is a customizable and flexible Angular component for displaying hierarchical data in a tree structure. It supports selection, expansion, search, and actions like edit, delete, and refresh.

Live Demo

Edit in CodeSandbox

Features

  • 🛠 Dynamic Tree Structure - Supports parent-child relationships with nested levels.
  • Checkbox Selection - Allows selecting individual nodes and handling indeterminate states.
  • 🔍 Search Functionality - Quickly find nodes within the tree.
  • 📏 Customizable UI - Adjust size, colors, and styling.
  • 🎨 Dark & Light Mode Support - Adapts to the selected theme.
  • 🔄 Expand/Collapse All - Expand or collapse all nodes easily.
  • 🖱 Action Buttons - Edit, delete, and detail buttons for nodes.
  • 🔄 Live Refresh - Refresh the tree dynamically.

Installation

npm install flexi-treeview

Usage

Import the Module

import { FlexiTreeviewComponent } from 'flexi-treeview';

@Component({
  selector: 'app-root',
  imports: [FlexiTreeviewComponent],
  templateUrl: './app.component.html',
  styleUrl: './app.component.css'
})

Add to Template

<flexi-treeview
    [data]="treeData"
    [treeviewTitle]="'Categories'"
    [themeClass]="'light'"
    [showCheckbox]="true"
    [showSearch]="true"
    [showDetailButton]="true"
    (onSelected)="handleSelectedNodes($event)"
    (onEdit)="handleEditNode($event)"
    (onDelete)="handleDeleteNode($event)"
    (onRefresh)="handleRefresh()"
    detailRouterLink="/products">
</flexi-treeview>

Define Tree Data

treeData: FlexiTreeNode[] = [
    {
      id: '1',
      name: 'Parent Node',
      code: 'P1',
      isMain: true,
      indeterminate: false,
      selected: false,
      expanded: true,
      description: '',
      originalData: null,
      children: [
        {
          id: '2',
          name: 'Child Node 1',
          code: 'C1',
          isMain: false,
          indeterminate: false,
          selected: false,
          expanded: true,
          description: '',
          originalData: null
        },
        {
          id: '3',
          name: 'Child Node 2',
          code: 'C2',
          isMain: false,
          indeterminate: false,
          selected: false,
          expanded: true,
          description: '',
          originalData: null
        }
      ]
    }
  ];
handleSelectedNodes(selectedNodes: FlexiTreeNode[]) {
  console.log('Selected Nodes:', selectedNodes);
}

handleEditNode(node: FlexiTreeNode) {
  console.log('Edit Node:', node);
}

handleDeleteNode(node: FlexiTreeNode) {
  console.log('Delete Node:', node);
}

handleRefresh() {
  console.log('Treeview refreshed');
}

API

Input PropertyTypeDefaultDescription
dataFlexiTreeNode[][]The tree node data array.
treeviewTitlestring''Title of the treeview.
showCheckboxbooleanfalseShow checkboxes for node selection.
showEditButtonbooleantrueShow the edit button for each node.
showDeleteButtonbooleantrueShow the delete button for each node.
showDetailButtonbooleanfalseShow the detail button for each node.
showSearchbooleantrueEnable search functionality.
showActionsbooleantrueShow action buttons for nodes.
widthstring'100%'Width of the treeview component.
heightstring'100%'Height of the treeview component.
fontSizestring'13px'Font size of tree nodes.
btnSizeFlexiButtonSizeType'small'Size of action buttons.
checkboxSizestring'1.4em'Size of checkboxes.
actionBtnPosition'left' | 'right''right'Position of action buttons.
themeClass'light' | 'dark''light'Theme of the treeview component.
loadingbooleanfalseShow loading indicator.
expendbooleantrueExpand all nodes initially.
detailRouterLinkstring''Router link for detail view.
language'en' | 'tr''en'Language setting for labels.

Events

EventOutput TypeDescription
onSelectedFlexiTreeNode[]Emits when nodes are selected.
onEditFlexiTreeNodeEmits when a node is edited.
onDeleteFlexiTreeNodeEmits when a node is deleted.
onRefreshvoidEmits when the refresh button is clicked.

License

MIT License.

19.0.21

4 months ago

19.0.20

4 months ago

19.0.22

4 months ago

19.0.18

4 months ago

19.0.19

4 months ago

19.0.17

7 months ago

19.0.15

7 months ago

19.0.14

7 months ago

19.0.13

7 months ago

19.0.3

8 months ago

19.0.5

8 months ago

19.0.4

8 months ago

19.0.7

8 months ago

19.0.6

8 months ago

19.0.9

8 months ago

19.0.8

8 months ago

19.0.10

8 months ago

19.0.12

8 months ago

19.0.11

8 months ago

19.0.2

8 months ago

18.0.14

8 months ago

18.0.15

8 months ago

18.0.13

9 months ago

18.0.12

9 months ago

18.0.11

9 months ago

18.0.10

9 months ago

18.0.9

9 months ago

18.0.8

9 months ago

18.0.7

9 months ago

18.0.6

9 months ago

18.0.5

9 months ago

18.0.4

9 months ago

18.0.3

9 months ago

18.0.2

9 months ago

18.0.1

9 months ago