Skip to content

Commit 065e802

Browse files
committed
feat(grid): react on max filters count changes
1 parent d2a4c83 commit 065e802

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,9 @@ export class UiGridComponent<T extends IGridDataEntry>
449449
*
450450
*/
451451
@Input()
452-
maxSelectedFilterValues = Infinity;
453-
452+
set maxSelectedFilterValues(value: number) {
453+
this.maxSelectedFilterValues$.next(value);
454+
}
454455
/**
455456
* Configure if the pagination should be selectable
456457
*
@@ -758,6 +759,12 @@ export class UiGridComponent<T extends IGridDataEntry>
758759
}),
759760
);
760761

762+
/**
763+
* Emits current max selected filter values count
764+
*
765+
*/
766+
maxSelectedFilterValues$ = new BehaviorSubject(Infinity);
767+
761768
/**
762769
* Emits the id of the entity that should be highlighted.
763770
*
@@ -859,8 +866,12 @@ export class UiGridComponent<T extends IGridDataEntry>
859866
);
860867

861868
disableFilterSelection$ = defer(() => this.filterManager.activeFilterValueCount$.pipe(
862-
map(count => count >= this.maxSelectedFilterValues)),
863-
).pipe(shareReplay(1));
869+
switchMap(count => this.maxSelectedFilterValues$
870+
.pipe(
871+
map(max => count >= max),
872+
)),
873+
distinctUntilChanged(),
874+
)).pipe(shareReplay(1));
864875

865876
readonly Infinity = Infinity;
866877
protected _destroyed$ = new Subject<void>();

0 commit comments

Comments
 (0)