@cauca-911/material 21.0.1-beta.4 → 21.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.
Files changed (239) hide show
  1. package/.eslintrc.json +79 -0
  2. package/README_PACKAGE.md +5 -0
  3. package/cauca-911-material-21.0.0.tgz +0 -0
  4. package/karma.conf.js +50 -0
  5. package/ng-package.json +7 -0
  6. package/package.json +23 -38
  7. package/src/assets/i18n/cauca/en-material.json +104 -0
  8. package/src/assets/i18n/cauca/es-material.json +104 -0
  9. package/src/assets/i18n/cauca/fr-material.json +106 -0
  10. package/src/assets/images/loading.gif +0 -0
  11. package/src/lib/cauca-material.component.html +1 -0
  12. package/src/lib/cauca-material.component.spec.ts +29 -0
  13. package/src/lib/cauca-material.component.ts +12 -0
  14. package/src/lib/cauca-material.service.spec.ts +16 -0
  15. package/src/lib/cauca-material.service.ts +7 -0
  16. package/src/lib/components/button/button.component.html +52 -0
  17. package/src/lib/components/button/button.component.scss +6 -0
  18. package/src/lib/components/button/button.component.spec.ts +142 -0
  19. package/src/lib/components/button/button.component.ts +22 -0
  20. package/src/lib/components/buttons/base-button.ts +35 -0
  21. package/src/lib/components/buttons/basic-button/basic-button.component.html +5 -0
  22. package/src/lib/components/buttons/basic-button/basic-button.component.scss +12 -0
  23. package/src/lib/components/buttons/basic-button/basic-button.component.spec.ts +106 -0
  24. package/src/lib/components/buttons/basic-button/basic-button.component.ts +17 -0
  25. package/src/lib/components/buttons/fab-button/fab-button.component.html +3 -0
  26. package/src/lib/components/buttons/fab-button/fab-button.component.scss +12 -0
  27. package/src/lib/components/buttons/fab-button/fab-button.component.spec.ts +82 -0
  28. package/src/lib/components/buttons/fab-button/fab-button.component.ts +16 -0
  29. package/src/lib/components/buttons/flat-button/flat-button.component.html +5 -0
  30. package/src/lib/components/buttons/flat-button/flat-button.component.scss +12 -0
  31. package/src/lib/components/buttons/flat-button/flat-button.component.spec.ts +106 -0
  32. package/src/lib/components/buttons/flat-button/flat-button.component.ts +17 -0
  33. package/src/lib/components/buttons/icon-button/icon-button.component.html +3 -0
  34. package/src/lib/components/buttons/icon-button/icon-button.component.scss +23 -0
  35. package/src/lib/components/buttons/icon-button/icon-button.component.spec.ts +38 -0
  36. package/src/lib/components/buttons/icon-button/icon-button.component.ts +15 -0
  37. package/src/lib/components/buttons/link-button/link-button.component.html +1 -0
  38. package/src/lib/components/buttons/link-button/link-button.component.scss +3 -0
  39. package/src/lib/components/buttons/link-button/link-button.component.spec.ts +97 -0
  40. package/src/lib/components/buttons/link-button/link-button.component.ts +25 -0
  41. package/src/lib/components/buttons/menu-item/menu-item.component.html +5 -0
  42. package/src/lib/components/buttons/menu-item/menu-item.component.scss +6 -0
  43. package/src/lib/components/buttons/menu-item/menu-item.component.spec.ts +66 -0
  44. package/src/lib/components/buttons/menu-item/menu-item.component.ts +19 -0
  45. package/src/lib/components/buttons/raised-button/raised-button.component.html +5 -0
  46. package/src/lib/components/buttons/raised-button/raised-button.component.scss +12 -0
  47. package/src/lib/components/buttons/raised-button/raised-button.component.spec.ts +108 -0
  48. package/src/lib/components/buttons/raised-button/raised-button.component.ts +17 -0
  49. package/src/lib/components/buttons/refresh-button/refresh-button.component.html +1 -0
  50. package/src/lib/components/buttons/refresh-button/refresh-button.component.scss +0 -0
  51. package/src/lib/components/buttons/refresh-button/refresh-button.component.spec.ts +81 -0
  52. package/src/lib/components/buttons/refresh-button/refresh-button.component.ts +19 -0
  53. package/src/lib/components/buttons/round-button/round-button.component.html +3 -0
  54. package/src/lib/components/buttons/round-button/round-button.component.scss +34 -0
  55. package/src/lib/components/buttons/round-button/round-button.component.spec.ts +26 -0
  56. package/src/lib/components/buttons/round-button/round-button.component.ts +14 -0
  57. package/src/lib/components/buttons/stroked-button/stroked-button.component.html +5 -0
  58. package/src/lib/components/buttons/stroked-button/stroked-button.component.scss +23 -0
  59. package/src/lib/components/buttons/stroked-button/stroked-button.component.spec.ts +114 -0
  60. package/src/lib/components/buttons/stroked-button/stroked-button.component.ts +17 -0
  61. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.html +9 -0
  62. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.scss +7 -0
  63. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.spec.ts +68 -0
  64. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts +155 -0
  65. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.html +6 -0
  66. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.scss +25 -0
  67. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.spec.ts +23 -0
  68. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.ts +23 -0
  69. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.html +77 -0
  70. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.scss +124 -0
  71. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.spec.ts +96 -0
  72. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.ts +228 -0
  73. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.html +9 -0
  74. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.scss +15 -0
  75. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.spec.ts +105 -0
  76. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.ts +48 -0
  77. package/src/lib/components/cauca-date-time-picker/models/dialog-date-time-picker-data.ts +29 -0
  78. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.html +14 -0
  79. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.scss +3 -0
  80. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.ts +87 -0
  81. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.html +12 -0
  82. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.scss +3 -0
  83. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.spec.ts +35 -0
  84. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts +57 -0
  85. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.html +49 -0
  86. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.ts +56 -0
  87. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.html +11 -0
  88. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.scss +4 -0
  89. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.spec.ts +39 -0
  90. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.ts +20 -0
  91. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.html +7 -0
  92. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.scss +41 -0
  93. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.spec.ts +24 -0
  94. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.ts +67 -0
  95. package/src/lib/components/deprecated-components/shared/models/menu-item.ts +11 -0
  96. package/src/lib/components/deprecated-components/shared/models/simple-dialog-data.ts +5 -0
  97. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.html +10 -0
  98. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.scss +14 -0
  99. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.spec.ts +90 -0
  100. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.ts +41 -0
  101. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.html +11 -0
  102. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.scss +29 -0
  103. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.spec.ts +137 -0
  104. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.ts +47 -0
  105. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.html +17 -0
  106. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.scss +14 -0
  107. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.spec.ts +96 -0
  108. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.ts +40 -0
  109. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.spec.ts +7 -0
  110. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.ts +5 -0
  111. package/src/lib/components/dialogs/dialog-styles.css +9 -0
  112. package/src/lib/components/dialogs/dialog-styles.scss +9 -0
  113. package/src/lib/components/dialogs/error-dialog/error-dialog.component.html +10 -0
  114. package/src/lib/components/dialogs/error-dialog/error-dialog.component.scss +10 -0
  115. package/src/lib/components/dialogs/error-dialog/error-dialog.component.spec.ts +91 -0
  116. package/src/lib/components/dialogs/error-dialog/error-dialog.component.ts +32 -0
  117. package/src/lib/components/dialogs/services/dialog.service.spec.ts +82 -0
  118. package/src/lib/components/dialogs/services/dialog.service.ts +107 -0
  119. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.html +24 -0
  120. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.scss +22 -0
  121. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.spec.ts +126 -0
  122. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.ts +66 -0
  123. package/src/lib/components/inputs/color-picker/color-picker.component.html +9 -0
  124. package/src/lib/components/inputs/color-picker/color-picker.component.scss +0 -0
  125. package/src/lib/components/inputs/color-picker/color-picker.component.spec.ts +29 -0
  126. package/src/lib/components/inputs/color-picker/color-picker.component.ts +111 -0
  127. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.html +13 -0
  128. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.scss +0 -0
  129. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.spec.ts +80 -0
  130. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.ts +46 -0
  131. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.html +40 -0
  132. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.scss +39 -0
  133. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.spec.ts +135 -0
  134. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts +263 -0
  135. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html +6 -0
  136. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss +27 -0
  137. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts +90 -0
  138. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.ts +17 -0
  139. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.html +5 -0
  140. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.scss +8 -0
  141. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.spec.ts +98 -0
  142. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.ts +16 -0
  143. package/src/lib/components/inputs/password/password-input/password-input.component.html +11 -0
  144. package/src/lib/components/inputs/password/password-input/password-input.component.scss +12 -0
  145. package/src/lib/components/inputs/password/password-input/password-input.component.spec.ts +141 -0
  146. package/src/lib/components/inputs/password/password-input/password-input.component.ts +67 -0
  147. package/src/lib/components/inputs/password/password-selection/password-selection.component.html +15 -0
  148. package/src/lib/components/inputs/password/password-selection/password-selection.component.scss +32 -0
  149. package/src/lib/components/inputs/password/password-selection/password-selection.component.spec.ts +138 -0
  150. package/src/lib/components/inputs/password/password-selection/password-selection.component.ts +101 -0
  151. package/src/lib/components/inputs/select-with-search/select-with-search.component.html +19 -0
  152. package/src/lib/components/inputs/select-with-search/select-with-search.component.scss +0 -0
  153. package/src/lib/components/inputs/select-with-search/select-with-search.component.spec.ts +215 -0
  154. package/src/lib/components/inputs/select-with-search/select-with-search.component.ts +108 -0
  155. package/src/lib/components/layout/expandable-panel/expandable-panel.component.html +14 -0
  156. package/src/lib/components/layout/expandable-panel/expandable-panel.component.scss +48 -0
  157. package/src/lib/components/layout/expandable-panel/expandable-panel.component.spec.ts +48 -0
  158. package/src/lib/components/layout/expandable-panel/expandable-panel.component.ts +19 -0
  159. package/src/lib/components/layout/group-container/group-container.component.html +6 -0
  160. package/src/lib/components/layout/group-container/group-container.component.scss +22 -0
  161. package/src/lib/components/layout/group-container/group-container.component.spec.ts +34 -0
  162. package/src/lib/components/layout/group-container/group-container.component.ts +14 -0
  163. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.html +13 -0
  164. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.scss +27 -0
  165. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts +144 -0
  166. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.ts +52 -0
  167. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.html +4 -0
  168. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.scss +10 -0
  169. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.spec.ts +80 -0
  170. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts +28 -0
  171. package/src/lib/components/layout/page-title/page-title.component.html +28 -0
  172. package/src/lib/components/layout/page-title/page-title.component.scss +40 -0
  173. package/src/lib/components/layout/page-title/page-title.component.spec.ts +162 -0
  174. package/src/lib/components/layout/page-title/page-title.component.ts +28 -0
  175. package/src/lib/components/layout/sections/main-section/main-section.component.html +6 -0
  176. package/src/lib/components/layout/sections/main-section/main-section.component.scss +27 -0
  177. package/src/lib/components/layout/sections/main-section/main-section.component.spec.ts +42 -0
  178. package/src/lib/components/layout/sections/main-section/main-section.component.ts +13 -0
  179. package/src/lib/components/layout/sections/section-column/section-column.component.html +3 -0
  180. package/src/lib/components/layout/sections/section-column/section-column.component.scss +18 -0
  181. package/src/lib/components/layout/sections/section-column/section-column.component.spec.ts +35 -0
  182. package/src/lib/components/layout/sections/section-column/section-column.component.ts +12 -0
  183. package/src/lib/components/layout/sections/section-field/section-field.component.html +21 -0
  184. package/src/lib/components/layout/sections/section-field/section-field.component.scss +44 -0
  185. package/src/lib/components/layout/sections/section-field/section-field.component.spec.ts +74 -0
  186. package/src/lib/components/layout/sections/section-field/section-field.component.ts +22 -0
  187. package/src/lib/components/list-paginator/list-paginator.component.html +16 -0
  188. package/src/lib/components/list-paginator/list-paginator.component.scss +46 -0
  189. package/src/lib/components/list-paginator/list-paginator.component.spec.ts +248 -0
  190. package/src/lib/components/list-paginator/list-paginator.component.ts +81 -0
  191. package/src/lib/components/misc/loading-error/loading-error.component.html +11 -0
  192. package/src/lib/components/misc/loading-error/loading-error.component.scss +0 -0
  193. package/src/lib/components/misc/loading-error/loading-error.component.spec.ts +75 -0
  194. package/src/lib/components/misc/loading-error/loading-error.component.ts +18 -0
  195. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.html +3 -0
  196. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.scss +0 -0
  197. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.spec.ts +43 -0
  198. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.ts +16 -0
  199. package/src/lib/components/misc/snack-bar/snack-bar.component.html +16 -0
  200. package/src/lib/components/misc/snack-bar/snack-bar.component.scss +84 -0
  201. package/src/lib/components/misc/snack-bar/snack-bar.component.spec.ts +136 -0
  202. package/src/lib/components/misc/snack-bar/snack-bar.component.ts +39 -0
  203. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.html +11 -0
  204. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.scss +0 -0
  205. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.spec.ts +67 -0
  206. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.ts +15 -0
  207. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.html +11 -0
  208. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.scss +0 -0
  209. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.spec.ts +77 -0
  210. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.ts +17 -0
  211. package/src/lib/components/presenters/badge/badge.component.html +6 -0
  212. package/src/lib/components/presenters/badge/badge.component.scss +10 -0
  213. package/src/lib/components/presenters/badge/badge.component.spec.ts +41 -0
  214. package/src/lib/components/presenters/badge/badge.component.ts +18 -0
  215. package/src/lib/components/presenters/icon/icon.component.scss +9 -0
  216. package/src/lib/components/presenters/icon/icon.component.spec.ts +38 -0
  217. package/src/lib/components/presenters/icon/icon.component.ts +37 -0
  218. package/src/lib/core/breadcrumb.service.spec.ts +35 -0
  219. package/src/lib/core/breadcrumb.service.ts +24 -0
  220. package/src/lib/core/directives/auto-trim-and-lower.directive.spec.ts +22 -0
  221. package/src/lib/core/directives/auto-trim-and-lower.directive.ts +19 -0
  222. package/src/lib/core/directives/form-error/form-error.module.ts +21 -0
  223. package/src/lib/core/directives/form-error/has-error-root.directive.ts +31 -0
  224. package/src/lib/core/directives/form-error/has-error.directive.ts +95 -0
  225. package/src/lib/core/loading-state.service.spec.ts +57 -0
  226. package/src/lib/core/loading-state.service.ts +44 -0
  227. package/src/lib/core/models/breadcrumb-location.ts +6 -0
  228. package/src/lib/core/models/password-validation.ts +20 -0
  229. package/src/lib/core/validators/password/password-validator.spec.ts +155 -0
  230. package/src/lib/core/validators/password/password-validator.ts +30 -0
  231. package/src/lib/provide-cauca-material.ts +10 -0
  232. package/src/public-api.ts +70 -0
  233. package/src/test.ts +17 -0
  234. package/tsconfig.lib.json +18 -0
  235. package/tsconfig.lib.prod.json +4 -0
  236. package/tsconfig.spec.json +17 -0
  237. package/fesm2022/cauca-911-material.mjs +0 -4323
  238. package/fesm2022/cauca-911-material.mjs.map +0 -1
  239. package/types/cauca-911-material.d.ts +0 -755
