@esfaenza/extensions 11.2.43 → 11.2.45

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.
@@ -60,7 +60,7 @@
60
60
  * @ignore
61
61
  */
62
62
  function MessageService(toastr, FANCY_ALERTS, LOCALE) {
63
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
63
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
64
64
  this.toastr = toastr;
65
65
  this.FANCY_ALERTS = FANCY_ALERTS;
66
66
  this.LOCALE = LOCALE;
@@ -88,8 +88,8 @@
88
88
  allowOutsideClick: false,
89
89
  icon: "warning"
90
90
  });
91
- this.warningSwalWithCancel = swal__default['default'].mixin({
92
- title: this.loc["Warning"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'],
91
+ this.successSwalWithCancel = swal__default['default'].mixin({
92
+ title: this.loc["Success"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'],
93
93
  customClass: {
94
94
  confirmButton: "btn btn-primary",
95
95
  cancelButton: "btn btn-secondary app-margin-right-10",
@@ -100,10 +100,24 @@
100
100
  showCancelButton: true,
101
101
  confirmButtonText: this.loc["Confirm"][(_b = this.LOCALE) !== null && _b !== void 0 ? _b : 'it-IT'],
102
102
  cancelButtonText: this.loc["Cancel"][(_c = this.LOCALE) !== null && _c !== void 0 ? _c : 'it-IT'],
103
+ icon: "success"
104
+ });
105
+ this.warningSwalWithCancel = swal__default['default'].mixin({
106
+ title: this.loc["Warning"][(_d = this.LOCALE) !== null && _d !== void 0 ? _d : 'it-IT'],
107
+ customClass: {
108
+ confirmButton: "btn btn-primary",
109
+ cancelButton: "btn btn-secondary app-margin-right-10",
110
+ container: "app-wrap",
111
+ },
112
+ buttonsStyling: false,
113
+ reverseButtons: true,
114
+ showCancelButton: true,
115
+ confirmButtonText: this.loc["Confirm"][(_e = this.LOCALE) !== null && _e !== void 0 ? _e : 'it-IT'],
116
+ cancelButtonText: this.loc["Cancel"][(_f = this.LOCALE) !== null && _f !== void 0 ? _f : 'it-IT'],
103
117
  icon: "warning"
104
118
  });
105
119
  this.warningSwal = swal__default['default'].mixin({
106
- title: this.loc["Warning"][(_d = this.LOCALE) !== null && _d !== void 0 ? _d : 'it-IT'],
120
+ title: this.loc["Warning"][(_g = this.LOCALE) !== null && _g !== void 0 ? _g : 'it-IT'],
107
121
  customClass: {
108
122
  confirmButton: "btn btn-primary",
109
123
  container: "app-wrap",
@@ -111,11 +125,11 @@
111
125
  buttonsStyling: false,
112
126
  reverseButtons: true,
113
127
  showCancelButton: false,
114
- confirmButtonText: this.loc["Close"][(_e = this.LOCALE) !== null && _e !== void 0 ? _e : 'it-IT'],
128
+ confirmButtonText: this.loc["Close"][(_h = this.LOCALE) !== null && _h !== void 0 ? _h : 'it-IT'],
115
129
  icon: "warning"
116
130
  });
117
131
  this.successSwal = swal__default['default'].mixin({
118
- title: this.loc["Success"][(_f = this.LOCALE) !== null && _f !== void 0 ? _f : 'it-IT'],
132
+ title: this.loc["Success"][(_j = this.LOCALE) !== null && _j !== void 0 ? _j : 'it-IT'],
119
133
  customClass: {
120
134
  confirmButton: "btn btn-primary",
121
135
  container: "app-wrap",
@@ -123,11 +137,11 @@
123
137
  buttonsStyling: false,
124
138
  reverseButtons: true,
125
139
  showCancelButton: false,
126
- confirmButtonText: this.loc["Close"][(_g = this.LOCALE) !== null && _g !== void 0 ? _g : 'it-IT'],
140
+ confirmButtonText: this.loc["Close"][(_k = this.LOCALE) !== null && _k !== void 0 ? _k : 'it-IT'],
127
141
  icon: "success"
128
142
  });
129
143
  this.errorSwal = swal__default['default'].mixin({
130
- title: this.loc["Error"][(_h = this.LOCALE) !== null && _h !== void 0 ? _h : 'it-IT'],
144
+ title: this.loc["Error"][(_l = this.LOCALE) !== null && _l !== void 0 ? _l : 'it-IT'],
131
145
  customClass: {
132
146
  confirmButton: "btn btn-primary",
133
147
  container: "app-wrap",
@@ -135,11 +149,11 @@
135
149
  buttonsStyling: false,
136
150
  reverseButtons: true,
137
151
  showCancelButton: false,
138
- confirmButtonText: this.loc["Close"][(_j = this.LOCALE) !== null && _j !== void 0 ? _j : 'it-IT'],
152
+ confirmButtonText: this.loc["Close"][(_m = this.LOCALE) !== null && _m !== void 0 ? _m : 'it-IT'],
139
153
  icon: "error"
140
154
  });
141
155
  this.infoSwal = swal__default['default'].mixin({
142
- title: this.loc["Info"][(_k = this.LOCALE) !== null && _k !== void 0 ? _k : 'it-IT'],
156
+ title: this.loc["Info"][(_o = this.LOCALE) !== null && _o !== void 0 ? _o : 'it-IT'],
143
157
  customClass: {
144
158
  confirmButton: "btn btn-primary",
145
159
  container: "app-wrap",
@@ -147,7 +161,7 @@
147
161
  buttonsStyling: false,
148
162
  reverseButtons: true,
149
163
  showCancelButton: false,
150
- confirmButtonText: this.loc["Close"][(_l = this.LOCALE) !== null && _l !== void 0 ? _l : 'it-IT'],
164
+ confirmButtonText: this.loc["Close"][(_p = this.LOCALE) !== null && _p !== void 0 ? _p : 'it-IT'],
151
165
  icon: "info"
152
166
  });
153
167
  }
@@ -271,6 +285,36 @@
271
285
  onerror();
272
286
  });
273
287
  };
288
+ /**
289
+ * Mostra un messaggio di success con richiesta di conferma e gestisce il risultato chiamato i callback **onconfirm** o **onabort**
290
+ *
291
+ * @param {string} title Titolo del messaggio
292
+ * @param {string} text Contenuto del messaggio
293
+ * @param {Function} onconfirm Callback da chimare su conferma
294
+ * @param {Function} onabort Callback da chimare su annullamento
295
+ * @param {string} confirmtext Testo del pulsante di azione
296
+ * @param {string} aborttext Testo del pulsante di annullamento
297
+ */
298
+ MessageService.prototype.simpleSuccessWithChoice = function (title, text, onconfirm, onabort, confirmtext, aborttext) {
299
+ if (onconfirm === void 0) { onconfirm = null; }
300
+ if (onabort === void 0) { onabort = null; }
301
+ if (confirmtext === void 0) { confirmtext = ""; }
302
+ if (aborttext === void 0) { aborttext = ''; }
303
+ var configuration = {
304
+ title: title,
305
+ html: text
306
+ };
307
+ if (confirmtext)
308
+ configuration["confirmButtonText"] = confirmtext;
309
+ if (aborttext)
310
+ configuration["cancelButtonText"] = aborttext;
311
+ this.successSwalWithCancel.fire(configuration).then(function (result) {
312
+ if (result.value && onconfirm)
313
+ onconfirm();
314
+ else if (onabort)
315
+ onabort();
316
+ });
317
+ };
274
318
  /**
275
319
  * Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
276
320
  *
@@ -1040,7 +1084,7 @@
1040
1084
  for (var i = 0; i < columns.length; i++) {
1041
1085
  var thisId = columns[i];
1042
1086
  for (var i_1 = 0; i_1 < headers.length; i_1++) {
1043
- if (headers[i_1].key == thisId) {
1087
+ if (headers[i_1].propKey == thisId) {
1044
1088
  orderedHeaders.push(headers[i_1]);
1045
1089
  break;
1046
1090
  }
@@ -1089,7 +1133,7 @@
1089
1133
  columns.forEach(function (t) {
1090
1134
  var propValue = obj.properties[t.key];
1091
1135
  Object.defineProperty(obj, t.key + "_exp", { value: propValue, writable: false, enumerable: true });
1092
- headers.push({ label: t.label, key: t.key + "_exp", order: t.order, type: t.type });
1136
+ headers.push({ label: t.label, key: t.key + "_exp", order: t.order, type: t.type, propKey: null });
1093
1137
  });
1094
1138
  //Tirati fuori tutti gli header faccio sort sull'ordinamento
1095
1139
  return headers.sort(function (a, b) { return a.order - b.order; });
@@ -1145,8 +1189,10 @@
1145
1189
  var toEmit = obj[prop + csvVisPrefix];
1146
1190
  var format = obj[prop + csvFormatPrefix];
1147
1191
  var propKey = obj[prop + csvPropKey];
1148
- if (propKey && !columnsSelection[propKey])
1192
+ if (propKey && !columnsSelection[propKey]) {
1193
+ console.log("[@esfaenza/extensions] Colonna da non esportare: " + propKey);
1149
1194
  return;
1195
+ }
1150
1196
  var lbl = obj[prop + csvHdrPrefix];
1151
1197
  var order = obj[prop + csvOrdPrefix];
1152
1198
  if (toEmit && lbl !== "undefined") {
@@ -1155,7 +1201,7 @@
1155
1201
  // Se è un formato data mi assicuro di non stampare mai una data 00:00:00 altrimenti in esportazione viene uno schifo
1156
1202
  var val = obj[prop] ? this.dates.trimSeconds(obj[prop].toString()) : "";
1157
1203
  Object.defineProperty(obj, prop + "_nofmt", { value: val, writable: false, enumerable: true });
1158
- headers.push({ label: lbl ? lbl : prop + "_nofmt", key: prop + "_nofmt", order: order, type: "string" });
1204
+ headers.push({ label: lbl ? lbl : prop + "_nofmt", key: prop + "_nofmt", order: order, type: "string", propKey: propKey });
1159
1205
  }
1160
1206
  else {
1161
1207
  // Caso formato numerico
@@ -1167,7 +1213,7 @@
1167
1213
  // Il singolo punto che c'è, se presente (separatore decimali) lo trasformo in virgola
1168
1214
  var valConverted = val_1.replace(".", ",");
1169
1215
  Object.defineProperty(obj, prop + "_fmt", { value: valConverted, writable: false, enumerable: true });
1170
- headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "number" });
1216
+ headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "number", propKey: propKey });
1171
1217
  }
1172
1218
  else {
1173
1219
  // Se ho un formato data trasformo in dayjs, formatto ed esporto
@@ -1175,7 +1221,7 @@
1175
1221
  // Se non funziona provo a definirgli la formattazione standard del metering per quel linguaggio
1176
1222
  var val_2 = this.dates.getFormatted(obj[prop], format.length <= 10, format.length > 16);
1177
1223
  Object.defineProperty(obj, prop + "_fmt", { value: val_2 !== null && val_2 !== void 0 ? val_2 : "", writable: false, enumerable: true });
1178
- headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "date" });
1224
+ headers.push({ label: lbl ? lbl : prop + "_fmt", key: prop + "_fmt", order: order, type: "date", propKey: propKey });
1179
1225
  }
1180
1226
  }
1181
1227
  }
@@ -1220,7 +1266,7 @@
1220
1266
  type = "date";
1221
1267
  }
1222
1268
  Object.defineProperty(obj, prop, { value: value, writable: false, enumerable: true });
1223
- headers.push({ label: lbl ? lbl : prop, key: prop, order: order, type: type });
1269
+ headers.push({ label: lbl ? lbl : prop, key: prop, order: order, type: type, propKey: null });
1224
1270
  };
1225
1271
  /**
1226
1272
  * Setup per l'esportazione di una lista di valori pivottati dinamicamente:
@@ -1274,7 +1320,7 @@
1274
1320
  type = "date";
1275
1321
  }
1276
1322
  Object.defineProperty(obj, prop + idx, { value: value, writable: false });
1277
- headers.push({ label: header, key: prop + idx, order: order + idx, type: type });
1323
+ headers.push({ label: header, key: prop + idx, order: order + idx, type: type, propKey: null });
1278
1324
  };
1279
1325
  var this_1 = this, headersplit, header;
1280
1326
  for (var idx = 0; idx < objs.length; idx++) {
@@ -1325,7 +1371,7 @@
1325
1371
  var value = tmpRes;
1326
1372
  var propname = prop + idx.toString() + idxinternal.toString();
1327
1373
  Object.defineProperty(obj, propname, { value: value, writable: false });
1328
- headers.push({ label: header + " " + desc, key: propname, order: order + idx, type: 'string' });
1374
+ headers.push({ label: header + " " + desc, key: propname, order: order + idx, type: 'string', propKey: null });
1329
1375
  });
1330
1376
  };
1331
1377
  var headersplit, header, valuesplit;