@klippa/ngx-enhancy-forms 14.22.13 → 14.22.14
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/esm2020/lib/form/form-submit-button/form-submit-button.component.mjs +12 -3
- package/esm2020/lib/form/form.component.mjs +5 -2
- package/fesm2015/klippa-ngx-enhancy-forms.mjs +15 -3
- package/fesm2015/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/fesm2020/klippa-ngx-enhancy-forms.mjs +15 -3
- package/fesm2020/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/lib/form/form-submit-button/form-submit-button.component.d.ts +4 -1
- package/lib/form/form.component.d.ts +2 -1
- package/package.json +1 -1
|
@@ -167,6 +167,7 @@ class FormComponent {
|
|
|
167
167
|
this.errorMessageLocation = 'belowCaption';
|
|
168
168
|
this.warnings = new Map();
|
|
169
169
|
this.errors = new Map();
|
|
170
|
+
this.allowSubmitOn = 'buttonAndEnter';
|
|
170
171
|
this.onInjected = new EventEmitter();
|
|
171
172
|
// we keep track of what form controls are actually rendered. Only those count when looking at form validation
|
|
172
173
|
this.activeControls = [];
|
|
@@ -436,7 +437,7 @@ class FormComponent {
|
|
|
436
437
|
}
|
|
437
438
|
}
|
|
438
439
|
FormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormComponent, deps: [{ token: FormComponent, optional: true, skipSelf: true }, { token: SubFormDirective, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
439
|
-
FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormComponent, selector: "klp-form", inputs: { readOnly: "readOnly", showErrorMessages: "showErrorMessages", errorMessageLocation: "errorMessageLocation", formGroup: "formGroup", warnings: "warnings", errors: "errors", patchValueInterceptor: "patchValueInterceptor" }, outputs: { onInjected: "onInjected" }, usesOnChanges: true, ngImport: i0, template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n", styles: [":host{display:block}:host.row{display:flex}:host form{height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
440
|
+
FormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormComponent, selector: "klp-form", inputs: { readOnly: "readOnly", showErrorMessages: "showErrorMessages", errorMessageLocation: "errorMessageLocation", formGroup: "formGroup", warnings: "warnings", errors: "errors", patchValueInterceptor: "patchValueInterceptor", allowSubmitOn: "allowSubmitOn" }, outputs: { onInjected: "onInjected" }, usesOnChanges: true, ngImport: i0, template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n", styles: [":host{display:block}:host.row{display:flex}:host form{height:inherit}\n"], dependencies: [{ kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }] });
|
|
440
441
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormComponent, decorators: [{
|
|
441
442
|
type: Component,
|
|
442
443
|
args: [{ selector: 'klp-form', template: "<form>\n\t<ng-content></ng-content>\n</form>\n\n\n", styles: [":host{display:block}:host.row{display:flex}:host form{height:inherit}\n"] }]
|
|
@@ -460,6 +461,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
460
461
|
type: Input
|
|
461
462
|
}], patchValueInterceptor: [{
|
|
462
463
|
type: Input
|
|
464
|
+
}], allowSubmitOn: [{
|
|
465
|
+
type: Input
|
|
463
466
|
}], onInjected: [{
|
|
464
467
|
type: Output
|
|
465
468
|
}] } });
|
|
@@ -1687,6 +1690,7 @@ class FormSubmitButtonComponent {
|
|
|
1687
1690
|
constructor() {
|
|
1688
1691
|
this.parentForm = inject(FormComponent, { optional: true });
|
|
1689
1692
|
this.handleError = inject(KLP_FORM_ERROR_HANDLER, { optional: true }) ?? DefaultErrorHandler;
|
|
1693
|
+
this.buttonType = 'submit';
|
|
1690
1694
|
this.isLoading = false;
|
|
1691
1695
|
this.fullWidth = false;
|
|
1692
1696
|
this.variant = 'greenFilled';
|
|
@@ -1697,6 +1701,14 @@ class FormSubmitButtonComponent {
|
|
|
1697
1701
|
this.parentForm.formGroup.get(e.path)?.setErrors({ message: { value: e.message } });
|
|
1698
1702
|
};
|
|
1699
1703
|
}
|
|
1704
|
+
ngOnInit() {
|
|
1705
|
+
if (this.parentForm.allowSubmitOn === 'buttonOnly') {
|
|
1706
|
+
this.buttonType = 'button';
|
|
1707
|
+
}
|
|
1708
|
+
else {
|
|
1709
|
+
this.buttonType = 'submit';
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1700
1712
|
async submitForm() {
|
|
1701
1713
|
await this.before().catch(() => null);
|
|
1702
1714
|
try {
|
|
@@ -1716,10 +1728,10 @@ class FormSubmitButtonComponent {
|
|
|
1716
1728
|
}
|
|
1717
1729
|
}
|
|
1718
1730
|
FormSubmitButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormSubmitButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1719
|
-
FormSubmitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormSubmitButtonComponent, selector: "klp-form-submit-button", inputs: { isLoading: "isLoading", fullWidth: "fullWidth", variant: "variant", submitCallback: "submitCallback", before: "before", after: "after", disabled: "disabled" }, host: { properties: { "class._fullWidth": "this.fullWidth" } }, ngImport: i0, template: "<klp-form-button\n\t\t[variant]=\"variant\"\n\t\t(click)=\"submitForm()\"\n\t\t[disabled]=\"isLoading || disabled\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\
|
|
1731
|
+
FormSubmitButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormSubmitButtonComponent, selector: "klp-form-submit-button", inputs: { isLoading: "isLoading", fullWidth: "fullWidth", variant: "variant", submitCallback: "submitCallback", before: "before", after: "after", disabled: "disabled" }, host: { properties: { "class._fullWidth": "this.fullWidth" } }, ngImport: i0, template: "<klp-form-button\n\t\t[variant]=\"variant\"\n\t\t(click)=\"submitForm()\"\n\t\t[disabled]=\"isLoading || disabled\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\t[type]=\"buttonType\"\n\t\t[ngClass]=\"fullWidth ? 'fullWidth' : ''\"\n\t>\n\t<ng-content></ng-content>\n</klp-form-button>\n", styles: [":host{display:inline-block}:host._fullWidth{display:block}.fullWidth{width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ButtonComponent, selector: "klp-form-button", inputs: ["variant", "size", "fullWidth", "hasBorder", "disabled", "isLoading", "type", "clickCallback"] }] });
|
|
1720
1732
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormSubmitButtonComponent, decorators: [{
|
|
1721
1733
|
type: Component,
|
|
1722
|
-
args: [{ selector: 'klp-form-submit-button', template: "<klp-form-button\n\t\t[variant]=\"variant\"\n\t\t(click)=\"submitForm()\"\n\t\t[disabled]=\"isLoading || disabled\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\
|
|
1734
|
+
args: [{ selector: 'klp-form-submit-button', template: "<klp-form-button\n\t\t[variant]=\"variant\"\n\t\t(click)=\"submitForm()\"\n\t\t[disabled]=\"isLoading || disabled\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\t[type]=\"buttonType\"\n\t\t[ngClass]=\"fullWidth ? 'fullWidth' : ''\"\n\t>\n\t<ng-content></ng-content>\n</klp-form-button>\n", styles: [":host{display:inline-block}:host._fullWidth{display:block}.fullWidth{width:100%}\n"] }]
|
|
1723
1735
|
}], propDecorators: { isLoading: [{
|
|
1724
1736
|
type: Input
|
|
1725
1737
|
}], fullWidth: [{
|