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,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
OnInit,
|
|
4
|
+
Input,
|
|
5
|
+
OnChanges,
|
|
6
|
+
SimpleChanges,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'app-validations-messages',
|
|
11
|
+
templateUrl: './validation.component.html',
|
|
12
|
+
styleUrls: ['./validation.component.scss'],
|
|
13
|
+
})
|
|
14
|
+
export class ValidationComponent implements OnInit, OnChanges {
|
|
15
|
+
@Input() element!: any;
|
|
16
|
+
@Input() label!: string;
|
|
17
|
+
@Input() showValidationOnNotTouched = false;
|
|
18
|
+
@Input() updatedErrors!: { type: string; message: string }[];
|
|
19
|
+
errorMessages: any[]=[];
|
|
20
|
+
|
|
21
|
+
private _messages: any = {};
|
|
22
|
+
|
|
23
|
+
get messages(): any {
|
|
24
|
+
if (this.element) {
|
|
25
|
+
for (const errorKey in this.element.errors) {
|
|
26
|
+
for (const key in this.element.errors[errorKey]) {
|
|
27
|
+
if (this._messages[errorKey]) {
|
|
28
|
+
this._messages[errorKey] = this._messages[errorKey].replace(
|
|
29
|
+
`[${key}]`,
|
|
30
|
+
this.element.errors[errorKey][key]
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return this._messages;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
set messages(m) {
|
|
41
|
+
this._messages = m;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
constructor() {
|
|
45
|
+
// this.errorMessages = [
|
|
46
|
+
// {
|
|
47
|
+
// type: 'required',
|
|
48
|
+
// message: this.translateService.instant(
|
|
49
|
+
// 'FORMS.VALIDATION.LABEL_REQUIRED'
|
|
50
|
+
// ),
|
|
51
|
+
// },
|
|
52
|
+
// {
|
|
53
|
+
// type: 'minlength',
|
|
54
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MIN_LENGTH'),
|
|
55
|
+
// },
|
|
56
|
+
// {
|
|
57
|
+
// type: 'maxlength',
|
|
58
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MAX_LENGTH'),
|
|
59
|
+
// },
|
|
60
|
+
// {
|
|
61
|
+
// type: 'min',
|
|
62
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MIN'),
|
|
63
|
+
// },
|
|
64
|
+
// {
|
|
65
|
+
// type: 'max',
|
|
66
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MAX'),
|
|
67
|
+
// },
|
|
68
|
+
// {
|
|
69
|
+
// type: 'minValue',
|
|
70
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MIN_VALUE'),
|
|
71
|
+
// },
|
|
72
|
+
// {
|
|
73
|
+
// type: 'maxValue',
|
|
74
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MAX_VALUE'),
|
|
75
|
+
// },
|
|
76
|
+
// {
|
|
77
|
+
// type: 'validatePhoneNumber',
|
|
78
|
+
// message: this.translateService.instant(
|
|
79
|
+
// 'FORMS.VALIDATION.VALIDATE_PHONE_NUMBER'
|
|
80
|
+
// ),
|
|
81
|
+
// },
|
|
82
|
+
// {
|
|
83
|
+
// type: 'pastDate',
|
|
84
|
+
// message: this.translateService.instant('FORMS.VALIDATION.PAST_DATE'),
|
|
85
|
+
// },
|
|
86
|
+
// {
|
|
87
|
+
// type: 'affectsError',
|
|
88
|
+
// message: this.translateService.instant(
|
|
89
|
+
// 'FORMS.VALIDATION.AFFECTS_ERROR'
|
|
90
|
+
// ),
|
|
91
|
+
// },
|
|
92
|
+
// {
|
|
93
|
+
// type: 'moreThan',
|
|
94
|
+
// message: this.translateService.instant('FORMS.VALIDATION.MORE_THAN'),
|
|
95
|
+
// },
|
|
96
|
+
// {
|
|
97
|
+
// type: 'lessThan',
|
|
98
|
+
// message: this.translateService.instant('FORMS.VALIDATION.LESS_THAN'),
|
|
99
|
+
// },
|
|
100
|
+
// {
|
|
101
|
+
// type: 'iban',
|
|
102
|
+
// message: this.translateService.instant('FORMS.VALIDATION.INVALID'),
|
|
103
|
+
// },
|
|
104
|
+
// {
|
|
105
|
+
// type: 'email',
|
|
106
|
+
// message: this.translateService.instant('FORMS.VALIDATION.EMAIL'),
|
|
107
|
+
// },
|
|
108
|
+
// {
|
|
109
|
+
// type: 'numberMoreThan',
|
|
110
|
+
// message: this.translateService.instant(
|
|
111
|
+
// 'FORMS.VALIDATION.VALUE_MORE_THAN'
|
|
112
|
+
// ),
|
|
113
|
+
// },
|
|
114
|
+
// {
|
|
115
|
+
// type: 'numberLessThan',
|
|
116
|
+
// message: this.translateService.instant(
|
|
117
|
+
// 'FORMS.VALIDATION.VALUE_LESS_THAN'
|
|
118
|
+
// ),
|
|
119
|
+
// },
|
|
120
|
+
// {
|
|
121
|
+
// type: 'outOfRange',
|
|
122
|
+
// message: this.translateService.instant('FORMS.VALIDATION.OUT_OF_RANGE'),
|
|
123
|
+
// },
|
|
124
|
+
// {
|
|
125
|
+
// type: 'iban',
|
|
126
|
+
// message: this.translateService.instant('FORMS.VALIDATION.IBAN'),
|
|
127
|
+
// },
|
|
128
|
+
// {
|
|
129
|
+
// type: 'timeIsAfter',
|
|
130
|
+
// message: this.translateService.instant(
|
|
131
|
+
// 'FORMS.VALIDATION.LESS_THAN_TIME'
|
|
132
|
+
// ),
|
|
133
|
+
// },
|
|
134
|
+
// ];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
138
|
+
const { updatedErrors } = changes;
|
|
139
|
+
|
|
140
|
+
if (
|
|
141
|
+
updatedErrors &&
|
|
142
|
+
updatedErrors.currentValue &&
|
|
143
|
+
updatedErrors.currentValue.length > 0
|
|
144
|
+
) {
|
|
145
|
+
for (const error of updatedErrors.currentValue) {
|
|
146
|
+
this.messages[error.type] = error.message;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
ngOnInit(): void {
|
|
152
|
+
for (const error of this.errorMessages) {
|
|
153
|
+
this.messages[error.type] = this.replaceTokens(error.message);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
replaceTokens(message: string): string {
|
|
158
|
+
let retMessage: string;
|
|
159
|
+
if (this.label) {
|
|
160
|
+
retMessage = message.replace('[label]', this.label);
|
|
161
|
+
} else {
|
|
162
|
+
retMessage = message;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return retMessage;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
getMessageDetail(key: any): string {
|
|
169
|
+
return this.messages[key];
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./validation.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/forms";
|
|
5
|
+
import * as i4 from "@angular/material/form-field";
|
|
6
|
+
export declare class ValidationModule {
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ValidationModule, never>;
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ValidationModule, [typeof i1.ValidationComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i4.MatFormFieldModule], [typeof i1.ValidationComponent]>;
|
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ValidationModule>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { ValidationComponent } from './validation.component';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
6
|
+
|
|
7
|
+
@NgModule({
|
|
8
|
+
declarations: [ValidationComponent],
|
|
9
|
+
imports: [CommonModule, FormsModule, MatFormFieldModule],
|
|
10
|
+
exports: [ValidationComponent],
|
|
11
|
+
})
|
|
12
|
+
export class ValidationModule {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ThemePalette } from '@angular/material/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class ButtonsComponent implements OnInit, OnChanges {
|
|
5
|
+
label: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
form: string;
|
|
9
|
+
size: 'default' | 'large';
|
|
10
|
+
type: 'button' | 'submit';
|
|
11
|
+
raised: boolean;
|
|
12
|
+
stroked: boolean;
|
|
13
|
+
full: boolean;
|
|
14
|
+
color: ThemePalette | 'success';
|
|
15
|
+
borderWidth: string;
|
|
16
|
+
classAttr: string;
|
|
17
|
+
ngOnInit(): void;
|
|
18
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ButtonsComponent, never>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonsComponent, "ecabs-buttons", never, { "label": "label"; "disabled": "disabled"; "loading": "loading"; "form": "form"; "size": "size"; "type": "type"; "raised": "raised"; "stroked": "stroked"; "full": "full"; "color": "color"; }, {}, never, ["mat-icon", "*"], false>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<button
|
|
2
|
+
mat-button
|
|
3
|
+
[ngClass]="{
|
|
4
|
+
'!w-full': full,
|
|
5
|
+
'mat-stroked-button': stroked,
|
|
6
|
+
'mat-raised-button': raised
|
|
7
|
+
}"
|
|
8
|
+
[color]="color"
|
|
9
|
+
[disabled]="disabled"
|
|
10
|
+
[type]="type"
|
|
11
|
+
[attr.form]="form"
|
|
12
|
+
>
|
|
13
|
+
<ecabs-loading-spinner size="tiny" *ngIf="loading"></ecabs-loading-spinner>
|
|
14
|
+
<ng-container *ngIf="!loading">
|
|
15
|
+
<ng-content select="mat-icon"></ng-content>
|
|
16
|
+
<ng-content></ng-content>
|
|
17
|
+
</ng-container>
|
|
18
|
+
</button>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Component, HostBinding, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { ThemePalette } from '@angular/material/core';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'ecabs-buttons',
|
|
6
|
+
templateUrl: './ecabs-buttons.component.html',
|
|
7
|
+
})
|
|
8
|
+
export class ButtonsComponent implements OnInit, OnChanges {
|
|
9
|
+
@Input()
|
|
10
|
+
label!: string;
|
|
11
|
+
|
|
12
|
+
@Input()
|
|
13
|
+
disabled!: boolean;
|
|
14
|
+
|
|
15
|
+
@Input()
|
|
16
|
+
loading!: boolean;
|
|
17
|
+
|
|
18
|
+
@Input()
|
|
19
|
+
form!: string;
|
|
20
|
+
|
|
21
|
+
@Input()
|
|
22
|
+
size: 'default' | 'large' = 'default';
|
|
23
|
+
|
|
24
|
+
@Input()
|
|
25
|
+
type: 'button' | 'submit' = 'button';
|
|
26
|
+
|
|
27
|
+
@Input() raised = false;
|
|
28
|
+
@Input() stroked = false;
|
|
29
|
+
@Input() full = false;
|
|
30
|
+
@Input()
|
|
31
|
+
color: ThemePalette | 'success' = 'primary';
|
|
32
|
+
|
|
33
|
+
@HostBinding('style.width')
|
|
34
|
+
borderWidth = '';
|
|
35
|
+
@HostBinding('class')
|
|
36
|
+
classAttr = '';
|
|
37
|
+
|
|
38
|
+
ngOnInit(): void {
|
|
39
|
+
if (this.full) {
|
|
40
|
+
this.borderWidth = '100%';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
45
|
+
const disabled = changes['disabled']?.currentValue !== undefined ? changes['disabled'].currentValue : this.disabled;
|
|
46
|
+
const loading = changes['loading']?.currentValue !== undefined ? changes['loading'].currentValue : this.loading;
|
|
47
|
+
|
|
48
|
+
if (disabled || loading) {
|
|
49
|
+
this.classAttr = 'pointer-events-none';
|
|
50
|
+
} else {
|
|
51
|
+
this.classAttr = '';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ecabs-buttons.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/material/button";
|
|
5
|
+
import * as i4 from "../ecabs-loading/ecabs-loading.module";
|
|
6
|
+
import * as i5 from "@angular/material/icon";
|
|
7
|
+
export declare class EcabsButtonsModule {
|
|
8
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EcabsButtonsModule, never>;
|
|
9
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EcabsButtonsModule, [typeof i1.ButtonsComponent], [typeof i2.CommonModule, typeof i3.MatButtonModule, typeof i4.EcabsLoadingModule, typeof i5.MatIconModule], [typeof i1.ButtonsComponent]>;
|
|
10
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<EcabsButtonsModule>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { ButtonsComponent } from './ecabs-buttons.component';
|
|
4
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
5
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
6
|
+
import { EcabsLoadingModule } from '../ecabs-loading/ecabs-loading.module';
|
|
7
|
+
|
|
8
|
+
@NgModule({
|
|
9
|
+
declarations: [ButtonsComponent],
|
|
10
|
+
imports: [CommonModule, MatButtonModule, EcabsLoadingModule, MatIconModule],
|
|
11
|
+
exports: [ButtonsComponent],
|
|
12
|
+
})
|
|
13
|
+
export class EcabsButtonsModule {}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AfterViewInit, EventEmitter, Injector, OnInit } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import ElementBaseComponent from '../base/element-base';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class EcabsInputComponent extends ElementBaseComponent implements ControlValueAccessor, AfterViewInit, OnInit {
|
|
6
|
+
private injector;
|
|
7
|
+
digitsOnly: boolean;
|
|
8
|
+
allowDecimal: boolean;
|
|
9
|
+
allowHyphen: boolean;
|
|
10
|
+
max: number;
|
|
11
|
+
step: number;
|
|
12
|
+
onblur: EventEmitter<any>;
|
|
13
|
+
val: string | number;
|
|
14
|
+
get value(): string | number;
|
|
15
|
+
set value(val: string | number);
|
|
16
|
+
constructor(injector: Injector);
|
|
17
|
+
ngOnInit(): void;
|
|
18
|
+
ngAfterViewInit(): void;
|
|
19
|
+
onChange: any;
|
|
20
|
+
onTouch: any;
|
|
21
|
+
writeValue(value: any): void;
|
|
22
|
+
registerOnChange(fn: any): void;
|
|
23
|
+
registerOnTouched(fn: any): void;
|
|
24
|
+
blurChange(e: any): void;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EcabsInputComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EcabsInputComponent, "ecabs-input", never, { "digitsOnly": "digitsOnly"; "allowDecimal": "allowDecimal"; "allowHyphen": "allowHyphen"; "max": "max"; "step": "step"; }, { "onblur": "onblur"; }, never, ["mat-icon", ".suffix"], false>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<app-element-wrapper [data]="getData()">
|
|
2
|
+
<div class="form-field__input--wrapper">
|
|
3
|
+
<input
|
|
4
|
+
appDigitsOnly
|
|
5
|
+
[digitsOnly]="digitsOnly"
|
|
6
|
+
[decimal]="allowDecimal"
|
|
7
|
+
[allowHyphen]="allowHyphen"
|
|
8
|
+
class="form-field__input"
|
|
9
|
+
[type]="type"
|
|
10
|
+
[id]="name"
|
|
11
|
+
[(ngModel)]="value"
|
|
12
|
+
[placeholder]="placeholder"
|
|
13
|
+
(blur)="onTouch()"
|
|
14
|
+
[disabled]="disabled"
|
|
15
|
+
[maxlength]="maxLength"
|
|
16
|
+
[max]="max"
|
|
17
|
+
[step]="step"
|
|
18
|
+
(blur)="blurChange($event)"
|
|
19
|
+
/>
|
|
20
|
+
|
|
21
|
+
<div class="form-field__input--suffix" *ngIf="type !== 'number'">
|
|
22
|
+
<ng-content select="mat-icon"></ng-content>
|
|
23
|
+
<ng-content select=".suffix"></ng-content>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</app-element-wrapper>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AfterViewInit, Component, EventEmitter, Injector, Input, OnInit, Output } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor, UntypedFormControl, NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import ElementBaseComponent from '../base/element-base';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'ecabs-input',
|
|
7
|
+
templateUrl: './ecabs-input.component.html',
|
|
8
|
+
providers: [
|
|
9
|
+
{
|
|
10
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11
|
+
useExisting: EcabsInputComponent,
|
|
12
|
+
multi: true,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
})
|
|
16
|
+
export class EcabsInputComponent
|
|
17
|
+
extends ElementBaseComponent
|
|
18
|
+
implements ControlValueAccessor, AfterViewInit, OnInit
|
|
19
|
+
{
|
|
20
|
+
@Input()
|
|
21
|
+
digitsOnly!: boolean;
|
|
22
|
+
|
|
23
|
+
@Input()
|
|
24
|
+
allowDecimal!: boolean;
|
|
25
|
+
|
|
26
|
+
@Input()
|
|
27
|
+
allowHyphen!: boolean;
|
|
28
|
+
|
|
29
|
+
@Input() max!: number;
|
|
30
|
+
@Input() step!: number;
|
|
31
|
+
|
|
32
|
+
@Output() onblur = new EventEmitter<any>();
|
|
33
|
+
val!: string | number;
|
|
34
|
+
|
|
35
|
+
get value(): string | number {
|
|
36
|
+
return this.val;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
set value(val) {
|
|
40
|
+
if (val !== undefined && this.val !== val) {
|
|
41
|
+
this.val = val;
|
|
42
|
+
this.onChange(val);
|
|
43
|
+
this.onTouch(val);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
constructor(private injector: Injector) {
|
|
48
|
+
super();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
ngOnInit(): void {
|
|
52
|
+
if (this.type === 'number') {
|
|
53
|
+
this.digitsOnly = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ngAfterViewInit(): void {
|
|
58
|
+
const ngControl: NgControl = this.injector.get(NgControl, null) as NgControl;
|
|
59
|
+
if (ngControl) {
|
|
60
|
+
this.control = ngControl.control as UntypedFormControl;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
onChange: any = () => {};
|
|
65
|
+
|
|
66
|
+
onTouch: any = () => {};
|
|
67
|
+
|
|
68
|
+
writeValue(value: any): void {
|
|
69
|
+
this.value = value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
registerOnChange(fn: any): void {
|
|
73
|
+
this.onChange = fn;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
registerOnTouched(fn: any): void {
|
|
77
|
+
this.onTouch = fn;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
blurChange(e:any): void {
|
|
81
|
+
this.onblur.emit(e);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ecabs-input.component";
|
|
3
|
+
import * as i2 from "../base/directives/digits-only.directive";
|
|
4
|
+
import * as i3 from "@angular/common";
|
|
5
|
+
import * as i4 from "@angular/material/input";
|
|
6
|
+
import * as i5 from "../base/element-wrapper/element-wrapper.module";
|
|
7
|
+
import * as i6 from "@angular/forms";
|
|
8
|
+
export declare class EcabsInputModule {
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EcabsInputModule, never>;
|
|
10
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EcabsInputModule, [typeof i1.EcabsInputComponent, typeof i2.DigitsOnlyDirective], [typeof i3.CommonModule, typeof i4.MatInputModule, typeof i5.ElementWrapperModule, typeof i6.FormsModule], [typeof i1.EcabsInputComponent]>;
|
|
11
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<EcabsInputModule>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { EcabsInputComponent } from './ecabs-input.component';
|
|
4
|
+
import { MatInputModule } from '@angular/material/input';
|
|
5
|
+
import { ElementWrapperModule } from '../base/element-wrapper/element-wrapper.module';
|
|
6
|
+
import { FormsModule } from '@angular/forms';
|
|
7
|
+
import { DigitsOnlyDirective } from '../base/directives/digits-only.directive';
|
|
8
|
+
|
|
9
|
+
@NgModule({
|
|
10
|
+
declarations: [EcabsInputComponent, DigitsOnlyDirective],
|
|
11
|
+
imports: [CommonModule, MatInputModule, ElementWrapperModule, FormsModule],
|
|
12
|
+
exports: [EcabsInputComponent],
|
|
13
|
+
})
|
|
14
|
+
export class EcabsInputModule {}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class EcabsLoadingComponent {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
size: 'large' | 'medium' | 'tiny';
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EcabsLoadingComponent, never>;
|
|
7
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EcabsLoadingComponent, "ecabs-ecabs-loading", never, { "loading": "loading"; "backgroundColor": "backgroundColor"; "size": "size"; }, {}, never, never, false>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { LoadingComponent } from './loading.component';
|
|
4
|
+
|
|
5
|
+
describe('LoadingComponent', () => {
|
|
6
|
+
let component: LoadingComponent;
|
|
7
|
+
let fixture: ComponentFixture<LoadingComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [LoadingComponent],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
fixture = TestBed.createComponent(LoadingComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
fixture.detectChanges();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should create', () => {
|
|
22
|
+
expect(component).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'ecabs-ecabs-loading',
|
|
5
|
+
templateUrl: './ecabs-loading.component.html',
|
|
6
|
+
})
|
|
7
|
+
export class EcabsLoadingComponent {
|
|
8
|
+
@Input() loading = false;
|
|
9
|
+
@Input() backgroundColor = 'white';
|
|
10
|
+
@Input() size: 'large' | 'medium' | 'tiny' = 'medium';
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ecabs-loading.component";
|
|
3
|
+
import * as i2 from "./spinner/spinner.component";
|
|
4
|
+
import * as i3 from "@angular/common";
|
|
5
|
+
export declare class EcabsLoadingModule {
|
|
6
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EcabsLoadingModule, never>;
|
|
7
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EcabsLoadingModule, [typeof i1.EcabsLoadingComponent, typeof i2.EcabsSpinnerComponent], [typeof i3.CommonModule], [typeof i1.EcabsLoadingComponent, typeof i2.EcabsSpinnerComponent]>;
|
|
8
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<EcabsLoadingModule>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { EcabsLoadingComponent } from './ecabs-loading.component';
|
|
4
|
+
import { EcabsSpinnerComponent } from './spinner/spinner.component';
|
|
5
|
+
|
|
6
|
+
@NgModule({
|
|
7
|
+
declarations: [EcabsLoadingComponent, EcabsSpinnerComponent],
|
|
8
|
+
imports: [CommonModule],
|
|
9
|
+
exports: [EcabsLoadingComponent, EcabsSpinnerComponent],
|
|
10
|
+
})
|
|
11
|
+
export class EcabsLoadingModule {}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class EcabsSpinnerComponent {
|
|
3
|
+
size: 'large' | 'medium' | 'tiny';
|
|
4
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EcabsSpinnerComponent, never>;
|
|
5
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EcabsSpinnerComponent, "ecabs-loading-spinner", never, { "size": "size"; }, {}, never, never, false>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
line-height: 0;
|
|
3
|
+
}
|
|
4
|
+
@keyframes ldio-inner {
|
|
5
|
+
0% {
|
|
6
|
+
transform: translate(-50%, -50%) rotate(0deg);
|
|
7
|
+
}
|
|
8
|
+
100% {
|
|
9
|
+
transform: translate(-50%, -50%) rotate(360deg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.loadingio-spinner-rolling {
|
|
14
|
+
width: 27px;
|
|
15
|
+
height: 27px;
|
|
16
|
+
display: inline-block;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
background: none;
|
|
19
|
+
.ldio-inner {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 100%;
|
|
22
|
+
position: relative;
|
|
23
|
+
transform: translateZ(0) scale(1);
|
|
24
|
+
backface-visibility: hidden;
|
|
25
|
+
transform-origin: 0 0;
|
|
26
|
+
div {
|
|
27
|
+
position: absolute;
|
|
28
|
+
width: 9px;
|
|
29
|
+
height: 9px;
|
|
30
|
+
border: 4px solid #85a2b6;
|
|
31
|
+
border-top-color: transparent;
|
|
32
|
+
border-radius: 50%;
|
|
33
|
+
animation: ldio-inner 1s linear infinite;
|
|
34
|
+
top: 14px;
|
|
35
|
+
left: 14px;
|
|
36
|
+
box-sizing: content-box;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
&.medium {
|
|
40
|
+
width: 40px;
|
|
41
|
+
height: 40px;
|
|
42
|
+
.ldio-inner div {
|
|
43
|
+
width: 20px;
|
|
44
|
+
height: 20px;
|
|
45
|
+
border-width: 6px;
|
|
46
|
+
top: 19px;
|
|
47
|
+
left: 19px;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
&.large {
|
|
51
|
+
width: 60px;
|
|
52
|
+
height: 60px;
|
|
53
|
+
.ldio-inner div {
|
|
54
|
+
width: 35px;
|
|
55
|
+
height: 35px;
|
|
56
|
+
border-width: 9px;
|
|
57
|
+
top: 29px;
|
|
58
|
+
left: 29px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { SpinnerComponent } from './spinner.component';
|
|
4
|
+
|
|
5
|
+
describe('SpinnerComponent', () => {
|
|
6
|
+
let component: SpinnerComponent;
|
|
7
|
+
let fixture: ComponentFixture<SpinnerComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [SpinnerComponent],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
fixture = TestBed.createComponent(SpinnerComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
fixture.detectChanges();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should create', () => {
|
|
22
|
+
expect(component).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|