utn-cli 2.0.28 → 2.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utn-cli",
3
- "version": "2.0.28",
3
+ "version": "2.0.29",
4
4
  "description": "Herramienta CLI unificada para la gestión de plantillas en SIGU.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -299,6 +299,11 @@ tr.example-element-row:hover {
299
299
  gap: 10px !important; /* Espacio uniforme entre elementos */
300
300
  }
301
301
 
302
+ .contenedor-columnas {
303
+ width: 100%;
304
+ justify-content: center;
305
+ }
306
+
302
307
  /* Forzamos que Input, Select y Botón sean idénticos en ancho */
303
308
  .custom-input,
304
309
  mat-select.custom-input,
@@ -9,6 +9,20 @@
9
9
  </div>
10
10
  <div class="centro"></div>
11
11
  <div class="derecha">
12
+ <mat-menu #menuColumnas="matMenu">
13
+ @for(col of columnas; track $index){
14
+ <button mat-menu-item>
15
+ <mat-checkbox [(ngModel)]="col.Visible" (change)="recalcularColumnas()">
16
+ {{ col.Alias }}
17
+ </mat-checkbox>
18
+ </button>
19
+ }
20
+ </mat-menu>
21
+ <div class="contenedor-columnas">
22
+ <button mat-icon-button [matMenuTriggerFor]="menuColumnas" matTooltip="Mostrar/Ocultar columnas">
23
+ <mat-icon>view_column</mat-icon>
24
+ </button>
25
+ </div>
12
26
  <input #valorFiltroInput id="valorFiltro" type="text" class="custom-input" placeholder="Filtrar"
13
27
  (keydown.enter)="AplicarFiltro()">
14
28
  @if(mostrarElBotonDeFiltro){
@@ -11,6 +11,9 @@ import { MatSelectModule } from '@angular/material/select';
11
11
  import { MensajeConfirmacionComponent } from '../mensaje-confirmacion/mensaje-confirmacion';
12
12
  import { MatDialog } from '@angular/material/dialog';
13
13
  import { MatBadgeModule } from '@angular/material/badge';
14
+ import { MatMenuModule } from '@angular/material/menu';
15
+ import { MatCheckboxModule } from '@angular/material/checkbox';
16
+ import { FormsModule } from '@angular/forms';
14
17
 
15
18
  @Component({
16
19
  selector: 'app-tabla',
@@ -31,20 +34,24 @@ import { MatBadgeModule } from '@angular/material/badge';
31
34
  MatSortModule,
32
35
  MatInputModule,
33
36
  MatSelectModule,
34
- MatBadgeModule],
37
+ MatBadgeModule,
38
+ MatMenuModule,
39
+ MatCheckboxModule,
40
+ FormsModule,
41
+ ],
35
42
  templateUrl: './tabla.component.html',
36
43
  styleUrl: './tabla.component.css'
37
44
  })
38
45
  export class TablaComponent implements OnInit, OnChanges {
39
- @Input() columnas: { Llave: string, Alias: string, TipoDeFiltro: string }[] = [];
46
+ @Input() columnas: { Llave: string, Alias: string, TipoDeFiltro: string, Visible?: boolean }[] = [];
40
47
  @Input() subColumnas: { Llave: string, Alias: string }[] = [];
41
48
  @Input() datos: any[] = [];
42
- @Input() acciones: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; }[] = [];
43
- @Input() accionesDinamicas: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; Mostrar: (row: any) => boolean }[] = [];
44
- @Input() accionesSiempreClickeable: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; }[] = [];
45
- @Input() subAcciones: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; }[] = [];
49
+ @Input() acciones: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; }[] = [];
50
+ @Input() accionesDinamicas: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; Mostrar: (row: any) => boolean }[] = [];
51
+ @Input() accionesSiempreClickeable: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; }[] = [];
52
+ @Input() subAcciones: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; }[] = [];
46
53
  @Input() subAccionesSiempreClickeable: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; }[] = [];
47
- @Input() subAccionesDinamicas: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; Mostrar: (row: any) => boolean }[] = [];
54
+ @Input() subAccionesDinamicas: { icono: string; color: string; textoAyuda: string; ejecutar: (row: any) => void; badge?: (row: any) => string | number | undefined | null; Mostrar: (row: any) => boolean }[] = [];
48
55
  @Input() desplegable: boolean = false
49
56
  @Input() atributoDesplegable: string = ''
50
57
  public llavesColumnas: string[] = [];
@@ -147,17 +154,31 @@ export class TablaComponent implements OnInit, OnChanges {
147
154
  }
148
155
 
149
156
  private inicializarColumnas(): void {
150
- this.llavesColumnas = this.columnas.map(c => c.Llave);
151
- this.tieneColumnaEstado = this.columnas.some(c => c.Llave === 'Estado');
157
+ this.columnas.forEach(c => {
158
+ if (c.Visible === undefined) {
159
+ c.Visible = true;
160
+ }
161
+ });
162
+ this.recalcularColumnas();
163
+ }
152
164
 
153
- if (this.acciones.length || this.accionesSiempreClickeable.length || this.accionesDinamicas.length) {
165
+ public recalcularColumnas(): void {
166
+ const columnasVisibles = this.columnas.filter(c => c.Visible).map(c => c.Llave);
167
+ this.llavesColumnas = [];
168
+ if (this.desplegable) {
169
+ this.llavesColumnas.push('expand');
170
+ }
171
+ this.llavesColumnas.push(...columnasVisibles);
172
+ this.tieneColumnaEstado = this.columnas.some(c => c.Llave === 'Estado');
173
+ if (this.acciones.length ||
174
+ this.accionesSiempreClickeable.length ||
175
+ this.accionesDinamicas.length) {
154
176
  this.llavesColumnas.push('acciones');
155
177
  }
156
-
157
178
  if (this.desplegable) {
158
- this.llavesColumnas.unshift('expand');
159
179
  this.llavesSubColumnas = this.subColumnas.map(c => c.Llave);
160
- if (this.subAcciones.length || this.subAccionesSiempreClickeable.length) {
180
+ if (this.subAcciones.length ||
181
+ this.subAccionesSiempreClickeable.length) {
161
182
  this.llavesSubColumnas.push('subAcciones');
162
183
  }
163
184
  }