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.
Files changed (172) hide show
  1. package/assets/images/nothing-here.svg +22 -0
  2. package/esm2020/lib/base/directives/digits-only.directive.mjs +2 -2
  3. package/esm2020/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.mjs +9 -5
  4. package/esm2020/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.mjs +1 -1
  5. package/esm2020/lib/ecabs-increment/ecabs-increment.component.mjs +2 -2
  6. package/esm2020/lib/ecabs-picker-header/ecabs-picker-header.component.mjs +2 -2
  7. package/fesm2015/ecabs-components.mjs +14 -10
  8. package/fesm2015/ecabs-components.mjs.map +1 -1
  9. package/fesm2020/ecabs-components.mjs +14 -10
  10. package/fesm2020/ecabs-components.mjs.map +1 -1
  11. package/lib/base/consts/date-mask.consts.ts +70 -0
  12. package/lib/base/directives/date-mask.directive.module.ts +15 -0
  13. package/lib/base/directives/date-mask.directive.ts +58 -0
  14. package/lib/base/directives/digits-only.directive.module.ts +15 -0
  15. package/lib/base/directives/digits-only.directive.ts +129 -0
  16. package/lib/base/directives/number-border.directive.module.ts +14 -0
  17. package/lib/base/directives/number-border.directive.ts +57 -0
  18. package/lib/base/element-base.ts +72 -0
  19. package/lib/base/element-wrapper/element-wrapper.component.html +30 -0
  20. package/lib/base/element-wrapper/element-wrapper.component.ts +33 -0
  21. package/lib/base/element-wrapper/element-wrapper.module.ts +30 -0
  22. package/lib/base/hint/hint.component.html +1 -0
  23. package/lib/base/hint/hint.component.scss +0 -0
  24. package/lib/base/hint/hint.component.ts +12 -0
  25. package/lib/base/hint/hint.module.ts +13 -0
  26. package/lib/base/validation/validation.component.html +8 -0
  27. package/lib/base/validation/validation.component.scss +0 -0
  28. package/lib/base/validation/validation.component.ts +84 -0
  29. package/lib/base/validation/validation.module.ts +12 -0
  30. package/lib/ecabs-active-status-filter/ecabs-active-status-filter.component.html +14 -0
  31. package/lib/ecabs-active-status-filter/ecabs-active-status-filter.component.scss +16 -0
  32. package/lib/ecabs-active-status-filter/ecabs-active-status-filter.component.ts +23 -0
  33. package/lib/ecabs-active-status-filter/ecabs-active-status-filter.module.ts +13 -0
  34. package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.html +11 -0
  35. package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.scss +0 -0
  36. package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.spec.ts +24 -0
  37. package/lib/ecabs-breadcrumb/ecabs-breadcrumb.component.ts +12 -0
  38. package/lib/ecabs-breadcrumb/ecabs-breadcrumb.module.ts +12 -0
  39. package/lib/ecabs-buttons/ecabs-buttons.component.html +18 -0
  40. package/lib/ecabs-buttons/ecabs-buttons.component.ts +54 -0
  41. package/lib/ecabs-buttons/ecabs-buttons.module.ts +13 -0
  42. package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.d.ts +5 -3
  43. package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.html +27 -0
  44. package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.scss +15 -0
  45. package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.component.ts +86 -0
  46. package/lib/ecabs-checkbox-toggle/ecabs-checkbox-toggle.module.ts +21 -0
  47. package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.html +4 -0
  48. package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.scss +0 -0
  49. package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.spec.ts +23 -0
  50. package/lib/ecabs-date-picker/components/ecabs-date-picker-header/ecabs-date-picker-header.component.ts +11 -0
  51. package/lib/ecabs-date-picker/ecabs-date-picker.component.html +31 -0
  52. package/lib/ecabs-date-picker/ecabs-date-picker.component.scss +10 -0
  53. package/lib/ecabs-date-picker/ecabs-date-picker.component.spec.ts +24 -0
  54. package/lib/ecabs-date-picker/ecabs-date-picker.component.ts +72 -0
  55. package/lib/ecabs-date-picker/ecabs-date-picker.module.ts +28 -0
  56. package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.html +4 -0
  57. package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.scss +1 -0
  58. package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.spec.ts +23 -0
  59. package/lib/ecabs-date-range-picker/components/ecabs-date-range-picker-header/ecabs-date-range-picker-header.component.ts +11 -0
  60. package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.html +31 -0
  61. package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.scss +23 -0
  62. package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.spec.ts +23 -0
  63. package/lib/ecabs-date-range-picker/ecabs-date-range-picker.component.ts +113 -0
  64. package/lib/ecabs-date-range-picker/ecabs-date-range-picker.module.ts +48 -0
  65. package/lib/ecabs-date-time-picker/components/ecabs-date-time-picker-header/ecabs-date-time-picker-header.component.html +4 -0
  66. package/lib/ecabs-date-time-picker/components/ecabs-date-time-picker-header/ecabs-date-time-picker-header.component.scss +14 -0
  67. package/lib/ecabs-date-time-picker/components/ecabs-date-time-picker-header/ecabs-date-time-picker-header.component.ts +11 -0
  68. package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.html +87 -0
  69. package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.scss +68 -0
  70. package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.spec.ts +23 -0
  71. package/lib/ecabs-date-time-picker/ecabs-date-time-picker.component.ts +185 -0
  72. package/lib/ecabs-date-time-picker/ecabs-date-time-picker.module.ts +36 -0
  73. package/lib/ecabs-date-time-range-picker/components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component.html +4 -0
  74. package/lib/ecabs-date-time-range-picker/components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component.scss +11 -0
  75. 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
  76. package/lib/ecabs-date-time-range-picker/components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component.ts +10 -0
  77. package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.html +107 -0
  78. package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.scss +51 -0
  79. package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.spec.ts +24 -0
  80. package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.component.ts +206 -0
  81. package/lib/ecabs-date-time-range-picker/ecabs-date-time-range-picker.module.ts +37 -0
  82. package/lib/ecabs-date-time-range-picker/time-range.directive.ts +38 -0
  83. package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.component.html +32 -0
  84. package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.component.scss +24 -0
  85. package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.component.ts +57 -0
  86. package/lib/ecabs-dialog-confirm/ecabs-dialog-confirm.module.ts +12 -0
  87. package/lib/ecabs-dialog-message/ecabs-dialog-message.component.html +27 -0
  88. package/lib/ecabs-dialog-message/ecabs-dialog-message.component.scss +25 -0
  89. package/lib/ecabs-dialog-message/ecabs-dialog-message.component.spec.ts +38 -0
  90. package/lib/ecabs-dialog-message/ecabs-dialog-message.component.ts +49 -0
  91. package/lib/ecabs-dialog-message/ecabs-dialog-message.module.ts +12 -0
  92. package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.html +9 -0
  93. package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.scss +0 -0
  94. package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.spec.ts +34 -0
  95. package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.component.ts +22 -0
  96. package/lib/ecabs-empty-placeholder/ecabs-empty-placeholder.module.ts +11 -0
  97. package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.html +33 -0
  98. package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.scss +79 -0
  99. package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.spec.ts +26 -0
  100. package/lib/ecabs-expansion-panel/ecabs-expansion-panel.component.ts +77 -0
  101. package/lib/ecabs-expansion-panel/ecabs-expansion-panel.module.ts +16 -0
  102. package/lib/ecabs-increment/ecabs-increment.component.html +18 -0
  103. package/lib/ecabs-increment/ecabs-increment.component.scss +33 -0
  104. package/lib/ecabs-increment/ecabs-increment.component.ts +74 -0
  105. package/lib/ecabs-increment/ecabs-increment.module.ts +16 -0
  106. package/lib/ecabs-input/ecabs-input.component.html +27 -0
  107. package/lib/ecabs-input/ecabs-input.component.ts +86 -0
  108. package/lib/ecabs-input/ecabs-input.module.ts +14 -0
  109. package/lib/ecabs-language-selector/ecabs-language-selector.component.html +17 -0
  110. package/lib/ecabs-language-selector/ecabs-language-selector.component.scss +24 -0
  111. package/lib/ecabs-language-selector/ecabs-language-selector.component.ts +56 -0
  112. package/lib/ecabs-language-selector/ecabs-language-selector.module.ts +21 -0
  113. package/lib/ecabs-loading/ecabs-loading.component.html +7 -0
  114. package/lib/ecabs-loading/ecabs-loading.component.spec.ts +24 -0
  115. package/lib/ecabs-loading/ecabs-loading.component.ts +11 -0
  116. package/lib/ecabs-loading/ecabs-loading.module.ts +11 -0
  117. package/lib/ecabs-loading/spinner/spinner.component.html +5 -0
  118. package/lib/ecabs-loading/spinner/spinner.component.scss +61 -0
  119. package/lib/ecabs-loading/spinner/spinner.component.spec.ts +24 -0
  120. package/lib/ecabs-loading/spinner/spinner.component.ts +11 -0
  121. package/lib/ecabs-note/ecabs-note.component.html +10 -0
  122. package/lib/ecabs-note/ecabs-note.component.scss +29 -0
  123. package/lib/ecabs-note/ecabs-note.component.ts +27 -0
  124. package/lib/ecabs-note/ecabs-note.module.ts +11 -0
  125. package/lib/ecabs-phone/ecabs-phone.component.html +17 -0
  126. package/lib/ecabs-phone/ecabs-phone.component.ts +108 -0
  127. package/lib/ecabs-phone/ecabs-phone.module.ts +15 -0
  128. package/lib/ecabs-picker-header/ecabs-picker-header.component.html +12 -0
  129. package/lib/ecabs-picker-header/ecabs-picker-header.component.scss +12 -0
  130. package/lib/ecabs-picker-header/ecabs-picker-header.component.ts +61 -0
  131. package/lib/ecabs-picker-header/ecabs-picker-header.module.ts +15 -0
  132. package/lib/ecabs-radio-button-list/ecabs-radio-button-list.component.html +13 -0
  133. package/lib/ecabs-radio-button-list/ecabs-radio-button-list.component.scss +16 -0
  134. package/lib/ecabs-radio-button-list/ecabs-radio-button-list.component.ts +60 -0
  135. package/lib/ecabs-radio-button-list/ecabs-radio-button-list.module.ts +20 -0
  136. package/lib/ecabs-select/ecabs-select.component.html +38 -0
  137. package/lib/ecabs-select/ecabs-select.component.ts +346 -0
  138. package/lib/ecabs-select/ecabs-select.module.ts +37 -0
  139. package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.html +7 -0
  140. package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.scss +11 -0
  141. package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.spec.ts +34 -0
  142. package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.component.ts +14 -0
  143. package/lib/ecabs-table/ecabs-table-filter-wrapper/ecabs-table-filter-wrapper.module.ts +14 -0
  144. package/lib/ecabs-table/ecabs-table.component.html +26 -0
  145. package/lib/ecabs-table/ecabs-table.component.scss +6 -0
  146. package/lib/ecabs-table/ecabs-table.component.spec.ts +24 -0
  147. package/lib/ecabs-table/ecabs-table.component.ts +42 -0
  148. package/lib/ecabs-table/ecabs-table.module.ts +19 -0
  149. package/lib/ecabs-textarea/ecabs-textarea.component.html +13 -0
  150. package/lib/ecabs-textarea/ecabs-textarea.component.ts +61 -0
  151. package/lib/ecabs-textarea/ecabs-textarea.module.ts +12 -0
  152. package/lib/ecabs-timepicker/componets/ecabs-time-list-panel/ecabs-time-list-panel.component.html +16 -0
  153. package/lib/ecabs-timepicker/componets/ecabs-time-list-panel/ecabs-time-list-panel.component.ts +126 -0
  154. package/lib/ecabs-timepicker/config.model.ts +5 -0
  155. package/lib/ecabs-timepicker/ecabs-timepicker.component.html +36 -0
  156. package/lib/ecabs-timepicker/ecabs-timepicker.component.scss +5 -0
  157. package/lib/ecabs-timepicker/ecabs-timepicker.component.ts +330 -0
  158. package/lib/ecabs-timepicker/ecabs-timepicker.module.ts +12 -0
  159. package/lib/ecabs-timepicker/ecabs-timepicker.service.ts +28 -0
  160. package/lib/ecabs-validation/ecabs-validation.component.html +9 -0
  161. package/lib/ecabs-validation/ecabs-validation.component.scss +23 -0
  162. package/lib/ecabs-validation/ecabs-validation.component.ts +14 -0
  163. package/lib/ecabs-validation/ecabs-validation.module.ts +12 -0
  164. package/lib/models/bread-crumb.ts +5 -0
  165. package/lib/models/language.models.ts +0 -0
  166. package/lib/models/timepicker.models.ts +7 -0
  167. package/lib/models/validation.models.ts +4 -0
  168. package/lib/services/ecabs-components.service.ts +33 -0
  169. package/package.json +1 -1
  170. package/public-api.ts +58 -0
  171. package/styles/material/overrides/_form.scss +5 -0
  172. package/test.ts +27 -0
