@klippa/ngx-enhancy-forms 16.7.6 → 16.8.0
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/esm2022/lib/elements/value-accessor-base/value-accessor-base.component.mjs +8 -2
- package/esm2022/lib/form/form-element/form-element.component.mjs +4 -3
- package/esm2022/lib/form/form-error/form-error.component.mjs +7 -3
- package/esm2022/lib/form/form-submit-button/form-submit-button.component.mjs +28 -43
- package/esm2022/lib/form/form-validation-error/form-validation-error.mjs +22 -0
- package/esm2022/lib/form/form.component.mjs +23 -4
- package/esm2022/lib/ngx-enhancy-forms.module.mjs +8 -3
- package/esm2022/lib/types.mjs +1 -1
- package/esm2022/lib/util/arrays.mjs +5 -2
- package/esm2022/lib/util/classes.mjs +2 -0
- package/esm2022/lib/withTooltip.component.mjs +65 -0
- package/esm2022/public-api.mjs +3 -1
- package/fesm2022/klippa-ngx-enhancy-forms.mjs +154 -49
- package/fesm2022/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +2 -1
- package/lib/form/form-error/form-error.component.d.ts +1 -0
- package/lib/form/form-submit-button/form-submit-button.component.d.ts +5 -6
- package/lib/form/form-validation-error/form-validation-error.d.ts +10 -0
- package/lib/form/form.component.d.ts +1 -0
- package/lib/ngx-enhancy-forms.module.d.ts +7 -6
- package/lib/types.d.ts +1 -1
- package/lib/util/arrays.d.ts +2 -0
- package/lib/util/classes.d.ts +1 -0
- package/lib/withTooltip.component.d.ts +10 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, Component, SkipSelf, Optional, InjectionToken, Inject, ViewChild, EventEmitter, Host, Output, HostBinding, TemplateRef, ContentChild, NgModule } from '@angular/core';
|
|
2
|
+
import { Directive, Input, Component, SkipSelf, Optional, InjectionToken, Inject, ViewChild, EventEmitter, Host, Output, HostBinding, TemplateRef, ContentChild, inject, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { UntypedFormArray, UntypedFormGroup, UntypedFormControl, FormControl, FormArray, FormGroup, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
7
|
-
import { isString
|
|
7
|
+
import { isString } from 'lodash-es';
|
|
8
|
+
import { isArray } from 'lodash';
|
|
8
9
|
import * as i4 from '@ng-select/ng-select';
|
|
9
10
|
import { NgSelectModule } from '@ng-select/ng-select';
|
|
10
11
|
import * as i2$1 from '@dustfoundation/ngx-sortablejs';
|
|
@@ -84,6 +85,9 @@ function splitArrayByCondition(value, condition) {
|
|
|
84
85
|
return acc;
|
|
85
86
|
}, [[]]);
|
|
86
87
|
}
|
|
88
|
+
function isArrayOf(arr, kind) {
|
|
89
|
+
return arr.reduce((acc, val) => acc && val instanceof kind, true);
|
|
90
|
+
}
|
|
87
91
|
|
|
88
92
|
function mergeArray(arrA, arrB) {
|
|
89
93
|
const arr = new Array(Math.max(arrA.length, arrB.length));
|
|
@@ -150,6 +154,9 @@ class FormComponent {
|
|
|
150
154
|
this.activeControls = [];
|
|
151
155
|
}
|
|
152
156
|
ngOnInit() {
|
|
157
|
+
if (isValueSet(this.patchValueInterceptor)) {
|
|
158
|
+
this.addSupportForPatchValueInterceptor();
|
|
159
|
+
}
|
|
153
160
|
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
154
161
|
const injectInto = this.subFormPlaceholder.injectInto;
|
|
155
162
|
const injectAt = this.subFormPlaceholder.at;
|
|
@@ -180,9 +187,6 @@ class FormComponent {
|
|
|
180
187
|
injectInto.setControl(injectAt, this.formGroup);
|
|
181
188
|
}
|
|
182
189
|
}
|
|
183
|
-
if (isValueSet(this.patchValueInterceptor)) {
|
|
184
|
-
this.addSupportForPatchValueInterceptor();
|
|
185
|
-
}
|
|
186
190
|
}
|
|
187
191
|
ngOnChanges(simpleChanges) {
|
|
188
192
|
if (simpleChanges.readOnly?.currentValue === true) {
|
|
@@ -281,6 +285,25 @@ class FormComponent {
|
|
|
281
285
|
const formGroupValue = this.formGroup.value;
|
|
282
286
|
const renderedAndEnabledValues = this.getRenderedFieldValuesFormGroup(this.formGroup, true);
|
|
283
287
|
const renderedButDisabledValues = this.getRenderedFieldValuesFormGroup(this.formGroup, false);
|
|
288
|
+
return new Promise((resolve, reject) => {
|
|
289
|
+
if (this.formGroup.pending) {
|
|
290
|
+
const sub = this.formGroup.statusChanges.subscribe((res) => {
|
|
291
|
+
if (res !== 'PENDING') {
|
|
292
|
+
sub.unsubscribe();
|
|
293
|
+
this.handleSubmission(originalDisabledStates, renderedAndEnabledValues, renderedButDisabledValues, formGroupValue)
|
|
294
|
+
.then(resolve)
|
|
295
|
+
.catch(reject);
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
this.handleSubmission(originalDisabledStates, renderedAndEnabledValues, renderedButDisabledValues, formGroupValue)
|
|
301
|
+
.then(resolve)
|
|
302
|
+
.catch(reject);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
handleSubmission(originalDisabledStates, renderedAndEnabledValues, renderedButDisabledValues, formGroupValue) {
|
|
284
307
|
if (this.formGroup.invalid) {
|
|
285
308
|
this.activeControls.find((e) => !e.formControl.valid)?.formElement?.scrollTo();
|
|
286
309
|
this.setDisabledStatesForAllControls(originalDisabledStates);
|
|
@@ -359,6 +382,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
|
359
382
|
type: Input
|
|
360
383
|
}] } });
|
|
361
384
|
|
|
385
|
+
class WithTooltipDirective {
|
|
386
|
+
constructor(el) {
|
|
387
|
+
this.klpWithTooltip = true;
|
|
388
|
+
el.nativeElement.addEventListener('mouseenter', () => {
|
|
389
|
+
if (!this.klpWithTooltip) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (getComputedStyle(el.nativeElement).position === 'static') {
|
|
393
|
+
el.nativeElement.style.position = 'relative';
|
|
394
|
+
}
|
|
395
|
+
this.div = document.createElement('div');
|
|
396
|
+
this.div.style.zIndex = '2';
|
|
397
|
+
this.div.style.color = '#515365';
|
|
398
|
+
this.div.style.position = 'fixed';
|
|
399
|
+
this.div.style.left = `${el.nativeElement.getBoundingClientRect().x}px`;
|
|
400
|
+
this.div.style.top = `${el.nativeElement.getBoundingClientRect().y}px`;
|
|
401
|
+
this.div.style.transform = `translate(calc(-100% + ${el.nativeElement.getBoundingClientRect().width}px), calc(-100% - 0.3rem))`;
|
|
402
|
+
this.div.style.maxWidth = '200px';
|
|
403
|
+
this.div.style.whiteSpace = 'break-spaces';
|
|
404
|
+
this.div.style.backgroundColor = 'white';
|
|
405
|
+
this.div.style.border = '1px solid rgba(255, 128, 0, 0.1254901961)';
|
|
406
|
+
this.div.style.boxShadow = `2px 3px 10px 0px rgba(255, 128, 0, 0.1254901961)`;
|
|
407
|
+
this.div.style.padding = '0.3rem 0.5rem';
|
|
408
|
+
this.div.style.boxSizing = 'border-box';
|
|
409
|
+
this.div.style.borderRadius = '3px';
|
|
410
|
+
this.div.textContent = el.nativeElement.innerText;
|
|
411
|
+
el.nativeElement.prepend(this.div);
|
|
412
|
+
this.triangle = document.createElement('div');
|
|
413
|
+
this.triangle.style.zIndex = '1';
|
|
414
|
+
this.triangle.style.position = 'fixed';
|
|
415
|
+
this.triangle.style.left = `calc(${el.nativeElement.getBoundingClientRect().x + el.nativeElement.getBoundingClientRect().width}px - 3rem)`;
|
|
416
|
+
this.triangle.style.top = `${el.nativeElement.getBoundingClientRect().y}px`;
|
|
417
|
+
this.triangle.style.transform = `translate(-50%, calc(-100% + 0.1rem))`;
|
|
418
|
+
this.triangle.style.width = '0';
|
|
419
|
+
this.triangle.style.height = '0';
|
|
420
|
+
this.triangle.style.borderLeft = '0.8rem solid transparent';
|
|
421
|
+
this.triangle.style.borderRight = '0.8rem solid transparent';
|
|
422
|
+
this.triangle.style.borderTop = '0.8rem solid rgba(255, 128, 0, 0.1254901961)';
|
|
423
|
+
el.nativeElement.prepend(this.triangle);
|
|
424
|
+
});
|
|
425
|
+
el.nativeElement.addEventListener('mouseout', () => {
|
|
426
|
+
try {
|
|
427
|
+
el.nativeElement.removeChild(this.div);
|
|
428
|
+
}
|
|
429
|
+
catch (ex) { }
|
|
430
|
+
try {
|
|
431
|
+
el.nativeElement.removeChild(this.triangle);
|
|
432
|
+
}
|
|
433
|
+
catch (ex) { }
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: WithTooltipDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
437
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.1", type: WithTooltipDirective, selector: "[klpWithTooltip]", inputs: { klpWithTooltip: "klpWithTooltip" }, ngImport: i0 }); }
|
|
438
|
+
}
|
|
439
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: WithTooltipDirective, decorators: [{
|
|
440
|
+
type: Directive,
|
|
441
|
+
args: [{
|
|
442
|
+
selector: '[klpWithTooltip]'
|
|
443
|
+
}]
|
|
444
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { klpWithTooltip: [{
|
|
445
|
+
type: Input
|
|
446
|
+
}] } });
|
|
447
|
+
|
|
362
448
|
const FORM_ERROR_MESSAGES = new InjectionToken('form.error.messages');
|
|
363
449
|
const DEFAULT_ERROR_MESSAGES = {
|
|
364
450
|
min: 'Use a number larger than %min%',
|
|
@@ -449,11 +535,11 @@ class FormElementComponent {
|
|
|
449
535
|
return this.parent?.errorMessageLocation ?? 'belowCaption';
|
|
450
536
|
}
|
|
451
537
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FormElementComponent, deps: [{ token: FormComponent, optional: true }, { token: FORM_ERROR_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
452
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: FormElementComponent, selector: "klp-form-element", inputs: { caption: "caption", direction: "direction", captionSpacing: "captionSpacing", spaceDistribution: "spaceDistribution", swapInputAndCaption: "swapInputAndCaption" }, viewQueries: [{ propertyName: "internalComponentRef", first: true, predicate: ["internalComponentRef"], descendants: true }], ngImport: i0, template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70', 'd34-66': spaceDistribution === '34-66'}\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\n<div class=\"componentContainer\" [ngClass]=\"{hasCaption: caption || captionRef, vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" *ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\n\t\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\n\t\t\twithErrorRightOfCaption: getErrorLocation() === 'rightOfCaption'\n\t\t}\"\n\t>\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\"> *</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}<span *ngIf=\"isRequired()\"> *</span></div>\n\t\t<div class=\"rightOfCaptionError\">\n\t\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'rightOfCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66'\n\t}\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n", styles: [":host{display:block}.componentContainer{display:flex;align-items:center;min-height:42px}.componentContainer:not(.hasCaption){display:block}.componentContainer:not(.hasCaption) .inputContainer{margin-top:0}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;padding-right:1.25rem;color:#515365}.caption.percentageSpacing{flex:40}.caption.percentageSpacing.d30-70{flex:30}.caption.percentageSpacing.d34-66{flex:34}.caption.hasErrors{color:#ff8000}.caption.withErrorRightOfCaption{display:flex;justify-content:space-between;gap:2
|
|
538
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: FormElementComponent, selector: "klp-form-element", inputs: { caption: "caption", direction: "direction", captionSpacing: "captionSpacing", spaceDistribution: "spaceDistribution", swapInputAndCaption: "swapInputAndCaption" }, viewQueries: [{ propertyName: "internalComponentRef", first: true, predicate: ["internalComponentRef"], descendants: true }], ngImport: i0, template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70', 'd34-66': spaceDistribution === '34-66'}\" [klpWithTooltip]=\"getErrorLocation() === 'rightOfCaption'\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\n<div class=\"componentContainer\" [ngClass]=\"{hasCaption: caption || captionRef, vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" *ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\n\t\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\n\t\t\twithErrorRightOfCaption: getErrorLocation() === 'rightOfCaption'\n\t\t}\"\n\t>\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\"> *</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\" class=\"captionText\">{{caption}}<span *ngIf=\"isRequired()\"> *</span></div>\n\t\t<div class=\"rightOfCaptionError\">\n\t\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'rightOfCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66'\n\t}\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n", styles: [":host{display:block}.componentContainer{display:flex;align-items:center;min-height:42px}.componentContainer:not(.hasCaption){display:block}.componentContainer:not(.hasCaption) .inputContainer{margin-top:0}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;padding-right:1.25rem;color:#515365}.caption.percentageSpacing{flex:40}.caption.percentageSpacing.d30-70{flex:30}.caption.percentageSpacing.d34-66{flex:34}.caption.hasErrors{color:#ff8000}.caption.hasErrors.withErrorRightOfCaption .rightOfCaptionError{display:block}.caption.withErrorRightOfCaption{display:flex;justify-content:space-between;gap:1rem}.caption.withErrorRightOfCaption .captionText{flex:1 2 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.caption.withErrorRightOfCaption .rightOfCaptionError{display:none;font-weight:400;overflow:hidden;flex:1 1 auto;text-align:right}.caption.withErrorRightOfCaption .rightOfCaptionError ::ng-deep *{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.inputContainer{flex:1}.inputContainer.percentageSpacing{flex:60}.inputContainer.percentageSpacing.d30-70{flex:70}.inputContainer.percentageSpacing.d34-66{flex:66}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}.errorContainer.hasCaption.d34-66{margin-left:34%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: WithTooltipDirective, selector: "[klpWithTooltip]", inputs: ["klpWithTooltip"] }] }); }
|
|
453
539
|
}
|
|
454
540
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FormElementComponent, decorators: [{
|
|
455
541
|
type: Component,
|
|
456
|
-
args: [{ selector: 'klp-form-element', template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70', 'd34-66': spaceDistribution === '34-66'}\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\n<div class=\"componentContainer\" [ngClass]=\"{hasCaption: caption || captionRef, vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" *ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\n\t\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\n\t\t\twithErrorRightOfCaption: getErrorLocation() === 'rightOfCaption'\n\t\t}\"\n\t>\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\"> *</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}<span *ngIf=\"isRequired()\"> *</span></div>\n\t\t<div class=\"rightOfCaptionError\">\n\t\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'rightOfCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66'\n\t}\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n", styles: [":host{display:block}.componentContainer{display:flex;align-items:center;min-height:42px}.componentContainer:not(.hasCaption){display:block}.componentContainer:not(.hasCaption) .inputContainer{margin-top:0}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;padding-right:1.25rem;color:#515365}.caption.percentageSpacing{flex:40}.caption.percentageSpacing.d30-70{flex:30}.caption.percentageSpacing.d34-66{flex:34}.caption.hasErrors{color:#ff8000}.caption.withErrorRightOfCaption{display:flex;justify-content:space-between;gap:2
|
|
542
|
+
args: [{ selector: 'klp-form-element', template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70', 'd34-66': spaceDistribution === '34-66'}\" [klpWithTooltip]=\"getErrorLocation() === 'rightOfCaption'\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\n<div class=\"componentContainer\" [ngClass]=\"{hasCaption: caption || captionRef, vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" *ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\n\t\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\n\t\t\twithErrorRightOfCaption: getErrorLocation() === 'rightOfCaption'\n\t\t}\"\n\t>\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\"> *</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\" class=\"captionText\">{{caption}}<span *ngIf=\"isRequired()\"> *</span></div>\n\t\t<div class=\"rightOfCaptionError\">\n\t\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'rightOfCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66'\n\t}\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n", styles: [":host{display:block}.componentContainer{display:flex;align-items:center;min-height:42px}.componentContainer:not(.hasCaption){display:block}.componentContainer:not(.hasCaption) .inputContainer{margin-top:0}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;padding-right:1.25rem;color:#515365}.caption.percentageSpacing{flex:40}.caption.percentageSpacing.d30-70{flex:30}.caption.percentageSpacing.d34-66{flex:34}.caption.hasErrors{color:#ff8000}.caption.hasErrors.withErrorRightOfCaption .rightOfCaptionError{display:block}.caption.withErrorRightOfCaption{display:flex;justify-content:space-between;gap:1rem}.caption.withErrorRightOfCaption .captionText{flex:1 2 auto;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.caption.withErrorRightOfCaption .rightOfCaptionError{display:none;font-weight:400;overflow:hidden;flex:1 1 auto;text-align:right}.caption.withErrorRightOfCaption .rightOfCaptionError ::ng-deep *{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.inputContainer{flex:1}.inputContainer.percentageSpacing{flex:60}.inputContainer.percentageSpacing.d30-70{flex:70}.inputContainer.percentageSpacing.d34-66{flex:66}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}.errorContainer.hasCaption.d34-66{margin-left:34%}\n"] }]
|
|
457
543
|
}], ctorParameters: function () { return [{ type: FormComponent, decorators: [{
|
|
458
544
|
type: Optional
|
|
459
545
|
}] }, { type: undefined, decorators: [{
|
|
@@ -496,6 +582,7 @@ class ValueAccessorBase {
|
|
|
496
582
|
// we support both providing just the formControlName and the full formControl
|
|
497
583
|
this.formControlName = null;
|
|
498
584
|
this.formControl = null;
|
|
585
|
+
this.inErrorState = false;
|
|
499
586
|
this.onTouch = new EventEmitter();
|
|
500
587
|
this.focus = () => {
|
|
501
588
|
if (isValueSet(this.nativeInputRef?.nativeElement)) {
|
|
@@ -525,6 +612,9 @@ class ValueAccessorBase {
|
|
|
525
612
|
}
|
|
526
613
|
}
|
|
527
614
|
isInErrorState() {
|
|
615
|
+
if (this.inErrorState) {
|
|
616
|
+
return true;
|
|
617
|
+
}
|
|
528
618
|
return this.attachedFormControl && this.attachedFormControl.status === 'INVALID' && this.attachedFormControl.touched;
|
|
529
619
|
}
|
|
530
620
|
ngOnDestroy() {
|
|
@@ -585,7 +675,7 @@ class ValueAccessorBase {
|
|
|
585
675
|
return false;
|
|
586
676
|
}
|
|
587
677
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ValueAccessorBase, deps: [{ token: FormElementComponent, host: true, optional: true }, { token: i2.ControlContainer, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
588
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: ValueAccessorBase, selector: "ng-component", inputs: { disabled: "disabled", innerValueChangeInterceptor: "innerValueChangeInterceptor", formControlName: "formControlName", formControl: "formControl" }, outputs: { onTouch: "onTouch" }, viewQueries: [{ propertyName: "nativeInputRef", first: true, predicate: ["nativeInputRef"], descendants: true }], ngImport: i0, template: '', isInline: true }); }
|
|
678
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: ValueAccessorBase, selector: "ng-component", inputs: { disabled: "disabled", innerValueChangeInterceptor: "innerValueChangeInterceptor", formControlName: "formControlName", formControl: "formControl", inErrorState: "inErrorState" }, outputs: { onTouch: "onTouch" }, viewQueries: [{ propertyName: "nativeInputRef", first: true, predicate: ["nativeInputRef"], descendants: true }], ngImport: i0, template: '', isInline: true }); }
|
|
589
679
|
}
|
|
590
680
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: ValueAccessorBase, decorators: [{
|
|
591
681
|
type: Component,
|
|
@@ -609,6 +699,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
|
609
699
|
type: Input
|
|
610
700
|
}], formControl: [{
|
|
611
701
|
type: Input
|
|
702
|
+
}], inErrorState: [{
|
|
703
|
+
type: Input
|
|
612
704
|
}], onTouch: [{
|
|
613
705
|
type: Output
|
|
614
706
|
}], nativeInputRef: [{
|
|
@@ -1167,12 +1259,15 @@ class FormErrorComponent {
|
|
|
1167
1259
|
}
|
|
1168
1260
|
});
|
|
1169
1261
|
}
|
|
1262
|
+
getErrorValueMessage() {
|
|
1263
|
+
return this.parent.getAttachedControl().errors[this.error];
|
|
1264
|
+
}
|
|
1170
1265
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FormErrorComponent, deps: [{ token: FormElementComponent, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1171
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: FormErrorComponent, selector: "klp-form-error", inputs: { error: "error" }, viewQueries: [{ propertyName: "contentRef", first: true, predicate: ["contentRef"], descendants: true }], ngImport: i0, template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }); }
|
|
1266
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: FormErrorComponent, selector: "klp-form-error", inputs: { error: "error" }, viewQueries: [{ propertyName: "contentRef", first: true, predicate: ["contentRef"], descendants: true }], ngImport: i0, template: "<ng-template #contentRef>\n\t<ng-content *ngIf=\"error !== 'async'\"></ng-content>\n\t<div *ngIf=\"error === 'async'\">{{getErrorValueMessage()}}</div>\n</ng-template>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1172
1267
|
}
|
|
1173
1268
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FormErrorComponent, decorators: [{
|
|
1174
1269
|
type: Component,
|
|
1175
|
-
args: [{ selector: 'klp-form-error', template: "<ng-template #contentRef>\n\t<ng-content></ng-content>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
1270
|
+
args: [{ selector: 'klp-form-error', template: "<ng-template #contentRef>\n\t<ng-content *ngIf=\"error !== 'async'\"></ng-content>\n\t<div *ngIf=\"error === 'async'\">{{getErrorValueMessage()}}</div>\n</ng-template>\n", styles: [":host{display:block}\n"] }]
|
|
1176
1271
|
}], ctorParameters: function () { return [{ type: FormElementComponent, decorators: [{
|
|
1177
1272
|
type: Host
|
|
1178
1273
|
}, {
|
|
@@ -1184,71 +1279,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
|
1184
1279
|
args: ['contentRef']
|
|
1185
1280
|
}] } });
|
|
1186
1281
|
|
|
1187
|
-
class
|
|
1188
|
-
|
|
1189
|
-
|
|
1282
|
+
class FormValidationError extends Error {
|
|
1283
|
+
constructor(path, message) {
|
|
1284
|
+
super(message);
|
|
1285
|
+
this.name = 'FormValidationError';
|
|
1286
|
+
this.path = path;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
const KLP_FORM_ERROR_HANDLER = new InjectionToken('KLP_FORM_ERROR_HANDLER');
|
|
1290
|
+
const DefaultErrorHandler = (error) => {
|
|
1291
|
+
if (Array.isArray(error) && isArrayOf(error, FormValidationError)) {
|
|
1292
|
+
// If the error is an array of FormValidationErrors, then pass it along.
|
|
1293
|
+
return error;
|
|
1294
|
+
}
|
|
1295
|
+
else if (error instanceof FormValidationError) {
|
|
1296
|
+
// If the error is a FormValidationError, then wrap it and pass it on.
|
|
1297
|
+
return [error];
|
|
1190
1298
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1299
|
+
throw error;
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
class FormSubmitButtonComponent {
|
|
1303
|
+
constructor() {
|
|
1304
|
+
this.parentForm = inject(FormComponent, { host: true, optional: true });
|
|
1305
|
+
this.handleError = inject(KLP_FORM_ERROR_HANDLER, { optional: true }) ?? DefaultErrorHandler;
|
|
1193
1306
|
this.isLoading = false;
|
|
1194
1307
|
this.fullWidth = false;
|
|
1195
1308
|
this.variant = 'greenFilled';
|
|
1196
1309
|
this.before = () => Promise.resolve();
|
|
1197
1310
|
this.after = () => Promise.resolve();
|
|
1311
|
+
this.setValidationError = (e) => {
|
|
1312
|
+
this.parentForm.formGroup.get(e.path)?.setErrors({ message: { value: e.message } });
|
|
1313
|
+
};
|
|
1198
1314
|
}
|
|
1199
1315
|
async submitForm() {
|
|
1316
|
+
await this.before().catch(() => null);
|
|
1200
1317
|
try {
|
|
1201
|
-
await this.
|
|
1318
|
+
const [renderedAndEnabledValues, renderedValues] = await this.parentForm.trySubmit();
|
|
1319
|
+
this.isLoading = true;
|
|
1320
|
+
await this.submitCallback(renderedAndEnabledValues, renderedValues)
|
|
1321
|
+
.finally(() => this.isLoading = false);
|
|
1202
1322
|
}
|
|
1203
1323
|
catch (e) {
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
this.parentForm
|
|
1207
|
-
.trySubmit()
|
|
1208
|
-
.then(([renderedAndEnabledValues, renderedValues]) => {
|
|
1209
|
-
this.isLoading = true;
|
|
1210
|
-
const submitCallbackResult = this.submitCallback(renderedAndEnabledValues, renderedValues);
|
|
1211
|
-
if (isNullOrUndefined(submitCallbackResult)) {
|
|
1212
|
-
throw new Error('No promise is returned in your submit function.');
|
|
1213
|
-
}
|
|
1214
|
-
return submitCallbackResult.then(() => (this.isLoading = false)).catch((e) => {
|
|
1215
|
-
this.isLoading = false;
|
|
1216
|
-
throw e;
|
|
1217
|
-
});
|
|
1218
|
-
})
|
|
1219
|
-
.catch((e) => {
|
|
1220
1324
|
if (e === invalidFieldsSymbol) {
|
|
1221
1325
|
return; // swallow the error, the framework will scroll to the field that needs attention
|
|
1222
1326
|
}
|
|
1223
|
-
|
|
1224
|
-
|
|
1327
|
+
this.handleError(e).forEach(this.setValidationError);
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1225
1330
|
await this.after();
|
|
1226
1331
|
}
|
|
1227
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FormSubmitButtonComponent, deps: [
|
|
1228
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: FormSubmitButtonComponent, selector: "klp-form-submit-button", inputs: { isLoading: "isLoading", fullWidth: "fullWidth", variant: "variant",
|
|
1332
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FormSubmitButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1333
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.1", type: FormSubmitButtonComponent, selector: "klp-form-submit-button", inputs: { isLoading: "isLoading", fullWidth: "fullWidth", variant: "variant", submitCallback: "submitCallback", before: "before", after: "after" }, 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\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\ttype=\"submit\"\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"] }] }); }
|
|
1229
1334
|
}
|
|
1230
1335
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: FormSubmitButtonComponent, decorators: [{
|
|
1231
1336
|
type: Component,
|
|
1232
1337
|
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\"\n\t\t[isLoading]=\"isLoading\"\n\t\t[fullWidth]=\"fullWidth\"\n\t\ttype=\"submit\"\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"] }]
|
|
1233
|
-
}],
|
|
1234
|
-
type: Host
|
|
1235
|
-
}, {
|
|
1236
|
-
type: Optional
|
|
1237
|
-
}] }]; }, propDecorators: { isLoading: [{
|
|
1338
|
+
}], propDecorators: { isLoading: [{
|
|
1238
1339
|
type: Input
|
|
1239
1340
|
}], fullWidth: [{
|
|
1240
1341
|
type: Input
|
|
1342
|
+
}, {
|
|
1343
|
+
type: HostBinding,
|
|
1344
|
+
args: ['class._fullWidth']
|
|
1241
1345
|
}], variant: [{
|
|
1242
1346
|
type: Input
|
|
1347
|
+
}], submitCallback: [{
|
|
1348
|
+
type: Input
|
|
1243
1349
|
}], before: [{
|
|
1244
1350
|
type: Input
|
|
1245
1351
|
}], after: [{
|
|
1246
1352
|
type: Input
|
|
1247
|
-
}], submitCallback: [{
|
|
1248
|
-
type: Input
|
|
1249
|
-
}], _: [{
|
|
1250
|
-
type: HostBinding,
|
|
1251
|
-
args: ['class._fullWidth']
|
|
1252
1353
|
}] } });
|
|
1253
1354
|
|
|
1254
1355
|
class MultipleValueAccessorBase extends ValueAccessorBase {
|
|
@@ -2015,7 +2116,8 @@ class NgxEnhancyFormsModule {
|
|
|
2015
2116
|
FormComponent,
|
|
2016
2117
|
SubFormDirective,
|
|
2017
2118
|
HourMinuteInputComponent,
|
|
2018
|
-
RadioComponent
|
|
2119
|
+
RadioComponent,
|
|
2120
|
+
WithTooltipDirective], imports: [CommonModule,
|
|
2019
2121
|
FormsModule,
|
|
2020
2122
|
NgSelectModule,
|
|
2021
2123
|
SortablejsModule,
|
|
@@ -2044,7 +2146,8 @@ class NgxEnhancyFormsModule {
|
|
|
2044
2146
|
FormComponent,
|
|
2045
2147
|
SubFormDirective,
|
|
2046
2148
|
HourMinuteInputComponent,
|
|
2047
|
-
RadioComponent
|
|
2149
|
+
RadioComponent,
|
|
2150
|
+
WithTooltipDirective] }); }
|
|
2048
2151
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.1", ngImport: i0, type: NgxEnhancyFormsModule, imports: [CommonModule,
|
|
2049
2152
|
FormsModule,
|
|
2050
2153
|
NgSelectModule,
|
|
@@ -2088,6 +2191,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
|
2088
2191
|
SubFormDirective,
|
|
2089
2192
|
HourMinuteInputComponent,
|
|
2090
2193
|
RadioComponent,
|
|
2194
|
+
WithTooltipDirective,
|
|
2091
2195
|
],
|
|
2092
2196
|
exports: [
|
|
2093
2197
|
ValueAccessorBase,
|
|
@@ -2116,6 +2220,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
|
2116
2220
|
SubFormDirective,
|
|
2117
2221
|
HourMinuteInputComponent,
|
|
2118
2222
|
RadioComponent,
|
|
2223
|
+
WithTooltipDirective,
|
|
2119
2224
|
],
|
|
2120
2225
|
}]
|
|
2121
2226
|
}] });
|
|
@@ -2128,5 +2233,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.1", ngImpor
|
|
|
2128
2233
|
* Generated bundle index. Do not edit.
|
|
2129
2234
|
*/
|
|
2130
2235
|
|
|
2131
|
-
export { ButtonComponent, CheckboxComponent, DATE_PICKER_LOCALE, DATE_PICKER_TRANSLATIONS, DATE_TIME_PICKER_TRANSLATIONS, DEFAULT_ERROR_MESSAGES, DatePickerComponent, DateTimePickerComponent, EmailInputComponent, FORM_ERROR_MESSAGES, FileInputComponent, FormCaptionComponent, FormComponent, FormElementComponent, FormErrorComponent, FormSubmitButtonComponent, HourMinuteInputComponent, KLP_DATE_FORMATS, KlpSelectOptionTemplateDirective, LoadingIndicatorComponent, MultipleValueAccessorBase, NgxEnhancyFormsModule, NumberInputComponent, Orientation, PasswordFieldComponent, RadioComponent, SELECT_TRANSLATIONS, SelectComponent, SelectFooterComponent, SortableGroupedItemsComponent, SortableItemsComponent, SubFormDirective, TextInputComponent, ToggleComponent, ValueAccessorBase, dateValidator, invalidDateKey, invalidFieldsSymbol, matDateFormatsFactory };
|
|
2236
|
+
export { ButtonComponent, CheckboxComponent, DATE_PICKER_LOCALE, DATE_PICKER_TRANSLATIONS, DATE_TIME_PICKER_TRANSLATIONS, DEFAULT_ERROR_MESSAGES, DatePickerComponent, DateTimePickerComponent, DefaultErrorHandler, EmailInputComponent, FORM_ERROR_MESSAGES, FileInputComponent, FormCaptionComponent, FormComponent, FormElementComponent, FormErrorComponent, FormSubmitButtonComponent, FormValidationError, HourMinuteInputComponent, KLP_DATE_FORMATS, KLP_FORM_ERROR_HANDLER, KlpSelectOptionTemplateDirective, LoadingIndicatorComponent, MultipleValueAccessorBase, NgxEnhancyFormsModule, NumberInputComponent, Orientation, PasswordFieldComponent, RadioComponent, SELECT_TRANSLATIONS, SelectComponent, SelectFooterComponent, SortableGroupedItemsComponent, SortableItemsComponent, SubFormDirective, TextInputComponent, ToggleComponent, ValueAccessorBase, WithTooltipDirective, dateValidator, invalidDateKey, invalidFieldsSymbol, matDateFormatsFactory };
|
|
2132
2237
|
//# sourceMappingURL=klippa-ngx-enhancy-forms.mjs.map
|