ngx-redi-core 0.0.0-watch
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.
- package/Helper/index.d.ts +5 -0
- package/Helper/package.json +3 -0
- package/Helper/public-api.d.ts +3 -0
- package/Helper/src/helpers/bag-data-subject.service.d.ts +43 -0
- package/Helper/src/helpers/csv.service.d.ts +33 -0
- package/Helper/src/helpers/data-subject.service.d.ts +32 -0
- package/Helper/src/models/interfaces/data-subject.interface.d.ts +6 -0
- package/README.md +24 -0
- package/RediDragDrop/index.d.ts +5 -0
- package/RediDragDrop/package.json +3 -0
- package/RediDragDrop/public-api.d.ts +4 -0
- package/RediDragDrop/src/models/classes/proceso-archivo-csv.d.ts +29 -0
- package/RediDragDrop/src/models/directives/drag-drop.directive.d.ts +43 -0
- package/RediDragDrop/src/modules/redi-drag-drop/redi-drag-drop.component.d.ts +188 -0
- package/RediDragDrop/src/modules/redi-drag-drop.module.d.ts +13 -0
- package/RediGrid/index.d.ts +5 -0
- package/RediGrid/package.json +3 -0
- package/RediGrid/public-api.d.ts +4 -0
- package/RediGrid/src/models/interfaces/cell.d.ts +37 -0
- package/RediGrid/src/models/interfaces/data-grid.d.ts +30 -0
- package/RediGrid/src/modules/redi-grid/redi-grid.component.d.ts +92 -0
- package/RediGrid/src/modules/redi-grid.module.d.ts +14 -0
- package/RediTable/index.d.ts +5 -0
- package/RediTable/package.json +3 -0
- package/RediTable/public-api.d.ts +6 -0
- package/RediTable/src/components/filter-data/filter-data.component.d.ts +23 -0
- package/RediTable/src/components/redi-table/redi-table.component.d.ts +139 -0
- package/RediTable/src/models/interfaces/column-definition.d.ts +18 -0
- package/RediTable/src/models/interfaces/data-table.d.ts +24 -0
- package/RediTable/src/models/interfaces/filter-item.d.ts +5 -0
- package/RediTable/src/models/interfaces/row-action.d.ts +24 -0
- package/RediTable/src/models/types/event-table.type.d.ts +5 -0
- package/Security/index.d.ts +5 -0
- package/Security/package.json +3 -0
- package/Security/public-api.d.ts +6 -0
- package/Security/src/modules/security-web-intercept/interceptors/redi-secure.interceptor.d.ts +39 -0
- package/Security/src/modules/security-web-intercept/models/secure-factory.model.d.ts +10 -0
- package/Security/src/modules/security-web-intercept/services/cifrado-basico.service.d.ts +14 -0
- package/Security/src/modules/security-web-intercept/services/cifrado.service.d.ts +21 -0
- package/Security/src/modules/security-web-intercept/services/reflection.service.d.ts +58 -0
- package/Security/src/modules/security.module.d.ts +11 -0
- package/esm2022/Helper/ngx-redi-core-Helper.mjs +5 -0
- package/esm2022/Helper/public-api.mjs +4 -0
- package/esm2022/Helper/src/helpers/bag-data-subject.service.mjs +61 -0
- package/esm2022/Helper/src/helpers/csv.service.mjs +69 -0
- package/esm2022/Helper/src/helpers/data-subject.service.mjs +34 -0
- package/esm2022/Helper/src/models/interfaces/data-subject.interface.mjs +2 -0
- package/esm2022/RediDragDrop/ngx-redi-core-RediDragDrop.mjs +5 -0
- package/esm2022/RediDragDrop/public-api.mjs +5 -0
- package/esm2022/RediDragDrop/src/models/classes/proceso-archivo-csv.mjs +132 -0
- package/esm2022/RediDragDrop/src/models/directives/drag-drop.directive.mjs +95 -0
- package/esm2022/RediDragDrop/src/modules/redi-drag-drop/redi-drag-drop.component.mjs +369 -0
- package/esm2022/RediDragDrop/src/modules/redi-drag-drop.module.mjs +34 -0
- package/esm2022/RediGrid/ngx-redi-core-RediGrid.mjs +5 -0
- package/esm2022/RediGrid/public-api.mjs +5 -0
- package/esm2022/RediGrid/src/models/interfaces/cell.mjs +2 -0
- package/esm2022/RediGrid/src/models/interfaces/data-grid.mjs +2 -0
- package/esm2022/RediGrid/src/modules/redi-grid/redi-grid.component.mjs +159 -0
- package/esm2022/RediGrid/src/modules/redi-grid.module.mjs +34 -0
- package/esm2022/RediTable/ngx-redi-core-RediTable.mjs +5 -0
- package/esm2022/RediTable/public-api.mjs +9 -0
- package/esm2022/RediTable/src/components/filter-data/filter-data.component.mjs +84 -0
- package/esm2022/RediTable/src/components/redi-table/redi-table.component.mjs +404 -0
- package/esm2022/RediTable/src/models/interfaces/column-definition.mjs +2 -0
- package/esm2022/RediTable/src/models/interfaces/data-table.mjs +2 -0
- package/esm2022/RediTable/src/models/interfaces/filter-item.mjs +2 -0
- package/esm2022/RediTable/src/models/interfaces/row-action.mjs +2 -0
- package/esm2022/RediTable/src/models/types/event-table.type.mjs +2 -0
- package/esm2022/Security/ngx-redi-core-Security.mjs +5 -0
- package/esm2022/Security/public-api.mjs +7 -0
- package/esm2022/Security/src/modules/security-web-intercept/interceptors/redi-secure.interceptor.mjs +88 -0
- package/esm2022/Security/src/modules/security-web-intercept/models/secure-factory.model.mjs +27 -0
- package/esm2022/Security/src/modules/security-web-intercept/services/cifrado-basico.service.mjs +51 -0
- package/esm2022/Security/src/modules/security-web-intercept/services/cifrado.service.mjs +33 -0
- package/esm2022/Security/src/modules/security-web-intercept/services/reflection.service.mjs +122 -0
- package/esm2022/Security/src/modules/security.module.mjs +23 -0
- package/esm2022/ngx-redi-core.mjs +5 -0
- package/esm2022/public-api.mjs +8 -0
- package/fesm2022/ngx-redi-core-Helper.mjs +166 -0
- package/fesm2022/ngx-redi-core-Helper.mjs.map +1 -0
- package/fesm2022/ngx-redi-core-RediDragDrop.mjs +628 -0
- package/fesm2022/ngx-redi-core-RediDragDrop.mjs.map +1 -0
- package/fesm2022/ngx-redi-core-RediGrid.mjs +196 -0
- package/fesm2022/ngx-redi-core-RediGrid.mjs.map +1 -0
- package/fesm2022/ngx-redi-core-RediTable.mjs +496 -0
- package/fesm2022/ngx-redi-core-RediTable.mjs.map +1 -0
- package/fesm2022/ngx-redi-core-Security.mjs +339 -0
- package/fesm2022/ngx-redi-core-Security.mjs.map +1 -0
- package/fesm2022/ngx-redi-core.mjs +14 -0
- package/fesm2022/ngx-redi-core.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/package.json +57 -0
- package/public-api.d.ts +4 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Component, Input, ViewChild, Output } from '@angular/core';
|
|
3
|
+
import * as i6 from '@angular/material/paginator';
|
|
4
|
+
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
|
5
|
+
import * as i7 from '@angular/material/sort';
|
|
6
|
+
import { MatSort, MatSortModule } from '@angular/material/sort';
|
|
7
|
+
import * as i4 from '@angular/material/table';
|
|
8
|
+
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
|
9
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
10
|
+
import * as i2$1 from '@angular/common';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import * as i3$1 from '@angular/material/icon';
|
|
13
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
14
|
+
import * as i5 from '@angular/material/checkbox';
|
|
15
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
16
|
+
import * as i10 from '@angular/material/button';
|
|
17
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
18
|
+
import * as i8 from '@angular/material/menu';
|
|
19
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
20
|
+
import * as i9 from '@angular/material/divider';
|
|
21
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
22
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
23
|
+
import { FormsModule } from '@angular/forms';
|
|
24
|
+
import * as i1 from '@angular/material/form-field';
|
|
25
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
26
|
+
import * as i2 from '@angular/material/input';
|
|
27
|
+
import { MatInputModule } from '@angular/material/input';
|
|
28
|
+
import * as i3 from '@angular/material/list';
|
|
29
|
+
import { MatListModule } from '@angular/material/list';
|
|
30
|
+
import * as i1$1 from 'ngx-redi-core/Helper';
|
|
31
|
+
|
|
32
|
+
class FilterDataComponent {
|
|
33
|
+
set filtrosColumnas(value) {
|
|
34
|
+
if (value) {
|
|
35
|
+
this._refFiltro = value;
|
|
36
|
+
this.filtros = [...value.map(f => { return { ...f }; })];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
constructor() {
|
|
40
|
+
this.filterEnd = new EventEmitter();
|
|
41
|
+
this._refFiltro = [];
|
|
42
|
+
this.filtros = [];
|
|
43
|
+
}
|
|
44
|
+
ngAfterViewInit() {
|
|
45
|
+
if (this.allItemControl) {
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
this.allItemControl.selected = this.isAllChecked(this.filtros);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
selectedChange() {
|
|
52
|
+
if (this.allItemControl) {
|
|
53
|
+
this.allItemControl.selected = this.isAllChecked(this.filtros);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
setAllCheck(value) {
|
|
57
|
+
this.filtros.map(f => f.isSelected = value);
|
|
58
|
+
}
|
|
59
|
+
isAllChecked(filters) {
|
|
60
|
+
return filters.every(f => f.isSelected);
|
|
61
|
+
}
|
|
62
|
+
changeFilter() {
|
|
63
|
+
if (this.control) {
|
|
64
|
+
let value = this.control.nativeElement.value ?? '';
|
|
65
|
+
this.filtros.map(f => f.isVisible = value === '' ||
|
|
66
|
+
f.name.trim().toLowerCase().indexOf(value.trim().toLowerCase()) !== -1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
aplicarFiltros() {
|
|
70
|
+
this._refFiltro.map((d, i) => { this._refFiltro[i].isSelected = this.filtros[i].isSelected; });
|
|
71
|
+
this.filterEnd.emit(true);
|
|
72
|
+
}
|
|
73
|
+
cancelarFiltro() {
|
|
74
|
+
this.filterEnd.emit();
|
|
75
|
+
}
|
|
76
|
+
loadData() {
|
|
77
|
+
this.control.nativeElement.value = '';
|
|
78
|
+
this._refFiltro.map((d, i) => {
|
|
79
|
+
this.filtros[i].isSelected = this._refFiltro[i].isSelected;
|
|
80
|
+
d.isVisible = true;
|
|
81
|
+
this.filtros[i].isVisible = true;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FilterDataComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
85
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: FilterDataComponent, isStandalone: true, selector: "filter-data", inputs: { filtrosColumnas: "filtrosColumnas" }, outputs: { filterEnd: "filterEnd" }, viewQueries: [{ propertyName: "allItemControl", first: true, predicate: ["mainControl"], descendants: true }, { propertyName: "control", first: true, predicate: ["textFilter"], descendants: true }], ngImport: i0, template: "<mat-label>Filtro</mat-label>\r\n<div>\r\n <input #textFilter class=\"inputFilter\" (keyup)=\"changeFilter()\" type=\"text\" placeholder=\"Buscar\" aria-label=\"Filtro\"\r\n matInput>\r\n</div>\r\n<mat-selection-list #elementos>\r\n <mat-list-option #mainControl (click)=\"setAllCheck(mainControl.selected)\"\r\n [disabled]=\"textFilter.value !== ''\">(Seleccionar todo)</mat-list-option>\r\n @for (filtro of filtros; track filtro) {\r\n @if(filtro.isVisible){\r\n <mat-list-option [(selected)]=\"filtro.isSelected\"\r\n (selectedChange)=\"selectedChange()\">{{filtro.name}}</mat-list-option>\r\n }\r\n }\r\n</mat-selection-list>\r\n<button mat-flat-button color=\"primary\" (click)=\"aplicarFiltros()\">Aceptar</button>\r\n<button mat-flat-button color=\"accent\" (click)=\"cancelarFiltro()\">Cancelar</button>", styles: ["mat-selection-list{max-height:40vh;height:20vh;overflow-y:scroll;border:solid 1px gray;margin-top:10px;margin-bottom:10px;background-color:#fff}input,mat-label{width:90%;margin-left:5px}:host{padding:5px}button{float:right;margin-right:5px}mat-list-option{max-height:35px}\n"], dependencies: [{ kind: "ngmodule", type: MatFormFieldModule }, { kind: "directive", type: i1.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatListModule }, { kind: "component", type: i3.MatSelectionList, selector: "mat-selection-list", inputs: ["color", "compareWith", "multiple", "hideSingleSelectionIndicator", "disabled"], outputs: ["selectionChange"], exportAs: ["matSelectionList"] }, { kind: "component", type: i3.MatListOption, selector: "mat-list-option", inputs: ["togglePosition", "checkboxPosition", "color", "value", "selected"], outputs: ["selectedChange"], exportAs: ["matListOption"] }] }); }
|
|
86
|
+
}
|
|
87
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: FilterDataComponent, decorators: [{
|
|
88
|
+
type: Component,
|
|
89
|
+
args: [{ selector: 'filter-data', standalone: true, imports: [
|
|
90
|
+
MatFormFieldModule,
|
|
91
|
+
FormsModule,
|
|
92
|
+
MatInputModule,
|
|
93
|
+
MatListModule
|
|
94
|
+
], template: "<mat-label>Filtro</mat-label>\r\n<div>\r\n <input #textFilter class=\"inputFilter\" (keyup)=\"changeFilter()\" type=\"text\" placeholder=\"Buscar\" aria-label=\"Filtro\"\r\n matInput>\r\n</div>\r\n<mat-selection-list #elementos>\r\n <mat-list-option #mainControl (click)=\"setAllCheck(mainControl.selected)\"\r\n [disabled]=\"textFilter.value !== ''\">(Seleccionar todo)</mat-list-option>\r\n @for (filtro of filtros; track filtro) {\r\n @if(filtro.isVisible){\r\n <mat-list-option [(selected)]=\"filtro.isSelected\"\r\n (selectedChange)=\"selectedChange()\">{{filtro.name}}</mat-list-option>\r\n }\r\n }\r\n</mat-selection-list>\r\n<button mat-flat-button color=\"primary\" (click)=\"aplicarFiltros()\">Aceptar</button>\r\n<button mat-flat-button color=\"accent\" (click)=\"cancelarFiltro()\">Cancelar</button>", styles: ["mat-selection-list{max-height:40vh;height:20vh;overflow-y:scroll;border:solid 1px gray;margin-top:10px;margin-bottom:10px;background-color:#fff}input,mat-label{width:90%;margin-left:5px}:host{padding:5px}button{float:right;margin-right:5px}mat-list-option{max-height:35px}\n"] }]
|
|
95
|
+
}], ctorParameters: () => [], propDecorators: { filtrosColumnas: [{
|
|
96
|
+
type: Input
|
|
97
|
+
}], allItemControl: [{
|
|
98
|
+
type: ViewChild,
|
|
99
|
+
args: ['mainControl']
|
|
100
|
+
}], filterEnd: [{
|
|
101
|
+
type: Output
|
|
102
|
+
}], control: [{
|
|
103
|
+
type: ViewChild,
|
|
104
|
+
args: ['textFilter']
|
|
105
|
+
}] } });
|
|
106
|
+
|
|
107
|
+
/** Librerías angular */
|
|
108
|
+
/**
|
|
109
|
+
* Componente que muestra los datos en una tabla
|
|
110
|
+
* @decorators ´@Component´
|
|
111
|
+
*/
|
|
112
|
+
class RediTableComponent {
|
|
113
|
+
/**
|
|
114
|
+
* Datos y configuración de la tabla
|
|
115
|
+
*/
|
|
116
|
+
set dataTable(data) {
|
|
117
|
+
if (this.internalTable !== data) {
|
|
118
|
+
this.internalTable = data;
|
|
119
|
+
this.actualizarTabla();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
;
|
|
123
|
+
get dataTable() {
|
|
124
|
+
return this.internalTable;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Crea un nuevo componente Tabla
|
|
128
|
+
*/
|
|
129
|
+
constructor(csv) {
|
|
130
|
+
this.csv = csv;
|
|
131
|
+
/**
|
|
132
|
+
* Propiedad que indica si se pueden seleccionar las filas
|
|
133
|
+
*/
|
|
134
|
+
this.seleccionarFilas = true;
|
|
135
|
+
/**
|
|
136
|
+
* Propiedad que indica si se habilitan los filtros para la tabla
|
|
137
|
+
*/
|
|
138
|
+
this.filtrarDatos = true;
|
|
139
|
+
/**
|
|
140
|
+
* Propiedad que indica si se paginan los datos
|
|
141
|
+
*/
|
|
142
|
+
this.paginar = true;
|
|
143
|
+
/**
|
|
144
|
+
* Propiedad que indica si se habilita el ordenamiento de datos
|
|
145
|
+
*/
|
|
146
|
+
this.ordenarDatos = true;
|
|
147
|
+
/**
|
|
148
|
+
* Contiene las columnas que se mostraran en la tabla
|
|
149
|
+
*/
|
|
150
|
+
this.columnas = [];
|
|
151
|
+
/**
|
|
152
|
+
* Contiene los datos de las columnas
|
|
153
|
+
*/
|
|
154
|
+
this.datosColumna = [];
|
|
155
|
+
this.onRowClick = new EventEmitter();
|
|
156
|
+
this.internalTable = {
|
|
157
|
+
dataSource: [],
|
|
158
|
+
acciones: [],
|
|
159
|
+
};
|
|
160
|
+
this.dataSource = new MatTableDataSource();
|
|
161
|
+
this.dataSource.data = [];
|
|
162
|
+
}
|
|
163
|
+
closeMenu(header) {
|
|
164
|
+
if (this.componenteFiltro) {
|
|
165
|
+
this.componenteFiltro.loadData();
|
|
166
|
+
}
|
|
167
|
+
if (header) {
|
|
168
|
+
header.classList.remove('headerHover');
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
openMenu(header) {
|
|
172
|
+
if (header) {
|
|
173
|
+
header.classList.add('headerHover');
|
|
174
|
+
this.componenteFiltro.changeFilter();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Eventos que se ejecutan al iniciar
|
|
179
|
+
*/
|
|
180
|
+
actualizarTabla() {
|
|
181
|
+
this.limpiarColumnas();
|
|
182
|
+
if (this.dataTable) {
|
|
183
|
+
this.dataSource = new MatTableDataSource(this.dataTable.dataSource);
|
|
184
|
+
this.construirDatosColumna();
|
|
185
|
+
this.mostrarColumnas();
|
|
186
|
+
this.dataSource.filterPredicate = (f, u) => { return this.customParameter(f, u); };
|
|
187
|
+
}
|
|
188
|
+
this.inicializarPaginador();
|
|
189
|
+
this.reasignarPaginacion();
|
|
190
|
+
this.changeSelection(this.seleccionarFilas);
|
|
191
|
+
this.dataTable.acciones = this.dataTable.acciones ?? [];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Construye los datos de las columnas para la tabla
|
|
195
|
+
*/
|
|
196
|
+
construirDatosColumna() {
|
|
197
|
+
if (this.dataTable.columnas &&
|
|
198
|
+
this.dataTable.columnas.length > 0) {
|
|
199
|
+
this.datosColumna.push(...this.dataTable.columnas);
|
|
200
|
+
this.generateFilterData(this.datosColumna);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
if (this.dataTable?.dataSource && this.dataTable.dataSource.length) {
|
|
204
|
+
this.datosColumna.push(...Object.keys(this.dataTable.dataSource[0])
|
|
205
|
+
.map(x => {
|
|
206
|
+
return {
|
|
207
|
+
identificador: x,
|
|
208
|
+
etiqueta: x,
|
|
209
|
+
filters: [],
|
|
210
|
+
isSort: false,
|
|
211
|
+
haveFilters: false,
|
|
212
|
+
sortDirection: ''
|
|
213
|
+
};
|
|
214
|
+
}));
|
|
215
|
+
this.generateFilterData(this.datosColumna);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
generateFilterData(columnas) {
|
|
220
|
+
let result = {};
|
|
221
|
+
let keys = Object.keys(this.dataSource.data[0]);
|
|
222
|
+
this.dataSource.filteredData.map((d) => {
|
|
223
|
+
keys.map((k) => {
|
|
224
|
+
let prop = Object.getOwnPropertyDescriptor(result, k)?.value ?? [];
|
|
225
|
+
let value = Object.getOwnPropertyDescriptor(d, k)?.value;
|
|
226
|
+
if (value && !prop.find(i => i.name == value)) {
|
|
227
|
+
prop.push({ name: value, isSelected: true, isVisible: true });
|
|
228
|
+
}
|
|
229
|
+
Object.defineProperty(result, k, { value: prop });
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
columnas.map(c => {
|
|
233
|
+
c.filters = Object.getOwnPropertyDescriptor(result, c.identificador)?.value;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Activa las columnas que se van a mostrar
|
|
238
|
+
*/
|
|
239
|
+
mostrarColumnas() {
|
|
240
|
+
this.columnas.push(...this.datosColumna
|
|
241
|
+
.map(item => { return item.identificador; }));
|
|
242
|
+
if (this.dataTable?.acciones && this.verAcciones()) {
|
|
243
|
+
this.columnas.push('actions');
|
|
244
|
+
}
|
|
245
|
+
this.dataSource.sort = this.sort;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Método que ejecuta los cambios en la selección de filas
|
|
249
|
+
* @param currentValue - Valor actual
|
|
250
|
+
*/
|
|
251
|
+
changeSelection(currentValue) {
|
|
252
|
+
if (currentValue) {
|
|
253
|
+
this.columnas.unshift('select');
|
|
254
|
+
this.dataTable.seleccion = this.dataTable.seleccion ?? new SelectionModel(true, []);
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
const index = this.columnas.indexOf('select');
|
|
258
|
+
if (index > -1) {
|
|
259
|
+
this.columnas.splice(index, 1);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Método que valida los cambios en los datos de entrada
|
|
265
|
+
* @param changer - Cambios realizados en la vista
|
|
266
|
+
*/
|
|
267
|
+
ngOnChanges(changes) {
|
|
268
|
+
this.actualizarSeleccion(changes);
|
|
269
|
+
this.actualizarFiltro(changes);
|
|
270
|
+
this.actualizarPaginacion(changes);
|
|
271
|
+
}
|
|
272
|
+
actualizarSeleccion(cambios) {
|
|
273
|
+
const changeSelectedRow = cambios['seleccionarFilas'];
|
|
274
|
+
if (changeSelectedRow && this.dataTable) {
|
|
275
|
+
this.changeSelection(changeSelectedRow.currentValue);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
actualizarFiltro(cambios) {
|
|
279
|
+
const changeFilter = cambios['filtrarDatos'];
|
|
280
|
+
if (changeFilter && !changeFilter.currentValue) {
|
|
281
|
+
this.dataSource.filter = '';
|
|
282
|
+
this.reasignarPaginacion();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
reasignarPaginacion() {
|
|
286
|
+
if (this.paginar) {
|
|
287
|
+
this.dataSource.paginator = this.paginator;
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
this.dataSource.paginator = null;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
actualizarPaginacion(cambios) {
|
|
294
|
+
const changePagination = cambios['paginar'];
|
|
295
|
+
if (changePagination) {
|
|
296
|
+
if (changePagination.currentValue) {
|
|
297
|
+
this.dataSource.paginator = this.paginator;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
this.dataSource.paginator = null;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Método que aplica el filtro a los datos de la tabla
|
|
306
|
+
* @param filtro - Evento de filtrado
|
|
307
|
+
*/
|
|
308
|
+
applyFilter(filtro) {
|
|
309
|
+
this.dataSource.filter = filtro === '' ? `$omit_${Date.now().toString()}` : filtro.trim().toLowerCase();
|
|
310
|
+
if (this.dataSource.paginator) {
|
|
311
|
+
this.dataSource.paginator.firstPage();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
limpiarColumnas() {
|
|
315
|
+
this.datosColumna.splice(0);
|
|
316
|
+
this.columnas.splice(0);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Método que indica si se debe mostrar la columna de acciones
|
|
320
|
+
* @returns True si se debe mostrar las acciones
|
|
321
|
+
*/
|
|
322
|
+
verAcciones() {
|
|
323
|
+
return this.dataTable && this.dataTable.acciones && this.dataTable.acciones.length > 0;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Método que inicializa el Paginador
|
|
327
|
+
*/
|
|
328
|
+
inicializarPaginador() {
|
|
329
|
+
if (this.paginator) {
|
|
330
|
+
this.paginator._intl.itemsPerPageLabel = 'Elementos por pagina';
|
|
331
|
+
this.paginator._intl.firstPageLabel = 'Primera pagina';
|
|
332
|
+
this.paginator._intl.itemsPerPageLabel = 'Elementos por pagina';
|
|
333
|
+
this.paginator._intl.lastPageLabel = 'Ultima pagina';
|
|
334
|
+
this.paginator._intl.nextPageLabel = 'Siguiente pagina';
|
|
335
|
+
this.paginator._intl.previousPageLabel = 'Pagina anterior';
|
|
336
|
+
this.paginator._intl.getRangeLabel = (page, pageSize, length) => {
|
|
337
|
+
return `Pagina:${page + 1} de ${pageSize <= length ? Math.ceil(length / pageSize) : 1}`;
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Indica si el ordenamiento esta activo
|
|
343
|
+
*/
|
|
344
|
+
ordenamientoActivo() {
|
|
345
|
+
if (!this.ordenarDatos && this.sort) {
|
|
346
|
+
this.sort.direction = '';
|
|
347
|
+
}
|
|
348
|
+
return this.ordenarDatos;
|
|
349
|
+
}
|
|
350
|
+
asignarOrden(column, orden) {
|
|
351
|
+
if (this.sort) {
|
|
352
|
+
this.datosColumna.map(d => d.isSort = false);
|
|
353
|
+
column.isSort = true;
|
|
354
|
+
column.sortDirection = orden;
|
|
355
|
+
this.sort.active = column.identificador;
|
|
356
|
+
this.sort.direction = orden;
|
|
357
|
+
this.dataSource.sort = this.sort;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/** Alterna la selección de registros de la tabla */
|
|
361
|
+
alternarSeleccion() {
|
|
362
|
+
if (this.todoSeleccionado()) {
|
|
363
|
+
this.dataTable.seleccion.clear();
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
this.dataTable.seleccion.select(...this.dataSource.data);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Indica si todo el contenido esta seleccionado
|
|
370
|
+
* @returns True si todo el contenido esta seleccionado
|
|
371
|
+
*/
|
|
372
|
+
todoSeleccionado() {
|
|
373
|
+
const numSelected = this.dataTable.seleccion.selected.length;
|
|
374
|
+
const numRows = this.dataSource.data.length;
|
|
375
|
+
return numSelected === numRows;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Obtiene el estado de la etiqueta de seleccionado
|
|
379
|
+
* @param fila - Fila que se validara
|
|
380
|
+
* @returns Estado de selección en modo texto
|
|
381
|
+
*/
|
|
382
|
+
validarEtiqueta(fila) {
|
|
383
|
+
if (!fila) {
|
|
384
|
+
return `${this.todoSeleccionado() ? 'deselect' : 'select'} all`;
|
|
385
|
+
}
|
|
386
|
+
return `${this.dataTable.seleccion.isSelected(fila) ? 'deselect' : 'select'} row ${Number(fila.position) + 1}`;
|
|
387
|
+
}
|
|
388
|
+
descargarCsv(archivo, soloSeleccionados) {
|
|
389
|
+
if (!soloSeleccionados) {
|
|
390
|
+
this.csv.descargarCsv(archivo, this.dataTable.dataSource);
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
this.csv.descargarCsv(archivo, this.dataTable.seleccion.selected);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
onRowSelect(event) {
|
|
397
|
+
this.onRowClick.emit(event);
|
|
398
|
+
}
|
|
399
|
+
deshabilitarAccion(action, element) {
|
|
400
|
+
if (action.deshabilitar) {
|
|
401
|
+
return action.deshabilitar;
|
|
402
|
+
}
|
|
403
|
+
else if (action.desabilitarActionPorValores) {
|
|
404
|
+
const valor = element[action.desabilitarActionPorValores.columnaRef];
|
|
405
|
+
const valores = action.desabilitarActionPorValores.valoresADeshabilitar;
|
|
406
|
+
if (valores.length === 0) {
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
return valores.some(value => value === valor);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
stopPropagation(clickEvent) {
|
|
416
|
+
clickEvent.stopPropagation();
|
|
417
|
+
clickEvent.preventDefault();
|
|
418
|
+
}
|
|
419
|
+
cambioFiltro(menu, isChange, columna) {
|
|
420
|
+
menu.closeMenu();
|
|
421
|
+
if (isChange) {
|
|
422
|
+
this.dataSource.filter = `$omit_${Date.now().toString()}`;
|
|
423
|
+
columna.haveFilters = columna.filters.some(f => !f.isSelected);
|
|
424
|
+
if (this.inputFiltro) {
|
|
425
|
+
this.inputFiltro.nativeElement.value = '';
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
customParameter(data, filter) {
|
|
430
|
+
return this.datosColumna.every(dc => {
|
|
431
|
+
let value = (Object.getOwnPropertyDescriptor(data, dc.identificador)?.value?.toString() ?? '').trim().toLowerCase();
|
|
432
|
+
let isAllSelected = dc.filters.every(f => f.isSelected);
|
|
433
|
+
if (!isAllSelected) {
|
|
434
|
+
return dc.filters.filter(f => f.isSelected).some(f => value.indexOf(f.name.toLowerCase()) !== -1);
|
|
435
|
+
}
|
|
436
|
+
return true;
|
|
437
|
+
}) && this.datosColumna.some(dc => {
|
|
438
|
+
let value = (Object.getOwnPropertyDescriptor(data, dc.identificador)?.value?.toString() ?? '').trim().toLowerCase();
|
|
439
|
+
return value.indexOf(filter) != -1 || filter.startsWith('$omit_');
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RediTableComponent, deps: [{ token: i1$1.CsvService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
443
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.0.4", type: RediTableComponent, isStandalone: true, selector: "redi-table", inputs: { seleccionarFilas: "seleccionarFilas", filtrarDatos: "filtrarDatos", paginar: "paginar", ordenarDatos: "ordenarDatos", dataTable: "dataTable" }, outputs: { onRowClick: "onRowClick" }, viewQueries: [{ propertyName: "sort", first: true, predicate: MatSort, descendants: true }, { propertyName: "paginator", first: true, predicate: MatPaginator, descendants: true }, { propertyName: "componenteFiltro", first: true, predicate: ["filtro"], descendants: true }, { propertyName: "inputFiltro", first: true, predicate: ["filtroInput"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<!-- Contenedor principal del componente -->\r\n<div class=\"container\">\r\n <!-- Filtro de datos para la tabla -->\r\n <div *ngIf=\"filtrarDatos\">\r\n <mat-icon class=\"icon\"> search </mat-icon>\r\n <input #filtroInput placeholder=\"Buscar\" (keyup)=\"applyFilter(filtroInput.value)\" />\r\n </div>\r\n <!-- Tabla de datos -->\r\n <div class=\"section\">\r\n <table mat-table [dataSource]=\"dataSource\" matSort>\r\n <caption> RediTableComponent </caption>\r\n <!-- Contenedor de selecci\u00F3n -->\r\n <ng-container *ngIf=\"seleccionarFilas\" matColumnDef=\"select\">\r\n <!-- Encabezado de tabla con selecci\u00F3n de registros -->\r\n <th scope=\"col\" mat-header-cell *matHeaderCellDef>\r\n <!-- controles de selecci\u00F3n -->\r\n <mat-checkbox (change)=\"$event ? alternarSeleccion() : null\"\r\n [checked]=\"dataTable.seleccion.hasValue() && todoSeleccionado()\"\r\n [indeterminate]=\"dataTable.seleccion.hasValue() && !todoSeleccionado()\">\r\n </mat-checkbox>\r\n </th>\r\n <!-- Selector de fila -->\r\n <td mat-cell class=\"checkCol\" *matCellDef=\"let row\">\r\n <mat-checkbox (change)=\"$event ? dataTable.seleccion.toggle(row) : null\"\r\n [checked]=\"dataTable.seleccion.isSelected(row)\" [aria-label]=\"validarEtiqueta(row)\">\r\n </mat-checkbox>\r\n </td>\r\n </ng-container>\r\n <!-- Ordenamiento de encabezados -->\r\n <ng-container>\r\n <ng-container [matColumnDef]=\"column.identificador\" *ngFor=\"let column of datosColumna\">\r\n <!-- Definici\u00F3n de encabezado por columna -->\r\n <th #header scope=\"col\" mat-header-cell *matHeaderCellDef>\r\n <div>\r\n <div *ngIf=\"column.isSort\">\r\n <mat-icon *ngIf=\"column.sortDirection ==='desc'\">text_rotate_up</mat-icon>\r\n <mat-icon *ngIf=\"column.sortDirection ==='asc'\">text_rotation_down</mat-icon>\r\n </div>\r\n <div>\r\n {{column.etiqueta ||\r\n column.identificador}}\r\n </div>\r\n\r\n <mat-icon *ngIf=\"column.haveFilters\">filter_list</mat-icon>\r\n\r\n <div>\r\n @if (this.ordenamientoActivo() || this.filtrarDatos) {\r\n <button #btnMenu #menuTrigger=\"matMenuTrigger\" (onMenuClose)=\"closeMenu(header)\"\r\n (onMenuOpen)=\"openMenu(header)\" mat-icon-button [matMenuTriggerFor]=\"menu\"\r\n aria-label=\"Opciones\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #menu=\"matMenu\">\r\n @if (this.ordenamientoActivo()) {\r\n <button mat-menu-item (click)=\"asignarOrden(column,'')\">\r\n <mat-icon>sort</mat-icon>\r\n <span>Quitar ordenamiento</span>\r\n </button>\r\n <button mat-menu-item (click)=\"asignarOrden(column,'asc')\">\r\n <mat-icon>text_rotate_up</mat-icon>\r\n <span>Orden ascendente</span>\r\n </button>\r\n <button mat-menu-item (click)=\"asignarOrden(column,'desc')\">\r\n <mat-icon>text_rotation_down</mat-icon>\r\n <span>Orden descendente</span>\r\n </button>\r\n <mat-divider></mat-divider>\r\n }\r\n @if(this.filtrarDatos){\r\n <filter-data #filtro [filtrosColumnas]=\"column.filters\"\r\n (click)=\"stopPropagation($event)\"\r\n (filterEnd)=\"cambioFiltro(menuTrigger,$event, column)\"></filter-data>\r\n }\r\n </mat-menu>\r\n }\r\n </div>\r\n </div>\r\n </th>\r\n <!-- Creaci\u00F3n de identificadores de tabla -->\r\n <td mat-cell *matCellDef=\"let element\"> {{element[column.identificador]}} </td>\r\n </ng-container>\r\n </ng-container>\r\n <!-- Definici\u00F3n de acciones -->\r\n <ng-container *ngIf=\"verAcciones()\" matColumnDef=\"actions\" stickyEnd>\r\n <th scope=\"col\" mat-header-cell *matHeaderCellDef aria-label=\"row actions\"> </th>\r\n <!-- Definici\u00F3n de acciones por fila -->\r\n <td mat-cell *matCellDef=\"let element\">\r\n <!-- Configuraci\u00F3n de botones de acci\u00F3n -->\r\n <button mat-icon-button color=\"primary\" *ngFor=\"let action of dataTable.acciones\"\r\n (click)=\"action?.emiter?.emit({target:element,source:dataSource})\"\r\n [disabled]=\"deshabilitarAccion(action,element)\">\r\n <!-- Icono din\u00E1mico de la acci\u00F3n -->\r\n <mat-icon [ngClass]=\"deshabilitarAccion(action,element) ? 'disabled-button' : ''\">\r\n {{action.icono || 'apps'}}\r\n </mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n <!-- Definici\u00F3n de columnas -->\r\n <tr mat-header-row *matHeaderRowDef=\"columnas; sticky:true\"></tr>\r\n <!-- Estilizados alternado de filas -->\r\n <tr mat-row *matRowDef=\"let row; columns: columnas;let rowNum = index\" [class.odd]=\"rowNum%2\"\r\n [class.even]=\"!(rowNum%2)\" (click)=\"onRowSelect(row)\"></tr>\r\n </table>\r\n </div>\r\n <!-- Paginador de datos -->\r\n <div [ngClass]=\"paginar ? 'visible' : 'hidden'\">\r\n <!-- Configuraci\u00F3n de Paginador -->\r\n <mat-paginator [pageSizeOptions]=\"[5,10,20,50,100]\" showFirstLastButtons aria-label=\"Seleccione una pagina\">\r\n </mat-paginator>\r\n </div>\r\n</div>", styles: [".container{display:grid}tbody{box-shadow:#0000003d 0 3px 8px}.section{overflow:auto;background-color:#fff;max-height:90vh;border:1px solid #c5c7d1}table{width:100%;color:#676a6f;overflow:auto;padding:0;background-color:#f7f7f7}.odd{background-color:#f4f4f4;font-size:1.05em}.even{background-color:#fff}.odd,.even{height:2.5em;cursor:pointer}td.mat-cell{border:0px;color:#676a6f;font-size:1.05em}.odd:hover,.even:hover{background-color:#cddce9}th{font-size:1.2em}th button{display:none}th div{display:flex;align-items:center}th div div{display:inline-block}th div div:last-child{min-width:48px;min-height:48px}.headerHover button{display:inline-block;cursor:pointer;background:#00000014}th:hover button{display:inline-block;cursor:pointer}tr.mat-header-row{height:35px}input{min-width:250px;border:solid 2px #dadada;float:right;margin-bottom:8px;outline:0;padding-right:2em}mat-icon{color:#676a6f}.icon{float:right;margin-left:-3em;position:relative;margin-top:1px}.visible{display:contents}.hidden{display:none}::-webkit-scrollbar{width:6px}::-webkit-scrollbar-track{background:#ccc;width:6px}caption{display:none}.disabled-button{color:#cecece}::ng-deep .mat-sort-header-stem{height:8px}::ng-deep .mat-sort-header-arrow{color:#797979;margin:0 0 20px}.checkCol{max-width:72px;width:50px}.inputFilter{min-width:50px;width:100px}.icons{position:absolute;top:0}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i4.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i4.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i4.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i4.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i4.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i4.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i4.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i4.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i4.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i4.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i5.MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatPaginatorModule }, { kind: "component", type: i6.MatPaginator, selector: "mat-paginator", inputs: ["color", "pageIndex", "length", "pageSize", "pageSizeOptions", "hidePageSize", "showFirstLastButtons", "selectConfig", "disabled"], outputs: ["page"], exportAs: ["matPaginator"] }, { kind: "ngmodule", type: MatSortModule }, { kind: "directive", type: i7.MatSort, selector: "[matSort]", inputs: ["matSortActive", "matSortStart", "matSortDirection", "matSortDisableClear", "matSortDisabled"], outputs: ["matSortChange"], exportAs: ["matSort"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i8.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "component", type: i8.MatMenuItem, selector: "[mat-menu-item]", inputs: ["role", "disabled", "disableRipple"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i8.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }, { kind: "ngmodule", type: MatDividerModule }, { kind: "component", type: i9.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i10.MatIconButton, selector: "button[mat-icon-button]", exportAs: ["matButton"] }, { kind: "component", type: FilterDataComponent, selector: "filter-data", inputs: ["filtrosColumnas"], outputs: ["filterEnd"] }] }); }
|
|
444
|
+
}
|
|
445
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.4", ngImport: i0, type: RediTableComponent, decorators: [{
|
|
446
|
+
type: Component,
|
|
447
|
+
args: [{ selector: 'redi-table', standalone: true, imports: [
|
|
448
|
+
CommonModule,
|
|
449
|
+
MatIconModule,
|
|
450
|
+
MatTableModule,
|
|
451
|
+
MatCheckboxModule,
|
|
452
|
+
MatPaginatorModule,
|
|
453
|
+
MatSortModule,
|
|
454
|
+
MatMenuModule,
|
|
455
|
+
MatDividerModule,
|
|
456
|
+
MatTooltipModule,
|
|
457
|
+
MatCheckboxModule,
|
|
458
|
+
MatButtonModule,
|
|
459
|
+
FilterDataComponent
|
|
460
|
+
], template: "<!-- Contenedor principal del componente -->\r\n<div class=\"container\">\r\n <!-- Filtro de datos para la tabla -->\r\n <div *ngIf=\"filtrarDatos\">\r\n <mat-icon class=\"icon\"> search </mat-icon>\r\n <input #filtroInput placeholder=\"Buscar\" (keyup)=\"applyFilter(filtroInput.value)\" />\r\n </div>\r\n <!-- Tabla de datos -->\r\n <div class=\"section\">\r\n <table mat-table [dataSource]=\"dataSource\" matSort>\r\n <caption> RediTableComponent </caption>\r\n <!-- Contenedor de selecci\u00F3n -->\r\n <ng-container *ngIf=\"seleccionarFilas\" matColumnDef=\"select\">\r\n <!-- Encabezado de tabla con selecci\u00F3n de registros -->\r\n <th scope=\"col\" mat-header-cell *matHeaderCellDef>\r\n <!-- controles de selecci\u00F3n -->\r\n <mat-checkbox (change)=\"$event ? alternarSeleccion() : null\"\r\n [checked]=\"dataTable.seleccion.hasValue() && todoSeleccionado()\"\r\n [indeterminate]=\"dataTable.seleccion.hasValue() && !todoSeleccionado()\">\r\n </mat-checkbox>\r\n </th>\r\n <!-- Selector de fila -->\r\n <td mat-cell class=\"checkCol\" *matCellDef=\"let row\">\r\n <mat-checkbox (change)=\"$event ? dataTable.seleccion.toggle(row) : null\"\r\n [checked]=\"dataTable.seleccion.isSelected(row)\" [aria-label]=\"validarEtiqueta(row)\">\r\n </mat-checkbox>\r\n </td>\r\n </ng-container>\r\n <!-- Ordenamiento de encabezados -->\r\n <ng-container>\r\n <ng-container [matColumnDef]=\"column.identificador\" *ngFor=\"let column of datosColumna\">\r\n <!-- Definici\u00F3n de encabezado por columna -->\r\n <th #header scope=\"col\" mat-header-cell *matHeaderCellDef>\r\n <div>\r\n <div *ngIf=\"column.isSort\">\r\n <mat-icon *ngIf=\"column.sortDirection ==='desc'\">text_rotate_up</mat-icon>\r\n <mat-icon *ngIf=\"column.sortDirection ==='asc'\">text_rotation_down</mat-icon>\r\n </div>\r\n <div>\r\n {{column.etiqueta ||\r\n column.identificador}}\r\n </div>\r\n\r\n <mat-icon *ngIf=\"column.haveFilters\">filter_list</mat-icon>\r\n\r\n <div>\r\n @if (this.ordenamientoActivo() || this.filtrarDatos) {\r\n <button #btnMenu #menuTrigger=\"matMenuTrigger\" (onMenuClose)=\"closeMenu(header)\"\r\n (onMenuOpen)=\"openMenu(header)\" mat-icon-button [matMenuTriggerFor]=\"menu\"\r\n aria-label=\"Opciones\">\r\n <mat-icon>more_vert</mat-icon>\r\n </button>\r\n <mat-menu #menu=\"matMenu\">\r\n @if (this.ordenamientoActivo()) {\r\n <button mat-menu-item (click)=\"asignarOrden(column,'')\">\r\n <mat-icon>sort</mat-icon>\r\n <span>Quitar ordenamiento</span>\r\n </button>\r\n <button mat-menu-item (click)=\"asignarOrden(column,'asc')\">\r\n <mat-icon>text_rotate_up</mat-icon>\r\n <span>Orden ascendente</span>\r\n </button>\r\n <button mat-menu-item (click)=\"asignarOrden(column,'desc')\">\r\n <mat-icon>text_rotation_down</mat-icon>\r\n <span>Orden descendente</span>\r\n </button>\r\n <mat-divider></mat-divider>\r\n }\r\n @if(this.filtrarDatos){\r\n <filter-data #filtro [filtrosColumnas]=\"column.filters\"\r\n (click)=\"stopPropagation($event)\"\r\n (filterEnd)=\"cambioFiltro(menuTrigger,$event, column)\"></filter-data>\r\n }\r\n </mat-menu>\r\n }\r\n </div>\r\n </div>\r\n </th>\r\n <!-- Creaci\u00F3n de identificadores de tabla -->\r\n <td mat-cell *matCellDef=\"let element\"> {{element[column.identificador]}} </td>\r\n </ng-container>\r\n </ng-container>\r\n <!-- Definici\u00F3n de acciones -->\r\n <ng-container *ngIf=\"verAcciones()\" matColumnDef=\"actions\" stickyEnd>\r\n <th scope=\"col\" mat-header-cell *matHeaderCellDef aria-label=\"row actions\"> </th>\r\n <!-- Definici\u00F3n de acciones por fila -->\r\n <td mat-cell *matCellDef=\"let element\">\r\n <!-- Configuraci\u00F3n de botones de acci\u00F3n -->\r\n <button mat-icon-button color=\"primary\" *ngFor=\"let action of dataTable.acciones\"\r\n (click)=\"action?.emiter?.emit({target:element,source:dataSource})\"\r\n [disabled]=\"deshabilitarAccion(action,element)\">\r\n <!-- Icono din\u00E1mico de la acci\u00F3n -->\r\n <mat-icon [ngClass]=\"deshabilitarAccion(action,element) ? 'disabled-button' : ''\">\r\n {{action.icono || 'apps'}}\r\n </mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n <!-- Definici\u00F3n de columnas -->\r\n <tr mat-header-row *matHeaderRowDef=\"columnas; sticky:true\"></tr>\r\n <!-- Estilizados alternado de filas -->\r\n <tr mat-row *matRowDef=\"let row; columns: columnas;let rowNum = index\" [class.odd]=\"rowNum%2\"\r\n [class.even]=\"!(rowNum%2)\" (click)=\"onRowSelect(row)\"></tr>\r\n </table>\r\n </div>\r\n <!-- Paginador de datos -->\r\n <div [ngClass]=\"paginar ? 'visible' : 'hidden'\">\r\n <!-- Configuraci\u00F3n de Paginador -->\r\n <mat-paginator [pageSizeOptions]=\"[5,10,20,50,100]\" showFirstLastButtons aria-label=\"Seleccione una pagina\">\r\n </mat-paginator>\r\n </div>\r\n</div>", styles: [".container{display:grid}tbody{box-shadow:#0000003d 0 3px 8px}.section{overflow:auto;background-color:#fff;max-height:90vh;border:1px solid #c5c7d1}table{width:100%;color:#676a6f;overflow:auto;padding:0;background-color:#f7f7f7}.odd{background-color:#f4f4f4;font-size:1.05em}.even{background-color:#fff}.odd,.even{height:2.5em;cursor:pointer}td.mat-cell{border:0px;color:#676a6f;font-size:1.05em}.odd:hover,.even:hover{background-color:#cddce9}th{font-size:1.2em}th button{display:none}th div{display:flex;align-items:center}th div div{display:inline-block}th div div:last-child{min-width:48px;min-height:48px}.headerHover button{display:inline-block;cursor:pointer;background:#00000014}th:hover button{display:inline-block;cursor:pointer}tr.mat-header-row{height:35px}input{min-width:250px;border:solid 2px #dadada;float:right;margin-bottom:8px;outline:0;padding-right:2em}mat-icon{color:#676a6f}.icon{float:right;margin-left:-3em;position:relative;margin-top:1px}.visible{display:contents}.hidden{display:none}::-webkit-scrollbar{width:6px}::-webkit-scrollbar-track{background:#ccc;width:6px}caption{display:none}.disabled-button{color:#cecece}::ng-deep .mat-sort-header-stem{height:8px}::ng-deep .mat-sort-header-arrow{color:#797979;margin:0 0 20px}.checkCol{max-width:72px;width:50px}.inputFilter{min-width:50px;width:100px}.icons{position:absolute;top:0}\n"] }]
|
|
461
|
+
}], ctorParameters: () => [{ type: i1$1.CsvService }], propDecorators: { seleccionarFilas: [{
|
|
462
|
+
type: Input
|
|
463
|
+
}], filtrarDatos: [{
|
|
464
|
+
type: Input
|
|
465
|
+
}], paginar: [{
|
|
466
|
+
type: Input
|
|
467
|
+
}], ordenarDatos: [{
|
|
468
|
+
type: Input
|
|
469
|
+
}], dataTable: [{
|
|
470
|
+
type: Input
|
|
471
|
+
}], sort: [{
|
|
472
|
+
type: ViewChild,
|
|
473
|
+
args: [MatSort]
|
|
474
|
+
}], paginator: [{
|
|
475
|
+
type: ViewChild,
|
|
476
|
+
args: [MatPaginator]
|
|
477
|
+
}], componenteFiltro: [{
|
|
478
|
+
type: ViewChild,
|
|
479
|
+
args: ['filtro']
|
|
480
|
+
}], inputFiltro: [{
|
|
481
|
+
type: ViewChild,
|
|
482
|
+
args: ['filtroInput']
|
|
483
|
+
}], onRowClick: [{
|
|
484
|
+
type: Output
|
|
485
|
+
}] } });
|
|
486
|
+
|
|
487
|
+
/** Componentes */
|
|
488
|
+
// /** Tipos */
|
|
489
|
+
// export * from './src/models/types/event-table.type';
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Generated bundle index. Do not edit.
|
|
493
|
+
*/
|
|
494
|
+
|
|
495
|
+
export { RediTableComponent };
|
|
496
|
+
//# sourceMappingURL=ngx-redi-core-RediTable.mjs.map
|