ecabs-components 0.0.1
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/README.md +24 -0
- package/esm2020/ecabs-components.mjs +5 -0
- package/esm2020/lib/base/directives/digits-only.directive.mjs +130 -0
- package/esm2020/lib/base/element-base.mjs +100 -0
- package/esm2020/lib/base/element-wrapper/element-wrapper.component.mjs +53 -0
- package/esm2020/lib/base/element-wrapper/element-wrapper.module.mjs +52 -0
- package/esm2020/lib/base/hint/hint.component.mjs +21 -0
- package/esm2020/lib/base/hint/hint.module.mjs +20 -0
- package/esm2020/lib/base/validation/validation.component.mjs +158 -0
- package/esm2020/lib/base/validation/validation.module.mjs +20 -0
- package/esm2020/lib/ecabs-buttons/ecabs-buttons.component.mjs +65 -0
- package/esm2020/lib/ecabs-buttons/ecabs-buttons.module.mjs +21 -0
- package/esm2020/lib/ecabs-input/ecabs-input.component.mjs +81 -0
- package/esm2020/lib/ecabs-input/ecabs-input.module.mjs +22 -0
- package/esm2020/lib/ecabs-loading/ecabs-loading.component.mjs +24 -0
- package/esm2020/lib/ecabs-loading/ecabs-loading.module.mjs +19 -0
- package/esm2020/lib/ecabs-loading/spinner/spinner.component.mjs +16 -0
- package/esm2020/public-api.mjs +8 -0
- package/fesm2015/ecabs-components.mjs +744 -0
- package/fesm2015/ecabs-components.mjs.map +1 -0
- package/fesm2020/ecabs-components.mjs +742 -0
- package/fesm2020/ecabs-components.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/base/directives/digits-only.directive.d.ts +26 -0
- package/lib/base/directives/digits-only.directive.ts +129 -0
- package/lib/base/element-base.d.ts +28 -0
- package/lib/base/element-base.ts +72 -0
- package/lib/base/element-wrapper/element-wrapper.component.d.ts +19 -0
- package/lib/base/element-wrapper/element-wrapper.component.html +30 -0
- package/lib/base/element-wrapper/element-wrapper.component.ts +33 -0
- package/lib/base/element-wrapper/element-wrapper.module.d.ts +16 -0
- package/lib/base/element-wrapper/element-wrapper.module.ts +30 -0
- package/lib/base/hint/hint.component.d.ts +8 -0
- package/lib/base/hint/hint.component.html +1 -0
- package/lib/base/hint/hint.component.scss +0 -0
- package/lib/base/hint/hint.component.ts +12 -0
- package/lib/base/hint/hint.module.d.ts +10 -0
- package/lib/base/hint/hint.module.ts +13 -0
- package/lib/base/validation/validation.component.d.ts +22 -0
- package/lib/base/validation/validation.component.html +8 -0
- package/lib/base/validation/validation.component.scss +0 -0
- package/lib/base/validation/validation.component.ts +171 -0
- package/lib/base/validation/validation.module.d.ts +10 -0
- package/lib/base/validation/validation.module.ts +12 -0
- package/lib/ecabs-buttons/ecabs-buttons.component.d.ts +21 -0
- package/lib/ecabs-buttons/ecabs-buttons.component.html +18 -0
- package/lib/ecabs-buttons/ecabs-buttons.component.ts +54 -0
- package/lib/ecabs-buttons/ecabs-buttons.module.d.ts +11 -0
- package/lib/ecabs-buttons/ecabs-buttons.module.ts +13 -0
- package/lib/ecabs-input/ecabs-input.component.d.ts +27 -0
- package/lib/ecabs-input/ecabs-input.component.html +26 -0
- package/lib/ecabs-input/ecabs-input.component.ts +83 -0
- package/lib/ecabs-input/ecabs-input.module.d.ts +12 -0
- package/lib/ecabs-input/ecabs-input.module.ts +14 -0
- package/lib/ecabs-loading/ecabs-loading.component.d.ts +8 -0
- package/lib/ecabs-loading/ecabs-loading.component.html +7 -0
- package/lib/ecabs-loading/ecabs-loading.component.spec.ts +24 -0
- package/lib/ecabs-loading/ecabs-loading.component.ts +11 -0
- package/lib/ecabs-loading/ecabs-loading.module.d.ts +9 -0
- package/lib/ecabs-loading/ecabs-loading.module.ts +11 -0
- package/lib/ecabs-loading/spinner/spinner.component.d.ts +6 -0
- package/lib/ecabs-loading/spinner/spinner.component.html +5 -0
- package/lib/ecabs-loading/spinner/spinner.component.scss +61 -0
- package/lib/ecabs-loading/spinner/spinner.component.spec.ts +24 -0
- package/lib/ecabs-loading/spinner/spinner.component.ts +11 -0
- package/package.json +33 -0
- package/public-api.d.ts +7 -0
- package/public-api.ts +7 -0
- package/styles/material/_theme.scss +99 -0
- package/styles/material/overrides/_autocomplete.scss +11 -0
- package/styles/material/overrides/_button.scss +81 -0
- package/styles/material/overrides/_card.scss +17 -0
- package/styles/material/overrides/_chip.scss +108 -0
- package/styles/material/overrides/_datepicker.scss +145 -0
- package/styles/material/overrides/_dialog.scss +8 -0
- package/styles/material/overrides/_divider.scss +3 -0
- package/styles/material/overrides/_expansion.scss +31 -0
- package/styles/material/overrides/_form.scss +47 -0
- package/styles/material/overrides/_icon.scss +3 -0
- package/styles/material/overrides/_menu.scss +3 -0
- package/styles/material/overrides/_paginator.scss +0 -0
- package/styles/material/overrides/_phone.scss +24 -0
- package/styles/material/overrides/_select.scss +36 -0
- package/styles/material/overrides/_tab.scss +23 -0
- package/styles/material/overrides/_table.scss +12 -0
- package/styles/material/overrides/_toaster.scss +38 -0
- package/styles/material/overrides/_toggle.scss +10 -0
- package/styles/material/overrides/_tooltip.scss +3 -0
- package/styles/material/overrides/index.scss +19 -0
- package/styles/scss/base/_heading.scss +17 -0
- package/styles/scss/base/_normalize.scss +78 -0
- package/styles/scss/base/index.scss +2 -0
- package/styles/scss/modules/_autocomplete.scss +29 -0
- package/styles/scss/modules/_button.scss +221 -0
- package/styles/scss/modules/_card.scss +23 -0
- package/styles/scss/modules/_chip.scss +56 -0
- package/styles/scss/modules/_datepicker.scss +422 -0
- package/styles/scss/modules/_dialog.scss +14 -0
- package/styles/scss/modules/_divider.scss +3 -0
- package/styles/scss/modules/_form.scss +221 -0
- package/styles/scss/modules/_icon.scss +30 -0
- package/styles/scss/modules/_img.scss +32 -0
- package/styles/scss/modules/_legend.scss +64 -0
- package/styles/scss/modules/_list.scss +17 -0
- package/styles/scss/modules/_map.scss +112 -0
- package/styles/scss/modules/_percentage.scss +33 -0
- package/styles/scss/modules/_phone.scss +21 -0
- package/styles/scss/modules/_select.scss +21 -0
- package/styles/scss/modules/_statuses.scss +31 -0
- package/styles/scss/modules/_tab.scss +16 -0
- package/styles/scss/modules/_table.scss +107 -0
- package/styles/scss/modules/_timepicker.scss +96 -0
- package/styles/scss/modules/_toaster.scss +53 -0
- package/styles/scss/modules/_tooltip.scss +7 -0
- package/styles/scss/modules/drag-drop.scss +31 -0
- package/styles/scss/modules/index.scss +23 -0
- package/styles/scss/utilities/_colors.scss +52 -0
- package/styles/scss/utilities/_fonts.scss +26 -0
- package/styles/scss/utilities/_functions.scss +27 -0
- package/styles/scss/utilities/_helpers.scss +5 -0
- package/styles/scss/utilities/_mixins.scss +65 -0
- package/styles/scss/utilities/_variables.scss +19 -0
- package/styles/scss/utilities/index.scss +6 -0
- package/styles/styles.scss +5 -0
- package/test.ts +27 -0
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, ChangeDetectionStrategy, Input, HostBinding, NgModule, EventEmitter, Output, Directive, HostListener } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import * as i2 from '@angular/material/button';
|
|
6
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
7
|
+
import * as i4 from '@angular/material/icon';
|
|
8
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
9
|
+
import * as i3 from '@angular/forms';
|
|
10
|
+
import { NgControl, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
11
|
+
import * as i5 from '@angular/material/tooltip';
|
|
12
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
13
|
+
import { MatInputModule } from '@angular/material/input';
|
|
14
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
15
|
+
|
|
16
|
+
class EcabsSpinnerComponent {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.size = 'medium';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
EcabsSpinnerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsSpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
22
|
+
EcabsSpinnerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: EcabsSpinnerComponent, selector: "ecabs-loading-spinner", inputs: { size: "size" }, ngImport: i0, template: "<div class=\"loadingio-spinner-rolling {{ size }}\">\r\n <div class=\"ldio-inner\">\r\n <div></div>\r\n </div>\r\n</div>\r\n", styles: [":host{line-height:0}@keyframes ldio-inner{0%{transform:translate(-50%,-50%) rotate(0)}to{transform:translate(-50%,-50%) rotate(360deg)}}.loadingio-spinner-rolling{width:27px;height:27px;display:inline-block;overflow:hidden;background:none}.loadingio-spinner-rolling .ldio-inner{width:100%;height:100%;position:relative;transform:translateZ(0) scale(1);-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-origin:0 0}.loadingio-spinner-rolling .ldio-inner div{position:absolute;width:9px;height:9px;border:4px solid #85a2b6;border-top-color:transparent;border-radius:50%;animation:ldio-inner 1s linear infinite;top:14px;left:14px;box-sizing:content-box}.loadingio-spinner-rolling.medium{width:40px;height:40px}.loadingio-spinner-rolling.medium .ldio-inner div{width:20px;height:20px;border-width:6px;top:19px;left:19px}.loadingio-spinner-rolling.large{width:60px;height:60px}.loadingio-spinner-rolling.large .ldio-inner div{width:35px;height:35px;border-width:9px;top:29px;left:29px}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsSpinnerComponent, decorators: [{
|
|
24
|
+
type: Component,
|
|
25
|
+
args: [{ selector: 'ecabs-loading-spinner', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"loadingio-spinner-rolling {{ size }}\">\r\n <div class=\"ldio-inner\">\r\n <div></div>\r\n </div>\r\n</div>\r\n", styles: [":host{line-height:0}@keyframes ldio-inner{0%{transform:translate(-50%,-50%) rotate(0)}to{transform:translate(-50%,-50%) rotate(360deg)}}.loadingio-spinner-rolling{width:27px;height:27px;display:inline-block;overflow:hidden;background:none}.loadingio-spinner-rolling .ldio-inner{width:100%;height:100%;position:relative;transform:translateZ(0) scale(1);-webkit-backface-visibility:hidden;backface-visibility:hidden;transform-origin:0 0}.loadingio-spinner-rolling .ldio-inner div{position:absolute;width:9px;height:9px;border:4px solid #85a2b6;border-top-color:transparent;border-radius:50%;animation:ldio-inner 1s linear infinite;top:14px;left:14px;box-sizing:content-box}.loadingio-spinner-rolling.medium{width:40px;height:40px}.loadingio-spinner-rolling.medium .ldio-inner div{width:20px;height:20px;border-width:6px;top:19px;left:19px}.loadingio-spinner-rolling.large{width:60px;height:60px}.loadingio-spinner-rolling.large .ldio-inner div{width:35px;height:35px;border-width:9px;top:29px;left:29px}\n"] }]
|
|
26
|
+
}], propDecorators: { size: [{
|
|
27
|
+
type: Input
|
|
28
|
+
}] } });
|
|
29
|
+
|
|
30
|
+
class ButtonsComponent {
|
|
31
|
+
constructor() {
|
|
32
|
+
this.size = 'default';
|
|
33
|
+
this.type = 'button';
|
|
34
|
+
this.raised = false;
|
|
35
|
+
this.stroked = false;
|
|
36
|
+
this.full = false;
|
|
37
|
+
this.color = 'primary';
|
|
38
|
+
this.borderWidth = '';
|
|
39
|
+
this.classAttr = '';
|
|
40
|
+
}
|
|
41
|
+
ngOnInit() {
|
|
42
|
+
if (this.full) {
|
|
43
|
+
this.borderWidth = '100%';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
ngOnChanges(changes) {
|
|
47
|
+
const disabled = changes['disabled']?.currentValue !== undefined ? changes['disabled'].currentValue : this.disabled;
|
|
48
|
+
const loading = changes['loading']?.currentValue !== undefined ? changes['loading'].currentValue : this.loading;
|
|
49
|
+
if (disabled || loading) {
|
|
50
|
+
this.classAttr = 'pointer-events-none';
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.classAttr = '';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
ButtonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ButtonsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
58
|
+
ButtonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ButtonsComponent, selector: "ecabs-buttons", inputs: { label: "label", disabled: "disabled", loading: "loading", form: "form", size: "size", type: "type", raised: "raised", stroked: "stroked", full: "full", color: "color" }, host: { properties: { "style.width": "this.borderWidth", "class": "this.classAttr" } }, usesOnChanges: true, ngImport: i0, template: "<button\r\n mat-button\r\n [ngClass]=\"{\r\n '!w-full': full,\r\n 'mat-stroked-button': stroked,\r\n 'mat-raised-button': raised\r\n }\"\r\n [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n [type]=\"type\"\r\n [attr.form]=\"form\"\r\n>\r\n <ecabs-loading-spinner size=\"tiny\" *ngIf=\"loading\"></ecabs-loading-spinner>\r\n <ng-container *ngIf=\"!loading\">\r\n <ng-content select=\"mat-icon\"></ng-content>\r\n <ng-content></ng-content>\r\n </ng-container>\r\n</button>\r\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: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: EcabsSpinnerComponent, selector: "ecabs-loading-spinner", inputs: ["size"] }] });
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ButtonsComponent, decorators: [{
|
|
60
|
+
type: Component,
|
|
61
|
+
args: [{ selector: 'ecabs-buttons', template: "<button\r\n mat-button\r\n [ngClass]=\"{\r\n '!w-full': full,\r\n 'mat-stroked-button': stroked,\r\n 'mat-raised-button': raised\r\n }\"\r\n [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n [type]=\"type\"\r\n [attr.form]=\"form\"\r\n>\r\n <ecabs-loading-spinner size=\"tiny\" *ngIf=\"loading\"></ecabs-loading-spinner>\r\n <ng-container *ngIf=\"!loading\">\r\n <ng-content select=\"mat-icon\"></ng-content>\r\n <ng-content></ng-content>\r\n </ng-container>\r\n</button>\r\n" }]
|
|
62
|
+
}], propDecorators: { label: [{
|
|
63
|
+
type: Input
|
|
64
|
+
}], disabled: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], loading: [{
|
|
67
|
+
type: Input
|
|
68
|
+
}], form: [{
|
|
69
|
+
type: Input
|
|
70
|
+
}], size: [{
|
|
71
|
+
type: Input
|
|
72
|
+
}], type: [{
|
|
73
|
+
type: Input
|
|
74
|
+
}], raised: [{
|
|
75
|
+
type: Input
|
|
76
|
+
}], stroked: [{
|
|
77
|
+
type: Input
|
|
78
|
+
}], full: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}], color: [{
|
|
81
|
+
type: Input
|
|
82
|
+
}], borderWidth: [{
|
|
83
|
+
type: HostBinding,
|
|
84
|
+
args: ['style.width']
|
|
85
|
+
}], classAttr: [{
|
|
86
|
+
type: HostBinding,
|
|
87
|
+
args: ['class']
|
|
88
|
+
}] } });
|
|
89
|
+
|
|
90
|
+
class EcabsLoadingComponent {
|
|
91
|
+
constructor() {
|
|
92
|
+
this.loading = false;
|
|
93
|
+
this.backgroundColor = 'white';
|
|
94
|
+
this.size = 'medium';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
EcabsLoadingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsLoadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
98
|
+
EcabsLoadingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: EcabsLoadingComponent, selector: "ecabs-ecabs-loading", inputs: { loading: "loading", backgroundColor: "backgroundColor", size: "size" }, ngImport: i0, template: "<div\r\n class=\"flex absolute left-0 top-0 right-0 bottom-0 z-50 items-center justify-center\"\r\n [ngStyle]=\"{ backgroundColor: backgroundColor }\"\r\n *ngIf=\"loading\"\r\n>\r\n <ecabs-loading-spinner [size]=\"size\" *ngIf=\"loading\"></ecabs-loading-spinner>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: EcabsSpinnerComponent, selector: "ecabs-loading-spinner", inputs: ["size"] }] });
|
|
99
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsLoadingComponent, decorators: [{
|
|
100
|
+
type: Component,
|
|
101
|
+
args: [{ selector: 'ecabs-ecabs-loading', template: "<div\r\n class=\"flex absolute left-0 top-0 right-0 bottom-0 z-50 items-center justify-center\"\r\n [ngStyle]=\"{ backgroundColor: backgroundColor }\"\r\n *ngIf=\"loading\"\r\n>\r\n <ecabs-loading-spinner [size]=\"size\" *ngIf=\"loading\"></ecabs-loading-spinner>\r\n</div>\r\n" }]
|
|
102
|
+
}], propDecorators: { loading: [{
|
|
103
|
+
type: Input
|
|
104
|
+
}], backgroundColor: [{
|
|
105
|
+
type: Input
|
|
106
|
+
}], size: [{
|
|
107
|
+
type: Input
|
|
108
|
+
}] } });
|
|
109
|
+
|
|
110
|
+
class EcabsLoadingModule {
|
|
111
|
+
}
|
|
112
|
+
EcabsLoadingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsLoadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
113
|
+
EcabsLoadingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: EcabsLoadingModule, declarations: [EcabsLoadingComponent, EcabsSpinnerComponent], imports: [CommonModule], exports: [EcabsLoadingComponent, EcabsSpinnerComponent] });
|
|
114
|
+
EcabsLoadingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsLoadingModule, imports: [CommonModule] });
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsLoadingModule, decorators: [{
|
|
116
|
+
type: NgModule,
|
|
117
|
+
args: [{
|
|
118
|
+
declarations: [EcabsLoadingComponent, EcabsSpinnerComponent],
|
|
119
|
+
imports: [CommonModule],
|
|
120
|
+
exports: [EcabsLoadingComponent, EcabsSpinnerComponent],
|
|
121
|
+
}]
|
|
122
|
+
}] });
|
|
123
|
+
|
|
124
|
+
class EcabsButtonsModule {
|
|
125
|
+
}
|
|
126
|
+
EcabsButtonsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsButtonsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
127
|
+
EcabsButtonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: EcabsButtonsModule, declarations: [ButtonsComponent], imports: [CommonModule, MatButtonModule, EcabsLoadingModule, MatIconModule], exports: [ButtonsComponent] });
|
|
128
|
+
EcabsButtonsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsButtonsModule, imports: [CommonModule, MatButtonModule, EcabsLoadingModule, MatIconModule] });
|
|
129
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsButtonsModule, decorators: [{
|
|
130
|
+
type: NgModule,
|
|
131
|
+
args: [{
|
|
132
|
+
declarations: [ButtonsComponent],
|
|
133
|
+
imports: [CommonModule, MatButtonModule, EcabsLoadingModule, MatIconModule],
|
|
134
|
+
exports: [ButtonsComponent],
|
|
135
|
+
}]
|
|
136
|
+
}] });
|
|
137
|
+
|
|
138
|
+
class ElementBaseComponent {
|
|
139
|
+
constructor() {
|
|
140
|
+
this.placeholder = '';
|
|
141
|
+
this.disabled = false;
|
|
142
|
+
this.showValidation = true;
|
|
143
|
+
this.showValidationOnNotTouched = false;
|
|
144
|
+
this.hideValidationMessage = false;
|
|
145
|
+
this.iconClass = '';
|
|
146
|
+
this.loading = false;
|
|
147
|
+
this.showHint = false;
|
|
148
|
+
this.showAsterisk = true;
|
|
149
|
+
this.focused = new EventEmitter();
|
|
150
|
+
this.focusOuted = new EventEmitter();
|
|
151
|
+
this.required = false;
|
|
152
|
+
this.isRequired = (ctrl) => {
|
|
153
|
+
if (ctrl?.validator) {
|
|
154
|
+
const validator = ctrl.validator({});
|
|
155
|
+
if (validator && validator['required']) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
if (ctrl?.['controls']) {
|
|
160
|
+
for (const name in ctrl['controls']) {
|
|
161
|
+
if (ctrl['controls'][name]) {
|
|
162
|
+
if (this.isRequired(ctrl['controls'][name])) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
getData() {
|
|
172
|
+
return {
|
|
173
|
+
type: this.type || 'text',
|
|
174
|
+
label: this.label,
|
|
175
|
+
placeholder: this.placeholder,
|
|
176
|
+
validationLabel: this.validationLabel,
|
|
177
|
+
disabled: this.disabled,
|
|
178
|
+
showValidation: this.showValidation,
|
|
179
|
+
showValidationOnNotTouched: this.showValidationOnNotTouched,
|
|
180
|
+
hideValidationMessage: this.hideValidationMessage,
|
|
181
|
+
iconClass: this.iconClass,
|
|
182
|
+
control: this.control,
|
|
183
|
+
loading: this.loading,
|
|
184
|
+
showHint: this.showHint,
|
|
185
|
+
maxLength: this.maxLength,
|
|
186
|
+
tooltip: this.tooltip,
|
|
187
|
+
name: this.name,
|
|
188
|
+
required: this.isRequired(this.control),
|
|
189
|
+
showAsterisk: this.showAsterisk,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
ElementBaseComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ElementBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
194
|
+
ElementBaseComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ElementBaseComponent, selector: "ng-component", inputs: { type: "type", name: "name", label: "label", placeholder: "placeholder", validationLabel: "validationLabel", disabled: "disabled", showValidation: "showValidation", showValidationOnNotTouched: "showValidationOnNotTouched", hideValidationMessage: "hideValidationMessage", iconClass: "iconClass", loading: "loading", showHint: "showHint", maxLength: "maxLength", tooltip: "tooltip", showAsterisk: "showAsterisk" }, outputs: { focused: "focused", focusOuted: "focusOuted" }, ngImport: i0, template: '', isInline: true });
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ElementBaseComponent, decorators: [{
|
|
196
|
+
type: Component,
|
|
197
|
+
args: [{
|
|
198
|
+
template: '',
|
|
199
|
+
}]
|
|
200
|
+
}], propDecorators: { type: [{
|
|
201
|
+
type: Input
|
|
202
|
+
}], name: [{
|
|
203
|
+
type: Input
|
|
204
|
+
}], label: [{
|
|
205
|
+
type: Input
|
|
206
|
+
}], placeholder: [{
|
|
207
|
+
type: Input
|
|
208
|
+
}], validationLabel: [{
|
|
209
|
+
type: Input
|
|
210
|
+
}], disabled: [{
|
|
211
|
+
type: Input
|
|
212
|
+
}], showValidation: [{
|
|
213
|
+
type: Input
|
|
214
|
+
}], showValidationOnNotTouched: [{
|
|
215
|
+
type: Input
|
|
216
|
+
}], hideValidationMessage: [{
|
|
217
|
+
type: Input
|
|
218
|
+
}], iconClass: [{
|
|
219
|
+
type: Input
|
|
220
|
+
}], loading: [{
|
|
221
|
+
type: Input
|
|
222
|
+
}], showHint: [{
|
|
223
|
+
type: Input
|
|
224
|
+
}], maxLength: [{
|
|
225
|
+
type: Input
|
|
226
|
+
}], tooltip: [{
|
|
227
|
+
type: Input
|
|
228
|
+
}], showAsterisk: [{
|
|
229
|
+
type: Input
|
|
230
|
+
}], focused: [{
|
|
231
|
+
type: Output
|
|
232
|
+
}], focusOuted: [{
|
|
233
|
+
type: Output
|
|
234
|
+
}] } });
|
|
235
|
+
|
|
236
|
+
class ValidationComponent {
|
|
237
|
+
constructor() {
|
|
238
|
+
this.showValidationOnNotTouched = false;
|
|
239
|
+
this.errorMessages = [];
|
|
240
|
+
this._messages = {};
|
|
241
|
+
// this.errorMessages = [
|
|
242
|
+
// {
|
|
243
|
+
// type: 'required',
|
|
244
|
+
// message: this.translateService.instant(
|
|
245
|
+
// 'FORMS.VALIDATION.LABEL_REQUIRED'
|
|
246
|
+
// ),
|
|
247
|
+
// },
|
|
248
|
+
// {
|
|
249
|
+
// type: 'minlength',
|
|
250
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MIN_LENGTH'),
|
|
251
|
+
// },
|
|
252
|
+
// {
|
|
253
|
+
// type: 'maxlength',
|
|
254
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MAX_LENGTH'),
|
|
255
|
+
// },
|
|
256
|
+
// {
|
|
257
|
+
// type: 'min',
|
|
258
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MIN'),
|
|
259
|
+
// },
|
|
260
|
+
// {
|
|
261
|
+
// type: 'max',
|
|
262
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MAX'),
|
|
263
|
+
// },
|
|
264
|
+
// {
|
|
265
|
+
// type: 'minValue',
|
|
266
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MIN_VALUE'),
|
|
267
|
+
// },
|
|
268
|
+
// {
|
|
269
|
+
// type: 'maxValue',
|
|
270
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MAX_VALUE'),
|
|
271
|
+
// },
|
|
272
|
+
// {
|
|
273
|
+
// type: 'validatePhoneNumber',
|
|
274
|
+
// message: this.translateService.instant(
|
|
275
|
+
// 'FORMS.VALIDATION.VALIDATE_PHONE_NUMBER'
|
|
276
|
+
// ),
|
|
277
|
+
// },
|
|
278
|
+
// {
|
|
279
|
+
// type: 'pastDate',
|
|
280
|
+
// message: this.translateService.instant('FORMS.VALIDATION.PAST_DATE'),
|
|
281
|
+
// },
|
|
282
|
+
// {
|
|
283
|
+
// type: 'affectsError',
|
|
284
|
+
// message: this.translateService.instant(
|
|
285
|
+
// 'FORMS.VALIDATION.AFFECTS_ERROR'
|
|
286
|
+
// ),
|
|
287
|
+
// },
|
|
288
|
+
// {
|
|
289
|
+
// type: 'moreThan',
|
|
290
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MORE_THAN'),
|
|
291
|
+
// },
|
|
292
|
+
// {
|
|
293
|
+
// type: 'lessThan',
|
|
294
|
+
// message: this.translateService.instant('FORMS.VALIDATION.LESS_THAN'),
|
|
295
|
+
// },
|
|
296
|
+
// {
|
|
297
|
+
// type: 'iban',
|
|
298
|
+
// message: this.translateService.instant('FORMS.VALIDATION.INVALID'),
|
|
299
|
+
// },
|
|
300
|
+
// {
|
|
301
|
+
// type: 'email',
|
|
302
|
+
// message: this.translateService.instant('FORMS.VALIDATION.EMAIL'),
|
|
303
|
+
// },
|
|
304
|
+
// {
|
|
305
|
+
// type: 'numberMoreThan',
|
|
306
|
+
// message: this.translateService.instant(
|
|
307
|
+
// 'FORMS.VALIDATION.VALUE_MORE_THAN'
|
|
308
|
+
// ),
|
|
309
|
+
// },
|
|
310
|
+
// {
|
|
311
|
+
// type: 'numberLessThan',
|
|
312
|
+
// message: this.translateService.instant(
|
|
313
|
+
// 'FORMS.VALIDATION.VALUE_LESS_THAN'
|
|
314
|
+
// ),
|
|
315
|
+
// },
|
|
316
|
+
// {
|
|
317
|
+
// type: 'outOfRange',
|
|
318
|
+
// message: this.translateService.instant('FORMS.VALIDATION.OUT_OF_RANGE'),
|
|
319
|
+
// },
|
|
320
|
+
// {
|
|
321
|
+
// type: 'iban',
|
|
322
|
+
// message: this.translateService.instant('FORMS.VALIDATION.IBAN'),
|
|
323
|
+
// },
|
|
324
|
+
// {
|
|
325
|
+
// type: 'timeIsAfter',
|
|
326
|
+
// message: this.translateService.instant(
|
|
327
|
+
// 'FORMS.VALIDATION.LESS_THAN_TIME'
|
|
328
|
+
// ),
|
|
329
|
+
// },
|
|
330
|
+
// ];
|
|
331
|
+
}
|
|
332
|
+
get messages() {
|
|
333
|
+
if (this.element) {
|
|
334
|
+
for (const errorKey in this.element.errors) {
|
|
335
|
+
for (const key in this.element.errors[errorKey]) {
|
|
336
|
+
if (this._messages[errorKey]) {
|
|
337
|
+
this._messages[errorKey] = this._messages[errorKey].replace(`[${key}]`, this.element.errors[errorKey][key]);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
return this._messages;
|
|
343
|
+
}
|
|
344
|
+
set messages(m) {
|
|
345
|
+
this._messages = m;
|
|
346
|
+
}
|
|
347
|
+
ngOnChanges(changes) {
|
|
348
|
+
const { updatedErrors } = changes;
|
|
349
|
+
if (updatedErrors &&
|
|
350
|
+
updatedErrors.currentValue &&
|
|
351
|
+
updatedErrors.currentValue.length > 0) {
|
|
352
|
+
for (const error of updatedErrors.currentValue) {
|
|
353
|
+
this.messages[error.type] = error.message;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
ngOnInit() {
|
|
358
|
+
for (const error of this.errorMessages) {
|
|
359
|
+
this.messages[error.type] = this.replaceTokens(error.message);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
replaceTokens(message) {
|
|
363
|
+
let retMessage;
|
|
364
|
+
if (this.label) {
|
|
365
|
+
retMessage = message.replace('[label]', this.label);
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
retMessage = message;
|
|
369
|
+
}
|
|
370
|
+
return retMessage;
|
|
371
|
+
}
|
|
372
|
+
getMessageDetail(key) {
|
|
373
|
+
return this.messages[key];
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
ValidationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
377
|
+
ValidationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ValidationComponent, selector: "app-validations-messages", inputs: { element: "element", label: "label", showValidationOnNotTouched: "showValidationOnNotTouched", updatedErrors: "updatedErrors" }, usesOnChanges: true, ngImport: i0, template: "<div\r\n class=\"form-field__validation\"\r\n *ngIf=\"element && (element?.touched || showValidationOnNotTouched) && element?.invalid\"\r\n>\r\n <div class=\"form-field__validation__item\" *ngFor=\"let item of element?.errors | keyvalue\">\r\n {{ getMessageDetail(item.key) }}\r\n </div>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }] });
|
|
378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationComponent, decorators: [{
|
|
379
|
+
type: Component,
|
|
380
|
+
args: [{ selector: 'app-validations-messages', template: "<div\r\n class=\"form-field__validation\"\r\n *ngIf=\"element && (element?.touched || showValidationOnNotTouched) && element?.invalid\"\r\n>\r\n <div class=\"form-field__validation__item\" *ngFor=\"let item of element?.errors | keyvalue\">\r\n {{ getMessageDetail(item.key) }}\r\n </div>\r\n</div>\r\n" }]
|
|
381
|
+
}], ctorParameters: function () { return []; }, propDecorators: { element: [{
|
|
382
|
+
type: Input
|
|
383
|
+
}], label: [{
|
|
384
|
+
type: Input
|
|
385
|
+
}], showValidationOnNotTouched: [{
|
|
386
|
+
type: Input
|
|
387
|
+
}], updatedErrors: [{
|
|
388
|
+
type: Input
|
|
389
|
+
}] } });
|
|
390
|
+
|
|
391
|
+
class HintComponent {
|
|
392
|
+
constructor() {
|
|
393
|
+
this.showHint = false;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
HintComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: HintComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
397
|
+
HintComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: HintComponent, selector: "app-hint", inputs: { element: "element", maxValue: "maxValue", showHint: "showHint" }, ngImport: i0, template: "<div class=\"hint\" *ngIf=\"element && showHint\">{{ element?.value?.length || 0 }}/{{ this.maxValue }}</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: HintComponent, decorators: [{
|
|
399
|
+
type: Component,
|
|
400
|
+
args: [{ selector: 'app-hint', template: "<div class=\"hint\" *ngIf=\"element && showHint\">{{ element?.value?.length || 0 }}/{{ this.maxValue }}</div>\r\n" }]
|
|
401
|
+
}], propDecorators: { element: [{
|
|
402
|
+
type: Input
|
|
403
|
+
}], maxValue: [{
|
|
404
|
+
type: Input
|
|
405
|
+
}], showHint: [{
|
|
406
|
+
type: Input
|
|
407
|
+
}] } });
|
|
408
|
+
|
|
409
|
+
class ElementWrapperComponent {
|
|
410
|
+
constructor() {
|
|
411
|
+
this.showHidePassword = new EventEmitter();
|
|
412
|
+
this.clear = new EventEmitter();
|
|
413
|
+
this.increase = new EventEmitter();
|
|
414
|
+
this.decrease = new EventEmitter();
|
|
415
|
+
}
|
|
416
|
+
showHidePasswordFn(event) {
|
|
417
|
+
this.showHidePassword.emit(event);
|
|
418
|
+
}
|
|
419
|
+
clearFn() {
|
|
420
|
+
this.clear.emit();
|
|
421
|
+
}
|
|
422
|
+
increaseFn() {
|
|
423
|
+
this.increase.emit();
|
|
424
|
+
}
|
|
425
|
+
decreaseFn() {
|
|
426
|
+
this.decrease.emit();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
ElementWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ElementWrapperComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
430
|
+
ElementWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: ElementWrapperComponent, selector: "app-element-wrapper", inputs: { data: "data", showCloseIcon: "showCloseIcon", focusedFlag: "focusedFlag", showPassword: "showPassword", control: "control" }, outputs: { showHidePassword: "showHidePassword", clear: "clear", increase: "increase", decrease: "decrease" }, ngImport: i0, template: "<div\r\n class=\"form-field\"\r\n [ngClass]=\"{\r\n 'form-field--invalid':\r\n data?.showValidation && (data?.control?.touched || data?.showValidationOnNotTouched) && data?.control?.invalid,\r\n disabled: data?.disabled,\r\n 'form-field--required': data?.required && data?.showAsterisk\r\n }\"\r\n>\r\n <div>\r\n <label class=\"form-field__label\" [attr.for]=\"data?.name\" *ngIf=\"data?.label\">\r\n <span [innerHTML]=\"data?.label\"></span>\r\n <mat-icon class=\"icon\" *ngIf=\"data?.tooltip\" [matTooltip]=\"data?.tooltip\">error_outline</mat-icon>\r\n </label>\r\n </div>\r\n\r\n <ng-content></ng-content>\r\n\r\n <ecabs-loading-spinner class=\"spinner\" size=\"tiny\" *ngIf=\"data.loading\"></ecabs-loading-spinner>\r\n\r\n <app-hint [element]=\"data?.control\" [showHint]=\"data?.showHint\" [maxValue]=\"data?.maxLength\"></app-hint>\r\n\r\n <app-validations-messages\r\n *ngIf=\"data?.showValidation && !data?.hideValidationMessage\"\r\n [element]=\"data?.control\"\r\n [label]=\"data?.label ? data?.label : data?.placeholder ? data.placeholder : data?.validationLabel\"\r\n [showValidationOnNotTouched]=\"data?.showValidationOnNotTouched\"\r\n >\r\n </app-validations-messages>\r\n</div>\r\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: EcabsSpinnerComponent, selector: "ecabs-loading-spinner", inputs: ["size"] }, { kind: "component", type: ValidationComponent, selector: "app-validations-messages", inputs: ["element", "label", "showValidationOnNotTouched", "updatedErrors"] }, { kind: "component", type: i4.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: HintComponent, selector: "app-hint", inputs: ["element", "maxValue", "showHint"] }] });
|
|
431
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ElementWrapperComponent, decorators: [{
|
|
432
|
+
type: Component,
|
|
433
|
+
args: [{ selector: 'app-element-wrapper', template: "<div\r\n class=\"form-field\"\r\n [ngClass]=\"{\r\n 'form-field--invalid':\r\n data?.showValidation && (data?.control?.touched || data?.showValidationOnNotTouched) && data?.control?.invalid,\r\n disabled: data?.disabled,\r\n 'form-field--required': data?.required && data?.showAsterisk\r\n }\"\r\n>\r\n <div>\r\n <label class=\"form-field__label\" [attr.for]=\"data?.name\" *ngIf=\"data?.label\">\r\n <span [innerHTML]=\"data?.label\"></span>\r\n <mat-icon class=\"icon\" *ngIf=\"data?.tooltip\" [matTooltip]=\"data?.tooltip\">error_outline</mat-icon>\r\n </label>\r\n </div>\r\n\r\n <ng-content></ng-content>\r\n\r\n <ecabs-loading-spinner class=\"spinner\" size=\"tiny\" *ngIf=\"data.loading\"></ecabs-loading-spinner>\r\n\r\n <app-hint [element]=\"data?.control\" [showHint]=\"data?.showHint\" [maxValue]=\"data?.maxLength\"></app-hint>\r\n\r\n <app-validations-messages\r\n *ngIf=\"data?.showValidation && !data?.hideValidationMessage\"\r\n [element]=\"data?.control\"\r\n [label]=\"data?.label ? data?.label : data?.placeholder ? data.placeholder : data?.validationLabel\"\r\n [showValidationOnNotTouched]=\"data?.showValidationOnNotTouched\"\r\n >\r\n </app-validations-messages>\r\n</div>\r\n" }]
|
|
434
|
+
}], propDecorators: { data: [{
|
|
435
|
+
type: Input
|
|
436
|
+
}], showCloseIcon: [{
|
|
437
|
+
type: Input
|
|
438
|
+
}], focusedFlag: [{
|
|
439
|
+
type: Input
|
|
440
|
+
}], showPassword: [{
|
|
441
|
+
type: Input
|
|
442
|
+
}], control: [{
|
|
443
|
+
type: Input
|
|
444
|
+
}], showHidePassword: [{
|
|
445
|
+
type: Output
|
|
446
|
+
}], clear: [{
|
|
447
|
+
type: Output
|
|
448
|
+
}], increase: [{
|
|
449
|
+
type: Output
|
|
450
|
+
}], decrease: [{
|
|
451
|
+
type: Output
|
|
452
|
+
}] } });
|
|
453
|
+
|
|
454
|
+
class DigitsOnlyDirective {
|
|
455
|
+
constructor(el) {
|
|
456
|
+
this.el = el;
|
|
457
|
+
this.digitsOnly = false;
|
|
458
|
+
this.allowHyphen = false;
|
|
459
|
+
this.decimal = false;
|
|
460
|
+
this.decimalSeparator = '.';
|
|
461
|
+
this.unit = 0;
|
|
462
|
+
this.minus = '-';
|
|
463
|
+
this.minusCounter = 0;
|
|
464
|
+
this.decimalCounter = 0;
|
|
465
|
+
this.navigationKeys = [
|
|
466
|
+
'Backspace',
|
|
467
|
+
'Delete',
|
|
468
|
+
'Tab',
|
|
469
|
+
'Escape',
|
|
470
|
+
'Enter',
|
|
471
|
+
'Home',
|
|
472
|
+
'End',
|
|
473
|
+
'ArrowLeft',
|
|
474
|
+
'ArrowRight',
|
|
475
|
+
'Clear',
|
|
476
|
+
'Copy',
|
|
477
|
+
'Paste',
|
|
478
|
+
];
|
|
479
|
+
this.inputElement = el.nativeElement;
|
|
480
|
+
}
|
|
481
|
+
onKeyDown(e) {
|
|
482
|
+
if (this.digitsOnly) {
|
|
483
|
+
if (this.navigationKeys.indexOf(e.key) > -1 || // Allow: navigation keys: backspace, delete, arrows etc.
|
|
484
|
+
(e.key === 'a' && e.ctrlKey) || // Allow: Ctrl+A
|
|
485
|
+
(e.key === 'c' && e.ctrlKey) || // Allow: Ctrl+C
|
|
486
|
+
(e.key === 'v' && e.ctrlKey) || // Allow: Ctrl+V
|
|
487
|
+
(e.key === 'x' && e.ctrlKey) || // Allow: Ctrl+X
|
|
488
|
+
(e.key === 'a' && e.metaKey) || // Allow: Cmd+A (Mac)
|
|
489
|
+
(e.key === 'c' && e.metaKey) || // Allow: Cmd+C (Mac)
|
|
490
|
+
(e.key === 'v' && e.metaKey) || // Allow: Cmd+V (Mac)
|
|
491
|
+
(e.key === 'x' && e.metaKey) || // Allow: Cmd+X (Mac)
|
|
492
|
+
(this.decimal && e.key === this.decimalSeparator && this.decimalCounter < 1) || // Allow: only one decimal point
|
|
493
|
+
(this.decimal && e.key === this.minus && this.minusCounter < 1) // Allow: only one minus
|
|
494
|
+
) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
// Ensure that it is a number and stop the keypress
|
|
498
|
+
if (e.key === ' ' || !this.regex.test(e.key)) {
|
|
499
|
+
e.preventDefault();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
onKeyUp() {
|
|
504
|
+
if (this.digitsOnly) {
|
|
505
|
+
if (!this.decimal) {
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
this.decimalCounter = this.el.nativeElement.value.split(this.decimalSeparator).length - 1;
|
|
509
|
+
this.minusCounter = this.el.nativeElement.value.split(this.minus).length - 1;
|
|
510
|
+
if (isNaN(+this.inputElement.value)) {
|
|
511
|
+
this.inputElement.value = this.sanitizeInput(this.inputElement.value);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
onPaste(event) {
|
|
516
|
+
if (this.digitsOnly) {
|
|
517
|
+
const pastedInput = event.clipboardData?.getData('text/plain');
|
|
518
|
+
this.pasteData(pastedInput);
|
|
519
|
+
event.preventDefault();
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
ngOnInit() {
|
|
523
|
+
this.regex = new RegExp(this.allowHyphen ? '^[\\d -]+$' : '\\d');
|
|
524
|
+
}
|
|
525
|
+
pasteData(pastedContent) {
|
|
526
|
+
const sanitizedContent = isNaN(+pastedContent) ? this.sanitizeInput(pastedContent) : pastedContent;
|
|
527
|
+
const pasted = document.execCommand('insertText', false, sanitizedContent);
|
|
528
|
+
if (!pasted) {
|
|
529
|
+
const { selectionStart: start, selectionEnd: end } = this.inputElement;
|
|
530
|
+
this.inputElement.setRangeText(sanitizedContent, start, end, 'end');
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
sanitizeInput(input) {
|
|
534
|
+
let result = '';
|
|
535
|
+
if (this.decimal && this.isValidDecimal(input)) {
|
|
536
|
+
const regex = new RegExp(`^[\d -${this.decimalSeparator}]+$`, 'g');
|
|
537
|
+
result = input.replace(regex, '');
|
|
538
|
+
}
|
|
539
|
+
else {
|
|
540
|
+
result = input.replace(`/${this.regex}/g`, '');
|
|
541
|
+
}
|
|
542
|
+
const maxLength = this.inputElement.maxLength;
|
|
543
|
+
if (maxLength > 0) {
|
|
544
|
+
// the input element has maxLength limit
|
|
545
|
+
const allowedLength = maxLength - this.inputElement.value.length;
|
|
546
|
+
result = allowedLength > 0 ? result.substring(0, allowedLength) : '';
|
|
547
|
+
}
|
|
548
|
+
return result;
|
|
549
|
+
}
|
|
550
|
+
isValidDecimal(inputString) {
|
|
551
|
+
return inputString.split(this.decimalSeparator).length <= 2;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
DigitsOnlyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DigitsOnlyDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
555
|
+
DigitsOnlyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: DigitsOnlyDirective, selector: "[appDigitsOnly]", inputs: { digitsOnly: "digitsOnly", allowHyphen: "allowHyphen", decimal: "decimal", decimalSeparator: "decimalSeparator", unit: "unit" }, host: { listeners: { "keydown": "onKeyDown($event)", "keyup": "onKeyUp($event)", "paste": "onPaste($event)" } }, ngImport: i0 });
|
|
556
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: DigitsOnlyDirective, decorators: [{
|
|
557
|
+
type: Directive,
|
|
558
|
+
args: [{
|
|
559
|
+
selector: '[appDigitsOnly]',
|
|
560
|
+
}]
|
|
561
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { digitsOnly: [{
|
|
562
|
+
type: Input
|
|
563
|
+
}], allowHyphen: [{
|
|
564
|
+
type: Input
|
|
565
|
+
}], decimal: [{
|
|
566
|
+
type: Input
|
|
567
|
+
}], decimalSeparator: [{
|
|
568
|
+
type: Input
|
|
569
|
+
}], unit: [{
|
|
570
|
+
type: Input
|
|
571
|
+
}], onKeyDown: [{
|
|
572
|
+
type: HostListener,
|
|
573
|
+
args: ['keydown', ['$event']]
|
|
574
|
+
}], onKeyUp: [{
|
|
575
|
+
type: HostListener,
|
|
576
|
+
args: ['keyup', ['$event']]
|
|
577
|
+
}], onPaste: [{
|
|
578
|
+
type: HostListener,
|
|
579
|
+
args: ['paste', ['$event']]
|
|
580
|
+
}] } });
|
|
581
|
+
|
|
582
|
+
class EcabsInputComponent extends ElementBaseComponent {
|
|
583
|
+
constructor(injector) {
|
|
584
|
+
super();
|
|
585
|
+
this.injector = injector;
|
|
586
|
+
this.onblur = new EventEmitter();
|
|
587
|
+
this.onChange = () => { };
|
|
588
|
+
this.onTouch = () => { };
|
|
589
|
+
}
|
|
590
|
+
get value() {
|
|
591
|
+
return this.val;
|
|
592
|
+
}
|
|
593
|
+
set value(val) {
|
|
594
|
+
if (val !== undefined && this.val !== val) {
|
|
595
|
+
this.val = val;
|
|
596
|
+
this.onChange(val);
|
|
597
|
+
this.onTouch(val);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
ngOnInit() {
|
|
601
|
+
if (this.type === 'number') {
|
|
602
|
+
this.digitsOnly = true;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
ngAfterViewInit() {
|
|
606
|
+
const ngControl = this.injector.get(NgControl, null);
|
|
607
|
+
if (ngControl) {
|
|
608
|
+
this.control = ngControl.control;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
writeValue(value) {
|
|
612
|
+
this.value = value;
|
|
613
|
+
}
|
|
614
|
+
registerOnChange(fn) {
|
|
615
|
+
this.onChange = fn;
|
|
616
|
+
}
|
|
617
|
+
registerOnTouched(fn) {
|
|
618
|
+
this.onTouch = fn;
|
|
619
|
+
}
|
|
620
|
+
blurChange(e) {
|
|
621
|
+
this.onblur.emit(e);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
EcabsInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
|
625
|
+
EcabsInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: EcabsInputComponent, selector: "ecabs-input", inputs: { digitsOnly: "digitsOnly", allowDecimal: "allowDecimal", allowHyphen: "allowHyphen", max: "max", step: "step" }, outputs: { onblur: "onblur" }, providers: [
|
|
626
|
+
{
|
|
627
|
+
provide: NG_VALUE_ACCESSOR,
|
|
628
|
+
useExisting: EcabsInputComponent,
|
|
629
|
+
multi: true,
|
|
630
|
+
},
|
|
631
|
+
], usesInheritance: true, ngImport: i0, template: "<app-element-wrapper [data]=\"getData()\">\r\n <div class=\"form-field__input--wrapper\">\r\n <input\r\n appDigitsOnly\r\n [digitsOnly]=\"digitsOnly\"\r\n [decimal]=\"allowDecimal\"\r\n [allowHyphen]=\"allowHyphen\"\r\n class=\"form-field__input\"\r\n [type]=\"type\"\r\n [id]=\"name\"\r\n [(ngModel)]=\"value\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouch()\"\r\n [disabled]=\"disabled\"\r\n [maxlength]=\"maxLength\"\r\n [max]=\"max\"\r\n [step]=\"step\"\r\n (blur)=\"blurChange($event)\"\r\n />\r\n\r\n <div class=\"form-field__input--suffix\" *ngIf=\"type !== 'number'\">\r\n <ng-content select=\"mat-icon\"></ng-content>\r\n <ng-content select=\".suffix\"></ng-content>\r\n </div>\r\n </div>\r\n</app-element-wrapper>\r\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ElementWrapperComponent, selector: "app-element-wrapper", inputs: ["data", "showCloseIcon", "focusedFlag", "showPassword", "control"], outputs: ["showHidePassword", "clear", "increase", "decrease"] }, { kind: "directive", type: i3.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: i3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i3.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: DigitsOnlyDirective, selector: "[appDigitsOnly]", inputs: ["digitsOnly", "allowHyphen", "decimal", "decimalSeparator", "unit"] }] });
|
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputComponent, decorators: [{
|
|
633
|
+
type: Component,
|
|
634
|
+
args: [{ selector: 'ecabs-input', providers: [
|
|
635
|
+
{
|
|
636
|
+
provide: NG_VALUE_ACCESSOR,
|
|
637
|
+
useExisting: EcabsInputComponent,
|
|
638
|
+
multi: true,
|
|
639
|
+
},
|
|
640
|
+
], template: "<app-element-wrapper [data]=\"getData()\">\r\n <div class=\"form-field__input--wrapper\">\r\n <input\r\n appDigitsOnly\r\n [digitsOnly]=\"digitsOnly\"\r\n [decimal]=\"allowDecimal\"\r\n [allowHyphen]=\"allowHyphen\"\r\n class=\"form-field__input\"\r\n [type]=\"type\"\r\n [id]=\"name\"\r\n [(ngModel)]=\"value\"\r\n [placeholder]=\"placeholder\"\r\n (blur)=\"onTouch()\"\r\n [disabled]=\"disabled\"\r\n [maxlength]=\"maxLength\"\r\n [max]=\"max\"\r\n [step]=\"step\"\r\n (blur)=\"blurChange($event)\"\r\n />\r\n\r\n <div class=\"form-field__input--suffix\" *ngIf=\"type !== 'number'\">\r\n <ng-content select=\"mat-icon\"></ng-content>\r\n <ng-content select=\".suffix\"></ng-content>\r\n </div>\r\n </div>\r\n</app-element-wrapper>\r\n" }]
|
|
641
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { digitsOnly: [{
|
|
642
|
+
type: Input
|
|
643
|
+
}], allowDecimal: [{
|
|
644
|
+
type: Input
|
|
645
|
+
}], allowHyphen: [{
|
|
646
|
+
type: Input
|
|
647
|
+
}], max: [{
|
|
648
|
+
type: Input
|
|
649
|
+
}], step: [{
|
|
650
|
+
type: Input
|
|
651
|
+
}], onblur: [{
|
|
652
|
+
type: Output
|
|
653
|
+
}] } });
|
|
654
|
+
|
|
655
|
+
class HintModule {
|
|
656
|
+
}
|
|
657
|
+
HintModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: HintModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
658
|
+
HintModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: HintModule, declarations: [HintComponent], imports: [CommonModule, FormsModule, MatFormFieldModule], exports: [HintComponent] });
|
|
659
|
+
HintModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: HintModule, imports: [CommonModule, FormsModule, MatFormFieldModule] });
|
|
660
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: HintModule, decorators: [{
|
|
661
|
+
type: NgModule,
|
|
662
|
+
args: [{
|
|
663
|
+
declarations: [HintComponent],
|
|
664
|
+
imports: [CommonModule, FormsModule, MatFormFieldModule],
|
|
665
|
+
exports: [HintComponent],
|
|
666
|
+
}]
|
|
667
|
+
}] });
|
|
668
|
+
|
|
669
|
+
class ValidationModule {
|
|
670
|
+
}
|
|
671
|
+
ValidationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
672
|
+
ValidationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: ValidationModule, declarations: [ValidationComponent], imports: [CommonModule, FormsModule, MatFormFieldModule], exports: [ValidationComponent] });
|
|
673
|
+
ValidationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationModule, imports: [CommonModule, FormsModule, MatFormFieldModule] });
|
|
674
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValidationModule, decorators: [{
|
|
675
|
+
type: NgModule,
|
|
676
|
+
args: [{
|
|
677
|
+
declarations: [ValidationComponent],
|
|
678
|
+
imports: [CommonModule, FormsModule, MatFormFieldModule],
|
|
679
|
+
exports: [ValidationComponent],
|
|
680
|
+
}]
|
|
681
|
+
}] });
|
|
682
|
+
|
|
683
|
+
class ElementWrapperModule {
|
|
684
|
+
}
|
|
685
|
+
ElementWrapperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ElementWrapperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
686
|
+
ElementWrapperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: ElementWrapperModule, declarations: [ElementWrapperComponent], imports: [CommonModule,
|
|
687
|
+
FormsModule,
|
|
688
|
+
EcabsLoadingModule,
|
|
689
|
+
ValidationModule,
|
|
690
|
+
MatFormFieldModule,
|
|
691
|
+
MatInputModule,
|
|
692
|
+
MatIconModule,
|
|
693
|
+
MatTooltipModule,
|
|
694
|
+
HintModule], exports: [ElementWrapperComponent] });
|
|
695
|
+
ElementWrapperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ElementWrapperModule, imports: [CommonModule,
|
|
696
|
+
FormsModule,
|
|
697
|
+
EcabsLoadingModule,
|
|
698
|
+
ValidationModule,
|
|
699
|
+
MatFormFieldModule,
|
|
700
|
+
MatInputModule,
|
|
701
|
+
MatIconModule,
|
|
702
|
+
MatTooltipModule,
|
|
703
|
+
HintModule] });
|
|
704
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ElementWrapperModule, decorators: [{
|
|
705
|
+
type: NgModule,
|
|
706
|
+
args: [{
|
|
707
|
+
declarations: [ElementWrapperComponent],
|
|
708
|
+
imports: [
|
|
709
|
+
CommonModule,
|
|
710
|
+
FormsModule,
|
|
711
|
+
EcabsLoadingModule,
|
|
712
|
+
ValidationModule,
|
|
713
|
+
MatFormFieldModule,
|
|
714
|
+
MatInputModule,
|
|
715
|
+
MatIconModule,
|
|
716
|
+
MatTooltipModule,
|
|
717
|
+
HintModule,
|
|
718
|
+
],
|
|
719
|
+
exports: [ElementWrapperComponent],
|
|
720
|
+
}]
|
|
721
|
+
}] });
|
|
722
|
+
|
|
723
|
+
class EcabsInputModule {
|
|
724
|
+
}
|
|
725
|
+
EcabsInputModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
726
|
+
EcabsInputModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, declarations: [EcabsInputComponent, DigitsOnlyDirective], imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule], exports: [EcabsInputComponent] });
|
|
727
|
+
EcabsInputModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule] });
|
|
728
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: EcabsInputModule, decorators: [{
|
|
729
|
+
type: NgModule,
|
|
730
|
+
args: [{
|
|
731
|
+
declarations: [EcabsInputComponent, DigitsOnlyDirective],
|
|
732
|
+
imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule],
|
|
733
|
+
exports: [EcabsInputComponent],
|
|
734
|
+
}]
|
|
735
|
+
}] });
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Generated bundle index. Do not edit.
|
|
739
|
+
*/
|
|
740
|
+
|
|
741
|
+
export { ButtonsComponent, EcabsButtonsModule, EcabsInputComponent, EcabsInputModule, EcabsLoadingComponent, EcabsLoadingModule, EcabsSpinnerComponent };
|
|
742
|
+
//# sourceMappingURL=ecabs-components.mjs.map
|