ng-components-tsi 0.0.38 → 0.0.39

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 (237) hide show
  1. package/fesm2022/ng-components-tsi.mjs +5063 -0
  2. package/fesm2022/ng-components-tsi.mjs.map +1 -0
  3. package/index.d.ts +5 -0
  4. package/lib/directivas/acciones/atajos.directive.d.ts +8 -0
  5. package/lib/directivas/animaciones/fade-animation.d.ts +3 -0
  6. package/lib/directivas/estilos/animated-checkbox.directive.d.ts +9 -0
  7. package/lib/directivas/estilos/button.constants.d.ts +64 -0
  8. package/lib/directivas/estilos/buttons-modal.directive.d.ts +11 -0
  9. package/lib/directivas/estilos/buttons-outline-directive.d.ts +11 -0
  10. package/lib/directivas/estilos/icons.directive.d.ts +11 -0
  11. package/lib/directivas/inputs/caracteres-codigo.directive.d.ts +12 -0
  12. package/lib/directivas/inputs/decimal.directive.d.ts +13 -0
  13. package/lib/directivas/inputs/only-day.directive.d.ts +8 -0
  14. package/lib/directivas/inputs/only-number-flex.directive.d.ts +9 -0
  15. package/lib/directivas/inputs/only-number.directive.d.ts +8 -0
  16. package/lib/enums/table-events.d.ts +5 -0
  17. package/lib/modals/general/md-generico/md-generico.component.d.ts +25 -0
  18. package/lib/models/button-color.model.d.ts +3 -0
  19. package/{src/lib/models/button-properties.model.ts → lib/models/button-properties.model.d.ts} +7 -8
  20. package/lib/models/cell-rendered.d.ts +11 -0
  21. package/lib/models/comercial/documentos-cab-auxiliares.model.d.ts +17 -0
  22. package/{src/lib/models/dropdownoption.model.ts → lib/models/dropdownoption.model.d.ts} +14 -15
  23. package/lib/models/general/recursos.model.d.ts +271 -0
  24. package/lib/models/general/utils.interface.d.ts +57 -0
  25. package/lib/models/input-config.d.ts +25 -0
  26. package/{src/lib/models/selected-row.ts → lib/models/selected-row.d.ts} +4 -4
  27. package/{src/lib/models/table-data.model.ts → lib/models/table-data.model.d.ts} +21 -21
  28. package/lib/service/alert-confirmation.service.d.ts +26 -0
  29. package/lib/service/alert-error.service.d.ts +9 -0
  30. package/lib/service/alert.service.d.ts +33 -0
  31. package/lib/service/formateador.service.d.ts +10 -0
  32. package/lib/service/toast.service.d.ts +25 -0
  33. package/lib/ui/alerts/alert-confirmation/alert-confirmation.component.d.ts +32 -0
  34. package/lib/ui/alerts/alert-error/alert-error.component.d.ts +9 -0
  35. package/lib/ui/alerts/alerta/alerta.component.d.ts +12 -0
  36. package/lib/ui/alerts/badge/badge.component.d.ts +8 -0
  37. package/lib/ui/alerts/toaster/toaster.component.d.ts +17 -0
  38. package/lib/ui/dropdown/dropdown-cdk/dropdown-cdk.component.d.ts +11 -0
  39. package/lib/ui/dropdown/dropdown-simple/dropdown.component.d.ts +13 -0
  40. package/lib/ui/forms/button/button.component.d.ts +47 -0
  41. package/lib/ui/forms/filter-toggle/filter-toggle.component.d.ts +9 -0
  42. package/lib/ui/forms/header/header.component.d.ts +17 -0
  43. package/lib/ui/forms/inputs/autocomplete/autocomplete.component.d.ts +43 -0
  44. package/lib/ui/forms/inputs/autocomplete-cdk/autocomplete.component.d.ts +48 -0
  45. package/lib/ui/forms/inputs/check-box/check-box.component.d.ts +14 -0
  46. package/lib/ui/forms/inputs/doble-input/doble-input.component.d.ts +47 -0
  47. package/lib/ui/forms/inputs/input/input.component.d.ts +60 -0
  48. package/lib/ui/forms/inputs/input-clase/input-clase.component.d.ts +13 -0
  49. package/lib/ui/forms/inputs/input-dinamico/input-dinamico.component.d.ts +8 -0
  50. package/lib/ui/forms/inputs/input-radio/input-radio.component.d.ts +24 -0
  51. package/lib/ui/forms/inputs/multiselected/multiselected.component.d.ts +39 -0
  52. package/lib/ui/forms/inputs/radio/radio.component.d.ts +14 -0
  53. package/lib/ui/forms/inputs/switch/switch.component.d.ts +20 -0
  54. package/lib/ui/forms/inputs/switch-activo/switch-activo.component.d.ts +21 -0
  55. package/lib/ui/forms/lists/list-option/list-option.component.d.ts +23 -0
  56. package/lib/ui/forms/lists/list-situaciones/list-situaciones.component.d.ts +28 -0
  57. package/lib/ui/forms/lists/multi-select-dropdown/multi-select-dropdown.component.d.ts +26 -0
  58. package/lib/ui/forms/sidebar/sidebar.component.d.ts +15 -0
  59. package/lib/ui/general/detalle-credito/detalle-credito.component.d.ts +8 -0
  60. package/lib/ui/general/montos-calcular/montos-calcular.component.d.ts +12 -0
  61. package/lib/ui/general/spinner/spinner.component.d.ts +5 -0
  62. package/lib/ui/tables/card-mobile/card-mobile.component.d.ts +17 -0
  63. package/lib/ui/tables/dropdown-menu/dropdown-menu.component.d.ts +43 -0
  64. package/lib/ui/tables/paginador/paginador.component.d.ts +20 -0
  65. package/lib/ui/tables/table-advance/table-advance.component.d.ts +94 -0
  66. package/lib/ui/tables/table-advance-optimizada/table-advance-optimizada.component.d.ts +82 -0
  67. package/lib/ui/tables/table-agrupada/table-agrupada.component.d.ts +96 -0
  68. package/lib/ui/tables/table-busqueda/table-busqueda.component.d.ts +48 -0
  69. package/lib/ui/tables/table-detalle/table-detalle.component.d.ts +59 -0
  70. package/lib/ui/tables/table-simple/table-simple.component.d.ts +39 -0
  71. package/lib/ui/tables/table-ultimate/table-ultimate.component.d.ts +84 -0
  72. package/lib/ui/tabs/nav-tabs/nav-tabs.component.d.ts +9 -0
  73. package/lib/ui/tabs/tab-item/tab-item.component.d.ts +9 -0
  74. package/lib/utils/general/validaciones-simple.d.ts +2 -0
  75. package/lib/utils/general/validaciones.d.ts +11 -0
  76. package/lib/utils/helpers/api-result.d.ts +17 -0
  77. package/lib/utils/helpers/modal-result.d.ts +10 -0
  78. package/ng-components-tsi-0.0.39.tgz +0 -0
  79. package/package.json +31 -23
  80. package/{src/public-api.ts → public-api.d.ts} +68 -99
  81. package/ng-package.json +0 -7
  82. package/src/lib/directivas/acciones/atajos.directive.ts +0 -26
  83. package/src/lib/directivas/animaciones/fade-animation.ts +0 -45
  84. package/src/lib/directivas/animaciones/fade.directive.ts +0 -43
  85. package/src/lib/directivas/estilos/animated-checkbox.directive.ts +0 -26
  86. package/src/lib/directivas/estilos/button.constants.ts +0 -66
  87. package/src/lib/directivas/estilos/buttons-modal.directive.ts +0 -36
  88. package/src/lib/directivas/estilos/buttons-outline-directive.ts +0 -27
  89. package/src/lib/directivas/estilos/icons.directive.ts +0 -26
  90. package/src/lib/directivas/inputs/caracteres-codigo.directive.ts +0 -63
  91. package/src/lib/directivas/inputs/decimal.directive.ts +0 -51
  92. package/src/lib/directivas/inputs/only-day.directive.ts +0 -53
  93. package/src/lib/directivas/inputs/only-number-flex.directive.ts +0 -50
  94. package/src/lib/directivas/inputs/only-number.directive.ts +0 -53
  95. package/src/lib/enums/table-events.ts +0 -5
  96. package/src/lib/modals/general/md-generico/md-generico.component.html +0 -44
  97. package/src/lib/modals/general/md-generico/md-generico.component.scss +0 -4
  98. package/src/lib/modals/general/md-generico/md-generico.component.ts +0 -50
  99. package/src/lib/models/button-color.model.ts +0 -9
  100. package/src/lib/models/cell-rendered.ts +0 -12
  101. package/src/lib/models/comercial/documentos-cab-auxiliares.model.ts +0 -18
  102. package/src/lib/models/general/recursos.model.ts +0 -285
  103. package/src/lib/models/general/utils.interface.ts +0 -66
  104. package/src/lib/models/input-config.ts +0 -26
  105. package/src/lib/service/alert-confirmation.service.ts +0 -87
  106. package/src/lib/service/alert-error.service.ts +0 -27
  107. package/src/lib/service/alert.service.ts +0 -216
  108. package/src/lib/service/formateador.service.ts +0 -49
  109. package/src/lib/service/toast.service.ts +0 -75
  110. package/src/lib/ui/alerts/alert-confirmation/alert-confirmation.component.html +0 -40
  111. package/src/lib/ui/alerts/alert-confirmation/alert-confirmation.component.scss +0 -42
  112. package/src/lib/ui/alerts/alert-confirmation/alert-confirmation.component.ts +0 -118
  113. package/src/lib/ui/alerts/alert-error/alert-error.component.html +0 -11
  114. package/src/lib/ui/alerts/alert-error/alert-error.component.scss +0 -39
  115. package/src/lib/ui/alerts/alert-error/alert-error.component.ts +0 -27
  116. package/src/lib/ui/alerts/alerta/alerta.component.html +0 -18
  117. package/src/lib/ui/alerts/alerta/alerta.component.scss +0 -104
  118. package/src/lib/ui/alerts/alerta/alerta.component.ts +0 -25
  119. package/src/lib/ui/alerts/badge/badge.component.ts +0 -16
  120. package/src/lib/ui/alerts/toaster/toaster.component.html +0 -52
  121. package/src/lib/ui/alerts/toaster/toaster.component.scss +0 -275
  122. package/src/lib/ui/alerts/toaster/toaster.component.ts +0 -50
  123. package/src/lib/ui/dropdown/dropdown-cdk/dropdown-cdk.component.html +0 -20
  124. package/src/lib/ui/dropdown/dropdown-cdk/dropdown-cdk.component.scss +0 -11
  125. package/src/lib/ui/dropdown/dropdown-cdk/dropdown-cdk.component.ts +0 -18
  126. package/src/lib/ui/dropdown/dropdown-simple/dropdown.component.html +0 -10
  127. package/src/lib/ui/dropdown/dropdown-simple/dropdown.component.scss +0 -54
  128. package/src/lib/ui/dropdown/dropdown-simple/dropdown.component.ts +0 -36
  129. package/src/lib/ui/forms/button/button.component.html +0 -69
  130. package/src/lib/ui/forms/button/button.component.scss +0 -126
  131. package/src/lib/ui/forms/button/button.component.ts +0 -137
  132. package/src/lib/ui/forms/filter-toggle/filter-toggle.component.scss +0 -22
  133. package/src/lib/ui/forms/filter-toggle/filter-toggle.component.ts +0 -29
  134. package/src/lib/ui/forms/header/header.component.html +0 -22
  135. package/src/lib/ui/forms/header/header.component.scss +0 -22
  136. package/src/lib/ui/forms/header/header.component.ts +0 -40
  137. package/src/lib/ui/forms/inputs/autocomplete/autocomplete.component.html +0 -46
  138. package/src/lib/ui/forms/inputs/autocomplete/autocomplete.component.scss +0 -90
  139. package/src/lib/ui/forms/inputs/autocomplete/autocomplete.component.ts +0 -203
  140. package/src/lib/ui/forms/inputs/autocomplete-cdk/autocomplete.component.html +0 -61
  141. package/src/lib/ui/forms/inputs/autocomplete-cdk/autocomplete.component.scss +0 -128
  142. package/src/lib/ui/forms/inputs/autocomplete-cdk/autocomplete.component.ts +0 -145
  143. package/src/lib/ui/forms/inputs/check-box/check-box.component.html +0 -6
  144. package/src/lib/ui/forms/inputs/check-box/check-box.component.ts +0 -24
  145. package/src/lib/ui/forms/inputs/doble-input/doble-input.component.html +0 -60
  146. package/src/lib/ui/forms/inputs/doble-input/doble-input.component.scss +0 -86
  147. package/src/lib/ui/forms/inputs/doble-input/doble-input.component.ts +0 -129
  148. package/src/lib/ui/forms/inputs/input/input.component.html +0 -169
  149. package/src/lib/ui/forms/inputs/input/input.component.scss +0 -74
  150. package/src/lib/ui/forms/inputs/input/input.component.ts +0 -147
  151. package/src/lib/ui/forms/inputs/input-clase/input-clase.component.html +0 -30
  152. package/src/lib/ui/forms/inputs/input-clase/input-clase.component.scss +0 -0
  153. package/src/lib/ui/forms/inputs/input-clase/input-clase.component.ts +0 -28
  154. package/src/lib/ui/forms/inputs/input-dinamico/input-dinamico.component.html +0 -41
  155. package/src/lib/ui/forms/inputs/input-dinamico/input-dinamico.component.scss +0 -0
  156. package/src/lib/ui/forms/inputs/input-dinamico/input-dinamico.component.ts +0 -17
  157. package/src/lib/ui/forms/inputs/input-radio/input-radio.component.html +0 -26
  158. package/src/lib/ui/forms/inputs/input-radio/input-radio.component.scss +0 -53
  159. package/src/lib/ui/forms/inputs/input-radio/input-radio.component.ts +0 -36
  160. package/src/lib/ui/forms/inputs/multiselected/multiselected.component.html +0 -56
  161. package/src/lib/ui/forms/inputs/multiselected/multiselected.component.scss +0 -145
  162. package/src/lib/ui/forms/inputs/multiselected/multiselected.component.ts +0 -109
  163. package/src/lib/ui/forms/inputs/radio/radio.component.html +0 -7
  164. package/src/lib/ui/forms/inputs/radio/radio.component.scss +0 -0
  165. package/src/lib/ui/forms/inputs/radio/radio.component.ts +0 -23
  166. package/src/lib/ui/forms/inputs/switch/switch.component.html +0 -12
  167. package/src/lib/ui/forms/inputs/switch/switch.component.scss +0 -48
  168. package/src/lib/ui/forms/inputs/switch/switch.component.ts +0 -50
  169. package/src/lib/ui/forms/inputs/switch-activo/switch-activo.component.html +0 -12
  170. package/src/lib/ui/forms/inputs/switch-activo/switch-activo.component.scss +0 -65
  171. package/src/lib/ui/forms/inputs/switch-activo/switch-activo.component.ts +0 -52
  172. package/src/lib/ui/forms/lists/list-option/list-option.component.html +0 -24
  173. package/src/lib/ui/forms/lists/list-option/list-option.component.scss +0 -49
  174. package/src/lib/ui/forms/lists/list-option/list-option.component.ts +0 -35
  175. package/src/lib/ui/forms/lists/list-situaciones/list-situaciones.component.html +0 -29
  176. package/src/lib/ui/forms/lists/list-situaciones/list-situaciones.component.scss +0 -0
  177. package/src/lib/ui/forms/lists/list-situaciones/list-situaciones.component.ts +0 -99
  178. package/src/lib/ui/forms/lists/multi-select-dropdown/multi-select-dropdown.component.html +0 -46
  179. package/src/lib/ui/forms/lists/multi-select-dropdown/multi-select-dropdown.component.scss +0 -30
  180. package/src/lib/ui/forms/lists/multi-select-dropdown/multi-select-dropdown.component.ts +0 -96
  181. package/src/lib/ui/forms/sidebar/sidebar.component.html +0 -33
  182. package/src/lib/ui/forms/sidebar/sidebar.component.scss +0 -85
  183. package/src/lib/ui/forms/sidebar/sidebar.component.ts +0 -61
  184. package/src/lib/ui/general/detalle-credito/detalle-credito.component.html +0 -35
  185. package/src/lib/ui/general/detalle-credito/detalle-credito.component.scss +0 -35
  186. package/src/lib/ui/general/detalle-credito/detalle-credito.component.ts +0 -14
  187. package/src/lib/ui/general/montos-calcular/montos-calcular.component.html +0 -17
  188. package/src/lib/ui/general/montos-calcular/montos-calcular.component.scss +0 -36
  189. package/src/lib/ui/general/montos-calcular/montos-calcular.component.ts +0 -19
  190. package/src/lib/ui/general/spinner/spinner.component.html +0 -8
  191. package/src/lib/ui/general/spinner/spinner.component.scss +0 -96
  192. package/src/lib/ui/general/spinner/spinner.component.ts +0 -11
  193. package/src/lib/ui/tables/card-mobile/card-mobile.component.html +0 -34
  194. package/src/lib/ui/tables/card-mobile/card-mobile.component.scss +0 -0
  195. package/src/lib/ui/tables/card-mobile/card-mobile.component.ts +0 -36
  196. package/src/lib/ui/tables/dropdown-menu/dropdown-menu.component.html +0 -59
  197. package/src/lib/ui/tables/dropdown-menu/dropdown-menu.component.scss +0 -88
  198. package/src/lib/ui/tables/dropdown-menu/dropdown-menu.component.ts +0 -171
  199. package/src/lib/ui/tables/paginador/paginador.component.html +0 -12
  200. package/src/lib/ui/tables/paginador/paginador.component.scss +0 -27
  201. package/src/lib/ui/tables/paginador/paginador.component.ts +0 -49
  202. package/src/lib/ui/tables/table-advance/table-advance.component.html +0 -322
  203. package/src/lib/ui/tables/table-advance/table-advance.component.scss +0 -282
  204. package/src/lib/ui/tables/table-advance/table-advance.component.ts +0 -421
  205. package/src/lib/ui/tables/table-advance-optimizada/table-advance-optimizada.component.html +0 -226
  206. package/src/lib/ui/tables/table-advance-optimizada/table-advance-optimizada.component.scss +0 -282
  207. package/src/lib/ui/tables/table-advance-optimizada/table-advance-optimizada.component.ts +0 -352
  208. package/src/lib/ui/tables/table-agrupada/table-agrupada.component.html +0 -340
  209. package/src/lib/ui/tables/table-agrupada/table-agrupada.component.scss +0 -282
  210. package/src/lib/ui/tables/table-agrupada/table-agrupada.component.ts +0 -425
  211. package/src/lib/ui/tables/table-busqueda/table-busqueda.component.html +0 -130
  212. package/src/lib/ui/tables/table-busqueda/table-busqueda.component.scss +0 -189
  213. package/src/lib/ui/tables/table-busqueda/table-busqueda.component.ts +0 -199
  214. package/src/lib/ui/tables/table-detalle/table-detalle.component.html +0 -220
  215. package/src/lib/ui/tables/table-detalle/table-detalle.component.scss +0 -135
  216. package/src/lib/ui/tables/table-detalle/table-detalle.component.ts +0 -336
  217. package/src/lib/ui/tables/table-simple/table-simple.component.html +0 -116
  218. package/src/lib/ui/tables/table-simple/table-simple.component.scss +0 -70
  219. package/src/lib/ui/tables/table-simple/table-simple.component.ts +0 -141
  220. package/src/lib/ui/tables/table-ultimate/table-ultimate.component.html +0 -268
  221. package/src/lib/ui/tables/table-ultimate/table-ultimate.component.scss +0 -282
  222. package/src/lib/ui/tables/table-ultimate/table-ultimate.component.ts +0 -383
  223. package/src/lib/ui/tabs/nav-tabs/nav-tabs.component.html +0 -12
  224. package/src/lib/ui/tabs/nav-tabs/nav-tabs.component.scss +0 -100
  225. package/src/lib/ui/tabs/nav-tabs/nav-tabs.component.ts +0 -19
  226. package/src/lib/ui/tabs/tab-item/tab-item.component.html +0 -0
  227. package/src/lib/ui/tabs/tab-item/tab-item.component.scss +0 -0
  228. package/src/lib/ui/tabs/tab-item/tab-item.component.ts +0 -13
  229. package/src/lib/utils/ayuda-global/datatable.ts +0 -67
  230. package/src/lib/utils/ayuda-global/filtros-busqueda.ts +0 -51
  231. package/src/lib/utils/general/validaciones-simple.ts +0 -14
  232. package/src/lib/utils/general/validaciones.ts +0 -123
  233. package/src/lib/utils/helpers/api-result.ts +0 -95
  234. package/src/lib/utils/helpers/modal-result.ts +0 -34
  235. package/tsconfig.lib.json +0 -15
  236. package/tsconfig.lib.prod.json +0 -11
  237. package/tsconfig.spec.json +0 -15
