@breadstone/mosaik-elements-angular 0.0.187 → 0.0.188
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/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 0.0.188 (2025-12-02)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- **directives:** update FormFieldDirective to improve error handling and usage documentation ([7c07bb43fd](https://github.com/RueDeRennes/mosaik/commit/7c07bb43fd))
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- **directives:** rename applyError to setError for clarity in FormFieldDirective ([747560c657](https://github.com/RueDeRennes/mosaik/commit/747560c657))
|
|
10
|
+
- **directives:** enhance error handling in FormFieldDirective to check for invalid state ([3b098ac14c](https://github.com/RueDeRennes/mosaik/commit/3b098ac14c))
|
|
11
|
+
|
|
1
12
|
## 0.0.187 (2025-12-02)
|
|
2
13
|
|
|
3
14
|
This was a version bump only for mosaik-elements-angular to align it with other projects, there were no code changes.
|
|
@@ -61753,7 +61753,7 @@ class FormFieldDirective {
|
|
|
61753
61753
|
// we recalc the error message and apply it to the Web Component.
|
|
61754
61754
|
effect(() => {
|
|
61755
61755
|
const fs = this.fieldState();
|
|
61756
|
-
this.
|
|
61756
|
+
this.setError(fs);
|
|
61757
61757
|
});
|
|
61758
61758
|
}
|
|
61759
61759
|
//#endregion
|
|
@@ -61780,16 +61780,16 @@ class FormFieldDirective {
|
|
|
61780
61780
|
*
|
|
61781
61781
|
* @param fieldState The current FieldState
|
|
61782
61782
|
*/
|
|
61783
|
-
|
|
61783
|
+
setError(fieldState) {
|
|
61784
61784
|
const el = this._elementRef.nativeElement;
|
|
61785
61785
|
if (!fieldState) {
|
|
61786
|
-
// No state → clear any previous error
|
|
61787
61786
|
el.error = '';
|
|
61788
61787
|
return;
|
|
61789
61788
|
}
|
|
61790
61789
|
const errors = fieldState.errors(); // array of validation errors
|
|
61791
61790
|
const isTouched = fieldState.touched(); // whether the field was touched
|
|
61792
|
-
|
|
61791
|
+
const isInvalid = fieldState.invalid(); // whether the field is invalid
|
|
61792
|
+
if (errors.length > 0 && isTouched && isInvalid) {
|
|
61793
61793
|
// Use the last error in the array as the “active” error message
|
|
61794
61794
|
const lastError = errors[errors.length - 1];
|
|
61795
61795
|
el.error = lastError.message ?? '';
|