Skip to content

Commit 23fd4e4

Browse files
authored
Merge pull request #235 from UiPath/fix/suggest-header-items
Fix/suggest header items
2 parents 5d7125c + 765f04b commit 23fd4e4

File tree

6 files changed

+30
-4
lines changed

6 files changed

+30
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# v13.4.1 (2022-06-22)
2+
* **suggest** hide no results when header items are available
3+
14
# v13.4.0 (2022-06-09)
25
* **suggest** implement custom header slot
36

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-components",
3-
"version": "13.4.0",
3+
"version": "13.4.1",
44
"author": {
55
"name": "UiPath Inc",
66
"url": "https://uipath.com"

projects/angular/components/ui-suggest/src/ui-suggest.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
</ng-container>
245245
</ng-container>
246246

247-
<mat-divider *ngIf="headerItems!.length"></mat-divider>
247+
<mat-divider *ngIf="headerItems!.length && !hasNoResults"></mat-divider>
248248

249249
<ng-container *cdkVirtualFor="
250250
let item of renderItems;
@@ -280,6 +280,7 @@
280280
) as label">
281281
<mat-list-item *ngIf="hasNoResults &&
282282
!isCustomValueVisible &&
283+
!headerItems!.length &&
283284
(loading$ | async) === false"
284285
[matTooltip]="label"
285286
[attr.role]="'option'"

projects/angular/components/ui-suggest/src/ui-suggest.component.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,28 @@ const sharedSpecifications = (
13911391
expect(entry.nativeElement.innerText).toBe(regularItems[idx].text);
13921392
});
13931393
}));
1394+
1395+
it('should render headerItems when searchSourceFactory is empty', fakeAsync(() => {
1396+
const headerItems = generateSuggetionItemList(1, 'Item');
1397+
const regularItems = [] as ISuggestValue[];
1398+
1399+
component.alwaysExpanded = true;
1400+
component.items = regularItems;
1401+
component.headerItems = headerItems;
1402+
component.searchable = true;
1403+
1404+
fixture.detectChanges();
1405+
tick(1000);
1406+
1407+
const itemListEntries = fixture.debugElement.queryAll(By.css('.mat-list-item'));
1408+
1409+
expect(itemListEntries).not.toBeNull();
1410+
expect(itemListEntries.length).toEqual(1);
1411+
1412+
const [item] = itemListEntries;
1413+
1414+
expect(item.nativeElement.innerText).toBe(headerItems[0].text);
1415+
}));
13941416
});
13951417

13961418
describe('Selection: single value', () => {

projects/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uipath/angular",
3-
"version": "13.4.0",
3+
"version": "13.4.1",
44
"license": "MIT",
55
"author": {
66
"name": "UiPath Inc",

0 commit comments

Comments
 (0)