@esfaenza/extensions 11.2.24 → 11.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ngx-toastr'), require('sweetalert2'), require('cerialize'), require('rxjs')) :
3
- typeof define === 'function' && define.amd ? define('@esfaenza/extensions', ['exports', '@angular/core', 'ngx-toastr', 'sweetalert2', 'cerialize', 'rxjs'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza.extensions = {}), global.ng.core, global.ngxToastr, global.swal, global.cerialize, global.rxjs));
5
- }(this, (function (exports, core, ngxToastr, swal, cerialize, rxjs) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('ngx-toastr'), require('sweetalert2'), require('rxjs'), require('rxjs/operators'), require('cerialize')) :
3
+ typeof define === 'function' && define.amd ? define('@esfaenza/extensions', ['exports', '@angular/core', 'ngx-toastr', 'sweetalert2', 'rxjs', 'rxjs/operators', 'cerialize'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.esfaenza = global.esfaenza || {}, global.esfaenza.extensions = {}), global.ng.core, global.ngxToastr, global.swal, global.rxjs, global.rxjs.operators, global.cerialize));
5
+ }(this, (function (exports, core, ngxToastr, swal, rxjs, operators, cerialize) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -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
@@ -267,6 +271,15 @@
267
271
  onerror();
268
272
  });
269
273
  };
274
+ /**
275
+ * Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
276
+ *
277
+ * @param {string} title Titolo del messaggio
278
+ * @param {string} text Contenuto del messaggio
279
+ */
280
+ MessageService.prototype.observableSimpleWarningWithChoice = function (title, text) {
281
+ return rxjs.of(this.warningSwalWithCancel.fire(title, text)).pipe(operators.map(function (t) { return !!t.value; }));
282
+ };
270
283
  /**
271
284
  * Mostra un messaggio di avviso che la sessione corrente è scaduta e propone all'utente di navigare al login. Qualora l'utente decidesse di farlo
272
285
  * verrà chiamata la funzione di callback **onnavigate
@@ -295,7 +308,9 @@
295
308
  if (postSuccess === void 0) { postSuccess = null; }
296
309
  if (postFailure === void 0) { postFailure = null; }
297
310
  if (response.success) {
298
- if (successMsg)
311
+ if (response.haswarning)
312
+ this.simpleWarning(response.warning);
313
+ else if (successMsg)
299
314
  this.simpleSuccess(successMsg);
300
315
  if (postSuccess)
301
316
  postSuccess();
@@ -305,9 +320,6 @@
305
320
  if (postFailure)
306
321
  postFailure();
307
322
  }
308
- else if (response.haswarning) {
309
- this.simpleWarning(response.warning);
310
- }
311
323
  };
312
324
  /**
313
325
  * Metodo helper per gestire in maniera standardizzata una risposta di tipo **string**, considerando che:
@@ -710,7 +722,7 @@
710
722
  tryThis = toCall(date, this.cfg.smallDate);
711
723
  else if (length == this.cfg.fulldateNoSS.length)
712
724
  tryThis = toCall(date, this.cfg.fulldateNoSS);
713
- if (tryThis && tryThis.isValid())
725
+ if (tryThis && tryThis.isValid && tryThis.isValid())
714
726
  return tryThis;
715
727
  // Se niente funziona, null.
716
728
  // Ricondurre l'Input ad una data non è possibile.