From b2b2caf9225bd1a565d60b64d341d642ea6d8f04 Mon Sep 17 00:00:00 2001 From: David Fernandez Date: Wed, 17 Jul 2024 15:18:11 +0200 Subject: [PATCH 1/2] fix(MultiSelect): Check for NaN values in isSelectionAllDisabled method --- src/app/components/multiselect/multiselect.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/components/multiselect/multiselect.ts b/src/app/components/multiselect/multiselect.ts index 5bc73ae2e21..58efa82479f 100755 --- a/src/app/components/multiselect/multiselect.ts +++ b/src/app/components/multiselect/multiselect.ts @@ -1471,6 +1471,10 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft } isSelectionAllDisabled() { + if (this.showToggleAll && isNaN(this.selectionLimit)) { + return true; + } + return this.showToggleAll && ObjectUtils.isEmpty(this.selectionLimit); } From 57d95568110cd1a5cd5e955987adc5b02ca86ffe Mon Sep 17 00:00:00 2001 From: David Fernandez Date: Thu, 18 Jul 2024 14:54:47 +0200 Subject: [PATCH 2/2] Fallback value to null instead of checking for NaN --- src/app/components/multiselect/multiselect.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/app/components/multiselect/multiselect.ts b/src/app/components/multiselect/multiselect.ts index 58efa82479f..425aaabe46d 100755 --- a/src/app/components/multiselect/multiselect.ts +++ b/src/app/components/multiselect/multiselect.ts @@ -571,7 +571,7 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft * Decides how many selected item labels to show at most. * @group Props */ - @Input({ transform: numberAttribute }) selectionLimit: number | undefined; + @Input({ transform: (value: unknown) => numberAttribute(value, null) }) selectionLimit: number | null | undefined; /** * Label to display after exceeding max selected labels e.g. ({0} items selected), defaults "ellipsis" keyword to indicate a text-overflow. * @group Props @@ -1471,10 +1471,6 @@ export class MultiSelect implements OnInit, AfterViewInit, AfterContentInit, Aft } isSelectionAllDisabled() { - if (this.showToggleAll && isNaN(this.selectionLimit)) { - return true; - } - return this.showToggleAll && ObjectUtils.isEmpty(this.selectionLimit); }