/* Copyright © 2016-2019 Lidor Systems. All rights reserved. This file is part of the "IntegralUI Web" Library. The contents of this file are subject to the IntegralUI Web License, and may not be used except in compliance with the License. A copy of the License should have been installed in the product's root installation directory or it can be found at http://www.lidorsystems.com/products/web/studio/license-agreement.aspx. This SOFTWARE is provided "AS IS", WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Any infringement will be prosecuted under applicable laws. */ import { Component, ViewContainerRef, ViewChild, ViewChildren, ViewEncapsulation } from '@angular/core'; import { IntegralUITreeView } from '../../integralui/components/integralui.treeview'; @Component({ selector: '', template: `

TreeView / ExpandBox on Right

{{item.text}}

A TreeView where expand box appears on item right side. It looks similar to the navigation panel in Angular documents page.

This sample is created by following settings:

In addition, you can reorder items by click and drag over specific item. A dragging window will appear, stating the target item and position at which item can be dropped. During drag drop operations, you can also create a copy of an item by holding the SHIFT key. The dragging window will change its icon, showing a + sign next to the position marker.

For more information check out the source code of this sample (treeview/treeview-expandbox-right.ts) file.

`, encapsulation: ViewEncapsulation.None }) export class TreeViewExpandBoxRightSample { @ViewChild('application', {read: ViewContainerRef, static: false}) applicationRef: ViewContainerRef; @ViewChild('treeview', { static: false }) treeview: IntegralUITreeView; public items: Array; private isEditActive: boolean = false; public editItem: any = null; private originalText: string = ''; public editorFocused: boolean = false; public hoverItem: any = null; public ctrlStyle: any = { general: { normal: 'trw-expbox-right' } } constructor(){ this.items = [ { id: 1, text: "Favorites", icon: "computer-icons favorites", items: [ { id: 11, pid: 1, text: "Desktop", icon: "computer-icons empty-doc" }, { id: 12, pid: 1, text: "Downloads", icon: "computer-icons downloads" } ] }, { id: 2, text: "Libraries", icon: "computer-icons folder", items: [ { id: 21, pid: 2, text: "Documents", icon: "computer-icons documents", expanded: false, items: [ { id: 211, pid: 21, text: "My Documents", icon: "computer-icons empty-doc" }, { id: 212, pid: 21, text: "Public Documents", icon: "computer-icons empty-doc" } ] }, { id: 22, pid: 2, text: "Music", icon: "computer-icons music" }, { id: 23, pid: 2, text: "Pictures", icon: "computer-icons pictures" }, { id: 24, pid: 2, text: "Videos", icon: "computer-icons videos" } ] }, { id: 3, text: "Computer", icon: "computer-icons pc", expanded: false, items: [ { id: 31, pid: 3, text: "Local Disk (C:)", icon: "computer-icons disk" }, { id: 32, pid: 3, text: "Storage (D:)", icon: "computer-icons disk" } ] }, { id: 4, text: "Network", icon: "computer-icons network" }, { id: 5, text: "Recycle Bin", icon: "computer-icons recycle" } ]; } ngAfterViewInit(){ this.treeview.selectedItem = this.items[0]; } isExpandBoxAllowed(item: any){ return item && item.items && item.items.length > 0 ? true : false; } toggle(item: any){ this.treeview.toggle(item); } }