@jvsoft/components 0.0.10 → 0.0.11

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 (141) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/build.js +20 -0
  3. package/dialog-flotante/dialog-flotante.component.html +66 -0
  4. package/dialog-flotante/dialog-flotante.component.ts +115 -0
  5. package/dialog-flotante/dialog-flotante.interface.ts +13 -0
  6. package/dialog-flotante/index.ts +1 -0
  7. package/dialog-flotante/ng-package.json +5 -0
  8. package/{index.d.ts → index.ts} +8 -1
  9. package/lista-arbol/lista-arbol.component.html +66 -0
  10. package/lista-arbol/lista-arbol.component.ts +238 -0
  11. package/lista-arbol/lista-arbol.functions.ts +46 -0
  12. package/lista-arbol/ng-package.json +5 -0
  13. package/luces-navidad/christmas-tree.png +0 -0
  14. package/luces-navidad/index.ts +1 -0
  15. package/luces-navidad/luces-navidad.component.html +6 -0
  16. package/luces-navidad/luces-navidad.component.ts +24 -0
  17. package/luces-navidad/ng-package.json +5 -0
  18. package/mat-suffix-search-button/index.ts +1 -0
  19. package/mat-suffix-search-button/mat-suffix-search-button.component.html +5 -0
  20. package/mat-suffix-search-button/mat-suffix-search-button.component.ts +36 -0
  21. package/mat-suffix-search-button/ng-package.json +5 -0
  22. package/menu/index.ts +1 -0
  23. package/menu/menu.component.html +40 -0
  24. package/menu/menu.component.ts +88 -0
  25. package/menu/menu.interface.ts +16 -0
  26. package/menu/ng-package.json +5 -0
  27. package/ng-package.json +17 -0
  28. package/package.json +15 -41
  29. package/progress-spinner.zip +0 -0
  30. package/tabla-mantenimiento/classes/data-model.ts +150 -0
  31. package/tabla-mantenimiento/components/progress-bar/index.ts +1 -0
  32. package/tabla-mantenimiento/components/progress-bar/ng-package.json +5 -0
  33. package/tabla-mantenimiento/components/progress-bar/progress-bar.component.html +10 -0
  34. package/tabla-mantenimiento/components/progress-bar/progress-bar.component.ts +85 -0
  35. package/tabla-mantenimiento/components/progress-bar/public-api.ts +2 -0
  36. package/tabla-mantenimiento/index.ts +1 -0
  37. package/tabla-mantenimiento/interfaces/{archivo.d.ts → archivo.ts} +7 -4
  38. package/tabla-mantenimiento/interfaces/global/{boton-mantenimiento.d.ts → boton-mantenimiento.ts} +9 -3
  39. package/tabla-mantenimiento/interfaces/global/{columnas-tabla.d.ts → columnas-tabla.ts} +90 -13
  40. package/tabla-mantenimiento/interfaces/global/export-excel-servidor.ts +0 -0
  41. package/tabla-mantenimiento/interfaces/global/no-export.ts +11 -0
  42. package/tabla-mantenimiento/interfaces/global/{otros.d.ts → otros.ts} +15 -3
  43. package/tabla-mantenimiento/interfaces/implements/{incluye-tabla-mantenimiento.d.ts → incluye-tabla-mantenimiento.ts} +6 -4
  44. package/tabla-mantenimiento/interfaces/implements/{index.d.ts → index.ts} +1 -0
  45. package/tabla-mantenimiento/mat-row-keyboard-selection.directive.ts +97 -0
  46. package/tabla-mantenimiento/ng-package.json +5 -0
  47. package/tabla-mantenimiento/pipes/no-sanitize.pipe.ts +12 -0
  48. package/tabla-mantenimiento/pipes/zero-fill.pipe.ts +19 -0
  49. package/tabla-mantenimiento/{public-api.d.ts → public-api.ts} +3 -2
  50. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.html +22 -0
  51. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.ts +12 -0
  52. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.html +58 -0
  53. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.ts +19 -0
  54. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.html +40 -0
  55. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.ts +17 -0
  56. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.html +25 -0
  57. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.ts +14 -0
  58. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.html +28 -0
  59. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.ts +13 -0
  60. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.html +30 -0
  61. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.ts +38 -0
  62. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.html +97 -0
  63. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.ts +43 -0
  64. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.html +26 -0
  65. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.ts +36 -0
  66. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.ts +54 -0
  67. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.html +76 -0
  68. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.ts +67 -0
  69. package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.html +7 -0
  70. package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.ts +39 -0
  71. package/tabla-mantenimiento/tabla-mantenimiento.component.html +385 -0
  72. package/tabla-mantenimiento/tabla-mantenimiento.component.ts +951 -0
  73. package/tabla-mantenimiento/tabla-mantenimiento.functions.ts +57 -0
  74. package/tabla-mantenimiento/tabla-mantenimiento.service.ts +44 -0
  75. package/tabla-mantenimiento/table-util.ts +49 -0
  76. package/tabla-mantenimiento.zip +0 -0
  77. package/tsconfig.lib.json +16 -0
  78. package/tsconfig.lib.prod.json +11 -0
  79. package/tsconfig.spec.json +15 -0
  80. package/yarn-error.log +68 -0
  81. package/dialog-flotante/dialog-flotante.component.d.ts +0 -32
  82. package/dialog-flotante/dialog-flotante.interface.d.ts +0 -11
  83. package/dialog-flotante/index.d.ts +0 -5
  84. package/fesm2022/jvsoft-components-dialog-flotante.mjs +0 -130
  85. package/fesm2022/jvsoft-components-dialog-flotante.mjs.map +0 -1
  86. package/fesm2022/jvsoft-components-lista-arbol.mjs +0 -266
  87. package/fesm2022/jvsoft-components-lista-arbol.mjs.map +0 -1
  88. package/fesm2022/jvsoft-components-luces-navidad.mjs +0 -33
  89. package/fesm2022/jvsoft-components-luces-navidad.mjs.map +0 -1
  90. package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs +0 -47
  91. package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs.map +0 -1
  92. package/fesm2022/jvsoft-components-menu.mjs +0 -102
  93. package/fesm2022/jvsoft-components-menu.mjs.map +0 -1
  94. package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs +0 -91
  95. package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs.map +0 -1
  96. package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs +0 -1801
  97. package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs.map +0 -1
  98. package/fesm2022/jvsoft-components.mjs +0 -2309
  99. package/fesm2022/jvsoft-components.mjs.map +0 -1
  100. package/lista-arbol/index.d.ts +0 -5
  101. package/lista-arbol/lista-arbol.component.d.ts +0 -58
  102. package/lista-arbol/lista-arbol.functions.d.ts +0 -1
  103. package/luces-navidad/index.d.ts +0 -5
  104. package/luces-navidad/luces-navidad.component.d.ts +0 -11
  105. package/mat-suffix-search-button/index.d.ts +0 -5
  106. package/mat-suffix-search-button/mat-suffix-search-button.component.d.ts +0 -12
  107. package/menu/index.d.ts +0 -5
  108. package/menu/menu.component.d.ts +0 -25
  109. package/menu/menu.interface.d.ts +0 -16
  110. package/src/styles/base-jvsoft-components.css +0 -9
  111. package/tabla-mantenimiento/classes/data-model.d.ts +0 -25
  112. package/tabla-mantenimiento/components/progress-bar/index.d.ts +0 -5
  113. package/tabla-mantenimiento/components/progress-bar/progress-bar.component.d.ts +0 -30
  114. package/tabla-mantenimiento/components/progress-bar/public-api.d.ts +0 -1
  115. package/tabla-mantenimiento/index.d.ts +0 -5
  116. package/tabla-mantenimiento/interfaces/global/no-export.d.ts +0 -2
  117. package/tabla-mantenimiento/mat-row-keyboard-selection.directive.d.ts +0 -19
  118. package/tabla-mantenimiento/pipes/no-sanitize.pipe.d.ts +0 -10
  119. package/tabla-mantenimiento/pipes/zero-fill.pipe.d.ts +0 -8
  120. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.d.ts +0 -8
  121. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.d.ts +0 -9
  122. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.d.ts +0 -9
  123. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.d.ts +0 -8
  124. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.d.ts +0 -8
  125. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.d.ts +0 -9
  126. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.d.ts +0 -8
  127. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.d.ts +0 -18
  128. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.d.ts +0 -23
  129. package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.d.ts +0 -21
  130. package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.d.ts +0 -18
  131. package/tabla-mantenimiento/tabla-mantenimiento.component.d.ts +0 -147
  132. package/tabla-mantenimiento/tabla-mantenimiento.functions.d.ts +0 -5
  133. package/tabla-mantenimiento/tabla-mantenimiento.service.d.ts +0 -8
  134. package/tabla-mantenimiento/table-util.d.ts +0 -11
  135. /package/dialog-flotante/{public-api.d.ts → public-api.ts} +0 -0
  136. /package/lista-arbol/{public-api.d.ts → public-api.ts} +0 -0
  137. /package/luces-navidad/{public-api.d.ts → public-api.ts} +0 -0
  138. /package/mat-suffix-search-button/{public-api.d.ts → public-api.ts} +0 -0
  139. /package/menu/{public-api.d.ts → public-api.ts} +0 -0
  140. /package/tabla-mantenimiento/interfaces/global/{index.d.ts → index.ts} +0 -0
  141. /package/tabla-mantenimiento/interfaces/{index.d.ts → index.ts} +0 -0
