@jvsoft/utils 0.0.13-alpha.3 → 0.0.13-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.
@@ -14,6 +14,14 @@ 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
+ */
17
25
  function deepMerge(source, target) {
18
26
  // Crea un clon profundo sin usar JSON.parse(JSON.stringify)
19
27
  let cloneSource = deepClone(source);
@@ -35,7 +43,12 @@ function deepMerge(source, target) {
35
43
  }
36
44
  return cloneSource; // Retorna el clon y no modifica el original
37
45
  }
38
- // Función de clonación profunda que maneja funciones, fechas y otros tipos especiales
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
+ */
39
52
  function deepClone(obj) {
40
53
  if (obj === null || typeof obj !== 'object') {
41
54
  return obj; // Devuelve el valor si no es un objeto
@@ -61,6 +74,7 @@ function deepClone(obj) {
61
74
  /**
62
75
  * Busca un elemento en un array o jerarquía de objetos según un campo y valor especificado.
63
76
  *
77
+ * @param datosFn - Objeto con los parámetros de búsqueda: items, campo, valor y opcionalmente campoHijo.
64
78
  * @returns El elemento encontrado o undefined si no existe.
65
79
  */
66
80
  function buscarPorCampo(datosFn) {
@@ -87,13 +101,33 @@ function buscarPorCampo(datosFn) {
87
101
  // Si no se encuentra nada, retorna undefined
88
102
  return undefined;
89
103
  }
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
+ */
90
111
  function sumarPropiedades(item, campos) {
91
112
  const datosSumar = campos.map(campo => (item[campo] * 1));
92
113
  return datosSumar.reduce((a, b) => a + b, 0);
93
114
  }
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
+ */
94
121
  function esNumero(value) {
95
122
  return !isNaN(Number(value));
96
123
  }
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
+ */
97
131
  function sumarObjetos(arrayObjetos, campos) {
98
132
  return arrayObjetos.reduce((accumulator, item) => {
99
133
  campos.forEach(campo => {
@@ -105,9 +139,22 @@ function sumarObjetos(arrayObjetos, campos) {
105
139
  return accumulator;
106
140
  }, {});
107
141
  }
142
+ /**
143
+ * Obtiene los valores únicos de un array.
144
+ *
145
+ * @param array - Array de valores.
146
+ * @returns Array con los valores únicos.
147
+ */
108
148
  function getUniqueValues(array) {
109
149
  return array.filter((currentValue, index, arr) => (arr.indexOf(currentValue) === index));
110
150
  }
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
+ */
111
158
  function getUniqueValuesByProperty(objetos, campo) {
112
159
  const objetosUnicos = {};
113
160
  objetos.forEach(objeto => {
@@ -123,6 +170,14 @@ function getUniqueValuesByProperty(objetos, campo) {
123
170
  // Convertir el objeto de claves únicas de vuelta a una lista de objetos
124
171
  return Object.values(objetosUnicos);
125
172
  }
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
+ */
126
181
  function ordenarArray(array, numeros = false, sentido = 'ASC') {
127
182
  if (numeros) {
128
183
  if (sentido != 'ASC') {
@@ -132,9 +187,24 @@ function ordenarArray(array, numeros = false, sentido = 'ASC') {
132
187
  }
133
188
  return array.sort((a, b) => (a > b) ? 1 : ((b > a) ? -1 : 0));
134
189
  }
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
+ */
135
198
  function ordenarPorPropiedad(objData, propiedad, /**@deprecated*/ numeros = false) {
136
199
  return ordenarPorPropiedades(objData, { propiedades: [propiedad], direcciones: ['asc'] });
137
200
  }
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
+ */
138
208
  function ordenarPorPropiedades(arr, options) {
139
209
  const { propiedades, direcciones = [] } = options;
140
210
  const orden = direcciones.map(d => d === 'desc' ? -1 : 1);
@@ -154,6 +224,13 @@ function ordenarPorPropiedades(arr, options) {
154
224
  }, 0);
155
225
  });
156
226
  }
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
+ */
157
234
  function groupBy(array, key) {
158
235
  const keyFn = key instanceof Function ? key : (obj) => obj[key];
159
236
  return array.reduce((objectsByKeyValue, obj) => {
@@ -162,6 +239,13 @@ function groupBy(array, key) {
162
239
  return objectsByKeyValue;
163
240
  }, {});
164
241
  }
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
+ */
165
249
  function nestGroupsBy(arr, properties) {
166
250
  const fnGroupBy = (conversions, property2) => {
167
251
  return conversions.reduce((acc, obj) => {
@@ -235,6 +319,13 @@ function eliminarColumnaPorIndex(data, columnIndex) {
235
319
  return newRow;
236
320
  });
237
321
  }
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
+ */
238
329
  function eliminarDuplicados(array, claves) {
239
330
  const unicos = new Map();
240
331
  for (const item of array) {
@@ -247,6 +338,14 @@ function eliminarDuplicados(array, claves) {
247
338
  }
248
339
  return Array.from(unicos.values());
249
340
  }
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
+ */
250
349
  function eliminarElementos(origen, elementosAEliminar, claves) {
251
350
  const clavesSet = new Set();
252
351
  for (const item of elementosAEliminar) {
@@ -263,227 +362,152 @@ function eliminarElementos(origen, elementosAEliminar, claves) {
263
362
  });
264
363
  }
265
364
 
365
+ /**
366
+ * Devuelve un valor de visualización para un elemento buscado.
367
+ * Compatible con listas simples, objetos y campos múltiples.
368
+ */
266
369
  function mostrarValorEnBusqueda(campos, idxSel) {
267
- const impDataMostrar = () => {
268
- let vD;
269
- if (campos.campoId == '*object*' || campos.campoId == '*objeto*') {
270
- console.log(campos);
271
- vD = campos.lista.find((x) => JSON.stringify(x).trim() == JSON.stringify(idxSel).trim());
272
- console.log(vD);
273
- }
274
- else {
275
- vD = campos.lista.find((x) => x[campos.campoId] == idxSel);
276
- }
277
- if (!vD && campos.opcExtra) {
278
- console.log('eval ', campos.opcExtra);
279
- if (campos.campoId == '*object*' || campos.campoId == '*objeto*') {
280
- console.log(campos);
281
- vD = campos.opcExtra.find((x) => JSON.stringify(x).trim() == JSON.stringify(idxSel).trim());
282
- console.log(vD);
283
- }
284
- else {
285
- vD = campos.opcExtra.find((x) => x[campos.campoId] == idxSel);
286
- }
287
- }
288
- if (vD) {
289
- let txtFinal = '';
290
- if (Array.isArray(campos.campoValue)) {
291
- campos.campoValue.forEach((vCampo, idx) => {
292
- txtFinal += (vD[vCampo] ?? '');
293
- if (idx < campos.campoValue.length - 1) {
294
- txtFinal += ' - ';
295
- }
296
- });
297
- }
298
- else {
299
- txtFinal = vD[campos.campoValue] ?? '';
300
- }
301
- return txtFinal.trim();
370
+ const buscarEnLista = (lista) => {
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());
302
375
  }
303
- else {
304
- console.log('ASSSSS ----- SSSS ');
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();
305
384
  }
306
- return '';
385
+ return (vD[campos.campoValue] ?? '').trim();
307
386
  };
308
387
  if (esNumero(idxSel)) {
309
- if (idxSel > 0 && campos.lista?.length > 0) {
310
- return impDataMostrar();
311
- }
312
- else if (idxSel && typeof idxSel == 'object') {
388
+ if ((idxSel > 0 && campos.lista?.length) || (idxSel && typeof idxSel === 'object')) {
313
389
  return impDataMostrar();
314
390
  }
315
391
  }
316
- else {
317
- if (campos.lista?.length > 0) {
318
- return impDataMostrar();
319
- }
392
+ else if (campos.lista?.length) {
393
+ return impDataMostrar();
320
394
  }
321
395
  return '';
322
396
  }
323
- function changeSelectData(objThis, dataFiltro) {
324
- objThis['filtrados'][dataFiltro.variableResultado] = dataFiltro.formControl.valueChanges.pipe(untilDestroyed(objThis)).pipe(startWith(''), map(value => {
325
- const varN = dataFiltro.data;
326
- if (varN) {
327
- if (value) {
328
- return varN.map(x => x).filter(dat => {
329
- if (Array.isArray(dataFiltro.campoBuscar)) {
330
- let encontrado = false;
331
- for (const vCampo of dataFiltro.campoBuscar) {
332
- // console.log(vCampo, value, dat[vCampo]);
333
- if (isNaN(Number(value))) {
334
- // NO ES NUMERO
335
- if (value && dat[vCampo] && dat[vCampo].toLowerCase().includes(value?.toString().toLowerCase())) {
336
- encontrado = true;
337
- break;
338
- }
339
- }
340
- else {
341
- if (value && dat[vCampo] && dat[vCampo].toString().includes(value?.toString())) {
342
- encontrado = true;
343
- break;
344
- }
345
- }
346
- }
347
- return encontrado;
348
- }
349
- else {
350
- if (isNaN(Number(value))) {
351
- return dat[dataFiltro.campoBuscar].toLowerCase().includes(value?.toString().toLowerCase());
352
- }
353
- else {
354
- return dat[dataFiltro.campoBuscar].toString().includes(value?.toString());
355
- }
356
- }
357
- });
358
- }
359
- return varN;
360
- }
361
- return false;
362
- }));
397
+ /**
398
+ * Filtra datos locales de un array basado en un valor de búsqueda.
399
+ */
400
+ function filtrarDatosLocal(data, value, campoBuscar) {
401
+ if (!value)
402
+ return data;
403
+ const normalizar = (val) => val?.toString()?.toLowerCase() ?? '';
404
+ const esNum = !isNaN(Number(value));
405
+ return data.filter(item => {
406
+ const campos = Array.isArray(campoBuscar) ? campoBuscar : [campoBuscar];
407
+ return campos.some(campo => {
408
+ const campoVal = item[campo];
409
+ if (campoVal == null)
410
+ return false;
411
+ return esNum
412
+ ? campoVal.toString().includes(value.toString())
413
+ : normalizar(campoVal).includes(normalizar(value));
414
+ });
415
+ });
416
+ }
417
+ /**
418
+ * Vincula un FormControl a datos locales para autocompletado.
419
+ */
420
+ function changeSelectData(objThis, { formControl, data, campoBuscar, variableResultado }) {
421
+ objThis.filtrados[variableResultado] = formControl.valueChanges.pipe(untilDestroyed(objThis)).pipe(startWith(''), map(value => data ? filtrarDatosLocal(data, value, campoBuscar) : []));
363
422
  }
423
+ /**
424
+ * Vincula un FormControl a datos locales obtenidos de dataServidor o dataServidorSuscripcion.
425
+ */
364
426
  function changeSelect(control, formControl, tipo, campoBuscar, campoFiltro = null) {
365
- // console.log(formControl);
366
- // const formGroup = formControl.parent.controls;
367
- // console.warn( Object.keys(formGroup).find(name => formControl === formGroup[name]) || null );
368
- if (!campoFiltro) {
369
- campoFiltro = tipo;
370
- }
371
- control['filtrados'][campoFiltro ?? '__'] = formControl.valueChanges.pipe(untilDestroyed(control)).pipe(startWith(''), map(value => {
372
- // console.warn(value);
427
+ const filtro = campoFiltro ?? tipo;
428
+ control.filtrados[filtro] = formControl.valueChanges.pipe(untilDestroyed(control)).pipe(startWith(''), map(value => {
373
429
  const partes = tipo.split('.');
374
- let varN;
375
- if (control['dataServidor']) {
376
- varN = (partes.length > 1) ? control['dataServidor'][partes[0]][partes[1]] : control['dataServidor'][tipo];
377
- }
378
- else if (control['dataServidorSuscripcion']) {
379
- varN = control['dataServidorSuscripcion'][tipo].getValue();
380
- }
381
- if (varN) {
382
- if (value) {
383
- return varN.map((x) => x).filter((dat) => {
384
- if (Array.isArray(campoBuscar)) {
385
- let encontrado = false;
386
- for (const vCampo of campoBuscar) {
387
- // console.log(vCampo, value, dat[vCampo]);
388
- if (isNaN(Number(value))) {
389
- // NO ES NUMERO
390
- if (value && dat[vCampo] && dat[vCampo].toLowerCase().includes(value?.toString().toLowerCase())) {
391
- encontrado = true;
392
- break;
393
- }
394
- }
395
- else {
396
- if (value && dat[vCampo] && dat[vCampo].toString().includes(value?.toString())) {
397
- encontrado = true;
398
- break;
399
- }
400
- }
401
- }
402
- return encontrado;
403
- }
404
- else {
405
- if (isNaN(Number(value))) {
406
- return dat[campoBuscar].toLowerCase().includes(value?.toString().toLowerCase());
407
- }
408
- else {
409
- return dat[campoBuscar].toString().includes(value?.toString());
410
- }
411
- }
412
- });
413
- }
414
- return varN;
415
- }
416
- return false;
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) : [];
417
434
  }));
418
435
  }
419
- function changeSelectDataApi(objThis, dataFiltro) {
420
- if (!dataFiltro.variableResultado) {
421
- dataFiltro.variableResultado = dataFiltro.tipoReq;
422
- }
423
- const idFiltrado = dataFiltro.variableResultado;
424
- dataFiltro.formControl.valueChanges.pipe(debounceTime(500), tap(() => {
425
- objThis.filtrados[dataFiltro.variableResultado + 'tmp'] = isObservable(objThis.filtrados[idFiltrado]) ? [] : objThis.filtrados[idFiltrado] || [];
426
- if (objThis.filtrados[idFiltrado] !== objThis.filtrados[idFiltrado + 'tmp']) {
427
- objThis.filtrados[idFiltrado] = [];
436
+ /**
437
+ * Función genérica para vincular un FormControl con datos desde API o Promise.
438
+ * Preparada para migrar a signals en el futuro.
439
+ */
440
+ function changeSelectReformateado(config) {
441
+ const { objThis, tipoReq, formControl, queryService, campoId, minLength = 3, dataExtra = {}, dataExtraVariable = [], anonimo = false, variableResultado = tipoReq, } = config;
442
+ formControl.valueChanges.pipe(debounceTime(500), tap(() => {
443
+ objThis.filtrados[variableResultado + 'tmp'] = isObservable(objThis.filtrados[variableResultado])
444
+ ? []
445
+ : objThis.filtrados[variableResultado] || [];
446
+ if (objThis.filtrados[variableResultado] !== objThis.filtrados[variableResultado + 'tmp']) {
447
+ objThis.filtrados[variableResultado] = [];
428
448
  }
429
449
  objThis.isLoading = true;
430
450
  }), switchMap(value => {
431
- if (dataFiltro.campoId) {
432
- const busquedaActual2 = objThis.filtrados[idFiltrado + 'tmp'].findIndex((item) => item[dataFiltro.campoId ?? '--'] === value);
433
- if (busquedaActual2 >= 0) {
434
- return of({ [dataFiltro.tipoReq]: objThis.filtrados[idFiltrado + 'tmp'] });
435
- }
436
- }
437
- return !value || value.length < (dataFiltro.minLength ?? 3) ? [] : (dataFiltro.queryService.getDataMethod('GET', dataFiltro.tipoReq, {
438
- ...(dataFiltro.dataExtra ?? {}),
439
- ...(dataFiltro.dataExtraVariable ? Object.fromEntries(dataFiltro.dataExtraVariable.map((objData) => [objData.campo, objData.ctrlValue.value])) : {}),
440
- txtBuscar: value,
441
- }, dataFiltro.anonimo).pipe(finalize(() => objThis.isLoading = false)));
442
- })).subscribe((data) => {
443
- objThis.filtrados[idFiltrado] = data[dataFiltro.tipoReq] ?? [];
444
- });
445
- }
446
- function changeSelectApi(control, queryService, formControl, tipo, dataExtra = {}, dataExtraVariable = null, minLength = 1, anonimo = false) {
447
- formControl.valueChanges.pipe(debounceTime(500), tap((value) => {
448
- control['filtrados'][tipo + 'tmp'] = isObservable(control['filtrados'][tipo]) ? [] : control['filtrados'][tipo];
449
- if (control['filtrados'][tipo] != control['filtrados'][tipo + 'tmp']) {
450
- control['filtrados'][tipo] = [];
451
- }
452
- control['isLoading'] = true;
453
- }), switchMap(value => {
454
- const formGroup = formControl.parent?.controls;
455
- const nombreControl = Object.keys(formGroup).find(name => formControl === formGroup[name]) || null;
456
- if (nombreControl && control['filtrados'][tipo + 'tmp'] && control['filtrados'][tipo + 'tmp'].length > 0) {
457
- const busquedaActual = control['filtrados'][tipo + 'tmp'].findIndex((item) => item[nombreControl] == value);
458
- if (busquedaActual >= 0) {
459
- const vRet = {};
460
- vRet[tipo] = control['filtrados'][tipo + 'tmp'];
461
- control['isLoading'] = false;
462
- return of(vRet);
451
+ if (campoId) {
452
+ const existe = objThis.filtrados[variableResultado + 'tmp']
453
+ .findIndex((item) => item[campoId] === value);
454
+ if (existe >= 0) {
455
+ return of({ [tipoReq]: objThis.filtrados[variableResultado + 'tmp'] });
463
456
  }
464
457
  }
465
458
  if (!value || value.length < minLength) {
466
- return [];
459
+ objThis.isLoading = false;
460
+ return of({ [tipoReq]: [] });
467
461
  }
468
- const dataExtraVariableData = {};
469
- if (dataExtraVariable) {
470
- // @ts-ignore
471
- for (const objData of dataExtraVariable) {
472
- dataExtraVariableData[objData.campo] = objData.ctrlValue.value;
473
- }
462
+ const extraVars = Object.fromEntries(dataExtraVariable.map(v => [v.campo, v.ctrlValue.value]));
463
+ const query = queryService.getDataMethod('GET', tipoReq, { ...dataExtra, ...extraVars, txtBuscar: value }, anonimo);
464
+ if (esPromise(query)) {
465
+ return query.then((data) => ({ [tipoReq]: data[tipoReq] ?? [] }))
466
+ .finally(() => { objThis.isLoading = false; });
474
467
  }
475
- return queryService.getDataMethod('GET', tipo, { ...dataExtra, ...dataExtraVariableData, ...{ txtBuscar: value } }, anonimo).pipe(finalize(() => {
476
- control['isLoading'] = false;
477
- }));
468
+ return query.pipe(finalize(() => { objThis.isLoading = false; }));
478
469
  })).subscribe((data) => {
479
- if (data[tipo] == undefined) {
480
- control['filtrados'][tipo] = [];
481
- }
482
- else {
483
- control['filtrados'][tipo] = data[tipo];
484
- }
470
+ objThis.filtrados[variableResultado] = data[tipoReq] ?? [];
471
+ });
472
+ }
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,
485
503
  });
486
504
  }
505
+ /**
506
+ * Comprueba si un valor es una Promesa.
507
+ */
508
+ function esPromise(valor) {
509
+ return !!valor && typeof valor.then === 'function';
510
+ }
487
511
 
488
512
  function seleccionarTextoInput(event) {
489
513
  event.target.select();
@@ -1780,5 +1804,5 @@ function zeroFill(value, digitos, ...args) {
1780
1804
  * Generated bundle index. Do not edit.
1781
1805
  */
1782
1806
 
1783
- export { DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, NoSanitizePipe, TipoValorFuncionPipe, ZeroFillPipe, b64Decode, b64Encode, buscarPorCampo, changeSelect, changeSelectApi, changeSelectData, changeSelectDataApi, convertirBytes, dataEnLista, dateDiffString, deepClone, deepMerge, delLocalStorage, desencriptar, downLoadFileStream, eliminarColumnaPorIndex, eliminarDuplicados, eliminarElementos, 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 };
1807
+ export { DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, NoSanitizePipe, TipoValorFuncionPipe, ZeroFillPipe, b64Decode, b64Encode, buscarPorCampo, changeSelect, changeSelectApi, changeSelectData, changeSelectDataApi, changeSelectReformateado, convertirBytes, dataEnLista, dateDiffString, deepClone, deepMerge, delLocalStorage, desencriptar, downLoadFileStream, eliminarColumnaPorIndex, eliminarDuplicados, eliminarElementos, 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 };
1784
1808
  //# sourceMappingURL=jvsoft-utils.mjs.map