@ngrdt/forms 0.0.62 → 0.0.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/ngrdt-forms.mjs +11 -2
- package/fesm2022/ngrdt-forms.mjs.map +1 -1
- package/index.d.ts +3 -1
- package/package.json +3 -3
package/fesm2022/ngrdt-forms.mjs
CHANGED
|
@@ -73,7 +73,7 @@ class RdtBaseFormInputComponent extends RdtInteractiveElementComponent {
|
|
|
73
73
|
return control.statusReactive() === 'INVALID';
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
-
return
|
|
76
|
+
return !!this.additionalErrors();
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
requiredEffect = effect(() => {
|
|
@@ -91,7 +91,8 @@ class RdtBaseFormInputComponent extends RdtInteractiveElementComponent {
|
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
|
-
|
|
94
|
+
additionalErrors = signal(null);
|
|
95
|
+
errors = computed(() => this.controlErrors() ?? this.requiredError() ?? this.additionalErrors());
|
|
95
96
|
visibleErrors = computed(() => this.invalid() && this.touched() ? this.errors() : null);
|
|
96
97
|
get ngControl() {
|
|
97
98
|
return this._ngControl;
|
|
@@ -159,6 +160,14 @@ class RdtBaseFormInputComponent extends RdtInteractiveElementComponent {
|
|
|
159
160
|
this.onChange(externalValue);
|
|
160
161
|
}
|
|
161
162
|
}
|
|
163
|
+
setAdditionalErrors(errors) {
|
|
164
|
+
if (errors === null || Object.keys(errors).length === 0) {
|
|
165
|
+
this.additionalErrors.set(null);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
this.additionalErrors.set(errors);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
162
171
|
listenControlEvents(control) {
|
|
163
172
|
control.events
|
|
164
173
|
.pipe(startWith(null), takeUntilDestroyed(this.destroyRef))
|