@esfaenza/extensions 11.2.25 → 11.2.28
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/bundles/esfaenza-extensions.umd.js +58 -13
- package/bundles/esfaenza-extensions.umd.js.map +1 -1
- package/bundles/esfaenza-extensions.umd.min.js +1 -1
- package/bundles/esfaenza-extensions.umd.min.js.map +1 -1
- package/esfaenza-extensions.metadata.json +1 -1
- package/esm2015/lib/services/extensions.dates.service.js +2 -2
- package/esm2015/lib/services/extensions.messages.service.js +12 -13
- package/esm2015/lib/services/extensions.utilities.service.js +43 -1
- package/fesm2015/esfaenza-extensions.js +54 -13
- package/fesm2015/esfaenza-extensions.js.map +1 -1
- package/lib/services/extensions.messages.service.d.ts +4 -4
- package/lib/services/extensions.utilities.service.d.ts +15 -0
- package/package.json +1 -1
|
@@ -160,13 +160,14 @@
|
|
|
160
160
|
* @param {string} text Testo da mostrare
|
|
161
161
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
162
162
|
*/
|
|
163
|
-
MessageService.prototype.simpleSuccess = function (text, secondaryNotificationType) {
|
|
163
|
+
MessageService.prototype.simpleSuccess = function (text, secondaryNotificationType, secondaryNotificationTimeout) {
|
|
164
164
|
if (secondaryNotificationType === void 0) { secondaryNotificationType = null; }
|
|
165
|
+
if (secondaryNotificationTimeout === void 0) { secondaryNotificationTimeout = null; }
|
|
165
166
|
var tos = this.toastrOrSwal(secondaryNotificationType);
|
|
166
167
|
if (tos == "swal")
|
|
167
168
|
this.successSwal.fire("", text);
|
|
168
169
|
else
|
|
169
|
-
this.toastr.success(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
170
|
+
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 });
|
|
170
171
|
};
|
|
171
172
|
/**
|
|
172
173
|
* Presentazione di un semplice messaggio di informazione
|
|
@@ -177,13 +178,14 @@
|
|
|
177
178
|
* @param {string} text Testo da mostrare
|
|
178
179
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
179
180
|
*/
|
|
180
|
-
MessageService.prototype.simpleInfo = function (text, secondaryNotificationType) {
|
|
181
|
+
MessageService.prototype.simpleInfo = function (text, secondaryNotificationType, secondaryNotificationTimeout) {
|
|
181
182
|
if (secondaryNotificationType === void 0) { secondaryNotificationType = null; }
|
|
183
|
+
if (secondaryNotificationTimeout === void 0) { secondaryNotificationTimeout = null; }
|
|
182
184
|
var tos = this.toastrOrSwal(secondaryNotificationType);
|
|
183
185
|
if (tos == "swal")
|
|
184
186
|
this.infoSwal.fire("", text);
|
|
185
187
|
else
|
|
186
|
-
this.toastr.info(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
188
|
+
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 });
|
|
187
189
|
};
|
|
188
190
|
/**
|
|
189
191
|
* Presentazione di un semplice messaggio di errore
|
|
@@ -194,13 +196,14 @@
|
|
|
194
196
|
* @param {string} text Testo da mostrare
|
|
195
197
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
196
198
|
*/
|
|
197
|
-
MessageService.prototype.simpleError = function (text, secondaryNotificationType) {
|
|
199
|
+
MessageService.prototype.simpleError = function (text, secondaryNotificationType, secondaryNotificationTimeout) {
|
|
198
200
|
if (secondaryNotificationType === void 0) { secondaryNotificationType = null; }
|
|
201
|
+
if (secondaryNotificationTimeout === void 0) { secondaryNotificationTimeout = null; }
|
|
199
202
|
var tos = this.toastrOrSwal(secondaryNotificationType);
|
|
200
203
|
if (tos == "swal")
|
|
201
204
|
this.errorSwal.fire("", text);
|
|
202
205
|
else
|
|
203
|
-
this.toastr.error(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
206
|
+
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 });
|
|
204
207
|
};
|
|
205
208
|
/**
|
|
206
209
|
* Presentazione di un semplice messaggio di avviso
|
|
@@ -211,13 +214,14 @@
|
|
|
211
214
|
* @param {string} text Testo da mostrare
|
|
212
215
|
* @param {"toastr" | "swal" | null} secondaryNotificationType Qualora sia una notifica secondaria, ne indica il tipo
|
|
213
216
|
*/
|
|
214
|
-
MessageService.prototype.simpleWarning = function (text, secondaryNotificationType) {
|
|
217
|
+
MessageService.prototype.simpleWarning = function (text, secondaryNotificationType, secondaryNotificationTimeout) {
|
|
215
218
|
if (secondaryNotificationType === void 0) { secondaryNotificationType = null; }
|
|
219
|
+
if (secondaryNotificationTimeout === void 0) { secondaryNotificationTimeout = null; }
|
|
216
220
|
var tos = this.toastrOrSwal(secondaryNotificationType);
|
|
217
221
|
if (tos == "swal")
|
|
218
222
|
this.warningSwal.fire("", text);
|
|
219
223
|
else
|
|
220
|
-
this.toastr.warning(text, null, { positionClass: tos == "toastr" ? "toast-top-right" : "toast-top-center", timeOut: tos == "toastr" ? 0 : 5000, extendedTimeOut: tos == "toastr" ? 0 : 1000 });
|
|
224
|
+
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 });
|
|
221
225
|
};
|
|
222
226
|
/**
|
|
223
227
|
* Ripulisce tutti i messaggi presenti in un dato momento sullo schermo
|
|
@@ -304,7 +308,9 @@
|
|
|
304
308
|
if (postSuccess === void 0) { postSuccess = null; }
|
|
305
309
|
if (postFailure === void 0) { postFailure = null; }
|
|
306
310
|
if (response.success) {
|
|
307
|
-
if (
|
|
311
|
+
if (response.haswarning)
|
|
312
|
+
this.simpleWarning(response.warning);
|
|
313
|
+
else if (successMsg)
|
|
308
314
|
this.simpleSuccess(successMsg);
|
|
309
315
|
if (postSuccess)
|
|
310
316
|
postSuccess();
|
|
@@ -314,9 +320,6 @@
|
|
|
314
320
|
if (postFailure)
|
|
315
321
|
postFailure();
|
|
316
322
|
}
|
|
317
|
-
else if (response.haswarning) {
|
|
318
|
-
this.simpleWarning(response.warning);
|
|
319
|
-
}
|
|
320
323
|
};
|
|
321
324
|
/**
|
|
322
325
|
* Metodo helper per gestire in maniera standardizzata una risposta di tipo **string**, considerando che:
|
|
@@ -719,7 +722,7 @@
|
|
|
719
722
|
tryThis = toCall(date, this.cfg.smallDate);
|
|
720
723
|
else if (length == this.cfg.fulldateNoSS.length)
|
|
721
724
|
tryThis = toCall(date, this.cfg.fulldateNoSS);
|
|
722
|
-
if (tryThis && tryThis.isValid())
|
|
725
|
+
if (tryThis && tryThis.isValid && tryThis.isValid())
|
|
723
726
|
return tryThis;
|
|
724
727
|
// Se niente funziona, null.
|
|
725
728
|
// Ricondurre l'Input ad una data non è possibile.
|
|
@@ -1791,6 +1794,48 @@
|
|
|
1791
1794
|
return "string";
|
|
1792
1795
|
}
|
|
1793
1796
|
};
|
|
1797
|
+
/**
|
|
1798
|
+
* Effettua la clonazione profonda di un oggetto in maniera molto più performante che JSON.parse(JSON.stringify()).
|
|
1799
|
+
*
|
|
1800
|
+
* Usare solo per oggetti puri e quantomeno semplici per evitare complicazioni derivanti dalle semplificazioni che questo metodo assume
|
|
1801
|
+
*
|
|
1802
|
+
* @param {any} source Oggetto da clonare
|
|
1803
|
+
*
|
|
1804
|
+
* @return {any} Clone dell'oggetto passato
|
|
1805
|
+
*/
|
|
1806
|
+
UtilityService.prototype.deepClone = function (source) {
|
|
1807
|
+
// Valori semplici
|
|
1808
|
+
if (source == null || typeof source !== 'object')
|
|
1809
|
+
return source;
|
|
1810
|
+
// Pseudo Struct
|
|
1811
|
+
switch (toString.call(source)) {
|
|
1812
|
+
case '[object Boolean]':
|
|
1813
|
+
case '[object Number]':
|
|
1814
|
+
case '[object String]':
|
|
1815
|
+
case '[object Date]':
|
|
1816
|
+
return new source.constructor(source.valueOf());
|
|
1817
|
+
default: break;
|
|
1818
|
+
}
|
|
1819
|
+
// Oggetti Complessi
|
|
1820
|
+
return this.recursiveStep(source, Array.isArray(source) || source instanceof Array ? [] : Object.create(Object.getPrototypeOf(source)));
|
|
1821
|
+
};
|
|
1822
|
+
/**
|
|
1823
|
+
* @ignore
|
|
1824
|
+
* Step ricorsivo per la clonatura degli oggetti. Vedere **deepClone**
|
|
1825
|
+
*/
|
|
1826
|
+
UtilityService.prototype.recursiveStep = function (source, destination) {
|
|
1827
|
+
if (Array.isArray(source) || source instanceof Array) {
|
|
1828
|
+
for (var i = 0, ii = source.length; i < ii; i++)
|
|
1829
|
+
destination.push(this.deepClone(source[i]));
|
|
1830
|
+
}
|
|
1831
|
+
else if (source && typeof source.hasOwnProperty === 'function') {
|
|
1832
|
+
for (var key in source) {
|
|
1833
|
+
if (source.hasOwnProperty(key))
|
|
1834
|
+
destination[key] = this.deepClone(source[key]);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
return destination;
|
|
1838
|
+
};
|
|
1794
1839
|
return UtilityService;
|
|
1795
1840
|
}());
|
|
1796
1841
|
UtilityService.decorators = [
|