Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1x 103x 103x 103x 103x 103x 103x 103x 103x 103x 103x 103x 160391x | /**
* Copyright (c) Siemens 2016 - 2025
* SPDX-License-Identifier: MIT
*/
import { ElementRef, Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import {
CheckboxClickEventArgs,
ClickEventArgs,
FolderStateEventArgs,
TreeItem
} from './si-tree-view.model';
import { ROOT_LEVEL } from './si-tree-view.utils';
/**
* Supports communication between the TreeViewComponent and the TreeViewItemComponent and the services.
* Stores tree specific settings.
* One instance per TreeViewComponent exists.
*/
@Injectable()
export class SiTreeViewService {
/** Emits when a tree item is clicked. */
clickEvent: Subject<ClickEventArgs> = new Subject<ClickEventArgs>();
/** Emits when a folder item is clicked. */
folderClickEvent: Subject<FolderStateEventArgs> = new Subject<FolderStateEventArgs>();
/** Emits when checkbox is clicked. */
checkboxClickEvent: Subject<CheckboxClickEventArgs> = new Subject<CheckboxClickEventArgs>();
/** Emits when on tree item expansion to load child items. */
loadChildrenEvent: Subject<TreeItem> = new Subject<TreeItem>();
/** Emits when the consumer want a node to be scrolled into view. */
scrollIntoViewEvent: Subject<ElementRef> = new Subject<ElementRef>();
/** Emits when the parent shall become focused. */
focusParentEvent: Subject<TreeItem> = new Subject<TreeItem>();
/** Emits when the child shall become focused. */
focusFirstChildEvent: Subject<TreeItem> = new Subject<TreeItem>();
/**
* Shows or hides context menu button.
*
* @defaultValue true
*/
enableContextMenuButton = true;
/**
* Child padding in pixel (px).
*
* @defaultValue 14
*/
childrenIndentation = 14;
/**
* Visualize tree as grouped list, the child padding will have no effect.
*
* @defaultValue false
*/
groupedList = false;
/** @internal */
triggerMarkForCheck: Subject<void> = new Subject<void>();
/** @internal */
scroll$!: Observable<Event>;
/** Indicate whether item is a group item. */
isGroupedItem(item: TreeItem): boolean {
return (!item.parent || item.parent.level === ROOT_LEVEL) && this.groupedList;
}
}
|