@klippa/ngx-enhancy-forms 14.16.1 → 14.16.3
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/elementIsTruncatedCb.component.mjs +54 -0
- package/esm2020/lib/elements/file-input/file-input.component.mjs +3 -3
- package/esm2020/lib/elements/text-input/text-input.component.mjs +3 -3
- package/esm2020/lib/elements/value-accessor-base/value-accessor-base.component.mjs +8 -1
- package/esm2020/lib/form/form-caption/form-caption.component.mjs +1 -1
- package/esm2020/lib/form/form-element/form-element.component.mjs +100 -9
- package/esm2020/lib/form/form-error/form-error.component.mjs +1 -1
- package/esm2020/lib/form/form.component.mjs +8 -2
- package/esm2020/lib/ngx-enhancy-forms.module.mjs +11 -3
- package/esm2020/lib/warning-icon/warning-icon.component.mjs +17 -0
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/klippa-ngx-enhancy-forms.mjs +270 -93
- package/fesm2015/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/fesm2020/klippa-ngx-enhancy-forms.mjs +265 -94
- package/fesm2020/klippa-ngx-enhancy-forms.mjs.map +1 -1
- package/lib/elementIsTruncatedCb.component.d.ts +13 -0
- package/lib/elements/value-accessor-base/value-accessor-base.component.d.ts +4 -1
- package/lib/form/form-caption/form-caption.component.d.ts +2 -2
- package/lib/form/form-element/form-element.component.d.ts +23 -8
- package/lib/form/form-error/form-error.component.d.ts +2 -2
- package/lib/form/form.component.d.ts +4 -2
- package/lib/ngx-enhancy-forms.module.d.ts +8 -6
- package/lib/warning-icon/warning-icon.component.d.ts +6 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, EventEmitter, Component, SkipSelf, Optional, Output, InjectionToken, Inject, ViewChild, Host, HostBinding, TemplateRef,
|
|
2
|
+
import { Directive, Input, EventEmitter, Component, SkipSelf, Optional, Output, InjectionToken, Inject, ViewChild, ContentChild, Host, HostBinding, TemplateRef, 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';
|
|
@@ -89,6 +89,15 @@ function isArrayOf(arr, kind) {
|
|
|
89
89
|
return arr.reduce((acc, val) => acc && val instanceof kind, true);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
function runNextRenderCycle(fn) {
|
|
93
|
+
setTimeout(fn);
|
|
94
|
+
}
|
|
95
|
+
function awaitableForNextCycle() {
|
|
96
|
+
return new Promise((resolve) => {
|
|
97
|
+
setTimeout(resolve);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
92
101
|
function mergeArray(arrA, arrB) {
|
|
93
102
|
const arr = new Array(Math.max(arrA.length, arrB.length));
|
|
94
103
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -150,6 +159,7 @@ class FormComponent {
|
|
|
150
159
|
this.readOnly = false;
|
|
151
160
|
this.showErrorMessages = true;
|
|
152
161
|
this.errorMessageLocation = 'belowCaption';
|
|
162
|
+
this.warnings = new Map();
|
|
153
163
|
this.onInjected = new EventEmitter();
|
|
154
164
|
// we keep track of what form controls are actually rendered. Only those count when looking at form validation
|
|
155
165
|
this.activeControls = [];
|
|
@@ -286,6 +296,9 @@ class FormComponent {
|
|
|
286
296
|
getFormElementByFormControl(control) {
|
|
287
297
|
return this.activeControls.find((e) => e.formControl === control)?.formElement;
|
|
288
298
|
}
|
|
299
|
+
getWarningToShow(control) {
|
|
300
|
+
return this.warnings.get(control);
|
|
301
|
+
}
|
|
289
302
|
trySubmit() {
|
|
290
303
|
this.formGroup.markAllAsTouched();
|
|
291
304
|
const allControls = this.getAllFormControls();
|
|
@@ -372,7 +385,7 @@ class FormComponent {
|
|
|
372
385
|
}
|
|
373
386
|
}
|
|
374
387
|
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 });
|
|
375
|
-
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", 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"] }] });
|
|
388
|
+
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", 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"] }] });
|
|
376
389
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormComponent, decorators: [{
|
|
377
390
|
type: Component,
|
|
378
391
|
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"] }]
|
|
@@ -390,89 +403,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
390
403
|
type: Input
|
|
391
404
|
}], formGroup: [{
|
|
392
405
|
type: Input
|
|
406
|
+
}], warnings: [{
|
|
407
|
+
type: Input
|
|
393
408
|
}], patchValueInterceptor: [{
|
|
394
409
|
type: Input
|
|
395
410
|
}], onInjected: [{
|
|
396
411
|
type: Output
|
|
397
412
|
}] } });
|
|
398
413
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
this.triangle = document.createElement('div');
|
|
428
|
-
this.triangle.style.zIndex = '1';
|
|
429
|
-
this.triangle.style.position = 'fixed';
|
|
430
|
-
this.triangle.style.left = `calc(${el.nativeElement.getBoundingClientRect().x + el.nativeElement.getBoundingClientRect().width}px - 2rem)`;
|
|
431
|
-
this.triangle.style.top = `${el.nativeElement.getBoundingClientRect().y}px`;
|
|
432
|
-
this.triangle.style.transform = `translate(-50%, calc(-100% + 0.1rem))`;
|
|
433
|
-
this.triangle.style.width = '0';
|
|
434
|
-
this.triangle.style.height = '0';
|
|
435
|
-
this.triangle.style.borderLeft = `${triangleSize} solid transparent`;
|
|
436
|
-
this.triangle.style.borderRight = `${triangleSize} solid transparent`;
|
|
437
|
-
this.triangle.style.borderTop = `${triangleSize} solid rgba(255, 128, 0, 0.1254901961)`;
|
|
438
|
-
el.nativeElement.prepend(this.triangle);
|
|
439
|
-
this.triangleWhite = document.createElement('div');
|
|
440
|
-
this.triangleWhite.style.zIndex = '3';
|
|
441
|
-
this.triangleWhite.style.position = 'fixed';
|
|
442
|
-
this.triangleWhite.style.left = `calc(${el.nativeElement.getBoundingClientRect().x + el.nativeElement.getBoundingClientRect().width}px - 2rem)`;
|
|
443
|
-
this.triangleWhite.style.top = `${el.nativeElement.getBoundingClientRect().y}px`;
|
|
444
|
-
this.triangleWhite.style.transform = `translate(-50%, calc(-100% + 0.1rem - 2px))`;
|
|
445
|
-
this.triangleWhite.style.width = '0';
|
|
446
|
-
this.triangleWhite.style.height = '0';
|
|
447
|
-
this.triangleWhite.style.borderLeft = `${triangleSize} solid transparent`;
|
|
448
|
-
this.triangleWhite.style.borderRight = `${triangleSize} solid transparent`;
|
|
449
|
-
this.triangleWhite.style.borderTop = `${triangleSize} solid white`;
|
|
450
|
-
el.nativeElement.prepend(this.triangleWhite);
|
|
451
|
-
});
|
|
452
|
-
el.nativeElement.addEventListener('mouseout', () => {
|
|
453
|
-
try {
|
|
454
|
-
el.nativeElement.removeChild(this.div);
|
|
455
|
-
}
|
|
456
|
-
catch (ex) { }
|
|
457
|
-
try {
|
|
458
|
-
el.nativeElement.removeChild(this.triangle);
|
|
459
|
-
}
|
|
460
|
-
catch (ex) { }
|
|
461
|
-
try {
|
|
462
|
-
el.nativeElement.removeChild(this.triangleWhite);
|
|
414
|
+
class WarningIconComponent {
|
|
415
|
+
constructor() {
|
|
416
|
+
this.variant = 'line';
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
WarningIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WarningIconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
420
|
+
WarningIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: WarningIconComponent, selector: "klp-form-warning-icon", inputs: { variant: "variant" }, ngImport: i0, template: "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" *ngIf=\"variant === 'line'\">\n\t<path d=\"M9.99976 7.49995V10.8333M9.99976 14.1666H10.0081M8.84585 3.24305L1.99178 15.0819C1.61161 15.7386 1.42153 16.0669 1.44962 16.3364C1.47412 16.5714 1.59727 16.785 1.7884 16.924C2.00753 17.0833 2.38691 17.0833 3.14569 17.0833H16.8538C17.6126 17.0833 17.992 17.0833 18.2111 16.924C18.4022 16.785 18.5254 16.5714 18.5499 16.3364C18.578 16.0669 18.3879 15.7386 18.0077 15.0819L11.1537 3.24305C10.7749 2.58875 10.5854 2.26159 10.3383 2.15172C10.1228 2.05587 9.87672 2.05587 9.66117 2.15172C9.41407 2.26159 9.22466 2.58875 8.84585 3.24305Z\" stroke=\"#ff8000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" *ngIf=\"variant === 'fill'\">\n\t<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.6771 1.39035C10.246 1.19866 9.75387 1.19866 9.32277 1.39035C8.98983 1.53839 8.77355 1.79916 8.62305 2.01164C8.47508 2.22055 8.31666 2.49423 8.14243 2.79523L1.25313 14.6949C1.07821 14.997 0.919248 15.2715 0.811464 15.5045C0.701923 15.7413 0.583086 16.0596 0.62096 16.4229C0.669969 16.8929 0.916253 17.3201 1.29852 17.598C1.59393 17.8128 1.92892 17.8695 2.18872 17.8933C2.44435 17.9167 2.76156 17.9167 3.11063 17.9167H16.8892C17.2383 17.9167 17.5555 17.9167 17.8111 17.8933C18.0709 17.8695 18.4059 17.8128 18.7014 17.598C19.0836 17.3201 19.3299 16.8929 19.3789 16.4229C19.4168 16.0596 19.2979 15.7413 19.1884 15.5045C19.0806 15.2715 18.9217 14.997 18.7468 14.695L11.8574 2.7952C11.6832 2.49422 11.5248 2.22053 11.3768 2.01164C11.2263 1.79916 11.01 1.53839 10.6771 1.39035ZM10.8333 7.50004C10.8333 7.0398 10.4602 6.66671 9.99996 6.66671C9.53972 6.66671 9.16663 7.0398 9.16663 7.50004V10.8334C9.16663 11.2936 9.53972 11.6667 9.99996 11.6667C10.4602 11.6667 10.8333 11.2936 10.8333 10.8334V7.50004ZM9.99996 13.3334C9.53972 13.3334 9.16663 13.7065 9.16663 14.1667C9.16663 14.6269 9.53972 15 9.99996 15H10.0083C10.4685 15 10.8416 14.6269 10.8416 14.1667C10.8416 13.7065 10.4685 13.3334 10.0083 13.3334H9.99996Z\" fill=\"#ff8000\"/>\n</svg>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
421
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WarningIconComponent, decorators: [{
|
|
422
|
+
type: Component,
|
|
423
|
+
args: [{ selector: 'klp-form-warning-icon', template: "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" *ngIf=\"variant === 'line'\">\n\t<path d=\"M9.99976 7.49995V10.8333M9.99976 14.1666H10.0081M8.84585 3.24305L1.99178 15.0819C1.61161 15.7386 1.42153 16.0669 1.44962 16.3364C1.47412 16.5714 1.59727 16.785 1.7884 16.924C2.00753 17.0833 2.38691 17.0833 3.14569 17.0833H16.8538C17.6126 17.0833 17.992 17.0833 18.2111 16.924C18.4022 16.785 18.5254 16.5714 18.5499 16.3364C18.578 16.0669 18.3879 15.7386 18.0077 15.0819L11.1537 3.24305C10.7749 2.58875 10.5854 2.26159 10.3383 2.15172C10.1228 2.05587 9.87672 2.05587 9.66117 2.15172C9.41407 2.26159 9.22466 2.58875 8.84585 3.24305Z\" stroke=\"#ff8000\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n</svg>\n<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" *ngIf=\"variant === 'fill'\">\n\t<path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M10.6771 1.39035C10.246 1.19866 9.75387 1.19866 9.32277 1.39035C8.98983 1.53839 8.77355 1.79916 8.62305 2.01164C8.47508 2.22055 8.31666 2.49423 8.14243 2.79523L1.25313 14.6949C1.07821 14.997 0.919248 15.2715 0.811464 15.5045C0.701923 15.7413 0.583086 16.0596 0.62096 16.4229C0.669969 16.8929 0.916253 17.3201 1.29852 17.598C1.59393 17.8128 1.92892 17.8695 2.18872 17.8933C2.44435 17.9167 2.76156 17.9167 3.11063 17.9167H16.8892C17.2383 17.9167 17.5555 17.9167 17.8111 17.8933C18.0709 17.8695 18.4059 17.8128 18.7014 17.598C19.0836 17.3201 19.3299 16.8929 19.3789 16.4229C19.4168 16.0596 19.2979 15.7413 19.1884 15.5045C19.0806 15.2715 18.9217 14.997 18.7468 14.695L11.8574 2.7952C11.6832 2.49422 11.5248 2.22053 11.3768 2.01164C11.2263 1.79916 11.01 1.53839 10.6771 1.39035ZM10.8333 7.50004C10.8333 7.0398 10.4602 6.66671 9.99996 6.66671C9.53972 6.66671 9.16663 7.0398 9.16663 7.50004V10.8334C9.16663 11.2936 9.53972 11.6667 9.99996 11.6667C10.4602 11.6667 10.8333 11.2936 10.8333 10.8334V7.50004ZM9.99996 13.3334C9.53972 13.3334 9.16663 13.7065 9.16663 14.1667C9.16663 14.6269 9.53972 15 9.99996 15H10.0083C10.4685 15 10.8416 14.6269 10.8416 14.1667C10.8416 13.7065 10.4685 13.3334 10.0083 13.3334H9.99996Z\" fill=\"#ff8000\"/>\n</svg>\n", styles: [":host{display:block}\n"] }]
|
|
424
|
+
}], propDecorators: { variant: [{
|
|
425
|
+
type: Input
|
|
426
|
+
}] } });
|
|
427
|
+
|
|
428
|
+
class ElementIsTruncatedCbComponent {
|
|
429
|
+
constructor(elementRef) {
|
|
430
|
+
this.elementRef = elementRef;
|
|
431
|
+
this.elementIsTruncatedCb = (isTruncated) => { };
|
|
432
|
+
}
|
|
433
|
+
ngAfterViewInit() {
|
|
434
|
+
if (!isValueSet(this.elementIsTruncatedCb)) {
|
|
435
|
+
console.log('nope');
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
console.log('yes');
|
|
439
|
+
this.elementRef.nativeElement.addEventListener('DOMCharacterDataModified', (event) => {
|
|
440
|
+
if (isValueSet(event.target.wholeText)) {
|
|
441
|
+
this.checkForTruncation();
|
|
463
442
|
}
|
|
464
|
-
|
|
465
|
-
|
|
443
|
+
}, false);
|
|
444
|
+
this.checkForTruncation();
|
|
445
|
+
}
|
|
446
|
+
ngOnDestroy() {
|
|
447
|
+
console.log('destroyed');
|
|
448
|
+
}
|
|
449
|
+
async checkForTruncation() {
|
|
450
|
+
await awaitableForNextCycle();
|
|
451
|
+
const isTruncated = this.isTruncated(this.elementRef.nativeElement);
|
|
452
|
+
if (isValueSet(isTruncated)) {
|
|
453
|
+
this.elementIsTruncatedCb(isTruncated);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
isTruncated(element) {
|
|
457
|
+
if (!(element.scrollWidth > 0)) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const thisElementIsTruncated = element.scrollWidth > element.clientWidth;
|
|
461
|
+
if (!thisElementIsTruncated) {
|
|
462
|
+
return Array.from(element.children).some((child) => this.isTruncated(child));
|
|
463
|
+
}
|
|
464
|
+
return thisElementIsTruncated;
|
|
466
465
|
}
|
|
467
466
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type:
|
|
467
|
+
ElementIsTruncatedCbComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ElementIsTruncatedCbComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
468
|
+
ElementIsTruncatedCbComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: ElementIsTruncatedCbComponent, selector: "[elementIsTruncatedCb]", inputs: { elementIsTruncatedCb: "elementIsTruncatedCb" }, ngImport: i0 });
|
|
469
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: ElementIsTruncatedCbComponent, decorators: [{
|
|
471
470
|
type: Directive,
|
|
472
471
|
args: [{
|
|
473
|
-
selector: '[
|
|
472
|
+
selector: '[elementIsTruncatedCb]'
|
|
474
473
|
}]
|
|
475
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: {
|
|
474
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { elementIsTruncatedCb: [{
|
|
476
475
|
type: Input
|
|
477
476
|
}] } });
|
|
478
477
|
|
|
@@ -499,6 +498,17 @@ class FormElementComponent {
|
|
|
499
498
|
this.errorMessageAsTooltip = false;
|
|
500
499
|
this.errorMessages = DEFAULT_ERROR_MESSAGES;
|
|
501
500
|
this.customErrorHandlers = [];
|
|
501
|
+
this.popupState = 'onHover';
|
|
502
|
+
this.setErrorMessageIsTruncated = (isTruncated) => {
|
|
503
|
+
this.errorFullyVisible = !isTruncated;
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
async ngAfterViewInit() {
|
|
507
|
+
await awaitableForNextCycle();
|
|
508
|
+
this.fieldInput?.setTailTpl(this.tailTpl);
|
|
509
|
+
this.fieldInput?.onTouch.asObservable().subscribe((e) => {
|
|
510
|
+
this.determinePopupState();
|
|
511
|
+
});
|
|
502
512
|
}
|
|
503
513
|
shouldShowErrorMessages() {
|
|
504
514
|
return this.parent?.showErrorMessages !== false;
|
|
@@ -512,6 +522,20 @@ class FormElementComponent {
|
|
|
512
522
|
this.attachedControl = formControl;
|
|
513
523
|
this.parent.registerControl(formControl, this);
|
|
514
524
|
this.input = input;
|
|
525
|
+
this.attachedControl.statusChanges.subscribe((e) => {
|
|
526
|
+
this.determinePopupState();
|
|
527
|
+
});
|
|
528
|
+
this.determinePopupState();
|
|
529
|
+
}
|
|
530
|
+
determinePopupState() {
|
|
531
|
+
if (stringIsSetAndFilled(this.getErrorToShow())) {
|
|
532
|
+
this.popupState = 'onHover';
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
if (stringIsSetAndFilled(this.getWarningToShow())) {
|
|
536
|
+
this.popupState = 'lockedOpen';
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
515
539
|
}
|
|
516
540
|
unregisterControl(formControl) {
|
|
517
541
|
this.attachedControl = null;
|
|
@@ -529,11 +553,18 @@ class FormElementComponent {
|
|
|
529
553
|
registerCaption(templateRef) {
|
|
530
554
|
this.captionRef = templateRef;
|
|
531
555
|
}
|
|
556
|
+
getWarningToShow() {
|
|
557
|
+
return this.parent?.getWarningToShow(this.attachedControl);
|
|
558
|
+
}
|
|
532
559
|
getErrorToShow() {
|
|
533
|
-
|
|
534
|
-
|
|
560
|
+
const firstError = Object.keys(this.attachedControl?.errors ?? {})[0];
|
|
561
|
+
if (this.attachedControl?.touched !== true) {
|
|
562
|
+
return null;
|
|
535
563
|
}
|
|
536
|
-
|
|
564
|
+
if (!this.attachedControl?.errors) {
|
|
565
|
+
return null;
|
|
566
|
+
}
|
|
567
|
+
return firstError;
|
|
537
568
|
}
|
|
538
569
|
getCustomErrorHandler(error) {
|
|
539
570
|
return this.customErrorHandlers.find((e) => e.error === error);
|
|
@@ -569,12 +600,59 @@ class FormElementComponent {
|
|
|
569
600
|
getErrorLocation() {
|
|
570
601
|
return this.parent?.errorMessageLocation ?? 'belowCaption';
|
|
571
602
|
}
|
|
603
|
+
shouldShowErrorTooltipOpened() {
|
|
604
|
+
return this.popupState === 'lockedOpen';
|
|
605
|
+
}
|
|
606
|
+
hasHoverableErrorTooltip() {
|
|
607
|
+
if (!this.hasRightOfCaptionError() && !this.errorMessageAsTooltip) {
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
if (this.popupState !== 'onHover') {
|
|
611
|
+
return false;
|
|
612
|
+
}
|
|
613
|
+
if (stringIsSetAndFilled(this.getErrorToShow())) {
|
|
614
|
+
return !this.errorFullyVisible;
|
|
615
|
+
}
|
|
616
|
+
if (stringIsSetAndFilled(this.getWarningToShow())) {
|
|
617
|
+
return true;
|
|
618
|
+
}
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
hasRightOfCaptionError() {
|
|
622
|
+
if (this.errorMessageAsTooltip) {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
if (this.direction !== 'vertical' || this.getErrorLocation() !== 'rightOfCaption') {
|
|
626
|
+
return false;
|
|
627
|
+
}
|
|
628
|
+
return true;
|
|
629
|
+
}
|
|
630
|
+
shouldShowWarningPopup() {
|
|
631
|
+
return stringIsSetAndFilled(this.getWarningToShow());
|
|
632
|
+
}
|
|
633
|
+
closePopup() {
|
|
634
|
+
this.popupState = 'onHover';
|
|
635
|
+
}
|
|
636
|
+
togglePopup() {
|
|
637
|
+
if (!this.hasRightOfCaptionError()) {
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
if (this.errorFullyVisible) {
|
|
641
|
+
return;
|
|
642
|
+
}
|
|
643
|
+
if (this.popupState === 'lockedOpen') {
|
|
644
|
+
this.popupState = 'onHover';
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
this.popupState = 'lockedOpen';
|
|
648
|
+
}
|
|
649
|
+
}
|
|
572
650
|
}
|
|
573
651
|
FormElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormElementComponent, deps: [{ token: FormComponent, optional: true }, { token: FORM_ERROR_MESSAGES, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
574
|
-
FormElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormElementComponent, selector: "klp-form-element", inputs: { caption: "caption", direction: "direction", captionSpacing: "captionSpacing", spaceDistribution: "spaceDistribution", swapInputAndCaption: "swapInputAndCaption", errorMessageAsTooltip: "errorMessageAsTooltip" }, 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]=\"!errorMessageAsTooltip && 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' && !errorMessageAsTooltip\" [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' && spaceDistribution !== 'fixedInputWidth',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\n\t\t\t'fixedInputWidth': spaceDistribution === 'fixedInputWidth',\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' && !errorMessageAsTooltip\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption' && !errorMessageAsTooltip\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages' && spaceDistribution !== 'fixedInputWidth',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66',\n\t\t'fixedInputWidth': spaceDistribution === 'fixedInputWidth'\n\t}\">\n\t\t<ng-container *ngIf=\"errorMessageAsTooltip && shouldShowErrorMessages() && getErrorToShow()\">\n\t\t\t<div class=\"errorTooltipTriangle\"></div>\n\t\t\t<div class=\"errorTooltipTriangleWhite\"></div>\n\t\t\t<div class=\"errorTooltip\">\n\t\t\t\t<ng-container [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t\t</div>\n\t\t</ng-container>\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.fixedInputWidth{flex:1 1 0px;overflow:hidden}.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{position:relative;flex:1}.inputContainer .errorTooltipTriangle{z-index:1;position:absolute;display:none;right:0;transform:translate(-50%,calc(-100% + .1rem));width:0px;height:0px;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid rgba(255,128,0,.125)}.inputContainer .errorTooltipTriangleWhite{z-index:3;position:absolute;display:none;right:0;transform:translate(-50%,calc(-100% + .1rem - 2px));width:0px;height:0px;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid white}.inputContainer .errorTooltip{position:absolute;top:-.6rem;right:0;display:none;z-index:2;color:#515365;transform:translateY(-100%);max-width:20rem;white-space:break-spaces;background-color:#fff;border:1px solid rgba(255,128,0,.125);box-shadow:#ff800020 2px 3px 10px;padding:.3rem .5rem;box-sizing:border-box;border-radius:3px}.inputContainer .errorTooltip .errorContainer{margin-left:initial}.inputContainer:hover .errorTooltip,.inputContainer:hover .errorTooltipTriangle,.inputContainer:hover .errorTooltipTriangleWhite{display:block}.inputContainer.percentageSpacing{flex:60}.inputContainer.percentageSpacing.d30-70{flex:70}.inputContainer.percentageSpacing.d34-66{flex:66}.inputContainer.fixedInputWidth{flex:0 0 auto}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:calc(40% + 1.25rem)}.errorContainer.hasCaption.d30-70{margin-left:calc(30% + 1.25rem)}.errorContainer.hasCaption.d34-66{margin-left:calc(34% + 1.25rem)}\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"] }] });
|
|
652
|
+
FormElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FormElementComponent, selector: "klp-form-element", inputs: { caption: "caption", direction: "direction", captionSpacing: "captionSpacing", spaceDistribution: "spaceDistribution", swapInputAndCaption: "swapInputAndCaption", errorMessageAsTooltip: "errorMessageAsTooltip" }, queries: [{ propertyName: "fieldInput", first: true, predicate: NG_VALUE_ACCESSOR, descendants: true }], viewQueries: [{ propertyName: "internalComponentRef", first: true, predicate: ["internalComponentRef"], descendants: true }, { propertyName: "tailTpl", first: true, predicate: ["tailTpl"], descendants: true }, { propertyName: "captionDummyForSpaceCalculation", first: true, predicate: ["captionDummyForSpaceCalculation"], descendants: true }], ngImport: i0, template: "<div\n\tclass=\"componentContainer\"\n\t[ngClass]=\"{\n\t\thasCaption: caption || captionRef,\n\t\tvertical: direction === 'vertical',\n\t\thorizontal: direction === 'horizontal',\n\t\treverseOrder: swapInputAndCaption,\n\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\tpercentageSpacing: captionSpacing === 'percentages' && spaceDistribution !== 'fixedInputWidth',\n\t\t'd40-60': spaceDistribution === '40-60',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66',\n\t\t'fixedInputWidth': spaceDistribution === 'fixedInputWidth'\n\t}\"\n>\n\t<div class=\"errorAboveInputContainer\" *ngIf=\"direction === 'horizontal' && !errorMessageAsTooltip\">\n\t\t<div class=\"spacer\"></div>\n\t\t<ng-container [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t</div>\n\n\t<div class=\"captionInputAndError\" #internalComponentRef>\n\t\t<div class=\"captionDummyForSpaceCalculation\" #captionDummyForSpaceCalculation *ngIf=\"hasRightOfCaptionError()\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionTpl\" [ngTemplateOutletContext]=\"{forCalculation: true}\"></ng-container>\n\t\t</div>\n\t\t<ng-container [ngTemplateOutlet]=\"captionTpl\"></ng-container>\n\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption' && !errorMessageAsTooltip\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t<div class=\"inputContainer\">\n\t\t\t<ng-container *ngIf=\"errorMessageAsTooltip && shouldShowErrorMessages() && getErrorToShow()\">\n\t\t\t\t<div class=\"errorTooltipTriangle\"></div>\n\t\t\t\t<div class=\"errorTooltipTriangleWhite\"></div>\n\t\t\t\t<div class=\"errorTooltip\">\n\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t\t<ng-content></ng-content>\n\t\t</div>\n\t</div>\n</div>\n\n<ng-template #captionTpl let-forCalculation=\"forCalculation\">\n\t<div class=\"caption\"\n\t\t*ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\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\" *ngIf=\"hasRightOfCaptionError()\" [ngClass]=\"{errorFullyVisible: errorFullyVisible}\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"errorRef\" [ngTemplateOutletContext]=\"{forCalculation: forCalculation}\"></ng-container>\n\t\t</div>\n\t</div>\n</ng-template>\n\n<ng-template #errorRef let-forCalculation=\"forCalculation\">\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [elementIsTruncatedCb]=\"forCalculation ? setErrorMessageIsTruncated : null\" [ngClass]=\"{horizontal: direction === 'horizontal', 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-template #tailTpl>\n\t<div class=\"errorTooltipContainer\" [ngClass]=\"{alwaysOpen: shouldShowErrorTooltipOpened()}\">\n\t\t<ng-container *ngIf=\"hasHoverableErrorTooltip() || shouldShowErrorTooltipOpened()\">\n\t\t\t<div class=\"errorTooltipTriangle\"></div>\n\t\t\t<div class=\"errorTooltipTriangleWhite\"></div>\n\t\t\t<div class=\"errorTooltip\" [ngClass]=\"{noPointerEvents: !shouldShowErrorTooltipOpened()}\">\n\t\t\t\t<i class=\"closeBtn\" (click)=\"closePopup();\">\u00D7</i>\n\t\t\t\t<ng-container *ngIf=\"getErrorToShow()\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t\t\t<div *ngIf=\"!getErrorToShow() && shouldShowWarningPopup()\">{{getWarningToShow()}}</div>\n\t\t\t</div>\n\t\t</ng-container>\n\t\t<klp-form-warning-icon variant=\"fill\" *ngIf=\"getErrorToShow()\" (click)=\"togglePopup()\"></klp-form-warning-icon>\n\t\t<klp-form-warning-icon variant=\"line\" *ngIf=\"!getErrorToShow() && getWarningToShow()\" (click)=\"togglePopup()\"></klp-form-warning-icon>\n\t</div>\n</ng-template>\n", styles: [":host{display:block}.componentContainer:not(.hasCaption) .captionInputAndError{display:block}.componentContainer:not(.hasCaption) .captionInputAndError .inputContainer{margin-top:0}.componentContainer.hasCaption .errorAboveInputContainer .spacer{display:block}.componentContainer.reverseOrder .captionInputAndError{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.horizontal .captionInputAndError{gap:1rem}.componentContainer.vertical .captionInputAndError{display:block}.componentContainer.vertical .captionInputAndError .inputContainer{margin-top:.3125rem}.componentContainer.vertical .captionInputAndError .errorContainer{margin-left:0}.componentContainer.d40-60 .errorAboveInputContainer .spacer{flex:40 1 0px}.componentContainer.d40-60 .errorAboveInputContainer .errorContainer{flex:60 1 0px}.componentContainer.d40-60 .caption{flex:40 1 0px}.componentContainer.d40-60 .inputContainer{flex:60 1 0px}.componentContainer.d34-66 .errorAboveInputContainer .spacer{flex:34 1 0px}.componentContainer.d34-66 .errorAboveInputContainer .errorContainer{flex:66 1 0px}.componentContainer.d34-66 .caption{flex:34 1 0px}.componentContainer.d34-66 .inputContainer{flex:66 1 0px}.componentContainer.d30-70 .errorAboveInputContainer .spacer{flex:30 1 0px}.componentContainer.d30-70 .errorAboveInputContainer .errorContainer{flex:70 1 0px}.componentContainer.d30-70 .caption{flex:30 1 0px}.componentContainer.d30-70 .inputContainer{flex:70 1 0px}.componentContainer.fixedInputWidth .caption{flex:1 1 0px;overflow:hidden}.componentContainer.fixedInputWidth .inputContainer{flex:0 0 auto}.captionInputAndError{display:flex;align-items:center;min-height:42px}.errorAboveInputContainer{display:flex;gap:1rem}.errorAboveInputContainer .spacer{display:none}.captionDummyForSpaceCalculation .caption.withErrorRightOfCaption{height:0px;overflow:hidden}.captionDummyForSpaceCalculation .caption.withErrorRightOfCaption .rightOfCaptionError{display:block}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;color:#515365;overflow:hidden}.caption.percentageSpacing{flex:40 1 0px}.caption.percentageSpacing.d30-70{flex:30 1 0px}.caption.percentageSpacing.d34-66{flex:34 1 0px}.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;max-width:40%;font-weight:400;overflow:hidden;flex:1 0 auto;text-align:right}.caption.withErrorRightOfCaption .rightOfCaptionError.errorFullyVisible{display:block}.caption.withErrorRightOfCaption .rightOfCaptionError ::ng-deep *{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.inputContainer{position:relative;flex:1}.inputContainer .errorTooltipContainer{position:relative}.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltipTriangle,.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltipTriangleWhite,.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltip,.inputContainer .errorTooltipContainer.alwaysOpen .closeBtn{display:block}.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltip{padding-right:1.4rem}.inputContainer .errorTooltipContainer klp-form-warning-icon{cursor:pointer}.inputContainer .errorTooltipTriangle{display:none;z-index:1;position:absolute;right:0;transform:translate(-.15rem,calc(-100% - .1rem)) scaleX(.8);width:0px;height:0px;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid rgba(0,0,0,.13)}.inputContainer .errorTooltipTriangleWhite{display:none;z-index:3;position:absolute;right:0;transform:translate(-.15rem,calc(-100% - .1rem - 2px)) scaleX(.8);width:0px;height:0px;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid white}.inputContainer .errorTooltip{display:none;word-wrap:break-word;position:absolute;top:-.6rem;right:-.625rem;background:white;transform:translateY(-100%);width:12rem;white-space:break-spaces;padding:.4rem .6rem;border-radius:.4rem;border:1px solid rgba(0,0,0,.13);box-shadow:#00000021 2px 3px 10px}.inputContainer .errorTooltip.noPointerEvents{pointer-events:none}.inputContainer .errorTooltip .closeBtn{display:none;position:absolute;top:.2rem;right:.2rem;padding:.2rem .4rem;cursor:pointer;color:#666;font-size:1rem}.inputContainer .errorTooltip .closeBtn:hover{color:#515365}.inputContainer:hover .errorTooltipContainer .errorTooltip,.inputContainer:hover .errorTooltipContainer .errorTooltipTriangle,.inputContainer:hover .errorTooltipContainer .errorTooltipTriangleWhite{display:block}.errorContainer{color:#ff8000}\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: "component", type: WarningIconComponent, selector: "klp-form-warning-icon", inputs: ["variant"] }, { kind: "directive", type: ElementIsTruncatedCbComponent, selector: "[elementIsTruncatedCb]", inputs: ["elementIsTruncatedCb"] }] });
|
|
575
653
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FormElementComponent, decorators: [{
|
|
576
654
|
type: Component,
|
|
577
|
-
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]=\"!errorMessageAsTooltip && 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' && !errorMessageAsTooltip\" [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' && spaceDistribution !== 'fixedInputWidth',\n\t\t\t'd30-70': spaceDistribution === '30-70',\n\t\t\t'd34-66': spaceDistribution === '34-66',\n\t\t\t'fixedInputWidth': spaceDistribution === 'fixedInputWidth',\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' && !errorMessageAsTooltip\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t</div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption' && !errorMessageAsTooltip\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{\n\t\tpercentageSpacing: captionSpacing === 'percentages' && spaceDistribution !== 'fixedInputWidth',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66',\n\t\t'fixedInputWidth': spaceDistribution === 'fixedInputWidth'\n\t}\">\n\t\t<ng-container *ngIf=\"errorMessageAsTooltip && shouldShowErrorMessages() && getErrorToShow()\">\n\t\t\t<div class=\"errorTooltipTriangle\"></div>\n\t\t\t<div class=\"errorTooltipTriangleWhite\"></div>\n\t\t\t<div class=\"errorTooltip\">\n\t\t\t\t<ng-container [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t\t</div>\n\t\t</ng-container>\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.fixedInputWidth{flex:1 1 0px;overflow:hidden}.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{position:relative;flex:1}.inputContainer .errorTooltipTriangle{z-index:1;position:absolute;display:none;right:0;transform:translate(-50%,calc(-100% + .1rem));width:0px;height:0px;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid rgba(255,128,0,.125)}.inputContainer .errorTooltipTriangleWhite{z-index:3;position:absolute;display:none;right:0;transform:translate(-50%,calc(-100% + .1rem - 2px));width:0px;height:0px;border-left:12px solid transparent;border-right:12px solid transparent;border-top:12px solid white}.inputContainer .errorTooltip{position:absolute;top:-.6rem;right:0;display:none;z-index:2;color:#515365;transform:translateY(-100%);max-width:20rem;white-space:break-spaces;background-color:#fff;border:1px solid rgba(255,128,0,.125);box-shadow:#ff800020 2px 3px 10px;padding:.3rem .5rem;box-sizing:border-box;border-radius:3px}.inputContainer .errorTooltip .errorContainer{margin-left:initial}.inputContainer:hover .errorTooltip,.inputContainer:hover .errorTooltipTriangle,.inputContainer:hover .errorTooltipTriangleWhite{display:block}.inputContainer.percentageSpacing{flex:60}.inputContainer.percentageSpacing.d30-70{flex:70}.inputContainer.percentageSpacing.d34-66{flex:66}.inputContainer.fixedInputWidth{flex:0 0 auto}.errorContainer{color:#ff8000}.errorContainer.hasCaption{margin-left:calc(40% + 1.25rem)}.errorContainer.hasCaption.d30-70{margin-left:calc(30% + 1.25rem)}.errorContainer.hasCaption.d34-66{margin-left:calc(34% + 1.25rem)}\n"] }]
|
|
655
|
+
args: [{ selector: 'klp-form-element', template: "<div\n\tclass=\"componentContainer\"\n\t[ngClass]=\"{\n\t\thasCaption: caption || captionRef,\n\t\tvertical: direction === 'vertical',\n\t\thorizontal: direction === 'horizontal',\n\t\treverseOrder: swapInputAndCaption,\n\t\thasErrors: getErrorToShow() && attachedControl.touched,\n\t\tpercentageSpacing: captionSpacing === 'percentages' && spaceDistribution !== 'fixedInputWidth',\n\t\t'd40-60': spaceDistribution === '40-60',\n\t\t'd30-70': spaceDistribution === '30-70',\n\t\t'd34-66': spaceDistribution === '34-66',\n\t\t'fixedInputWidth': spaceDistribution === 'fixedInputWidth'\n\t}\"\n>\n\t<div class=\"errorAboveInputContainer\" *ngIf=\"direction === 'horizontal' && !errorMessageAsTooltip\">\n\t\t<div class=\"spacer\"></div>\n\t\t<ng-container [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t</div>\n\n\t<div class=\"captionInputAndError\" #internalComponentRef>\n\t\t<div class=\"captionDummyForSpaceCalculation\" #captionDummyForSpaceCalculation *ngIf=\"hasRightOfCaptionError()\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionTpl\" [ngTemplateOutletContext]=\"{forCalculation: true}\"></ng-container>\n\t\t</div>\n\t\t<ng-container [ngTemplateOutlet]=\"captionTpl\"></ng-container>\n\t\t<ng-container *ngIf=\"direction === 'vertical' && getErrorLocation() === 'belowCaption' && !errorMessageAsTooltip\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t<div class=\"inputContainer\">\n\t\t\t<ng-container *ngIf=\"errorMessageAsTooltip && shouldShowErrorMessages() && getErrorToShow()\">\n\t\t\t\t<div class=\"errorTooltipTriangle\"></div>\n\t\t\t\t<div class=\"errorTooltipTriangleWhite\"></div>\n\t\t\t\t<div class=\"errorTooltip\">\n\t\t\t\t\t<ng-container [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t\t\t</div>\n\t\t\t</ng-container>\n\t\t\t<ng-content></ng-content>\n\t\t</div>\n\t</div>\n</div>\n\n<ng-template #captionTpl let-forCalculation=\"forCalculation\">\n\t<div class=\"caption\"\n\t\t*ngIf=\"caption || captionRef\"\n\t\t[ngClass]=\"{\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\" *ngIf=\"hasRightOfCaptionError()\" [ngClass]=\"{errorFullyVisible: errorFullyVisible}\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"errorRef\" [ngTemplateOutletContext]=\"{forCalculation: forCalculation}\"></ng-container>\n\t\t</div>\n\t</div>\n</ng-template>\n\n<ng-template #errorRef let-forCalculation=\"forCalculation\">\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [elementIsTruncatedCb]=\"forCalculation ? setErrorMessageIsTruncated : null\" [ngClass]=\"{horizontal: direction === 'horizontal', 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-template #tailTpl>\n\t<div class=\"errorTooltipContainer\" [ngClass]=\"{alwaysOpen: shouldShowErrorTooltipOpened()}\">\n\t\t<ng-container *ngIf=\"hasHoverableErrorTooltip() || shouldShowErrorTooltipOpened()\">\n\t\t\t<div class=\"errorTooltipTriangle\"></div>\n\t\t\t<div class=\"errorTooltipTriangleWhite\"></div>\n\t\t\t<div class=\"errorTooltip\" [ngClass]=\"{noPointerEvents: !shouldShowErrorTooltipOpened()}\">\n\t\t\t\t<i class=\"closeBtn\" (click)=\"closePopup();\">\u00D7</i>\n\t\t\t\t<ng-container *ngIf=\"getErrorToShow()\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t\t\t\t<div *ngIf=\"!getErrorToShow() && shouldShowWarningPopup()\">{{getWarningToShow()}}</div>\n\t\t\t</div>\n\t\t</ng-container>\n\t\t<klp-form-warning-icon variant=\"fill\" *ngIf=\"getErrorToShow()\" (click)=\"togglePopup()\"></klp-form-warning-icon>\n\t\t<klp-form-warning-icon variant=\"line\" *ngIf=\"!getErrorToShow() && getWarningToShow()\" (click)=\"togglePopup()\"></klp-form-warning-icon>\n\t</div>\n</ng-template>\n", styles: [":host{display:block}.componentContainer:not(.hasCaption) .captionInputAndError{display:block}.componentContainer:not(.hasCaption) .captionInputAndError .inputContainer{margin-top:0}.componentContainer.hasCaption .errorAboveInputContainer .spacer{display:block}.componentContainer.reverseOrder .captionInputAndError{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.horizontal .captionInputAndError{gap:1rem}.componentContainer.vertical .captionInputAndError{display:block}.componentContainer.vertical .captionInputAndError .inputContainer{margin-top:.3125rem}.componentContainer.vertical .captionInputAndError .errorContainer{margin-left:0}.componentContainer.d40-60 .errorAboveInputContainer .spacer{flex:40 1 0px}.componentContainer.d40-60 .errorAboveInputContainer .errorContainer{flex:60 1 0px}.componentContainer.d40-60 .caption{flex:40 1 0px}.componentContainer.d40-60 .inputContainer{flex:60 1 0px}.componentContainer.d34-66 .errorAboveInputContainer .spacer{flex:34 1 0px}.componentContainer.d34-66 .errorAboveInputContainer .errorContainer{flex:66 1 0px}.componentContainer.d34-66 .caption{flex:34 1 0px}.componentContainer.d34-66 .inputContainer{flex:66 1 0px}.componentContainer.d30-70 .errorAboveInputContainer .spacer{flex:30 1 0px}.componentContainer.d30-70 .errorAboveInputContainer .errorContainer{flex:70 1 0px}.componentContainer.d30-70 .caption{flex:30 1 0px}.componentContainer.d30-70 .inputContainer{flex:70 1 0px}.componentContainer.fixedInputWidth .caption{flex:1 1 0px;overflow:hidden}.componentContainer.fixedInputWidth .inputContainer{flex:0 0 auto}.captionInputAndError{display:flex;align-items:center;min-height:42px}.errorAboveInputContainer{display:flex;gap:1rem}.errorAboveInputContainer .spacer{display:none}.captionDummyForSpaceCalculation .caption.withErrorRightOfCaption{height:0px;overflow:hidden}.captionDummyForSpaceCalculation .caption.withErrorRightOfCaption .rightOfCaptionError{display:block}.captionRefContainer{display:flex}.caption{font-weight:700;flex:0 0 auto;color:#515365;overflow:hidden}.caption.percentageSpacing{flex:40 1 0px}.caption.percentageSpacing.d30-70{flex:30 1 0px}.caption.percentageSpacing.d34-66{flex:34 1 0px}.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;max-width:40%;font-weight:400;overflow:hidden;flex:1 0 auto;text-align:right}.caption.withErrorRightOfCaption .rightOfCaptionError.errorFullyVisible{display:block}.caption.withErrorRightOfCaption .rightOfCaptionError ::ng-deep *{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.inputContainer{position:relative;flex:1}.inputContainer .errorTooltipContainer{position:relative}.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltipTriangle,.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltipTriangleWhite,.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltip,.inputContainer .errorTooltipContainer.alwaysOpen .closeBtn{display:block}.inputContainer .errorTooltipContainer.alwaysOpen .errorTooltip{padding-right:1.4rem}.inputContainer .errorTooltipContainer klp-form-warning-icon{cursor:pointer}.inputContainer .errorTooltipTriangle{display:none;z-index:1;position:absolute;right:0;transform:translate(-.15rem,calc(-100% - .1rem)) scaleX(.8);width:0px;height:0px;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid rgba(0,0,0,.13)}.inputContainer .errorTooltipTriangleWhite{display:none;z-index:3;position:absolute;right:0;transform:translate(-.15rem,calc(-100% - .1rem - 2px)) scaleX(.8);width:0px;height:0px;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid white}.inputContainer .errorTooltip{display:none;word-wrap:break-word;position:absolute;top:-.6rem;right:-.625rem;background:white;transform:translateY(-100%);width:12rem;white-space:break-spaces;padding:.4rem .6rem;border-radius:.4rem;border:1px solid rgba(0,0,0,.13);box-shadow:#00000021 2px 3px 10px}.inputContainer .errorTooltip.noPointerEvents{pointer-events:none}.inputContainer .errorTooltip .closeBtn{display:none;position:absolute;top:.2rem;right:.2rem;padding:.2rem .4rem;cursor:pointer;color:#666;font-size:1rem}.inputContainer .errorTooltip .closeBtn:hover{color:#515365}.inputContainer:hover .errorTooltipContainer .errorTooltip,.inputContainer:hover .errorTooltipContainer .errorTooltipTriangle,.inputContainer:hover .errorTooltipContainer .errorTooltipTriangleWhite{display:block}.errorContainer{color:#ff8000}\n"] }]
|
|
578
656
|
}], ctorParameters: function () { return [{ type: FormComponent, decorators: [{
|
|
579
657
|
type: Optional
|
|
580
658
|
}] }, { type: undefined, decorators: [{
|
|
@@ -597,6 +675,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
597
675
|
}], internalComponentRef: [{
|
|
598
676
|
type: ViewChild,
|
|
599
677
|
args: ['internalComponentRef']
|
|
678
|
+
}], tailTpl: [{
|
|
679
|
+
type: ViewChild,
|
|
680
|
+
args: ['tailTpl']
|
|
681
|
+
}], captionDummyForSpaceCalculation: [{
|
|
682
|
+
type: ViewChild,
|
|
683
|
+
args: ['captionDummyForSpaceCalculation']
|
|
684
|
+
}], fieldInput: [{
|
|
685
|
+
type: ContentChild,
|
|
686
|
+
args: [NG_VALUE_ACCESSOR]
|
|
600
687
|
}] } });
|
|
601
688
|
|
|
602
689
|
/**
|
|
@@ -629,6 +716,12 @@ class ValueAccessorBase {
|
|
|
629
716
|
throw new Error('the focus() method is not implemented in this element!');
|
|
630
717
|
}
|
|
631
718
|
};
|
|
719
|
+
this.setTailTpl = (tpl) => {
|
|
720
|
+
this.tailTpl = tpl;
|
|
721
|
+
};
|
|
722
|
+
this.getTailTpl = () => {
|
|
723
|
+
return this.tailTpl;
|
|
724
|
+
};
|
|
632
725
|
}
|
|
633
726
|
ngOnInit() {
|
|
634
727
|
if (this.formControl) {
|
|
@@ -661,6 +754,7 @@ class ValueAccessorBase {
|
|
|
661
754
|
}
|
|
662
755
|
touch() {
|
|
663
756
|
this.touched.forEach((f) => f());
|
|
757
|
+
this.onTouch.emit();
|
|
664
758
|
}
|
|
665
759
|
writeValue(value) {
|
|
666
760
|
this.innerValue = value;
|
|
@@ -886,15 +980,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
886
980
|
type: Input
|
|
887
981
|
}] } });
|
|
888
982
|
|
|
889
|
-
function runNextRenderCycle(fn) {
|
|
890
|
-
setTimeout(fn);
|
|
891
|
-
}
|
|
892
|
-
function awaitableForNextCycle() {
|
|
893
|
-
return new Promise((resolve) => {
|
|
894
|
-
setTimeout(resolve);
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
|
|
898
983
|
const SELECT_TRANSLATIONS = new InjectionToken('klp.form.select.translations');
|
|
899
984
|
class KlpSelectOptionTemplateDirective {
|
|
900
985
|
}
|
|
@@ -1295,10 +1380,10 @@ class TextInputComponent extends ValueAccessorBase {
|
|
|
1295
1380
|
}
|
|
1296
1381
|
}
|
|
1297
1382
|
TextInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: TextInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1298
|
-
TextInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: TextInputComponent, selector: "klp-form-text-input", inputs: { placeholder: "placeholder", type: "type", clearable: "clearable", icon: "icon", hasBorderLeft: "hasBorderLeft", hasBorderRight: "hasBorderRight" }, outputs: { onBlur: "onBlur" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\">\n\t<ng-container *ngIf=\"icon?.length > 0\">\n\t\t<i class=\"ti-search\" *ngIf=\"icon === 'search'\"></i>\n\t</ng-container>\n\t<input\n\t\t[type]=\"type\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable, noBorderLeft: !hasBorderLeft, noBorderRight: !hasBorderRight}\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch(); onBlur.emit()\"\n\t\t[disabled]='disabled'\n\t\t#nativeInputRef\n\t/>\n\t<div class=\"clearIcon\" *ngIf=\"clearable && innerValue?.length > 0\" (click)=\"resetToNull()\">\u00D7</div>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{position:relative}i{position:absolute;left:.625rem;top:14px}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}input.hasIcon{padding-left:1.875rem}input.hasClearButton{padding-right:1.875rem}input.noBorderLeft{border-left:none}input.noBorderRight{border-right:none}.
|
|
1383
|
+
TextInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: TextInputComponent, selector: "klp-form-text-input", inputs: { placeholder: "placeholder", type: "type", clearable: "clearable", icon: "icon", hasBorderLeft: "hasBorderLeft", hasBorderRight: "hasBorderRight" }, outputs: { onBlur: "onBlur" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\">\n\t<ng-container *ngIf=\"icon?.length > 0\">\n\t\t<i class=\"ti-search\" *ngIf=\"icon === 'search'\"></i>\n\t</ng-container>\n\t<input\n\t\t[type]=\"type\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable, noBorderLeft: !hasBorderLeft, noBorderRight: !hasBorderRight}\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch(); onBlur.emit()\"\n\t\t[disabled]='disabled'\n\t\t#nativeInputRef\n\t/>\n\t<div class=\"tail\">\n\t\t<ng-container [ngTemplateOutlet]=\"getTailTpl()\"></ng-container>\n\t\t<div class=\"clearIcon\" *ngIf=\"clearable && innerValue?.length > 0\" (click)=\"resetToNull()\">\u00D7</div>\n\t</div>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{position:relative}i{position:absolute;left:.625rem;top:14px}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}input.hasIcon{padding-left:1.875rem}input.hasClearButton{padding-right:1.875rem}input.noBorderLeft{border-left:none}input.noBorderRight{border-right:none}.tail{position:absolute;right:.625rem;display:flex;align-items:center;top:0;bottom:0;gap:.625rem}.tail .clearIcon{transform:translateY(-2px);font-size:18px;cursor:pointer}.showErrors{border-color:#ff8000}\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: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
1299
1384
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: TextInputComponent, decorators: [{
|
|
1300
1385
|
type: Component,
|
|
1301
|
-
args: [{ selector: 'klp-form-text-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }], template: "<div class=\"componentContainer\">\n\t<ng-container *ngIf=\"icon?.length > 0\">\n\t\t<i class=\"ti-search\" *ngIf=\"icon === 'search'\"></i>\n\t</ng-container>\n\t<input\n\t\t[type]=\"type\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable, noBorderLeft: !hasBorderLeft, noBorderRight: !hasBorderRight}\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch(); onBlur.emit()\"\n\t\t[disabled]='disabled'\n\t\t#nativeInputRef\n\t/>\n\t<div class=\"clearIcon\" *ngIf=\"clearable && innerValue?.length > 0\" (click)=\"resetToNull()\">\u00D7</div>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{position:relative}i{position:absolute;left:.625rem;top:14px}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}input.hasIcon{padding-left:1.875rem}input.hasClearButton{padding-right:1.875rem}input.noBorderLeft{border-left:none}input.noBorderRight{border-right:none}.
|
|
1386
|
+
args: [{ selector: 'klp-form-text-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: TextInputComponent, multi: true }], template: "<div class=\"componentContainer\">\n\t<ng-container *ngIf=\"icon?.length > 0\">\n\t\t<i class=\"ti-search\" *ngIf=\"icon === 'search'\"></i>\n\t</ng-container>\n\t<input\n\t\t[type]=\"type\"\n\t\t[(ngModel)]=\"innerValue\"\n\t\t[ngClass]=\"{showErrors: isInErrorState(), hasIcon: icon?.length > 0, hasClearButton: clearable, noBorderLeft: !hasBorderLeft, noBorderRight: !hasBorderRight}\"\n\t\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t\t(blur)=\"touch(); onBlur.emit()\"\n\t\t[disabled]='disabled'\n\t\t#nativeInputRef\n\t/>\n\t<div class=\"tail\">\n\t\t<ng-container [ngTemplateOutlet]=\"getTailTpl()\"></ng-container>\n\t\t<div class=\"clearIcon\" *ngIf=\"clearable && innerValue?.length > 0\" (click)=\"resetToNull()\">\u00D7</div>\n\t</div>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{position:relative}i{position:absolute;left:.625rem;top:14px}input{outline:none;display:block;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;height:42px;width:100%;padding:.375rem .625rem;font-size:14px;color:#888da8;transition:all .2s ease-in;-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;-o-transition:all .2s ease-in;-ms-transition:all .2s ease-in}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder{color:#adadad}input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{outline:0 none;box-shadow:none;border-color:#3ed778}input.input-sm{height:30px}input.input-lg{height:50px}input.error{border-color:#dc3545;background-color:#f6cdd1}input.valid{border-color:#37c936;background-color:#ebfaeb;color:#278d26}input.hasIcon{padding-left:1.875rem}input.hasClearButton{padding-right:1.875rem}input.noBorderLeft{border-left:none}input.noBorderRight{border-right:none}.tail{position:absolute;right:.625rem;display:flex;align-items:center;top:0;bottom:0;gap:.625rem}.tail .clearIcon{transform:translateY(-2px);font-size:18px;cursor:pointer}.showErrors{border-color:#ff8000}\n"] }]
|
|
1302
1387
|
}], propDecorators: { placeholder: [{
|
|
1303
1388
|
type: Input
|
|
1304
1389
|
}], type: [{
|
|
@@ -2030,10 +2115,10 @@ class FileInputComponent extends MultipleValueAccessorBase {
|
|
|
2030
2115
|
}
|
|
2031
2116
|
}
|
|
2032
2117
|
FileInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FileInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
2033
|
-
FileInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FileInputComponent, selector: "klp-form-file-input", inputs: { isLoading: "isLoading", clearable: "clearable", onlyShowUploadButton: "onlyShowUploadButton", useFullParentSize: "useFullParentSize", buttonText: "buttonText" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }], viewQueries: [{ propertyName: "nativeInputRef", first: true, predicate: ["nativeInputRef"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#nativeInputRef\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" (click)=\"uploadFileClicked()\">\n\t\t\t{{buttonText}}\n\t\t</klp-form-button>\n\t</div>\n\t<div class=\"fileName\" *ngIf=\"!onlyShowUploadButton\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{display:flex;align-items:center}.componentContainer.fullParentSize{height:100%;justify-content:center;position:relative}.componentContainer:not(.fullParentSize) .buttonContainer{position:relative}.componentContainer .buttonContainer{flex:0 0 auto}input{position:absolute;cursor:pointer;opacity:0;inset:0}.fileName{flex:1 1 0px;margin-left:.625rem;color:#515365;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clearButton{flex:0 0 auto}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "klp-form-button", inputs: ["variant", "size", "fullWidth", "hasBorder", "disabled", "isLoading", "type", "clickCallback"] }] });
|
|
2118
|
+
FileInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.8", type: FileInputComponent, selector: "klp-form-file-input", inputs: { isLoading: "isLoading", clearable: "clearable", onlyShowUploadButton: "onlyShowUploadButton", useFullParentSize: "useFullParentSize", buttonText: "buttonText" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }], viewQueries: [{ propertyName: "nativeInputRef", first: true, predicate: ["nativeInputRef"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#nativeInputRef\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" [disabled]=\"disabled\" (click)=\"uploadFileClicked()\">\n\t\t\t{{buttonText}}\n\t\t</klp-form-button>\n\t</div>\n\t<div class=\"fileName\" *ngIf=\"!onlyShowUploadButton\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{display:flex;align-items:center}.componentContainer.fullParentSize{height:100%;justify-content:center;position:relative}.componentContainer:not(.fullParentSize) .buttonContainer{position:relative}.componentContainer .buttonContainer{flex:0 0 auto}input{position:absolute;cursor:pointer;opacity:0;inset:0}.fileName{flex:1 1 0px;margin-left:.625rem;color:#515365;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clearButton{flex:0 0 auto}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ButtonComponent, selector: "klp-form-button", inputs: ["variant", "size", "fullWidth", "hasBorder", "disabled", "isLoading", "type", "clickCallback"] }] });
|
|
2034
2119
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: FileInputComponent, decorators: [{
|
|
2035
2120
|
type: Component,
|
|
2036
|
-
args: [{ selector: 'klp-form-file-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }], template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#nativeInputRef\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" (click)=\"uploadFileClicked()\">\n\t\t\t{{buttonText}}\n\t\t</klp-form-button>\n\t</div>\n\t<div class=\"fileName\" *ngIf=\"!onlyShowUploadButton\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{display:flex;align-items:center}.componentContainer.fullParentSize{height:100%;justify-content:center;position:relative}.componentContainer:not(.fullParentSize) .buttonContainer{position:relative}.componentContainer .buttonContainer{flex:0 0 auto}input{position:absolute;cursor:pointer;opacity:0;inset:0}.fileName{flex:1 1 0px;margin-left:.625rem;color:#515365;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clearButton{flex:0 0 auto}\n"] }]
|
|
2121
|
+
args: [{ selector: 'klp-form-file-input', providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }], template: "<div class=\"componentContainer\" [ngClass]=\"{fullParentSize: useFullParentSize}\">\n\t<div class=\"buttonContainer\">\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t#nativeInputRef\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\" [disabled]=\"disabled\" (click)=\"uploadFileClicked()\">\n\t\t\t{{buttonText}}\n\t\t</klp-form-button>\n\t</div>\n\t<div class=\"fileName\" *ngIf=\"!onlyShowUploadButton\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n", styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{display:flex;align-items:center}.componentContainer.fullParentSize{height:100%;justify-content:center;position:relative}.componentContainer:not(.fullParentSize) .buttonContainer{position:relative}.componentContainer .buttonContainer{flex:0 0 auto}input{position:absolute;cursor:pointer;opacity:0;inset:0}.fileName{flex:1 1 0px;margin-left:.625rem;color:#515365;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clearButton{flex:0 0 auto}\n"] }]
|
|
2037
2122
|
}], propDecorators: { isLoading: [{
|
|
2038
2123
|
type: Input
|
|
2039
2124
|
}], clearable: [{
|
|
@@ -2206,6 +2291,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
2206
2291
|
type: Input
|
|
2207
2292
|
}] } });
|
|
2208
2293
|
|
|
2294
|
+
const triangleSize = '12px';
|
|
2295
|
+
class WithTooltipDirective {
|
|
2296
|
+
constructor(el) {
|
|
2297
|
+
this.klpWithTooltip = true;
|
|
2298
|
+
el.nativeElement.addEventListener('mouseenter', () => {
|
|
2299
|
+
if (!this.klpWithTooltip) {
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2302
|
+
if (getComputedStyle(el.nativeElement).position === 'static') {
|
|
2303
|
+
el.nativeElement.style.position = 'relative';
|
|
2304
|
+
}
|
|
2305
|
+
this.div = document.createElement('div');
|
|
2306
|
+
this.div.style.zIndex = '2';
|
|
2307
|
+
this.div.style.color = '#ff8000';
|
|
2308
|
+
this.div.style.position = 'fixed';
|
|
2309
|
+
this.div.style.left = `${el.nativeElement.getBoundingClientRect().x}px`;
|
|
2310
|
+
this.div.style.top = `${el.nativeElement.getBoundingClientRect().y}px`;
|
|
2311
|
+
this.div.style.transform = `translate(calc(-100% + ${el.nativeElement.getBoundingClientRect().width}px), calc(-100% - 0.3rem))`;
|
|
2312
|
+
this.div.style.maxWidth = '200px';
|
|
2313
|
+
this.div.style.whiteSpace = 'break-spaces';
|
|
2314
|
+
this.div.style.backgroundColor = 'white';
|
|
2315
|
+
this.div.style.border = '1px solid rgba(255, 128, 0, 0.1254901961)';
|
|
2316
|
+
this.div.style.boxShadow = `2px 3px 10px 0px rgba(255, 128, 0, 0.1254901961)`;
|
|
2317
|
+
this.div.style.padding = '0.3rem 0.5rem';
|
|
2318
|
+
this.div.style.boxSizing = 'border-box';
|
|
2319
|
+
this.div.style.borderRadius = '3px';
|
|
2320
|
+
this.div.textContent = el.nativeElement.innerText;
|
|
2321
|
+
el.nativeElement.prepend(this.div);
|
|
2322
|
+
this.triangle = document.createElement('div');
|
|
2323
|
+
this.triangle.style.zIndex = '1';
|
|
2324
|
+
this.triangle.style.position = 'fixed';
|
|
2325
|
+
this.triangle.style.left = `calc(${el.nativeElement.getBoundingClientRect().x + el.nativeElement.getBoundingClientRect().width}px - 2rem)`;
|
|
2326
|
+
this.triangle.style.top = `${el.nativeElement.getBoundingClientRect().y}px`;
|
|
2327
|
+
this.triangle.style.transform = `translate(-50%, calc(-100% + 0.1rem))`;
|
|
2328
|
+
this.triangle.style.width = '0';
|
|
2329
|
+
this.triangle.style.height = '0';
|
|
2330
|
+
this.triangle.style.borderLeft = `${triangleSize} solid transparent`;
|
|
2331
|
+
this.triangle.style.borderRight = `${triangleSize} solid transparent`;
|
|
2332
|
+
this.triangle.style.borderTop = `${triangleSize} solid rgba(255, 128, 0, 0.1254901961)`;
|
|
2333
|
+
el.nativeElement.prepend(this.triangle);
|
|
2334
|
+
this.triangleWhite = document.createElement('div');
|
|
2335
|
+
this.triangleWhite.style.zIndex = '3';
|
|
2336
|
+
this.triangleWhite.style.position = 'fixed';
|
|
2337
|
+
this.triangleWhite.style.left = `calc(${el.nativeElement.getBoundingClientRect().x + el.nativeElement.getBoundingClientRect().width}px - 2rem)`;
|
|
2338
|
+
this.triangleWhite.style.top = `${el.nativeElement.getBoundingClientRect().y}px`;
|
|
2339
|
+
this.triangleWhite.style.transform = `translate(-50%, calc(-100% + 0.1rem - 2px))`;
|
|
2340
|
+
this.triangleWhite.style.width = '0';
|
|
2341
|
+
this.triangleWhite.style.height = '0';
|
|
2342
|
+
this.triangleWhite.style.borderLeft = `${triangleSize} solid transparent`;
|
|
2343
|
+
this.triangleWhite.style.borderRight = `${triangleSize} solid transparent`;
|
|
2344
|
+
this.triangleWhite.style.borderTop = `${triangleSize} solid white`;
|
|
2345
|
+
el.nativeElement.prepend(this.triangleWhite);
|
|
2346
|
+
});
|
|
2347
|
+
el.nativeElement.addEventListener('mouseout', () => {
|
|
2348
|
+
try {
|
|
2349
|
+
el.nativeElement.removeChild(this.div);
|
|
2350
|
+
}
|
|
2351
|
+
catch (ex) { }
|
|
2352
|
+
try {
|
|
2353
|
+
el.nativeElement.removeChild(this.triangle);
|
|
2354
|
+
}
|
|
2355
|
+
catch (ex) { }
|
|
2356
|
+
try {
|
|
2357
|
+
el.nativeElement.removeChild(this.triangleWhite);
|
|
2358
|
+
}
|
|
2359
|
+
catch (ex) { }
|
|
2360
|
+
});
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
WithTooltipDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WithTooltipDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
2364
|
+
WithTooltipDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.8", type: WithTooltipDirective, selector: "[klpWithTooltip]", inputs: { klpWithTooltip: "klpWithTooltip" }, ngImport: i0 });
|
|
2365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: WithTooltipDirective, decorators: [{
|
|
2366
|
+
type: Directive,
|
|
2367
|
+
args: [{
|
|
2368
|
+
selector: '[klpWithTooltip]'
|
|
2369
|
+
}]
|
|
2370
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { klpWithTooltip: [{
|
|
2371
|
+
type: Input
|
|
2372
|
+
}] } });
|
|
2373
|
+
|
|
2209
2374
|
class NgxEnhancyFormsModule {
|
|
2210
2375
|
}
|
|
2211
2376
|
NgxEnhancyFormsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -2235,7 +2400,9 @@ NgxEnhancyFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
2235
2400
|
SubFormDirective,
|
|
2236
2401
|
HourMinuteInputComponent,
|
|
2237
2402
|
RadioComponent,
|
|
2238
|
-
WithTooltipDirective
|
|
2403
|
+
WithTooltipDirective,
|
|
2404
|
+
WarningIconComponent,
|
|
2405
|
+
ElementIsTruncatedCbComponent], imports: [CommonModule,
|
|
2239
2406
|
FormsModule,
|
|
2240
2407
|
NgSelectModule,
|
|
2241
2408
|
SortablejsModule,
|
|
@@ -2265,7 +2432,8 @@ NgxEnhancyFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", v
|
|
|
2265
2432
|
SubFormDirective,
|
|
2266
2433
|
HourMinuteInputComponent,
|
|
2267
2434
|
RadioComponent,
|
|
2268
|
-
WithTooltipDirective
|
|
2435
|
+
WithTooltipDirective,
|
|
2436
|
+
ElementIsTruncatedCbComponent] });
|
|
2269
2437
|
NgxEnhancyFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.8", ngImport: i0, type: NgxEnhancyFormsModule, imports: [CommonModule,
|
|
2270
2438
|
FormsModule,
|
|
2271
2439
|
NgSelectModule,
|
|
@@ -2309,6 +2477,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
2309
2477
|
HourMinuteInputComponent,
|
|
2310
2478
|
RadioComponent,
|
|
2311
2479
|
WithTooltipDirective,
|
|
2480
|
+
WarningIconComponent,
|
|
2481
|
+
ElementIsTruncatedCbComponent,
|
|
2312
2482
|
],
|
|
2313
2483
|
exports: [
|
|
2314
2484
|
ValueAccessorBase,
|
|
@@ -2338,6 +2508,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
2338
2508
|
HourMinuteInputComponent,
|
|
2339
2509
|
RadioComponent,
|
|
2340
2510
|
WithTooltipDirective,
|
|
2511
|
+
ElementIsTruncatedCbComponent,
|
|
2341
2512
|
]
|
|
2342
2513
|
}]
|
|
2343
2514
|
}] });
|
|
@@ -2350,5 +2521,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.8", ngImpor
|
|
|
2350
2521
|
* Generated bundle index. Do not edit.
|
|
2351
2522
|
*/
|
|
2352
2523
|
|
|
2353
|
-
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 };
|
|
2524
|
+
export { ButtonComponent, CheckboxComponent, DATE_PICKER_LOCALE, DATE_PICKER_TRANSLATIONS, DATE_TIME_PICKER_TRANSLATIONS, DEFAULT_ERROR_MESSAGES, DatePickerComponent, DateTimePickerComponent, DefaultErrorHandler, ElementIsTruncatedCbComponent, 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 };
|
|
2354
2525
|
//# sourceMappingURL=klippa-ngx-enhancy-forms.mjs.map
|