@@ -1,6 +1,25 @@
1
- import { EstilosBarra } from '../../components/progress-bar';
2
- import { TipoValorFuncion } from './no-export';
3
- type TiposColumnas = 'yes_no' | 'estiloEstablecido' | 'text' | 'number' | 'money' | 'date' | 'image' | 'estado' | 'badge' | 'progress' | 'checkbox' | 'icon' | 'icons' | 'icon_checkbox' | 'custom' | 'expandir' | 'numeracion_automatica';
1
+ import {EstilosBarra} from '../../components/progress-bar';
2
+ import {TipoValorFuncion} from './no-export';
3
+
4
+ type TiposColumnas =
5
+ | 'yes_no'
6
+ | 'estiloEstablecido'
7
+ | 'text'
8
+ | 'number'
9
+ | 'money'
10
+ | 'date'
11
+ | 'image'
12
+ | 'estado'
13
+ | 'badge'
14
+ | 'progress'
15
+ | 'checkbox'
16
+ | 'icon'
17
+ | 'icons'
18
+ | 'icon_checkbox'
19
+ | 'custom'
20
+ | 'expandir'
21
+ | 'numeracion_automatica';
22
+
4
23
  export interface ColumnaTablaReporte {
5
24
  ocultar?: boolean;
6
25
  transformar?: (row: any) => any;
@@ -10,11 +29,13 @@ export interface ColumnaTablaReporte {
10
29
  };
11
30
  opcionesPdfmake?: {
12
31
  transformarCuerpo?(row: any): any;
13
- titulo?: object;
14
- cuerpo?: object;
32
+ titulo?: object,
33
+ cuerpo?: object,
15
34
  total?: TipoValorFuncion<any>;
16
- };
35
+ }
17
36
  }