@@ -0,0 +1,4 @@
1
+ <div class="select-date-label text-xl font-semibold">
2
+ {{ headerLabel }}
3
+ </div>
4
+ <ecabs-picker-header ></ecabs-picker-header>
@@ -0,0 +1,11 @@
1
+ :host ::ng-deep {
2
+ ecabs-picker-header{
3
+ display: none !important;
4
+ }
5
+ }
6
+
7
+ :host ::ng-deep {
8
+ .mat-calendar{
9
+ height: 50px !important;
10
+ }
11
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { EcabsDateTimeRangePickerHeaderComponent } from './ecabs-date-time-range-picker-header.component';
4
+
5
+ describe('FormDateTimeRangePickerHeaderComponent', () => {
6
+ let component: EcabsDateTimeRangePickerHeaderComponent;
7
+ let fixture: ComponentFixture<EcabsDateTimeRangePickerHeaderComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+
12
+ declarations: [EcabsDateTimeRangePickerHeaderComponent],
13
+ }).compileComponents();
14
+
15
+ fixture = TestBed.createComponent(EcabsDateTimeRangePickerHeaderComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,10 @@
1
+ import { Component, Input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'ecabs-date-time-range-picker-header',
5
+ templateUrl: './ecabs-date-time-range-picker-header.component.html',
6
+ styleUrls: ['./ecabs-date-time-range-picker-header.component.scss'],
7
+ })
8
+ export class EcabsDateTimeRangePickerHeaderComponent {
9
+ @Input() headerLabel = 'Applicable times';
10
+ }
@@ -0,0 +1,107 @@
1
+ <app-element-wrapper [data]="getData()">
2
+ <div class="form-field__input--wrapper w-full">
3
+ <input
4
+ class="fake-input"
5
+ [id]="_date"
6
+ [(ngModel)]="_date"
7
+ [placeholder]="placeholder"
8
+ [disabled]="disabled || controlDate?.disabled"
9
+ [matDatepicker]="picker"
10
+ (blur)="onTouch()"
11
+ />
12
+ <mat-datepicker (opened)="opened()" #picker [calendarHeaderComponent]="header" [touchUi]="touchUi">
13
+
14
+ <mat-datepicker-actions>
15
+ <div class="flex flex-col w-full gap-y-4">
16
+ <div class="flex gap-2 justify-center items-center">
17
+ <div class="flex flex-col justify-center">
18
+ <div class="text-center">{{from}}</div>
19
+ <div class="flex gap-2 justify-center items-center">
20
+ <input
21
+ class="block form-field__input time"
22
+ appDigitsOnly
23
+ appNumberBorder
24
+ [digitsOnly]="true"
25
+ [id]="hoursFrom"
26
+ [maxValue]="maxValueHours"
27
+ [(ngModel)]="hoursFrom"
28
+ />
29
+
30
+ <span class="font-bold">:</span>
31
+ <input
32
+ class="form-field__input time"
33
+ [id]="minutesFrom"
34
+ [(ngModel)]="minutesFrom"
35
+ appDigitsOnly
36
+ appNumberBorder
37
+ [digitsOnly]="true"
38
+ [maxValue]="maxValueMinutesSeconds"
39
+ />
40
+ </div>
41
+ </div>
42
+ </div>
43
+ <div class="time--inputs"></div>
44
+ <div class="flex gap-2 justify-center items-center mb-5">
45
+ <div class="flex flex-col justify-center">
46
+ <div class="text-center">{{to}}</div>
47
+ <div class="flex gap-2 justify-center items-center">
48
+ <input
49
+ class="form-field__input time"
50
+ appDigitsOnly
51
+ appNumberBorder
52
+ [digitsOnly]="true"
53
+ [id]="hoursTo"
54
+ [maxValue]="maxValueHours"
55
+ [(ngModel)]="hoursTo"
56
+ />
57
+ <span class="font-bold">:</span>
58
+ <input
59
+ class="form-field__input time"
60
+ [id]="minutesTo"
61
+ [(ngModel)]="minutesTo"
62
+ appDigitsOnly
63
+ appNumberBorder
64
+ [digitsOnly]="true"
65
+ [maxValue]="maxValueMinutesSeconds"
66
+ />
67
+ </div>
68
+ </div>
69
+ </div>
70
+ <div class="grid-picker-actions">
71
+ <button type="button" mat-stroked-button class="w-full cancel-button" color="primary" matDatepickerCancel>
72
+ {{ cancleLabel }}
73
+ </button>
74
+
75
+ <button
76
+ type="button"
77
+ mat-button
78
+ class="w-full ml-0 apply-button"
79
+ color="primary"
80
+ matDatepickerApply
81
+ (click)="onApply()"
82
+ >
83
+ {{ applyLabel }}
84
+ </button>
85
+ </div>
86
+ </div>
87
+ </mat-datepicker-actions>
88
+ </mat-datepicker>
89
+ <input
90
+ class="form-field__input w-full date-input"
91
+ [id]="name"
92
+ [(ngModel)]="pickerValue"
93
+ [placeholder]="placeholder"
94
+ [disabled]="disabled || controlDate?.disabled"
95
+ appTimeRange
96
+ [all]="all"
97
+ (blur)="onTouch()"
98
+ (blur)="blurChange($event)"
99
+ (keyup)="blurChange($event)"
100
+ (keydown)="keydownChange($event)"
101
+ />
102
+ <button type="button" class="datepicker-toggle" (click)="picker.open()">
103
+ <mat-icon>access_time</mat-icon>
104
+ </button>
105
+ </div>
106
+ </app-element-wrapper>
107
+
@@ -0,0 +1,51 @@
1
+ @import "./../../styles/scss/utilities/helpers";
2
+
3
+ .datepicker-toggle {
4
+ transform: translateX(-1.75rem);
5
+ }
6
+
7
+ .time {
8
+ width: 3.375rem;
9
+ }
10
+
11
+ .fake-input {
12
+ visibility: hidden;
13
+ width: 0;
14
+ padding: 0;
15
+ }
16
+
17
+ .date-input {
18
+ margin: 0rem -0.25rem 0rem 0.125rem;
19
+ }
20
+
21
+ .time--inputs {
22
+ position: relative;
23
+ margin-bottom: 2.4rem;
24
+
25
+ &::after {
26
+ @extend %pseudos;
27
+ height: 1px;
28
+ right: 0;
29
+ left: 0;
30
+ background-color: var(--color-gray-300);
31
+ }
32
+
33
+ &::after {
34
+ bottom: -1.6rem;
35
+ }
36
+ }
37
+
38
+ :host ::ng-deep {
39
+ .form-field {
40
+ margin-right: -1.25rem;
41
+ margin-left: -0.125rem;
42
+ }
43
+ }
44
+
45
+ :host ::ng-deep {
46
+ .mat-datepicker-content .mat-calendar{
47
+ height: 50px !important;
48
+ }
49
+ }
50
+
51
+
@@ -0,0 +1,24 @@
1
+ import { DecimalPipe } from '@angular/common';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+
4
+ import { EcabsDateTimeRangePickerComponent } from './ecabs-date-time-range-picker.component';
5
+
6
+ describe('FormDateTimeRangePickerComponent', () => {
7
+ let component: EcabsDateTimeRangePickerComponent;
8
+ let fixture: ComponentFixture<EcabsDateTimeRangePickerComponent>;
9
+
10
+ beforeEach(async () => {
11
+ await TestBed.configureTestingModule({
12
+ declarations: [EcabsDateTimeRangePickerComponent],
13
+ providers: [DecimalPipe],
14
+ }).compileComponents();
15
+
16
+ fixture = TestBed.createComponent(EcabsDateTimeRangePickerComponent);
17
+ component = fixture.componentInstance;
18
+ fixture.detectChanges();
19
+ });
20
+
21
+ it('should create', () => {
22
+ expect(component).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,206 @@
1
+ import { DecimalPipe } from '@angular/common';
2
+ import { AfterViewInit, Component, EventEmitter, Injector, Input, Output } from '@angular/core';
3
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR, NgControl, UntypedFormControl } from '@angular/forms';
4
+ import ElementBaseComponent from '../base/element-base';
5
+ import { EcabsDateTimeRangePickerHeaderComponent } from './components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component';
6
+
7
+ @Component({
8
+ selector: 'ecabs-date-time-range-picker',
9
+ templateUrl: './ecabs-date-time-range-picker.component.html',
10
+ styleUrls: ['./ecabs-date-time-range-picker.component.scss'],
11
+ providers: [
12
+ {
13
+ provide: NG_VALUE_ACCESSOR,
14
+ useExisting: EcabsDateTimeRangePickerComponent,
15
+ multi: true,
16
+ },
17
+ DecimalPipe,
18
+ ],
19
+ })
20
+ export class EcabsDateTimeRangePickerComponent
21
+ extends ElementBaseComponent
22
+ implements ControlValueAccessor, AfterViewInit {
23
+ @Input() touchUi = false;
24
+
25
+ @Output() onblur = new EventEmitter<any>();
26
+
27
+
28
+ @Input() cancleLabel = 'Cancel';
29
+ @Input() applyLabel = 'Apply';
30
+ @Input() all = 'All';
31
+ @Input() from = 'From';
32
+ @Input() to = 'To';
33
+
34
+
35
+
36
+ _hoursFrom = '12';
37
+ _minutesFrom = '00';
38
+ _hoursTo = '12';
39
+ _minutesTo = '00';
40
+ _seconds = '00';
41
+ _date: string;
42
+ _pickerValue: string;
43
+ val: string;
44
+ header = EcabsDateTimeRangePickerHeaderComponent;
45
+ maxValueHours = 23;
46
+ maxValueMinutesSeconds = 59;
47
+ controlDate: UntypedFormControl;
48
+
49
+ get value(): string {
50
+ return this.val;
51
+ }
52
+
53
+ get pickerValue(): string {
54
+ return this._pickerValue;
55
+ }
56
+
57
+ get hoursFrom(): string {
58
+ return this._hoursFrom;
59
+ }
60
+
61
+ get minutesFrom(): string {
62
+ return this._minutesFrom;
63
+ }
64
+
65
+ get hoursTo(): string {
66
+ return this._hoursTo;
67
+ }
68
+
69
+ get minutesTo(): string {
70
+ return this._minutesTo;
71
+ }
72
+
73
+ get seconds(): string {
74
+ return this._seconds;
75
+ }
76
+
77
+ set hoursFrom(value: string) {
78
+ if (value !== undefined && this._hoursFrom !== value) {
79
+ this._hoursFrom = this.roundNumber(+value);
80
+ }
81
+ }
82
+
83
+ set minutesFrom(value: string) {
84
+ if (value !== undefined && this._minutesFrom !== value) {
85
+ this._minutesFrom = this.roundNumber(+value);
86
+ }
87
+ }
88
+
89
+ set hoursTo(value: string) {
90
+ if (value !== undefined && this._hoursTo !== value) {
91
+ this._hoursTo = this.roundNumber(+value);
92
+ }
93
+ }
94
+
95
+ set minutesTo(value: string) {
96
+ if (value !== undefined && this._minutesTo !== value) {
97
+ this._minutesTo = this.roundNumber(+value);
98
+ }
99
+ }
100
+
101
+ set seconds(value: string) {
102
+ if (value !== undefined && this._seconds !== value) {
103
+ this._seconds = this.roundNumber(+value);
104
+ }
105
+ }
106
+
107
+ set value(val) {
108
+ if (val && this.val !== val) {
109
+ this.val = val;
110
+ this.pickerValue = val;
111
+ this.onChange(val);
112
+ this.onTouch(val);
113
+ }
114
+ }
115
+
116
+ set pickerValue(val: string) {
117
+ if (val) {
118
+ this._pickerValue = val;
119
+ this.value = val;
120
+ }
121
+ }
122
+
123
+ constructor(
124
+ private readonly injector: Injector,
125
+ private readonly decimalPipe: DecimalPipe
126
+ ) {
127
+ super();
128
+ }
129
+
130
+ ngAfterViewInit(): void {
131
+ const ngControl: NgControl = this.injector.get(NgControl, null);
132
+ if (ngControl) {
133
+ this.control = ngControl.control as UntypedFormControl;
134
+
135
+ setTimeout(() => {
136
+ this.controlDate = this.control;
137
+ const controlDate = !!this.control.value ? this.control.value : '';
138
+
139
+ if (controlDate) {
140
+ this.setValues(controlDate);
141
+ }
142
+ }, 10);
143
+ }
144
+ }
145
+
146
+ onChange: any = () => { };
147
+ onTouch: any = () => { };
148
+
149
+ writeValue(value: any): void {
150
+ this.value = value;
151
+ }
152
+
153
+ registerOnChange(fn: any): void {
154
+ this.onChange = fn;
155
+ }
156
+
157
+ registerOnTouched(fn: any): void {
158
+ this.onTouch = fn;
159
+ }
160
+
161
+ blurChange(e: any): void {
162
+ this.onblur.emit(e);
163
+ }
164
+
165
+ keydownChange(e: any): void {
166
+ if (e?.target.value === this.all) {
167
+ const val = '';
168
+ this.val = val;
169
+ this._pickerValue = val;
170
+ this.onChange(val);
171
+ this.onTouch(val);
172
+ }
173
+ }
174
+
175
+ onApply(): void {
176
+ if (this._minutesFrom && this._hoursFrom && this._minutesTo && this._hoursTo) {
177
+ this.setValues(this._hoursFrom + ':' + this._minutesFrom + ' - ' + this._hoursTo + ':' + this._minutesTo);
178
+ this.value = this._hoursFrom + ':' + this._minutesFrom + ' - ' + this._hoursTo + ':' + this._minutesTo;
179
+
180
+ return;
181
+ }
182
+ }
183
+
184
+ opened(): void {
185
+ setTimeout(() => {
186
+ const elements = document.getElementsByClassName('mat-calendar-content');
187
+ while (elements.length > 0) {
188
+ elements[0].parentNode.removeChild(elements[0]);
189
+ }
190
+
191
+ let cols = Array.from(document.getElementsByClassName('mat-calendar') as HTMLCollectionOf<HTMLElement>);
192
+ for(let i=0; i<cols.length; i++) {
193
+ cols[i].style.height = '50px';
194
+ }
195
+
196
+ });
197
+ }
198
+
199
+ private roundNumber(num: number): string | null {
200
+ return this.decimalPipe.transform(num, '2.0-0') ?? '00';
201
+ }
202
+
203
+ private setValues(date: string): void {
204
+ this._date = date;
205
+ }
206
+ }
@@ -0,0 +1,37 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
+ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
+ import { MatDatepickerModule } from '@angular/material/datepicker';
5
+ import { MatIconModule } from '@angular/material/icon';
6
+ import { MaskDateDirectiveModule } from '../base/directives/date-mask.directive.module';
7
+ import { DigitsOnlyDirectivesModule } from '../base/directives/digits-only.directive.module';
8
+ import { NumberBorderDirectiveModule } from '../base/directives/number-border.directive.module';
9
+
10
+ import { ElementWrapperModule } from '../base/element-wrapper/element-wrapper.module';
11
+ import { EcabsButtonsModule } from '../ecabs-buttons/ecabs-buttons.module';
12
+ import { EcabsPickerHeaderModule } from '../ecabs-picker-header/ecabs-picker-header.module';
13
+ import { MatButtonModule } from '@angular/material/button';
14
+ import { EcabsDateTimeRangePickerComponent } from './ecabs-date-time-range-picker.component';
15
+ import { EcabsDateTimeRangePickerHeaderComponent } from './components/ecabs-date-time-range-picker-header/ecabs-date-time-range-picker-header.component';
16
+ import { TimeRangeDirective } from './time-range.directive';
17
+
18
+
19
+ @NgModule({
20
+ declarations: [EcabsDateTimeRangePickerComponent, EcabsDateTimeRangePickerHeaderComponent, TimeRangeDirective],
21
+ imports: [
22
+ CommonModule,
23
+ ElementWrapperModule,
24
+ MatIconModule,
25
+ MatDatepickerModule,
26
+ MatButtonModule,
27
+ FormsModule,
28
+ ReactiveFormsModule,
29
+ EcabsPickerHeaderModule,
30
+ EcabsButtonsModule,
31
+ DigitsOnlyDirectivesModule,
32
+ NumberBorderDirectiveModule,
33
+ MaskDateDirectiveModule
34
+ ],
35
+ exports: [EcabsDateTimeRangePickerComponent, EcabsDateTimeRangePickerHeaderComponent, TimeRangeDirective],
36
+ })
37
+ export class EcabsDatetimeRangePickerModule { }
@@ -0,0 +1,38 @@
1
+ import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
2
+ import * as textMask from 'vanilla-text-mask/dist/vanillaTextMask';
3
+
4
+ @Directive({
5
+ selector: '[appTimeRange]',
6
+ })
7
+ export class TimeRangeDirective implements OnInit, OnDestroy {
8
+ @Input() isDateTimeMask = false;
9
+ @Input() considerSeconds = false;
10
+ @Input() all: string;
11
+
12
+ maskedInputController;
13
+ maskDateTime = [/\d/, /\d/, ':', /\d/, /\d/, ' ', '-', ' ', /\d/, /\d/, ':', /\d/, /\d/];
14
+
15
+ constructor(private readonly element: ElementRef) { }
16
+
17
+ ngOnInit(): void {
18
+ const all = this.all;
19
+ this.maskedInputController = textMask.maskInput({
20
+ inputElement: this.element.nativeElement,
21
+ guide: true,
22
+ showMask: false,
23
+ keepCharPositions: true,
24
+ mask: this.maskDateTime,
25
+ pipe: function (conformedValue) {
26
+ if (conformedValue === '__:__ - __:__') {
27
+ return all;
28
+ }
29
+
30
+ return conformedValue;
31
+ },
32
+ });
33
+ }
34
+
35
+ ngOnDestroy(): void {
36
+ this.maskedInputController.destroy();
37
+ }
38
+ }
@@ -0,0 +1,32 @@
1
+ <div matDialogTitle *ngIf="data?.title || !!data?.isPopover" class="flex flex-column">
2
+ <div *ngIf="!!data?.isPopover" class="w-full flex justify-end">
3
+ <mat-icon
4
+ (click)="dialogRef.close(true)"
5
+ class="mat-icon material-icons-outlined float-right icon--close mb-2"
6
+ role="button"
7
+ >
8
+ close
9
+ </mat-icon>
10
+ </div>
11
+
12
+ <div class="font-semibold heading--xs modal-title {{ data.titleColor }}" *ngIf="data.title">
13
+ {{ data.title }}
14
+ </div>
15
+ </div>
16
+
17
+ <div mat-dialog-content>
18
+ <div>{{ data?.content }}</div>
19
+ <ng-container *ngTemplateOutlet="data?.message"></ng-container>
20
+ </div>
21
+
22
+ <div class="pb-6">
23
+ <div mat-dialog-actions class="btn__group flex justify-end w-full" *ngIf="!data?.isPopover">
24
+ <ecabs-buttons (click)="dialogRef.close(false)" [stroked]="true">
25
+ {{ data?.cancelLabel }}
26
+ </ecabs-buttons>
27
+
28
+ <ecabs-buttons [color]="data?.color || color" [loading]="data.loading$ | async" (click)="closeDialog()">
29
+ {{ data?.confirmLabel }}
30
+ </ecabs-buttons>
31
+ </div>
32
+ </div>
@@ -0,0 +1,24 @@
1
+ :host,
2
+ :host ::ng-deep {
3
+ .mat-dialog-title {
4
+ .mat-icon.icon--close {
5
+ width: 20px;
6
+ height: 20px;
7
+ line-height: 20px;
8
+ font-size: 20px;
9
+ }
10
+ }
11
+
12
+ app-buttons {
13
+ width: calc(50% - 0.5rem);
14
+ }
15
+
16
+ button {
17
+ width: 100%;
18
+ }
19
+ }
20
+ .modal-title {
21
+ &.warn {
22
+ color: var(--color-error) !important;
23
+ }
24
+ }
@@ -0,0 +1,57 @@
1
+ import { Component, Inject, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
+ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
3
+ import { ThemePalette } from '@angular/material/core';
4
+ import { Observable, Subject, takeUntil } from 'rxjs';
5
+
6
+ @Component({
7
+ selector: 'ecabs-dialog-confirm',
8
+ templateUrl: './ecabs-dialog-confirm.component.html',
9
+ styleUrls: ['./ecabs-dialog-confirm.component.scss'],
10
+ })
11
+ export class EcabsDialogConfirmComponent implements OnInit, OnDestroy {
12
+
13
+ private destroy$: Subject<any> = new Subject<any>();
14
+
15
+ message: string;
16
+ color: ThemePalette = 'primary';
17
+ titleColor: ThemePalette = 'primary';
18
+
19
+ constructor(
20
+ public dialogRef: MatDialogRef<DialogConfirmComponentConfig>,
21
+ @Inject(MAT_DIALOG_DATA) public data: DialogConfirmComponentConfig,
22
+ ) { }
23
+
24
+ ngOnInit(): void {
25
+ this.dialogRef.updateSize(this.data.width || '24rem');
26
+ }
27
+
28
+ ngOnDestroy(): void {
29
+ this.destroy$.next(true);
30
+ this.destroy$.complete();
31
+ }
32
+
33
+ closeDialog() {
34
+ if (this.data.loading$) {
35
+ this.data.loading$?.pipe(takeUntil(this.destroy$)).subscribe((loading) => {
36
+ if (!loading) {
37
+ this.dialogRef.close(true);
38
+ }
39
+ });
40
+ } else {
41
+ this.dialogRef.close(true);
42
+ }
43
+ }
44
+ }
45
+
46
+ export interface DialogConfirmComponentConfig {
47
+ title?: string;
48
+ message: TemplateRef<any>;
49
+ color?: ThemePalette;
50
+ titleColor?: ThemePalette;
51
+ confirmLabel?: string;
52
+ cancelLabel?: string;
53
+ isPopover?: boolean;
54
+ width?: string;
55
+ content?: string;
56
+ loading$?: Observable<boolean>;
57
+ }
@@ -0,0 +1,12 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { EcabsDialogConfirmComponent } from './ecabs-dialog-confirm.component';
4
+ import { MatDialogModule } from '@angular/material/dialog';
5
+ import { MatIconModule } from '@angular/material/icon';
6
+ import { EcabsButtonsModule } from '../ecabs-buttons/ecabs-buttons.module';
7
+
8
+ @NgModule( {
9
+ declarations: [ EcabsDialogConfirmComponent ],
10
+ imports: [ CommonModule, MatDialogModule, EcabsButtonsModule, MatIconModule ],
11
+ } )
12
+ export class EcabsDialogConfirmModule { }
@@ -0,0 +1,27 @@
1
+ <div matDialogTitle *ngIf="data?.title || !!data?.isPopover" class="flex flex-column">
2
+ <div *ngIf="!!data?.isPopover" class="w-full flex justify-end">
3
+ <mat-icon
4
+ (click)="dialogRef.close(true)"
5
+ class="mat-icon material-icons-outlined float-right icon--close mb-2"
6
+ role="button"
7
+ >
8
+ close
9
+ </mat-icon>
10
+ </div>
11
+
12
+ <div *ngIf="data.title" class="title font-semibold heading--xs" [ngClass]="data?.titleColor || titleColor">
13
+ {{ data.title }}
14
+ </div>
15
+ </div>
16
+
17
+ <div mat-dialog-content>
18
+ {{data?.message}}
19
+ </div>
20
+
21
+ <div class="pb-6">
22
+ <div mat-dialog-actions class="btn__group flex justify-end w-full" *ngIf="!data?.isPopover">
23
+ <ecabs-buttons [color]="data?.color || color" [full]="data?.isButtonBlock" [loading]="data.loading$ | async" (click)="closeDialog()">
24
+ {{ data?.confirmLabel }}
25
+ </ecabs-buttons>
26
+ </div>
27
+ </div>