@esfaenza/extensions 15.2.2 → 15.2.4

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,19 +1,14 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, NgModule, Injector, Injectable, Inject, Optional } from '@angular/core';
3
+ import * as i1 from '@esfaenza/localizations';
4
+ import { BaseLocalization } from '@esfaenza/localizations';
5
+ import { __awaiter } from 'tslib';
3
6
  import swal from 'sweetalert2';
7
+ import { first, map } from 'rxjs/operators';
4
8
  import { ToastrService } from 'ngx-toastr';
5
9
  import { of, Subject } from 'rxjs';
6
- import { map } from 'rxjs/operators';
7
10
  import { Deserialize } from 'cerialize';
8
11
 
9
- /**
10
- * Token che identifica il locale da utilizzare per questa libreria, sono supportati i locali 'it-IT' ed 'en-US'
11
- */
12
- const EXT_LOCALE = new InjectionToken('EXT_LOCALE');
13
- /**
14
- * Token che indica se la libreria deve utilizzare la libreria 'sweetalerts2' (più graficamente piacevolo) o se limitarsi ad usare 'toastr'
15
- */
16
- const EXT_FANCY_ALERTS = new InjectionToken('EXT_FANCY_ALERTS');
17
12
  /**
18
13
  * Token che indica il prefisso delle searchView che serve per storicizzarle evitando di tirarsi in memoria anche tutti gli oggetti. Se vuoto viene supposto 'Hot'
19
14
  */
@@ -32,8 +27,6 @@ class ExtensionsModule {
32
27
  return {
33
28
  ngModule: ExtensionsModule,
34
29
  providers: [
35
- { provide: EXT_LOCALE, useValue: (config === null || config === void 0 ? void 0 : config.locale) || 'it-IT' },
36
- { provide: EXT_FANCY_ALERTS, useValue: (config === null || config === void 0 ? void 0 : config.fancy_alerts) || true },
37
30
  { provide: APPSEARCH_PREFIX, useValue: (config === null || config === void 0 ? void 0 : config.appsearch_prefix) || 'Hot' },
38
31
  { provide: EXT_ALLOW_UTC, useValue: (config === null || config === void 0 ? void 0 : config.allow_utc) == null ? false : config === null || config === void 0 ? void 0 : config.allow_utc }
39
32
  ]
@@ -42,12 +35,14 @@ class ExtensionsModule {
42
35
  }
43
36
  ExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
44
37
  ExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ExtensionsModule });
45
- ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExtensionsModule });
38
+ ExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExtensionsModule, providers: [BaseLocalization] });
46
39
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ExtensionsModule, decorators: [{
47
- type: NgModule
40
+ type: NgModule,
41
+ args: [{
42
+ providers: [BaseLocalization]
43
+ }]
48
44
  }] });
49
45
 
50
- // Angular
51
46
  /**
52
47
  * Service che fornisce funzionalità di alert nei tipi fondamentali: success, info, warning e danger
53
48
  */
