import { CoreModel } from '../core/core.model'; export class TreeviewModel extends CoreModel { /** * Array of tree items. */ items: any[] = []; /** * Treeview options object. */ options?: { /** * Name of property to be ID for the item. */ idField?: string; /** * Name of property to be NAME for the item. */ displayField?: string; /** * Name of property to be ARRAY with childrens for the item. */ childrenField?: string; /** * Name of property to be boolean EXPANDED for the item. */ isExpandedField?: string; /** * Boolean property which means to be selectable with checkbox for each item. */ selectable?: boolean; /** * Boolean property which means to alow items draging. */ allowDrag?: boolean; /** * Boolean property which means animated items expanding. */ animateExpand?: boolean; }; /** * It is the constructor for the Treeview component. It takes the values to create the Treeview object. */ constructor(values: Object = {}) { super(values); Object.assign(this, values); if(this.options.idField==null) this.options.idField = "id"; if(this.options.displayField==null) this.options.displayField = "name"; if(this.options.childrenField==null) this.options.childrenField = "children"; if(this.options.isExpandedField==null) this.options.isExpandedField = "expanded"; if(this.options.selectable==null) this.options.selectable = false; if(this.options.allowDrag==null) this.options.allowDrag = false; if(this.options.animateExpand==null) this.options.animateExpand = true; } }