@@ -0,0 +1,96 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
3
+ import { DialogDateTimePickerComponent } from './dialog-date-time-picker.component';
4
+ import { TranslatePipe } from '@ngx-translate/core';
5
+ import { MockPipe } from 'ng-mocks';
6
+
7
+ describe('DialogDateTimePickerComponent', () => {
8
+ let component: DialogDateTimePickerComponent;
9
+ let fixture: ComponentFixture<DialogDateTimePickerComponent>;
10
+
11
+ beforeEach(async () => {
12
+ await TestBed.configureTestingModule({
13
+ imports: [
14
+ DialogDateTimePickerComponent,
15
+ MatDialogModule,
16
+ ],
17
+ declarations: [MockPipe(TranslatePipe, key => key)],
18
+ providers: [{
19
+ provide: MatDialogRef,
20
+ useValue: {}
21
+ }, {
22
+ provide: MAT_DIALOG_DATA,
23
+ useValue: {}
24
+ }]
25
+ })
26
+ .compileComponents();
27
+
28
+ fixture = TestBed.createComponent(DialogDateTimePickerComponent);
29
+ component = fixture.componentInstance;
30
+ fixture.detectChanges();
31
+ });
32
+
33
+ it('should create', () => {
34
+ expect(component).toBeTruthy();
35
+ });
36
+
37
+ it('should not show the list of seconds when showSeconds is false', () => {
38
+ const divSeconds = fixture.nativeElement.querySelector('.seconds');
39
+
40
+ expect(divSeconds).toBeNull();
41
+ });
42
+
43
+ it('should show the list of seconds when showSeconds is true', () => {
44
+ component.showSeconds.set(true);
45
+ fixture.detectChanges();
46
+
47
+ const divSeconds = fixture.nativeElement.querySelector('.seconds');
48
+
49
+ expect(divSeconds).not.toBeNull();
50
+ });
51
+
52
+ it('should execute hourChanged when click on hours list', () => {
53
+ const hourChangedSpy = spyOn(component, 'hourChanged');
54
+ const hoursList = fixture.nativeElement.querySelector('.hours mat-list mat-list-item');
55
+
56
+ hoursList.click();
57
+ fixture.detectChanges();
58
+
59
+ expect(hourChangedSpy).toHaveBeenCalled();
60
+ });
61
+
62
+ it('should execute minuteChanged when click on minutes list', () => {
63
+ const minuteChangedSpy = spyOn(component, 'minuteChanged');
64
+ const minutesList = fixture.nativeElement.querySelector('.minutes mat-list mat-list-item');
65
+
66
+ minutesList.click();
67
+ fixture.detectChanges();
68
+
69
+ expect(minuteChangedSpy).toHaveBeenCalled();
70
+ });
71
+
72
+ it('should execute minuteChanged when click on minutes list', () => {
73
+ component.showSeconds.set(true);
74
+ fixture.detectChanges();
75
+ const secondChangedSpy = spyOn(component, 'secondChanged');
76
+ const secondsList = fixture.nativeElement.querySelector('.seconds mat-list mat-list-item');
77
+
78
+ secondsList.click();
79
+ fixture.detectChanges();
80
+
81
+ expect(secondChangedSpy).toHaveBeenCalled();
82
+ });
83
+
84
+ it('should not show time when showTime is false', () => {
85
+ component.showTime.set(false);
86
+ fixture.detectChanges();
87
+
88
+ const hoursDiv = fixture.nativeElement.querySelector('.hours');
89
+ const minutesDiv = fixture.nativeElement.querySelector('.minutes');
90
+ const secondsDiv = fixture.nativeElement.querySelector('.seconds');
91
+
92
+ expect(hoursDiv).toBeNull();
93
+ expect(minutesDiv).toBeNull();
94
+ expect(secondsDiv).toBeNull();
95
+ });
96
+ });
@@ -0,0 +1,228 @@
1
+ import { ChangeDetectionStrategy, Component, HostListener, OnInit, signal, WritableSignal, inject } from '@angular/core';
2
+ import { provideNativeDateAdapter } from '@angular/material/core';
3
+ import { MatDatepickerModule } from '@angular/material/datepicker';
4
+ import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
5
+ import { MatListModule } from '@angular/material/list';
6
+ import { DialogDateTimePickerOptions, DialogDateTimePickerDataDisabled, DialogDateTimePickerDataStep } from '../../models/dialog-date-time-picker-data';
7
+ import { CaucaCoreForChildModule } from '@cauca-911/core';
8
+ import { MatButtonModule } from '@angular/material/button';
9
+ import { MatIconModule } from '@angular/material/icon';
10
+ import { CommonModule } from '@angular/common';
11
+ import { MobileTimePickerComponent } from '../mobile-time-picker/mobile-time-picker.component';
12
+ import { DesktopTimePickerComponent } from '../desktop-time-picker/desktop-time-picker.component';
13
+
14
+ @Component({
15
+ selector: 'cauca-dialog-date-time-picker',
16
+ imports: [
17
+ CommonModule,
18
+ CaucaCoreForChildModule,
19
+ MatButtonModule,
20
+ MatDatepickerModule,
21
+ MatIconModule,
22
+ MatListModule,
23
+ MobileTimePickerComponent,
24
+ DesktopTimePickerComponent
25
+ ],
26
+ providers: [provideNativeDateAdapter()],
27
+ templateUrl: './dialog-date-time-picker.component.html',
28
+ styleUrl: './dialog-date-time-picker.component.scss',
29
+ changeDetection: ChangeDetectionStrategy.OnPush
30
+ })
31
+ export class DialogDateTimePickerComponent implements OnInit {
32
+
33
+ public selectedHour = 0;
34
+ public selectedMinute = 0;
35
+ public selectedSecond = 0;
36
+ public initialDate: Date = null;
37
+ public selectedDate: Date = null;
38
+ public minimumDate = new Date();
39
+ public maximumDate = new Date();
40
+ public showSeconds: WritableSignal<boolean> = signal(false);
41
+ public showClearButton: boolean = true;
42
+ public showButtonIcons: boolean = true;
43
+
44
+ public hours = [...Array(24).keys()];
45
+ public minutes = [...Array(60).keys()];
46
+ public seconds = [...Array(60).keys()];
47
+ public showMobileUi: boolean = false;
48
+
49
+ public showTime: WritableSignal<boolean> = signal(true);
50
+
51
+ public disabled: DialogDateTimePickerDataDisabled = {
52
+ hours: true,
53
+ someHours: [],
54
+ minutes: true,
55
+ someMinutes: [],
56
+ seconds: true,
57
+ someSeconds: [],
58
+ };
59
+
60
+ private step: DialogDateTimePickerDataStep = {
61
+ hours: 1,
62
+ minutes: 1,
63
+ seconds: 1,
64
+ };
65
+
66
+ private readonly dialogRef = inject<MatDialogRef<DialogDateTimePickerComponent>>(MatDialogRef);
67
+ private readonly options = inject<DialogDateTimePickerOptions>(MAT_DIALOG_DATA);
68
+
69
+ public constructor() {
70
+ const options = this.options;
71
+
72
+ this.step = options.step || this.step;
73
+ this.showSeconds.set(options.showSeconds);
74
+ this.showButtonIcons = options.showButtonIcons ?? this.showButtonIcons;
75
+ this.showClearButton = options.showClearButton ?? this.showClearButton;
76
+ this.showTime.set(options.showTime ?? true);
77
+ this.setListHoursMinutes();
78
+ this.initialEachComponentValue(options);
79
+ }
80
+
81
+ public ngOnInit(): void {
82
+ this.onWindowWithChange(window.innerWidth);
83
+ }
84
+
85
+ @HostListener('window:resize', ['$event'])
86
+ public onResize(event) {
87
+ this.onWindowWithChange(event.target.innerWidth);
88
+ }
89
+
90
+ public dateChanged(date: Date): void {
91
+ if (date) {
92
+ this.selectedDate = date;
93
+ this.selectedDate.setHours(this.selectedHour);
94
+ this.selectedDate.setMinutes(this.selectedMinute);
95
+ this.selectedDate.setSeconds(this.selectedSecond);
96
+ this.disabled.hours = false;
97
+ this.disabled.someHours = this.hours.filter(hour => this.hourOfSelectedDateIsDisabled(hour));
98
+ } else {
99
+ this.selectedDate = null;
100
+ this.disabled.hours = true;
101
+ }
102
+ }
103
+
104
+ public hourChanged(hour: number): void {
105
+ if (this.disabled.hours || this.disabled.someHours.includes(hour)) return;
106
+
107
+ this.selectedHour = hour;
108
+ this.selectedDate.setHours(hour);
109
+ this.disabled.minutes = false;
110
+ this.disabled.someMinutes = this.minutes.filter(minute => this.minuteOfSelectedDateIsDisabled(minute));
111
+ }
112
+
113
+ public minuteChanged(minute: number): void {
114
+ if (this.disabled.minutes || this.disabled.someMinutes.includes(minute)) return;
115
+
116
+ this.selectedMinute = minute;
117
+ this.selectedDate.setMinutes(minute);
118
+ this.disabled.seconds = false;
119
+ this.disabled.someSeconds = this.seconds.filter(second => this.secondOfSelectedDateIsDisabled(second));
120
+ }
121
+
122
+ public secondChanged(second: number): void {
123
+ if (this.disabled.seconds || this.disabled.someSeconds.includes(second)) return;
124
+
125
+ this.selectedSecond = second;
126
+ this.selectedDate.setSeconds(second);
127
+ }
128
+
129
+ public clear(): void {
130
+ this.dialogRef.close({
131
+ value: null
132
+ });
133
+ }
134
+
135
+ public cancel(): void {
136
+ this.dialogRef.close({
137
+ value: this.initialDate
138
+ });
139
+ }
140
+
141
+ public confirm(): void {
142
+ this.dialogRef.close({
143
+ value: this.selectedDate
144
+ });
145
+ }
146
+
147
+ private onWindowWithChange(width: number): void {
148
+ this.showMobileUi = width && width <= 555;
149
+ }
150
+
151
+ private hourOfSelectedDateIsDisabled(hour: number): boolean {
152
+ if (this.selectedDateIsTheMinimumDate()) {
153
+ return hour < this.minimumDate.getHours();
154
+ } else if (this.selectedDateIsTheMaximumDate()) {
155
+ return hour > this.maximumDate.getHours();
156
+ }
157
+
158
+ return false;
159
+ }
160
+
161
+ private minuteOfSelectedDateIsDisabled(minute: number): boolean {
162
+ if (
163
+ this.selectedDateIsTheMinimumDate() &&
164
+ this.selectedDate.getHours() === this.minimumDate.getHours()
165
+ ) {
166
+ return minute < this.minimumDate.getMinutes();
167
+ } else if (
168
+ this.selectedDateIsTheMaximumDate() &&
169
+ this.selectedDate.getHours() === this.maximumDate.getHours()
170
+ ) {
171
+ return minute > this.maximumDate.getMinutes();
172
+ }
173
+
174
+ return false;
175
+ }
176
+
177
+ private secondOfSelectedDateIsDisabled(second: number): boolean {
178
+ if (
179
+ this.selectedDateIsTheMinimumDate() &&
180
+ this.selectedDate.getHours() === this.minimumDate.getHours() &&
181
+ this.selectedDate.getMinutes() === this.minimumDate.getMinutes()
182
+ ) {
183
+ return second < this.minimumDate.getSeconds();
184
+ } else if (
185
+ this.selectedDateIsTheMaximumDate() &&
186
+ this.selectedDate.getMinutes() === this.maximumDate.getMinutes()
187
+ ) {
188
+ return second > this.maximumDate.getSeconds();
189
+ }
190
+
191
+ return false;
192
+ }
193
+
194
+ private initialEachComponentValue(options: DialogDateTimePickerOptions): void {
195
+ this.initialDate = options.selectedDate ? new Date(options.selectedDate) : null;
196
+ this.minimumDate = options.minimumDate ? new Date(options.minimumDate) : null;
197
+ this.maximumDate = options.maximumDate ? new Date(options.maximumDate) : null;
198
+ this.selectedDate = options.selectedDate ? new Date(options.selectedDate) : new Date();
199
+ this.dateChanged(options.selectedDate ? new Date(options.selectedDate) : null);
200
+ this.hourChanged(options.selectedDate ? new Date(options.selectedDate).getHours() : 0);
201
+ this.minuteChanged(options.selectedDate ? new Date(options.selectedDate).getMinutes() : 0);
202
+ this.secondChanged(options.selectedDate ? new Date(options.selectedDate).getSeconds() : 0);
203
+ }
204
+
205
+ private selectedDateIsTheMinimumDate(): boolean {
206
+ return (
207
+ this.minimumDate &&
208
+ this.selectedDate.getFullYear() === this.minimumDate.getFullYear() &&
209
+ this.selectedDate.getMonth() === this.minimumDate.getMonth() &&
210
+ this.selectedDate.getDate() === this.minimumDate.getDate()
211
+ );
212
+ }
213
+
214
+ private selectedDateIsTheMaximumDate(): boolean {
215
+ return (
216
+ this.maximumDate &&
217
+ this.selectedDate.getFullYear() === this.maximumDate.getFullYear() &&
218
+ this.selectedDate.getMonth() === this.maximumDate.getMonth() &&
219
+ this.selectedDate.getDate() === this.maximumDate.getDate()
220
+ );
221
+ }
222
+
223
+ private setListHoursMinutes(): void {
224
+ this.hours = this.hours.filter(hour => hour % this.step.hours === 0);
225
+ this.minutes = this.minutes.filter(minute => minute % this.step.minutes === 0);
226
+ this.seconds = this.seconds.filter(seconde => seconde % this.step.seconds === 0);
227
+ }
228
+ }
@@ -0,0 +1,9 @@
1
+ <button mat-icon-button (click)="valueUp()">
2
+ <mat-icon>keyboard_arrow_up</mat-icon>
3
+ </button>
4
+ <div>
5
+ {{(value() < 10 ? '0' : '' ) + value()}}
6
+ </div>
7
+ <button mat-icon-button (click)="valueDown()">
8
+ <mat-icon>keyboard_arrow_down</mat-icon>
9
+ </button>
@@ -0,0 +1,15 @@
1
+ :host {
2
+ display: flex;
3
+ flex-direction: column;
4
+ align-items: center;
5
+ justify-content: center;
6
+ height: 70px;
7
+ font-family: var(--mat-form-field-container-text-font);
8
+ }
9
+
10
+ .mat-mdc-icon-button {
11
+ height: 24px;
12
+ width: 24px;
13
+ line-height: 24px;
14
+ padding: 0;
15
+ }
@@ -0,0 +1,105 @@
1
+ import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
2
+ import { HarnessLoader } from '@angular/cdk/testing';
3
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
4
+ import { MatButtonHarness } from '@angular/material/button/testing';
5
+
6
+ import { MobileTimePickerComponent } from './mobile-time-picker.component';
7
+
8
+ const someOptions = [
9
+ 0, 1, 2
10
+ ];
11
+ const someFirstOption = 0;
12
+ const someLastOption = 2;
13
+
14
+ describe('MobileTimePickerComponent', () => {
15
+ let component: MobileTimePickerComponent;
16
+ let fixture: ComponentFixture<MobileTimePickerComponent>;
17
+ let loader: HarnessLoader;
18
+
19
+ beforeEach(async () => {
20
+ await TestBed.configureTestingModule({
21
+ imports: [MobileTimePickerComponent]
22
+ })
23
+ .compileComponents();
24
+
25
+ fixture = TestBed.createComponent(MobileTimePickerComponent);
26
+ loader = TestbedHarnessEnvironment.loader(fixture);
27
+ component = fixture.componentInstance;
28
+ fixture.componentRef.setInput('options', someOptions);
29
+ fixture.componentRef.setInput('value', 0);
30
+ fixture.detectChanges();
31
+ });
32
+
33
+ it('should create', () => {
34
+ expect(component).toBeTruthy();
35
+ });
36
+
37
+ it('should emit valueChange when clicking Up arrow', fakeAsync(async () => {
38
+ const spy = spyOn(component.valueChange, 'emit');
39
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
40
+
41
+ button.click();
42
+ tick();
43
+
44
+ expect(spy).toHaveBeenCalled();
45
+ }));
46
+
47
+ it('should change for next value when clicking Up arrow', fakeAsync(async () => {
48
+ fixture.componentRef.setInput('value', someFirstOption);
49
+ const spy = spyOn(component.valueChange, 'emit');
50
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
51
+
52
+ button.click();
53
+ tick();
54
+
55
+ expect(spy).toHaveBeenCalledWith(someFirstOption + 1);
56
+ }));
57
+
58
+ it('should return to first value when clicking Up arrow and at the last value is selected', fakeAsync(async () => {
59
+ fixture.componentRef.setInput('value', someLastOption);
60
+ const spy = spyOn(component.valueChange, 'emit');
61
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
62
+
63
+ await button.click();
64
+ tick();
65
+ fixture.detectChanges();
66
+
67
+ expect(spy).toHaveBeenCalledWith(someFirstOption);
68
+ }));
69
+
70
+ it('should emit valueChange when clicking Down arrow', fakeAsync(async () => {
71
+ const spy = spyOn(component.valueChange, 'emit');
72
+ const buttons = await loader.getAllHarnesses(MatButtonHarness);
73
+ const button = buttons[buttons.length - 1];
74
+
75
+ button.click();
76
+ tick();
77
+
78
+ expect(spy).toHaveBeenCalled();
79
+ }));
80
+
81
+ it('should change for next value when clicking Down arrow', fakeAsync(async () => {
82
+ fixture.componentRef.setInput('value', someLastOption);
83
+ const spy = spyOn(component.valueChange, 'emit');
84
+ const buttons = await loader.getAllHarnesses(MatButtonHarness);
85
+ const button = buttons[buttons.length - 1];
86
+
87
+ await button.click();
88
+ tick();
89
+ fixture.detectChanges();
90
+
91
+ expect(spy).toHaveBeenCalledWith(someLastOption - 1);
92
+ }));
93
+
94
+ it('should return to last value when clicking Down arrow and at the first value is selected', fakeAsync(async () => {
95
+ fixture.componentRef.setInput('value', someFirstOption);
96
+ const spy = spyOn(component.valueChange, 'emit');
97
+ const buttons = await loader.getAllHarnesses(MatButtonHarness);
98
+ const button = buttons[buttons.length - 1];
99
+
100
+ button.click();
101
+ tick();
102
+
103
+ expect(spy).toHaveBeenCalledWith(someLastOption);
104
+ }));
105
+ });
@@ -0,0 +1,48 @@
1
+ import { ChangeDetectionStrategy, Component, input, output } from '@angular/core';
2
+ import { MatButtonModule } from '@angular/material/button';
3
+ import { MatFormFieldModule } from '@angular/material/form-field';
4
+ import { MatIconModule } from '@angular/material/icon';
5
+ import { MatInputModule } from '@angular/material/input';
6
+
7
+ @Component({
8
+ selector: 'cauca-mobile-time-picker',
9
+ imports: [
10
+ MatButtonModule,
11
+ MatIconModule,
12
+ MatFormFieldModule,
13
+ MatInputModule
14
+ ],
15
+ templateUrl: './mobile-time-picker.component.html',
16
+ styleUrl: './mobile-time-picker.component.scss',
17
+ changeDetection: ChangeDetectionStrategy.OnPush
18
+ })
19
+ export class MobileTimePickerComponent {
20
+ public value = input.required<number>();
21
+ public options = input.required<number[]>();
22
+
23
+ public valueChange = output<number>();
24
+
25
+ public valueUp(): void {
26
+ const currentIndex = this.options().indexOf(this.value());
27
+ let newValue = 0;
28
+ if (currentIndex === this.options().length - 1) {
29
+ newValue = this.options()[0];
30
+ } else {
31
+ newValue = this.options()[currentIndex + 1];
32
+ }
33
+
34
+ this.valueChange.emit(newValue);
35
+ }
36
+
37
+ public valueDown(): void {
38
+ const currentIndex = this.options().indexOf(this.value());
39
+ let newValue = 0;
40
+ if (currentIndex === 0) {
41
+ newValue = this.options()[this.options().length - 1];
42
+ } else {
43
+ newValue = this.options()[currentIndex - 1];
44
+ }
45
+
46
+ this.valueChange.emit(newValue);
47
+ }
48
+ }
@@ -0,0 +1,29 @@
1
+ export interface DialogDateTimePickerDataStep {
2
+ hours: number,
3
+ minutes: number,
4
+ seconds: number,
5
+ }
6
+
7
+ export interface DialogDateTimePickerDataDisabled {
8
+ hours: boolean,
9
+ someHours: number[],
10
+ minutes: boolean,
11
+ someMinutes: number[],
12
+ seconds: boolean,
13
+ someSeconds: number[],
14
+ }
15
+
16
+ export interface DialogDateTimePickerOptions {
17
+ selectedDate: Date,
18
+ minimumDate: Date | null,
19
+ maximumDate: Date | null,
20
+ showSeconds: boolean,
21
+ showClearButton: boolean,
22
+ showButtonIcons: boolean,
23
+ showTime: boolean,
24
+ step: DialogDateTimePickerDataStep,
25
+ }
26
+
27
+ export interface DialogDateTimePickerValue {
28
+ value: Date,
29
+ }
@@ -0,0 +1,14 @@
1
+ <button mat-raised-button (click)="openDialog($event)">
2
+ @if (icon) {
3
+ <mat-icon>{{icon}}</mat-icon>
4
+ }
5
+ @if (text) {
6
+ <span>{{text}}</span>
7
+ }
8
+ </button>
9
+ @if (multiple) {
10
+ <input #file type="file" (change)="onSelectFile($event)" [accept]="accept" multiple="multiple" />
11
+ } @else {
12
+ <input #file type="file" (change)="onSelectFile($event)" [accept]="accept" />
13
+ }
14
+
@@ -0,0 +1,87 @@
1
+ import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild, inject } from '@angular/core';
2
+ import { MatDialog } from '@angular/material/dialog';
3
+ import { TranslateService } from '@cauca-911/core';
4
+ import { CaucaSimpleDialogComponent } from '../cauca-simple-dialog/cauca-simple-dialog.component';
5
+ import { MatButtonModule } from '@angular/material/button';
6
+ import { MatIcon } from '@angular/material/icon';
7
+
8
+ @Component({
9
+ selector: 'cauca-input-file',
10
+ templateUrl: './cauca-input-file.component.html',
11
+ styleUrls: ['./cauca-input-file.component.scss'],
12
+ imports: [MatButtonModule, MatIcon]
13
+ })
14
+ export class CaucaInputFileComponent implements OnInit {
15
+
16
+ @ViewChild('file', {static: false})
17
+ public file: ElementRef;
18
+ @Output()
19
+ public readend = new EventEmitter();
20
+ @Input()
21
+ public accept = '';
22
+ @Input()
23
+ public multiple = false;
24
+ @Input()
25
+ public icon = '';
26
+ @Input()
27
+ public text = '';
28
+
29
+ private labels: any = {};
30
+ private readonly translateService = inject(TranslateService);
31
+ private readonly dialog = inject(MatDialog);
32
+
33
+ public ngOnInit(): void {
34
+ if (!this.icon && !this.text) {
35
+ this.translateService.get(
36
+ ['material.select', 'material.dialogTitle', 'material.dialogMessage']
37
+ ).subscribe((labels: any) => {
38
+ this.labels = labels;
39
+ this.text = labels['material.select'];
40
+ });
41
+ }
42
+ }
43
+
44
+ public onSelectFile(e: any): void {
45
+ for (let i = 0, j = e.target.files.length; i < j; i++) {
46
+ const file = e.target.files[i];
47
+ const reader = new FileReader();
48
+ reader.onerror = ((error: any) => this.onError(error));
49
+ reader.onload = ((event: any) => this.onReadEnd(file, event));
50
+ reader.readAsDataURL(file);
51
+ }
52
+
53
+ if (e.target.files.length) {
54
+ this.dialog.open(CaucaSimpleDialogComponent, {
55
+ width: '250px',
56
+ disableClose: true,
57
+ data: {
58
+ title: this.labels['material.dialogTitle'],
59
+ message: this.labels['material.dialogMessage']
60
+ }
61
+ });
62
+ }
63
+ }
64
+
65
+ public openDialog(event: any): void {
66
+ if (this.file) {
67
+ this.file.nativeElement.click();
68
+ }
69
+ event.stopPropagation();
70
+ }
71
+
72
+ private onError(error: any): void {
73
+ throw error;
74
+ }
75
+
76
+ private onReadEnd(file: any, e: any): void {
77
+ this.dialog.closeAll();
78
+ this.readend.emit({
79
+ name: file.name,
80
+ size: file.size,
81
+ type: file.type,
82
+ lastModifiedDate: file.lastModifiedDate,
83
+ content: e.target['result'],
84
+ file,
85
+ });
86
+ }
87
+ }
@@ -0,0 +1,12 @@
1
+ <mat-tab-group [selectedIndex]="selectedIndex" (selectedIndexChange)="onTagChanged($event)">
2
+ @for (lang of labels; track lang; let i = $index) {
3
+ <mat-tab [label]="lang">
4
+ <mat-form-field hideRequiredMarker="never">
5
+ <input matInput [placeholder]="lang" [formControl]="forms[i]" required="required">
6
+ @if (forms[i].invalid) {
7
+ <mat-error>{{getErrorMessage(i) | translate}}</mat-error>
8
+ }
9
+ </mat-form-field>
10
+ </mat-tab>
11
+ }
12
+ </mat-tab-group>