@ngrdt/forms 0.0.62 → 0.0.64
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 +12 -3
- 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,14 +91,15 @@ 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;
|
|
98
99
|
}
|
|
99
100
|
_ngControl = null;
|
|
100
101
|
_onChange = noop;
|
|
101
|
-
_onTouch =
|
|
102
|
+
_onTouch = () => this.touchedInternal.set(true);
|
|
102
103
|
_onValidatorChange = noop;
|
|
103
104
|
get onChange() {
|
|
104
105
|
return this._onChange;
|
|
@@ -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))
|