@jvsoft/components 0.0.13-alpha.1 → 0.0.13-alpha.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 (140) hide show
  1. package/dialog-flotante/dialog-flotante.component.d.ts +32 -0
  2. package/dialog-flotante/dialog-flotante.interface.d.ts +11 -0
  3. package/dialog-flotante/index.d.ts +5 -0
  4. package/fesm2022/jvsoft-components-dialog-flotante.mjs +129 -0
  5. package/fesm2022/jvsoft-components-dialog-flotante.mjs.map +1 -0
  6. package/fesm2022/jvsoft-components-lista-arbol.mjs +282 -0
  7. package/fesm2022/jvsoft-components-lista-arbol.mjs.map +1 -0
  8. package/fesm2022/jvsoft-components-luces-navidad.mjs +33 -0
  9. package/fesm2022/jvsoft-components-luces-navidad.mjs.map +1 -0
  10. package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs +47 -0
  11. package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs.map +1 -0
  12. package/fesm2022/jvsoft-components-menu.mjs +102 -0
  13. package/fesm2022/jvsoft-components-menu.mjs.map +1 -0
  14. package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs +91 -0
  15. package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs.map +1 -0
  16. package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs +1812 -0
  17. package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs.map +1 -0
  18. package/fesm2022/jvsoft-components.mjs +2335 -0
  19. package/fesm2022/jvsoft-components.mjs.map +1 -0
  20. package/{index.ts → index.d.ts} +1 -8
  21. package/lista-arbol/index.d.ts +5 -0
  22. package/lista-arbol/lista-arbol.component.d.ts +58 -0
  23. package/lista-arbol/lista-arbol.functions.d.ts +8 -0
  24. package/luces-navidad/index.d.ts +5 -0
  25. package/luces-navidad/luces-navidad.component.d.ts +11 -0
  26. package/mat-suffix-search-button/index.d.ts +5 -0
  27. package/mat-suffix-search-button/mat-suffix-search-button.component.d.ts +12 -0
  28. package/menu/index.d.ts +5 -0
  29. package/menu/menu.component.d.ts +25 -0
  30. package/menu/menu.interface.d.ts +16 -0
  31. package/package.json +43 -6
  32. package/tabla-mantenimiento/classes/data-model.d.ts +25 -0
  33. package/tabla-mantenimiento/components/progress-bar/index.d.ts +5 -0
  34. package/tabla-mantenimiento/components/progress-bar/progress-bar.component.d.ts +30 -0
  35. package/tabla-mantenimiento/components/progress-bar/public-api.d.ts +1 -0
  36. package/tabla-mantenimiento/index.d.ts +5 -0
  37. package/tabla-mantenimiento/interfaces/{archivo.ts → archivo.d.ts} +4 -7
  38. package/tabla-mantenimiento/interfaces/global/{boton-mantenimiento.ts → boton-mantenimiento.d.ts} +3 -9
  39. package/tabla-mantenimiento/interfaces/global/{columnas-tabla.ts → columnas-tabla.d.ts} +12 -89
  40. package/tabla-mantenimiento/interfaces/global/no-export.d.ts +2 -0
  41. package/tabla-mantenimiento/interfaces/global/{otros.ts → otros.d.ts} +4 -15
  42. package/tabla-mantenimiento/interfaces/implements/{incluye-tabla-mantenimiento.ts → incluye-tabla-mantenimiento.d.ts} +4 -6
  43. package/tabla-mantenimiento/interfaces/implements/{index.ts → index.d.ts} +0 -1
  44. package/tabla-mantenimiento/mat-row-keyboard-selection.directive.d.ts +19 -0
  45. package/tabla-mantenimiento/pipes/no-sanitize.pipe.d.ts +10 -0
  46. package/tabla-mantenimiento/pipes/zero-fill.pipe.d.ts +8 -0
  47. package/tabla-mantenimiento/{public-api.ts → public-api.d.ts} +2 -3
  48. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.d.ts +8 -0
  49. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.d.ts +9 -0
  50. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.d.ts +9 -0
  51. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.d.ts +8 -0
  52. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.d.ts +8 -0
  53. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.d.ts +9 -0
  54. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.d.ts +8 -0
  55. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.d.ts +18 -0
  56. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.d.ts +23 -0
  57. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.d.ts +21 -0
  58. package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.d.ts +18 -0
  59. package/tabla-mantenimiento/tabla-mantenimiento.component.d.ts +151 -0
  60. package/tabla-mantenimiento/tabla-mantenimiento.functions.d.ts +5 -0
  61. package/tabla-mantenimiento/tabla-mantenimiento.service.d.ts +8 -0
  62. package/tabla-mantenimiento/table-util.d.ts +11 -0
  63. package/CHANGELOG.md +0 -15
  64. package/build.js +0 -20
  65. package/dialog-flotante/dialog-flotante.component.html +0 -66
  66. package/dialog-flotante/dialog-flotante.component.ts +0 -115
  67. package/dialog-flotante/dialog-flotante.interface.ts +0 -13
  68. package/dialog-flotante/index.ts +0 -1
  69. package/dialog-flotante/ng-package.json +0 -5
  70. package/lista-arbol/lista-arbol.component.html +0 -66
  71. package/lista-arbol/lista-arbol.component.ts +0 -238
  72. package/lista-arbol/lista-arbol.functions.ts +0 -46
  73. package/lista-arbol/ng-package.json +0 -5
  74. package/luces-navidad/christmas-tree.png +0 -0
  75. package/luces-navidad/index.ts +0 -1
  76. package/luces-navidad/luces-navidad.component.html +0 -6
  77. package/luces-navidad/luces-navidad.component.ts +0 -24
  78. package/luces-navidad/ng-package.json +0 -5
  79. package/mat-suffix-search-button/index.ts +0 -1
  80. package/mat-suffix-search-button/mat-suffix-search-button.component.html +0 -5
  81. package/mat-suffix-search-button/mat-suffix-search-button.component.ts +0 -36
  82. package/mat-suffix-search-button/ng-package.json +0 -5
  83. package/menu/index.ts +0 -1
  84. package/menu/menu.component.html +0 -40
  85. package/menu/menu.component.ts +0 -88
  86. package/menu/menu.interface.ts +0 -16
  87. package/menu/ng-package.json +0 -5
  88. package/ng-package.json +0 -17
  89. package/progress-spinner.zip +0 -0
  90. package/tabla-mantenimiento/classes/data-model.ts +0 -150
  91. package/tabla-mantenimiento/components/progress-bar/index.ts +0 -1
  92. package/tabla-mantenimiento/components/progress-bar/ng-package.json +0 -5
  93. package/tabla-mantenimiento/components/progress-bar/progress-bar.component.html +0 -10
  94. package/tabla-mantenimiento/components/progress-bar/progress-bar.component.ts +0 -85
  95. package/tabla-mantenimiento/components/progress-bar/public-api.ts +0 -2
  96. package/tabla-mantenimiento/index.ts +0 -1
  97. package/tabla-mantenimiento/interfaces/global/export-excel-servidor.ts +0 -0
  98. package/tabla-mantenimiento/interfaces/global/no-export.ts +0 -11
  99. package/tabla-mantenimiento/mat-row-keyboard-selection.directive.ts +0 -97
  100. package/tabla-mantenimiento/ng-package.json +0 -5
  101. package/tabla-mantenimiento/pipes/no-sanitize.pipe.ts +0 -12
  102. package/tabla-mantenimiento/pipes/zero-fill.pipe.ts +0 -19
  103. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.html +0 -22
  104. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.ts +0 -12
  105. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.html +0 -58
  106. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.ts +0 -19
  107. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.html +0 -40
  108. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.ts +0 -17
  109. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.html +0 -25
  110. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.ts +0 -14
  111. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.html +0 -28
  112. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.ts +0 -13
  113. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.html +0 -30
  114. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.ts +0 -38
  115. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.html +0 -97
  116. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.ts +0 -43
  117. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.html +0 -26
  118. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.ts +0 -36
  119. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.ts +0 -54
  120. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.html +0 -76
  121. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.ts +0 -67
  122. package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.html +0 -7
  123. package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.ts +0 -39
  124. package/tabla-mantenimiento/tabla-mantenimiento.component.html +0 -385
  125. package/tabla-mantenimiento/tabla-mantenimiento.component.ts +0 -951
  126. package/tabla-mantenimiento/tabla-mantenimiento.functions.ts +0 -57
  127. package/tabla-mantenimiento/tabla-mantenimiento.service.ts +0 -44
  128. package/tabla-mantenimiento/table-util.ts +0 -49
  129. package/tabla-mantenimiento.zip +0 -0
  130. package/tsconfig.lib.json +0 -21
  131. package/tsconfig.lib.prod.json +0 -11
  132. package/tsconfig.spec.json +0 -15
  133. package/yarn-error.log +0 -68
  134. /package/dialog-flotante/{public-api.ts → public-api.d.ts} +0 -0
  135. /package/lista-arbol/{public-api.ts → public-api.d.ts} +0 -0
  136. /package/luces-navidad/{public-api.ts → public-api.d.ts} +0 -0
  137. /package/mat-suffix-search-button/{public-api.ts → public-api.d.ts} +0 -0
  138. /package/menu/{public-api.ts → public-api.d.ts} +0 -0
  139. /package/tabla-mantenimiento/interfaces/global/{index.ts → index.d.ts} +0 -0
  140. /package/tabla-mantenimiento/interfaces/{index.ts → index.d.ts} +0 -0
