@zambon-dev/ui 1.2.1 → 1.2.2
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
|
@@ -23,6 +23,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
23
23
|
|
|
24
24
|
### ⚠ Breaking Changes / Migration
|
|
25
25
|
|
|
26
|
+
## [1.2.2] - 2026-10-30
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **A field shows the server's validation message as soon as the answer arrives.**
|
|
31
|
+
`lib-form-input-group` read its control's errors and touched state straight from the control,
|
|
32
|
+
which is not a signal. Under `OnPush` nothing told it when they changed from outside the field.
|
|
33
|
+
So when a save came back with a 400, the input turned red, but the message stayed hidden until
|
|
34
|
+
the user typed in the field again. The group now follows the control's events. This also covers
|
|
35
|
+
`lib-catalog-select`, which draws its field inside the group.
|
|
36
|
+
- **A save that marks every field as touched shows the required messages.** Same cause, same fix.
|
|
37
|
+
|
|
26
38
|
## [1.2.1] - 2026-10-27
|
|
27
39
|
|
|
28
40
|
### Added
|
|
@@ -1833,6 +1833,19 @@ var FormInputGroupComponent = class FormInputGroupComponent extends BaseComponen
|
|
|
1833
1833
|
formGroupName = inject(FormGroupName, { optional: true });
|
|
1834
1834
|
formService = inject(FormService);
|
|
1835
1835
|
loadingField = signal(false, ...ngDevMode ? [{ debugName: "loadingField" }] : /* istanbul ignore next */ []);
|
|
1836
|
+
controlChanged = signal(0, ...ngDevMode ? [{ debugName: "controlChanged" }] : /* istanbul ignore next */ []);
|
|
1837
|
+
errors = computed(() => {
|
|
1838
|
+
this.controlChanged();
|
|
1839
|
+
return this.formControl?.errors ?? null;
|
|
1840
|
+
}, ...ngDevMode ? [{ debugName: "errors" }] : /* istanbul ignore next */ []);
|
|
1841
|
+
isInvalid = computed(() => {
|
|
1842
|
+
this.controlChanged();
|
|
1843
|
+
return this.formControl?.invalid ?? false;
|
|
1844
|
+
}, ...ngDevMode ? [{ debugName: "isInvalid" }] : /* istanbul ignore next */ []);
|
|
1845
|
+
isTouched = computed(() => {
|
|
1846
|
+
this.controlChanged();
|
|
1847
|
+
return this.formControl?.touched ?? false;
|
|
1848
|
+
}, ...ngDevMode ? [{ debugName: "isTouched" }] : /* istanbul ignore next */ []);
|
|
1836
1849
|
get formControl() {
|
|
1837
1850
|
return this.controlName() ? this.formGroup.get(this.controlName()) : null;
|
|
1838
1851
|
}
|
|
@@ -1851,6 +1864,7 @@ var FormInputGroupComponent = class FormInputGroupComponent extends BaseComponen
|
|
|
1851
1864
|
super();
|
|
1852
1865
|
}
|
|
1853
1866
|
ngOnInit() {
|
|
1867
|
+
this.formControl?.events.pipe(takeUntil(this.destroy$)).subscribe(() => this.controlChanged.update((count) => count + 1));
|
|
1854
1868
|
this.formControl?.statusChanges.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
|
1855
1869
|
this.loadingField.set(false);
|
|
1856
1870
|
});
|
|
@@ -2012,7 +2026,7 @@ var FormInputGroupComponent = class FormInputGroupComponent extends BaseComponen
|
|
|
2012
2026
|
} },
|
|
2013
2027
|
usesInheritance: true,
|
|
2014
2028
|
ngImport: i0,
|
|
2015
|
-
template: "@if (showLabel()) {\n <label [attr.for]=\"controlName()\"> {{ label() | translate }}: </label>\n}\n\n<div class=\"field\" [class.col-span-2]=\"!showLabel()\" [ngStyle]=\"{ 'align-content': alignContent() }\">\n @if (loadingField() || (formService.loading && formService.model === null)) {\n <div class=\"loading\">\n <div></div>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"template() ?? defaultTemplate\"> </ng-container>\n @if (
|
|
2029
|
+
template: "@if (showLabel()) {\n <label [attr.for]=\"controlName()\"> {{ label() | translate }}: </label>\n}\n\n<div class=\"field\" [class.col-span-2]=\"!showLabel()\" [ngStyle]=\"{ 'align-content': alignContent() }\">\n @if (loadingField() || (formService.loading && formService.model === null)) {\n <div class=\"loading\">\n <div></div>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"template() ?? defaultTemplate\"> </ng-container>\n @if (isTouched()) {\n <div class=\"validations\" [class.show]=\"isInvalid()\">\n @for (error of errors() | keyvalue; track error) {\n @if (hasValidation(error.key)) {\n <span>{{ validations()[error.key] | translate }}</span>\n }\n <ng-template #defaultValidationError>{{ error.key }}</ng-template>\n }\n </div>\n }\n <ng-template #defaultTemplate>\n <lib-form-input\n #formInput\n [autofocus]=\"autofocus()\"\n [controlName]=\"controlName()\"\n [fixedValue]=\"fixedValue()\"\n [format]=\"format()\"\n [isDisabled]=\"isDisabled()\"\n [isFullHeight]=\"isFullHeight()\"\n [min]=\"min()\"\n [maxLength]=\"maxLength()\"\n [readOnly]=\"readOnly()\"\n [rows]=\"rows()!\"\n [step]=\"step()\"\n [type]=\"type()\"\n >\n </lib-form-input>\n </ng-template>\n @if (hasNotes) {\n <span class=\"text-sm italic\"> *{{ notes() | translate }} </span>\n }\n }\n</div>\n",
|
|
2016
2030
|
styles: ["@layer properties;:host{grid-column:span 2 / span 2;display:grid;grid-template-columns:subgrid;gap:calc(var(--spacing, .25rem) * 3)}:host.full-height{max-height:100%;overflow:auto}label{padding-block:var(--spacing, .25rem);white-space:nowrap;text-align:right;--tw-leading: calc(var(--spacing, .25rem) * 6);line-height:calc(var(--spacing, .25rem) * 6);font-size:var(--text-caption);font-weight:var(--font-weight-emphasis);color:var(--color-content-secondary)}.field .validations{flex-basis:100%;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));color:var(--color-danger)}.field .validations.show{margin-top:var(--spacing, .25rem)}.field .validations span{display:block}.field .loading{max-width:var(--container-sm, 24rem);animation:var(--animate-pulse, pulse 2s cubic-bezier(.4, 0, .6, 1) infinite)}.field .loading *{height:calc(var(--spacing, .25rem) * 2.5);width:100%;border-radius:calc(infinity * 1px);background-color:var(--color-surface-inset)}@property --tw-leading{syntax: \"*\"; inherits: false;}@keyframes pulse{50%{opacity:.5}}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-leading: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"],
|
|
2017
2031
|
dependencies: [
|
|
2018
2032
|
{
|
|
@@ -2095,7 +2109,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
2095
2109
|
"[class.full-height]": "isFullHeight()",
|
|
2096
2110
|
"[attr.type]": "null"
|
|
2097
2111
|
},
|
|
2098
|
-
template: "@if (showLabel()) {\n <label [attr.for]=\"controlName()\"> {{ label() | translate }}: </label>\n}\n\n<div class=\"field\" [class.col-span-2]=\"!showLabel()\" [ngStyle]=\"{ 'align-content': alignContent() }\">\n @if (loadingField() || (formService.loading && formService.model === null)) {\n <div class=\"loading\">\n <div></div>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"template() ?? defaultTemplate\"> </ng-container>\n @if (
|
|
2112
|
+
template: "@if (showLabel()) {\n <label [attr.for]=\"controlName()\"> {{ label() | translate }}: </label>\n}\n\n<div class=\"field\" [class.col-span-2]=\"!showLabel()\" [ngStyle]=\"{ 'align-content': alignContent() }\">\n @if (loadingField() || (formService.loading && formService.model === null)) {\n <div class=\"loading\">\n <div></div>\n </div>\n } @else {\n <ng-container *ngTemplateOutlet=\"template() ?? defaultTemplate\"> </ng-container>\n @if (isTouched()) {\n <div class=\"validations\" [class.show]=\"isInvalid()\">\n @for (error of errors() | keyvalue; track error) {\n @if (hasValidation(error.key)) {\n <span>{{ validations()[error.key] | translate }}</span>\n }\n <ng-template #defaultValidationError>{{ error.key }}</ng-template>\n }\n </div>\n }\n <ng-template #defaultTemplate>\n <lib-form-input\n #formInput\n [autofocus]=\"autofocus()\"\n [controlName]=\"controlName()\"\n [fixedValue]=\"fixedValue()\"\n [format]=\"format()\"\n [isDisabled]=\"isDisabled()\"\n [isFullHeight]=\"isFullHeight()\"\n [min]=\"min()\"\n [maxLength]=\"maxLength()\"\n [readOnly]=\"readOnly()\"\n [rows]=\"rows()!\"\n [step]=\"step()\"\n [type]=\"type()\"\n >\n </lib-form-input>\n </ng-template>\n @if (hasNotes) {\n <span class=\"text-sm italic\"> *{{ notes() | translate }} </span>\n }\n }\n</div>\n",
|
|
2099
2113
|
styles: ["@layer properties;:host{grid-column:span 2 / span 2;display:grid;grid-template-columns:subgrid;gap:calc(var(--spacing, .25rem) * 3)}:host.full-height{max-height:100%;overflow:auto}label{padding-block:var(--spacing, .25rem);white-space:nowrap;text-align:right;--tw-leading: calc(var(--spacing, .25rem) * 6);line-height:calc(var(--spacing, .25rem) * 6);font-size:var(--text-caption);font-weight:var(--font-weight-emphasis);color:var(--color-content-secondary)}.field .validations{flex-basis:100%;font-size:var(--text-sm, .875rem);line-height:var(--tw-leading, var(--text-sm--line-height, calc(1.25 / .875)));color:var(--color-danger)}.field .validations.show{margin-top:var(--spacing, .25rem)}.field .validations span{display:block}.field .loading{max-width:var(--container-sm, 24rem);animation:var(--animate-pulse, pulse 2s cubic-bezier(.4, 0, .6, 1) infinite)}.field .loading *{height:calc(var(--spacing, .25rem) * 2.5);width:100%;border-radius:calc(infinity * 1px);background-color:var(--color-surface-inset)}@property --tw-leading{syntax: \"*\"; inherits: false;}@keyframes pulse{50%{opacity:.5}}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-leading: initial}}}\n/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */\n"]
|
|
2100
2114
|
}]
|
|
2101
2115
|
}],
|