File

src/ui/tree-view/smart-tree-list/smart-tree-list.component.ts

Implements

OnChanges

Metadata

Index

Properties
Methods
Inputs
Outputs

Inputs

columnHeadersStatic
Type : string[]
columnWidths
Type : any[]
disabled
Type : boolean
hasChildren
Type : any
height
Type : number
items
Type : SmartTreeViewContextMenuItem[]
Default value : []
loadChildren
Type : any
loading
Type : boolean
Default value : false
mainColumnHeader
Type : string
rootNode
Type : SmartNode[]
rootNodeExpandedByDefault
Type : boolean
selectedNode
Type : SmartNode

The externally selected node; keeps the controlled Kendo selection in sync.

Outputs

onContextMenuClick
Type : EventEmitter<SmartTreeViewContextMenuItem>
onNodeSelection
Type : EventEmitter<SmartNode>

Methods

Public handleCellClick
handleCellClick(ev: CellClickEvent)

Handles the cell click event in the Smart Tree List component. Displays the context menu if the click event is a right-click.

Parameters :
Name Type Optional Description
ev CellClickEvent No

The event object containing information about the cell click.

Returns : void

This method does not return a value.

Public handleContextMenuClick
handleContextMenuClick(menuItem: SmartTreeViewContextMenuItem)

Handles the click event of a context menu item. Emits the clicked menu item to the parent component.

Parameters :
Name Type Optional Description
menuItem SmartTreeViewContextMenuItem No

The clicked context menu item.

Returns : void
Public handleSelectionChange
handleSelectionChange(ev: SelectionChangeEvent)

Handles row selection changes emitted by the Kendo TreeList.

Parameters :
Name Type Optional Description
ev SelectionChangeEvent No

The Kendo TreeList selection event.

Returns : void
showContextMenu
showContextMenu(mouseEvent: MouseEvent)

Displays the context menu at the specified mouse position relative to the tree context menu container

Parameters :
Name Type Optional
mouseEvent MouseEvent No
Returns : void

Properties

contextMenu
Type : ContextMenuComponent
Decorators :
@ViewChild(ContextMenuComponent)
treeContextMenuContainer
Type : ViewContainerRef
Decorators :
@ViewChild('contextMenuContainer', {read: ViewContainerRef, static: true})
treeListContainer
Type : ViewContainerRef
Decorators :
@ViewChild('treeListContainer', {read: ViewContainerRef, static: true})
<!--
**************************************************************************
* Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -                  *
* www.consultingwerk.com and other contributors as listed                *
* below. All Rights Reserved.                                            *
*                                                                        *
*  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY        *
*   KIND, either express or implied.                                     *
*                                                                        *
*  Contributors:                                                         *
*                                                                        *
**************************************************************************

--------------------------------------------------------------------------
    File        : smart-tree-list.component.html
    Purpose     : Template for Smart Tree List.
    Author(s)   : Oana Sucigan
    Created     : Dec 18, 2020
