@eui/components 18.0.0-next.63 → 18.0.0-next.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/components/CollapsedBreadcrumbComponent.html +1 -1
- package/docs/components/EuiAppSidebarHeaderUserProfileComponent.html +1 -1
- package/docs/components/EuiAppTopMessageComponent.html +1 -1
- package/docs/components/EuiBreadcrumbItemComponent.html +1 -1
- package/docs/components/EuiCardFooterMenuContentComponent.html +1 -1
- package/docs/components/EuiCardHeaderComponent.html +1 -1
- package/docs/components/EuiChipListComponent.html +1 -1
- package/docs/components/EuiDialogContainerComponent.html +1 -1
- package/docs/components/EuiDiscussionThreadItemComponent.html +1 -1
- package/docs/components/EuiDropdownItemComponent.html +1 -1
- package/docs/components/EuiEditorComponent.html +1 -1
- package/docs/components/EuiFilePreviewComponent.html +1 -1
- package/docs/components/EuiGrowlComponent.html +1 -1
- package/docs/components/EuiIconButtonExpanderComponent.html +1 -1
- package/docs/components/EuiListItemComponent.html +1 -1
- package/docs/components/EuiMenuComponent.html +1 -1
- package/docs/components/EuiMenuItemComponent.html +1 -1
- package/docs/components/EuiNotificationItemComponent.html +1 -1
- package/docs/components/EuiNotificationItemV2Component.html +1 -1
- package/docs/components/EuiNotificationsComponent.html +1 -1
- package/docs/components/EuiNotificationsV2Component.html +1 -1
- package/docs/components/EuiOverlayHeaderTitleComponent.html +1 -1
- package/docs/components/EuiPageColumnComponent.html +1 -1
- package/docs/components/EuiPageHeaderComponent.html +1 -1
- package/docs/components/EuiPaginatorComponent.html +1 -1
- package/docs/components/EuiPopoverComponent.html +1 -1
- package/docs/components/EuiSearchComponent.html +1 -1
- package/docs/components/EuiTableFilterComponent.html +1 -1
- package/docs/components/EuiTableSortableColComponent.html +1 -1
- package/docs/components/EuiTableV2FilterComponent.html +1 -1
- package/docs/components/EuiTableV2SortableColComponent.html +1 -1
- package/docs/components/EuiTabsComponent.html +1 -1
- package/docs/components/EuiTimebarComponent.html +1 -1
- package/docs/components/EuiTimepickerComponent.html +1 -1
- package/docs/components/EuiToolbarMenuComponent.html +1 -1
- package/docs/components/EuiToolbarNavbarComponent.html +1 -1
- package/docs/components/EuiTreeComponent.html +3 -3
- package/docs/components/EuiTreeListToolbarComponent.html +1 -1
- package/docs/components/EuiUserProfileCardComponent.html +1 -1
- package/docs/components/EuiUserProfileComponent.html +1 -1
- package/docs/components/EuiWizardComponent.html +1 -1
- package/docs/dependencies.html +1 -1
- package/docs/js/menu-wc.js +3 -3
- package/docs/js/menu-wc_es5.js +1 -1
- package/docs/js/search/search_index.js +2 -2
- package/esm2022/eui-card/components/eui-card-footer/eui-card-footer-menu-content.component.mjs +3 -3
- package/esm2022/eui-card/components/eui-card-header/eui-card-header.component.mjs +3 -3
- package/esm2022/eui-card/eui-card.component.mjs +2 -2
- package/esm2022/eui-chip-list/eui-chip-list.component.mjs +3 -3
- package/esm2022/eui-dialog/container/eui-dialog-container.component.mjs +3 -3
- package/esm2022/eui-dialog/eui-dialog.component.mjs +2 -2
- package/esm2022/eui-discussion-thread/eui-discussion-thread-item.component.mjs +3 -3
- package/esm2022/eui-dropdown/dropdown-item/eui-dropdown-item.component.mjs +3 -3
- package/esm2022/eui-file-upload/file-preview/file-preview.component.mjs +3 -3
- package/esm2022/eui-growl/eui-growl.component.mjs +3 -3
- package/esm2022/eui-icon/eui-icon-button-expander/eui-icon-button-expander.component.mjs +3 -3
- package/esm2022/eui-icon/eui-icon-svg.component.mjs +2 -2
- package/esm2022/eui-list/eui-list-item/eui-list-item.component.mjs +3 -3
- package/esm2022/eui-list/eui-list.component.mjs +2 -2
- package/esm2022/eui-menu/eui-menu-item.component.mjs +3 -3
- package/esm2022/eui-menu/eui-menu.component.mjs +3 -3
- package/esm2022/eui-overlay/components/eui-overlay-header/eui-overlay-header-title/eui-overlay-header-title.component.mjs +3 -3
- package/esm2022/eui-page/components/eui-page-column/eui-page-column.component.mjs +3 -3
- package/esm2022/eui-page/components/eui-page-header/eui-page-header.component.mjs +3 -3
- package/esm2022/eui-paginator/eui-paginator.component.mjs +3 -3
- package/esm2022/eui-popover/eui-popover.component.mjs +3 -3
- package/esm2022/eui-table/filter/eui-table-filter.component.mjs +3 -3
- package/esm2022/eui-table/sortable-col/eui-table-sortable-col.component.mjs +3 -3
- package/esm2022/eui-table-v2/filter/eui-table-v2-filter.component.mjs +3 -3
- package/esm2022/eui-table-v2/sortable-col/eui-table-v2-sortable-col.component.mjs +3 -3
- package/esm2022/eui-tabs/eui-tabs.component.mjs +3 -3
- package/esm2022/eui-timebar/eui-timebar.component.mjs +3 -3
- package/esm2022/eui-timepicker/eui-timepicker.component.mjs +3 -3
- package/esm2022/eui-tree/eui-tree.component.mjs +5 -5
- package/esm2022/eui-tree-list/toolbar/toolbar.component.mjs +3 -3
- package/esm2022/eui-user-profile/user-profile-card/user-profile-card.component.mjs +3 -3
- package/esm2022/eui-user-profile/user-profile.component.mjs +3 -3
- package/esm2022/eui-wizard/eui-wizard.component.mjs +3 -3
- package/esm2022/externals/eui-editor/eui-editor.component.mjs +3 -3
- package/esm2022/layout/eui-app/eui-app-sidebar/sidebar-header-user-profile/sidebar-header-user-profile.component.mjs +3 -3
- package/esm2022/layout/eui-app/eui-app-top-message/top-message.component.mjs +3 -3
- package/esm2022/layout/eui-breadcrumb/collapsed-breadcrumb/collapsed-breadcrumb.component.mjs +3 -3
- package/esm2022/layout/eui-breadcrumb/item/breadcrumb-item.component.mjs +3 -3
- package/esm2022/layout/eui-notifications/eui-notification-item.component.mjs +3 -3
- package/esm2022/layout/eui-notifications/eui-notifications.component.mjs +3 -3
- package/esm2022/layout/eui-notifications-v2/eui-notification-item.component.mjs +3 -3
- package/esm2022/layout/eui-notifications-v2/eui-notifications.component.mjs +3 -3
- package/esm2022/layout/eui-search/search.component.mjs +3 -3
- package/esm2022/layout/eui-toolbar/toolbar-menu/toolbar-menu.component.mjs +3 -3
- package/esm2022/layout/eui-toolbar/toolbar-navbar/toolbar-navbar.component.mjs +3 -3
- package/eui-list/eui-list-item/eui-list-item.component.d.ts +1 -1
- package/eui-tree/eui-tree.component.d.ts.map +1 -1
- package/fesm2022/eui-components-eui-card.mjs +6 -6
- package/fesm2022/eui-components-eui-card.mjs.map +2 -2
- package/fesm2022/eui-components-eui-chip-list.mjs +4 -4
- package/fesm2022/eui-components-eui-chip-list.mjs.map +1 -1
- package/fesm2022/eui-components-eui-dialog.mjs +18 -18
- package/fesm2022/eui-components-eui-dialog.mjs.map +2 -2
- package/fesm2022/eui-components-eui-discussion-thread.mjs +8 -8
- package/fesm2022/eui-components-eui-discussion-thread.mjs.map +1 -1
- package/fesm2022/eui-components-eui-dropdown.mjs +2 -2
- package/fesm2022/eui-components-eui-dropdown.mjs.map +2 -2
- package/fesm2022/eui-components-eui-file-upload.mjs +2 -2
- package/fesm2022/eui-components-eui-file-upload.mjs.map +2 -2
- package/fesm2022/eui-components-eui-growl.mjs +2 -2
- package/fesm2022/eui-components-eui-growl.mjs.map +1 -1
- package/fesm2022/eui-components-eui-icon.mjs +10 -10
- package/fesm2022/eui-components-eui-icon.mjs.map +2 -2
- package/fesm2022/eui-components-eui-list.mjs +4 -4
- package/fesm2022/eui-components-eui-list.mjs.map +2 -2
- package/fesm2022/eui-components-eui-menu.mjs +18 -18
- package/fesm2022/eui-components-eui-menu.mjs.map +2 -2
- package/fesm2022/eui-components-eui-overlay.mjs +2 -2
- package/fesm2022/eui-components-eui-overlay.mjs.map +2 -2
- package/fesm2022/eui-components-eui-page.mjs +4 -4
- package/fesm2022/eui-components-eui-page.mjs.map +2 -2
- package/fesm2022/eui-components-eui-paginator.mjs +8 -8
- package/fesm2022/eui-components-eui-paginator.mjs.map +1 -1
- package/fesm2022/eui-components-eui-popover.mjs +2 -2
- package/fesm2022/eui-components-eui-popover.mjs.map +2 -2
- package/fesm2022/eui-components-eui-table-v2.mjs +8 -8
- package/fesm2022/eui-components-eui-table-v2.mjs.map +1 -1
- package/fesm2022/eui-components-eui-table.mjs +14 -14
- package/fesm2022/eui-components-eui-table.mjs.map +1 -1
- package/fesm2022/eui-components-eui-tabs.mjs +2 -2
- package/fesm2022/eui-components-eui-tabs.mjs.map +2 -2
- package/fesm2022/eui-components-eui-timebar.mjs +6 -6
- package/fesm2022/eui-components-eui-timebar.mjs.map +1 -1
- package/fesm2022/eui-components-eui-timepicker.mjs +12 -12
- package/fesm2022/eui-components-eui-timepicker.mjs.map +1 -1
- package/fesm2022/eui-components-eui-tree-list.mjs +6 -6
- package/fesm2022/eui-components-eui-tree-list.mjs.map +1 -1
- package/fesm2022/eui-components-eui-tree.mjs +6 -6
- package/fesm2022/eui-components-eui-tree.mjs.map +1 -1
- package/fesm2022/eui-components-eui-user-profile.mjs +4 -4
- package/fesm2022/eui-components-eui-user-profile.mjs.map +2 -2
- package/fesm2022/eui-components-eui-wizard.mjs +2 -2
- package/fesm2022/eui-components-eui-wizard.mjs.map +2 -2
- package/fesm2022/eui-components-externals-eui-editor.mjs +8 -8
- package/fesm2022/eui-components-externals-eui-editor.mjs.map +1 -1
- package/fesm2022/eui-components-layout.mjs +36 -36
- package/fesm2022/eui-components-layout.mjs.map +2 -2
- package/package.json +21 -21
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../eui-tree/eui-tree.model.ts", "../../eui-tree/eui-tree.component.ts", "../../eui-tree/eui-tree.component.html", "../../eui-tree/eui-dropdown-tree.directive.ts", "../../eui-tree/eui-tree-helper.ts", "../../eui-tree/eui-tree-form-control.directive.ts"],
|
4
|
-
"sourcesContent": ["import { UxLinkLegacy } from '@eui/base';\n\nexport type TreeDataModel = Array<TreeItemModel>;\n\nexport type TreeItemModel = {\n node: TreeNode;\n children?: TreeDataModel;\n};\n\nexport type TreeNode = {\n // metadata can be block content, or any\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n treeContentBlock: EuiTreeContentBlockModel | any;\n} & SelectionModel &\n ExpandModel;\n\nexport interface EuiTreeContentBlockModel {\n id?: string | number;\n label: string;\n tooltipLabel: string;\n url: string;\n urlExternal: string;\n urlExternalTarget: string;\n typeLabel: string;\n typeClass: string;\n chips?: Array<{ label: string; typeClass?: string; isOutline?: boolean }>;\n iconClass: string;\n iconTypeClass: string;\n iconSvgName?: string;\n rightContent?: {\n iconClass: string;\n iconTypeClass: string;\n iconSvgName?: string;\n badges?: Array<{ label: string; typeClass: string }>;\n chips?: Array<{ label: string; typeClass?: string; isOutline?: boolean }>;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n contextMenuMetaData?: any;\n };\n metaData: string;\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\nexport type SelectionModel = {\n selectable?: boolean;\n isSelected?: boolean;\n // if one of sub is selected, it becomes intermediate\n isIndeterminate?: boolean;\n selectConfig?: SelectConfigModel;\n};\n\nexport interface SelectConfigModel extends MultiSelectionLogic, SingleSelectionLogic {\n /*\n If It is true;\n When user select parent, all the children will be selected\n When selection state is changed, If all children is selected parent will be selected as long as noAutoSelectParent is not true\n */\n recursive?: boolean;\n /* when It is true, If all children is selected, parent will not be selected, while recursive is true*/\n noAutoSelectParent?: boolean;\n singleSelect?: boolean;\n}\n\nexport interface MultiSelectionLogic {\n /*\n If It is true;\n When user select parent, all the children will be selected\n When selection state is changed, If all children is selected parent will be selected as long as noAutoSelectParent is not true\n */\n recursive?: boolean;\n /* when It is true, If all children is selected, parent will not be selected, while recursive is true*/\n noAutoSelectParent?: boolean;\n}\n\nexport interface SingleSelectionLogic {\n singleSelect?: boolean;\n}\n\nexport type ExpandModel = {\n isExpanded?: boolean;\n};\n\nexport type EuiTreeSelectionChanges = { added: TreeDataModel; removed: TreeDataModel; selection: TreeDataModel };\n\nexport type TreeDataRunTimeModel = Array<TreeItemRunTimeModel>;\n\nexport type TreeItemRunTimeModel = { index: number; path: string; children?: Array<TreeItemRunTimeModel>; last?: boolean, matched?: boolean };\n\nexport type TreeItemSelectionRecursiveModel = {\n selectionRecursiveState: SelectionRecursiveState;\n children?: Array<TreeItemSelectionRecursiveModel>;\n};\n\nexport type SelectionRecursiveState = 'indeterminate' | 'allSelected' | 'allNotSelected';\n\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\nexport function uxTreeNodesMetaDataMapper(oldTree: Array<UxLinkLegacy>): TreeDataModel {\n return oldTree.map((item) => {\n if (item?.typeClass === 'default') {\n // default typeClass will be\n item.typeClass = 'secondary';\n }\n if (item?.badgeLabel) {\n // default typeClass will be\n if (item?.badges?.length > 0) {\n item.badges.push({ label: item?.badgeLabel, typeClass: 'secondary' });\n } else {\n item.badges = [{ label: item?.badgeLabel, typeClass: 'secondary' }];\n }\n }\n return {\n node: {\n treeContentBlock: {\n label: item.label,\n typeLabel: item.typeLabel,\n typeClass: item.typeLabel && !item.typeClass ? 'secondary' : item.typeClass,\n tooltipLabel: item.tooltipLabel,\n url: item.url,\n urlExternal: item.urlExternal,\n urlExternalTarget: item.urlExternal && item.urlExternalTarget ? item.urlExternalTarget : undefined,\n badges: item.badges,\n metadata: item.metadata,\n },\n },\n children: item.children ? uxTreeNodesMetaDataMapper(item.children) : undefined,\n };\n });\n}\n\nexport class EuiTreePagination<T> {\n private data: T[];\n private startPage: number;\n private totalItems: number;\n private renderedPageCount: number;\n private perPage: number;\n private totalPages: number;\n\n constructor(data: T[], startPage: number, renderedPageCount: number, perPage: number) {\n this.data = data;\n this.setCurrentStartPage(startPage);\n this.renderedPageCount = renderedPageCount;\n this.totalItems = this.data.length;\n this.perPage = perPage;\n this.totalPages = Math.ceil(this.totalItems / this.perPage);\n }\n\n public paginateNext(): { startPage: number; data: T[] } {\n if (this.startPage < this.totalPages) {\n this.startPage += 1;\n }\n return this.getViewData();\n }\n\n public paginatePrev(): { startPage: number; data: T[] } {\n if (this.startPage > 1) {\n this.startPage -= 1;\n }\n return this.getViewData();\n }\n\n public getCurrentStartPage(): number {\n return this.startPage;\n }\n\n public setCurrentStartPage(startPage: number): void {\n this.startPage = startPage;\n }\n\n public isAtMax(): boolean {\n return this.totalPages < this.startPage + this.renderedPageCount;\n }\n\n public getViewData(): { startPage: number; data: T[] } {\n const startIndex = (this.startPage - 1) * this.perPage;\n const endIndex = startIndex + this.perPage * this.renderedPageCount;\n const pageData = structuredClone(this.data).slice(startIndex, endIndex);\n return {\n startPage: this.startPage,\n data: pageData,\n };\n }\n}\n", "import {\n Component,\n Input,\n NgModule,\n ChangeDetectionStrategy,\n EventEmitter,\n Output,\n ViewEncapsulation,\n TemplateRef,\n ChangeDetectorRef,\n SimpleChanges,\n OnInit,\n OnChanges,\n HostBinding,\n OnDestroy,\n ViewChild,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { RouterModule } from '@angular/router';\nimport {\n SelectionRecursiveState,\n TreeDataModel,\n TreeItemModel,\n TreeDataRunTimeModel,\n TreeItemRunTimeModel,\n TreeItemSelectionRecursiveModel,\n EuiTreeSelectionChanges,\n EuiTreePagination,\n} from './eui-tree.model';\nimport { FormsModule } from '@angular/forms';\nimport { EuiInputCheckboxModule } from '@eui/components/eui-input-checkbox';\nimport { EuiButtonModule } from '@eui/components/eui-button';\nimport { EuiIconModule } from '@eui/components/eui-icon';\nimport { EuiLabelModule } from '@eui/components/eui-label';\nimport { EuiBadgeModule } from '@eui/components/eui-badge';\nimport { EuiChipModule } from '@eui/components/eui-chip';\nimport { EuiDropdownModule } from '@eui/components/eui-dropdown';\nimport { NestedTreeControl, CdkTreeModule, CdkTree } from '@angular/cdk/tree';\nimport { ArrayDataSource, SelectionModel } from '@angular/cdk/collections';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ScrollingModule, ScrollDispatcher, CdkScrollable } from '@angular/cdk/scrolling';\nimport { debounceTime } from 'rxjs';\n\n@Component({\n selector: 'eui-tree',\n templateUrl: './eui-tree.component.html',\n styleUrls: ['./styles/_index.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class EuiTreeComponent implements OnInit, OnChanges, OnDestroy {\n @HostBinding('class')\n public get cssClasses(): string {\n return this.getCssClasses();\n }\n @HostBinding('attr.data-e2e') @Input() e2eAttr = 'eui-tree';\n @Input() nodes: TreeDataModel;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() nodeTemplateRef: TemplateRef<any>;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() nodeContentMetadataTemplateRef: TemplateRef<any>;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() rightContextMenuTemplateRef: TemplateRef<any>;\n @Input() expandedIconClass: string;\n @Input() collapsedIconClass: string;\n @Input() expandedSvgIconClass = 'eui-chevron-forward:eui';\n @Input() collapsedSvgIconClass = 'eui-chevron-down:eui';\n\n @ViewChild('cdkScrollableRef', { read: CdkScrollable }) cdkScrollableRef: CdkScrollable;\n @ViewChild('treeComponentInstance') public treeComponentInstance: CdkTree<TreeItemRunTimeModel>;\n\n // @ViewChild('treeComponentInstance') public treeComponentInstance: any;\n\n @Input()\n get isClickTogglingNode(): boolean {\n return this._isClickTogglingNode;\n }\n\n set isClickTogglingNode(value: BooleanInput) {\n this._isClickTogglingNode = coerceBooleanProperty(value);\n }\n\n @Input()\n get isMultiselect(): boolean {\n return this._isMultiselect;\n }\n\n set isMultiselect(value: BooleanInput) {\n this._isMultiselect = coerceBooleanProperty(value);\n }\n\n @Input()\n get isSingleSelect(): boolean {\n return this._isSingleSelect;\n }\n\n set isSingleSelect(value: BooleanInput) {\n this._isSingleSelect = coerceBooleanProperty(value);\n }\n\n @Input()\n get isRecursiveSelection(): boolean {\n return this._isRecursiveSelection;\n }\n\n set isRecursiveSelection(value: BooleanInput) {\n this._isRecursiveSelection = coerceBooleanProperty(value);\n }\n\n @Input()\n get isRecursiveParentSelection(): boolean {\n return this._isRecursiveParentSelection;\n }\n\n set isRecursiveParentSelection(value: BooleanInput) {\n this._isRecursiveParentSelection = coerceBooleanProperty(value);\n }\n\n @Input()\n get showUnderlinedLinks(): boolean {\n return this._showUnderlinedLinks;\n }\n\n set showUnderlinedLinks(value: BooleanInput) {\n this._showUnderlinedLinks = coerceBooleanProperty(value);\n }\n\n @Input()\n get showLines(): boolean {\n return this._showLines;\n }\n\n set showLines(value: BooleanInput) {\n this._showLines = coerceBooleanProperty(value);\n }\n\n @Input()\n get autoTranslate(): boolean {\n return this._autoTranslate;\n }\n\n set autoTranslate(value: BooleanInput) {\n this._autoTranslate = coerceBooleanProperty(value);\n }\n\n @Input()\n get highlightPath(): boolean {\n return this._highlightPath;\n }\n\n set highlightPath(value: BooleanInput) {\n this._highlightPath = coerceBooleanProperty(value);\n }\n\n @Output() selectionChange = new EventEmitter<EuiTreeSelectionChanges>();\n @Output() nodeClick = new EventEmitter<TreeItemModel>();\n @Output() nodeToggle = new EventEmitter<TreeItemModel>();\n cdkArrayDataSource: ArrayDataSource<TreeItemRunTimeModel>;\n cdkTreeControl: NestedTreeControl<TreeItemRunTimeModel>;\n renderTree: boolean;\n public uid: string = Math.floor(Math.random() * 1000000000).toString();\n protected _isMultiLevel;\n private processedNodes: TreeDataModel;\n private treeDataRunTime: TreeDataRunTimeModel;\n private treeDataRunTimeBackup: TreeDataRunTimeModel;\n private runTimeSelectionRecursiveState: Array<TreeItemSelectionRecursiveModel>;\n private selectionModel: SelectionModel<TreeItemRunTimeModel>;\n private _isClickTogglingNode = false;\n private _isMultiselect = false;\n private _isSingleSelect = false;\n private _isRecursiveSelection = false;\n private _isRecursiveParentSelection = true;\n private _showUnderlinedLinks = false;\n private _showLines = true;\n private _autoTranslate = true;\n private _highlightPath = false;\n private selectionModelSubs;\n private scrollDispatcherSubs;\n private _selection;\n private treePagination: EuiTreePagination<TreeItemRunTimeModel>;\n\n constructor(private changeDetectorRef: ChangeDetectorRef, private scrollDispatcher: ScrollDispatcher) {}\n\n ngOnInit(): void {\n this.initTree();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['nodes']?.currentValue !== changes['nodes']?.previousValue) {\n this.renderTree = false;\n this.initTree();\n if(this.treeComponentInstance) {\n this.treeComponentInstance?.renderNodeChanges([]);\n this.treeComponentInstance?.renderNodeChanges(this.treeDataRunTime);\n }\n }\n }\n\n ngOnDestroy(): void {\n if (this.selectionModelSubs) {\n this.selectionModelSubs.unsubscribe();\n }\n if (this.scrollDispatcherSubs) {\n this.scrollDispatcherSubs.unsubscribe();\n }\n }\n\n getSelection(): TreeDataModel {\n return this._selection;\n }\n\n getProcessedNodes(): TreeDataModel {\n return this.processedNodes;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n trackBy(index: number, item: TreeItemRunTimeModel): any {\n return item.path;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n trackByControl(item: TreeItemRunTimeModel): any {\n return item;\n }\n\n getTreeItem(path: string): TreeItemModel {\n const indexArr: Array<number> = this.resolvePath(path);\n let nodeArr = this.processedNodes;\n let node;\n if (nodeArr && Array.isArray(nodeArr)) {\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n nodeArr = nodeArr && nodeArr[pathIndex]?.children;\n } else {\n node = nodeArr[pathIndex];\n }\n });\n }\n return node;\n }\n\n expandAll(): void {\n this.cdkTreeControl.expandAll();\n this.changeDetectorRef.markForCheck();\n }\n\n expandAt(path: string): void {\n this.getParentPaths(path).reverse().forEach((parentPath)=>{\n this.cdkTreeControl.expand(this.getRunTimeTreeItem(parentPath));\n });\n this.cdkTreeControl.expand(this.getRunTimeTreeItem(path));\n this.changeDetectorRef.detectChanges();\n }\n\n collapseAll(): void {\n this.cdkTreeControl.collapseAll();\n this.changeDetectorRef.markForCheck();\n }\n\n filterTerm(filterInput: string, filterKey?: string, showChildrenOfMatchedItems?: boolean): void {\n if (filterInput !== '' && filterInput !== null && typeof filterInput !== 'undefined') {\n this.treeDataRunTime = this.filterTreeData(structuredClone(this.treeDataRunTimeBackup), filterKey || 'label', filterInput, showChildrenOfMatchedItems);\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, { trackBy: this.trackByControl });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandMatched(this.treeDataRunTime);\n // this.expandAll();\n } else {\n this.treeDataRunTime = structuredClone(this.treeDataRunTimeBackup);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, { trackBy: this.trackByControl });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandAll();\n }\n }\n\n setAllSelection(isChecked: boolean): void {\n this.setIsCheckedForAll(this.treeDataRunTime, isChecked);\n this.changeDetectorRef.markForCheck();\n }\n\n updateTreeItem(givenTreeItem: TreeItemModel, path: string): void {\n const treeItem = structuredClone(givenTreeItem);\n if (treeItem && path) {\n this.setTreeData(path, this.processInputs([treeItem])[0]);\n const pathArr = path.split('.');\n const index = parseInt(pathArr.pop(), 10);\n const treeItemRuntime = this.calculateRunTimeState(treeItem, index, pathArr.join('.'));\n if (treeItemRuntime?.children?.length > 0) {\n treeItemRuntime.children = this.applyRunTimeLastItems(treeItemRuntime.children);\n }\n this.setTreeDataRunTimeBackup(path, treeItemRuntime);\n this.setTreeDataRunTime(path, treeItemRuntime);\n // itemRecursiveSelectionState\n const itemRecursiveSelectionState = this.calculateItemSelectionRecursiveState(treeItem);\n this.setRunTimeSelectionRecursiveStateTree(path, itemRecursiveSelectionState);\n this.syncStateChangesAtPath(path);\n // Rendering\n this.changeDetectorRef.detectChanges();\n this.treeComponentInstance.renderNodeChanges([]);\n this.treeComponentInstance.renderNodeChanges(this.treeDataRunTime);\n if (this.cdkTreeControl.isExpanded(treeItemRuntime) && !treeItem.node.isExpanded) {\n this.cdkTreeControl.toggle(treeItemRuntime);\n } else if (!this.cdkTreeControl.isExpanded(treeItemRuntime) && treeItem.node.isExpanded) {\n this.cdkTreeControl.expand(treeItemRuntime);\n }\n this.renderInitialExpand(this.getRunTimeTreeItem(path)?.children);\n this.getInitialSelection(this.getRunTimeTreeItem(path)?.children)?.forEach((runTimeItem) => {\n this.selectTreeItem(this.getRunTimeBackupTreeItem(runTimeItem.path));\n });\n this.changeDetectorRef.detectChanges();\n }\n }\n\n onNodeClick(treeRunTimeItem: TreeItemRunTimeModel): void {\n this.nodeClick.emit(this.getTreeItem(treeRunTimeItem?.path));\n if (this.isClickTogglingNode) {\n this.cdkTreeControl.toggle(treeRunTimeItem);\n this.onNodeToggle(treeRunTimeItem);\n }\n }\n\n onNodeToggle(treeRunTimeItem: TreeItemRunTimeModel): void {\n this.getTreeItem(treeRunTimeItem?.path).node.isExpanded = this.cdkTreeControl.isExpanded(treeRunTimeItem);\n this.nodeToggle.emit(this.getTreeItem(treeRunTimeItem?.path));\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nodeSelected(evt: any, path: string): void {\n const item = this.getTreeItem(path);\n const runTimeBackupTreeItem = this.getRunTimeBackupTreeItem(path);\n const renderedRunTimeTreeItem = this.getRunTimeTreeItem(path);\n const node = item.node;\n // console.log(path,item,runTimeTreeItem, renderedRunTimeTreeItem);\n if (!node?.selectConfig?.singleSelect) {\n node.isSelected = evt.target.checked;\n node.isIndeterminate = false;\n // If the node is recursive it sets every children with the change.\n if (renderedRunTimeTreeItem?.children && renderedRunTimeTreeItem?.children?.length > 0) {\n if (node?.selectConfig?.recursive) {\n // console.log(renderedRunTimeTreeItem);\n this.setIsCheckedForAll(renderedRunTimeTreeItem?.children, evt.target.checked);\n }\n }\n\n this.setRunTimeSelectionRecursiveStateTree(\n path,\n this.calculateItemSelectionRecursiveState(structuredClone(this.getTreeItem(path))),\n );\n if (renderedRunTimeTreeItem?.children && renderedRunTimeTreeItem?.children?.length >= 0) {\n if (node?.selectConfig?.recursive) {\n // this.setIsCheckedForAll(renderedRunTimeTreeItem?.children, evt.target.checked);\n this.runStateChangesForAll(renderedRunTimeTreeItem?.children);\n }\n this.treeComponentInstance?.renderNodeChanges([]);\n this.treeComponentInstance?.renderNodeChanges(this.treeDataRunTime);\n }\n this.syncStateChangesAtPath(path);\n if (this.getTreeItem(path).node.isSelected) {\n this.selectTreeItem(runTimeBackupTreeItem);\n } else {\n this.deselectTreeItem(runTimeBackupTreeItem);\n }\n const nodePathsSeq = this.getParentPaths(path);\n if (nodePathsSeq.length > 0) {\n nodePathsSeq.forEach((nodePath: string) => {\n const treeItem = this.getTreeItem(nodePath);\n const childStates = this.getRunTimeSelectionRecursiveState(nodePath).children.map((_) => _.selectionRecursiveState);\n this.updateRunTimeSelectionRecursiveState(\n nodePath,\n this.decideSelectionRecursiveState(\n childStates,\n treeItem.node?.isSelected,\n treeItem.node?.selectConfig?.recursive,\n treeItem.node?.selectConfig?.noAutoSelectParent,\n ),\n );\n this.syncStateChangesAtPath(nodePath);\n });\n this.changeDetectorRef.detectChanges();\n } else {\n this.changeDetectorRef.detectChanges();\n }\n } else {\n const prevItem = this.selectionModel.selected[0];\n if (evt.target.checked) {\n if (prevItem) {\n this.getTreeItem(prevItem.path).node.isSelected = false;\n this.selectionModel.deselect(prevItem);\n }\n item.node.isSelected = true;\n this.selectionModel.select(runTimeBackupTreeItem);\n } else {\n item.node.isSelected = false;\n this.selectionModel.deselect(runTimeBackupTreeItem);\n }\n if (this.highlightPath) {\n if (evt.target.checked && prevItem) {\n const prevItemNodePathsSeq = this.getParentPaths(prevItem.path);\n if (prevItemNodePathsSeq.length > 0) {\n prevItemNodePathsSeq.forEach((nodePath: string) => {\n this.updateRunTimeSelectionRecursiveState(nodePath, 'allNotSelected');\n this.syncStateChangesAtPath(nodePath);\n });\n }\n }\n const nodePathsSeq = this.getParentPaths(path);\n if (nodePathsSeq?.length > 0) {\n nodePathsSeq.forEach((nodePath: string) => {\n this.updateRunTimeSelectionRecursiveState(nodePath, evt.target.checked ? 'indeterminate' : 'allNotSelected');\n this.syncStateChangesAtPath(nodePath);\n });\n this.changeDetectorRef.detectChanges();\n }\n }\n }\n }\n\n hasChild = (_: number, item: TreeItemRunTimeModel): boolean => !!item?.children && item?.children?.length >= 0;\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSelectFn(path: string): (evt: any) => void {\n if (this.getTreeItem(path)?.node?.selectable) {\n const nodeSelected = this.nodeSelected.bind(this);\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (evt: any) => nodeSelected(evt, path);\n }\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (evt: any) => {\n console.warn('treeItemModel.node.selectable is false, you can not implement onSelect');\n };\n }\n\n getRunTimeSelectionRecursiveState(path: string): TreeItemSelectionRecursiveModel {\n const indexArr: Array<number> = this.resolvePath(path);\n let nodeArr = this.runTimeSelectionRecursiveState;\n let node;\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n nodeArr = nodeArr[pathIndex]?.children;\n } else {\n node = nodeArr[pathIndex];\n }\n });\n return node;\n }\n\n private initTree(): void {\n if (this.nodes) {\n this._isMultiLevel = this.checkIfMultiLevel(this.nodes);\n this.processedNodes = this.processInputs(structuredClone(this.nodes));\n this.treeDataRunTime = this.createTreeDataRuntime(this.processedNodes);\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.runTimeSelectionRecursiveState = this.createRunTimeSelectionRecursiveState(this.processedNodes);\n this.treeDataRunTimeBackup = structuredClone(this.treeDataRunTime);\n // todo It should be configurable, 800, 2 and 400 are hard coded right now\n if (this.treeDataRunTimeBackup.length > 800) {\n this.treePagination = new EuiTreePagination<TreeItemRunTimeModel>(this.treeDataRunTimeBackup, 1, 2, 400);\n const paginatedData = this.treePagination.getViewData().data;\n this.cdkArrayDataSource = new ArrayDataSource<TreeItemRunTimeModel>(paginatedData);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = paginatedData;\n this.runScrollListener();\n } else {\n this.cdkArrayDataSource = new ArrayDataSource<TreeItemRunTimeModel>(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n }\n this.renderInitialExpand(this.treeDataRunTime);\n this.selectionModel = new SelectionModel<TreeItemRunTimeModel>(\n true,\n this.getInitialSelection(this.treeDataRunTime),\n true,\n (a, b) => a?.path === b?.path,\n );\n this._selection = [...this.selectionModel.selected]?.map((item) => this.getTreeItem(item?.path));\n this.renderTree = true;\n if (this.selectionModelSubs) {\n this.selectionModelSubs.unsubscribe();\n }\n this.selectionModelSubs = this.selectionModel.changed.pipe(debounceTime(1)).subscribe((sc) => {\n const selectionChange = {\n added: sc.added.map((_) => this.getTreeItem(_.path)),\n removed: sc.removed.map((_) => this.getTreeItem(_.path)),\n selection: [...this.selectionModel.selected].map((item) => this.getTreeItem(item.path)),\n };\n this._selection = selectionChange.selection;\n this.selectionChange.emit(selectionChange);\n });\n this.changeDetectorRef.markForCheck();\n }\n }\n\n private processInputs(treeData: TreeDataModel): TreeDataModel {\n if (this.isMultiselect) {\n treeData = this.overrideTreeDataModelForSelection(treeData, this.isRecursiveSelection, !this.isRecursiveParentSelection);\n }\n if (this.isSingleSelect) {\n treeData = this.overrideTreeDataModelForSelection(treeData, false, false, true);\n }\n return treeData;\n }\n\n private overrideTreeDataModelForSelection(\n nodeArr: TreeDataModel,\n isRecursive: boolean,\n noAutoSelectParent: boolean,\n singleSelect?: boolean,\n ): TreeDataModel {\n return nodeArr?.map((item: TreeItemModel, index: number) => {\n if (item?.children && item.children.length > 0) {\n return {\n ...item,\n node: {\n ...item.node,\n selectable: typeof item?.node?.selectable === 'undefined' ? true : item?.node?.selectable,\n // isSelected: false,\n // isIndeterminate: false,\n selectConfig: {\n ...item.node.selectConfig,\n recursive:\n typeof item?.node?.selectConfig?.recursive === 'undefined'\n ? !!isRecursive\n : item?.node?.selectConfig?.recursive,\n noAutoSelectParent:\n typeof item?.node?.selectConfig?.noAutoSelectParent === 'undefined'\n ? noAutoSelectParent\n : item?.node?.selectConfig?.noAutoSelectParent,\n singleSelect:\n typeof item?.node?.selectConfig?.singleSelect === 'undefined'\n ? singleSelect\n : item?.node?.selectConfig?.singleSelect,\n },\n },\n children: this.overrideTreeDataModelForSelection(item.children, isRecursive, noAutoSelectParent, singleSelect),\n };\n } else {\n return {\n ...item,\n node: {\n ...item.node,\n selectable: typeof item?.node?.selectable === 'undefined' ? true : item?.node?.selectable,\n selectConfig: {\n ...item.node?.selectConfig,\n singleSelect:\n typeof item?.node?.selectConfig?.singleSelect === 'undefined'\n ? singleSelect\n : item?.node?.selectConfig?.singleSelect,\n },\n },\n };\n }\n });\n }\n\n private runScrollListener(): void {\n this.scrollDispatcherSubs = this.scrollDispatcher.scrolled().subscribe((scrollable: CdkScrollable) => {\n if (scrollable && this.checkIfCurrentScrollable(scrollable)) {\n const isAtBottom =\n scrollable?.getElementRef().nativeElement.scrollTop + scrollable?.getElementRef().nativeElement.clientHeight >=\n scrollable?.getElementRef().nativeElement.scrollHeight;\n const isAtTop = scrollable?.getElementRef().nativeElement.scrollTop === 0;\n // console.log('Element:', this.cdkScrollableRef.getElementRef());\n if (isAtBottom && !this.treePagination.isAtMax()) {\n if (this.nodes.length > 0) {\n this.treeDataRunTime = this.treePagination.paginateNext().data;\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandAll();\n const totalHeight = scrollable.measureScrollOffset('bottom') + scrollable.measureScrollOffset('top');\n const viewportHeight = scrollable.getElementRef().nativeElement.clientHeight;\n const positionToScroll = totalHeight - viewportHeight;\n scrollable.scrollTo({ top: positionToScroll / 2 });\n }\n } else if (isAtTop && this.treePagination.getCurrentStartPage() > 1) {\n if (this.nodes.length > 0) {\n this.treeDataRunTime = this.treePagination.paginatePrev().data;\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandAll();\n const totalHeight = scrollable.measureScrollOffset('bottom') + scrollable.measureScrollOffset('top');\n const viewportHeight = scrollable.getElementRef().nativeElement.clientHeight;\n const positionToScroll = totalHeight - viewportHeight;\n scrollable.scrollTo({ top: positionToScroll / 2 + viewportHeight });\n }\n }\n }\n });\n }\n\n private getSelectionIndexOfItem(runTimeTreeItem: TreeItemRunTimeModel): number {\n return this.selectionModel.selected.findIndex((i) => i?.path === runTimeTreeItem?.path);\n }\n\n private selectTreeItem(runTimeBackupTreeItem: TreeItemRunTimeModel): void {\n const indexOfItem = this.getSelectionIndexOfItem(runTimeBackupTreeItem);\n if (indexOfItem === -1) {\n this.selectionModel.select(runTimeBackupTreeItem);\n }\n }\n\n private deselectTreeItem(runTimeTreeItem: TreeItemRunTimeModel): void {\n const indexOfItem = this.getSelectionIndexOfItem(runTimeTreeItem);\n if (indexOfItem > -1) {\n const newSelection = [...this.selectionModel.selected];\n newSelection.splice(indexOfItem, 1);\n this.selectionModel.setSelection(...newSelection);\n }\n }\n\n private createTreeDataRuntime(nodes: TreeDataModel): TreeDataRunTimeModel {\n return structuredClone(nodes)?.map((item, index) => {\n return this.calculateRunTimeState(item, index);\n });\n }\n\n private applyRunTimeLastItems(items: TreeDataRunTimeModel): TreeDataRunTimeModel {\n return items?.map((item, index) => {\n if (item?.children) {\n return {\n ...item,\n last: items.length === index + 1 ? true : undefined,\n children: item.children?.length > 0 ? this.applyRunTimeLastItems(item.children) : item?.children,\n };\n } else {\n return {\n ...item,\n last: items.length === index + 1 ? true : undefined,\n };\n }\n });\n }\n\n private createRunTimeSelectionRecursiveState(nodes: TreeDataModel): Array<TreeItemSelectionRecursiveModel> {\n return structuredClone(nodes)?.map((item) => this.calculateItemSelectionRecursiveState({ ...item }));\n }\n\n // Creating run time state which includes children selection state for selection tree.\n private calculateItemSelectionRecursiveState(treeItem: TreeItemModel): TreeItemSelectionRecursiveModel {\n const childrenSelectionRecursive: Array<TreeItemSelectionRecursiveModel> = [];\n if (treeItem.children && treeItem.children.length > 0) {\n treeItem.children.forEach((child, index) => {\n childrenSelectionRecursive[index] = this.calculateItemSelectionRecursiveState(child);\n });\n }\n const childStates = childrenSelectionRecursive.map((_) => _.selectionRecursiveState);\n const itemState: SelectionRecursiveState = this.decideSelectionRecursiveState(\n childStates,\n treeItem.node.isSelected,\n treeItem.node?.selectConfig?.recursive,\n treeItem.node?.selectConfig?.noAutoSelectParent,\n );\n return {\n selectionRecursiveState: itemState,\n children: childrenSelectionRecursive,\n };\n }\n\n private decideSelectionRecursiveState(\n childStates: Array<SelectionRecursiveState> = [],\n isSelected: boolean,\n recursive: boolean,\n noAutoSelectParent: boolean,\n ): SelectionRecursiveState {\n let itemState: SelectionRecursiveState = 'indeterminate';\n if (isSelected && childStates.every((state) => state === 'allSelected')) {\n itemState = 'allSelected';\n } else if (!isSelected && childStates.every((state) => state === 'allNotSelected')) {\n itemState = 'allNotSelected';\n } else if (recursive && childStates.every((state) => state === 'allSelected') && !isSelected && !noAutoSelectParent) {\n itemState = 'allSelected';\n } else if (recursive && childStates.every((state) => state === 'allNotSelected') && isSelected) {\n itemState = 'allNotSelected';\n }\n return itemState;\n }\n\n private syncStateChangesAtPath(nodePath): void {\n const treeItem = this.getTreeItem(nodePath);\n const runTimeBackupTreeItem = this.getRunTimeBackupTreeItem(nodePath);\n const runTimeSelectionRecursiveItem = this.getRunTimeSelectionRecursiveState(nodePath);\n if (treeItem?.node?.selectable && treeItem.node?.selectConfig?.recursive) {\n if (!treeItem.node?.selectConfig?.noAutoSelectParent) {\n treeItem.node = {\n ...treeItem.node,\n isSelected: runTimeSelectionRecursiveItem.selectionRecursiveState === 'allSelected',\n isIndeterminate: runTimeSelectionRecursiveItem.selectionRecursiveState === 'indeterminate',\n };\n } else {\n treeItem.node = {\n ...treeItem.node,\n isSelected: treeItem.node.isSelected && runTimeSelectionRecursiveItem.selectionRecursiveState === 'allSelected',\n isIndeterminate:\n runTimeSelectionRecursiveItem.selectionRecursiveState === 'indeterminate' ||\n (!treeItem.node.isSelected && runTimeSelectionRecursiveItem.selectionRecursiveState === 'allSelected'),\n };\n }\n // console.log(treeItem, treeItem.node.treeContentBlock.label, 'isSelected:' + treeItem.node.isSelected, 'isIndeterminate:' + treeItem.node.isIndeterminate);\n if (treeItem.node.isSelected === true && !this.selectionModel.isSelected(runTimeBackupTreeItem)) {\n this.selectTreeItem(runTimeBackupTreeItem);\n } else if (treeItem.node.isSelected === false && this.selectionModel.isSelected(runTimeBackupTreeItem)) {\n this.deselectTreeItem(runTimeBackupTreeItem);\n }\n }\n }\n\n private setTreeData(path: string, item: TreeItemModel): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.processedNodes;\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = item;\n }\n });\n }\n\n private setTreeDataRunTimeBackup(path: string, item: TreeItemRunTimeModel): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.treeDataRunTimeBackup;\n indexArr.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = item;\n }\n });\n }\n\n private setTreeDataRunTime(path: string, item: TreeItemRunTimeModel): void {\n const oldItem = this.getRunTimeTreeItem(path);\n if(oldItem){\n Object.keys(item)?.forEach(key => {\n oldItem[key] = item[key];\n });\n }\n }\n\n private setRunTimeSelectionRecursiveStateTree(path: string, item: TreeItemSelectionRecursiveModel): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.runTimeSelectionRecursiveState;\n indexArr.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = item;\n }\n });\n }\n\n private updateRunTimeSelectionRecursiveState(path: string, selectionRecursiveState: SelectionRecursiveState): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.runTimeSelectionRecursiveState;\n indexArr.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = {\n ...itemArr[pathIndex],\n selectionRecursiveState,\n };\n }\n });\n }\n\n private setIsCheckedForAll(nodeArr: Array<TreeItemRunTimeModel>, isChecked: boolean): void {\n nodeArr.forEach((runTimeItem: TreeItemRunTimeModel, index: number) => {\n const runtimeBackupTreeItem = this.getRunTimeBackupTreeItem(runTimeItem.path);\n const treeItem = this.getTreeItem(runTimeItem.path);\n const node = treeItem.node;\n if (node?.selectable) {\n node.isSelected = isChecked;\n node.isIndeterminate = false;\n if (isChecked) {\n this.selectTreeItem(runtimeBackupTreeItem);\n } else {\n this.deselectTreeItem(runtimeBackupTreeItem);\n }\n }\n if (runTimeItem?.children?.length > 0) {\n this.setIsCheckedForAll(nodeArr[index].children, isChecked);\n }\n });\n }\n\n private runStateChangesForAll(nodeArr: Array<TreeItemRunTimeModel>): void {\n nodeArr?.forEach((runTimeItem: TreeItemRunTimeModel, index: number) => {\n if (runTimeItem?.children?.length >= 0) {\n this.runStateChangesForAll(nodeArr[index].children);\n this.syncSelectionAtPath(runTimeItem);\n }\n });\n }\n\n private syncSelectionAtPath(runTimeTreeItem: TreeItemRunTimeModel): void {\n // It is here for the filter edge case.\n this.syncStateChangesAtPath(runTimeTreeItem.path);\n // Sets isSelected change on the control.\n if (this.getTreeItem(runTimeTreeItem.path).node.isSelected) {\n this.selectTreeItem(this.getRunTimeBackupTreeItem(runTimeTreeItem.path));\n } else {\n this.deselectTreeItem(this.getRunTimeBackupTreeItem(runTimeTreeItem.path));\n }\n }\n\n private resolvePath(path: string): Array<number> {\n return path?.split('.').map((index: string) => parseInt(index, 10));\n }\n\n private getParentPaths(path: string): Array<string> {\n const pathArr = path.split('.');\n const hasParent = pathArr.length > 1;\n // Sets the hasParent If there is a parent, and removes the last element form pathArr.\n if (hasParent) {\n pathArr.pop();\n // Calculates parent path\n const parentPath = pathArr.join('.');\n // Creating node index sequence f.e If path is '1.2' it will be [1,2]\n const nodeIndexSeq = parentPath.split('.').map((indexStr) => parseInt(indexStr, 10));\n // Calculating the node paths array to be re-calculated from bottom to top\n const nodePathsSeq = [];\n nodeIndexSeq.forEach((nodeIndex, index) => {\n nodePathsSeq[index] = nodeIndexSeq.slice(0, index + 1).join('.');\n });\n return nodePathsSeq.reverse();\n } else {\n return [];\n }\n }\n\n private calculateRunTimeState(treeItem: TreeItemModel, index: number, parentPath?: string): TreeItemRunTimeModel {\n const runTimeTreeItem: TreeItemRunTimeModel = {\n path: parentPath ? parentPath + '.' + index : index.toString(),\n index,\n };\n if (treeItem.children && treeItem.children.length >= 0) {\n runTimeTreeItem.children = [];\n treeItem.children.forEach((child, treeItemIndex) => {\n runTimeTreeItem.children[treeItemIndex] = this.calculateRunTimeState(child, treeItemIndex, runTimeTreeItem.path);\n });\n }\n return runTimeTreeItem;\n }\n\n private filterTreeData(runTimeTreeData: TreeDataRunTimeModel, key = 'label', filterStr: string, showChildren: boolean, show?:boolean): TreeDataRunTimeModel {\n return runTimeTreeData.filter((runTimeItem) => {\n const targetData = this.getTreeItem(runTimeItem.path).node.treeContentBlock[key];\n if (\n targetData && this.normalizedStr(targetData)?.includes(this.normalizedStr(filterStr))\n ) {\n if(runTimeItem?.children?.length > 0){\n runTimeItem.children = this.filterTreeData(runTimeItem.children, key, filterStr, showChildren, showChildren);\n }\n Object.assign(runTimeItem,{ matched: true })\n // runTimeItem.matched = true;\n return true;\n } else if (runTimeItem?.children?.length > 0) {\n runTimeItem.children = this.filterTreeData(runTimeItem.children, key, filterStr, showChildren, show);\n runTimeItem.children = runTimeItem.children.length > 0 ? runTimeItem.children : undefined;\n return runTimeItem?.children?.length > 0 || show;\n } else {\n return show;\n }\n });\n }\n\n private normalizedStr(str: string): string {\n return str\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n }\n\n private getInitialSelection(nodes: TreeDataRunTimeModel): Array<TreeItemRunTimeModel> {\n const selection: Array<TreeItemRunTimeModel> = [];\n this.scanSelection(nodes, selection);\n return selection;\n }\n\n private scanSelection(nodes: TreeDataRunTimeModel, selection: Array<TreeItemRunTimeModel>): void {\n nodes.forEach((item: TreeItemRunTimeModel) => {\n if (this.getTreeItem(item.path).node?.selectable && this.getTreeItem(item.path).node.isSelected) {\n selection.push(item);\n }\n if (item?.children?.length > 0) {\n this.scanSelection(item.children, selection);\n }\n });\n }\n\n private renderInitialExpand(nodes: TreeDataRunTimeModel): void {\n nodes.forEach((item: TreeItemRunTimeModel) => {\n if (item?.children?.length > 0) {\n this.renderInitialExpand(item.children);\n }\n if (typeof this.getTreeItem(item.path).node.isExpanded !== 'undefined') {\n if(this.getTreeItem(item.path).node.isExpanded && !this.cdkTreeControl.isExpanded(item)){\n this.expandAt(item.path);\n }else if(!this.getTreeItem(item.path).node.isExpanded && this.cdkTreeControl.isExpanded(item)){\n this.cdkTreeControl.collapse(item);\n }\n }\n });\n }\n\n private expandMatched(nodes: TreeDataRunTimeModel): void {\n nodes.forEach((item: TreeItemRunTimeModel) => {\n if (item.matched) {\n const parentPath = this.getParentPaths(item.path)[0];\n if (parentPath) {\n let parentTreeItem = this.getTreeItem(parentPath);\n parentTreeItem = {\n ...parentTreeItem,\n node: {\n ...parentTreeItem.node,\n isExpanded: true,\n },\n };\n // node.isExpanded = true;\n // console.log(\"here\", parentTreeItem.node.treeContentBlock.label, parentPath, item);\n this.expandAt(parentPath);\n }\n }\n if (item?.children?.length > 0) {\n this.expandMatched(item.children);\n }\n });\n }\n\n private getRunTimeTreeItem(path: string): TreeItemRunTimeModel {\n return this.findRunTimeTreeItem(this.treeDataRunTime, path);\n }\n\n private findRunTimeTreeItem(treeDataRunTime: TreeDataRunTimeModel, path): TreeItemRunTimeModel {\n for (const runTimeItem of treeDataRunTime) {\n if (runTimeItem.path === path) {\n return runTimeItem;\n } else if (runTimeItem?.children?.length > 0) {\n const found = this.findRunTimeTreeItem(runTimeItem.children, path);\n if (found) {\n return found;\n }\n }\n }\n return null;\n }\n\n private getRunTimeBackupTreeItem(path: string): TreeItemRunTimeModel {\n const indexArr: Array<number> = this.resolvePath(path);\n let nodeArr = this.treeDataRunTimeBackup;\n let node;\n if (nodeArr && Array.isArray(nodeArr)) {\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n nodeArr = nodeArr && nodeArr[pathIndex]?.children;\n } else {\n node = nodeArr[pathIndex];\n }\n });\n }\n return node;\n }\n\n private getCssClasses(): string {\n return [\n 'eui-tree',\n this.isMultiselect ? 'eui-tree--multiselect' : '',\n this._isMultiLevel ? 'eui-tree--with-children' : '',\n this._showLines ? 'eui-tree--show-lines' : '',\n ]\n .join(' ')\n .trim();\n }\n\n private checkIfMultiLevel(tree: TreeDataModel): boolean {\n let isMultiLevel = false;\n tree.forEach((item: TreeItemModel) => {\n if (item?.children?.length >= 0) {\n isMultiLevel = true;\n }\n });\n return isMultiLevel;\n }\n\n private checkIfCurrentScrollable(scrolled: CdkScrollable): boolean {\n return scrolled.getElementRef().nativeElement === this.cdkScrollableRef.getElementRef().nativeElement;\n }\n}\n\n@NgModule({\n imports: [\n CommonModule,\n RouterModule,\n FormsModule,\n TranslateModule,\n EuiInputCheckboxModule,\n CdkTreeModule,\n EuiButtonModule,\n EuiIconModule,\n EuiLabelModule,\n EuiBadgeModule,\n EuiChipModule,\n EuiDropdownModule,\n ScrollingModule,\n ],\n declarations: [EuiTreeComponent],\n exports: [EuiTreeComponent],\n})\nexport class EuiTreeModule {}\n", "<div class=\"eui-ul-rep eui-tree__wrapper\" cdkScrollable #cdkScrollableRef>\n <cdk-tree\n #treeComponentInstance\n [dataSource]=\"cdkArrayDataSource\"\n [treeControl]=\"cdkTreeControl\"\n [trackBy]=\"trackBy\"\n *ngIf=\"renderTree\"\n class=\"eui-cdk-tree\">\n <!-- There are two states of generic cdk-nested-tree-node declarations.\n First one is without child. No sub rendering.\n -->\n <cdk-nested-tree-node *cdkTreeNodeDef=\"let treeRunTimeItemModel\" class=\"eui-cdk-nested-tree-node\">\n <div *ngIf=\"treeRunTimeItemModel\"\n class=\"eui-li-rep eui-tree-node\"\n [class.eui-tree-node--first]=\"treeRunTimeItemModel?.path === '0'\"\n [class.eui-tree-node--last]=\"treeRunTimeItemModel.last\"\n title=\"{{\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div class=\"eui-tree-node-wrapper\"\n (click)=\"onNodeClick(treeRunTimeItemModel)\">\n <div class=\"eui-tree-node-wrapper__container\">\n <!--\n Renders node in default or provided template's context.\n Generates onSelect with onSelectFn for developers to send the events from their custom check events.\n Provides id to be used on generic template\n -->\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplateRef || nodeTemplateDefault\"\n [ngTemplateOutletContext]=\"{\n $implicit: getTreeItem(treeRunTimeItemModel?.path)?.node,\n onSelect: onSelectFn(treeRunTimeItemModel.path),\n id: uid + treeRunTimeItemModel.path,\n path: treeRunTimeItemModel.path\n }\">\n </ng-container>\n </div>\n </div>\n </div>\n </cdk-nested-tree-node>\n <!-- This is the tree node template for expandable nodes -->\n <cdk-nested-tree-node\n *cdkTreeNodeDef=\"let treeRunTimeItemModel; when: hasChild\"\n class=\"eui-cdk-nested-tree-node eui-cdk-nested-tree-node--with-child\">\n <div\n class=\"eui-li-rep eui-tree-node eui-tree-node--with-child\"\n [class.eui-tree-node--first]=\"treeRunTimeItemModel?.path === '0'\"\n [class.eui-tree-node--last]=\"treeRunTimeItemModel.last\"\n *ngIf=\"treeRunTimeItemModel\"\n title=\"{{\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div\n class=\"eui-tree-node-wrapper\">\n <!--Here wraps the node, and listen for node clicks.-->\n <div (click)=\"onNodeClick(treeRunTimeItemModel)\" class=\"eui-tree-node-wrapper__container\">\n <!-- Expand/collapse action button -->\n <button\n euiButton\n euiIconButton\n euiBasicButton\n euiRounded\n euiSizeS\n type=\"button\"\n [attr.aria-label]=\"'Toggle ' + getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.label\"\n (click)=\"onNodeToggle(treeRunTimeItemModel)\"\n cdkTreeNodeToggle\n class=\"eui-tree-node__button\">\n <eui-icon-svg\n *ngIf=\"!cdkTreeControl.isExpanded(treeRunTimeItemModel) && !collapsedIconClass\"\n [icon]=\"expandedSvgIconClass\"></eui-icon-svg>\n <eui-icon-svg\n *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel) && !expandedIconClass\"\n [icon]=\"collapsedSvgIconClass\"></eui-icon-svg>\n </button>\n <!--\n Renders node in default or provided template's context.\n Generates onSelect with onSelectFn for developers to send the events from their custom check events.\n Provides id to be used on generic template\n -->\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplateRef || nodeTemplateDefault\"\n [ngTemplateOutletContext]=\"{\n $implicit: getTreeItem(treeRunTimeItemModel.path)?.node,\n onSelect: onSelectFn(treeRunTimeItemModel.path),\n id: uid + treeRunTimeItemModel.path,\n path: treeRunTimeItemModel.path,\n children: getTreeItem(treeRunTimeItemModel?.path)?.children\n }\">\n </ng-container>\n </div>\n </div>\n <!--uses cdkTreeNodeOutlet to render children nodes, CdkTreeControl is used to control isExpanded state.-->\n <div class=\"eui-ul-rep eui-tree-node\" role=\"group\" *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel)\">\n <ng-container cdkTreeNodeOutlet></ng-container>\n </div>\n </div>\n </cdk-nested-tree-node>\n </cdk-tree>\n</div>\n\n<ng-template #nodeTemplateDefault let-node let-onSelect=\"onSelect\" let-id=\"id\" let-path=\"path\">\n <ng-container *ngIf=\"node\">\n <div class=\"eui-tree-node-wrapper__container-left\" [class.eui-tree-node-wrapper__container-left--selected]=\"node?.isSelected\">\n <!--input checkbox area-->\n <input\n euiInputCheckBox\n *ngIf=\"node && node.selectable\"\n type=\"checkbox\"\n id=\"{{ id }}\"\n [checked]=\"!!node?.isSelected\"\n [indeterminate]=\"!!node?.isIndeterminate\"\n (change)=\"onSelect($event)\"\n class=\"eui-u-mr-m\" />\n\n <!--icon area-->\n <ng-container *ngIf=\"node?.treeContentBlock?.iconSvgName\">\n <eui-icon-svg\n icon=\"{{ node?.treeContentBlock?.iconSvgName }}\"\n fillColor=\"{{ node?.treeContentBlock?.iconTypeClass || 'neutral' }}\"\n size=\"s\"\n class=\"eui-u-mr-xs\">\n </eui-icon-svg>\n </ng-container>\n\n <!--chips area-->\n <ng-container *ngIf=\"node?.treeContentBlock?.chips\">\n <eui-chip\n *ngFor=\"let chip of node.treeContentBlock.chips\"\n euiSizeXS\n [euiVariant]=\"chip.typeClass || 'secondary'\"\n [euiOutline]=\"chip.isOutline\"\n class=\"eui-chip--rounded eui-u-mb-none eui-u-mr-xs\">\n <span euiLabel>{{ chip.label }}</span>\n </eui-chip>\n </ng-container>\n\n <!--badge (typeLabel & typeClass) area-->\n <ng-container *ngIf=\"node?.treeContentBlock?.typeLabel\" [ngSwitch]=\"node?.treeContentBlock?.typeClass\">\n <eui-badge euiSizeM [euiVariant]=\"node?.treeContentBlock?.typeClass || 'primary'\" class=\"eui-u-flex-no-shrink eui-u-mr-xs\">\n {{ node?.treeContentBlock?.typeLabel }}\n </eui-badge>\n </ng-container>\n </div>\n\n <!--label area-->\n <div class=\"eui-tree-node-wrapper__container-middle\">\n <label\n *ngIf=\"!node?.treeContentBlock?.url && !node?.treeContentBlock?.urlExternal\"\n euiLabel\n for=\"{{ id }}\"\n class=\"eui-u-text-truncate eui-u-p-2xs\"\n [class.eui-label--selected]=\"\n highlightPath\n ? getRunTimeSelectionRecursiveState(path)?.selectionRecursiveState === 'indeterminate' || node?.isSelected\n : node?.isSelected\n \"\n [class.eui-u-cursor-pointer]=\"node?.selectable\">\n {{ autoTranslate ? (node?.treeContentBlock?.label | translate) : node?.treeContentBlock?.label }}\n </label>\n <label *ngIf=\"node?.treeContentBlock?.url\" euiLabel for=\"{{ id }}\" class=\"eui-u-text-truncate eui-u-p-2xs\">\n <a\n class=\"eui-u-text-link\"\n [class.eui-u-text-link-standalone]=\"!showUnderlinedLinks\"\n [routerLink]=\"node?.treeContentBlock?.url\">\n {{ autoTranslate ? (node?.treeContentBlock?.label | translate) : node?.treeContentBlock?.label }}\n </a>\n </label>\n <label *ngIf=\"node?.treeContentBlock?.urlExternal\" euiLabel for=\"{{ id }}\" class=\"eui-u-text-truncate eui-u-p-2xs\">\n <a\n class=\"eui-u-text-link-external\"\n [class.eui-u-text-link-external-standalone]=\"!showUnderlinedLinks\"\n href=\"{{ node?.treeContentBlock?.urlExternal }}\"\n target=\"{{ node?.treeContentBlock?.urlExternalTarget || 'blank' }}\">\n {{ autoTranslate ? (node?.treeContentBlock?.label | translate) : node?.treeContentBlock?.label }}\n </a>\n </label>\n </div>\n\n <div *ngIf=\"node?.treeContentBlock?.rightContent\" class=\"eui-tree-node-wrapper__container-right\">\n <!--badges area-->\n <ng-container *ngFor=\"let badge of node.treeContentBlock.rightContent?.badges\">\n <eui-badge euiSizeM euiOutline [euiVariant]=\"badge.typeClass || 'secondary'\" class=\"eui-u-ml-xs\">\n <span euiLabel>{{ badge.label }}</span>\n </eui-badge>\n </ng-container>\n\n <!--chips area-->\n <ng-container *ngFor=\"let chip of node.treeContentBlock.rightContent?.chips\">\n <eui-chip\n euiSizeXS\n [euiVariant]=\"chip.typeClass || 'secondary'\"\n [euiOutline]=\"chip.isOutline\"\n class=\"eui-chip--rounded eui-u-mb-none eui-u-ml-xs\">\n <span euiLabel>{{ chip.label }}</span>\n </eui-chip>\n </ng-container>\n\n <!--Context menu-->\n <ng-container *ngIf=\"node.treeContentBlock.rightContent?.contextMenuMetaData && rightContextMenuTemplateRef\">\n <eui-dropdown class=\"eui-u-ml-xs\">\n <button euiButton euiSizeS euiRounded euiIconButton euiBasicButton euiSecondary [attr.aria-label]=\"'Options menu'\">\n <eui-icon-svg icon=\"eui-ellipsis-vertical\"></eui-icon-svg>\n </button>\n <eui-dropdown-content>\n <ng-template\n [ngTemplateOutlet]=\"rightContextMenuTemplateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: node?.treeContentBlock?.rightContent?.contextMenuMetaData,\n metadata: node?.treeContentBlock?.rightContent?.contextMenuMetaData\n }\">\n </ng-template>\n </eui-dropdown-content>\n </eui-dropdown>\n </ng-container>\n </div>\n\n <!--metadata, uses the help of ng template to generate dynamic expand variable without handling state -->\n <ng-container\n *ngIf=\"node.treeContentBlock?.metadata && nodeContentMetadataTemplateRef\"\n [ngTemplateOutlet]=\"nodeContentMetadataContainer\"\n [ngTemplateOutletContext]=\"{\n $implicit: { expanded: false }\n }\">\n </ng-container>\n <ng-template #nodeContentMetadataContainer let-metaDataContainer>\n <button\n euiButton\n euiBasicButton\n euiIconButton\n euiRounded\n euiSizeS\n type=\"button\"\n aria-label=\"expand collapse tree item\"\n (click)=\"metaDataContainer.expanded = !metaDataContainer.expanded\">\n <eui-icon-svg [icon]=\"metaDataContainer.expanded ? 'eui-chevron-down' : 'eui-chevron-forward'\"></eui-icon-svg>\n </button>\n <div *ngIf=\"metaDataContainer.expanded\" class=\"eui-tree-node__metacontent\">\n <!--passing metadata of the node content to provided template-ref:nodeContentMetadataTemplateRef-->\n <ng-template\n [ngTemplateOutlet]=\"nodeContentMetadataTemplateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: node?.treeContentBlock?.metadata,\n metadata: node?.treeContentBlock?.metadata\n }\">\n </ng-template>\n </div>\n </ng-template>\n </ng-container>\n</ng-template>\n", "import {\n Directive,\n Host,\n AfterContentInit,\n ContentChild,\n Input,\n TemplateRef,\n AfterViewInit,\n ChangeDetectorRef,\n ElementRef,\n Renderer2,\n NgModule,\n} from '@angular/core';\nimport { EuiTreeComponent } from './eui-tree.component';\nimport { TreeDataModel } from './eui-tree.model';\nimport { EuiDropdownComponent } from '@eui/components/eui-dropdown';\nimport { CommonModule } from '@angular/common';\n\n@Directive({\n selector: 'eui-dropdown[euiDropdownTree]',\n})\nexport class EuiDropdownTreeDirective implements AfterContentInit, AfterViewInit {\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() buttonTemplateRef: TemplateRef<any>;\n @ContentChild(EuiTreeComponent, { static: false }) euiTree: EuiTreeComponent;\n\n private buttonLabel: string;\n private buttonViewRef;\n\n constructor(\n private changeDetectorRef: ChangeDetectorRef,\n private hostElement: ElementRef,\n private renderer: Renderer2,\n @Host() private euiDropdown: EuiDropdownComponent,\n ) {}\n\n ngAfterContentInit(): void {\n this.buttonLabel = this.createButtonLabel(this.euiTree.getSelection());\n this.euiTree.selectionChange.subscribe((selectionChanges) => {\n this.buttonLabel = this.createButtonLabel(selectionChanges.selection);\n this.buttonViewRef.context.$implicit = this.buttonLabel;\n this.buttonViewRef.detectChanges();\n });\n }\n\n ngAfterViewInit(): void {\n if (this.buttonTemplateRef) {\n const triggerContainer = this.hostElement.nativeElement.querySelector('.eui-dropdown__trigger-container');\n if (!triggerContainer) {\n console.error('Could not find the triggerContainer');\n return;\n }\n while (triggerContainer.firstChild) {\n triggerContainer.removeChild(triggerContainer.firstChild);\n }\n this.buttonViewRef = this.buttonTemplateRef.createEmbeddedView({ $implicit: this.buttonLabel });\n this.buttonViewRef.detectChanges();\n\n this.buttonViewRef.rootNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.renderer.appendChild(triggerContainer, node);\n }\n });\n }\n }\n\n private createButtonLabel(selection: TreeDataModel): string {\n if (selection?.length > 0) {\n return this.euiTree\n .getSelection()\n ?.map((item) => item.node.treeContentBlock.label)\n .join(',') as string;\n }\n return 'No node selected.';\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [EuiDropdownTreeDirective],\n declarations: [EuiDropdownTreeDirective],\n})\nexport class EuiDropdownTreeDirectiveModule {}\n", "import { TreeDataModel, TreeItemModel } from './eui-tree.model';\n\nexport class EuiTreeHelper {\n private readonly treeData: TreeDataModel;\n\n constructor(treeData: TreeDataModel) {\n this.treeData = treeData;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getPath(value: any, identifierKey = 'node.treeContentBlock.id'): string {\n if(typeof value !=='undefined'){\n const paths: Array<string> = [];\n this.traverse(this.treeData, '', [value], paths, undefined, identifierKey);\n return paths[0];\n }\n return null;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getPaths(values: Array<any>, identifierKey?: string): Array<string> {\n const paths: Array<string> = [];\n this.traverse(this.treeData, '', values, paths, undefined, identifierKey);\n return paths;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getItems(values: Array<any>, identifierKey?: string): Array<TreeItemModel> {\n const matchedItems: Array<TreeItemModel> = [];\n this.traverse(this.treeData, '', values, undefined, matchedItems, identifierKey);\n return matchedItems;\n }\n\n private traverse(\n tree: TreeDataModel,\n currentPath: string,\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n values: Array<any>,\n paths?: Array<string>,\n items?: Array<TreeItemModel>,\n identifierKey?: string,\n ): void {\n for (const [i, item] of tree.entries()) {\n const valueToCheck = identifierKey ? this.getValueAtKey(item, identifierKey) : item;\n\n if (values.some((v) => this.deepEqual(v, valueToCheck))) {\n if (paths) paths.push(`${currentPath}${i}`);\n if (items) items.push(item);\n }\n\n if (item.children && item.children.length) {\n this.traverse(item.children, `${currentPath}${i}.`, values, paths, items, identifierKey);\n }\n }\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private getValueAtKey(object: any, key: string): any {\n const keys = key.split('.');\n let current = object;\n for (const k of keys) {\n if (current[k] !== undefined) {\n current = current[k];\n } else {\n return undefined;\n }\n }\n return current;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private deepEqual(obj1: any, obj2: any): boolean {\n if (obj1 === obj2) {\n return true;\n }\n if (typeof obj1 !== 'object' || obj1 === null || typeof obj2 !== 'object' || obj2 === null) {\n return false;\n }\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n for (const key of keys1) {\n if (!keys2.includes(key) || !this.deepEqual(obj1[key], obj2[key])) {\n return false;\n }\n }\n return true;\n }\n}\n", "import { Directive, Host, forwardRef, AfterContentInit, Input, NgModule } from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\nimport { EuiTreeComponent } from './eui-tree.component';\nimport { EuiTreeSelectionChanges, TreeDataModel, TreeItemModel } from './eui-tree.model';\nimport { EuiTreeHelper } from './eui-tree-helper';\n\n@Directive({\n selector: 'eui-tree[euiTreeFormControl]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => EuiTreeFormControlDirective),\n multi: true,\n },\n ],\n})\nexport class EuiTreeFormControlDirective implements ControlValueAccessor, AfterContentInit {\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private onChange: (value: any) => void;\n private onTouched: () => void;\n\n constructor(@Host() private tree: EuiTreeComponent) {}\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() euiTreeControlValueSetter: (selection: TreeDataModel) => any = (selection: TreeDataModel) => {\n return selection;\n };\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() euiTreeControlModelMapper: (model: any, tree?: TreeDataModel) => Array<TreeItemModel> = (model: Array<TreeItemModel>) => {\n return model;\n };\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n writeValue(value: any): void {\n this.tree.setAllSelection(false);\n if (typeof value !== 'undefined' && value !== null && value?.length > 0) {\n const initialItems = this.euiTreeControlModelMapper(value, this.tree.nodes);\n const paths = new EuiTreeHelper(this.tree.nodes).getPaths(initialItems);\n paths.forEach((path: string) => {\n this.tree.nodeSelected({ target: { checked: true } }, path);\n });\n }\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n ngAfterContentInit(): void {\n this.tree.selectionChange.subscribe((selectionChanges: EuiTreeSelectionChanges) => {\n this.onChange(this.euiTreeControlValueSetter(selectionChanges.selection));\n });\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [EuiTreeFormControlDirective],\n declarations: [EuiTreeFormControlDirective],\n})\nexport class EuiTreeFormControlDirectiveModule {}\n"],
|
4
|
+
"sourcesContent": ["import { UxLinkLegacy } from '@eui/base';\n\nexport type TreeDataModel = Array<TreeItemModel>;\n\nexport type TreeItemModel = {\n node: TreeNode;\n children?: TreeDataModel;\n};\n\nexport type TreeNode = {\n // metadata can be block content, or any\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n treeContentBlock: EuiTreeContentBlockModel | any;\n} & SelectionModel &\n ExpandModel;\n\nexport interface EuiTreeContentBlockModel {\n id?: string | number;\n label: string;\n tooltipLabel: string;\n url: string;\n urlExternal: string;\n urlExternalTarget: string;\n typeLabel: string;\n typeClass: string;\n chips?: Array<{ label: string; typeClass?: string; isOutline?: boolean }>;\n iconClass: string;\n iconTypeClass: string;\n iconSvgName?: string;\n rightContent?: {\n iconClass: string;\n iconTypeClass: string;\n iconSvgName?: string;\n badges?: Array<{ label: string; typeClass: string }>;\n chips?: Array<{ label: string; typeClass?: string; isOutline?: boolean }>;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n contextMenuMetaData?: any;\n };\n metaData: string;\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n}\n\nexport type SelectionModel = {\n selectable?: boolean;\n isSelected?: boolean;\n // if one of sub is selected, it becomes intermediate\n isIndeterminate?: boolean;\n selectConfig?: SelectConfigModel;\n};\n\nexport interface SelectConfigModel extends MultiSelectionLogic, SingleSelectionLogic {\n /*\n If It is true;\n When user select parent, all the children will be selected\n When selection state is changed, If all children is selected parent will be selected as long as noAutoSelectParent is not true\n */\n recursive?: boolean;\n /* when It is true, If all children is selected, parent will not be selected, while recursive is true*/\n noAutoSelectParent?: boolean;\n singleSelect?: boolean;\n}\n\nexport interface MultiSelectionLogic {\n /*\n If It is true;\n When user select parent, all the children will be selected\n When selection state is changed, If all children is selected parent will be selected as long as noAutoSelectParent is not true\n */\n recursive?: boolean;\n /* when It is true, If all children is selected, parent will not be selected, while recursive is true*/\n noAutoSelectParent?: boolean;\n}\n\nexport interface SingleSelectionLogic {\n singleSelect?: boolean;\n}\n\nexport type ExpandModel = {\n isExpanded?: boolean;\n};\n\nexport type EuiTreeSelectionChanges = { added: TreeDataModel; removed: TreeDataModel; selection: TreeDataModel };\n\nexport type TreeDataRunTimeModel = Array<TreeItemRunTimeModel>;\n\nexport type TreeItemRunTimeModel = { index: number; path: string; children?: Array<TreeItemRunTimeModel>; last?: boolean, matched?: boolean };\n\nexport type TreeItemSelectionRecursiveModel = {\n selectionRecursiveState: SelectionRecursiveState;\n children?: Array<TreeItemSelectionRecursiveModel>;\n};\n\nexport type SelectionRecursiveState = 'indeterminate' | 'allSelected' | 'allNotSelected';\n\n// eslint-disable-next-line prefer-arrow/prefer-arrow-functions\nexport function uxTreeNodesMetaDataMapper(oldTree: Array<UxLinkLegacy>): TreeDataModel {\n return oldTree.map((item) => {\n if (item?.typeClass === 'default') {\n // default typeClass will be\n item.typeClass = 'secondary';\n }\n if (item?.badgeLabel) {\n // default typeClass will be\n if (item?.badges?.length > 0) {\n item.badges.push({ label: item?.badgeLabel, typeClass: 'secondary' });\n } else {\n item.badges = [{ label: item?.badgeLabel, typeClass: 'secondary' }];\n }\n }\n return {\n node: {\n treeContentBlock: {\n label: item.label,\n typeLabel: item.typeLabel,\n typeClass: item.typeLabel && !item.typeClass ? 'secondary' : item.typeClass,\n tooltipLabel: item.tooltipLabel,\n url: item.url,\n urlExternal: item.urlExternal,\n urlExternalTarget: item.urlExternal && item.urlExternalTarget ? item.urlExternalTarget : undefined,\n badges: item.badges,\n metadata: item.metadata,\n },\n },\n children: item.children ? uxTreeNodesMetaDataMapper(item.children) : undefined,\n };\n });\n}\n\nexport class EuiTreePagination<T> {\n private data: T[];\n private startPage: number;\n private totalItems: number;\n private renderedPageCount: number;\n private perPage: number;\n private totalPages: number;\n\n constructor(data: T[], startPage: number, renderedPageCount: number, perPage: number) {\n this.data = data;\n this.setCurrentStartPage(startPage);\n this.renderedPageCount = renderedPageCount;\n this.totalItems = this.data.length;\n this.perPage = perPage;\n this.totalPages = Math.ceil(this.totalItems / this.perPage);\n }\n\n public paginateNext(): { startPage: number; data: T[] } {\n if (this.startPage < this.totalPages) {\n this.startPage += 1;\n }\n return this.getViewData();\n }\n\n public paginatePrev(): { startPage: number; data: T[] } {\n if (this.startPage > 1) {\n this.startPage -= 1;\n }\n return this.getViewData();\n }\n\n public getCurrentStartPage(): number {\n return this.startPage;\n }\n\n public setCurrentStartPage(startPage: number): void {\n this.startPage = startPage;\n }\n\n public isAtMax(): boolean {\n return this.totalPages < this.startPage + this.renderedPageCount;\n }\n\n public getViewData(): { startPage: number; data: T[] } {\n const startIndex = (this.startPage - 1) * this.perPage;\n const endIndex = startIndex + this.perPage * this.renderedPageCount;\n const pageData = structuredClone(this.data).slice(startIndex, endIndex);\n return {\n startPage: this.startPage,\n data: pageData,\n };\n }\n}\n", "import {\n Component,\n Input,\n NgModule,\n ChangeDetectionStrategy,\n EventEmitter,\n Output,\n ViewEncapsulation,\n TemplateRef,\n ChangeDetectorRef,\n SimpleChanges,\n OnInit,\n OnChanges,\n HostBinding,\n OnDestroy,\n ViewChild,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { RouterModule } from '@angular/router';\nimport {\n SelectionRecursiveState,\n TreeDataModel,\n TreeItemModel,\n TreeDataRunTimeModel,\n TreeItemRunTimeModel,\n TreeItemSelectionRecursiveModel,\n EuiTreeSelectionChanges,\n EuiTreePagination,\n} from './eui-tree.model';\nimport { FormsModule } from '@angular/forms';\nimport { EuiInputCheckboxModule } from '@eui/components/eui-input-checkbox';\nimport { EuiButtonModule } from '@eui/components/eui-button';\nimport { EuiIconModule } from '@eui/components/eui-icon';\nimport { EuiLabelModule } from '@eui/components/eui-label';\nimport { EuiBadgeModule } from '@eui/components/eui-badge';\nimport { EuiChipModule } from '@eui/components/eui-chip';\nimport { EuiDropdownModule } from '@eui/components/eui-dropdown';\nimport { NestedTreeControl, CdkTreeModule, CdkTree } from '@angular/cdk/tree';\nimport { ArrayDataSource, SelectionModel } from '@angular/cdk/collections';\nimport { BooleanInput, coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { TranslateModule } from '@ngx-translate/core';\nimport { ScrollingModule, ScrollDispatcher, CdkScrollable } from '@angular/cdk/scrolling';\nimport { debounceTime } from 'rxjs';\n\n@Component({\n selector: 'eui-tree',\n templateUrl: './eui-tree.component.html',\n styleUrls: ['./styles/_index.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class EuiTreeComponent implements OnInit, OnChanges, OnDestroy {\n @HostBinding('class')\n public get cssClasses(): string {\n return this.getCssClasses();\n }\n @HostBinding('attr.data-e2e') @Input() e2eAttr = 'eui-tree';\n @Input() nodes: TreeDataModel;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() nodeTemplateRef: TemplateRef<any>;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() nodeContentMetadataTemplateRef: TemplateRef<any>;\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() rightContextMenuTemplateRef: TemplateRef<any>;\n @Input() expandedIconClass: string;\n @Input() collapsedIconClass: string;\n @Input() expandedSvgIconClass = 'chevron-forward:sharp';\n @Input() collapsedSvgIconClass = 'chevron-down:sharp';\n\n @ViewChild('cdkScrollableRef', { read: CdkScrollable }) cdkScrollableRef: CdkScrollable;\n @ViewChild('treeComponentInstance') public treeComponentInstance: CdkTree<TreeItemRunTimeModel>;\n\n // @ViewChild('treeComponentInstance') public treeComponentInstance: any;\n\n @Input()\n get isClickTogglingNode(): boolean {\n return this._isClickTogglingNode;\n }\n\n set isClickTogglingNode(value: BooleanInput) {\n this._isClickTogglingNode = coerceBooleanProperty(value);\n }\n\n @Input()\n get isMultiselect(): boolean {\n return this._isMultiselect;\n }\n\n set isMultiselect(value: BooleanInput) {\n this._isMultiselect = coerceBooleanProperty(value);\n }\n\n @Input()\n get isSingleSelect(): boolean {\n return this._isSingleSelect;\n }\n\n set isSingleSelect(value: BooleanInput) {\n this._isSingleSelect = coerceBooleanProperty(value);\n }\n\n @Input()\n get isRecursiveSelection(): boolean {\n return this._isRecursiveSelection;\n }\n\n set isRecursiveSelection(value: BooleanInput) {\n this._isRecursiveSelection = coerceBooleanProperty(value);\n }\n\n @Input()\n get isRecursiveParentSelection(): boolean {\n return this._isRecursiveParentSelection;\n }\n\n set isRecursiveParentSelection(value: BooleanInput) {\n this._isRecursiveParentSelection = coerceBooleanProperty(value);\n }\n\n @Input()\n get showUnderlinedLinks(): boolean {\n return this._showUnderlinedLinks;\n }\n\n set showUnderlinedLinks(value: BooleanInput) {\n this._showUnderlinedLinks = coerceBooleanProperty(value);\n }\n\n @Input()\n get showLines(): boolean {\n return this._showLines;\n }\n\n set showLines(value: BooleanInput) {\n this._showLines = coerceBooleanProperty(value);\n }\n\n @Input()\n get autoTranslate(): boolean {\n return this._autoTranslate;\n }\n\n set autoTranslate(value: BooleanInput) {\n this._autoTranslate = coerceBooleanProperty(value);\n }\n\n @Input()\n get highlightPath(): boolean {\n return this._highlightPath;\n }\n\n set highlightPath(value: BooleanInput) {\n this._highlightPath = coerceBooleanProperty(value);\n }\n\n @Output() selectionChange = new EventEmitter<EuiTreeSelectionChanges>();\n @Output() nodeClick = new EventEmitter<TreeItemModel>();\n @Output() nodeToggle = new EventEmitter<TreeItemModel>();\n cdkArrayDataSource: ArrayDataSource<TreeItemRunTimeModel>;\n cdkTreeControl: NestedTreeControl<TreeItemRunTimeModel>;\n renderTree: boolean;\n public uid: string = Math.floor(Math.random() * 1000000000).toString();\n protected _isMultiLevel;\n private processedNodes: TreeDataModel;\n private treeDataRunTime: TreeDataRunTimeModel;\n private treeDataRunTimeBackup: TreeDataRunTimeModel;\n private runTimeSelectionRecursiveState: Array<TreeItemSelectionRecursiveModel>;\n private selectionModel: SelectionModel<TreeItemRunTimeModel>;\n private _isClickTogglingNode = false;\n private _isMultiselect = false;\n private _isSingleSelect = false;\n private _isRecursiveSelection = false;\n private _isRecursiveParentSelection = true;\n private _showUnderlinedLinks = false;\n private _showLines = true;\n private _autoTranslate = true;\n private _highlightPath = false;\n private selectionModelSubs;\n private scrollDispatcherSubs;\n private _selection;\n private treePagination: EuiTreePagination<TreeItemRunTimeModel>;\n\n constructor(private changeDetectorRef: ChangeDetectorRef, private scrollDispatcher: ScrollDispatcher) {}\n\n ngOnInit(): void {\n this.initTree();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['nodes']?.currentValue !== changes['nodes']?.previousValue) {\n this.renderTree = false;\n this.initTree();\n if(this.treeComponentInstance) {\n this.treeComponentInstance?.renderNodeChanges([]);\n this.treeComponentInstance?.renderNodeChanges(this.treeDataRunTime);\n }\n }\n }\n\n ngOnDestroy(): void {\n if (this.selectionModelSubs) {\n this.selectionModelSubs.unsubscribe();\n }\n if (this.scrollDispatcherSubs) {\n this.scrollDispatcherSubs.unsubscribe();\n }\n }\n\n getSelection(): TreeDataModel {\n return this._selection;\n }\n\n getProcessedNodes(): TreeDataModel {\n return this.processedNodes;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n trackBy(index: number, item: TreeItemRunTimeModel): any {\n return item.path;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n trackByControl(item: TreeItemRunTimeModel): any {\n return item;\n }\n\n getTreeItem(path: string): TreeItemModel {\n const indexArr: Array<number> = this.resolvePath(path);\n let nodeArr = this.processedNodes;\n let node;\n if (nodeArr && Array.isArray(nodeArr)) {\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n nodeArr = nodeArr && nodeArr[pathIndex]?.children;\n } else {\n node = nodeArr[pathIndex];\n }\n });\n }\n return node;\n }\n\n expandAll(): void {\n this.cdkTreeControl.expandAll();\n this.changeDetectorRef.markForCheck();\n }\n\n expandAt(path: string): void {\n this.getParentPaths(path).reverse().forEach((parentPath)=>{\n this.cdkTreeControl.expand(this.getRunTimeTreeItem(parentPath));\n });\n this.cdkTreeControl.expand(this.getRunTimeTreeItem(path));\n this.changeDetectorRef.detectChanges();\n }\n\n collapseAll(): void {\n this.cdkTreeControl.collapseAll();\n this.changeDetectorRef.markForCheck();\n }\n\n filterTerm(filterInput: string, filterKey?: string, showChildrenOfMatchedItems?: boolean): void {\n if (filterInput !== '' && filterInput !== null && typeof filterInput !== 'undefined') {\n this.treeDataRunTime = this.filterTreeData(structuredClone(this.treeDataRunTimeBackup), filterKey || 'label', filterInput, showChildrenOfMatchedItems);\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, { trackBy: this.trackByControl });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandMatched(this.treeDataRunTime);\n // this.expandAll();\n } else {\n this.treeDataRunTime = structuredClone(this.treeDataRunTimeBackup);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, { trackBy: this.trackByControl });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandAll();\n }\n }\n\n setAllSelection(isChecked: boolean): void {\n this.setIsCheckedForAll(this.treeDataRunTime, isChecked);\n this.changeDetectorRef.markForCheck();\n }\n\n updateTreeItem(givenTreeItem: TreeItemModel, path: string): void {\n const treeItem = structuredClone(givenTreeItem);\n if (treeItem && path) {\n this.setTreeData(path, this.processInputs([treeItem])[0]);\n const pathArr = path.split('.');\n const index = parseInt(pathArr.pop(), 10);\n const treeItemRuntime = this.calculateRunTimeState(treeItem, index, pathArr.join('.'));\n if (treeItemRuntime?.children?.length > 0) {\n treeItemRuntime.children = this.applyRunTimeLastItems(treeItemRuntime.children);\n }\n this.setTreeDataRunTimeBackup(path, treeItemRuntime);\n this.setTreeDataRunTime(path, treeItemRuntime);\n // itemRecursiveSelectionState\n const itemRecursiveSelectionState = this.calculateItemSelectionRecursiveState(treeItem);\n this.setRunTimeSelectionRecursiveStateTree(path, itemRecursiveSelectionState);\n this.syncStateChangesAtPath(path);\n // Rendering\n this.changeDetectorRef.detectChanges();\n this.treeComponentInstance.renderNodeChanges([]);\n this.treeComponentInstance.renderNodeChanges(this.treeDataRunTime);\n if (this.cdkTreeControl.isExpanded(treeItemRuntime) && !treeItem.node.isExpanded) {\n this.cdkTreeControl.toggle(treeItemRuntime);\n } else if (!this.cdkTreeControl.isExpanded(treeItemRuntime) && treeItem.node.isExpanded) {\n this.cdkTreeControl.expand(treeItemRuntime);\n }\n this.renderInitialExpand(this.getRunTimeTreeItem(path)?.children);\n this.getInitialSelection(this.getRunTimeTreeItem(path)?.children)?.forEach((runTimeItem) => {\n this.selectTreeItem(this.getRunTimeBackupTreeItem(runTimeItem.path));\n });\n this.changeDetectorRef.detectChanges();\n }\n }\n\n onNodeClick(treeRunTimeItem: TreeItemRunTimeModel): void {\n this.nodeClick.emit(this.getTreeItem(treeRunTimeItem?.path));\n if (this.isClickTogglingNode) {\n this.cdkTreeControl.toggle(treeRunTimeItem);\n this.onNodeToggle(treeRunTimeItem);\n }\n }\n\n onNodeToggle(treeRunTimeItem: TreeItemRunTimeModel): void {\n this.getTreeItem(treeRunTimeItem?.path).node.isExpanded = this.cdkTreeControl.isExpanded(treeRunTimeItem);\n this.nodeToggle.emit(this.getTreeItem(treeRunTimeItem?.path));\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nodeSelected(evt: any, path: string): void {\n const item = this.getTreeItem(path);\n const runTimeBackupTreeItem = this.getRunTimeBackupTreeItem(path);\n const renderedRunTimeTreeItem = this.getRunTimeTreeItem(path);\n const node = item.node;\n // console.log(path,item,runTimeTreeItem, renderedRunTimeTreeItem);\n if (!node?.selectConfig?.singleSelect) {\n node.isSelected = evt.target.checked;\n node.isIndeterminate = false;\n // If the node is recursive it sets every children with the change.\n if (renderedRunTimeTreeItem?.children && renderedRunTimeTreeItem?.children?.length > 0) {\n if (node?.selectConfig?.recursive) {\n // console.log(renderedRunTimeTreeItem);\n this.setIsCheckedForAll(renderedRunTimeTreeItem?.children, evt.target.checked);\n }\n }\n\n this.setRunTimeSelectionRecursiveStateTree(\n path,\n this.calculateItemSelectionRecursiveState(structuredClone(this.getTreeItem(path))),\n );\n if (renderedRunTimeTreeItem?.children && renderedRunTimeTreeItem?.children?.length >= 0) {\n if (node?.selectConfig?.recursive) {\n // this.setIsCheckedForAll(renderedRunTimeTreeItem?.children, evt.target.checked);\n this.runStateChangesForAll(renderedRunTimeTreeItem?.children);\n }\n this.treeComponentInstance?.renderNodeChanges([]);\n this.treeComponentInstance?.renderNodeChanges(this.treeDataRunTime);\n }\n this.syncStateChangesAtPath(path);\n if (this.getTreeItem(path).node.isSelected) {\n this.selectTreeItem(runTimeBackupTreeItem);\n } else {\n this.deselectTreeItem(runTimeBackupTreeItem);\n }\n const nodePathsSeq = this.getParentPaths(path);\n if (nodePathsSeq.length > 0) {\n nodePathsSeq.forEach((nodePath: string) => {\n const treeItem = this.getTreeItem(nodePath);\n const childStates = this.getRunTimeSelectionRecursiveState(nodePath).children.map((_) => _.selectionRecursiveState);\n this.updateRunTimeSelectionRecursiveState(\n nodePath,\n this.decideSelectionRecursiveState(\n childStates,\n treeItem.node?.isSelected,\n treeItem.node?.selectConfig?.recursive,\n treeItem.node?.selectConfig?.noAutoSelectParent,\n ),\n );\n this.syncStateChangesAtPath(nodePath);\n });\n this.changeDetectorRef.detectChanges();\n } else {\n this.changeDetectorRef.detectChanges();\n }\n } else {\n const prevItem = this.selectionModel.selected[0];\n if (evt.target.checked) {\n if (prevItem) {\n this.getTreeItem(prevItem.path).node.isSelected = false;\n this.selectionModel.deselect(prevItem);\n }\n item.node.isSelected = true;\n this.selectionModel.select(runTimeBackupTreeItem);\n } else {\n item.node.isSelected = false;\n this.selectionModel.deselect(runTimeBackupTreeItem);\n }\n if (this.highlightPath) {\n if (evt.target.checked && prevItem) {\n const prevItemNodePathsSeq = this.getParentPaths(prevItem.path);\n if (prevItemNodePathsSeq.length > 0) {\n prevItemNodePathsSeq.forEach((nodePath: string) => {\n this.updateRunTimeSelectionRecursiveState(nodePath, 'allNotSelected');\n this.syncStateChangesAtPath(nodePath);\n });\n }\n }\n const nodePathsSeq = this.getParentPaths(path);\n if (nodePathsSeq?.length > 0) {\n nodePathsSeq.forEach((nodePath: string) => {\n this.updateRunTimeSelectionRecursiveState(nodePath, evt.target.checked ? 'indeterminate' : 'allNotSelected');\n this.syncStateChangesAtPath(nodePath);\n });\n this.changeDetectorRef.detectChanges();\n }\n }\n }\n }\n\n hasChild = (_: number, item: TreeItemRunTimeModel): boolean => !!item?.children && item?.children?.length >= 0;\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onSelectFn(path: string): (evt: any) => void {\n if (this.getTreeItem(path)?.node?.selectable) {\n const nodeSelected = this.nodeSelected.bind(this);\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (evt: any) => nodeSelected(evt, path);\n }\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (evt: any) => {\n console.warn('treeItemModel.node.selectable is false, you can not implement onSelect');\n };\n }\n\n getRunTimeSelectionRecursiveState(path: string): TreeItemSelectionRecursiveModel {\n const indexArr: Array<number> = this.resolvePath(path);\n let nodeArr = this.runTimeSelectionRecursiveState;\n let node;\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n nodeArr = nodeArr[pathIndex]?.children;\n } else {\n node = nodeArr[pathIndex];\n }\n });\n return node;\n }\n\n private initTree(): void {\n if (this.nodes) {\n this._isMultiLevel = this.checkIfMultiLevel(this.nodes);\n this.processedNodes = this.processInputs(structuredClone(this.nodes));\n this.treeDataRunTime = this.createTreeDataRuntime(this.processedNodes);\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.runTimeSelectionRecursiveState = this.createRunTimeSelectionRecursiveState(this.processedNodes);\n this.treeDataRunTimeBackup = structuredClone(this.treeDataRunTime);\n // todo It should be configurable, 800, 2 and 400 are hard coded right now\n if (this.treeDataRunTimeBackup.length > 800) {\n this.treePagination = new EuiTreePagination<TreeItemRunTimeModel>(this.treeDataRunTimeBackup, 1, 2, 400);\n const paginatedData = this.treePagination.getViewData().data;\n this.cdkArrayDataSource = new ArrayDataSource<TreeItemRunTimeModel>(paginatedData);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = paginatedData;\n this.runScrollListener();\n } else {\n this.cdkArrayDataSource = new ArrayDataSource<TreeItemRunTimeModel>(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n }\n this.renderInitialExpand(this.treeDataRunTime);\n this.selectionModel = new SelectionModel<TreeItemRunTimeModel>(\n true,\n this.getInitialSelection(this.treeDataRunTime),\n true,\n (a, b) => a?.path === b?.path,\n );\n this._selection = [...this.selectionModel.selected]?.map((item) => this.getTreeItem(item?.path));\n this.renderTree = true;\n if (this.selectionModelSubs) {\n this.selectionModelSubs.unsubscribe();\n }\n this.selectionModelSubs = this.selectionModel.changed.pipe(debounceTime(1)).subscribe((sc) => {\n const selectionChange = {\n added: sc.added.map((_) => this.getTreeItem(_.path)),\n removed: sc.removed.map((_) => this.getTreeItem(_.path)),\n selection: [...this.selectionModel.selected].map((item) => this.getTreeItem(item.path)),\n };\n this._selection = selectionChange.selection;\n this.selectionChange.emit(selectionChange);\n });\n this.changeDetectorRef.markForCheck();\n }\n }\n\n private processInputs(treeData: TreeDataModel): TreeDataModel {\n if (this.isMultiselect) {\n treeData = this.overrideTreeDataModelForSelection(treeData, this.isRecursiveSelection, !this.isRecursiveParentSelection);\n }\n if (this.isSingleSelect) {\n treeData = this.overrideTreeDataModelForSelection(treeData, false, false, true);\n }\n return treeData;\n }\n\n private overrideTreeDataModelForSelection(\n nodeArr: TreeDataModel,\n isRecursive: boolean,\n noAutoSelectParent: boolean,\n singleSelect?: boolean,\n ): TreeDataModel {\n return nodeArr?.map((item: TreeItemModel, index: number) => {\n if (item?.children && item.children.length > 0) {\n return {\n ...item,\n node: {\n ...item.node,\n selectable: typeof item?.node?.selectable === 'undefined' ? true : item?.node?.selectable,\n // isSelected: false,\n // isIndeterminate: false,\n selectConfig: {\n ...item.node.selectConfig,\n recursive:\n typeof item?.node?.selectConfig?.recursive === 'undefined'\n ? !!isRecursive\n : item?.node?.selectConfig?.recursive,\n noAutoSelectParent:\n typeof item?.node?.selectConfig?.noAutoSelectParent === 'undefined'\n ? noAutoSelectParent\n : item?.node?.selectConfig?.noAutoSelectParent,\n singleSelect:\n typeof item?.node?.selectConfig?.singleSelect === 'undefined'\n ? singleSelect\n : item?.node?.selectConfig?.singleSelect,\n },\n },\n children: this.overrideTreeDataModelForSelection(item.children, isRecursive, noAutoSelectParent, singleSelect),\n };\n } else {\n return {\n ...item,\n node: {\n ...item.node,\n selectable: typeof item?.node?.selectable === 'undefined' ? true : item?.node?.selectable,\n selectConfig: {\n ...item.node?.selectConfig,\n singleSelect:\n typeof item?.node?.selectConfig?.singleSelect === 'undefined'\n ? singleSelect\n : item?.node?.selectConfig?.singleSelect,\n },\n },\n };\n }\n });\n }\n\n private runScrollListener(): void {\n this.scrollDispatcherSubs = this.scrollDispatcher.scrolled().subscribe((scrollable: CdkScrollable) => {\n if (scrollable && this.checkIfCurrentScrollable(scrollable)) {\n const isAtBottom =\n scrollable?.getElementRef().nativeElement.scrollTop + scrollable?.getElementRef().nativeElement.clientHeight >=\n scrollable?.getElementRef().nativeElement.scrollHeight;\n const isAtTop = scrollable?.getElementRef().nativeElement.scrollTop === 0;\n // console.log('Element:', this.cdkScrollableRef.getElementRef());\n if (isAtBottom && !this.treePagination.isAtMax()) {\n if (this.nodes.length > 0) {\n this.treeDataRunTime = this.treePagination.paginateNext().data;\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandAll();\n const totalHeight = scrollable.measureScrollOffset('bottom') + scrollable.measureScrollOffset('top');\n const viewportHeight = scrollable.getElementRef().nativeElement.clientHeight;\n const positionToScroll = totalHeight - viewportHeight;\n scrollable.scrollTo({ top: positionToScroll / 2 });\n }\n } else if (isAtTop && this.treePagination.getCurrentStartPage() > 1) {\n if (this.nodes.length > 0) {\n this.treeDataRunTime = this.treePagination.paginatePrev().data;\n this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);\n this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);\n this.cdkTreeControl = new NestedTreeControl<TreeItemRunTimeModel>((node) => node?.children, {\n trackBy: this.trackByControl,\n });\n this.cdkTreeControl.dataNodes = this.treeDataRunTime;\n this.renderTree = false;\n this.changeDetectorRef.detectChanges();\n this.renderTree = true;\n this.changeDetectorRef.detectChanges();\n this.expandAll();\n const totalHeight = scrollable.measureScrollOffset('bottom') + scrollable.measureScrollOffset('top');\n const viewportHeight = scrollable.getElementRef().nativeElement.clientHeight;\n const positionToScroll = totalHeight - viewportHeight;\n scrollable.scrollTo({ top: positionToScroll / 2 + viewportHeight });\n }\n }\n }\n });\n }\n\n private getSelectionIndexOfItem(runTimeTreeItem: TreeItemRunTimeModel): number {\n return this.selectionModel.selected.findIndex((i) => i?.path === runTimeTreeItem?.path);\n }\n\n private selectTreeItem(runTimeBackupTreeItem: TreeItemRunTimeModel): void {\n const indexOfItem = this.getSelectionIndexOfItem(runTimeBackupTreeItem);\n if (indexOfItem === -1) {\n this.selectionModel.select(runTimeBackupTreeItem);\n }\n }\n\n private deselectTreeItem(runTimeTreeItem: TreeItemRunTimeModel): void {\n const indexOfItem = this.getSelectionIndexOfItem(runTimeTreeItem);\n if (indexOfItem > -1) {\n const newSelection = [...this.selectionModel.selected];\n newSelection.splice(indexOfItem, 1);\n this.selectionModel.setSelection(...newSelection);\n }\n }\n\n private createTreeDataRuntime(nodes: TreeDataModel): TreeDataRunTimeModel {\n return structuredClone(nodes)?.map((item, index) => {\n return this.calculateRunTimeState(item, index);\n });\n }\n\n private applyRunTimeLastItems(items: TreeDataRunTimeModel): TreeDataRunTimeModel {\n return items?.map((item, index) => {\n if (item?.children) {\n return {\n ...item,\n last: items.length === index + 1 ? true : undefined,\n children: item.children?.length > 0 ? this.applyRunTimeLastItems(item.children) : item?.children,\n };\n } else {\n return {\n ...item,\n last: items.length === index + 1 ? true : undefined,\n };\n }\n });\n }\n\n private createRunTimeSelectionRecursiveState(nodes: TreeDataModel): Array<TreeItemSelectionRecursiveModel> {\n return structuredClone(nodes)?.map((item) => this.calculateItemSelectionRecursiveState({ ...item }));\n }\n\n // Creating run time state which includes children selection state for selection tree.\n private calculateItemSelectionRecursiveState(treeItem: TreeItemModel): TreeItemSelectionRecursiveModel {\n const childrenSelectionRecursive: Array<TreeItemSelectionRecursiveModel> = [];\n if (treeItem.children && treeItem.children.length > 0) {\n treeItem.children.forEach((child, index) => {\n childrenSelectionRecursive[index] = this.calculateItemSelectionRecursiveState(child);\n });\n }\n const childStates = childrenSelectionRecursive.map((_) => _.selectionRecursiveState);\n const itemState: SelectionRecursiveState = this.decideSelectionRecursiveState(\n childStates,\n treeItem.node.isSelected,\n treeItem.node?.selectConfig?.recursive,\n treeItem.node?.selectConfig?.noAutoSelectParent,\n );\n return {\n selectionRecursiveState: itemState,\n children: childrenSelectionRecursive,\n };\n }\n\n private decideSelectionRecursiveState(\n childStates: Array<SelectionRecursiveState> = [],\n isSelected: boolean,\n recursive: boolean,\n noAutoSelectParent: boolean,\n ): SelectionRecursiveState {\n let itemState: SelectionRecursiveState = 'indeterminate';\n if (isSelected && childStates.every((state) => state === 'allSelected')) {\n itemState = 'allSelected';\n } else if (!isSelected && childStates.every((state) => state === 'allNotSelected')) {\n itemState = 'allNotSelected';\n } else if (recursive && childStates.every((state) => state === 'allSelected') && !isSelected && !noAutoSelectParent) {\n itemState = 'allSelected';\n } else if (recursive && childStates.every((state) => state === 'allNotSelected') && isSelected) {\n itemState = 'allNotSelected';\n }\n return itemState;\n }\n\n private syncStateChangesAtPath(nodePath): void {\n const treeItem = this.getTreeItem(nodePath);\n const runTimeBackupTreeItem = this.getRunTimeBackupTreeItem(nodePath);\n const runTimeSelectionRecursiveItem = this.getRunTimeSelectionRecursiveState(nodePath);\n if (treeItem?.node?.selectable && treeItem.node?.selectConfig?.recursive) {\n if (!treeItem.node?.selectConfig?.noAutoSelectParent) {\n treeItem.node = {\n ...treeItem.node,\n isSelected: runTimeSelectionRecursiveItem.selectionRecursiveState === 'allSelected',\n isIndeterminate: runTimeSelectionRecursiveItem.selectionRecursiveState === 'indeterminate',\n };\n } else {\n treeItem.node = {\n ...treeItem.node,\n isSelected: treeItem.node.isSelected && runTimeSelectionRecursiveItem.selectionRecursiveState === 'allSelected',\n isIndeterminate:\n runTimeSelectionRecursiveItem.selectionRecursiveState === 'indeterminate' ||\n (!treeItem.node.isSelected && runTimeSelectionRecursiveItem.selectionRecursiveState === 'allSelected'),\n };\n }\n // console.log(treeItem, treeItem.node.treeContentBlock.label, 'isSelected:' + treeItem.node.isSelected, 'isIndeterminate:' + treeItem.node.isIndeterminate);\n if (treeItem.node.isSelected === true && !this.selectionModel.isSelected(runTimeBackupTreeItem)) {\n this.selectTreeItem(runTimeBackupTreeItem);\n } else if (treeItem.node.isSelected === false && this.selectionModel.isSelected(runTimeBackupTreeItem)) {\n this.deselectTreeItem(runTimeBackupTreeItem);\n }\n }\n }\n\n private setTreeData(path: string, item: TreeItemModel): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.processedNodes;\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = item;\n }\n });\n }\n\n private setTreeDataRunTimeBackup(path: string, item: TreeItemRunTimeModel): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.treeDataRunTimeBackup;\n indexArr.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = item;\n }\n });\n }\n\n private setTreeDataRunTime(path: string, item: TreeItemRunTimeModel): void {\n const oldItem = this.getRunTimeTreeItem(path);\n if(oldItem){\n Object.keys(item)?.forEach(key => {\n oldItem[key] = item[key];\n });\n }\n }\n\n private setRunTimeSelectionRecursiveStateTree(path: string, item: TreeItemSelectionRecursiveModel): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.runTimeSelectionRecursiveState;\n indexArr.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = item;\n }\n });\n }\n\n private updateRunTimeSelectionRecursiveState(path: string, selectionRecursiveState: SelectionRecursiveState): void {\n const indexArr: Array<number> = this.resolvePath(path);\n let itemArr = this.runTimeSelectionRecursiveState;\n indexArr.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n itemArr = itemArr[pathIndex]?.children;\n } else {\n itemArr[pathIndex] = {\n ...itemArr[pathIndex],\n selectionRecursiveState,\n };\n }\n });\n }\n\n private setIsCheckedForAll(nodeArr: Array<TreeItemRunTimeModel>, isChecked: boolean): void {\n nodeArr.forEach((runTimeItem: TreeItemRunTimeModel, index: number) => {\n const runtimeBackupTreeItem = this.getRunTimeBackupTreeItem(runTimeItem.path);\n const treeItem = this.getTreeItem(runTimeItem.path);\n const node = treeItem.node;\n if (node?.selectable) {\n node.isSelected = isChecked;\n node.isIndeterminate = false;\n if (isChecked) {\n this.selectTreeItem(runtimeBackupTreeItem);\n } else {\n this.deselectTreeItem(runtimeBackupTreeItem);\n }\n }\n if (runTimeItem?.children?.length > 0) {\n this.setIsCheckedForAll(nodeArr[index].children, isChecked);\n }\n });\n }\n\n private runStateChangesForAll(nodeArr: Array<TreeItemRunTimeModel>): void {\n nodeArr?.forEach((runTimeItem: TreeItemRunTimeModel, index: number) => {\n if (runTimeItem?.children?.length >= 0) {\n this.runStateChangesForAll(nodeArr[index].children);\n this.syncSelectionAtPath(runTimeItem);\n }\n });\n }\n\n private syncSelectionAtPath(runTimeTreeItem: TreeItemRunTimeModel): void {\n // It is here for the filter edge case.\n this.syncStateChangesAtPath(runTimeTreeItem.path);\n // Sets isSelected change on the control.\n if (this.getTreeItem(runTimeTreeItem.path).node.isSelected) {\n this.selectTreeItem(this.getRunTimeBackupTreeItem(runTimeTreeItem.path));\n } else {\n this.deselectTreeItem(this.getRunTimeBackupTreeItem(runTimeTreeItem.path));\n }\n }\n\n private resolvePath(path: string): Array<number> {\n return path?.split('.').map((index: string) => parseInt(index, 10));\n }\n\n private getParentPaths(path: string): Array<string> {\n const pathArr = path.split('.');\n const hasParent = pathArr.length > 1;\n // Sets the hasParent If there is a parent, and removes the last element form pathArr.\n if (hasParent) {\n pathArr.pop();\n // Calculates parent path\n const parentPath = pathArr.join('.');\n // Creating node index sequence f.e If path is '1.2' it will be [1,2]\n const nodeIndexSeq = parentPath.split('.').map((indexStr) => parseInt(indexStr, 10));\n // Calculating the node paths array to be re-calculated from bottom to top\n const nodePathsSeq = [];\n nodeIndexSeq.forEach((nodeIndex, index) => {\n nodePathsSeq[index] = nodeIndexSeq.slice(0, index + 1).join('.');\n });\n return nodePathsSeq.reverse();\n } else {\n return [];\n }\n }\n\n private calculateRunTimeState(treeItem: TreeItemModel, index: number, parentPath?: string): TreeItemRunTimeModel {\n const runTimeTreeItem: TreeItemRunTimeModel = {\n path: parentPath ? parentPath + '.' + index : index.toString(),\n index,\n };\n if (treeItem.children && treeItem.children.length >= 0) {\n runTimeTreeItem.children = [];\n treeItem.children.forEach((child, treeItemIndex) => {\n runTimeTreeItem.children[treeItemIndex] = this.calculateRunTimeState(child, treeItemIndex, runTimeTreeItem.path);\n });\n }\n return runTimeTreeItem;\n }\n\n private filterTreeData(runTimeTreeData: TreeDataRunTimeModel, key = 'label', filterStr: string, showChildren: boolean, show?:boolean): TreeDataRunTimeModel {\n return runTimeTreeData.filter((runTimeItem) => {\n const targetData = this.getTreeItem(runTimeItem.path).node.treeContentBlock[key];\n if (\n targetData && this.normalizedStr(targetData)?.includes(this.normalizedStr(filterStr))\n ) {\n if(runTimeItem?.children?.length > 0){\n runTimeItem.children = this.filterTreeData(runTimeItem.children, key, filterStr, showChildren, showChildren);\n }\n Object.assign(runTimeItem,{ matched: true })\n // runTimeItem.matched = true;\n return true;\n } else if (runTimeItem?.children?.length > 0) {\n runTimeItem.children = this.filterTreeData(runTimeItem.children, key, filterStr, showChildren, show);\n runTimeItem.children = runTimeItem.children.length > 0 ? runTimeItem.children : undefined;\n return runTimeItem?.children?.length > 0 || show;\n } else {\n return show;\n }\n });\n }\n\n private normalizedStr(str: string): string {\n return str\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '');\n }\n\n private getInitialSelection(nodes: TreeDataRunTimeModel): Array<TreeItemRunTimeModel> {\n const selection: Array<TreeItemRunTimeModel> = [];\n this.scanSelection(nodes, selection);\n return selection;\n }\n\n private scanSelection(nodes: TreeDataRunTimeModel, selection: Array<TreeItemRunTimeModel>): void {\n nodes.forEach((item: TreeItemRunTimeModel) => {\n if (this.getTreeItem(item.path).node?.selectable && this.getTreeItem(item.path).node.isSelected) {\n selection.push(item);\n }\n if (item?.children?.length > 0) {\n this.scanSelection(item.children, selection);\n }\n });\n }\n\n private renderInitialExpand(nodes: TreeDataRunTimeModel): void {\n nodes.forEach((item: TreeItemRunTimeModel) => {\n if (item?.children?.length > 0) {\n this.renderInitialExpand(item.children);\n }\n if (typeof this.getTreeItem(item.path).node.isExpanded !== 'undefined') {\n if(this.getTreeItem(item.path).node.isExpanded && !this.cdkTreeControl.isExpanded(item)){\n this.expandAt(item.path);\n }else if(!this.getTreeItem(item.path).node.isExpanded && this.cdkTreeControl.isExpanded(item)){\n this.cdkTreeControl.collapse(item);\n }\n }\n });\n }\n\n private expandMatched(nodes: TreeDataRunTimeModel): void {\n nodes.forEach((item: TreeItemRunTimeModel) => {\n if (item.matched) {\n const parentPath = this.getParentPaths(item.path)[0];\n if (parentPath) {\n let parentTreeItem = this.getTreeItem(parentPath);\n parentTreeItem = {\n ...parentTreeItem,\n node: {\n ...parentTreeItem.node,\n isExpanded: true,\n },\n };\n // node.isExpanded = true;\n // console.log(\"here\", parentTreeItem.node.treeContentBlock.label, parentPath, item);\n this.expandAt(parentPath);\n }\n }\n if (item?.children?.length > 0) {\n this.expandMatched(item.children);\n }\n });\n }\n\n private getRunTimeTreeItem(path: string): TreeItemRunTimeModel {\n return this.findRunTimeTreeItem(this.treeDataRunTime, path);\n }\n\n private findRunTimeTreeItem(treeDataRunTime: TreeDataRunTimeModel, path): TreeItemRunTimeModel {\n for (const runTimeItem of treeDataRunTime) {\n if (runTimeItem.path === path) {\n return runTimeItem;\n } else if (runTimeItem?.children?.length > 0) {\n const found = this.findRunTimeTreeItem(runTimeItem.children, path);\n if (found) {\n return found;\n }\n }\n }\n return null;\n }\n\n private getRunTimeBackupTreeItem(path: string): TreeItemRunTimeModel {\n const indexArr: Array<number> = this.resolvePath(path);\n let nodeArr = this.treeDataRunTimeBackup;\n let node;\n if (nodeArr && Array.isArray(nodeArr)) {\n indexArr?.forEach((pathIndex: number, index) => {\n if (index < indexArr.length - 1) {\n nodeArr = nodeArr && nodeArr[pathIndex]?.children;\n } else {\n node = nodeArr[pathIndex];\n }\n });\n }\n return node;\n }\n\n private getCssClasses(): string {\n return [\n 'eui-tree',\n this.isMultiselect ? 'eui-tree--multiselect' : '',\n this._isMultiLevel ? 'eui-tree--with-children' : '',\n this._showLines ? 'eui-tree--show-lines' : '',\n ]\n .join(' ')\n .trim();\n }\n\n private checkIfMultiLevel(tree: TreeDataModel): boolean {\n let isMultiLevel = false;\n tree.forEach((item: TreeItemModel) => {\n if (item?.children?.length >= 0) {\n isMultiLevel = true;\n }\n });\n return isMultiLevel;\n }\n\n private checkIfCurrentScrollable(scrolled: CdkScrollable): boolean {\n return scrolled.getElementRef().nativeElement === this.cdkScrollableRef.getElementRef().nativeElement;\n }\n}\n\n@NgModule({\n imports: [\n CommonModule,\n RouterModule,\n FormsModule,\n TranslateModule,\n EuiInputCheckboxModule,\n CdkTreeModule,\n EuiButtonModule,\n EuiIconModule,\n EuiLabelModule,\n EuiBadgeModule,\n EuiChipModule,\n EuiDropdownModule,\n ScrollingModule,\n ],\n declarations: [EuiTreeComponent],\n exports: [EuiTreeComponent],\n})\nexport class EuiTreeModule {}\n", "<div class=\"eui-ul-rep eui-tree__wrapper\" cdkScrollable #cdkScrollableRef>\n <cdk-tree\n #treeComponentInstance\n [dataSource]=\"cdkArrayDataSource\"\n [treeControl]=\"cdkTreeControl\"\n [trackBy]=\"trackBy\"\n *ngIf=\"renderTree\"\n class=\"eui-cdk-tree\">\n <!-- There are two states of generic cdk-nested-tree-node declarations.\n First one is without child. No sub rendering.\n -->\n <cdk-nested-tree-node *cdkTreeNodeDef=\"let treeRunTimeItemModel\" class=\"eui-cdk-nested-tree-node\">\n <div *ngIf=\"treeRunTimeItemModel\"\n class=\"eui-li-rep eui-tree-node\"\n [class.eui-tree-node--first]=\"treeRunTimeItemModel?.path === '0'\"\n [class.eui-tree-node--last]=\"treeRunTimeItemModel.last\"\n title=\"{{\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div class=\"eui-tree-node-wrapper\"\n (click)=\"onNodeClick(treeRunTimeItemModel)\">\n <div class=\"eui-tree-node-wrapper__container\">\n <!--\n Renders node in default or provided template's context.\n Generates onSelect with onSelectFn for developers to send the events from their custom check events.\n Provides id to be used on generic template\n -->\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplateRef || nodeTemplateDefault\"\n [ngTemplateOutletContext]=\"{\n $implicit: getTreeItem(treeRunTimeItemModel?.path)?.node,\n onSelect: onSelectFn(treeRunTimeItemModel.path),\n id: uid + treeRunTimeItemModel.path,\n path: treeRunTimeItemModel.path\n }\">\n </ng-container>\n </div>\n </div>\n </div>\n </cdk-nested-tree-node>\n <!-- This is the tree node template for expandable nodes -->\n <cdk-nested-tree-node\n *cdkTreeNodeDef=\"let treeRunTimeItemModel; when: hasChild\"\n class=\"eui-cdk-nested-tree-node eui-cdk-nested-tree-node--with-child\">\n <div\n class=\"eui-li-rep eui-tree-node eui-tree-node--with-child\"\n [class.eui-tree-node--first]=\"treeRunTimeItemModel?.path === '0'\"\n [class.eui-tree-node--last]=\"treeRunTimeItemModel.last\"\n *ngIf=\"treeRunTimeItemModel\"\n title=\"{{\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div\n class=\"eui-tree-node-wrapper\">\n <!--Here wraps the node, and listen for node clicks.-->\n <div (click)=\"onNodeClick(treeRunTimeItemModel)\" class=\"eui-tree-node-wrapper__container\">\n <!-- Expand/collapse action button -->\n <button\n euiButton\n euiIconButton\n euiBasicButton\n euiRounded\n euiSizeS\n type=\"button\"\n [attr.aria-label]=\"'Toggle ' + getTreeItem(treeRunTimeItemModel?.path)?.node?.treeContentBlock?.label\"\n (click)=\"onNodeToggle(treeRunTimeItemModel)\"\n cdkTreeNodeToggle\n class=\"eui-tree-node__button\">\n <eui-icon-svg\n *ngIf=\"!cdkTreeControl.isExpanded(treeRunTimeItemModel) && !collapsedIconClass\"\n [icon]=\"expandedSvgIconClass\"></eui-icon-svg>\n <eui-icon-svg\n *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel) && !expandedIconClass\"\n [icon]=\"collapsedSvgIconClass\"></eui-icon-svg>\n </button>\n <!--\n Renders node in default or provided template's context.\n Generates onSelect with onSelectFn for developers to send the events from their custom check events.\n Provides id to be used on generic template\n -->\n <ng-container\n [ngTemplateOutlet]=\"nodeTemplateRef || nodeTemplateDefault\"\n [ngTemplateOutletContext]=\"{\n $implicit: getTreeItem(treeRunTimeItemModel.path)?.node,\n onSelect: onSelectFn(treeRunTimeItemModel.path),\n id: uid + treeRunTimeItemModel.path,\n path: treeRunTimeItemModel.path,\n children: getTreeItem(treeRunTimeItemModel?.path)?.children\n }\">\n </ng-container>\n </div>\n </div>\n <!--uses cdkTreeNodeOutlet to render children nodes, CdkTreeControl is used to control isExpanded state.-->\n <div class=\"eui-ul-rep eui-tree-node\" role=\"group\" *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel)\">\n <ng-container cdkTreeNodeOutlet></ng-container>\n </div>\n </div>\n </cdk-nested-tree-node>\n </cdk-tree>\n</div>\n\n<ng-template #nodeTemplateDefault let-node let-onSelect=\"onSelect\" let-id=\"id\" let-path=\"path\">\n <ng-container *ngIf=\"node\">\n <div class=\"eui-tree-node-wrapper__container-left\" [class.eui-tree-node-wrapper__container-left--selected]=\"node?.isSelected\">\n <!--input checkbox area-->\n <input\n euiInputCheckBox\n *ngIf=\"node && node.selectable\"\n type=\"checkbox\"\n id=\"{{ id }}\"\n [checked]=\"!!node?.isSelected\"\n [indeterminate]=\"!!node?.isIndeterminate\"\n (change)=\"onSelect($event)\"\n class=\"eui-u-mr-m\" />\n\n <!--icon area-->\n <ng-container *ngIf=\"node?.treeContentBlock?.iconSvgName\">\n <eui-icon-svg\n icon=\"{{ node?.treeContentBlock?.iconSvgName }}\"\n fillColor=\"{{ node?.treeContentBlock?.iconTypeClass || 'neutral' }}\"\n size=\"s\"\n class=\"eui-u-mr-xs\">\n </eui-icon-svg>\n </ng-container>\n\n <!--chips area-->\n <ng-container *ngIf=\"node?.treeContentBlock?.chips\">\n <eui-chip\n *ngFor=\"let chip of node.treeContentBlock.chips\"\n euiSizeXS\n [euiVariant]=\"chip.typeClass || 'secondary'\"\n [euiOutline]=\"chip.isOutline\"\n class=\"eui-chip--rounded eui-u-mb-none eui-u-mr-xs\">\n <span euiLabel>{{ chip.label }}</span>\n </eui-chip>\n </ng-container>\n\n <!--badge (typeLabel & typeClass) area-->\n <ng-container *ngIf=\"node?.treeContentBlock?.typeLabel\" [ngSwitch]=\"node?.treeContentBlock?.typeClass\">\n <eui-badge euiSizeM [euiVariant]=\"node?.treeContentBlock?.typeClass || 'primary'\" class=\"eui-u-flex-no-shrink eui-u-mr-xs\">\n {{ node?.treeContentBlock?.typeLabel }}\n </eui-badge>\n </ng-container>\n </div>\n\n <!--label area-->\n <div class=\"eui-tree-node-wrapper__container-middle\">\n <label\n *ngIf=\"!node?.treeContentBlock?.url && !node?.treeContentBlock?.urlExternal\"\n euiLabel\n for=\"{{ id }}\"\n class=\"eui-u-text-truncate eui-u-p-2xs\"\n [class.eui-label--selected]=\"\n highlightPath\n ? getRunTimeSelectionRecursiveState(path)?.selectionRecursiveState === 'indeterminate' || node?.isSelected\n : node?.isSelected\n \"\n [class.eui-u-cursor-pointer]=\"node?.selectable\">\n {{ autoTranslate ? (node?.treeContentBlock?.label | translate) : node?.treeContentBlock?.label }}\n </label>\n <label *ngIf=\"node?.treeContentBlock?.url\" euiLabel for=\"{{ id }}\" class=\"eui-u-text-truncate eui-u-p-2xs\">\n <a\n class=\"eui-u-text-link\"\n [class.eui-u-text-link-standalone]=\"!showUnderlinedLinks\"\n [routerLink]=\"node?.treeContentBlock?.url\">\n {{ autoTranslate ? (node?.treeContentBlock?.label | translate) : node?.treeContentBlock?.label }}\n </a>\n </label>\n <label *ngIf=\"node?.treeContentBlock?.urlExternal\" euiLabel for=\"{{ id }}\" class=\"eui-u-text-truncate eui-u-p-2xs\">\n <a\n class=\"eui-u-text-link-external\"\n [class.eui-u-text-link-external-standalone]=\"!showUnderlinedLinks\"\n href=\"{{ node?.treeContentBlock?.urlExternal }}\"\n target=\"{{ node?.treeContentBlock?.urlExternalTarget || 'blank' }}\">\n {{ autoTranslate ? (node?.treeContentBlock?.label | translate) : node?.treeContentBlock?.label }}\n </a>\n </label>\n </div>\n\n <div *ngIf=\"node?.treeContentBlock?.rightContent\" class=\"eui-tree-node-wrapper__container-right\">\n <!--badges area-->\n <ng-container *ngFor=\"let badge of node.treeContentBlock.rightContent?.badges\">\n <eui-badge euiSizeM euiOutline [euiVariant]=\"badge.typeClass || 'secondary'\" class=\"eui-u-ml-xs\">\n <span euiLabel>{{ badge.label }}</span>\n </eui-badge>\n </ng-container>\n\n <!--chips area-->\n <ng-container *ngFor=\"let chip of node.treeContentBlock.rightContent?.chips\">\n <eui-chip\n euiSizeXS\n [euiVariant]=\"chip.typeClass || 'secondary'\"\n [euiOutline]=\"chip.isOutline\"\n class=\"eui-chip--rounded eui-u-mb-none eui-u-ml-xs\">\n <span euiLabel>{{ chip.label }}</span>\n </eui-chip>\n </ng-container>\n\n <!--Context menu-->\n <ng-container *ngIf=\"node.treeContentBlock.rightContent?.contextMenuMetaData && rightContextMenuTemplateRef\">\n <eui-dropdown class=\"eui-u-ml-xs\">\n <button euiButton euiSizeS euiRounded euiIconButton euiBasicButton euiSecondary [attr.aria-label]=\"'Options menu'\">\n <eui-icon-svg icon=\"ellipsis-vertical:sharp\"></eui-icon-svg>\n </button>\n <eui-dropdown-content>\n <ng-template\n [ngTemplateOutlet]=\"rightContextMenuTemplateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: node?.treeContentBlock?.rightContent?.contextMenuMetaData,\n metadata: node?.treeContentBlock?.rightContent?.contextMenuMetaData\n }\">\n </ng-template>\n </eui-dropdown-content>\n </eui-dropdown>\n </ng-container>\n </div>\n\n <!--metadata, uses the help of ng template to generate dynamic expand variable without handling state -->\n <ng-container\n *ngIf=\"node.treeContentBlock?.metadata && nodeContentMetadataTemplateRef\"\n [ngTemplateOutlet]=\"nodeContentMetadataContainer\"\n [ngTemplateOutletContext]=\"{\n $implicit: { expanded: false }\n }\">\n </ng-container>\n <ng-template #nodeContentMetadataContainer let-metaDataContainer>\n <button\n euiButton\n euiBasicButton\n euiIconButton\n euiRounded\n euiSizeS\n type=\"button\"\n aria-label=\"expand collapse tree item\"\n (click)=\"metaDataContainer.expanded = !metaDataContainer.expanded\">\n <eui-icon-svg [icon]=\"metaDataContainer.expanded ? 'chevron-down:sharp' : 'chevron-forward:sharp'\"></eui-icon-svg>\n </button>\n <div *ngIf=\"metaDataContainer.expanded\" class=\"eui-tree-node__metacontent\">\n <!--passing metadata of the node content to provided template-ref:nodeContentMetadataTemplateRef-->\n <ng-template\n [ngTemplateOutlet]=\"nodeContentMetadataTemplateRef\"\n [ngTemplateOutletContext]=\"{\n $implicit: node?.treeContentBlock?.metadata,\n metadata: node?.treeContentBlock?.metadata\n }\">\n </ng-template>\n </div>\n </ng-template>\n </ng-container>\n</ng-template>\n", "import {\n Directive,\n Host,\n AfterContentInit,\n ContentChild,\n Input,\n TemplateRef,\n AfterViewInit,\n ChangeDetectorRef,\n ElementRef,\n Renderer2,\n NgModule,\n} from '@angular/core';\nimport { EuiTreeComponent } from './eui-tree.component';\nimport { TreeDataModel } from './eui-tree.model';\nimport { EuiDropdownComponent } from '@eui/components/eui-dropdown';\nimport { CommonModule } from '@angular/common';\n\n@Directive({\n selector: 'eui-dropdown[euiDropdownTree]',\n})\nexport class EuiDropdownTreeDirective implements AfterContentInit, AfterViewInit {\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() buttonTemplateRef: TemplateRef<any>;\n @ContentChild(EuiTreeComponent, { static: false }) euiTree: EuiTreeComponent;\n\n private buttonLabel: string;\n private buttonViewRef;\n\n constructor(\n private changeDetectorRef: ChangeDetectorRef,\n private hostElement: ElementRef,\n private renderer: Renderer2,\n @Host() private euiDropdown: EuiDropdownComponent,\n ) {}\n\n ngAfterContentInit(): void {\n this.buttonLabel = this.createButtonLabel(this.euiTree.getSelection());\n this.euiTree.selectionChange.subscribe((selectionChanges) => {\n this.buttonLabel = this.createButtonLabel(selectionChanges.selection);\n this.buttonViewRef.context.$implicit = this.buttonLabel;\n this.buttonViewRef.detectChanges();\n });\n }\n\n ngAfterViewInit(): void {\n if (this.buttonTemplateRef) {\n const triggerContainer = this.hostElement.nativeElement.querySelector('.eui-dropdown__trigger-container');\n if (!triggerContainer) {\n console.error('Could not find the triggerContainer');\n return;\n }\n while (triggerContainer.firstChild) {\n triggerContainer.removeChild(triggerContainer.firstChild);\n }\n this.buttonViewRef = this.buttonTemplateRef.createEmbeddedView({ $implicit: this.buttonLabel });\n this.buttonViewRef.detectChanges();\n\n this.buttonViewRef.rootNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.renderer.appendChild(triggerContainer, node);\n }\n });\n }\n }\n\n private createButtonLabel(selection: TreeDataModel): string {\n if (selection?.length > 0) {\n return this.euiTree\n .getSelection()\n ?.map((item) => item.node.treeContentBlock.label)\n .join(',') as string;\n }\n return 'No node selected.';\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [EuiDropdownTreeDirective],\n declarations: [EuiDropdownTreeDirective],\n})\nexport class EuiDropdownTreeDirectiveModule {}\n", "import { TreeDataModel, TreeItemModel } from './eui-tree.model';\n\nexport class EuiTreeHelper {\n private readonly treeData: TreeDataModel;\n\n constructor(treeData: TreeDataModel) {\n this.treeData = treeData;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getPath(value: any, identifierKey = 'node.treeContentBlock.id'): string {\n if(typeof value !=='undefined'){\n const paths: Array<string> = [];\n this.traverse(this.treeData, '', [value], paths, undefined, identifierKey);\n return paths[0];\n }\n return null;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getPaths(values: Array<any>, identifierKey?: string): Array<string> {\n const paths: Array<string> = [];\n this.traverse(this.treeData, '', values, paths, undefined, identifierKey);\n return paths;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n public getItems(values: Array<any>, identifierKey?: string): Array<TreeItemModel> {\n const matchedItems: Array<TreeItemModel> = [];\n this.traverse(this.treeData, '', values, undefined, matchedItems, identifierKey);\n return matchedItems;\n }\n\n private traverse(\n tree: TreeDataModel,\n currentPath: string,\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n values: Array<any>,\n paths?: Array<string>,\n items?: Array<TreeItemModel>,\n identifierKey?: string,\n ): void {\n for (const [i, item] of tree.entries()) {\n const valueToCheck = identifierKey ? this.getValueAtKey(item, identifierKey) : item;\n\n if (values.some((v) => this.deepEqual(v, valueToCheck))) {\n if (paths) paths.push(`${currentPath}${i}`);\n if (items) items.push(item);\n }\n\n if (item.children && item.children.length) {\n this.traverse(item.children, `${currentPath}${i}.`, values, paths, items, identifierKey);\n }\n }\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private getValueAtKey(object: any, key: string): any {\n const keys = key.split('.');\n let current = object;\n for (const k of keys) {\n if (current[k] !== undefined) {\n current = current[k];\n } else {\n return undefined;\n }\n }\n return current;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private deepEqual(obj1: any, obj2: any): boolean {\n if (obj1 === obj2) {\n return true;\n }\n if (typeof obj1 !== 'object' || obj1 === null || typeof obj2 !== 'object' || obj2 === null) {\n return false;\n }\n const keys1 = Object.keys(obj1);\n const keys2 = Object.keys(obj2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n for (const key of keys1) {\n if (!keys2.includes(key) || !this.deepEqual(obj1[key], obj2[key])) {\n return false;\n }\n }\n return true;\n }\n}\n", "import { Directive, Host, forwardRef, AfterContentInit, Input, NgModule } from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { CommonModule } from '@angular/common';\nimport { EuiTreeComponent } from './eui-tree.component';\nimport { EuiTreeSelectionChanges, TreeDataModel, TreeItemModel } from './eui-tree.model';\nimport { EuiTreeHelper } from './eui-tree-helper';\n\n@Directive({\n selector: 'eui-tree[euiTreeFormControl]',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => EuiTreeFormControlDirective),\n multi: true,\n },\n ],\n})\nexport class EuiTreeFormControlDirective implements ControlValueAccessor, AfterContentInit {\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private onChange: (value: any) => void;\n private onTouched: () => void;\n\n constructor(@Host() private tree: EuiTreeComponent) {}\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() euiTreeControlValueSetter: (selection: TreeDataModel) => any = (selection: TreeDataModel) => {\n return selection;\n };\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n @Input() euiTreeControlModelMapper: (model: any, tree?: TreeDataModel) => Array<TreeItemModel> = (model: Array<TreeItemModel>) => {\n return model;\n };\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n writeValue(value: any): void {\n this.tree.setAllSelection(false);\n if (typeof value !== 'undefined' && value !== null && value?.length > 0) {\n const initialItems = this.euiTreeControlModelMapper(value, this.tree.nodes);\n const paths = new EuiTreeHelper(this.tree.nodes).getPaths(initialItems);\n paths.forEach((path: string) => {\n this.tree.nodeSelected({ target: { checked: true } }, path);\n });\n }\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n // TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n ngAfterContentInit(): void {\n this.tree.selectionChange.subscribe((selectionChanges: EuiTreeSelectionChanges) => {\n this.onChange(this.euiTreeControlValueSetter(selectionChanges.selection));\n });\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [EuiTreeFormControlDirective],\n declarations: [EuiTreeFormControlDirective],\n})\nexport class EuiTreeFormControlDirectiveModule {}\n"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S,CAAC,2BAA2B;IACrC,cAAc,CAAC,2BAA2B;GAC7C;;",
|
6
6
|
"names": ["Input", "NgModule", "CommonModule", "i0", "Directive", "Host", "Input", "NgModule", "CommonModule", "i0"]
|
7
7
|
}
|
@@ -221,7 +221,7 @@ var EuiUserProfileComponent = class _EuiUserProfileComponent {
|
|
221
221
|
</ng-template>
|
222
222
|
<eui-avatar-badge position="bottom" *ngIf="hasMenu || hasToggle">
|
223
223
|
<eui-badge euiSecondary euiSizeXS>
|
224
|
-
<eui-icon-svg icon="
|
224
|
+
<eui-icon-svg icon="chevron-down:sharp" size="2xs" fillColor="neutral"></eui-icon-svg>
|
225
225
|
</eui-badge>
|
226
226
|
</eui-avatar-badge>
|
227
227
|
</eui-avatar>
|
@@ -293,7 +293,7 @@ i03.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.1", n
|
|
293
293
|
</ng-template>
|
294
294
|
<eui-avatar-badge position="bottom" *ngIf="hasMenu || hasToggle">
|
295
295
|
<eui-badge euiSecondary euiSizeXS>
|
296
|
-
<eui-icon-svg icon="
|
296
|
+
<eui-icon-svg icon="chevron-down:sharp" size="2xs" fillColor="neutral"></eui-icon-svg>
|
297
297
|
</eui-badge>
|
298
298
|
</eui-avatar-badge>
|
299
299
|
</eui-avatar>
|
@@ -391,12 +391,12 @@ var EuiUserProfileCardComponent = class _EuiUserProfileCardComponent {
|
|
391
391
|
this.ɵfac = i04.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.0-rc.1", ngImport: i04, type: _EuiUserProfileCardComponent, deps: [{ token: i13.UserService }], target: i04.ɵɵFactoryTarget.Component });
|
392
392
|
}
|
393
393
|
static {
|
394
|
-
this.ɵcmp = i04.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.0.0-rc.1", type: _EuiUserProfileCardComponent, selector: "eui-user-profile-card", inputs: { impersonateLabel: "impersonateLabel", showDetailsLabel: "showDetailsLabel", avatarUrl: "avatarUrl", isShowAvatarInitials: ["isShowAvatarInitials", "isShowAvatarInitials", booleanAttribute2] }, outputs: { showProfileInfo: "showProfileInfo", closeProfileMenu: "closeProfileMenu" }, host: { properties: { "class": "this.cssClasses" } }, ngImport: i04, template: '<div class="eui-user-profile-card__main-wrapper">\n <div class="eui-user-profile-card__avatar-wrapper">\n <eui-avatar euiSizeL euiInfo>\n <eui-avatar-text *ngIf="isShowAvatarInitials; else noAvatarInitials">\n {{ avatarInitials }}\n </eui-avatar-text>\n <ng-template #noAvatarInitials>\n <eui-avatar-image *ngIf="!avatarUrl"></eui-avatar-image>\n <eui-avatar-image *ngIf="avatarUrl" [imageUrl]="avatarUrl"></eui-avatar-image>\n </ng-template>\n </eui-avatar>\n </div>\n <div class="eui-user-profile-card__userInfos">\n <div class="eui-u-f-xl eui-u-mb-s">{{ userState.fullName }}</div>\n <div *ngIf="userState.function" class="eui-user-profile-card__userInfos-item">\n {{ userState.function }}\n </div>\n <div *ngIf="userState.organisation && userState.organisation.code" class="eui-user-profile-card__userInfos-item">\n {{ userState.organisation.code }}\n </div>\n </div>\n <div class="eui-user-profile-card__main-wrapper-right-content">\n <a class="eui-u-text-link" tabindex="0" (click)="onClose()">close</a>\n <button euiButton euiIconButton euiInfo euiSizeS class="eui-u-ml-auto eui-u-mt-m" (click)="onShowInfoClick()" title="{{ showDetailsLabel }}">\n <eui-icon-svg icon="eui-
|
394
|
+
this.ɵcmp = i04.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "18.0.0-rc.1", type: _EuiUserProfileCardComponent, selector: "eui-user-profile-card", inputs: { impersonateLabel: "impersonateLabel", showDetailsLabel: "showDetailsLabel", avatarUrl: "avatarUrl", isShowAvatarInitials: ["isShowAvatarInitials", "isShowAvatarInitials", booleanAttribute2] }, outputs: { showProfileInfo: "showProfileInfo", closeProfileMenu: "closeProfileMenu" }, host: { properties: { "class": "this.cssClasses" } }, ngImport: i04, template: '<div class="eui-user-profile-card__main-wrapper">\n <div class="eui-user-profile-card__avatar-wrapper">\n <eui-avatar euiSizeL euiInfo>\n <eui-avatar-text *ngIf="isShowAvatarInitials; else noAvatarInitials">\n {{ avatarInitials }}\n </eui-avatar-text>\n <ng-template #noAvatarInitials>\n <eui-avatar-image *ngIf="!avatarUrl"></eui-avatar-image>\n <eui-avatar-image *ngIf="avatarUrl" [imageUrl]="avatarUrl"></eui-avatar-image>\n </ng-template>\n </eui-avatar>\n </div>\n <div class="eui-user-profile-card__userInfos">\n <div class="eui-u-f-xl eui-u-mb-s">{{ userState.fullName }}</div>\n <div *ngIf="userState.function" class="eui-user-profile-card__userInfos-item">\n {{ userState.function }}\n </div>\n <div *ngIf="userState.organisation && userState.organisation.code" class="eui-user-profile-card__userInfos-item">\n {{ userState.organisation.code }}\n </div>\n </div>\n <div class="eui-user-profile-card__main-wrapper-right-content">\n <a class="eui-u-text-link" tabindex="0" (click)="onClose()">close</a>\n <button euiButton euiIconButton euiInfo euiSizeS class="eui-u-ml-auto eui-u-mt-m" (click)="onShowInfoClick()" title="{{ showDetailsLabel }}">\n <eui-icon-svg icon="eui-ecl-information"></eui-icon-svg>\n </button>\n </div>\n</div>\n\n<ng-container *ngIf="userState?.impersonatingUser">\n <div class="eui-user-profile-card__impersonateInfos">\n <div>{{ userState?.impersonatingUser?.firstName }} {{ userState?.impersonatingUser?.lastName }}</div>\n <div class="eui-u-mt-2xs">{{ impersonateLabel }}</div>\n <div class="eui-u-mt-2xs">\n <strong>{{ userState?.fullName }}</strong>\n </div>\n </div>\n</ng-container>\n', dependencies: [{ kind: "directive", type: i22.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i32.EuiIconSvgComponent, selector: "eui-icon-svg, span[euiIconSvg], i[euiIconSvg]", inputs: ["icon", "fillColor", "set", "size", "ariaLabelledby", "role", "style", "iconUrl", "transform", "aria-label", "ariaHidden", "focusable", "isLoading", "isInputIcon", "euiStart", "euiEnd"] }, { kind: "component", type: i42.EuiButtonComponent, selector: "button[euiButton], a[euiButton]", inputs: ["e2eAttr", "id", "euiBasicButton", "euiButtonCall", "euiBlockButton", "euiIconButton", "euiLineWrap", "isChecked", "euiDisabled"], outputs: ["buttonClick"] }, { kind: "component", type: i52.EuiAvatarComponent, selector: "div[euiAvatar], span[euiAvatar], eui-avatar", inputs: ["e2eAttr", "aria-label", "hasShadow", "isShapeSquare", "isFlat", "hasNoBackground"] }, { kind: "component", type: i52.EuiAvatarTextComponent, selector: "eui-avatar-text" }, { kind: "component", type: i52.EuiAvatarImageComponent, selector: "eui-avatar-image", inputs: ["imageUrl"] }], changeDetection: i04.ChangeDetectionStrategy.Default, encapsulation: i04.ViewEncapsulation.None });
|
395
395
|
}
|
396
396
|
};
|
397
397
|
i04.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.0-rc.1", ngImport: i04, type: EuiUserProfileCardComponent, decorators: [{
|
398
398
|
type: Component4,
|
399
|
-
args: [{ selector: "eui-user-profile-card", changeDetection: ChangeDetectionStrategy3.Default, encapsulation: ViewEncapsulation7.None, template: '<div class="eui-user-profile-card__main-wrapper">\n <div class="eui-user-profile-card__avatar-wrapper">\n <eui-avatar euiSizeL euiInfo>\n <eui-avatar-text *ngIf="isShowAvatarInitials; else noAvatarInitials">\n {{ avatarInitials }}\n </eui-avatar-text>\n <ng-template #noAvatarInitials>\n <eui-avatar-image *ngIf="!avatarUrl"></eui-avatar-image>\n <eui-avatar-image *ngIf="avatarUrl" [imageUrl]="avatarUrl"></eui-avatar-image>\n </ng-template>\n </eui-avatar>\n </div>\n <div class="eui-user-profile-card__userInfos">\n <div class="eui-u-f-xl eui-u-mb-s">{{ userState.fullName }}</div>\n <div *ngIf="userState.function" class="eui-user-profile-card__userInfos-item">\n {{ userState.function }}\n </div>\n <div *ngIf="userState.organisation && userState.organisation.code" class="eui-user-profile-card__userInfos-item">\n {{ userState.organisation.code }}\n </div>\n </div>\n <div class="eui-user-profile-card__main-wrapper-right-content">\n <a class="eui-u-text-link" tabindex="0" (click)="onClose()">close</a>\n <button euiButton euiIconButton euiInfo euiSizeS class="eui-u-ml-auto eui-u-mt-m" (click)="onShowInfoClick()" title="{{ showDetailsLabel }}">\n <eui-icon-svg icon="eui-
|
399
|
+
args: [{ selector: "eui-user-profile-card", changeDetection: ChangeDetectionStrategy3.Default, encapsulation: ViewEncapsulation7.None, template: '<div class="eui-user-profile-card__main-wrapper">\n <div class="eui-user-profile-card__avatar-wrapper">\n <eui-avatar euiSizeL euiInfo>\n <eui-avatar-text *ngIf="isShowAvatarInitials; else noAvatarInitials">\n {{ avatarInitials }}\n </eui-avatar-text>\n <ng-template #noAvatarInitials>\n <eui-avatar-image *ngIf="!avatarUrl"></eui-avatar-image>\n <eui-avatar-image *ngIf="avatarUrl" [imageUrl]="avatarUrl"></eui-avatar-image>\n </ng-template>\n </eui-avatar>\n </div>\n <div class="eui-user-profile-card__userInfos">\n <div class="eui-u-f-xl eui-u-mb-s">{{ userState.fullName }}</div>\n <div *ngIf="userState.function" class="eui-user-profile-card__userInfos-item">\n {{ userState.function }}\n </div>\n <div *ngIf="userState.organisation && userState.organisation.code" class="eui-user-profile-card__userInfos-item">\n {{ userState.organisation.code }}\n </div>\n </div>\n <div class="eui-user-profile-card__main-wrapper-right-content">\n <a class="eui-u-text-link" tabindex="0" (click)="onClose()">close</a>\n <button euiButton euiIconButton euiInfo euiSizeS class="eui-u-ml-auto eui-u-mt-m" (click)="onShowInfoClick()" title="{{ showDetailsLabel }}">\n <eui-icon-svg icon="eui-ecl-information"></eui-icon-svg>\n </button>\n </div>\n</div>\n\n<ng-container *ngIf="userState?.impersonatingUser">\n <div class="eui-user-profile-card__impersonateInfos">\n <div>{{ userState?.impersonatingUser?.firstName }} {{ userState?.impersonatingUser?.lastName }}</div>\n <div class="eui-u-mt-2xs">{{ impersonateLabel }}</div>\n <div class="eui-u-mt-2xs">\n <strong>{{ userState?.fullName }}</strong>\n </div>\n </div>\n</ng-container>\n' }]
|
400
400
|
}], ctorParameters: () => [{ type: i13.UserService }], propDecorators: { cssClasses: [{
|
401
401
|
type: HostBinding4,
|
402
402
|
args: ["class"]
|