@cauca-911/material 21.0.1 → 21.0.3

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 (241) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -24
  3. package/{src/assets → assets}/i18n/cauca/en-material.json +104 -104
  4. package/{src/assets → assets}/i18n/cauca/es-material.json +104 -104
  5. package/{src/assets → assets}/i18n/cauca/fr-material.json +106 -106
  6. package/fesm2022/cauca-911-material.mjs +4145 -0
  7. package/fesm2022/cauca-911-material.mjs.map +1 -0
  8. package/package.json +38 -23
  9. package/types/cauca-911-material.d.ts +745 -0
  10. package/.eslintrc.json +0 -79
  11. package/README_PACKAGE.md +0 -5
  12. package/cauca-911-material-21.0.0.tgz +0 -0
  13. package/karma.conf.js +0 -50
  14. package/ng-package.json +0 -7
  15. package/src/lib/cauca-material.component.html +0 -1
  16. package/src/lib/cauca-material.component.spec.ts +0 -29
  17. package/src/lib/cauca-material.component.ts +0 -12
  18. package/src/lib/cauca-material.service.spec.ts +0 -16
  19. package/src/lib/cauca-material.service.ts +0 -7
  20. package/src/lib/components/button/button.component.html +0 -52
  21. package/src/lib/components/button/button.component.scss +0 -6
  22. package/src/lib/components/button/button.component.spec.ts +0 -142
  23. package/src/lib/components/button/button.component.ts +0 -22
  24. package/src/lib/components/buttons/base-button.ts +0 -35
  25. package/src/lib/components/buttons/basic-button/basic-button.component.html +0 -5
  26. package/src/lib/components/buttons/basic-button/basic-button.component.scss +0 -12
  27. package/src/lib/components/buttons/basic-button/basic-button.component.spec.ts +0 -106
  28. package/src/lib/components/buttons/basic-button/basic-button.component.ts +0 -17
  29. package/src/lib/components/buttons/fab-button/fab-button.component.html +0 -3
  30. package/src/lib/components/buttons/fab-button/fab-button.component.scss +0 -12
  31. package/src/lib/components/buttons/fab-button/fab-button.component.spec.ts +0 -82
  32. package/src/lib/components/buttons/fab-button/fab-button.component.ts +0 -16
  33. package/src/lib/components/buttons/flat-button/flat-button.component.html +0 -5
  34. package/src/lib/components/buttons/flat-button/flat-button.component.scss +0 -12
  35. package/src/lib/components/buttons/flat-button/flat-button.component.spec.ts +0 -106
  36. package/src/lib/components/buttons/flat-button/flat-button.component.ts +0 -17
  37. package/src/lib/components/buttons/icon-button/icon-button.component.html +0 -3
  38. package/src/lib/components/buttons/icon-button/icon-button.component.scss +0 -23
  39. package/src/lib/components/buttons/icon-button/icon-button.component.spec.ts +0 -38
  40. package/src/lib/components/buttons/icon-button/icon-button.component.ts +0 -15
  41. package/src/lib/components/buttons/link-button/link-button.component.html +0 -1
  42. package/src/lib/components/buttons/link-button/link-button.component.scss +0 -3
  43. package/src/lib/components/buttons/link-button/link-button.component.spec.ts +0 -97
  44. package/src/lib/components/buttons/link-button/link-button.component.ts +0 -25
  45. package/src/lib/components/buttons/menu-item/menu-item.component.html +0 -5
  46. package/src/lib/components/buttons/menu-item/menu-item.component.scss +0 -6
  47. package/src/lib/components/buttons/menu-item/menu-item.component.spec.ts +0 -66
  48. package/src/lib/components/buttons/menu-item/menu-item.component.ts +0 -19
  49. package/src/lib/components/buttons/raised-button/raised-button.component.html +0 -5
  50. package/src/lib/components/buttons/raised-button/raised-button.component.scss +0 -12
  51. package/src/lib/components/buttons/raised-button/raised-button.component.spec.ts +0 -108
  52. package/src/lib/components/buttons/raised-button/raised-button.component.ts +0 -17
  53. package/src/lib/components/buttons/refresh-button/refresh-button.component.html +0 -1
  54. package/src/lib/components/buttons/refresh-button/refresh-button.component.scss +0 -0
  55. package/src/lib/components/buttons/refresh-button/refresh-button.component.spec.ts +0 -81
  56. package/src/lib/components/buttons/refresh-button/refresh-button.component.ts +0 -19
  57. package/src/lib/components/buttons/round-button/round-button.component.html +0 -3
  58. package/src/lib/components/buttons/round-button/round-button.component.scss +0 -34
  59. package/src/lib/components/buttons/round-button/round-button.component.spec.ts +0 -26
  60. package/src/lib/components/buttons/round-button/round-button.component.ts +0 -14
  61. package/src/lib/components/buttons/stroked-button/stroked-button.component.html +0 -5
  62. package/src/lib/components/buttons/stroked-button/stroked-button.component.scss +0 -23
  63. package/src/lib/components/buttons/stroked-button/stroked-button.component.spec.ts +0 -114
  64. package/src/lib/components/buttons/stroked-button/stroked-button.component.ts +0 -17
  65. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.html +0 -9
  66. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.scss +0 -7
  67. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.spec.ts +0 -68
  68. package/src/lib/components/cauca-date-time-picker/cauca-date-time-picker.component.ts +0 -155
  69. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.html +0 -6
  70. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.scss +0 -25
  71. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.spec.ts +0 -23
  72. package/src/lib/components/cauca-date-time-picker/components/desktop-time-picker/desktop-time-picker.component.ts +0 -23
  73. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.html +0 -77
  74. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.scss +0 -124
  75. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.spec.ts +0 -96
  76. package/src/lib/components/cauca-date-time-picker/components/dialog-date-time-picker/dialog-date-time-picker.component.ts +0 -228
  77. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.html +0 -9
  78. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.scss +0 -15
  79. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.spec.ts +0 -105
  80. package/src/lib/components/cauca-date-time-picker/components/mobile-time-picker/mobile-time-picker.component.ts +0 -48
  81. package/src/lib/components/cauca-date-time-picker/models/dialog-date-time-picker-data.ts +0 -29
  82. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.html +0 -14
  83. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.scss +0 -3
  84. package/src/lib/components/deprecated-components/cauca-input-file/cauca-input-file.component.ts +0 -87
  85. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.html +0 -12
  86. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.scss +0 -3
  87. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.spec.ts +0 -35
  88. package/src/lib/components/deprecated-components/cauca-input-multiple-langue/cauca-input-multiple-langue.component.ts +0 -57
  89. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.html +0 -49
  90. package/src/lib/components/deprecated-components/cauca-menu-vertical/cauca-menu-vertical.component.ts +0 -56
  91. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.html +0 -11
  92. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.scss +0 -4
  93. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.spec.ts +0 -39
  94. package/src/lib/components/deprecated-components/cauca-simple-dialog/cauca-simple-dialog.component.ts +0 -20
  95. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.html +0 -7
  96. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.scss +0 -41
  97. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.spec.ts +0 -24
  98. package/src/lib/components/deprecated-components/cauca-slideshow/cauca-slideshow.component.ts +0 -67
  99. package/src/lib/components/deprecated-components/shared/models/menu-item.ts +0 -11
  100. package/src/lib/components/deprecated-components/shared/models/simple-dialog-data.ts +0 -5
  101. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.html +0 -10
  102. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.scss +0 -14
  103. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.spec.ts +0 -90
  104. package/src/lib/components/dialogs/alert-dialog/alert-dialog.component.ts +0 -41
  105. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.html +0 -11
  106. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.scss +0 -29
  107. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.spec.ts +0 -137
  108. package/src/lib/components/dialogs/confirm-dialog/confirm-dialog.component.ts +0 -47
  109. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.html +0 -17
  110. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.scss +0 -14
  111. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.spec.ts +0 -96
  112. package/src/lib/components/dialogs/delete-dialog/delete-dialog.component.ts +0 -40
  113. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.spec.ts +0 -7
  114. package/src/lib/components/dialogs/delete-dialog/models/delete-dialog-data.ts +0 -5
  115. package/src/lib/components/dialogs/dialog-styles.css +0 -9
  116. package/src/lib/components/dialogs/dialog-styles.scss +0 -9
  117. package/src/lib/components/dialogs/error-dialog/error-dialog.component.html +0 -10
  118. package/src/lib/components/dialogs/error-dialog/error-dialog.component.scss +0 -10
  119. package/src/lib/components/dialogs/error-dialog/error-dialog.component.spec.ts +0 -91
  120. package/src/lib/components/dialogs/error-dialog/error-dialog.component.ts +0 -32
  121. package/src/lib/components/dialogs/services/dialog.service.spec.ts +0 -82
  122. package/src/lib/components/dialogs/services/dialog.service.ts +0 -107
  123. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.html +0 -24
  124. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.scss +0 -22
  125. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.spec.ts +0 -126
  126. package/src/lib/components/dialogs/text-input-dialog/text-input-dialog.component.ts +0 -66
  127. package/src/lib/components/inputs/color-picker/color-picker.component.html +0 -9
  128. package/src/lib/components/inputs/color-picker/color-picker.component.scss +0 -0
  129. package/src/lib/components/inputs/color-picker/color-picker.component.spec.ts +0 -29
  130. package/src/lib/components/inputs/color-picker/color-picker.component.ts +0 -111
  131. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.html +0 -13
  132. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.scss +0 -0
  133. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.spec.ts +0 -80
  134. package/src/lib/components/inputs/date-range-picker/date-range-picker.component.ts +0 -46
  135. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.html +0 -40
  136. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.scss +0 -39
  137. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.spec.ts +0 -135
  138. package/src/lib/components/inputs/dropdown-chip-autocomplete/dropdown-chip-autocomplete.component.ts +0 -263
  139. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.html +0 -6
  140. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.scss +0 -27
  141. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.spec.ts +0 -90
  142. package/src/lib/components/inputs/password/password-criteria/password-criteria.component.ts +0 -17
  143. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.html +0 -5
  144. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.scss +0 -8
  145. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.spec.ts +0 -98
  146. package/src/lib/components/inputs/password/password-criteria-viewer/password-criteria-viewer.component.ts +0 -16
  147. package/src/lib/components/inputs/password/password-input/password-input.component.html +0 -11
  148. package/src/lib/components/inputs/password/password-input/password-input.component.scss +0 -12
  149. package/src/lib/components/inputs/password/password-input/password-input.component.spec.ts +0 -141
  150. package/src/lib/components/inputs/password/password-input/password-input.component.ts +0 -67
  151. package/src/lib/components/inputs/password/password-selection/password-selection.component.html +0 -15
  152. package/src/lib/components/inputs/password/password-selection/password-selection.component.scss +0 -32
  153. package/src/lib/components/inputs/password/password-selection/password-selection.component.spec.ts +0 -138
  154. package/src/lib/components/inputs/password/password-selection/password-selection.component.ts +0 -101
  155. package/src/lib/components/inputs/select-with-search/select-with-search.component.html +0 -19
  156. package/src/lib/components/inputs/select-with-search/select-with-search.component.scss +0 -0
  157. package/src/lib/components/inputs/select-with-search/select-with-search.component.spec.ts +0 -215
  158. package/src/lib/components/inputs/select-with-search/select-with-search.component.ts +0 -108
  159. package/src/lib/components/layout/expandable-panel/expandable-panel.component.html +0 -14
  160. package/src/lib/components/layout/expandable-panel/expandable-panel.component.scss +0 -48
  161. package/src/lib/components/layout/expandable-panel/expandable-panel.component.spec.ts +0 -48
  162. package/src/lib/components/layout/expandable-panel/expandable-panel.component.ts +0 -19
  163. package/src/lib/components/layout/group-container/group-container.component.html +0 -6
  164. package/src/lib/components/layout/group-container/group-container.component.scss +0 -22
  165. package/src/lib/components/layout/group-container/group-container.component.spec.ts +0 -34
  166. package/src/lib/components/layout/group-container/group-container.component.ts +0 -14
  167. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.html +0 -13
  168. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.scss +0 -27
  169. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.spec.ts +0 -144
  170. package/src/lib/components/layout/menu-expandable-panel/menu-expandable-panel.component.ts +0 -52
  171. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.html +0 -4
  172. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.scss +0 -10
  173. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.spec.ts +0 -80
  174. package/src/lib/components/layout/menu-expandable-panel-item/menu-expandable-panel-item.component.ts +0 -28
  175. package/src/lib/components/layout/page-title/page-title.component.html +0 -28
  176. package/src/lib/components/layout/page-title/page-title.component.scss +0 -40
  177. package/src/lib/components/layout/page-title/page-title.component.spec.ts +0 -162
  178. package/src/lib/components/layout/page-title/page-title.component.ts +0 -28
  179. package/src/lib/components/layout/sections/main-section/main-section.component.html +0 -6
  180. package/src/lib/components/layout/sections/main-section/main-section.component.scss +0 -27
  181. package/src/lib/components/layout/sections/main-section/main-section.component.spec.ts +0 -42
  182. package/src/lib/components/layout/sections/main-section/main-section.component.ts +0 -13
  183. package/src/lib/components/layout/sections/section-column/section-column.component.html +0 -3
  184. package/src/lib/components/layout/sections/section-column/section-column.component.scss +0 -18
  185. package/src/lib/components/layout/sections/section-column/section-column.component.spec.ts +0 -35
  186. package/src/lib/components/layout/sections/section-column/section-column.component.ts +0 -12
  187. package/src/lib/components/layout/sections/section-field/section-field.component.html +0 -21
  188. package/src/lib/components/layout/sections/section-field/section-field.component.scss +0 -44
  189. package/src/lib/components/layout/sections/section-field/section-field.component.spec.ts +0 -74
  190. package/src/lib/components/layout/sections/section-field/section-field.component.ts +0 -22
  191. package/src/lib/components/list-paginator/list-paginator.component.html +0 -16
  192. package/src/lib/components/list-paginator/list-paginator.component.scss +0 -46
  193. package/src/lib/components/list-paginator/list-paginator.component.spec.ts +0 -248
  194. package/src/lib/components/list-paginator/list-paginator.component.ts +0 -81
  195. package/src/lib/components/misc/loading-error/loading-error.component.html +0 -11
  196. package/src/lib/components/misc/loading-error/loading-error.component.scss +0 -0
  197. package/src/lib/components/misc/loading-error/loading-error.component.spec.ts +0 -75
  198. package/src/lib/components/misc/loading-error/loading-error.component.ts +0 -18
  199. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.html +0 -3
  200. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.scss +0 -0
  201. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.spec.ts +0 -43
  202. package/src/lib/components/misc/loading-spinner-indicator/loading-spinner-indicator.component.ts +0 -16
  203. package/src/lib/components/misc/snack-bar/snack-bar.component.html +0 -16
  204. package/src/lib/components/misc/snack-bar/snack-bar.component.scss +0 -84
  205. package/src/lib/components/misc/snack-bar/snack-bar.component.spec.ts +0 -136
  206. package/src/lib/components/misc/snack-bar/snack-bar.component.ts +0 -39
  207. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.html +0 -11
  208. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.scss +0 -0
  209. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.spec.ts +0 -67
  210. package/src/lib/components/notifications/saving-confirmed-box/saving-confirmed-box.component.ts +0 -15
  211. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.html +0 -11
  212. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.scss +0 -0
  213. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.spec.ts +0 -77
  214. package/src/lib/components/notifications/saving-error-box/saving-error-box.component.ts +0 -17
  215. package/src/lib/components/presenters/badge/badge.component.html +0 -6
  216. package/src/lib/components/presenters/badge/badge.component.scss +0 -10
  217. package/src/lib/components/presenters/badge/badge.component.spec.ts +0 -41
  218. package/src/lib/components/presenters/badge/badge.component.ts +0 -18
  219. package/src/lib/components/presenters/icon/icon.component.scss +0 -9
  220. package/src/lib/components/presenters/icon/icon.component.spec.ts +0 -38
  221. package/src/lib/components/presenters/icon/icon.component.ts +0 -37
  222. package/src/lib/core/breadcrumb.service.spec.ts +0 -35
  223. package/src/lib/core/breadcrumb.service.ts +0 -24
  224. package/src/lib/core/directives/auto-trim-and-lower.directive.spec.ts +0 -22
  225. package/src/lib/core/directives/auto-trim-and-lower.directive.ts +0 -19
  226. package/src/lib/core/directives/form-error/form-error.module.ts +0 -21
  227. package/src/lib/core/directives/form-error/has-error-root.directive.ts +0 -31
  228. package/src/lib/core/directives/form-error/has-error.directive.ts +0 -95
  229. package/src/lib/core/loading-state.service.spec.ts +0 -57
  230. package/src/lib/core/loading-state.service.ts +0 -44
  231. package/src/lib/core/models/breadcrumb-location.ts +0 -6
  232. package/src/lib/core/models/password-validation.ts +0 -20
  233. package/src/lib/core/validators/password/password-validator.spec.ts +0 -155
  234. package/src/lib/core/validators/password/password-validator.ts +0 -30
  235. package/src/lib/provide-cauca-material.ts +0 -10
  236. package/src/public-api.ts +0 -70
  237. package/src/test.ts +0 -17
  238. package/tsconfig.lib.json +0 -18
  239. package/tsconfig.lib.prod.json +0 -4
  240. package/tsconfig.spec.json +0 -17
  241. /package/{src/assets → assets}/images/loading.gif +0 -0