--------------------------------------------------------------------------
-->
<div #treeListContainer class="h-100">
	<div #contextMenuContainer></div>
	<div
		[hidden]="!treeDisabled"
		[ngStyle]="{ width: '100%', height: '100%' }"
		class="disabled-overlay"
	></div>
	@if (loading) {
	<div class="smart-tree-list-skeleton">
		<div class="skeleton-header">
			<kendo-skeleton
				shape="rectangle"
				[width]="'100%'"
				[height]="'32px'"
				animation="wave"
			></kendo-skeleton>
		</div>
		<div class="skeleton-body">
			@for (row of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; track row) {
			<div class="skeleton-row">
				<kendo-skeleton
					shape="rectangle"
					[width]="'100%'"
					[height]="'28px'"
					animation="wave"
				></kendo-skeleton>
			</div>
			}
		</div>
	</div>
	} @else {
	<kendo-treelist
		(cellClick)="handleCellClick($event)"
		[fetchChildren]="loadChildren"
		(selectionChange)="handleSelectionChange($event)"
		[idField]="'nodeUuid'"
		[expandedKeys]="
			rootNodeExpandedByDefault && rootNode && [rootNode[0]?.nodeUuid]
		"
		[selectable]="{
			mode: 'row',
			multiple: false,
			drag: false,
			enabled: !treeDisabled,
			readonly: false
		}"
		kendoTreeListSelectable
		[itemKey]="'nodeUuid'"
		[selectedItems]="selectedItems"
		[resizable]="true"
		[hasChildren]="hasChildren"
		[style.height]="'100%'"
		[data]="rootNode"
		[scrollable]="'scrollable'"
		kendoTreeListExpandable
	>
		<kendo-treelist-column
			[title]="mainColumnHeader"
			[width]="200"
			[expandable]="true"
		>
			<ng-template kendoTreeListCellTemplate let-dataItem>
				@if (!!dataItem.source.ImageUrl) {
				<img
					[src]="dataItem.source.ImageUrl"
					class="smart-tree-view-node-image"
				/>
				}
				<span>
					{{ dataItem.source.NodeValues[0] }}
				</span>
			</ng-template>
		</kendo-treelist-column>

		@for (column of columnHeadersStatic; track column; let i = $index) {
		<kendo-treelist-column
			[field]="column"
			[title]="column"
			[width]="columnWidths && columnWidths.length && columnWidths[i]"
		>
			<ng-template kendoTreeListCellTemplate let-dataItem>
				<div
					style="width: 100%"
					[class]="dataItem.source.NodeDataTypes[i + 1]"
				>
					{{ dataItem.source.NodeValues[i + 1] }}
				</div>
			</ng-template>
		</kendo-treelist-column>
		}
	</kendo-treelist>
	}
</div>
<div class="smart-tree-view-context-menu-container">
	<div #treeMenuContainer>
		@if (items?.length > 0) {
		<kendo-contextmenu
			[appendTo]="treeContextMenuContainer"
			class="tree-view-context-menu"
			[items]="items"
			(select)="handleContextMenuClick($event.item)"
		>
		</kendo-contextmenu>
		}
	</div>
</div>

./smart-tree-list.component.css

/**********************************************************************
 * Copyright © 2006-2026 by Consultingwerk Ltd. ("CW") -              *
 * www.consultingwerk.com and other contributors as listed            *
 * below. All Rights Reserved.                                        *
 *                                                                    *
 *  Software is distributed on an "AS IS", WITHOUT WARRANTY OF ANY    *
 *   KIND, either express or implied.                                 *
 *                                                                    *
 *  Contributors:                                                     *
 *                                                                    *
 **********************************************************************/
/*------------------------------------------------------------------------
    File        : smart-tree-list.component.css
    Purpose     : Styles for Smart Tree List.
    Author(s)   : Radu Nicoara
    Created     : Sep 26, 2018
  ----------------------------------------------------------------------*/

:host ::ng-deep .k-treelist .k-treelist-toggle,
:host ::ng-deep .k-treelist td > .k-icon.k-i-loading,
:host ::ng-deep .k-treelist .k-table-td > .k-icon.k-i-loading {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 1rem;
	width: 1rem;
	min-width: 1rem;
	height: 1rem;
	min-height: 1rem;
	line-height: 1rem;
	box-sizing: border-box;
	vertical-align: middle;
}

.smart-tree-list-skeleton {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	gap: var(--kendo-spacing-1, 0.125rem);
	padding: var(--kendo-spacing-2, 0.5rem);
	border: 1px solid var(--kendo-color-border, #dee2e6);
	border-radius: var(--kendo-border-radius-md, 0.25rem);
	background-color: var(--kendo-color-surface, #ffffff);
	box-sizing: border-box;
	overflow: hidden;
}

.smart-tree-list-skeleton .skeleton-header {
	margin-bottom: var(--kendo-spacing-1, 0.25rem);
}

.smart-tree-list-skeleton .skeleton-body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: var(--kendo-spacing-1, 0.25rem);
	overflow: hidden;
}

.smart-tree-list-skeleton .skeleton-row {
	width: 100%;
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""