@jvsoft/utils 1.0.0-alpha.7 → 1.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/directives/auto-select-first.directive.d.ts +13 -0
  2. package/directives/public-api.d.ts +1 -0
  3. package/fesm2022/jvsoft-utils-directives.mjs +72 -3
  4. package/fesm2022/jvsoft-utils-directives.mjs.map +1 -1
  5. package/fesm2022/jvsoft-utils-functions.mjs +1744 -0
  6. package/fesm2022/jvsoft-utils-functions.mjs.map +1 -0
  7. package/fesm2022/jvsoft-utils-interfaces.mjs +6 -0
  8. package/fesm2022/jvsoft-utils-interfaces.mjs.map +1 -0
  9. package/fesm2022/jvsoft-utils-pipes.mjs +345 -0
  10. package/fesm2022/jvsoft-utils-pipes.mjs.map +1 -0
  11. package/fesm2022/jvsoft-utils.mjs +72 -3
  12. package/fesm2022/jvsoft-utils.mjs.map +1 -1
  13. package/functions/index.d.ts +5 -0
  14. package/interfaces/index.d.ts +5 -0
  15. package/package.json +13 -1
  16. package/pipes/index.d.ts +5 -0
  17. package/public-api.d.ts +3 -3
  18. /package/{src/functions → functions}/base64.d.ts +0 -0
  19. /package/{src/functions → functions}/browser.d.ts +0 -0
  20. /package/{src/functions → functions}/crypto-js.d.ts +0 -0
  21. /package/{src/functions → functions}/date.d.ts +0 -0
  22. /package/{src/functions → functions}/dev-log.d.ts +0 -0
  23. /package/{src/functions → functions}/email.d.ts +0 -0
  24. /package/{src/functions → functions}/file.d.ts +0 -0
  25. /package/{src/functions → functions}/forms.d.ts +0 -0
  26. /package/{src/functions → functions}/http-client.d.ts +0 -0
  27. /package/{src/functions → functions}/local-storage.d.ts +0 -0
  28. /package/{src/functions → functions}/mat-form-controls/autocomplete.d.ts +0 -0
  29. /package/{src/functions → functions}/mat-form-controls/index.d.ts +0 -0
  30. /package/{src/functions → functions}/number.d.ts +0 -0
  31. /package/{src/functions → functions}/object-transformation.d.ts +0 -0
  32. /package/{src/functions → functions}/objects-arrays.d.ts +0 -0
  33. /package/{src/functions → functions}/public-api.d.ts +0 -0
  34. /package/{src/functions → functions}/string.d.ts +0 -0
  35. /package/{src/functions → functions}/sweetalert.d.ts +0 -0
  36. /package/{src/functions → functions}/utiles.d.ts +0 -0
  37. /package/{src/interfaces → interfaces}/datos.d.ts +0 -0
  38. /package/{src/interfaces → interfaces}/public-api.d.ts +0 -0
  39. /package/{src/pipes → pipes}/data-en-lista.pipe.d.ts +0 -0
  40. /package/{src/pipes → pipes}/date-diff-string.pipe.d.ts +0 -0
  41. /package/{src/pipes → pipes}/display-with.pipe.d.ts +0 -0
  42. /package/{src/pipes → pipes}/filtro.pipe.d.ts +0 -0
  43. /package/{src/pipes → pipes}/form-control-is-required.pipe.d.ts +0 -0
  44. /package/{src/pipes → pipes}/json-parse.pipe.d.ts +0 -0
  45. /package/{src/pipes → pipes}/no-sanitize.pipe.d.ts +0 -0
  46. /package/{src/pipes → pipes}/public-api.d.ts +0 -0
  47. /package/{src/pipes → pipes}/tipo-valor-funcion.pipe.d.ts +0 -0
  48. /package/{src/pipes → pipes}/zero-fill.pipe.d.ts +0 -0
