@esfaenza/extensions 13.3.6 → 13.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, NgModule, Injectable, Optional, Inject } from '@angular/core';
2
+ import { InjectionToken, NgModule, Injector, Injectable, Inject, Optional } from '@angular/core';
3
3
  import swal from 'sweetalert2';
4
+ import { ToastrService } from 'ngx-toastr';
4
5
  import { of, Subject } from 'rxjs';
5
6
  import { map } from 'rxjs/operators';
6
- import * as i1 from 'ngx-toastr';
7
7
  import { Deserialize } from 'cerialize';
8
8
 
9
9
  /**
@@ -40,10 +40,10 @@ class ExtensionsModule {
40
40
  };
41
41
  }
42
42
  }
43
- ExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
44
- ExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ExtensionsModule });
45
- ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ExtensionsModule });
46
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ExtensionsModule, decorators: [{
43
+ ExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
44
+ ExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule });
45
+ ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule });
46
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule, decorators: [{
47
47
  type: NgModule
48
48
  }] });
49
49
 
@@ -57,9 +57,9 @@ class MessageService {
57
57
  *
58
58
  * @ignore
59
59
  */
60
- constructor(toastr, FANCY_ALERTS, LOCALE) {
61
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
62
- this.toastr = toastr;
60
+ constructor(injector, FANCY_ALERTS, LOCALE) {
61
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
62
+ this.injector = injector;
63
63
  this.FANCY_ALERTS = FANCY_ALERTS;
64
64
  this.LOCALE = LOCALE;
65
65
  /**
@@ -86,8 +86,8 @@ class MessageService {
86
86
  allowOutsideClick: false,
87
87
  icon: "warning"
88
88
  });
89
- this.warningSwalWithCancel = swal.mixin({
90
- title: this.loc["Warning"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'],
89
+ this.successSwalWithCancel = swal.mixin({
90
+ title: this.loc["Success"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'],
91
91
  customClass: {
92
92
  confirmButton: "btn btn-primary",
93
93
  cancelButton: "btn btn-secondary app-margin-right-10",
@@ -98,10 +98,24 @@ class MessageService {
98
98
  showCancelButton: true,
99
99
  confirmButtonText: this.loc["Confirm"][(_b = this.LOCALE) !== null && _b !== void 0 ? _b : 'it-IT'],
100
100
  cancelButtonText: this.loc["Cancel"][(_c = this.LOCALE) !== null && _c !== void 0 ? _c : 'it-IT'],
101
+ icon: "success"
102
+ });
103
+ this.warningSwalWithCancel = swal.mixin({
104
+ title: this.loc["Warning"][(_d = this.LOCALE) !== null && _d !== void 0 ? _d : 'it-IT'],
105
+ customClass: {
106
+ confirmButton: "btn btn-primary",
107
+ cancelButton: "btn btn-secondary app-margin-right-10",
108
+ container: "app-wrap",
109
+ },
110
+ buttonsStyling: false,
111
+ reverseButtons: true,
112
+ showCancelButton: true,
113
+ confirmButtonText: this.loc["Confirm"][(_e = this.LOCALE) !== null && _e !== void 0 ? _e : 'it-IT'],
114
+ cancelButtonText: this.loc["Cancel"][(_f = this.LOCALE) !== null && _f !== void 0 ? _f : 'it-IT'],
101
115
  icon: "warning"
102
116
  });
103
117
  this.warningSwal = swal.mixin({
104
- title: this.loc["Warning"][(_d = this.LOCALE) !== null && _d !== void 0 ? _d : 'it-IT'],
118
+ title: this.loc["Warning"][(_g = this.LOCALE) !== null && _g !== void 0 ? _g : 'it-IT'],
105
119
  customClass: {
106
120
  confirmButton: "btn btn-primary",
107
121
  container: "app-wrap",
@@ -109,11 +123,11 @@ class MessageService {
109
123
  buttonsStyling: false,
110
124
  reverseButtons: true,
111
125
  showCancelButton: false,
112
- confirmButtonText: this.loc["Close"][(_e = this.LOCALE) !== null && _e !== void 0 ? _e : 'it-IT'],
126
+ confirmButtonText: this.loc["Close"][(_h = this.LOCALE) !== null && _h !== void 0 ? _h : 'it-IT'],
113
127
  icon: "warning"
114
128
  });
115
129
  this.successSwal = swal.mixin({
116
- title: this.loc["Success"][(_f = this.LOCALE) !== null && _f !== void 0 ? _f : 'it-IT'],
130
+ title: this.loc["Success"][(_j = this.LOCALE) !== null && _j !== void 0 ? _j : 'it-IT'],
117
131
  customClass: {
118
132
  confirmButton: "btn btn-primary",
119
133
  container: "app-wrap",
@@ -121,11 +135,11 @@ class MessageService {
121
135
  buttonsStyling: false,
122
136
  reverseButtons: true,
123
137
  showCancelButton: false,
124
- confirmButtonText: this.loc["Close"][(_g = this.LOCALE) !== null && _g !== void 0 ? _g : 'it-IT'],
138
+ confirmButtonText: this.loc["Close"][(_k = this.LOCALE) !== null && _k !== void 0 ? _k : 'it-IT'],
125
139
  icon: "success"
126
140
  });
127
141
  this.errorSwal = swal.mixin({
128
- title: this.loc["Error"][(_h = this.LOCALE) !== null && _h !== void 0 ? _h : 'it-IT'],
142
+ title: this.loc["Error"][(_l = this.LOCALE) !== null && _l !== void 0 ? _l : 'it-IT'],
129
143
  customClass: {
130
144
  confirmButton: "btn btn-primary",
131
145
  container: "app-wrap",
@@ -133,11 +147,11 @@ class MessageService {
133
147
  buttonsStyling: false,
134
148
  reverseButtons: true,
135
149
  showCancelButton: false,
136
- confirmButtonText: this.loc["Close"][(_j = this.LOCALE) !== null && _j !== void 0 ? _j : 'it-IT'],
150
+ confirmButtonText: this.loc["Close"][(_m = this.LOCALE) !== null && _m !== void 0 ? _m : 'it-IT'],
137
151
  icon: "error"
138
152
  });
139
153
  this.infoSwal = swal.mixin({
140
- title: this.loc["Info"][(_k = this.LOCALE) !== null && _k !== void 0 ? _k : 'it-IT'],
154
+ title: this.loc["Info"][(_o = this.LOCALE) !== null && _o !== void 0 ? _o : 'it-IT'],
141
155
  customClass: {
142
156
  confirmButton: "btn btn-primary",
143
157
  container: "app-wrap",
@@ -145,10 +159,13 @@ class MessageService {
145
159
  buttonsStyling: false,
146
160
  reverseButtons: true,
147
161
  showCancelButton: false,
148
- confirmButtonText: this.loc["Close"][(_l = this.LOCALE) !== null && _l !== void 0 ? _l : 'it-IT'],
162
+ confirmButtonText: this.loc["Close"][(_p = this.LOCALE) !== null && _p !== void 0 ? _p : 'it-IT'],
149
163
  icon: "info"
150
164
  });
151
165
  }
166
+ get toastr() {
167
+ return this.injector.get(ToastrService);
168
+ }
152
169
  /**
153
170
  * Presentazione di un semplice messaggio di successo
154
171
  *
@@ -158,12 +175,12 @@ class MessageService {
158
175
  * @param {string} text Testo da mostrare
159
176
  * @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
160
177
  */
161
- simpleSuccess(text, secondaryNotificationType = null) {
178
+ simpleSuccess(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
162
179
  let tos = this.toastrOrSwal(secondaryNotificationType);
163
180
  if (tos == "swal")
164
181
  this.successSwal.fire("", text);
165
182
  else
166
- this.toastr.success(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
183
+ 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 });
167
184
  }
168
185
  /**
169
186
  * Presentazione di un semplice messaggio di informazione
@@ -174,12 +191,12 @@ class MessageService {
174
191
  * @param {string} text Testo da mostrare
175
192
  * @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
176
193
  */
177
- simpleInfo(text, secondaryNotificationType = null) {
194
+ simpleInfo(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
178
195
  let tos = this.toastrOrSwal(secondaryNotificationType);
179
196
  if (tos == "swal")
180
197
  this.infoSwal.fire("", text);
181
198
  else
182
- this.toastr.info(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
199
+ 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 });
183
200
  }
184
201
  /**
185
202
  * Presentazione di un semplice messaggio di errore
@@ -190,12 +207,12 @@ class MessageService {
190
207
  * @param {string} text Testo da mostrare
191
208
  * @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
192
209
  */
193
- simpleError(text, secondaryNotificationType = null) {
210
+ simpleError(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
194
211
  let tos = this.toastrOrSwal(secondaryNotificationType);
195
212
  if (tos == "swal")
196
213
  this.errorSwal.fire("", text);
197
214
  else
198
- this.toastr.error(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
215
+ 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 });
199
216
  }
200
217
  /**
201
218
  * Presentazione di un semplice messaggio di avviso
@@ -206,12 +223,12 @@ class MessageService {
206
223
  * @param {string} text Testo da mostrare
207
224
  * @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
208
225
  */
209
- simpleWarning(text, secondaryNotificationType = null) {
226
+ simpleWarning(text, secondaryNotificationType = null, secondaryNotificationTimeout = null) {
210
227
  let tos = this.toastrOrSwal(secondaryNotificationType);
211
228
  if (tos == "swal")
212
229
  this.warningSwal.fire("", text);
213
230
  else
214
- this.toastr.warning(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
231
+ 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 });
215
232
  }
216
233
  /**
217
234
  * Ripulisce tutti i messaggi presenti in un dato momento sullo schermo
@@ -259,6 +276,32 @@ class MessageService {
259
276
  onerror();
260
277
  });
261
278
  }
279
+ /**
280
+ * Mostra un messaggio di success con richiesta di conferma e gestisce il risultato chiamato i callback **onconfirm** o **onabort**
281
+ *
282
+ * @param {string} title Titolo del messaggio
283
+ * @param {string} text Contenuto del messaggio
284
+ * @param {Function} onconfirm Callback da chimare su conferma
285
+ * @param {Function} onabort Callback da chimare su annullamento
286
+ * @param {string} confirmtext Testo del pulsante di azione
287
+ * @param {string} aborttext Testo del pulsante di annullamento
288
+ */
289
+ simpleSuccessWithChoice(title, text, onconfirm = null, onabort = null, confirmtext = "", aborttext = '') {
290
+ var configuration = {
291
+ title: title,
292
+ html: text
293
+ };
294
+ if (confirmtext)
295
+ configuration["confirmButtonText"] = confirmtext;
296
+ if (aborttext)
297
+ configuration["cancelButtonText"] = aborttext;
298
+ this.successSwalWithCancel.fire(configuration).then((result) => {
299
+ if (result.value && onconfirm)
300
+ onconfirm();
301
+ else if (onabort)
302
+ onabort();
303
+ });
304
+ }
262
305
  /**
263
306
  * Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
264
307
  *
@@ -300,8 +343,8 @@ class MessageService {
300
343
  if (postSuccess)
301
344
  postSuccess();
302
345
  }
303
- else if (response.haserror) {
304
- this.simpleError((errorMsg ? errorMsg + ": " : "") + response.error);
346
+ else {
347
+ this.simpleError((errorMsg ? errorMsg + ": " : "") + response.haserror ? response.error : '[NO ERR.]');
305
348
  if (postFailure)
306
349
  postFailure();
307
350
  }
@@ -357,12 +400,15 @@ class MessageService {
357
400
  }
358
401
  }
359
402
  }
360
- MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MessageService, deps: [{ token: i1.ToastrService }, { token: EXT_FANCY_ALERTS, optional: true }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
361
- MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MessageService });
362
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: MessageService, decorators: [{
403
+ MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageService, deps: [{ token: Injector }, { token: EXT_FANCY_ALERTS, optional: true }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
404
+ MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageService });
405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MessageService, decorators: [{
363
406
  type: Injectable
364
407
  }], ctorParameters: function () {
365
- return [{ type: i1.ToastrService }, { type: undefined, decorators: [{
408
+ return [{ type: i0.Injector, decorators: [{
409
+ type: Inject,
410
+ args: [Injector]
411
+ }] }, { type: undefined, decorators: [{
366
412
  type: Optional
367
413
  }, {
368
414
  type: Inject,
@@ -407,7 +453,27 @@ class ClipboardService {
407
453
  "Error during Clipboard content copy operation": {
408
454
  'en-US': "Error during Clipboard content copy operation",
409
455
  'it-IT': "Errore nella scrittura del contenuto nella Clipboard"
410
- }
456
+ },
457
+ "Please insert your clipboard content": {
458
+ 'en-US': "Please insert your clipboard content",
459
+ 'it-IT': "Si prega di incollare il contenuto della Clipboard"
460
+ },
461
+ "User input required": {
462
+ 'en-US': "User input required",
463
+ 'it-IT': "Richiesto Input utente"
464
+ },
465
+ "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": {
466
+ '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",
467
+ '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"
468
+ },
469
+ "Confirm": {
470
+ 'en-US': "Confirm",
471
+ 'it-IT': "Conferma"
472
+ },
473
+ "Cancel": {
474
+ 'en-US': "Cancel",
475
+ 'it-IT': "Annulla"
476
+ },
411
477
  };
412
478
  }
413
479
  /**
@@ -418,38 +484,66 @@ class ClipboardService {
418
484
  * @param {Function} valueFoundCallback Callback che questa funzione chiamerà una volta ottenuto i valori richiesti dalla clipboard
419
485
  */
420
486
  getClipboard(style, valueFoundCallback) {
421
- var _a;
487
+ var _a, _b, _c, _d;
422
488
  if (navigator.userAgent.indexOf("Firefox") != -1) {
423
- //https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText
424
- this.msgService.simpleError(this.loc["Unfortunately Firefox doesn't yet support direct Clipboard access if not via extensions, Please use Chrome to do this operation"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT']);
489
+ swal.fire({
490
+ title: this.loc["User input required"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'],
491
+ 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"][(_b = this.LOCALE) !== null && _b !== void 0 ? _b : 'it-IT'],
492
+ input: 'textarea',
493
+ icon: "warning",
494
+ confirmButtonText: this.loc["Confirm"][(_c = this.LOCALE) !== null && _c !== void 0 ? _c : 'it-IT'],
495
+ cancelButtonText: this.loc["Cancel"][(_d = this.LOCALE) !== null && _d !== void 0 ? _d : 'it-IT'],
496
+ showCancelButton: true,
497
+ customClass: {
498
+ confirmButton: "btn btn-primary",
499
+ cancelButton: "btn btn-secondary app-margin-right-15",
500
+ container: "app-wrap",
501
+ },
502
+ reverseButtons: true,
503
+ allowOutsideClick: false,
504
+ inputValidator: (value) => {
505
+ var _a;
506
+ if (!value)
507
+ return this.loc["Please insert your clipboard content"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'];
508
+ }
509
+ }).then(t => {
510
+ if (t.isConfirmed) {
511
+ console.log("[@esfaenza/extensions] Retrieving input data from user input");
512
+ this.doClipboardDataGet(t.value, style, valueFoundCallback);
513
+ }
514
+ });
425
515
  return;
426
516
  }
427
517
  if (window.clipboardData) {
518
+ console.log("[@esfaenza/extensions] Found clipboardData");
428
519
  let data = window.clipboardData.getData("Text");
429
- var value = style == "array" ? this.getClipboardLines(data) :
430
- style == "matrix" ? this.getClipboardMatrix(data) : [];
431
- if (valueFoundCallback)
432
- valueFoundCallback(value);
520
+ this.doClipboardDataGet(data, style, valueFoundCallback);
433
521
  }
434
522
  else if (window.navigator.clipboard) {
523
+ console.log("[@esfaenza/extensions] Found navigator clipboard");
435
524
  window.navigator.permissions.query({ name: 'clipboard-read' }).then(result => {
436
- if (!(result.state === 'granted' || result.state === 'prompt'))
525
+ if (!(result.state === 'granted' || result.state === 'prompt')) {
526
+ console.error("[@esfaenza/extensions] Clipboard permission not granted");
437
527
  if (valueFoundCallback)
438
528
  valueFoundCallback([]);
529
+ return;
530
+ }
531
+ console.log("[@esfaenza/extensions] Clipboard permission granted, retrieving values");
439
532
  window.navigator.clipboard.readText()
440
- .then(t => {
441
- var value = style == "array" ? this.getClipboardLines(t) :
442
- style == "matrix" ? this.getClipboardMatrix(t) : [];
443
- if (valueFoundCallback)
444
- valueFoundCallback(value);
445
- })
446
- .catch(err => {
447
- var _a;
448
- this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'] + ": " + err);
449
- });
533
+ .then((t) => this.doClipboardDataGet(t, style, valueFoundCallback))
534
+ .catch((err) => { var _a; return this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'] + ": " + err); });
450
535
  });
451
536
  }
452
537
  }
538
+ /** @ignore */
539
+ doClipboardDataGet(clipboardText, style, valueFoundCallback) {
540
+ console.log("[@esfaenza/extensions] Retrieved clipboard values: " + clipboardText);
541
+ let value = style == "array" ? this.getClipboardLines(clipboardText) :
542
+ style == "matrix" ? this.getClipboardMatrix(clipboardText) : [];
543
+ console.log(`[@esfaenza/extensions] Adapted for ${style}: ${JSON.stringify(value)}`);
544
+ if (valueFoundCallback)
545
+ valueFoundCallback(value);
546
+ }
453
547
  /**
454
548
  * Ottiene il contenuto della clipboard diviso per righe (separate da newline)
455
549
  *
@@ -458,7 +552,10 @@ class ClipboardService {
458
552
  * @returns {string[]} Array contenente il testo preso dalla clipboard diviso per riga
459
553
  */
460
554
  getClipboardLines(data) {
461
- return data.trim().split("\r\n");
555
+ let trimmedData = data.trim();
556
+ if (!trimmedData.includes("\r\n") && trimmedData.includes("\n"))
557
+ return trimmedData.split("\n");
558
+ return trimmedData.split("\r\n");
462
559
  }
463
560
  /**
464
561
  * Ottiene il contenuto della clipboard diviso per righe (separate da newline) e colonne (separate da tab)
@@ -469,7 +566,7 @@ class ClipboardService {
469
566
  */
470
567
  getClipboardMatrix(data) {
471
568
  var ret = [];
472
- var rows = data.split("\r\n");
569
+ var rows = !data.includes("\r\n") && data.includes("\n") ? data.split("\n") : data.split("\r\n");
473
570
  // A quanto pare ogni valore è separato da un \t... spero che sia uno standard di quando si copia da excel altrimenti ciao
474
571
  for (let i = 0; i < rows.length; i++)
475
572
  ret.push(rows[i].split('\t').map(t => t.trim()));
@@ -528,9 +625,9 @@ class ClipboardService {
528
625
  document.body.removeChild(textArea);
529
626
  }
530
627
  }
531
- ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClipboardService, deps: [{ token: MessageService }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
532
- ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClipboardService });
533
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ClipboardService, decorators: [{
628
+ ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ClipboardService, deps: [{ token: MessageService }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
629
+ ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ClipboardService });
630
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ClipboardService, decorators: [{
534
631
  type: Injectable
535
632
  }], ctorParameters: function () {
536
633
  return [{ type: MessageService }, { type: undefined, decorators: [{
@@ -603,8 +700,13 @@ class DateService {
603
700
  if (mydt == null)
604
701
  return "FE: Not a Date";
605
702
  let isZeroTime = mydt.startOf(timepart).valueOf() === mydt.valueOf();
606
- if (!isZeroTime)
703
+ if (!isZeroTime) {
704
+ if (timepart == "day" && mydt.subtract(1, "hour").hour() == mydt.hour()) {
705
+ // Se l'ora precedente è lo stesso orario dell'ora attuale l'istante finale dev'essere mandato avanti di 1
706
+ mydt = mydt.add(1, "hour");
707
+ }
607
708
  return printSeconds ? mydt.format(this.cfg.fulldateDisplay) : mydt.format(this.cfg.fulldateDisplayNoSS);
709
+ }
608
710
  let tmpValue = mydt.subtract(1, timepart);
609
711
  let value = "";
610
712
  // Istante finale delle ore: 05/10/1992 --> 04/10/1992 24:00(:00)
@@ -712,7 +814,7 @@ class DateService {
712
814
  tryThis = toCall(date, this.cfg.smallDate);
713
815
  else if (length == this.cfg.fulldateNoSS.length)
714
816
  tryThis = toCall(date, this.cfg.fulldateNoSS);
715
- if (tryThis && tryThis.isValid())
817
+ if (tryThis && tryThis.isValid && tryThis.isValid())
716
818
  return tryThis;
717
819
  // Se niente funziona, null.
718
820
  // Ricondurre l'Input ad una data non è possibile.
@@ -754,9 +856,9 @@ class DateService {
754
856
  return date.format(small ? this.cfg.smallDate : seconds ? this.cfg.fulldateDisplay : this.cfg.fulldateDisplayNoSS);
755
857
  }
756
858
  }
757
- DateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: DateService, deps: [{ token: EXT_LOCALE, optional: true }, { token: EXT_ALLOW_UTC, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
758
- DateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: DateService });
759
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: DateService, decorators: [{
859
+ DateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateService, deps: [{ token: EXT_LOCALE, optional: true }, { token: EXT_ALLOW_UTC, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
860
+ DateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateService });
861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateService, decorators: [{
760
862
  type: Injectable
761
863
  }], ctorParameters: function () {
762
864
  return [{ type: undefined, decorators: [{
@@ -789,6 +891,10 @@ const csvVisPrefix = "_csvvis";
789
891
  * Suffisso della proprietà da generare in cui salvare il nome della colonna in cui salvare questa proprietà
790
892
  */
791
893
  const csvHdrPrefix = "_csvhdr";
894
+ /**
895
+ * Suffisso della proprietà da generare in cui salvare il codice del th a cui si riferisce questo campo
896
+ */
897
+ const csvPropKey = "_csvkey";
792
898
  /**
793
899
  * Suffisso della proprietà da generare in cui salvare il valore da prendere per una proprietà di tipo Lista
794
900
  */
@@ -812,7 +918,11 @@ const dictionaryCsvHdrPrefix = "_flatlistcsvhdr";
812
918
  /**
813
919
  * Suffisso della proprietà da generare in cui salvare il formato della proprietà che si sta esportando
814
920
  */
815
- const csvFormatPrefix = "_csvfmt";
921
+ const csvFormatPrefix = "_csvfmt";
922
+ /**
923
+ * Nome della proprietà che contiene tutti i nomi di tutte le proprietà da esportare
924
+ */
925
+ const exportList = "__export_list__";
816
926
 
817
927
  // Angular
818
928
  /**
@@ -840,12 +950,18 @@ const csvFormatPrefix = "_csvfmt";
840
950
  * @param {string} header Titolo della colonna nel file CSV esportato
841
951
  * @param {string} format Formato di esportazione. Può essere un formato data per i campi data o 'F' per i campi floating point
842
952
  */
843
- const Export = (order, header, format = null) => (target, propertyKey) => {
953
+ const Export = (order, header, format = null, tableid = null) => (target, propertyKey) => {
844
954
  if (format)
845
955
  Object.defineProperty(target, propertyKey + csvFormatPrefix, { value: format, writable: false });
846
956
  Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
847
957
  Object.defineProperty(target, propertyKey + csvVisPrefix, { value: !!header, writable: false });
848
958
  Object.defineProperty(target, propertyKey + csvHdrPrefix, { value: header, writable: false });
959
+ if (tableid)
960
+ Object.defineProperty(target, propertyKey + csvPropKey, { value: tableid, writable: false });
961
+ if (target[exportList])
962
+ target[exportList].push(propertyKey + csvVisPrefix);
963
+ else
964
+ target[exportList] = [propertyKey + csvVisPrefix];
849
965
  };
850
966
  /**
851
967
  * Decoratore di esportazione utilizzabile su un oggetto.
@@ -879,8 +995,9 @@ const Export = (order, header, format = null) => (target, propertyKey) => {
879
995
  */
880
996
  const ExportAs = (order, type) => (target, propertyKey) => {
881
997
  var t = new type();
882
- for (var prop in t) {
883
- //Niente hasownproperty perché le proprietà dell'oggetto interno sono dentro al prototype
998
+ var props = t[exportList];
999
+ for (let i = 0; i < props.length; i++) {
1000
+ let prop = props[i].replace(csvVisPrefix, '');
884
1001
  if (typeof t[prop + csvVisPrefix] !== "undefined") {
885
1002
  var toEmit = t[prop + csvVisPrefix];
886
1003
  var lbl = t[prop + csvHdrPrefix];
@@ -893,6 +1010,10 @@ const ExportAs = (order, type) => (target, propertyKey) => {
893
1010
  Object.defineProperty(target, propertyKey + prop + csvValueNavigator, { value: propertyKey + "." + prop, writable: false });
894
1011
  Object.defineProperty(target, propertyKey + prop + csvVisPrefix, { value: toEmit, writable: false });
895
1012
  Object.defineProperty(target, propertyKey + prop + csvHdrPrefix, { value: lbl, writable: false });
1013
+ if (target[exportList])
1014
+ target[exportList].push(propertyKey + prop + csvVisPrefix);
1015
+ else
1016
+ target[exportList] = [propertyKey + prop + csvVisPrefix];
896
1017
  }
897
1018
  }
898
1019
  };
@@ -919,6 +1040,10 @@ const ExportList = (order, headernavigator, valuenavigator, valueformat = null)
919
1040
  Object.defineProperty(target, propertyKey + listCsvValPrefix, { value: valuenavigator, writable: false });
920
1041
  Object.defineProperty(target, propertyKey + listCsvHdrPrefix, { value: headernavigator, writable: false });
921
1042
  Object.defineProperty(target, propertyKey + listCsvValFormat, { value: valueformat, writable: false });
1043
+ if (target[exportList])
1044
+ target[exportList].push(propertyKey + listCsvHdrPrefix);
1045
+ else
1046
+ target[exportList] = [propertyKey + listCsvHdrPrefix];
922
1047
  };
923
1048
  /**
924
1049
  * Decoratore di esportazione utilizzabile su un dizionario. Se ad esempio si vogliono generare le colonne
@@ -939,6 +1064,10 @@ const ExportDictionary = (order, headernavigator, valuenavigator) => (target, pr
939
1064
  Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
940
1065
  Object.defineProperty(target, propertyKey + dictionaryCsvValPrefix, { value: valuenavigator, writable: false });
941
1066
  Object.defineProperty(target, propertyKey + dictionaryCsvHdrPrefix, { value: headernavigator, writable: false });
1067
+ if (target[exportList])
1068
+ target[exportList].push(propertyKey + dictionaryCsvHdrPrefix);
1069
+ else
1070
+ target[exportList] = [propertyKey + dictionaryCsvHdrPrefix];
942
1071
  };
943
1072
  /**
944
1073
  * Service che si occupa dell'esportazione degli oggetti marcati dai Decoratori **ExportDictionary**, **ExportList**, **ExportAs** o **Export**
@@ -959,15 +1088,19 @@ class ExportService {
959
1088
  *
960
1089
  * @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
961
1090
  */
962
- setupForExport(objs) {
1091
+ setupForExport(objs, columns = []) {
963
1092
  let headers = [];
964
1093
  let headersCache = {};
965
1094
  if (!objs || objs.length == 0)
966
1095
  return headers;
967
1096
  // Devo per forza farlo per tutti gli oggetti dato che devo esporre le proprietà che mi servono da esportare
968
1097
  // Gli header li raccolgo tutti poi faccio uan distinct in modo da esportare tutte le proprietà per bene
1098
+ let columnSelectionDictionary = {};
1099
+ if ((columns === null || columns === void 0 ? void 0 : columns.length) > 0)
1100
+ for (let i = 0; i < (columns === null || columns === void 0 ? void 0 : columns.length); i++)
1101
+ columnSelectionDictionary[columns[i]] = true;
969
1102
  for (let i = 0; i < objs.length; i++) {
970
- let hds = this.parseAndGetHeaders(objs[i]);
1103
+ let hds = this.parseAndGetHeaders(objs[i], columnSelectionDictionary);
971
1104
  // Aggiungo gli header facendo in modo di non aggiungerne mai due uguali per non dover fare una distinct dopo
972
1105
  // che costerebbe comunque risorse. Utilizzo un dizionario d'appoggio per lookup istantanei
973
1106
  for (let k = 0; k < hds.length; k++) {
@@ -977,7 +1110,23 @@ class ExportService {
977
1110
  }
978
1111
  }
979
1112
  }
980
- return headers.sort((a, b) => a.order - b.order);
1113
+ if (!columns || columns.length == 0)
1114
+ return headers.sort((a, b) => a.order - b.order);
1115
+ else {
1116
+ // Se mi arriva la lista di colonne non mi dà solo la visibilità, ma anche l'ordinamento
1117
+ // le esporto di conseguenza
1118
+ let orderedHeaders = [];
1119
+ for (let i = 0; i < columns.length; i++) {
1120
+ let thisId = columns[i];
1121
+ for (let i = 0; i < headers.length; i++) {
1122
+ if (headers[i].propKey == thisId) {
1123
+ orderedHeaders.push(headers[i]);
1124
+ break;
1125
+ }
1126
+ }
1127
+ }
1128
+ return orderedHeaders;
1129
+ }
981
1130
  }
982
1131
  /**
983
1132
  * 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**
@@ -1018,7 +1167,7 @@ class ExportService {
1018
1167
  columns.forEach(t => {
1019
1168
  var propValue = obj.properties[t.key];
1020
1169
  Object.defineProperty(obj, t.key + "_exp", { value: propValue, writable: false, enumerable: true });
1021
- headers.push({ label: t.label, key: t.key + "_exp", order: t.order, type: t.type });
1170
+ headers.push({ label: t.label, key: t.key + "_exp", order: t.order, type: t.type, propKey: null });
1022
1171
  });
1023
1172
  //Tirati fuori tutti gli header faccio sort sull'ordinamento
1024
1173
  return headers.sort((a, b) => { return a.order - b.order; });
@@ -1032,23 +1181,33 @@ class ExportService {
1032
1181
  *
1033
1182
  * @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
1034
1183
  */
1035
- parseAndGetHeaders(obj) {
1184
+ parseAndGetHeaders(obj, columnsSelection) {
1036
1185
  var headers = [];
1037
1186
  // Miracle incoming
1038
- for (var prop in obj) {
1187
+ let exportProps = obj[exportList] || [];
1188
+ if (exportProps.length == 0)
1189
+ console.warn("[@esfaenza/extensions] Nessuna colonna configurata da esportare!");
1190
+ for (let i = 0; i < exportProps.length; i++) {
1191
+ let prop = exportProps[i];
1192
+ let propBase = "";
1039
1193
  let toCall;
1040
- if (typeof obj[prop + listCsvHdrPrefix] !== "undefined")
1194
+ if (prop.endsWith(listCsvHdrPrefix)) {
1195
+ propBase = prop.replace(listCsvHdrPrefix, '');
1041
1196
  toCall = this.parseList.bind(this);
1042
- else if (typeof obj[prop + dictionaryCsvHdrPrefix] !== "undefined")
1197
+ }
1198
+ else if (prop.endsWith(dictionaryCsvHdrPrefix)) {
1043
1199
  toCall = this.parseDictionary.bind(this);
1044
- else if (typeof obj[prop + csvVisPrefix] !== "undefined") {
1045
- if (typeof obj[prop + csvValueNavigator] !== "undefined")
1200
+ propBase = prop.replace(dictionaryCsvHdrPrefix, '');
1201
+ }
1202
+ else if (prop.endsWith(csvVisPrefix)) {
1203
+ propBase = prop.replace(csvVisPrefix, '');
1204
+ if (typeof obj[propBase + csvValueNavigator] !== "undefined")
1046
1205
  toCall = this.parseObject.bind(this);
1047
1206
  else
1048
1207
  toCall = this.parseProperty.bind(this);
1049
1208
  }
1050
1209
  if (toCall)
1051
- toCall(obj, prop, headers);
1210
+ toCall(obj, propBase, headers, columnsSelection);
1052
1211
  }
1053
1212
  return headers;
1054
1213
  }
@@ -1060,9 +1219,14 @@ class ExportService {
1060
1219
  * @param {string} prop Proprietà da esportare
1061
1220
  * @param {CsvHeaders} headers Contenitore degli header, verrà riempito da questa funzione
1062
1221
  */
1063
- parseProperty(obj, prop, headers) {
1222
+ parseProperty(obj, prop, headers, columnsSelection) {
1064
1223
  let toEmit = obj[prop + csvVisPrefix];
1065
1224
  let format = obj[prop + csvFormatPrefix];
1225
+ let propKey = obj[prop + csvPropKey];
1226
+ if (propKey && !columnsSelection[propKey] && Object.keys(columnsSelection).length > 0) {
1227
+ console.log("[@esfaenza/extensions] Colonna da non esportare: " + propKey);
1228
+ return;
1229
+ }
1066
1230
  let lbl = obj[prop + csvHdrPrefix];
1067
1231
  let order = obj[prop + csvOrdPrefix];
1068
1232
  if (toEmit && lbl !== "undefined") {
@@ -1071,7 +1235,7 @@ class ExportService {
1071
1235
  // Se è un formato data mi assicuro di non stampare mai una data 00:00:00 altrimenti in esportazione viene uno schifo
1072
1236
  var val = obj[prop] ? this.dates.trimSeconds(obj[prop].toString()) : "";
1073
1237
  Object.defineProperty(obj, prop + "_nofmt", { value: val, writable: false, enumerable: true });
1074
- headers.push({ label: lbl ? lbl : prop + "_nofmt", key: prop + "_nofmt", order: order, type: "string" });
1238
+ headers.push({ label: lbl ? lbl : prop + "_nofmt", key: prop + "_nofmt", order: order, type: "string", propKey: propKey });
1075
1239
  }
1076
1240
  else {
1077
1241
  // Caso formato numerico
@@ -1083,15 +1247,15 @@ class ExportService {
1083
1247
  // Il singolo punto che c'è, se presente (separatore decimali) lo trasformo in virgola
1084
1248
  let valConverted = val.replace(".", ",");
1085
1249
  Object.defineProperty(obj, prop + "_fmt", { value: valConverted, writable: false, enumerable: true });
1086
- headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "number" });
1250
+ headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "number", propKey: propKey });
1087
1251
  }
1088
1252
  else {
1089
1253
  // Se ho un formato data trasformo in dayjs, formatto ed esporto
1090
1254
  // Per la trasformazione in dayjs provo prima a passargli la stringa di netto, sperando la riconosca
1091
1255
  // Se non funziona provo a definirgli la formattazione standard del metering per quel linguaggio
1092
- let val = this.dates.getFormatted(obj[prop], format.length <= 10, false);
1256
+ let val = this.dates.getFormatted(obj[prop], format.length <= 10, format.length > 16);
1093
1257
  Object.defineProperty(obj, prop + "_fmt", { value: val !== null && val !== void 0 ? val : "", writable: false, enumerable: true });
1094
- headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "date" });
1258
+ headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "date", propKey: propKey });
1095
1259
  }
1096
1260
  }
1097
1261
  }
@@ -1132,11 +1296,11 @@ class ExportService {
1132
1296
  type = "number";
1133
1297
  }
1134
1298
  else if (format) {
1135
- value = this.dates.getFormatted(value, format.length <= 10, false);
1299
+ value = this.dates.getFormatted(value, format.length <= 10, format.length > 16);
1136
1300
  type = "date";
1137
1301
  }
1138
- Object.defineProperty(obj, prop, { value: value, writable: false, enumerable: true });
1139
- headers.push({ label: lbl ? lbl : prop, key: prop, order: order, type: type });
1302
+ Object.defineProperty(obj, prop, { value: value !== null && value !== void 0 ? value : "", writable: false, enumerable: true });
1303
+ headers.push({ label: lbl ? lbl : prop, key: prop, order: order, type: type, propKey: null });
1140
1304
  }
1141
1305
  /**
1142
1306
  * Setup per l'esportazione di una lista di valori pivottati dinamicamente:
@@ -1186,11 +1350,11 @@ class ExportService {
1186
1350
  type = "number";
1187
1351
  }
1188
1352
  else if (valueformat) {
1189
- value = this.dates.getFormatted(obj[prop], valueformat.length <= 10, false);
1353
+ value = this.dates.getFormatted(obj[prop], valueformat.length <= 10, valueformat.length > 16);
1190
1354
  type = "date";
1191
1355
  }
1192
- Object.defineProperty(obj, prop + idx, { value: value, writable: false });
1193
- headers.push({ label: header, key: prop + idx, order: order + idx, type: type });
1356
+ Object.defineProperty(obj, prop + idx, { value: value !== null && value !== void 0 ? value : "", writable: false });
1357
+ headers.push({ label: header, key: prop + idx, order: order + idx, type: type, propKey: null });
1194
1358
  }
1195
1359
  }
1196
1360
  /**
@@ -1236,8 +1400,8 @@ class ExportService {
1236
1400
  jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
1237
1401
  let value = tmpRes;
1238
1402
  let propname = prop + idx.toString() + idxinternal.toString();
1239
- Object.defineProperty(obj, propname, { value: value, writable: false });
1240
- headers.push({ label: header + " " + desc, key: propname, order: order + idx, type: 'string' });
1403
+ Object.defineProperty(obj, propname, { value: value !== null && value !== void 0 ? value : "", writable: false });
1404
+ headers.push({ label: header + " " + desc, key: propname, order: order + idx, type: 'string', propKey: null });
1241
1405
  });
1242
1406
  }
1243
1407
  }
@@ -1254,9 +1418,9 @@ class ExportService {
1254
1418
  return Deserialize(items, type);
1255
1419
  }
1256
1420
  }
1257
- ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ExportService, deps: [{ token: DateService }], target: i0.ɵɵFactoryTarget.Injectable });
1258
- ExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ExportService });
1259
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: ExportService, decorators: [{
1421
+ ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExportService, deps: [{ token: DateService }], target: i0.ɵɵFactoryTarget.Injectable });
1422
+ ExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExportService });
1423
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExportService, decorators: [{
1260
1424
  type: Injectable
1261
1425
  }], ctorParameters: function () { return [{ type: DateService }]; } });
1262
1426
 
@@ -1561,9 +1725,9 @@ class HashingService {
1561
1725
  return (a + b) & 0xFFFFFFFF;
1562
1726
  }
1563
1727
  }
1564
- HashingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: HashingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1565
- HashingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: HashingService });
1566
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: HashingService, decorators: [{
1728
+ HashingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HashingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1729
+ HashingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HashingService });
1730
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: HashingService, decorators: [{
1567
1731
  type: Injectable
1568
1732
  }] });
1569
1733
 
@@ -1769,10 +1933,52 @@ class UtilityService {
1769
1933
  return "string";
1770
1934
  }
1771
1935
  }
1936
+ /**
1937
+ * Effettua la clonazione profonda di un oggetto in maniera molto più performante che JSON.parse(JSON.stringify()).
1938
+ *
1939
+ * Usare solo per oggetti puri e quantomeno semplici per evitare complicazioni derivanti dalle semplificazioni che questo metodo assume
1940
+ *
1941
+ * @param {any} source Oggetto da clonare
1942
+ *
1943
+ * @return {any} Clone dell'oggetto passato
1944
+ */
1945
+ deepClone(source) {
1946
+ // Valori semplici
1947
+ if (source == null || typeof source !== 'object')
1948
+ return source;
1949
+ // Pseudo Struct
1950
+ switch (toString.call(source)) {
1951
+ case '[object Boolean]':
1952
+ case '[object Number]':
1953
+ case '[object String]':
1954
+ case '[object Date]':
1955
+ return new source.constructor(source.valueOf());
1956
+ default: break;
1957
+ }
1958
+ // Oggetti Complessi
1959
+ return this.recursiveStep(source, Array.isArray(source) || source instanceof Array ? [] : Object.create(Object.getPrototypeOf(source)));
1960
+ }
1961
+ /**
1962
+ * @ignore
1963
+ * Step ricorsivo per la clonatura degli oggetti. Vedere **deepClone**
1964
+ */
1965
+ recursiveStep(source, destination) {
1966
+ if (Array.isArray(source) || source instanceof Array) {
1967
+ for (var i = 0, ii = source.length; i < ii; i++)
1968
+ destination.push(this.deepClone(source[i]));
1969
+ }
1970
+ else if (source && typeof source.hasOwnProperty === 'function') {
1971
+ for (let key in source) {
1972
+ if (source.hasOwnProperty(key))
1973
+ destination[key] = this.deepClone(source[key]);
1974
+ }
1975
+ }
1976
+ return destination;
1977
+ }
1772
1978
  }
1773
- UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: UtilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1774
- UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: UtilityService });
1775
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: UtilityService, decorators: [{
1979
+ UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1980
+ UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService });
1981
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UtilityService, decorators: [{
1776
1982
  type: Injectable
1777
1983
  }] });
1778
1984
 
@@ -1831,9 +2037,9 @@ class InterComService {
1831
2037
  this.outbounds[key] = new Subject();
1832
2038
  }
1833
2039
  }
1834
- InterComService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: InterComService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1835
- InterComService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: InterComService });
1836
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: InterComService, decorators: [{
2040
+ InterComService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: InterComService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2041
+ InterComService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: InterComService });
2042
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: InterComService, decorators: [{
1837
2043
  type: Injectable
1838
2044
  }] });
1839
2045
 
@@ -1870,10 +2076,10 @@ class FullExtensionsModule {
1870
2076
  };
1871
2077
  }
1872
2078
  }
1873
- FullExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FullExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1874
- FullExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FullExtensionsModule });
1875
- FullExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FullExtensionsModule });
1876
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FullExtensionsModule, decorators: [{
2079
+ FullExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2080
+ FullExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule });
2081
+ FullExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule });
2082
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: FullExtensionsModule, decorators: [{
1877
2083
  type: NgModule
1878
2084
  }] });
1879
2085