@esfaenza/extensions 13.3.5 → 13.3.7
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/esm2020/lib/models/CallResult.mjs +1 -1
- package/esm2020/lib/models/CsvHeaders.mjs +1 -1
- package/esm2020/lib/models/ExportConsts.mjs +9 -1
- package/esm2020/lib/modules/extensions.full.module.mjs +4 -4
- package/esm2020/lib/modules/extensions.module.mjs +4 -4
- package/esm2020/lib/services/extensions.clipboard.service.mjs +75 -23
- package/esm2020/lib/services/extensions.dates.service.mjs +11 -6
- package/esm2020/lib/services/extensions.exports.service.mjs +86 -32
- package/esm2020/lib/services/extensions.hashing.service.mjs +3 -3
- package/esm2020/lib/services/extensions.intercom.service.mjs +3 -3
- package/esm2020/lib/services/extensions.messages.service.mjs +69 -23
- package/esm2020/lib/services/extensions.utilities.service.mjs +46 -4
- package/fesm2015/esfaenza-extensions.mjs +315 -110
- package/fesm2015/esfaenza-extensions.mjs.map +1 -1
- package/fesm2020/esfaenza-extensions.mjs +302 -97
- package/fesm2020/esfaenza-extensions.mjs.map +1 -1
- package/lib/models/CallResult.d.ts +11 -25
- package/lib/models/CsvHeaders.d.ts +4 -0
- package/lib/models/ExportConsts.d.ts +8 -0
- package/lib/services/extensions.clipboard.service.d.ts +2 -0
- package/lib/services/extensions.exports.service.d.ts +2 -2
- package/lib/services/extensions.messages.service.d.ts +23 -7
- package/lib/services/extensions.utilities.service.d.ts +15 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, NgModule,
|
|
2
|
+
import { InjectionToken, NgModule, Injector, Injectable, Inject, Optional } from '@angular/core';
|
|
3
3
|
import swal from 'sweetalert2';
|
|
4
|
+
import { ToastrService } from 'ngx-toastr';
|
|
4
5
|
import { of, Subject } from 'rxjs';
|
|
5
6
|
import { map } from 'rxjs/operators';
|
|
6
|
-
import * as i1 from 'ngx-toastr';
|
|
7
7
|
import { Deserialize } from 'cerialize';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -40,10 +40,10 @@ class ExtensionsModule {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
ExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
44
|
-
ExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.
|
|
45
|
-
ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
43
|
+
ExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
44
|
+
ExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule });
|
|
45
|
+
ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule });
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule, decorators: [{
|
|
47
47
|
type: NgModule
|
|
48
48
|
}] });
|
|
49
49
|
|
|
@@ -57,8 +57,8 @@ class MessageService {
|
|
|
57
57
|
*
|
|
58
58
|
* @ignore
|
|
59
59
|
*/
|
|
60
|
-
constructor(
|
|
61
|
-
this.
|
|
60
|
+
constructor(injector, FANCY_ALERTS, LOCALE) {
|
|
61
|
+
this.injector = injector;
|
|
62
62
|
this.FANCY_ALERTS = FANCY_ALERTS;
|
|
63
63
|
this.LOCALE = LOCALE;
|
|
64
64
|
/**
|
|
@@ -85,6 +85,20 @@ class MessageService {
|
|
|
85
85
|
allowOutsideClick: false,
|
|
86
86
|
icon: "warning"
|
|
87
87
|
});
|
|
88
|
+
this.successSwalWithCancel = swal.mixin({
|
|
89
|
+
title: this.loc["Success"][this.LOCALE ?? 'it-IT'],
|
|
90
|
+
customClass: {
|
|
91
|
+
confirmButton: "btn btn-primary",
|
|
92
|
+
cancelButton: "btn btn-secondary app-margin-right-10",
|
|
93
|
+
container: "app-wrap",
|
|
94
|
+
},
|
|
95
|
+
buttonsStyling: false,
|
|
96
|
+
reverseButtons: true,
|
|
97
|
+
showCancelButton: true,
|
|
98
|
+
confirmButtonText: this.loc["Confirm"][this.LOCALE ?? 'it-IT'],
|
|
99
|
+
cancelButtonText: this.loc["Cancel"][this.LOCALE ?? 'it-IT'],
|
|
100
|
+
icon: "success"
|
|
101
|
+
});
|
|
88
102
|
this.warningSwalWithCancel = swal.mixin({
|
|
89
103
|
title: this.loc["Warning"][this.LOCALE ?? 'it-IT'],
|
|
90
104
|
customClass: {
|
|
@@ -148,6 +162,9 @@ class MessageService {
|
|
|
148
162
|
icon: "info"
|
|
149
163
|
});
|
|
150
164
|
}
|
|
165
|
+
get toastr() {
|
|
166
|
+
return this.injector.get(ToastrService);
|
|
167
|
+
}
|
|
151
168
|
/**
|
|
152
169
|
* Presentazione di un semplice messaggio di successo
|
|
153
170
|
*
|
|
@@ -157,12 +174,12 @@ class MessageService {
|
|
|
157
174
|
* @param {string} text Testo da mostrare
|
|
158
175
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
159
176
|
*/
|
|
160
|
-
simpleSuccess(text, secondaryNotificationType = null) {
|
|
177
|
+
simpleSuccess(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
161
178
|
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
162
179
|
if (tos == "swal")
|
|
163
180
|
this.successSwal.fire("", text);
|
|
164
181
|
else
|
|
165
|
-
this.toastr.success(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
182
|
+
this.toastr.success(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: secondaryNotificationTimeout || (tos == "toastr" ? 0 : 5000), extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
166
183
|
}
|
|
167
184
|
/**
|
|
168
185
|
* Presentazione di un semplice messaggio di informazione
|
|
@@ -173,12 +190,12 @@ class MessageService {
|
|
|
173
190
|
* @param {string} text Testo da mostrare
|
|
174
191
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
175
192
|
*/
|
|
176
|
-
simpleInfo(text, secondaryNotificationType = null) {
|
|
193
|
+
simpleInfo(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
177
194
|
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
178
195
|
if (tos == "swal")
|
|
179
196
|
this.infoSwal.fire("", text);
|
|
180
197
|
else
|
|
181
|
-
this.toastr.info(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
198
|
+
this.toastr.info(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: secondaryNotificationTimeout || (tos == "toastr" ? 0 : 5000), extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
182
199
|
}
|
|
183
200
|
/**
|
|
184
201
|
* Presentazione di un semplice messaggio di errore
|
|
@@ -189,12 +206,12 @@ class MessageService {
|
|
|
189
206
|
* @param {string} text Testo da mostrare
|
|
190
207
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
191
208
|
*/
|
|
192
|
-
simpleError(text, secondaryNotificationType = null) {
|
|
209
|
+
simpleError(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
193
210
|
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
194
211
|
if (tos == "swal")
|
|
195
212
|
this.errorSwal.fire("", text);
|
|
196
213
|
else
|
|
197
|
-
this.toastr.error(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
214
|
+
this.toastr.error(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: secondaryNotificationTimeout || (tos == "toastr" ? 0 : 5000), extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
198
215
|
}
|
|
199
216
|
/**
|
|
200
217
|
* Presentazione di un semplice messaggio di avviso
|
|
@@ -205,12 +222,12 @@ class MessageService {
|
|
|
205
222
|
* @param {string} text Testo da mostrare
|
|
206
223
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
207
224
|
*/
|
|
208
|
-
simpleWarning(text, secondaryNotificationType = null) {
|
|
225
|
+
simpleWarning(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
209
226
|
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
210
227
|
if (tos == "swal")
|
|
211
228
|
this.warningSwal.fire("", text);
|
|
212
229
|
else
|
|
213
|
-
this.toastr.warning(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
230
|
+
this.toastr.warning(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: secondaryNotificationTimeout || (tos == "toastr" ? 0 : 5000), extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
214
231
|
}
|
|
215
232
|
/**
|
|
216
233
|
* Ripulisce tutti i messaggi presenti in un dato momento sullo schermo
|
|
@@ -258,6 +275,32 @@ class MessageService {
|
|
|
258
275
|
onerror();
|
|
259
276
|
});
|
|
260
277
|
}
|
|
278
|
+
/**
|
|
279
|
+
* Mostra un messaggio di success con richiesta di conferma e gestisce il risultato chiamato i callback **onconfirm** o **onabort**
|
|
280
|
+
*
|
|
281
|
+
* @param {string} title Titolo del messaggio
|
|
282
|
+
* @param {string} text Contenuto del messaggio
|
|
283
|
+
* @param {Function} onconfirm Callback da chimare su conferma
|
|
284
|
+
* @param {Function} onabort Callback da chimare su annullamento
|
|
285
|
+
* @param {string} confirmtext Testo del pulsante di azione
|
|
286
|
+
* @param {string} aborttext Testo del pulsante di annullamento
|
|
287
|
+
*/
|
|
288
|
+
simpleSuccessWithChoice(title, text, onconfirm = null, onabort = null, confirmtext = "", aborttext = '') {
|
|
289
|
+
var configuration = {
|
|
290
|
+
title: title,
|
|
291
|
+
html: text
|
|
292
|
+
};
|
|
293
|
+
if (confirmtext)
|
|
294
|
+
configuration["confirmButtonText"] = confirmtext;
|
|
295
|
+
if (aborttext)
|
|
296
|
+
configuration["cancelButtonText"] = aborttext;
|
|
297
|
+
this.successSwalWithCancel.fire(configuration).then((result) => {
|
|
298
|
+
if (result.value && onconfirm)
|
|
299
|
+
onconfirm();
|
|
300
|
+
else if (onabort)
|
|
301
|
+
onabort();
|
|
302
|
+
});
|
|
303
|
+
}
|
|
261
304
|
/**
|
|
262
305
|
* Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
|
|
263
306
|
*
|
|
@@ -292,19 +335,18 @@ class MessageService {
|
|
|
292
335
|
*/
|
|
293
336
|
manageCallResultResponse(response, successMsg, errorMsg, postSuccess = null, postFailure = null) {
|
|
294
337
|
if (response.success) {
|
|
295
|
-
if (
|
|
338
|
+
if (response.haswarning)
|
|
339
|
+
this.simpleWarning(response.warning);
|
|
340
|
+
else if (successMsg)
|
|
296
341
|
this.simpleSuccess(successMsg);
|
|
297
342
|
if (postSuccess)
|
|
298
343
|
postSuccess();
|
|
299
344
|
}
|
|
300
|
-
else
|
|
301
|
-
this.simpleError((errorMsg ? errorMsg + ": " : "") + response.error);
|
|
345
|
+
else {
|
|
346
|
+
this.simpleError((errorMsg ? errorMsg + ": " : "") + response.haserror ? response.error : '[NO ERR.]');
|
|
302
347
|
if (postFailure)
|
|
303
348
|
postFailure();
|
|
304
349
|
}
|
|
305
|
-
else if (response.haswarning) {
|
|
306
|
-
this.simpleWarning(response.warning);
|
|
307
|
-
}
|
|
308
350
|
}
|
|
309
351
|
/**
|
|
310
352
|
* Metodo helper per gestire in maniera standardizzata una risposta di tipo **string**, considerando che:
|
|
@@ -357,11 +399,14 @@ class MessageService {
|
|
|
357
399
|
}
|
|
358
400
|
}
|
|
359
401
|
}
|
|
360
|
-
MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
361
|
-
MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
402
|
+
MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageService, deps: [{ token: Injector }, { token: EXT_FANCY_ALERTS, optional: true }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
403
|
+
MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageService });
|
|
404
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageService, decorators: [{
|
|
363
405
|
type: Injectable
|
|
364
|
-
}], ctorParameters: function () { return [{ type:
|
|
406
|
+
}], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
|
|
407
|
+
type: Inject,
|
|
408
|
+
args: [Injector]
|
|
409
|
+
}] }, { type: undefined, decorators: [{
|
|
365
410
|
type: Optional
|
|
366
411
|
}, {
|
|
367
412
|
type: Inject,
|
|
@@ -405,7 +450,27 @@ class ClipboardService {
|
|
|
405
450
|
"Error during Clipboard content copy operation": {
|
|
406
451
|
'en-US': "Error during Clipboard content copy operation",
|
|
407
452
|
'it-IT': "Errore nella scrittura del contenuto nella Clipboard"
|
|
408
|
-
}
|
|
453
|
+
},
|
|
454
|
+
"Please insert your clipboard content": {
|
|
455
|
+
'en-US': "Please insert your clipboard content",
|
|
456
|
+
'it-IT': "Si prega di incollare il contenuto della Clipboard"
|
|
457
|
+
},
|
|
458
|
+
"User input required": {
|
|
459
|
+
'en-US': "User input required",
|
|
460
|
+
'it-IT': "Richiesto Input utente"
|
|
461
|
+
},
|
|
462
|
+
"Your current browser does not support reading from the clipboard directly. Please paste your clipboard's content in this Input field and confirm the operation": {
|
|
463
|
+
'en-US': "Your current browser does not support reading from the clipboard directly. Please paste your clipboard's content in this Input field and confirm the operation",
|
|
464
|
+
'it-IT': "Il browser corrente non supporta la lettura diretta dei dati della Clipboard, si prega di effettuare un'incolla (CTRL + V) nella casella di testo e confermare l'operazione"
|
|
465
|
+
},
|
|
466
|
+
"Confirm": {
|
|
467
|
+
'en-US': "Confirm",
|
|
468
|
+
'it-IT': "Conferma"
|
|
469
|
+
},
|
|
470
|
+
"Cancel": {
|
|
471
|
+
'en-US': "Cancel",
|
|
472
|
+
'it-IT': "Annulla"
|
|
473
|
+
},
|
|
409
474
|
};
|
|
410
475
|
}
|
|
411
476
|
/**
|
|
@@ -417,35 +482,63 @@ class ClipboardService {
|
|
|
417
482
|
*/
|
|
418
483
|
getClipboard(style, valueFoundCallback) {
|
|
419
484
|
if (navigator.userAgent.indexOf("Firefox") != -1) {
|
|
420
|
-
|
|
421
|
-
|
|
485
|
+
swal.fire({
|
|
486
|
+
title: this.loc["User input required"][this.LOCALE ?? 'it-IT'],
|
|
487
|
+
text: this.loc["Your current browser does not support reading from the clipboard directly. Please paste your clipboard's content in this Input field and confirm the operation"][this.LOCALE ?? 'it-IT'],
|
|
488
|
+
input: 'textarea',
|
|
489
|
+
icon: "warning",
|
|
490
|
+
confirmButtonText: this.loc["Confirm"][this.LOCALE ?? 'it-IT'],
|
|
491
|
+
cancelButtonText: this.loc["Cancel"][this.LOCALE ?? 'it-IT'],
|
|
492
|
+
showCancelButton: true,
|
|
493
|
+
customClass: {
|
|
494
|
+
confirmButton: "btn btn-primary",
|
|
495
|
+
cancelButton: "btn btn-secondary app-margin-right-15",
|
|
496
|
+
container: "app-wrap",
|
|
497
|
+
},
|
|
498
|
+
reverseButtons: true,
|
|
499
|
+
allowOutsideClick: false,
|
|
500
|
+
inputValidator: (value) => {
|
|
501
|
+
if (!value)
|
|
502
|
+
return this.loc["Please insert your clipboard content"][this.LOCALE ?? 'it-IT'];
|
|
503
|
+
}
|
|
504
|
+
}).then(t => {
|
|
505
|
+
if (t.isConfirmed) {
|
|
506
|
+
console.log("[@esfaenza/extensions] Retrieving input data from user input");
|
|
507
|
+
this.doClipboardDataGet(t.value, style, valueFoundCallback);
|
|
508
|
+
}
|
|
509
|
+
});
|
|
422
510
|
return;
|
|
423
511
|
}
|
|
424
512
|
if (window.clipboardData) {
|
|
513
|
+
console.log("[@esfaenza/extensions] Found clipboardData");
|
|
425
514
|
let data = window.clipboardData.getData("Text");
|
|
426
|
-
|
|
427
|
-
style == "matrix" ? this.getClipboardMatrix(data) : [];
|
|
428
|
-
if (valueFoundCallback)
|
|
429
|
-
valueFoundCallback(value);
|
|
515
|
+
this.doClipboardDataGet(data, style, valueFoundCallback);
|
|
430
516
|
}
|
|
431
517
|
else if (window.navigator.clipboard) {
|
|
518
|
+
console.log("[@esfaenza/extensions] Found navigator clipboard");
|
|
432
519
|
window.navigator.permissions.query({ name: 'clipboard-read' }).then(result => {
|
|
433
|
-
if (!(result.state === 'granted' || result.state === 'prompt'))
|
|
520
|
+
if (!(result.state === 'granted' || result.state === 'prompt')) {
|
|
521
|
+
console.error("[@esfaenza/extensions] Clipboard permission not granted");
|
|
434
522
|
if (valueFoundCallback)
|
|
435
523
|
valueFoundCallback([]);
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
console.log("[@esfaenza/extensions] Clipboard permission granted, retrieving values");
|
|
436
527
|
window.navigator.clipboard.readText()
|
|
437
|
-
.then(t =>
|
|
438
|
-
|
|
439
|
-
style == "matrix" ? this.getClipboardMatrix(t) : [];
|
|
440
|
-
if (valueFoundCallback)
|
|
441
|
-
valueFoundCallback(value);
|
|
442
|
-
})
|
|
443
|
-
.catch(err => {
|
|
444
|
-
this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][this.LOCALE ?? 'it-IT'] + ": " + err);
|
|
445
|
-
});
|
|
528
|
+
.then((t) => this.doClipboardDataGet(t, style, valueFoundCallback))
|
|
529
|
+
.catch((err) => this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][this.LOCALE ?? 'it-IT'] + ": " + err));
|
|
446
530
|
});
|
|
447
531
|
}
|
|
448
532
|
}
|
|
533
|
+
/** @ignore */
|
|
534
|
+
doClipboardDataGet(clipboardText, style, valueFoundCallback) {
|
|
535
|
+
console.log("[@esfaenza/extensions] Retrieved clipboard values: " + clipboardText);
|
|
536
|
+
let value = style == "array" ? this.getClipboardLines(clipboardText) :
|
|
537
|
+
style == "matrix" ? this.getClipboardMatrix(clipboardText) : [];
|
|
538
|
+
console.log(`[@esfaenza/extensions] Adapted for ${style}: ${JSON.stringify(value)}`);
|
|
539
|
+
if (valueFoundCallback)
|
|
540
|
+
valueFoundCallback(value);
|
|
541
|
+
}
|
|
449
542
|
/**
|
|
450
543
|
* Ottiene il contenuto della clipboard diviso per righe (separate da newline)
|
|
451
544
|
*
|
|
@@ -454,7 +547,10 @@ class ClipboardService {
|
|
|
454
547
|
* @returns {string[]} Array contenente il testo preso dalla clipboard diviso per riga
|
|
455
548
|
*/
|
|
456
549
|
getClipboardLines(data) {
|
|
457
|
-
|
|
550
|
+
let trimmedData = data.trim();
|
|
551
|
+
if (!trimmedData.includes("\r\n") && trimmedData.includes("\n"))
|
|
552
|
+
return trimmedData.split("\n");
|
|
553
|
+
return trimmedData.split("\r\n");
|
|
458
554
|
}
|
|
459
555
|
/**
|
|
460
556
|
* Ottiene il contenuto della clipboard diviso per righe (separate da newline) e colonne (separate da tab)
|
|
@@ -465,7 +561,7 @@ class ClipboardService {
|
|
|
465
561
|
*/
|
|
466
562
|
getClipboardMatrix(data) {
|
|
467
563
|
var ret = [];
|
|
468
|
-
var rows = data.split("\r\n");
|
|
564
|
+
var rows = !data.includes("\r\n") && data.includes("\n") ? data.split("\n") : data.split("\r\n");
|
|
469
565
|
// A quanto pare ogni valore è separato da un \t... spero che sia uno standard di quando si copia da excel altrimenti ciao
|
|
470
566
|
for (let i = 0; i < rows.length; i++)
|
|
471
567
|
ret.push(rows[i].split('\t').map(t => t.trim()));
|
|
@@ -523,9 +619,9 @@ class ClipboardService {
|
|
|
523
619
|
document.body.removeChild(textArea);
|
|
524
620
|
}
|
|
525
621
|
}
|
|
526
|
-
ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
527
|
-
ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
528
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
622
|
+
ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ClipboardService, deps: [{ token: MessageService }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
623
|
+
ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ClipboardService });
|
|
624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ClipboardService, decorators: [{
|
|
529
625
|
type: Injectable
|
|
530
626
|
}], ctorParameters: function () { return [{ type: MessageService }, { type: undefined, decorators: [{
|
|
531
627
|
type: Optional
|
|
@@ -595,8 +691,13 @@ class DateService {
|
|
|
595
691
|
if (mydt == null)
|
|
596
692
|
return "FE: Not a Date";
|
|
597
693
|
let isZeroTime = mydt.startOf(timepart).valueOf() === mydt.valueOf();
|
|
598
|
-
if (!isZeroTime)
|
|
694
|
+
if (!isZeroTime) {
|
|
695
|
+
if (timepart == "day" && mydt.subtract(1, "hour").hour() == mydt.hour()) {
|
|
696
|
+
// Se l'ora precedente è lo stesso orario dell'ora attuale l'istante finale dev'essere mandato avanti di 1
|
|
697
|
+
mydt = mydt.add(1, "hour");
|
|
698
|
+
}
|
|
599
699
|
return printSeconds ? mydt.format(this.cfg.fulldateDisplay) : mydt.format(this.cfg.fulldateDisplayNoSS);
|
|
700
|
+
}
|
|
600
701
|
let tmpValue = mydt.subtract(1, timepart);
|
|
601
702
|
let value = "";
|
|
602
703
|
// Istante finale delle ore: 05/10/1992 --> 04/10/1992 24:00(:00)
|
|
@@ -704,7 +805,7 @@ class DateService {
|
|
|
704
805
|
tryThis = toCall(date, this.cfg.smallDate);
|
|
705
806
|
else if (length == this.cfg.fulldateNoSS.length)
|
|
706
807
|
tryThis = toCall(date, this.cfg.fulldateNoSS);
|
|
707
|
-
if (tryThis && tryThis.isValid())
|
|
808
|
+
if (tryThis && tryThis.isValid && tryThis.isValid())
|
|
708
809
|
return tryThis;
|
|
709
810
|
// Se niente funziona, null.
|
|
710
811
|
// Ricondurre l'Input ad una data non è possibile.
|
|
@@ -746,9 +847,9 @@ class DateService {
|
|
|
746
847
|
return date.format(small ? this.cfg.smallDate : seconds ? this.cfg.fulldateDisplay : this.cfg.fulldateDisplayNoSS);
|
|
747
848
|
}
|
|
748
849
|
}
|
|
749
|
-
DateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
750
|
-
DateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
751
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
850
|
+
DateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateService, deps: [{ token: EXT_LOCALE, optional: true }, { token: EXT_ALLOW_UTC, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
851
|
+
DateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateService });
|
|
852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateService, decorators: [{
|
|
752
853
|
type: Injectable
|
|
753
854
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
754
855
|
type: Optional
|
|
@@ -779,6 +880,10 @@ const csvVisPrefix = "_csvvis";
|
|
|
779
880
|
* Suffisso della proprietà da generare in cui salvare il nome della colonna in cui salvare questa proprietà
|
|
780
881
|
*/
|
|
781
882
|
const csvHdrPrefix = "_csvhdr";
|
|
883
|
+
/**
|
|
884
|
+
* Suffisso della proprietà da generare in cui salvare il codice del th a cui si riferisce questo campo
|
|
885
|
+
*/
|
|
886
|
+
const csvPropKey = "_csvkey";
|
|
782
887
|
/**
|
|
783
888
|
* Suffisso della proprietà da generare in cui salvare il valore da prendere per una proprietà di tipo Lista
|
|
784
889
|
*/
|
|
@@ -802,7 +907,11 @@ const dictionaryCsvHdrPrefix = "_flatlistcsvhdr";
|
|
|
802
907
|
/**
|
|
803
908
|
* Suffisso della proprietà da generare in cui salvare il formato della proprietà che si sta esportando
|
|
804
909
|
*/
|
|
805
|
-
const csvFormatPrefix = "_csvfmt";
|
|
910
|
+
const csvFormatPrefix = "_csvfmt";
|
|
911
|
+
/**
|
|
912
|
+
* Nome della proprietà che contiene tutti i nomi di tutte le proprietà da esportare
|
|
913
|
+
*/
|
|
914
|
+
const exportList = "__export_list__";
|
|
806
915
|
|
|
807
916
|
// Angular
|
|
808
917
|
/**
|
|
@@ -830,12 +939,18 @@ const csvFormatPrefix = "_csvfmt";
|
|
|
830
939
|
* @param {string} header Titolo della colonna nel file CSV esportato
|
|
831
940
|
* @param {string} format Formato di esportazione. Può essere un formato data per i campi data o 'F' per i campi floating point
|
|
832
941
|
*/
|
|
833
|
-
const Export = (order, header, format = null) => (target, propertyKey) => {
|
|
942
|
+
const Export = (order, header, format = null, tableid = null) => (target, propertyKey) => {
|
|
834
943
|
if (format)
|
|
835
944
|
Object.defineProperty(target, propertyKey + csvFormatPrefix, { value: format, writable: false });
|
|
836
945
|
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
837
946
|
Object.defineProperty(target, propertyKey + csvVisPrefix, { value: !!header, writable: false });
|
|
838
947
|
Object.defineProperty(target, propertyKey + csvHdrPrefix, { value: header, writable: false });
|
|
948
|
+
if (tableid)
|
|
949
|
+
Object.defineProperty(target, propertyKey + csvPropKey, { value: tableid, writable: false });
|
|
950
|
+
if (target[exportList])
|
|
951
|
+
target[exportList].push(propertyKey + csvVisPrefix);
|
|
952
|
+
else
|
|
953
|
+
target[exportList] = [propertyKey + csvVisPrefix];
|
|
839
954
|
};
|
|
840
955
|
/**
|
|
841
956
|
* Decoratore di esportazione utilizzabile su un oggetto.
|
|
@@ -869,8 +984,9 @@ const Export = (order, header, format = null) => (target, propertyKey) => {
|
|
|
869
984
|
*/
|
|
870
985
|
const ExportAs = (order, type) => (target, propertyKey) => {
|
|
871
986
|
var t = new type();
|
|
872
|
-
|
|
873
|
-
|
|
987
|
+
var props = t[exportList];
|
|
988
|
+
for (let i = 0; i < props.length; i++) {
|
|
989
|
+
let prop = props[i].replace(csvVisPrefix, '');
|
|
874
990
|
if (typeof t[prop + csvVisPrefix] !== "undefined") {
|
|
875
991
|
var toEmit = t[prop + csvVisPrefix];
|
|
876
992
|
var lbl = t[prop + csvHdrPrefix];
|
|
@@ -883,6 +999,10 @@ const ExportAs = (order, type) => (target, propertyKey) => {
|
|
|
883
999
|
Object.defineProperty(target, propertyKey + prop + csvValueNavigator, { value: propertyKey + "." + prop, writable: false });
|
|
884
1000
|
Object.defineProperty(target, propertyKey + prop + csvVisPrefix, { value: toEmit, writable: false });
|
|
885
1001
|
Object.defineProperty(target, propertyKey + prop + csvHdrPrefix, { value: lbl, writable: false });
|
|
1002
|
+
if (target[exportList])
|
|
1003
|
+
target[exportList].push(propertyKey + prop + csvVisPrefix);
|
|
1004
|
+
else
|
|
1005
|
+
target[exportList] = [propertyKey + prop + csvVisPrefix];
|
|
886
1006
|
}
|
|
887
1007
|
}
|
|
888
1008
|
};
|
|
@@ -909,6 +1029,10 @@ const ExportList = (order, headernavigator, valuenavigator, valueformat = null)
|
|
|
909
1029
|
Object.defineProperty(target, propertyKey + listCsvValPrefix, { value: valuenavigator, writable: false });
|
|
910
1030
|
Object.defineProperty(target, propertyKey + listCsvHdrPrefix, { value: headernavigator, writable: false });
|
|
911
1031
|
Object.defineProperty(target, propertyKey + listCsvValFormat, { value: valueformat, writable: false });
|
|
1032
|
+
if (target[exportList])
|
|
1033
|
+
target[exportList].push(propertyKey + listCsvHdrPrefix);
|
|
1034
|
+
else
|
|
1035
|
+
target[exportList] = [propertyKey + listCsvHdrPrefix];
|
|
912
1036
|
};
|
|
913
1037
|
/**
|
|
914
1038
|
* Decoratore di esportazione utilizzabile su un dizionario. Se ad esempio si vogliono generare le colonne
|
|
@@ -929,6 +1053,10 @@ const ExportDictionary = (order, headernavigator, valuenavigator) => (target, pr
|
|
|
929
1053
|
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
930
1054
|
Object.defineProperty(target, propertyKey + dictionaryCsvValPrefix, { value: valuenavigator, writable: false });
|
|
931
1055
|
Object.defineProperty(target, propertyKey + dictionaryCsvHdrPrefix, { value: headernavigator, writable: false });
|
|
1056
|
+
if (target[exportList])
|
|
1057
|
+
target[exportList].push(propertyKey + dictionaryCsvHdrPrefix);
|
|
1058
|
+
else
|
|
1059
|
+
target[exportList] = [propertyKey + dictionaryCsvHdrPrefix];
|
|
932
1060
|
};
|
|
933
1061
|
/**
|
|
934
1062
|
* Service che si occupa dell'esportazione degli oggetti marcati dai Decoratori **ExportDictionary**, **ExportList**, **ExportAs** o **Export**
|
|
@@ -949,15 +1077,19 @@ class ExportService {
|
|
|
949
1077
|
*
|
|
950
1078
|
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
951
1079
|
*/
|
|
952
|
-
setupForExport(objs) {
|
|
1080
|
+
setupForExport(objs, columns = []) {
|
|
953
1081
|
let headers = [];
|
|
954
1082
|
let headersCache = {};
|
|
955
1083
|
if (!objs || objs.length == 0)
|
|
956
1084
|
return headers;
|
|
957
1085
|
// Devo per forza farlo per tutti gli oggetti dato che devo esporre le proprietà che mi servono da esportare
|
|
958
1086
|
// Gli header li raccolgo tutti poi faccio uan distinct in modo da esportare tutte le proprietà per bene
|
|
1087
|
+
let columnSelectionDictionary = {};
|
|
1088
|
+
if (columns?.length > 0)
|
|
1089
|
+
for (let i = 0; i < columns?.length; i++)
|
|
1090
|
+
columnSelectionDictionary[columns[i]] = true;
|
|
959
1091
|
for (let i = 0; i < objs.length; i++) {
|
|
960
|
-
let hds = this.parseAndGetHeaders(objs[i]);
|
|
1092
|
+
let hds = this.parseAndGetHeaders(objs[i], columnSelectionDictionary);
|
|
961
1093
|
// Aggiungo gli header facendo in modo di non aggiungerne mai due uguali per non dover fare una distinct dopo
|
|
962
1094
|
// che costerebbe comunque risorse. Utilizzo un dizionario d'appoggio per lookup istantanei
|
|
963
1095
|
for (let k = 0; k < hds.length; k++) {
|
|
@@ -967,7 +1099,23 @@ class ExportService {
|
|
|
967
1099
|
}
|
|
968
1100
|
}
|
|
969
1101
|
}
|
|
970
|
-
|
|
1102
|
+
if (!columns || columns.length == 0)
|
|
1103
|
+
return headers.sort((a, b) => a.order - b.order);
|
|
1104
|
+
else {
|
|
1105
|
+
// Se mi arriva la lista di colonne non mi dà solo la visibilità, ma anche l'ordinamento
|
|
1106
|
+
// le esporto di conseguenza
|
|
1107
|
+
let orderedHeaders = [];
|
|
1108
|
+
for (let i = 0; i < columns.length; i++) {
|
|
1109
|
+
let thisId = columns[i];
|
|
1110
|
+
for (let i = 0; i < headers.length; i++) {
|
|
1111
|
+
if (headers[i].propKey == thisId) {
|
|
1112
|
+
orderedHeaders.push(headers[i]);
|
|
1113
|
+
break;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
return orderedHeaders;
|
|
1118
|
+
}
|
|
971
1119
|
}
|
|
972
1120
|
/**
|
|
973
1121
|
* Data una lista di oggetti generici genera gli header per l'esportazione e integra ogni oggetto con le proprietà esportabili dalla libreria **@ctrl/ngx-csv**
|
|
@@ -1008,7 +1156,7 @@ class ExportService {
|
|
|
1008
1156
|
columns.forEach(t => {
|
|
1009
1157
|
var propValue = obj.properties[t.key];
|
|
1010
1158
|
Object.defineProperty(obj, t.key + "_exp", { value: propValue, writable: false, enumerable: true });
|
|
1011
|
-
headers.push({ label: t.label, key: t.key + "_exp", order: t.order, type: t.type });
|
|
1159
|
+
headers.push({ label: t.label, key: t.key + "_exp", order: t.order, type: t.type, propKey: null });
|
|
1012
1160
|
});
|
|
1013
1161
|
//Tirati fuori tutti gli header faccio sort sull'ordinamento
|
|
1014
1162
|
return headers.sort((a, b) => { return a.order - b.order; });
|
|
@@ -1022,23 +1170,33 @@ class ExportService {
|
|
|
1022
1170
|
*
|
|
1023
1171
|
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
1024
1172
|
*/
|
|
1025
|
-
parseAndGetHeaders(obj) {
|
|
1173
|
+
parseAndGetHeaders(obj, columnsSelection) {
|
|
1026
1174
|
var headers = [];
|
|
1027
1175
|
// Miracle incoming
|
|
1028
|
-
|
|
1176
|
+
let exportProps = obj[exportList] || [];
|
|
1177
|
+
if (exportProps.length == 0)
|
|
1178
|
+
console.warn("[@esfaenza/extensions] Nessuna colonna configurata da esportare!");
|
|
1179
|
+
for (let i = 0; i < exportProps.length; i++) {
|
|
1180
|
+
let prop = exportProps[i];
|
|
1181
|
+
let propBase = "";
|
|
1029
1182
|
let toCall;
|
|
1030
|
-
if (
|
|
1183
|
+
if (prop.endsWith(listCsvHdrPrefix)) {
|
|
1184
|
+
propBase = prop.replace(listCsvHdrPrefix, '');
|
|
1031
1185
|
toCall = this.parseList.bind(this);
|
|
1032
|
-
|
|
1186
|
+
}
|
|
1187
|
+
else if (prop.endsWith(dictionaryCsvHdrPrefix)) {
|
|
1033
1188
|
toCall = this.parseDictionary.bind(this);
|
|
1034
|
-
|
|
1035
|
-
|
|
1189
|
+
propBase = prop.replace(dictionaryCsvHdrPrefix, '');
|
|
1190
|
+
}
|
|
1191
|
+
else if (prop.endsWith(csvVisPrefix)) {
|
|
1192
|
+
propBase = prop.replace(csvVisPrefix, '');
|
|
1193
|
+
if (typeof obj[propBase + csvValueNavigator] !== "undefined")
|
|
1036
1194
|
toCall = this.parseObject.bind(this);
|
|
1037
1195
|
else
|
|
1038
1196
|
toCall = this.parseProperty.bind(this);
|
|
1039
1197
|
}
|
|
1040
1198
|
if (toCall)
|
|
1041
|
-
toCall(obj,
|
|
1199
|
+
toCall(obj, propBase, headers, columnsSelection);
|
|
1042
1200
|
}
|
|
1043
1201
|
return headers;
|
|
1044
1202
|
}
|
|
@@ -1050,9 +1208,14 @@ class ExportService {
|
|
|
1050
1208
|
* @param {string} prop Proprietà da esportare
|
|
1051
1209
|
* @param {CsvHeaders} headers Contenitore degli header, verrà riempito da questa funzione
|
|
1052
1210
|
*/
|
|
1053
|
-
parseProperty(obj, prop, headers) {
|
|
1211
|
+
parseProperty(obj, prop, headers, columnsSelection) {
|
|
1054
1212
|
let toEmit = obj[prop + csvVisPrefix];
|
|
1055
1213
|
let format = obj[prop + csvFormatPrefix];
|
|
1214
|
+
let propKey = obj[prop + csvPropKey];
|
|
1215
|
+
if (propKey && !columnsSelection[propKey] && Object.keys(columnsSelection).length > 0) {
|
|
1216
|
+
console.log("[@esfaenza/extensions] Colonna da non esportare: " + propKey);
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1056
1219
|
let lbl = obj[prop + csvHdrPrefix];
|
|
1057
1220
|
let order = obj[prop + csvOrdPrefix];
|
|
1058
1221
|
if (toEmit && lbl !== "undefined") {
|
|
@@ -1061,7 +1224,7 @@ class ExportService {
|
|
|
1061
1224
|
// Se è un formato data mi assicuro di non stampare mai una data 00:00:00 altrimenti in esportazione viene uno schifo
|
|
1062
1225
|
var val = obj[prop] ? this.dates.trimSeconds(obj[prop].toString()) : "";
|
|
1063
1226
|
Object.defineProperty(obj, prop + "_nofmt", { value: val, writable: false, enumerable: true });
|
|
1064
|
-
headers.push({ label: lbl ? lbl : prop + "_nofmt", key: prop + "_nofmt", order: order, type: "string" });
|
|
1227
|
+
headers.push({ label: lbl ? lbl : prop + "_nofmt", key: prop + "_nofmt", order: order, type: "string", propKey: propKey });
|
|
1065
1228
|
}
|
|
1066
1229
|
else {
|
|
1067
1230
|
// Caso formato numerico
|
|
@@ -1073,15 +1236,15 @@ class ExportService {
|
|
|
1073
1236
|
// Il singolo punto che c'è, se presente (separatore decimali) lo trasformo in virgola
|
|
1074
1237
|
let valConverted = val.replace(".", ",");
|
|
1075
1238
|
Object.defineProperty(obj, prop + "_fmt", { value: valConverted, writable: false, enumerable: true });
|
|
1076
|
-
headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "number" });
|
|
1239
|
+
headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "number", propKey: propKey });
|
|
1077
1240
|
}
|
|
1078
1241
|
else {
|
|
1079
1242
|
// Se ho un formato data trasformo in dayjs, formatto ed esporto
|
|
1080
1243
|
// Per la trasformazione in dayjs provo prima a passargli la stringa di netto, sperando la riconosca
|
|
1081
1244
|
// Se non funziona provo a definirgli la formattazione standard del metering per quel linguaggio
|
|
1082
|
-
let val = this.dates.getFormatted(obj[prop], format.length <= 10,
|
|
1245
|
+
let val = this.dates.getFormatted(obj[prop], format.length <= 10, format.length > 16);
|
|
1083
1246
|
Object.defineProperty(obj, prop + "_fmt", { value: val ?? "", writable: false, enumerable: true });
|
|
1084
|
-
headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "date" });
|
|
1247
|
+
headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "date", propKey: propKey });
|
|
1085
1248
|
}
|
|
1086
1249
|
}
|
|
1087
1250
|
}
|
|
@@ -1122,11 +1285,11 @@ class ExportService {
|
|
|
1122
1285
|
type = "number";
|
|
1123
1286
|
}
|
|
1124
1287
|
else if (format) {
|
|
1125
|
-
value = this.dates.getFormatted(value, format.length <= 10,
|
|
1288
|
+
value = this.dates.getFormatted(value, format.length <= 10, format.length > 16);
|
|
1126
1289
|
type = "date";
|
|
1127
1290
|
}
|
|
1128
|
-
Object.defineProperty(obj, prop, { value: value, writable: false, enumerable: true });
|
|
1129
|
-
headers.push({ label: lbl ? lbl : prop, key: prop, order: order, type: type });
|
|
1291
|
+
Object.defineProperty(obj, prop, { value: value ?? "", writable: false, enumerable: true });
|
|
1292
|
+
headers.push({ label: lbl ? lbl : prop, key: prop, order: order, type: type, propKey: null });
|
|
1130
1293
|
}
|
|
1131
1294
|
/**
|
|
1132
1295
|
* Setup per l'esportazione di una lista di valori pivottati dinamicamente:
|
|
@@ -1176,11 +1339,11 @@ class ExportService {
|
|
|
1176
1339
|
type = "number";
|
|
1177
1340
|
}
|
|
1178
1341
|
else if (valueformat) {
|
|
1179
|
-
value = this.dates.getFormatted(obj[prop], valueformat.length <= 10,
|
|
1342
|
+
value = this.dates.getFormatted(obj[prop], valueformat.length <= 10, valueformat.length > 16);
|
|
1180
1343
|
type = "date";
|
|
1181
1344
|
}
|
|
1182
|
-
Object.defineProperty(obj, prop + idx, { value: value, writable: false });
|
|
1183
|
-
headers.push({ label: header, key: prop + idx, order: order + idx, type: type });
|
|
1345
|
+
Object.defineProperty(obj, prop + idx, { value: value ?? "", writable: false });
|
|
1346
|
+
headers.push({ label: header, key: prop + idx, order: order + idx, type: type, propKey: null });
|
|
1184
1347
|
}
|
|
1185
1348
|
}
|
|
1186
1349
|
/**
|
|
@@ -1226,8 +1389,8 @@ class ExportService {
|
|
|
1226
1389
|
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1227
1390
|
let value = tmpRes;
|
|
1228
1391
|
let propname = prop + idx.toString() + idxinternal.toString();
|
|
1229
|
-
Object.defineProperty(obj, propname, { value: value, writable: false });
|
|
1230
|
-
headers.push({ label: header + " " + desc, key: propname, order: order + idx, type: 'string' });
|
|
1392
|
+
Object.defineProperty(obj, propname, { value: value ?? "", writable: false });
|
|
1393
|
+
headers.push({ label: header + " " + desc, key: propname, order: order + idx, type: 'string', propKey: null });
|
|
1231
1394
|
});
|
|
1232
1395
|
}
|
|
1233
1396
|
}
|
|
@@ -1244,9 +1407,9 @@ class ExportService {
|
|
|
1244
1407
|
return Deserialize(items, type);
|
|
1245
1408
|
}
|
|
1246
1409
|
}
|
|
1247
|
-
ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1248
|
-
ExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1249
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
1410
|
+
ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExportService, deps: [{ token: DateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1411
|
+
ExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExportService });
|
|
1412
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExportService, decorators: [{
|
|
1250
1413
|
type: Injectable
|
|
1251
1414
|
}], ctorParameters: function () { return [{ type: DateService }]; } });
|
|
1252
1415
|
|
|
@@ -1551,9 +1714,9 @@ class HashingService {
|
|
|
1551
1714
|
return (a + b) & 0xFFFFFFFF;
|
|
1552
1715
|
}
|
|
1553
1716
|
}
|
|
1554
|
-
HashingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1555
|
-
HashingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1556
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
1717
|
+
HashingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HashingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1718
|
+
HashingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HashingService });
|
|
1719
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HashingService, decorators: [{
|
|
1557
1720
|
type: Injectable
|
|
1558
1721
|
}] });
|
|
1559
1722
|
|
|
@@ -1759,10 +1922,52 @@ class UtilityService {
|
|
|
1759
1922
|
return "string";
|
|
1760
1923
|
}
|
|
1761
1924
|
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Effettua la clonazione profonda di un oggetto in maniera molto più performante che JSON.parse(JSON.stringify()).
|
|
1927
|
+
*
|
|
1928
|
+
* Usare solo per oggetti puri e quantomeno semplici per evitare complicazioni derivanti dalle semplificazioni che questo metodo assume
|
|
1929
|
+
*
|
|
1930
|
+
* @param {any} source Oggetto da clonare
|
|
1931
|
+
*
|
|
1932
|
+
* @return {any} Clone dell'oggetto passato
|
|
1933
|
+
*/
|
|
1934
|
+
deepClone(source) {
|
|
1935
|
+
// Valori semplici
|
|
1936
|
+
if (source == null || typeof source !== 'object')
|
|
1937
|
+
return source;
|
|
1938
|
+
// Pseudo Struct
|
|
1939
|
+
switch (toString.call(source)) {
|
|
1940
|
+
case '[object Boolean]':
|
|
1941
|
+
case '[object Number]':
|
|
1942
|
+
case '[object String]':
|
|
1943
|
+
case '[object Date]':
|
|
1944
|
+
return new source.constructor(source.valueOf());
|
|
1945
|
+
default: break;
|
|
1946
|
+
}
|
|
1947
|
+
// Oggetti Complessi
|
|
1948
|
+
return this.recursiveStep(source, Array.isArray(source) || source instanceof Array ? [] : Object.create(Object.getPrototypeOf(source)));
|
|
1949
|
+
}
|
|
1950
|
+
/**
|
|
1951
|
+
* @ignore
|
|
1952
|
+
* Step ricorsivo per la clonatura degli oggetti. Vedere **deepClone**
|
|
1953
|
+
*/
|
|
1954
|
+
recursiveStep(source, destination) {
|
|
1955
|
+
if (Array.isArray(source) || source instanceof Array) {
|
|
1956
|
+
for (var i = 0, ii = source.length; i < ii; i++)
|
|
1957
|
+
destination.push(this.deepClone(source[i]));
|
|
1958
|
+
}
|
|
1959
|
+
else if (source && typeof source.hasOwnProperty === 'function') {
|
|
1960
|
+
for (let key in source) {
|
|
1961
|
+
if (source.hasOwnProperty(key))
|
|
1962
|
+
destination[key] = this.deepClone(source[key]);
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
return destination;
|
|
1966
|
+
}
|
|
1762
1967
|
}
|
|
1763
|
-
UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1764
|
-
UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1765
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
1968
|
+
UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1969
|
+
UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService });
|
|
1970
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService, decorators: [{
|
|
1766
1971
|
type: Injectable
|
|
1767
1972
|
}] });
|
|
1768
1973
|
|
|
@@ -1821,9 +2026,9 @@ class InterComService {
|
|
|
1821
2026
|
this.outbounds[key] = new Subject();
|
|
1822
2027
|
}
|
|
1823
2028
|
}
|
|
1824
|
-
InterComService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1825
|
-
InterComService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1826
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
2029
|
+
InterComService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: InterComService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2030
|
+
InterComService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: InterComService });
|
|
2031
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: InterComService, decorators: [{
|
|
1827
2032
|
type: Injectable
|
|
1828
2033
|
}] });
|
|
1829
2034
|
|
|
@@ -1860,10 +2065,10 @@ class FullExtensionsModule {
|
|
|
1860
2065
|
};
|
|
1861
2066
|
}
|
|
1862
2067
|
}
|
|
1863
|
-
FullExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1864
|
-
FullExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.
|
|
1865
|
-
FullExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.
|
|
1866
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
2068
|
+
FullExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2069
|
+
FullExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule });
|
|
2070
|
+
FullExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule });
|
|
2071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule, decorators: [{
|
|
1867
2072
|
type: NgModule
|
|
1868
2073
|
}] });
|
|
1869
2074
|
|