@@ -0,0 +1,345 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Pipe } from '@angular/core';
3
+ import { Validators } from '@angular/forms';
4
+ import * as i1 from '@angular/platform-browser';
5
+
6
+ class DataEnListaPipe {
7
+ transform(coleccion, idBuscar, dato) {
8
+ if (coleccion) {
9
+ if (Array.isArray(idBuscar)) {
10
+ return coleccion.find(item => {
11
+ const arrCoincide = [];
12
+ idBuscar.forEach((campo, idx) => {
13
+ // @ts-ignore
14
+ arrCoincide.push((item[campo] == dato[idx]));
15
+ });
16
+ return arrCoincide.every(e => e === true);
17
+ });
18
+ }
19
+ // @ts-ignore
20
+ return coleccion.find(item => item[idBuscar] == dato);
21
+ }
22
+ return null;
23
+ }
24
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DataEnListaPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
25
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: DataEnListaPipe, isStandalone: true, name: "dataEnLista" });
26
+ }
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DataEnListaPipe, decorators: [{
28
+ type: Pipe,
29
+ args: [{
30
+ name: 'dataEnLista',
31
+ }]
32
+ }] });
33
+ function dataEnLista(coleccion, idBuscar, dato) {
34
+ return new DataEnListaPipe().transform(coleccion, idBuscar, dato);
35
+ }
36
+
37
+ class DateDiffStringPipe {
38
+ transform(startingDate, endingDate) {
39
+ let startDate = new Date(startingDate);
40
+ // user not pass endingDate then set current date as end date.
41
+ if (!endingDate) {
42
+ endingDate = new Date();
43
+ }
44
+ let endDate = new Date(endingDate);
45
+ // chack start date and end date and base on condication alter date.
46
+ if (startDate > endDate) {
47
+ const swap = startDate;
48
+ startDate = endDate;
49
+ endDate = swap;
50
+ }
51
+ const disgregado = this.separarMilisegundos(endDate.getTime() - startDate.getTime());
52
+ // console.log(disgregado);
53
+ const formatearATexto = (arrayToFill, campo, texto, textoPlural = 's') => {
54
+ if (campo > 0) {
55
+ arrayToFill.push(campo + ' ' + texto + (campo > 1 ? textoPlural : ''));
56
+ }
57
+ return arrayToFill;
58
+ };
59
+ let arrDFinal = [];
60
+ arrDFinal = formatearATexto(arrDFinal, disgregado.years, 'año');
61
+ arrDFinal = formatearATexto(arrDFinal, disgregado.months, 'mes', 'es');
62
+ arrDFinal = formatearATexto(arrDFinal, disgregado.weeks, 'semana');
63
+ arrDFinal = formatearATexto(arrDFinal, disgregado.days, 'día');
64
+ arrDFinal = formatearATexto(arrDFinal, disgregado.hours, 'hora');
65
+ arrDFinal = formatearATexto(arrDFinal, disgregado.minutes, 'minuto');
66
+ arrDFinal = formatearATexto(arrDFinal, disgregado.seconds, 'segundo');
67
+ if (arrDFinal.length > 3) {
68
+ arrDFinal.splice(3);
69
+ arrDFinal.splice(-1, 0, 'y');
70
+ }
71
+ else {
72
+ if (arrDFinal.length > 1) {
73
+ arrDFinal.splice(-1, 0, 'y');
74
+ }
75
+ }
76
+ return arrDFinal.join(' ');
77
+ }
78
+ separarMilisegundos(milisegundos) {
79
+ const todoEnSegundos = milisegundos / 1000;
80
+ let secsUsed = 0;
81
+ const years = Math.floor(todoEnSegundos / 31536000);
82
+ if (years > 0) {
83
+ secsUsed += (years * 31536000);
84
+ }
85
+ const months = Math.floor((todoEnSegundos - secsUsed) / 2628288);
86
+ if (months > 0) {
87
+ secsUsed += (months * 2628288);
88
+ }
89
+ const weeks = Math.floor((todoEnSegundos - secsUsed) / 604800);
90
+ if (weeks > 0) {
91
+ secsUsed += (weeks * 604800);
92
+ }
93
+ const days = Math.floor((todoEnSegundos - secsUsed) / 86400);
94
+ if (days > 0) {
95
+ secsUsed += (days * 86400);
96
+ }
97
+ const hours = Math.floor((todoEnSegundos - secsUsed) / 3600);
98
+ if (hours > 0) {
99
+ secsUsed += (hours * 3600);
100
+ }
101
+ const minutes = Math.floor((todoEnSegundos - secsUsed) / 60);
102
+ if (minutes > 0) {
103
+ secsUsed += (minutes * 60);
104
+ }
105
+ const seconds = Math.round(todoEnSegundos - secsUsed);
106
+ return {
107
+ years,
108
+ months,
109
+ weeks,
110
+ days,
111
+ hours,
112
+ minutes,
113
+ seconds,
114
+ };
115
+ }
116
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DateDiffStringPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
117
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: DateDiffStringPipe, isStandalone: true, name: "dateDiffString" });
118
+ }
119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: DateDiffStringPipe, decorators: [{
120
+ type: Pipe,
121
+ args: [{
122
+ name: 'dateDiffString',
123
+ pure: true
124
+ }]
125
+ }] });
126
+ function dateDiffString(startingDate, endingDate) {
127
+ return new DateDiffStringPipe().transform(startingDate, endingDate);
128
+ }
129
+
130
+ class FiltroPipe {
131
+ transform(items, opcionesBusqueda) {
132
+ if (!items || !Array.isArray(items))
133
+ return [];
134
+ if (!opcionesBusqueda.texto || opcionesBusqueda.texto.length < (opcionesBusqueda.longitudMinima ?? 1))
135
+ return items;
136
+ const normalize = (() => {
137
+ const from = 'ÃÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛãàáäâèéëêìíïîòóöôùúüûÑñÇç';
138
+ const to = 'AAAAAEEEEIIIIOOOOUUUUaaaaaeeeeiiiioooouuuunncc';
139
+ const mapping = {};
140
+ for (let i = 0; i < from.length; i++) {
141
+ mapping[from[i]] = to[i];
142
+ }
143
+ return (str) => {
144
+ return str.split('').map(c => mapping[c] || c).join('');
145
+ };
146
+ })();
147
+ const textoNormalizado = normalize(opcionesBusqueda.texto.toLowerCase());
148
+ return items.filter(item => {
149
+ // 🔹 Manejo de `mostrarObligado`
150
+ if (opcionesBusqueda.mostrarObligado) {
151
+ const { campo, items: obligados } = opcionesBusqueda.mostrarObligado;
152
+ if (obligados.includes(item[campo]))
153
+ return true;
154
+ }
155
+ // 🔹 Manejo de `campo`
156
+ if (opcionesBusqueda.campo) {
157
+ if (Array.isArray(opcionesBusqueda.campo)) {
158
+ return opcionesBusqueda.campo.some(campo => {
159
+ const valor = item[campo];
160
+ return valor ? normalize(valor.toLowerCase()).includes(textoNormalizado) : false;
161
+ });
162
+ }
163
+ else {
164
+ const valor = item[opcionesBusqueda.campo];
165
+ return valor ? normalize(valor.toLowerCase()).includes(textoNormalizado) : false;
166
+ }
167
+ }
168
+ return false;
169
+ });
170
+ }
171
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FiltroPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
172
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: FiltroPipe, isStandalone: true, name: "filtro" });
173
+ }
174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FiltroPipe, decorators: [{
175
+ type: Pipe,
176
+ args: [{
177
+ name: 'filtro'
178
+ }]
179
+ }] });
180
+
181
+ class FormControlIsRequiredPipe {
182
+ transform(formControl, ...args) {
183
+ if (!formControl) {
184
+ return false;
185
+ }
186
+ return formControl.hasValidator(Validators.required);
187
+ }
188
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FormControlIsRequiredPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
189
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: FormControlIsRequiredPipe, isStandalone: true, name: "formControlIsRequired" });
190
+ }
191
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FormControlIsRequiredPipe, decorators: [{
192
+ type: Pipe,
193
+ args: [{
194
+ name: 'formControlIsRequired'
195
+ }]
196
+ }] });
197
+ function formControlIsRequired(formControl) {
198
+ return new FormControlIsRequiredPipe().transform(formControl);
199
+ }
200
+
201
+ class JsonParsePipe {
202
+ transform(value, ...args) {
203
+ if (!value) {
204
+ return [];
205
+ }
206
+ try {
207
+ return JSON.parse(value);
208
+ }
209
+ catch (e) {
210
+ console.warn('La cadena "' + value + '" no es JSON');
211
+ return [];
212
+ }
213
+ }
214
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonParsePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
215
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: JsonParsePipe, isStandalone: true, name: "jsonParse" });
216
+ }
217
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JsonParsePipe, decorators: [{
218
+ type: Pipe,
219
+ args: [{
220
+ name: 'jsonParse'
221
+ }]
222
+ }] });
223
+
224
+ class NoSanitizePipe {
225
+ domSanitizer;
226
+ constructor(domSanitizer) {
227
+ this.domSanitizer = domSanitizer;
228
+ }
229
+ transform(html) {
230
+ return this.domSanitizer.bypassSecurityTrustHtml(html);
231
+ }
232
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoSanitizePipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
233
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: NoSanitizePipe, isStandalone: true, name: "noSanitize" });
234
+ }
235
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NoSanitizePipe, decorators: [{
236
+ type: Pipe,
237
+ args: [{ name: 'noSanitize' }]
238
+ }], ctorParameters: () => [{ type: i1.DomSanitizer }] });
239
+
240
+ class TipoValorFuncionPipe {
241
+ transform(datoParam, defaultValue, ...param) {
242
+ if (datoParam === undefined || datoParam === null) {
243
+ return defaultValue;
244
+ }
245
+ if (typeof datoParam === 'function') {
246
+ return datoParam(...param);
247
+ }
248
+ return datoParam;
249
+ }
250
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TipoValorFuncionPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
251
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: TipoValorFuncionPipe, isStandalone: true, name: "tipoValorFuncion" });
252
+ }
253
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TipoValorFuncionPipe, decorators: [{
254
+ type: Pipe,
255
+ args: [{
256
+ name: 'tipoValorFuncion',
257
+ standalone: true, // Para usarlo en standalone components
258
+ }]
259
+ }] });
260
+ function tipoValorFuncion(datoParam, defaultValue, ...param) {
261
+ return new TipoValorFuncionPipe().transform(datoParam, defaultValue, ...param);
262
+ }
263
+
264
+ class ZeroFillPipe {
265
+ transform(value, digitos, ...args) {
266
+ let s = value + '';
267
+ while (s.length < digitos) {
268
+ s = '0' + s;
269
+ }
270
+ return s;
271
+ }
272
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ZeroFillPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
273
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: ZeroFillPipe, isStandalone: true, name: "zeroFill" });
274
+ }
275
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ZeroFillPipe, decorators: [{
276
+ type: Pipe,
277
+ args: [{
278
+ name: 'zeroFill',
279
+ }]
280
+ }] });
281
+ function zeroFill(value, digitos, ...args) {
282
+ return new ZeroFillPipe().transform(value, digitos, args);
283
+ }
284
+
285
+ class JvsDisplayWithPipe {
286
+ /**
287
+ * Retorna una función compatible con [displayWith] de MatAutocomplete.
288
+ * @param lista La lista de objetos donde buscar.
289
+ * @param campoId El nombre del campo que coincide con el valor del control (ej: 'iCarreraId').
290
+ * @param campoValue El nombre del campo (o campos) a mostrar (ej: 'cCarreraNombre' o ['cCodigo', 'cNombre']).
291
+ * @param opcExtra Lista opcional de objetos extra donde buscar si no se encuentra en la lista principal.
292
+ */
293
+ transform(lista, campoId, campoValue, opcExtra) {
294
+ return (idxSel) => {
295
+ if (idxSel === null || idxSel === undefined || !lista) {
296
+ return '';
297
+ }
298
+ const impDataMostrar = (vD) => {
299
+ if (!vD)
300
+ return '';
301
+ if (Array.isArray(campoValue)) {
302
+ return campoValue
303
+ .map(field => vD[field] ?? '')
304
+ .filter(val => !!val)
305
+ .join(' - ');
306
+ }
307
+ return vD[campoValue]?.toString() || '';
308
+ };
309
+ // Buscar en la lista principal
310
+ let item;
311
+ if (campoId === '*object*' || campoId === '*objeto*') {
312
+ item = lista.find(x => JSON.stringify(x).trim() === JSON.stringify(idxSel).trim());
313
+ }
314
+ else {
315
+ item = lista.find(x => x[campoId] == idxSel);
316
+ }
317
+ // Si no se encuentra, buscar en opcExtra
318
+ if (!item && opcExtra) {
319
+ if (campoId === '*object*' || campoId === '*objeto*') {
320
+ item = opcExtra.find(x => JSON.stringify(x).trim() === JSON.stringify(idxSel).trim());
321
+ }
322
+ else {
323
+ item = opcExtra.find(x => x[campoId] == idxSel);
324
+ }
325
+ }
326
+ return item ? impDataMostrar(item).trim() : '';
327
+ };
328
+ }
329
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JvsDisplayWithPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
330
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: JvsDisplayWithPipe, isStandalone: true, name: "jvsDisplayWith" });
331
+ }
332
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: JvsDisplayWithPipe, decorators: [{
333
+ type: Pipe,
334
+ args: [{
335
+ name: 'jvsDisplayWith',
336
+ standalone: true
337
+ }]
338
+ }] });
339
+
340
+ /**
341
+ * Generated bundle index. Do not edit.
342
+ */
343
+
344
+ export { DataEnListaPipe, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, JvsDisplayWithPipe, NoSanitizePipe, TipoValorFuncionPipe, ZeroFillPipe, dataEnLista, dateDiffString, formControlIsRequired, tipoValorFuncion, zeroFill };
345
+ //# sourceMappingURL=jvsoft-utils-pipes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jvsoft-utils-pipes.mjs","sources":["../../../projects/utils/pipes/data-en-lista.pipe.ts","../../../projects/utils/pipes/date-diff-string.pipe.ts","../../../projects/utils/pipes/filtro.pipe.ts","../../../projects/utils/pipes/form-control-is-required.pipe.ts","../../../projects/utils/pipes/json-parse.pipe.ts","../../../projects/utils/pipes/no-sanitize.pipe.ts","../../../projects/utils/pipes/tipo-valor-funcion.pipe.ts","../../../projects/utils/pipes/zero-fill.pipe.ts","../../../projects/utils/pipes/display-with.pipe.ts","../../../projects/utils/pipes/jvsoft-utils-pipes.ts"],"sourcesContent":["import {Pipe, PipeTransform} from '@angular/core';\n\n@Pipe({\n name: 'dataEnLista',\n})\nexport class DataEnListaPipe implements PipeTransform {\n\n transform(coleccion: object[], idBuscar: string | string[], dato: any): any {\n if (coleccion) {\n if (Array.isArray(idBuscar)) {\n return coleccion.find(item => {\n const arrCoincide: any[] = [];\n idBuscar.forEach((campo: string, idx) => {\n // @ts-ignore\n arrCoincide.push((item[campo] == dato[idx]));\n });\n return arrCoincide.every(e => e === true);\n });\n }\n // @ts-ignore\n return coleccion.find(item => item[idBuscar] == dato);\n }\n return null;\n }\n\n // opcSelec(coleccion, idBuscar, formControl) {\n // \tif (coleccion) {\n // \t\tif (formControl.value == '') {\n // \t\t\treturn {cModuloNombre: '', cModuloPadreNombre: 'Todos', iModuloId: ''};\n // \t\t}\n // \t\treturn coleccion.find(item => item[idBuscar] == formControl.value);\n // \t}\n // \treturn null;\n // }\n\n}\n\nexport function dataEnLista(coleccion: object[], idBuscar: string | string[], dato: any): any {\n return new DataEnListaPipe().transform(coleccion, idBuscar, dato);\n}\n","import {Pipe, PipeTransform} from '@angular/core';\n\n@Pipe({\n\tname: 'dateDiffString',\n\tpure: true\n})\nexport class DateDiffStringPipe implements PipeTransform {\n\ttransform(startingDate: Date, endingDate: Date): any {\n\t\tlet startDate = new Date(startingDate);\n\t\t// user not pass endingDate then set current date as end date.\n\t\tif (!endingDate) {\n\t\t\tendingDate = new Date();\n\t\t}\n\t\tlet endDate = new Date(endingDate);\n\t\t// chack start date and end date and base on condication alter date.\n\t\tif (startDate > endDate) {\n\t\t\tconst swap = startDate;\n\t\t\tstartDate = endDate;\n\t\t\tendDate = swap;\n\t\t}\n\n\t\tconst disgregado = this.separarMilisegundos(endDate.getTime() - startDate.getTime());\n\t\t// console.log(disgregado);\n\t\tconst formatearATexto = (arrayToFill: string[], campo: any, texto: any, textoPlural = 's') => {\n\t\t\tif (campo > 0) {\n\t\t\t\tarrayToFill.push( campo + ' ' + texto + (campo > 1 ? textoPlural : '') );\n\t\t\t}\n\t\t\treturn arrayToFill;\n\t\t};\n\n\t\tlet arrDFinal: any[] = [];\n\t\tarrDFinal = formatearATexto(arrDFinal, disgregado.years, 'año');\n\t\tarrDFinal = formatearATexto(arrDFinal, disgregado.months, 'mes', 'es');\n\t\tarrDFinal = formatearATexto(arrDFinal, disgregado.weeks, 'semana');\n\t\tarrDFinal = formatearATexto(arrDFinal, disgregado.days, 'día');\n\t\tarrDFinal = formatearATexto(arrDFinal, disgregado.hours, 'hora');\n\t\tarrDFinal = formatearATexto(arrDFinal, disgregado.minutes, 'minuto');\n\t\tarrDFinal = formatearATexto(arrDFinal, disgregado.seconds, 'segundo');\n\t\tif (arrDFinal.length > 3) {\n\t\t\tarrDFinal.splice(3);\n\t\t\tarrDFinal.splice(-1, 0, 'y');\n\t\t} else {\n\t\t\tif (arrDFinal.length > 1) {\n\t\t\t\tarrDFinal.splice(-1, 0, 'y');\n\t\t\t}\n\t\t}\n\t\treturn arrDFinal.join(' ');\n\t}\n\n\tsepararMilisegundos(milisegundos: any): {\n\t\tyears: number,\n\t\tmonths: number,\n\t\tweeks: number,\n\t\tdays: number,\n\t\thours: number,\n\t\tminutes: number,\n\t\tseconds: number,\n\t} {\n\t\tconst todoEnSegundos = milisegundos / 1000;\n\t\tlet secsUsed = 0;\n\t\tconst years = Math.floor(todoEnSegundos / 31536000);\n\t\tif (years > 0) {\n\t\t\tsecsUsed += (years * 31536000);\n\t\t}\n\t\tconst months = Math.floor((todoEnSegundos - secsUsed) / 2628288);\n\t\tif (months > 0) {\n\t\t\tsecsUsed += (months * 2628288);\n\t\t}\n\t\tconst weeks = Math.floor((todoEnSegundos - secsUsed) / 604800);\n\t\tif (weeks > 0) {\n\t\t\tsecsUsed += (weeks * 604800);\n\t\t}\n\t\tconst days = Math.floor((todoEnSegundos - secsUsed) / 86400);\n\t\tif (days > 0) {\n\t\t\tsecsUsed += (days * 86400);\n\t\t}\n\t\tconst hours = Math.floor((todoEnSegundos - secsUsed) / 3600);\n\t\tif (hours > 0) {\n\t\t\tsecsUsed += (hours * 3600);\n\t\t}\n\t\tconst minutes = Math.floor((todoEnSegundos - secsUsed) / 60);\n\t\tif (minutes > 0) {\n\t\t\tsecsUsed += (minutes * 60);\n\t\t}\n\t\tconst seconds = Math.round(todoEnSegundos - secsUsed);\n\n\t\treturn {\n\t\t\tyears,\n\t\t\tmonths,\n\t\t\tweeks,\n\t\t\tdays,\n\t\t\thours,\n\t\t\tminutes,\n\t\t\tseconds,\n\t\t};\n\t}\n\n/*\n\ttransform(to: Date, from: Date, seconds = true, strict = false): string {\n\t\tif (typeof to == 'string') {\n\t\t\tto = new Date(to);\n\t\t}\n\t\tif (typeof from == 'string') {\n\t\t\tfrom = new Date(from);\n\t\t}\n\t\tconsole.log(typeof to, typeof from);\n\t\tconsole.log(to);\n\t\tconsole.log(from);\n\n\t\treturn strict ? formatDistanceStrict(from, to, {unit: 'minute', locale: es}) : formatDistance(from, to, {includeSeconds: seconds, locale: es});\n\t}\n\t*/\n}\n\nexport function dateDiffString(startingDate: Date, endingDate: Date){\n\treturn new DateDiffStringPipe().transform(startingDate, endingDate);\n}\n","import {Pipe, PipeTransform} from '@angular/core';\n\ninterface OpcionesBusqueda {\n texto: string;\n longitudMinima?: number;\n campo?: string | string[];\n mostrarObligado?: MostrarObligado;\n}\n\ninterface MostrarObligado {\n campo: string;\n items: any[];\n}\n\n@Pipe({\n name: 'filtro'\n})\nexport class FiltroPipe implements PipeTransform {\n\n transform(items: any[], opcionesBusqueda: OpcionesBusqueda): any[] {\n if (!items || !Array.isArray(items)) return [];\n if (!opcionesBusqueda.texto || opcionesBusqueda.texto.length < (opcionesBusqueda.longitudMinima ?? 1)) return items;\n\n const normalize = (() => {\n const from = 'ÃÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛãàáäâèéëêìíïîòóöôùúüûÑñÇç';\n const to = 'AAAAAEEEEIIIIOOOOUUUUaaaaaeeeeiiiioooouuuunncc';\n const mapping: Record<string, string> = {};\n\n for (let i = 0; i < from.length; i++) {\n mapping[from[i]] = to[i];\n }\n\n return (str: string): string => {\n return str.split('').map(c => mapping[c] || c).join('');\n };\n })();\n\n const textoNormalizado = normalize(opcionesBusqueda.texto.toLowerCase());\n\n return items.filter(item => {\n // 🔹 Manejo de `mostrarObligado`\n if (opcionesBusqueda.mostrarObligado) {\n const {campo, items: obligados} = opcionesBusqueda.mostrarObligado;\n if (obligados.includes(item[campo])) return true;\n }\n\n // 🔹 Manejo de `campo`\n if (opcionesBusqueda.campo) {\n if (Array.isArray(opcionesBusqueda.campo)) {\n return opcionesBusqueda.campo.some(campo => {\n const valor = item[campo] as string | undefined;\n return valor ? normalize(valor.toLowerCase()).includes(textoNormalizado):false;\n });\n }\n else {\n const valor = item[opcionesBusqueda.campo] as string | undefined;\n return valor ? normalize(valor.toLowerCase()).includes(textoNormalizado):false;\n }\n }\n\n return false;\n });\n }\n}\n","import {Pipe, PipeTransform} from '@angular/core';\nimport {AbstractControl, Validators} from '@angular/forms';\n\n@Pipe({\n name: 'formControlIsRequired'\n})\nexport class FormControlIsRequiredPipe implements PipeTransform {\n\n\ttransform(formControl: AbstractControl, ...args: unknown[]): any {\n\t\tif (!formControl) { return false; }\n\t\treturn formControl.hasValidator(Validators.required);\n\t}\n\n}\nexport function formControlIsRequired(formControl: AbstractControl) {\n return new FormControlIsRequiredPipe().transform(formControl);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n\tname: 'jsonParse'\n})\nexport class JsonParsePipe implements PipeTransform {\n\n\ttransform(value: string, ...args: unknown[]): any {\n\t\tif (!value) { return []; }\n\t\ttry {\n\t\t\treturn JSON.parse(value);\n\t\t} catch (e) {\n\t\t\tconsole.warn('La cadena \"' + value + '\" no es JSON');\n\t\t\treturn [];\n\t\t}\n\t}\n\n}\n","import {Pipe, PipeTransform} from '@angular/core';\nimport {DomSanitizer, SafeHtml} from '@angular/platform-browser';\n\n@Pipe({ name: 'noSanitize' })\nexport class NoSanitizePipe implements PipeTransform {\n\tconstructor(private domSanitizer: DomSanitizer) {\n\n\t}\n\ttransform(html: string): SafeHtml {\n\t\treturn this.domSanitizer.bypassSecurityTrustHtml(html);\n\t}\n}\n","import {Pipe, PipeTransform} from '@angular/core';\n\nexport type TipoValorFuncion<T> = T | ((...param: any) => T);\n\n@Pipe({\n name: 'tipoValorFuncion',\n standalone: true, // Para usarlo en standalone components\n})\nexport class TipoValorFuncionPipe implements PipeTransform {\n transform<T>(datoParam: TipoValorFuncion<T>, defaultValue?: T, ...param: any[]): T | undefined {\n if (datoParam === undefined || datoParam === null) {\n return defaultValue;\n }\n if (typeof datoParam === 'function') {\n return (datoParam as (...args: any) => T)(...param);\n }\n return datoParam;\n }\n}\n\nexport function tipoValorFuncion<T>(datoParam: TipoValorFuncion<T>, defaultValue?: T, ...param: any[]): T | undefined {\n return new TipoValorFuncionPipe().transform(datoParam, defaultValue, ...param);\n}\n","import {Pipe, PipeTransform} from '@angular/core';\n\n@Pipe({\n\tname: 'zeroFill',\n})\nexport class ZeroFillPipe implements PipeTransform {\n\n\ttransform(value: unknown, digitos: number, ...args: unknown[]) {\n\t\tlet s = value + '';\n\t\twhile (s.length < digitos) {\n\t\t\ts = '0' + s;\n\t\t}\n\t\treturn s;\n\t}\n\n}\nexport function zeroFill(value: unknown, digitos: number, ...args: unknown[]) {\n\treturn new ZeroFillPipe().transform(value, digitos, args);\n}\n","import { Pipe, PipeTransform } from '@angular/core';\n\n@Pipe({\n name: 'jvsDisplayWith',\n standalone: true\n})\nexport class JvsDisplayWithPipe implements PipeTransform {\n /**\n * Retorna una función compatible con [displayWith] de MatAutocomplete.\n * @param lista La lista de objetos donde buscar.\n * @param campoId El nombre del campo que coincide con el valor del control (ej: 'iCarreraId').\n * @param campoValue El nombre del campo (o campos) a mostrar (ej: 'cCarreraNombre' o ['cCodigo', 'cNombre']).\n * @param opcExtra Lista opcional de objetos extra donde buscar si no se encuentra en la lista principal.\n */\n transform(lista: any[] | null, campoId: string, campoValue: string | string[], opcExtra?: any[] | null): (value: any) => string {\n return (idxSel: any): string => {\n if (idxSel === null || idxSel === undefined || !lista) {\n return '';\n }\n\n const impDataMostrar = (vD: any) => {\n if (!vD) return '';\n \n if (Array.isArray(campoValue)) {\n return campoValue\n .map(field => vD[field] ?? '')\n .filter(val => !!val)\n .join(' - ');\n }\n return vD[campoValue]?.toString() || '';\n };\n\n // Buscar en la lista principal\n let item;\n if (campoId === '*object*' || campoId === '*objeto*') {\n item = lista.find(x => JSON.stringify(x).trim() === JSON.stringify(idxSel).trim());\n } else {\n item = lista.find(x => x[campoId] == idxSel);\n }\n\n // Si no se encuentra, buscar en opcExtra\n if (!item && opcExtra) {\n if (campoId === '*object*' || campoId === '*objeto*') {\n item = opcExtra.find(x => JSON.stringify(x).trim() === JSON.stringify(idxSel).trim());\n } else {\n item = opcExtra.find(x => x[campoId] == idxSel);\n }\n }\n\n return item ? impDataMostrar(item).trim() : '';\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAKa,eAAe,CAAA;AAExB,IAAA,SAAS,CAAC,SAAmB,EAAE,QAA2B,EAAE,IAAS,EAAA;QACjE,IAAI,SAAS,EAAE;AACX,YAAA,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;AACzB,gBAAA,OAAO,S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B,IAAI,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,UAAU,EAAE;AAClD,oBAAA,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;;qBAClF;AACH,oBAAA,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC;;;AAIvD,YAAA,OAAO,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE;AAClD,SAAC;;wGA5CI,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA;sGAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,gBAAA,EAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACF,oBAAA,IAAI,EAAE,gBAAgB;AACtB,oBAAA,UAAU,EAAE;AACf,iBAAA;;;ACLD;;AAEG;;;;"}
@@ -1,6 +1,6 @@
1
- import { Validators, FormGroup, FormControl, FormArray, NG_VALIDATORS, NgControl } from '@angular/forms';
1
+ import { Validators, FormGroup, FormControl, FormArray, NG_VALIDATORS, NgControl, FormControlName } from '@angular/forms';
2
2
  import * as i0 from '@angular/core';