@@ -1,951 +0,0 @@
1
- import {animate, state, style, transition, trigger} from '@angular/animations';
2
- import {Overlay, OverlayRef} from '@angular/cdk/overlay';
3
- import {TemplatePortal} from '@angular/cdk/portal';
4
- import {CommonModule} from '@angular/common';
5
- import {AfterContentInit, ChangeDetectorRef, Component, ContentChildren, ElementRef, EventEmitter, HostBinding, Input, OnChanges, OnInit, Output, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '@angular/core';
6
- import {FormBuilder, FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms';
7
- import {MatBadgeModule} from '@angular/material/badge';
8
- import {MatCheckboxModule} from '@angular/material/checkbox';
9
- import {MatRippleModule} from '@angular/material/core';
10
- import {MatDividerModule} from '@angular/material/divider';
11
- import {MatIconModule} from '@angular/material/icon';
12
- import {MatMenuModule} from '@angular/material/menu';
13
- import {MAT_PAGINATOR_DEFAULT_OPTIONS, MatPaginator, MatPaginatorModule} from '@angular/material/paginator';
14
- import {MatSort, MatSortModule} from '@angular/material/sort';
15
- import {MatColumnDef, MatFooterRow, MatRow, MatTable, MatTableDataSource, MatTableModule} from '@angular/material/table';
16
- import {MatTooltipModule} from '@angular/material/tooltip';
17
- import {UntilDestroy, untilDestroyed} from '@ngneat/until-destroy';
18
-
19
- import moment from 'moment';
20
- import {fromEvent, Observable, of, Subscription} from 'rxjs';
21
- import {filter, map, take} from 'rxjs/operators';
22
- import shortHash from 'shorthash2';
23
- import {DataModel} from './classes/data-model';
24
- import {BotonMantenimiento, ColumnaIcons, ColumnaTabla, OpcionSeleccionada, SeccionesBotonesMantenimiento} from './interfaces';
25
- import {tipoValorFuncion, TipoValorFuncion} from './interfaces/global/no-export';
26
- import {MatRowKeyboardSelectionDirective} from './mat-row-keyboard-selection.directive';
27
- import {TablaMantenimientoColumnDefsComponent} from './tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component';
28
- import {TablaMantenimientoMenuComponent} from './tabla-mantenimiento-menu/tabla-mantenimiento-menu.component';
29
- import {buscarEnArray, capitalizarTexto, formatearFecha, getBrowserName} from './tabla-mantenimiento.functions';
30
- import {TablaMantenimientoService} from './tabla-mantenimiento.service';
31
- import {TableUtil} from './table-util';
32
- import {SelectionModel} from '@angular/cdk/collections';
33
-
34
- export interface MantenimientoFilaExtraData {
35
- template?: TemplateRef<any>;
36
- esVisible?(item?: any): boolean;
37
- }
38
-
39
- type TiposControlBusqueda ='query' | 'simple' | '';
40
- @UntilDestroy({ checkProperties: true })
41
- @Component({
42
- selector: 'jvs-tabla-mantenimiento',
43
- standalone: true,
44
- imports: [
45
- CommonModule,
46
- FormsModule,
47
- MatCheckboxModule,
48
- MatDividerModule,
49
- MatIconModule,
50
- MatMenuModule,
51
- MatPaginatorModule,
52
- MatRippleModule,
53
- MatSortModule,
54
- MatTableModule,
55
- MatTooltipModule,
56
- ReactiveFormsModule,
57
- TablaMantenimientoColumnDefsComponent,
58
- MatBadgeModule,
59
- TablaMantenimientoMenuComponent,
60
- MatRowKeyboardSelectionDirective,
61
- ],
62
- templateUrl: './tabla-mantenimiento.component.html',
63
- styleUrls: ['./tabla-mantenimiento.component.scss'],
64
- host: {
65
- class: 'jvs-tabla-mantenimiento',
66
- },
67
- animations: [
68
- trigger('detailExpand', [
69
- state('collapsed', style({height: '0px', minHeight: '0'})),
70
- state('expanded', style({height: '*'})),
71
- transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')),
72
- ]),
73
- trigger('fadeInUp', [
74
- transition(':enter', [
75
- style({
76
- transform: 'translateY(20px)',
77
- opacity: 0
78
- }),
79
- animate(`400ms cubic-bezier(0.35, 0, 0.25, 1)`, style({
80
- transform: 'translateY(0)',
81
- opacity: 1
82
- }))
83
- ])
84
- ]),
85
- ],
86
- providers: [
87
- {provide: MAT_PAGINATOR_DEFAULT_OPTIONS, useValue: {formFieldAppearance: 'outline'}}
88
- ]
89
- })
90
- export class TablaMantenimientoComponent<T> implements OnInit, AfterContentInit, OnChanges {
91
- static nextId = 0;
92
- @HostBinding()
93
- readonly id = `jvs-tabla-mantenimiento-id-${TablaMantenimientoComponent.nextId++}`;
94
-
95
- get templateBotonesComunes(): BotonMantenimiento[] {
96
- return this.tablaMantenimientoService.templateBotonesComunes;
97
- };
98
- get templateColumnasTabla(): ColumnaTabla<any>[] {
99
- return this.tablaMantenimientoService.templateColumnasTabla;
100
- };
101
-
102
- @Input() dataSuscription: Observable<any> | undefined ;
103
- @Input({required: true}) objThis: any;
104
- @Input({required: true}) nombreColeccion: any;
105
- @Input() ctrlBusquedaValue = '';
106
- @Input() ctrlBusquedaPlaceholder = 'Buscar...';
107
- @Input() filtroCampos = true;
108
- @Input() paginador = true;
109
- @Input() esTabla = true;
110
- @Input() readOnly: boolean | 'permitirSeleccion' = false;
111
- @Input() filaExtraHeader: MantenimientoFilaExtraData | any;
112
- @Input() filaFooter = false;
113
- @Input() botonesCRUD = 'CUD';
114
- @Output() dblclickItem = new EventEmitter();
115
- @Input() objBotonesCRUD: BotonMantenimiento[] = [
116
- {tipo: 'nuevo', sinCondicion: true},
117
- {tipo: 'editar'},
118
- {tipo: 'eliminar'},
119
- ];
120
- @Input() classSeleccionado = ['elemento-seleccionado', /*'!bg-primary-activo','text-primary-contrast', */ 'mat-elevation-z8', /*'dark:!bg-primary-dark-activo',*/ 'border-y-2 border-primary-contrast', 'font-bold', 'text-2xl'];
121
- // @Input() classAnulado = ['line-through', 'text-red', 'italic'];
122
- @Input() classAnulado = ['elemento-anulado', /*'line-through', */'text-red-900', 'bg-red-200'];
123
- @Input() campoAnulado: any = null;
124
- @Input() campoAnuladoMensaje: any = null;
125
- @Output() opcionSelecionada = new EventEmitter();
126
- @Output() opcBusqueda = new EventEmitter();
127
- @Output() accionRecargar = new EventEmitter();
128
-
129
-
130
- @Input() set selectionModel(val: SelectionModel<any>) {
131
- this.objSeleccionado = val;
132
- }
133
- @Output() selectionModelChange = new EventEmitter<SelectionModel<any>>();
134
-
135
- isRecargarUsed = false;
136
- @Input() filaExtraTemplate: TemplateRef<any> | undefined;
137
- @ViewChild(MatPaginator) paginator!: MatPaginator;
138
- @ViewChild(MatSort) sort!: MatSort;
139
- @Input() exportarExcel = true;
140
- // MIO
141
- @Input() pageSize = 25;
142
- @Input() pageSizeOptions = [5, 10, 25, 50, 100, 500, 1000];
143
- @Output() dataSourceChange: EventEmitter<any> = new EventEmitter();
144
-
145
- @Output() resultados = new EventEmitter<any>();
146
- dataSource = new MatTableDataSource(); // or whatever type of datasource you have
147
- // this is where the magic happens:
148
- @ViewChild(MatTable, {static: false}) table!: MatTable<T>;
149
- @ContentChildren(MatColumnDef, {descendants: true}) columnDefs!: QueryList<MatColumnDef>;
150
-
151
- componenteCargadoTotalmente = false;
152
-
153
-
154
-
155
- /////////////////////
156
- paginacion = {
157
- pageSize: 25,
158
- pageSizeOptions: <number[]>[],
159
- pageCurrent: <any>null,
160
- pageIndex: 0,
161
- pageLength: null,
162
- };
163
- // All that's left is to add them to the table ourselves:
164
- ignorarDerechos = false;
165
- @Input() derechosActuales: any = null;
166
- // listaCRUD: BotonMantenimiento[] = [];
167
- @ViewChildren(MatRow, {read: ElementRef}) rows!: QueryList<ElementRef<HTMLTableRowElement>>;
168
- @ViewChild(MatFooterRow, {read: ElementRef}) rowFooter!: ElementRef<HTMLTableRowElement>;
169
- mouseEvent$: Subscription | undefined;
170
- overlayRef: OverlayRef | undefined;
171
- @ViewChild('userMenu') userMenu!: TemplateRef<any>;
172
- // FILTRO BUSQUEDA
173
- opcFiltroActual = {};
174
-
175
- protected readonly capitalizarTexto = capitalizarTexto;
176
-
177
-
178
- _seleccionado: any = {};
179
-
180
- cCampoBusqueda = new FormControl('');
181
- chkLista = new DataModel();
182
- constructor(
183
- private fb: FormBuilder,
184
- public overlay: Overlay,
185
- public viewContainerRef: ViewContainerRef,
186
- protected tablaMantenimientoService: TablaMantenimientoService,
187
- private cdRef: ChangeDetectorRef
188
- ) {
189
- // this._seleccionado[this.nombreColeccion] = null;
190
- }
191
-
192
- _ctrlBusqueda: TiposControlBusqueda = '';
193
-
194
- get ctrlBusqueda() {
195
- return this._ctrlBusqueda;
196
- }
197
-
198
- @Input() set ctrlBusqueda(val: TiposControlBusqueda) {
199
- if (val == '') {
200
- val = 'simple';
201
- }
202
- this._ctrlBusqueda = val;
203
- }
204
-
205
- // @Input() leyenda;
206
- private _leyenda: { text: string, class?: string } | undefined = undefined;
207
-
208
- get leyenda(): { text: string, class?: string } | undefined {
209
- return this._leyenda;
210
- }
211
-
212
- @Input() set leyenda(val: { text: string, class?: string } | string) {
213
- if (typeof val == 'string') {
214
- this._leyenda = {text: val};
215
- }
216
- else {
217
- this._leyenda = val;
218
- }
219
- }
220
-
221
- // @Input() idTabla: string[];
222
- private _idTabla: string[] = [];
223
-
224
- get idTabla(): string[] {
225
- return this._idTabla;
226
- }
227
-
228
- @Input({required: true}) set idTabla(val: string[] | string) {
229
- if (Array.isArray(val)) {
230
- this._idTabla = val;
231
- }
232
- else {
233
- this._idTabla.push(val);
234
- }
235
- }
236
-
237
- private _columnasTabla: ColumnaTabla<any>[] = [];
238
-
239
- get columnasTabla(): ColumnaTabla<any>[] {
240
- return this._columnasTabla ?? [];
241
- }
242
-
243
- @Input() set columnasTabla(val: ColumnaTabla<any>[]) {
244
- const reemplazarConTemplate = (listaInicial: ColumnaTabla<any>[] = []) => {
245
- listaInicial.forEach((btnActual, idx) => {
246
- const btnEnTemplate = buscarEnArray(this.templateColumnasTabla, 'property', btnActual.property);
247
- if (btnEnTemplate) {
248
- listaInicial[idx] = {
249
- ...btnEnTemplate,
250
- ...btnActual
251
- };
252
- }
253
- if (listaInicial[idx].type == 'text') {
254
- if (!listaInicial[idx].text) {
255
- listaInicial[idx].text = {
256
- cssStyle: {}
257
- };
258
- }
259
- else if (!listaInicial[idx].text.cssStyle) {
260
- listaInicial[idx].text.cssStyle = {};
261
- }
262
- listaInicial[idx].text.cssStyle = {...listaInicial[idx].text.cssStyle};
263
- }
264
- else if (listaInicial[idx].type == 'estado') {
265
- const mutar: ColumnaIcons<any> = {
266
- ...listaInicial[idx],
267
- type: 'icons',
268
- iconsDef: {
269
- soloIcono: true,
270
- iconSize: '16px',
271
- items: [
272
- // {
273
- // icon: 'roundToggleOff', contentCss: 'text-gray-400',
274
- // esVisible: (row) => row['iCredDepenTareaEstado'] == 0
275
- // },
276
- // {
277
- // icon: 'roundToggleOn', contentCss: 'text-green-600',
278
- // esVisible: (row) => row['iCredDepenTareaEstado'] == 1
279
- // },
280
- ]
281
- },
282
- };
283
- if (listaInicial[idx].estados) {
284
- listaInicial[idx].estados.forEach((estado: any) => {
285
- if (Array.isArray(mutar.iconsDef.items)) {
286
- mutar.iconsDef.items.push({
287
- icon: estado.icon , contentCss: estado.cssClasses,
288
- esVisible: (row) => row[listaInicial[idx].property] == estado.estado,
289
- })
290
- }
291
- });
292
- }
293
- listaInicial[idx] = mutar;
294
- }
295
-
296
- if (btnActual.type == 'custom') {
297
-
298
- listaInicial[idx].datosExtra = {
299
- ...listaInicial[idx].datosExtra,
300
- tabla_mantenimiento_config_visibleAlias: listaInicial[idx].visible == undefined ? true : listaInicial[idx].visible,
301
- }
302
- listaInicial[idx].visible = false
303
- }
304
- });
305
- return listaInicial;
306
- };
307
- this._columnasTabla = val ? reemplazarConTemplate(val):[];
308
- }
309
-
310
- // @Input() botonesMenu: BotonMantenimiento[] = [];
311
- private _botonesMenu: SeccionesBotonesMantenimiento = {
312
- crud: undefined,
313
- principal: [],
314
- izquierda: [],
315
- derecha: [],
316
- secundario: [],
317
- inferior: [],
318
- };
319
-
320
- get botonesMenu(): SeccionesBotonesMantenimiento {
321
- return this._botonesMenu;
322
- }
323
-
324
- get botonesMenuFinal(): SeccionesBotonesMantenimiento {
325
- const nuevoBotonesMenu: SeccionesBotonesMantenimiento = this.botonesMenu;
326
-
327
- // Iteramos sobre cada sección de botones
328
- Object.keys(nuevoBotonesMenu).forEach(seccion => {
329
- nuevoBotonesMenu[seccion] = nuevoBotonesMenu[seccion]?.filter((boton: BotonMantenimiento) => {
330
- if (this.readOnly) {
331
- if (boton.subItems) {
332
- boton.subItems = boton.subItems.filter((subItem: BotonMantenimiento) => subItem.ignorarReadOnly === true);
333
- return boton.subItems.length < 1;
334
- }
335
- return boton.ignorarReadOnly === true;
336
- }
337
- return true;
338
- }); // Filtramos los botones nulos
339
- });
340
-
341
- return nuevoBotonesMenu;
342
- }
343
-
344
- @Input() set botonesMenu(val: SeccionesBotonesMantenimiento) {
345
- const reemplazarConTemplate: any = (listaInicial: BotonMantenimiento[] = []) =>
346
- listaInicial.map((btnActual: BotonMantenimiento) => {
347
- const btnEnTemplate = buscarEnArray(this.templateBotonesComunes, 'tipo', btnActual.tipoTemplate ?? btnActual.tipo);
348
- if (btnEnTemplate) {
349
- if (btnActual.tipoTemplate && !btnActual.label) {
350
- btnEnTemplate.label = undefined;
351
- }
352
- if (btnActual.subItems) {
353
- return { ...btnEnTemplate, ...btnActual, seccion: this.nombreColeccion, subItems: reemplazarConTemplate(btnActual.subItems) };
354
- }
355
- return { ...btnEnTemplate, ...btnActual, seccion: this.nombreColeccion };
356
- }
357
- return btnActual;
358
- });
359
-
360
- if (val?.crud) {
361
- this.objBotonesCRUD = this.templateBotonesComunes
362
- .filter(obj => ['nuevo', 'editar', 'eliminar'].includes(obj.tipo))
363
- .map(obj => val.crud?.find(o => o.tipo === obj.tipo) ?? obj);
364
-
365
- }
366
-
367
-
368
- Object.keys(val).forEach(btnKey => {
369
- if (val[btnKey]) {
370
- val[btnKey] = reemplazarConTemplate(val[btnKey]);
371
- }
372
- });
373
-
374
- this._botonesMenu = {...this._botonesMenu, ...val};
375
- }
376
-
377
- get listaMenuCompleto(): BotonMantenimiento[] {
378
- let menuTotal: BotonMantenimiento[] = [];
379
- menuTotal = menuTotal.concat(this.botonesMenu.izquierda ?? []);
380
- menuTotal = menuTotal.concat(this.botonesMenu.crud ?? []);
381
- menuTotal = menuTotal.concat(this.botonesMenu.principal ?? []);
382
- menuTotal = menuTotal.concat(this.botonesMenu.derecha ?? []);
383
- menuTotal = menuTotal.concat(this.botonesMenu.secundario ?? []);
384
- menuTotal = menuTotal.concat(this.botonesMenu.inferior ?? []);
385
- return menuTotal;
386
- }
387
-
388
- get objVisibleColumns() {
389
- return this.columnasTabla.filter(column => {
390
- if (column.noMostrar != undefined) {
391
- column.noMostrarEnLista = column.noMostrar;
392
- }
393
- return !tipoValorFuncion(column.noMostrarEnLista, false)
394
- }).filter(column => {
395
- // SECCION MODIFICADOR
396
- if (this.filaExtraTemplate) {
397
- column.sort = false;
398
- }
399
- // Fin SECCION MODIFICADOR
400
-
401
- column.visible = tipoValorFuncion(column.visible, true);
402
- if (!column.visible && column.esVisible != undefined) {
403
- column.visible = column.esVisible();
404
- }
405
- return column.visible;
406
- });
407
- }
408
-
409
- get visibleColumns() {
410
- return this.objVisibleColumns.map(column => column.property);
411
- }
412
-
413
- get tieneCheckbox() {
414
- return this.columnasTabla && this.columnasTabla.length > 0 && this.columnasTabla.find(col => col.type === 'checkbox') || false;
415
- }
416
-
417
- get buscarItemSeleccionado(): any {
418
- const dRet = this.dataSource.data.find(itm => this._seleccionado === this.propiedadSeleccion(itm));
419
- return dRet ?? null;
420
- }
421
-
422
- get objSeleccionado() {
423
- return this.buscarItemSeleccionado; // ?? this.objThis?.['seleccionados']?.[this.nombreColeccion];
424
- }
425
- set objSeleccionado(val: any) {
426
-
427
- // if (val) {
428
- this.seleccionarItem(val, true);
429
- // }
430
- /* if (!this.objThis) {
431
- this.objThis = {};
432
- }
433
- if (!this.objThis['seleccionados']) {
434
- this.objThis['seleccionados'] = {};
435
- }
436
- this.objThis['seleccionados'][this.nombreColeccion] = val;*/
437
- }
438
- get idsSeleccionado(): string {
439
- return <string>this.chkLista.generarLista();
440
- }
441
-
442
- idTablaValor(data: any): string {
443
- if (data) {
444
- if (this.idTabla.length < 1) {
445
- return shortHash(JSON.stringify({data, claseFinal: undefined}))
446
- }
447
- return this.idTabla.map(d => data[d]).join('-');
448
- }
449
- return '';
450
- }
451
-
452
- @Input() condicionesClaseFila = (item: any): any[] => [];
453
- @Input() rowTooltip = (item: any): string => '';
454
- @Input() soloIconos? :TipoValorFuncion<boolean> = false;
455
-
456
- ngOnInit(): void {
457
- // this.sharedService.dataRutaActual$.pipe(untilDestroyed(this)).subscribe(datRouteData => {
458
- // if (datRouteData) {
459
- // this.derechosActuales = datRouteData['derechos'];
460
- // if (!this.ignorarDerechos) {
461
- // this.ignorarDerechos = datRouteData['ignorarDerechos'] ?? false;
462
- // }
463
- // }
464
- // });
465
- this.paginacion.pageSize = this.pageSize;
466
- this.paginacion.pageSizeOptions = this.pageSizeOptions;
467
- this.actualizarCrud();
468
-
469
- this.agregarBotonesExportacion();
470
- if (this.dataSuscription) {
471
- this.dataSuscription.subscribe(res => {
472
- if (res) {
473
- if (this.objSeleccionado) {
474
- console.log('SELECCIONADO');
475
- if (this.idTabla && this.idTabla.length > 0) {
476
- console.log('ID TABLA');
477
- const arrayData = this.idTabla.map(d => this.objSeleccionado[d]);
478
- console.log(arrayData);
479
- const busqueda = buscarEnArray(res, this.idTabla, arrayData);
480
- console.log(busqueda);
481
-
482
- if (busqueda) {
483
- console.log(busqueda);
484
- this.objSeleccionado = busqueda;
485
- }
486
- }
487
- else {
488
-
489
- console.log('eLSE ID TABLA');
490
- const dataStr = res.find((itm: any) => shortHash(JSON.stringify({
491
- ...itm, claseFinal: undefined
492
- })) == shortHash(JSON.stringify({...this.objSeleccionado, claseFinal: undefined})));
493
- if (dataStr) {
494
- this.objSeleccionado = dataStr;
495
- }
496
- }
497
- }
498
- this.setData(res);
499
- }
500
- });
501
- }
502
- this.isRecargarUsed = this.accionRecargar.observed;
503
- }
504
-
505
- ngAfterContentInit() {
506
- this.componenteCargadoTotalmente = true;
507
- this.cdRef.detectChanges();
508
- this.columnDefs.forEach(columnDef => {
509
- this.table.addColumnDef(columnDef);
510
- const col = this.columnasTabla.find(col => col.property == columnDef.name);
511
- if (col && col.type == 'custom') {
512
- col.visible = col.datosExtra?.tabla_mantenimiento_config_visibleAlias ?? col.visible;
513
- delete col.datosExtra?.tabla_mantenimiento_config_visibleAlias;
514
- if (Object.keys(col.datosExtra).length < 1) {
515
- delete col.datosExtra;
516
- }
517
- }
518
- });
519
- // console.log(a);
520
- if (this.ctrlBusquedaValue) {
521
- this.cCampoBusqueda.setValue(this.ctrlBusquedaValue);
522
- }
523
- this.table.renderRows(); // 🔹 Refrescar la tabla
524
-
525
-
526
- }
527
-
528
- ngOnChanges(changes: SimpleChanges) {
529
- if (changes['botonesCRUD'] || changes['ctrlBusqueda']) {
530
- this.actualizarCrud();
531
- }
532
- if (changes['botonesMenu']) {
533
- this.agregarBotonesExportacion();
534
- }
535
- }
536
-
537
- trackByFn = (index: number, item: any): string => {
538
- return this.propiedadSeleccion(item);
539
- };
540
-
541
-
542
- agregarBotonesExportacion() {
543
- const fnAddBoton = (condicion: boolean, tipoBoton: string) => {
544
- if (condicion) {
545
- const objBoton = buscarEnArray(this.templateBotonesComunes, 'tipo', tipoBoton);
546
- const objBotonEnInferior = buscarEnArray((this.botonesMenu?.inferior ?? []), 'tipo', tipoBoton);
547
-
548
- if (!objBotonEnInferior && objBoton) {
549
- if (!this.botonesMenu.inferior) {
550
- this.botonesMenu.inferior = [];
551
- }
552
- this.botonesMenu?.inferior?.push({
553
- ...objBoton,
554
- esIndependiente: true,
555
- });
556
- }
557
- }
558
- }
559
- fnAddBoton((this.exportarExcel && this.esTabla), 'exportar_excel');
560
- }
561
-
562
- actualizarCrud() {
563
- const operacionesCRUD: Record<'C' | 'U' | 'D', string> = {
564
- 'C': 'nuevo',
565
- 'U': 'editar',
566
- 'D': 'eliminar'
567
- };
568
-
569
- const agregarBoton = (tipo: string) => {
570
- let botonComun = buscarEnArray(this.templateBotonesComunes, 'tipo', tipo);
571
- if (botonComun) {
572
- const personalizado = buscarEnArray(this.objBotonesCRUD, 'tipo', tipo);
573
- const boton = personalizado ? {...botonComun, ...personalizado}:botonComun;
574
- if (this.botonesMenu.crud) {
575
- this.botonesMenu.crud.push(boton);
576
- }
577
- }
578
- };
579
-
580
- const lstCRUD = (this.botonesMenu.crud ?? []).map(i => i.tipo);
581
-
582
- if (lstCRUD.length > 0) {
583
- for (const operacion of (this.botonesCRUD || "").toUpperCase()) {
584
- const operacionKey = operacion as 'C' | 'U' | 'D';
585
- if (lstCRUD.includes(operacion) && operacionesCRUD[operacionKey]) {
586
- agregarBoton(operacionesCRUD[operacionKey]);
587
- }
588
- }
589
- }
590
- else {
591
- this.botonesMenu.crud = [];
592
- for (const operacion of (this.botonesCRUD || "").toUpperCase()) {
593
- const operacionKey = operacion as 'C' | 'U' | 'D';
594
- if (operacionesCRUD[operacionKey]) {
595
- agregarBoton(operacionesCRUD[operacionKey]);
596
- }
597
- }
598
- }
599
-
600
- if (this.ctrlBusqueda === 'simple') {
601
- this.cCampoBusqueda.valueChanges.pipe(
602
- untilDestroyed(this),
603
- ).subscribe(value => this.onFilterChange(value ?? ''));
604
- }
605
-
606
- if (this.botonesCRUD === '-') {
607
- this.botonesMenu.crud = [];
608
- }
609
- }
610
- classFila(item: any) {
611
- let claseFinal: any[] = [];
612
- if (this.campoAnulado && (item[this.campoAnulado] == 1)) {
613
- claseFinal = claseFinal.concat(this.classAnulado);
614
- }
615
- if (this.objSeleccionado == item || this.esSeleccionActual(item)) {
616
- claseFinal = claseFinal.concat(this.classSeleccionado);
617
- }
618
- claseFinal = claseFinal.concat(this.condicionesClaseFila(item));
619
- item.claseFinal = claseFinal;
620
- return claseFinal;
621
- }
622
-
623
- procesarRowTooltip(item: any) {
624
- let txtTooptip = [];
625
- if (this.campoAnuladoMensaje && (item[this.campoAnulado] == 1)) {
626
- txtTooptip.push(item[this.campoAnuladoMensaje]);
627
- // return item[this.campoAnuladoMensaje];
628
- }
629
- if (this.rowTooltip) {
630
- txtTooptip.push(this.rowTooltip(item));
631
- }
632
- return txtTooptip.filter(itm => !!itm).join(' | ');
633
- }
634
-
635
- subItemsActivos(btn: any, item: any) {
636
- return btn.subItems.filter((sub: any) => !sub.esVisible || sub.esVisible(item)).length > 0;
637
- }
638
-
639
- get noData() {
640
- if (!this.esTabla){
641
- return of(true);
642
- }
643
- if (!this.dataSource || !this.table) {
644
- return of(true);
645
- }
646
- // @ts-ignore
647
- return this.table.dataSource?.connect().pipe(map(data => data?.length === 0));
648
- }
649
-
650
- onFilterChange(value: string) {
651
- if (!this.dataSource) {
652
- return;
653
- }
654
- value = value.trim();
655
- value = value.toLowerCase();
656
- this.dataSource.filter = value;
657
- }
658
-
659
- toggleColumnVisibility(column: any, event: any) {
660
- event.stopPropagation();
661
- event.stopImmediatePropagation();
662
- column.visible = !column.visible;
663
- }
664
-
665
- cargarData(retorno = false) {
666
-
667
- if (this.ctrlBusqueda && this.ctrlBusqueda == 'simple') {
668
- if (!retorno) {
669
- this.dataSource.paginator = this.paginator;
670
- this.dataSource.sort = this.sort;
671
- }
672
-
673
- const aS: any = this.dataSource?.data;
674
-
675
- if (
676
- (!aS || !aS[0] || !aS[0]['iTotalRegistros'])
677
- ) {
678
- return false;
679
- }
680
- }
681
- const dPag: any = {
682
- iPaginacion: 1,
683
- iPageSize: this.paginator?.pageSize ? this.paginator?.pageSize:this.paginacion.pageCurrent?.pageSize,
684
- iPageNumber: (this.paginator?.pageIndex ? this.paginator?.pageIndex:0) + 1,
685
- };
686
- if (this.ctrlBusqueda && this.ctrlBusqueda == 'query') {
687
- dPag['cCampoBusqueda'] = this.cCampoBusqueda.value;
688
- }
689
- if (retorno) {
690
- return dPag;
691
- }
692
- this.resultados.emit(dPag);
693
- this.opcBusqueda.emit(dPag);
694
- }
695
-
696
- // FIN FILTRO BUSQUEDA INTEGRAR
697
-
698
- setData(data: any) {
699
- this.dataSource = new MatTableDataSource(data);
700
- this.dataSource.sortingDataAccessor = (item: any, property) => {
701
- const dColumn: ColumnaTabla<any> | null = buscarEnArray(this.columnasTabla, 'property', property);
702
- if (dColumn) {
703
- switch (dColumn.sortType ?? dColumn.type) {
704
- case 'number':
705
- return item[property] * 1;
706
- case 'date':
707
- return formatearFecha(item[property]);
708
- }
709
- }
710
- if (item) {
711
- switch (property) {
712
- case 'fromDate':
713
- return new Date(item['fromDate']);
714
- default:
715
- return item[property];
716
- }
717
- }
718
- };
719
- // this.paginator.length = (data && data[0] && data[0]['iTotalRegistros']) ? data[0]['iTotalRegistros'] : data.length;
720
- // this.dataSource.paginator = this.paginator;
721
- if (this.sort) {
722
- this.dataSource.sort = this.sort;
723
- }
724
- // this.dataSource.filter = this.filter;
725
- this.dataSourceChange.emit(this.dataSource);
726
- // this.dataSource.paginator.pageSize = this.paginacion.pageSize;
727
- if (data && data[0] && data[0]['iPageNumber']) {
728
- this.paginacion.pageIndex = (data && data[0] && data[0]['iPageNumber']) ? data[0]['iPageNumber']:0;
729
- }
730
- this.paginacion.pageLength = (data && data[0] && data[0]['iTotalRegistros']) ? data[0]['iTotalRegistros']:data.length;
731
- if (data && data[0] && !data[0]['iTotalRegistros']) {
732
- this.dataSource.paginator = this.paginator;
733
- }
734
-
735
- if (this.tieneCheckbox) {
736
- this.chkLista.agregarControles(data, this.tieneCheckbox.property, !this.tieneCheckbox.chkFieldPersistente, (this.tieneCheckbox.chkField ?? null), this.tieneCheckbox.chkFieldSeparador);
737
- }
738
- }
739
-
740
- botonDisabled(btn: BotonMantenimiento, item: any) {
741
- let disabled;
742
- if (!btn.sinCondicion) {
743
- if (btn.estaDeshabilitado) {
744
- disabled = btn.estaDeshabilitado(item, this);
745
- }
746
- else {
747
- disabled = !this.objSeleccionado;
748
- }
749
- }
750
- if (!disabled && !btn.esIndependiente && !btn.ignorarDerecho && this.derechosActuales) {
751
- // if (!this.usuarioService.esEquipoJVSoft()) {
752
- disabled = !(this.derechosActuales[btn.cDerechoCodigo ?? btn.tipo]);
753
- // }
754
- }
755
- return disabled;
756
- }
757
-
758
- propiedadSeleccion(item: any): string {
759
- return `${this.nombreColeccion}_${this.idTablaValor(item)}`;
760
- }
761
-
762
- esSeleccionActual(item: any): boolean {
763
- return this._seleccionado === this.propiedadSeleccion(item);
764
- }
765
-
766
- seleccionarItem(item?: any, forzado: boolean = false): void {
767
- const idItem = this.propiedadSeleccion(item);
768
- if (forzado) {
769
- this._seleccionado = idItem;
770
- }
771
- else {
772
- this._seleccionado = this._seleccionado === idItem ? null:idItem;
773
- }
774
- this.selectionModelChange.emit(this.objSeleccionado);
775
-
776
- /*if (!this.objThis) {
777
- this.objThis = {};
778
- }
779
- if (!this.objThis['seleccionados']) {
780
- this.objThis['seleccionados'] = {};
781
- }
782
- this.objThis['seleccionados'][this.nombreColeccion] = this._seleccionado;*/
783
- }
784
-
785
- opcMenu(item: any, objMenu: OpcionSeleccionada, modal = null, retorno = false) {
786
-
787
- // console.log(this.buscarItemSeleccionado);
788
- // console.log(objMenu);
789
- // let salir = this.readOnly;
790
- // if (salir && this.readOnly === 'permitirSeleccion' && ['ver', 'seleccionar'].includes(objMenu.tipo)) {
791
- // salir = false;
792
- // }
793
- // if (salir) {
794
- // return false;
795
- // }
796
-
797
- // console.warn(objMenu);
798
- if (objMenu.tipo == 'exportar_excel' && this.exportarExcel) {
799
- /*
800
- TableUtil.exportArrayToExcel(this.dataSource.data.map(x => {
801
- const columnasNumeros = this.objVisibleColumns.filter(column => ['money', 'number'].includes(column.type));
802
- columnasNumeros.forEach(columna => {
803
- x[columna.property] *= 1;
804
- });
805
- return x;
806
- }), 'TEST');
807
- */
808
- const dataGeneradoPorHtml = TableUtil.getWorkBook('tabla_' + this.nombreColeccion, []);
809
- const objetosExtraidos = this.dataSource.filteredData.map((objeto: any, idx) =>
810
- this.objVisibleColumns.reduce((acumulador, columna) => {
811
- // console.log(propiedad);
812
- const nColumn = (columna.labelLista ?? columna.label).toUpperCase().replace('<BR>', ' ');
813
- switch (columna.type) {
814
- case 'date':
815
- // acumulador[nColumn] = (new DatePipe('es-PE')).transform(objeto[columna.property], 'dd/MM/yyyy' /*'yyyy-MM-dd'*/);
816
- // new Date(dateString.replace(/(\d{2}:\d{2}:\d{2}):\w{2}/, '$1'));
817
- // acumulador[nColumn] = new Date(objeto[columna.property].replace(/(\d{2}:\d{2}:\d{2}):\w{2}/, '$1'));
818
- // acumulador[nColumn] = formatearFechaFormato(objeto[columna.property], 'dd/MM/yyyy');
819
- // acumulador[nColumn] = formatearFechaTimezone(objeto[columna.property]);
820
- // acumulador[nColumn] = new Date(objeto[columna.property]);
821
- let fecha = objeto[columna.property];
822
- if (objeto[columna.property]) {
823
- fecha = new Date(objeto[columna.property].replace(/(\d{2}:\d{2}:\d{2}):\w{2}/, '$1'));
824
- if (getBrowserName() == 'chrome') {
825
- fecha = moment(objeto[columna.property], true).add(2, 'minutes').toDate();
826
- }
827
- }
828
- acumulador[nColumn] = fecha;
829
- // acumulador[nColumn] = objeto[columna.property];
830
- break;
831
- case 'number':
832
- case 'money':
833
- acumulador[nColumn] = objeto[columna.property] * 1;
834
- break;
835
- default:
836
- if (columna.property == 'numeracion_automatica') {
837
- acumulador[nColumn] = idx + 1;
838
- }
839
- else {
840
- if (columna.type == 'custom') {
841
- // dataGeneradoPorHtml.sheetToJson
842
- acumulador[nColumn] = dataGeneradoPorHtml.sheetToJson[idx][columna.label];
843
- }
844
- else {
845
- if (columna.type == 'text' && columna.innerHTML) {
846
- const convertirHtmlATexto = (html: string): string => {
847
- const elementoTemporal = document.createElement('div');
848
- elementoTemporal.innerHTML = html;
849
- return elementoTemporal.textContent || "";
850
- }
851
- acumulador[nColumn] = convertirHtmlATexto(columna.innerHTML(objeto));
852
- }
853
- else if (columna.transformar) {
854
- acumulador[nColumn] = columna.transformar(objeto);
855
- }
856
- else {
857
- acumulador[nColumn] = objeto[columna.property];
858
- }
859
- }
860
- }
861
- break;
862
- }
863
- return acumulador;
864
- }, {} as Record<string, any>)
865
- );
866
-
867
- // TableUtil.exportTableToExcel('tabla_' + this.nombreColeccion);
868
- // console.log(objetosExtraidos);
869
- TableUtil.exportArrayToExcel(objetosExtraidos, this.nombreColeccion);
870
-
871
- // this.tableExporter.exportTable('xlsx', {fileName: 'JVSoftExport'});
872
- }
873
-
874
- const opAdic: any = {seccion: this.nombreColeccion};
875
- if (item) {
876
- opAdic['item'] = item;
877
- }
878
- opAdic['itemSeleccionado'] = this.objSeleccionado;
879
-
880
- if (this.tieneCheckbox) {
881
- // itmsSeleccionados = this.formulariosGlobalesService.generarLista(this.nombreColeccion);
882
- opAdic['idsSeleccionados'] = this.idsSeleccionado;
883
- }
884
- // opAdic['refTabla'] = this;
885
- objMenu = {...objMenu, ...opAdic};
886
- if (retorno) {
887
- return objMenu;
888
- }
889
- // console.warn(objMenu);
890
- this.opcionSelecionada.emit(objMenu);
891
- return 1;
892
- }
893
-
894
- emitirResultados(evento = {}) {
895
- this.opcFiltroActual = {...this.opcFiltroActual, ...evento, ...this.cargarData(true)};
896
- // console.warn('resultadosFILTRO', this.opcFiltroActual);
897
- this.resultados.emit(this.opcFiltroActual);
898
- }
899
- abrirMenuContextual({x, y}: MouseEvent, user: any) {
900
- // console.log(user);
901
- // this.opcMenu(user, {tipo: 'ver'});
902
- this.objSeleccionado = user;
903
- this.cerrarMenuContextual();
904
- const positionStrategy = this.overlay.position().flexibleConnectedTo({x, y}).withPositions([
905
- {
906
- originX: 'end',
907
- originY: 'bottom',
908
- overlayX: 'end',
909
- overlayY: 'top',
910
- },
911
- ]);
912
-
913
- this.overlayRef = this.overlay.create({
914
- positionStrategy,
915
- scrollStrategy: this.overlay.scrollStrategies.close(),
916
- });
917
-
918
- this.overlayRef.attach(new TemplatePortal(this.userMenu, this.viewContainerRef, {
919
- // $implicit: user
920
- item: user,
921
- }));
922
-
923
- this.mouseEvent$ = fromEvent<MouseEvent>(document, 'click').pipe(
924
- filter(event => {
925
- const clickTarget = event.target as HTMLElement;
926
- return !!this.overlayRef && !this.overlayRef.overlayElement.contains(clickTarget);
927
- }),
928
- take(1),
929
- ).subscribe(() => this.cerrarMenuContextual());
930
-
931
- }
932
-
933
- cerrarMenuContextual() {
934
- this.mouseEvent$ && this.mouseEvent$.unsubscribe();
935
- if (this.overlayRef) {
936
- this.overlayRef.dispose();
937
- this.overlayRef = undefined;
938
- }
939
- }
940
-
941
- emitirAccionRecargar() {
942
- if (!this.idTabla) {
943
- this.objSeleccionado = null;
944
- }
945
- this.accionRecargar.emit(this.opcFiltroActual);
946
- // this.accionRecargar.emit({ ...this.opcFiltroActual, ...{seleccionado: this.objSeleccionado}});
947
- }
948
-
949
- protected readonly tipoValorFuncion = tipoValorFuncion;
950
- }
951
-