@esfaenza/extensions 13.3.5 → 13.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/models/CallResult.mjs +1 -1
- package/esm2020/lib/models/CsvHeaders.mjs +1 -1
- package/esm2020/lib/models/ExportConsts.mjs +9 -1
- package/esm2020/lib/modules/extensions.full.module.mjs +4 -4
- package/esm2020/lib/modules/extensions.module.mjs +4 -4
- package/esm2020/lib/services/extensions.clipboard.service.mjs +75 -23
- package/esm2020/lib/services/extensions.dates.service.mjs +11 -6
- package/esm2020/lib/services/extensions.exports.service.mjs +86 -32
- package/esm2020/lib/services/extensions.hashing.service.mjs +3 -3
- package/esm2020/lib/services/extensions.intercom.service.mjs +3 -3
- package/esm2020/lib/services/extensions.messages.service.mjs +69 -23
- package/esm2020/lib/services/extensions.utilities.service.mjs +46 -4
- package/fesm2015/esfaenza-extensions.mjs +315 -110
- package/fesm2015/esfaenza-extensions.mjs.map +1 -1
- package/fesm2020/esfaenza-extensions.mjs +302 -97
- package/fesm2020/esfaenza-extensions.mjs.map +1 -1
- package/lib/models/CallResult.d.ts +11 -25
- package/lib/models/CsvHeaders.d.ts +4 -0
- package/lib/models/ExportConsts.d.ts +8 -0
- package/lib/services/extensions.clipboard.service.d.ts +2 -0
- package/lib/services/extensions.exports.service.d.ts +2 -2
- package/lib/services/extensions.messages.service.d.ts +23 -7
- package/lib/services/extensions.utilities.service.d.ts +15 -0
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, NgModule,
|
|
2
|
+
import { InjectionToken, NgModule, Injector, Injectable, Inject, Optional } from '@angular/core';
|
|
3
3
|
import swal from 'sweetalert2';
|
|
4
|
+
import { ToastrService } from 'ngx-toastr';
|
|
4
5
|
import { of, Subject } from 'rxjs';
|
|
5
6
|
import { map } from 'rxjs/operators';
|
|
6
|
-
import * as i1 from 'ngx-toastr';
|
|
7
7
|
import { Deserialize } from 'cerialize';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -40,10 +40,10 @@ class ExtensionsModule {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
ExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
44
|
-
ExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.
|
|
45
|
-
ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.
|
|
46
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
43
|
+
ExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
44
|
+
ExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule });
|
|
45
|
+
ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule });
|
|
46
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ExtensionsModule, decorators: [{
|
|
47
47
|
type: NgModule
|
|
48
48
|
}] });
|
|
49
49
|
|
|
@@ -57,9 +57,9 @@ class MessageService {
|
|
|
57
57
|
*
|
|
58
58
|
* @ignore
|
|
59
59
|
*/
|
|
60
|
-
constructor(
|
|
61
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
62
|
-
this.
|
|
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.
|
|
90
|
-
title: this.loc["
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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
|
*
|
|
@@ -293,19 +336,18 @@ class MessageService {
|
|
|
293
336
|
*/
|
|
294
337
|
manageCallResultResponse(response, successMsg, errorMsg, postSuccess = null, postFailure = null) {
|
|
295
338
|
if (response.success) {
|
|
296
|
-
if (
|
|
339
|
+
if (response.haswarning)
|
|
340
|
+
this.simpleWarning(response.warning);
|
|
341
|
+
else if (successMsg)
|
|
297
342
|
this.simpleSuccess(successMsg);
|
|
298
343
|
if (postSuccess)
|
|
299
344
|
postSuccess();
|
|
300
345
|
}
|
|
301
|
-
else
|
|
302
|
-
this.simpleError((errorMsg ? errorMsg + ": " : "") + response.error);
|
|
346
|
+
else {
|
|
347
|
+
this.simpleError((errorMsg ? errorMsg + ": " : "") + response.haserror ? response.error : '[NO ERR.]');
|
|
303
348
|
if (postFailure)
|
|
304
349
|
postFailure();
|
|
305
350
|
}
|
|
306
|
-
else if (response.haswarning) {
|
|
307
|
-
this.simpleWarning(response.warning);
|
|
308
|
-
}
|
|
309
351
|
}
|
|
310
352
|
/**
|
|
311
353
|
* Metodo helper per gestire in maniera standardizzata una risposta di tipo **string**, considerando che:
|
|
@@ -358,12 +400,15 @@ class MessageService {
|
|
|
358
400
|
}
|
|
359
401
|
}
|
|
360
402
|
}
|
|
361
|
-
MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
362
|
-
MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
363
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
364
406
|
type: Injectable
|
|
365
407
|
}], ctorParameters: function () {
|
|
366
|
-
return [{ type:
|
|
408
|
+
return [{ type: i0.Injector, decorators: [{
|
|
409
|
+
type: Inject,
|
|
410
|
+
args: [Injector]
|
|
411
|
+
}] }, { type: undefined, decorators: [{
|
|
367
412
|
type: Optional
|
|
368
413
|
}, {
|
|
369
414
|
type: Inject,
|
|
@@ -408,7 +453,27 @@ class ClipboardService {
|
|
|
408
453
|
"Error during Clipboard content copy operation": {
|
|
409
454
|
'en-US': "Error during Clipboard content copy operation",
|
|
410
455
|
'it-IT': "Errore nella scrittura del contenuto nella Clipboard"
|
|
411
|
-
}
|
|
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
|
+
},
|
|
412
477
|
};
|
|
413
478
|
}
|
|
414
479
|
/**
|
|
@@ -419,38 +484,66 @@ class ClipboardService {
|
|
|
419
484
|
* @param {Function} valueFoundCallback Callback che questa funzione chiamerà una volta ottenuto i valori richiesti dalla clipboard
|
|
420
485
|
*/
|
|
421
486
|
getClipboard(style, valueFoundCallback) {
|
|
422
|
-
var _a;
|
|
487
|
+
var _a, _b, _c, _d;
|
|
423
488
|
if (navigator.userAgent.indexOf("Firefox") != -1) {
|
|
424
|
-
|
|
425
|
-
|
|
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
|
+
});
|
|
426
515
|
return;
|
|
427
516
|
}
|
|
428
517
|
if (window.clipboardData) {
|
|
518
|
+
console.log("[@esfaenza/extensions] Found clipboardData");
|
|
429
519
|
let data = window.clipboardData.getData("Text");
|
|
430
|
-
|
|
431
|
-
style == "matrix" ? this.getClipboardMatrix(data) : [];
|
|
432
|
-
if (valueFoundCallback)
|
|
433
|
-
valueFoundCallback(value);
|
|
520
|
+
this.doClipboardDataGet(data, style, valueFoundCallback);
|
|
434
521
|
}
|
|
435
522
|
else if (window.navigator.clipboard) {
|
|
523
|
+
console.log("[@esfaenza/extensions] Found navigator clipboard");
|
|
436
524
|
window.navigator.permissions.query({ name: 'clipboard-read' }).then(result => {
|
|
437
|
-
if (!(result.state === 'granted' || result.state === 'prompt'))
|
|
525
|
+
if (!(result.state === 'granted' || result.state === 'prompt')) {
|
|
526
|
+
console.error("[@esfaenza/extensions] Clipboard permission not granted");
|
|
438
527
|
if (valueFoundCallback)
|
|
439
528
|
valueFoundCallback([]);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
console.log("[@esfaenza/extensions] Clipboard permission granted, retrieving values");
|
|
440
532
|
window.navigator.clipboard.readText()
|
|
441
|
-
.then(t =>
|
|
442
|
-
var
|
|
443
|
-
style == "matrix" ? this.getClipboardMatrix(t) : [];
|
|
444
|
-
if (valueFoundCallback)
|
|
445
|
-
valueFoundCallback(value);
|
|
446
|
-
})
|
|
447
|
-
.catch(err => {
|
|
448
|
-
var _a;
|
|
449
|
-
this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'] + ": " + err);
|
|
450
|
-
});
|
|
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); });
|
|
451
535
|
});
|
|
452
536
|
}
|
|
453
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
|
+
}
|
|
454
547
|
/**
|
|
455
548
|
* Ottiene il contenuto della clipboard diviso per righe (separate da newline)
|
|
456
549
|
*
|
|
@@ -459,7 +552,10 @@ class ClipboardService {
|
|
|
459
552
|
* @returns {string[]} Array contenente il testo preso dalla clipboard diviso per riga
|
|
460
553
|
*/
|
|
461
554
|
getClipboardLines(data) {
|
|
462
|
-
|
|
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");
|
|
463
559
|
}
|
|
464
560
|
/**
|
|
465
561
|
* Ottiene il contenuto della clipboard diviso per righe (separate da newline) e colonne (separate da tab)
|
|
@@ -470,7 +566,7 @@ class ClipboardService {
|
|
|
470
566
|
*/
|
|
471
567
|
getClipboardMatrix(data) {
|
|
472
568
|
var ret = [];
|
|
473
|
-
var rows = data.split("\r\n");
|
|
569
|
+
var rows = !data.includes("\r\n") && data.includes("\n") ? data.split("\n") : data.split("\r\n");
|
|
474
570
|
// A quanto pare ogni valore è separato da un \t... spero che sia uno standard di quando si copia da excel altrimenti ciao
|
|
475
571
|
for (let i = 0; i < rows.length; i++)
|
|
476
572
|
ret.push(rows[i].split('\t').map(t => t.trim()));
|
|
@@ -529,9 +625,9 @@ class ClipboardService {
|
|
|
529
625
|
document.body.removeChild(textArea);
|
|
530
626
|
}
|
|
531
627
|
}
|
|
532
|
-
ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
533
|
-
ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
534
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
535
631
|
type: Injectable
|
|
536
632
|
}], ctorParameters: function () {
|
|
537
633
|
return [{ type: MessageService }, { type: undefined, decorators: [{
|
|
@@ -604,8 +700,13 @@ class DateService {
|
|
|
604
700
|
if (mydt == null)
|
|
605
701
|
return "FE: Not a Date";
|
|
606
702
|
let isZeroTime = mydt.startOf(timepart).valueOf() === mydt.valueOf();
|
|
607
|
-
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
|
+
}
|
|
608
708
|
return printSeconds ? mydt.format(this.cfg.fulldateDisplay) : mydt.format(this.cfg.fulldateDisplayNoSS);
|
|
709
|
+
}
|
|
609
710
|
let tmpValue = mydt.subtract(1, timepart);
|
|
610
711
|
let value = "";
|
|
611
712
|
// Istante finale delle ore: 05/10/1992 --> 04/10/1992 24:00(:00)
|
|
@@ -713,7 +814,7 @@ class DateService {
|
|
|
713
814
|
tryThis = toCall(date, this.cfg.smallDate);
|
|
714
815
|
else if (length == this.cfg.fulldateNoSS.length)
|
|
715
816
|
tryThis = toCall(date, this.cfg.fulldateNoSS);
|
|
716
|
-
if (tryThis && tryThis.isValid())
|
|
817
|
+
if (tryThis && tryThis.isValid && tryThis.isValid())
|
|
717
818
|
return tryThis;
|
|
718
819
|
// Se niente funziona, null.
|
|
719
820
|
// Ricondurre l'Input ad una data non è possibile.
|
|
@@ -755,9 +856,9 @@ class DateService {
|
|
|
755
856
|
return date.format(small ? this.cfg.smallDate : seconds ? this.cfg.fulldateDisplay : this.cfg.fulldateDisplayNoSS);
|
|
756
857
|
}
|
|
757
858
|
}
|
|
758
|
-
DateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
759
|
-
DateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
760
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
761
862
|
type: Injectable
|
|
762
863
|
}], ctorParameters: function () {
|
|
763
864
|
return [{ type: undefined, decorators: [{
|
|
@@ -790,6 +891,10 @@ const csvVisPrefix = "_csvvis";
|
|
|
790
891
|
* Suffisso della proprietà da generare in cui salvare il nome della colonna in cui salvare questa proprietà
|
|
791
892
|
*/
|
|
792
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";
|
|
793
898
|
/**
|
|
794
899
|
* Suffisso della proprietà da generare in cui salvare il valore da prendere per una proprietà di tipo Lista
|
|
795
900
|
*/
|
|
@@ -813,7 +918,11 @@ const dictionaryCsvHdrPrefix = "_flatlistcsvhdr";
|
|
|
813
918
|
/**
|
|
814
919
|
* Suffisso della proprietà da generare in cui salvare il formato della proprietà che si sta esportando
|
|
815
920
|
*/
|
|
816
|
-
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__";
|
|
817
926
|
|
|
818
927
|
// Angular
|
|
819
928
|
/**
|
|
@@ -841,12 +950,18 @@ const csvFormatPrefix = "_csvfmt";
|
|
|
841
950
|
* @param {string} header Titolo della colonna nel file CSV esportato
|
|
842
951
|
* @param {string} format Formato di esportazione. Può essere un formato data per i campi data o 'F' per i campi floating point
|
|
843
952
|
*/
|
|
844
|
-
const Export = (order, header, format = null) => (target, propertyKey) => {
|
|
953
|
+
const Export = (order, header, format = null, tableid = null) => (target, propertyKey) => {
|
|
845
954
|
if (format)
|
|
846
955
|
Object.defineProperty(target, propertyKey + csvFormatPrefix, { value: format, writable: false });
|
|
847
956
|
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
848
957
|
Object.defineProperty(target, propertyKey + csvVisPrefix, { value: !!header, writable: false });
|
|
849
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];
|
|
850
965
|
};
|
|
851
966
|
/**
|
|
852
967
|
* Decoratore di esportazione utilizzabile su un oggetto.
|
|
@@ -880,8 +995,9 @@ const Export = (order, header, format = null) => (target, propertyKey) => {
|
|
|
880
995
|
*/
|
|
881
996
|
const ExportAs = (order, type) => (target, propertyKey) => {
|
|
882
997
|
var t = new type();
|
|
883
|
-
|
|
884
|
-
|
|
998
|
+
var props = t[exportList];
|
|
999
|
+
for (let i = 0; i < props.length; i++) {
|
|
1000
|
+
let prop = props[i].replace(csvVisPrefix, '');
|
|
885
1001
|
if (typeof t[prop + csvVisPrefix] !== "undefined") {
|
|
886
1002
|
var toEmit = t[prop + csvVisPrefix];
|
|
887
1003
|
var lbl = t[prop + csvHdrPrefix];
|
|
@@ -894,6 +1010,10 @@ const ExportAs = (order, type) => (target, propertyKey) => {
|
|
|
894
1010
|
Object.defineProperty(target, propertyKey + prop + csvValueNavigator, { value: propertyKey + "." + prop, writable: false });
|
|
895
1011
|
Object.defineProperty(target, propertyKey + prop + csvVisPrefix, { value: toEmit, writable: false });
|
|
896
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];
|
|
897
1017
|
}
|
|
898
1018
|
}
|
|
899
1019
|
};
|
|
@@ -920,6 +1040,10 @@ const ExportList = (order, headernavigator, valuenavigator, valueformat = null)
|
|
|
920
1040
|
Object.defineProperty(target, propertyKey + listCsvValPrefix, { value: valuenavigator, writable: false });
|
|
921
1041
|
Object.defineProperty(target, propertyKey + listCsvHdrPrefix, { value: headernavigator, writable: false });
|
|
922
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];
|
|
923
1047
|
};
|
|
924
1048
|
/**
|
|
925
1049
|
* Decoratore di esportazione utilizzabile su un dizionario. Se ad esempio si vogliono generare le colonne
|
|
@@ -940,6 +1064,10 @@ const ExportDictionary = (order, headernavigator, valuenavigator) => (target, pr
|
|
|
940
1064
|
Object.defineProperty(target, propertyKey + csvOrdPrefix, { value: order, writable: false });
|
|
941
1065
|
Object.defineProperty(target, propertyKey + dictionaryCsvValPrefix, { value: valuenavigator, writable: false });
|
|
942
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];
|
|
943
1071
|
};
|
|
944
1072
|
/**
|
|
945
1073
|
* Service che si occupa dell'esportazione degli oggetti marcati dai Decoratori **ExportDictionary**, **ExportList**, **ExportAs** o **Export**
|
|
@@ -960,15 +1088,19 @@ class ExportService {
|
|
|
960
1088
|
*
|
|
961
1089
|
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
962
1090
|
*/
|
|
963
|
-
setupForExport(objs) {
|
|
1091
|
+
setupForExport(objs, columns = []) {
|
|
964
1092
|
let headers = [];
|
|
965
1093
|
let headersCache = {};
|
|
966
1094
|
if (!objs || objs.length == 0)
|
|
967
1095
|
return headers;
|
|
968
1096
|
// Devo per forza farlo per tutti gli oggetti dato che devo esporre le proprietà che mi servono da esportare
|
|
969
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;
|
|
970
1102
|
for (let i = 0; i < objs.length; i++) {
|
|
971
|
-
let hds = this.parseAndGetHeaders(objs[i]);
|
|
1103
|
+
let hds = this.parseAndGetHeaders(objs[i], columnSelectionDictionary);
|
|
972
1104
|
// Aggiungo gli header facendo in modo di non aggiungerne mai due uguali per non dover fare una distinct dopo
|
|
973
1105
|
// che costerebbe comunque risorse. Utilizzo un dizionario d'appoggio per lookup istantanei
|
|
974
1106
|
for (let k = 0; k < hds.length; k++) {
|
|
@@ -978,7 +1110,23 @@ class ExportService {
|
|
|
978
1110
|
}
|
|
979
1111
|
}
|
|
980
1112
|
}
|
|
981
|
-
|
|
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
|
+
}
|
|
982
1130
|
}
|
|
983
1131
|
/**
|
|
984
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**
|
|
@@ -1019,7 +1167,7 @@ class ExportService {
|
|
|
1019
1167
|
columns.forEach(t => {
|
|
1020
1168
|
var propValue = obj.properties[t.key];
|
|
1021
1169
|
Object.defineProperty(obj, t.key + "_exp", { value: propValue, writable: false, enumerable: true });
|
|
1022
|
-
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 });
|
|
1023
1171
|
});
|
|
1024
1172
|
//Tirati fuori tutti gli header faccio sort sull'ordinamento
|
|
1025
1173
|
return headers.sort((a, b) => { return a.order - b.order; });
|
|
@@ -1033,23 +1181,33 @@ class ExportService {
|
|
|
1033
1181
|
*
|
|
1034
1182
|
* @returns {CsvHeaders[]} Header di esportazione già ordinati correttamente
|
|
1035
1183
|
*/
|
|
1036
|
-
parseAndGetHeaders(obj) {
|
|
1184
|
+
parseAndGetHeaders(obj, columnsSelection) {
|
|
1037
1185
|
var headers = [];
|
|
1038
1186
|
// Miracle incoming
|
|
1039
|
-
|
|
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 = "";
|
|
1040
1193
|
let toCall;
|
|
1041
|
-
if (
|
|
1194
|
+
if (prop.endsWith(listCsvHdrPrefix)) {
|
|
1195
|
+
propBase = prop.replace(listCsvHdrPrefix, '');
|
|
1042
1196
|
toCall = this.parseList.bind(this);
|
|
1043
|
-
|
|
1197
|
+
}
|
|
1198
|
+
else if (prop.endsWith(dictionaryCsvHdrPrefix)) {
|
|
1044
1199
|
toCall = this.parseDictionary.bind(this);
|
|
1045
|
-
|
|
1046
|
-
|
|
1200
|
+
propBase = prop.replace(dictionaryCsvHdrPrefix, '');
|
|
1201
|
+
}
|
|
1202
|
+
else if (prop.endsWith(csvVisPrefix)) {
|
|
1203
|
+
propBase = prop.replace(csvVisPrefix, '');
|
|
1204
|
+
if (typeof obj[propBase + csvValueNavigator] !== "undefined")
|
|
1047
1205
|
toCall = this.parseObject.bind(this);
|
|
1048
1206
|
else
|
|
1049
1207
|
toCall = this.parseProperty.bind(this);
|
|
1050
1208
|
}
|
|
1051
1209
|
if (toCall)
|
|
1052
|
-
toCall(obj,
|
|
1210
|
+
toCall(obj, propBase, headers, columnsSelection);
|
|
1053
1211
|
}
|
|
1054
1212
|
return headers;
|
|
1055
1213
|
}
|
|
@@ -1061,9 +1219,14 @@ class ExportService {
|
|
|
1061
1219
|
* @param {string} prop Proprietà da esportare
|
|
1062
1220
|
* @param {CsvHeaders} headers Contenitore degli header, verrà riempito da questa funzione
|
|
1063
1221
|
*/
|
|
1064
|
-
parseProperty(obj, prop, headers) {
|
|
1222
|
+
parseProperty(obj, prop, headers, columnsSelection) {
|
|
1065
1223
|
let toEmit = obj[prop + csvVisPrefix];
|
|
1066
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
|
+
}
|
|
1067
1230
|
let lbl = obj[prop + csvHdrPrefix];
|
|
1068
1231
|
let order = obj[prop + csvOrdPrefix];
|
|
1069
1232
|
if (toEmit && lbl !== "undefined") {
|
|
@@ -1072,7 +1235,7 @@ class ExportService {
|
|
|
1072
1235
|
// Se è un formato data mi assicuro di non stampare mai una data 00:00:00 altrimenti in esportazione viene uno schifo
|
|
1073
1236
|
var val = obj[prop] ? this.dates.trimSeconds(obj[prop].toString()) : "";
|
|
1074
1237
|
Object.defineProperty(obj, prop + "_nofmt", { value: val, writable: false, enumerable: true });
|
|
1075
|
-
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 });
|
|
1076
1239
|
}
|
|
1077
1240
|
else {
|
|
1078
1241
|
// Caso formato numerico
|
|
@@ -1084,15 +1247,15 @@ class ExportService {
|
|
|
1084
1247
|
// Il singolo punto che c'è, se presente (separatore decimali) lo trasformo in virgola
|
|
1085
1248
|
let valConverted = val.replace(".", ",");
|
|
1086
1249
|
Object.defineProperty(obj, prop + "_fmt", { value: valConverted, writable: false, enumerable: true });
|
|
1087
|
-
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 });
|
|
1088
1251
|
}
|
|
1089
1252
|
else {
|
|
1090
1253
|
// Se ho un formato data trasformo in dayjs, formatto ed esporto
|
|
1091
1254
|
// Per la trasformazione in dayjs provo prima a passargli la stringa di netto, sperando la riconosca
|
|
1092
1255
|
// Se non funziona provo a definirgli la formattazione standard del metering per quel linguaggio
|
|
1093
|
-
let val = this.dates.getFormatted(obj[prop], format.length <= 10,
|
|
1256
|
+
let val = this.dates.getFormatted(obj[prop], format.length <= 10, format.length > 16);
|
|
1094
1257
|
Object.defineProperty(obj, prop + "_fmt", { value: val !== null && val !== void 0 ? val : "", writable: false, enumerable: true });
|
|
1095
|
-
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 });
|
|
1096
1259
|
}
|
|
1097
1260
|
}
|
|
1098
1261
|
}
|
|
@@ -1133,11 +1296,11 @@ class ExportService {
|
|
|
1133
1296
|
type = "number";
|
|
1134
1297
|
}
|
|
1135
1298
|
else if (format) {
|
|
1136
|
-
value = this.dates.getFormatted(value, format.length <= 10,
|
|
1299
|
+
value = this.dates.getFormatted(value, format.length <= 10, format.length > 16);
|
|
1137
1300
|
type = "date";
|
|
1138
1301
|
}
|
|
1139
|
-
Object.defineProperty(obj, prop, { value: value, writable: false, enumerable: true });
|
|
1140
|
-
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 });
|
|
1141
1304
|
}
|
|
1142
1305
|
/**
|
|
1143
1306
|
* Setup per l'esportazione di una lista di valori pivottati dinamicamente:
|
|
@@ -1187,11 +1350,11 @@ class ExportService {
|
|
|
1187
1350
|
type = "number";
|
|
1188
1351
|
}
|
|
1189
1352
|
else if (valueformat) {
|
|
1190
|
-
value = this.dates.getFormatted(obj[prop], valueformat.length <= 10,
|
|
1353
|
+
value = this.dates.getFormatted(obj[prop], valueformat.length <= 10, valueformat.length > 16);
|
|
1191
1354
|
type = "date";
|
|
1192
1355
|
}
|
|
1193
|
-
Object.defineProperty(obj, prop + idx, { value: value, writable: false });
|
|
1194
|
-
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 });
|
|
1195
1358
|
}
|
|
1196
1359
|
}
|
|
1197
1360
|
/**
|
|
@@ -1237,8 +1400,8 @@ class ExportService {
|
|
|
1237
1400
|
jumps.forEach(pp => { tmpRes = tmpRes[pp]; });
|
|
1238
1401
|
let value = tmpRes;
|
|
1239
1402
|
let propname = prop + idx.toString() + idxinternal.toString();
|
|
1240
|
-
Object.defineProperty(obj, propname, { value: value, writable: false });
|
|
1241
|
-
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 });
|
|
1242
1405
|
});
|
|
1243
1406
|
}
|
|
1244
1407
|
}
|
|
@@ -1255,9 +1418,9 @@ class ExportService {
|
|
|
1255
1418
|
return Deserialize(items, type);
|
|
1256
1419
|
}
|
|
1257
1420
|
}
|
|
1258
|
-
ExportService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1259
|
-
ExportService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1260
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
1261
1424
|
type: Injectable
|
|
1262
1425
|
}], ctorParameters: function () { return [{ type: DateService }]; } });
|
|
1263
1426
|
|
|
@@ -1562,9 +1725,9 @@ class HashingService {
|
|
|
1562
1725
|
return (a + b) & 0xFFFFFFFF;
|
|
1563
1726
|
}
|
|
1564
1727
|
}
|
|
1565
|
-
HashingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1566
|
-
HashingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1567
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
1568
1731
|
type: Injectable
|
|
1569
1732
|
}] });
|
|
1570
1733
|
|
|
@@ -1770,10 +1933,52 @@ class UtilityService {
|
|
|
1770
1933
|
return "string";
|
|
1771
1934
|
}
|
|
1772
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
|
+
}
|
|
1773
1978
|
}
|
|
1774
|
-
UtilityService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1775
|
-
UtilityService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1776
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
1777
1982
|
type: Injectable
|
|
1778
1983
|
}] });
|
|
1779
1984
|
|
|
@@ -1832,9 +2037,9 @@ class InterComService {
|
|
|
1832
2037
|
this.outbounds[key] = new Subject();
|
|
1833
2038
|
}
|
|
1834
2039
|
}
|
|
1835
|
-
InterComService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1836
|
-
InterComService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.
|
|
1837
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
1838
2043
|
type: Injectable
|
|
1839
2044
|
}] });
|
|
1840
2045
|
|
|
@@ -1871,10 +2076,10 @@ class FullExtensionsModule {
|
|
|
1871
2076
|
};
|
|
1872
2077
|
}
|
|
1873
2078
|
}
|
|
1874
|
-
FullExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.
|
|
1875
|
-
FullExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.
|
|
1876
|
-
FullExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.
|
|
1877
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.
|
|
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: [{
|
|
1878
2083
|
type: NgModule
|
|
1879
2084
|
}] });
|
|
1880
2085
|
|