diff --git a/projects/angular/components/ui-tree-select/src/ui-tree-select.component.html b/projects/angular/components/ui-tree-select/src/ui-tree-select.component.html index f767a5963..cf22c13f6 100644 --- a/projects/angular/components/ui-tree-select/src/ui-tree-select.component.html +++ b/projects/angular/components/ui-tree-select/src/ui-tree-select.component.html @@ -1,30 +1,37 @@ - - - - - - - - + + + + + + + + + + + - - - - - + + + + + + diff --git a/projects/angular/components/ui-tree-select/src/ui-tree-select.component.spec.ts b/projects/angular/components/ui-tree-select/src/ui-tree-select.component.spec.ts index 0a55c3698..23caddbfc 100644 --- a/projects/angular/components/ui-tree-select/src/ui-tree-select.component.spec.ts +++ b/projects/angular/components/ui-tree-select/src/ui-tree-select.component.spec.ts @@ -42,6 +42,15 @@ const DATA_STUB = [ (expanded)="expanded($event)" (collapsed)="collapsed($event)">

no data

+ + + +
+ header template +
+
+
+ { @@ -119,6 +129,14 @@ describe('UiTreeSelectComponent', () => { expect(fixture.nativeElement.textContent.trim()).toBe('no data'); }); + it('should correctly render header template', () => { + component.showHeaderTemplate = true; + fixture.detectChanges(); + const headerElement = fixture.nativeElement.querySelector('.header'); + expect(headerElement).toBeTruthy(); + expect(headerElement.textContent.trim()).toBe('header template'); + }); + it('should correctly emit selected event', () => { const nodeWithChildren = fixture.nativeElement.querySelectorAll('.tree-item-container')[0]; nodeWithChildren.click(); diff --git a/projects/angular/components/ui-tree-select/src/ui-tree-select.component.ts b/projects/angular/components/ui-tree-select/src/ui-tree-select.component.ts index 990a77a11..2dcecd8e8 100644 --- a/projects/angular/components/ui-tree-select/src/ui-tree-select.component.ts +++ b/projects/angular/components/ui-tree-select/src/ui-tree-select.component.ts @@ -62,6 +62,9 @@ export class UiTreeSelectComponent implements AfterViewInit, OnDestroy { @ViewChildren(UiTreeItemComponent) items!: QueryList; + @ContentChild('headerTemplate') + headerTemplate?: any; + @ContentChild('itemTemplate') itemTemplate?: any; diff --git a/projects/playground/src/app/pages/tree-select/tree-select.page.html b/projects/playground/src/app/pages/tree-select/tree-select.page.html index 512700b6f..b5fbd1922 100644 --- a/projects/playground/src/app/pages/tree-select/tree-select.page.html +++ b/projects/playground/src/app/pages/tree-select/tree-select.page.html @@ -3,6 +3,14 @@ (selected)="selected($event)" (expanded)="expanded($event)">

no data

+ + +
+ folder + Header +
+
+