ecabs-components 0.0.59 → 0.0.61
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/assets/images/nothing-here.svg +22 -0
- package/esm2020/lib/base/directives/digits-only.directive.mjs +2 -2
- package/esm2020/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.mjs +9 -5
- package/esm2020/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.mjs +1 -1
- package/esm2020/lib/ecabs-increment/ecabs-increment.component.mjs +2 -2
- package/esm2020/lib/ecabs-picker-header/ecabs-picker-header.component.mjs +2 -2
- package/fesm2015/ecabs-components.mjs +14 -10
- package/fesm2015/ecabs-components.mjs.map +1 -1
- package/fesm2020/ecabs-components.mjs +14 -10
- package/fesm2020/ecabs-components.mjs.map +1 -1
- package/lib/base/consts/date-mask.consts.ts +70 -0
- package/lib/base/directives/date-mask.directive.module.ts +15 -0
- package/lib/base/directives/date-mask.directive.ts +58 -0
- package/lib/base/directives/digits-only.directive.module.ts +15 -0
- package/lib/base/directives/digits-only.directive.ts +129 -0
- package/lib/base/directives/number-border.directive.module.ts +14 -0
- package/lib/base/directives/number-border.directive.ts +57 -0
- package/lib/base/element-base.ts +72 -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.ts +30 -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.ts +13 -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 +84 -0
- package/lib/base/validation/validation.module.ts +12 -0
- package/lib/ecabs-active-status-filter/ecabs-active-status-filter.component.html +14 -0
- package/lib/ecabs-active-status-filter/ecabs-active-status-filter.component.scss +16 -0
- package/lib/ecabs-active-status-filter/ecabs-active-status-filter.component.ts +23 -0
- package/lib/ecabs-active-status-filter/ecabs-active-status-filter.module.ts +13 -0
- package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.html +11 -0
- package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.scss +0 -0
- package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.spec.ts +24 -0
- package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.ts +12 -0
- package/lib/ecabs-breadcrumb/ecabs-breadcrumb.module.ts +12 -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.ts +13 -0
- package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.d.ts +5 -3
- package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.html +27 -0
- package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.scss +15 -0
- package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.ts +86 -0
- package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.module.ts +21 -0
- package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.html +4 -0
- package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.scss +0 -0
- package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.spec.ts +23 -0
- package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.ts +11 -0
- package/lib/ecabs-date-picker/ecabs-date-picker.component.html +31 -0
- package/lib/ecabs-date-picker/ecabs-date-picker.component.scss +10 -0
- package/lib/ecabs-date-picker/ecabs-date-picker.component.spec.ts +24 -0
- package/lib/ecabs-date-picker/ecabs-date-picker.component.ts +72 -0
- package/lib/ecabs-date-picker/ecabs-date-picker.module.ts +28 -0
- package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.html +4 -0
- package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.scss +1 -0
- package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.spec.ts +23 -0
- package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.ts +11 -0
- package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.html +31 -0
- package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.scss +23 -0
- package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.spec.ts +23 -0
- package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.ts +113 -0
- package/lib/ecabs-date-range-picker/ecabs-date-range-picker.module.ts +48 -0
- package/lib/ecabs-date-time-picker/components/ecabs-date-time-picker-header/ecabs-date-time-picker-header.component.html +4 -0
- package/lib/ecabs-date-time-picker/components/ecabs-date-time-picker-header/ecabs-date-time-picker-header.component.scss +14 -0
- package/lib/ecabs-date-time-picker/components/ecabs-date-time-picker-header/ecabs-date-time-picker-header.component.ts +11 -0
- package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.html +87 -0
- package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.scss +68 -0
- package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.spec.ts +23 -0
- package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.ts +185 -0
- package/lib/ecabs-date-time-picker/ecabs-date-time-picker.module.ts +36 -0
- package/lib/ecabs-date-time-range-picker/components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component.html +4 -0
- package/lib/ecabs-date-time-range-picker/components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component.scss +11 -0
- package/lib/ecabs-date-time-range-picker/components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component.spec.ts +23 -0
- package/lib/ecabs-date-time-range-picker/components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component.ts +10 -0
- package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.html +107 -0
- package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.scss +51 -0
- package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.spec.ts +24 -0
- package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.ts +206 -0
- package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.module.ts +37 -0
- package/lib/ecabs-date-time-range-picker/time-range.directive.ts +38 -0
- package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.component.html +32 -0
- package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.component.scss +24 -0
- package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.component.ts +57 -0
- package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.module.ts +12 -0
- package/lib/ecabs-dialog-message/ecabs-dialog-message.component.html +27 -0
- package/lib/ecabs-dialog-message/ecabs-dialog-message.component.scss +25 -0
- package/lib/ecabs-dialog-message/ecabs-dialog-message.component.spec.ts +38 -0
- package/lib/ecabs-dialog-message/ecabs-dialog-message.component.ts +49 -0
- package/lib/ecabs-dialog-message/ecabs-dialog-message.module.ts +12 -0
- package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.html +9 -0
- package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.scss +0 -0
- package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.spec.ts +34 -0
- package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.ts +22 -0
- package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.module.ts +11 -0
- package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.html +33 -0
- package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.scss +79 -0
- package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.spec.ts +26 -0
- package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.ts +77 -0
- package/lib/ecabs-expansion-panel/ecabs-expansion-panel.module.ts +16 -0
- package/lib/ecabs-increment/ecabs-increment.component.html +18 -0
- package/lib/ecabs-increment/ecabs-increment.component.scss +33 -0
- package/lib/ecabs-increment/ecabs-increment.component.ts +74 -0
- package/lib/ecabs-increment/ecabs-increment.module.ts +16 -0
- package/lib/ecabs-input/ecabs-input.component.html +27 -0
- package/lib/ecabs-input/ecabs-input.component.ts +86 -0
- package/lib/ecabs-input/ecabs-input.module.ts +14 -0
- package/lib/ecabs-language-selector/ecabs-language-selector.component.html +17 -0
- package/lib/ecabs-language-selector/ecabs-language-selector.component.scss +24 -0
- package/lib/ecabs-language-selector/ecabs-language-selector.component.ts +56 -0
- package/lib/ecabs-language-selector/ecabs-language-selector.module.ts +21 -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.ts +11 -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/lib/ecabs-note/ecabs-note.component.html +10 -0
- package/lib/ecabs-note/ecabs-note.component.scss +29 -0
- package/lib/ecabs-note/ecabs-note.component.ts +27 -0
- package/lib/ecabs-note/ecabs-note.module.ts +11 -0
- package/lib/ecabs-phone/ecabs-phone.component.html +17 -0
- package/lib/ecabs-phone/ecabs-phone.component.ts +108 -0
- package/lib/ecabs-phone/ecabs-phone.module.ts +15 -0
- package/lib/ecabs-picker-header/ecabs-picker-header.component.html +12 -0
- package/lib/ecabs-picker-header/ecabs-picker-header.component.scss +12 -0
- package/lib/ecabs-picker-header/ecabs-picker-header.component.ts +61 -0
- package/lib/ecabs-picker-header/ecabs-picker-header.module.ts +15 -0
- package/lib/ecabs-radio-button-list/ecabs-radio-button-list.component.html +13 -0
- package/lib/ecabs-radio-button-list/ecabs-radio-button-list.component.scss +16 -0
- package/lib/ecabs-radio-button-list/ecabs-radio-button-list.component.ts +60 -0
- package/lib/ecabs-radio-button-list/ecabs-radio-button-list.module.ts +20 -0
- package/lib/ecabs-select/ecabs-select.component.html +38 -0
- package/lib/ecabs-select/ecabs-select.component.ts +346 -0
- package/lib/ecabs-select/ecabs-select.module.ts +37 -0
- package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.html +7 -0
- package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.scss +11 -0
- package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.spec.ts +34 -0
- package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.ts +14 -0
- package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.module.ts +14 -0
- package/lib/ecabs-table/ecabs-table.component.html +26 -0
- package/lib/ecabs-table/ecabs-table.component.scss +6 -0
- package/lib/ecabs-table/ecabs-table.component.spec.ts +24 -0
- package/lib/ecabs-table/ecabs-table.component.ts +42 -0
- package/lib/ecabs-table/ecabs-table.module.ts +19 -0
- package/lib/ecabs-textarea/ecabs-textarea.component.html +13 -0
- package/lib/ecabs-textarea/ecabs-textarea.component.ts +61 -0
- package/lib/ecabs-textarea/ecabs-textarea.module.ts +12 -0
- package/lib/ecabs-timepicker/componets/ecabs-time-list-panel/ecabs-time-list-panel.component.html +16 -0
- package/lib/ecabs-timepicker/componets/ecabs-time-list-panel/ecabs-time-list-panel.component.ts +126 -0
- package/lib/ecabs-timepicker/config.model.ts +5 -0
- package/lib/ecabs-timepicker/ecabs-timepicker.component.html +36 -0
- package/lib/ecabs-timepicker/ecabs-timepicker.component.scss +5 -0
- package/lib/ecabs-timepicker/ecabs-timepicker.component.ts +330 -0
- package/lib/ecabs-timepicker/ecabs-timepicker.module.ts +12 -0
- package/lib/ecabs-timepicker/ecabs-timepicker.service.ts +28 -0
- package/lib/ecabs-validation/ecabs-validation.component.html +9 -0
- package/lib/ecabs-validation/ecabs-validation.component.scss +23 -0
- package/lib/ecabs-validation/ecabs-validation.component.ts +14 -0
- package/lib/ecabs-validation/ecabs-validation.module.ts +12 -0
- package/lib/models/bread-crumb.ts +5 -0
- package/lib/models/language.models.ts +0 -0
- package/lib/models/timepicker.models.ts +7 -0
- package/lib/models/validation.models.ts +4 -0
- package/lib/services/ecabs-components.service.ts +33 -0
- package/package.json +1 -1
- package/public-api.ts +58 -0
- package/styles/material/overrides/_form.scss +5 -0
- package/test.ts +27 -0
|
@@ -0,0 +1,86 @@
|
|
|
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
|
+
@Input()
|
|
20
|
+
digitsOnly!: boolean;
|
|
21
|
+
|
|
22
|
+
@Input()
|
|
23
|
+
allowDecimal!: boolean;
|
|
24
|
+
|
|
25
|
+
@Input()
|
|
26
|
+
allowHyphen!: boolean;
|
|
27
|
+
|
|
28
|
+
@Input() max!: number;
|
|
29
|
+
@Input() min!: 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
|
+
|
|
44
|
+
if ( this.getData()?.control?.updateOn !== 'blur' ) {
|
|
45
|
+
this.onTouch( val );
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
constructor( private injector: Injector ) {
|
|
51
|
+
super();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
ngOnInit(): void {
|
|
55
|
+
if ( this.type === 'number' ) {
|
|
56
|
+
this.digitsOnly = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ngAfterViewInit(): void {
|
|
61
|
+
const ngControl: NgControl = this.injector.get( NgControl, null ) as NgControl;
|
|
62
|
+
if ( ngControl ) {
|
|
63
|
+
this.control = ngControl.control as UntypedFormControl;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
onChange: any = () => { };
|
|
68
|
+
|
|
69
|
+
onTouch: any = () => { };
|
|
70
|
+
|
|
71
|
+
writeValue( value: any ): void {
|
|
72
|
+
this.value = value;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
registerOnChange( fn: any ): void {
|
|
76
|
+
this.onChange = fn;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
registerOnTouched( fn: any ): void {
|
|
80
|
+
this.onTouch = fn;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
blurChange( e: any ): void {
|
|
84
|
+
this.onblur.emit( e );
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -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 { DigitsOnlyDirectivesModule } from '../base/directives/digits-only.directive.module';
|
|
8
|
+
|
|
9
|
+
@NgModule( {
|
|
10
|
+
declarations: [ EcabsInputComponent ],
|
|
11
|
+
imports: [ CommonModule, MatInputModule, ElementWrapperModule, FormsModule, DigitsOnlyDirectivesModule ],
|
|
12
|
+
exports: [ EcabsInputComponent ],
|
|
13
|
+
} )
|
|
14
|
+
export class EcabsInputModule { }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<mat-form-field [ngClass]="{'flag-only': flagOnly}">
|
|
2
|
+
<mat-select class="capitalize" [(ngModel)]="selectedLang" name="language" (ngModelChange)="toggleLang()"
|
|
3
|
+
panelClass="wide-select">
|
|
4
|
+
<mat-select-trigger>
|
|
5
|
+
<div class="flex items-center" [matTooltip]="tooltip" [matTooltipDisabled]="!flagOnly || !tooltip">
|
|
6
|
+
<span [ngClass]="flagClass(matchSelected())"></span>
|
|
7
|
+
<div *ngIf="!flagOnly" class="ml-2">{{standardLang(matchSelected())}}</div>
|
|
8
|
+
</div>
|
|
9
|
+
</mat-select-trigger>
|
|
10
|
+
<mat-option class="capitalize" *ngFor="let lang of languages" [value]="lang">
|
|
11
|
+
<div class="flex items-center">
|
|
12
|
+
<span [ngClass]="flagClass(lang)"></span>
|
|
13
|
+
<div class="ml-2">{{standardLang(lang) | titlecase}}</div>
|
|
14
|
+
</div>
|
|
15
|
+
</mat-option>
|
|
16
|
+
</mat-select>
|
|
17
|
+
</mat-form-field>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
:host::ng-deep {
|
|
2
|
+
.mat-select {
|
|
3
|
+
padding: 0;
|
|
4
|
+
border: 0;
|
|
5
|
+
|
|
6
|
+
.mat-select-arrow {
|
|
7
|
+
border: none;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&, .mat-option {
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.mat-form-field-infix {
|
|
16
|
+
width: auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.flag-only {
|
|
20
|
+
.mat-select .mat-select-arrow-wrapper {
|
|
21
|
+
width: 0;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component( {
|
|
4
|
+
selector: 'ecabs-language-selector',
|
|
5
|
+
templateUrl: './ecabs-language-selector.component.html',
|
|
6
|
+
styleUrls: [ './ecabs-language-selector.component.scss' ],
|
|
7
|
+
} )
|
|
8
|
+
export class EcabsLanguageSelectorComponent implements OnChanges {
|
|
9
|
+
@Input()
|
|
10
|
+
languages: string[] = [];
|
|
11
|
+
|
|
12
|
+
@Input()
|
|
13
|
+
currentLanguage: string;
|
|
14
|
+
|
|
15
|
+
@Input()
|
|
16
|
+
flagOnly: boolean;
|
|
17
|
+
|
|
18
|
+
@Input()
|
|
19
|
+
tooltip: string;
|
|
20
|
+
|
|
21
|
+
@Output()
|
|
22
|
+
languageChanged: EventEmitter<string> = new EventEmitter<string>();
|
|
23
|
+
|
|
24
|
+
selectedLang: string;
|
|
25
|
+
|
|
26
|
+
ngOnChanges(): void {
|
|
27
|
+
this.selectedLang = this.currentLanguage;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
toggleLang(): void {
|
|
31
|
+
return this.matchSelected() ? this.languageChanged.emit( this.matchSelected() ) : undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
matchSelected(): string {
|
|
35
|
+
return this.languages?.find( ( lang ) => lang === this.selectedLang );
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
standardLang( code: string ): string {
|
|
39
|
+
return this.standardise( code );
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
flagClass( lang: string ): string {
|
|
43
|
+
return `fi fi-${ lang?.slice( -2 ).toLowerCase() }`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private standardise( code: string ): string {
|
|
47
|
+
if ( !code ) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
const lang = new Intl.DisplayNames( [ code ], {
|
|
51
|
+
type: 'language',
|
|
52
|
+
languageDisplay: 'standard',
|
|
53
|
+
} );
|
|
54
|
+
return lang.of( code );
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { EcabsLanguageSelectorComponent } from './ecabs-language-selector.component';
|
|
4
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
6
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
7
|
+
import {MatTooltipModule} from "@angular/material/tooltip";
|
|
8
|
+
|
|
9
|
+
@NgModule( {
|
|
10
|
+
declarations: [ EcabsLanguageSelectorComponent ],
|
|
11
|
+
imports: [
|
|
12
|
+
CommonModule,
|
|
13
|
+
MatSelectModule,
|
|
14
|
+
MatFormFieldModule,
|
|
15
|
+
FormsModule,
|
|
16
|
+
ReactiveFormsModule,
|
|
17
|
+
MatTooltipModule
|
|
18
|
+
],
|
|
19
|
+
exports: [ EcabsLanguageSelectorComponent ],
|
|
20
|
+
} )
|
|
21
|
+
export class EcabsLanguageSelectorModule { }
|
|
@@ -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-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,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,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
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'ecabs-loading-spinner',
|
|
5
|
+
templateUrl: './spinner.component.html',
|
|
6
|
+
styleUrls: ['./spinner.component.scss'],
|
|
7
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
8
|
+
})
|
|
9
|
+
export class EcabsSpinnerComponent {
|
|
10
|
+
@Input() size: 'large' | 'medium' | 'tiny' = 'medium';
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
@import './../../styles/scss/utilities/index';
|
|
2
|
+
|
|
3
|
+
.note {
|
|
4
|
+
border-radius: $border-radius-base;
|
|
5
|
+
|
|
6
|
+
.mat-icon {
|
|
7
|
+
color: inherit;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@include m(danger) {
|
|
11
|
+
color: var(--color-error);
|
|
12
|
+
background-color: var(--color-error-opacity);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@include m(warn) {
|
|
16
|
+
background-color: var(--color-warning-opacity);
|
|
17
|
+
color: var(--color-warn);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@include m(success) {
|
|
21
|
+
background-color: rgba(var(--color-success-rgb), .06);
|
|
22
|
+
color: var(--color-success);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@include m(default) {
|
|
26
|
+
background-color: rgba(var(--color-info-rgb), .06);
|
|
27
|
+
color: var(--color-info);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Component, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component( {
|
|
4
|
+
selector: 'ecabs-note',
|
|
5
|
+
templateUrl: './ecabs-note.component.html',
|
|
6
|
+
styleUrls: [ './ecabs-note.component.scss' ],
|
|
7
|
+
} )
|
|
8
|
+
export class NoteComponent {
|
|
9
|
+
@Input()
|
|
10
|
+
type: 'default' | 'danger' | 'warn' | 'success' = 'default';
|
|
11
|
+
|
|
12
|
+
get classByType(): string {
|
|
13
|
+
switch ( this.type ) {
|
|
14
|
+
case 'warn':
|
|
15
|
+
return 'note--warn';
|
|
16
|
+
|
|
17
|
+
case 'danger':
|
|
18
|
+
return 'note--danger';
|
|
19
|
+
|
|
20
|
+
case 'success':
|
|
21
|
+
return 'note--success';
|
|
22
|
+
|
|
23
|
+
default:
|
|
24
|
+
return 'note--default';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
4
|
+
import { NoteComponent } from './ecabs-note.component';
|
|
5
|
+
|
|
6
|
+
@NgModule( {
|
|
7
|
+
declarations: [ NoteComponent ],
|
|
8
|
+
imports: [ CommonModule, MatIconModule ],
|
|
9
|
+
exports: [ NoteComponent ],
|
|
10
|
+
} )
|
|
11
|
+
export class NoteModule { }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<app-element-wrapper [data]="getData()">
|
|
2
|
+
<form #f="ngForm" [formGroup]="phoneForm">
|
|
3
|
+
<ngx-mat-intl-tel-input
|
|
4
|
+
(focusout)="onBlur()"
|
|
5
|
+
[ngClass]="{ error: phoneForm.invalid && (phoneForm.dirty || phoneForm.touched) }"
|
|
6
|
+
#phoneInput
|
|
7
|
+
[preferredCountries]="preferredCountries"
|
|
8
|
+
[enablePlaceholder]="enablePlaceholder"
|
|
9
|
+
[enableSearch]="enableSearch"
|
|
10
|
+
[disabled]="disabled"
|
|
11
|
+
[formControlName]="'phone'"
|
|
12
|
+
name="phone"
|
|
13
|
+
[inputPlaceholder]="placeholder"
|
|
14
|
+
>
|
|
15
|
+
</ngx-mat-intl-tel-input>
|
|
16
|
+
</form>
|
|
17
|
+
</app-element-wrapper>
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { AfterViewInit, Component, HostListener, Injector, Input, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
ControlValueAccessor,
|
|
4
|
+
UntypedFormControl,
|
|
5
|
+
UntypedFormGroup,
|
|
6
|
+
NG_VALUE_ACCESSOR,
|
|
7
|
+
Validators,
|
|
8
|
+
NgControl,
|
|
9
|
+
} from '@angular/forms';
|
|
10
|
+
import { NgxMatIntlTelInputComponent } from 'ngx-mat-intl-tel-input';
|
|
11
|
+
import ElementBaseComponent from '../base/element-base';
|
|
12
|
+
|
|
13
|
+
@Component( {
|
|
14
|
+
selector: 'ecabs-phone',
|
|
15
|
+
templateUrl: './ecabs-phone.component.html',
|
|
16
|
+
providers: [
|
|
17
|
+
{
|
|
18
|
+
provide: NG_VALUE_ACCESSOR,
|
|
19
|
+
useExisting: EcabsPhoneComponent,
|
|
20
|
+
multi: true,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
} )
|
|
24
|
+
export class EcabsPhoneComponent
|
|
25
|
+
extends ElementBaseComponent
|
|
26
|
+
implements ControlValueAccessor, AfterViewInit, OnDestroy, OnInit {
|
|
27
|
+
@Input() preferredCountries!: string[];
|
|
28
|
+
@Input() enablePlaceholder!: boolean;
|
|
29
|
+
@Input() enableSearch: boolean = true;
|
|
30
|
+
@Input() useOnlyDisabledClass = false;
|
|
31
|
+
@Input() override required = false;
|
|
32
|
+
|
|
33
|
+
@ViewChild( 'phoneInput' )
|
|
34
|
+
phoneInput!: NgxMatIntlTelInputComponent;
|
|
35
|
+
|
|
36
|
+
phoneForm: UntypedFormGroup;
|
|
37
|
+
phoneSub!: any;
|
|
38
|
+
prohibitedCharacters = [ '-' ];
|
|
39
|
+
|
|
40
|
+
get value(): any {
|
|
41
|
+
return this.phoneForm.get( 'phone' )?.value;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
set value( val ) {
|
|
45
|
+
if ( val !== undefined && this.value !== val ) {
|
|
46
|
+
this.phoneForm.setValue( { phone: val } );
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
constructor( private readonly injector: Injector ) {
|
|
51
|
+
super();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@HostListener( 'keypress', [ '$event' ] ) onInput( event: KeyboardEvent ): void {
|
|
55
|
+
if ( this.prohibitedCharacters.includes( event.key ) ) {
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ngOnInit(): void {
|
|
61
|
+
this.phoneForm = new UntypedFormGroup( {
|
|
62
|
+
phone: new UntypedFormControl( undefined, this.required ? [ Validators.required ] : [] ),
|
|
63
|
+
} );
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
ngAfterViewInit(): void {
|
|
67
|
+
const ngControl: NgControl = this.injector.get( NgControl, null );
|
|
68
|
+
if ( ngControl ) {
|
|
69
|
+
this.control = ngControl.control as UntypedFormControl;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.phoneSub = this.phoneForm.valueChanges.subscribe( ( formVal ) => {
|
|
73
|
+
this.value = formVal?.phone;
|
|
74
|
+
this.onChange( this.value );
|
|
75
|
+
this.onTouch( this.value );
|
|
76
|
+
this.control.setErrors( this.phoneForm.get( 'phone' ).errors );
|
|
77
|
+
} );
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
onChange: any = (): void => { };
|
|
81
|
+
onTouch: any = (): void => { };
|
|
82
|
+
|
|
83
|
+
writeValue( value: any ): void {
|
|
84
|
+
this.value = value;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
registerOnChange( fn: any ): void {
|
|
88
|
+
this.onChange = fn;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
registerOnTouched( fn: any ): void {
|
|
92
|
+
this.onTouch = fn;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
ngOnDestroy(): void {
|
|
96
|
+
this.phoneSub?.unsubscribe();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
reset(): void {
|
|
100
|
+
this.phoneInput.reset();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
onBlur(): void {
|
|
104
|
+
this.control.setErrors( this.phoneForm.get( 'phone' ).errors );
|
|
105
|
+
this.onTouch( this.value );
|
|
106
|
+
this.onChange( this.value );
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
|
+
import { MatInputModule } from '@angular/material/input';
|
|
5
|
+
import { NgxMatIntlTelInputComponent } from 'ngx-mat-intl-tel-input';
|
|
6
|
+
|
|
7
|
+
import { ElementWrapperModule } from '../base/element-wrapper/element-wrapper.module';
|
|
8
|
+
import { EcabsPhoneComponent } from './ecabs-phone.component';
|
|
9
|
+
|
|
10
|
+
@NgModule( {
|
|
11
|
+
declarations: [ EcabsPhoneComponent ],
|
|
12
|
+
imports: [ CommonModule, MatInputModule, ElementWrapperModule, FormsModule, NgxMatIntlTelInputComponent, ReactiveFormsModule ],
|
|
13
|
+
exports: [ EcabsPhoneComponent ],
|
|
14
|
+
} )
|
|
15
|
+
export class EcabsPhoneModule { }
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<div class="header">
|
|
2
|
+
<button mat-icon-button (click)="previousClicked()">
|
|
3
|
+
<mat-icon>keyboard_arrow_left</mat-icon>
|
|
4
|
+
</button>
|
|
5
|
+
<button mat-flat-button (click)="currentPeriodClicked()">
|
|
6
|
+
<span >{{ periodLabel }}</span>
|
|
7
|
+
</button>
|
|
8
|
+
|
|
9
|
+
<button mat-icon-button (click)="nextClicked()">
|
|
10
|
+
<mat-icon>keyboard_arrow_right</mat-icon>
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|