@@ -1,107 +0,0 @@
1
- import { inject, Injectable } from '@angular/core';
2
- import { MatDialog } from '@angular/material/dialog';
3
- import { firstValueFrom } from 'rxjs';
4
- import { AlertDialogComponent, AlertDialogData } from '../alert-dialog/alert-dialog.component';
5
- import { ComponentType } from '@angular/cdk/portal';
6
- import { ConfirmDialogComponent } from '../confirm-dialog/confirm-dialog.component';
7
- import { TextInputDialogComponent } from '../text-input-dialog/text-input-dialog.component';
8
- import { ValidatorFn } from '@angular/forms';
9
- import { TranslateService } from '@ngx-translate/core';
10
- import { DeleteDialogComponent } from '../delete-dialog/delete-dialog.component';
11
- import { DeleteDialogData } from '../delete-dialog/models/delete-dialog-data';
12
- import { ErrorDialogComponent } from '../error-dialog/error-dialog.component';
13
-
14
- @Injectable({
15
- providedIn: 'root'
16
- })
17
- export class DialogService {
18
-
19
- private readonly defaultConfirmationOptions: ConfirmationOptions = {
20
- noText: 'no',
21
- noColor: 'primary',
22
- noType: 'stroked',
23
- yesText: 'yes',
24
- yesType: 'raised',
25
- messageArgs: null,
26
- titleArgs: null,
27
- yesColor: 'primary'
28
- };
29
-
30
- private readonly translate = inject(TranslateService);
31
- private readonly dialog = inject(MatDialog);
32
-
33
- public async showDialog(title: string, message: string): Promise<any> {
34
- const dialogRef = this.dialog.open(AlertDialogComponent, {
35
- data: { title, message } as AlertDialogData,
36
- autoFocus: false
37
- });
38
- return await firstValueFrom(dialogRef.afterClosed());
39
- }
40
-
41
- public async showCustomDialog(component: ComponentType<unknown>, args: any , options: any = { autoFocus: false }): Promise<any> {
42
- const config = { ...options, ... { data: args} };
43
- return await firstValueFrom(this.dialog.open(component, config)
44
- .afterClosed());
45
- }
46
-
47
- public async askForConfirmation(title: string, message: string, args: Partial<ConfirmationOptions> = null, options: any = { autoFocus: false}): Promise<ConfirmationResult> {
48
- args = { ...this.defaultConfirmationOptions, ...(args || {}) };
49
- const data = { options: args, title, message };
50
- const config = { ...options, ... { data } };
51
- const dialogRef = this.dialog.open(ConfirmDialogComponent, config);
52
- return await firstValueFrom(dialogRef.afterClosed());
53
- }
54
-
55
- public async askForDeleteConfirmation(name: string, type: string, translateType: boolean = false): Promise<any> {
56
- if (translateType) {
57
- type = this.translate.instant(type);
58
- }
59
- const dialogRef = this.dialog.open(DeleteDialogComponent, {
60
- data: { name, type } as DeleteDialogData,
61
- autoFocus: false
62
- });
63
- return await firstValueFrom(dialogRef.afterClosed());
64
- }
65
-
66
- public async showDeletionError(name: string): Promise<any> {
67
- const dialogRef = this.dialog.open(ErrorDialogComponent, {
68
- data: { name } as DeleteDialogData,
69
- autoFocus: '#okButton'
70
- });
71
- return await firstValueFrom(dialogRef.afterClosed());
72
- }
73
-
74
- public async input(inputOptions: InputOptions, optionsDialog: any = { autoFocus: false }, value: string = '' , suffix = ''): Promise<{ result: ConfirmationResult, value: string }> {
75
- const args = { ...inputOptions, value, suffix };
76
- const config = { ...optionsDialog, ... { data: args } };
77
-
78
- return await firstValueFrom(this.dialog.open(TextInputDialogComponent, config)
79
- .afterClosed());
80
- }
81
- }
82
-
83
- export interface ConfirmationOptions {
84
- noText: string;
85
- noColor: string;
86
- noType?: 'basic' | 'raised' | 'stroked' | 'flat' | 'icon';
87
- yesText: string;
88
- yesColor: string;
89
- yesType?: 'basic' | 'raised' | 'stroked' | 'flat' | 'icon';
90
- messageArgs: any;
91
- titleArgs: any;
92
- }
93
-
94
- export enum ConfirmationResult {
95
- Cancel,
96
- Yes,
97
- No
98
- }
99
-
100
- export interface InputOptions {
101
- titleLabel: string;
102
- validateButtonLabel: string;
103
- cancelButtonLabel: string;
104
- inputLabel: string;
105
- useTextArea?: boolean;
106
- validators?: ValidatorFn | ValidatorFn[];
107
- }
@@ -1,24 +0,0 @@
1
- <div mat-dialog-title>
2
- <div class="h6">{{ titleLabel | translate }}</div>
3
- <cauca-icon-button id="close-button" icon="close" (buttonClick)="cancelClick()" />
4
- </div>
5
- <div mat-dialog-content>
6
- <form [formGroup]="form">
7
- <mat-form-field>
8
- <mat-label>{{ inputLabel | translate}}</mat-label>
9
- @if (useTextArea()) {
10
- <textarea cdkTextareaAutosize formControlName="input" matInput></textarea>
11
- } @else {
12
- <input formControlName="input" matInput />
13
- }
14
- @if (showSuffix()) { <span matTextSuffix>{{suffix()}}</span> }
15
- @if (form.controls.input.hasError('required')) {<mat-error>{{'error.requiredField' | translate}}</mat-error>}
16
- @if (form.controls.input.hasError('invalidName')) {<mat-error>{{'error.invalidName' | translate}}</mat-error>}
17
- @if (form.controls.input.hasError('alreadyUsed')) {<mat-error>{{'error.alreadyUsed' | translate}}</mat-error>}
18
- </mat-form-field>
19
- </form>
20
- </div>
21
- <mat-dialog-actions align="end">
22
- <cauca-stroked-button id="close-button" [label]="cancelButtonLabel" (buttonClick)="cancelClick()" color="primary" />
23
- <cauca-raised-button class="yes-button" [isDisabled]="!form.valid" [label]="validateButtonLabel" color="primary" (buttonClick)="validateClick()" />
24
- </mat-dialog-actions>
@@ -1,22 +0,0 @@
1
- :host>div:first-child {
2
- display: flex;
3
- align-items: center;
4
- padding: 8px 24px 0px 24px;
5
-
6
- div:first-child {
7
- flex: 1;
8
- }
9
- }
10
-
11
- mat-form-field {
12
- width: 100%;
13
- }
14
-
15
- .mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,
16
- .mat-mdc-dialog-actions[align=end] {
17
- column-gap: 8px;
18
- }
19
-
20
- .mat-mdc-dialog-content {
21
- padding-top: 8px !important;
22
- }
@@ -1,126 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { TextInputDialogComponent } from './text-input-dialog.component';
4
- import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
5
- import { MockComponents, MockModule, MockPipe, ngMocks } from 'ng-mocks';
6
- import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
7
- import { ConfirmationResult } from '../services/dialog.service';
8
- import { HarnessLoader } from '@angular/cdk/testing';
9
- import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
10
- import { MatFormFieldHarness } from '@angular/material/form-field/testing';
11
- import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
12
- import { StrokedButtonComponent } from '../../buttons/stroked-button/stroked-button.component';
13
- import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
14
-
15
- describe('TextInputDialogComponent', () => {
16
- let component: TextInputDialogComponent;
17
- let fixture: ComponentFixture<TextInputDialogComponent>;
18
- let loader: HarnessLoader;
19
- let mockMatDialog, defaultData: any;
20
-
21
- beforeEach(async () => {
22
- mockMatDialog = jasmine.createSpyObj('MatDialogRef', ['close']);
23
- defaultData = {
24
- titleLabel: 'Title',
25
- validateButtonLabel: 'Validate',
26
- cancelButtonLabel: 'Cancel',
27
- inputLabel: 'Input',
28
- suffix: '.xlxs'
29
- };
30
-
31
- await TestBed.configureTestingModule({
32
- imports: [TextInputDialogComponent,
33
- MockModule(TranslateModule),
34
- ...MockComponents(IconButtonComponent, StrokedButtonComponent, RaisedButtonComponent)
35
- ],
36
- declarations: [
37
- MockPipe(TranslatePipe, value => value),
38
- ...MockComponents(StrokedButtonComponent, RaisedButtonComponent)
39
- ],
40
- providers: [
41
- { provide: MatDialogRef, useValue: mockMatDialog },
42
- { provide: MAT_DIALOG_DATA, useValue: defaultData },
43
- ]
44
- })
45
- .compileComponents();
46
-
47
- fixture = TestBed.createComponent(TextInputDialogComponent);
48
- loader = TestbedHarnessEnvironment.loader(fixture);
49
- component = fixture.componentInstance;
50
- fixture.detectChanges();
51
- });
52
-
53
- it('should create', () => {
54
- expect(component).toBeTruthy();
55
- });
56
-
57
- it('should set dialog labels', () => {
58
- expect(component.titleLabel).toBe(defaultData.titleLabel);
59
- expect(fixture.nativeElement.querySelector('.h6').textContent).toBe(defaultData.titleLabel);
60
-
61
- expect(component.validateButtonLabel).toBe(defaultData.validateButtonLabel);
62
- expect(ngMocks.findInstance(RaisedButtonComponent).label).toBe(defaultData.validateButtonLabel);
63
-
64
- expect(component.cancelButtonLabel).toBe(defaultData.cancelButtonLabel);
65
- expect(ngMocks.findInstance(StrokedButtonComponent).label).toBe(defaultData.cancelButtonLabel);
66
-
67
- expect(component.inputLabel).toBe(defaultData.inputLabel);
68
- });
69
-
70
- it('should close dialog when clicking on cancel button in title', () => {
71
- const closeButton = ngMocks.findInstance(IconButtonComponent);
72
-
73
- closeButton.buttonClick.emit();
74
-
75
- expect(mockMatDialog.close).toHaveBeenCalledWith({ result: ConfirmationResult.Cancel, value: null });
76
- });
77
-
78
- it('should close dialog with cancel result on cancel button click', () => {
79
- const closeButton = ngMocks.findInstance(StrokedButtonComponent);
80
-
81
- closeButton.buttonClick.emit();
82
-
83
- expect(mockMatDialog.close).toHaveBeenCalledWith({result: ConfirmationResult.Cancel, value: null});
84
- });
85
-
86
- it('should close dialog with yes result and input value on validate button click', () => {
87
- const validateButton = ngMocks.findInstance(RaisedButtonComponent);
88
- const value = 'test';
89
-
90
- component.form.controls.input.setValue(value);
91
- validateButton.buttonClick.emit();
92
-
93
- expect(mockMatDialog.close).toHaveBeenCalledWith({result: ConfirmationResult.Yes, value});
94
- });
95
-
96
- it('should set suffix from received data', () => {
97
- expect(component.suffix()).toBe(defaultData.suffix);
98
- });
99
-
100
- it('should show suffix when suffix is set', async () => {
101
- const formField = await loader.getHarness(MatFormFieldHarness);
102
- fixture.detectChanges();
103
-
104
- expect(await formField.getSuffixText()).toBe('.xlxs');
105
- });
106
-
107
- it('should show suffix when showSuffix is not set', async () => {
108
- const suffix = '';
109
- component.suffix.set(suffix);
110
- fixture.detectChanges();
111
-
112
- const formField = await loader.getHarness(MatFormFieldHarness);
113
-
114
- expect(await formField.getSuffixText()).toBe('');
115
- });
116
-
117
- it('should show textarea when useTextArea is set', async () => {
118
- component.useTextArea.set(true);
119
- fixture.detectChanges();
120
-
121
- const textarea = fixture.nativeElement.querySelector('textarea');
122
-
123
- expect(textarea).toBeTruthy();
124
- expect( fixture.nativeElement.querySelector('input')).toBeFalsy();
125
- });
126
- });
@@ -1,66 +0,0 @@
1
- import { Component, computed, Inject, signal } from '@angular/core';
2
- import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
3
- import { TranslateModule } from '@ngx-translate/core';
4
- import { MatFormFieldModule } from '@angular/material/form-field';
5
- import { MatInputModule } from '@angular/material/input';
6
- import { FormGroup, ReactiveFormsModule, UntypedFormBuilder, ValidatorFn } from '@angular/forms';
7
- import { ConfirmationResult } from '../services/dialog.service';
8
- import { RaisedButtonComponent } from '../../buttons/raised-button/raised-button.component';
9
- import { StrokedButtonComponent } from '../../buttons/stroked-button/stroked-button.component';
10
- import { IconButtonComponent } from '../../buttons/icon-button/icon-button.component';
11
-
12
- @Component({
13
- selector: 'cauca-text-input-dialog',
14
- standalone: true,
15
- imports: [TranslateModule, RaisedButtonComponent, MatDialogModule, StrokedButtonComponent, MatFormFieldModule, MatInputModule, ReactiveFormsModule, IconButtonComponent],
16
- templateUrl: './text-input-dialog.component.html',
17
- styleUrl: './text-input-dialog.component.scss'
18
- })
19
- export class TextInputDialogComponent {
20
- public form: FormGroup;
21
-
22
- public titleLabel: string = '';
23
- public validateButtonLabel: string = '';
24
- public cancelButtonLabel: string = '';
25
- public inputLabel: string = '';
26
- public suffix = signal<string>('');
27
- public showSuffix = computed(() => !!this.suffix());
28
- public useTextArea = signal<boolean>(false);
29
-
30
- public constructor(
31
- formBuilder: UntypedFormBuilder,
32
- public dialogRef: MatDialogRef<TextInputDialogComponent>,
33
- @Inject(MAT_DIALOG_DATA) public data: TextInputDialogData) {
34
- this.suffix.set(data.suffix);
35
-
36
- this.titleLabel = data.titleLabel;
37
- this.validateButtonLabel = data.validateButtonLabel;
38
- this.cancelButtonLabel = data.cancelButtonLabel;
39
- this.inputLabel = data.inputLabel;
40
- this.useTextArea.set(data.useTextArea ?? false);
41
-
42
- this.form = formBuilder.group({
43
- input: [data.value, data.validators]
44
- });
45
- }
46
-
47
- public cancelClick(): void {
48
- this.dialogRef.close({ result: ConfirmationResult.Cancel, value: null });
49
- }
50
-
51
- public validateClick(): void {
52
- const trimmedValue = this.form.controls.input.value.trim();
53
- this.dialogRef.close({ result: ConfirmationResult.Yes, value: trimmedValue });
54
- }
55
- }
56
-
57
- export interface TextInputDialogData {
58
- titleLabel: string;
59
- validateButtonLabel: string;
60
- cancelButtonLabel: string;
61
- inputLabel: string;
62
- suffix?: string;
63
- useTextArea?: boolean;
64
- validators?: ValidatorFn | ValidatorFn[];
65
- value?: string;
66
- }
@@ -1,9 +0,0 @@
1
- <input
2
- matInput
3
- [(colorPicker)]="value"
4
- [value]="value"
5
- (colorPickerChange)="onChangeColor($event)"
6
- type="text"
7
- class="form-control"
8
- id="color-id"
9
- />
@@ -1,29 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { ColorPickerComponent } from './color-picker.component';
4
-
5
- describe('ColorPickerComponent', () => {
6
- let component: ColorPickerComponent;
7
- let fixture: ComponentFixture<ColorPickerComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [ColorPickerComponent]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(ColorPickerComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
-
24
- it('should set value when onChangeColor is called', () => {
25
- const color = 'red';
26
- component.onChangeColor(color);
27
- expect(component.value).toEqual(color);
28
- });
29
- });
@@ -1,111 +0,0 @@
1
- import { Component, ElementRef, EventEmitter, HostBinding, Input, OnDestroy, Optional, Output, Self } from '@angular/core';
2
- import { ControlValueAccessor, NgControl } from '@angular/forms';
3
- import { MatFormFieldControl } from '@angular/material/form-field';
4
- import { MatInputModule } from '@angular/material/input';
5
- import { ColorPickerDirective } from 'ngx-color-picker';
6
- import { Subject } from 'rxjs';
7
-
8
- @Component({
9
- selector: 'cauca-color-picker',
10
- imports: [MatInputModule, ColorPickerDirective],
11
- templateUrl: './color-picker.component.html',
12
- styleUrl: './color-picker.component.scss',
13
- providers: [{
14
- provide: MatFormFieldControl,
15
- useExisting: ColorPickerComponent,
16
- }]
17
- })
18
- export class ColorPickerComponent implements ControlValueAccessor, MatFormFieldControl<string>, OnDestroy {
19
-
20
- public stateChanges = new Subject<void>();
21
- public static nextId = 0;
22
-
23
- @HostBinding()public id = `example-tel-input-${ColorPickerComponent.nextId++}`;
24
- public placeholder: string;
25
- public focused: boolean = false;
26
- public touched = false;
27
- public required: boolean;
28
- public disabled: boolean;
29
- public errorState: boolean;
30
- public controlType?: string;
31
- public autofilled?: boolean;
32
- public userAriaDescribedBy?: string;
33
- @Output() public valueChanged = new EventEmitter<string>();
34
- private _value: string;
35
- @HostBinding('class.floating')
36
- public get shouldLabelFloat() {
37
- return this.focused || !this.empty;
38
- }
39
- public get empty() {
40
- return !this._value?.length;
41
- }
42
-
43
- @Input()
44
- public get value(): string | null {
45
- return this._value;
46
- }
47
-
48
- public set value(newValue: string | null) {
49
- this._value = newValue;
50
- this.onChange(this._value);
51
- this.stateChanges.next();
52
- }
53
-
54
- public constructor(
55
- private elementRef: ElementRef<HTMLElement>,
56
- @Optional() @Self() public ngControl: NgControl) {
57
- if (this.ngControl != null) {
58
- this.ngControl.valueAccessor = this;
59
- }
60
- elementRef.nativeElement.addEventListener('focusin', this.onFocusIn.bind(this));
61
- elementRef.nativeElement.addEventListener('focusout', this.onFocusOut.bind(this));
62
- }
63
-
64
- public onFocusIn(_: FocusEvent) {
65
- if (!this.focused) {
66
- this.focused = true;
67
- this.stateChanges.next();
68
- }
69
- }
70
-
71
- public onFocusOut(event: FocusEvent) {
72
- if (!this.elementRef.nativeElement.contains(event.relatedTarget as Element)) {
73
- this.touched = true;
74
- this.focused = false;
75
- this.onTouched();
76
- this.stateChanges.next();
77
- }
78
- }
79
-
80
- public ngOnDestroy(): void {
81
- this.stateChanges.complete();
82
- }
83
- public setDescribedByIds(_: string[]): void {
84
- // Do nothing for now
85
- }
86
- public onContainerClick(_: MouseEvent): void {
87
- // Do nothing for now
88
- }
89
- public writeValue(value: string): void {
90
- this.value = value;
91
- }
92
-
93
- public registerOnChange(fn: any): void {
94
- this.onChange = fn;
95
- }
96
-
97
- public registerOnTouched(fn: any): void {
98
- this.onTouched = fn;
99
- }
100
-
101
- public onChange = (_: any): void => {
102
- // Do nothing for now
103
- };
104
- public onTouched = (): void => {
105
- // Do nothing for now
106
- };
107
-
108
- public onChangeColor(color: string): void {
109
- this.value = color;
110
- }
111
- }
@@ -1,13 +0,0 @@
1
- <mat-form-field class="full-width-field" subscriptSizing="dynamic">
2
- <mat-datepicker-toggle matPrefix (click)="clear()" onkeypress="clear()">
3
- <mat-icon matDatepickerToggleIcon>clear</mat-icon>
4
- </mat-datepicker-toggle>
5
- <mat-label>{{'dateRangeSelectorLabel'|translate}}</mat-label>
6
- <mat-date-range-input [formGroup]="form" [rangePicker]="campaignOnePicker">
7
- <input matStartDate formControlName="from" [readOnly]="true">
8
- <input matEndDate formControlName="to" [readOnly]="true">
9
- </mat-date-range-input>
10
- <mat-datepicker-toggle matIconSuffix [for]="campaignOnePicker">
11
- </mat-datepicker-toggle>
12
- <mat-date-range-picker #campaignOnePicker></mat-date-range-picker>
13
- </mat-form-field>
@@ -1,80 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { DateRangePickerComponent } from './date-range-picker.component';
4
- import { HarnessLoader } from '@angular/cdk/testing';
5
- import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
6
- import { MatDateRangeInputHarness } from '@angular/material/datepicker/testing';
7
- import { MockModule, MockPipe } from 'ng-mocks';
8
- import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
9
-
10
- describe('DateRangePickerComponent', () => {
11
- let component: DateRangePickerComponent;
12
- let fixture: ComponentFixture<DateRangePickerComponent>;
13
- let harness: HarnessLoader;
14
-
15
- beforeEach(async () => {
16
- await TestBed.configureTestingModule({
17
- imports: [DateRangePickerComponent, MockModule(TranslateModule)],
18
- declarations: [MockPipe(TranslatePipe, value => value),],
19
- })
20
- .compileComponents();
21
-
22
- fixture = TestBed.createComponent(DateRangePickerComponent);
23
- harness = TestbedHarnessEnvironment.loader(fixture);
24
- component = fixture.componentInstance;
25
- fixture.detectChanges();
26
- });
27
-
28
- it('should create', () => {
29
- expect(component).toBeTruthy();
30
- });
31
-
32
- it('should not have a range selected by default', () => {
33
- expect(component.range()).toEqual({ from: null, to: null });
34
- });
35
-
36
- it('should update form from date when date picker changes', async () => {
37
- const selectedDate = new Date();
38
- const picker = await harness.getHarness(MatDateRangeInputHarness);
39
- const input = await picker.getStartInput();
40
-
41
- await input.setValue(selectedDate.toUTCString());
42
-
43
- expect(component.form.value.from).not.toBeNull();
44
- });
45
-
46
- it('should update form to date when date picker changes', async () => {
47
- const selectedDate = new Date();
48
- const picker = await harness.getHarness(MatDateRangeInputHarness);
49
- const input = await picker.getEndInput();
50
-
51
- await input.setValue(selectedDate.toUTCString());
52
-
53
- expect(component.form.value.to).not.toBeNull();
54
- });
55
-
56
- it('should clear the form when clear is called', async () => {
57
- const selectedDate = new Date();
58
- const picker = await harness.getHarness(MatDateRangeInputHarness);
59
- const input = await picker.getStartInput();
60
-
61
- await input.setValue(selectedDate.toUTCString());
62
- expect(component.form.value.from).not.toBeNull();
63
-
64
- component.clear();
65
- expect(component.form.value.from).toBeNull();
66
- });
67
-
68
- it('should emit new range when form changes', async () => {
69
- const selectedDate = new Date();
70
- const picker = await harness.getHarness(MatDateRangeInputHarness);
71
- const input = await picker.getStartInput();
72
-
73
- await input.setValue(selectedDate.toUTCString());
74
- expect(component.range()).toEqual({ from: component.form.value.from, to: null });
75
-
76
- const toInput = await picker.getEndInput();
77
- await toInput.setValue(selectedDate.toUTCString());
78
- expect(component.range()).toEqual({ from: component.form.value.from, to: component.form.value.to });
79
- });
80
- });
@@ -1,46 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, model, OnInit } from '@angular/core';
2
- import {FormControl, FormGroup, ReactiveFormsModule} from '@angular/forms';
3
- import { provideNativeDateAdapter } from '@angular/material/core';
4
- import { MatFormFieldModule } from '@angular/material/form-field';
5
- import {MatDatepickerModule} from '@angular/material/datepicker';
6
- import { MatIcon } from '@angular/material/icon';
7
- import { TranslateModule } from '@ngx-translate/core';
8
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
9
-
10
- @Component({
11
- selector: 'cauca-date-range-picker',
12
- standalone: true,
13
- changeDetection: ChangeDetectionStrategy.OnPush,
14
- imports: [MatFormFieldModule, MatDatepickerModule, ReactiveFormsModule, MatIcon, TranslateModule],
15
- templateUrl: './date-range-picker.component.html',
16
- styleUrl: './date-range-picker.component.scss',
17
- providers: [provideNativeDateAdapter()]
18
- })
19
- export class DateRangePickerComponent implements OnInit {
20
- public range = model<DateRange>({ from: null, to: null });
21
-
22
- public readonly form = new FormGroup({
23
- from: new FormControl(null),
24
- to: new FormControl(null)
25
- });
26
-
27
- public constructor() {
28
- this.form.valueChanges
29
- .pipe(takeUntilDestroyed())
30
- .subscribe(value => this.range.set({ from: value.from, to: value.to }));
31
- }
32
-
33
- public ngOnInit(): void {
34
- this.form.patchValue(this.range());
35
- }
36
-
37
- public clear(): void {
38
- this.form.patchValue({ from: null, to: null });
39
- }
40
-
41
- }
42
-
43
- export interface DateRange {
44
- from: Date|null,
45
- to: Date|null
46
- }