@esfaenza/extensions 15.2.25 → 15.2.27
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/services/extensions.embedding.service.mjs +131 -4
- package/esm2020/lib/services/extensions.messages.service.mjs +54 -25
- package/fesm2015/esfaenza-extensions.mjs +1716 -1561
- package/fesm2015/esfaenza-extensions.mjs.map +1 -1
- package/fesm2020/esfaenza-extensions.mjs +1748 -1595
- package/fesm2020/esfaenza-extensions.mjs.map +1 -1
- package/lib/services/extensions.embedding.service.d.ts +12 -1
- package/lib/services/extensions.messages.service.d.ts +30 -34
- package/package.json +1 -1
|
@@ -2,10 +2,11 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { InjectionToken, Injectable, Optional, Inject, Pipe, NgModule, Injector } from '@angular/core';
|
|
3
3
|
import * as i1 from '@esfaenza/localizations';
|
|
4
4
|
import { LocalizationModule } from '@esfaenza/localizations';
|
|
5
|
-
import { first, map } from 'rxjs/operators';
|
|
6
|
-
import swal from 'sweetalert2';
|
|
7
|
-
import { ToastrService } from 'ngx-toastr';
|
|
5
|
+
import { first, filter, take, map } from 'rxjs/operators';
|
|
8
6
|
import { of, Subject } from 'rxjs';
|
|
7
|
+
import { ToastrService } from 'ngx-toastr';
|
|
8
|
+
import swal from 'sweetalert2';
|
|
9
|
+
import * as i2 from '@angular/router';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Token che indica il prefisso delle searchView che serve per storicizzarle evitando di tirarsi in memoria anche tutti gli oggetti. Se vuoto viene supposto 'Hot'
|
|
@@ -312,1882 +313,2034 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
312
313
|
}]
|
|
313
314
|
}] });
|
|
314
315
|
|
|
315
|
-
// Angular
|
|
316
|
-
/* Classe che contiene tutte le informazioni sull'embedding in un unico contenitore per semplicità */
|
|
317
|
-
class AppEmbeddingExtensions {
|
|
318
|
-
constructor() {
|
|
319
|
-
this.Embedded = false;
|
|
320
|
-
this.EmbeddingLevel = 0;
|
|
321
|
-
this.MainWindow = window;
|
|
322
|
-
while (this.MainWindow.parent != this.MainWindow) {
|
|
323
|
-
this.MainWindow = this.MainWindow.parent;
|
|
324
|
-
this.EmbeddingLevel++;
|
|
325
|
-
this.Embedded = true;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
AppEmbeddingExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
330
|
-
AppEmbeddingExtensions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, providedIn: "root" });
|
|
331
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, decorators: [{
|
|
332
|
-
type: Injectable,
|
|
333
|
-
args: [{ providedIn: "root" }]
|
|
334
|
-
}], ctorParameters: function () { return []; } });
|
|
335
|
-
|
|
336
|
-
// Angular
|
|
337
|
-
/**
|
|
338
|
-
* Service che fornisce un accesso base in lettura/scrittura sulla clipboard
|
|
339
|
-
*/
|
|
340
|
-
class BaseExtensionsService {
|
|
341
|
-
constructor(emb) {
|
|
342
|
-
this.emb = emb;
|
|
343
|
-
this.RedirectMap = {};
|
|
344
|
-
this.RoutesMap = {};
|
|
345
|
-
for (let prop in this.RedirectMap) {
|
|
346
|
-
this.RoutesMap[prop] = { route: null };
|
|
347
|
-
this.RoutesMap[prop].route = (param) => {
|
|
348
|
-
let obj = {};
|
|
349
|
-
obj[this.RedirectMap[prop].params[0]] = param;
|
|
350
|
-
return [(this.emb.Embedded ? "pages_ext/" : "pages/") + this.RedirectMap[prop].url, obj];
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
BaseExtensionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseExtensionsService, deps: [{ token: AppEmbeddingExtensions }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
356
|
-
BaseExtensionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseExtensionsService, providedIn: "root" });
|
|
357
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseExtensionsService, decorators: [{
|
|
358
|
-
type: Injectable,
|
|
359
|
-
args: [{ providedIn: "root" }]
|
|
360
|
-
}], ctorParameters: function () { return [{ type: AppEmbeddingExtensions }]; } });
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Suffisso della proprietà da generare in cui salvare il navigatore
|
|
364
|
-
* utilizzato dal servizio di esportazione per prendere il valore delle proprietà di un oggetto
|
|
365
|
-
*/
|
|
366
|
-
const csvValueNavigator = "_csvnav";
|
|
367
|
-
/** Suffisso con le informazioni del tipo per le esportazioni di oggetti */
|
|
368
|
-
const csvValueType = "_csvtype";
|
|
369
|
-
/** Suffisso della proprietà da generare in cui salvare l'ordine di esportazione */
|
|
370
|
-
const csvOrdPrefix = "_csvord";
|
|
371
|
-
/** Suffisso della proprietà da generare in cui salvare la visibilità di questa proprietà */
|
|
372
|
-
const csvVisPrefix = "_csvvis";
|
|
373
|
-
/** Suffisso della proprietà da generare in cui salvare il nome della colonna in cui salvare questa proprietà */
|
|
374
|
-
const csvHdrPrefix = "_csvhdr";
|
|
375
|
-
/** Suffisso della proprietà da generare in cui salvare il codice del th a cui si riferisce questo campo */
|
|
376
|
-
const csvPropKey = "_csvkey";
|
|
377
|
-
/** Suffisso della proprietà da generare in cui salvare il valore da prendere per una proprietà di tipo Lista */
|
|
378
|
-
const listCsvValPrefix = "_listcsvval";
|
|
379
|
-
/** Suffisso della proprietà da generare in cui salvare l'Header della proprietà di tipo Lista relativo al valore esportato nella proprietà con suffisso **listCsvValPrefix** */
|
|
380
|
-
const listCsvHdrPrefix = "_listcsvhdr";
|
|
381
|
-
/** Suffisso della proprietà da generare in cui salvare il formato della proprietà di tipo Lista relativo al valore esportato nella proprietà con suffisso **listCsvValPrefix** */
|
|
382
|
-
const listCsvValFormat = "_listcsvvalformat";
|
|
383
|
-
/** Suffisso della proprietà da generare in cui salvare il valore da prendere per una proprietà di tipo Dizionario */
|
|
384
|
-
const dictionaryCsvValPrefix = "_flatlistcsvval";
|
|
385
|
-
/** Suffisso della proprietà da generare in cui salvare l'Header della proprietà di un Dizionario relativo al valore esportato nella proprietà con suffisso **dictionaryCsvValPrefix** */
|
|
386
|
-
const dictionaryCsvHdrPrefix = "_flatlistcsvhdr";
|
|
387
|
-
/** Suffisso della proprietà da generare in cui salvare il formato della proprietà che si sta esportando */
|
|
388
|
-
const csvFormatPrefix = "_csvfmt";
|
|
389
|
-
/** Nome della proprietà che contiene tutti i nomi di tutte le proprietà da esportare */
|
|
390
|
-
const exportList = "__export_list__";
|
|
391
|
-
/** Nome della proprietà che contiene la classe di localizzazione da utilizzare per una data esportazione */
|
|
392
|
-
const locProperty = "__loc__";
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Mappatura del TypeCode del C#
|
|
396
|
-
*/
|
|
397
|
-
var TypeCode;
|
|
398
|
-
(function (TypeCode) {
|
|
399
|
-
/** @ignore */ TypeCode[TypeCode["Empty"] = 0] = "Empty";
|
|
400
|
-
/** @ignore */ TypeCode[TypeCode["Obj"] = 1] = "Obj";
|
|
401
|
-
/** @ignore */ TypeCode[TypeCode["DBNull"] = 2] = "DBNull";
|
|
402
|
-
/** @ignore */ TypeCode[TypeCode["Boolean"] = 3] = "Boolean";
|
|
403
|
-
/** @ignore */ TypeCode[TypeCode["Char"] = 4] = "Char";
|
|
404
|
-
/** @ignore */ TypeCode[TypeCode["SByte"] = 5] = "SByte";
|
|
405
|
-
/** @ignore */ TypeCode[TypeCode["Byte"] = 6] = "Byte";
|
|
406
|
-
/** @ignore */ TypeCode[TypeCode["Int16"] = 7] = "Int16";
|
|
407
|
-
/** @ignore */ TypeCode[TypeCode["UInt16"] = 8] = "UInt16";
|
|
408
|
-
/** @ignore */ TypeCode[TypeCode["Int32"] = 9] = "Int32";
|
|
409
|
-
/** @ignore */ TypeCode[TypeCode["UInt32"] = 10] = "UInt32";
|
|
410
|
-
/** @ignore */ TypeCode[TypeCode["Int64"] = 11] = "Int64";
|
|
411
|
-
/** @ignore */ TypeCode[TypeCode["UInt64"] = 12] = "UInt64";
|
|
412
|
-
/** @ignore */ TypeCode[TypeCode["Single"] = 13] = "Single";
|
|
413
|
-
/** @ignore */ TypeCode[TypeCode["Double"] = 14] = "Double";
|
|
414
|
-
/** @ignore */ TypeCode[TypeCode["Decimal"] = 15] = "Decimal";
|
|
415
|
-
/** @ignore */ TypeCode[TypeCode["DateTime"] = 16] = "DateTime";
|
|
416
|
-
/** @ignore */ TypeCode[TypeCode["String"] = 18] = "String";
|
|
417
|
-
})(TypeCode || (TypeCode = {}));
|
|
418
|
-
|
|
419
316
|
// Angular
|
|
420
317
|
/**
|
|
421
|
-
* Service che fornisce
|
|
318
|
+
* Service che fornisce alcuni semplici funzioni di Hashing / GUID / ecc...
|
|
422
319
|
*/
|
|
423
|
-
class
|
|
320
|
+
class HashingService {
|
|
424
321
|
constructor() {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
this.
|
|
322
|
+
/**
|
|
323
|
+
* Blacklist dei tipi da ignorare quando si effettua l'hashing degli oggetti
|
|
324
|
+
*/
|
|
325
|
+
this.objBlacklist = {
|
|
326
|
+
"NgForm": true, "ElementRef": true, "ExtensionsService": true, "ToastrService": true, "LocaleService": true, "AppState": true, "Router": true,
|
|
327
|
+
"ActivatedRoute": true, "HTTPService": true, "Location": true, "CanvasComponent": true, "ModalDirective": true, "ChangeDetectorRef": true,
|
|
328
|
+
"DateService": true, "EventEmitter": true, "ViewRef_": true, "Subscriber": true, "ItemLocalization": true
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Array dei possibili valori di un simbolo esadecimale
|
|
332
|
+
*/
|
|
333
|
+
this.hex_chr = '0123456789abcdef'.split('');
|
|
429
334
|
}
|
|
430
335
|
/**
|
|
431
|
-
*
|
|
336
|
+
* Generazione di un GUID pseudo-univoco
|
|
337
|
+
*
|
|
338
|
+
* @returns {string} il GUID generato
|
|
432
339
|
*/
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
window.getSelection().removeAllRanges();
|
|
439
|
-
}
|
|
440
|
-
else if (document.selection) // IE?
|
|
441
|
-
document.selection.empty();
|
|
340
|
+
getGUID() {
|
|
341
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
342
|
+
var r = Math.random() * 16 | 0, v = c == "x" ? r : (r & 0x3 | 0x8);
|
|
343
|
+
return v.toString(16);
|
|
344
|
+
});
|
|
442
345
|
}
|
|
443
346
|
/**
|
|
444
|
-
*
|
|
445
|
-
* trova e restituisce l'oggetto desiderato
|
|
347
|
+
* Calcolo dell'hash su un oggetto
|
|
446
348
|
*
|
|
447
|
-
* @param {
|
|
448
|
-
* @param {
|
|
449
|
-
* @param {
|
|
349
|
+
* @param {any} o Oggetto di cui calcolare l'hash
|
|
350
|
+
* @param {number} level Livello di ricorsione nel caso venga effettuato l'hash di un oggetto che contiene altri oggetti
|
|
351
|
+
* @param {boolean} navigateFullDepth Indica se navigare l'oggetto per l'intera lunghezza. In caso contrario si ferma al secondo livello
|
|
450
352
|
*
|
|
451
|
-
* @returns {
|
|
353
|
+
* @returns {string} Hash generato per l'oggetto in questione
|
|
452
354
|
*/
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
355
|
+
hashObject(o, level = 0, navigateFullDepth = false, precise = false) {
|
|
356
|
+
var strDef = this.stringify(o, level, navigateFullDepth);
|
|
357
|
+
var hash = precise ? this.md5(strDef) : this.simpleHash(strDef);
|
|
358
|
+
return hash;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Hash più semplice e più veloce dell'md5, ma meno sicuro
|
|
362
|
+
*
|
|
363
|
+
* Vedi https://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript
|
|
364
|
+
*
|
|
365
|
+
* @param {string} str Stringa di cui calcolare l'hash
|
|
366
|
+
*/
|
|
367
|
+
simpleHash(str, seed = 0) {
|
|
368
|
+
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
|
|
369
|
+
for (let i = 0, ch; i < str.length; i++) {
|
|
370
|
+
ch = str.charCodeAt(i);
|
|
371
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
372
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
458
373
|
}
|
|
459
|
-
|
|
374
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
375
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
376
|
+
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString();
|
|
460
377
|
}
|
|
461
378
|
/**
|
|
462
|
-
*
|
|
379
|
+
* Genera una stringa che identifica univocamente l'oggetto in questione
|
|
463
380
|
*
|
|
464
|
-
* @param {
|
|
465
|
-
* @param {
|
|
466
|
-
* @param {
|
|
381
|
+
* @param {any} o Oggetto di cui calcolare la stringa univoca
|
|
382
|
+
* @param {number} level Livello di ricorsione nel caso venga effettuato l'hash di un oggetto che contiene altri oggetti
|
|
383
|
+
* @param {boolean} navigateFullDepth Indica se navigare l'oggetto per l'intera lunghezza. In caso contrario si ferma al secondo livello
|
|
467
384
|
*/
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
385
|
+
stringify(o, level, navigateFullDepth) {
|
|
386
|
+
var i, r;
|
|
387
|
+
if (o === null)
|
|
388
|
+
return "n";
|
|
389
|
+
if (o === true)
|
|
390
|
+
return "t";
|
|
391
|
+
if (o === false)
|
|
392
|
+
return "f";
|
|
393
|
+
if (o instanceof Date)
|
|
394
|
+
return 'd:' + o.valueOf().toString();
|
|
395
|
+
i = typeof o;
|
|
396
|
+
if (i === "string")
|
|
397
|
+
return "s:" + o;
|
|
398
|
+
if (i === "number")
|
|
399
|
+
return "n:" + o;
|
|
400
|
+
if (o instanceof Function)
|
|
401
|
+
return "m:" + o.toString();
|
|
402
|
+
if (o instanceof Array) {
|
|
403
|
+
r = [];
|
|
404
|
+
for (i = 0; i < o.length; i++) {
|
|
405
|
+
let res = this.stringify(o[i], level, navigateFullDepth);
|
|
406
|
+
if (res)
|
|
407
|
+
r.push(res);
|
|
472
408
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
409
|
+
return r.length > 0 ? "a:" + r.join(";") : "";
|
|
410
|
+
}
|
|
411
|
+
r = [];
|
|
412
|
+
//Se è oggetto, escludo tutti quelli di sistema/inutili
|
|
413
|
+
if (o) {
|
|
414
|
+
var name = o.__proto__.constructor.name;
|
|
415
|
+
if (!this.objBlacklist[name]) {
|
|
416
|
+
for (i in o) {
|
|
417
|
+
if (o.hasOwnProperty(i) && (level <= 2 || navigateFullDepth)) {
|
|
418
|
+
let res = this.stringify(o[i], level + 1, navigateFullDepth);
|
|
419
|
+
if (res)
|
|
420
|
+
r.push(i + ":" + res);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
476
423
|
}
|
|
477
424
|
}
|
|
478
|
-
|
|
479
|
-
form.submitted = false;
|
|
425
|
+
return r.length > 0 ? "o:" + r.join(";") : "";
|
|
480
426
|
}
|
|
481
427
|
/**
|
|
482
|
-
*
|
|
428
|
+
* Data una stringa restituisce l'md5
|
|
483
429
|
*
|
|
484
|
-
* @param {string}
|
|
485
|
-
* @
|
|
430
|
+
* @param {string} s Stringa di cui calcolare l'md5
|
|
431
|
+
* @returns {string} md5 della stringa **s**
|
|
486
432
|
*/
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
document.body.appendChild(a);
|
|
490
|
-
a.className = "ta-display-none";
|
|
491
|
-
a.href = url;
|
|
492
|
-
a.download = fileName;
|
|
493
|
-
a.click();
|
|
494
|
-
window.URL.revokeObjectURL(url);
|
|
495
|
-
document.body.removeChild(a);
|
|
433
|
+
md5(s) {
|
|
434
|
+
return this.hex(this.md51(s));
|
|
496
435
|
}
|
|
497
436
|
/**
|
|
498
|
-
*
|
|
437
|
+
* @ignore
|
|
499
438
|
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
* @returns {string} Durata formattata
|
|
439
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
503
440
|
*/
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
441
|
+
md5cycle(x, k) {
|
|
442
|
+
var a = x[0], b = x[1], c = x[2], d = x[3];
|
|
443
|
+
a = this.ff(a, b, c, d, k[0], 7, -680876936);
|
|
444
|
+
d = this.ff(d, a, b, c, k[1], 12, -389564586);
|
|
445
|
+
c = this.ff(c, d, a, b, k[2], 17, 606105819);
|
|
446
|
+
b = this.ff(b, c, d, a, k[3], 22, -1044525330);
|
|
447
|
+
a = this.ff(a, b, c, d, k[4], 7, -176418897);
|
|
448
|
+
d = this.ff(d, a, b, c, k[5], 12, 1200080426);
|
|
449
|
+
c = this.ff(c, d, a, b, k[6], 17, -1473231341);
|
|
450
|
+
b = this.ff(b, c, d, a, k[7], 22, -45705983);
|
|
451
|
+
a = this.ff(a, b, c, d, k[8], 7, 1770035416);
|
|
452
|
+
d = this.ff(d, a, b, c, k[9], 12, -1958414417);
|
|
453
|
+
c = this.ff(c, d, a, b, k[10], 17, -42063);
|
|
454
|
+
b = this.ff(b, c, d, a, k[11], 22, -1990404162);
|
|
455
|
+
a = this.ff(a, b, c, d, k[12], 7, 1804603682);
|
|
456
|
+
d = this.ff(d, a, b, c, k[13], 12, -40341101);
|
|
457
|
+
c = this.ff(c, d, a, b, k[14], 17, -1502002290);
|
|
458
|
+
b = this.ff(b, c, d, a, k[15], 22, 1236535329);
|
|
459
|
+
a = this.gg(a, b, c, d, k[1], 5, -165796510);
|
|
460
|
+
d = this.gg(d, a, b, c, k[6], 9, -1069501632);
|
|
461
|
+
c = this.gg(c, d, a, b, k[11], 14, 643717713);
|
|
462
|
+
b = this.gg(b, c, d, a, k[0], 20, -373897302);
|
|
463
|
+
a = this.gg(a, b, c, d, k[5], 5, -701558691);
|
|
464
|
+
d = this.gg(d, a, b, c, k[10], 9, 38016083);
|
|
465
|
+
c = this.gg(c, d, a, b, k[15], 14, -660478335);
|
|
466
|
+
b = this.gg(b, c, d, a, k[4], 20, -405537848);
|
|
467
|
+
a = this.gg(a, b, c, d, k[9], 5, 568446438);
|
|
468
|
+
d = this.gg(d, a, b, c, k[14], 9, -1019803690);
|
|
469
|
+
c = this.gg(c, d, a, b, k[3], 14, -187363961);
|
|
470
|
+
b = this.gg(b, c, d, a, k[8], 20, 1163531501);
|
|
471
|
+
a = this.gg(a, b, c, d, k[13], 5, -1444681467);
|
|
472
|
+
d = this.gg(d, a, b, c, k[2], 9, -51403784);
|
|
473
|
+
c = this.gg(c, d, a, b, k[7], 14, 1735328473);
|
|
474
|
+
b = this.gg(b, c, d, a, k[12], 20, -1926607734);
|
|
475
|
+
a = this.hh(a, b, c, d, k[5], 4, -378558);
|
|
476
|
+
d = this.hh(d, a, b, c, k[8], 11, -2022574463);
|
|
477
|
+
c = this.hh(c, d, a, b, k[11], 16, 1839030562);
|
|
478
|
+
b = this.hh(b, c, d, a, k[14], 23, -35309556);
|
|
479
|
+
a = this.hh(a, b, c, d, k[1], 4, -1530992060);
|
|
480
|
+
d = this.hh(d, a, b, c, k[4], 11, 1272893353);
|
|
481
|
+
c = this.hh(c, d, a, b, k[7], 16, -155497632);
|
|
482
|
+
b = this.hh(b, c, d, a, k[10], 23, -1094730640);
|
|
483
|
+
a = this.hh(a, b, c, d, k[13], 4, 681279174);
|
|
484
|
+
d = this.hh(d, a, b, c, k[0], 11, -358537222);
|
|
485
|
+
c = this.hh(c, d, a, b, k[3], 16, -722521979);
|
|
486
|
+
b = this.hh(b, c, d, a, k[6], 23, 76029189);
|
|
487
|
+
a = this.hh(a, b, c, d, k[9], 4, -640364487);
|
|
488
|
+
d = this.hh(d, a, b, c, k[12], 11, -421815835);
|
|
489
|
+
c = this.hh(c, d, a, b, k[15], 16, 530742520);
|
|
490
|
+
b = this.hh(b, c, d, a, k[2], 23, -995338651);
|
|
491
|
+
a = this.ii(a, b, c, d, k[0], 6, -198630844);
|
|
492
|
+
d = this.ii(d, a, b, c, k[7], 10, 1126891415);
|
|
493
|
+
c = this.ii(c, d, a, b, k[14], 15, -1416354905);
|
|
494
|
+
b = this.ii(b, c, d, a, k[5], 21, -57434055);
|
|
495
|
+
a = this.ii(a, b, c, d, k[12], 6, 1700485571);
|
|
496
|
+
d = this.ii(d, a, b, c, k[3], 10, -1894986606);
|
|
497
|
+
c = this.ii(c, d, a, b, k[10], 15, -1051523);
|
|
498
|
+
b = this.ii(b, c, d, a, k[1], 21, -2054922799);
|
|
499
|
+
a = this.ii(a, b, c, d, k[8], 6, 1873313359);
|
|
500
|
+
d = this.ii(d, a, b, c, k[15], 10, -30611744);
|
|
501
|
+
c = this.ii(c, d, a, b, k[6], 15, -1560198380);
|
|
502
|
+
b = this.ii(b, c, d, a, k[13], 21, 1309151649);
|
|
503
|
+
a = this.ii(a, b, c, d, k[4], 6, -145523070);
|
|
504
|
+
d = this.ii(d, a, b, c, k[11], 10, -1120210379);
|
|
505
|
+
c = this.ii(c, d, a, b, k[2], 15, 718787259);
|
|
506
|
+
b = this.ii(b, c, d, a, k[9], 21, -343485551);
|
|
507
|
+
x[0] = this.add32(a, x[0]);
|
|
508
|
+
x[1] = this.add32(b, x[1]);
|
|
509
|
+
x[2] = this.add32(c, x[2]);
|
|
510
|
+
x[3] = this.add32(d, x[3]);
|
|
512
511
|
}
|
|
513
512
|
/**
|
|
514
|
-
*
|
|
513
|
+
* @ignore
|
|
515
514
|
*
|
|
516
|
-
*
|
|
517
|
-
* @param {string} filename Nome del file suggerito in fase di salvataggio
|
|
515
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
518
516
|
*/
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
this.
|
|
517
|
+
cmn(q, a, b, x, s, t) {
|
|
518
|
+
a = this.add32(this.add32(a, q), this.add32(x, t));
|
|
519
|
+
return this.add32((a << s) | (a >>> (32 - s)), b);
|
|
522
520
|
}
|
|
523
521
|
/**
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
* @param {string} base64Data Base64 da trasformare
|
|
522
|
+
* @ignore
|
|
527
523
|
*
|
|
528
|
-
*
|
|
524
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
529
525
|
*/
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
var binaryLen = binaryString.length;
|
|
533
|
-
var bytes = new Uint8Array(binaryLen);
|
|
534
|
-
for (var i = 0; i < binaryLen; i++) {
|
|
535
|
-
var ascii = binaryString.charCodeAt(i);
|
|
536
|
-
bytes[i] = ascii;
|
|
537
|
-
}
|
|
538
|
-
return bytes;
|
|
526
|
+
ff(a, b, c, d, x, s, t) {
|
|
527
|
+
return this.cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
|
539
528
|
}
|
|
540
529
|
/**
|
|
541
|
-
*
|
|
530
|
+
* @ignore
|
|
542
531
|
*
|
|
543
|
-
*
|
|
544
|
-
* @param {string} filename Nome del file suggerito in fase di salvataggio
|
|
532
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
545
533
|
*/
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
var link = document.createElement("a");
|
|
549
|
-
document.body.appendChild(link);
|
|
550
|
-
link.href = window.URL.createObjectURL(blob);
|
|
551
|
-
var fileName = filename;
|
|
552
|
-
link.download = fileName;
|
|
553
|
-
link.click();
|
|
554
|
-
document.body.removeChild(link);
|
|
534
|
+
gg(a, b, c, d, x, s, t) {
|
|
535
|
+
return this.cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
|
555
536
|
}
|
|
556
|
-
;
|
|
557
537
|
/**
|
|
558
|
-
*
|
|
538
|
+
* @ignore
|
|
559
539
|
*
|
|
560
|
-
*
|
|
561
|
-
* @param {number} x Indice del primo elemento
|
|
562
|
-
* @param {number} y Indice del secondo elemento
|
|
540
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
563
541
|
*/
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
array[x] = array[y];
|
|
567
|
-
array[y] = b;
|
|
542
|
+
hh(a, b, c, d, x, s, t) {
|
|
543
|
+
return this.cmn(b ^ c ^ d, a, b, x, s, t);
|
|
568
544
|
}
|
|
569
545
|
/**
|
|
570
|
-
*
|
|
546
|
+
* @ignore
|
|
571
547
|
*
|
|
572
|
-
*
|
|
548
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
549
|
+
*/
|
|
550
|
+
ii(a, b, c, d, x, s, t) {
|
|
551
|
+
return this.cmn(c ^ (b | (~d)), a, b, x, s, t);
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* @ignore
|
|
573
555
|
*
|
|
574
|
-
*
|
|
556
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
575
557
|
*/
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
case TypeCode.UInt32:
|
|
590
|
-
case TypeCode.UInt64:
|
|
591
|
-
return "number";
|
|
592
|
-
case TypeCode.Char:
|
|
593
|
-
case TypeCode.String:
|
|
594
|
-
return "string";
|
|
595
|
-
case TypeCode.DateTime:
|
|
596
|
-
return "date";
|
|
597
|
-
default:
|
|
598
|
-
console.log("Unrecognized input type. Typecode:" + type);
|
|
599
|
-
return "string";
|
|
558
|
+
md51(s) {
|
|
559
|
+
var n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i;
|
|
560
|
+
for (i = 64; i <= s.length; i += 64)
|
|
561
|
+
this.md5cycle(state, this.md5blk(s.substring(i - 64, i)));
|
|
562
|
+
s = s.substring(i - 64);
|
|
563
|
+
var tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
|
564
|
+
for (i = 0; i < s.length; i++)
|
|
565
|
+
tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
|
|
566
|
+
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
567
|
+
if (i > 55) {
|
|
568
|
+
this.md5cycle(state, tail);
|
|
569
|
+
for (i = 0; i < 16; i++)
|
|
570
|
+
tail[i] = 0;
|
|
600
571
|
}
|
|
572
|
+
tail[14] = n * 8;
|
|
573
|
+
this.md5cycle(state, tail);
|
|
574
|
+
return state;
|
|
601
575
|
}
|
|
602
576
|
/**
|
|
603
|
-
*
|
|
577
|
+
* @ignore
|
|
604
578
|
*
|
|
605
|
-
*
|
|
579
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
580
|
+
*/
|
|
581
|
+
md5blk(s) {
|
|
582
|
+
var md5blks = [], i;
|
|
583
|
+
for (i = 0; i < 64; i += 4)
|
|
584
|
+
md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
|
|
585
|
+
return md5blks;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* @ignore
|
|
606
589
|
*
|
|
607
|
-
*
|
|
590
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
591
|
+
*/
|
|
592
|
+
rhex(n) {
|
|
593
|
+
var s = '', j = 0;
|
|
594
|
+
for (; j < 4; j++)
|
|
595
|
+
s += this.hex_chr[(n >> (j * 8 + 4)) & 0x0F] + this.hex_chr[(n >> (j * 8)) & 0x0F];
|
|
596
|
+
return s;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* @ignore
|
|
608
600
|
*
|
|
609
|
-
*
|
|
601
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
610
602
|
*/
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
// Pseudo Struct
|
|
616
|
-
switch (toString.call(source)) {
|
|
617
|
-
case '[object Boolean]':
|
|
618
|
-
case '[object Number]':
|
|
619
|
-
case '[object String]':
|
|
620
|
-
case '[object Date]':
|
|
621
|
-
return new source.constructor(source.valueOf());
|
|
622
|
-
// Clonazione di un file -> Restituisco il riferimento al file stesso
|
|
623
|
-
case "[object File]":
|
|
624
|
-
return source;
|
|
625
|
-
default: break;
|
|
626
|
-
}
|
|
627
|
-
// Oggetti Complessi
|
|
628
|
-
return this.recursiveStep(source, Array.isArray(source) || source instanceof Array ? [] : Object.create(Object.getPrototypeOf(source)));
|
|
603
|
+
hex(x) {
|
|
604
|
+
for (var i = 0; i < x.length; i++)
|
|
605
|
+
x[i] = this.rhex(x[i]);
|
|
606
|
+
return x.join('');
|
|
629
607
|
}
|
|
630
608
|
/**
|
|
631
609
|
* @ignore
|
|
632
|
-
*
|
|
610
|
+
*
|
|
611
|
+
* Metodo di utilità per il calcolo dell'md5
|
|
633
612
|
*/
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
for (var i = 0, ii = source.length; i < ii; i++)
|
|
637
|
-
destination.push(this.deepClone(source[i]));
|
|
638
|
-
}
|
|
639
|
-
else if (source && typeof source.hasOwnProperty === 'function') {
|
|
640
|
-
for (let key in source) {
|
|
641
|
-
if (source.hasOwnProperty(key))
|
|
642
|
-
destination[key] = this.deepClone(source[key]);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
return destination;
|
|
646
|
-
}
|
|
647
|
-
cast(object, clss) {
|
|
648
|
-
let ret = Object.assign(Object.create(clss.prototype), object);
|
|
649
|
-
return ret;
|
|
650
|
-
}
|
|
651
|
-
/** @ignore */
|
|
652
|
-
throttla(id, func, throttleTime) {
|
|
653
|
-
//Se ho la funzione che vuole eseguire ripulisco quel timeout
|
|
654
|
-
if (this.executionTimers[id])
|
|
655
|
-
clearTimeout(this.executionTimers[id]);
|
|
656
|
-
//Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
|
|
657
|
-
this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
|
|
613
|
+
add32(a, b) {
|
|
614
|
+
return (a + b) & 0xFFFFFFFF;
|
|
658
615
|
}
|
|
659
616
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
617
|
+
HashingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HashingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
618
|
+
HashingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HashingService, providedIn: "root" });
|
|
619
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: HashingService, decorators: [{
|
|
663
620
|
type: Injectable,
|
|
664
621
|
args: [{ providedIn: "root" }]
|
|
665
622
|
}] });
|
|
666
623
|
|
|
667
624
|
// Angular
|
|
668
625
|
/**
|
|
669
|
-
*
|
|
670
|
-
*
|
|
671
|
-
* Sostanzilamente aggiunge la proprietà **__loc__** all'oggetto creato dalla classe corrente assegnandogli come valore il tipo del LocalizationService da usare per la traduzione
|
|
672
|
-
*
|
|
673
|
-
* @param {Type<LocalizationService>} loc Tipo ereditato dal LocalizationService che può essere creato a runtime sotto contesto della DI di Angular
|
|
626
|
+
* Service che fornisce funzionalità di alert nei tipi fondamentali: success, info, warning e danger
|
|
674
627
|
*/
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
628
|
+
class MessageService {
|
|
629
|
+
/** Costruttore @ignore */
|
|
630
|
+
constructor(injector, locProvider, hash) {
|
|
631
|
+
this.injector = injector;
|
|
632
|
+
this.locProvider = locProvider;
|
|
633
|
+
this.hash = hash;
|
|
634
|
+
/** Oggetto statico in supporto alla localizzazione */
|
|
635
|
+
this.loc = {
|
|
636
|
+
'Confirm': { 'en-US': "Confirm", 'it-IT': "Conferma", },
|
|
637
|
+
'Cancel': { 'en-US': "Cancel", 'it-IT': "Annulla", },
|
|
638
|
+
'Close': { 'en-US': "Close", 'it-IT': "Chiudi", },
|
|
639
|
+
'Error': { 'en-US': "Error", 'it-IT': "Errore", },
|
|
640
|
+
'Info': { 'en-US': "Info", 'it-IT': "Informazione", },
|
|
641
|
+
'Success': { 'en-US': "Success", 'it-IT': "Successo", },
|
|
642
|
+
'Warning': { 'en-US': "Warning", 'it-IT': "Attenzione", }
|
|
682
643
|
};
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
* Ad esempio, da questa configurazione:
|
|
690
|
-
*
|
|
691
|
-
* @example
|
|
692
|
-
* ```
|
|
693
|
-
* @Export(true, "MyHeader")
|
|
694
|
-
* ciao: string;
|
|
695
|
-
* ```
|
|
696
|
-
*
|
|
697
|
-
* Nasceranno le seguenti proprietà nell'oggetto esportabile:
|
|
698
|
-
*
|
|
699
|
-
* @example
|
|
700
|
-
* ```
|
|
701
|
-
* ciao_csvvis: string; => true
|
|
702
|
-
* ciao: string;
|
|
703
|
-
* ciao_csvhdr: string => "MyHeader"
|
|
704
|
-
* ```
|
|
705
|
-
*
|
|
706
|
-
* @param {number} order Ordine di esportazione. Più piccolo è, prima appare il valore
|
|
707
|
-
* @param {string} header Titolo della colonna nel file CSV esportato
|
|
708
|
-
* @param {string} format Formato di esportazione. Può essere un formato data per i campi data o 'F' per i campi floating point
|
|
709
|
-
*/
|
|
710
|
-
const Export = (order, header, format = null, tableid = null) => (target, propertyKey) => {
|
|
711
|
-
if (format)
|
|
712
|
-
Object.defineProperty(target, propertyKey + csvFormatPrefix, { value: format, writable: false });
|
|
713
|
-
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
714
|
-
Object.defineProperty(target, propertyKey + csvVisPrefix, { value: !!header, writable: false });
|
|
715
|
-
Object.defineProperty(target, propertyKey + csvHdrPrefix, { value: header, writable: false });
|
|
716
|
-
if (tableid)
|
|
717
|
-
Object.defineProperty(target, propertyKey + csvPropKey, { value: tableid, writable: false });
|
|
718
|
-
if (target[exportList])
|
|
719
|
-
target[exportList].push(propertyKey + csvVisPrefix);
|
|
720
|
-
else
|
|
721
|
-
target[exportList] = [propertyKey + csvVisPrefix];
|
|
722
|
-
};
|
|
723
|
-
/**
|
|
724
|
-
* Decoratore di esportazione utilizzabile su un oggetto.
|
|
725
|
-
* Per ogni proprietà dell'oggetto verranno generate 3 proprietà che gestiranno l'esportazione: (prop, prop_csvvis, prop_csvhdr).
|
|
726
|
-
* Per essere esportate, le proprietà dell'oggetto devono essere marcate con i Decoratori di esportazione
|
|
727
|
-
*
|
|
728
|
-
* Ad esempio, da questa configurazione:
|
|
729
|
-
*
|
|
730
|
-
* @example
|
|
731
|
-
* ```
|
|
732
|
-
* MyObj {
|
|
733
|
-
* @Export(true, "MyHeader")
|
|
734
|
-
* ciao: string;
|
|
735
|
-
* }
|
|
736
|
-
*
|
|
737
|
-
* @ExportObject(true, "MyHeader")
|
|
738
|
-
* test: MyObj;
|
|
739
|
-
* ```
|
|
740
|
-
*
|
|
741
|
-
* Nasceranno le seguenti proprietà nell'oggetto esportabile:
|
|
742
|
-
*
|
|
743
|
-
* @example
|
|
744
|
-
* ```
|
|
745
|
-
* testciao: string; => Valore di MyObj.ciao
|
|
746
|
-
* testciao_csvvis: string; => true
|
|
747
|
-
* testciao_csvhdr: string => "MyHeader"
|
|
748
|
-
* ```
|
|
749
|
-
*
|
|
750
|
-
* @param {number} order Ordine di esportazione. Più piccolo è, prima appare il valore
|
|
751
|
-
* @param {any} type Tipo da esportare
|
|
752
|
-
*/
|
|
753
|
-
const ExportAs = (order, type, prefix) => (target, propertyKey) => {
|
|
754
|
-
var t = new type();
|
|
755
|
-
var props = t[exportList];
|
|
756
|
-
for (let i = 0; i < props.length; i++) {
|
|
757
|
-
let prop = props[i].replace(csvVisPrefix, '');
|
|
758
|
-
if (typeof t[prop + csvVisPrefix] !== "undefined") {
|
|
759
|
-
var toEmit = t[prop + csvVisPrefix];
|
|
760
|
-
var lbl = t[prop + csvHdrPrefix];
|
|
761
|
-
var format = t[prop + csvFormatPrefix];
|
|
762
|
-
var orderProp = t[prop + csvOrdPrefix];
|
|
763
|
-
if (format)
|
|
764
|
-
Object.defineProperty(target, propertyKey + prop + csvFormatPrefix, { value: format, writable: false });
|
|
765
|
-
Object.defineProperty(target, propertyKey + prop + csvOrdPrefix, { value: orderProp + order, writable: false });
|
|
766
|
-
Object.defineProperty(target, propertyKey + prop, { value: null, writable: true, enumerable: true });
|
|
767
|
-
Object.defineProperty(target, propertyKey + prop + csvValueNavigator, { value: propertyKey + "." + prop, writable: false });
|
|
768
|
-
Object.defineProperty(target, propertyKey + prop + csvVisPrefix, { value: toEmit, writable: false });
|
|
769
|
-
Object.defineProperty(target, propertyKey + prop + csvHdrPrefix, { value: (prefix ? prefix + ' ' : '') + lbl, writable: false });
|
|
770
|
-
Object.defineProperty(target, propertyKey + prop + csvValueType, { value: type, writable: false });
|
|
771
|
-
if (target[exportList])
|
|
772
|
-
target[exportList].push(propertyKey + prop + csvVisPrefix);
|
|
773
|
-
else
|
|
774
|
-
target[exportList] = [propertyKey + prop + csvVisPrefix];
|
|
775
|
-
}
|
|
644
|
+
/** Supporto all'Embedding */
|
|
645
|
+
this.Embedded = false;
|
|
646
|
+
this.MainWindow = null;
|
|
647
|
+
this.MessageObserver = null;
|
|
648
|
+
this.GuidRepsonseFunctionsMap = {};
|
|
649
|
+
this.init();
|
|
776
650
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
this.
|
|
841
|
-
|
|
842
|
-
|
|
651
|
+
/** Getter per il servizio dei toast. ngx-toastr è fatta talmente male che la service dev'essere recuperata in questo modo */
|
|
652
|
+
get toastr() {
|
|
653
|
+
return this.injector.get(ToastrService);
|
|
654
|
+
}
|
|
655
|
+
configureEmbeddability(mainWindow, messageObserver) {
|
|
656
|
+
this.Embedded = true;
|
|
657
|
+
this.MainWindow = mainWindow;
|
|
658
|
+
this.MessageObserver = messageObserver;
|
|
659
|
+
}
|
|
660
|
+
async init() {
|
|
661
|
+
let LOCALE = this.locProvider ? await this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
|
|
662
|
+
this.expiredSessionSwal = swal.mixin({
|
|
663
|
+
showCancelButton: false,
|
|
664
|
+
confirmButtonText: 'Login',
|
|
665
|
+
customClass: {
|
|
666
|
+
confirmButton: "btn btn-primary",
|
|
667
|
+
container: "app-wrap",
|
|
668
|
+
},
|
|
669
|
+
buttonsStyling: false,
|
|
670
|
+
reverseButtons: false,
|
|
671
|
+
allowOutsideClick: false,
|
|
672
|
+
icon: "warning"
|
|
673
|
+
});
|
|
674
|
+
this.successSwalWithCancel = swal.mixin({
|
|
675
|
+
title: this.loc["Success"][LOCALE],
|
|
676
|
+
customClass: {
|
|
677
|
+
confirmButton: "btn btn-primary",
|
|
678
|
+
cancelButton: "btn btn-secondary app-margin-right-10",
|
|
679
|
+
container: "app-wrap",
|
|
680
|
+
},
|
|
681
|
+
buttonsStyling: false,
|
|
682
|
+
reverseButtons: true,
|
|
683
|
+
showCancelButton: true,
|
|
684
|
+
confirmButtonText: this.loc["Confirm"][LOCALE],
|
|
685
|
+
cancelButtonText: this.loc["Cancel"][LOCALE],
|
|
686
|
+
icon: "success"
|
|
687
|
+
});
|
|
688
|
+
this.warningSwalWithCancel = swal.mixin({
|
|
689
|
+
title: this.loc["Warning"][LOCALE],
|
|
690
|
+
customClass: {
|
|
691
|
+
confirmButton: "btn btn-primary",
|
|
692
|
+
cancelButton: "btn btn-secondary app-margin-right-10",
|
|
693
|
+
container: "app-wrap",
|
|
694
|
+
},
|
|
695
|
+
buttonsStyling: false,
|
|
696
|
+
reverseButtons: true,
|
|
697
|
+
showCancelButton: true,
|
|
698
|
+
confirmButtonText: this.loc["Confirm"][LOCALE],
|
|
699
|
+
cancelButtonText: this.loc["Cancel"][LOCALE],
|
|
700
|
+
icon: "warning"
|
|
701
|
+
});
|
|
702
|
+
this.warningSwal = swal.mixin({
|
|
703
|
+
title: this.loc["Warning"][LOCALE],
|
|
704
|
+
customClass: {
|
|
705
|
+
confirmButton: "btn btn-primary",
|
|
706
|
+
container: "app-wrap",
|
|
707
|
+
},
|
|
708
|
+
buttonsStyling: false,
|
|
709
|
+
reverseButtons: true,
|
|
710
|
+
showCancelButton: false,
|
|
711
|
+
confirmButtonText: this.loc["Close"][LOCALE],
|
|
712
|
+
icon: "warning"
|
|
713
|
+
});
|
|
714
|
+
this.successSwal = swal.mixin({
|
|
715
|
+
title: this.loc["Success"][LOCALE],
|
|
716
|
+
customClass: {
|
|
717
|
+
confirmButton: "btn btn-primary",
|
|
718
|
+
container: "app-wrap",
|
|
719
|
+
},
|
|
720
|
+
buttonsStyling: false,
|
|
721
|
+
reverseButtons: true,
|
|
722
|
+
showCancelButton: false,
|
|
723
|
+
confirmButtonText: this.loc["Close"][LOCALE],
|
|
724
|
+
icon: "success"
|
|
725
|
+
});
|
|
726
|
+
this.errorSwal = swal.mixin({
|
|
727
|
+
title: this.loc["Error"][LOCALE],
|
|
728
|
+
customClass: {
|
|
729
|
+
confirmButton: "btn btn-primary",
|
|
730
|
+
container: "app-wrap",
|
|
731
|
+
},
|
|
732
|
+
buttonsStyling: false,
|
|
733
|
+
reverseButtons: true,
|
|
734
|
+
showCancelButton: false,
|
|
735
|
+
confirmButtonText: this.loc["Close"][LOCALE],
|
|
736
|
+
icon: "error"
|
|
737
|
+
});
|
|
738
|
+
this.infoSwal = swal.mixin({
|
|
739
|
+
title: this.loc["Info"][LOCALE],
|
|
740
|
+
customClass: {
|
|
741
|
+
confirmButton: "btn btn-primary",
|
|
742
|
+
container: "app-wrap",
|
|
743
|
+
},
|
|
744
|
+
buttonsStyling: false,
|
|
745
|
+
reverseButtons: true,
|
|
746
|
+
showCancelButton: false,
|
|
747
|
+
confirmButtonText: this.loc["Close"][LOCALE],
|
|
748
|
+
icon: "info"
|
|
749
|
+
});
|
|
843
750
|
}
|
|
844
751
|
/**
|
|
845
|
-
*
|
|
752
|
+
* Presentazione di un semplice messaggio di successo
|
|
846
753
|
*
|
|
847
|
-
*
|
|
754
|
+
* Se viene chiamato con le impostazioni di default e toastr è abilitato, viene mostrato al centro
|
|
755
|
+
* Se viene chiamato con override su toastr vuol dire che è una notifica secondaria e appare in alto a destra
|
|
848
756
|
*
|
|
849
|
-
* @
|
|
757
|
+
* @param {string} text Testo da mostrare
|
|
758
|
+
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
850
759
|
*/
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
return headers;
|
|
856
|
-
// Devo per forza farlo per tutti gli oggetti dato che devo esporre le proprietà che mi servono da esportare
|
|
857
|
-
// Gli header li raccolgo tutti poi faccio uan distinct in modo da esportare tutte le proprietà per bene
|
|
858
|
-
let columnSelectionDictionary = {};
|
|
859
|
-
if (columns?.length > 0)
|
|
860
|
-
for (let i = 0; i < columns?.length; i++)
|
|
861
|
-
columnSelectionDictionary[columns[i]] = true;
|
|
862
|
-
for (let i = 0; i < objs.length; i++) {
|
|
863
|
-
let hds = this.parseAndGetHeaders(objs[i], columnSelectionDictionary);
|
|
864
|
-
// Aggiungo gli header facendo in modo di non aggiungerne mai due uguali per non dover fare una distinct dopo
|
|
865
|
-
// che costerebbe comunque risorse. Utilizzo un dizionario d'appoggio per lookup istantanei
|
|
866
|
-
for (let k = 0; k < hds.length; k++) {
|
|
867
|
-
if (!headersCache[hds[k].key]) {
|
|
868
|
-
headersCache[hds[k].key] = true;
|
|
869
|
-
headers.push(hds[k]);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
760
|
+
simpleSuccess(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
761
|
+
if (this.Embedded) {
|
|
762
|
+
this.MainWindow.postMessage({ type: "alert", level: 'success', msg: text }, "*");
|
|
763
|
+
return;
|
|
872
764
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
765
|
+
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
766
|
+
if (tos == "swal")
|
|
767
|
+
this.successSwal.fire("", text);
|
|
768
|
+
else
|
|
769
|
+
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 });
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Presentazione di un semplice messaggio di informazione
|
|
773
|
+
*
|
|
774
|
+
* Se viene chiamato con le impostazioni di default e toastr è abilitato, viene mostrato al centro
|
|
775
|
+
* Se viene chiamato con override su toastr vuol dire che è una notifica secondaria e appare in alto a destra
|
|
776
|
+
*
|
|
777
|
+
* @param {string} text Testo da mostrare
|
|
778
|
+
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
779
|
+
*/
|
|
780
|
+
simpleInfo(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
781
|
+
if (this.Embedded) {
|
|
782
|
+
this.MainWindow.postMessage({ type: "alert", level: 'info', msg: text }, "*");
|
|
783
|
+
return;
|
|
889
784
|
}
|
|
785
|
+
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
786
|
+
if (tos == "swal")
|
|
787
|
+
this.infoSwal.fire("", text);
|
|
788
|
+
else
|
|
789
|
+
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 });
|
|
890
790
|
}
|
|
891
791
|
/**
|
|
892
|
-
*
|
|
792
|
+
* Presentazione di un semplice messaggio di errore
|
|
893
793
|
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
794
|
+
* Se viene chiamato con le impostazioni di default e toastr è abilitato, viene mostrato al centro
|
|
795
|
+
* Se viene chiamato con override su toastr vuol dire che è una notifica secondaria e appare in alto a destra
|
|
896
796
|
*
|
|
897
|
-
* @
|
|
797
|
+
* @param {string} text Testo da mostrare
|
|
798
|
+
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
898
799
|
*/
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
return
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
});
|
|
910
|
-
return headers;
|
|
800
|
+
simpleError(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
801
|
+
if (this.Embedded) {
|
|
802
|
+
this.MainWindow.postMessage({ type: "alert", level: 'error', msg: text }, "*");
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
806
|
+
if (tos == "swal")
|
|
807
|
+
this.errorSwal.fire("", text);
|
|
808
|
+
else
|
|
809
|
+
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 });
|
|
911
810
|
}
|
|
912
811
|
/**
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
* Metodo interno richiamato da **setupForGenericExport**
|
|
812
|
+
* Presentazione di un semplice messaggio di avviso
|
|
916
813
|
*
|
|
917
|
-
*
|
|
918
|
-
*
|
|
814
|
+
* Se viene chiamato con le impostazioni di default e toastr è abilitato, viene mostrato al centro
|
|
815
|
+
* Se viene chiamato con override su toastr vuol dire che è una notifica secondaria e appare in alto a destra
|
|
919
816
|
*
|
|
920
|
-
* @
|
|
817
|
+
* @param {string} text Testo da mostrare
|
|
818
|
+
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
921
819
|
*/
|
|
922
|
-
|
|
923
|
-
if (
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
//Tirati fuori tutti gli header faccio sort sull'ordinamento
|
|
933
|
-
return headers.sort((a, b) => { return a.order - b.order; });
|
|
820
|
+
simpleWarning(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
821
|
+
if (this.Embedded) {
|
|
822
|
+
this.MainWindow.postMessage({ type: "alert", level: 'warning', msg: text }, "*");
|
|
823
|
+
return;
|
|
824
|
+
}
|
|
825
|
+
let tos = this.toastrOrSwal(secondaryNotificationType);
|
|
826
|
+
if (tos == "swal")
|
|
827
|
+
this.warningSwal.fire("", text);
|
|
828
|
+
else
|
|
829
|
+
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 });
|
|
934
830
|
}
|
|
935
831
|
/**
|
|
936
|
-
*
|
|
832
|
+
* Ripulisce tutti i messaggi presenti in un dato momento sullo schermo
|
|
833
|
+
*/
|
|
834
|
+
clearMessages() {
|
|
835
|
+
this.toastr.clear();
|
|
836
|
+
swal.close();
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Mostra un messaggio di avviso con richiesta di conferma
|
|
937
840
|
*
|
|
938
|
-
*
|
|
841
|
+
* @param {string} title Titolo del messaggio
|
|
842
|
+
* @param {string} text Contenuto del messaggio
|
|
939
843
|
*
|
|
940
|
-
* @
|
|
844
|
+
* @returns {Promise} Restituisce una Promise col risultato scelto dall'utente (conferma o no)
|
|
845
|
+
*/
|
|
846
|
+
promiseWarningWithChoice(title, text) {
|
|
847
|
+
return this.warningSwalWithCancel.fire(title, text);
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* In base alla configurazione attuale e all'eventuale override per la chiamata del caso indica se bisogna utilizzare toastr o sweetalert
|
|
941
851
|
*
|
|
942
|
-
* @
|
|
852
|
+
* @param {"toastr" | "swal" | null} providerOverride Override alla modalità configurata
|
|
853
|
+
*
|
|
854
|
+
* @returns {"toastr" | "swal"} Indicazione su che provider di messaggi di avviso debba essere utilizzato
|
|
943
855
|
*/
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
let loc = obj[locProperty] ? this.lc.generateFromType(obj[locProperty]) : null;
|
|
949
|
-
if (exportProps.length == 0)
|
|
950
|
-
console.warn("[@esfaenza/extensions] Nessuna colonna configurata da esportare!");
|
|
951
|
-
for (let i = 0; i < exportProps.length; i++) {
|
|
952
|
-
let prop = exportProps[i];
|
|
953
|
-
let propBase = "";
|
|
954
|
-
let toCall;
|
|
955
|
-
if (prop.endsWith(listCsvHdrPrefix)) {
|
|
956
|
-
propBase = prop.replace(listCsvHdrPrefix, '');
|
|
957
|
-
toCall = this.parseList.bind(this);
|
|
958
|
-
}
|
|
959
|
-
else if (prop.endsWith(dictionaryCsvHdrPrefix)) {
|
|
960
|
-
propBase = prop.replace(dictionaryCsvHdrPrefix, '');
|
|
961
|
-
toCall = this.parseDictionary.bind(this);
|
|
962
|
-
}
|
|
963
|
-
else if (prop.endsWith(csvVisPrefix)) {
|
|
964
|
-
propBase = prop.replace(csvVisPrefix, '');
|
|
965
|
-
if (typeof obj[propBase + csvValueNavigator] !== "undefined")
|
|
966
|
-
toCall = this.parseObject.bind(this);
|
|
967
|
-
else
|
|
968
|
-
toCall = this.parseProperty.bind(this);
|
|
969
|
-
}
|
|
970
|
-
if (toCall)
|
|
971
|
-
toCall(obj, propBase, headers, columnsSelection, loc);
|
|
972
|
-
}
|
|
973
|
-
return headers;
|
|
856
|
+
toastrOrSwal(providerOverride) {
|
|
857
|
+
if (providerOverride != null)
|
|
858
|
+
return providerOverride;
|
|
859
|
+
return "swal";
|
|
974
860
|
}
|
|
975
861
|
/**
|
|
976
|
-
*
|
|
977
|
-
* Viene generato l'header e la proprietà relativa al valore formattato o no
|
|
862
|
+
* Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
|
|
978
863
|
*
|
|
979
|
-
* @param {
|
|
980
|
-
* @param {string}
|
|
981
|
-
* @param {
|
|
982
|
-
* @param {
|
|
864
|
+
* @param {string} title Titolo del messaggio
|
|
865
|
+
* @param {string} text Contenuto del messaggio
|
|
866
|
+
* @param {Function} onsuccess Callback da chimare su conferma
|
|
867
|
+
* @param {Function} onerror Callback da chimare su errori
|
|
983
868
|
*/
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
let
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
val = val.replace(/,/, "");
|
|
1013
|
-
// Il singolo punto che c'è, se presente (separatore decimali) lo trasformo in virgola
|
|
1014
|
-
let valConverted = val.replace(".", ",");
|
|
1015
|
-
Object.defineProperty(obj, key, { value: valConverted, writable: false, enumerable: true });
|
|
1016
|
-
headers.push({ label, key, order, type: "number", propKey });
|
|
1017
|
-
}
|
|
1018
|
-
else {
|
|
1019
|
-
// Se ho un formato data trasformo in dayjs, formatto ed esporto
|
|
1020
|
-
// Per la trasformazione in dayjs provo prima a passargli la stringa di netto, sperando la riconosca
|
|
1021
|
-
// Se non funziona provo a definirgli la formattazione standard del metering per quel linguaggio
|
|
1022
|
-
let val = this.dates.getFormatted(obj[prop], format.length <= 10, format.length > 16);
|
|
1023
|
-
Object.defineProperty(obj, key, { value: val ?? "", writable: false, enumerable: true });
|
|
1024
|
-
headers.push({ label, key, order, type: "date", propKey });
|
|
1025
|
-
}
|
|
869
|
+
_simpleWarningWithChoice(title, text, onsuccess = null, onerror = null) {
|
|
870
|
+
this.warningSwalWithCancel.fire(title, text).then((result) => {
|
|
871
|
+
if (result.value && onsuccess)
|
|
872
|
+
onsuccess();
|
|
873
|
+
else if (onerror)
|
|
874
|
+
onerror();
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
simpleWarningWithChoice(title, text, onsuccess, onerror) {
|
|
878
|
+
this.withChoiceBase("warning", title, text, onsuccess, onerror);
|
|
879
|
+
}
|
|
880
|
+
simpleSuccessWithChoice(title, text, onsuccess, onerror) {
|
|
881
|
+
this.withChoiceBase("success", title, text, onsuccess, onerror);
|
|
882
|
+
}
|
|
883
|
+
withChoiceBase(level, title, text, onsuccess, onerror) {
|
|
884
|
+
if (this.Embedded) {
|
|
885
|
+
let guid = this.hash.getGUID();
|
|
886
|
+
this.GuidRepsonseFunctionsMap[guid] = { onsuccess, onerror };
|
|
887
|
+
this.MainWindow.postMessage({ type: "confirm", level, title, text, guid }, "*");
|
|
888
|
+
// Observe sulla risposta
|
|
889
|
+
console.log("Inviata confirm request alla pagina principale, in attesa di risposta...");
|
|
890
|
+
this.MessageObserver.pipe(filter(event => event?.data?.type == "confirm-response" && event?.data?.guid == guid), take(1)).subscribe(event => {
|
|
891
|
+
console.log("Event listener su window-message. Risposta pergiunta");
|
|
892
|
+
if (event?.data?.result === true)
|
|
893
|
+
this.GuidRepsonseFunctionsMap[guid].onsuccess();
|
|
894
|
+
else if (event?.data?.result === true)
|
|
895
|
+
this.GuidRepsonseFunctionsMap[guid].onerror();
|
|
896
|
+
});
|
|
1026
897
|
}
|
|
898
|
+
else
|
|
899
|
+
(level == "warning" ? this._simpleWarningWithChoice : this._simpleSuccessWithChoice)(title, text, onsuccess, onerror);
|
|
1027
900
|
}
|
|
1028
901
|
/**
|
|
1029
|
-
*
|
|
1030
|
-
* Viene generato l'header e la proprietà relativa al valore formattato o no.
|
|
1031
|
-
*
|
|
1032
|
-
* Per ottenere il valore e l'header della proprietà vengono utilizzati i navigatori auto-generati nel decoratore **ExportAs**
|
|
902
|
+
* Mostra un messaggio di success con richiesta di conferma e gestisce il risultato chiamato i callback **onconfirm** o **onabort**
|
|
1033
903
|
*
|
|
1034
|
-
* @param {
|
|
1035
|
-
* @param {string}
|
|
1036
|
-
* @param {
|
|
1037
|
-
* @param {
|
|
904
|
+
* @param {string} title Titolo del messaggio
|
|
905
|
+
* @param {string} text Contenuto del messaggio
|
|
906
|
+
* @param {Function} onconfirm Callback da chimare su conferma
|
|
907
|
+
* @param {Function} onabort Callback da chimare su annullamento
|
|
908
|
+
* @param {string} confirmtext Testo del pulsante di azione
|
|
909
|
+
* @param {string} aborttext Testo del pulsante di annullamento
|
|
1038
910
|
*/
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
//Salto 2 > diventa obj.subobj
|
|
1055
|
-
//ecc...
|
|
1056
|
-
jmps.forEach(pp => { clone = clone[pp]; });
|
|
1057
|
-
//Valore finale :D
|
|
1058
|
-
let value = clone;
|
|
1059
|
-
let text = obj[prop + csvHdrPrefix];
|
|
1060
|
-
let label = loc && text ? loc.loc(text) : text || "";
|
|
1061
|
-
let order = obj[prop + csvOrdPrefix];
|
|
1062
|
-
//Se per questa proprietà ho un formato lo applico
|
|
1063
|
-
let format = obj[prop + csvFormatPrefix];
|
|
1064
|
-
let type = "string";
|
|
1065
|
-
if (format == "F") {
|
|
1066
|
-
let val = value.toString();
|
|
1067
|
-
val = val.replace(/,/, "");
|
|
1068
|
-
value = val.replace(".", ",");
|
|
1069
|
-
type = "number";
|
|
1070
|
-
}
|
|
1071
|
-
else if (format) {
|
|
1072
|
-
value = this.dates.getFormatted(value, format.length <= 10, format.length > 16);
|
|
1073
|
-
type = "date";
|
|
1074
|
-
}
|
|
1075
|
-
Object.defineProperty(obj, prop, { value: value ?? "", writable: false, enumerable: true });
|
|
1076
|
-
headers.push({ label, key: prop, order, type, propKey: null });
|
|
911
|
+
_simpleSuccessWithChoice(title, text, onconfirm = null, onabort = null, confirmtext = "", aborttext = '') {
|
|
912
|
+
var configuration = {
|
|
913
|
+
title: title,
|
|
914
|
+
html: text
|
|
915
|
+
};
|
|
916
|
+
if (confirmtext)
|
|
917
|
+
configuration["confirmButtonText"] = confirmtext;
|
|
918
|
+
if (aborttext)
|
|
919
|
+
configuration["cancelButtonText"] = aborttext;
|
|
920
|
+
this.successSwalWithCancel.fire(configuration).then((result) => {
|
|
921
|
+
if (result.value && onconfirm)
|
|
922
|
+
onconfirm();
|
|
923
|
+
else if (onabort)
|
|
924
|
+
onabort();
|
|
925
|
+
});
|
|
1077
926
|
}
|
|
1078
927
|
/**
|
|
1079
|
-
*
|
|
1080
|
-
*
|
|
1081
|
-
* => Recupero il valore utilizzando i navigatori
|
|
1082
|
-
*
|
|
1083
|
-
* => Recupero l'header utilizzando i navigatori
|
|
928
|
+
* Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
|
|
1084
929
|
*
|
|
1085
|
-
*
|
|
930
|
+
* @param {string} title Titolo del messaggio
|
|
931
|
+
* @param {string} text Contenuto del messaggio
|
|
932
|
+
*/
|
|
933
|
+
observableSimpleWarningWithChoice(title, text) {
|
|
934
|
+
return of(this.warningSwalWithCancel.fire(title, text)).pipe(map(t => !!t.value));
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Mostra un messaggio di avviso che la sessione corrente è scaduta e propone all'utente di navigare al login. Qualora l'utente decidesse di farlo
|
|
938
|
+
* verrà chiamata la funzione di callback **onnavigate
|
|
1086
939
|
*
|
|
1087
|
-
*
|
|
940
|
+
* @param {string} title Titolo del messaggio
|
|
941
|
+
* @param {string} text Contenuto del messaggio
|
|
942
|
+
* @param {Function} onnavigate Callback da chimare su navigazione in corso
|
|
943
|
+
*/
|
|
944
|
+
expiredSessionMessage(title, text, onnavigate = null) {
|
|
945
|
+
this.expiredSessionSwal.fire(title, text).then((result) => {
|
|
946
|
+
if (result.value && onnavigate)
|
|
947
|
+
onnavigate();
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Metodo helper per gestire in maniera standardizzata una risposta di tipo **CallResult**
|
|
1088
952
|
*
|
|
1089
|
-
* @param {
|
|
1090
|
-
* @param {string}
|
|
1091
|
-
* @param {
|
|
1092
|
-
* @param {
|
|
953
|
+
* @param {CallResult} response Risposta ricevuta dal server
|
|
954
|
+
* @param {string} successMsg Messaggio da visualizzare in caso di successo
|
|
955
|
+
* @param {string} errorMsg Messaggio da visualizzare in caso di fallimento
|
|
956
|
+
* @param {Function} postSuccess Callback da chimare in caso di successo
|
|
957
|
+
* @param {Function} postFailure Callback da chimare in caso di fallimento
|
|
1093
958
|
*/
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
jumps = pr.split(".");
|
|
1108
|
-
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
1109
|
-
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1110
|
-
let localized = !!loc ? loc.loc(tmpRes) : tmpRes;
|
|
1111
|
-
if (!label)
|
|
1112
|
-
label = localized;
|
|
1113
|
-
else
|
|
1114
|
-
label += " " + localized;
|
|
1115
|
-
});
|
|
1116
|
-
jumps = valuenavigator.split(".");
|
|
1117
|
-
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
1118
|
-
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1119
|
-
let value = tmpRes;
|
|
1120
|
-
let type = "string";
|
|
1121
|
-
if (valueformat == "F") {
|
|
1122
|
-
let val = value != null ? value.toString() : "";
|
|
1123
|
-
val = val.replace(/,/, "");
|
|
1124
|
-
value = val.replace(".", ",");
|
|
1125
|
-
type = "number";
|
|
1126
|
-
}
|
|
1127
|
-
else if (valueformat) {
|
|
1128
|
-
value = this.dates.getFormatted(obj[prop], valueformat.length <= 10, valueformat.length > 16);
|
|
1129
|
-
type = "date";
|
|
1130
|
-
}
|
|
1131
|
-
Object.defineProperty(obj, prop + idx, { value: value ?? "", writable: false });
|
|
1132
|
-
headers.push({ label, key: prop + idx, order: order + idx, type, propKey: null });
|
|
959
|
+
manageCallResultResponse(response, successMsg, errorMsg, postSuccess = null, postFailure = null) {
|
|
960
|
+
if (response.success) {
|
|
961
|
+
if (response.haswarning)
|
|
962
|
+
this.simpleWarning(response.warning);
|
|
963
|
+
else if (successMsg)
|
|
964
|
+
this.simpleSuccess(successMsg);
|
|
965
|
+
if (postSuccess)
|
|
966
|
+
postSuccess();
|
|
967
|
+
}
|
|
968
|
+
else {
|
|
969
|
+
this.simpleError((errorMsg ? errorMsg + ": " : "") + response.haserror ? response.error : '[NO ERR.]');
|
|
970
|
+
if (postFailure)
|
|
971
|
+
postFailure();
|
|
1133
972
|
}
|
|
1134
973
|
}
|
|
1135
974
|
/**
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
* => Recupero il valore utilizzando i navigatori
|
|
1139
|
-
*
|
|
1140
|
-
* => Recupero l'header utilizzando i navigatori
|
|
975
|
+
* Metodo helper per gestire in maniera standardizzata una risposta di tipo **string**, considerando che:
|
|
1141
976
|
*
|
|
1142
|
-
*
|
|
977
|
+
* Stringa vuota --> Tutto bene
|
|
1143
978
|
*
|
|
1144
|
-
*
|
|
979
|
+
* Stringa piena --> Questo è il messaggio d'errore per cui la chiamata è fallita
|
|
1145
980
|
*
|
|
1146
|
-
* @param {
|
|
1147
|
-
* @param {string}
|
|
1148
|
-
* @param {
|
|
1149
|
-
* @param {
|
|
981
|
+
* @param {string} response Risposta ricevuta dal server
|
|
982
|
+
* @param {string} successMsg Messaggio da visualizzare in caso di successo
|
|
983
|
+
* @param {string} errorMsg Messaggio da visualizzare in caso di fallimento
|
|
984
|
+
* @param {Function} postSuccess Callback da chimare in caso di successo
|
|
985
|
+
* @param {Function} postFailure Callback da chimare in caso di fallimento
|
|
1150
986
|
*/
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
1164
|
-
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1165
|
-
if (!label)
|
|
1166
|
-
label = !!loc ? loc.loc(tmpRes) : tmpRes;
|
|
1167
|
-
else
|
|
1168
|
-
label += " " + !!loc ? loc.loc(tmpRes) : tmpRes;
|
|
1169
|
-
});
|
|
1170
|
-
var valuesplit = valuenavigator.split(",");
|
|
1171
|
-
valuesplit.forEach((t, idxinternal) => {
|
|
1172
|
-
var navig = t.split("-")[1];
|
|
1173
|
-
var desc = t.split("-")[0];
|
|
1174
|
-
jumps = navig.split(".");
|
|
1175
|
-
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
1176
|
-
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1177
|
-
let value = tmpRes;
|
|
1178
|
-
let propname = prop + idx.toString() + idxinternal.toString();
|
|
1179
|
-
Object.defineProperty(obj, propname, { value: value ?? "", writable: false });
|
|
1180
|
-
headers.push({ label: label + " " + !!loc ? loc.loc(desc) : desc, key: propname, order: order + idx, type: 'string', propKey: null });
|
|
1181
|
-
});
|
|
987
|
+
manageStringResponse(response, successMsg, errorMsg, postSuccess = null, postFailure = null) {
|
|
988
|
+
if (!response) {
|
|
989
|
+
if (successMsg)
|
|
990
|
+
this.simpleSuccess(successMsg);
|
|
991
|
+
if (postSuccess)
|
|
992
|
+
postSuccess();
|
|
993
|
+
}
|
|
994
|
+
else {
|
|
995
|
+
if (errorMsg)
|
|
996
|
+
this.simpleError(errorMsg + ": " + response);
|
|
997
|
+
if (postFailure)
|
|
998
|
+
postFailure();
|
|
1182
999
|
}
|
|
1183
1000
|
}
|
|
1184
1001
|
/**
|
|
1185
|
-
*
|
|
1002
|
+
* Metodo helper per gestire in maniera standardizzata una risposta di tipo **boolean**
|
|
1003
|
+
*
|
|
1004
|
+
* @param {string} response Risposta ricevuta dal server
|
|
1005
|
+
* @param {string} successMsg Messaggio da visualizzare in caso di successo
|
|
1006
|
+
* @param {string} errorMsg Messaggio da visualizzare in caso di fallimento
|
|
1007
|
+
* @param {Function} postSuccess Callback da chimare in caso di successo
|
|
1008
|
+
* @param {Function} postFailure Callback da chimare in caso di fallimento
|
|
1186
1009
|
*/
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1010
|
+
manageStringResponseBool(response, successMsg, errorMsg, postSuccess = null, postFailure = null) {
|
|
1011
|
+
if (response) {
|
|
1012
|
+
if (successMsg)
|
|
1013
|
+
this.simpleSuccess(successMsg);
|
|
1014
|
+
if (postSuccess)
|
|
1015
|
+
postSuccess();
|
|
1192
1016
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
let val = item[headers[j].key];
|
|
1199
|
-
row += `${row != '' ? sep : ''}"${val}"`;
|
|
1200
|
-
}
|
|
1201
|
-
csvData += row + '\r\n';
|
|
1017
|
+
else {
|
|
1018
|
+
if (errorMsg)
|
|
1019
|
+
this.simpleError(errorMsg);
|
|
1020
|
+
if (postFailure)
|
|
1021
|
+
postFailure();
|
|
1202
1022
|
}
|
|
1203
|
-
var BOM = new Uint8Array([0xEF, 0xBB, 0xBF]);
|
|
1204
|
-
var blob = new Blob([BOM, csvData], { type: 'text/csv' });
|
|
1205
|
-
var objectUrl = URL.createObjectURL(blob);
|
|
1206
|
-
this.utiExts.fileDownload(objectUrl, fn.endsWith('.xlsx') ? fn.replace('.xlsx', '.csv') : fn.endsWith('.csv') ? fn : fn + ".csv");
|
|
1207
1023
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1024
|
+
}
|
|
1025
|
+
MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MessageService, deps: [{ token: Injector }, { token: i1.BaseLocalization, optional: true }, { token: HashingService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1026
|
+
MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MessageService, providedIn: "root" });
|
|
1027
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MessageService, decorators: [{
|
|
1028
|
+
type: Injectable,
|
|
1029
|
+
args: [{ providedIn: "root" }]
|
|
1030
|
+
}], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
|
|
1031
|
+
type: Inject,
|
|
1032
|
+
args: [Injector]
|
|
1033
|
+
}] }, { type: i1.BaseLocalization, decorators: [{
|
|
1034
|
+
type: Optional
|
|
1035
|
+
}] }, { type: HashingService }]; } });
|
|
1036
|
+
|
|
1037
|
+
// Angular
|
|
1038
|
+
/* Classe che contiene tutte le informazioni sull'embedding in un unico contenitore per semplicità */
|
|
1039
|
+
class AppEmbeddingExtensions {
|
|
1040
|
+
constructor(msgService, router) {
|
|
1041
|
+
this.msgService = msgService;
|
|
1042
|
+
this.router = router;
|
|
1043
|
+
this.Embedded = false;
|
|
1044
|
+
this.EmbeddingLevel = 0;
|
|
1045
|
+
this.MessageObserver = new Subject();
|
|
1046
|
+
this.MainWindow = window;
|
|
1047
|
+
while (this.MainWindow.parent != this.MainWindow) {
|
|
1048
|
+
this.MainWindow = this.MainWindow.parent;
|
|
1049
|
+
this.EmbeddingLevel++;
|
|
1050
|
+
this.Embedded = true;
|
|
1227
1051
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1052
|
+
this.configureEmbeddability();
|
|
1053
|
+
if (this.Embedded)
|
|
1054
|
+
this.msgService.configureEmbeddability(this.MainWindow, this.MessageObserver);
|
|
1055
|
+
}
|
|
1056
|
+
configureEmbeddability() {
|
|
1057
|
+
window.onmessage = (event) => {
|
|
1058
|
+
// Ignoro i miei messaggi dato che mi interessano solo quelli degli altri iframe
|
|
1059
|
+
if (event.source == window && event?.data?.type != "modal-open")
|
|
1060
|
+
return;
|
|
1061
|
+
this.MessageObserver.next({ event: "window-message", data: event?.data });
|
|
1062
|
+
if (event?.data?.type == "alert") {
|
|
1063
|
+
console.log(`Window message - alert -> Level: ${event?.data?.level}, Message: ${event?.data?.msg}`);
|
|
1064
|
+
switch (event?.data?.level) {
|
|
1065
|
+
case "success":
|
|
1066
|
+
this.msgService.simpleSuccess(event?.data?.msg);
|
|
1067
|
+
break;
|
|
1068
|
+
case "warning":
|
|
1069
|
+
this.msgService.simpleWarning(event?.data?.msg);
|
|
1070
|
+
break;
|
|
1071
|
+
case "error":
|
|
1072
|
+
this.msgService.simpleError(event?.data?.msg);
|
|
1073
|
+
break;
|
|
1074
|
+
case "info":
|
|
1075
|
+
this.msgService.simpleInfo(event?.data?.msg);
|
|
1249
1076
|
break;
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
else if (event?.data?.type == "confirm") {
|
|
1080
|
+
console.log(`Window message - confirm -> Level: ${event?.data?.level}, Message: ${event?.data?.text}, Title: ${event?.data?.title}, ID: ${event?.data?.guid}`);
|
|
1081
|
+
var sourceWindow = event.source;
|
|
1082
|
+
var baseResponse = { type: "confirm-response", guid: event?.data?.guid };
|
|
1083
|
+
switch (event?.data?.level) {
|
|
1084
|
+
case "success":
|
|
1085
|
+
this.msgService.simpleSuccessWithChoice(event?.data?.title, event?.data?.text, () => {
|
|
1086
|
+
debugger;
|
|
1087
|
+
sourceWindow.postMessage({ result: true, ...baseResponse }, "*");
|
|
1088
|
+
}, () => {
|
|
1089
|
+
sourceWindow.postMessage({ result: false, ...baseResponse }, "*");
|
|
1090
|
+
});
|
|
1253
1091
|
break;
|
|
1254
|
-
|
|
1255
|
-
|
|
1092
|
+
case "warning":
|
|
1093
|
+
this.msgService.simpleWarningWithChoice(event?.data?.title, event?.data?.text, () => {
|
|
1094
|
+
debugger;
|
|
1095
|
+
sourceWindow.postMessage({ result: true, ...baseResponse }, "*");
|
|
1096
|
+
}, () => {
|
|
1097
|
+
sourceWindow.postMessage({ result: false, ...baseResponse }, "*");
|
|
1098
|
+
});
|
|
1256
1099
|
break;
|
|
1257
1100
|
}
|
|
1258
1101
|
}
|
|
1102
|
+
else if (event?.data?.type == "navigate") {
|
|
1103
|
+
console.log(`Window message - navigate -> ${event?.data?.url}`);
|
|
1104
|
+
this.router.navigate([event?.data?.url]);
|
|
1105
|
+
}
|
|
1106
|
+
else if (event?.data?.type == "redirect") {
|
|
1107
|
+
console.log(`Window message - redirect -> ${event?.data?.url}`);
|
|
1108
|
+
window.location.href = event?.data?.url;
|
|
1109
|
+
}
|
|
1110
|
+
else if (event?.data?.type == "navigation") {
|
|
1111
|
+
console.log(`Window message - Navigation -> ${event?.data?.internalNavigation ? "[internal]" : ""} ${event?.data?.title}`);
|
|
1112
|
+
this.MessageObserver.next({ event: "navigation", data: event?.data });
|
|
1113
|
+
}
|
|
1114
|
+
else if (event?.data?.type == "modal-open") {
|
|
1115
|
+
const wrapper = document.body.getElementsByClassName("main-wrapper")[0];
|
|
1116
|
+
let wrapperStyles = window.getComputedStyle(wrapper);
|
|
1117
|
+
const wrapperPaddingLeft = parseInt(wrapperStyles.getPropertyValue("padding-left"));
|
|
1118
|
+
const wrapperPaddingRight = parseInt(wrapperStyles.getPropertyValue("padding-right"));
|
|
1119
|
+
console.log(`Window message - Modal Open -> Backdrop Height: ${event?.data?.backdropHeight}`);
|
|
1120
|
+
var topHeight = 116; // valore fisso, distanza fra il top e l'inizio dell'iframe, non sarà mai diverso
|
|
1121
|
+
var rightSpace = wrapperPaddingRight; // valore fisso, distanza fra la fine dell'iframe e il lato sinistro dello schermo, non sarà mai diverso
|
|
1122
|
+
var leftSpace = 230 + wrapperPaddingLeft; // 230 è la variabile $sidebar-width
|
|
1123
|
+
let commonStyles = "position: absolute; z-index: 9999; background-color: #000; opacity: 0.5; ";
|
|
1124
|
+
wrapper.style.setProperty("overflow", "hidden", "important");
|
|
1125
|
+
const top = document.createElement("div");
|
|
1126
|
+
top.className = "embedded-modal-top";
|
|
1127
|
+
top.style.cssText = commonStyles + `height: ${topHeight}px; top: 0; width: calc(100% - ${leftSpace}px); left: ${leftSpace}px`;
|
|
1128
|
+
top.id = "top";
|
|
1129
|
+
const left = document.createElement("div");
|
|
1130
|
+
left.className = "embedded-modal-left";
|
|
1131
|
+
left.style.cssText = commonStyles + `height: 100%; top: 0; width: ${leftSpace}px;`;
|
|
1132
|
+
left.id = "left";
|
|
1133
|
+
const right = document.createElement("div");
|
|
1134
|
+
right.className = "embedded-modal-right";
|
|
1135
|
+
right.style.cssText = commonStyles + `height: calc(100% - ${topHeight}px); top: ${topHeight}px; right: 0; width: ${rightSpace}px;`;
|
|
1136
|
+
right.id = "right";
|
|
1137
|
+
document.body.appendChild(top);
|
|
1138
|
+
document.body.appendChild(left);
|
|
1139
|
+
document.body.appendChild(right);
|
|
1140
|
+
}
|
|
1141
|
+
else if (event?.data?.type == "modal-close") {
|
|
1142
|
+
console.log(`Window message - Modal Close`);
|
|
1143
|
+
let wrapper = document.body.getElementsByClassName("main-wrapper")[0];
|
|
1144
|
+
wrapper.style.removeProperty("overflow");
|
|
1145
|
+
const top = document.getElementById("top");
|
|
1146
|
+
const left = document.getElementById("left");
|
|
1147
|
+
const right = document.getElementById("right");
|
|
1148
|
+
if (top)
|
|
1149
|
+
document.body.removeChild(top);
|
|
1150
|
+
if (left)
|
|
1151
|
+
document.body.removeChild(left);
|
|
1152
|
+
if (right)
|
|
1153
|
+
document.body.removeChild(right);
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
if (this.Embedded)
|
|
1157
|
+
document.body.style.setProperty("overflow-y", "auto", "important");
|
|
1158
|
+
}
|
|
1159
|
+
refreshBoundariesOnMenuCollapse() {
|
|
1160
|
+
const wrapper = document.body.getElementsByClassName("main-wrapper")[0];
|
|
1161
|
+
let wrapperStyles = window.getComputedStyle(wrapper);
|
|
1162
|
+
const wrapperPaddingLeft = parseInt(wrapperStyles.getPropertyValue("padding-left"));
|
|
1163
|
+
var leftSpace = 230 + wrapperPaddingLeft;
|
|
1164
|
+
const left = document.getElementById("left");
|
|
1165
|
+
const top = document.getElementById("top");
|
|
1166
|
+
if (top) {
|
|
1167
|
+
top.style.setProperty("left", (leftSpace) + "px");
|
|
1168
|
+
top.style.setProperty("width", `calc(100% - ${leftSpace}px)`);
|
|
1259
1169
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
let objectUrl = URL.createObjectURL(blob);
|
|
1263
|
-
this.utiExts.fileDownload(objectUrl, fn.endsWith('.csv') ? fn.replace('.csv', '.xlsx') : fn.endsWith('.xlsx') ? fn : fn + ".xlsx");
|
|
1264
|
-
}
|
|
1265
|
-
/**
|
|
1266
|
-
* Metodo che effettivamente genera gli header e i dati per l'esportazione con **ngx-csv**
|
|
1267
|
-
*
|
|
1268
|
-
* @param {any[]} items Oggetti da esportare
|
|
1269
|
-
*/
|
|
1270
|
-
export(items, format, fileName, type, columnsFilter, genericHeaders) {
|
|
1271
|
-
var createdItems = items.map(t => {
|
|
1272
|
-
let tmp = new type();
|
|
1273
|
-
for (let property in t)
|
|
1274
|
-
tmp[property] = t[property];
|
|
1275
|
-
return tmp;
|
|
1276
|
-
});
|
|
1277
|
-
let headers = genericHeaders ? this.setupForGenericExport(createdItems, genericHeaders) : this.setupForExport(createdItems, columnsFilter);
|
|
1278
|
-
(format == "CSV" ? this.exportCSV : this.exportExcel).bind(this)(fileName, headers, createdItems);
|
|
1170
|
+
if (left)
|
|
1171
|
+
left.style.setProperty("width", leftSpace + "px");
|
|
1279
1172
|
}
|
|
1280
1173
|
}
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
1174
|
+
AppEmbeddingExtensions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, deps: [{ token: MessageService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1175
|
+
AppEmbeddingExtensions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, providedIn: "root" });
|
|
1176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: AppEmbeddingExtensions, decorators: [{
|
|
1284
1177
|
type: Injectable,
|
|
1285
1178
|
args: [{ providedIn: "root" }]
|
|
1286
|
-
}], ctorParameters: function () { return [{ type:
|
|
1179
|
+
}], ctorParameters: function () { return [{ type: MessageService }, { type: i2.Router }]; } });
|
|
1287
1180
|
|
|
1288
1181
|
// Angular
|
|
1289
1182
|
/**
|
|
1290
|
-
* Service che fornisce
|
|
1183
|
+
* Service che fornisce un accesso base in lettura/scrittura sulla clipboard
|
|
1291
1184
|
*/
|
|
1292
|
-
class
|
|
1293
|
-
|
|
1294
|
-
* Costruttore
|
|
1295
|
-
*
|
|
1296
|
-
* @ignore
|
|
1297
|
-
*/
|
|
1298
|
-
constructor(injector, locProvider, emb) {
|
|
1299
|
-
this.injector = injector;
|
|
1300
|
-
this.locProvider = locProvider;
|
|
1185
|
+
class BaseExtensionsService {
|
|
1186
|
+
constructor(emb) {
|
|
1301
1187
|
this.emb = emb;
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
'Success': { 'en-US': "Success", 'it-IT': "Successo", },
|
|
1312
|
-
'Warning': { 'en-US': "Warning", 'it-IT': "Attenzione", }
|
|
1313
|
-
};
|
|
1314
|
-
this.init();
|
|
1315
|
-
}
|
|
1316
|
-
get toastr() {
|
|
1317
|
-
return this.injector.get(ToastrService);
|
|
1318
|
-
}
|
|
1319
|
-
async init() {
|
|
1320
|
-
let LOCALE = this.locProvider ? await this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
|
|
1321
|
-
this.expiredSessionSwal = swal.mixin({
|
|
1322
|
-
showCancelButton: false,
|
|
1323
|
-
confirmButtonText: 'Login',
|
|
1324
|
-
customClass: {
|
|
1325
|
-
confirmButton: "btn btn-primary",
|
|
1326
|
-
container: "app-wrap",
|
|
1327
|
-
},
|
|
1328
|
-
buttonsStyling: false,
|
|
1329
|
-
reverseButtons: false,
|
|
1330
|
-
allowOutsideClick: false,
|
|
1331
|
-
icon: "warning"
|
|
1332
|
-
});
|
|
1333
|
-
this.successSwalWithCancel = swal.mixin({
|
|
1334
|
-
title: this.loc["Success"][LOCALE],
|
|
1335
|
-
customClass: {
|
|
1336
|
-
confirmButton: "btn btn-primary",
|
|
1337
|
-
cancelButton: "btn btn-secondary app-margin-right-10",
|
|
1338
|
-
container: "app-wrap",
|
|
1339
|
-
},
|
|
1340
|
-
buttonsStyling: false,
|
|
1341
|
-
reverseButtons: true,
|
|
1342
|
-
showCancelButton: true,
|
|
1343
|
-
confirmButtonText: this.loc["Confirm"][LOCALE],
|
|
1344
|
-
cancelButtonText: this.loc["Cancel"][LOCALE],
|
|
1345
|
-
icon: "success"
|
|
1346
|
-
});
|
|
1347
|
-
this.warningSwalWithCancel = swal.mixin({
|
|
1348
|
-
title: this.loc["Warning"][LOCALE],
|
|
1349
|
-
customClass: {
|
|
1350
|
-
confirmButton: "btn btn-primary",
|
|
1351
|
-
cancelButton: "btn btn-secondary app-margin-right-10",
|
|
1352
|
-
container: "app-wrap",
|
|
1353
|
-
},
|
|
1354
|
-
buttonsStyling: false,
|
|
1355
|
-
reverseButtons: true,
|
|
1356
|
-
showCancelButton: true,
|
|
1357
|
-
confirmButtonText: this.loc["Confirm"][LOCALE],
|
|
1358
|
-
cancelButtonText: this.loc["Cancel"][LOCALE],
|
|
1359
|
-
icon: "warning"
|
|
1360
|
-
});
|
|
1361
|
-
this.warningSwal = swal.mixin({
|
|
1362
|
-
title: this.loc["Warning"][LOCALE],
|
|
1363
|
-
customClass: {
|
|
1364
|
-
confirmButton: "btn btn-primary",
|
|
1365
|
-
container: "app-wrap",
|
|
1366
|
-
},
|
|
1367
|
-
buttonsStyling: false,
|
|
1368
|
-
reverseButtons: true,
|
|
1369
|
-
showCancelButton: false,
|
|
1370
|
-
confirmButtonText: this.loc["Close"][LOCALE],
|
|
1371
|
-
icon: "warning"
|
|
1372
|
-
});
|
|
1373
|
-
this.successSwal = swal.mixin({
|
|
1374
|
-
title: this.loc["Success"][LOCALE],
|
|
1375
|
-
customClass: {
|
|
1376
|
-
confirmButton: "btn btn-primary",
|
|
1377
|
-
container: "app-wrap",
|
|
1378
|
-
},
|
|
1379
|
-
buttonsStyling: false,
|
|
1380
|
-
reverseButtons: true,
|
|
1381
|
-
showCancelButton: false,
|
|
1382
|
-
confirmButtonText: this.loc["Close"][LOCALE],
|
|
1383
|
-
icon: "success"
|
|
1384
|
-
});
|
|
1385
|
-
this.errorSwal = swal.mixin({
|
|
1386
|
-
title: this.loc["Error"][LOCALE],
|
|
1387
|
-
customClass: {
|
|
1388
|
-
confirmButton: "btn btn-primary",
|
|
1389
|
-
container: "app-wrap",
|
|
1390
|
-
},
|
|
1391
|
-
buttonsStyling: false,
|
|
1392
|
-
reverseButtons: true,
|
|
1393
|
-
showCancelButton: false,
|
|
1394
|
-
confirmButtonText: this.loc["Close"][LOCALE],
|
|
1395
|
-
icon: "error"
|
|
1396
|
-
});
|
|
1397
|
-
this.infoSwal = swal.mixin({
|
|
1398
|
-
title: this.loc["Info"][LOCALE],
|
|
1399
|
-
customClass: {
|
|
1400
|
-
confirmButton: "btn btn-primary",
|
|
1401
|
-
container: "app-wrap",
|
|
1402
|
-
},
|
|
1403
|
-
buttonsStyling: false,
|
|
1404
|
-
reverseButtons: true,
|
|
1405
|
-
showCancelButton: false,
|
|
1406
|
-
confirmButtonText: this.loc["Close"][LOCALE],
|
|
1407
|
-
icon: "info"
|
|
1408
|
-
});
|
|
1409
|
-
}
|
|
1410
|
-
/**
|
|
1411
|
-
* Presentazione di un semplice messaggio di successo
|
|
1412
|
-
*
|
|
1413
|
-
* Se viene chiamato con le impostazioni di default e toastr è abilitato, viene mostrato al centro
|
|
1414
|
-
* Se viene chiamato con override su toastr vuol dire che è una notifica secondaria e appare in alto a destra
|
|
1415
|
-
*
|
|
1416
|
-
* @param {string} text Testo da mostrare
|
|
1417
|
-
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
1418
|
-
*/
|
|
1419
|
-
simpleSuccess(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
|
|
1420
|
-
if (this.emb.Embedded) {
|
|
1421
|
-
this.emb.MainWindow.postMessage({ type: "alert", level: 'success', msg: text }, "*");
|
|
1422
|
-
return;
|
|
1188
|
+
this.RedirectMap = {};
|
|
1189
|
+
this.RoutesMap = {};
|
|
1190
|
+
for (let prop in this.RedirectMap) {
|
|
1191
|
+
this.RoutesMap[prop] = { route: null };
|
|
1192
|
+
this.RoutesMap[prop].route = (param) => {
|
|
1193
|
+
let obj = {};
|
|
1194
|
+
obj[this.RedirectMap[prop].params[0]] = param;
|
|
1195
|
+
return [(this.emb.Embedded ? "pages_ext/" : "pages/") + this.RedirectMap[prop].url, obj];
|
|
1196
|
+
};
|
|
1423
1197
|
}
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
BaseExtensionsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseExtensionsService, deps: [{ token: AppEmbeddingExtensions }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1201
|
+
BaseExtensionsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseExtensionsService, providedIn: "root" });
|
|
1202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseExtensionsService, decorators: [{
|
|
1203
|
+
type: Injectable,
|
|
1204
|
+
args: [{ providedIn: "root" }]
|
|
1205
|
+
}], ctorParameters: function () { return [{ type: AppEmbeddingExtensions }]; } });
|
|
1206
|
+
|
|
1207
|
+
/**
|
|
1208
|
+
* Suffisso della proprietà da generare in cui salvare il navigatore
|
|
1209
|
+
* utilizzato dal servizio di esportazione per prendere il valore delle proprietà di un oggetto
|
|
1210
|
+
*/
|
|
1211
|
+
const csvValueNavigator = "_csvnav";
|
|
1212
|
+
/** Suffisso con le informazioni del tipo per le esportazioni di oggetti */
|
|
1213
|
+
const csvValueType = "_csvtype";
|
|
1214
|
+
/** Suffisso della proprietà da generare in cui salvare l'ordine di esportazione */
|
|
1215
|
+
const csvOrdPrefix = "_csvord";
|
|
1216
|
+
/** Suffisso della proprietà da generare in cui salvare la visibilità di questa proprietà */
|
|
1217
|
+
const csvVisPrefix = "_csvvis";
|
|
1218
|
+
/** Suffisso della proprietà da generare in cui salvare il nome della colonna in cui salvare questa proprietà */
|
|
1219
|
+
const csvHdrPrefix = "_csvhdr";
|
|
1220
|
+
/** Suffisso della proprietà da generare in cui salvare il codice del th a cui si riferisce questo campo */
|
|
1221
|
+
const csvPropKey = "_csvkey";
|
|
1222
|
+
/** Suffisso della proprietà da generare in cui salvare il valore da prendere per una proprietà di tipo Lista */
|
|
1223
|
+
const listCsvValPrefix = "_listcsvval";
|
|
1224
|
+
/** Suffisso della proprietà da generare in cui salvare l'Header della proprietà di tipo Lista relativo al valore esportato nella proprietà con suffisso **listCsvValPrefix** */
|
|
1225
|
+
const listCsvHdrPrefix = "_listcsvhdr";
|
|
1226
|
+
/** Suffisso della proprietà da generare in cui salvare il formato della proprietà di tipo Lista relativo al valore esportato nella proprietà con suffisso **listCsvValPrefix** */
|
|
1227
|
+
const listCsvValFormat = "_listcsvvalformat";
|
|
1228
|
+
/** Suffisso della proprietà da generare in cui salvare il valore da prendere per una proprietà di tipo Dizionario */
|
|
1229
|
+
const dictionaryCsvValPrefix = "_flatlistcsvval";
|
|
1230
|
+
/** Suffisso della proprietà da generare in cui salvare l'Header della proprietà di un Dizionario relativo al valore esportato nella proprietà con suffisso **dictionaryCsvValPrefix** */
|
|
1231
|
+
const dictionaryCsvHdrPrefix = "_flatlistcsvhdr";
|
|
1232
|
+
/** Suffisso della proprietà da generare in cui salvare il formato della proprietà che si sta esportando */
|
|
1233
|
+
const csvFormatPrefix = "_csvfmt";
|
|
1234
|
+
/** Nome della proprietà che contiene tutti i nomi di tutte le proprietà da esportare */
|
|
1235
|
+
const exportList = "__export_list__";
|
|
1236
|
+
/** Nome della proprietà che contiene la classe di localizzazione da utilizzare per una data esportazione */
|
|
1237
|
+
const locProperty = "__loc__";
|
|
1238
|
+
|
|
1239
|
+
/**
|
|
1240
|
+
* Mappatura del TypeCode del C#
|
|
1241
|
+
*/
|
|
1242
|
+
var TypeCode;
|
|
1243
|
+
(function (TypeCode) {
|
|
1244
|
+
/** @ignore */ TypeCode[TypeCode["Empty"] = 0] = "Empty";
|
|
1245
|
+
/** @ignore */ TypeCode[TypeCode["Obj"] = 1] = "Obj";
|
|
1246
|
+
/** @ignore */ TypeCode[TypeCode["DBNull"] = 2] = "DBNull";
|
|
1247
|
+
/** @ignore */ TypeCode[TypeCode["Boolean"] = 3] = "Boolean";
|
|
1248
|
+
/** @ignore */ TypeCode[TypeCode["Char"] = 4] = "Char";
|
|
1249
|
+
/** @ignore */ TypeCode[TypeCode["SByte"] = 5] = "SByte";
|
|
1250
|
+
/** @ignore */ TypeCode[TypeCode["Byte"] = 6] = "Byte";
|
|
1251
|
+
/** @ignore */ TypeCode[TypeCode["Int16"] = 7] = "Int16";
|
|
1252
|
+
/** @ignore */ TypeCode[TypeCode["UInt16"] = 8] = "UInt16";
|
|
1253
|
+
/** @ignore */ TypeCode[TypeCode["Int32"] = 9] = "Int32";
|
|
1254
|
+
/** @ignore */ TypeCode[TypeCode["UInt32"] = 10] = "UInt32";
|
|
1255
|
+
/** @ignore */ TypeCode[TypeCode["Int64"] = 11] = "Int64";
|
|
1256
|
+
/** @ignore */ TypeCode[TypeCode["UInt64"] = 12] = "UInt64";
|
|
1257
|
+
/** @ignore */ TypeCode[TypeCode["Single"] = 13] = "Single";
|
|
1258
|
+
/** @ignore */ TypeCode[TypeCode["Double"] = 14] = "Double";
|
|
1259
|
+
/** @ignore */ TypeCode[TypeCode["Decimal"] = 15] = "Decimal";
|
|
1260
|
+
/** @ignore */ TypeCode[TypeCode["DateTime"] = 16] = "DateTime";
|
|
1261
|
+
/** @ignore */ TypeCode[TypeCode["String"] = 18] = "String";
|
|
1262
|
+
})(TypeCode || (TypeCode = {}));
|
|
1263
|
+
|
|
1264
|
+
// Angular
|
|
1265
|
+
/**
|
|
1266
|
+
* Service che fornisce metodi di pubblica utilità
|
|
1267
|
+
*/
|
|
1268
|
+
class UtilityService {
|
|
1269
|
+
constructor() {
|
|
1270
|
+
// Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
1271
|
+
//TODO: spostarla in un metodo di utilit� (esfaenza/extensions)
|
|
1272
|
+
/** @ignore */
|
|
1273
|
+
this.executionTimers = {};
|
|
1429
1274
|
}
|
|
1430
1275
|
/**
|
|
1431
|
-
*
|
|
1432
|
-
*
|
|
1433
|
-
* Se viene chiamato con le impostazioni di default e toastr è abilitato, viene mostrato al centro
|
|
1434
|
-
* Se viene chiamato con override su toastr vuol dire che è una notifica secondaria e appare in alto a destra
|
|
1435
|
-
*
|
|
1436
|
-
* @param {string} text Testo da mostrare
|
|
1437
|
-
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
1276
|
+
* Deseleziona il testo eventualmente selezionato
|
|
1438
1277
|
*/
|
|
1439
|
-
|
|
1440
|
-
if (
|
|
1441
|
-
|
|
1442
|
-
|
|
1278
|
+
clearTextSelection() {
|
|
1279
|
+
if (window.getSelection) {
|
|
1280
|
+
if (window.getSelection().empty) // Chrome
|
|
1281
|
+
window.getSelection().empty();
|
|
1282
|
+
else if (window.getSelection().removeAllRanges) // Firefox
|
|
1283
|
+
window.getSelection().removeAllRanges();
|
|
1443
1284
|
}
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
this.infoSwal.fire("", text);
|
|
1447
|
-
else
|
|
1448
|
-
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 });
|
|
1285
|
+
else if (document.selection) // IE?
|
|
1286
|
+
document.selection.empty();
|
|
1449
1287
|
}
|
|
1450
1288
|
/**
|
|
1451
|
-
*
|
|
1289
|
+
* Partendo da una lista, dato il nome della proprietà chiave e il valore della chiave selezionata,
|
|
1290
|
+
* trova e restituisce l'oggetto desiderato
|
|
1452
1291
|
*
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1292
|
+
* @param {T[]} sourceList Lista di oggetti dentro cui cercare
|
|
1293
|
+
* @param {string} sourceItemIdField Nome della proprietà che rappresenta la chiave di un oggetto di tipo T
|
|
1294
|
+
* @param {string} selectedValue Valore di chiave selezionato
|
|
1455
1295
|
*
|
|
1456
|
-
* @
|
|
1457
|
-
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
1296
|
+
* @returns {T} Oggetto la cui proprietà **sourceItemIdField** assume il valore **selectedValue**
|
|
1458
1297
|
*/
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1298
|
+
getSelectedItem(sourceList, sourceItemIdField, selectedValue) {
|
|
1299
|
+
for (let i = 0; i < sourceList.length; i++) {
|
|
1300
|
+
var item = sourceList[i];
|
|
1301
|
+
if (item[sourceItemIdField] == selectedValue)
|
|
1302
|
+
return item;
|
|
1463
1303
|
}
|
|
1464
|
-
|
|
1465
|
-
if (tos == "swal")
|
|
1466
|
-
this.errorSwal.fire("", text);
|
|
1467
|
-
else
|
|
1468
|
-
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 });
|
|
1304
|
+
return null;
|
|
1469
1305
|
}
|
|
1470
1306
|
/**
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
* Se viene chiamato con le impostazioni di default e toastr è abilitato, viene mostrato al centro
|
|
1474
|
-
* Se viene chiamato con override su toastr vuol dire che è una notifica secondaria e appare in alto a destra
|
|
1307
|
+
* Effettua il reset di un Form di Angular
|
|
1475
1308
|
*
|
|
1476
|
-
* @param {
|
|
1477
|
-
* @param {
|
|
1309
|
+
* @param {NgForm} form Form da resettare
|
|
1310
|
+
* @param {string} exception1 Campo da non resettare
|
|
1311
|
+
* @param {string} exception2 Campo da non resettare
|
|
1478
1312
|
*/
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1313
|
+
cleanForm(form, exception1 = null, exception2 = null) {
|
|
1314
|
+
for (let name in form.controls) {
|
|
1315
|
+
if (name && name != exception1 && name != exception1 + "_internal" && name != exception2 && name != exception2 + "_internal") {
|
|
1316
|
+
form.controls[name].reset();
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
form.controls[name].markAsPristine();
|
|
1320
|
+
form.controls[name].markAsUntouched();
|
|
1321
|
+
}
|
|
1483
1322
|
}
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
this.warningSwal.fire("", text);
|
|
1487
|
-
else
|
|
1488
|
-
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 });
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* Ripulisce tutti i messaggi presenti in un dato momento sullo schermo
|
|
1492
|
-
*/
|
|
1493
|
-
clearMessages() {
|
|
1494
|
-
this.toastr.clear();
|
|
1495
|
-
swal.close();
|
|
1323
|
+
//Reimposto il submitted
|
|
1324
|
+
form.submitted = false;
|
|
1496
1325
|
}
|
|
1497
1326
|
/**
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
1500
|
-
* @param {string} title Titolo del messaggio
|
|
1501
|
-
* @param {string} text Contenuto del messaggio
|
|
1327
|
+
* Helper che permette di scaricare un file dato un URL (Generato da una chiamata ad **window.URL.createObjectURL**)
|
|
1502
1328
|
*
|
|
1503
|
-
* @
|
|
1329
|
+
* @param {string} url ObjectURL che rappresenta il file da scaricare
|
|
1330
|
+
* @param {string} filename Nome del file suggerito in fase di salvataggio
|
|
1504
1331
|
*/
|
|
1505
|
-
|
|
1506
|
-
|
|
1332
|
+
fileDownload(url, fileName) {
|
|
1333
|
+
var a = document.createElement("a");
|
|
1334
|
+
document.body.appendChild(a);
|
|
1335
|
+
a.className = "ta-display-none";
|
|
1336
|
+
a.href = url;
|
|
1337
|
+
a.download = fileName;
|
|
1338
|
+
a.click();
|
|
1339
|
+
window.URL.revokeObjectURL(url);
|
|
1340
|
+
document.body.removeChild(a);
|
|
1507
1341
|
}
|
|
1508
1342
|
/**
|
|
1509
|
-
*
|
|
1343
|
+
* Helper per la formattazione di un numero di millisecondi in una stringa più comprensibile per un umano
|
|
1510
1344
|
*
|
|
1511
|
-
* @param {
|
|
1345
|
+
* @param {number} duration Tempo espresso in millisecondi
|
|
1512
1346
|
*
|
|
1513
|
-
* @returns {
|
|
1347
|
+
* @returns {string} Durata formattata
|
|
1514
1348
|
*/
|
|
1515
|
-
|
|
1516
|
-
if (
|
|
1517
|
-
return
|
|
1518
|
-
|
|
1349
|
+
msToTime(duration) {
|
|
1350
|
+
if (!duration)
|
|
1351
|
+
return "";
|
|
1352
|
+
var milliseconds = parseInt(((duration % 1000) / 100).toString()), seconds = parseInt(((duration / 1000) % 60).toString()), minutes = parseInt(((duration / (1000 * 60)) % 60).toString()), hours = parseInt(((duration / (1000 * 60 * 60)) % 24).toString());
|
|
1353
|
+
var st_hours = (hours < 10) ? "0" + hours : hours;
|
|
1354
|
+
var st_minutes = (minutes < 10) ? "0" + minutes : minutes;
|
|
1355
|
+
var st_seconds = (seconds < 10) ? "0" + seconds : seconds;
|
|
1356
|
+
return st_hours + ":" + st_minutes + ":" + st_seconds + "." + milliseconds;
|
|
1519
1357
|
}
|
|
1520
1358
|
/**
|
|
1521
|
-
*
|
|
1359
|
+
* Helper che permette di scaricare un file in Base64
|
|
1522
1360
|
*
|
|
1523
|
-
* @param {string}
|
|
1524
|
-
* @param {string}
|
|
1525
|
-
* @param {Function} onsuccess Callback da chimare su conferma
|
|
1526
|
-
* @param {Function} onerror Callback da chimare su errori
|
|
1361
|
+
* @param {string} base64Data Base64 che rappresenta il file da scaricare
|
|
1362
|
+
* @param {string} filename Nome del file suggerito in fase di salvataggio
|
|
1527
1363
|
*/
|
|
1528
|
-
|
|
1529
|
-
this.
|
|
1530
|
-
|
|
1531
|
-
onsuccess();
|
|
1532
|
-
else if (onerror)
|
|
1533
|
-
onerror();
|
|
1534
|
-
});
|
|
1364
|
+
saveFile(base64Data, filename) {
|
|
1365
|
+
var sampleArr = this.base64ToArrayBuffer(base64Data);
|
|
1366
|
+
this.saveByteArray(sampleArr, filename);
|
|
1535
1367
|
}
|
|
1536
1368
|
/**
|
|
1537
|
-
*
|
|
1369
|
+
* Trasforma un Base64 in un ArrayBuffer
|
|
1538
1370
|
*
|
|
1539
|
-
* @param {string}
|
|
1540
|
-
*
|
|
1541
|
-
* @
|
|
1542
|
-
* @param {Function} onabort Callback da chimare su annullamento
|
|
1543
|
-
* @param {string} confirmtext Testo del pulsante di azione
|
|
1544
|
-
* @param {string} aborttext Testo del pulsante di annullamento
|
|
1371
|
+
* @param {string} base64Data Base64 da trasformare
|
|
1372
|
+
*
|
|
1373
|
+
* @returns {Uint8Array} Array UTF8
|
|
1545
1374
|
*/
|
|
1546
|
-
|
|
1547
|
-
var
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
this.successSwalWithCancel.fire(configuration).then((result) => {
|
|
1556
|
-
if (result.value && onconfirm)
|
|
1557
|
-
onconfirm();
|
|
1558
|
-
else if (onabort)
|
|
1559
|
-
onabort();
|
|
1560
|
-
});
|
|
1375
|
+
base64ToArrayBuffer(base64Data) {
|
|
1376
|
+
var binaryString = window.atob(base64Data);
|
|
1377
|
+
var binaryLen = binaryString.length;
|
|
1378
|
+
var bytes = new Uint8Array(binaryLen);
|
|
1379
|
+
for (var i = 0; i < binaryLen; i++) {
|
|
1380
|
+
var ascii = binaryString.charCodeAt(i);
|
|
1381
|
+
bytes[i] = ascii;
|
|
1382
|
+
}
|
|
1383
|
+
return bytes;
|
|
1561
1384
|
}
|
|
1562
1385
|
/**
|
|
1563
|
-
*
|
|
1386
|
+
* Helper che permette di scaricare un file dato un array di Byte (**Uint8Array**)
|
|
1564
1387
|
*
|
|
1565
|
-
* @param {
|
|
1566
|
-
* @param {string}
|
|
1388
|
+
* @param {Uint8Array} byte Rappresentazione del file da scaricare
|
|
1389
|
+
* @param {string} filename Nome del file suggerito in fase di salvataggio
|
|
1567
1390
|
*/
|
|
1568
|
-
|
|
1569
|
-
|
|
1391
|
+
saveByteArray(byte, filename) {
|
|
1392
|
+
var blob = new Blob([byte]);
|
|
1393
|
+
var link = document.createElement("a");
|
|
1394
|
+
document.body.appendChild(link);
|
|
1395
|
+
link.href = window.URL.createObjectURL(blob);
|
|
1396
|
+
var fileName = filename;
|
|
1397
|
+
link.download = fileName;
|
|
1398
|
+
link.click();
|
|
1399
|
+
document.body.removeChild(link);
|
|
1570
1400
|
}
|
|
1401
|
+
;
|
|
1571
1402
|
/**
|
|
1572
|
-
*
|
|
1573
|
-
* verrà chiamata la funzione di callback **onnavigate
|
|
1403
|
+
* Utility per lo swap di due elementi di un array
|
|
1574
1404
|
*
|
|
1575
|
-
* @param {
|
|
1576
|
-
* @param {
|
|
1577
|
-
* @param {
|
|
1405
|
+
* @param {any[]} array Array di cui invertire due elementi
|
|
1406
|
+
* @param {number} x Indice del primo elemento
|
|
1407
|
+
* @param {number} y Indice del secondo elemento
|
|
1578
1408
|
*/
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
});
|
|
1409
|
+
swap(array, x, y) {
|
|
1410
|
+
var b = array[x];
|
|
1411
|
+
array[x] = array[y];
|
|
1412
|
+
array[y] = b;
|
|
1584
1413
|
}
|
|
1585
1414
|
/**
|
|
1586
|
-
*
|
|
1415
|
+
* Helper di trascodifica da tipo c# a tipo Typescript
|
|
1587
1416
|
*
|
|
1588
|
-
* @param {
|
|
1589
|
-
*
|
|
1590
|
-
* @
|
|
1591
|
-
* @param {Function} postSuccess Callback da chimare in caso di successo
|
|
1592
|
-
* @param {Function} postFailure Callback da chimare in caso di fallimento
|
|
1417
|
+
* @param {TypeCode} type Tipo da trascodificare
|
|
1418
|
+
*
|
|
1419
|
+
* @returns {"boolean" | "number" | "string" | "date"} Tipo Typescript corrispondente
|
|
1593
1420
|
*/
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1421
|
+
getJsTypeFromTypeCode(type) {
|
|
1422
|
+
switch (type) {
|
|
1423
|
+
case TypeCode.Boolean:
|
|
1424
|
+
return "boolean";
|
|
1425
|
+
case TypeCode.Decimal:
|
|
1426
|
+
case TypeCode.Double:
|
|
1427
|
+
case TypeCode.Single:
|
|
1428
|
+
case TypeCode.Int16:
|
|
1429
|
+
case TypeCode.Int32:
|
|
1430
|
+
case TypeCode.Int64:
|
|
1431
|
+
case TypeCode.Byte:
|
|
1432
|
+
case TypeCode.SByte:
|
|
1433
|
+
case TypeCode.UInt16:
|
|
1434
|
+
case TypeCode.UInt32:
|
|
1435
|
+
case TypeCode.UInt64:
|
|
1436
|
+
return "number";
|
|
1437
|
+
case TypeCode.Char:
|
|
1438
|
+
case TypeCode.String:
|
|
1439
|
+
return "string";
|
|
1440
|
+
case TypeCode.DateTime:
|
|
1441
|
+
return "date";
|
|
1442
|
+
default:
|
|
1443
|
+
console.log("Unrecognized input type. Typecode:" + type);
|
|
1444
|
+
return "string";
|
|
1607
1445
|
}
|
|
1608
1446
|
}
|
|
1609
1447
|
/**
|
|
1610
|
-
*
|
|
1448
|
+
* Effettua la clonazione profonda di un oggetto in maniera molto più performante che JSON.parse(JSON.stringify()).
|
|
1611
1449
|
*
|
|
1612
|
-
*
|
|
1450
|
+
* Usare solo per oggetti puri e quantomeno semplici per evitare complicazioni derivanti dalle semplificazioni che questo metodo assume
|
|
1613
1451
|
*
|
|
1614
|
-
*
|
|
1452
|
+
* @param {any} source Oggetto da clonare
|
|
1615
1453
|
*
|
|
1616
|
-
* @
|
|
1617
|
-
* @param {string} successMsg Messaggio da visualizzare in caso di successo
|
|
1618
|
-
* @param {string} errorMsg Messaggio da visualizzare in caso di fallimento
|
|
1619
|
-
* @param {Function} postSuccess Callback da chimare in caso di successo
|
|
1620
|
-
* @param {Function} postFailure Callback da chimare in caso di fallimento
|
|
1454
|
+
* @return {any} Clone dell'oggetto passato
|
|
1621
1455
|
*/
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1456
|
+
deepClone(source) {
|
|
1457
|
+
// Valori semplici
|
|
1458
|
+
if (source == null || typeof source !== 'object')
|
|
1459
|
+
return source;
|
|
1460
|
+
// Pseudo Struct
|
|
1461
|
+
switch (toString.call(source)) {
|
|
1462
|
+
case '[object Boolean]':
|
|
1463
|
+
case '[object Number]':
|
|
1464
|
+
case '[object String]':
|
|
1465
|
+
case '[object Date]':
|
|
1466
|
+
return new source.constructor(source.valueOf());
|
|
1467
|
+
// Clonazione di un file -> Restituisco il riferimento al file stesso
|
|
1468
|
+
case "[object File]":
|
|
1469
|
+
return source;
|
|
1470
|
+
default: break;
|
|
1634
1471
|
}
|
|
1472
|
+
// Oggetti Complessi
|
|
1473
|
+
return this.recursiveStep(source, Array.isArray(source) || source instanceof Array ? [] : Object.create(Object.getPrototypeOf(source)));
|
|
1635
1474
|
}
|
|
1636
1475
|
/**
|
|
1637
|
-
*
|
|
1638
|
-
*
|
|
1639
|
-
* @param {string} response Risposta ricevuta dal server
|
|
1640
|
-
* @param {string} successMsg Messaggio da visualizzare in caso di successo
|
|
1641
|
-
* @param {string} errorMsg Messaggio da visualizzare in caso di fallimento
|
|
1642
|
-
* @param {Function} postSuccess Callback da chimare in caso di successo
|
|
1643
|
-
* @param {Function} postFailure Callback da chimare in caso di fallimento
|
|
1476
|
+
* @ignore
|
|
1477
|
+
* Step ricorsivo per la clonatura degli oggetti. Vedere **deepClone**
|
|
1644
1478
|
*/
|
|
1645
|
-
|
|
1646
|
-
if (
|
|
1647
|
-
|
|
1648
|
-
this.
|
|
1649
|
-
if (postSuccess)
|
|
1650
|
-
postSuccess();
|
|
1479
|
+
recursiveStep(source, destination) {
|
|
1480
|
+
if (Array.isArray(source) || source instanceof Array) {
|
|
1481
|
+
for (var i = 0, ii = source.length; i < ii; i++)
|
|
1482
|
+
destination.push(this.deepClone(source[i]));
|
|
1651
1483
|
}
|
|
1652
|
-
else {
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1484
|
+
else if (source && typeof source.hasOwnProperty === 'function') {
|
|
1485
|
+
for (let key in source) {
|
|
1486
|
+
if (source.hasOwnProperty(key))
|
|
1487
|
+
destination[key] = this.deepClone(source[key]);
|
|
1488
|
+
}
|
|
1657
1489
|
}
|
|
1490
|
+
return destination;
|
|
1491
|
+
}
|
|
1492
|
+
cast(object, clss) {
|
|
1493
|
+
let ret = Object.assign(Object.create(clss.prototype), object);
|
|
1494
|
+
return ret;
|
|
1495
|
+
}
|
|
1496
|
+
/** @ignore */
|
|
1497
|
+
throttla(id, func, throttleTime) {
|
|
1498
|
+
//Se ho la funzione che vuole eseguire ripulisco quel timeout
|
|
1499
|
+
if (this.executionTimers[id])
|
|
1500
|
+
clearTimeout(this.executionTimers[id]);
|
|
1501
|
+
//Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
|
|
1502
|
+
this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
|
|
1658
1503
|
}
|
|
1659
1504
|
}
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
1505
|
+
UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UtilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1506
|
+
UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UtilityService, providedIn: "root" });
|
|
1507
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: UtilityService, decorators: [{
|
|
1663
1508
|
type: Injectable,
|
|
1664
1509
|
args: [{ providedIn: "root" }]
|
|
1665
|
-
}]
|
|
1666
|
-
type: Inject,
|
|
1667
|
-
args: [Injector]
|
|
1668
|
-
}] }, { type: i1.BaseLocalization, decorators: [{
|
|
1669
|
-
type: Optional
|
|
1670
|
-
}] }, { type: AppEmbeddingExtensions }]; } });
|
|
1510
|
+
}] });
|
|
1671
1511
|
|
|
1672
1512
|
// Angular
|
|
1673
1513
|
/**
|
|
1674
|
-
*
|
|
1514
|
+
* Decoratore che fornisce la classe di localizzazione per tutte le proprietà esportate con @Export e qualsiasi altro tag che richieda localizzazioni.
|
|
1515
|
+
*
|
|
1516
|
+
* Sostanzilamente aggiunge la proprietà **__loc__** all'oggetto creato dalla classe corrente assegnandogli come valore il tipo del LocalizationService da usare per la traduzione
|
|
1517
|
+
*
|
|
1518
|
+
* @param {Type<LocalizationService>} loc Tipo ereditato dal LocalizationService che può essere creato a runtime sotto contesto della DI di Angular
|
|
1519
|
+
*/
|
|
1520
|
+
function ExportLocalization(loc) {
|
|
1521
|
+
return function integrateLoc(constructor) {
|
|
1522
|
+
return class extends constructor {
|
|
1523
|
+
constructor() {
|
|
1524
|
+
super(...arguments);
|
|
1525
|
+
this.__loc__ = loc;
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Decoratore di esportazione utilizzabile su una proprietà singola.
|
|
1532
|
+
* Verranno generate 3 proprietà che gestiranno l'esportazione: (prop, prop_csvvis, prop_csvhdr).
|
|
1533
|
+
*
|
|
1534
|
+
* Ad esempio, da questa configurazione:
|
|
1535
|
+
*
|
|
1536
|
+
* @example
|
|
1537
|
+
* ```
|
|
1538
|
+
* @Export(true, "MyHeader")
|
|
1539
|
+
* ciao: string;
|
|
1540
|
+
* ```
|
|
1541
|
+
*
|
|
1542
|
+
* Nasceranno le seguenti proprietà nell'oggetto esportabile:
|
|
1543
|
+
*
|
|
1544
|
+
* @example
|
|
1545
|
+
* ```
|
|
1546
|
+
* ciao_csvvis: string; => true
|
|
1547
|
+
* ciao: string;
|
|
1548
|
+
* ciao_csvhdr: string => "MyHeader"
|
|
1549
|
+
* ```
|
|
1550
|
+
*
|
|
1551
|
+
* @param {number} order Ordine di esportazione. Più piccolo è, prima appare il valore
|
|
1552
|
+
* @param {string} header Titolo della colonna nel file CSV esportato
|
|
1553
|
+
* @param {string} format Formato di esportazione. Può essere un formato data per i campi data o 'F' per i campi floating point
|
|
1554
|
+
*/
|
|
1555
|
+
const Export = (order, header, format = null, tableid = null) => (target, propertyKey) => {
|
|
1556
|
+
if (format)
|
|
1557
|
+
Object.defineProperty(target, propertyKey + csvFormatPrefix, { value: format, writable: false });
|
|
1558
|
+
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
1559
|
+
Object.defineProperty(target, propertyKey + csvVisPrefix, { value: !!header, writable: false });
|
|
1560
|
+
Object.defineProperty(target, propertyKey + csvHdrPrefix, { value: header, writable: false });
|
|
1561
|
+
if (tableid)
|
|
1562
|
+
Object.defineProperty(target, propertyKey + csvPropKey, { value: tableid, writable: false });
|
|
1563
|
+
if (target[exportList])
|
|
1564
|
+
target[exportList].push(propertyKey + csvVisPrefix);
|
|
1565
|
+
else
|
|
1566
|
+
target[exportList] = [propertyKey + csvVisPrefix];
|
|
1567
|
+
};
|
|
1568
|
+
/**
|
|
1569
|
+
* Decoratore di esportazione utilizzabile su un oggetto.
|
|
1570
|
+
* Per ogni proprietà dell'oggetto verranno generate 3 proprietà che gestiranno l'esportazione: (prop, prop_csvvis, prop_csvhdr).
|
|
1571
|
+
* Per essere esportate, le proprietà dell'oggetto devono essere marcate con i Decoratori di esportazione
|
|
1572
|
+
*
|
|
1573
|
+
* Ad esempio, da questa configurazione:
|
|
1574
|
+
*
|
|
1575
|
+
* @example
|
|
1576
|
+
* ```
|
|
1577
|
+
* MyObj {
|
|
1578
|
+
* @Export(true, "MyHeader")
|
|
1579
|
+
* ciao: string;
|
|
1580
|
+
* }
|
|
1581
|
+
*
|
|
1582
|
+
* @ExportObject(true, "MyHeader")
|
|
1583
|
+
* test: MyObj;
|
|
1584
|
+
* ```
|
|
1585
|
+
*
|
|
1586
|
+
* Nasceranno le seguenti proprietà nell'oggetto esportabile:
|
|
1587
|
+
*
|
|
1588
|
+
* @example
|
|
1589
|
+
* ```
|
|
1590
|
+
* testciao: string; => Valore di MyObj.ciao
|
|
1591
|
+
* testciao_csvvis: string; => true
|
|
1592
|
+
* testciao_csvhdr: string => "MyHeader"
|
|
1593
|
+
* ```
|
|
1594
|
+
*
|
|
1595
|
+
* @param {number} order Ordine di esportazione. Più piccolo è, prima appare il valore
|
|
1596
|
+
* @param {any} type Tipo da esportare
|
|
1597
|
+
*/
|
|
1598
|
+
const ExportAs = (order, type, prefix) => (target, propertyKey) => {
|
|
1599
|
+
var t = new type();
|
|
1600
|
+
var props = t[exportList];
|
|
1601
|
+
for (let i = 0; i < props.length; i++) {
|
|
1602
|
+
let prop = props[i].replace(csvVisPrefix, '');
|
|
1603
|
+
if (typeof t[prop + csvVisPrefix] !== "undefined") {
|
|
1604
|
+
var toEmit = t[prop + csvVisPrefix];
|
|
1605
|
+
var lbl = t[prop + csvHdrPrefix];
|
|
1606
|
+
var format = t[prop + csvFormatPrefix];
|
|
1607
|
+
var orderProp = t[prop + csvOrdPrefix];
|
|
1608
|
+
if (format)
|
|
1609
|
+
Object.defineProperty(target, propertyKey + prop + csvFormatPrefix, { value: format, writable: false });
|
|
1610
|
+
Object.defineProperty(target, propertyKey + prop + csvOrdPrefix, { value: orderProp + order, writable: false });
|
|
1611
|
+
Object.defineProperty(target, propertyKey + prop, { value: null, writable: true, enumerable: true });
|
|
1612
|
+
Object.defineProperty(target, propertyKey + prop + csvValueNavigator, { value: propertyKey + "." + prop, writable: false });
|
|
1613
|
+
Object.defineProperty(target, propertyKey + prop + csvVisPrefix, { value: toEmit, writable: false });
|
|
1614
|
+
Object.defineProperty(target, propertyKey + prop + csvHdrPrefix, { value: (prefix ? prefix + ' ' : '') + lbl, writable: false });
|
|
1615
|
+
Object.defineProperty(target, propertyKey + prop + csvValueType, { value: type, writable: false });
|
|
1616
|
+
if (target[exportList])
|
|
1617
|
+
target[exportList].push(propertyKey + prop + csvVisPrefix);
|
|
1618
|
+
else
|
|
1619
|
+
target[exportList] = [propertyKey + prop + csvVisPrefix];
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
/**
|
|
1624
|
+
* Decoratore di esportazione utilizzabile su una lista,
|
|
1625
|
+
* si utilizzano 2 navigator rispettivamente per la valorizzazione dell'Header e del Valore e
|
|
1626
|
+
* per ogni elemento dell'array verranno generate 3 proprietà che gestiranno l'esportazione: (prop, prop_csvvis, prop_csvhdr)
|
|
1627
|
+
*
|
|
1628
|
+
* ATTENZIONE: Gli oggetti esportati in questa modalità non devono presentare altri tag di tipo @Export{...} all'interno. Fa tutto questo decoratore
|
|
1629
|
+
*
|
|
1630
|
+
* I navigator hanno questa convenzione:
|
|
1631
|
+
*
|
|
1632
|
+
* . --> divide due proprietà da richiamare consecutivamente: "a.b" richiamerà "obj.a.b";
|
|
1633
|
+
*
|
|
1634
|
+
* | --> divide più proprietà per le concatenazioni con uno spazio fra una e l'altra: "regdesc|slice.slicename" diventerà obj.regdesc + " " + obj.slice.slicename
|
|
1635
|
+
*
|
|
1636
|
+
* @param {number} order Ordine di esportazione. Più piccolo è, prima appare il valore
|
|
1637
|
+
* @param {string} headernavigator Navigator col compito di selezionare il titolo per la colonna
|
|
1638
|
+
* @param {string} valuenavigator Navigator col compito di selezionare il valore per la colonna
|
|
1639
|
+
* @param {string} valueformat Formato di esportazione per i valori selezionati dal **valuenavigator**. Può essere un formato data per i campi data o 'F' per i campi floating point
|
|
1640
|
+
*/
|
|
1641
|
+
const ExportList = (order, headernavigator, valuenavigator, valueformat = null) => (target, propertyKey) => {
|
|
1642
|
+
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
1643
|
+
Object.defineProperty(target, propertyKey + listCsvValPrefix, { value: valuenavigator, writable: false });
|
|
1644
|
+
Object.defineProperty(target, propertyKey + listCsvHdrPrefix, { value: headernavigator, writable: false });
|
|
1645
|
+
Object.defineProperty(target, propertyKey + listCsvValFormat, { value: valueformat, writable: false });
|
|
1646
|
+
if (target[exportList])
|
|
1647
|
+
target[exportList].push(propertyKey + listCsvHdrPrefix);
|
|
1648
|
+
else
|
|
1649
|
+
target[exportList] = [propertyKey + listCsvHdrPrefix];
|
|
1650
|
+
};
|
|
1651
|
+
/**
|
|
1652
|
+
* Decoratore di esportazione utilizzabile su un dizionario. Se ad esempio si vogliono generare le colonne
|
|
1653
|
+
*
|
|
1654
|
+
* Valore A = 1
|
|
1655
|
+
*
|
|
1656
|
+
* Valore B = 2
|
|
1657
|
+
*
|
|
1658
|
+
* Valore C = 3
|
|
1659
|
+
*
|
|
1660
|
+
* partendo da un oggetto iniziale { Valore { A: 1, B: 2, C: 3 } }
|
|
1661
|
+
*
|
|
1662
|
+
* @param {number} order Ordine di esportazione. Più piccolo è, prima appare il valore
|
|
1663
|
+
* @param {string} headernavigator Navigator col compito di selezionare il titolo per la colonna
|
|
1664
|
+
* @param {string} valuenavigator Navigator col compito di selezionare il valore per la colonna
|
|
1665
|
+
*/
|
|
1666
|
+
const ExportDictionary = (order, headernavigator, valuenavigator) => (target, propertyKey) => {
|
|
1667
|
+
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
1668
|
+
Object.defineProperty(target, propertyKey + dictionaryCsvValPrefix, { value: valuenavigator, writable: false });
|
|
1669
|
+
Object.defineProperty(target, propertyKey + dictionaryCsvHdrPrefix, { value: headernavigator, writable: false });
|
|
1670
|
+
if (target[exportList])
|
|
1671
|
+
target[exportList].push(propertyKey + dictionaryCsvHdrPrefix);
|
|
1672
|
+
else
|
|
1673
|
+
target[exportList] = [propertyKey + dictionaryCsvHdrPrefix];
|
|
1674
|
+
};
|
|
1675
|
+
/**
|
|
1676
|
+
* Service che si occupa dell'esportazione degli oggetti marcati dai Decoratori **ExportDictionary**, **ExportList**, **ExportAs** o **Export**
|
|
1675
1677
|
*/
|
|
1676
|
-
class
|
|
1678
|
+
class ExportService {
|
|
1677
1679
|
/**
|
|
1678
1680
|
* Costruttore
|
|
1679
1681
|
*
|
|
1680
1682
|
* @ignore
|
|
1681
1683
|
*/
|
|
1682
|
-
constructor(
|
|
1683
|
-
this.
|
|
1684
|
-
this.
|
|
1685
|
-
|
|
1686
|
-
* Oggetto statico di localizzazione per i messaggi di questa Service
|
|
1687
|
-
*/
|
|
1688
|
-
this.loc = {
|
|
1689
|
-
"Unfortunately Firefox doesn't yet support direct Clipboard access if not via extensions, Please use Chrome to do this operation": {
|
|
1690
|
-
'en-US': "Unfortunately Firefox doesn't yet support direct Clipboard access if not via extensions, Please use Chrome to do this operation",
|
|
1691
|
-
'it-IT': "Mi dispiace ma Firefox non supporta l'accesso diretto alla Clipboard, se non attraverso le estensioni. Si prega di usare Chrome"
|
|
1692
|
-
},
|
|
1693
|
-
"Generic error during 'copy' command execution": {
|
|
1694
|
-
'en-US': "Generic error during 'copy' command execution",
|
|
1695
|
-
'it-IT': "Errore generico durante l'esecuzione del comando 'copy'"
|
|
1696
|
-
},
|
|
1697
|
-
"Error during Clipboard content read operation": {
|
|
1698
|
-
'en-US': "Error during Clipboard content read operation",
|
|
1699
|
-
'it-IT': "Errore nella lettura del contenuto della Clipboard"
|
|
1700
|
-
},
|
|
1701
|
-
"Error during Clipboard content copy operation": {
|
|
1702
|
-
'en-US': "Error during Clipboard content copy operation",
|
|
1703
|
-
'it-IT': "Errore nella scrittura del contenuto nella Clipboard"
|
|
1704
|
-
},
|
|
1705
|
-
"Please insert your clipboard content": {
|
|
1706
|
-
'en-US': "Please insert your clipboard content",
|
|
1707
|
-
'it-IT': "Si prega di incollare il contenuto della Clipboard"
|
|
1708
|
-
},
|
|
1709
|
-
"User input required": {
|
|
1710
|
-
'en-US': "User input required",
|
|
1711
|
-
'it-IT': "Richiesto Input utente"
|
|
1712
|
-
},
|
|
1713
|
-
"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": {
|
|
1714
|
-
'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",
|
|
1715
|
-
'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"
|
|
1716
|
-
},
|
|
1717
|
-
"Confirm": {
|
|
1718
|
-
'en-US': "Confirm",
|
|
1719
|
-
'it-IT': "Conferma"
|
|
1720
|
-
},
|
|
1721
|
-
"Cancel": {
|
|
1722
|
-
'en-US': "Cancel",
|
|
1723
|
-
'it-IT': "Annulla"
|
|
1724
|
-
},
|
|
1725
|
-
};
|
|
1684
|
+
constructor(dates, utiExts, lc) {
|
|
1685
|
+
this.dates = dates;
|
|
1686
|
+
this.utiExts = utiExts;
|
|
1687
|
+
this.lc = lc;
|
|
1726
1688
|
}
|
|
1727
1689
|
/**
|
|
1728
|
-
*
|
|
1729
|
-
* Si può specificare se ci si aspetta una lista o una matrice di valori in modo da ricevere già un risultato utilizzabile
|
|
1690
|
+
* Data una lista di oggetti genera gli header per l'esportazione e integra ogni oggetto con le proprietà esportabili dalla libreria **@ctrl/ngx-csv**
|
|
1730
1691
|
*
|
|
1731
|
-
* @param {
|
|
1732
|
-
*
|
|
1692
|
+
* @param {any[]} objs Oggetti da esportare
|
|
1693
|
+
*
|
|
1694
|
+
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
1733
1695
|
*/
|
|
1734
|
-
|
|
1735
|
-
let
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
if (!value)
|
|
1754
|
-
return this.loc["Please insert your clipboard content"][LOCALE];
|
|
1755
|
-
}
|
|
1756
|
-
}).then(t => {
|
|
1757
|
-
if (t.isConfirmed) {
|
|
1758
|
-
console.log("[@esfaenza/extensions] Retrieving input data from user input");
|
|
1759
|
-
this.doClipboardDataGet(t.value, style, valueFoundCallback);
|
|
1696
|
+
setupForExport(objs, columns = []) {
|
|
1697
|
+
let headers = [];
|
|
1698
|
+
let headersCache = {};
|
|
1699
|
+
if (!objs || objs.length == 0)
|
|
1700
|
+
return headers;
|
|
1701
|
+
// Devo per forza farlo per tutti gli oggetti dato che devo esporre le proprietà che mi servono da esportare
|
|
1702
|
+
// Gli header li raccolgo tutti poi faccio uan distinct in modo da esportare tutte le proprietà per bene
|
|
1703
|
+
let columnSelectionDictionary = {};
|
|
1704
|
+
if (columns?.length > 0)
|
|
1705
|
+
for (let i = 0; i < columns?.length; i++)
|
|
1706
|
+
columnSelectionDictionary[columns[i]] = true;
|
|
1707
|
+
for (let i = 0; i < objs.length; i++) {
|
|
1708
|
+
let hds = this.parseAndGetHeaders(objs[i], columnSelectionDictionary);
|
|
1709
|
+
// Aggiungo gli header facendo in modo di non aggiungerne mai due uguali per non dover fare una distinct dopo
|
|
1710
|
+
// che costerebbe comunque risorse. Utilizzo un dizionario d'appoggio per lookup istantanei
|
|
1711
|
+
for (let k = 0; k < hds.length; k++) {
|
|
1712
|
+
if (!headersCache[hds[k].key]) {
|
|
1713
|
+
headersCache[hds[k].key] = true;
|
|
1714
|
+
headers.push(hds[k]);
|
|
1760
1715
|
}
|
|
1761
|
-
}
|
|
1762
|
-
return;
|
|
1763
|
-
}
|
|
1764
|
-
if (window.clipboardData) {
|
|
1765
|
-
console.log("[@esfaenza/extensions] Found clipboardData");
|
|
1766
|
-
let data = window.clipboardData.getData("Text");
|
|
1767
|
-
this.doClipboardDataGet(data, style, valueFoundCallback);
|
|
1716
|
+
}
|
|
1768
1717
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1718
|
+
if (!columns || columns.length == 0)
|
|
1719
|
+
return headers.sort((a, b) => a.order - b.order);
|
|
1720
|
+
else {
|
|
1721
|
+
// Se mi arriva la lista di colonne non mi dà solo la visibilità, ma anche l'ordinamento
|
|
1722
|
+
// le esporto di conseguenza
|
|
1723
|
+
let orderedHeaders = [];
|
|
1724
|
+
for (let i = 0; i < columns.length; i++) {
|
|
1725
|
+
let thisId = columns[i];
|
|
1726
|
+
for (let i = 0; i < headers.length; i++) {
|
|
1727
|
+
if (headers[i].propKey == thisId) {
|
|
1728
|
+
orderedHeaders.push(headers[i]);
|
|
1729
|
+
break;
|
|
1730
|
+
}
|
|
1777
1731
|
}
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
.then((t) => this.doClipboardDataGet(t, style, valueFoundCallback))
|
|
1781
|
-
.catch((err) => this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][LOCALE] + ": " + err));
|
|
1782
|
-
});
|
|
1732
|
+
}
|
|
1733
|
+
return orderedHeaders;
|
|
1783
1734
|
}
|
|
1784
1735
|
}
|
|
1785
|
-
/** @ignore */
|
|
1786
|
-
doClipboardDataGet(clipboardText, style, valueFoundCallback) {
|
|
1787
|
-
console.log("[@esfaenza/extensions] Retrieved clipboard values: " + clipboardText);
|
|
1788
|
-
let value = style == "array" ? this.getClipboardLines(clipboardText) :
|
|
1789
|
-
style == "matrix" ? this.getClipboardMatrix(clipboardText) : [];
|
|
1790
|
-
console.log(`[@esfaenza/extensions] Adapted for ${style}: ${JSON.stringify(value)}`);
|
|
1791
|
-
if (valueFoundCallback)
|
|
1792
|
-
valueFoundCallback(value);
|
|
1793
|
-
}
|
|
1794
|
-
/**
|
|
1795
|
-
* Ottiene il contenuto della clipboard diviso per righe (separate da newline)
|
|
1796
|
-
*
|
|
1797
|
-
* @param {string} data contenuto letto dalla clipboard
|
|
1798
|
-
*
|
|
1799
|
-
* @returns {string[]} Array contenente il testo preso dalla clipboard diviso per riga
|
|
1800
|
-
*/
|
|
1801
|
-
getClipboardLines(data) {
|
|
1802
|
-
let trimmedData = data.trim();
|
|
1803
|
-
if (!trimmedData.includes("\r\n") && trimmedData.includes("\n"))
|
|
1804
|
-
return trimmedData.split("\n");
|
|
1805
|
-
return trimmedData.split("\r\n");
|
|
1806
|
-
}
|
|
1807
|
-
/**
|
|
1808
|
-
* Ottiene il contenuto della clipboard diviso per righe (separate da newline) e colonne (separate da tab)
|
|
1809
|
-
*
|
|
1810
|
-
* @param {string} data contenuto letto dalla clipboard
|
|
1811
|
-
*
|
|
1812
|
-
* @returns {string[][]} Matrice contenente il testo preso dalla clipboard diviso per riga e colonna
|
|
1813
|
-
*/
|
|
1814
|
-
getClipboardMatrix(data) {
|
|
1815
|
-
var ret = [];
|
|
1816
|
-
var rows = !data.includes("\r\n") && data.includes("\n") ? data.split("\n") : data.split("\r\n");
|
|
1817
|
-
// A quanto pare ogni valore è separato da un \t... spero che sia uno standard di quando si copia da excel altrimenti ciao
|
|
1818
|
-
for (let i = 0; i < rows.length; i++)
|
|
1819
|
-
ret.push(rows[i].split('\t').map(t => t.trim()));
|
|
1820
|
-
return ret;
|
|
1821
|
-
}
|
|
1822
1736
|
/**
|
|
1823
|
-
*
|
|
1737
|
+
* 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**
|
|
1824
1738
|
*
|
|
1825
|
-
* @param {
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
//
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
// the web page to copy to the clipboard.
|
|
1843
|
-
//
|
|
1844
|
-
// Place in top-left corner of screen regardless of scroll position.
|
|
1845
|
-
textArea.style.position = "fixed";
|
|
1846
|
-
textArea.style.top = "0";
|
|
1847
|
-
textArea.style.left = "0";
|
|
1848
|
-
// Ensure it has a small width and height. Setting to 1px / 1em
|
|
1849
|
-
// doesn't work as this gives a negative w/h on some browsers.
|
|
1850
|
-
textArea.style.width = "2em";
|
|
1851
|
-
textArea.style.height = "2em";
|
|
1852
|
-
// We don't need padding, reducing the size if it does flash render.
|
|
1853
|
-
textArea.style.padding = "0";
|
|
1854
|
-
// Clean up any borders.
|
|
1855
|
-
textArea.style.border = "none";
|
|
1856
|
-
textArea.style.outline = "none";
|
|
1857
|
-
textArea.style.boxShadow = "none";
|
|
1858
|
-
// Avoid flash of white box if rendered for any reason.
|
|
1859
|
-
textArea.style.background = "transparent";
|
|
1860
|
-
textArea.value = text;
|
|
1861
|
-
document.body.appendChild(textArea);
|
|
1862
|
-
textArea.focus();
|
|
1863
|
-
textArea.select();
|
|
1864
|
-
try {
|
|
1865
|
-
var successful = document.execCommand("copy");
|
|
1866
|
-
if (!successful)
|
|
1867
|
-
this.msgService.simpleError(this.loc["Generic error during 'copy' command execution"][LOCALE]);
|
|
1868
|
-
}
|
|
1869
|
-
catch (err) {
|
|
1870
|
-
this.msgService.simpleError(this.loc["Error during Clipboard content copy operation"][LOCALE] + ": " + err);
|
|
1871
|
-
}
|
|
1872
|
-
document.body.removeChild(textArea);
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, deps: [{ token: MessageService }, { token: i1.BaseLocalization, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1876
|
-
ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, providedIn: "root" });
|
|
1877
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, decorators: [{
|
|
1878
|
-
type: Injectable,
|
|
1879
|
-
args: [{ providedIn: "root" }]
|
|
1880
|
-
}], ctorParameters: function () { return [{ type: MessageService }, { type: i1.BaseLocalization, decorators: [{
|
|
1881
|
-
type: Optional
|
|
1882
|
-
}] }]; } });
|
|
1883
|
-
|
|
1884
|
-
// Angular
|
|
1885
|
-
/**
|
|
1886
|
-
* Service che fornisce alcuni semplici funzioni di Hashing / GUID / ecc...
|
|
1887
|
-
*/
|
|
1888
|
-
class HashingService {
|
|
1889
|
-
constructor() {
|
|
1890
|
-
/**
|
|
1891
|
-
* Blacklist dei tipi da ignorare quando si effettua l'hashing degli oggetti
|
|
1892
|
-
*/
|
|
1893
|
-
this.objBlacklist = {
|
|
1894
|
-
"NgForm": true, "ElementRef": true, "ExtensionsService": true, "ToastrService": true, "LocaleService": true, "AppState": true, "Router": true,
|
|
1895
|
-
"ActivatedRoute": true, "HTTPService": true, "Location": true, "CanvasComponent": true, "ModalDirective": true, "ChangeDetectorRef": true,
|
|
1896
|
-
"DateService": true, "EventEmitter": true, "ViewRef_": true, "Subscriber": true, "ItemLocalization": true
|
|
1897
|
-
};
|
|
1898
|
-
/**
|
|
1899
|
-
* Array dei possibili valori di un simbolo esadecimale
|
|
1900
|
-
*/
|
|
1901
|
-
this.hex_chr = '0123456789abcdef'.split('');
|
|
1739
|
+
* @param {GenericItem[]} objs Oggetti generici da esportare
|
|
1740
|
+
* @param {CsvHeaders[]} columns Colonne richieste dall'esportazione
|
|
1741
|
+
*
|
|
1742
|
+
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
1743
|
+
*/
|
|
1744
|
+
setupForGenericExport(objs, columns) {
|
|
1745
|
+
let headers = [];
|
|
1746
|
+
if (!objs || objs.length == 0)
|
|
1747
|
+
return headers;
|
|
1748
|
+
// Devo per forza farlo per tutti gli oggetti dato che devo esporre le proprietà che mi servono da esportare
|
|
1749
|
+
objs.forEach((obj, index) => {
|
|
1750
|
+
if (index == 0)
|
|
1751
|
+
headers = this.parseAndGetGenericHeaders(obj, columns);
|
|
1752
|
+
else
|
|
1753
|
+
this.parseAndGetGenericHeaders(obj, columns);
|
|
1754
|
+
});
|
|
1755
|
+
return headers;
|
|
1902
1756
|
}
|
|
1903
1757
|
/**
|
|
1904
|
-
*
|
|
1758
|
+
* Dato un oggetto generico genera gli header per l'esportazione e lo integra con le proprietà esportabili dalla libreria **@ctrl/ngx-csv**
|
|
1905
1759
|
*
|
|
1906
|
-
*
|
|
1760
|
+
* Metodo interno richiamato da **setupForGenericExport**
|
|
1761
|
+
*
|
|
1762
|
+
* @param {GenericItem} obj Oggetto generico da esportare
|
|
1763
|
+
* @param {CsvColumn[]} columns Colonne richieste dall'esportazione
|
|
1764
|
+
*
|
|
1765
|
+
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
1907
1766
|
*/
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1767
|
+
parseAndGetGenericHeaders(obj, columns) {
|
|
1768
|
+
if (!obj.properties)
|
|
1769
|
+
return null;
|
|
1770
|
+
var headers = [];
|
|
1771
|
+
//Miracle incoming
|
|
1772
|
+
columns.forEach(t => {
|
|
1773
|
+
var propValue = obj.properties[t.key];
|
|
1774
|
+
Object.defineProperty(obj, t.key + "_exp", { value: propValue, writable: false, enumerable: true });
|
|
1775
|
+
headers.push({ label: t.label, key: t.key + "_exp", order: t.order, type: t.type, propKey: null });
|
|
1912
1776
|
});
|
|
1777
|
+
//Tirati fuori tutti gli header faccio sort sull'ordinamento
|
|
1778
|
+
return headers.sort((a, b) => { return a.order - b.order; });
|
|
1913
1779
|
}
|
|
1914
1780
|
/**
|
|
1915
|
-
*
|
|
1781
|
+
* Dato un oggetto genera gli header per l'esportazione e lo integra con le proprietà esportabili dalla libreria **@ctrl/ngx-csv**
|
|
1916
1782
|
*
|
|
1917
|
-
*
|
|
1918
|
-
* @param {number} level Livello di ricorsione nel caso venga effettuato l'hash di un oggetto che contiene altri oggetti
|
|
1919
|
-
* @param {boolean} navigateFullDepth Indica se navigare l'oggetto per l'intera lunghezza. In caso contrario si ferma al secondo livello
|
|
1783
|
+
* Metodo interno richiamato da **setupForExport**
|
|
1920
1784
|
*
|
|
1921
|
-
* @
|
|
1785
|
+
* @param {any} obj Oggetto generico da esportare
|
|
1786
|
+
*
|
|
1787
|
+
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
1922
1788
|
*/
|
|
1923
|
-
|
|
1924
|
-
var
|
|
1925
|
-
|
|
1926
|
-
|
|
1789
|
+
parseAndGetHeaders(obj, columnsSelection) {
|
|
1790
|
+
var headers = [];
|
|
1791
|
+
// Miracle incoming
|
|
1792
|
+
let exportProps = obj[exportList] || [];
|
|
1793
|
+
let loc = obj[locProperty] ? this.lc.generateFromType(obj[locProperty]) : null;
|
|
1794
|
+
if (exportProps.length == 0)
|
|
1795
|
+
console.warn("[@esfaenza/extensions] Nessuna colonna configurata da esportare!");
|
|
1796
|
+
for (let i = 0; i < exportProps.length; i++) {
|
|
1797
|
+
let prop = exportProps[i];
|
|
1798
|
+
let propBase = "";
|
|
1799
|
+
let toCall;
|
|
1800
|
+
if (prop.endsWith(listCsvHdrPrefix)) {
|
|
1801
|
+
propBase = prop.replace(listCsvHdrPrefix, '');
|
|
1802
|
+
toCall = this.parseList.bind(this);
|
|
1803
|
+
}
|
|
1804
|
+
else if (prop.endsWith(dictionaryCsvHdrPrefix)) {
|
|
1805
|
+
propBase = prop.replace(dictionaryCsvHdrPrefix, '');
|
|
1806
|
+
toCall = this.parseDictionary.bind(this);
|
|
1807
|
+
}
|
|
1808
|
+
else if (prop.endsWith(csvVisPrefix)) {
|
|
1809
|
+
propBase = prop.replace(csvVisPrefix, '');
|
|
1810
|
+
if (typeof obj[propBase + csvValueNavigator] !== "undefined")
|
|
1811
|
+
toCall = this.parseObject.bind(this);
|
|
1812
|
+
else
|
|
1813
|
+
toCall = this.parseProperty.bind(this);
|
|
1814
|
+
}
|
|
1815
|
+
if (toCall)
|
|
1816
|
+
toCall(obj, propBase, headers, columnsSelection, loc);
|
|
1817
|
+
}
|
|
1818
|
+
return headers;
|
|
1927
1819
|
}
|
|
1928
1820
|
/**
|
|
1929
|
-
*
|
|
1821
|
+
* Setup per l'esportazione di una singola proprietà.
|
|
1822
|
+
* Viene generato l'header e la proprietà relativa al valore formattato o no
|
|
1930
1823
|
*
|
|
1931
|
-
*
|
|
1824
|
+
* @param {any} obj Oggetto di cui esportare la proprietà **prop**
|
|
1825
|
+
* @param {string} prop Proprietà da esportare
|
|
1826
|
+
* @param {CsvHeaders} headers Contenitore degli header, verrà riempito da questa funzione
|
|
1827
|
+
* @param {LocalizationService} loc Servizio di localizzazione che traduce tutti i nomi che può
|
|
1828
|
+
*/
|
|
1829
|
+
parseProperty(obj, prop, headers, columnsSelection, loc) {
|
|
1830
|
+
let toEmit = obj[prop + csvVisPrefix];
|
|
1831
|
+
let format = obj[prop + csvFormatPrefix];
|
|
1832
|
+
let propKey = obj[prop + csvPropKey];
|
|
1833
|
+
if (propKey && !columnsSelection[propKey] && Object.keys(columnsSelection).length > 0) {
|
|
1834
|
+
console.log("[@esfaenza/extensions] Colonna da non esportare: " + propKey);
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
let text = obj[prop + csvHdrPrefix];
|
|
1838
|
+
let label = loc && text ? loc.loc(text) : text || "";
|
|
1839
|
+
let order = obj[prop + csvOrdPrefix];
|
|
1840
|
+
if (!toEmit)
|
|
1841
|
+
return;
|
|
1842
|
+
// Se non ho un formato esporto direttamente
|
|
1843
|
+
if (!format) {
|
|
1844
|
+
// Se è un formato data mi assicuro di non stampare mai una data 00:00:00 altrimenti in esportazione viene uno schifo
|
|
1845
|
+
let val = obj[prop] ? this.dates.trimSeconds(obj[prop].toString()) : "";
|
|
1846
|
+
let key = prop + "_nofmt";
|
|
1847
|
+
Object.defineProperty(obj, key, { value: val, writable: false, enumerable: true });
|
|
1848
|
+
headers.push({ label, key, order, type: "string", propKey });
|
|
1849
|
+
}
|
|
1850
|
+
else {
|
|
1851
|
+
let key = prop + "_fmt";
|
|
1852
|
+
// Caso formato numerico
|
|
1853
|
+
if (format == "F") {
|
|
1854
|
+
// Check considerando la possibilità di zeri
|
|
1855
|
+
let val = obj[prop] != null ? obj[prop].toString() : "";
|
|
1856
|
+
// Elimino tutte le virgole (indicatori di migliaia per la culture default en-US)
|
|
1857
|
+
val = val.replace(/,/, "");
|
|
1858
|
+
// Il singolo punto che c'è, se presente (separatore decimali) lo trasformo in virgola
|
|
1859
|
+
let valConverted = val.replace(".", ",");
|
|
1860
|
+
Object.defineProperty(obj, key, { value: valConverted, writable: false, enumerable: true });
|
|
1861
|
+
headers.push({ label, key, order, type: "number", propKey });
|
|
1862
|
+
}
|
|
1863
|
+
else {
|
|
1864
|
+
// Se ho un formato data trasformo in dayjs, formatto ed esporto
|
|
1865
|
+
// Per la trasformazione in dayjs provo prima a passargli la stringa di netto, sperando la riconosca
|
|
1866
|
+
// Se non funziona provo a definirgli la formattazione standard del metering per quel linguaggio
|
|
1867
|
+
let val = this.dates.getFormatted(obj[prop], format.length <= 10, format.length > 16);
|
|
1868
|
+
Object.defineProperty(obj, key, { value: val ?? "", writable: false, enumerable: true });
|
|
1869
|
+
headers.push({ label, key, order, type: "date", propKey });
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
/**
|
|
1874
|
+
* Setup per l'esportazione di una singola proprietà da un oggetto.
|
|
1875
|
+
* Viene generato l'header e la proprietà relativa al valore formattato o no.
|
|
1932
1876
|
*
|
|
1933
|
-
*
|
|
1877
|
+
* Per ottenere il valore e l'header della proprietà vengono utilizzati i navigatori auto-generati nel decoratore **ExportAs**
|
|
1878
|
+
*
|
|
1879
|
+
* @param {any} obj Oggetto di cui esportare la proprietà **prop**
|
|
1880
|
+
* @param {string} prop Proprietà da esportare
|
|
1881
|
+
* @param {CsvHeaders} headers Contenitore degli header, verrà riempito da questa funzione
|
|
1882
|
+
* @param {LocalizationService} loc Servizio di localizzazione che traduce tutti i nomi che può
|
|
1934
1883
|
*/
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1884
|
+
parseObject(obj, prop, headers, columnsSelection, loc) {
|
|
1885
|
+
//se questa proprietà ha un navigator significa che deriva da un oggetto interno, recupero il valore in questa fase dato che prima non ce l'ho
|
|
1886
|
+
let valuenavigator = obj[prop + csvValueNavigator];
|
|
1887
|
+
//Es. di valuenavigator obj.subobj.subsubobj.property
|
|
1888
|
+
let jmps = valuenavigator.split(".");
|
|
1889
|
+
// Localizzazione presa dalla classe base se c'è, altrimenti dalla classe interna (cioè dal primo saltino)
|
|
1890
|
+
if (!loc) {
|
|
1891
|
+
let type = obj[prop + csvValueType];
|
|
1892
|
+
let proto = new type();
|
|
1893
|
+
loc = proto[locProperty] ? this.lc.generateFromType(proto[locProperty]) : null;
|
|
1941
1894
|
}
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1895
|
+
//Mi clono l'oggetto originale per non uccidergli i riferimenti
|
|
1896
|
+
let clone = JSON.parse(JSON.stringify(obj));
|
|
1897
|
+
//Salto ricorsivamente su me stesso per arrivare alla proprietà
|
|
1898
|
+
//Salto 1 > diventa obj
|
|
1899
|
+
//Salto 2 > diventa obj.subobj
|
|
1900
|
+
//ecc...
|
|
1901
|
+
jmps.forEach(pp => { clone = clone[pp]; });
|
|
1902
|
+
//Valore finale :D
|
|
1903
|
+
let value = clone;
|
|
1904
|
+
let text = obj[prop + csvHdrPrefix];
|
|
1905
|
+
let label = loc && text ? loc.loc(text) : text || "";
|
|
1906
|
+
let order = obj[prop + csvOrdPrefix];
|
|
1907
|
+
//Se per questa proprietà ho un formato lo applico
|
|
1908
|
+
let format = obj[prop + csvFormatPrefix];
|
|
1909
|
+
let type = "string";
|
|
1910
|
+
if (format == "F") {
|
|
1911
|
+
let val = value.toString();
|
|
1912
|
+
val = val.replace(/,/, "");
|
|
1913
|
+
value = val.replace(".", ",");
|
|
1914
|
+
type = "number";
|
|
1915
|
+
}
|
|
1916
|
+
else if (format) {
|
|
1917
|
+
value = this.dates.getFormatted(value, format.length <= 10, format.length > 16);
|
|
1918
|
+
type = "date";
|
|
1919
|
+
}
|
|
1920
|
+
Object.defineProperty(obj, prop, { value: value ?? "", writable: false, enumerable: true });
|
|
1921
|
+
headers.push({ label, key: prop, order, type, propKey: null });
|
|
1945
1922
|
}
|
|
1946
1923
|
/**
|
|
1947
|
-
*
|
|
1924
|
+
* Setup per l'esportazione di una lista di valori pivottati dinamicamente:
|
|
1948
1925
|
*
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1951
|
-
*
|
|
1926
|
+
* => Recupero il valore utilizzando i navigatori
|
|
1927
|
+
*
|
|
1928
|
+
* => Recupero l'header utilizzando i navigatori
|
|
1929
|
+
*
|
|
1930
|
+
* => Con il valore ci creo la property
|
|
1931
|
+
*
|
|
1932
|
+
* => Con l'header e il riferimento alla property appena creata creo un record negli header da esportare
|
|
1933
|
+
*
|
|
1934
|
+
* @param {any} obj Oggetto di cui esportare la proprietà **prop**
|
|
1935
|
+
* @param {string} prop Proprietà da esportare
|
|
1936
|
+
* @param {CsvHeaders} headers Contenitore degli header, verrà riempito da questa funzione
|
|
1937
|
+
* @param {LocalizationService} loc Servizio di localizzazione che traduce tutti i nomi che può
|
|
1952
1938
|
*/
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1939
|
+
parseList(obj, prop, headers, columnsSelection, loc) {
|
|
1940
|
+
let headernavigator = obj[prop + listCsvHdrPrefix];
|
|
1941
|
+
let valuenavigator = obj[prop + listCsvValPrefix];
|
|
1942
|
+
let valueformat = obj[prop + listCsvValFormat];
|
|
1943
|
+
let order = obj[prop + csvOrdPrefix];
|
|
1944
|
+
var jumps, tmpRes;
|
|
1945
|
+
var objs = obj[prop];
|
|
1946
|
+
for (let idx = 0; idx < objs.length; idx++) {
|
|
1947
|
+
let listitem = objs[idx];
|
|
1948
|
+
var headersplit = headernavigator.split(" ");
|
|
1949
|
+
var label = "";
|
|
1950
|
+
// Per l'header si considera a se stante ogni pezzo separato da spazio per fare le concatenazioni
|
|
1951
|
+
headersplit.forEach(pr => {
|
|
1952
|
+
jumps = pr.split(".");
|
|
1953
|
+
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
1954
|
+
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1955
|
+
let localized = !!loc ? loc.loc(tmpRes) : tmpRes;
|
|
1956
|
+
if (!label)
|
|
1957
|
+
label = localized;
|
|
1958
|
+
else
|
|
1959
|
+
label += " " + localized;
|
|
1960
|
+
});
|
|
1961
|
+
jumps = valuenavigator.split(".");
|
|
1962
|
+
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
1963
|
+
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1964
|
+
let value = tmpRes;
|
|
1965
|
+
let type = "string";
|
|
1966
|
+
if (valueformat == "F") {
|
|
1967
|
+
let val = value != null ? value.toString() : "";
|
|
1968
|
+
val = val.replace(/,/, "");
|
|
1969
|
+
value = val.replace(".", ",");
|
|
1970
|
+
type = "number";
|
|
1976
1971
|
}
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
//Se è oggetto, escludo tutti quelli di sistema/inutili
|
|
1981
|
-
if (o) {
|
|
1982
|
-
var name = o.__proto__.constructor.name;
|
|
1983
|
-
if (!this.objBlacklist[name]) {
|
|
1984
|
-
for (i in o) {
|
|
1985
|
-
if (o.hasOwnProperty(i) && (level <= 2 || navigateFullDepth)) {
|
|
1986
|
-
let res = this.stringify(o[i], level + 1, navigateFullDepth);
|
|
1987
|
-
if (res)
|
|
1988
|
-
r.push(i + ":" + res);
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1972
|
+
else if (valueformat) {
|
|
1973
|
+
value = this.dates.getFormatted(obj[prop], valueformat.length <= 10, valueformat.length > 16);
|
|
1974
|
+
type = "date";
|
|
1991
1975
|
}
|
|
1976
|
+
Object.defineProperty(obj, prop + idx, { value: value ?? "", writable: false });
|
|
1977
|
+
headers.push({ label, key: prop + idx, order: order + idx, type, propKey: null });
|
|
1992
1978
|
}
|
|
1993
|
-
return r.length > 0 ? "o:" + r.join(";") : "";
|
|
1994
1979
|
}
|
|
1995
1980
|
/**
|
|
1996
|
-
*
|
|
1981
|
+
* Setup per l'esportazione di una lista di valori pivottati dinamicamente:
|
|
1997
1982
|
*
|
|
1998
|
-
*
|
|
1999
|
-
* @returns {string} md5 della stringa **s**
|
|
2000
|
-
*/
|
|
2001
|
-
md5(s) {
|
|
2002
|
-
return this.hex(this.md51(s));
|
|
2003
|
-
}
|
|
2004
|
-
/**
|
|
2005
|
-
* @ignore
|
|
1983
|
+
* => Recupero il valore utilizzando i navigatori
|
|
2006
1984
|
*
|
|
2007
|
-
*
|
|
2008
|
-
*/
|
|
2009
|
-
md5cycle(x, k) {
|
|
2010
|
-
var a = x[0], b = x[1], c = x[2], d = x[3];
|
|
2011
|
-
a = this.ff(a, b, c, d, k[0], 7, -680876936);
|
|
2012
|
-
d = this.ff(d, a, b, c, k[1], 12, -389564586);
|
|
2013
|
-
c = this.ff(c, d, a, b, k[2], 17, 606105819);
|
|
2014
|
-
b = this.ff(b, c, d, a, k[3], 22, -1044525330);
|
|
2015
|
-
a = this.ff(a, b, c, d, k[4], 7, -176418897);
|
|
2016
|
-
d = this.ff(d, a, b, c, k[5], 12, 1200080426);
|
|
2017
|
-
c = this.ff(c, d, a, b, k[6], 17, -1473231341);
|
|
2018
|
-
b = this.ff(b, c, d, a, k[7], 22, -45705983);
|
|
2019
|
-
a = this.ff(a, b, c, d, k[8], 7, 1770035416);
|
|
2020
|
-
d = this.ff(d, a, b, c, k[9], 12, -1958414417);
|
|
2021
|
-
c = this.ff(c, d, a, b, k[10], 17, -42063);
|
|
2022
|
-
b = this.ff(b, c, d, a, k[11], 22, -1990404162);
|
|
2023
|
-
a = this.ff(a, b, c, d, k[12], 7, 1804603682);
|
|
2024
|
-
d = this.ff(d, a, b, c, k[13], 12, -40341101);
|
|
2025
|
-
c = this.ff(c, d, a, b, k[14], 17, -1502002290);
|
|
2026
|
-
b = this.ff(b, c, d, a, k[15], 22, 1236535329);
|
|
2027
|
-
a = this.gg(a, b, c, d, k[1], 5, -165796510);
|
|
2028
|
-
d = this.gg(d, a, b, c, k[6], 9, -1069501632);
|
|
2029
|
-
c = this.gg(c, d, a, b, k[11], 14, 643717713);
|
|
2030
|
-
b = this.gg(b, c, d, a, k[0], 20, -373897302);
|
|
2031
|
-
a = this.gg(a, b, c, d, k[5], 5, -701558691);
|
|
2032
|
-
d = this.gg(d, a, b, c, k[10], 9, 38016083);
|
|
2033
|
-
c = this.gg(c, d, a, b, k[15], 14, -660478335);
|
|
2034
|
-
b = this.gg(b, c, d, a, k[4], 20, -405537848);
|
|
2035
|
-
a = this.gg(a, b, c, d, k[9], 5, 568446438);
|
|
2036
|
-
d = this.gg(d, a, b, c, k[14], 9, -1019803690);
|
|
2037
|
-
c = this.gg(c, d, a, b, k[3], 14, -187363961);
|
|
2038
|
-
b = this.gg(b, c, d, a, k[8], 20, 1163531501);
|
|
2039
|
-
a = this.gg(a, b, c, d, k[13], 5, -1444681467);
|
|
2040
|
-
d = this.gg(d, a, b, c, k[2], 9, -51403784);
|
|
2041
|
-
c = this.gg(c, d, a, b, k[7], 14, 1735328473);
|
|
2042
|
-
b = this.gg(b, c, d, a, k[12], 20, -1926607734);
|
|
2043
|
-
a = this.hh(a, b, c, d, k[5], 4, -378558);
|
|
2044
|
-
d = this.hh(d, a, b, c, k[8], 11, -2022574463);
|
|
2045
|
-
c = this.hh(c, d, a, b, k[11], 16, 1839030562);
|
|
2046
|
-
b = this.hh(b, c, d, a, k[14], 23, -35309556);
|
|
2047
|
-
a = this.hh(a, b, c, d, k[1], 4, -1530992060);
|
|
2048
|
-
d = this.hh(d, a, b, c, k[4], 11, 1272893353);
|
|
2049
|
-
c = this.hh(c, d, a, b, k[7], 16, -155497632);
|
|
2050
|
-
b = this.hh(b, c, d, a, k[10], 23, -1094730640);
|
|
2051
|
-
a = this.hh(a, b, c, d, k[13], 4, 681279174);
|
|
2052
|
-
d = this.hh(d, a, b, c, k[0], 11, -358537222);
|
|
2053
|
-
c = this.hh(c, d, a, b, k[3], 16, -722521979);
|
|
2054
|
-
b = this.hh(b, c, d, a, k[6], 23, 76029189);
|
|
2055
|
-
a = this.hh(a, b, c, d, k[9], 4, -640364487);
|
|
2056
|
-
d = this.hh(d, a, b, c, k[12], 11, -421815835);
|
|
2057
|
-
c = this.hh(c, d, a, b, k[15], 16, 530742520);
|
|
2058
|
-
b = this.hh(b, c, d, a, k[2], 23, -995338651);
|
|
2059
|
-
a = this.ii(a, b, c, d, k[0], 6, -198630844);
|
|
2060
|
-
d = this.ii(d, a, b, c, k[7], 10, 1126891415);
|
|
2061
|
-
c = this.ii(c, d, a, b, k[14], 15, -1416354905);
|
|
2062
|
-
b = this.ii(b, c, d, a, k[5], 21, -57434055);
|
|
2063
|
-
a = this.ii(a, b, c, d, k[12], 6, 1700485571);
|
|
2064
|
-
d = this.ii(d, a, b, c, k[3], 10, -1894986606);
|
|
2065
|
-
c = this.ii(c, d, a, b, k[10], 15, -1051523);
|
|
2066
|
-
b = this.ii(b, c, d, a, k[1], 21, -2054922799);
|
|
2067
|
-
a = this.ii(a, b, c, d, k[8], 6, 1873313359);
|
|
2068
|
-
d = this.ii(d, a, b, c, k[15], 10, -30611744);
|
|
2069
|
-
c = this.ii(c, d, a, b, k[6], 15, -1560198380);
|
|
2070
|
-
b = this.ii(b, c, d, a, k[13], 21, 1309151649);
|
|
2071
|
-
a = this.ii(a, b, c, d, k[4], 6, -145523070);
|
|
2072
|
-
d = this.ii(d, a, b, c, k[11], 10, -1120210379);
|
|
2073
|
-
c = this.ii(c, d, a, b, k[2], 15, 718787259);
|
|
2074
|
-
b = this.ii(b, c, d, a, k[9], 21, -343485551);
|
|
2075
|
-
x[0] = this.add32(a, x[0]);
|
|
2076
|
-
x[1] = this.add32(b, x[1]);
|
|
2077
|
-
x[2] = this.add32(c, x[2]);
|
|
2078
|
-
x[3] = this.add32(d, x[3]);
|
|
2079
|
-
}
|
|
2080
|
-
/**
|
|
2081
|
-
* @ignore
|
|
1985
|
+
* => Recupero l'header utilizzando i navigatori
|
|
2082
1986
|
*
|
|
2083
|
-
*
|
|
1987
|
+
* => Con il valore ci creo la property
|
|
1988
|
+
*
|
|
1989
|
+
* => Con l'header e il riferimento alla property appena creata creo un record negli header da esportare
|
|
1990
|
+
*
|
|
1991
|
+
* @param {any} obj Oggetto di cui esportare la proprietà **prop**
|
|
1992
|
+
* @param {string} prop Proprietà da esportare
|
|
1993
|
+
* @param {CsvHeaders} headers Contenitore degli header, verrà riempito da questa funzione
|
|
1994
|
+
* @param {LocalizationService} loc Servizio di localizzazione che traduce tutti i nomi che può
|
|
2084
1995
|
*/
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
1996
|
+
parseDictionary(obj, prop, headers, columnsSelection, loc) {
|
|
1997
|
+
let headernavigator = obj[prop + dictionaryCsvHdrPrefix];
|
|
1998
|
+
let valuenavigator = obj[prop + dictionaryCsvValPrefix];
|
|
1999
|
+
let order = obj[prop + csvOrdPrefix];
|
|
2000
|
+
var jumps, tmpRes;
|
|
2001
|
+
var objs = obj[prop];
|
|
2002
|
+
for (let idx = 0; idx < objs.length; idx++) {
|
|
2003
|
+
let listitem = objs[idx];
|
|
2004
|
+
var headersplit = headernavigator.split(" ");
|
|
2005
|
+
var label = "";
|
|
2006
|
+
headersplit.forEach(pr => {
|
|
2007
|
+
jumps = pr.split(".");
|
|
2008
|
+
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
2009
|
+
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
2010
|
+
if (!label)
|
|
2011
|
+
label = !!loc ? loc.loc(tmpRes) : tmpRes;
|
|
2012
|
+
else
|
|
2013
|
+
label += " " + !!loc ? loc.loc(tmpRes) : tmpRes;
|
|
2014
|
+
});
|
|
2015
|
+
var valuesplit = valuenavigator.split(",");
|
|
2016
|
+
valuesplit.forEach((t, idxinternal) => {
|
|
2017
|
+
var navig = t.split("-")[1];
|
|
2018
|
+
var desc = t.split("-")[0];
|
|
2019
|
+
jumps = navig.split(".");
|
|
2020
|
+
tmpRes = JSON.parse(JSON.stringify(listitem));
|
|
2021
|
+
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
2022
|
+
let value = tmpRes;
|
|
2023
|
+
let propname = prop + idx.toString() + idxinternal.toString();
|
|
2024
|
+
Object.defineProperty(obj, propname, { value: value ?? "", writable: false });
|
|
2025
|
+
headers.push({ label: label + " " + !!loc ? loc.loc(desc) : desc, key: propname, order: order + idx, type: 'string', propKey: null });
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2088
2028
|
}
|
|
2089
2029
|
/**
|
|
2090
|
-
*
|
|
2091
|
-
*
|
|
2092
|
-
* Metodo di utilità per il calcolo dell'md5
|
|
2030
|
+
* Effettua l'esportazione in file CSV
|
|
2093
2031
|
*/
|
|
2094
|
-
|
|
2095
|
-
|
|
2032
|
+
exportCSV(fn, headers, data) {
|
|
2033
|
+
let csvData = '', row = '', sep = ';';
|
|
2034
|
+
for (let i = 0; i < headers.length; i++) {
|
|
2035
|
+
let h = headers[i];
|
|
2036
|
+
row += `${row != '' ? sep : ''}"${h.label}"`;
|
|
2037
|
+
}
|
|
2038
|
+
csvData += row + '\r\n';
|
|
2039
|
+
for (let i = 0; i < data.length; i++) {
|
|
2040
|
+
row = '';
|
|
2041
|
+
let item = data[i];
|
|
2042
|
+
for (let j = 0; j < headers.length; j++) {
|
|
2043
|
+
let val = item[headers[j].key];
|
|
2044
|
+
row += `${row != '' ? sep : ''}"${val}"`;
|
|
2045
|
+
}
|
|
2046
|
+
csvData += row + '\r\n';
|
|
2047
|
+
}
|
|
2048
|
+
var BOM = new Uint8Array([0xEF, 0xBB, 0xBF]);
|
|
2049
|
+
var blob = new Blob([BOM, csvData], { type: 'text/csv' });
|
|
2050
|
+
var objectUrl = URL.createObjectURL(blob);
|
|
2051
|
+
this.utiExts.fileDownload(objectUrl, fn.endsWith('.xlsx') ? fn.replace('.xlsx', '.csv') : fn.endsWith('.csv') ? fn : fn + ".csv");
|
|
2052
|
+
}
|
|
2053
|
+
/** Effettua l'esportazione del file Excel basandosi sul modulo **ExcelJS**, sugli header **headers** e sui dati **data** */
|
|
2054
|
+
async exportExcel(fn, headers, data) {
|
|
2055
|
+
try {
|
|
2056
|
+
this.ExcelJS = this.ExcelJS || await import('exceljs');
|
|
2057
|
+
}
|
|
2058
|
+
catch {
|
|
2059
|
+
throw "Impossibile caricare la libreria per l'esportazione in Excel";
|
|
2060
|
+
}
|
|
2061
|
+
let iFix = 1;
|
|
2062
|
+
let workbook = new this.ExcelJS.Workbook();
|
|
2063
|
+
workbook.creator = "Ema's big Es-Table";
|
|
2064
|
+
workbook.created = new Date();
|
|
2065
|
+
let sheet = workbook.addWorksheet('Data');
|
|
2066
|
+
let header = sheet.getRow(1);
|
|
2067
|
+
header.font = { bold: true };
|
|
2068
|
+
headers = headers.sort((a, b) => a.order - b.order);
|
|
2069
|
+
for (let i = 0; i < headers.length; i++) {
|
|
2070
|
+
let h = headers[i];
|
|
2071
|
+
header.getCell(i + iFix).value = h.label;
|
|
2072
|
+
}
|
|
2073
|
+
for (let i = 0; i < data.length; i++) {
|
|
2074
|
+
let row = sheet.getRow(i + iFix + 1);
|
|
2075
|
+
let item = data[i];
|
|
2076
|
+
for (let i = 0; i < headers.length; i++) {
|
|
2077
|
+
let h = headers[i];
|
|
2078
|
+
let cell = row.getCell(i + 1);
|
|
2079
|
+
let val = item[h.key];
|
|
2080
|
+
if (!val) {
|
|
2081
|
+
cell.value = "";
|
|
2082
|
+
continue;
|
|
2083
|
+
}
|
|
2084
|
+
switch (h.type) {
|
|
2085
|
+
case 'date':
|
|
2086
|
+
// ExcelJS va di default in UTC quindi rischierebbe di tirare giù 2 ore ad ogni esportazione
|
|
2087
|
+
// Bisogna aggiungere l'utc offset alla data attuale
|
|
2088
|
+
let date = this.dates.getDateConvertion(val);
|
|
2089
|
+
if (date) {
|
|
2090
|
+
let correctedDate = date.add(date.utcOffset(), 'minute');
|
|
2091
|
+
cell.value = correctedDate.toDate();
|
|
2092
|
+
cell.numFmt = val.length > 10 ? 'dd/mm/yyyy h:m:s' : '';
|
|
2093
|
+
}
|
|
2094
|
+
break;
|
|
2095
|
+
case 'number':
|
|
2096
|
+
let converted = parseFloat(val.replace(',', '.'));
|
|
2097
|
+
cell.value = isNaN(converted) ? "" : converted;
|
|
2098
|
+
break;
|
|
2099
|
+
default:
|
|
2100
|
+
cell.value = val;
|
|
2101
|
+
break;
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
let buffer = await workbook.xlsx.writeBuffer();
|
|
2106
|
+
let blob = new Blob([buffer], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;" });
|
|
2107
|
+
let objectUrl = URL.createObjectURL(blob);
|
|
2108
|
+
this.utiExts.fileDownload(objectUrl, fn.endsWith('.csv') ? fn.replace('.csv', '.xlsx') : fn.endsWith('.xlsx') ? fn : fn + ".xlsx");
|
|
2096
2109
|
}
|
|
2097
2110
|
/**
|
|
2098
|
-
*
|
|
2111
|
+
* Metodo che effettivamente genera gli header e i dati per l'esportazione con **ngx-csv**
|
|
2099
2112
|
*
|
|
2100
|
-
*
|
|
2113
|
+
* @param {any[]} items Oggetti da esportare
|
|
2101
2114
|
*/
|
|
2102
|
-
|
|
2103
|
-
|
|
2115
|
+
export(items, format, fileName, type, columnsFilter, genericHeaders) {
|
|
2116
|
+
var createdItems = items.map(t => {
|
|
2117
|
+
let tmp = new type();
|
|
2118
|
+
for (let property in t)
|
|
2119
|
+
tmp[property] = t[property];
|
|
2120
|
+
return tmp;
|
|
2121
|
+
});
|
|
2122
|
+
let headers = genericHeaders ? this.setupForGenericExport(createdItems, genericHeaders) : this.setupForExport(createdItems, columnsFilter);
|
|
2123
|
+
(format == "CSV" ? this.exportCSV : this.exportExcel).bind(this)(fileName, headers, createdItems);
|
|
2104
2124
|
}
|
|
2125
|
+
}
|
|
2126
|
+
ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, deps: [{ token: DateService }, { token: UtilityService }, { token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2127
|
+
ExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, providedIn: "root" });
|
|
2128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExportService, decorators: [{
|
|
2129
|
+
type: Injectable,
|
|
2130
|
+
args: [{ providedIn: "root" }]
|
|
2131
|
+
}], ctorParameters: function () { return [{ type: DateService }, { type: UtilityService }, { type: i1.LocalizationService }]; } });
|
|
2132
|
+
|
|
2133
|
+
// Angular
|
|
2134
|
+
/**
|
|
2135
|
+
* Service che fornisce un accesso base in lettura/scrittura sulla clipboard
|
|
2136
|
+
*/
|
|
2137
|
+
class ClipboardService {
|
|
2105
2138
|
/**
|
|
2106
|
-
*
|
|
2139
|
+
* Costruttore
|
|
2107
2140
|
*
|
|
2108
|
-
* Metodo di utilità per il calcolo dell'md5
|
|
2109
|
-
*/
|
|
2110
|
-
hh(a, b, c, d, x, s, t) {
|
|
2111
|
-
return this.cmn(b ^ c ^ d, a, b, x, s, t);
|
|
2112
|
-
}
|
|
2113
|
-
/**
|
|
2114
2141
|
* @ignore
|
|
2115
|
-
*
|
|
2116
|
-
* Metodo di utilità per il calcolo dell'md5
|
|
2117
2142
|
*/
|
|
2118
|
-
|
|
2119
|
-
|
|
2143
|
+
constructor(msgService, locProvider) {
|
|
2144
|
+
this.msgService = msgService;
|
|
2145
|
+
this.locProvider = locProvider;
|
|
2146
|
+
/**
|
|
2147
|
+
* Oggetto statico di localizzazione per i messaggi di questa Service
|
|
2148
|
+
*/
|
|
2149
|
+
this.loc = {
|
|
2150
|
+
"Unfortunately Firefox doesn't yet support direct Clipboard access if not via extensions, Please use Chrome to do this operation": {
|
|
2151
|
+
'en-US': "Unfortunately Firefox doesn't yet support direct Clipboard access if not via extensions, Please use Chrome to do this operation",
|
|
2152
|
+
'it-IT': "Mi dispiace ma Firefox non supporta l'accesso diretto alla Clipboard, se non attraverso le estensioni. Si prega di usare Chrome"
|
|
2153
|
+
},
|
|
2154
|
+
"Generic error during 'copy' command execution": {
|
|
2155
|
+
'en-US': "Generic error during 'copy' command execution",
|
|
2156
|
+
'it-IT': "Errore generico durante l'esecuzione del comando 'copy'"
|
|
2157
|
+
},
|
|
2158
|
+
"Error during Clipboard content read operation": {
|
|
2159
|
+
'en-US': "Error during Clipboard content read operation",
|
|
2160
|
+
'it-IT': "Errore nella lettura del contenuto della Clipboard"
|
|
2161
|
+
},
|
|
2162
|
+
"Error during Clipboard content copy operation": {
|
|
2163
|
+
'en-US': "Error during Clipboard content copy operation",
|
|
2164
|
+
'it-IT': "Errore nella scrittura del contenuto nella Clipboard"
|
|
2165
|
+
},
|
|
2166
|
+
"Please insert your clipboard content": {
|
|
2167
|
+
'en-US': "Please insert your clipboard content",
|
|
2168
|
+
'it-IT': "Si prega di incollare il contenuto della Clipboard"
|
|
2169
|
+
},
|
|
2170
|
+
"User input required": {
|
|
2171
|
+
'en-US': "User input required",
|
|
2172
|
+
'it-IT': "Richiesto Input utente"
|
|
2173
|
+
},
|
|
2174
|
+
"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": {
|
|
2175
|
+
'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",
|
|
2176
|
+
'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"
|
|
2177
|
+
},
|
|
2178
|
+
"Confirm": {
|
|
2179
|
+
'en-US': "Confirm",
|
|
2180
|
+
'it-IT': "Conferma"
|
|
2181
|
+
},
|
|
2182
|
+
"Cancel": {
|
|
2183
|
+
'en-US': "Cancel",
|
|
2184
|
+
'it-IT': "Annulla"
|
|
2185
|
+
},
|
|
2186
|
+
};
|
|
2120
2187
|
}
|
|
2121
2188
|
/**
|
|
2122
|
-
*
|
|
2189
|
+
* Prende il valore della clipboard.
|
|
2190
|
+
* Si può specificare se ci si aspetta una lista o una matrice di valori in modo da ricevere già un risultato utilizzabile
|
|
2123
2191
|
*
|
|
2124
|
-
*
|
|
2192
|
+
* @param {'array' | 'matrix'} style Stile dell'output desiderato, se array o matrice
|
|
2193
|
+
* @param {Function} valueFoundCallback Callback che questa funzione chiamerà una volta ottenuto i valori richiesti dalla clipboard
|
|
2125
2194
|
*/
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2195
|
+
async getClipboard(style, valueFoundCallback) {
|
|
2196
|
+
let LOCALE = this.locProvider ? await this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
|
|
2197
|
+
if (navigator.userAgent.indexOf("Firefox") != -1) {
|
|
2198
|
+
swal.fire({
|
|
2199
|
+
title: this.loc["User input required"][LOCALE],
|
|
2200
|
+
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"][LOCALE],
|
|
2201
|
+
input: 'textarea',
|
|
2202
|
+
icon: "warning",
|
|
2203
|
+
confirmButtonText: this.loc["Confirm"][LOCALE],
|
|
2204
|
+
cancelButtonText: this.loc["Cancel"][LOCALE],
|
|
2205
|
+
showCancelButton: true,
|
|
2206
|
+
customClass: {
|
|
2207
|
+
confirmButton: "btn btn-primary",
|
|
2208
|
+
cancelButton: "btn btn-secondary app-margin-right-15",
|
|
2209
|
+
container: "app-wrap",
|
|
2210
|
+
},
|
|
2211
|
+
reverseButtons: true,
|
|
2212
|
+
allowOutsideClick: false,
|
|
2213
|
+
inputValidator: (value) => {
|
|
2214
|
+
if (!value)
|
|
2215
|
+
return this.loc["Please insert your clipboard content"][LOCALE];
|
|
2216
|
+
}
|
|
2217
|
+
}).then(t => {
|
|
2218
|
+
if (t.isConfirmed) {
|
|
2219
|
+
console.log("[@esfaenza/extensions] Retrieving input data from user input");
|
|
2220
|
+
this.doClipboardDataGet(t.value, style, valueFoundCallback);
|
|
2221
|
+
}
|
|
2222
|
+
});
|
|
2223
|
+
return;
|
|
2224
|
+
}
|
|
2225
|
+
if (window.clipboardData) {
|
|
2226
|
+
console.log("[@esfaenza/extensions] Found clipboardData");
|
|
2227
|
+
let data = window.clipboardData.getData("Text");
|
|
2228
|
+
this.doClipboardDataGet(data, style, valueFoundCallback);
|
|
2229
|
+
}
|
|
2230
|
+
else if (window.navigator.clipboard) {
|
|
2231
|
+
console.log("[@esfaenza/extensions] Found navigator clipboard");
|
|
2232
|
+
window.navigator.permissions.query({ name: 'clipboard-read' }).then(result => {
|
|
2233
|
+
if (!(result.state === 'granted' || result.state === 'prompt')) {
|
|
2234
|
+
console.error("[@esfaenza/extensions] Clipboard permission not granted");
|
|
2235
|
+
if (valueFoundCallback)
|
|
2236
|
+
valueFoundCallback([]);
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
console.log("[@esfaenza/extensions] Clipboard permission granted, retrieving values");
|
|
2240
|
+
window.navigator.clipboard.readText()
|
|
2241
|
+
.then((t) => this.doClipboardDataGet(t, style, valueFoundCallback))
|
|
2242
|
+
.catch((err) => this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][LOCALE] + ": " + err));
|
|
2243
|
+
});
|
|
2139
2244
|
}
|
|
2140
|
-
tail[14] = n * 8;
|
|
2141
|
-
this.md5cycle(state, tail);
|
|
2142
|
-
return state;
|
|
2143
2245
|
}
|
|
2144
|
-
/**
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24);
|
|
2153
|
-
return md5blks;
|
|
2246
|
+
/** @ignore */
|
|
2247
|
+
doClipboardDataGet(clipboardText, style, valueFoundCallback) {
|
|
2248
|
+
console.log("[@esfaenza/extensions] Retrieved clipboard values: " + clipboardText);
|
|
2249
|
+
let value = style == "array" ? this.getClipboardLines(clipboardText) :
|
|
2250
|
+
style == "matrix" ? this.getClipboardMatrix(clipboardText) : [];
|
|
2251
|
+
console.log(`[@esfaenza/extensions] Adapted for ${style}: ${JSON.stringify(value)}`);
|
|
2252
|
+
if (valueFoundCallback)
|
|
2253
|
+
valueFoundCallback(value);
|
|
2154
2254
|
}
|
|
2155
2255
|
/**
|
|
2156
|
-
*
|
|
2256
|
+
* Ottiene il contenuto della clipboard diviso per righe (separate da newline)
|
|
2157
2257
|
*
|
|
2158
|
-
*
|
|
2258
|
+
* @param {string} data contenuto letto dalla clipboard
|
|
2259
|
+
*
|
|
2260
|
+
* @returns {string[]} Array contenente il testo preso dalla clipboard diviso per riga
|
|
2159
2261
|
*/
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
return
|
|
2262
|
+
getClipboardLines(data) {
|
|
2263
|
+
let trimmedData = data.trim();
|
|
2264
|
+
if (!trimmedData.includes("\r\n") && trimmedData.includes("\n"))
|
|
2265
|
+
return trimmedData.split("\n");
|
|
2266
|
+
return trimmedData.split("\r\n");
|
|
2165
2267
|
}
|
|
2166
2268
|
/**
|
|
2167
|
-
*
|
|
2269
|
+
* Ottiene il contenuto della clipboard diviso per righe (separate da newline) e colonne (separate da tab)
|
|
2168
2270
|
*
|
|
2169
|
-
*
|
|
2271
|
+
* @param {string} data contenuto letto dalla clipboard
|
|
2272
|
+
*
|
|
2273
|
+
* @returns {string[][]} Matrice contenente il testo preso dalla clipboard diviso per riga e colonna
|
|
2170
2274
|
*/
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2275
|
+
getClipboardMatrix(data) {
|
|
2276
|
+
var ret = [];
|
|
2277
|
+
var rows = !data.includes("\r\n") && data.includes("\n") ? data.split("\n") : data.split("\r\n");
|
|
2278
|
+
// A quanto pare ogni valore è separato da un \t... spero che sia uno standard di quando si copia da excel altrimenti ciao
|
|
2279
|
+
for (let i = 0; i < rows.length; i++)
|
|
2280
|
+
ret.push(rows[i].split('\t').map(t => t.trim()));
|
|
2281
|
+
return ret;
|
|
2175
2282
|
}
|
|
2176
2283
|
/**
|
|
2177
|
-
*
|
|
2284
|
+
* Metodo che copia un testo all'interno della clipboard
|
|
2178
2285
|
*
|
|
2179
|
-
*
|
|
2286
|
+
* @param {string} text Testo da inserire nella clipboard
|
|
2180
2287
|
*/
|
|
2181
|
-
|
|
2182
|
-
|
|
2288
|
+
async copyTextToClipboard(text) {
|
|
2289
|
+
let LOCALE = this.locProvider ? await this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
|
|
2290
|
+
var textArea = document.createElement("textarea");
|
|
2291
|
+
//
|
|
2292
|
+
// *** This styling is an extra step which is likely not required. ***
|
|
2293
|
+
//
|
|
2294
|
+
// Why is it here? To ensure:
|
|
2295
|
+
// 1. the element is able to have focus and selection.
|
|
2296
|
+
// 2. if element was to flash render it has minimal visual impact.
|
|
2297
|
+
// 3. less flakyness with selection and copying which **might** occur if
|
|
2298
|
+
// the textarea element is not visible.
|
|
2299
|
+
//
|
|
2300
|
+
// The likelihood is the element won't even render, not even a flash,
|
|
2301
|
+
// so some of these are just precautions. However in IE the element
|
|
2302
|
+
// is visible whilst the popup box asking the user for permission for
|
|
2303
|
+
// the web page to copy to the clipboard.
|
|
2304
|
+
//
|
|
2305
|
+
// Place in top-left corner of screen regardless of scroll position.
|
|
2306
|
+
textArea.style.position = "fixed";
|
|
2307
|
+
textArea.style.top = "0";
|
|
2308
|
+
textArea.style.left = "0";
|
|
2309
|
+
// Ensure it has a small width and height. Setting to 1px / 1em
|
|
2310
|
+
// doesn't work as this gives a negative w/h on some browsers.
|
|
2311
|
+
textArea.style.width = "2em";
|
|
2312
|
+
textArea.style.height = "2em";
|
|
2313
|
+
// We don't need padding, reducing the size if it does flash render.
|
|
2314
|
+
textArea.style.padding = "0";
|
|
2315
|
+
// Clean up any borders.
|
|
2316
|
+
textArea.style.border = "none";
|
|
2317
|
+
textArea.style.outline = "none";
|
|
2318
|
+
textArea.style.boxShadow = "none";
|
|
2319
|
+
// Avoid flash of white box if rendered for any reason.
|
|
2320
|
+
textArea.style.background = "transparent";
|
|
2321
|
+
textArea.value = text;
|
|
2322
|
+
document.body.appendChild(textArea);
|
|
2323
|
+
textArea.focus();
|
|
2324
|
+
textArea.select();
|
|
2325
|
+
try {
|
|
2326
|
+
var successful = document.execCommand("copy");
|
|
2327
|
+
if (!successful)
|
|
2328
|
+
this.msgService.simpleError(this.loc["Generic error during 'copy' command execution"][LOCALE]);
|
|
2329
|
+
}
|
|
2330
|
+
catch (err) {
|
|
2331
|
+
this.msgService.simpleError(this.loc["Error during Clipboard content copy operation"][LOCALE] + ": " + err);
|
|
2332
|
+
}
|
|
2333
|
+
document.body.removeChild(textArea);
|
|
2183
2334
|
}
|
|
2184
2335
|
}
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
2336
|
+
ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, deps: [{ token: MessageService }, { token: i1.BaseLocalization, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2337
|
+
ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, providedIn: "root" });
|
|
2338
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, decorators: [{
|
|
2188
2339
|
type: Injectable,
|
|
2189
2340
|
args: [{ providedIn: "root" }]
|
|
2190
|
-
}] }
|
|
2341
|
+
}], ctorParameters: function () { return [{ type: MessageService }, { type: i1.BaseLocalization, decorators: [{
|
|
2342
|
+
type: Optional
|
|
2343
|
+
}] }]; } });
|
|
2191
2344
|
|
|
2192
2345
|
/**
|
|
2193
2346
|
* Classe che rappresenta una risposta ricevuta da un Backend
|