@esfaenza/extensions 11.2.44 → 11.2.48
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 +120 -35
- 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.clipboard.service.js +67 -25
- package/esm2015/lib/services/extensions.messages.service.js +52 -12
- package/fesm2015/esfaenza-extensions.js +116 -35
- package/fesm2015/esfaenza-extensions.js.map +1 -1
- package/lib/services/extensions.clipboard.service.d.ts +2 -0
- package/lib/services/extensions.messages.service.d.ts +15 -0
- package/package.json +1 -1
|
@@ -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.
|
|
92
|
-
title: this.loc["
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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"][(
|
|
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
|
*
|
|
@@ -418,7 +462,27 @@
|
|
|
418
462
|
"Error during Clipboard content copy operation": {
|
|
419
463
|
'en-US': "Error during Clipboard content copy operation",
|
|
420
464
|
'it-IT': "Errore nella scrittura del contenuto nella Clipboard"
|
|
421
|
-
}
|
|
465
|
+
},
|
|
466
|
+
"Please insert your clipboard content": {
|
|
467
|
+
'en-US': "Please insert your clipboard content",
|
|
468
|
+
'it-IT': "Si prega di incollare il contenuto della Clipboard"
|
|
469
|
+
},
|
|
470
|
+
"User input required": {
|
|
471
|
+
'en-US': "User input required",
|
|
472
|
+
'it-IT': "Richiesto Input utente"
|
|
473
|
+
},
|
|
474
|
+
"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": {
|
|
475
|
+
'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",
|
|
476
|
+
'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"
|
|
477
|
+
},
|
|
478
|
+
"Confirm": {
|
|
479
|
+
'en-US': "Confirm",
|
|
480
|
+
'it-IT': "Conferma"
|
|
481
|
+
},
|
|
482
|
+
"Cancel": {
|
|
483
|
+
'en-US': "Cancel",
|
|
484
|
+
'it-IT': "Annulla"
|
|
485
|
+
},
|
|
422
486
|
};
|
|
423
487
|
}
|
|
424
488
|
/**
|
|
@@ -430,21 +494,40 @@
|
|
|
430
494
|
*/
|
|
431
495
|
ClipboardService.prototype.getClipboard = function (style, valueFoundCallback) {
|
|
432
496
|
var _this = this;
|
|
433
|
-
var _a;
|
|
497
|
+
var _a, _b, _c, _d;
|
|
434
498
|
if (navigator.userAgent.indexOf("Firefox") != -1) {
|
|
435
|
-
|
|
436
|
-
|
|
499
|
+
swal__default['default'].fire({
|
|
500
|
+
title: this.loc["User input required"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'],
|
|
501
|
+
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'],
|
|
502
|
+
input: 'textarea',
|
|
503
|
+
icon: "warning",
|
|
504
|
+
confirmButtonText: this.loc["Confirm"][(_c = this.LOCALE) !== null && _c !== void 0 ? _c : 'it-IT'],
|
|
505
|
+
cancelButtonText: this.loc["Cancel"][(_d = this.LOCALE) !== null && _d !== void 0 ? _d : 'it-IT'],
|
|
506
|
+
showCancelButton: true,
|
|
507
|
+
customClass: {
|
|
508
|
+
confirmButton: "btn btn-primary",
|
|
509
|
+
cancelButton: "btn btn-secondary app-margin-right-15",
|
|
510
|
+
container: "app-wrap",
|
|
511
|
+
},
|
|
512
|
+
reverseButtons: true,
|
|
513
|
+
allowOutsideClick: false,
|
|
514
|
+
inputValidator: function (value) {
|
|
515
|
+
var _a;
|
|
516
|
+
if (!value)
|
|
517
|
+
return _this.loc["Please insert your clipboard content"][(_a = _this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'];
|
|
518
|
+
}
|
|
519
|
+
}).then(function (t) {
|
|
520
|
+
if (t.isConfirmed) {
|
|
521
|
+
console.log("[@esfaenza/extensions] Retrieving input data from user input");
|
|
522
|
+
_this.doClipboardDataGet(t.value, style, valueFoundCallback);
|
|
523
|
+
}
|
|
524
|
+
});
|
|
437
525
|
return;
|
|
438
526
|
}
|
|
439
527
|
if (window.clipboardData) {
|
|
440
528
|
console.log("[@esfaenza/extensions] Found clipboardData");
|
|
441
529
|
var data = window.clipboardData.getData("Text");
|
|
442
|
-
|
|
443
|
-
var value = style == "array" ? this.getClipboardLines(data) :
|
|
444
|
-
style == "matrix" ? this.getClipboardMatrix(data) : [];
|
|
445
|
-
console.log("[@esfaenza/extensions] Adapted for " + style + ": " + JSON.stringify(value));
|
|
446
|
-
if (valueFoundCallback)
|
|
447
|
-
valueFoundCallback(value);
|
|
530
|
+
this.doClipboardDataGet(data, style, valueFoundCallback);
|
|
448
531
|
}
|
|
449
532
|
else if (window.navigator.clipboard) {
|
|
450
533
|
console.log("[@esfaenza/extensions] Found navigator clipboard");
|
|
@@ -457,21 +540,20 @@
|
|
|
457
540
|
}
|
|
458
541
|
console.log("[@esfaenza/extensions] Clipboard permission granted, retrieving values");
|
|
459
542
|
window.navigator.clipboard.readText()
|
|
460
|
-
.then(function (t) {
|
|
461
|
-
|
|
462
|
-
var value = style == "array" ? _this.getClipboardLines(t) :
|
|
463
|
-
style == "matrix" ? _this.getClipboardMatrix(t) : [];
|
|
464
|
-
console.log("[@esfaenza/extensions] Adapted for " + style + ": " + JSON.stringify(value));
|
|
465
|
-
if (valueFoundCallback)
|
|
466
|
-
valueFoundCallback(value);
|
|
467
|
-
})
|
|
468
|
-
.catch(function (err) {
|
|
469
|
-
var _a;
|
|
470
|
-
_this.msgService.simpleError(_this.loc["Error during Clipboard content read operation"][(_a = _this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'] + ": " + err);
|
|
471
|
-
});
|
|
543
|
+
.then(function (t) { return _this.doClipboardDataGet(t, style, valueFoundCallback); })
|
|
544
|
+
.catch(function (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); });
|
|
472
545
|
});
|
|
473
546
|
}
|
|
474
547
|
};
|
|
548
|
+
/** @ignore */
|
|
549
|
+
ClipboardService.prototype.doClipboardDataGet = function (clipboardText, style, valueFoundCallback) {
|
|
550
|
+
console.log("[@esfaenza/extensions] Retrieved clipboard values: " + clipboardText);
|
|
551
|
+
var value = style == "array" ? this.getClipboardLines(clipboardText) :
|
|
552
|
+
style == "matrix" ? this.getClipboardMatrix(clipboardText) : [];
|
|
553
|
+
console.log("[@esfaenza/extensions] Adapted for " + style + ": " + JSON.stringify(value));
|
|
554
|
+
if (valueFoundCallback)
|
|
555
|
+
valueFoundCallback(value);
|
|
556
|
+
};
|
|
475
557
|
/**
|
|
476
558
|
* Ottiene il contenuto della clipboard diviso per righe (separate da newline)
|
|
477
559
|
*
|
|
@@ -480,7 +562,10 @@
|
|
|
480
562
|
* @returns {string[]} Array contenente il testo preso dalla clipboard diviso per riga
|
|
481
563
|
*/
|
|
482
564
|
ClipboardService.prototype.getClipboardLines = function (data) {
|
|
483
|
-
|
|
565
|
+
var trimmedData = data.trim();
|
|
566
|
+
if (!trimmedData.includes("\r\n") && trimmedData.includes("\n"))
|
|
567
|
+
return trimmedData.split("\n");
|
|
568
|
+
return trimmedData.split("\r\n");
|
|
484
569
|
};
|
|
485
570
|
/**
|
|
486
571
|
* Ottiene il contenuto della clipboard diviso per righe (separate da newline) e colonne (separate da tab)
|
|
@@ -491,7 +576,7 @@
|
|
|
491
576
|
*/
|
|
492
577
|
ClipboardService.prototype.getClipboardMatrix = function (data) {
|
|
493
578
|
var ret = [];
|
|
494
|
-
var rows = data.split("\r\n");
|
|
579
|
+
var rows = !data.includes("\r\n") && data.includes("\n") ? data.split("\n") : data.split("\r\n");
|
|
495
580
|
// A quanto pare ogni valore è separato da un \t... spero che sia uno standard di quando si copia da excel altrimenti ciao
|
|
496
581
|
for (var i = 0; i < rows.length; i++)
|
|
497
582
|
ret.push(rows[i].split('\t').map(function (t) { return t.trim(); }));
|