@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,114 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { StrokedButtonComponent } from './stroked-button.component';
4
+ import { HarnessLoader } from '@angular/cdk/testing';
5
+ import {MatIconHarness} from '@angular/material/icon/testing';
6
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
7
+ import { MatButtonHarness } from '@angular/material/button/testing';
8
+ import { TranslatePipe } from '@ngx-translate/core';
9
+ import { MockPipe } from 'ng-mocks';
10
+
11
+ describe('StrokedButtonComponent', () => {
12
+ let component: StrokedButtonComponent;
13
+ let fixture: ComponentFixture<StrokedButtonComponent>;
14
+ let loader: HarnessLoader;
15
+
16
+ beforeEach(async () => {
17
+ await TestBed.configureTestingModule({
18
+ imports: [
19
+ StrokedButtonComponent,
20
+ ],
21
+ declarations: [MockPipe(TranslatePipe, key => key)]
22
+ })
23
+ .compileComponents();
24
+
25
+ fixture = TestBed.createComponent(StrokedButtonComponent);
26
+ loader = TestbedHarnessEnvironment.loader(fixture);
27
+ component = fixture.componentInstance;
28
+ fixture.detectChanges();
29
+ });
30
+
31
+ it('should create', () => {
32
+ expect(component).toBeTruthy();
33
+ });
34
+
35
+ it('should display the provided icon', async() => {
36
+ fixture.componentRef.setInput('icon', 'twidelidou');
37
+
38
+ fixture.detectChanges();
39
+
40
+ const icon = await loader.getHarness(MatIconHarness);
41
+ expect(await icon.getName()).toBe(component.icon());
42
+ });
43
+
44
+ it('should display the label', async () => {
45
+ fixture.componentRef.setInput('label', 'twidelidou');
46
+
47
+ fixture.detectChanges();
48
+
49
+ const button = await loader.getHarness(MatButtonHarness);
50
+ expect(await button.getText()).toContain(component.label());
51
+ });
52
+
53
+ it('should disable button when disabled is set', async () => {
54
+ fixture.componentRef.setInput('isDisabled', true);
55
+
56
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
57
+ expect(await button.isDisabled()).toBeTrue();
58
+ });
59
+
60
+ it('should enable button when disabled is not set', async () => {
61
+ fixture.componentRef.setInput('isDisabled', false);
62
+
63
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
64
+ expect(await button.isDisabled()).toBeFalse();
65
+ });
66
+
67
+ it('should disable button when disabled is not set and show load icon', async () => {
68
+ fixture.componentRef.setInput('isInProgress', true);
69
+
70
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
71
+ const icon = await button.getHarness(MatIconHarness);
72
+ expect(await button.isDisabled()).toBeTrue();
73
+ expect(await icon.getName()).toBe('update');
74
+ });
75
+
76
+ it('should not show any icon when not set', async () => {
77
+ fixture.componentRef.setInput('icon', null);
78
+
79
+ const button = await loader.getHarnessOrNull(MatButtonHarness);
80
+ const icon = await button.getHarnessOrNull(MatIconHarness);
81
+ expect(icon).toBe(null);
82
+ });
83
+
84
+ it('should emit buttonClick event when clicked', async () => {
85
+ const clickSpy = spyOn(component.buttonClick, 'emit');
86
+ const button = await loader.getHarness(MatButtonHarness);
87
+
88
+ await button.click();
89
+
90
+ expect(clickSpy).toHaveBeenCalled();
91
+ });
92
+
93
+ it('should add the icon-only class to the button when no label is provided', () => {
94
+ fixture.componentRef.setInput('icon', 'twidelidou');
95
+
96
+ fixture.detectChanges();
97
+
98
+ expect(fixture.nativeElement.querySelector('button')).toHaveClass('icon-only');
99
+ });
100
+
101
+ it('should add small-button class when small is set', () => {
102
+ fixture.componentRef.setInput('small', false);
103
+
104
+ fixture.detectChanges();
105
+
106
+ expect(fixture.nativeElement.querySelector('button')).not.toHaveClass('small-button');
107
+
108
+ fixture.componentRef.setInput('small', true);
109
+
110
+ fixture.detectChanges();
111
+
112
+ expect(fixture.nativeElement.querySelector('button')).toHaveClass('small-button');
113
+ });
114
+ });
@@ -0,0 +1,17 @@
1
+ import { ChangeDetectionStrategy, Component } from '@angular/core';
2
+ import { MatButton, } from '@angular/material/button';
3
+ import { MatIconModule } from '@angular/material/icon';
4
+ import { TranslateModule } from '@ngx-translate/core';
5
+ import { BaseButtonWithLabel } from '../base-button';
6
+ import { NgClass } from '@angular/common';
7
+
8
+ @Component({
9
+ selector: 'cauca-stroked-button',
10
+ standalone: true,
11
+ changeDetection: ChangeDetectionStrategy.OnPush,
12
+ imports: [MatButton, MatIconModule, TranslateModule, NgClass],
13
+ templateUrl: './stroked-button.component.html',
14
+ styleUrl: './stroked-button.component.scss',
15
+ })
16
+ export class StrokedButtonComponent extends BaseButtonWithLabel {
17
+ }
@@ -0,0 +1,9 @@
1
+ <mat-form-field [subscriptSizing]="subscriptSizing">
2
+ @if (label) {
3
+ <mat-label>{{ translateLabel ? (label | translate) : label }}{{isRequired ? '*' : ''}}</mat-label>
4
+ }
5
+ <input (focusout)="onTouched()" matInput [value]="stringDate" readonly="readonly">
6
+ <button matSuffix mat-icon-button (click)="showDialog()">
7
+ <mat-icon>calendar_month</mat-icon>
8
+ </button>
9
+ </mat-form-field>
@@ -0,0 +1,7 @@
1
+ :host {
2
+ display: block;
3
+ }
4
+
5
+ mat-form-field {
6
+ width: 100%;
7
+ }
@@ -0,0 +1,68 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { CaucaDateTimePickerComponent } from './cauca-date-time-picker.component';
3
+ import { MatDialogModule } from '@angular/material/dialog';
4
+ import { DatePipe, registerLocaleData } from '@angular/common';
5
+ import { LOCALE_ID } from '@angular/core';
6
+ import localeFr from '@angular/common/locales/fr';
7
+ import { MockModule, MockPipe } from 'ng-mocks';
8
+ import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
9
+
10
+ describe('CaucaDateTimePickerComponent', () => {
11
+ let component: CaucaDateTimePickerComponent;
12
+ let fixture: ComponentFixture<CaucaDateTimePickerComponent>;
13
+
14
+ beforeEach(async () => {
15
+ await TestBed.configureTestingModule({
16
+ imports: [
17
+ CaucaDateTimePickerComponent,
18
+ MatDialogModule,
19
+ MockModule(TranslateModule),
20
+ MockPipe(TranslatePipe, value => value)
21
+ ],
22
+ providers: [
23
+ DatePipe,
24
+ { provide: LOCALE_ID, useValue: 'fr-CA' },
25
+ ],
26
+ })
27
+ .compileComponents();
28
+
29
+ registerLocaleData(localeFr, 'fr');
30
+ fixture = TestBed.createComponent(CaucaDateTimePickerComponent);
31
+ component = fixture.componentInstance;
32
+ fixture.detectChanges();
33
+ });
34
+
35
+ afterEach(() => {
36
+ component.showSeconds = false;
37
+ });
38
+
39
+ it('should create', () => {
40
+ expect(component).toBeTruthy();
41
+ });
42
+
43
+ it('should execute openDialog when click on button', () => {
44
+ const showDialogSpy = spyOn(component, 'showDialog');
45
+ const button = fixture.nativeElement.querySelector('button');
46
+
47
+ button.click();
48
+
49
+ expect(showDialogSpy).toHaveBeenCalled();
50
+ });
51
+
52
+ it('should stringify the date when value is pass', () => {
53
+ const today = new Date();
54
+ const input = fixture.nativeElement.querySelector('input');
55
+
56
+ component.value = today;
57
+
58
+ expect(input.value).not.toBeNull();
59
+ });
60
+
61
+ it('should set empty the date when value is null', () => {
62
+ const input = fixture.nativeElement.querySelector('input');
63
+
64
+ component.value = null;
65
+
66
+ expect(input.value).toBe('');
67
+ });
68
+ });
@@ -0,0 +1,155 @@
1
+ import { Component, ElementRef, EventEmitter, forwardRef, inject, Injector, Input, OnInit, Output } from '@angular/core';
2
+ import { DialogPosition, MatDialog } from '@angular/material/dialog';
3
+ import { MatIconModule } from '@angular/material/icon';
4
+ import { MatInputModule } from '@angular/material/input';
5
+ import { DialogDateTimePickerComponent } from './components/dialog-date-time-picker/dialog-date-time-picker.component';
6
+ import { DialogDateTimePickerOptions, DialogDateTimePickerValue } from './models/dialog-date-time-picker-data';
7
+ import { MatButtonModule } from '@angular/material/button';
8
+ import { DatePipe } from '@angular/common';
9
+ import { AbstractControl, ControlContainer, ControlValueAccessor, FormControl, FormControlName, FormGroup, NG_VALUE_ACCESSOR, NgControl, Validators } from '@angular/forms';
10
+ import { MatFormFieldModule, SubscriptSizing } from '@angular/material/form-field';
11
+ import { TranslateModule } from '@ngx-translate/core';
12
+
13
+ @Component({
14
+ selector: 'cauca-date-time-picker',
15
+ imports: [
16
+ TranslateModule,
17
+ MatButtonModule,
18
+ MatIconModule,
19
+ MatInputModule,
20
+ MatFormFieldModule
21
+ ],
22
+ providers: [
23
+ DatePipe,
24
+ {
25
+ provide: NG_VALUE_ACCESSOR,
26
+ multi: true,
27
+ useExisting: forwardRef(() => CaucaDateTimePickerComponent),
28
+ }
29
+ ],
30
+ templateUrl: './cauca-date-time-picker.component.html',
31
+ styleUrl: './cauca-date-time-picker.component.scss'
32
+ })
33
+ export class CaucaDateTimePickerComponent implements ControlValueAccessor, OnInit {
34
+
35
+ @Input() public subscriptSizing: SubscriptSizing = 'fixed';
36
+ @Input() public showTime: boolean = true;
37
+ @Input() public label: string = '';
38
+ @Input() public translateLabel: boolean = true;
39
+ @Input() public stepHours = 1;
40
+ @Input() public stepMinutes = 1;
41
+ @Input() public stepSecondes = 1;
42
+ @Input() public minimumDate: Date = null;
43
+ @Input() public maximumDate: Date = null;
44
+ @Input() public showSeconds: boolean = false;
45
+ @Input() public showFormat: string = 'yyyy/MM/dd, HH:mm';
46
+ @Input() public showClearButton: boolean = true;
47
+ @Input() public showButtonIcons: boolean = true;
48
+ @Output() public selectedChange = new EventEmitter<Date>();
49
+
50
+ public control: AbstractControl;
51
+ public stringDate: string = '';
52
+
53
+ private readonly injector = inject(Injector);
54
+ private readonly elementRef = inject(ElementRef);
55
+ private readonly dialog = inject(MatDialog);
56
+ private readonly datePipe = inject(DatePipe);
57
+ private selectedDate: Date;
58
+
59
+ @Input()
60
+ public set value(value: Date) {
61
+ if (value) {
62
+ this.stringDate = this.stringifyDate(value);
63
+ this.selectedDate = value;
64
+ }
65
+ }
66
+
67
+ public get isRequired(): boolean {
68
+ return Boolean(this.control?.hasValidator(Validators.required))
69
+ }
70
+
71
+ public ngOnInit(): void {
72
+ const ngControl = this.injector.get(NgControl, null, { self: true, optional: true });
73
+ if (ngControl instanceof FormControlName) {
74
+ const container = this.injector.get(ControlContainer).control as FormGroup;
75
+ this.control = container.controls[ngControl.name] as FormControl;
76
+ } else {
77
+ this.control = new FormControl();
78
+ }
79
+ }
80
+
81
+ public showDialog(): void {
82
+ const dialogRef = this.dialog.open(DialogDateTimePickerComponent, {
83
+ position: this.getDialogPosition(),
84
+ data: this.getDateTimePickerOptions(),
85
+ maxWidth: '100vw',
86
+ });
87
+
88
+ dialogRef.afterClosed().subscribe((data: DialogDateTimePickerValue) => {
89
+ if (data) {
90
+ this.stringDate = this.stringifyDate(data.value);
91
+ this.selectedDate = data.value;
92
+ this.selectedChange.emit(data.value);
93
+ this.onChange(data.value);
94
+ }
95
+ });
96
+ }
97
+
98
+ public writeValue(date: Date): void {
99
+ this.value = date;
100
+ }
101
+
102
+ public registerOnChange(fn: any): void {
103
+ this.onChange = fn;
104
+ }
105
+
106
+ public registerOnTouched(fn: any): void {
107
+ this.onTouched = fn;
108
+ }
109
+
110
+ public onChange = (value: Date): Date => value;
111
+
112
+ public onTouched = (): void => {/* This method needs to be empty */ };
113
+
114
+ private getDateTimePickerOptions(): DialogDateTimePickerOptions {
115
+ return {
116
+ selectedDate: this.selectedDate,
117
+ minimumDate: this.minimumDate,
118
+ maximumDate: this.maximumDate,
119
+ showSeconds: this.showSeconds,
120
+ showClearButton: this.showClearButton,
121
+ showButtonIcons: this.showButtonIcons,
122
+ showTime: this.showTime,
123
+ step: {
124
+ hours: this.stepHours,
125
+ minutes: this.stepMinutes,
126
+ seconds: this.stepSecondes,
127
+ }
128
+ };
129
+ }
130
+ private stringifyDate(date: Date): string {
131
+ return this.datePipe.transform(date, this.showFormat);
132
+ }
133
+
134
+ private getDialogPosition(): DialogPosition {
135
+ const rect = this.elementRef.nativeElement.getBoundingClientRect();
136
+ const top = rect.y + rect.height - 22;
137
+ const bottom = window.innerHeight - rect.y;
138
+ const minimumDialogHeight = 400;
139
+ const minimumScreenSize = 800;
140
+
141
+ if (window.innerHeight < minimumScreenSize || window.innerWidth < minimumScreenSize) {
142
+ return null;
143
+ } else if (window.innerHeight > (top + minimumDialogHeight)) {
144
+ return {
145
+ left: `${rect.x}px`,
146
+ top: `${top}px`,
147
+ };
148
+ }
149
+
150
+ return {
151
+ left: `${rect.x}px`,
152
+ bottom: `${bottom}px`,
153
+ };
154
+ }
155
+ }
@@ -0,0 +1,6 @@
1
+ <mat-list [disabled]="disabled?.all">
2
+ @for (option of options; track option) {
3
+ <mat-list-item [activated]="value === option" [disabled]="disabled?.someOptions.includes(option)"
4
+ (click)="valueChange.emit(option)">{{(option < 10 ? '0' : '' ) + option}}</mat-list-item>
5
+ }
6
+ </mat-list>
@@ -0,0 +1,25 @@
1
+ mat-list {
2
+ width: 50px;
3
+ padding: 0;
4
+
5
+ .mat-mdc-list-item:not(.mat-mdc-list-item-interactive) {
6
+ cursor: pointer;
7
+ }
8
+ }
9
+
10
+ >div::-webkit-scrollbar {
11
+ display: none;
12
+ }
13
+
14
+ ::ng-deep .mdc-list-item__primary-text {
15
+ font-family: var(--mat-datepicker-calendar-text-font);
16
+ font-size: var(--mat-datepicker-calendar-text-size);
17
+ }
18
+
19
+ ::ng-deep .mdc-list-item--activated {
20
+ background-color: var(--mat-datepicker-calendar-date-selected-state-background-color);
21
+
22
+ .mdc-list-item__primary-text {
23
+ color: var(--mat-datepicker-calendar-date-selected-state-text-color);
24
+ }
25
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { DesktopTimePickerComponent } from './desktop-time-picker.component';
4
+
5
+ describe('DesktopTimePickerComponent', () => {
6
+ let component: DesktopTimePickerComponent;
7
+ let fixture: ComponentFixture<DesktopTimePickerComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [DesktopTimePickerComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(DesktopTimePickerComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,23 @@
1
+ import { Component, EventEmitter, Input, Output } from '@angular/core';
2
+ import { MatListModule } from '@angular/material/list';
3
+
4
+ @Component({
5
+ selector: 'cauca-desktop-time-picker',
6
+ imports: [
7
+ MatListModule
8
+ ],
9
+ templateUrl: './desktop-time-picker.component.html',
10
+ styleUrl: './desktop-time-picker.component.scss'
11
+ })
12
+ export class DesktopTimePickerComponent {
13
+ @Input() public options: number[] = [];
14
+ @Input() public value: number;
15
+ @Input() public disabled: DesktopTimePickerComponentDisabled;
16
+
17
+ @Output() public valueChange = new EventEmitter<number>();
18
+ }
19
+
20
+ export interface DesktopTimePickerComponentDisabled {
21
+ all: boolean;
22
+ someOptions: number[];
23
+ }
@@ -0,0 +1,77 @@
1
+ <div mat-dialog-content>
2
+ <div [ngClass]="showSeconds() ? 'show-seconds' : 'hide-seconds'" class="date-time-picker">
3
+ <div class="calendar">
4
+ <mat-calendar
5
+ [minDate]="minimumDate"
6
+ [maxDate]="maximumDate"
7
+ [selected]="selectedDate"
8
+ (selectedChange)="dateChanged($event)"
9
+ ></mat-calendar>
10
+ </div>
11
+
12
+ @if (showTime()) {
13
+ @if (!showMobileUi) {
14
+ <div class="hours">
15
+ <cauca-desktop-time-picker [disabled]="{all: disabled.hours, someOptions: disabled.someHours}" (valueChange)="hourChanged($event)" [options]="hours" [value]="selectedHour"/>
16
+ </div>
17
+ }
18
+ @if (showMobileUi) {
19
+ <div class="hours">
20
+ <cauca-mobile-time-picker (valueChange)="hourChanged($event)" [options]="hours" [value]="selectedHour" />
21
+ </div>
22
+ }
23
+
24
+ @if (showMobileUi) {
25
+ <div class="hour-and-minute-separator">:</div>
26
+ }
27
+
28
+ @if (!showMobileUi) {
29
+ <div class="minutes">
30
+ <cauca-desktop-time-picker [disabled]="{all: disabled.minutes, someOptions: disabled.someMinutes}" (valueChange)="minuteChanged($event)" [options]="minutes" [value]="selectedMinute"/>
31
+ </div>
32
+ }
33
+ @if (showMobileUi) {
34
+ <div class="minutes">
35
+ <cauca-mobile-time-picker (valueChange)="minuteChanged($event)" [options]="minutes" [value]="selectedMinute" />
36
+ </div>
37
+ }
38
+
39
+ @if (showSeconds() && showMobileUi) {
40
+ <div class="minute-and-second-separator">:</div>
41
+ }
42
+ @if (showSeconds() && !showMobileUi) {
43
+ <div class="seconds">
44
+ <cauca-desktop-time-picker [disabled]="{all: disabled.seconds, someOptions: disabled.someSeconds}" (valueChange)="secondChanged($event)" [options]="seconds" [value]="selectedSecond"/>
45
+ </div>
46
+ }
47
+ @if (showSeconds() && showMobileUi) {
48
+ <div class="seconds">
49
+ <cauca-mobile-time-picker (valueChange)="secondChanged($event)" [options]="seconds" [value]="selectedSecond" />
50
+ </div>
51
+ }
52
+ }
53
+ </div>
54
+ </div>
55
+
56
+ <div mat-dialog-actions align="end">
57
+ @if (showClearButton) {
58
+ <button mat-stroked-button (click)="clear()">
59
+ @if (showButtonIcons) {
60
+ <mat-icon>clear</mat-icon>
61
+ }
62
+ {{'material.clear' | translate}}
63
+ </button>
64
+ }
65
+ <button color="primary" mat-stroked-button (click)="cancel()">
66
+ @if (showButtonIcons) {
67
+ <mat-icon>cancel</mat-icon>
68
+ }
69
+ {{'material.cancel' | translate}}
70
+ </button>
71
+ <button color="primary" mat-raised-button cdkFocusInitial (click)="confirm()">
72
+ @if (showButtonIcons) {
73
+ <mat-icon>check</mat-icon>
74
+ }
75
+ {{'material.ok' | translate}}
76
+ </button>
77
+ </div>
@@ -0,0 +1,124 @@
1
+ @use '@angular/material' as mat;
2
+
3
+ div[mat-dialog-actions] {
4
+ padding: 8px;
5
+ border-top: 1px solid #ccc;
6
+
7
+ button {
8
+ margin: 2px;
9
+ }
10
+ }
11
+
12
+ .date-time-picker {
13
+ display: grid;
14
+ grid-template-areas:
15
+ "calendar hours minutes seconds";
16
+ height: 350px;
17
+ overflow: hidden;
18
+ justify-content: center;
19
+
20
+ >div {
21
+ overflow: auto;
22
+ flex: 1;
23
+ max-width: 50px;
24
+ scrollbar-width: none;
25
+ border-left: 1px solid #ccc;
26
+ }
27
+
28
+ >div:first-child {
29
+ flex: 4;
30
+ max-width: 290px;
31
+ border-left: none;
32
+
33
+ mat-calendar {
34
+ width: 290px;
35
+ height: 350px;
36
+ }
37
+ }
38
+
39
+ >div::-webkit-scrollbar {
40
+ display: none;
41
+ }
42
+
43
+ ::ng-deep .mdc-list-item__primary-text {
44
+ font-family: var(--mat-datepicker-calendar-text-font);
45
+ font-size: var(--mat-datepicker-calendar-text-size);
46
+ }
47
+
48
+ ::ng-deep .mdc-list-item--activated {
49
+ background-color: var(--mat-datepicker-calendar-date-selected-state-background-color);
50
+
51
+ .mdc-list-item__primary-text {
52
+ color: var(--mat-datepicker-calendar-date-selected-state-text-color);
53
+ }
54
+ }
55
+ }
56
+
57
+ .calendar {
58
+ grid-area: calendar;
59
+ }
60
+
61
+ .hours {
62
+ grid-area: hours;
63
+ }
64
+
65
+ .minutes {
66
+ grid-area: minutes;
67
+ }
68
+
69
+ .seconds {
70
+ grid-area: seconds;
71
+ }
72
+
73
+ .hour-and-minute-separator {
74
+ grid-area: hour-and-minute-separator;
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: center;
78
+ font-weight: 700;
79
+ }
80
+
81
+ .minute-and-second-separator {
82
+ grid-area: minute-and-second-separator;
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: center;
86
+ font-weight: 700;
87
+ }
88
+
89
+ @media only screen and (max-width: 555px) {
90
+
91
+ .show-seconds {
92
+ grid-template-areas:
93
+ "calendar calendar calendar calendar calendar calendar calendar"
94
+ ". hours hour-and-minute-separator minutes minute-and-second-separator seconds .";
95
+ grid-template-columns: auto 40px 2px 40px 2px 40px auto;
96
+ }
97
+
98
+ .hide-seconds {
99
+ grid-template-areas:
100
+ "calendar calendar calendar calendar calendar"
101
+ ". hours hour-and-minute-separator minutes .";
102
+ grid-template-columns: auto 40px 2px 40px auto;
103
+ }
104
+
105
+ .date-time-picker {
106
+ grid-template-rows: auto auto;
107
+ height: 450px;
108
+
109
+ >div {
110
+ border-left: none;
111
+ }
112
+
113
+ >div:not(:first-child) {
114
+ height: 70px;
115
+ }
116
+
117
+ >div:first-child {
118
+ overflow: initial;
119
+ flex: 4;
120
+ max-width: 290px;
121
+ border-left: none;
122
+ }
123
+ }
124
+ }