@@ -1,352 +0,0 @@
1
- import { DatePipe, DecimalPipe, NgClass, NgTemplateOutlet } from '@angular/common';
2
- import { ChangeDetectionStrategy, Component, computed, contentChild, effect, ElementRef, HostListener, inject, input, linkedSignal, model, output, QueryList, signal, TemplateRef, untracked, viewChild, ViewChild, ViewChildren } from '@angular/core';
3
- import { FormsModule } from '@angular/forms';
4
- import { DropdownCdkComponent } from "../../dropdown/dropdown-cdk/dropdown-cdk.component";
5
- import { CardMobileComponent } from "../card-mobile/card-mobile.component";
6
- import { dropdownAnimation, fadeInOut } from '../../../directivas/animaciones/fade-animation';
7
- import { CellRender, CellRendered } from '../../../models/cell-rendered';
8
- import { TableData } from '../../../models/table-data.model';
9
- import { formatNumber, validarBoolean } from 'shared-tsi';
10
-
11
- @Component({
12
- selector: 'app-table-advance-optimizada',
13
- imports: [DropdownCdkComponent, FormsModule, NgClass, NgTemplateOutlet, CardMobileComponent],
14
- templateUrl: './table-advance-optimizada.component.html',
15
- styleUrl: './table-advance-optimizada.component.scss',
16
- animations: [dropdownAnimation, fadeInOut],
17
- providers: [DatePipe, DecimalPipe],
18
- changeDetection:ChangeDetectionStrategy.OnPush
19
- })
20
- export class TableAdvanceOptimizadaComponent {
21
-
22
- tableHeaders = viewChild<QueryList<ElementRef>>('thElement')
23
- customActions = contentChild<TemplateRef<any>>('customActions')
24
- anchor = viewChild<ElementRef<HTMLTableRowElement>>('anchor')
25
-
26
- private decimalPipe = inject(DecimalPipe)
27
- titleTabla = input<string>('Contrato')
28
-
29
-
30
- rows = input<any[]>([])
31
- columns = input<any[]>([])
32
- withDetails = input<boolean>(false)
33
- withFiltro = input<boolean>(false)
34
- altoContainer = input<number>()
35
- colorHeader = input<'normal' | 'light'>('normal')
36
-
37
- busqueda = signal<string>('')
38
- selectedRow = model<any>(null)
39
- identifier = input<string[]>([])
40
-
41
- altoContenedor = signal<number>(0)
42
- showPopoverFilter = signal<boolean>(false)
43
- withHeight = input<boolean>(false)
44
- rendered = input<CellRendered[]>([])
45
- withTotal = input<boolean>(false)
46
- withCheckbox = input<boolean>(false)
47
- selectItems = model<string[]>([])
48
- isDarkMode = input<boolean>(false)
49
-
50
- sortColumn: string | null = null
51
- sortDirection: 'asc' | 'desc' = 'asc'
52
- expandedRows: number = -1
53
-
54
-
55
- /* VARIABLES PARA OPTIMIZAR */
56
- dataVirtual = signal<any[]>([])
57
- isLoading = signal(false);
58
- isLoadingResponsive = signal(false)
59
- // private batchSize = 30;
60
- private loadedCount = 0;
61
- private observer!: IntersectionObserver;
62
- maxItems = input<number>(50)
63
- batchSize = input<number>(40)
64
-
65
- rowEvent = output<any>()
66
-
67
- rowFilter = computed(() => {
68
- const term = this.busqueda().toLowerCase()
69
- const currentRows = this.rows?.() || []
70
- return currentRows.filter(item => this.filtraItem(item, term))
71
- })
72
-
73
- filtrarColumnas = linkedSignal(() => {
74
- const columns = this.columns()
75
- const filtro: { [caption: string]: boolean } = {}
76
- columns.forEach((col) => {
77
- if (col.fieldname) {
78
- filtro[col.fieldname] = true
79
- }
80
- })
81
- return filtro
82
- })
83
-
84
- toggleFiltros(event: Event) {
85
- const checked = (event.target as HTMLInputElement).checked
86
- const filtros = this.filtrarColumnas()
87
- Object.keys(filtros).forEach(key => {
88
- filtros[key] = checked
89
- })
90
- }
91
-
92
- visibilidadColumn = linkedSignal(() => {
93
- const columns = this.columns()
94
- const columnVisibility: { [caption: string]: boolean } = {}
95
- columns.forEach((col) => {
96
- if (col.caption) {
97
- columnVisibility[col.caption] = true
98
- }
99
- })
100
- return columnVisibility
101
- })
102
-
103
- concatenarValue(obj: any, value: string[]) {
104
- let result = ''
105
- value.forEach(el => {
106
- result += obj[el]
107
- })
108
- return result
109
- }
110
-
111
- checkString = {
112
- 'S': 'Activo',
113
- 'N': 'Inactivo'
114
- }
115
-
116
- isMobile = signal<boolean>(window.innerWidth <= 768)
117
-
118
- constructor() {
119
- effect(() => {
120
- const size = (this.rowFilter() ?? []).length
121
-
122
- const alto = this.altoContainer()
123
- if (alto > 0 && alto < this.altoContenedor()) {
124
- setTimeout(() => {
125
- this.altoContenedor.set(alto)
126
- }, 300)
127
- }
128
- if (alto > 0 && alto > this.altoContenedor()) {
129
- this.altoContenedor.set(alto)
130
- }
131
-
132
- const selected = untracked(() => this.selectedRow())
133
- if (size > 0 && selected) {
134
- queueMicrotask(() => {
135
- const el = document.getElementById('row_table_' + selected)
136
- el?.scrollIntoView({ behavior: 'smooth', block: 'nearest' })
137
- })
138
- }
139
- })
140
-
141
- effect(() => {
142
- const filtered = this.rowFilter();
143
- const firstBatch = filtered.slice(0, this.batchSize());
144
- this.dataVirtual.set(firstBatch);
145
- this.loadedCount = firstBatch.length;
146
- });
147
-
148
- effect(() => {
149
- this.isMobile();
150
- this.isLoadingResponsive.set(true);
151
- setTimeout(() => this.isLoadingResponsive.set(false), 200);
152
- });
153
-
154
- effect(() => {
155
- if(this.anchor()) {
156
- this.actionsAnchor()
157
- }
158
- })
159
- }
160
-
161
- @HostListener('window:resize', ['$event'])
162
- onResize(event: any) {
163
- this.isMobile.set(event.target.innerWidth <= 768);
164
- }
165
-
166
- actionsAnchor() {
167
- this.observer = new IntersectionObserver(entries => {
168
- if (entries[0].isIntersecting && this.loadedCount < this.rowFilter().length && !this.isLoading()) {
169
- this.loadMore();
170
- }
171
- });
172
- this.observer.observe(this.anchor().nativeElement);
173
- }
174
-
175
- togglePopoverFilter() {
176
- this.showPopoverFilter.update(prev => !prev)
177
- }
178
-
179
- selectRow(index: any) {
180
- if (this.identifier().length < 1) {
181
- return this.selectedRow.set(index)
182
- }
183
- this.selectedRow.set(this.concatenarValue(index, this.identifier()))
184
- }
185
-
186
- sortTable(column: string) {
187
- if (this.sortColumn == column) {
188
- this.sortDirection = this.sortDirection == 'asc' ? 'desc' : 'asc'
189
- } else {
190
- this.sortColumn = column
191
- this.sortDirection = 'asc'
192
- }
193
-
194
- this.dataVirtual().sort((a, b) => {
195
- const valueA = a[column] ?? ''
196
- const valueB = b[column] ?? ''
197
-
198
- if (typeof valueA == 'number' && typeof valueB == 'number') {
199
- return this.sortDirection == 'asc' ? valueA - valueB : valueB - valueA
200
- } else {
201
- return this.sortDirection == 'asc'
202
- ? valueA.toString().localeCompare(valueB.toString())
203
- : valueB.toString().localeCompare(valueA.toString())
204
- }
205
- })
206
- }
207
-
208
- toggleExpandRow(index: number) {
209
- this.expandedRows = this.expandedRows == index ? -1 : index
210
- }
211
-
212
- textoDigitado(event: Event) {
213
- const value = (event.target as HTMLInputElement).value
214
- this.busqueda.set(value)
215
- }
216
-
217
- getHighlight(text: any, fieldname: string): string {
218
- if (text == null) {
219
- text = ''
220
- }
221
- if (!this.filtrarColumnas()[fieldname] || !this.busqueda()) return text
222
- if (typeof text !== 'string') {
223
- text = text.toString()
224
- }
225
- const regex = new RegExp(`(${this.busqueda()})`, 'gi')
226
- return text?.replace(regex, '<mark>$1</mark>')
227
- }
228
-
229
- getSituacionNumberFromColumns(row: any, columns: any[]): number {
230
- const situacionColumn = columns.find(col => col.type == 'situacion_number')
231
- if (situacionColumn) {
232
- return row[situacionColumn.prop] || 0
233
- }
234
- return 0
235
- }
236
-
237
- private filtraItem(item: any, term: string): boolean {
238
- const columnasActivas = Object.entries(this.filtrarColumnas())
239
- .filter(([_campo, activo]) => activo)
240
- return columnasActivas.some(([campo]) => {
241
- const raw = item[campo];
242
- const formatted = item._format?.[campo];
243
- const valor = (formatted ?? raw ?? '').toString().toLowerCase();
244
- return valor.includes(term)
245
- })
246
- }
247
-
248
- validaVisibilidad(value: boolean) {
249
- return validarBoolean(value)
250
- }
251
-
252
- allCheck(event: Event) {
253
- const input = event.target as HTMLInputElement
254
- if (input.checked) {
255
- const keys = this.rowFilter().map(row => JSON.stringify(row))
256
- this.selectItems.set(keys)
257
- } else {
258
- this.selectItems.set([])
259
- }
260
- }
261
-
262
- validaAllCheck(): boolean {
263
- const keys = this.rowFilter().map(row => JSON.stringify(row))
264
- return (
265
- keys.length > 0 &&
266
- keys.every(k => this.selectItems().includes(k))
267
- )
268
- }
269
-
270
- isItemSelected(index: number): boolean {
271
- const row = this.rowFilter()[index]
272
- const key = JSON.stringify(row)
273
- return this.selectItems().includes(key)
274
- }
275
-
276
- toogleItem(index: number, event: Event) {
277
- const input = event.target as HTMLInputElement
278
- const row = this.rowFilter()[index]
279
- const key = JSON.stringify(row)
280
-
281
- if (input.checked) {
282
- this.selectItems.update(sel => [...sel, key])
283
- return
284
- }
285
- this.selectItems.update(sel => sel.filter(s => s != key))
286
- }
287
-
288
- resolveCell(col: string, row: any): CellRender | null {
289
- const value = row[col]
290
- const r = this.rendered().find(r => r.matches(col, value, row))
291
- return r ? r.render(value, row) : null
292
- }
293
-
294
- getTotals(fieldname: string): string {
295
- const itemsSelected = this.withCheckbox() ? this.selectItems().map(item => JSON.parse(item?.toString())) : this.rows()
296
- const final = itemsSelected.reduce((acc, row) => {
297
- const val = row[fieldname]
298
- return acc + (typeof val == 'number' ? val : 0)
299
- }, 0)
300
-
301
- return formatNumber(this.decimalPipe,final)
302
- }
303
-
304
- getColspanBeforeTotals(): number {
305
- const firstTotalizableIndex = this.columns().findIndex(c => c.totalizable)
306
- const result = firstTotalizableIndex >= 0 ? firstTotalizableIndex : this.columns.length
307
- return this.withCheckbox() ? result + 1 : result
308
- }
309
-
310
- getRowClass(row: any): { [key: string]: boolean } {
311
- return {
312
- 'text-error': row.situac == 'J',
313
- 'text-alerta': row.situac == 'L'
314
- }
315
- }
316
-
317
- getPosition(col:TableData):string {
318
- if(col.position) return `text-${col.position}`
319
- if(['decimal', 'number'].includes(col.tipo)) return `text-end`
320
- if(['fecha', 'date'].includes(col.tipo)) return `text-center`
321
- return 'text-start'
322
- }
323
-
324
- private loadMore() {
325
- this.isLoading.set(true);
326
- setTimeout(() => {
327
-
328
- const current = this.dataVirtual();
329
- const next = this.rowFilter().slice(this.loadedCount, this.loadedCount + this.batchSize());
330
- const merged = [...current];
331
- for (const item of next) {
332
- if (!merged.some(x => x.idListTsi === item.idListTsi)) {
333
- merged.push(item);
334
- }
335
- }
336
- this.dataVirtual.set(merged);
337
- this.loadedCount += next.length;
338
- this.isLoading.set(false);
339
- }, 100);
340
- }
341
-
342
- onClick(row:any) {
343
- this.rowEvent.emit({ usecase:1 , data:row})
344
- }
345
- onDoubleClick(row:any) {
346
- this.rowEvent.emit({ usecase:2 , data:row})
347
- }
348
- onRightClick(event: MouseEvent,row:any) {
349
- event.preventDefault();
350
- this.rowEvent.emit({ usecase:3 , data:row})
351
- }
352
- }
@@ -1,340 +0,0 @@
1
- @if (withFiltro()) {
2
- <div class="col-12 mb-2 mt-2 d-flex justify-content-end align-items-center">
3
- <label class="form-label me-2 pt-2">Buscar</label>
4
- <input type="text" class="form-control cw-250" (input)="textoDigitado($event)">
5
-
6
- <app-dropdown-cdk>
7
- <ng-template #trigger>
8
- <button class="btn btn-dark boton-buscar fs-7">
9
- <i class="fas fa-cog"></i>
10
- </button>
11
- </ng-template>
12
-
13
- <ng-template #content>
14
- <div class="popover-menu-filter bg-white shadow" @dropdownAnimation>
15
- <div class="popover-title fs-7 bg-white">
16
- Filtros
17
- </div>
18
-
19
- <div class="form-check form-switch text-start d-flex align-items-center">
20
- <input class="form-check-input py-0 my-0 cw-25 ch-15" type="checkbox" [checked]="true"
21
- (change)="toggleFiltros($event)" />
22
- <label class="form-check-label ps-2 fs-6 mb-0 cursor-pointer">
23
- Todos
24
- </label>
25
- </div>
26
-
27
- @for (col of columns(); track col.caption) {
28
- <div class="form-check form-switch text-start d-flex align-items-center">
29
- <input type="checkbox" class="form-check-input py-0 my-0 cw-25 ch-15"
30
- id="{{ 'filter_' + col.caption }}" [(ngModel)]="filtrarColumnas()[col.fieldname]" />
31
- <label class="form-check-label ps-2 fs-6 cursor-pointer mb-0" for="{{ 'filter_' + col.caption }}">
32
- {{ col.caption }}
33
- </label>
34
- </div>
35
- }
36
- </div>
37
- </ng-template>
38
- </app-dropdown-cdk>
39
- </div>
40
- }
41
-
42
- <!-- VISTA MOBILE -->
43
- @if (activeMobileMode()) {
44
- @if (isLoadingResponsive()) {
45
- <div class="d-flex flex-column justify-content-center align-items-center py-2">
46
- <div class="spinner-border text-secondary mb-2" role="status"></div>
47
- <span class="ms-2 fs-6">Cargando...</span>
48
- </div>
49
- }
50
-
51
- @if (!isLoadingResponsive()) {
52
- @if (isMobile()) {
53
- <app-card-mobile [data]="rowFilter()" [columns]="columns()" [actions]="customActions()" [identifier]="identifier()"
54
- [titleTabla]="titleTabla()" [altoContainer]="altoContainer()" />
55
- }
56
- @if (!isMobile()) {
57
- <ng-container *ngTemplateOutlet="table"></ng-container>
58
- }
59
- }
60
- }
61
- @else {
62
- <ng-container *ngTemplateOutlet="table"></ng-container>
63
- }
64
-
65
- <ng-template #table>
66
- <div class="table-container table-responsive"
67
- [style.height]="withHeight() && altoContenedor() ? 'calc(100vh - ' + altoContenedor() + 'px)' : ''"
68
- [style.max-height]="altoContenedor()? 'calc(100vh - ' + altoContenedor() + 'px)' : ''">
69
- <div>
70
- <table #table class="table table-striped normal-table" [ngClass]="isDarkMode() ? 'table-dark' : ''">
71
-
72
- @if (hasColumnGroups()) {
73
- <thead>
74
- <tr class="shadow-sm">
75
- @if (withDetails()) {
76
- <th rowspan="2" class="cw-20 b-table">
77
- </th>
78
- }
79
-
80
- @if (withCheckbox()) {
81
- <th rowspan="2" class="cw-20 b-table">
82
- <label>
83
- <input type="checkbox" name="check_box_select_table_main"
84
- id="check_box_select_table_main" animatedCheckbox [checked]="validaAllCheck()"
85
- (change)="allCheck($event)">
86
- </label>
87
- </th>
88
- }
89
-
90
- @if (customActions()) {
91
- <th rowspan="2" class="cw-40 b-table">
92
- </th>
93
- }
94
-
95
- @for (seg of headerSegments(); track $index) {
96
-
97
- @if (seg.type === 'column') {
98
- <th class="b-table" rowspan="2"
99
- [style.width]="seg.column?.width ? seg.column.width + 'px' : 'auto'">
100
- {{ seg.column?.caption }}
101
- </th>
102
- }
103
-
104
- @if (seg.type === 'group') {
105
- <th class="b-table text-center fw-bold" [attr.colspan]="seg.group?.colspan">
106
- {{ seg.group?.label }}
107
- </th>
108
- }
109
-
110
- }
111
- </tr>
112
-
113
- <tr class="shadow-sm">
114
- @for (column of groupedColumns(); track $index) {
115
- @if (validaVisibilidad(column.visible) && visibilidadColumn()[column.fieldname] !== false) {
116
- <th class="b-table" #thElement [title]="column.caption"
117
- [style.width]="column?.width ? column.width + 'px' : 'auto'"
118
- [style.max-width]="column?.width ? column.width + 'px' : 'auto'">
119
- {{ column.caption }}
120
- @if(column.caption){
121
- @if (sortColumn == column.fieldname) {
122
- <span (click)="sortTable(column.fieldname)" class="cursor-pointer">
123
- <i
124
- [ngClass]="sortDirection == 'asc' ? 'fas fa-angle-up fs-6':'fas fa-angle-down fs-6'"></i>
125
- </span>
126
- }
127
- @if (sortColumn !== column.fieldname) {
128
- <i class="fas fa-sort icon-sort cursor-pointer" (click)="sortTable(column.fieldname)"></i>
129
- }
130
- }
131
- </th>
132
- }
133
- }
134
- </tr>
135
- </thead>
136
-
137
- } @else {
138
-
139
- <thead>
140
- <tr class="shadow-sm">
141
- @if (withDetails()) {
142
- <th class="cw-20 b-table" [ngClass]="colorHeader()== 'normal' ? 'h-table' : ''"></th>
143
- }
144
-
145
- @if (withCheckbox()) {
146
- <th class="cw-20 b-table" [ngClass]="colorHeader()== 'normal' ? 'h-table' : ''">
147
- <label>
148
- <input type="checkbox" name="check_box_select_table_main"
149
- id="check_box_select_table_main" animatedCheckbox [checked]="validaAllCheck()"
150
- (change)="allCheck($event)">
151
- </label>
152
- </th>
153
- }
154
-
155
- @if (customActions()) {
156
- <th class="cw-40 b-table" [ngClass]="colorHeader()== 'normal' ? 'h-table' : ''">
157
-
158
- <app-dropdown-cdk>
159
- <ng-template #trigger>
160
- <button class="btn p-0 text-dark d-flex mx-auto border-0">
161
- <i class="fas fa-cog"></i>
162
- </button>
163
- </ng-template>
164
- <ng-template #content>
165
- <div class="popover-menu-column bg-white shadow mt-2" @dropdownAnimation>
166
- <div class="popover-title fs-7 bg-white">Columnas</div>
167
- @for (col of columns(); track col.caption) {
168
- @if (col.caption) {
169
- <div class="form-check form-switch text-start d-flex align-items-center">
170
- <input type="checkbox" class="form-check-input py-0 my-0 cw-25 ch-15"
171
- id="{{ 'switch_' + col.caption }}"
172
- [(ngModel)]="visibilidadColumn()[col.fieldname]" />
173
- <label class="form-check-label ps-2 fs-6 cursor-pointer font-label mb-0"
174
- for="{{ 'switch_' + col.caption }}">
175
- {{ col.caption }}
176
- </label>
177
- </div>
178
- }
179
- }
180
- </div>
181
- </ng-template>
182
- </app-dropdown-cdk>
183
- </th>
184
- }
185
- @for (column of columns(); track $index) {
186
- @if (validaVisibilidad(column.visible) && visibilidadColumn()[column.fieldname] !== false) {
187
- <th class="b-table" #thElement [title]="column.caption"
188
- [style.width]="column?.width ? column.width + 'px' : 'auto'"
189
- [style.max-width]="column?.width ? column.width + 'px' : 'auto'"
190
- [ngClass]="colorHeader()== 'normal' ? 'h-table' : ''">
191
- {{ column.caption }}
192
- @if(column.caption){
193
- @if (sortColumn == column.fieldname) {
194
- <span (click)="sortTable(column.fieldname)" class="cursor-pointer">
195
- <i
196
- [ngClass]="sortDirection == 'asc' ? 'fas fa-angle-up fs-6':'fas fa-angle-down fs-6'"></i>
197
- </span>
198
- }
199
- @if (sortColumn !== column.fieldname) {
200
- <i class="fas fa-sort icon-sort cursor-pointer" (click)="sortTable(column.fieldname)"></i>
201
- }
202
- }
203
- </th>
204
- }
205
- }
206
- </tr>
207
- </thead>
208
-
209
- }
210
-
211
- <tbody>
212
- @for (row of dataVirtual(); track row.idListTsi) {
213
- @let idList = row.idListTsi;
214
- <tr [ngClass]="{'table-active': (identifier().length < 1 ? selectedRow() == $index : selectedRow() == concatenarValue(row,identifier()))}"
215
- (click)="selectRow(identifier().length < 1 ? $index : row); onClick(row)"
216
- (dblclick)="onDoubleClick(row)" (contextmenu)="onRightClick($event,row)"
217
- [id]="identifier().length < 1 ? ('row_table_' + $index) : ('row_table_'+ concatenarValue(row,identifier()))">
218
- @if (withDetails()) {
219
- <td class="b-table text-center mwp-25">
220
- <a (click)="toggleExpandRow($index)" class="text-dark cursor-pointer fs-6">
221
- <i class="fa-solid" [class.fa-chevron-right]="expandedRows != $index"
222
- [class.fa-chevron-down]="expandedRows == $index"></i>
223
- </a>
224
- </td>
225
- }
226
-
227
- @if (withCheckbox()) {
228
- <td scope="col" class="text-center b-table">
229
- <label>
230
- <input type="checkbox" [name]="'check_box_select_table_' + idList"
231
- [id]="'check_box_select_table_' + idList" animatedCheckbox
232
- [checked]="isItemSelected(idList)" (change)="toogleItem(idList , $event)"
233
- [disabled]="isCheckboxDisabled(row)">
234
- </label>
235
- </td>
236
- }
237
-
238
- @if (customActions()) {
239
- <td class="text-center mwp-90 b-table">
240
- <ng-container
241
- *ngTemplateOutlet="customActions(); context: { $implicit: row }"></ng-container>
242
- </td>
243
- }
244
- @for (column of columns(); track $index) {
245
- @if (validaVisibilidad(column.visible) && visibilidadColumn()[column.fieldname] !== false) {
246
-
247
- @if (column.template) {
248
- <td class="b-table">
249
- <ng-container
250
- *ngTemplateOutlet="column.template; context: { $implicit: row, column: column }">
251
- </ng-container>
252
- </td>
253
- }@else {
254
- @switch (column.tipo) {
255
- @case ('cell-render') {
256
- @let resolverItem = resolveCell(column.fieldname, row);
257
- @if (resolverItem) {
258
- <td class="b-table" [title]="resolverItem.text" [class.text-center]="resolverItem.icon">
259
- @if (resolverItem.icon) {
260
- <i class="fs-5" [ngClass]="resolverItem.icon"></i>
261
- } @else if (resolverItem.class) {
262
- <span [ngClass]="row.situac == 'J' ? 'text-error' : resolverItem.class">
263
- {{ resolverItem.text }}
264
- </span>
265
- } @else {
266
- {{ resolverItem.text }}
267
- }
268
- </td>
269
- }
270
- }
271
-
272
- @default {
273
- <td [innerHTML]="getHighlight(row._format?.[column.fieldname] ?? row[column.fieldname], column.fieldname)"
274
- [style.width]="column?.width ? column.width + 'px' : 'auto'"
275
- [style.max-width]="column?.width ? column.width + 'px' : 'auto'"
276
- [title]="row._format?.[column.fieldname] ?? row[column.fieldname]"
277
- [ngClass]="rowClassFn() ? rowClassFn()(row) : getRowClass(row)"
278
- class="b-table {{getPosition(column)}}">
279
- </td>
280
- }
281
- }
282
-
283
- }
284
- }
285
- }
286
- </tr>
287
- @if ($index == expandedRows) {
288
- <tr @fadeInOut>
289
- <td [attr.colspan]="columns().length + (withDetails()? 1 : 0) + (customActions() ? 1 : 0) + (withCheckbox() ? 1 : 0)"
290
- class="table-blank">
291
- <div class="d-flex flex-column auditoria">
292
- <span class="fw-bold fs-7 text-dark">Datos de auditoría</span>
293
- <span class="fs-6 text-dark fw-bold">
294
- Creación: {{ row.nomucreac }} el {{ row._format?.fcreac ?? row.fcreac }} a las {{
295
- row.hcreac }}
296
- </span>
297
- <span class="fs-6 text-dark fw-bold">
298
- Actualización: {{ row.nomuactua }} el {{ row._format?.factua ?? row.factua }} a las
299
- {{
300
- row.hactua }}
301
- </span>
302
- </div>
303
- </td>
304
- </tr>
305
- }
306
- }
307
- <tr #anchor>
308
- <td [attr.colspan]="columns().length + (withDetails()? 1 : 0) + (customActions() ? 1 : 0) + (withCheckbox() ? 1 : 0)"
309
- class="text-center text-muted py-3">
310
- @if (isLoading()) {
311
- <span>Cargando más registros...</span>
312
- }
313
- @if (!isLoading() && dataVirtual().length >= 5000) {
314
- <span>No hay más registros</span>
315
- }
316
- </td>
317
- </tr>
318
- </tbody>
319
-
320
- @if (withTotal()) {
321
- <tfoot>
322
- <tr>
323
- <td class="b-table" [attr.colspan]="getColspanBeforeTotals()">Totales:</td>
324
- @for (col of columns() ; track $index) {
325
- @if (col.totalizable) {
326
- <td class="b-table text-end">
327
- {{ getTotals(col.fieldname)}}
328
- </td>
329
- }
330
- }
331
- </tr>
332
- </tfoot>
333
- }
334
- </table>
335
- </div>
336
- </div>
337
-
338
- </ng-template>
339
-
340
- <!-- FIN VISTA MOBILE -->