37
+
38
+
18
39
  export interface IconsIcon {
19
40
  icon: string;
20
41
  iconSize?: string;
@@ -22,14 +43,29 @@ export interface IconsIcon {
22
43
  toolTipField?: string;
23
44
  contentCss?: string;
24
45
  cssClass?: string;
46
+
25
47
  click?(row: any): void;
48
+
26
49
  esVisible?(row: any): boolean;
27
50
  }
28
- export type TiposColumnasNuevo = 'text' | 'checkbox' | 'money' | 'icon' | 'icons' | 'progress' | 'expandir' | 'date' | 'number';
51
+
52
+ // VERSION MEJORADA //
53
+
54
+ export type TiposColumnasNuevo =
55
+ | 'text'
56
+ | 'checkbox'
57
+ | 'money'
58
+ | 'icon'
59
+ | 'icons'
60
+ | 'progress'
61
+ | 'expandir'
62
+ | 'date'
63
+ | 'number';
64
+
29
65
  type PropiedadString<T> = Extract<keyof T, string>;
30
66
  interface BaseColumna<T> {
31
67
  tableDataIndex?: number;
32
- label: string;
68
+ label: '' | string;
33
69
  labelLista?: string;
34
70
  property: PropiedadString<T> | string;
35
71
  /** esta propiedad solo se usa cuando se usará una funcion para modificarla */
@@ -39,57 +75,72 @@ interface BaseColumna<T> {
39
75
  sortType?: 'number' | 'date';
40
76
  reportType?: TiposColumnas;
41
77
  visible?: TipoValorFuncion<boolean>;
78
+ // sticky?: boolean;
79
+ // stickyEnd?: boolean;
42
80
  cssClasses?: string[];
43
81
  cssClassesTH?: string[];
44
82
  textCss?: string | string[];
45
83
  cssFooterClasses?: string[];
46
84
  datosExtra?: any;
85
+
47
86
  reporte?: ColumnaTablaReporte;
87
+
48
88
  innerHTMLInvisible?: (row: any) => string;
49
89
  /** @deprecated usar `visible` en su lugar: ejm: visible: ():boolean => {}, visible: boolean */
50
90
  esVisible?: () => boolean;
51
91
  /** @deprecated usar `noMostrarEnLista` en su lugar: ejm: noMostrarEnLista: ():boolean => {}, noMostrarEnLista: boolean */
52
92
  noMostrar?: () => boolean;
53
93
  noMostrarEnLista?: TipoValorFuncion<boolean>;
94
+
54
95
  click?: (row: any) => void;
55
96
  transformar?: (row: any) => any;
56
97
  transformarFooter?: () => any;
98
+
57
99
  /** @deprecated usar `reporte.opcionesPdfmake.transformarCuerpo` */
58
100
  transformarDirecto?: never;
101
+
59
102
  }
103
+
60
104
  export interface ColumnaTexto<T> extends BaseColumna<T> {
61
105
  type: 'text';
62
106
  innerHTML?: (row: any) => string;
63
107
  zeroFill?: number;
64
108
  text?: PropiedadesText;
65
109
  }
110
+
66
111
  export interface ColumnaCheckbox<T> extends BaseColumna<T> {
67
112
  type: 'checkbox';
68
113
  chkField?: string | string[];
69
114
  chkFieldPersistente?: boolean;
70
115
  chkFieldSeparador?: string;
71
116
  }
117
+
72
118
  export interface ColumnaMoney<T> extends BaseColumna<T> {
73
119
  type: 'money';
74
120
  simboloMoneda?: string;
75
121
  format?: string;
76
122
  }
123
+
77
124
  export interface ColumnaIcons<T> extends BaseColumna<T> {
78
125
  type: 'icons';
79
126
  iconsDef: ColumnaIconsDef;
127
+
80
128
  }
81
129
  export interface ColumnaProgress<T> extends BaseColumna<T> {
82
130
  type: 'progress';
83
131
  progressbar: PropiedadesProgressBar;
84
132
  }
133
+
85
134
  export interface ColumnaDate<T> extends BaseColumna<T> {
86
135
  type: 'date';
87
136
  format?: string;
88
137
  }
138
+
89
139
  export interface ColumnaNumber<T> extends BaseColumna<T> {
90
140
  type: 'number';
91
141
  format?: string;
92
142
  }
143
+
93
144
  export interface ColumnaExpandir<T> extends BaseColumna<T> {
94
145
  type: 'expandir';
95
146
  }
@@ -97,27 +148,52 @@ export interface ColumnaYesNo<T> extends BaseColumna<T> {
97
148
  type: 'yes_no';
98
149
  yesIcon?: string;
99
150
  yesTooltip?: string;
100
- yesValue?: any;
151
+ yesValue?: any,
101
152
  noIcon?: string;
102
153
  noTooltip?: string;
103
- noValue?: any;
154
+ noValue?: any,
104
155
  }
156
+
105
157
  export interface ColumnaEstiloEstablecido<T> extends BaseColumna<T> {
106
158
  type: 'estiloEstablecido';
107
159
  propertyTemplate: PropiedadString<T> | string;
108
160
  }
161
+
109
162
  export interface ColumnaOtros<T> extends BaseColumna<T> {
110
- type: 'image' | 'custom' | 'estado' | 'numeracion_automatica';
163
+ type:
164
+ // | 'estiloEstablecido'
165
+ | 'image'
166
+ | 'custom'
167
+ | 'estado'
168
+ | 'numeracion_automatica';
169
+
111
170
  /** @deprecated */
112
171
  readonly estados?: object[];
113
172
  }
114
- export type ColumnaTabla<T> = ColumnaEstiloEstablecido<T> | ColumnaTexto<T> | ColumnaCheckbox<T> | ColumnaMoney<T> | ColumnaIcons<T> | ColumnaProgress<T> | ColumnaDate<T> | ColumnaNumber<T> | ColumnaExpandir<T> | ColumnaYesNo<T> | ColumnaOtros<T>;
173
+
174
+ // 🔹 Unimos todas las interfaces en un solo tipo discriminado
175
+ export type ColumnaTabla<T> =
176
+ | ColumnaEstiloEstablecido<T>
177
+
178
+ | ColumnaTexto<T>
179
+ | ColumnaCheckbox<T>
180
+ | ColumnaMoney<T>
181
+ | ColumnaIcons<T>
182
+ | ColumnaProgress<T>
183
+ | ColumnaDate<T>
184
+ | ColumnaNumber<T>
185
+ | ColumnaExpandir<T>
186
+ | ColumnaYesNo<T>
187
+ | ColumnaOtros<T>
188
+
189
+ // 🟢 Definición de propiedades específicas
115
190
  export interface PropiedadesText {
116
191
  separador?: string;
117
192
  cssContenedor?: string;
118
193
  cssStyle?: object;
119
194
  click?: (row: any) => void;
120
195
  }
196
+
121
197
  export interface PropiedadesProgressBar {
122
198
  formatoNumero?: string;
123
199
  coloresValor?: EstilosBarra[];
@@ -125,11 +201,13 @@ export interface PropiedadesProgressBar {
125
201
  textoMostrar?: (row: any) => string;
126
202
  porcentaje: (row: any) => number;
127
203
  }
204
+
128
205
  export interface ColumnaIconsDef {
129
206
  items: TipoValorFuncion<IconsIcon[]>;
130
207
  soloIcono?: boolean;
131
208
  iconSize?: string;
132
209
  }
210
+
133
211
  export interface IconsIcon {
134
212
  icon: string;
135
213
  iconSize?: string;
@@ -140,4 +218,3 @@ export interface IconsIcon {
140
218
  click?: (row: any) => void;
141
219
  esVisible?: (row: any) => boolean;
142
220
  }
143
- export {};
@@ -0,0 +1,11 @@
1
+ export type TipoValorFuncion<T> = T | ((...param: any) => T);
2
+
3
+ export function tipoValorFuncion<T>(datoParam: TipoValorFuncion<T>, defaultValue?: T, ...param: any[]): T | undefined {
4
+ if (datoParam === undefined || datoParam === null) {
5
+ return defaultValue; // Retorna el valor por defecto si es undefined
6
+ }
7
+ if (typeof datoParam === 'function') {
8
+ return (datoParam as (...args: any) => T)(...param);
9
+ }
10
+ return datoParam;
11
+ }
@@ -1,5 +1,6 @@
1
- import { BehaviorSubject } from 'rxjs';
2
- import { TiposOpciones } from './boton-mantenimiento';
1
+ import {BehaviorSubject} from 'rxjs';
2
+ import {TiposOpciones} from './boton-mantenimiento';
3
+
3
4
  export interface OpcionSeleccionada {
4
5
  readonly tableDataIndex?: number;
5
6
  item?: any;
@@ -14,13 +15,24 @@ export interface OpcionSeleccionada {
14
15
  /** @deprecated usar '`datosExtra`' en su lugar */
15
16
  dialog?: any;
16
17
  }
18
+
19
+ interface DatosExtra {
20
+ /** templateRef del '`GeneralFileUpload`' **/
21
+ templateArchivos: any;
22
+ [key: string]: any;
23
+ }
24
+
25
+
26
+
17
27
  export interface DialogDatosRecibidos {
18
28
  opcMenuSubmit?: OpcionSeleccionada;
29
+
19
30
  [key: string]: any;
20
31
  }
21
32
  export interface DataServidor {
22
33
  [key: string]: BehaviorSubject<any>;
23
34
  }
24
- export interface OpcMenuEvent extends OpcionSeleccionada {
35
+
36
+ export interface OpcMenuEvent extends OpcionSeleccionada{
25
37
  datosGuardados?: any;
26
38
  }
@@ -1,11 +1,13 @@
1
- import { ColumnaTabla, DataServidor, OpcionSeleccionada, TablaMantenimientoSeccionBotones } from '../global';
1
+ import {ColumnaTabla, DataServidor, OpcionSeleccionada, TablaMantenimientoSeccionBotones} from '../global';
2
+
3
+
2
4
  export declare interface IncluyeTablaMantenimiento {
3
5
  dataServidorSuscripcion?: DataServidor;
4
6
  botonesMenu?: TablaMantenimientoSeccionBotones;
7
+ // opcionesFiltro?: TabSeccion[];
5
8
  columnasPrincipal: ColumnaTabla<any>[];
6
- seleccionados: {
7
- [key: string]: any;
8
- };
9
+ // columnasTabla: ColumnaTabla<any>[];
10
+ seleccionados: { [key:string]: any };
9
11
  cargaInicial?<T>(): void | Promise<T>;
10
12
  cargarLista?<T>(): void | Promise<T>;
11
13
  opcMenu?(v: OpcionSeleccionada): void;
@@ -1 +1,2 @@
1
+
1
2
  export * from './incluye-tabla-mantenimiento';
@@ -0,0 +1,97 @@
1
+ import {Directive, ElementRef, EventEmitter, HostListener, Input, OnDestroy, OnInit, Output} from '@angular/core';
2
+ import {MatTable, MatTableDataSource} from '@angular/material/table';
3
+ import {Subject, takeUntil} from 'rxjs';
4
+
5
+ @Directive({
6
+ selector: '[matRowKeyboardSelection]'
7
+ })
8
+ export class MatRowKeyboardSelectionDirective implements OnInit, OnDestroy {
9
+
10
+ private rows!: HTMLElement[];
11
+ private renderedData!: any[];
12
+
13
+ @Input('matRowKeyboardSelection') tabla!: MatTable<any>; // Entrada: Referencia a la tabla
14
+ @Input() rowModel: any; // Entrada: Modelo de fila actual
15
+ @Output() seleccionarSiguiente = new EventEmitter(); // Salida: Evento al seleccionar siguiente
16
+
17
+ private unsubscriber$ = new Subject();
18
+
19
+ constructor(private el: ElementRef) {}
20
+
21
+ ngOnInit(): void {
22
+ // Asignar tabindex si no está definido
23
+ if (this.el.nativeElement.tabIndex < 0) {
24
+ this.el.nativeElement.tabIndex = 0;
25
+ }
26
+
27
+ // Obtener la fuente de datos de la tabla
28
+ const dataSource = this.tabla.dataSource as MatTableDataSource<any>;
29
+
30
+ // Suscribirse a los cambios en los datos
31
+ dataSource.connect().pipe(takeUntil(this.unsubscriber$)).subscribe(data => {
32
+ this.renderedData = data;
33
+ this.rows = Array.from(<NodeListOf<HTMLElement>>this.getTableRows());
34
+ });
35
+ }
36
+
37
+ ngOnDestroy(): void {
38
+ // Finalizar la suscripción al destruir la directiva
39
+ this.unsubscriber$.next(null);
40
+ this.unsubscriber$.complete();
41
+ }
42
+
43
+ @HostListener('keydown', ['$event']) onKeydown(event: KeyboardEvent): void {
44
+ var element = event.target as HTMLElement;
45
+ if (element.tagName === "INPUT") {
46
+ event.stopPropagation();
47
+ }
48
+ else {
49
+ const currentIndex = this.renderedData.findIndex(row => row === this.rowModel);
50
+ const eRef = event.target as HTMLElement;
51
+ this.rows = this.rows.filter(elem => elem.hasAttribute('id'));
52
+ const arrayFilas = Array.from(this.rows);
53
+
54
+ const fElem = arrayFilas.filter(elem => elem.id == eRef.id).pop();
55
+ const cElemIdx = arrayFilas.findIndex(elem => elem == fElem);
56
+
57
+ let newRow: HTMLElement | undefined;
58
+
59
+ // Controlar las teclas presionadas
60
+ switch (event.key) {
61
+ case 'ArrowDown':
62
+ newRow = this.rows[cElemIdx + 1];
63
+ break;
64
+ case 'ArrowUp':
65
+ newRow = this.rows[cElemIdx - 1];
66
+ break;
67
+ case 'Enter':
68
+ case ' ':
69
+ this.seleccionarSiguiente.next(this.renderedData[currentIndex]);
70
+ event.preventDefault();
71
+ break;
72
+ }
73
+
74
+ // Enfocar la nueva fila seleccionada
75
+ if (newRow) {
76
+ newRow.classList.add('estaFocus');
77
+ newRow.focus();
78
+ }
79
+ }
80
+ }
81
+
82
+ private getTableRows(): NodeListOf<HTMLElement> | undefined {
83
+ let el = this.el.nativeElement;
84
+
85
+ // Recorrer los elementos padres hasta encontrar la tabla
86
+ while (el && el.parentNode) {
87
+ el = el.parentNode;
88
+
89
+ // Verificar si es una tabla de material
90
+ if (el.tagName && el.tagName.toLowerCase() === 'mat-table' || el.hasAttribute('mat-table')) {
91
+ return el.querySelectorAll('mat-row, tr[mat-row]');
92
+ }
93
+ }
94
+
95
+ return undefined;
96
+ }
97
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "lib": {
3
+ "entryFile": "public-api.ts"
4
+ }
5
+ }
@@ -0,0 +1,12 @@
1
+ import {Pipe, PipeTransform} from '@angular/core';
2
+ import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
3
+
4
+ @Pipe({ name: 'noSanitize' })
5
+ export class NoSanitizePipe implements PipeTransform {
6
+ constructor(private domSanitizer: DomSanitizer) {
7
+
8
+ }
9
+ transform(html: string): SafeHtml {
10
+ return this.domSanitizer.bypassSecurityTrustHtml(html);
11
+ }
12
+ }
@@ -0,0 +1,19 @@
1
+ import {Pipe, PipeTransform} from '@angular/core';
2
+
3
+ @Pipe({
4
+ name: 'zeroFill',
5
+ })
6
+ export class ZeroFillPipe implements PipeTransform {
7
+
8
+ transform(value: unknown, digitos: number, ...args: unknown[]) {
9
+ let s = value + '';
10
+ while (s.length < digitos) {
11
+ s = '0' + s;
12
+ }
13
+ return s;
14
+ }
15
+
16
+ }
17
+ export function zeroFill(value: unknown, digitos: number, ...args: unknown[]) {
18
+ return new ZeroFillPipe().transform(value, digitos, args);
19
+ }
@@ -1,4 +1,5 @@
1
1
  export * from './tabla-mantenimiento.component';
2
2
  export * from './tabla-mantenimiento.service';
3
- export * from './components/progress-bar';
4
- export * from './interfaces';
3
+ export * from './components/progress-bar'
4
+ export * from './interfaces'
5
+
@@ -0,0 +1,22 @@
1
+ <ng-template #cellTemplate let-row="row">
2
+ {{ row[column.property] | date: (column.format ? column.format : 'dd/MM/yyyy') }}
3
+ </ng-template>
4
+
5
+ <ng-container matColumnDef="{{ column.property }}">
6
+ <!-- Definición del encabezado de la columna -->
7
+ <th *matHeaderCellDef [ngClass]="column.cssClassesTH" class="uppercase text-center" mat-header-cell mat-sort-header
8
+ [disabled]="column.sort === false">
9
+ <span [innerHTML]="column.label ?? ''">{{ column.label }} </span>
10
+ </th>
11
+
12
+ <!-- Cuerpo de la celda, definido por los hijos -->
13
+ <td *matCellDef="let row" [ngClass]="column.cssClasses" mat-cell (click)="accionClick(row, $event)">
14
+
15
+ <ng-container [ngTemplateOutlet]="cellTemplate" [ngTemplateOutletContext]="{row}"></ng-container>
16
+
17
+ </td>
18
+
19
+ <th *matFooterCellDef [ngClass]="column.cssFooterClasses" mat-footer-cell>
20
+ {{ column.transformarFooter ? column.transformarFooter() : '' }}
21
+ </th>
22
+ </ng-container>
@@ -0,0 +1,12 @@
1
+ import {Component, Input} from '@angular/core';
2
+ import {ColumnaDate} from '../../../interfaces';
3
+ import {ColumnTypeComponent} from '../column-type.component';
4
+
5
+ @Component({
6
+ selector: 'jvs-column-type-date',
7
+ standalone: false,
8
+ templateUrl: './column-type-date.component.html'
9
+ })
10
+ export class ColumnTypeDateComponent<T> extends ColumnTypeComponent<T> {
11
+ @Input({required: true}) override column: ColumnaDate<T> = {} as ColumnaDate<T>;
12
+ }
@@ -0,0 +1,58 @@
1
+ <ng-template #cellTemplate let-row="row">
2
+ <div class="flex items-center justify-center" [ngClass]="{ '-space-x-1': !column.iconsDef?.soloIcono }"
3
+ >
4
+ <ng-container *ngFor="let icon of obtenerItems(column.iconsDef, row)">
5
+ <ng-container *ngIf="!column.iconsDef?.soloIcono; else soloIcono">
6
+ <button matRipple type="button" *ngIf="!icon.esVisible || icon.esVisible(row)"
7
+ (click)="icon.click ? icon.click(row) : false; $event.stopPropagation()"
8
+ class="flex items-center justify-center p-1 rounded border shadow-sm hover:shadow-lg"
9
+ [ngClass]="icon.contentCss"
10
+ [matTooltip]="icon.toolTip ?? row[icon.toolTipField ?? '_field_']"
11
+ [matTooltipDisabled]="!icon.toolTip && !icon.toolTipField"
12
+ >
13
+ <ng-container [ngTemplateOutlet]="iconoConTamanio"
14
+ [ngTemplateOutletContext]="{icon: icon.icon, iconClass: icon.cssClass, size: (icon.iconSize ?? column.iconsDef?.iconSize)}"></ng-container>
15
+ </button>
16
+ </ng-container>
17
+ <ng-template #soloIcono>
18
+ <div *ngIf="!icon.esVisible || icon.esVisible(row)" [ngClass]="icon.contentCss"
19
+ class="flex items-center"
20
+ [matTooltip]="icon.toolTip ?? row[icon.toolTipField ?? '_field_']"
21
+ [matTooltipDisabled]="!icon.toolTip && !icon.toolTipField"
22
+ >
23
+ <ng-container [ngTemplateOutlet]="iconoConTamanio"
24
+ [ngTemplateOutletContext]="{icon: icon.icon, iconClass: icon.cssClass, size: (icon.iconSize ?? column.iconsDef?.iconSize)}"></ng-container>
25
+ </div>
26
+ </ng-template>
27
+ </ng-container>
28
+ </div>
29
+ </ng-template>
30
+
31
+ <ng-container matColumnDef="{{ column.property }}">
32
+ <!-- Definición del encabezado de la columna -->
33
+ <th *matHeaderCellDef [ngClass]="column.cssClassesTH" class="uppercase text-center" mat-header-cell mat-sort-header
34
+ [disabled]="column.sort === false">
35
+ <span [innerHTML]="column.label ?? ''">{{ column.label }} </span>
36
+ </th>
37
+
38
+ <!-- Cuerpo de la celda, definido por los hijos -->
39
+ <td *matCellDef="let row" [ngClass]="column.cssClasses" mat-cell (click)="accionClick(row, $event)">
40
+
41
+ <ng-container [ngTemplateOutlet]="cellTemplate" [ngTemplateOutletContext]="{row}"></ng-container>
42
+
43
+ </td>
44
+
45
+ <th *matFooterCellDef [ngClass]="column.cssFooterClasses" mat-footer-cell>
46
+ {{ column.transformarFooter ? column.transformarFooter() : '' }}
47
+ </th>
48
+ </ng-container>
49
+
50
+
51
+ <ng-template #iconoConTamanio let-icon="icon" let-iconClass="iconClass" let-size="size">
52
+ <mat-icon *ngIf="size" [svgIcon]="icon" [ngClass]="iconClass" [inline]="true"
53
+ [style.font-size]="size"
54
+ [style.height]="size"
55
+ [style.width]="size"
56
+ ></mat-icon>
57
+ <mat-icon *ngIf="!size" [svgIcon]="icon" [ngClass]="iconClass"></mat-icon>
58
+ </ng-template>
@@ -0,0 +1,19 @@
1
+ import {Component, Input} from '@angular/core';
2
+ import {ColumnaIcons, IconsIcon} from '../../../interfaces';
3
+ import {ColumnTypeComponent} from '../column-type.component';
4
+
5
+ @Component({
6
+ selector: 'jvs-column-type-icons',
7
+ standalone: false,
8
+ templateUrl: './column-type-icons.component.html'
9
+ })
10
+ export class ColumnTypeIconsComponent<T> extends ColumnTypeComponent<T> {
11
+ @Input({required: true}) override column: ColumnaIcons<T> = {} as ColumnaIcons<T>;
12
+
13
+ obtenerItems(columna: any, row: any): IconsIcon[] {
14
+ if (typeof columna.items === 'function') {
15
+ return columna.items(row);
16
+ }
17
+ return columna.items;
18
+ }
19
+ }
@@ -0,0 +1,40 @@
1
+ <ng-template #cellTemplate let-row="row">
2
+ <span [ngClass]="column.textCss"
3
+ [class.text-sky-700]="(value(row)) >= 0" [class.text-red-700]="(value(row)) < 0"
4
+ *ngIf="value(row)"
5
+ (click)="accionClick(row, $event)">{{ value(row) | number: (column.format || '1.2-2') }}</span>
6
+ </ng-template>
7
+ <ng-template #columnFooterTemplate let-row="row">
8
+ <span *ngIf="column.transformarFooter"
9
+ [class.text-sky-700]="column.transformarFooter() >= 0"
10
+ [class.text-red-700]="column.transformarFooter() < 0"
11
+ >
12
+ <span>{{ column.transformarFooter() | currency: column.simboloMoneda ?? 'S/' }}</span>
13
+ </span>
14
+ </ng-template>
15
+
16
+ <!--<jvs-column-type [column]="column" [cellTemplate]="cellTemplate" [columnFooterTemplate]="columnFooterTemplate"></jvs-column-type>-->
17
+
18
+ <ng-container matColumnDef="{{ column.property }}">
19
+ <!-- Definición del encabezado de la columna -->
20
+ <th *matHeaderCellDef [ngClass]="column.cssClassesTH" class="uppercase text-center" mat-header-cell mat-sort-header
21
+ [disabled]="column.sort === false">
22
+ <span [innerHTML]="column.label ?? ''">{{ column.label }} </span>
23
+ </th>
24
+
25
+ <!-- Cuerpo de la celda, definido por los hijos -->
26
+ <td *matCellDef="let row" [ngClass]="column.cssClasses" mat-cell (click)="accionClick(row, $event)">
27
+
28
+ <ng-container [ngTemplateOutlet]="cellTemplate" [ngTemplateOutletContext]="{row}"></ng-container>
29
+
30
+ </td>
31
+
32
+ <th *matFooterCellDef [ngClass]="column.cssFooterClasses" mat-footer-cell>
33
+ <span *ngIf="column.transformarFooter"
34
+ [class.text-sky-700]="column.transformarFooter() >= 0"
35
+ [class.text-red-700]="column.transformarFooter() < 0"
36
+ >
37
+ <span>{{ column.transformarFooter() | currency: column.simboloMoneda ?? 'S/' }}</span>
38
+ </span>
39
+ </th>
40
+ </ng-container>
@@ -0,0 +1,17 @@
1
+ import {Component, Input} from '@angular/core';
2
+ import {ColumnaMoney} from '../../../interfaces';
3
+ import {ColumnTypeComponent} from '../column-type.component';
4
+
5
+ @Component({
6
+ selector: 'jvs-column-type-money',
7
+ templateUrl: './column-type-money.component.html',
8
+ standalone: false,
9
+ })
10
+ export class ColumnTypeMoneyComponent<T> extends ColumnTypeComponent<T> {
11
+ @Input({required: true}) override column: ColumnaMoney<T> = {} as ColumnaMoney<T>;
12
+
13
+
14
+ value(row: any): number {
15
+ return (this.column.transformar ? this.column.transformar(row):row[this.column.property]);
16
+ }
17
+ }
@@ -0,0 +1,25 @@
1
+
2
+ <ng-template #cellTemplate let-row="row">
3
+ <span *ngIf="column.property && row[column.property]" class="!text-indigo-900 font-semibold">
4
+ {{ row[column.property] | number: (column.format ? column.format : '1.0-2') }}
5
+ </span>
6
+ </ng-template>
7
+
8
+ <ng-container matColumnDef="{{ column.property }}">
9
+ <!-- Definición del encabezado de la columna -->
10
+ <th *matHeaderCellDef [ngClass]="column.cssClassesTH" class="uppercase text-center" mat-header-cell mat-sort-header
11
+ [disabled]="column.sort === false">
12
+ <span [innerHTML]="column.label ?? ''">{{ column.label }} </span>
13
+ </th>
14
+
15
+ <!-- Cuerpo de la celda, definido por los hijos -->
16
+ <td *matCellDef="let row" [ngClass]="column.cssClasses" mat-cell (click)="accionClick(row, $event)">
17
+
18
+ <ng-container [ngTemplateOutlet]="cellTemplate" [ngTemplateOutletContext]="{row}"></ng-container>
19
+
20
+ </td>
21
+
22
+ <th *matFooterCellDef [ngClass]="column.cssFooterClasses" mat-footer-cell>
23
+ {{ column.transformarFooter ? column.transformarFooter() : '' }}
24
+ </th>
25
+ </ng-container>
@@ -0,0 +1,14 @@
1
+ import {Component, Input} from '@angular/core';
2
+ import {ColumnaNumber} from '../../../interfaces';
3
+ import {ColumnTypeComponent} from '../column-type.component';
4
+
5
+
6
+ @Component({
7
+ selector: 'jvs-column-type-number',
8
+ standalone: false,
9
+ templateUrl: './column-type-number.component.html'
10
+ })
11
+ export class ColumnTypeNumberComponent<T> extends ColumnTypeComponent<T> {
12
+ @Input({required: true}) override column: ColumnaNumber<T> = {} as ColumnaNumber<T>;
13
+
14
+ }