From 5afe84ec2d3a4c1af15467e7ff993a8d6e4fa2df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mehmet=20=C3=87etin?=
<92744169+mehmetcetin01140@users.noreply.github.com>
Date: Tue, 26 Mar 2024 17:57:26 +0300
Subject: [PATCH 1/3] Fixed #14698 - p-cascadeSelect | options: not change
after new data in array of options
---
.../components/cascadeselect/cascadeselect.ts | 20 ++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/src/app/components/cascadeselect/cascadeselect.ts b/src/app/components/cascadeselect/cascadeselect.ts
index d5ae6d79178..18ed45d13af 100755
--- a/src/app/components/cascadeselect/cascadeselect.ts
+++ b/src/app/components/cascadeselect/cascadeselect.ts
@@ -18,6 +18,7 @@ import {
Output,
QueryList,
signal,
+ SimpleChanges,
TemplateRef,
ViewChild,
ViewEncapsulation
@@ -295,7 +296,7 @@ export class CascadeSelectSub implements OnInit {
(null);
+ processedOptions: string[] | string | undefined = [];
+
get containerClass() {
return {
'p-cascadeselect p-component p-inputwrapper': true,
@@ -679,11 +682,7 @@ export class CascadeSelect implements OnInit, AfterContentInit {
visibleOptions = computed(() => {
const processedOption = this.activeOptionPath().find((p) => p.key === this.focusedOptionInfo().parentKey);
- return processedOption ? processedOption.children : this.processedOptions();
- });
-
- processedOptions = computed(() => {
- return this.createProcessedOptions(this.options || []);
+ return processedOption ? processedOption.children : this.processedOptions;
});
label = computed(() => {
@@ -710,6 +709,13 @@ export class CascadeSelect implements OnInit, AfterContentInit {
return label;
}
+ ngOnChanges(changes: SimpleChanges): void {
+ if (changes.options) {
+ this.processedOptions = this.createProcessedOptions(this.options || []);
+ this.modelValue.set('');
+ }
+ }
+
hasSelectedOption() {
return ObjectUtils.isNotEmpty(this.modelValue());
}
@@ -1074,7 +1080,7 @@ export class CascadeSelect implements OnInit, AfterContentInit {
}
findOptionPathByValue(value, processedOptions?, level = 0) {
- processedOptions = processedOptions || (level === 0 && this.processedOptions());
+ processedOptions = processedOptions || (level === 0 && this.processedOptions);
if (!processedOptions) return null;
if (ObjectUtils.isEmpty(value)) return [];
From 1c347bcc172d268b68477df5d7decb615f8f997d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mehmet=20=C3=87etin?=
<92744169+mehmetcetin01140@users.noreply.github.com>
Date: Fri, 29 Mar 2024 11:58:14 +0300
Subject: [PATCH 2/3] Fixed #15195 - InputOtp | integerOnly= true => no
response to the numeric keypad
---
src/app/components/inputotp/inputotp.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/app/components/inputotp/inputotp.ts b/src/app/components/inputotp/inputotp.ts
index a1a58a3394f..058aca59fa5 100644
--- a/src/app/components/inputotp/inputotp.ts
+++ b/src/app/components/inputotp/inputotp.ts
@@ -126,7 +126,7 @@ export class InputOtp implements AfterContentInit {
value: any;
get inputMode(): string {
- return this.integerOnly ? 'number' : 'text';
+ return this.integerOnly ? 'numeric' : 'text';
}
get inputType(): string {
From 7049296e873647cc0f6065c9f5d2a767a5c838ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mehmet=20=C3=87etin?=
<92744169+mehmetcetin01140@users.noreply.github.com>
Date: Fri, 29 Mar 2024 12:03:53 +0300
Subject: [PATCH 3/3] refactor
---
src/app/components/cascadeselect/cascadeselect.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/components/cascadeselect/cascadeselect.ts b/src/app/components/cascadeselect/cascadeselect.ts
index 18ed45d13af..29339021845 100755
--- a/src/app/components/cascadeselect/cascadeselect.ts
+++ b/src/app/components/cascadeselect/cascadeselect.ts
@@ -711,8 +711,8 @@ export class CascadeSelect implements OnInit, AfterContentInit {
ngOnChanges(changes: SimpleChanges): void {
if (changes.options) {
- this.processedOptions = this.createProcessedOptions(this.options || []);
- this.modelValue.set('');
+ this.processedOptions = this.createProcessedOptions(changes.options.currentValue || []);
+ this.updateModel(null)
}
}