import { ElementRef, OnInit, OnChanges, DoCheck, EventEmitter, IterableDiffers } from '@angular/core'; import { CfCoreComponent } from '../core/core.component'; import { TreeviewModel } from '../../models/treeview/treeview.model'; import { TreeviewStylingModel } from '../../models/treeview/treeview-styling.model'; /** *

Treeview component based on Angular 2 Tree. Treeview items has options to be selectable, expandable, dragable and has templating possibility for aech item.

*

Example of using Menu:

*
 * <cf-treeview [properties]="myTreeview" [styling]="myTreeviewStyles"></cf-treeview>
 * 
*/ export declare class CfTreeviewComponent extends CfCoreComponent implements OnInit, OnChanges, DoCheck { elementRef: ElementRef; /** * It is an object with two properties: items (an array with items and each item is an object with type "any"), options (object with specific properties). */ cfTreeview: TreeviewModel; /** * An array for selected items IDs. Each item ID must be string. */ selectedItems: any[]; /** * Identifier for template for each item. */ itemTemplate: any; /** * It is an attribute [properties] of directive cf-treeview which take TreeviewModel object. *

Example of Treeview json object:

*
{
     *  items: [
     *    { _id: '1', _name: 'root1', _expanded: true, _children: [
     *      { _id: '2', _expanded: false, _name: 'child1' },
     *      { _id: '3', _expanded: false,_name: 'child2' }]
     *    }
     *  ],
     *  options: {
     *    idField: '_id',
     *    nameField: '_name',
     *    childrenField: '_children',
     *    isExpandedField: '_expanded',
     *    selectable: true,
     *    allowDrag: true
     *  }
     * }
*

items: array

* Ii is an array of tree items. Each item must have two required properties: id with unique id and name. *

options: object

* It is an object with specific properties. All properties are not required. *

allowDrag: boolean

* Means items to be dragable. Default is false. *

selectable: boolean

* Means items to be selectable by checking checkboxes. Default is false. *

idField: string

* Means name of property to be mapped as id. If not set - component will be looking property id inside item. *

displayField: string

* Means name of property to be mapped as name. If not set - component will be looking property name inside item. *

childrenField: string

* Means name of property to be mapped as children. If not set - component will be looking property children inside item. *

isExpandedField: string

* Means name of property to be mapped as expanded. If not set - component will add property expanded inside item. */ properties: TreeviewModel; /** * It is an object with styling for two component elements: container (type TreeviewStylingModel) and item (type StylingModel). */ styling: TreeviewStylingModel; /** * It is (cfSelected) attribute of cf-treeview component. Is emmiting event with array of selected items by user. */ cfSelected: EventEmitter; /** * Identifier to register TreeComponent component. */ private tree; /** * Object to register element state and compute differences. */ differ: any; constructor(elementRef: ElementRef, differs: IterableDiffers); ngOnInit(): void; ngOnChanges(changes: any): void; ngDoCheck(): void; /** * Function called when TreeComponent emmit his events after user iteraction with it. */ onEvent($event: any): void; /** * It is function for selecting tree items * @param node it is json item object * @param $event it is angular original event for angular material md-checkbox */ check(node: any, $event: any): void; /** * Function to find all checked tree items. * @param items array of tree items */ findCheckedItems(items: any): void; /** * Function to update array with selected items IDs. */ updateSelectedItems(): void; /** * Function to select/unselect item by it checked property and same for it childrens. * @param node tree item object * @param checked item checked state */ updateChildNodesCheckBox(node: any, checked: any): void; /** * Function to update item parents checked states * @param node tree item object */ updateParentNodesCheckBox(node: any): void; }