@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,215 @@
1
+ import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
2
+ import { Component, Input } from '@angular/core';
3
+
4
+ import { SelectWithSearchComponent } from './select-with-search.component';
5
+ import { HarnessLoader } from '@angular/cdk/testing';
6
+ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
7
+ import { MatFormFieldHarness } from '@angular/material/form-field/testing';
8
+ import { MockModule, MockPipe } from 'ng-mocks';
9
+ import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
10
+ import { MatSelectHarness } from '@angular/material/select/testing';
11
+
12
+ // Mock the external search component to avoid FormControl timing side-effects in tests
13
+ @Component({ selector: 'ngx-mat-select-search', template: '' })
14
+ class MockNgxMatSelectSearchComponent {
15
+ @Input() public formControl: any;
16
+ @Input() public placeholderLabel?: string;
17
+ @Input() public noEntriesFoundLabel?: string;
18
+ }
19
+
20
+ describe('SelectWithSearchComponent', () => {
21
+ let component: SelectWithSearchComponent;
22
+ let fixture: ComponentFixture<SelectWithSearchComponent>;
23
+ let loader: HarnessLoader;
24
+
25
+ beforeEach(async () => {
26
+ await TestBed.configureTestingModule({
27
+ imports: [SelectWithSearchComponent, MockModule(TranslateModule)],
28
+ declarations: [
29
+ MockPipe(TranslatePipe, value => value),
30
+ MockNgxMatSelectSearchComponent
31
+ ]
32
+ }).compileComponents();
33
+
34
+ fixture = TestBed.createComponent(SelectWithSearchComponent);
35
+ loader = TestbedHarnessEnvironment.loader(fixture);
36
+ component = fixture.componentInstance;
37
+
38
+ fixture.componentRef.setInput('showClearOption', false);
39
+ fixture.componentRef.setInput('enableSearch', true);
40
+ fixture.detectChanges();
41
+ });
42
+
43
+ it('should create', () => {
44
+ expect(component).toBeTruthy();
45
+ });
46
+
47
+ it('should show label received in input', fakeAsync(async () => {
48
+ const someLabel = 'ASuperLabel';
49
+
50
+ component.label = someLabel;
51
+ fixture.detectChanges();
52
+ tick();
53
+
54
+ const formField = await loader.getHarnessOrNull(MatFormFieldHarness);
55
+ expect(await formField.getLabel()).toBe(someLabel);
56
+ }));
57
+
58
+ it('should disable control when zero option are provided', async () => {
59
+ const formField = await loader.getHarnessOrNull(MatFormFieldHarness);
60
+
61
+ expect(await formField.isDisabled()).toBeTrue();
62
+ });
63
+
64
+ it('shouldn\'t disable control when options are provided', async () => {
65
+ component.options = [{id: '1', name: 'Super!'}];
66
+ fixture.detectChanges();
67
+ const formField = await loader.getHarnessOrNull(MatFormFieldHarness);
68
+
69
+ expect(await formField.isDisabled()).toBeFalse();
70
+ });
71
+
72
+ it('should always have ngx search mat-option', async () => {
73
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
74
+ component.options = [{ id: '1', name: 'Super!' }];
75
+ fixture.detectChanges();
76
+
77
+ await formField.open();
78
+
79
+ expect((await formField.getOptions()).length).toBe(2);
80
+ });
81
+
82
+ it('should show mat-option for each option provided', async () => {
83
+ component.options = [{ id: '1', name: 'Super!' }, { id: '2', name: 'Cool!'}];
84
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
85
+
86
+ fixture.detectChanges();
87
+ await formField.open();
88
+
89
+ expect((await formField.getOptions()).length).toBe(3);
90
+ });
91
+
92
+ it('should select option when value is provided', async () => {
93
+ const someOption = { id: '1', name: 'Super!' };
94
+ component.value = someOption.id;
95
+ component.options = [{ id: '2', name: 'Cool!' }, someOption];
96
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
97
+
98
+ fixture.detectChanges();
99
+ await formField.open();
100
+
101
+ expect(await formField.getValueText()).toBe(someOption.name);
102
+ });
103
+
104
+ it('should emit valueChanged when option change', async () => {
105
+ const someOption = { id: '1', name: 'Super!' };
106
+ component.options = [someOption, { id: '2', name: 'Cool!' }];
107
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
108
+
109
+ fixture.detectChanges();
110
+ await formField.open();
111
+ await formField.clickOptions({text: someOption.name});
112
+
113
+ expect(component.value).toBe(someOption.id);
114
+ expect(await formField.getValueText()).toBe(someOption.name);
115
+ });
116
+
117
+ it('should filter options when setting filter control value', fakeAsync(() => {
118
+ const someOption = { id: '1', name: 'Super!' };
119
+ component.options = [someOption, { id: '2', name: 'Cool!' }];
120
+
121
+ fixture.detectChanges();
122
+ tick();
123
+
124
+ expect(component.filteredOptions.value()?.length).toBe(2);
125
+
126
+ component.optionFilterControl.setValue('Co');
127
+ tick();
128
+ fixture.detectChanges();
129
+ tick();
130
+
131
+ expect(component.filteredOptions.value()?.length).toBe(1);
132
+ expect(component.filteredOptions.value()![0].name).toBe('Cool!');
133
+ }));
134
+
135
+ it('should select first option when selectFirstOptionByDefault is true', async () => {
136
+ const someOption = { id: '1', name: 'Super!' };
137
+ component.selectFirstOptionByDefault = true;
138
+ component.options = [someOption, { id: '2', name: 'Cool!' }];
139
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
140
+
141
+ expect(await formField.getValueText()).toBe(someOption.name);
142
+ });
143
+
144
+ it('shouldn\'t select first option when selectFirstOptionByDefault is false', async () => {
145
+ const someOption = { id: '1', name: 'Super!' };
146
+ component.selectFirstOptionByDefault = false;
147
+ component.options = [someOption, { id: '2', name: 'Cool!' }];
148
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
149
+
150
+ expect(await formField.getValueText()).toBeFalsy();
151
+ });
152
+
153
+ it('should show clear option when showClearOption is true', async () => {
154
+ fixture.componentRef.setInput('showClearOption', true);
155
+ component.options = [{ id: '1', name: 'Super!' }, { id: '2', name: 'Cool!' }];
156
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
157
+
158
+ fixture.detectChanges();
159
+ await formField.open();
160
+
161
+ expect((await formField.getOptions()).length).toBe(4);
162
+
163
+ const options = await formField.getOptions();
164
+ expect(await options[1].getText()).toBe('--');
165
+ });
166
+
167
+ it('should not show clear option when showClearOption is false', async () => {
168
+ fixture.componentRef.setInput('showClearOption', false);
169
+ component.options = [{ id: '1', name: 'Super!' }, { id: '2', name: 'Cool!' }];
170
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
171
+
172
+ fixture.detectChanges();
173
+ await formField.open();
174
+
175
+ // Should have search option + 2 regular options = 3 total
176
+ expect((await formField.getOptions()).length).toBe(3);
177
+ });
178
+
179
+ it('should clear selection when clear option is selected', async () => {
180
+ fixture.componentRef.setInput('showClearOption', true);
181
+ component.value = '1';
182
+ component.options = [{ id: '1', name: 'Super!' }, { id: '2', name: 'Cool!' }];
183
+ const formField = await loader.getHarnessOrNull(MatSelectHarness);
184
+
185
+ fixture.detectChanges();
186
+ await formField.open();
187
+ await formField.clickOptions({ text: '--' });
188
+
189
+ expect(component.value).toBeNull();
190
+ });
191
+
192
+ it('should always show clear option even when filtering', fakeAsync(() => {
193
+ fixture.componentRef.setInput('showClearOption', true);
194
+ component.options = [{ id: '1', name: 'Super!' }, { id: '2', name: 'Cool!' }];
195
+
196
+ fixture.detectChanges();
197
+ tick();
198
+
199
+ // With clear option enabled, the resource should include clear option at index 0
200
+ const initial = component.filteredOptions.value() || [];
201
+ expect(initial.length).toBe(3);
202
+ expect(initial[0].name).toBe('--');
203
+
204
+ // Filter and ensure the clear option remains present
205
+ component.optionFilterControl.setValue('Co');
206
+ tick();
207
+ fixture.detectChanges();
208
+ tick();
209
+
210
+ const filtered = component.filteredOptions.value() || [];
211
+ expect(filtered.length).toBe(2);
212
+ expect(filtered[0].name).toBe('--');
213
+ expect(filtered[1].name).toBe('Cool!');
214
+ }));
215
+ });
@@ -0,0 +1,108 @@
1
+ import { Component, computed, EventEmitter, input, Input, Output, resource, signal, ViewChild } from '@angular/core';
2
+ import { ReactiveFormsModule, FormsModule, FormControl } from '@angular/forms';
3
+ import { MatFormFieldModule } from '@angular/material/form-field';
4
+ import { MatSelect, MatSelectModule } from '@angular/material/select';
5
+ import { TranslateModule } from '@ngx-translate/core';
6
+ import { NgxMatSelectSearchModule } from 'ngx-mat-select-search';
7
+ import { toSignal } from '@angular/core/rxjs-interop';
8
+ import { toLowerCaseAndWithoutDiacritics } from '@cauca-911/core';
9
+
10
+ export interface Option {
11
+ id: string | null;
12
+ name: string;
13
+ }
14
+
15
+ @Component({
16
+ selector: 'cauca-select-with-search',
17
+ standalone: true,
18
+ imports: [MatSelectModule, TranslateModule, MatFormFieldModule, ReactiveFormsModule, FormsModule, NgxMatSelectSearchModule],
19
+ templateUrl: './select-with-search.component.html',
20
+ styleUrl: './select-with-search.component.scss'
21
+ })
22
+ export class SelectWithSearchComponent {
23
+ @Input({required: true}) public label: string;
24
+ @Input() public selectFirstOptionByDefault: boolean = false;
25
+
26
+ public optionFilterControl: FormControl<string> = new FormControl<string>('');
27
+ @ViewChild('singleSelect', { static: true }) public singleSelect: MatSelect;
28
+ public isDisabled = input<boolean>(false);
29
+ public hasOptions = signal<boolean>(false);
30
+ public disableControl = computed(() => this.isDisabled() || !this.hasOptions());
31
+ public allowMultiSelection = input<boolean>(false);
32
+ public showClearOption = input<boolean>(false);
33
+ public enableSearch = input<boolean>(true);
34
+
35
+ public filteredOptions = resource({
36
+ params: () => ({ filter: this.filterText(), options: this.allOptions(), showClear: this.showClearOption() }),
37
+ loader: ({ params }) => Promise.resolve(this.computeFilteredOptions(params))
38
+ });
39
+
40
+ @Output()
41
+ public valueChanged = new EventEmitter();
42
+
43
+ private selectedOptionId: string | null;
44
+ private readonly allOptions = signal<Option[]>([]);
45
+ private readonly filterText = toSignal(this.optionFilterControl.valueChanges, { initialValue: '' });
46
+
47
+ @Input()
48
+ public set options(newOptions: Option[]) {
49
+ if (newOptions) {
50
+ this.allOptions.set(newOptions);
51
+ this.hasOptions.set(newOptions.length >= 1);
52
+ this.setInitialSelectedOption();
53
+ } else {
54
+ this.allOptions.set([]);
55
+ this.hasOptions.set(false);
56
+ }
57
+ }
58
+ public get options(): Option[] {
59
+ return this.allOptions();
60
+ }
61
+
62
+ @Input()
63
+ public set value(newValue: string | null) {
64
+ if (newValue !== this.selectedOptionId) {
65
+ this.selectedOptionId = newValue;
66
+ this.valueChanged.emit(this.value);
67
+ }
68
+ }
69
+ public get value(): string | null {
70
+ return this.selectedOptionId;
71
+ }
72
+
73
+ private setInitialSelectedOption(): void {
74
+ if (this.value) {
75
+ const city = this.options.find((c: Option) => c.id === this.value);
76
+ if (!city) {
77
+ this.selectFirstOption();
78
+ }
79
+ } else if (this.options.length > 0 && this.selectFirstOptionByDefault) {
80
+ this.selectFirstOption();
81
+ }
82
+ }
83
+
84
+ private selectFirstOption(): void {
85
+ this.value = this.options[0].id;
86
+ }
87
+
88
+ private computeFilteredOptions(params: { filter: string, options: Option[], showClear: boolean }): Option[] {
89
+ const { filter, options, showClear } = params;
90
+ if (!options || !Array.isArray(options)) {
91
+ return [];
92
+ }
93
+ let filtered: Option[];
94
+
95
+ if (!filter) {
96
+ filtered = options.slice();
97
+ } else {
98
+ const filterLower = toLowerCaseAndWithoutDiacritics(filter);
99
+ filtered = options.filter(option => toLowerCaseAndWithoutDiacritics(option?.name ?? '').indexOf(filterLower) > -1);
100
+ }
101
+ if (showClear) {
102
+ const clearOption: Option = { id: null, name: '--' };
103
+ filtered = [clearOption, ...filtered];
104
+ }
105
+
106
+ return filtered;
107
+ }
108
+ }
@@ -0,0 +1,14 @@
1
+ <section>
2
+ <div class="expansion-button" (click)="changeState()">
3
+ <mat-icon [class.collapsed]="isCollapsed()">expand_less</mat-icon>
4
+ <div>
5
+ <div class="primary">{{caption()}}</div>
6
+ <div class="body2">{{subCaption()}}</div>
7
+ </div>
8
+ </div>
9
+ <div class="expansion-panel" [class.collapsed]="isCollapsed()">
10
+ <div class="expansion-panel-content">
11
+ <ng-content></ng-content>
12
+ </div>
13
+ </div>
14
+ </section>
@@ -0,0 +1,48 @@
1
+ section {
2
+ display: flex;
3
+ padding: 16px 0px;
4
+ }
5
+
6
+ .primary {
7
+ font-weight: 600;
8
+ }
9
+
10
+ .body2 {
11
+ width: fit-content;
12
+ white-space: nowrap;
13
+ }
14
+
15
+ .expansion-button {
16
+ display: flex;
17
+ gap: 4px;
18
+ width: 240px;
19
+ padding: 0px 16px 8px 0px;
20
+ cursor: pointer;
21
+ height: fit-content;
22
+
23
+ mat-icon {
24
+ transition: transform 500ms ease-in-out;
25
+ &.collapsed {
26
+ transform: rotate(180deg);
27
+ }
28
+ }
29
+ }
30
+
31
+ .expansion-panel {
32
+ overflow: hidden;
33
+ flex: 1;
34
+ display: grid;
35
+ grid-template-rows: 1fr;
36
+ min-height: 0;
37
+ transition: grid-template-rows 500ms ease-in, opacity 500ms ease-in, visibility 500ms ease-in;
38
+
39
+ &.collapsed {
40
+ grid-template-rows: 0fr;
41
+ opacity: 0;
42
+ visibility: hidden;
43
+ }
44
+ }
45
+
46
+ .expansion-panel-content {
47
+ min-height: 0;
48
+ }
@@ -0,0 +1,48 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { ExpandablePanelComponent } from './expandable-panel.component';
3
+
4
+ describe('ExpandablePanelComponent', () => {
5
+ let component: ExpandablePanelComponent;
6
+ let fixture: ComponentFixture<ExpandablePanelComponent>;
7
+
8
+ beforeEach(async () => {
9
+ await TestBed.configureTestingModule({
10
+ imports: [ExpandablePanelComponent],
11
+ })
12
+ .compileComponents();
13
+
14
+ fixture = TestBed.createComponent(ExpandablePanelComponent);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+
23
+ it('should display the title and subtitle', () => {
24
+ const someTitle = 'someTitle';
25
+ const someSubTitle = 'someSubTitle';
26
+ fixture.componentRef.setInput('caption', someTitle);
27
+ fixture.componentRef.setInput('subCaption', someSubTitle);
28
+
29
+ fixture.detectChanges();
30
+
31
+ expect(component.subCaption()).toBe(someSubTitle);
32
+ expect(component.caption()).toBe(someTitle);
33
+ expect(fixture.nativeElement.querySelector('.primary').textContent).toBe(someTitle);
34
+ expect(fixture.nativeElement.querySelector('.body2').textContent).toBe(someSubTitle);
35
+ });
36
+
37
+ it('should be open by default', () => {
38
+ expect(component.isCollapsed()).toBeFalse();
39
+ });
40
+
41
+ it('should collapsed when clicking on the button', () => {
42
+ fixture.nativeElement.querySelector('.expansion-button').click();
43
+ fixture.detectChanges();
44
+
45
+ expect(component.isCollapsed()).toBeTrue();
46
+ });
47
+
48
+ });
@@ -0,0 +1,19 @@
1
+ import { ChangeDetectionStrategy, Component, InputSignal, ModelSignal, input, model } from '@angular/core';
2
+ import { MatIcon } from '@angular/material/icon';
3
+
4
+ @Component({
5
+ selector: 'cauca-expandable-panel',
6
+ changeDetection: ChangeDetectionStrategy.OnPush,
7
+ imports: [MatIcon],
8
+ templateUrl: './expandable-panel.component.html',
9
+ styleUrl: './expandable-panel.component.scss',
10
+ })
11
+ export class ExpandablePanelComponent {
12
+ public isCollapsed: ModelSignal<boolean> = model(false);
13
+ public caption: InputSignal<string> = input('');
14
+ public subCaption: InputSignal<string> = input('');
15
+
16
+ public changeState(): void {
17
+ this.isCollapsed.update(value => !value);
18
+ }
19
+ }
@@ -0,0 +1,6 @@
1
+ <div class="group-container">
2
+ <div class="group-container-title subtitle1">{{caption()|translate}}</div>
3
+ <div class="group-container-content">
4
+ <ng-content />
5
+ </div>
6
+ </div>
@@ -0,0 +1,22 @@
1
+ .group-container {
2
+ display: flex;
3
+ align-items: flex-start;
4
+ align-self: stretch;
5
+ }
6
+
7
+ .group-container-title {
8
+ display: flex;
9
+ width: 300px;
10
+ max-width: 300px;
11
+ padding: 16px 0px;
12
+ flex-direction: column;
13
+ align-items: flex-start;
14
+ }
15
+
16
+ .group-container-content {
17
+ display: flex;
18
+ flex-direction: column;
19
+ align-items: stretch;
20
+ flex: 1;
21
+ padding: 16px;
22
+ }
@@ -0,0 +1,34 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { GroupContainerComponent } from './group-container.component';
4
+ import { MockModule, MockPipe } from 'ng-mocks';
5
+ import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
6
+
7
+ describe('GroupContainerComponent', () => {
8
+ let component: GroupContainerComponent;
9
+ let fixture: ComponentFixture<GroupContainerComponent>;
10
+
11
+ beforeEach(async () => {
12
+ await TestBed.configureTestingModule({
13
+ imports: [GroupContainerComponent, MockModule(TranslateModule)],
14
+ declarations: [MockPipe(TranslatePipe, value => value)],
15
+ })
16
+ .compileComponents();
17
+
18
+ fixture = TestBed.createComponent(GroupContainerComponent);
19
+ component = fixture.componentInstance;
20
+ fixture.detectChanges();
21
+ });
22
+
23
+ it('should create', () => {
24
+ expect(component).toBeTruthy();
25
+ });
26
+
27
+ it('should have display the caption', () =>{
28
+ fixture.componentRef.setInput('caption', 'Test Caption');
29
+
30
+ fixture.detectChanges();
31
+
32
+ expect(fixture.nativeElement.querySelector('.group-container-title').textContent).toContain('Test Caption');
33
+ });
34
+ });
@@ -0,0 +1,14 @@
1
+ import { ChangeDetectionStrategy, Component, input } from '@angular/core';
2
+ import { TranslateModule } from '@ngx-translate/core';
3
+
4
+ @Component({
5
+ selector: 'cauca-group-container',
6
+ standalone: true,
7
+ changeDetection: ChangeDetectionStrategy.OnPush,
8
+ imports: [TranslateModule],
9
+ templateUrl: './group-container.component.html',
10
+ styleUrl: './group-container.component.scss'
11
+ })
12
+ export class GroupContainerComponent {
13
+ public caption = input<string>();
14
+ }
@@ -0,0 +1,13 @@
1
+ <section [ngClass]="opened() ? 'bottom-padding' : ''" (click)="handleClick()">
2
+ <mat-icon>{{menuIcon()}}</mat-icon>
3
+ <div>
4
+ <div class="subtitle1">{{caption() | translate}}</div>
5
+ @if(subCaption()) {<div class="body2">{{subCaption() | translate}}</div>}
6
+ </div>
7
+ @if (showExpansionIcon()) {<mat-icon [class.opened]="opened()">arrow_forward_ios</mat-icon>}
8
+ </section>
9
+ @if(opened()) {
10
+ @for (item of items(); track item.title) {
11
+ <cauca-menu-expandable-panel-item [icon]="item.icon" [caption]="item.title" [route]="item.route" [isSubItem]="true" [action]="item.action" />
12
+ }
13
+ }
@@ -0,0 +1,27 @@
1
+ :host {
2
+ padding: 10px 12px;
3
+ background-color: #FFFFFF;
4
+ cursor: pointer;
5
+ display: block;
6
+ }
7
+
8
+ section {
9
+ display: flex;
10
+ gap: 16px;
11
+ align-items: center;
12
+
13
+ mat-icon:last-child {
14
+ transition: transform 200ms ease-in-out;
15
+ &.opened {
16
+ transform: rotate(-90deg);
17
+ }
18
+ }
19
+ }
20
+
21
+ section.bottom-padding {
22
+ padding-bottom: 10px;
23
+ }
24
+
25
+ div {
26
+ flex: 1;
27
+ }