@jvsoft/utils 0.0.13-alpha.6 → 1.0.0-alpha.5
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/fesm2022/jvsoft-utils-src-functions.mjs +445 -188
- package/fesm2022/jvsoft-utils-src-functions.mjs.map +1 -1
- package/fesm2022/jvsoft-utils-src-pipes.mjs +24 -24
- package/fesm2022/jvsoft-utils-src-pipes.mjs.map +1 -1
- package/fesm2022/jvsoft-utils.mjs +469 -212
- package/fesm2022/jvsoft-utils.mjs.map +1 -1
- package/functions/base64.d.ts +63 -0
- package/functions/dev-log.d.ts +97 -0
- package/functions/mat-form-controls/autocomplete.d.ts +29 -32
- package/functions/objects-arrays.d.ts +13 -97
- package/functions/public-api.d.ts +1 -0
- package/package.json +9 -2
- package/src/functions/base64.d.ts +63 -0
- package/src/functions/dev-log.d.ts +97 -0
- package/src/functions/mat-form-controls/autocomplete.d.ts +29 -32
- package/src/functions/objects-arrays.d.ts +13 -97
- package/src/functions/public-api.d.ts +1 -0
|
@@ -14,14 +14,6 @@ import * as i0 from '@angular/core';
|
|
|
14
14
|
import { Pipe } from '@angular/core';
|
|
15
15
|
import * as i1 from '@angular/platform-browser';
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Realiza una fusión profunda entre dos objetos, sin modificar el original.
|
|
19
|
-
* Si el valor en target no es un objeto, lo reemplaza directamente.
|
|
20
|
-
*
|
|
21
|
-
* @param source - Objeto fuente que se clonará y fusionará.
|
|
22
|
-
* @param target - Objeto destino cuyos valores se fusionarán.
|
|
23
|
-
* @returns Un nuevo objeto con la fusión profunda.
|
|
24
|
-
*/
|
|
25
17
|
function deepMerge(source, target) {
|
|
26
18
|
// Crea un clon profundo sin usar JSON.parse(JSON.stringify)
|
|
27
19
|
let cloneSource = deepClone(source);
|
|
@@ -43,12 +35,7 @@ function deepMerge(source, target) {
|
|
|
43
35
|
}
|
|
44
36
|
return cloneSource; // Retorna el clon y no modifica el original
|
|
45
37
|
}
|
|
46
|
-
|
|
47
|
-
* Realiza una clonación profunda de un objeto, manejando funciones, fechas y arrays.
|
|
48
|
-
*
|
|
49
|
-
* @param obj - Objeto a clonar.
|
|
50
|
-
* @returns Una copia profunda del objeto.
|
|
51
|
-
*/
|
|
38
|
+
// Función de clonación profunda que maneja funciones, fechas y otros tipos especiales
|
|
52
39
|
function deepClone(obj) {
|
|
53
40
|
if (obj === null || typeof obj !== 'object') {
|
|
54
41
|
return obj; // Devuelve el valor si no es un objeto
|
|
@@ -74,7 +61,6 @@ function deepClone(obj) {
|
|
|
74
61
|
/**
|
|
75
62
|
* Busca un elemento en un array o jerarquía de objetos según un campo y valor especificado.
|
|
76
63
|
*
|
|
77
|
-
* @param datosFn - Objeto con los parámetros de búsqueda: items, campo, valor y opcionalmente campoHijo.
|
|
78
64
|
* @returns El elemento encontrado o undefined si no existe.
|
|
79
65
|
*/
|
|
80
66
|
function buscarPorCampo(datosFn) {
|
|
@@ -101,33 +87,13 @@ function buscarPorCampo(datosFn) {
|
|
|
101
87
|
// Si no se encuentra nada, retorna undefined
|
|
102
88
|
return undefined;
|
|
103
89
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Suma los valores de las propiedades especificadas de un objeto.
|
|
106
|
-
*
|
|
107
|
-
* @param item - Objeto con las propiedades a sumar.
|
|
108
|
-
* @param campos - Array de nombres de las propiedades a sumar.
|
|
109
|
-
* @returns La suma de los valores de las propiedades.
|
|
110
|
-
*/
|
|
111
90
|
function sumarPropiedades(item, campos) {
|
|
112
91
|
const datosSumar = campos.map(campo => (item[campo] * 1));
|
|
113
92
|
return datosSumar.reduce((a, b) => a + b, 0);
|
|
114
93
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Verifica si el valor proporcionado es un número válido.
|
|
117
|
-
*
|
|
118
|
-
* @param value - Valor a verificar.
|
|
119
|
-
* @returns true si es un número, false en caso contrario.
|
|
120
|
-
*/
|
|
121
94
|
function esNumero(value) {
|
|
122
95
|
return !isNaN(Number(value));
|
|
123
96
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Suma los valores de las propiedades especificadas en un array de objetos.
|
|
126
|
-
*
|
|
127
|
-
* @param arrayObjetos - Array de objetos a procesar.
|
|
128
|
-
* @param campos - Array de nombres de las propiedades a sumar.
|
|
129
|
-
* @returns Objeto con la suma de cada propiedad.
|
|
130
|
-
*/
|
|
131
97
|
function sumarObjetos(arrayObjetos, campos) {
|
|
132
98
|
return arrayObjetos.reduce((accumulator, item) => {
|
|
133
99
|
campos.forEach(campo => {
|
|
@@ -139,22 +105,9 @@ function sumarObjetos(arrayObjetos, campos) {
|
|
|
139
105
|
return accumulator;
|
|
140
106
|
}, {});
|
|
141
107
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Obtiene los valores únicos de un array.
|
|
144
|
-
*
|
|
145
|
-
* @param array - Array de valores.
|
|
146
|
-
* @returns Array con los valores únicos.
|
|
147
|
-
*/
|
|
148
108
|
function getUniqueValues(array) {
|
|
149
109
|
return array.filter((currentValue, index, arr) => (arr.indexOf(currentValue) === index));
|
|
150
110
|
}
|
|
151
|
-
/**
|
|
152
|
-
* Obtiene los objetos únicos de un array según una propiedad específica.
|
|
153
|
-
*
|
|
154
|
-
* @param objetos - Array de objetos.
|
|
155
|
-
* @param campo - Nombre de la propiedad para determinar unicidad.
|
|
156
|
-
* @returns Array de objetos únicos por la propiedad.
|
|
157
|
-
*/
|
|
158
111
|
function getUniqueValuesByProperty(objetos, campo) {
|
|
159
112
|
const objetosUnicos = {};
|
|
160
113
|
objetos.forEach(objeto => {
|
|
@@ -170,14 +123,6 @@ function getUniqueValuesByProperty(objetos, campo) {
|
|
|
170
123
|
// Convertir el objeto de claves únicas de vuelta a una lista de objetos
|
|
171
124
|
return Object.values(objetosUnicos);
|
|
172
125
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Ordena un array de valores numéricos o alfabéticos.
|
|
175
|
-
*
|
|
176
|
-
* @param array - Array a ordenar.
|
|
177
|
-
* @param numeros - Si es true, ordena como números.
|
|
178
|
-
* @param sentido - 'ASC' para ascendente, 'DESC' para descendente.
|
|
179
|
-
* @returns Array ordenado.
|
|
180
|
-
*/
|
|
181
126
|
function ordenarArray(array, numeros = false, sentido = 'ASC') {
|
|
182
127
|
if (numeros) {
|
|
183
128
|
if (sentido != 'ASC') {
|
|
@@ -187,24 +132,9 @@ function ordenarArray(array, numeros = false, sentido = 'ASC') {
|
|
|
187
132
|
}
|
|
188
133
|
return array.sort((a, b) => (a > b) ? 1 : ((b > a) ? -1 : 0));
|
|
189
134
|
}
|
|
190
|
-
/**
|
|
191
|
-
* Ordena un array de objetos por una propiedad específica.
|
|
192
|
-
*
|
|
193
|
-
* @param objData - Array de objetos a ordenar.
|
|
194
|
-
* @param propiedad - Propiedad por la que se ordena.
|
|
195
|
-
* @param numeros - (Obsoleto) Si es true, ordena como números.
|
|
196
|
-
* @returns Array ordenado.
|
|
197
|
-
*/
|
|
198
135
|
function ordenarPorPropiedad(objData, propiedad, /**@deprecated*/ numeros = false) {
|
|
199
136
|
return ordenarPorPropiedades(objData, { propiedades: [propiedad], direcciones: ['asc'] });
|
|
200
137
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Ordena un array de objetos por varias propiedades y direcciones.
|
|
203
|
-
*
|
|
204
|
-
* @param arr - Array de objetos a ordenar.
|
|
205
|
-
* @param options - Opciones con propiedades y direcciones de orden.
|
|
206
|
-
* @returns Array ordenado.
|
|
207
|
-
*/
|
|
208
138
|
function ordenarPorPropiedades(arr, options) {
|
|
209
139
|
const { propiedades, direcciones = [] } = options;
|
|
210
140
|
const orden = direcciones.map(d => d === 'desc' ? -1 : 1);
|
|
@@ -224,13 +154,6 @@ function ordenarPorPropiedades(arr, options) {
|
|
|
224
154
|
}, 0);
|
|
225
155
|
});
|
|
226
156
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Agrupa los elementos de un array según una clave o función de clave.
|
|
229
|
-
*
|
|
230
|
-
* @param array - Array de objetos a agrupar.
|
|
231
|
-
* @param key - Propiedad o función para agrupar.
|
|
232
|
-
* @returns Objeto con los grupos por clave.
|
|
233
|
-
*/
|
|
234
157
|
function groupBy(array, key) {
|
|
235
158
|
const keyFn = key instanceof Function ? key : (obj) => obj[key];
|
|
236
159
|
return array.reduce((objectsByKeyValue, obj) => {
|
|
@@ -239,13 +162,6 @@ function groupBy(array, key) {
|
|
|
239
162
|
return objectsByKeyValue;
|
|
240
163
|
}, {});
|
|
241
164
|
}
|
|
242
|
-
/**
|
|
243
|
-
* Agrupa y anida los elementos de un array según una lista de propiedades.
|
|
244
|
-
*
|
|
245
|
-
* @param arr - Array de objetos a agrupar.
|
|
246
|
-
* @param properties - Propiedades para agrupar de forma anidada.
|
|
247
|
-
* @returns Objeto anidado por los grupos de propiedades.
|
|
248
|
-
*/
|
|
249
165
|
function nestGroupsBy(arr, properties) {
|
|
250
166
|
const fnGroupBy = (conversions, property2) => {
|
|
251
167
|
return conversions.reduce((acc, obj) => {
|
|
@@ -319,13 +235,6 @@ function eliminarColumnaPorIndex(data, columnIndex) {
|
|
|
319
235
|
return newRow;
|
|
320
236
|
});
|
|
321
237
|
}
|
|
322
|
-
/**
|
|
323
|
-
* Elimina elementos duplicados de un array de objetos según claves específicas.
|
|
324
|
-
*
|
|
325
|
-
* @param array - Array de objetos.
|
|
326
|
-
* @param claves - Claves para determinar unicidad. Si no se especifica, compara todo el objeto.
|
|
327
|
-
* @returns Array sin duplicados.
|
|
328
|
-
*/
|
|
329
238
|
function eliminarDuplicados(array, claves) {
|
|
330
239
|
const unicos = new Map();
|
|
331
240
|
for (const item of array) {
|
|
@@ -338,14 +247,6 @@ function eliminarDuplicados(array, claves) {
|
|
|
338
247
|
}
|
|
339
248
|
return Array.from(unicos.values());
|
|
340
249
|
}
|
|
341
|
-
/**
|
|
342
|
-
* Elimina elementos de un array origen que estén presentes en otro array, según claves específicas.
|
|
343
|
-
*
|
|
344
|
-
* @param origen - Array original.
|
|
345
|
-
* @param elementosAEliminar - Elementos a eliminar del array origen.
|
|
346
|
-
* @param claves - Claves para comparar los objetos. Si no se especifica, compara todo el objeto.
|
|
347
|
-
* @returns Array filtrado sin los elementos eliminados.
|
|
348
|
-
*/
|
|
349
250
|
function eliminarElementos(origen, elementosAEliminar, claves) {
|
|
350
251
|
const clavesSet = new Set();
|
|
351
252
|
for (const item of elementosAEliminar) {
|
|
@@ -361,41 +262,12 @@ function eliminarElementos(origen, elementosAEliminar, claves) {
|
|
|
361
262
|
return !clavesSet.has(key);
|
|
362
263
|
});
|
|
363
264
|
}
|
|
364
|
-
|
|
365
265
|
/**
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
if (!lista)
|
|
372
|
-
return null;
|
|
373
|
-
if (campos.campoId === '*object*' || campos.campoId === '*objeto*') {
|
|
374
|
-
return lista.find((x) => JSON.stringify(x).trim() === JSON.stringify(idxSel).trim());
|
|
375
|
-
}
|
|
376
|
-
return lista.find((x) => x[campos.campoId] === idxSel);
|
|
377
|
-
};
|
|
378
|
-
const impDataMostrar = () => {
|
|
379
|
-
let vD = buscarEnLista(campos.lista) || (campos.opcExtra && buscarEnLista(campos.opcExtra));
|
|
380
|
-
if (!vD)
|
|
381
|
-
return '';
|
|
382
|
-
if (Array.isArray(campos.campoValue)) {
|
|
383
|
-
return campos.campoValue.map((vCampo) => vD[vCampo] ?? '').join(' - ').trim();
|
|
384
|
-
}
|
|
385
|
-
return (vD[campos.campoValue] ?? '').trim();
|
|
386
|
-
};
|
|
387
|
-
if (esNumero(idxSel)) {
|
|
388
|
-
if ((idxSel > 0 && campos.lista?.length) || (idxSel && typeof idxSel === 'object')) {
|
|
389
|
-
return impDataMostrar();
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
else if (campos.lista?.length) {
|
|
393
|
-
return impDataMostrar();
|
|
394
|
-
}
|
|
395
|
-
return '';
|
|
396
|
-
}
|
|
397
|
-
/**
|
|
398
|
-
* Filtra datos locales de un array basado en un valor de búsqueda.
|
|
266
|
+
* Filtra datos localmente según un valor de búsqueda
|
|
267
|
+
* @param data - Array de datos a filtrar
|
|
268
|
+
* @param value - Valor de búsqueda
|
|
269
|
+
* @param campoBuscar - Campo(s) por el cual buscar
|
|
270
|
+
* @returns Array filtrado
|
|
399
271
|
*/
|
|
400
272
|
function filtrarDatosLocal(data, value, campoBuscar) {
|
|
401
273
|
if (!value)
|
|
@@ -414,24 +286,242 @@ function filtrarDatosLocal(data, value, campoBuscar) {
|
|
|
414
286
|
});
|
|
415
287
|
});
|
|
416
288
|
}
|
|
289
|
+
|
|
290
|
+
function mostrarValorEnBusqueda(campos, idxSel) {
|
|
291
|
+
const impDataMostrar = () => {
|
|
292
|
+
let vD;
|
|
293
|
+
if (campos.campoId == '*object*' || campos.campoId == '*objeto*') {
|
|
294
|
+
console.log(campos);
|
|
295
|
+
vD = campos.lista.find((x) => JSON.stringify(x).trim() == JSON.stringify(idxSel).trim());
|
|
296
|
+
console.log(vD);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
vD = campos.lista.find((x) => x[campos.campoId] == idxSel);
|
|
300
|
+
}
|
|
301
|
+
if (!vD && campos.opcExtra) {
|
|
302
|
+
console.log('eval ', campos.opcExtra);
|
|
303
|
+
if (campos.campoId == '*object*' || campos.campoId == '*objeto*') {
|
|
304
|
+
console.log(campos);
|
|
305
|
+
vD = campos.opcExtra.find((x) => JSON.stringify(x).trim() == JSON.stringify(idxSel).trim());
|
|
306
|
+
console.log(vD);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
vD = campos.opcExtra.find((x) => x[campos.campoId] == idxSel);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (vD) {
|
|
313
|
+
let txtFinal = '';
|
|
314
|
+
if (Array.isArray(campos.campoValue)) {
|
|
315
|
+
campos.campoValue.forEach((vCampo, idx) => {
|
|
316
|
+
txtFinal += (vD[vCampo] ?? '');
|
|
317
|
+
if (idx < campos.campoValue.length - 1) {
|
|
318
|
+
txtFinal += ' - ';
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
txtFinal = vD[campos.campoValue] ?? '';
|
|
324
|
+
}
|
|
325
|
+
return txtFinal.trim();
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
console.log('ASSSSS ----- SSSS ');
|
|
329
|
+
}
|
|
330
|
+
return '';
|
|
331
|
+
};
|
|
332
|
+
if (esNumero(idxSel)) {
|
|
333
|
+
if (idxSel > 0 && campos.lista?.length > 0) {
|
|
334
|
+
return impDataMostrar();
|
|
335
|
+
}
|
|
336
|
+
else if (idxSel && typeof idxSel == 'object') {
|
|
337
|
+
return impDataMostrar();
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
if (campos.lista?.length > 0) {
|
|
342
|
+
return impDataMostrar();
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return '';
|
|
346
|
+
}
|
|
347
|
+
function changeSelectData(objThis, dataFiltro) {
|
|
348
|
+
objThis['filtrados'][dataFiltro.variableResultado] = dataFiltro.formControl.valueChanges.pipe(untilDestroyed(objThis)).pipe(startWith(''), map(value => {
|
|
349
|
+
const varN = dataFiltro.data;
|
|
350
|
+
if (varN) {
|
|
351
|
+
if (value) {
|
|
352
|
+
return varN.map(x => x).filter(dat => {
|
|
353
|
+
if (Array.isArray(dataFiltro.campoBuscar)) {
|
|
354
|
+
let encontrado = false;
|
|
355
|
+
for (const vCampo of dataFiltro.campoBuscar) {
|
|
356
|
+
// console.log(vCampo, value, dat[vCampo]);
|
|
357
|
+
if (isNaN(Number(value))) {
|
|
358
|
+
// NO ES NUMERO
|
|
359
|
+
if (value && dat[vCampo] && dat[vCampo].toLowerCase().includes(value?.toString().toLowerCase())) {
|
|
360
|
+
encontrado = true;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
if (value && dat[vCampo] && dat[vCampo].toString().includes(value?.toString())) {
|
|
366
|
+
encontrado = true;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
return encontrado;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
if (isNaN(Number(value))) {
|
|
375
|
+
return dat[dataFiltro.campoBuscar].toLowerCase().includes(value?.toString().toLowerCase());
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
return dat[dataFiltro.campoBuscar].toString().includes(value?.toString());
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return varN;
|
|
384
|
+
}
|
|
385
|
+
return false;
|
|
386
|
+
}));
|
|
387
|
+
}
|
|
388
|
+
function changeSelect(control, formControl, tipo, campoBuscar, campoFiltro = null) {
|
|
389
|
+
// console.log(formControl);
|
|
390
|
+
// const formGroup = formControl.parent.controls;
|
|
391
|
+
// console.warn( Object.keys(formGroup).find(name => formControl === formGroup[name]) || null );
|
|
392
|
+
if (!campoFiltro) {
|
|
393
|
+
campoFiltro = tipo;
|
|
394
|
+
}
|
|
395
|
+
control['filtrados'][campoFiltro ?? '__'] = formControl.valueChanges.pipe(untilDestroyed(control)).pipe(startWith(''), map(value => {
|
|
396
|
+
// console.warn(value);
|
|
397
|
+
const partes = tipo.split('.');
|
|
398
|
+
let varN;
|
|
399
|
+
if (control['dataServidor']) {
|
|
400
|
+
varN = (partes.length > 1) ? control['dataServidor'][partes[0]][partes[1]] : control['dataServidor'][tipo];
|
|
401
|
+
}
|
|
402
|
+
else if (control['dataServidorSuscripcion']) {
|
|
403
|
+
varN = control['dataServidorSuscripcion'][tipo].getValue();
|
|
404
|
+
}
|
|
405
|
+
if (varN) {
|
|
406
|
+
if (value) {
|
|
407
|
+
return varN.map((x) => x).filter((dat) => {
|
|
408
|
+
if (Array.isArray(campoBuscar)) {
|
|
409
|
+
let encontrado = false;
|
|
410
|
+
for (const vCampo of campoBuscar) {
|
|
411
|
+
// console.log(vCampo, value, dat[vCampo]);
|
|
412
|
+
if (isNaN(Number(value))) {
|
|
413
|
+
// NO ES NUMERO
|
|
414
|
+
if (value && dat[vCampo] && dat[vCampo].toLowerCase().includes(value?.toString().toLowerCase())) {
|
|
415
|
+
encontrado = true;
|
|
416
|
+
break;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
if (value && dat[vCampo] && dat[vCampo].toString().includes(value?.toString())) {
|
|
421
|
+
encontrado = true;
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return encontrado;
|
|
427
|
+
}
|
|
428
|
+
else {
|
|
429
|
+
if (isNaN(Number(value))) {
|
|
430
|
+
return dat[campoBuscar].toLowerCase().includes(value?.toString().toLowerCase());
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
return dat[campoBuscar].toString().includes(value?.toString());
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
return varN;
|
|
439
|
+
}
|
|
440
|
+
return false;
|
|
441
|
+
}));
|
|
442
|
+
}
|
|
443
|
+
function changeSelectDataApi(objThis, dataFiltro) {
|
|
444
|
+
if (!dataFiltro.variableResultado) {
|
|
445
|
+
dataFiltro.variableResultado = dataFiltro.tipoReq;
|
|
446
|
+
}
|
|
447
|
+
const idFiltrado = dataFiltro.variableResultado;
|
|
448
|
+
dataFiltro.formControl.valueChanges.pipe(debounceTime(500), tap(() => {
|
|
449
|
+
objThis.filtrados[dataFiltro.variableResultado + 'tmp'] = isObservable(objThis.filtrados[idFiltrado]) ? [] : objThis.filtrados[idFiltrado] || [];
|
|
450
|
+
if (objThis.filtrados[idFiltrado] !== objThis.filtrados[idFiltrado + 'tmp']) {
|
|
451
|
+
objThis.filtrados[idFiltrado] = [];
|
|
452
|
+
}
|
|
453
|
+
objThis.isLoading = true;
|
|
454
|
+
}), switchMap(value => {
|
|
455
|
+
if (dataFiltro.campoId) {
|
|
456
|
+
const busquedaActual2 = objThis.filtrados[idFiltrado + 'tmp'].findIndex((item) => item[dataFiltro.campoId ?? '--'] === value);
|
|
457
|
+
if (busquedaActual2 >= 0) {
|
|
458
|
+
return of({ [dataFiltro.tipoReq]: objThis.filtrados[idFiltrado + 'tmp'] });
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return !value || value.length < (dataFiltro.minLength ?? 3) ? [] : (dataFiltro.queryService.getDataMethod('GET', dataFiltro.tipoReq, {
|
|
462
|
+
...(dataFiltro.dataExtra ?? {}),
|
|
463
|
+
...(dataFiltro.dataExtraVariable ? Object.fromEntries(dataFiltro.dataExtraVariable.map((objData) => [objData.campo, objData.ctrlValue.value])) : {}),
|
|
464
|
+
txtBuscar: value,
|
|
465
|
+
}, dataFiltro.anonimo).pipe(finalize(() => objThis.isLoading = false)));
|
|
466
|
+
})).subscribe((data) => {
|
|
467
|
+
objThis.filtrados[idFiltrado] = data[dataFiltro.tipoReq] ?? [];
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
function changeSelectApi(control, queryService, formControl, tipo, dataExtra = {}, dataExtraVariable = null, minLength = 1, anonimo = false) {
|
|
471
|
+
formControl.valueChanges.pipe(debounceTime(500), tap((value) => {
|
|
472
|
+
control['filtrados'][tipo + 'tmp'] = isObservable(control['filtrados'][tipo]) ? [] : control['filtrados'][tipo];
|
|
473
|
+
if (control['filtrados'][tipo] != control['filtrados'][tipo + 'tmp']) {
|
|
474
|
+
control['filtrados'][tipo] = [];
|
|
475
|
+
}
|
|
476
|
+
control['isLoading'] = true;
|
|
477
|
+
}), switchMap(value => {
|
|
478
|
+
const formGroup = formControl.parent?.controls;
|
|
479
|
+
const nombreControl = Object.keys(formGroup).find(name => formControl === formGroup[name]) || null;
|
|
480
|
+
if (nombreControl && control['filtrados'][tipo + 'tmp'] && control['filtrados'][tipo + 'tmp'].length > 0) {
|
|
481
|
+
const busquedaActual = control['filtrados'][tipo + 'tmp'].findIndex((item) => item[nombreControl] == value);
|
|
482
|
+
if (busquedaActual >= 0) {
|
|
483
|
+
const vRet = {};
|
|
484
|
+
vRet[tipo] = control['filtrados'][tipo + 'tmp'];
|
|
485
|
+
control['isLoading'] = false;
|
|
486
|
+
return of(vRet);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (!value || value.length < minLength) {
|
|
490
|
+
return [];
|
|
491
|
+
}
|
|
492
|
+
const dataExtraVariableData = {};
|
|
493
|
+
if (dataExtraVariable) {
|
|
494
|
+
// @ts-ignore
|
|
495
|
+
for (const objData of dataExtraVariable) {
|
|
496
|
+
dataExtraVariableData[objData.campo] = objData.ctrlValue.value;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return queryService.getDataMethod('GET', tipo, { ...dataExtra, ...dataExtraVariableData, ...{ txtBuscar: value } }, anonimo).pipe(finalize(() => {
|
|
500
|
+
control['isLoading'] = false;
|
|
501
|
+
}));
|
|
502
|
+
})).subscribe((data) => {
|
|
503
|
+
if (data[tipo] == undefined) {
|
|
504
|
+
control['filtrados'][tipo] = [];
|
|
505
|
+
}
|
|
506
|
+
else {
|
|
507
|
+
control['filtrados'][tipo] = data[tipo];
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}
|
|
417
511
|
/**
|
|
418
|
-
*
|
|
512
|
+
* Comprueba si un valor es una Promesa
|
|
513
|
+
* @param valor - Valor a verificar
|
|
514
|
+
* @returns true si es una Promise
|
|
419
515
|
*/
|
|
420
|
-
function
|
|
421
|
-
|
|
516
|
+
function esPromise(valor) {
|
|
517
|
+
return !!valor && typeof valor.then === 'function';
|
|
422
518
|
}
|
|
423
519
|
/**
|
|
424
|
-
*
|
|
520
|
+
* Selecciona todo el texto de un input
|
|
521
|
+
* @param event - Evento del input
|
|
425
522
|
*/
|
|
426
|
-
function
|
|
427
|
-
|
|
428
|
-
control.filtrados[filtro] = formControl.valueChanges.pipe(untilDestroyed(control)).pipe(startWith(''), map(value => {
|
|
429
|
-
const partes = tipo.split('.');
|
|
430
|
-
const varN = control.dataServidor?.[partes[0]]?.[partes[1]] ??
|
|
431
|
-
control.dataServidor?.[tipo] ??
|
|
432
|
-
control.dataServidorSuscripcion?.[tipo]?.getValue();
|
|
433
|
-
return varN ? filtrarDatosLocal(varN, value, campoBuscar) : [];
|
|
434
|
-
}));
|
|
523
|
+
function seleccionarTextoInput$1(event) {
|
|
524
|
+
event.target.select();
|
|
435
525
|
}
|
|
436
526
|
/**
|
|
437
527
|
* Función genérica para vincular un FormControl con datos desde API o Promise.
|
|
@@ -459,10 +549,11 @@ function changeSelectReformateado(config) {
|
|
|
459
549
|
objThis.isLoading = false;
|
|
460
550
|
return of({ [tipoReq]: [] });
|
|
461
551
|
}
|
|
462
|
-
const extraVars = Object.fromEntries(dataExtraVariable.map(v => [v.campo, v.ctrlValue.value]));
|
|
552
|
+
const extraVars = Object.fromEntries(dataExtraVariable.map((v) => [v.campo, v.ctrlValue.value]));
|
|
463
553
|
const query = queryService.getDataMethod('GET', tipoReq, { ...dataExtra, ...extraVars, txtBuscar: value }, anonimo);
|
|
464
554
|
if (esPromise(query)) {
|
|
465
|
-
return query
|
|
555
|
+
return query
|
|
556
|
+
.then((data) => ({ [tipoReq]: data[tipoReq] ?? [] }))
|
|
466
557
|
.finally(() => { objThis.isLoading = false; });
|
|
467
558
|
}
|
|
468
559
|
return query.pipe(finalize(() => { objThis.isLoading = false; }));
|
|
@@ -470,57 +561,39 @@ function changeSelectReformateado(config) {
|
|
|
470
561
|
objThis.filtrados[variableResultado] = data[tipoReq] ?? [];
|
|
471
562
|
});
|
|
472
563
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Alias para compatibilidad.
|
|
475
|
-
*/
|
|
476
|
-
function changeSelectDataApi(objThis, dataFiltro) {
|
|
477
|
-
return changeSelectReformateado({
|
|
478
|
-
objThis,
|
|
479
|
-
tipoReq: dataFiltro.tipoReq,
|
|
480
|
-
formControl: dataFiltro.formControl,
|
|
481
|
-
queryService: dataFiltro.queryService,
|
|
482
|
-
campoId: dataFiltro.campoId,
|
|
483
|
-
minLength: dataFiltro.minLength,
|
|
484
|
-
dataExtra: dataFiltro.dataExtra,
|
|
485
|
-
dataExtraVariable: dataFiltro.dataExtraVariable,
|
|
486
|
-
anonimo: dataFiltro.anonimo,
|
|
487
|
-
variableResultado: dataFiltro.variableResultado,
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Alias para compatibilidad.
|
|
492
|
-
*/
|
|
493
|
-
function changeSelectApi(control, queryService, formControl, tipo, dataExtra = {}, dataExtraVariable = null, minLength = 1, anonimo = false) {
|
|
494
|
-
return changeSelectReformateado({
|
|
495
|
-
objThis: control,
|
|
496
|
-
tipoReq: tipo,
|
|
497
|
-
formControl,
|
|
498
|
-
queryService,
|
|
499
|
-
minLength,
|
|
500
|
-
dataExtra,
|
|
501
|
-
dataExtraVariable: dataExtraVariable ?? [],
|
|
502
|
-
anonimo,
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Comprueba si un valor es una Promesa.
|
|
507
|
-
*/
|
|
508
|
-
function esPromise(valor) {
|
|
509
|
-
return !!valor && typeof valor.then === 'function';
|
|
510
|
-
}
|
|
511
564
|
|
|
512
565
|
function seleccionarTextoInput(event) {
|
|
513
566
|
event.target.select();
|
|
514
567
|
}
|
|
515
568
|
|
|
569
|
+
/**
|
|
570
|
+
* Codifica un string a base64 (método legacy)
|
|
571
|
+
* @param val - String a codificar
|
|
572
|
+
* @returns String codificado en base64
|
|
573
|
+
* @deprecated Use encodeBase64String() en su lugar
|
|
574
|
+
*/
|
|
516
575
|
function b64Encode(val) {
|
|
517
576
|
return Buffer.from(val, 'binary').toString('base64');
|
|
518
577
|
}
|
|
578
|
+
/**
|
|
579
|
+
* Decodifica un string desde base64 (método legacy)
|
|
580
|
+
* @param val - String en base64 a decodificar
|
|
581
|
+
* @returns String decodificado
|
|
582
|
+
* @deprecated Use decodeBase64String() en su lugar
|
|
583
|
+
*/
|
|
519
584
|
function b64Decode(val) {
|
|
520
585
|
return Buffer.from(val, 'base64').toString('binary');
|
|
521
586
|
}
|
|
522
587
|
/**
|
|
523
588
|
* Codificar string a Base64 (UTF-8 seguro)
|
|
589
|
+
* @param str - String a codificar
|
|
590
|
+
* @returns String codificado en base64
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```typescript
|
|
594
|
+
* const encoded = encodeBase64String('Hola Mundo ñ');
|
|
595
|
+
* // encoded: "SG9sYSBNdW5kbyDDsQ=="
|
|
596
|
+
* ```
|
|
524
597
|
*/
|
|
525
598
|
function encodeBase64String(str) {
|
|
526
599
|
const encoder = new TextEncoder();
|
|
@@ -531,6 +604,14 @@ function encodeBase64String(str) {
|
|
|
531
604
|
}
|
|
532
605
|
/**
|
|
533
606
|
* Decodificar Base64 a string (UTF-8 seguro)
|
|
607
|
+
* @param b64 - String en base64 a decodificar
|
|
608
|
+
* @returns String decodificado
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* ```typescript
|
|
612
|
+
* const decoded = decodeBase64String('SG9sYSBNdW5kbyDDsQ==');
|
|
613
|
+
* // decoded: "Hola Mundo ñ"
|
|
614
|
+
* ```
|
|
534
615
|
*/
|
|
535
616
|
function decodeBase64String(b64) {
|
|
536
617
|
const binary = atob(b64);
|
|
@@ -543,18 +624,43 @@ function decodeBase64String(b64) {
|
|
|
543
624
|
}
|
|
544
625
|
/**
|
|
545
626
|
* Codificar un objeto a base64 (UTF-8 seguro)
|
|
627
|
+
* @param obj - Objeto a codificar
|
|
628
|
+
* @returns String codificado en base64
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```typescript
|
|
632
|
+
* const obj = { nombre: 'Juan', edad: 25 };
|
|
633
|
+
* const encoded = encodeBase64Object(obj);
|
|
634
|
+
* ```
|
|
546
635
|
*/
|
|
547
636
|
function encodeBase64Object(obj) {
|
|
548
637
|
return encodeBase64String(JSON.stringify(obj));
|
|
549
638
|
}
|
|
550
639
|
/**
|
|
551
640
|
* Decodificar un base64 y obtener el objeto original
|
|
641
|
+
* @param b64 - String en base64 a decodificar
|
|
642
|
+
* @returns Objeto decodificado
|
|
643
|
+
*
|
|
644
|
+
* @example
|
|
645
|
+
* ```typescript
|
|
646
|
+
* const obj = decodeBase64Object<{ nombre: string, edad: number }>(encoded);
|
|
647
|
+
* // obj: { nombre: 'Juan', edad: 25 }
|
|
648
|
+
* ```
|
|
552
649
|
*/
|
|
553
650
|
function decodeBase64Object(b64) {
|
|
554
651
|
return JSON.parse(decodeBase64String(b64));
|
|
555
652
|
}
|
|
556
653
|
/**
|
|
557
654
|
* Codificar archivo a Base64 (retorna solo el contenido, sin "data:...")
|
|
655
|
+
* @param file - Archivo o Blob a codificar
|
|
656
|
+
* @returns Promise con el string en base64
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* const file = event.target.files[0];
|
|
661
|
+
* const base64 = await encodeBase64File(file);
|
|
662
|
+
* // base64: "iVBORw0KGgoAAAANSUhEUgAA..."
|
|
663
|
+
* ```
|
|
558
664
|
*/
|
|
559
665
|
function encodeBase64File(file) {
|
|
560
666
|
return new Promise((resolve, reject) => {
|
|
@@ -569,6 +675,16 @@ function encodeBase64File(file) {
|
|
|
569
675
|
}
|
|
570
676
|
/**
|
|
571
677
|
* Decodificar Base64 a Blob (para reconstruir archivos en Angular)
|
|
678
|
+
* @param b64 - String en base64
|
|
679
|
+
* @param mimeType - Tipo MIME del archivo (opcional)
|
|
680
|
+
* @returns Blob con el contenido decodificado
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* ```typescript
|
|
684
|
+
* const blob = decodeBase64ToBlob(base64String, 'image/png');
|
|
685
|
+
* const url = URL.createObjectURL(blob);
|
|
686
|
+
* // Usar url para mostrar imagen o descargar
|
|
687
|
+
* ```
|
|
572
688
|
*/
|
|
573
689
|
function decodeBase64ToBlob(b64, mimeType = 'application/octet-stream') {
|
|
574
690
|
const byteChars = atob(b64);
|
|
@@ -642,6 +758,147 @@ function formatearFechaCadena(fecha) {
|
|
|
642
758
|
return new Date(year, month, day);
|
|
643
759
|
}
|
|
644
760
|
|
|
761
|
+
/**
|
|
762
|
+
* Configuración global para las utilidades de logging
|
|
763
|
+
*/
|
|
764
|
+
let isProductionMode = false;
|
|
765
|
+
/**
|
|
766
|
+
* Configura el modo de producción para las utilidades de logging
|
|
767
|
+
* @param production - true si está en modo producción, false para desarrollo
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* ```typescript
|
|
771
|
+
* import { setProductionMode } from '@jvsoft/utils';
|
|
772
|
+
* import { environment } from './environments/environment';
|
|
773
|
+
*
|
|
774
|
+
* setProductionMode(environment.production);
|
|
775
|
+
* ```
|
|
776
|
+
*/
|
|
777
|
+
function setProductionMode(production) {
|
|
778
|
+
isProductionMode = production;
|
|
779
|
+
}
|
|
780
|
+
/**
|
|
781
|
+
* Obtiene el estado actual del modo de producción
|
|
782
|
+
* @returns true si está en modo producción, false en desarrollo
|
|
783
|
+
*/
|
|
784
|
+
function isProduction() {
|
|
785
|
+
return isProductionMode;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Muestra mensajes de log solo en modo desarrollo
|
|
789
|
+
* @param args - Argumentos a mostrar en consola
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* ```typescript
|
|
793
|
+
* devLog('Usuario cargado:', usuario);
|
|
794
|
+
* devLog('Estado:', { activo: true, rol: 'admin' });
|
|
795
|
+
* ```
|
|
796
|
+
*/
|
|
797
|
+
function devLog(...args) {
|
|
798
|
+
if (!isProductionMode) {
|
|
799
|
+
console.log(...args);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Muestra advertencias solo en modo desarrollo
|
|
804
|
+
* @param args - Argumentos a mostrar como advertencia
|
|
805
|
+
*
|
|
806
|
+
* @example
|
|
807
|
+
* ```typescript
|
|
808
|
+
* devWarn('Función deprecada, usar nuevaFuncion() en su lugar');
|
|
809
|
+
* ```
|
|
810
|
+
*/
|
|
811
|
+
function devWarn(...args) {
|
|
812
|
+
if (!isProductionMode) {
|
|
813
|
+
console.warn(...args);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Muestra errores en consola (siempre, incluso en producción)
|
|
818
|
+
* @param args - Argumentos a mostrar como error
|
|
819
|
+
*
|
|
820
|
+
* @example
|
|
821
|
+
* ```typescript
|
|
822
|
+
* devError('Error al cargar datos:', error);
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
function devError(...args) {
|
|
826
|
+
console.error(...args);
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Crea un grupo de logs solo en modo desarrollo
|
|
830
|
+
* @param label - Etiqueta del grupo
|
|
831
|
+
* @param collapsed - Si el grupo debe estar colapsado por defecto
|
|
832
|
+
*
|
|
833
|
+
* @example
|
|
834
|
+
* ```typescript
|
|
835
|
+
* devGroup('Datos del usuario');
|
|
836
|
+
* devLog('Nombre:', usuario.nombre);
|
|
837
|
+
* devLog('Email:', usuario.email);
|
|
838
|
+
* devGroupEnd();
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
function devGroup(label, collapsed = false) {
|
|
842
|
+
if (!isProductionMode) {
|
|
843
|
+
if (collapsed) {
|
|
844
|
+
console.groupCollapsed(label);
|
|
845
|
+
}
|
|
846
|
+
else {
|
|
847
|
+
console.group(label);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Cierra el grupo de logs actual
|
|
853
|
+
*/
|
|
854
|
+
function devGroupEnd() {
|
|
855
|
+
if (!isProductionMode) {
|
|
856
|
+
console.groupEnd();
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Muestra una tabla en consola solo en modo desarrollo
|
|
861
|
+
* @param data - Datos a mostrar en formato tabla
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* ```typescript
|
|
865
|
+
* devTable([
|
|
866
|
+
* { nombre: 'Juan', edad: 25 },
|
|
867
|
+
* { nombre: 'María', edad: 30 }
|
|
868
|
+
* ]);
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
function devTable(data) {
|
|
872
|
+
if (!isProductionMode) {
|
|
873
|
+
console.table(data);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* Inicia un temporizador solo en modo desarrollo
|
|
878
|
+
* @param label - Etiqueta del temporizador
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* ```typescript
|
|
882
|
+
* devTime('carga-datos');
|
|
883
|
+
* // ... código a medir
|
|
884
|
+
* devTimeEnd('carga-datos'); // Muestra: carga-datos: 123.45ms
|
|
885
|
+
* ```
|
|
886
|
+
*/
|
|
887
|
+
function devTime(label) {
|
|
888
|
+
if (!isProductionMode) {
|
|
889
|
+
console.time(label);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Finaliza un temporizador y muestra el tiempo transcurrido
|
|
894
|
+
* @param label - Etiqueta del temporizador
|
|
895
|
+
*/
|
|
896
|
+
function devTimeEnd(label) {
|
|
897
|
+
if (!isProductionMode) {
|
|
898
|
+
console.timeEnd(label);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
|
|
645
902
|
function maskEmail(email) {
|
|
646
903
|
const [user, domain] = email.split("@");
|
|
647
904
|
if (user.length <= 2) {
|
|
@@ -1589,10 +1846,10 @@ class DataEnListaPipe {
|
|
|
1589
1846
|
}
|
|
1590
1847
|
return null;
|
|
1591
1848
|
}
|
|
1592
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1593
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
1849
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataEnListaPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1850
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: DataEnListaPipe, isStandalone: true, name: "dataEnLista" });
|
|
1594
1851
|
}
|
|
1595
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DataEnListaPipe, decorators: [{
|
|
1596
1853
|
type: Pipe,
|
|
1597
1854
|
args: [{
|
|
1598
1855
|
name: 'dataEnLista',
|
|
@@ -1681,10 +1938,10 @@ class DateDiffStringPipe {
|
|
|
1681
1938
|
seconds,
|
|
1682
1939
|
};
|
|
1683
1940
|
}
|
|
1684
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1685
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
1941
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DateDiffStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1942
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: DateDiffStringPipe, isStandalone: true, name: "dateDiffString" });
|
|
1686
1943
|
}
|
|
1687
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1944
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: DateDiffStringPipe, decorators: [{
|
|
1688
1945
|
type: Pipe,
|
|
1689
1946
|
args: [{
|
|
1690
1947
|
name: 'dateDiffString',
|
|
@@ -1736,10 +1993,10 @@ class FiltroPipe {
|
|
|
1736
1993
|
return false;
|
|
1737
1994
|
});
|
|
1738
1995
|
}
|
|
1739
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1740
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
1996
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FiltroPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1997
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: FiltroPipe, isStandalone: true, name: "filtro" });
|
|
1741
1998
|
}
|
|
1742
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
1999
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FiltroPipe, decorators: [{
|
|
1743
2000
|
type: Pipe,
|
|
1744
2001
|
args: [{
|
|
1745
2002
|
name: 'filtro'
|
|
@@ -1753,10 +2010,10 @@ class FormControlIsRequiredPipe {
|
|
|
1753
2010
|
}
|
|
1754
2011
|
return formControl.hasValidator(Validators.required);
|
|
1755
2012
|
}
|
|
1756
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1757
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
2013
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FormControlIsRequiredPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2014
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: FormControlIsRequiredPipe, isStandalone: true, name: "formControlIsRequired" });
|
|
1758
2015
|
}
|
|
1759
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2016
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FormControlIsRequiredPipe, decorators: [{
|
|
1760
2017
|
type: Pipe,
|
|
1761
2018
|
args: [{
|
|
1762
2019
|
name: 'formControlIsRequired'
|
|
@@ -1779,10 +2036,10 @@ class JsonParsePipe {
|
|
|
1779
2036
|
return [];
|
|
1780
2037
|
}
|
|
1781
2038
|
}
|
|
1782
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1783
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
2039
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: JsonParsePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2040
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: JsonParsePipe, isStandalone: true, name: "jsonParse" });
|
|
1784
2041
|
}
|
|
1785
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2042
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: JsonParsePipe, decorators: [{
|
|
1786
2043
|
type: Pipe,
|
|
1787
2044
|
args: [{
|
|
1788
2045
|
name: 'jsonParse'
|
|
@@ -1797,10 +2054,10 @@ class NoSanitizePipe {
|
|
|
1797
2054
|
transform(html) {
|
|
1798
2055
|
return this.domSanitizer.bypassSecurityTrustHtml(html);
|
|
1799
2056
|
}
|
|
1800
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1801
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
2057
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: NoSanitizePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2058
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: NoSanitizePipe, isStandalone: true, name: "noSanitize" });
|
|
1802
2059
|
}
|
|
1803
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2060
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: NoSanitizePipe, decorators: [{
|
|
1804
2061
|
type: Pipe,
|
|
1805
2062
|
args: [{ name: 'noSanitize' }]
|
|
1806
2063
|
}], ctorParameters: () => [{ type: i1.DomSanitizer }] });
|
|
@@ -1815,10 +2072,10 @@ class TipoValorFuncionPipe {
|
|
|
1815
2072
|
}
|
|
1816
2073
|
return datoParam;
|
|
1817
2074
|
}
|
|
1818
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1819
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
2075
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TipoValorFuncionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2076
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: TipoValorFuncionPipe, isStandalone: true, name: "tipoValorFuncion" });
|
|
1820
2077
|
}
|
|
1821
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TipoValorFuncionPipe, decorators: [{
|
|
1822
2079
|
type: Pipe,
|
|
1823
2080
|
args: [{
|
|
1824
2081
|
name: 'tipoValorFuncion',
|
|
@@ -1837,10 +2094,10 @@ class ZeroFillPipe {
|
|
|
1837
2094
|
}
|
|
1838
2095
|
return s;
|
|
1839
2096
|
}
|
|
1840
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.
|
|
1841
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.
|
|
2097
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ZeroFillPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2098
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.16", ngImport: i0, type: ZeroFillPipe, isStandalone: true, name: "zeroFill" });
|
|
1842
2099
|
}
|
|
1843
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.
|
|
2100
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ZeroFillPipe, decorators: [{
|
|
1844
2101
|
type: Pipe,
|
|
1845
2102
|
args: [{
|
|
1846
2103
|
name: 'zeroFill',
|
|
@@ -1863,5 +2120,5 @@ function zeroFill(value, digitos, ...args) {
|
|
|
1863
2120
|
* Generated bundle index. Do not edit.
|
|
1864
2121
|
*/
|
|
1865
2122
|
|
|
1866
|
-
export { DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, NoSanitizePipe, TipoValorFuncionPipe, ZeroFillPipe, b64Decode, b64Encode, buscarPorCampo, changeSelect, changeSelectApi, changeSelectData, changeSelectDataApi, changeSelectReformateado, convertirBytes, dataEnLista, dateDiffString, decodeBase64Object, decodeBase64String, decodeBase64ToBlob, deepClone, deepMerge, delLocalStorage, desencriptar, downLoadFileStream, eliminarColumnaPorIndex, eliminarDuplicados, eliminarElementos, encodeBase64File, encodeBase64Object, encodeBase64String, encriptar, esNumero, establecerQuitarRequired, extraerDominio, formControlIsRequired, formatearFecha, formatearFechaCadena, formatearFechaFormato, generateRandomString, getBrowserName, getCambiarPwd, getDataArchivoFromPath, getFormValidationErrors, getLocalStorage, getUniqueValues, getUniqueValuesByProperty, groupBy, inicializarVariablesSessionStorage, isEmail, jwtToken, jwtTokenData, jwtTokenExpiracion, jwtTokenExpiracionFaltante, localStorageKeys, markAsTouchedWithoutEmitEvent, maskEmail, mensajeAlerta, mensajeConfirmacion, mensajeTimer, mensajeToast, mensajesDeError, mensajesErrorFormControl, mostrarValorEnBusqueda, nestGroupsBy, numberToWords, objectPropertiesBoolean, objectPropertiesToType, obtenerHostDesdeUrl, obtenerMimeType, obtenerUltimoOrden, ordenarArray, ordenarPorPropiedad, ordenarPorPropiedades, roundToDecimal, sanitizarNombreArchivo, seleccionarTextoInput, setCambiarPwd, setControlDesdeLista, setJwtTokenData, setLocalStorage, sumarObjetos, sumarPropiedades, tipoValorFuncion, toFormData, transformarFechasPorNombreDeCampo, verificarRUC, zeroFill };
|
|
2123
|
+
export { DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, NoSanitizePipe, TipoValorFuncionPipe, ZeroFillPipe, b64Decode, b64Encode, buscarPorCampo, changeSelect, changeSelectApi, changeSelectData, changeSelectDataApi, changeSelectReformateado, convertirBytes, dataEnLista, dateDiffString, decodeBase64Object, decodeBase64String, decodeBase64ToBlob, deepClone, deepMerge, delLocalStorage, desencriptar, devError, devGroup, devGroupEnd, devLog, devTable, devTime, devTimeEnd, devWarn, downLoadFileStream, eliminarColumnaPorIndex, eliminarDuplicados, eliminarElementos, encodeBase64File, encodeBase64Object, encodeBase64String, encriptar, esNumero, esPromise, establecerQuitarRequired, extraerDominio, filtrarDatosLocal, formControlIsRequired, formatearFecha, formatearFechaCadena, formatearFechaFormato, generateRandomString, getBrowserName, getCambiarPwd, getDataArchivoFromPath, getFormValidationErrors, getLocalStorage, getUniqueValues, getUniqueValuesByProperty, getValueByPath, groupBy, inicializarVariablesSessionStorage, isEmail, isProduction, jwtToken, jwtTokenData, jwtTokenExpiracion, jwtTokenExpiracionFaltante, localStorageKeys, markAsTouchedWithoutEmitEvent, maskEmail, mensajeAlerta, mensajeConfirmacion, mensajeTimer, mensajeToast, mensajesDeError, mensajesErrorFormControl, mostrarValorEnBusqueda, nestGroupsBy, numberToWords, objectPropertiesBoolean, objectPropertiesToType, obtenerHostDesdeUrl, obtenerMimeType, obtenerUltimoOrden, ordenarArray, ordenarPorPropiedad, ordenarPorPropiedades, roundToDecimal, sanitizarNombreArchivo, seleccionarTextoInput, setCambiarPwd, setControlDesdeLista, setJwtTokenData, setLocalStorage, setProductionMode, sumarObjetos, sumarPropiedades, tipoValorFuncion, toFormData, transformarFechasPorNombreDeCampo, verificarRUC, zeroFill };
|
|
1867
2124
|
//# sourceMappingURL=jvsoft-utils.mjs.map
|