@@ -57,11 +52,9 @@ class MessageService {
57
52
  *
58
53
  * @ignore
59
54
  */
60
- constructor(injector, FANCY_ALERTS, LOCALE) {
61
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
55
+ constructor(injector, locProvider) {
62
56
  this.injector = injector;
63
- this.FANCY_ALERTS = FANCY_ALERTS;
64
- this.LOCALE = LOCALE;
57
+ this.locProvider = locProvider;
65
58
  /**
66
59
  * Oggetto statico in supporto alla localizzazione
67
60
  */
@@ -74,98 +67,104 @@ class MessageService {
74
67
  'Success': { 'en-US': "Success", 'it-IT': "Successo", },
75
68
  'Warning': { 'en-US': "Warning", 'it-IT': "Attenzione", }
76
69
  };
77
- this.expiredSessionSwal = swal.mixin({
78
- showCancelButton: false,
79
- confirmButtonText: 'Login',
80
- customClass: {
81
- confirmButton: "btn btn-primary",
82
- container: "app-wrap",
83
- },
84
- buttonsStyling: false,
85
- reverseButtons: false,
86
- allowOutsideClick: false,
87
- icon: "warning"
88
- });
89
- this.successSwalWithCancel = swal.mixin({
90
- title: this.loc["Success"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'],
91
- customClass: {
92
- confirmButton: "btn btn-primary",
93
- cancelButton: "btn btn-secondary app-margin-right-10",
94
- container: "app-wrap",
95
- },
96
- buttonsStyling: false,
97
- reverseButtons: true,
98
- showCancelButton: true,
99
- confirmButtonText: this.loc["Confirm"][(_b = this.LOCALE) !== null && _b !== void 0 ? _b : 'it-IT'],
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'],
115
- icon: "warning"
116
- });
117
- this.warningSwal = swal.mixin({
118
- title: this.loc["Warning"][(_g = this.LOCALE) !== null && _g !== void 0 ? _g : 'it-IT'],
119
- customClass: {
120
- confirmButton: "btn btn-primary",
121
- container: "app-wrap",
122
- },
123
- buttonsStyling: false,
124
- reverseButtons: true,
125
- showCancelButton: false,
126
- confirmButtonText: this.loc["Close"][(_h = this.LOCALE) !== null && _h !== void 0 ? _h : 'it-IT'],
127
- icon: "warning"
128
- });
129
- this.successSwal = swal.mixin({
130
- title: this.loc["Success"][(_j = this.LOCALE) !== null && _j !== void 0 ? _j : 'it-IT'],
131
- customClass: {
132
- confirmButton: "btn btn-primary",
133
- container: "app-wrap",
134
- },
135
- buttonsStyling: false,
136
- reverseButtons: true,
137
- showCancelButton: false,
138
- confirmButtonText: this.loc["Close"][(_k = this.LOCALE) !== null && _k !== void 0 ? _k : 'it-IT'],
139
- icon: "success"
140
- });
141
- this.errorSwal = swal.mixin({
142
- title: this.loc["Error"][(_l = this.LOCALE) !== null && _l !== void 0 ? _l : 'it-IT'],
143
- customClass: {
144
- confirmButton: "btn btn-primary",
145
- container: "app-wrap",
146
- },
147
- buttonsStyling: false,
148
- reverseButtons: true,
149
- showCancelButton: false,
150
- confirmButtonText: this.loc["Close"][(_m = this.LOCALE) !== null && _m !== void 0 ? _m : 'it-IT'],
151
- icon: "error"
152
- });
153
- this.infoSwal = swal.mixin({
154
- title: this.loc["Info"][(_o = this.LOCALE) !== null && _o !== void 0 ? _o : 'it-IT'],
155
- customClass: {
156
- confirmButton: "btn btn-primary",
157
- container: "app-wrap",
158
- },
159
- buttonsStyling: false,
160
- reverseButtons: true,
161
- showCancelButton: false,
162
- confirmButtonText: this.loc["Close"][(_p = this.LOCALE) !== null && _p !== void 0 ? _p : 'it-IT'],
163
- icon: "info"
164
- });
70
+ this.init();
165
71
  }
166
72
  get toastr() {
167
73
  return this.injector.get(ToastrService);
168
74
  }
75
+ init() {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ let LOCALE = this.locProvider ? yield this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
78
+ this.expiredSessionSwal = swal.mixin({
79
+ showCancelButton: false,
80
+ confirmButtonText: 'Login',
81
+ customClass: {
82
+ confirmButton: "btn btn-primary",
83
+ container: "app-wrap",
84
+ },
85
+ buttonsStyling: false,
86
+ reverseButtons: false,
87
+ allowOutsideClick: false,
88
+ icon: "warning"
89
+ });
90
+ this.successSwalWithCancel = swal.mixin({
91
+ title: this.loc["Success"][LOCALE],
92
+ customClass: {
93
+ confirmButton: "btn btn-primary",
94
+ cancelButton: "btn btn-secondary app-margin-right-10",
95
+ container: "app-wrap",
96
+ },
97
+ buttonsStyling: false,
98
+ reverseButtons: true,
99
+ showCancelButton: true,
100
+ confirmButtonText: this.loc["Confirm"][LOCALE],
101
+ cancelButtonText: this.loc["Cancel"][LOCALE],
102
+ icon: "success"
103
+ });
104
+ this.warningSwalWithCancel = swal.mixin({
105
+ title: this.loc["Warning"][LOCALE],
106
+ customClass: {
107
+ confirmButton: "btn btn-primary",
108
+ cancelButton: "btn btn-secondary app-margin-right-10",
109
+ container: "app-wrap",
110
+ },
111
+ buttonsStyling: false,
112
+ reverseButtons: true,
113
+ showCancelButton: true,
114
+ confirmButtonText: this.loc["Confirm"][LOCALE],
115
+ cancelButtonText: this.loc["Cancel"][LOCALE],
116
+ icon: "warning"
117
+ });
118
+ this.warningSwal = swal.mixin({
119
+ title: this.loc["Warning"][LOCALE],
120
+ customClass: {
121
+ confirmButton: "btn btn-primary",
122
+ container: "app-wrap",
123
+ },
124
+ buttonsStyling: false,
125
+ reverseButtons: true,
126
+ showCancelButton: false,
127
+ confirmButtonText: this.loc["Close"][LOCALE],
128
+ icon: "warning"
129
+ });
130
+ this.successSwal = swal.mixin({
131
+ title: this.loc["Success"][LOCALE],
132
+ customClass: {
133
+ confirmButton: "btn btn-primary",
134
+ container: "app-wrap",
135
+ },
136
+ buttonsStyling: false,
137
+ reverseButtons: true,
138
+ showCancelButton: false,
139
+ confirmButtonText: this.loc["Close"][LOCALE],
140
+ icon: "success"
141
+ });
142
+ this.errorSwal = swal.mixin({
143
+ title: this.loc["Error"][LOCALE],
144
+ customClass: {
145
+ confirmButton: "btn btn-primary",
146
+ container: "app-wrap",
147
+ },
148
+ buttonsStyling: false,
149
+ reverseButtons: true,
150
+ showCancelButton: false,
151
+ confirmButtonText: this.loc["Close"][LOCALE],
152
+ icon: "error"
153
+ });
154
+ this.infoSwal = swal.mixin({
155
+ title: this.loc["Info"][LOCALE],
156
+ customClass: {
157
+ confirmButton: "btn btn-primary",
158
+ container: "app-wrap",
159
+ },
160
+ buttonsStyling: false,
161
+ reverseButtons: true,
162
+ showCancelButton: false,
163
+ confirmButtonText: this.loc["Close"][LOCALE],
164
+ icon: "info"
165
+ });
166
+ });
167
+ }
169
168
  /**
170
169
  * Presentazione di un semplice messaggio di successo
171
170
  *
@@ -258,7 +257,7 @@ class MessageService {
258
257
  toastrOrSwal(providerOverride) {
259
258
  if (providerOverride != null)
260
259
  return providerOverride;
261
- return this.FANCY_ALERTS == null ? "swal" : this.FANCY_ALERTS ? "swal" : "toastr";
260
+ return "swal";
262
261
  }
263
262
  /**
264
263
  * Mostra un messaggio di avviso con richiesta di conferma e gestisce il risultato chiamato i callback **onsuccess** o **onerror**
@@ -400,7 +399,7 @@ class MessageService {
400
399
  }
401
400
  }
402
401
  }
403
- MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MessageService, deps: [{ token: Injector }, { token: EXT_FANCY_ALERTS, optional: true }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
402
+ MessageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MessageService, deps: [{ token: Injector }, { token: i1.BaseLocalization, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
404
403
  MessageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MessageService });
405
404
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MessageService, decorators: [{
406
405
  type: Injectable
@@ -408,20 +407,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
408
407
  return [{ type: i0.Injector, decorators: [{
409
408
  type: Inject,
410
409
  args: [Injector]
411
- }] }, { type: undefined, decorators: [{
410
+ }] }, { type: i1.BaseLocalization, decorators: [{
412
411
  type: Optional
413
- }, {
414
- type: Inject,
415
- args: [EXT_FANCY_ALERTS]
416
- }] }, { type: undefined, decorators: [{
417
- type: Optional
418
- }, {
419
- type: Inject,
420
- args: [EXT_LOCALE]
421
412
  }] }];
422
413
  } });
423
414
 
424
- // Angular
425
415
  /**
426
416
  * Service che fornisce un accesso base in lettura/scrittura sulla clipboard
427
417
  */
@@ -431,9 +421,9 @@ class ClipboardService {
431
421
  *
432
422
  * @ignore
433
423
  */
434
- constructor(msgService, LOCALE) {
424
+ constructor(msgService, locProvider) {
435
425
  this.msgService = msgService;
436
- this.LOCALE = LOCALE;
426
+ this.locProvider = locProvider;
437
427
  /**
438
428
  * Oggetto statico di localizzazione per i messaggi di questa Service
439
429
  */
@@ -484,56 +474,57 @@ class ClipboardService {
484
474
  * @param {Function} valueFoundCallback Callback che questa funzione chiamerà una volta ottenuto i valori richiesti dalla clipboard
485
475
  */
486
476
  getClipboard(style, valueFoundCallback) {
487
- var _a, _b, _c, _d;
488
- if (navigator.userAgent.indexOf("Firefox") != -1) {
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
- });
515
- return;
516
- }
517
- if (window.clipboardData) {
518
- console.log("[@esfaenza/extensions] Found clipboardData");
519
- let data = window.clipboardData.getData("Text");
520
- this.doClipboardDataGet(data, style, valueFoundCallback);
521
- }
522
- else if (window.navigator.clipboard) {
523
- console.log("[@esfaenza/extensions] Found navigator clipboard");
524
- window.navigator.permissions.query({ name: 'clipboard-read' }).then(result => {
525
- if (!(result.state === 'granted' || result.state === 'prompt')) {
526
- console.error("[@esfaenza/extensions] Clipboard permission not granted");
527
- if (valueFoundCallback)
528
- valueFoundCallback([]);
529
- return;
530
- }
531
- console.log("[@esfaenza/extensions] Clipboard permission granted, retrieving values");
532
- window.navigator.clipboard.readText()
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); });
535
- });
536
- }
477
+ return __awaiter(this, void 0, void 0, function* () {
478
+ let LOCALE = this.locProvider ? yield this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
479
+ if (navigator.userAgent.indexOf("Firefox") != -1) {
480
+ swal.fire({
481
+ title: this.loc["User input required"][LOCALE],
482
+ 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"][LOCALE],
483
+ input: 'textarea',
484
+ icon: "warning",
485
+ confirmButtonText: this.loc["Confirm"][LOCALE],
486
+ cancelButtonText: this.loc["Cancel"][LOCALE],
487
+ showCancelButton: true,
488
+ customClass: {
489
+ confirmButton: "btn btn-primary",
490
+ cancelButton: "btn btn-secondary app-margin-right-15",
491
+ container: "app-wrap",
492
+ },
493
+ reverseButtons: true,
494
+ allowOutsideClick: false,
495
+ inputValidator: (value) => {
496
+ if (!value)
497
+ return this.loc["Please insert your clipboard content"][LOCALE];
498
+ }
499
+ }).then(t => {
500
+ if (t.isConfirmed) {
501
+ console.log("[@esfaenza/extensions] Retrieving input data from user input");
502
+ this.doClipboardDataGet(t.value, style, valueFoundCallback);
503
+ }
504
+ });
505
+ return;
506
+ }
507
+ if (window.clipboardData) {
508
+ console.log("[@esfaenza/extensions] Found clipboardData");
509
+ let data = window.clipboardData.getData("Text");
510
+ this.doClipboardDataGet(data, style, valueFoundCallback);
511
+ }
512
+ else if (window.navigator.clipboard) {
513
+ console.log("[@esfaenza/extensions] Found navigator clipboard");
514
+ window.navigator.permissions.query({ name: 'clipboard-read' }).then(result => {
515
+ if (!(result.state === 'granted' || result.state === 'prompt')) {
516
+ console.error("[@esfaenza/extensions] Clipboard permission not granted");
517
+ if (valueFoundCallback)
518
+ valueFoundCallback([]);
519
+ return;
520
+ }
521
+ console.log("[@esfaenza/extensions] Clipboard permission granted, retrieving values");
522
+ window.navigator.clipboard.readText()
523
+ .then((t) => this.doClipboardDataGet(t, style, valueFoundCallback))
524
+ .catch((err) => this.msgService.simpleError(this.loc["Error during Clipboard content read operation"][LOCALE] + ": " + err));
525
+ });
526
+ }
527
+ });
537
528
  }