3
- import { inject, DestroyRef, Pipe, input, forwardRef, Directive, output, HostListener } from '@angular/core';
3
+ import { inject, DestroyRef, Pipe, input, forwardRef, Directive, output, HostListener, effect, untracked } from '@angular/core';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import { tap, startWith, debounceTime, isObservable, switchMap, of, finalize, Subject, merge, distinctUntilChanged, map as map$1 } from 'rxjs';
6
6
  import { map } from 'rxjs/operators';
@@ -13,6 +13,7 @@ import moment from 'moment';
13
13
  import swal from 'sweetalert2';
14
14
  import { jwtDecode } from 'jwt-decode';
15
15
  import * as i1 from '@angular/platform-browser';
16
+ import { ToastrService } from 'ngx-toastr';
16
17
 
17
18
  function deepMerge(source, target) {
18
19
  // Crea un clon profundo sin usar JSON.parse(JSON.stringify)
@@ -2338,6 +2339,74 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
2338
2339
  args: ['focus']
2339
2340
  }] } });
2340
2341
 
2342
+ class AutoSelectFirstDirective {
2343
+ ngControl = inject(NgControl, { optional: true });
2344
+ fcName = inject(FormControlName, { optional: true });
2345
+ toastr = inject(ToastrService, { optional: true });
2346
+ // Inputs using Signals
2347
+ options = input(null, { alias: 'jvsAutoSelectFirst' });
2348
+ jvsIdKey = input(null);
2349
+ jvsEmptyMsg = input('Lista sin elementos');
2350
+ onAutoSelect = output();
2351
+ constructor() {
2352
+ effect(() => {
2353
+ const currentOptions = this.options();
2354
+ const idKey = this.jvsIdKey();
2355
+ const emptyMsg = this.jvsEmptyMsg();
2356
+ if (currentOptions === null)
2357
+ return;
2358
+ const optionsArray = Array.isArray(currentOptions) ? currentOptions : [];
2359
+ if (optionsArray.length > 0) {
2360
+ untracked(() => {
2361
+ const control = this.ngControl?.control;
2362
+ const currentValue = control?.value;
2363
+ // Only autoselect if empty
2364
+ if (control && (currentValue === null || currentValue === undefined || currentValue === '')) {
2365
+ const firstItem = optionsArray[0];
2366
+ let valueToSet;
2367
+ // Resolve key
2368
+ let effectiveKey = idKey;
2369
+ // Default to formControlName if not provided
2370
+ if (!effectiveKey && this.fcName) {
2371
+ effectiveKey = this.fcName.name;
2372
+ }
2373
+ if (effectiveKey) {
2374
+ if (Array.isArray(effectiveKey)) {
2375
+ // Composite key: build an object with the specified keys
2376
+ valueToSet = {};
2377
+ effectiveKey.forEach(key => {
2378
+ valueToSet[key] = firstItem[key];
2379
+ });
2380
+ }
2381
+ else {
2382
+ valueToSet = firstItem[effectiveKey];
2383
+ }
2384
+ }
2385
+ else {
2386
+ // Use whole item if no key resolution possible
2387
+ valueToSet = firstItem;
2388
+ }
2389
+ control.setValue(valueToSet);
2390
+ this.onAutoSelect.emit(firstItem);
2391
+ }
2392
+ });
2393
+ }
2394
+ else if (emptyMsg && this.toastr) {
2395
+ this.toastr.warning(emptyMsg, 'Filtrado');
2396
+ }
2397
+ });
2398
+ }
2399
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AutoSelectFirstDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2400
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.14", type: AutoSelectFirstDirective, isStandalone: true, selector: "[jvsAutoSelectFirst]", inputs: { options: { classPropertyName: "options", publicName: "jvsAutoSelectFirst", isSignal: true, isRequired: false, transformFunction: null }, jvsIdKey: { classPropertyName: "jvsIdKey", publicName: "jvsIdKey", isSignal: true, isRequired: false, transformFunction: null }, jvsEmptyMsg: { classPropertyName: "jvsEmptyMsg", publicName: "jvsEmptyMsg", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onAutoSelect: "onAutoSelect" }, ngImport: i0 });
2401
+ }
2402
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: AutoSelectFirstDirective, decorators: [{
2403
+ type: Directive,
2404
+ args: [{
2405
+ selector: '[jvsAutoSelectFirst]',
2406
+ standalone: true
2407
+ }]
2408
+ }], ctorParameters: () => [] });
2409
+
2341
2410
  /*
2342
2411
  * Public API Surface of utils
2343
2412
  */
@@ -2349,5 +2418,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
2349
2418
  * Generated bundle index. Do not edit.
2350
2419
  */
2351
2420
 
2352
- export { AutocompleteMatchValidatorDirective, DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, JvsAutocompleteDirective, JvsDisplayWithPipe, 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 };
2421
+ export { AutoSelectFirstDirective, AutocompleteMatchValidatorDirective, DataEnListaPipe, DataModel, DateDiffStringPipe, FiltroPipe, FormControlIsRequiredPipe, JsonParsePipe, JvsAutocompleteDirective, JvsDisplayWithPipe, 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 };
2353
2422
  //# sourceMappingURL=jvsoft-utils.mjs.map