@jvsoft/components 0.0.9 → 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.
- package/CHANGELOG.md +9 -0
- package/build.js +20 -0
- package/dialog-flotante/dialog-flotante.component.html +66 -0
- package/dialog-flotante/dialog-flotante.component.ts +115 -0
- package/dialog-flotante/dialog-flotante.interface.ts +13 -0
- package/dialog-flotante/index.ts +1 -0
- package/dialog-flotante/ng-package.json +5 -0
- package/{index.d.ts → index.ts} +8 -0
- package/lista-arbol/lista-arbol.component.html +66 -0
- package/lista-arbol/lista-arbol.component.ts +238 -0
- package/lista-arbol/lista-arbol.functions.ts +46 -0
- package/lista-arbol/ng-package.json +5 -0
- package/lista-arbol/public-api.ts +1 -0
- package/luces-navidad/christmas-tree.png +0 -0
- package/luces-navidad/index.ts +1 -0
- package/luces-navidad/luces-navidad.component.html +6 -0
- package/luces-navidad/luces-navidad.component.ts +24 -0
- package/luces-navidad/ng-package.json +5 -0
- package/mat-suffix-search-button/index.ts +1 -0
- package/mat-suffix-search-button/mat-suffix-search-button.component.html +5 -0
- package/mat-suffix-search-button/mat-suffix-search-button.component.ts +36 -0
- package/mat-suffix-search-button/ng-package.json +5 -0
- package/menu/index.ts +1 -0
- package/menu/menu.component.html +40 -0
- package/menu/menu.component.ts +88 -0
- package/menu/menu.interface.ts +16 -0
- package/menu/ng-package.json +5 -0
- package/ng-package.json +17 -0
- package/package.json +15 -36
- package/progress-spinner.zip +0 -0
- package/tabla-mantenimiento/classes/data-model.ts +150 -0
- package/tabla-mantenimiento/components/progress-bar/index.ts +1 -0
- package/tabla-mantenimiento/components/progress-bar/ng-package.json +5 -0
- package/tabla-mantenimiento/components/progress-bar/progress-bar.component.html +10 -0
- package/tabla-mantenimiento/components/progress-bar/progress-bar.component.ts +85 -0
- package/tabla-mantenimiento/components/progress-bar/public-api.ts +2 -0
- package/tabla-mantenimiento/index.ts +1 -0
- package/tabla-mantenimiento/interfaces/{archivo.d.ts → archivo.ts} +7 -4
- package/tabla-mantenimiento/interfaces/global/{boton-mantenimiento.d.ts → boton-mantenimiento.ts} +9 -3
- package/tabla-mantenimiento/interfaces/global/{columnas-tabla.d.ts → columnas-tabla.ts} +90 -13
- package/tabla-mantenimiento/interfaces/global/export-excel-servidor.ts +0 -0
- package/tabla-mantenimiento/interfaces/global/no-export.ts +11 -0
- package/tabla-mantenimiento/interfaces/global/{otros.d.ts → otros.ts} +15 -3
- package/tabla-mantenimiento/interfaces/implements/{incluye-tabla-mantenimiento.d.ts → incluye-tabla-mantenimiento.ts} +6 -4
- package/tabla-mantenimiento/interfaces/implements/{index.d.ts → index.ts} +1 -0
- package/tabla-mantenimiento/mat-row-keyboard-selection.directive.ts +97 -0
- package/tabla-mantenimiento/ng-package.json +5 -0
- package/tabla-mantenimiento/pipes/no-sanitize.pipe.ts +12 -0
- package/tabla-mantenimiento/pipes/zero-fill.pipe.ts +19 -0
- package/tabla-mantenimiento/{public-api.d.ts → public-api.ts} +3 -2
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.html +22 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.ts +12 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.html +58 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.ts +19 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.html +40 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.ts +17 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.html +25 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.ts +14 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.html +28 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.ts +13 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.html +30 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.ts +38 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.html +97 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.ts +43 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.html +26 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.ts +36 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.ts +54 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.html +76 -0
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.ts +67 -0
- package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.html +7 -0
- package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.ts +39 -0
- package/tabla-mantenimiento/tabla-mantenimiento.component.html +385 -0
- package/tabla-mantenimiento/tabla-mantenimiento.component.ts +951 -0
- package/tabla-mantenimiento/tabla-mantenimiento.functions.ts +57 -0
- package/tabla-mantenimiento/tabla-mantenimiento.service.ts +44 -0
- package/tabla-mantenimiento/table-util.ts +49 -0
- package/tabla-mantenimiento.zip +0 -0
- package/tsconfig.lib.json +16 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/yarn-error.log +68 -0
- package/dialog-flotante/dialog-flotante.component.d.ts +0 -32
- package/dialog-flotante/dialog-flotante.interface.d.ts +0 -11
- package/dialog-flotante/index.d.ts +0 -5
- package/fesm2022/jvsoft-components-dialog-flotante.mjs +0 -130
- package/fesm2022/jvsoft-components-dialog-flotante.mjs.map +0 -1
- package/fesm2022/jvsoft-components-luces-navidad.mjs +0 -33
- package/fesm2022/jvsoft-components-luces-navidad.mjs.map +0 -1
- package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs +0 -47
- package/fesm2022/jvsoft-components-mat-suffix-search-button.mjs.map +0 -1
- package/fesm2022/jvsoft-components-menu.mjs +0 -102
- package/fesm2022/jvsoft-components-menu.mjs.map +0 -1
- package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs +0 -91
- package/fesm2022/jvsoft-components-tabla-mantenimiento-components-progress-bar.mjs.map +0 -1
- package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs +0 -1801
- package/fesm2022/jvsoft-components-tabla-mantenimiento.mjs.map +0 -1
- package/fesm2022/jvsoft-components.mjs +0 -2061
- package/fesm2022/jvsoft-components.mjs.map +0 -1
- package/luces-navidad/index.d.ts +0 -5
- package/luces-navidad/luces-navidad.component.d.ts +0 -11
- package/mat-suffix-search-button/index.d.ts +0 -5
- package/mat-suffix-search-button/mat-suffix-search-button.component.d.ts +0 -12
- package/menu/index.d.ts +0 -5
- package/menu/menu.component.d.ts +0 -25
- package/menu/menu.interface.d.ts +0 -16
- package/src/styles/base-jvsoft-components.css +0 -9
- package/tabla-mantenimiento/classes/data-model.d.ts +0 -25
- package/tabla-mantenimiento/components/progress-bar/index.d.ts +0 -5
- package/tabla-mantenimiento/components/progress-bar/progress-bar.component.d.ts +0 -30
- package/tabla-mantenimiento/components/progress-bar/public-api.d.ts +0 -1
- package/tabla-mantenimiento/index.d.ts +0 -5
- package/tabla-mantenimiento/interfaces/global/no-export.d.ts +0 -2
- package/tabla-mantenimiento/mat-row-keyboard-selection.directive.d.ts +0 -19
- package/tabla-mantenimiento/pipes/no-sanitize.pipe.d.ts +0 -10
- package/tabla-mantenimiento/pipes/zero-fill.pipe.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-date/column-type-date.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-icons/column-type-icons.component.d.ts +0 -9
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-money/column-type-money.component.d.ts +0 -9
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-number/column-type-number.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-progressbar/column-type-progressbar.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-sino/column-type-sino.component.d.ts +0 -9
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type-text/column-type-text.component.d.ts +0 -8
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.component.d.ts +0 -18
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/column-type/column-type.module.d.ts +0 -23
- package/tabla-mantenimiento/tabla-mantenimiento-column-defs/tabla-mantenimiento-column-defs.component.d.ts +0 -21
- package/tabla-mantenimiento/tabla-mantenimiento-menu/tabla-mantenimiento-menu.component.d.ts +0 -18
- package/tabla-mantenimiento/tabla-mantenimiento.component.d.ts +0 -147
- package/tabla-mantenimiento/tabla-mantenimiento.functions.d.ts +0 -5
- package/tabla-mantenimiento/tabla-mantenimiento.service.d.ts +0 -8
- package/tabla-mantenimiento/table-util.d.ts +0 -11
- /package/dialog-flotante/{public-api.d.ts → public-api.ts} +0 -0
- /package/luces-navidad/{public-api.d.ts → public-api.ts} +0 -0
- /package/mat-suffix-search-button/{public-api.d.ts → public-api.ts} +0 -0
- /package/menu/{public-api.d.ts → public-api.ts} +0 -0
- /package/tabla-mantenimiento/interfaces/global/{index.d.ts → index.ts} +0 -0
- /package/tabla-mantenimiento/interfaces/{index.d.ts → index.ts} +0 -0
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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 {};
|
|
File without changes
|
|
@@ -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 {
|
|
2
|
-
import {
|
|
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
|
-
|
|
35
|
+
|
|
36
|
+
export interface OpcMenuEvent extends OpcionSeleccionada{
|
|
25
37
|
datosGuardados?: any;
|
|
26
38
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
7
|
-
|
|
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;
|
|
@@ -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,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
|
+
}
|
|
@@ -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
|
+
}
|