538
529
  /** @ignore */
539
530
  doClipboardDataGet(clipboardText, style, valueFoundCallback) {
@@ -578,67 +569,65 @@ class ClipboardService {
578
569
  * @param {string} text Testo da inserire nella clipboard
579
570
  */
580
571
  copyTextToClipboard(text) {
581
- var _a, _b;
582
- var textArea = document.createElement("textarea");
583
- //
584
- // *** This styling is an extra step which is likely not required. ***
585
- //
586
- // Why is it here? To ensure:
587
- // 1. the element is able to have focus and selection.
588
- // 2. if element was to flash render it has minimal visual impact.
589
- // 3. less flakyness with selection and copying which **might** occur if
590
- // the textarea element is not visible.
591
- //
592
- // The likelihood is the element won't even render, not even a flash,
593
- // so some of these are just precautions. However in IE the element
594
- // is visible whilst the popup box asking the user for permission for
595
- // the web page to copy to the clipboard.
596
- //
597
- // Place in top-left corner of screen regardless of scroll position.
598
- textArea.style.position = "fixed";
599
- textArea.style.top = "0";
600
- textArea.style.left = "0";
601
- // Ensure it has a small width and height. Setting to 1px / 1em
602
- // doesn't work as this gives a negative w/h on some browsers.
603
- textArea.style.width = "2em";
604
- textArea.style.height = "2em";
605
- // We don't need padding, reducing the size if it does flash render.
606
- textArea.style.padding = "0";
607
- // Clean up any borders.
608
- textArea.style.border = "none";
609
- textArea.style.outline = "none";
610
- textArea.style.boxShadow = "none";
611
- // Avoid flash of white box if rendered for any reason.
612
- textArea.style.background = "transparent";
613
- textArea.value = text;
614
- document.body.appendChild(textArea);
615
- textArea.focus();
616
- textArea.select();
617
- try {
618
- var successful = document.execCommand("copy");
619
- if (!successful)
620
- this.msgService.simpleError(this.loc["Generic error during 'copy' command execution"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT']);
621
- }
622
- catch (err) {
623
- this.msgService.simpleError(this.loc["Error during Clipboard content copy operation"][(_b = this.LOCALE) !== null && _b !== void 0 ? _b : 'it-IT'] + ": " + err);
624
- }
625
- document.body.removeChild(textArea);
572
+ return __awaiter(this, void 0, void 0, function* () {
573
+ let LOCALE = this.locProvider ? yield this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
574
+ var textArea = document.createElement("textarea");
575
+ //
576
+ // *** This styling is an extra step which is likely not required. ***
577
+ //
578
+ // Why is it here? To ensure:
579
+ // 1. the element is able to have focus and selection.
580
+ // 2. if element was to flash render it has minimal visual impact.
581
+ // 3. less flakyness with selection and copying which **might** occur if
582
+ // the textarea element is not visible.
583
+ //
584
+ // The likelihood is the element won't even render, not even a flash,
585
+ // so some of these are just precautions. However in IE the element
586
+ // is visible whilst the popup box asking the user for permission for
587
+ // the web page to copy to the clipboard.
588
+ //
589
+ // Place in top-left corner of screen regardless of scroll position.
590
+ textArea.style.position = "fixed";
591
+ textArea.style.top = "0";
592
+ textArea.style.left = "0";
593
+ // Ensure it has a small width and height. Setting to 1px / 1em
594
+ // doesn't work as this gives a negative w/h on some browsers.
595
+ textArea.style.width = "2em";
596
+ textArea.style.height = "2em";
597
+ // We don't need padding, reducing the size if it does flash render.
598
+ textArea.style.padding = "0";
599
+ // Clean up any borders.
600
+ textArea.style.border = "none";
601
+ textArea.style.outline = "none";
602
+ textArea.style.boxShadow = "none";
603
+ // Avoid flash of white box if rendered for any reason.
604
+ textArea.style.background = "transparent";
605
+ textArea.value = text;
606
+ document.body.appendChild(textArea);
607
+ textArea.focus();
608
+ textArea.select();
609
+ try {
610
+ var successful = document.execCommand("copy");
611
+ if (!successful)
612
+ this.msgService.simpleError(this.loc["Generic error during 'copy' command execution"][LOCALE]);
613
+ }
614
+ catch (err) {
615
+ this.msgService.simpleError(this.loc["Error during Clipboard content copy operation"][LOCALE] + ": " + err);
616
+ }
617
+ document.body.removeChild(textArea);
618
+ });
626
619
  }
627
620
  }
628
- ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, deps: [{ token: MessageService }, { token: EXT_LOCALE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
621
+ ClipboardService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, deps: [{ token: MessageService }, { token: i1.BaseLocalization, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
629
622
  ClipboardService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService });
630
623
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ClipboardService, decorators: [{
631
624
  type: Injectable
632
625
  }], ctorParameters: function () {
633
- return [{ type: MessageService }, { type: undefined, decorators: [{
626
+ return [{ type: MessageService }, { type: i1.BaseLocalization, decorators: [{
634
627
  type: Optional
635
- }, {
636
- type: Inject,
637
- args: [EXT_LOCALE]
638
628
  }] }];
639
629
  } });
640
630
 
641
- // Angular
642
631
  /**
643
632
  * Service che fornisce dei metodi di estensione per la gestione/manipolazione delle date
644
633
  */
@@ -648,9 +637,8 @@ class DateService {
648
637
  *
649
638
  * @ignore
650
639
  */
651
- constructor(LOCALE, allowUtc) {
652
- var _a, _b, _c, _d, _e, _f, _g, _h;
653
- this.LOCALE = LOCALE;
640
+ constructor(locProvider, allowUtc) {
641
+ this.locProvider = locProvider;
654
642
  this.allowUtc = allowUtc;
655
643
  /**
656
644
  * Oggetto statico di localizzazione per i messaggi di questa Service
@@ -677,14 +665,20 @@ class DateService {
677
665
  smallDateWithM: "",
678
666
  fulldateDisplayNoSS: ""
679
667
  };
680
- this.cfg.smallDate = this.loc["SMALL_DATE_FORMAT"][(_a = this.LOCALE) !== null && _a !== void 0 ? _a : 'it-IT'];
681
- this.cfg.fulldate = this.loc["FULL_DATE_FORMAT"][(_b = this.LOCALE) !== null && _b !== void 0 ? _b : 'it-IT'];
682
- this.cfg.fulldateNoSS = this.loc["FULL_DATE_FORMAT_NO_SS"][(_c = this.LOCALE) !== null && _c !== void 0 ? _c : 'it-IT'];
683
- this.cfg.fulldateDisplay = this.loc["FULL_DATE_DISPLAY_FORMAT"][(_d = this.LOCALE) !== null && _d !== void 0 ? _d : 'it-IT'];
684
- this.cfg.fulldateDisplayNoSS = this.loc["FULL_DATE_DISPLAY_FORMAT_NO_SS"][(_e = this.LOCALE) !== null && _e !== void 0 ? _e : 'it-IT'];
685
- this.cfg.smallDate = this.loc["SMALL_DATE_DISPLAY_FORMAT"][(_f = this.LOCALE) !== null && _f !== void 0 ? _f : 'it-IT'];
686
- this.cfg.smallDateWithH = this.loc["SMALL_DATE_DISPLAY_FORMAT_WITH_HOUR"][(_g = this.LOCALE) !== null && _g !== void 0 ? _g : 'it-IT'];
687
- this.cfg.smallDateWithM = this.loc["SMALL_DATE_DISPLAY_FORMAT_WITH_MINUTE"][(_h = this.LOCALE) !== null && _h !== void 0 ? _h : 'it-IT'];
668
+ this.init();
669
+ }
670
+ init() {
671
+ return __awaiter(this, void 0, void 0, function* () {
672
+ let LOCALE = this.locProvider ? yield this.locProvider.Locale.pipe(first()).toPromise() : 'it-IT';
673
+ this.cfg.smallDate = this.loc["SMALL_DATE_FORMAT"][LOCALE];
674
+ this.cfg.fulldate = this.loc["FULL_DATE_FORMAT"][LOCALE];
675
+ this.cfg.fulldateNoSS = this.loc["FULL_DATE_FORMAT_NO_SS"][LOCALE];
676
+ this.cfg.fulldateDisplay = this.loc["FULL_DATE_DISPLAY_FORMAT"][LOCALE];
677
+ this.cfg.fulldateDisplayNoSS = this.loc["FULL_DATE_DISPLAY_FORMAT_NO_SS"][LOCALE];
678
+ this.cfg.smallDate = this.loc["SMALL_DATE_DISPLAY_FORMAT"][LOCALE];
679
+ this.cfg.smallDateWithH = this.loc["SMALL_DATE_DISPLAY_FORMAT_WITH_HOUR"][LOCALE];
680
+ this.cfg.smallDateWithM = this.loc["SMALL_DATE_DISPLAY_FORMAT_WITH_MINUTE"][LOCALE];
681
+ });
688
682
  }
689
683
  /**
690
684
  * Aggiusta una data in "istante finale" in base a qual è la parte di data significativa.
@@ -856,16 +850,13 @@ class DateService {
856
850
  return date.format(small ? this.cfg.smallDate : seconds ? this.cfg.fulldateDisplay : this.cfg.fulldateDisplayNoSS);
857
851
  }
858
852
  }
859
- DateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateService, deps: [{ token: EXT_LOCALE, optional: true }, { token: EXT_ALLOW_UTC, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
853
+ DateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateService, deps: [{ token: i1.BaseLocalization, optional: true }, { token: EXT_ALLOW_UTC, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
860
854
  DateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateService });
861
855
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DateService, decorators: [{
862
856
  type: Injectable
863
857
  }], ctorParameters: function () {
864
- return [{ type: undefined, decorators: [{
858
+ return [{ type: i1.BaseLocalization, decorators: [{
865
859
  type: Optional
866
- }, {
867
- type: Inject,
868
- args: [EXT_LOCALE]
869
860
  }] }, { type: undefined, decorators: [{
870
861
  type: Optional
871
862
  }, {
@@ -1009,7 +1000,7 @@ const ExportAs = (order, type, prefix) => (target, propertyKey) => {
1009
1000
  Object.defineProperty(target, propertyKey + prop, { value: null, writable: true, enumerable: true });
1010
1001
  Object.defineProperty(target, propertyKey + prop + csvValueNavigator, { value: propertyKey + "." + prop, writable: false });
1011
1002
  Object.defineProperty(target, propertyKey + prop + csvVisPrefix, { value: toEmit, writable: false });
1012
- Object.defineProperty(target, propertyKey + prop + csvHdrPrefix, { value: prefix + " " + lbl, writable: false });
1003
+ Object.defineProperty(target, propertyKey + prop + csvHdrPrefix, { value: (prefix ? prefix + ' ' : '') + lbl, writable: false });
1013
1004
  if (target[exportList])
1014
1005
  target[exportList].push(propertyKey + prop + csvVisPrefix);
1015
1006
  else
@@ -2068,8 +2059,6 @@ class FullExtensionsModule {
2068
2059
  MessageService,
2069
2060
  UtilityService,
2070
2061
  InterComService,
2071
- { provide: EXT_LOCALE, useValue: (config === null || config === void 0 ? void 0 : config.locale) || 'it-IT' },
2072
- { provide: EXT_FANCY_ALERTS, useValue: (config === null || config === void 0 ? void 0 : config.fancy_alerts) || true },
2073
2062
  { provide: APPSEARCH_PREFIX, useValue: (config === null || config === void 0 ? void 0 : config.appsearch_prefix) || 'Hot' },
2074
2063
  { provide: EXT_ALLOW_UTC, useValue: (config === null || config === void 0 ? void 0 : config.allow_utc) == null ? false : config === null || config === void 0 ? void 0 : config.allow_utc }
2075
2064
  ]
@@ -2078,9 +2067,12 @@ class FullExtensionsModule {
2078
2067
  }
2079
2068
  FullExtensionsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FullExtensionsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2080
2069
  FullExtensionsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FullExtensionsModule });
2081
- FullExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FullExtensionsModule });
2070
+ FullExtensionsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FullExtensionsModule, providers: [BaseLocalization] });
2082
2071
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FullExtensionsModule, decorators: [{
2083
- type: NgModule
2072
+ type: NgModule,
2073
+ args: [{
2074
+ providers: [BaseLocalization]
2075
+ }]
2084
2076
  }] });
2085
2077
 
2086
2078
  /**
@@ -2116,5 +2108,5 @@ var InboundMessageTypes;
2116
2108
  * Generated bundle index. Do not edit.
2117
2109
  */
2118
2110
 
2119
- export { APPSEARCH_PREFIX, CallResult, ClipboardService, CsvHeaders, DateService, EXT_ALLOW_UTC, EXT_FANCY_ALERTS, EXT_LOCALE, Export, ExportAs, ExportDictionary, ExportList, ExportService, ExtensionsModule, FullExtensionsModule, GenericItem, HashingService, InboundMessageTypes, InterComMessage, InterComService, MessageService, UtilityService };
2111
+ export { APPSEARCH_PREFIX, CallResult, ClipboardService, CsvHeaders, DateService, EXT_ALLOW_UTC, Export, ExportAs, ExportDictionary, ExportList, ExportService, ExtensionsModule, FullExtensionsModule, GenericItem, HashingService, InboundMessageTypes, InterComMessage, InterComService, MessageService, UtilityService };
2120
2112
  //# sourceMappingURL=esfaenza-extensions.mjs.map