Skip to content

Commit 4069ede

Browse files
authored
Merge pull request #391 from UiPath/fix/ui-suggest-remove-empty-space
fix(suggest): reduce height of ui-suggest when no results found
2 parents d87b801 + a424d24 commit 4069ede

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
</ng-container>
302302

303303
<mat-list-item *ngIf="loading$ | async"
304-
[style.height.px]="itemSize">
304+
[style.height.px]="baseSize">
305305
<mat-progress-spinner color="primary"
306306
mode="indeterminate"
307307
diameter="20"

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,14 @@ export class UiSuggestComponent extends UiSuggestMatFormFieldDirective
439439
return this._height$.value;
440440
}
441441

442-
const actualCount = Math.max(
443-
this.renderItems.filter(Boolean).length + (this.enableCustomValue ?
444-
(Number(this.isCustomValueVisible)) : (this.headerItems!.length)),
445-
1,
446-
);
447-
const displayedCount = Math.min(this.displayCount, actualCount);
442+
const actualCount = this.renderItems.filter(Boolean).length + (this.enableCustomValue ?
443+
(Number(this.isCustomValueVisible)) : (this.headerItems!.length));
444+
445+
if (actualCount === 0) {
446+
return this.baseSize + Number(!!this.headerItems!.length);
447+
}
448448

449+
const displayedCount = Math.min(this.displayCount, Math.max(actualCount, 1));
449450
return this.itemSize * displayedCount + Number(!!this.headerItems!.length);
450451
}
451452

projects/angular/components/ui-suggest/src/ui-suggest.mat-form-field.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ export abstract class UiSuggestMatFormFieldDirective implements
131131
get itemSize() {
132132
if (this.customItemSize) { return this.customItemSize; }
133133

134+
return this.baseSize;
135+
}
136+
137+
get baseSize() {
134138
return this.isFormControl ? 32 : 40;
135139
}
136140

0 commit comments

Comments
 (0)