@eui/components 17.0.0-next.20 → 17.0.0-next.21
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/classes/EuiTreeHelper.html +85 -0
- package/docs/classes/EuiTreePagination.html +514 -0
- package/docs/components/ChartComponent.html +1 -1
- package/docs/components/CollapsedBreadcrumbComponent.html +1 -1
- package/docs/components/EclMessageWcComponent.html +1 -1
- package/docs/components/EuiAccessibleButtonIconComponent.html +1 -1
- package/docs/components/EuiAlertComponent.html +96 -609
- package/docs/components/EuiAppBreadcrumbComponent.html +1 -1
- package/docs/components/EuiAppComponent.html +1 -1
- package/docs/components/EuiAppFooterComponent.html +1 -1
- package/docs/components/EuiAppHeaderComponent.html +1 -1
- package/docs/components/EuiAppSidebarBodyComponent.html +1 -1
- package/docs/components/EuiAppSidebarComponent.html +1 -1
- package/docs/components/EuiAppSidebarDrawerComponent.html +1 -1
- package/docs/components/EuiAppSidebarFooterComponent.html +1 -1
- package/docs/components/EuiAppSidebarHeaderComponent.html +1 -1
- package/docs/components/EuiAppSidebarHeaderUserProfileComponent.html +1 -1
- package/docs/components/EuiAppSidebarMenuComponent.html +1 -1
- package/docs/components/EuiAppToolbarComponent.html +1 -1
- package/docs/components/EuiAppTopMessageComponent.html +1 -1
- package/docs/components/EuiAutocompleteAsyncTestComponent.html +1 -1
- package/docs/components/EuiAutocompleteChipsAsyncTestComponent.html +1 -1
- package/docs/components/EuiAutocompleteChipsTestComponent.html +1 -1
- package/docs/components/EuiAutocompleteComponent.html +1 -1
- package/docs/components/EuiAutocompleteTestComponent.html +1 -1
- package/docs/components/EuiAvatarBadgeComponent.html +1 -1
- package/docs/components/EuiAvatarComponent.html +1 -1
- package/docs/components/EuiAvatarIconComponent.html +1 -1
- package/docs/components/EuiAvatarImageComponent.html +1 -1
- package/docs/components/EuiAvatarListComponent.html +1 -1
- package/docs/components/EuiAvatarTextComponent.html +1 -1
- package/docs/components/EuiBadgeComponent.html +1 -1
- package/docs/components/EuiBlockContentComponent.html +1 -1
- package/docs/components/EuiBlockDocumentComponent.html +1 -1
- package/docs/components/EuiBreadcrumbComponent.html +1 -1
- package/docs/components/EuiBreadcrumbItemComponent.html +1 -1
- package/docs/components/EuiButtonComponent.html +1 -1
- package/docs/components/EuiButtonGroupComponent.html +1 -1
- package/docs/components/EuiButtonsComponent.html +1 -1
- package/docs/components/EuiCardComponent.html +1 -1
- package/docs/components/EuiCardContentComponent.html +1 -1
- package/docs/components/EuiCardFooterActionButtonsComponent.html +1 -1
- package/docs/components/EuiCardFooterActionIconsComponent.html +1 -1
- package/docs/components/EuiCardFooterComponent.html +1 -1
- package/docs/components/EuiCardFooterMenuContentComponent.html +1 -1
- package/docs/components/EuiCardHeaderBodyComponent.html +1 -1
- package/docs/components/EuiCardHeaderComponent.html +1 -1
- package/docs/components/EuiCardHeaderLeftContentComponent.html +1 -1
- package/docs/components/EuiCardHeaderRightContentComponent.html +1 -1
- package/docs/components/EuiCardHeaderSubtitleComponent.html +1 -1
- package/docs/components/EuiCardHeaderTitleComponent.html +1 -1
- package/docs/components/EuiCardMediaComponent.html +1 -1
- package/docs/components/EuiChipComponent.html +1 -1
- package/docs/components/EuiChipListComponent.html +1 -1
- package/docs/components/EuiCommonHeaderComponent.html +1 -1
- package/docs/components/EuiDashboardButtonComponent.html +1 -1
- package/docs/components/EuiDashboardCardComponent.html +1 -1
- package/docs/components/EuiDateRangeSelectorComponent.html +70 -2
- package/docs/components/EuiDatepickerComponent.html +1 -1
- package/docs/components/EuiDialogComponent.html +1 -1
- package/docs/components/EuiDialogContainerComponent.html +1 -1
- package/docs/components/EuiDimmerComponent.html +1 -1
- package/docs/components/EuiDisableContentComponent.html +1 -1
- package/docs/components/EuiDiscussionThreadComponent.html +1 -1
- package/docs/components/EuiDiscussionThreadItemComponent.html +1 -1
- package/docs/components/EuiDropdownComponent.html +1 -1
- package/docs/components/EuiDropdownItemComponent.html +1 -1
- package/docs/components/EuiEclBannerComponent.html +1 -1
- package/docs/components/EuiEclButtonComponent.html +1 -1
- package/docs/components/EuiEclCarouselComponent.html +1 -1
- package/docs/components/EuiEclCarouselItemComponent.html +1 -1
- package/docs/components/EuiEclIconComponent.html +1 -1
- package/docs/components/EuiEclMessageComponent.html +1 -1
- package/docs/components/EuiEditorComponent.html +1 -1
- package/docs/components/EuiEditorCountersComponent.html +1 -1
- package/docs/components/EuiEditorHtmlViewComponent.html +1 -1
- package/docs/components/EuiEditorImageDialogComponent.html +1 -1
- package/docs/components/EuiEditorJsonViewComponent.html +1 -1
- package/docs/components/EuiExpandContentComponent.html +1 -1
- package/docs/components/EuiFeedbackMessageComponent.html +1 -1
- package/docs/components/EuiFieldsetComponent.html +1 -1
- package/docs/components/EuiFilePreviewComponent.html +1 -1
- package/docs/components/EuiFileUploadComponent.html +1 -2
- package/docs/components/EuiFileUploadProgressComponent.html +1 -1
- package/docs/components/EuiFooterComponent.html +1 -1
- package/docs/components/EuiGrowlComponent.html +1 -1
- package/docs/components/EuiHeaderAppComponent.html +1 -1
- package/docs/components/EuiHeaderAppNameComponent.html +1 -1
- package/docs/components/EuiHeaderAppNameLogoComponent.html +1 -1
- package/docs/components/EuiHeaderAppSubtitleComponent.html +1 -1
- package/docs/components/EuiHeaderComponent.html +1 -1
- package/docs/components/EuiHeaderEnvironmentComponent.html +1 -1
- package/docs/components/EuiHeaderLogoComponent.html +1 -1
- package/docs/components/EuiHeaderUserProfileComponent.html +1 -1
- package/docs/components/EuiIconColorComponent.html +1 -1
- package/docs/components/EuiIconComponent.html +1 -1
- package/docs/components/EuiIconSvgComponent.html +1 -1
- package/docs/components/EuiIconToggleComponent.html +1 -1
- package/docs/components/EuiInputCheckboxComponent.html +1 -1
- package/docs/components/EuiInputGroupComponent.html +1 -1
- package/docs/components/EuiInputNumberComponent.html +14 -2
- package/docs/components/EuiInputRadioComponent.html +1 -1
- package/docs/components/EuiInputTextComponent.html +1 -1
- package/docs/components/EuiLabelComponent.html +1 -1
- package/docs/components/EuiLanguageSelectorComponent.html +1 -1
- package/docs/components/EuiListComponent.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/EuiMessageBoxComponent.html +1 -1
- package/docs/components/EuiModalSelectorComponent.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/EuiOverlayBodyComponent.html +1 -1
- package/docs/components/EuiOverlayComponent.html +1 -1
- package/docs/components/EuiOverlayFooterComponent.html +1 -1
- package/docs/components/EuiOverlayHeaderComponent.html +1 -1
- package/docs/components/EuiOverlayHeaderTitleComponent.html +1 -1
- package/docs/components/EuiPageBreadcrumbComponent.html +1 -1
- package/docs/components/EuiPageColumnComponent.html +1 -1
- package/docs/components/EuiPageColumnsComponent.html +1 -1
- package/docs/components/EuiPageComponent.html +1 -1
- package/docs/components/EuiPageContentComponent.html +1 -1
- package/docs/components/EuiPageFooterComponent.html +1 -1
- package/docs/components/EuiPageHeaderComponent.html +1 -1
- package/docs/components/EuiPageHeroHeaderComponent.html +1 -1
- package/docs/components/EuiPageTopContentComponent.html +1 -1
- package/docs/components/EuiPaginatorComponent.html +1 -1
- package/docs/components/EuiPopoverComponent.html +1 -1
- package/docs/components/EuiProgressBarComponent.html +1 -1
- package/docs/components/EuiProgressCircleComponent.html +1 -1
- package/docs/components/EuiResizableComponent.html +1 -1
- package/docs/components/EuiSearchComponent.html +1 -1
- package/docs/components/EuiSelectComponent.html +1 -1
- package/docs/components/EuiSidebarMenuComponent.html +1 -1
- package/docs/components/EuiSidebarToggleComponent.html +1 -1
- package/docs/components/EuiSlideToggleComponent.html +1 -1
- package/docs/components/EuiSlideToggleTestComponent.html +1 -1
- package/docs/components/EuiTabComponent.html +1 -1
- package/docs/components/EuiTabContentComponent.html +1 -1
- package/docs/components/EuiTabLabelComponent.html +1 -1
- package/docs/components/EuiTableComponent.html +1 -1
- package/docs/components/EuiTableExpandableRowComponent.html +1 -1
- package/docs/components/EuiTableFilterComponent.html +1 -1
- package/docs/components/EuiTableSelectableHeaderComponent.html +2 -2
- package/docs/components/EuiTableSelectableRowComponent.html +1 -1
- package/docs/components/EuiTableSortableColComponent.html +1 -1
- package/docs/components/EuiTabsComponent.html +1 -1
- package/docs/components/EuiTextareaComponent.html +1 -1
- package/docs/components/EuiTimebarComponent.html +1 -1
- package/docs/components/EuiTimelineComponent.html +1 -1
- package/docs/components/EuiTimelineItemComponent.html +1 -1
- package/docs/components/EuiTimepickerComponent.html +1 -1
- package/docs/components/EuiToolbarAppComponent.html +1 -1
- package/docs/components/EuiToolbarCenterComponent.html +1 -1
- package/docs/components/EuiToolbarComponent.html +1 -1
- package/docs/components/EuiToolbarEnvironmentComponent.html +1 -1
- package/docs/components/EuiToolbarItemComponent.html +1 -1
- package/docs/components/EuiToolbarItemNotificationsComponent.html +1 -1
- package/docs/components/EuiToolbarItemSearchComponent.html +1 -1
- package/docs/components/EuiToolbarItemUserProfileComponent.html +1 -1
- package/docs/components/EuiToolbarItemsComponent.html +1 -1
- package/docs/components/EuiToolbarLogoComponent.html +1 -1
- package/docs/components/EuiToolbarMenuComponent.html +1 -1
- package/docs/components/EuiTooltipContainerComponent.html +1 -1
- package/docs/components/EuiTreeComponent.html +527 -55
- package/docs/components/EuiTreeListComponent.html +1 -1
- package/docs/components/EuiTreeListItemComponent.html +1 -1
- package/docs/components/EuiTreeListItemContentComponent.html +1 -1
- package/docs/components/EuiTreeListToolbarComponent.html +1 -1
- package/docs/components/EuiUserProfileCardComponent.html +1 -1
- package/docs/components/EuiUserProfileComponent.html +1 -1
- package/docs/components/EuiUserProfileMenuComponent.html +1 -1
- package/docs/components/EuiUserProfileMenuItemComponent.html +1 -1
- package/docs/components/EuiUxTreeComponent.html +1 -1
- package/docs/components/EuiUxTreeNodeComponent.html +1 -1
- package/docs/components/EuiUxTreeToolbarComponent.html +1 -1
- package/docs/components/EuiWizardComponent.html +1 -1
- package/docs/components/EuiWizardStepComponent.html +1 -1
- package/docs/components/QuillEditorComponent.html +1 -1
- package/docs/dependencies.html +2 -2
- package/docs/directives/EuiAlertTitleDirective.html +284 -0
- package/docs/index.html +3 -3
- package/docs/interfaces/MultiSelectionLogic.html +259 -0
- package/docs/interfaces/SelectConfigModel.html +52 -0
- package/docs/interfaces/SingleSelectionLogic.html +214 -0
- package/docs/js/menu-wc.js +29 -6
- package/docs/js/menu-wc_es5.js +1 -1
- package/docs/js/search/search_index.js +2 -2
- package/docs/miscellaneous/typealiases.html +2 -2
- package/docs/modules/EuiAlertModule.html +9 -0
- package/esm2022/eui-alert/eui-alert.component.mjs +80 -35
- package/esm2022/eui-card/eui-card.component.mjs +2 -2
- package/esm2022/eui-date-range-selector/eui-date-range-selector.component.mjs +13 -3
- package/esm2022/eui-dialog/container/eui-dialog-container.component.mjs +2 -2
- package/esm2022/eui-dialog/eui-dialog.component.mjs +2 -2
- package/esm2022/eui-dropdown/dropdown-item/eui-dropdown-item.component.mjs +2 -2
- package/esm2022/eui-dropdown/eui-dropdown.component.mjs +2 -2
- package/esm2022/eui-file-upload/eui-file-upload.component.mjs +8 -7
- package/esm2022/eui-file-upload/file-preview/file-preview.component.mjs +2 -2
- package/esm2022/eui-growl/eui-growl.component.mjs +2 -2
- package/esm2022/eui-input-number/eui-input-number.component.mjs +17 -9
- package/esm2022/eui-overlay/components/eui-overlay-body/eui-overlay-body.component.mjs +2 -2
- package/esm2022/eui-overlay/components/eui-overlay-footer/eui-overlay-footer.component.mjs +2 -2
- package/esm2022/eui-overlay/components/eui-overlay-header/eui-overlay-header.component.mjs +2 -2
- package/esm2022/eui-overlay/eui-overlay.component.mjs +2 -2
- package/esm2022/eui-page/eui-page.component.mjs +2 -2
- package/esm2022/eui-select/eui-select.component.mjs +2 -2
- package/esm2022/eui-sidebar-menu/eui-sidebar-menu.component.mjs +2 -2
- package/esm2022/eui-table/eui-table.component.mjs +2 -2
- package/esm2022/eui-table/selectable-header/eui-table-selectable-header.component.mjs +3 -3
- package/esm2022/eui-tabs/eui-tab/eui-tab.component.mjs +2 -2
- package/esm2022/eui-tabs/eui-tabs.component.mjs +2 -2
- package/esm2022/eui-textarea/eui-textarea.component.mjs +2 -2
- package/esm2022/eui-tree/eui-tree-helper.mjs +8 -1
- package/esm2022/eui-tree/eui-tree.component.mjs +450 -184
- package/esm2022/eui-tree/eui-tree.model.mjs +41 -1
- package/esm2022/layout/eui-app/eui-app-sidebar/sidebar.component.mjs +2 -2
- package/eui-alert/eui-alert.component.d.ts +23 -11
- package/eui-alert/eui-alert.component.d.ts.map +1 -1
- package/eui-date-range-selector/eui-date-range-selector.component.d.ts +2 -0
- package/eui-date-range-selector/eui-date-range-selector.component.d.ts.map +1 -1
- package/eui-file-upload/eui-file-upload.component.d.ts +2 -3
- package/eui-file-upload/eui-file-upload.component.d.ts.map +1 -1
- package/eui-input-number/eui-input-number.component.d.ts +3 -2
- package/eui-input-number/eui-input-number.component.d.ts.map +1 -1
- package/eui-tree/eui-tree-helper.d.ts +1 -0
- package/eui-tree/eui-tree-helper.d.ts.map +1 -1
- package/eui-tree/eui-tree.component.d.ts +46 -19
- package/eui-tree/eui-tree.component.d.ts.map +1 -1
- package/eui-tree/eui-tree.model.d.ts +41 -7
- package/eui-tree/eui-tree.model.d.ts.map +1 -1
- package/fesm2022/eui-components-eui-alert.mjs +80 -35
- package/fesm2022/eui-components-eui-alert.mjs.map +1 -1
- package/fesm2022/eui-components-eui-card.mjs +2 -2
- package/fesm2022/eui-components-eui-date-range-selector.mjs +12 -2
- package/fesm2022/eui-components-eui-date-range-selector.mjs.map +1 -1
- package/fesm2022/eui-components-eui-dialog.mjs +4 -4
- package/fesm2022/eui-components-eui-dropdown.mjs +4 -4
- package/fesm2022/eui-components-eui-file-upload.mjs +8 -7
- package/fesm2022/eui-components-eui-file-upload.mjs.map +1 -1
- package/fesm2022/eui-components-eui-growl.mjs +2 -2
- package/fesm2022/eui-components-eui-input-number.mjs +16 -8
- package/fesm2022/eui-components-eui-input-number.mjs.map +1 -1
- package/fesm2022/eui-components-eui-overlay.mjs +8 -8
- package/fesm2022/eui-components-eui-page.mjs +2 -2
- package/fesm2022/eui-components-eui-select.mjs +2 -2
- package/fesm2022/eui-components-eui-sidebar-menu.mjs +2 -2
- package/fesm2022/eui-components-eui-table.mjs +4 -4
- package/fesm2022/eui-components-eui-table.mjs.map +1 -1
- package/fesm2022/eui-components-eui-tabs.mjs +4 -4
- package/fesm2022/eui-components-eui-textarea.mjs +2 -2
- package/fesm2022/eui-components-eui-tree.mjs +533 -221
- package/fesm2022/eui-components-eui-tree.mjs.map +1 -1
- package/fesm2022/eui-components-layout.mjs +2 -2
- package/package.json +7 -7
@@ -1,49 +1,114 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, HostBinding, Input, Output, NgModule, Directive, Host, ContentChild, forwardRef } from '@angular/core';
|
3
|
-
import * as
|
2
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, ViewEncapsulation, HostBinding, Input, ViewChild, Output, NgModule, Directive, Host, ContentChild, forwardRef } from '@angular/core';
|
3
|
+
import * as i2 from '@angular/common';
|
4
4
|
import { CommonModule } from '@angular/common';
|
5
|
-
import * as
|
5
|
+
import * as i3 from '@angular/router';
|
6
6
|
import { RouterModule } from '@angular/router';
|
7
7
|
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
8
|
-
import * as
|
8
|
+
import * as i4 from '@eui/components/eui-input-checkbox';
|
9
9
|
import { EuiInputCheckboxModule } from '@eui/components/eui-input-checkbox';
|
10
|
-
import * as
|
10
|
+
import * as i6 from '@eui/components/eui-button';
|
11
11
|
import { EuiButtonModule } from '@eui/components/eui-button';
|
12
|
-
import * as
|
12
|
+
import * as i7 from '@eui/components/eui-icon';
|
13
13
|
import { EuiIconModule } from '@eui/components/eui-icon';
|
14
|
-
import * as
|
14
|
+
import * as i8 from '@eui/components/eui-label';
|
15
15
|
import { EuiLabelModule } from '@eui/components/eui-label';
|
16
|
-
import * as
|
16
|
+
import * as i9 from '@eui/components/eui-badge';
|
17
17
|
import { EuiBadgeModule } from '@eui/components/eui-badge';
|
18
|
-
import * as
|
18
|
+
import * as i10 from '@eui/components/eui-chip';
|
19
19
|
import { EuiChipModule } from '@eui/components/eui-chip';
|
20
|
-
import * as
|
20
|
+
import * as i11 from '@eui/components/eui-dropdown';
|
21
21
|
import { EuiDropdownModule } from '@eui/components/eui-dropdown';
|
22
|
-
import * as
|
22
|
+
import * as i5 from '@angular/cdk/tree';
|
23
23
|
import { NestedTreeControl, CdkTreeModule } from '@angular/cdk/tree';
|
24
24
|
import { ArrayDataSource, SelectionModel } from '@angular/cdk/collections';
|
25
25
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
26
|
-
import * as
|
26
|
+
import * as i12 from '@ngx-translate/core';
|
27
27
|
import { TranslateModule } from '@ngx-translate/core';
|
28
|
+
import * as i1 from '@angular/cdk/scrolling';
|
29
|
+
import { CdkScrollable, ScrollingModule } from '@angular/cdk/scrolling';
|
30
|
+
import { debounceTime } from 'rxjs';
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
33
|
+
function uxTreeNodesMetaDataMapper(oldTree) {
|
34
|
+
return oldTree.map((item) => {
|
35
|
+
if (item?.typeClass === 'default') {
|
36
|
+
// default typeClass will be
|
37
|
+
item.typeClass = 'secondary';
|
38
|
+
}
|
39
|
+
if (item?.badgeLabel) {
|
40
|
+
// default typeClass will be
|
41
|
+
if (item?.badges?.length > 0) {
|
42
|
+
item.badges.push({ label: item?.badgeLabel, typeClass: 'secondary' });
|
43
|
+
}
|
44
|
+
else {
|
45
|
+
item.badges = [{ label: item?.badgeLabel, typeClass: 'secondary' }];
|
46
|
+
}
|
47
|
+
}
|
48
|
+
return {
|
49
|
+
node: {
|
50
|
+
treeContentBlock: {
|
51
|
+
label: item.label,
|
52
|
+
typeLabel: item.typeLabel,
|
53
|
+
typeClass: item.typeLabel && !item.typeClass ? 'secondary' : item.typeClass,
|
54
|
+
tooltipLabel: item.tooltipLabel,
|
55
|
+
url: item.url,
|
56
|
+
urlExternal: item.urlExternal,
|
57
|
+
urlExternalTarget: item.urlExternal && item.urlExternalTarget ? item.urlExternalTarget : undefined,
|
58
|
+
badges: item.badges,
|
59
|
+
metadata: item.metadata,
|
60
|
+
},
|
61
|
+
},
|
62
|
+
children: item.children ? uxTreeNodesMetaDataMapper(item.children) : undefined,
|
63
|
+
};
|
64
|
+
});
|
65
|
+
}
|
66
|
+
class EuiTreePagination {
|
67
|
+
constructor(data, startPage, renderedPageCount, perPage) {
|
68
|
+
this.data = data;
|
69
|
+
this.setCurrentStartPage(startPage);
|
70
|
+
this.renderedPageCount = renderedPageCount;
|
71
|
+
this.totalItems = this.data.length;
|
72
|
+
this.perPage = perPage;
|
73
|
+
this.totalPages = Math.ceil(this.totalItems / this.perPage);
|
74
|
+
}
|
75
|
+
paginateNext() {
|
76
|
+
if (this.startPage < this.totalPages) {
|
77
|
+
this.startPage += 1;
|
78
|
+
}
|
79
|
+
return this.getViewData();
|
32
80
|
}
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
81
|
+
paginatePrev() {
|
82
|
+
if (this.startPage > 1) {
|
83
|
+
this.startPage -= 1;
|
84
|
+
}
|
85
|
+
return this.getViewData();
|
37
86
|
}
|
38
|
-
|
39
|
-
this.
|
87
|
+
getCurrentStartPage() {
|
88
|
+
return this.startPage;
|
40
89
|
}
|
41
|
-
|
42
|
-
|
90
|
+
setCurrentStartPage(startPage) {
|
91
|
+
this.startPage = startPage;
|
43
92
|
}
|
44
|
-
|
45
|
-
this.
|
93
|
+
isAtMax() {
|
94
|
+
return this.totalPages < this.startPage + this.renderedPageCount;
|
46
95
|
}
|
96
|
+
getViewData() {
|
97
|
+
const startIndex = (this.startPage - 1) * this.perPage;
|
98
|
+
const endIndex = startIndex + this.perPage * this.renderedPageCount;
|
99
|
+
const pageData = structuredClone(this.data).slice(startIndex, endIndex);
|
100
|
+
return {
|
101
|
+
startPage: this.startPage,
|
102
|
+
data: pageData,
|
103
|
+
};
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
class EuiTreeComponent {
|
108
|
+
get cssClasses() {
|
109
|
+
return this.getCssClasses();
|
110
|
+
}
|
111
|
+
// @ViewChild('treeComponentInstance') public treeComponentInstance: any;
|
47
112
|
get isClickTogglingNode() {
|
48
113
|
return this._isClickTogglingNode;
|
49
114
|
}
|
@@ -56,6 +121,12 @@ class EuiTreeComponent {
|
|
56
121
|
set isMultiselect(value) {
|
57
122
|
this._isMultiselect = coerceBooleanProperty(value);
|
58
123
|
}
|
124
|
+
get isSingleSelect() {
|
125
|
+
return this._isSingleSelect;
|
126
|
+
}
|
127
|
+
set isSingleSelect(value) {
|
128
|
+
this._isSingleSelect = coerceBooleanProperty(value);
|
129
|
+
}
|
59
130
|
get isRecursiveSelection() {
|
60
131
|
return this._isRecursiveSelection;
|
61
132
|
}
|
@@ -68,14 +139,33 @@ class EuiTreeComponent {
|
|
68
139
|
set isRecursiveParentSelection(value) {
|
69
140
|
this._isRecursiveParentSelection = coerceBooleanProperty(value);
|
70
141
|
}
|
142
|
+
get showUnderlinedLinks() {
|
143
|
+
return this._showUnderlinedLinks;
|
144
|
+
}
|
145
|
+
set showUnderlinedLinks(value) {
|
146
|
+
this._showUnderlinedLinks = coerceBooleanProperty(value);
|
147
|
+
}
|
148
|
+
get showLines() {
|
149
|
+
return this._showLines;
|
150
|
+
}
|
151
|
+
set showLines(value) {
|
152
|
+
this._showLines = coerceBooleanProperty(value);
|
153
|
+
}
|
71
154
|
get autoTranslate() {
|
72
155
|
return this._autoTranslate;
|
73
156
|
}
|
74
157
|
set autoTranslate(value) {
|
75
158
|
this._autoTranslate = coerceBooleanProperty(value);
|
76
159
|
}
|
77
|
-
|
160
|
+
get highlightPath() {
|
161
|
+
return this._highlightPath;
|
162
|
+
}
|
163
|
+
set highlightPath(value) {
|
164
|
+
this._highlightPath = coerceBooleanProperty(value);
|
165
|
+
}
|
166
|
+
constructor(changeDetectorRef, scrollDispatcher) {
|
78
167
|
this.changeDetectorRef = changeDetectorRef;
|
168
|
+
this.scrollDispatcher = scrollDispatcher;
|
79
169
|
this.e2eAttr = 'eui-tree';
|
80
170
|
this.expandedSvgIconClass = 'eui-chevron-forward:eui';
|
81
171
|
this.collapsedSvgIconClass = 'eui-chevron-down:eui';
|
@@ -85,17 +175,20 @@ class EuiTreeComponent {
|
|
85
175
|
this.uid = Math.floor(Math.random() * 1000000000).toString();
|
86
176
|
this._isClickTogglingNode = false;
|
87
177
|
this._isMultiselect = false;
|
178
|
+
this._isSingleSelect = false;
|
88
179
|
this._isRecursiveSelection = false;
|
89
180
|
this._isRecursiveParentSelection = true;
|
90
|
-
this.
|
181
|
+
this._showUnderlinedLinks = false;
|
91
182
|
this._showLines = false;
|
92
|
-
this.
|
183
|
+
this._autoTranslate = true;
|
184
|
+
this._highlightPath = false;
|
185
|
+
this.hasChild = (_, item) => !!item?.children && item?.children?.length >= 0;
|
93
186
|
}
|
94
187
|
ngOnInit() {
|
95
188
|
this.initTree();
|
96
189
|
}
|
97
190
|
ngOnChanges(changes) {
|
98
|
-
if (changes['nodes']
|
191
|
+
if (changes['nodes']?.currentValue !== changes['nodes']?.previousValue) {
|
99
192
|
this.renderTree = false;
|
100
193
|
this.initTree();
|
101
194
|
}
|
@@ -104,14 +197,25 @@ class EuiTreeComponent {
|
|
104
197
|
if (this.selectionModelSubs) {
|
105
198
|
this.selectionModelSubs.unsubscribe();
|
106
199
|
}
|
200
|
+
if (this.scrollDispatcherSubs) {
|
201
|
+
this.scrollDispatcherSubs.unsubscribe();
|
202
|
+
}
|
107
203
|
}
|
108
204
|
getSelection() {
|
109
205
|
return this._selection;
|
110
206
|
}
|
207
|
+
getProcessedNodes() {
|
208
|
+
return this.processedNodes;
|
209
|
+
}
|
210
|
+
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
212
|
+
trackBy(index, item) {
|
213
|
+
return item.path;
|
214
|
+
}
|
111
215
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
112
216
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
113
|
-
|
114
|
-
return
|
217
|
+
trackByControl(item) {
|
218
|
+
return item;
|
115
219
|
}
|
116
220
|
getTreeItem(path) {
|
117
221
|
const indexArr = this.resolvePath(path);
|
@@ -144,102 +248,154 @@ class EuiTreeComponent {
|
|
144
248
|
this.changeDetectorRef.markForCheck();
|
145
249
|
}
|
146
250
|
filterTerm(filterInput) {
|
147
|
-
if (filterInput && filterInput !== '') {
|
251
|
+
if (filterInput !== '' && filterInput !== null && typeof filterInput !== 'undefined') {
|
252
|
+
this.treeDataRunTime = this.filterTreeData(structuredClone(this.treeDataRunTimeBackup), 'label', filterInput);
|
253
|
+
this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);
|
254
|
+
this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);
|
255
|
+
this.cdkTreeControl = new NestedTreeControl((node) => node?.children, { trackBy: this.trackByControl });
|
256
|
+
this.cdkTreeControl.dataNodes = this.treeDataRunTime;
|
148
257
|
this.renderTree = false;
|
149
258
|
this.changeDetectorRef.detectChanges();
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
this.cdkTreeControl = new NestedTreeControl((node) => node?.children);
|
154
|
-
this.cdkTreeControl.dataNodes = this.treeDataRunTime;
|
155
|
-
this.renderTree = true;
|
156
|
-
this.changeDetectorRef.detectChanges();
|
157
|
-
this.expandAll();
|
158
|
-
});
|
259
|
+
this.renderTree = true;
|
260
|
+
this.changeDetectorRef.detectChanges();
|
261
|
+
this.expandAll();
|
159
262
|
}
|
160
263
|
else {
|
264
|
+
this.treeDataRunTime = structuredClone(this.treeDataRunTimeBackup);
|
265
|
+
this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);
|
266
|
+
this.cdkTreeControl = new NestedTreeControl((node) => node?.children, { trackBy: this.trackByControl });
|
267
|
+
this.cdkTreeControl.dataNodes = this.treeDataRunTime;
|
161
268
|
this.renderTree = false;
|
162
269
|
this.changeDetectorRef.detectChanges();
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
this.cdkTreeControl = new NestedTreeControl((node) => node?.children);
|
167
|
-
this.cdkTreeControl.dataNodes = this.treeDataRunTime;
|
168
|
-
this.renderTree = true;
|
169
|
-
this.changeDetectorRef.detectChanges();
|
170
|
-
this.expandAll();
|
171
|
-
});
|
270
|
+
this.renderTree = true;
|
271
|
+
this.changeDetectorRef.detectChanges();
|
272
|
+
this.expandAll();
|
172
273
|
}
|
173
274
|
}
|
174
275
|
setAllSelection(isChecked) {
|
175
|
-
this.setIsCheckedForAll(this.
|
276
|
+
this.setIsCheckedForAll(this.treeDataRunTime, isChecked);
|
176
277
|
this.changeDetectorRef.markForCheck();
|
177
278
|
}
|
178
|
-
|
179
|
-
this.
|
279
|
+
updateTreeItem(treeItem, path) {
|
280
|
+
this.setTreeData(path, this.processInputs([treeItem])[0]);
|
281
|
+
const pathArr = path.split('.');
|
282
|
+
const index = parseInt(pathArr.pop(), 10);
|
283
|
+
const treeItemRuntime = this.calculateRunTimeState(treeItem, index, pathArr.join('.'));
|
284
|
+
this.setTreeDataRunTime(path, treeItemRuntime);
|
285
|
+
// itemRecursiveSelectionState
|
286
|
+
const itemRecursiveSelectionState = this.calculateItemSelectionRecursiveState(treeItem);
|
287
|
+
this.setRunTimeSelectionRecursiveStateTree(path, itemRecursiveSelectionState);
|
288
|
+
this.syncStateChangesAtPath(path);
|
289
|
+
// Rendering
|
290
|
+
this.changeDetectorRef.detectChanges();
|
291
|
+
this.treeComponentInstance.renderNodeChanges([]);
|
292
|
+
this.treeComponentInstance.renderNodeChanges(this.treeDataRunTime);
|
293
|
+
if (this.cdkTreeControl.isExpanded(treeItemRuntime) && !treeItem.node.isExpanded) {
|
294
|
+
this.cdkTreeControl.toggle(treeItemRuntime);
|
295
|
+
}
|
296
|
+
else if (!this.cdkTreeControl.isExpanded(treeItemRuntime) && treeItem.node.isExpanded) {
|
297
|
+
this.cdkTreeControl.expand(treeItemRuntime);
|
298
|
+
}
|
299
|
+
this.changeDetectorRef.detectChanges();
|
300
|
+
}
|
301
|
+
onNodeClick(treeRunTimeItem) {
|
302
|
+
this.nodeClick.emit(this.getTreeItem(treeRunTimeItem?.path));
|
180
303
|
if (this.isClickTogglingNode) {
|
181
|
-
this.cdkTreeControl.toggle(
|
182
|
-
this.onNodeToggle(
|
304
|
+
this.cdkTreeControl.toggle(treeRunTimeItem);
|
305
|
+
this.onNodeToggle(treeRunTimeItem);
|
183
306
|
}
|
184
307
|
}
|
185
|
-
onNodeToggle(
|
186
|
-
this.
|
308
|
+
onNodeToggle(treeRunTimeItem) {
|
309
|
+
this.getTreeItem(treeRunTimeItem?.path).node.isExpanded = this.cdkTreeControl.isExpanded(treeRunTimeItem);
|
310
|
+
this.nodeToggle.emit(this.getTreeItem(treeRunTimeItem?.path));
|
187
311
|
}
|
188
312
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
189
313
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
190
314
|
nodeSelected(evt, path) {
|
191
315
|
const item = this.getTreeItem(path);
|
192
|
-
const
|
316
|
+
const runTimeTreeItem = this.getRunTimeBackupTreeItem(path);
|
317
|
+
const renderedRunTimeTreeItem = this.getRunTimeTreeItem(path);
|
193
318
|
const node = item.node;
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
this.
|
319
|
+
// console.log(path,item,runTimeTreeItem, renderedRunTimeTreeItem);
|
320
|
+
if (!node?.selectConfig?.singleSelect) {
|
321
|
+
node.isSelected = evt.target.checked;
|
322
|
+
node.isIndeterminate = false;
|
323
|
+
// If the node is recursive it sets every children with the change.
|
324
|
+
if (renderedRunTimeTreeItem?.children && renderedRunTimeTreeItem?.children?.length > 0) {
|
325
|
+
if (node?.selectConfig?.recursive) {
|
326
|
+
// console.log(renderedRunTimeTreeItem);
|
327
|
+
this.setIsCheckedForAll(renderedRunTimeTreeItem?.children, evt.target.checked);
|
328
|
+
}
|
329
|
+
}
|
330
|
+
this.setRunTimeSelectionRecursiveStateTree(path, this.calculateItemSelectionRecursiveState(structuredClone(this.getTreeItem(path))));
|
331
|
+
if (renderedRunTimeTreeItem?.children && renderedRunTimeTreeItem?.children?.length > 0) {
|
332
|
+
if (node?.selectConfig?.recursive) {
|
333
|
+
// this.setIsCheckedForAll(renderedRunTimeTreeItem?.children, evt.target.checked);
|
334
|
+
this.runStateChangesForAll(renderedRunTimeTreeItem?.children);
|
335
|
+
}
|
336
|
+
this.treeComponentInstance?.renderNodeChanges([]);
|
337
|
+
this.treeComponentInstance?.renderNodeChanges(this.treeDataRunTime);
|
338
|
+
}
|
339
|
+
this.syncStateChangesAtPath(path);
|
340
|
+
if (this.getTreeItem(path).node.isSelected) {
|
341
|
+
this.selectTreeItem(runTimeTreeItem);
|
342
|
+
}
|
343
|
+
else {
|
344
|
+
this.deselectTreeItem(runTimeTreeItem);
|
345
|
+
}
|
346
|
+
const nodePathsSeq = this.getParentPaths(path);
|
347
|
+
if (nodePathsSeq.length > 0) {
|
348
|
+
nodePathsSeq.forEach((nodePath) => {
|
349
|
+
const treeItem = this.getTreeItem(nodePath);
|
350
|
+
const childStates = this.getRunTimeSelectionRecursiveState(nodePath).children.map((_) => _.selectionRecursiveState);
|
351
|
+
this.updateRunTimeSelectionRecursiveState(nodePath, this.decideSelectionRecursiveState(childStates, treeItem.node?.isSelected, treeItem.node?.selectConfig?.recursive, treeItem.node?.selectConfig?.noAutoSelectParent));
|
352
|
+
this.syncStateChangesAtPath(nodePath);
|
353
|
+
});
|
354
|
+
this.changeDetectorRef.detectChanges();
|
355
|
+
}
|
356
|
+
else {
|
357
|
+
this.changeDetectorRef.detectChanges();
|
358
|
+
}
|
206
359
|
}
|
207
360
|
else {
|
208
|
-
this.
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
361
|
+
const prevItem = this.selectionModel.selected[0];
|
362
|
+
if (evt.target.checked) {
|
363
|
+
if (prevItem) {
|
364
|
+
this.getTreeItem(prevItem.path).node.isSelected = false;
|
365
|
+
this.selectionModel.deselect(prevItem);
|
366
|
+
}
|
367
|
+
item.node.isSelected = true;
|
368
|
+
this.selectionModel.select(runTimeTreeItem);
|
369
|
+
}
|
370
|
+
else {
|
371
|
+
item.node.isSelected = false;
|
372
|
+
this.selectionModel.deselect(runTimeTreeItem);
|
373
|
+
}
|
374
|
+
if (this.highlightPath) {
|
375
|
+
if (evt.target.checked && prevItem) {
|
376
|
+
const prevItemNodePathsSeq = this.getParentPaths(prevItem.path);
|
377
|
+
if (prevItemNodePathsSeq.length > 0) {
|
378
|
+
prevItemNodePathsSeq.forEach((nodePath) => {
|
379
|
+
this.updateRunTimeSelectionRecursiveState(nodePath, 'allNotSelected');
|
380
|
+
this.syncStateChangesAtPath(nodePath);
|
381
|
+
});
|
382
|
+
}
|
383
|
+
}
|
384
|
+
const nodePathsSeq = this.getParentPaths(path);
|
385
|
+
if (nodePathsSeq?.length > 0) {
|
386
|
+
nodePathsSeq.forEach((nodePath) => {
|
387
|
+
this.updateRunTimeSelectionRecursiveState(nodePath, evt.target.checked ? 'indeterminate' : 'allNotSelected');
|
388
|
+
this.syncStateChangesAtPath(nodePath);
|
389
|
+
});
|
390
|
+
this.changeDetectorRef.detectChanges();
|
391
|
+
}
|
215
392
|
}
|
216
|
-
}
|
217
|
-
// Calculates to the node and its children node state
|
218
|
-
this.setRunTimeSelectionRecursiveStateTree(path, this.calculateItemSelectionRecursiveState(structuredClone(this.getTreeItem(path))));
|
219
|
-
// It is here for the filter edge case.
|
220
|
-
this.syncStateChangesAtPath(path);
|
221
|
-
if (hasParent) {
|
222
|
-
// Calculates parent path
|
223
|
-
const parentPath = pathArr.join('.');
|
224
|
-
// Creating node index sequence f.e If path is '1.2' it will be [1,2]
|
225
|
-
const nodeIndexSeq = parentPath.split('.').map((indexStr) => parseInt(indexStr, 10));
|
226
|
-
// Calculating the node paths array to be re-calculated from bottom to top
|
227
|
-
const nodePathsSeq = [];
|
228
|
-
nodeIndexSeq.forEach((nodeIndex, index) => {
|
229
|
-
nodePathsSeq[index] = nodeIndexSeq.slice(0, index + 1).join('.');
|
230
|
-
});
|
231
|
-
nodePathsSeq.reverse();
|
232
|
-
nodePathsSeq.forEach((nodePath) => {
|
233
|
-
this.updateRunTimeSelectionRecursiveState(nodePath, this.decideSelectionRecursiveState(this.getRunTimeSelectionRecursiveState(nodePath)));
|
234
|
-
this.syncStateChangesAtPath(nodePath);
|
235
|
-
});
|
236
|
-
this.changeDetectorRef.detectChanges();
|
237
393
|
}
|
238
394
|
}
|
239
395
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
240
396
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
241
|
-
onSelectFn(path
|
242
|
-
if (
|
397
|
+
onSelectFn(path) {
|
398
|
+
if (this.getTreeItem(path)?.node?.selectable) {
|
243
399
|
const nodeSelected = this.nodeSelected.bind(this);
|
244
400
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
245
401
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -251,23 +407,54 @@ class EuiTreeComponent {
|
|
251
407
|
console.warn('treeItemModel.node.selectable is false, you can not implement onSelect');
|
252
408
|
};
|
253
409
|
}
|
410
|
+
getRunTimeSelectionRecursiveState(path) {
|
411
|
+
const indexArr = this.resolvePath(path);
|
412
|
+
let nodeArr = this.runTimeSelectionRecursiveState;
|
413
|
+
let node;
|
414
|
+
indexArr?.forEach((pathIndex, index) => {
|
415
|
+
if (index < indexArr.length - 1) {
|
416
|
+
nodeArr = nodeArr[pathIndex]?.children;
|
417
|
+
}
|
418
|
+
else {
|
419
|
+
node = nodeArr[pathIndex];
|
420
|
+
}
|
421
|
+
});
|
422
|
+
return node;
|
423
|
+
}
|
254
424
|
initTree() {
|
255
425
|
if (this.nodes) {
|
256
426
|
this._isMultiLevel = this.checkIfMultiLevel(this.nodes);
|
257
427
|
this.processedNodes = this.processInputs(structuredClone(this.nodes));
|
258
|
-
this.createTreeDataRuntime(this.processedNodes);
|
259
|
-
this.
|
428
|
+
this.treeDataRunTime = this.createTreeDataRuntime(this.processedNodes);
|
429
|
+
this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);
|
430
|
+
this.runTimeSelectionRecursiveState = this.createRunTimeSelectionRecursiveState(this.processedNodes);
|
260
431
|
this.treeDataRunTimeBackup = structuredClone(this.treeDataRunTime);
|
261
|
-
this.
|
262
|
-
this.
|
432
|
+
// console.log(this.processedNodes,this.treeDataRunTime);
|
433
|
+
if (this.treeDataRunTimeBackup.length > 800) {
|
434
|
+
this.treePagination = new EuiTreePagination(this.treeDataRunTimeBackup, 1, 2, 400);
|
435
|
+
const paginatedData = this.treePagination.getViewData().data;
|
436
|
+
this.cdkArrayDataSource = new ArrayDataSource(paginatedData);
|
437
|
+
this.cdkTreeControl = new NestedTreeControl((node) => node?.children, {
|
438
|
+
trackBy: this.trackByControl,
|
439
|
+
});
|
440
|
+
this.cdkTreeControl.dataNodes = paginatedData;
|
441
|
+
this.runScrollListener();
|
442
|
+
}
|
443
|
+
else {
|
444
|
+
this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);
|
445
|
+
this.cdkTreeControl = new NestedTreeControl((node) => node?.children, {
|
446
|
+
trackBy: this.trackByControl,
|
447
|
+
});
|
448
|
+
this.cdkTreeControl.dataNodes = this.treeDataRunTime;
|
449
|
+
}
|
263
450
|
this.renderInitialExpand(this.treeDataRunTime);
|
264
451
|
this.selectionModel = new SelectionModel(true, this.getInitialSelection(this.treeDataRunTime), true, (a, b) => a?.path === b?.path);
|
265
|
-
this._selection = [...this.selectionModel.selected]?.map((item) => this.getTreeItem(item
|
452
|
+
this._selection = [...this.selectionModel.selected]?.map((item) => this.getTreeItem(item?.path));
|
266
453
|
this.renderTree = true;
|
267
454
|
if (this.selectionModelSubs) {
|
268
455
|
this.selectionModelSubs.unsubscribe();
|
269
456
|
}
|
270
|
-
this.selectionModelSubs = this.selectionModel.changed.subscribe((sc) => {
|
457
|
+
this.selectionModelSubs = this.selectionModel.changed.pipe(debounceTime(1)).subscribe((sc) => {
|
271
458
|
const selectionChange = {
|
272
459
|
added: sc.added.map((_) => this.getTreeItem(_.path)),
|
273
460
|
removed: sc.removed.map((_) => this.getTreeItem(_.path)),
|
@@ -283,10 +470,13 @@ class EuiTreeComponent {
|
|
283
470
|
if (this.isMultiselect) {
|
284
471
|
treeData = this.overrideTreeDataModelForSelection(treeData, this.isRecursiveSelection, !this.isRecursiveParentSelection);
|
285
472
|
}
|
473
|
+
if (this.isSingleSelect) {
|
474
|
+
treeData = this.overrideTreeDataModelForSelection(treeData, false, false, true);
|
475
|
+
}
|
286
476
|
return treeData;
|
287
477
|
}
|
288
|
-
overrideTreeDataModelForSelection(nodeArr, isRecursive, noAutoSelectParent) {
|
289
|
-
return nodeArr?.map((item) => {
|
478
|
+
overrideTreeDataModelForSelection(nodeArr, isRecursive, noAutoSelectParent, singleSelect) {
|
479
|
+
return nodeArr?.map((item, index) => {
|
290
480
|
if (item?.children && item.children.length > 0) {
|
291
481
|
return {
|
292
482
|
...item,
|
@@ -303,9 +493,12 @@ class EuiTreeComponent {
|
|
303
493
|
noAutoSelectParent: typeof item?.node?.selectConfig?.noAutoSelectParent === 'undefined'
|
304
494
|
? noAutoSelectParent
|
305
495
|
: item?.node?.selectConfig?.noAutoSelectParent,
|
496
|
+
singleSelect: typeof item?.node?.selectConfig?.singleSelect === 'undefined'
|
497
|
+
? singleSelect
|
498
|
+
: item?.node?.selectConfig?.singleSelect,
|
306
499
|
},
|
307
500
|
},
|
308
|
-
children: this.overrideTreeDataModelForSelection(item.children, isRecursive, noAutoSelectParent),
|
501
|
+
children: this.overrideTreeDataModelForSelection(item.children, isRecursive, noAutoSelectParent, singleSelect),
|
309
502
|
};
|
310
503
|
}
|
311
504
|
else {
|
@@ -314,11 +507,67 @@ class EuiTreeComponent {
|
|
314
507
|
node: {
|
315
508
|
...item.node,
|
316
509
|
selectable: typeof item?.node?.selectable === 'undefined' ? true : item?.node?.selectable,
|
510
|
+
selectConfig: {
|
511
|
+
...item.node?.selectConfig,
|
512
|
+
singleSelect: typeof item?.node?.selectConfig?.singleSelect === 'undefined'
|
513
|
+
? singleSelect
|
514
|
+
: item?.node?.selectConfig?.singleSelect,
|
515
|
+
},
|
317
516
|
},
|
318
517
|
};
|
319
518
|
}
|
320
519
|
});
|
321
520
|
}
|
521
|
+
runScrollListener() {
|
522
|
+
this.scrollDispatcherSubs = this.scrollDispatcher.scrolled().subscribe((scrollable) => {
|
523
|
+
if (scrollable && this.checkIfCurrentScrollable(scrollable)) {
|
524
|
+
const isAtBottom = scrollable?.getElementRef().nativeElement.scrollTop + scrollable?.getElementRef().nativeElement.clientHeight >=
|
525
|
+
scrollable?.getElementRef().nativeElement.scrollHeight;
|
526
|
+
const isAtTop = scrollable?.getElementRef().nativeElement.scrollTop === 0;
|
527
|
+
// console.log('Element:', this.cdkScrollableRef.getElementRef());
|
528
|
+
if (isAtBottom && !this.treePagination.isAtMax()) {
|
529
|
+
if (this.nodes.length > 0) {
|
530
|
+
this.treeDataRunTime = this.treePagination.paginateNext().data;
|
531
|
+
this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);
|
532
|
+
this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);
|
533
|
+
this.cdkTreeControl = new NestedTreeControl((node) => node?.children, {
|
534
|
+
trackBy: this.trackByControl,
|
535
|
+
});
|
536
|
+
this.cdkTreeControl.dataNodes = this.treeDataRunTime;
|
537
|
+
this.renderTree = false;
|
538
|
+
this.changeDetectorRef.detectChanges();
|
539
|
+
this.renderTree = true;
|
540
|
+
this.changeDetectorRef.detectChanges();
|
541
|
+
this.expandAll();
|
542
|
+
const totalHeight = scrollable.measureScrollOffset('bottom') + scrollable.measureScrollOffset('top');
|
543
|
+
const viewportHeight = scrollable.getElementRef().nativeElement.clientHeight;
|
544
|
+
const positionToScroll = totalHeight - viewportHeight;
|
545
|
+
scrollable.scrollTo({ top: positionToScroll / 2 });
|
546
|
+
}
|
547
|
+
}
|
548
|
+
else if (isAtTop && this.treePagination.getCurrentStartPage() > 1) {
|
549
|
+
if (this.nodes.length > 0) {
|
550
|
+
this.treeDataRunTime = this.treePagination.paginatePrev().data;
|
551
|
+
this.treeDataRunTime = this.applyRunTimeLastItems(this.treeDataRunTime);
|
552
|
+
this.cdkArrayDataSource = new ArrayDataSource(this.treeDataRunTime);
|
553
|
+
this.cdkTreeControl = new NestedTreeControl((node) => node?.children, {
|
554
|
+
trackBy: this.trackByControl,
|
555
|
+
});
|
556
|
+
this.cdkTreeControl.dataNodes = this.treeDataRunTime;
|
557
|
+
this.renderTree = false;
|
558
|
+
this.changeDetectorRef.detectChanges();
|
559
|
+
this.renderTree = true;
|
560
|
+
this.changeDetectorRef.detectChanges();
|
561
|
+
this.expandAll();
|
562
|
+
const totalHeight = scrollable.measureScrollOffset('bottom') + scrollable.measureScrollOffset('top');
|
563
|
+
const viewportHeight = scrollable.getElementRef().nativeElement.clientHeight;
|
564
|
+
const positionToScroll = totalHeight - viewportHeight;
|
565
|
+
scrollable.scrollTo({ top: positionToScroll / 2 + viewportHeight });
|
566
|
+
}
|
567
|
+
}
|
568
|
+
}
|
569
|
+
});
|
570
|
+
}
|
322
571
|
getSelectionIndexOfItem(runTimeTreeItem) {
|
323
572
|
return this.selectionModel.selected.findIndex((i) => i?.path === runTimeTreeItem?.path);
|
324
573
|
}
|
@@ -336,54 +585,65 @@ class EuiTreeComponent {
|
|
336
585
|
this.selectionModel.setSelection(...newSelection);
|
337
586
|
}
|
338
587
|
}
|
339
|
-
// Creates treeDataRunTime & runTimeSelectionRecursiveState for separate the logic.
|
340
588
|
createTreeDataRuntime(nodes) {
|
341
|
-
|
342
|
-
return this.calculateRunTimeState(
|
589
|
+
return structuredClone(nodes)?.map((item, index) => {
|
590
|
+
return this.calculateRunTimeState(item, index);
|
343
591
|
});
|
344
|
-
|
592
|
+
}
|
593
|
+
applyRunTimeLastItems(items) {
|
594
|
+
return items?.map((item, index) => {
|
595
|
+
if (item?.children) {
|
596
|
+
return {
|
597
|
+
...item,
|
598
|
+
last: items.length === index + 1 ? true : undefined,
|
599
|
+
children: item.children?.length > 0 ? this.applyRunTimeLastItems(item.children) : item?.children,
|
600
|
+
};
|
601
|
+
}
|
602
|
+
else {
|
603
|
+
return {
|
604
|
+
...item,
|
605
|
+
last: items.length === index + 1 ? true : undefined,
|
606
|
+
};
|
607
|
+
}
|
608
|
+
});
|
609
|
+
}
|
610
|
+
createRunTimeSelectionRecursiveState(nodes) {
|
611
|
+
return structuredClone(nodes)?.map((item) => this.calculateItemSelectionRecursiveState({ ...item }));
|
345
612
|
}
|
346
613
|
// Creating run time state which includes children selection state for selection tree.
|
347
|
-
calculateItemSelectionRecursiveState(treeItem) {
|
614
|
+
calculateItemSelectionRecursiveState(treeItem, isSelected) {
|
615
|
+
const childrenSelectionRecursive = [];
|
348
616
|
if (treeItem.children && treeItem.children.length > 0) {
|
349
617
|
treeItem.children.forEach((child, index) => {
|
350
|
-
|
618
|
+
childrenSelectionRecursive[index] = this.calculateItemSelectionRecursiveState(child);
|
351
619
|
});
|
352
620
|
}
|
353
|
-
const
|
621
|
+
const childStates = childrenSelectionRecursive.map((_) => _.selectionRecursiveState);
|
622
|
+
const itemState = this.decideSelectionRecursiveState(childStates, isSelected || treeItem.node.isSelected, treeItem.node?.selectConfig?.recursive, treeItem.node?.selectConfig?.noAutoSelectParent);
|
354
623
|
return {
|
355
|
-
...treeItem,
|
356
624
|
selectionRecursiveState: itemState,
|
625
|
+
children: childrenSelectionRecursive,
|
357
626
|
};
|
358
627
|
}
|
359
|
-
decideSelectionRecursiveState(
|
360
|
-
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
361
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
362
|
-
const runTimeItems = treeItem.children || [];
|
363
|
-
const childStates = runTimeItems?.map((item) => item.selectionRecursiveState);
|
628
|
+
decideSelectionRecursiveState(childStates = [], isSelected, recursive, noAutoSelectParent) {
|
364
629
|
let itemState = 'indeterminate';
|
365
|
-
if (
|
630
|
+
if (isSelected && childStates.every((state) => state === 'allSelected')) {
|
366
631
|
itemState = 'allSelected';
|
367
632
|
}
|
368
|
-
else if (!
|
633
|
+
else if (!isSelected && childStates.every((state) => state === 'allNotSelected')) {
|
369
634
|
itemState = 'allNotSelected';
|
370
635
|
}
|
371
|
-
else if (
|
372
|
-
childStates.every((state) => state === 'allSelected') &&
|
373
|
-
!treeItem.node.isSelected &&
|
374
|
-
!treeItem?.node?.selectConfig?.noAutoSelectParent) {
|
636
|
+
else if (recursive && childStates.every((state) => state === 'allSelected') && !isSelected && !noAutoSelectParent) {
|
375
637
|
itemState = 'allSelected';
|
376
638
|
}
|
377
|
-
else if (
|
378
|
-
childStates.every((state) => state === 'allNotSelected') &&
|
379
|
-
treeItem.node.isSelected) {
|
639
|
+
else if (recursive && childStates.every((state) => state === 'allNotSelected') && isSelected) {
|
380
640
|
itemState = 'allNotSelected';
|
381
641
|
}
|
382
642
|
return itemState;
|
383
643
|
}
|
384
644
|
syncStateChangesAtPath(nodePath) {
|
385
645
|
const treeItem = this.getTreeItem(nodePath);
|
386
|
-
const runTimeTreeItem = this.
|
646
|
+
const runTimeTreeItem = this.getRunTimeBackupTreeItem(nodePath);
|
387
647
|
const runTimeSelectionRecursiveItem = this.getRunTimeSelectionRecursiveState(nodePath);
|
388
648
|
if (treeItem?.node?.selectable && treeItem.node?.selectConfig?.recursive) {
|
389
649
|
if (!treeItem.node?.selectConfig?.noAutoSelectParent) {
|
@@ -402,27 +662,37 @@ class EuiTreeComponent {
|
|
402
662
|
};
|
403
663
|
}
|
404
664
|
// console.log(treeItem, treeItem.node.treeContentBlock.label, 'isSelected:' + treeItem.node.isSelected, 'isIndeterminate:' + treeItem.node.isIndeterminate);
|
405
|
-
if (treeItem.node.isSelected === true) {
|
665
|
+
if (treeItem.node.isSelected === true && !this.selectionModel.isSelected(runTimeTreeItem)) {
|
406
666
|
this.selectTreeItem(runTimeTreeItem);
|
407
667
|
}
|
408
|
-
else {
|
668
|
+
else if (treeItem.node.isSelected === false && this.selectionModel.isSelected(runTimeTreeItem)) {
|
409
669
|
this.deselectTreeItem(runTimeTreeItem);
|
410
670
|
}
|
411
671
|
}
|
412
672
|
}
|
413
|
-
|
673
|
+
setTreeData(path, item) {
|
414
674
|
const indexArr = this.resolvePath(path);
|
415
|
-
let
|
416
|
-
let node;
|
675
|
+
let itemArr = this.processedNodes;
|
417
676
|
indexArr.forEach((pathIndex, index) => {
|
418
677
|
if (index < indexArr.length - 1) {
|
419
|
-
|
678
|
+
itemArr = itemArr[pathIndex]?.children;
|
420
679
|
}
|
421
680
|
else {
|
422
|
-
|
681
|
+
itemArr[pathIndex] = item;
|
682
|
+
}
|
683
|
+
});
|
684
|
+
}
|
685
|
+
setTreeDataRunTime(path, item) {
|
686
|
+
const indexArr = this.resolvePath(path);
|
687
|
+
let itemArr = this.treeDataRunTime;
|
688
|
+
indexArr.forEach((pathIndex, index) => {
|
689
|
+
if (index < indexArr.length - 1) {
|
690
|
+
itemArr = itemArr[pathIndex]?.children;
|
691
|
+
}
|
692
|
+
else {
|
693
|
+
itemArr[pathIndex] = item;
|
423
694
|
}
|
424
695
|
});
|
425
|
-
return node;
|
426
696
|
}
|
427
697
|
setRunTimeSelectionRecursiveStateTree(path, item) {
|
428
698
|
const indexArr = this.resolvePath(path);
|
@@ -451,53 +721,90 @@ class EuiTreeComponent {
|
|
451
721
|
}
|
452
722
|
});
|
453
723
|
}
|
454
|
-
setIsCheckedForAll(nodeArr, isChecked
|
455
|
-
nodeArr.forEach((
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
isSelected: isChecked,
|
462
|
-
isIndeterminate: false,
|
463
|
-
},
|
464
|
-
};
|
724
|
+
setIsCheckedForAll(nodeArr, isChecked) {
|
725
|
+
nodeArr.forEach((runTimeItem, index) => {
|
726
|
+
const treeItem = this.getTreeItem(runTimeItem.path);
|
727
|
+
const node = treeItem.node;
|
728
|
+
if (node?.selectable) {
|
729
|
+
node.isSelected = isChecked;
|
730
|
+
node.isIndeterminate = false;
|
465
731
|
if (isChecked) {
|
466
|
-
this.selectTreeItem(
|
732
|
+
this.selectTreeItem(runTimeItem);
|
467
733
|
}
|
468
734
|
else {
|
469
|
-
this.deselectTreeItem(
|
735
|
+
this.deselectTreeItem(runTimeItem);
|
470
736
|
}
|
471
737
|
}
|
472
|
-
if (
|
473
|
-
this.setIsCheckedForAll(nodeArr[index].children, isChecked
|
738
|
+
if (runTimeItem?.children?.length > 0 && runTimeItem?.children && runTimeItem?.children.length > 0) {
|
739
|
+
this.setIsCheckedForAll(nodeArr[index].children, isChecked);
|
474
740
|
}
|
475
741
|
});
|
476
742
|
}
|
743
|
+
runStateChangesForAll(nodeArr) {
|
744
|
+
nodeArr.forEach((runTimeItem, index) => {
|
745
|
+
if (runTimeItem?.children?.length > 0 && runTimeItem?.children && runTimeItem?.children.length > 0) {
|
746
|
+
this.syncSelectionAtPath(runTimeItem);
|
747
|
+
this.runStateChangesForAll(nodeArr[index].children);
|
748
|
+
}
|
749
|
+
});
|
750
|
+
}
|
751
|
+
syncSelectionAtPath(runTimeTreeItem) {
|
752
|
+
// It is here for the filter edge case.
|
753
|
+
this.syncStateChangesAtPath(runTimeTreeItem.path);
|
754
|
+
// Sets isSelected change on the control.
|
755
|
+
if (this.getTreeItem(runTimeTreeItem.path).node.isSelected) {
|
756
|
+
this.selectTreeItem(runTimeTreeItem);
|
757
|
+
}
|
758
|
+
else {
|
759
|
+
this.deselectTreeItem(runTimeTreeItem);
|
760
|
+
}
|
761
|
+
}
|
477
762
|
resolvePath(path) {
|
478
763
|
return path?.split('.').map((index) => parseInt(index, 10));
|
479
764
|
}
|
765
|
+
getParentPaths(path) {
|
766
|
+
const pathArr = path.split('.');
|
767
|
+
const hasParent = pathArr.length > 1;
|
768
|
+
// Sets the hasParent If there is a parent, and removes the last element form pathArr.
|
769
|
+
if (hasParent) {
|
770
|
+
pathArr.pop();
|
771
|
+
// Calculates parent path
|
772
|
+
const parentPath = pathArr.join('.');
|
773
|
+
// Creating node index sequence f.e If path is '1.2' it will be [1,2]
|
774
|
+
const nodeIndexSeq = parentPath.split('.').map((indexStr) => parseInt(indexStr, 10));
|
775
|
+
// Calculating the node paths array to be re-calculated from bottom to top
|
776
|
+
const nodePathsSeq = [];
|
777
|
+
nodeIndexSeq.forEach((nodeIndex, index) => {
|
778
|
+
nodePathsSeq[index] = nodeIndexSeq.slice(0, index + 1).join('.');
|
779
|
+
});
|
780
|
+
return nodePathsSeq.reverse();
|
781
|
+
}
|
782
|
+
else {
|
783
|
+
return [];
|
784
|
+
}
|
785
|
+
}
|
480
786
|
calculateRunTimeState(treeItem, index, parentPath) {
|
481
|
-
|
482
|
-
|
483
|
-
|
787
|
+
const runTimeTreeItem = {
|
788
|
+
path: parentPath ? parentPath + '.' + index : index.toString(),
|
789
|
+
index,
|
790
|
+
};
|
791
|
+
if (treeItem.children && treeItem.children.length >= 0) {
|
792
|
+
runTimeTreeItem.children = [];
|
484
793
|
treeItem.children.forEach((child, treeItemIndex) => {
|
485
|
-
|
794
|
+
runTimeTreeItem.children[treeItemIndex] = this.calculateRunTimeState(child, treeItemIndex, runTimeTreeItem.path);
|
486
795
|
});
|
487
796
|
}
|
488
|
-
return
|
797
|
+
return runTimeTreeItem;
|
489
798
|
}
|
490
|
-
filterTreeData(
|
491
|
-
return
|
492
|
-
if (
|
493
|
-
treeItem.children = this.filterTreeData([...treeItem.children], key, filterStr);
|
494
|
-
treeItem.children = treeItem.children.length > 0 ? treeItem.children : undefined;
|
495
|
-
}
|
496
|
-
if (this.normalizedStr(treeItem.node.treeContentBlock.label).includes(this.normalizedStr(filterStr))) {
|
799
|
+
filterTreeData(runTimeTreeData, key = 'label', filterStr) {
|
800
|
+
return runTimeTreeData.filter((runTimeItem) => {
|
801
|
+
if (this.normalizedStr(this.getTreeItem(runTimeItem.path).node.treeContentBlock.label).includes(this.normalizedStr(filterStr))) {
|
497
802
|
return true;
|
498
803
|
}
|
499
|
-
else if (
|
500
|
-
|
804
|
+
else if (runTimeItem?.children?.length > 0) {
|
805
|
+
runTimeItem.children = this.filterTreeData(structuredClone(runTimeItem.children), key, filterStr);
|
806
|
+
runTimeItem.children = runTimeItem.children.length > 0 ? runTimeItem.children : undefined;
|
807
|
+
return runTimeItem?.children?.length > 0;
|
501
808
|
}
|
502
809
|
else {
|
503
810
|
return false;
|
@@ -517,7 +824,7 @@ class EuiTreeComponent {
|
|
517
824
|
}
|
518
825
|
scanSelection(nodes, selection) {
|
519
826
|
nodes.forEach((item) => {
|
520
|
-
if (item.node?.selectable && item.node.isSelected) {
|
827
|
+
if (this.getTreeItem(item.path).node?.selectable && this.getTreeItem(item.path).node.isSelected) {
|
521
828
|
selection.push(item);
|
522
829
|
}
|
523
830
|
if (item?.children?.length > 0) {
|
@@ -527,7 +834,7 @@ class EuiTreeComponent {
|
|
527
834
|
}
|
528
835
|
renderInitialExpand(nodes) {
|
529
836
|
nodes.forEach((item) => {
|
530
|
-
if (item
|
837
|
+
if (this.getTreeItem(item.path).node.isExpanded) {
|
531
838
|
this.expandAt(item.path);
|
532
839
|
}
|
533
840
|
if (item?.children?.length > 0) {
|
@@ -536,8 +843,25 @@ class EuiTreeComponent {
|
|
536
843
|
});
|
537
844
|
}
|
538
845
|
getRunTimeTreeItem(path) {
|
846
|
+
return this.findRunTimeTreeItem(this.treeDataRunTime, path);
|
847
|
+
}
|
848
|
+
findRunTimeTreeItem(treeDataRunTime, path) {
|
849
|
+
for (const runTimeItem of treeDataRunTime) {
|
850
|
+
if (runTimeItem.path === path) {
|
851
|
+
return runTimeItem;
|
852
|
+
}
|
853
|
+
else if (runTimeItem?.children?.length > 0) {
|
854
|
+
const found = this.findRunTimeTreeItem(runTimeItem.children, path);
|
855
|
+
if (found) {
|
856
|
+
return found;
|
857
|
+
}
|
858
|
+
}
|
859
|
+
}
|
860
|
+
return null;
|
861
|
+
}
|
862
|
+
getRunTimeBackupTreeItem(path) {
|
539
863
|
const indexArr = this.resolvePath(path);
|
540
|
-
let nodeArr = this.
|
864
|
+
let nodeArr = this.treeDataRunTimeBackup;
|
541
865
|
let node;
|
542
866
|
if (nodeArr && Array.isArray(nodeArr)) {
|
543
867
|
indexArr?.forEach((pathIndex, index) => {
|
@@ -559,19 +883,22 @@ class EuiTreeComponent {
|
|
559
883
|
checkIfMultiLevel(tree) {
|
560
884
|
let isMultiLevel = false;
|
561
885
|
tree.forEach((item) => {
|
562
|
-
if (item?.children?.length
|
886
|
+
if (item?.children?.length >= 0) {
|
563
887
|
isMultiLevel = true;
|
564
888
|
}
|
565
889
|
});
|
566
890
|
return isMultiLevel;
|
567
891
|
}
|
568
|
-
|
569
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.0-rc.1", type: EuiTreeComponent, selector: "eui-tree", inputs: { e2eAttr: "e2eAttr", nodes: "nodes", nodeTemplateRef: "nodeTemplateRef", nodeContentMetadataTemplateRef: "nodeContentMetadataTemplateRef", rightContextMenuTemplateRef: "rightContextMenuTemplateRef", expandedIconClass: "expandedIconClass", collapsedIconClass: "collapsedIconClass", expandedSvgIconClass: "expandedSvgIconClass", collapsedSvgIconClass: "collapsedSvgIconClass", showUnderlinedLinks: "showUnderlinedLinks", showLines: "showLines", isClickTogglingNode: "isClickTogglingNode", isMultiselect: "isMultiselect", isRecursiveSelection: "isRecursiveSelection", isRecursiveParentSelection: "isRecursiveParentSelection", autoTranslate: "autoTranslate" }, outputs: { selectionChange: "selectionChange", nodeClick: "nodeClick", nodeToggle: "nodeToggle" }, host: { properties: { "class": "this.cssClasses", "attr.data-e2e": "this.e2eAttr" } }, usesOnChanges: true, ngImport: i0, template: "<ul class=\"eui-tree__wrapper\">\n <cdk-tree [dataSource]=\"cdkArrayDataSource\" [treeControl]=\"cdkTreeControl\" [trackBy]=\"trackBy\" *ngIf=\"renderTree\" 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 treeItemModel\" class=\"eui-cdk-nested-tree-node\">\n <li\n class=\"eui-tree-node\"\n *ngIf=\"treeItemModel\"\n title=\"{{\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div class=\"eui-tree-node-wrapper\" (click)=\"onNodeClick(treeItemModel)\"\n [class.eui-tree-node-wrapper--last]=\"false\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines\">\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(treeItemModel?.path)?.node,\n onSelect: onSelectFn(treeItemModel.path, treeItemModel),\n id: uid + treeItemModel.path\n }\">\n </ng-container>\n </div>\n </div>\n </li>\n </cdk-nested-tree-node>\n <!-- This is the tree node template for expandable nodes -->\n <cdk-nested-tree-node\n *cdkTreeNodeDef=\"let treeItemModel; when: hasChild\"\n class=\"eui-cdk-nested-tree-node eui-cdk-nested-tree-node--with-child\">\n <li\n class=\"eui-tree-node\"\n *ngIf=\"treeItemModel\"\n title=\"{{\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div class=\"eui-tree-node-wrapper\"\n [class.eui-tree-node-wrapper--last]=\"false\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines\">\n <!--Here wraps the node, and listen for node clicks.-->\n <div (click)=\"onNodeClick(treeItemModel)\" 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 ' + treeItemModel?.node?.treeContentBlock?.label\"\n (click)=\"onNodeToggle(treeItemModel)\"\n cdkTreeNodeToggle\n class=\"eui-tree-node__button\">\n <span\n euiIcon\n *ngIf=\"!cdkTreeControl.isExpanded(treeItemModel) && collapsedIconClass\"\n [iconClass]=\"collapsedIconClass\"></span>\n <span\n euiIcon\n *ngIf=\"cdkTreeControl.isExpanded(treeItemModel) && expandedIconClass\"\n [iconClass]=\"expandedIconClass\"></span>\n <eui-icon-svg\n *ngIf=\"!cdkTreeControl.isExpanded(treeItemModel) && !collapsedIconClass\"\n [icon]=\"expandedSvgIconClass\"></eui-icon-svg>\n <eui-icon-svg\n *ngIf=\"cdkTreeControl.isExpanded(treeItemModel) && !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(treeItemModel?.path)?.node,\n onSelect: onSelectFn(treeItemModel?.path, treeItemModel),\n id: uid + treeItemModel.path\n }\">\n </ng-container>\n </div>\n </div>\n <!--uses cdkTreeNodeOutlet to render children nodes, CdkTreeControl is used to control isExpanded state.-->\n <ul class=\"eui-tree-node\" *ngIf=\"cdkTreeControl.isExpanded(treeItemModel)\">\n <ng-container cdkTreeNodeOutlet></ng-container>\n </ul>\n </li>\n </cdk-nested-tree-node>\n </cdk-tree>\n</ul>\n\n<ng-template #nodeTemplateDefault let-node let-onSelect=\"onSelect\" let-id=\"id\">\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?.iconClass\">\n <eui-icon\n [euiVariant]=\"node?.treeContentBlock?.iconTypeClass || 'primary'\"\n iconClass=\"{{ node?.treeContentBlock?.iconClass }}\"\n euiSizeS\n class=\"eui-u-mr-xs\">\n </eui-icon>\n </ng-container>\n <ng-container *ngIf=\"node?.treeContentBlock?.iconSvgName\">\n <eui-icon-svg\n icon=\"{{ node?.treeContentBlock?.iconSvgName }}\"\n fillColor=\"{{ node?.treeContentBlock?.iconTypeClass || 'grey-100' }}\"\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]=\"node?.isSelected\"\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 class=\"eui-u-text-link\" [class.eui-u-text-link-standalone]=\"!showUnderlinedLinks\" [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 (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", styles: [".eui-tree{display:flex;overflow-x:hidden;overflow-y:auto;position:relative;width:100%}.eui-tree::-webkit-scrollbar{display:inherit;height:6px;width:6px;background-color:var(--eui-base-color-grey-5)}.eui-tree::-webkit-scrollbar-thumb{background-color:var(--eui-base-color-grey-20);border-radius:5rem}.eui-tree::-webkit-scrollbar-thumb:hover{background-color:var(--eui-base-color-grey-35)}.eui-tree::-webkit-scrollbar-track{background-color:var(--eui-base-color-grey-5);border-radius:0}.eui-tree .eui-tree__wrapper{display:flex;list-style:none;margin:0;padding:var(--eui-base-spacing-2xs);position:relative;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{display:flex;width:auto}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child){padding-inline-start:var(--eui-base-spacing-xl)}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines:before{position:relative;left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs));display:inline-flex;border-left:1px solid var(--eui-base-color-grey-25);content:\"\";height:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines.eui-tree-node-wrapper--last:before{align-self:flex-start;display:inline-flex;height:50%;position:relative}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines .eui-tree-node-wrapper__container:before{position:relative;left:0;display:inline-flex;width:var(--eui-base-spacing-l);border-bottom:1px solid var(--eui-base-color-grey-25);border-left:1px solid var(--eui-base-color-grey-25);content:\"\";margin-left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs))}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node--with-child{display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node__metacontent{display:flex}.eui-tree .eui-tree__wrapper .eui-tree-node__button{margin-left:calc(-1 * var(--eui-base-spacing-2xs));margin-right:var(--eui-base-spacing-2xs)}.eui-tree .eui-tree__wrapper ul.eui-tree-node{padding-inline-start:var(--eui-base-spacing-l)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper{align-items:center;display:flex;min-height:var(--eui-base-spacing-xl);width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper:hover{background-color:var(--eui-base-color-grey-5)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container{align-items:center;display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-left{align-items:center;display:flex;justify-content:flex-start}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-middle{align-items:center;display:flex;justify-content:flex-start;overflow:hidden;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-right{align-items:center;display:flex;justify-content:flex-end;margin-left:auto}.eui-tree:not(.eui-tree--with-children) .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{padding-inline-start:2px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i2.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i3.EuiInputCheckboxComponent, selector: "input[euiInputCheckBox]", inputs: ["indeterminate", "isInvalid", "styleClass", "checked", "id"], outputs: ["indeterminateChange"] }, { kind: "directive", type: i4.CdkNestedTreeNode, selector: "cdk-nested-tree-node", inputs: ["role", "disabled", "tabIndex"], exportAs: ["cdkNestedTreeNode"] }, { kind: "directive", type: i4.CdkTreeNodeDef, selector: "[cdkTreeNodeDef]", inputs: ["cdkTreeNodeDefWhen"] }, { kind: "directive", type: i4.CdkTreeNodeToggle, selector: "[cdkTreeNodeToggle]", inputs: ["cdkTreeNodeToggleRecursive"] }, { kind: "component", type: i4.CdkTree, selector: "cdk-tree", inputs: ["dataSource", "treeControl", "trackBy"], exportAs: ["cdkTree"] }, { kind: "directive", type: i4.CdkTreeNodeOutlet, selector: "[cdkTreeNodeOutlet]" }, { kind: "component", type: i5.EuiButtonComponent, selector: "button[euiButton], a[euiButton]", inputs: ["e2eAttr", "id", "euiBasicButton", "euiButtonCall", "euiBlockButton", "isLoading", "euiIconButton", "euiLineWrap"], outputs: ["buttonClick"] }, { kind: "component", type: i6.EuiIconComponent, selector: "div[euiIcon], span[euiIcon], i[euiIcon], eui-icon", inputs: ["aria-label", "iconClass", "isLoading"] }, { kind: "component", type: i6.EuiIconSvgComponent, selector: "eui-icon-svg, span[euiIconSvg], i[euiIconSvg]", inputs: ["icon", "size", "fillColor", "set", "ariaLabelledby", "role", "style", "iconUrl", "transform", "aria-label", "ariaHidden", "focusable", "isLoading"] }, { kind: "component", type: i7.EuiLabelComponent, selector: "label[euiLabel], span[euiLabel], div[euiLabel], a[euiLabel], eui-label, label[euiSublabel], span[euiSublabel], div[euiSublabel], a[euiSublabel], eui-sublabel", inputs: ["euiRequired", "euiReadonly", "euiSublabel"] }, { kind: "component", type: i8.EuiBadgeComponent, selector: "div[euiBadge], span[euiBadge], eui-badge", inputs: ["aria-label"] }, { kind: "component", type: i9.EuiChipComponent, selector: "eui-chip, span[euiChip], li[euiChip]", inputs: ["euiInternalId", "tooltipMessage", "id", "data", "isChipRemovable", "isSquared"], outputs: ["remove"] }, { kind: "component", type: i10.EuiDropdownComponent, selector: "eui-dropdown", inputs: ["e2eAttr", "tabIndex", "width", "position", "isDropDownRightAligned", "isClosedOnClickInside", "isLabelUpdatedFromSelectedItem", "isExpandOnHover", "hasTabNavigation"] }, { kind: "directive", type: i10.EuiDropdownContentDirective, selector: "eui-dropdown-content" }, { kind: "pipe", type: i11.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
892
|
+
checkIfCurrentScrollable(scrolled) {
|
893
|
+
return scrolled.getElementRef().nativeElement === this.cdkScrollableRef.getElementRef().nativeElement;
|
894
|
+
}
|
895
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: EuiTreeComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.ScrollDispatcher }], target: i0.ɵɵFactoryTarget.Component }); }
|
896
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.0.0-rc.1", type: EuiTreeComponent, selector: "eui-tree", inputs: { e2eAttr: "e2eAttr", nodes: "nodes", nodeTemplateRef: "nodeTemplateRef", nodeContentMetadataTemplateRef: "nodeContentMetadataTemplateRef", rightContextMenuTemplateRef: "rightContextMenuTemplateRef", expandedIconClass: "expandedIconClass", collapsedIconClass: "collapsedIconClass", expandedSvgIconClass: "expandedSvgIconClass", collapsedSvgIconClass: "collapsedSvgIconClass", isClickTogglingNode: "isClickTogglingNode", isMultiselect: "isMultiselect", isSingleSelect: "isSingleSelect", isRecursiveSelection: "isRecursiveSelection", isRecursiveParentSelection: "isRecursiveParentSelection", showUnderlinedLinks: "showUnderlinedLinks", showLines: "showLines", autoTranslate: "autoTranslate", highlightPath: "highlightPath" }, outputs: { selectionChange: "selectionChange", nodeClick: "nodeClick", nodeToggle: "nodeToggle" }, host: { properties: { "class": "this.cssClasses", "attr.data-e2e": "this.e2eAttr" } }, viewQueries: [{ propertyName: "cdkScrollableRef", first: true, predicate: ["cdkScrollableRef"], descendants: true, read: CdkScrollable }, { propertyName: "treeComponentInstance", first: true, predicate: ["treeComponentInstance"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ul class=\"eui-tree__wrapper\" cdkScrollable #cdkScrollableRef style=\"overflow: auto; max-height: 400px\">\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 <li\n class=\"eui-tree-node\"\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 (click)=\"onNodeClick(treeRunTimeItemModel)\"\n [class.eui-tree-node-wrapper--last]=\"treeRunTimeItemModel.last\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines && _isMultiLevel\">\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 }\">\n </ng-container>\n </div>\n </div>\n </li>\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 <li\n class=\"eui-tree-node\"\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 [class.eui-tree-node-wrapper--last]=\"treeRunTimeItemModel.last\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines\">\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 <span\n euiIcon\n *ngIf=\"!cdkTreeControl.isExpanded(treeRunTimeItemModel) && collapsedIconClass\"\n [iconClass]=\"collapsedIconClass\"></span>\n <span\n euiIcon\n *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel) && expandedIconClass\"\n [iconClass]=\"expandedIconClass\"></span>\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 }\">\n </ng-container>\n </div>\n </div>\n <!--uses cdkTreeNodeOutlet to render children nodes, CdkTreeControl is used to control isExpanded state.-->\n <ul class=\"eui-tree-node\" *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel)\">\n <ng-container cdkTreeNodeOutlet></ng-container>\n </ul>\n </li>\n </cdk-nested-tree-node>\n </cdk-tree>\n</ul>\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?.iconClass\">\n <eui-icon\n [euiVariant]=\"node?.treeContentBlock?.iconTypeClass || 'primary'\"\n iconClass=\"{{ node?.treeContentBlock?.iconClass }}\"\n euiSizeS\n class=\"eui-u-mr-xs\">\n </eui-icon>\n </ng-container>\n <ng-container *ngIf=\"node?.treeContentBlock?.iconSvgName\">\n <eui-icon-svg\n icon=\"{{ node?.treeContentBlock?.iconSvgName }}\"\n fillColor=\"{{ node?.treeContentBlock?.iconTypeClass || 'grey-100' }}\"\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", styles: [".eui-tree{display:flex;overflow-x:hidden;overflow-y:auto;position:relative;width:100%}.eui-tree::-webkit-scrollbar{display:inherit;height:6px;width:6px;background-color:var(--eui-base-color-grey-5)}.eui-tree::-webkit-scrollbar-thumb{background-color:var(--eui-base-color-grey-20);border-radius:5rem}.eui-tree::-webkit-scrollbar-thumb:hover{background-color:var(--eui-base-color-grey-50)}.eui-tree::-webkit-scrollbar-track{background-color:var(--eui-base-color-grey-5);border-radius:0}.eui-tree .eui-tree__wrapper{display:flex;list-style:none;margin:0;padding:var(--eui-base-spacing-2xs);position:relative;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{display:flex;width:auto}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child){padding-inline-start:var(--eui-base-spacing-xl)}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines:before{position:relative;left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs));display:inline-flex;border-left:1px solid var(--eui-base-color-grey-25);content:\"\";height:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines.eui-tree-node-wrapper--last:before{align-self:flex-start;display:inline-flex;height:50%;position:relative}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines .eui-tree-node-wrapper__container:before{position:relative;left:0;display:inline-flex;width:var(--eui-base-spacing-l);border-bottom:1px solid var(--eui-base-color-grey-25);border-left:1px solid var(--eui-base-color-grey-25);content:\"\";margin-left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs))}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node--with-child{display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node__metacontent{display:flex}.eui-tree .eui-tree__wrapper .eui-tree-node__button{margin-left:calc(-1 * var(--eui-base-spacing-2xs));margin-right:var(--eui-base-spacing-2xs)}.eui-tree .eui-tree__wrapper ul.eui-tree-node{padding-inline-start:var(--eui-base-spacing-l)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper{align-items:center;display:flex;min-height:var(--eui-base-spacing-xl);width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper:hover{background-color:var(--eui-base-color-grey-5)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container{align-items:center;display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-left{align-items:center;display:flex;justify-content:flex-start}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-middle{align-items:center;display:flex;justify-content:flex-start;overflow:hidden;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-right{align-items:center;display:flex;justify-content:flex-end;margin-left:auto}.eui-tree:not(.eui-tree--with-children) .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{padding-inline-start:2px}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i4.EuiInputCheckboxComponent, selector: "input[euiInputCheckBox]", inputs: ["indeterminate", "isInvalid", "styleClass", "checked", "id"], outputs: ["indeterminateChange"] }, { kind: "directive", type: i5.CdkNestedTreeNode, selector: "cdk-nested-tree-node", inputs: ["role", "disabled", "tabIndex"], exportAs: ["cdkNestedTreeNode"] }, { kind: "directive", type: i5.CdkTreeNodeDef, selector: "[cdkTreeNodeDef]", inputs: ["cdkTreeNodeDefWhen"] }, { kind: "directive", type: i5.CdkTreeNodeToggle, selector: "[cdkTreeNodeToggle]", inputs: ["cdkTreeNodeToggleRecursive"] }, { kind: "component", type: i5.CdkTree, selector: "cdk-tree", inputs: ["dataSource", "treeControl", "trackBy"], exportAs: ["cdkTree"] }, { kind: "directive", type: i5.CdkTreeNodeOutlet, selector: "[cdkTreeNodeOutlet]" }, { kind: "component", type: i6.EuiButtonComponent, selector: "button[euiButton], a[euiButton]", inputs: ["e2eAttr", "id", "euiBasicButton", "euiButtonCall", "euiBlockButton", "isLoading", "euiIconButton", "euiLineWrap"], outputs: ["buttonClick"] }, { kind: "component", type: i7.EuiIconComponent, selector: "div[euiIcon], span[euiIcon], i[euiIcon], eui-icon", inputs: ["aria-label", "iconClass", "isLoading"] }, { kind: "component", type: i7.EuiIconSvgComponent, selector: "eui-icon-svg, span[euiIconSvg], i[euiIconSvg]", inputs: ["icon", "size", "fillColor", "set", "ariaLabelledby", "role", "style", "iconUrl", "transform", "aria-label", "ariaHidden", "focusable", "isLoading"] }, { kind: "component", type: i8.EuiLabelComponent, selector: "label[euiLabel], span[euiLabel], div[euiLabel], a[euiLabel], eui-label, label[euiSublabel], span[euiSublabel], div[euiSublabel], a[euiSublabel], eui-sublabel", inputs: ["euiRequired", "euiReadonly", "euiSublabel"] }, { kind: "component", type: i9.EuiBadgeComponent, selector: "div[euiBadge], span[euiBadge], eui-badge", inputs: ["aria-label"] }, { kind: "component", type: i10.EuiChipComponent, selector: "eui-chip, span[euiChip], li[euiChip]", inputs: ["euiInternalId", "tooltipMessage", "id", "data", "isChipRemovable", "isSquared"], outputs: ["remove"] }, { kind: "component", type: i11.EuiDropdownComponent, selector: "eui-dropdown", inputs: ["e2eAttr", "tabIndex", "width", "position", "isDropDownRightAligned", "isClosedOnClickInside", "isLabelUpdatedFromSelectedItem", "isExpandOnHover", "hasTabNavigation"] }, { kind: "directive", type: i11.EuiDropdownContentDirective, selector: "eui-dropdown-content" }, { kind: "directive", type: i1.CdkScrollable, selector: "[cdk-scrollable], [cdkScrollable]" }, { kind: "pipe", type: i12.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
570
897
|
}
|
571
898
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: EuiTreeComponent, decorators: [{
|
572
899
|
type: Component,
|
573
|
-
args: [{ selector: 'eui-tree', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<ul class=\"eui-tree__wrapper\">\n <cdk-tree [dataSource]=\"cdkArrayDataSource\" [treeControl]=\"cdkTreeControl\" [trackBy]=\"trackBy\" *ngIf=\"renderTree\" 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 treeItemModel\" class=\"eui-cdk-nested-tree-node\">\n <li\n class=\"eui-tree-node\"\n *ngIf=\"treeItemModel\"\n title=\"{{\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div class=\"eui-tree-node-wrapper\" (click)=\"onNodeClick(treeItemModel)\"\n [class.eui-tree-node-wrapper--last]=\"false\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines\">\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(treeItemModel?.path)?.node,\n onSelect: onSelectFn(treeItemModel.path, treeItemModel),\n id: uid + treeItemModel.path\n }\">\n </ng-container>\n </div>\n </div>\n </li>\n </cdk-nested-tree-node>\n <!-- This is the tree node template for expandable nodes -->\n <cdk-nested-tree-node\n *cdkTreeNodeDef=\"let treeItemModel; when: hasChild\"\n class=\"eui-cdk-nested-tree-node eui-cdk-nested-tree-node--with-child\">\n <li\n class=\"eui-tree-node\"\n *ngIf=\"treeItemModel\"\n title=\"{{\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.tooltipLabel ||\n getTreeItem(treeItemModel?.path)?.node?.treeContentBlock?.label\n }}\">\n <div class=\"eui-tree-node-wrapper\"\n [class.eui-tree-node-wrapper--last]=\"false\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines\">\n <!--Here wraps the node, and listen for node clicks.-->\n <div (click)=\"onNodeClick(treeItemModel)\" 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 ' + treeItemModel?.node?.treeContentBlock?.label\"\n (click)=\"onNodeToggle(treeItemModel)\"\n cdkTreeNodeToggle\n class=\"eui-tree-node__button\">\n <span\n euiIcon\n *ngIf=\"!cdkTreeControl.isExpanded(treeItemModel) && collapsedIconClass\"\n [iconClass]=\"collapsedIconClass\"></span>\n <span\n euiIcon\n *ngIf=\"cdkTreeControl.isExpanded(treeItemModel) && expandedIconClass\"\n [iconClass]=\"expandedIconClass\"></span>\n <eui-icon-svg\n *ngIf=\"!cdkTreeControl.isExpanded(treeItemModel) && !collapsedIconClass\"\n [icon]=\"expandedSvgIconClass\"></eui-icon-svg>\n <eui-icon-svg\n *ngIf=\"cdkTreeControl.isExpanded(treeItemModel) && !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(treeItemModel?.path)?.node,\n onSelect: onSelectFn(treeItemModel?.path, treeItemModel),\n id: uid + treeItemModel.path\n }\">\n </ng-container>\n </div>\n </div>\n <!--uses cdkTreeNodeOutlet to render children nodes, CdkTreeControl is used to control isExpanded state.-->\n <ul class=\"eui-tree-node\" *ngIf=\"cdkTreeControl.isExpanded(treeItemModel)\">\n <ng-container cdkTreeNodeOutlet></ng-container>\n </ul>\n </li>\n </cdk-nested-tree-node>\n </cdk-tree>\n</ul>\n\n<ng-template #nodeTemplateDefault let-node let-onSelect=\"onSelect\" let-id=\"id\">\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?.iconClass\">\n <eui-icon\n [euiVariant]=\"node?.treeContentBlock?.iconTypeClass || 'primary'\"\n iconClass=\"{{ node?.treeContentBlock?.iconClass }}\"\n euiSizeS\n class=\"eui-u-mr-xs\">\n </eui-icon>\n </ng-container>\n <ng-container *ngIf=\"node?.treeContentBlock?.iconSvgName\">\n <eui-icon-svg\n icon=\"{{ node?.treeContentBlock?.iconSvgName }}\"\n fillColor=\"{{ node?.treeContentBlock?.iconTypeClass || 'grey-100' }}\"\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]=\"node?.isSelected\"\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 class=\"eui-u-text-link\" [class.eui-u-text-link-standalone]=\"!showUnderlinedLinks\" [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 (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", styles: [".eui-tree{display:flex;overflow-x:hidden;overflow-y:auto;position:relative;width:100%}.eui-tree::-webkit-scrollbar{display:inherit;height:6px;width:6px;background-color:var(--eui-base-color-grey-5)}.eui-tree::-webkit-scrollbar-thumb{background-color:var(--eui-base-color-grey-20);border-radius:5rem}.eui-tree::-webkit-scrollbar-thumb:hover{background-color:var(--eui-base-color-grey-35)}.eui-tree::-webkit-scrollbar-track{background-color:var(--eui-base-color-grey-5);border-radius:0}.eui-tree .eui-tree__wrapper{display:flex;list-style:none;margin:0;padding:var(--eui-base-spacing-2xs);position:relative;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{display:flex;width:auto}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child){padding-inline-start:var(--eui-base-spacing-xl)}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines:before{position:relative;left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs));display:inline-flex;border-left:1px solid var(--eui-base-color-grey-25);content:\"\";height:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines.eui-tree-node-wrapper--last:before{align-self:flex-start;display:inline-flex;height:50%;position:relative}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines .eui-tree-node-wrapper__container:before{position:relative;left:0;display:inline-flex;width:var(--eui-base-spacing-l);border-bottom:1px solid var(--eui-base-color-grey-25);border-left:1px solid var(--eui-base-color-grey-25);content:\"\";margin-left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs))}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node--with-child{display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node__metacontent{display:flex}.eui-tree .eui-tree__wrapper .eui-tree-node__button{margin-left:calc(-1 * var(--eui-base-spacing-2xs));margin-right:var(--eui-base-spacing-2xs)}.eui-tree .eui-tree__wrapper ul.eui-tree-node{padding-inline-start:var(--eui-base-spacing-l)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper{align-items:center;display:flex;min-height:var(--eui-base-spacing-xl);width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper:hover{background-color:var(--eui-base-color-grey-5)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container{align-items:center;display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-left{align-items:center;display:flex;justify-content:flex-start}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-middle{align-items:center;display:flex;justify-content:flex-start;overflow:hidden;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-right{align-items:center;display:flex;justify-content:flex-end;margin-left:auto}.eui-tree:not(.eui-tree--with-children) .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{padding-inline-start:2px}\n"] }]
|
574
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { cssClasses: [{
|
900
|
+
args: [{ selector: 'eui-tree', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<ul class=\"eui-tree__wrapper\" cdkScrollable #cdkScrollableRef style=\"overflow: auto; max-height: 400px\">\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 <li\n class=\"eui-tree-node\"\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 (click)=\"onNodeClick(treeRunTimeItemModel)\"\n [class.eui-tree-node-wrapper--last]=\"treeRunTimeItemModel.last\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines && _isMultiLevel\">\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 }\">\n </ng-container>\n </div>\n </div>\n </li>\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 <li\n class=\"eui-tree-node\"\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 [class.eui-tree-node-wrapper--last]=\"treeRunTimeItemModel.last\"\n [class.eui-tree-node-wrapper--show-lines]=\"showLines\">\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 <span\n euiIcon\n *ngIf=\"!cdkTreeControl.isExpanded(treeRunTimeItemModel) && collapsedIconClass\"\n [iconClass]=\"collapsedIconClass\"></span>\n <span\n euiIcon\n *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel) && expandedIconClass\"\n [iconClass]=\"expandedIconClass\"></span>\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 }\">\n </ng-container>\n </div>\n </div>\n <!--uses cdkTreeNodeOutlet to render children nodes, CdkTreeControl is used to control isExpanded state.-->\n <ul class=\"eui-tree-node\" *ngIf=\"cdkTreeControl.isExpanded(treeRunTimeItemModel)\">\n <ng-container cdkTreeNodeOutlet></ng-container>\n </ul>\n </li>\n </cdk-nested-tree-node>\n </cdk-tree>\n</ul>\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?.iconClass\">\n <eui-icon\n [euiVariant]=\"node?.treeContentBlock?.iconTypeClass || 'primary'\"\n iconClass=\"{{ node?.treeContentBlock?.iconClass }}\"\n euiSizeS\n class=\"eui-u-mr-xs\">\n </eui-icon>\n </ng-container>\n <ng-container *ngIf=\"node?.treeContentBlock?.iconSvgName\">\n <eui-icon-svg\n icon=\"{{ node?.treeContentBlock?.iconSvgName }}\"\n fillColor=\"{{ node?.treeContentBlock?.iconTypeClass || 'grey-100' }}\"\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", styles: [".eui-tree{display:flex;overflow-x:hidden;overflow-y:auto;position:relative;width:100%}.eui-tree::-webkit-scrollbar{display:inherit;height:6px;width:6px;background-color:var(--eui-base-color-grey-5)}.eui-tree::-webkit-scrollbar-thumb{background-color:var(--eui-base-color-grey-20);border-radius:5rem}.eui-tree::-webkit-scrollbar-thumb:hover{background-color:var(--eui-base-color-grey-50)}.eui-tree::-webkit-scrollbar-track{background-color:var(--eui-base-color-grey-5);border-radius:0}.eui-tree .eui-tree__wrapper{display:flex;list-style:none;margin:0;padding:var(--eui-base-spacing-2xs);position:relative;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{display:flex;width:auto}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child){padding-inline-start:var(--eui-base-spacing-xl)}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines:before{position:relative;left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs));display:inline-flex;border-left:1px solid var(--eui-base-color-grey-25);content:\"\";height:100%}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines.eui-tree-node-wrapper--last:before{align-self:flex-start;display:inline-flex;height:50%;position:relative}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node:not(.eui-cdk-nested-tree-node--with-child) .eui-tree-node-wrapper.eui-tree-node-wrapper--show-lines .eui-tree-node-wrapper__container:before{position:relative;left:0;display:inline-flex;width:var(--eui-base-spacing-l);border-bottom:1px solid var(--eui-base-color-grey-25);border-left:1px solid var(--eui-base-color-grey-25);content:\"\";margin-left:calc(-1 * var(--eui-base-spacing-l) + var(--eui-base-spacing-2xs))}.eui-tree .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node--with-child{display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node{display:flex;flex-direction:column;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node__metacontent{display:flex}.eui-tree .eui-tree__wrapper .eui-tree-node__button{margin-left:calc(-1 * var(--eui-base-spacing-2xs));margin-right:var(--eui-base-spacing-2xs)}.eui-tree .eui-tree__wrapper ul.eui-tree-node{padding-inline-start:var(--eui-base-spacing-l)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper{align-items:center;display:flex;min-height:var(--eui-base-spacing-xl);width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper:hover{background-color:var(--eui-base-color-grey-5)}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container{align-items:center;display:flex;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-left{align-items:center;display:flex;justify-content:flex-start}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-middle{align-items:center;display:flex;justify-content:flex-start;overflow:hidden;width:100%}.eui-tree .eui-tree__wrapper .eui-tree-node-wrapper__container-right{align-items:center;display:flex;justify-content:flex-end;margin-left:auto}.eui-tree:not(.eui-tree--with-children) .eui-tree__wrapper .eui-cdk-tree .eui-cdk-nested-tree-node{padding-inline-start:2px}\n"] }]
|
901
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i1.ScrollDispatcher }], propDecorators: { cssClasses: [{
|
575
902
|
type: HostBinding,
|
576
903
|
args: ['class']
|
577
904
|
}], e2eAttr: [{
|
@@ -595,20 +922,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ng
|
|
595
922
|
type: Input
|
596
923
|
}], collapsedSvgIconClass: [{
|
597
924
|
type: Input
|
598
|
-
}],
|
599
|
-
type:
|
600
|
-
|
601
|
-
|
925
|
+
}], cdkScrollableRef: [{
|
926
|
+
type: ViewChild,
|
927
|
+
args: ['cdkScrollableRef', { read: CdkScrollable }]
|
928
|
+
}], treeComponentInstance: [{
|
929
|
+
type: ViewChild,
|
930
|
+
args: ['treeComponentInstance']
|
602
931
|
}], isClickTogglingNode: [{
|
603
932
|
type: Input
|
604
933
|
}], isMultiselect: [{
|
605
934
|
type: Input
|
935
|
+
}], isSingleSelect: [{
|
936
|
+
type: Input
|
606
937
|
}], isRecursiveSelection: [{
|
607
938
|
type: Input
|
608
939
|
}], isRecursiveParentSelection: [{
|
609
940
|
type: Input
|
941
|
+
}], showUnderlinedLinks: [{
|
942
|
+
type: Input
|
943
|
+
}], showLines: [{
|
944
|
+
type: Input
|
610
945
|
}], autoTranslate: [{
|
611
946
|
type: Input
|
947
|
+
}], highlightPath: [{
|
948
|
+
type: Input
|
612
949
|
}], selectionChange: [{
|
613
950
|
type: Output
|
614
951
|
}], nodeClick: [{
|
@@ -629,7 +966,8 @@ class EuiTreeModule {
|
|
629
966
|
EuiLabelModule,
|
630
967
|
EuiBadgeModule,
|
631
968
|
EuiChipModule,
|
632
|
-
EuiDropdownModule
|
969
|
+
EuiDropdownModule,
|
970
|
+
ScrollingModule], exports: [EuiTreeComponent] }); }
|
633
971
|
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: EuiTreeModule, imports: [CommonModule,
|
634
972
|
RouterModule,
|
635
973
|
FormsModule,
|
@@ -641,7 +979,8 @@ class EuiTreeModule {
|
|
641
979
|
EuiLabelModule,
|
642
980
|
EuiBadgeModule,
|
643
981
|
EuiChipModule,
|
644
|
-
EuiDropdownModule
|
982
|
+
EuiDropdownModule,
|
983
|
+
ScrollingModule] }); }
|
645
984
|
}
|
646
985
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: EuiTreeModule, decorators: [{
|
647
986
|
type: NgModule,
|
@@ -659,47 +998,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ng
|
|
659
998
|
EuiBadgeModule,
|
660
999
|
EuiChipModule,
|
661
1000
|
EuiDropdownModule,
|
1001
|
+
ScrollingModule,
|
662
1002
|
],
|
663
1003
|
declarations: [EuiTreeComponent],
|
664
1004
|
exports: [EuiTreeComponent],
|
665
1005
|
}]
|
666
1006
|
}] });
|
667
1007
|
|
668
|
-
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
669
|
-
function uxTreeNodesMetaDataMapper(oldTree) {
|
670
|
-
return oldTree.map((item) => {
|
671
|
-
if (item?.typeClass === 'default') {
|
672
|
-
// default typeClass will be
|
673
|
-
item.typeClass = 'secondary';
|
674
|
-
}
|
675
|
-
if (item?.badgeLabel) {
|
676
|
-
// default typeClass will be
|
677
|
-
if (item?.badges?.length > 0) {
|
678
|
-
item.badges.push({ label: item?.badgeLabel, typeClass: 'secondary' });
|
679
|
-
}
|
680
|
-
else {
|
681
|
-
item.badges = [{ label: item?.badgeLabel, typeClass: 'secondary' }];
|
682
|
-
}
|
683
|
-
}
|
684
|
-
return {
|
685
|
-
node: {
|
686
|
-
treeContentBlock: {
|
687
|
-
label: item.label,
|
688
|
-
typeLabel: item.typeLabel,
|
689
|
-
typeClass: item.typeLabel && !item.typeClass ? 'secondary' : item.typeClass,
|
690
|
-
tooltipLabel: item.tooltipLabel,
|
691
|
-
url: item.url,
|
692
|
-
urlExternal: item.urlExternal,
|
693
|
-
urlExternalTarget: item.urlExternal && item.urlExternalTarget ? item.urlExternalTarget : undefined,
|
694
|
-
badges: item.badges,
|
695
|
-
metadata: item.metadata,
|
696
|
-
},
|
697
|
-
},
|
698
|
-
children: item.children ? uxTreeNodesMetaDataMapper(item.children) : undefined,
|
699
|
-
};
|
700
|
-
});
|
701
|
-
}
|
702
|
-
|
703
1008
|
class EuiDropdownTreeDirective {
|
704
1009
|
constructor(changeDetectorRef, hostElement, renderer, euiDropdown) {
|
705
1010
|
this.changeDetectorRef = changeDetectorRef;
|
@@ -743,7 +1048,7 @@ class EuiDropdownTreeDirective {
|
|
743
1048
|
}
|
744
1049
|
return 'No node selected.';
|
745
1050
|
}
|
746
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: EuiDropdownTreeDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token:
|
1051
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: EuiDropdownTreeDirective, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i11.EuiDropdownComponent, host: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
747
1052
|
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.0-rc.1", type: EuiDropdownTreeDirective, selector: "eui-dropdown[euiDropdownTree]", inputs: { buttonTemplateRef: "buttonTemplateRef" }, queries: [{ propertyName: "euiTree", first: true, predicate: EuiTreeComponent, descendants: true }], ngImport: i0 }); }
|
748
1053
|
}
|
749
1054
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ngImport: i0, type: EuiDropdownTreeDirective, decorators: [{
|
@@ -751,7 +1056,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ng
|
|
751
1056
|
args: [{
|
752
1057
|
selector: 'eui-dropdown[euiDropdownTree]',
|
753
1058
|
}]
|
754
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type:
|
1059
|
+
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i11.EuiDropdownComponent, decorators: [{
|
755
1060
|
type: Host
|
756
1061
|
}] }], propDecorators: { buttonTemplateRef: [{
|
757
1062
|
type: Input
|
@@ -779,6 +1084,13 @@ class EuiTreeHelper {
|
|
779
1084
|
}
|
780
1085
|
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
781
1086
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
1087
|
+
getPath(value, identifierKey = 'node.treeContentBlock.id') {
|
1088
|
+
const paths = [];
|
1089
|
+
this.traverse(this.treeData, '', [value], paths, undefined, identifierKey);
|
1090
|
+
return paths[0];
|
1091
|
+
}
|
1092
|
+
// TODO: find the correct type or turn into a generic, https://www.typescriptlang.org/docs/handbook/2/generics.html
|
1093
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
782
1094
|
getPaths(values, identifierKey) {
|
783
1095
|
const paths = [];
|
784
1096
|
this.traverse(this.treeData, '', values, paths, undefined, identifierKey);
|
@@ -933,5 +1245,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.0-rc.1", ng
|
|
933
1245
|
* Generated bundle index. Do not edit.
|
934
1246
|
*/
|
935
1247
|
|
936
|
-
export { EuiDropdownTreeDirective, EuiDropdownTreeDirectiveModule, EuiTreeComponent, EuiTreeFormControlDirective, EuiTreeFormControlDirectiveModule, EuiTreeHelper, EuiTreeModule, uxTreeNodesMetaDataMapper };
|
1248
|
+
export { EuiDropdownTreeDirective, EuiDropdownTreeDirectiveModule, EuiTreeComponent, EuiTreeFormControlDirective, EuiTreeFormControlDirectiveModule, EuiTreeHelper, EuiTreeModule, EuiTreePagination, uxTreeNodesMetaDataMapper };
|
937
1249
|
//# sourceMappingURL=eui-components-eui-tree.mjs.map
|