@eqproject/eqp-attachments 2.5.0 → 2.5.2

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.
Files changed (28) hide show
  1. package/{esm2022 → esm2020}/eqproject-eqp-attachments.mjs +4 -4
  2. package/esm2020/lib/eqp-attachments.component.mjs +1064 -0
  3. package/{esm2022 → esm2020}/lib/eqp-attachments.module.mjs +43 -43
  4. package/esm2020/lib/helpers/attachment.helper.mjs +66 -0
  5. package/{esm2022 → esm2020}/lib/interfaces/IAttachment.mjs +12 -12
  6. package/{esm2022 → esm2020}/lib/interfaces/IOptions.mjs +1 -1
  7. package/{esm2022 → esm2020}/lib/modules/material.module.mjs +231 -231
  8. package/{esm2022 → esm2020}/lib/services/eqp-attachment-dialog.service.mjs +103 -103
  9. package/{esm2022 → esm2020}/lib/services/eqp-attachment.service.mjs +23 -23
  10. package/{esm2022 → esm2020}/public-api.mjs +9 -9
  11. package/fesm2015/eqproject-eqp-attachments.mjs +1535 -0
  12. package/fesm2015/eqproject-eqp-attachments.mjs.map +1 -0
  13. package/{fesm2022 → fesm2020}/eqproject-eqp-attachments.mjs +1459 -1491
  14. package/fesm2020/eqproject-eqp-attachments.mjs.map +1 -0
  15. package/index.d.ts +5 -5
  16. package/lib/eqp-attachments.component.d.ts +318 -318
  17. package/lib/eqp-attachments.module.d.ts +13 -13
  18. package/lib/helpers/attachment.helper.d.ts +20 -20
  19. package/lib/interfaces/IAttachment.d.ts +21 -21
  20. package/lib/interfaces/IOptions.d.ts +11 -11
  21. package/lib/modules/material.module.d.ts +37 -37
  22. package/lib/services/eqp-attachment-dialog.service.d.ts +31 -31
  23. package/lib/services/eqp-attachment.service.d.ts +7 -7
  24. package/package.json +20 -14
  25. package/public-api.d.ts +6 -6
  26. package/esm2022/lib/eqp-attachments.component.mjs +0 -1096
  27. package/esm2022/lib/helpers/attachment.helper.mjs +0 -66
  28. package/fesm2022/eqproject-eqp-attachments.mjs.map +0 -1
@@ -0,0 +1,1535 @@
1
+ import { __awaiter } from 'tslib';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable, EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
4
+ import * as i2 from '@angular/forms';
5
+ import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
6
+ import * as i15 from '@eqproject/eqp-table';
7
+ import { TooltipPositionType, TypeColumn, EqpTableModule } from '@eqproject/eqp-table';
8
+ import imageCompression from 'browser-image-compression';
9
+ import * as i14 from 'ngx-image-cropper';
10
+ import { base64ToFile, ImageCropperComponent, ImageCropperModule } from 'ngx-image-cropper';
11
+ import Swal from 'sweetalert2';
12
+ import { Observable, from, concatMap } from 'rxjs';
13
+ import * as i1 from '@angular/material/dialog';
14
+ import { MatDialogModule } from '@angular/material/dialog';
15
+ import * as i3 from '@angular/platform-browser';
16
+ import * as i4 from '@angular/common/http';
17
+ import * as i6 from '@angular/material/button';
18
+ import { MatButtonModule } from '@angular/material/button';
19
+ import * as i7 from '@angular/material/input';
20
+ import { MatInputModule } from '@angular/material/input';
21
+ import * as i8 from '@angular/material/form-field';
22
+ import { MatFormFieldModule } from '@angular/material/form-field';
23
+ import * as i9 from '@angular/material/menu';
24
+ import { MatMenuModule } from '@angular/material/menu';
25
+ import * as i10 from '@angular/material/card';
26
+ import { MatCardModule } from '@angular/material/card';
27
+ import * as i11 from '@angular/material/icon';
28
+ import { MatIconModule } from '@angular/material/icon';
29
+ import * as i12 from '@angular/material/tooltip';
30
+ import { MatTooltipModule } from '@angular/material/tooltip';
31
+ import * as i13 from '@angular/common';
32
+ import { CommonModule } from '@angular/common';
33
+ import * as i16 from 'ngx-file-drop';
34
+ import { NgxFileDropModule } from 'ngx-file-drop';
35
+ import { MatCheckboxModule } from '@angular/material/checkbox';
36
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
37
+ import { MatDatepickerModule } from '@angular/material/datepicker';
38
+ import { MatRadioModule } from '@angular/material/radio';
39
+ import { MatSelectModule } from '@angular/material/select';
40
+ import { MatSliderModule } from '@angular/material/slider';
41
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
42
+ import { MatSidenavModule } from '@angular/material/sidenav';
43
+ import { MatToolbarModule } from '@angular/material/toolbar';
44
+ import { MatListModule } from '@angular/material/list';
45
+ import { MatGridListModule } from '@angular/material/grid-list';
46
+ import { MatStepperModule } from '@angular/material/stepper';
47
+ import { MatTabsModule } from '@angular/material/tabs';
48
+ import { MatExpansionModule } from '@angular/material/expansion';
49
+ import { MatButtonToggleModule } from '@angular/material/button-toggle';
50
+ import { MatChipsModule } from '@angular/material/chips';
51
+ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
52
+ import { MatProgressBarModule } from '@angular/material/progress-bar';
53
+ import { MatSnackBarModule } from '@angular/material/snack-bar';
54
+ import { MatTableModule } from '@angular/material/table';
55
+ import { MatSortModule } from '@angular/material/sort';
56
+ import { MatPaginatorModule } from '@angular/material/paginator';
57
+ import { MatNativeDateModule } from '@angular/material/core';
58
+
59
+ class AttachmentHelperService {
60
+ constructor() { }
61
+ /**
62
+ * Restituisce TRUE se il mime type passato nel parametro corrisponde ad un mime type di un'immagine
63
+ * @param mimeType Mime Type da verificare
64
+ */
65
+ static checkImageFromMimeType(mimeType) {
66
+ return this.imageMimeTypes.find(s => s == mimeType) != null;
67
+ }
68
+ /**
69
+ * In base all'estensione passata come parametro, restituisce la FontAwesome corretta da utilizzare.
70
+ * Se l'estensione non viene trovata nella costante riportata dentro common.model.ts restituisce un icona standard
71
+ * @param extension Estensione del file per cui restituire l'icona corretta
72
+ */
73
+ static getIconFromFileExtensione(extension) {
74
+ let fileIcon = this.fileExtensionIcon[extension];
75
+ return fileIcon !== null && fileIcon !== void 0 ? fileIcon : "fas fa-file";
76
+ }
77
+ }
78
+ AttachmentHelperService.imageMimeTypes = ["image/bmp", "image/gif", "image/jpeg", "image/tiff", "image/png"];
79
+ AttachmentHelperService.fileExtensionIcon = {
80
+ "txt": "fas fa-file-text",
81
+ "pdf": "fas fa-file-pdf",
82
+ "doc": "fas fa-file-word",
83
+ "docx": "fas fa-file-word",
84
+ "xls": "fas fa-file-excel",
85
+ "xlsx": "fas fa-file-excel",
86
+ "jpg": "fas fa-file-image",
87
+ "jpeg": "fas fa-file-image",
88
+ "png": "fas fa-file-image",
89
+ "bmp": "fas fa-file-image",
90
+ "mkv": "fas fa-file-video",
91
+ "flv": "fas fa-file-video",
92
+ "gif": "fas fa-file-video",
93
+ "gifv": "fas fa-file-video",
94
+ "avi": "fas fa-file-video",
95
+ "wmv": "fas fa-file-video",
96
+ "mp4": "fas fa-file-video",
97
+ "m4p": "fas fa-file-video",
98
+ "m4v": "fas fa-file-video",
99
+ "mpg": "fas fa-file-video",
100
+ "mp2": "fas fa-file-video",
101
+ "mpeg": "fas fa-file-video",
102
+ "mpe": "fas fa-file-video",
103
+ "mpv": "fas fa-file-video",
104
+ "m2v": "fas fa-file-video",
105
+ "3gp": "fas fa-file-video",
106
+ "3g2": "fas fa-file-video",
107
+ "mp3": "fas fa-file-audio",
108
+ };
109
+ AttachmentHelperService.dropboxCredentials = {
110
+ url: 'https://www.dropbox.com/static/api/2/dropins.js',
111
+ apiKey: "aj2xjzms4dl1sch",
112
+ accessToken: "l.BbasuuUFe42u-fXvpmDEteNkGMH-yPTxD79JhRjkBcR94Fm2QLgIjEETvx8TY36HsQQsIe24ofcNjYlg9IhSB7Fguqbi7wH-Jg6bW_3Q8VemsH4pC7Iakat643EzRcw7OMObPSs"
113
+ };
114
+ AttachmentHelperService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AttachmentHelperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
115
+ AttachmentHelperService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AttachmentHelperService, providedIn: 'root' });
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AttachmentHelperService, decorators: [{
117
+ type: Injectable,
118
+ args: [{
119
+ providedIn: 'root'
120
+ }]
121
+ }], ctorParameters: function () { return []; } });
122
+
123
+ var AttachmentType;
124
+ (function (AttachmentType) {
125
+ AttachmentType[AttachmentType["FILE"] = 1] = "FILE";
126
+ AttachmentType[AttachmentType["LINK"] = 2] = "LINK";
127
+ AttachmentType[AttachmentType["DROPBOX"] = 3] = "DROPBOX";
128
+ })(AttachmentType || (AttachmentType = {}));
129
+ var CropOptionEnum;
130
+ (function (CropOptionEnum) {
131
+ CropOptionEnum[CropOptionEnum["ROTATE"] = 1] = "ROTATE";
132
+ CropOptionEnum[CropOptionEnum["FLIP"] = 2] = "FLIP";
133
+ })(CropOptionEnum || (CropOptionEnum = {}));
134
+
135
+ class EqpAttachmentDialogService {
136
+ constructor() { }
137
+ /**
138
+ * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.
139
+ * @param message Messaggio d'errore da mostrare nello sweetalert
140
+ * @param title Titolo dello sweetalert (di default mostra 'Errore')
141
+ */
142
+ static Error(message, title = null) {
143
+ let currentTitle = title != null ? title : 'Errore';
144
+ if (Array.isArray(message)) {
145
+ currentTitle = title != null ? title : 'Errore';
146
+ let htmlErrors = message.join("<br>");
147
+ Swal.fire({
148
+ title: currentTitle,
149
+ html: htmlErrors,
150
+ icon: 'error'
151
+ });
152
+ }
153
+ else {
154
+ Swal.fire(currentTitle, message, 'error');
155
+ }
156
+ }
157
+ /**
158
+ * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto
159
+ * CONFERMA lancia la funzione di callback passata come parametro
160
+ * @param message Messaggio da mostrare nello sweetalert
161
+ * @param title Titolo dello sweetalert (di default mostra 'Info')
162
+ */
163
+ static Confirm(message, confirmCallback, isWarning = false, title = null, customWidth = null) {
164
+ let currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';
165
+ if (Array.isArray(message)) {
166
+ let htmlErrors = message.join("<br>");
167
+ Swal.fire({
168
+ title: currentTitle,
169
+ html: htmlErrors,
170
+ width: customWidth ? customWidth : '32rem',
171
+ icon: !isWarning ? 'question' : 'warning',
172
+ showCancelButton: true,
173
+ allowOutsideClick: false,
174
+ allowEscapeKey: false
175
+ }).then((result) => {
176
+ if (result.value && confirmCallback) {
177
+ confirmCallback();
178
+ }
179
+ });
180
+ }
181
+ else {
182
+ Swal.fire({
183
+ title: currentTitle,
184
+ text: message,
185
+ width: customWidth ? customWidth : '32rem',
186
+ icon: !isWarning ? 'question' : 'warning',
187
+ showCancelButton: true,
188
+ allowOutsideClick: false,
189
+ allowEscapeKey: false
190
+ }).then((result) => {
191
+ if (result.value && confirmCallback) {
192
+ confirmCallback();
193
+ }
194
+ });
195
+ }
196
+ }
197
+ /**
198
+ * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro
199
+ * @param message Messaggio da mostrare nello sweetalert
200
+ * @param title Titolo dello sweetalert (di default mostra 'Info')
201
+ */
202
+ static Info(message, title = null, isToast = null) {
203
+ let currentTitle = title != null ? title : "Informazione:";
204
+ Swal.fire(currentTitle, message, 'info');
205
+ }
206
+ /**
207
+ * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro
208
+ * @param message Messaggio da mostrare nello sweetalert
209
+ * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')
210
+ */
211
+ static Warning(message, title = null, isToast = null) {
212
+ let currentTitle = title != null ? title : "Attenzione!";
213
+ if (Array.isArray(message)) {
214
+ let htmlWarnings = message.join("<br>");
215
+ Swal.fire({
216
+ title: currentTitle,
217
+ html: htmlWarnings,
218
+ icon: 'warning'
219
+ });
220
+ }
221
+ else {
222
+ Swal.fire(currentTitle, message, 'warning');
223
+ }
224
+ }
225
+ }
226
+ EqpAttachmentDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentDialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
227
+ EqpAttachmentDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentDialogService, providedIn: 'root' });
228
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentDialogService, decorators: [{
229
+ type: Injectable,
230
+ args: [{
231
+ providedIn: 'root'
232
+ }]
233
+ }], ctorParameters: function () { return []; } });
234
+
235
+ class EqpAttachmentService {
236
+ constructor() { }
237
+ loadDropboxScript() {
238
+ const script = document.createElement("script");
239
+ script.type = "text/javascript";
240
+ script.src = AttachmentHelperService.dropboxCredentials.url;
241
+ script.id = "dropboxjs";
242
+ script.dataset.appKey = AttachmentHelperService.dropboxCredentials.apiKey;
243
+ document.body.appendChild(script);
244
+ }
245
+ }
246
+ EqpAttachmentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
247
+ EqpAttachmentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentService, providedIn: "root" });
248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentService, decorators: [{
249
+ type: Injectable,
250
+ args: [{
251
+ providedIn: "root"
252
+ }]
253
+ }], ctorParameters: function () { return []; } });
254
+
255
+ const toBase64 = (file) => new Promise((resolve, reject) => {
256
+ const reader = new FileReader();
257
+ reader.readAsDataURL(file);
258
+ reader.onload = () => resolve(reader.result.toString());
259
+ reader.onerror = (error) => reject(error);
260
+ });
261
+ class EqpAttachmentsComponent {
262
+ constructor(dialog, formBuilder, sanitizer, http, cd, eqpAttachmentService) {
263
+ this.dialog = dialog;
264
+ this.formBuilder = formBuilder;
265
+ this.sanitizer = sanitizer;
266
+ this.http = http;
267
+ this.cd = cd;
268
+ this.eqpAttachmentService = eqpAttachmentService;
269
+ //#region @Input del componente
270
+ /**
271
+ * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso "multipleAttachment" è TRUE).
272
+ */
273
+ this.disableAction = false;
274
+ /**
275
+ * Se TRUE mostra il titolo nell'header nel caso in cui "multipleAttachment" è TRUE ("Elenco allegati" di default).
276
+ */
277
+ this.showHeader = true;
278
+ /**
279
+ * Titolo da visualizzare se il parametro "showHeader" è TRUE. Di devault viene visualizzato "Elenco allegati".
280
+ */
281
+ this.headerTitle = "Elenco allegati";
282
+ /**
283
+ * Sorgente dati da visualizzare. Nel caso si vuole gestire un singolo allegato va passato in ogni caso come Array.
284
+ */
285
+ this.attachmentsList = null;
286
+ /**
287
+ * Se TRUE non mostra la MatCard (nel caso in cui "multipleAttachment" è TRUE).
288
+ */
289
+ this.showMatCard = true;
290
+ /**
291
+ * Se FALSE allora il componente mostra solo il pulsante di caricamento di un singolo file, una volta caricato il file invoca l'evento di output "localEditedAttachments".
292
+ * Se TRUE allora il componente mostra l'elenco di tutti gli allegati ricevuto nel parametro "attachmentsList".
293
+ */
294
+ this.multipleAttachment = true;
295
+ /**
296
+ * Se assume il valore TRUE allora sarà possibile caricare più file per volta. Questa funzionalità è attiva
297
+ * SOLO se si gestiscono allegati multipli, quindi se l'input 'multipleAttachment' assume il valore TRUE, altrimenti è sempre disabilitata.
298
+ */
299
+ this.loadMultipleFiles = false;
300
+ /**
301
+ * Configurazione delle colonne della eqp-table per la visualizzazione degli allegati (caso "multipleAttachment" è TRUE).
302
+ */
303
+ this.attachmentsColumns = null;
304
+ /**
305
+ * Imposta il messaggio da visualizzare nel caso in cui la tabella degli allegati (nel caso in cui "multipleAttachment" è TRUE) è vuota.
306
+ */
307
+ this.emptyTableMessage = "Nessun dato trovato";
308
+ /**
309
+ * Se TRUE allora permette di selezionare soltanto file di tipo immagine, avente uno dei mimetype
310
+ * specificati dentro AttachmentHelperService.
311
+ * Se FALSE permette di selezionare qualsiasi tipo di file
312
+ */
313
+ this.allowOnlyImages = false;
314
+ /**
315
+ * Se TRUE disabilita il pulsante di Aggiunta allegato (a prescindere dal valore del parametro "multipleAttachment").
316
+ */
317
+ this.isDisabled = false;
318
+ /**
319
+ * Mostra/nasconde la colonna per visualizzare l'anteprima dei file nella tabella (caso multipleAtatchments = true).
320
+ */
321
+ this.showInlinePreview = false;
322
+ /**
323
+ * Endpoint da chiamare per recueprare l'IAttachmentDTO completo da vedere nell'anteprima. La chiamata sarà in POST e nel body
324
+ * conterrà l'IAttachmentDTO selezionato dall'utente.
325
+ * La chiamata viene eseguita solo per l'anteprima delle immagini essendo necessario il base64 completo dell'immagine a dimensione reale.
326
+ * Per documenti/link basta che sia popolata la proprietà FilePath di IAttachmentDTO.
327
+ */
328
+ this.getAttachmentEndpoint = null;
329
+ /**
330
+ * Hostname dell'ambiente di produzione dell'applicativo. Necessario per visualizzare l'anteprima dei documenti
331
+ * tramite il viewer di google.
332
+ * NOTA: Per visualizzare l'anteprima è necessario che la prorietà FilePath dell'IAttachmentDTO sia popolata e che
333
+ * sia abilitato l'accesso alla cartella sul server tramite hostname.
334
+ */
335
+ this.productionBaseUrl = null;
336
+ /**
337
+ * Opzioni per la compressione delle immagini caricate.
338
+ */
339
+ this.compressionOptions = {
340
+ maxSizeMB: 0.5,
341
+ maxWidthOrHeight: 1920,
342
+ useWebWorker: true
343
+ };
344
+ /**
345
+ * Array di AttachmentType che si possono aggiungere
346
+ */
347
+ this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];
348
+ /**
349
+ * Permette di stabilire se la eqp-table contenente l'elenco degli allegati utilizza
350
+ * il multilingua oppure no
351
+ */
352
+ this.isEqpTableMultiLanguage = false;
353
+ /**
354
+ * Permette di stabilire, in caso di gestione allegati multipli, se la tabella contenente l'elenco
355
+ * degli allegati deve essere paginata oppure no
356
+ */
357
+ this.tablePaginatorVisible = true;
358
+ /**
359
+ * Permette di stabilire, in caso di gestione allegati multipli, se la tabella contenente l'elenco
360
+ * degli allegati deve contenere il campo di ricerca oppure no
361
+ */
362
+ this.isTableSearcheable = true;
363
+ /**
364
+ * In caso di gestione allegati multipli, permette di stabilire la dimensione pagina di default
365
+ * per la tabella contenente l'elenco degli allegati
366
+ */
367
+ this.tablePaginatorSize = null;
368
+ /**
369
+ * Permette di scegliere il modo in cui i file devono essere caricati
370
+ */
371
+ // @Input("uploadType") uploadType: UploadTypeEnum = UploadTypeEnum.FILE_AND_LINK;
372
+ /**
373
+ * Permette di stabilire se i pulsanti per il caricamento dei file sono separati o in un menù a tendina
374
+ */
375
+ this.separatedUploadButtons = false;
376
+ /**
377
+ * Permette di scegliere se dare la possibilità di vedere o no l'anteprima
378
+ */
379
+ this.showPreview = true;
380
+ /**
381
+ * In caso di allegato singolo, permette di scegliere se aggiungere file tramite drag and drop
382
+ */
383
+ this.singleAttachmentDragAndDrop = false;
384
+ /**
385
+ * Array di opzioni che si possono utilizzare per il crop
386
+ */
387
+ this.cropOptions = [];
388
+ /**
389
+ * Input per definire le label da usare nel componente
390
+ */
391
+ this.downloadTooltipPosition = TooltipPositionType.Below;
392
+ this.openLinkLabel = "Apri link";
393
+ this.addButtonLabel = "Aggiungi";
394
+ this.downloadLabel = "Download";
395
+ this.deleteLabel = "Elimina";
396
+ this.fileNameLabel = "Nome file";
397
+ this.previewLabel = "Anteprima";
398
+ this.uploadFileLabel = "Carica file";
399
+ this.confirmLabel = "Conferma";
400
+ this.abortLabel = "Annulla";
401
+ this.saveLabel = "Salva";
402
+ this.exitLabel = "Esci";
403
+ this.uploadWithDropboxLabel = "Carica con Dropbox";
404
+ this.cropLabel = "Scegli le dimensioni dell'immagine";
405
+ this.eqpTableSearchText = "Cerca";
406
+ this.deleteDialogTitle = null;
407
+ this.deleteDialogMessage = "Sei sicuro di voler cancellare quest'allegato?";
408
+ this.noImageSelectedErrorMessage = "Non è possibile selezionare un file che non sia un'immagine.";
409
+ this.wrongTypeSelectedErrorMessage = "Non è possibile caricare il file selezionato.";
410
+ this.videoPreviewErrorMessage = "Impossibile aprire l'anteprima di un file video.";
411
+ this.audioPreviewErrorMessage = "Impossibile aprire l'anteprima di un file audio.";
412
+ this.flipHorinzontalLabel = "Capovolgi orizzontalmente";
413
+ this.flipVerticalLabel = "Capovolgi verticalmente";
414
+ this.rotateRightLabel = "Ruota a destra";
415
+ this.rotateLeftLabel = "Ruota a sinistra";
416
+ //#endregion
417
+ //#region @Output del componente
418
+ /**
419
+ * Restituisce la lista aggiornata degli allegati.
420
+ */
421
+ this.localEditedAttachments = new EventEmitter();
422
+ /**
423
+ * Evento scatenato alla pressione del pulsante ESCI della modale di caricamento file.
424
+ */
425
+ this.abortAddAttachment = new EventEmitter();
426
+ /**
427
+ * Evento di output che restituisce l'IAttachmentDTO selezionato per il download nel caso FileDataBase64, FileContentType o FileName non fossero specificati.
428
+ */
429
+ this.downloadAttachment = new EventEmitter();
430
+ /**
431
+ * Evento di output che restituisce l'elemento eliminato prima che questo venga effettivamente rismosso dalla lista.
432
+ */
433
+ this.onDeleteAttachment = new EventEmitter();
434
+ //#endregion
435
+ //#region Proprietà per gestione caricamento nuovo allegato
436
+ this.newAttachment = {};
437
+ this.newMultipleAttachments = [];
438
+ this.attachmentType = AttachmentType;
439
+ this.selectedFile = null;
440
+ this.selectedFiles = null;
441
+ this.showCropImage = false;
442
+ //#endregion
443
+ //#region Proprietà per gestione ridimensionamento file di tipo image
444
+ this.imageChangedEvent = "";
445
+ this.croppedImage = "";
446
+ this.transform = {};
447
+ this.canvasRotation = 0;
448
+ //#endregion
449
+ this.AttachmentType = AttachmentType;
450
+ this.addingLinkMode = false;
451
+ }
452
+ ngOnInit() {
453
+ return __awaiter(this, void 0, void 0, function* () {
454
+ //Se è stata richiesta la gestione delle sole immagini allora imposta il filtro per le estensioni possibili da caricare
455
+ if (!this.acceptedFileTypes)
456
+ if (this.allowOnlyImages == true)
457
+ this.acceptedFileTypes = "image/*";
458
+ else
459
+ this.acceptedFileTypes = "*";
460
+ // Se non sono stati specificati i tipi da gestire ma è stato passato null o un array vuoto imposto i tipi di default.
461
+ if (!this.allowedTypes || this.allowedTypes.length == 0)
462
+ this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK, AttachmentType.DROPBOX];
463
+ else if (this.allowedTypes.find((t) => t != AttachmentType.FILE && t != AttachmentType.LINK && t != AttachmentType.DROPBOX)) {
464
+ EqpAttachmentDialogService.Warning('Almeno uno degli AttachmentType selezionati nel parametro "allowedTypes" non esiste.');
465
+ this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK, AttachmentType.DROPBOX];
466
+ }
467
+ //Se è stata richiesta la gestione multipla degli allegati allora configura l'eqp-table
468
+ if (this.multipleAttachment == true && (!this.attachmentsColumns || this.attachmentsColumns.length == 0)) {
469
+ this.configureColumns();
470
+ }
471
+ if (this.attachmentsList == null)
472
+ this.attachmentsList = new Array();
473
+ this.checkAttachmentImage();
474
+ if (this.allowedTypes.includes(3)) {
475
+ this.eqpAttachmentService.loadDropboxScript();
476
+ }
477
+ });
478
+ }
479
+ reloadData() {
480
+ if (this.attachmentTable)
481
+ this.attachmentTable.reloadDatatable();
482
+ }
483
+ checkAttachmentImage() {
484
+ this.attachmentsList.forEach((a) => {
485
+ a.IsImage = AttachmentHelperService.checkImageFromMimeType(a.FileContentType);
486
+ });
487
+ }
488
+ //#region Gestione elenco allegati
489
+ /**
490
+ * Configura le colonne per l'eqp-table nel caso in cui il parametro "multipleAttachments" è TRUE.
491
+ */
492
+ configureColumns() {
493
+ this.attachmentsColumns = [];
494
+ if (this.disableAction != true) {
495
+ this.attachmentsColumns.push({
496
+ key: "action",
497
+ display: "",
498
+ type: TypeColumn.MenuAction,
499
+ buttonMenuIcon: "more_vert",
500
+ styles: { flex: "0 0 6%" },
501
+ actions: [
502
+ { name: this.deleteLabel, icon: "delete", fn: (element, index, col) => this.deleteAttachment(element) }
503
+ ]
504
+ });
505
+ }
506
+ let downloadColumn = {
507
+ key: "attachment",
508
+ display: "",
509
+ type: TypeColumn.SimpleAction,
510
+ styles: { flex: "0 0 6%" },
511
+ actions: [
512
+ {
513
+ name: "",
514
+ fontawesome: true,
515
+ icon: (element) => {
516
+ return this.showInlinePreview
517
+ ? element.AttachmentType == AttachmentType.FILE
518
+ ? "fas fa-cloud-download-alt"
519
+ : "fas fa-external-link-alt"
520
+ : this.getAttachmentIcon(element);
521
+ },
522
+ fn: (element, col, elementIndex) => this.viewAttachment(element),
523
+ tooltip: {
524
+ tooltipText: (element) => {
525
+ return element.AttachmentType == AttachmentType.FILE ? this.downloadLabel : this.openLinkLabel;
526
+ },
527
+ tooltipPosition: this.downloadTooltipPosition
528
+ }
529
+ }
530
+ ]
531
+ };
532
+ let inlinePreviewColumn = {
533
+ key: "InlinePreview",
534
+ display: this.previewLabel,
535
+ type: TypeColumn.ExternalTemplate,
536
+ externalTemplate: this.inlinePreviewTemplate,
537
+ styles: { flex: "0 0 10%" }
538
+ };
539
+ let fileNameColumn = { key: "FileName", display: this.fileNameLabel };
540
+ if (this.showInlinePreview) {
541
+ this.attachmentsColumns.push(inlinePreviewColumn);
542
+ this.attachmentsColumns.push(fileNameColumn);
543
+ this.attachmentsColumns.push(downloadColumn);
544
+ }
545
+ else {
546
+ this.attachmentsColumns.push(downloadColumn);
547
+ this.attachmentsColumns.push(fileNameColumn);
548
+ }
549
+ }
550
+ /**
551
+ * Elimina un allegato eliminando anche il file presente nello storage di archiviazione utilizzato (AWS o cartella progetto)
552
+ * @param element IAttachmentDTO da cancellare
553
+ */
554
+ deleteAttachment(element) {
555
+ EqpAttachmentDialogService.Confirm(this.deleteDialogMessage, () => {
556
+ this.removeAttachmentFromList(this.attachmentsList.indexOf(element));
557
+ }, true, this.deleteDialogTitle);
558
+ }
559
+ /**
560
+ * Rimuove l'allegato selezionato dalla lista "attachmentsList" e invoca l'evento di output che restituisce la lista aggiornata.
561
+ * @param attachmentIndex Indice dell'attachment da rimuovere
562
+ */
563
+ removeAttachmentFromList(attachmentIndex) {
564
+ this.onDeleteAttachment.emit(this.attachmentsList[attachmentIndex]);
565
+ this.attachmentsList.splice(attachmentIndex, 1);
566
+ if (this.attachmentTable)
567
+ this.attachmentTable.reloadDatatable();
568
+ this.localEditedAttachments.emit(this.attachmentsList);
569
+ }
570
+ /**
571
+ * Scarica l'allegato o apre il link
572
+ * @param element Allegato da mostrare
573
+ */
574
+ viewAttachment(attachment) {
575
+ if (attachment.AttachmentType == AttachmentType.LINK) {
576
+ window.open(attachment.FilePath, "_blank");
577
+ return;
578
+ }
579
+ if (attachment.FileDataBase64 && attachment.FileContentType && attachment.FileName) {
580
+ let source = `data:${attachment.FileContentType};base64,${attachment.FileDataBase64}`;
581
+ const link = document.createElement("a");
582
+ link.href = source;
583
+ link.download = `${attachment.FileName}`;
584
+ link.click();
585
+ }
586
+ else {
587
+ this.downloadAttachment.emit(attachment);
588
+ }
589
+ }
590
+ /**
591
+ * Ridefinisce l'icona da mostrare nella colonna dell'eqp-table per ogni file.
592
+ * L'icona varia in base all'estensione del file
593
+ * @param attachment
594
+ */
595
+ getAttachmentIcon(attachment) {
596
+ if (attachment.AttachmentType == AttachmentType.LINK)
597
+ return "fas fa-link";
598
+ else
599
+ return AttachmentHelperService.getIconFromFileExtensione(attachment.FileExtension);
600
+ }
601
+ //#endregion
602
+ /**
603
+ * In caso di allegato singolo, sceglie quale metodo richiamare in base al tipo di allegato
604
+ */
605
+ addFile(attachmentType, imageInput = null) {
606
+ if (attachmentType == AttachmentType.LINK) {
607
+ this.switchToAddingLinkMode();
608
+ }
609
+ else if (attachmentType == AttachmentType.FILE) {
610
+ imageInput.click();
611
+ }
612
+ else {
613
+ this.chooseDropboxFile();
614
+ }
615
+ }
616
+ createAttachmentForm() {
617
+ //Crea la form per la validazione dei campi
618
+ this.newAttachmentForm = this.formBuilder.group({
619
+ type: [this.newAttachment.AttachmentType, Validators.required],
620
+ name: [this.newAttachment.FileName],
621
+ path: [this.newAttachment.FilePath],
622
+ customHeight: [this.customHeight],
623
+ customWidth: [this.customWidth]
624
+ });
625
+ }
626
+ close(emitCloseEvent = true) {
627
+ this.newAttachment = {};
628
+ this.newMultipleAttachments = new Array();
629
+ this.abortFile();
630
+ if (this.newAttachmentForm)
631
+ this.newAttachmentForm.reset();
632
+ this.dialogRefCropImage.close();
633
+ this.restoreOriginalDimensions();
634
+ if (emitCloseEvent == true && this.abortAddAttachment)
635
+ this.abortAddAttachment.emit();
636
+ }
637
+ /**
638
+ * In base al tipo di allegato controlla se disabilitare o meno il pulsante per salvare.
639
+ * Funzione usata nel [disable] del pulsante "Salva" del dialog per l'aggiunta di un allegato.
640
+ * @returns
641
+ */
642
+ disableSave() {
643
+ if (this.loadMultipleFiles != true) {
644
+ if (this.newAttachment.AttachmentType == AttachmentType.FILE) {
645
+ return !this.newAttachment.FileDataBase64;
646
+ }
647
+ else {
648
+ return !this.newAttachment.FilePath;
649
+ }
650
+ }
651
+ else {
652
+ return (this.newMultipleAttachments.filter((p) => (p.AttachmentType == AttachmentType.FILE && !p.FileDataBase64) ||
653
+ (p.AttachmentType == AttachmentType.LINK && !p.FilePath)).length > 0);
654
+ }
655
+ }
656
+ confirmAddAttachment() {
657
+ if (this.newAttachment.IsImage) {
658
+ this.newAttachment.FileDataBase64 = this.imageCropper.crop().base64.split(";base64,")[1];
659
+ }
660
+ if (this.loadMultipleFiles != true) {
661
+ if (this.newAttachment.AttachmentType == AttachmentType.LINK && !this.newAttachment.FileName)
662
+ this.newAttachment.FileName = this.newAttachment.FilePath;
663
+ if (this.attachmentsList == null)
664
+ this.attachmentsList = new Array();
665
+ this.attachmentsList.push(this.newAttachment);
666
+ }
667
+ else {
668
+ if (this.newMultipleAttachments == null || this.newMultipleAttachments.length == 0)
669
+ return;
670
+ if (this.attachmentsList == null)
671
+ this.attachmentsList = new Array();
672
+ this.attachmentsList = this.attachmentsList.concat(this.newMultipleAttachments);
673
+ }
674
+ if (this.attachmentTable)
675
+ this.attachmentTable.reloadDatatable();
676
+ this.localEditedAttachments.emit(this.attachmentsList);
677
+ if (this.newAttachment.IsImage) {
678
+ this.dialogRefCropImage.close();
679
+ this.restoreOriginalDimensions();
680
+ }
681
+ }
682
+ /**
683
+ * Apre il dialog per l'anteprima dell'allegato selezionato.
684
+ * @param row
685
+ * @returns
686
+ */
687
+ openPreviewDialog(row) {
688
+ return __awaiter(this, void 0, void 0, function* () {
689
+ this.selectedAttachment = JSON.parse(JSON.stringify(row));
690
+ if (this.selectedAttachment.AttachmentType == AttachmentType.FILE) {
691
+ if (this.selectedAttachment.FileContentType.startsWith("video")) {
692
+ EqpAttachmentDialogService.Warning(this.videoPreviewErrorMessage);
693
+ return;
694
+ }
695
+ else if (this.selectedAttachment.FileContentType.startsWith("audio")) {
696
+ EqpAttachmentDialogService.Warning(this.audioPreviewErrorMessage);
697
+ return;
698
+ }
699
+ }
700
+ if (this.getAttachmentEndpoint && this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64) {
701
+ yield this.getAttachmentByID()
702
+ .then((res) => {
703
+ this.selectedAttachment.FileDataBase64 = res.FileDataBase64;
704
+ })
705
+ .catch((err) => {
706
+ EqpAttachmentDialogService.Error(err);
707
+ });
708
+ }
709
+ if (this.selectedAttachment.AttachmentType == AttachmentType.LINK) {
710
+ this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.selectedAttachment.FilePath);
711
+ }
712
+ else if (this.selectedAttachment.IsImage &&
713
+ !this.selectedAttachment.FileDataBase64 &&
714
+ !this.selectedAttachment.FileThumbnailBase64) {
715
+ EqpAttachmentDialogService.Info("Impossibile aprire l'anteprima dell'allegato, file mancante.");
716
+ return;
717
+ }
718
+ else if (!this.selectedAttachment.IsImage) {
719
+ if (this.selectedAttachment.FilePath && this.productionBaseUrl) {
720
+ this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl("https://docs.google.com/gview?url=" +
721
+ this.productionBaseUrl +
722
+ "/" +
723
+ this.selectedAttachment.FilePath +
724
+ "&embedded=true");
725
+ }
726
+ else {
727
+ EqpAttachmentDialogService.Info("Impossibile aprire l'anteprima del documento!");
728
+ return;
729
+ }
730
+ }
731
+ this.dialog.open(this.dialogPreview, {
732
+ disableClose: true,
733
+ hasBackdrop: true
734
+ });
735
+ });
736
+ }
737
+ getAttachmentByID() {
738
+ return __awaiter(this, void 0, void 0, function* () {
739
+ return this.http.post(this.getAttachmentEndpoint, this.selectedAttachment).toPromise();
740
+ });
741
+ }
742
+ //#region Gestione caricamento file
743
+ /**
744
+ * Evento scatenato alla selezione del file (o dei file).
745
+ * Se il caricamento è SINGOLO o se comunque è stato selezionato un solo file allora si occupa di controllare se si tratta di un immagine in modo da
746
+ * mostrare le funzionalità del croppie (per ritagliare l'immagine) oppure no.
747
+ * Se il file caricato non è un immagine allora genera direttamente il base64 e lo associa all'allegato da salvare.
748
+ * Se invece il caricamento dei file è MULTIPLO e sono presenti più file allora esegue le stesse operazioni ignorando però il contrllo
749
+ * immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
750
+ */
751
+ onFileAdded(event, isFileDropped = false) {
752
+ return __awaiter(this, void 0, void 0, function* () {
753
+ this.showCropImage = false;
754
+ let filesOnInput = isFileDropped ? event : event.target.files;
755
+ //Se è stato richiesto il caricamento SINGOLO oppure se il caricamento è MULTIPLO ma è stato selezionato un solo file
756
+ //allora verifica se il file è un immagine (per mostrare il CROPPIE)
757
+ if ([...filesOnInput].length == 1 || this.loadMultipleFiles != true) {
758
+ this.selectedFile = filesOnInput[0];
759
+ this.selectedFiles = filesOnInput;
760
+ if (!this.selectedFile)
761
+ return;
762
+ //Memorizza i dati per l'allegato
763
+ this.newAttachment = yield this.createAttachmentFromUploadedFile(this.selectedFile, false);
764
+ this.newMultipleAttachments = new Array();
765
+ this.newMultipleAttachments.push(this.newAttachment);
766
+ //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine
767
+ let checkOnlyImage = this.checkAllowOnlyImageFile(this.newAttachment);
768
+ if (checkOnlyImage == false)
769
+ return;
770
+ this.createAttachmentForm();
771
+ //Verifica se il file caricato è un'immagine oppure no. Se è un immagine, prima di caricarla mostra il croppie per il resize.
772
+ //Se non è un immagine allora genera il Base64
773
+ if (this.newAttachment.IsImage == true) {
774
+ this.getImageDimensions(filesOnInput[0]);
775
+ //Mostra il croppie e disabilita la form finchè non termina la modifica dell'immagine
776
+ this.newAttachmentForm.disable();
777
+ this.newAttachmentForm.controls["customWidth"].enable();
778
+ this.newAttachmentForm.controls["customHeight"].enable();
779
+ this.showCropImage = true;
780
+ this.imageFile = event;
781
+ this.dialogRefCropImage = this.dialog.open(this.dialogCropImage, {
782
+ disableClose: true,
783
+ hasBackdrop: true,
784
+ width: "60%",
785
+ maxHeight: "80%",
786
+ maxWidth: "70vh"
787
+ });
788
+ }
789
+ else {
790
+ this.showCropImage = false;
791
+ let base64Result = yield this.getBase64FromFile(this.selectedFile);
792
+ this.newAttachment.FileDataBase64 = base64Result.Base64File;
793
+ this.newAttachment.FileContentType = base64Result.ContentType;
794
+ this.confirmAddAttachment();
795
+ }
796
+ }
797
+ else {
798
+ this.selectedFiles = filesOnInput;
799
+ if (!this.selectedFiles || this.selectedFiles.length == 0)
800
+ return;
801
+ this.newMultipleAttachments = new Array();
802
+ for (let i = 0; i < this.selectedFiles.length; i++) {
803
+ let newAttachment = yield this.createAttachmentFromUploadedFile(this.selectedFiles[i], true, true);
804
+ //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine
805
+ let checkOnlyImage = this.checkAllowOnlyImageFile(newAttachment);
806
+ if (checkOnlyImage == false)
807
+ return;
808
+ this.newMultipleAttachments.push(newAttachment);
809
+ }
810
+ this.confirmAddAttachment();
811
+ }
812
+ //Resetto il valore del file input in modo da scatenare il change anche se si dovesse caricare lo stesso file
813
+ if (!isFileDropped)
814
+ event.target.value = "";
815
+ });
816
+ }
817
+ /**
818
+ * A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
819
+ * Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
820
+ * ricava il ContentType da associare all'oggetto IAttachmentDTO da restituire
821
+ * @param currentFile Oggetto FILE da processare
822
+ * @param getBase64 Se TRUE allora calcola base64 e ContentType del file passato in input
823
+ * @returns Restituisce un oggetto di tipo IAttachmentDTO
824
+ */
825
+ createAttachmentFromUploadedFile(currentFile, getBase64 = true, cropFile = false) {
826
+ return __awaiter(this, void 0, void 0, function* () {
827
+ let newAttachment = {};
828
+ //Memorizza i dati per l'allegato
829
+ newAttachment.AttachmentType = AttachmentType.FILE;
830
+ newAttachment.FileContentType = currentFile.type;
831
+ newAttachment.FileName = currentFile.name;
832
+ newAttachment.FileExtension = currentFile.name.substr(currentFile.name.lastIndexOf(".") + 1);
833
+ newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(currentFile.type);
834
+ if (getBase64 == true) {
835
+ let base64Result = yield this.getBase64FromFile(currentFile);
836
+ newAttachment.FileDataBase64 = base64Result.Base64File;
837
+ newAttachment.FileContentType = base64Result.ContentType;
838
+ if (newAttachment.IsImage && newAttachment.FileDataBase64 && cropFile) {
839
+ this.getCroppedAndUpload(`data:${base64Result.ContentType};base64,${base64Result.Base64File}`, newAttachment);
840
+ }
841
+ }
842
+ return newAttachment;
843
+ });
844
+ }
845
+ /**
846
+ * A partire dal file passato in input restituisce un oggetto
847
+ * contenente il base64 del file e il suo contentType
848
+ * @param currentFile Oggetto File da cui estrapolare base64 e contentType
849
+ * @returns Restituisce un oggetto avente le proprietà Base64File e ContentType
850
+ */
851
+ getBase64FromFile(currentFile) {
852
+ return __awaiter(this, void 0, void 0, function* () {
853
+ let base64File = yield toBase64(currentFile);
854
+ let contentType = null;
855
+ if (base64File) {
856
+ // Loris 20/01/2022: PROBLEMA - Quando eseguo l'upload di un file .sql non viene salvato/scaricato correttamente.
857
+ // Questo succede perchè non viene popolato il FileContentType. Per risolvere il problema
858
+ // faccio un controllo e se non esiste il FileContentType allora lo recupero dal base64 ottenuto.
859
+ contentType = base64File.split(",")[0].split(":")[1].split(";")[0];
860
+ // Un altro metodo per leggere il ccontent type del file è tramite una regular expression:
861
+ base64File = base64File.split(",")[1];
862
+ }
863
+ let result = {
864
+ Base64File: base64File,
865
+ ContentType: contentType
866
+ };
867
+ return result;
868
+ });
869
+ }
870
+ /**
871
+ * Controlla se il file che si sta caricando è supportato dal sistema.
872
+ * @returns
873
+ */
874
+ checkAcceptedFiles() {
875
+ if ((this.loadMultipleFiles != true && this.selectedFile.type.startsWith("video")) ||
876
+ (this.loadMultipleFiles == true && [...this.selectedFiles].filter((p) => p.type.startsWith("video")).length > 0))
877
+ return false;
878
+ if (this.acceptedFileTypes == "*")
879
+ return true;
880
+ //Verifica che i tipi del file (o dei file) caricati siano coerenti con quelli accettati dalla direttiva
881
+ let accepted = true;
882
+ if (this.loadMultipleFiles != true)
883
+ accepted = this.acceptedFileTypes.includes(this.selectedFile.type);
884
+ else {
885
+ let uploadedFileTypes = [...this.selectedFiles].map((p) => p.type);
886
+ uploadedFileTypes.forEach((type) => {
887
+ if (!this.acceptedFileTypes.includes(type))
888
+ accepted = false;
889
+ });
890
+ }
891
+ //Questo controllo permette di gestire le casistiche per cui vengono indicati come tipi validi, ad esempio, 'image/*'
892
+ if (!accepted && this.loadMultipleFiles != true) {
893
+ for (let t of this.acceptedFileTypes.split(",").filter((t) => t.includes("*"))) {
894
+ accepted = this.selectedFile.type.startsWith(t.split("*")[0]);
895
+ if (accepted)
896
+ break;
897
+ }
898
+ }
899
+ return accepted;
900
+ }
901
+ /**
902
+ * Se eqp-attachments è stata configurata per il caricamento delle sole immagini allora verifica che il file passato in
903
+ * input sia effettivamente un immagine o no.
904
+ * Se il controllo va a buon fine restituisce TRUE altrimenti mostra un messaggio d'errore e restituisce FALSE
905
+ */
906
+ checkAllowOnlyImageFile(newAttachment) {
907
+ if (this.allowOnlyImages == true && newAttachment.IsImage != true) {
908
+ EqpAttachmentDialogService.Error(this.noImageSelectedErrorMessage);
909
+ this.abortFile();
910
+ return false;
911
+ }
912
+ else if (!this.checkAcceptedFiles()) {
913
+ EqpAttachmentDialogService.Error(this.wrongTypeSelectedErrorMessage);
914
+ this.abortFile();
915
+ return false;
916
+ }
917
+ return true;
918
+ }
919
+ //#region Gestione crop file
920
+ getImageDimensions(img) {
921
+ const reader = new FileReader();
922
+ reader.onload = (e) => {
923
+ const image = new Image();
924
+ image.src = e.target.result;
925
+ image.onload = (rs) => {
926
+ this.originalHeight = rs.currentTarget["height"];
927
+ this.originalWidth = rs.currentTarget["width"];
928
+ if (this.originalWidth > 1280) {
929
+ this.customWidth = 1280;
930
+ this.customHeight = Math.round((1280 * this.originalHeight) / this.originalWidth);
931
+ }
932
+ else {
933
+ this.customHeight = rs.currentTarget["height"];
934
+ this.customWidth = rs.currentTarget["width"];
935
+ }
936
+ };
937
+ };
938
+ reader.readAsDataURL(img);
939
+ }
940
+ restoreOriginalDimensions() {
941
+ this.customWidth = this.originalWidth;
942
+ this.customHeight = this.originalHeight;
943
+ this.canvasRotation = 0;
944
+ this.transform = {};
945
+ }
946
+ onDimensionsChange(dimension) {
947
+ if (dimension == "H") {
948
+ this.customWidth = Math.round((this.customHeight * this.originalWidth) / this.originalHeight);
949
+ }
950
+ else if (dimension == "W") {
951
+ this.customHeight = Math.round((this.customWidth * this.originalHeight) / this.originalWidth);
952
+ }
953
+ }
954
+ imageCropped(event) {
955
+ this.croppedImage = event.base64;
956
+ this.getCroppedAndUpload(this.croppedImage, this.newAttachment);
957
+ }
958
+ getCroppedAndUpload(file, newAttachment) {
959
+ var self = this;
960
+ var file = base64ToFile(file);
961
+ const options = this.compressionOptions;
962
+ /**
963
+ * Comprime l'immagine passando come parametri le options create nell'oggetto sopra, e il file dal reader principale
964
+ */
965
+ imageCompression(file, options).then((fileCompressed) => {
966
+ let fileReader = new FileReader();
967
+ //Faccio la push di ogni file all'interno dell'array di file dell'item da mandare al server
968
+ fileReader.onload = function () {
969
+ let resultReader = fileReader.result;
970
+ var marker = ";base64,";
971
+ newAttachment.FileDataBase64 = resultReader.substring(resultReader.indexOf(marker) + marker.length);
972
+ self.showCropImage = false;
973
+ if (self.newAttachmentForm) {
974
+ self.newAttachmentForm.enable();
975
+ }
976
+ };
977
+ fileReader.readAsDataURL(fileCompressed);
978
+ });
979
+ }
980
+ // confirmCrop() {
981
+ // this.imageCropper.crop();
982
+ // this.dialogRefCropImage.close();
983
+ // this.restoreOriginalDimensions();
984
+ // }
985
+ rotateLeft() {
986
+ this.canvasRotation--;
987
+ this.flipAfterRotate();
988
+ }
989
+ rotateRight() {
990
+ this.canvasRotation++;
991
+ this.flipAfterRotate();
992
+ }
993
+ flipAfterRotate() {
994
+ const flippedH = this.transform.flipH;
995
+ const flippedV = this.transform.flipV;
996
+ this.transform = Object.assign(Object.assign({}, this.transform), { flipH: flippedV, flipV: flippedH });
997
+ }
998
+ flipHorizontal() {
999
+ this.transform = Object.assign(Object.assign({}, this.transform), { flipH: !this.transform.flipH });
1000
+ }
1001
+ flipVertical() {
1002
+ this.transform = Object.assign(Object.assign({}, this.transform), { flipV: !this.transform.flipV });
1003
+ }
1004
+ //#endregion
1005
+ /**
1006
+ * Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO
1007
+ */
1008
+ abortFile() {
1009
+ if (this.imageInput)
1010
+ this.imageInput.nativeElement.value = "";
1011
+ this.selectedFile = null;
1012
+ this.selectedFiles = null;
1013
+ this.showCropImage = false;
1014
+ this.newAttachment.IsImage = false;
1015
+ this.newAttachment.FileDataBase64 = null;
1016
+ this.newAttachment.FileName = null;
1017
+ this.newAttachment.FileExtension = null;
1018
+ this.newAttachment.FileContentType = null;
1019
+ this.newMultipleAttachments = new Array();
1020
+ this.customHeight = null;
1021
+ this.customWidth = null;
1022
+ this.originalHeight = null;
1023
+ this.originalWidth = null;
1024
+ this.dialogRefCropImage.close();
1025
+ this.restoreOriginalDimensions();
1026
+ }
1027
+ //#endregion
1028
+ // Viene creato un'array observables per memorizzare tutti gli observable creati dalle chiamate a fileEntry.file().
1029
+ // Dopo che tutti gli observables sono stati completati, viene utilizzato il metodo subscribe() per eseguire la funzione onFileAdded().
1030
+ fileDropped(files) {
1031
+ let filesDropped = [];
1032
+ const observables = [];
1033
+ for (let i = 0; i < files.length; i++) {
1034
+ if (files[i].fileEntry.isFile) {
1035
+ const fileEntry = files[i].fileEntry;
1036
+ const observable = new Observable((observer) => {
1037
+ fileEntry.file((file) => {
1038
+ filesDropped.push(file);
1039
+ observer.next(file);
1040
+ observer.complete();
1041
+ });
1042
+ });
1043
+ observables.push(observable);
1044
+ }
1045
+ else {
1046
+ const fileEntry = files[i].fileEntry;
1047
+ console.log(files[i].relativePath, fileEntry);
1048
+ }
1049
+ }
1050
+ from(observables)
1051
+ .pipe(concatMap((observable) => observable))
1052
+ .subscribe({
1053
+ complete: () => {
1054
+ this.onFileAdded(filesDropped, true);
1055
+ }
1056
+ });
1057
+ }
1058
+ // Se il caricamento del file dropbox va a buon fine, la funzione di callback restituisce un array di oggetti.
1059
+ // Viene poi fatta una XMLHttpRequest con responseType 'blob' per convertire il primo elemento della response in un Blob.
1060
+ chooseDropboxFile() {
1061
+ var options = {
1062
+ success: (files) => {
1063
+ const xhr = new XMLHttpRequest();
1064
+ xhr.open("GET", files[0].link);
1065
+ xhr.setRequestHeader("Authorization", `Bearer ${AttachmentHelperService.dropboxCredentials.accessToken}`);
1066
+ xhr.responseType = "blob";
1067
+ xhr.onload = () => {
1068
+ const blob = xhr.response;
1069
+ const file = new File([blob], files[0].name, { type: blob.type });
1070
+ let filesAdded = [file];
1071
+ this.onFileAdded(filesAdded, true);
1072
+ };
1073
+ xhr.send();
1074
+ },
1075
+ linkType: "direct",
1076
+ multiselect: false,
1077
+ extensions: [".jpg", ".png", ".pdf", ".doc", ".docx", ".txt"]
1078
+ };
1079
+ Dropbox.choose(options);
1080
+ }
1081
+ // Workaround dropzone: disabilito il click degli elementi inclusi nella dropzone per evitare di cliccare due volte
1082
+ onSelectFile(event, fileInput) {
1083
+ if (event.target.tagName === "BUTTON" ||
1084
+ event.target.tagName === "INPUT" ||
1085
+ this.addingLinkMode == true) {
1086
+ return;
1087
+ }
1088
+ fileInput.click();
1089
+ }
1090
+ // Metodo per visualizzare la form di aggiunta di un link
1091
+ switchToAddingLinkMode() {
1092
+ this.addingLinkMode = true;
1093
+ this.newAttachment = {};
1094
+ this.newAttachment.IsImage = false;
1095
+ this.newAttachment.AttachmentType = this.attachmentType.LINK;
1096
+ this.newMultipleAttachments = new Array();
1097
+ this.newMultipleAttachments.push(this.newAttachment);
1098
+ this.createAttachmentForm();
1099
+ }
1100
+ }
1101
+ EqpAttachmentsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentsComponent, deps: [{ token: i1.MatDialog }, { token: i2.FormBuilder }, { token: i3.DomSanitizer }, { token: i4.HttpClient }, { token: i0.ChangeDetectorRef }, { token: EqpAttachmentService }], target: i0.ɵɵFactoryTarget.Component });
1102
+ EqpAttachmentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: EqpAttachmentsComponent, selector: "eqp-attachments", inputs: { disableAction: "disableAction", showHeader: "showHeader", headerTitle: "headerTitle", attachmentsList: "attachmentsList", showMatCard: "showMatCard", multipleAttachment: "multipleAttachment", loadMultipleFiles: "loadMultipleFiles", attachmentsColumns: "attachmentsColumns", emptyTableMessage: "emptyTableMessage", allowOnlyImages: "allowOnlyImages", acceptedFileTypes: "acceptedFileTypes", isDisabled: "isDisabled", showInlinePreview: "showInlinePreview", getAttachmentEndpoint: "getAttachmentEndpoint", productionBaseUrl: "productionBaseUrl", compressionOptions: "compressionOptions", allowedTypes: "allowedTypes", isEqpTableMultiLanguage: "isEqpTableMultiLanguage", tablePaginatorVisible: "tablePaginatorVisible", isTableSearcheable: "isTableSearcheable", tablePaginatorSize: "tablePaginatorSize", separatedUploadButtons: "separatedUploadButtons", showPreview: "showPreview", singleAttachmentDragAndDrop: "singleAttachmentDragAndDrop", cropOptions: "cropOptions", cropDialogClass: "cropDialogClass", downloadTooltipPosition: "downloadTooltipPosition", openLinkLabel: "openLinkLabel", addButtonLabel: "addButtonLabel", downloadLabel: "downloadLabel", deleteLabel: "deleteLabel", fileNameLabel: "fileNameLabel", previewLabel: "previewLabel", uploadFileLabel: "uploadFileLabel", confirmLabel: "confirmLabel", abortLabel: "abortLabel", saveLabel: "saveLabel", exitLabel: "exitLabel", uploadWithDropboxLabel: "uploadWithDropboxLabel", cropLabel: "cropLabel", eqpTableSearchText: "eqpTableSearchText", deleteDialogTitle: "deleteDialogTitle", deleteDialogMessage: "deleteDialogMessage", noImageSelectedErrorMessage: "noImageSelectedErrorMessage", wrongTypeSelectedErrorMessage: "wrongTypeSelectedErrorMessage", videoPreviewErrorMessage: "videoPreviewErrorMessage", audioPreviewErrorMessage: ["videoPreviewErrorMessage", "audioPreviewErrorMessage"], flipHorinzontalLabel: "flipHorinzontalLabel", flipVerticalLabel: "flipVerticalLabel", rotateRightLabel: "rotateRightLabel", rotateLeftLabel: "rotateLeftLabel" }, outputs: { localEditedAttachments: "localEditedAttachments", abortAddAttachment: "abortAddAttachment", downloadAttachment: "downloadAttachment", onDeleteAttachment: "onDeleteAttachment" }, viewQueries: [{ propertyName: "dialogAddAttachment", first: true, predicate: ["dialogAddAttachment"], descendants: true, static: true }, { propertyName: "dialogAddMultipleAttachment", first: true, predicate: ["dialogAddMultipleAttachment"], descendants: true, static: true }, { propertyName: "dialogCropImage", first: true, predicate: ["dialogCropImage"], descendants: true, static: true }, { propertyName: "imageCropper", first: true, predicate: ImageCropperComponent, descendants: true }, { propertyName: "imageInput", first: true, predicate: ["imageInput"], descendants: true }, { propertyName: "attachmentTable", first: true, predicate: ["attachmentTable"], descendants: true }, { propertyName: "inlinePreviewTemplate", first: true, predicate: ["inlinePreviewTemplate"], descendants: true, static: true }, { propertyName: "dialogPreview", first: true, predicate: ["dialogPreview"], descendants: true, static: true }], ngImport: i0, template: "<!-- Se richiesta la gestione singola mostra il pulsante di caricamento di un singolo file -->\r\n<div *ngIf=\"multipleAttachment != true\">\r\n <div *ngIf=\"!singleAttachmentDragAndDrop\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <div *ngIf=\"!addingLinkMode\" class=\"text-center\">\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n </div>\r\n <!-- Template della form per l'aggiunta di un link -->\r\n <div *ngIf=\"addingLinkMode\" class=\"text-center\">\r\n <ng-container *ngTemplateOutlet=\"addingLinkTemplate\"></ng-container>\r\n </div>\r\n </div>\r\n <div *ngIf=\"singleAttachmentDragAndDrop\">\r\n <input\r\n #fileInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <ngx-file-drop\r\n (onFileDrop)=\"fileDropped($event)\"\r\n (click)=\"onSelectFile($event, fileInput)\"\r\n *ngIf=\"\r\n allowedTypes &&\r\n allowedTypes.includes(1) &&\r\n (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \">\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"!addingLinkMode\">\r\n <i class=\"fa-solid fa-cloud-upload-alt fa-3x mt-3\"></i>\r\n Trascina i file qui\r\n <div class=\"btn-group mt-1\" role=\"group\">\r\n <button type=\"button\" class=\"btn btn-light border-end\" (click)=\"fileInput.click()\">Scegli un file</button>\r\n <div class=\"btn-group\" role=\"group\">\r\n <button\r\n type=\"button\"\r\n class=\"btn btn-light border-start dropdown-toggle\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\"></button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n mat-menu-item\r\n (click)=\"fileInput.click()\"\r\n class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n mat-menu-item\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n mat-menu-item\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </mat-menu>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"addingLinkMode\">\r\n <ng-container *ngTemplateOutlet=\"addingLinkTemplate\"></ng-container>\r\n </ng-template>\r\n </ngx-file-drop>\r\n </div>\r\n <div class=\"text-center\">\r\n <button\r\n class=\"mb-2 me-2 eqp-attachments-download-btn\"\r\n (click)=\"viewAttachment(attachmentsList[0])\"\r\n type=\"button\"\r\n mat-raised-button\r\n *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\"\r\n color=\"primary\">\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType == AttachmentType.FILE\">download</mat-icon>\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType != AttachmentType.FILE\">open_in_new</mat-icon>\r\n {{ attachmentsList[0].AttachmentType == AttachmentType.FILE ? downloadLabel : openLinkLabel }}\r\n </button>\r\n <button\r\n class=\"mb-2 me-2 eqp-attachments-preview-btn\"\r\n (click)=\"openPreviewDialog(attachmentsList[0])\"\r\n type=\"button\"\r\n mat-raised-button\r\n color=\"primary\"\r\n *ngIf=\"\r\n showPreview &&\r\n attachmentsList &&\r\n attachmentsList.length > 0 &&\r\n attachmentsList[0] &&\r\n (!attachmentsList[0].FileContentType ||\r\n (!attachmentsList[0].FileContentType.startsWith('video') &&\r\n !attachmentsList[0].FileContentType.startsWith('audio'))) &&\r\n attachmentsList[0].IsImage == true\r\n \">\r\n <mat-icon>visibility</mat-icon> {{ previewLabel }}\r\n </button>\r\n <button\r\n class=\"mb-2 eqp-attachments-delete-btn\"\r\n (click)=\"deleteAttachment(attachmentsList[0])\"\r\n type=\"button\"\r\n mat-raised-button\r\n *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\"\r\n [disabled]=\"isDisabled\">\r\n <mat-icon>delete</mat-icon> {{ deleteLabel }}\r\n </button>\r\n </div>\r\n <div\r\n class=\"row\"\r\n style=\"margin-top: 10px\"\r\n *ngIf=\"\r\n attachmentsList.length > 0 &&\r\n attachmentsList[0] &&\r\n attachmentsList[0].FileDataBase64 &&\r\n attachmentsList[0].IsImage == true\r\n \">\r\n <div class=\"col-sm-12 d-flex justify-content-center\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{ attachmentsList[0].FileDataBase64 }}\" />\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row\" *ngIf=\"attachmentsList.length > 0 && attachmentsList[0] && attachmentsList[0].IsImage != true\">\r\n <div class=\"col-sm-12\">\r\n <mat-form-field>\r\n <mat-label>{{ fileNameLabel }}</mat-label>\r\n <input readonly matInput [(ngModel)]=\"attachmentsList[0].FileName\" />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div *ngIf=\"multipleAttachment == true\">\r\n <input\r\n #fileInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <ngx-file-drop (onFileDrop)=\"fileDropped($event)\" (click)=\"onSelectFile($event, fileInput)\">\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"!addingLinkMode\">\r\n <i class=\"fa-solid fa-cloud-upload-alt fa-3x mt-3\"></i>\r\n Trascina i file qui\r\n <div class=\"btn-group mt-1\" role=\"group\">\r\n <button type=\"button\" class=\"btn btn-light border-end\" (click)=\"fileInput.click()\">Scegli un file</button>\r\n <div class=\"btn-group\" role=\"group\">\r\n <button\r\n type=\"button\"\r\n class=\"btn btn-light border-start dropdown-toggle\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\"></button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n mat-menu-item\r\n (click)=\"fileInput.click()\"\r\n class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n mat-menu-item\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n mat-menu-item\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </mat-menu>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"addingLinkMode\">\r\n <ng-container *ngTemplateOutlet=\"addingLinkTemplate\"></ng-container>\r\n </ng-template>\r\n </ngx-file-drop>\r\n <div class=\"mt-2\">\r\n <eqp-table\r\n #attachmentTable\r\n [createMatCard]=\"false\"\r\n #table\r\n [columns]=\"attachmentsColumns\"\r\n [isMultiLanguage]=\"isEqpTableMultiLanguage\"\r\n [data]=\"attachmentsList\"\r\n [paginatorVisible]=\"tablePaginatorVisible\"\r\n [matPaginatorSize]=\"tablePaginatorSize\"\r\n [emptyTableMessage]=\"emptyTableMessage\"\r\n [searchText]=\"eqpTableSearchText\"\r\n [isTableSearcheable]=\"isTableSearcheable\">\r\n </eqp-table>\r\n </div>\r\n</div>\r\n\r\n<ng-template #dialogCropImage>\r\n <!-- Richiama il template per le funzionalit\u00E0 del CROPPIE -->\r\n <div style=\"overflow-x: hidden\" [ngClass]=\"cropDialogClass\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"croppieTemplate\"\r\n [ngTemplateOutletContext]=\"{ form: newAttachmentForm }\"\r\n *ngIf=\"showCropImage == true\"></ng-container>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #inlinePreviewTemplate let-row=\"row\">\r\n <div\r\n class=\"inline-preview-container\"\r\n *ngIf=\"row.AttachmentType != AttachmentType.LINK && row.IsImage\"\r\n (click)=\"openPreviewDialog(row)\">\r\n <img src=\"data:image/png;base64,{{ row.FileThumbnailBase64 ? row.FileThumbnailBase64 : row.FileDataBase64 }}\" />\r\n </div>\r\n <div\r\n class=\"inline-preview-container\"\r\n *ngIf=\"row.AttachmentType != AttachmentType.LINK && !row.IsImage\"\r\n (click)=\"openPreviewDialog(row)\">\r\n <i [ngClass]=\"getAttachmentIcon(row)\"></i>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #dialogPreview>\r\n <mat-card class=\"example-card\" *ngIf=\"selectedAttachment\">\r\n <mat-card-content>\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">\r\n {{ previewLabel }} {{ selectedAttachment?.AttachmentType == attachmentType.FILE ? \"File\" : \"Link\" }}\r\n <button\r\n type=\"button\"\r\n class=\"btn-close closeButton\"\r\n mat-dialog-close\r\n (click)=\"selectedAttachment = null\"></button>\r\n </div>\r\n </div>\r\n <div class=\"row mt-2\">\r\n <!-- ANTEPRIMA IMMAGINE -->\r\n <div class=\"col-12 text-center preview-container\" *ngIf=\"selectedAttachment.IsImage\">\r\n <img\r\n class=\"image-preview\"\r\n src=\"data:image/png;base64,{{\r\n selectedAttachment.FileDataBase64\r\n ? selectedAttachment.FileDataBase64\r\n : selectedAttachment.FileThumbnailBase64\r\n }}\" />\r\n </div>\r\n\r\n <!-- ANTEPRIMA LINK -->\r\n <div class=\"col-12 preview-container\" *ngIf=\"!selectedAttachment.IsImage\">\r\n <iframe\r\n class=\"link-preview\"\r\n [src]=\"selectedAttachment.TrustedUrl\"\r\n [title]=\"selectedAttachment.FileName\"></iframe>\r\n </div>\r\n </div>\r\n <div class=\"row mt-3\">\r\n <div class=\"col-sm-12 text-center\">\r\n <button\r\n mat-mini-fab\r\n color=\"primary\"\r\n matTooltip=\"Download\"\r\n (click)=\"viewAttachment(selectedAttachment)\"\r\n *ngIf=\"selectedAttachment.AttachmentType != AttachmentType.LINK\">\r\n <mat-icon>download</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n </mat-card>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER IL PULSANTE DI AGGIUNTA NUOVO ALLEGATO -->\r\n<ng-template #addAttachmentButton>\r\n <!--\r\n Pulsanti per l'aggiunta di un file o un link. Ne viene visualizzato uno se:\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK)\r\n e sono nella gestione di pi\u00F9 allegati (multipleAttachment == true)\r\n OPPURE\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK)\r\n e sono nella gestione di un singolo allegato (multipleAttachment == true) e non ne \u00E8 ancora stato selezionato uno (ovvero attachmentsList non esiste o non ha elementi)\r\n -->\r\n <input\r\n #fileInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <button\r\n class=\"btn btn-primary mb-4 me-5 eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"primary\"\r\n type=\"button\"\r\n *ngIf=\"\r\n allowedTypes &&\r\n allowedTypes.length == 1 &&\r\n (multipleAttachment == true ||\r\n !attachmentsList ||\r\n attachmentsList.length == 0 ||\r\n (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \"\r\n (click)=\"addFile(allowedTypes[0], fileInput)\"\r\n [disabled]=\"isDisabled\">\r\n <!-- Per l'aggiunta dei file mostro un'icona diversa dall'aggiunta dei link -->\r\n <mat-icon *ngIf=\"allowedTypes[0] == 1\">cloud_upload</mat-icon>\r\n <i class=\"fas fa-link\" *ngIf=\"allowedTypes[0] == 2\"></i>\r\n <i class=\"fa-brands fa-dropbox\" *ngIf=\"allowedTypes[0] == 3\"></i>\r\n <span style=\"margin-left: 10px\">\r\n {{\r\n allowedTypes[0] == 1\r\n ? addButtonLabel + \" file\"\r\n : allowedTypes[0] == 2\r\n ? addButtonLabel + \" link\"\r\n : uploadWithDropboxLabel\r\n }}</span\r\n >\r\n </button>\r\n\r\n <!-- Pulsante per aprire il menu per la scelta del tipo di Attachment da creare -->\r\n <button\r\n class=\"btn btn-primary mb-4 me-5 eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"primary\"\r\n type=\"button\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\"\r\n [disabled]=\"isDisabled\"\r\n *ngIf=\"\r\n !separatedUploadButtons &&\r\n allowedTypes &&\r\n allowedTypes.length > 1 &&\r\n (multipleAttachment == true ||\r\n !attachmentsList ||\r\n attachmentsList.length == 0 ||\r\n (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \">\r\n <mat-icon *ngIf=\"multipleAttachment != true\">cloud_upload</mat-icon>\r\n <mat-icon *ngIf=\"multipleAttachment == true\">add</mat-icon>\r\n <span style=\"margin-left: 0px\"> {{ addButtonLabel }} </span>\r\n </button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <input\r\n #imageInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n mat-menu-item\r\n (click)=\"imageInput.click()\"\r\n class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n mat-menu-item\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n mat-menu-item\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </mat-menu>\r\n\r\n <div\r\n *ngIf=\"\r\n separatedUploadButtons &&\r\n allowedTypes &&\r\n allowedTypes.length > 1 &&\r\n (multipleAttachment == true ||\r\n !attachmentsList ||\r\n attachmentsList.length == 0 ||\r\n (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \">\r\n <div class=\"btn-group\">\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n (click)=\"imageInput.click()\"\r\n class=\"btn btn-secondary eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"secondary\"\r\n type=\"button\">\r\n <i class=\"fa-solid fa-cloud-upload\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <input\r\n #imageInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"btn btn-secondary eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"secondary\"\r\n type=\"button\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"btn btn-secondary eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"secondary\"\r\n type=\"button\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #croppieTemplate>\r\n <div class=\"row m-3\">\r\n <h4>{{ cropLabel }}</h4>\r\n </div>\r\n <div class=\"row m-2 crop-large\">\r\n <div class=\"col-md-12 d-flex align-items-center justify-content-center\">\r\n <button\r\n [matTooltip]=\"rotateLeftLabel\"\r\n *ngIf=\"cropOptions.includes(1)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"rotateLeft()\">\r\n <mat-icon style=\"vertical-align: middle\">rotate_left</mat-icon>\r\n </button>\r\n <button\r\n [matTooltip]=\"rotateRightLabel\"\r\n *ngIf=\"cropOptions.includes(1)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"rotateRight()\">\r\n <mat-icon style=\"vertical-align: middle\">rotate_right</mat-icon>\r\n </button>\r\n <button\r\n [matTooltip]=\"flipHorinzontalLabel\"\r\n *ngIf=\"cropOptions.includes(2)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"flipHorizontal()\">\r\n <mat-icon style=\"vertical-align: middle\">flip_horizontal</mat-icon>\r\n </button>\r\n <button\r\n [matTooltip]=\"flipVerticalLabel\"\r\n *ngIf=\"cropOptions.includes(2)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"flipVertical()\">\r\n <div style=\"transform: rotate(90deg)\"><mat-icon style=\"vertical-align: middle\">flip_vertical</mat-icon></div>\r\n </button>\r\n <button\r\n [matTooltip]=\"'Reset'\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"restoreOriginalDimensions()\">\r\n <mat-icon style=\"vertical-align: middle\">replay</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"row m-2 crop-small\">\r\n <div class=\"col-md-12 d-flex align-items-center justify-content-center\">\r\n <mat-icon *ngIf=\"cropOptions.includes(1)\" style=\"font-size: 27px; vertical-align: middle\" (click)=\"rotateLeft()\"\r\n >rotate_left</mat-icon\r\n >\r\n <mat-icon\r\n class=\"ms-3\"\r\n *ngIf=\"cropOptions.includes(1)\"\r\n style=\"font-size: 27px; vertical-align: middle\"\r\n (click)=\"rotateRight()\"\r\n >rotate_right</mat-icon\r\n >\r\n <mat-icon\r\n class=\"ms-3\"\r\n *ngIf=\"cropOptions.includes(2)\"\r\n style=\"font-size: 27px; vertical-align: middle\"\r\n (click)=\"flipHorizontal()\"\r\n >flip_horizontal</mat-icon\r\n >\r\n <div class=\"ms-3\" style=\"transform: rotate(90deg)\">\r\n <mat-icon\r\n *ngIf=\"cropOptions.includes(2)\"\r\n style=\"font-size: 27px; vertical-align: middle\"\r\n (click)=\"flipVertical()\"\r\n >flip_vertical</mat-icon\r\n >\r\n </div>\r\n <mat-icon class=\"ms-3\" (click)=\"restoreOriginalDimensions()\" style=\"font-size: 27px; vertical-align: middle\"\r\n >replay</mat-icon\r\n >\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12 d-flex align-items-center justify-content-center\">\r\n <div class=\"crop-container\">\r\n <image-cropper\r\n [imageFile]=\"selectedFile\"\r\n [maintainAspectRatio]=\"false\"\r\n [autoCrop]=\"false\"\r\n [containWithinAspectRatio]=\"false\"\r\n [aspectRatio]=\"4 / 3\"\r\n [cropperMinWidth]=\"128\"\r\n [onlyScaleDown]=\"true\"\r\n [roundCropper]=\"false\"\r\n [canvasRotation]=\"0\"\r\n [transform]=\"transform\"\r\n [alignImage]=\"'left'\"\r\n format=\"png\"\r\n (imageCropped)=\"imageCropped($event)\"\r\n [resizeToWidth]=\"customWidth\"\r\n [resizeToHeight]=\"customHeight\"\r\n [canvasRotation]=\"canvasRotation\">\r\n </image-cropper>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center mt-2 mb-2 crop-large\">\r\n <div class=\"col-12 d-flex align-items-center justify-content-center\">\r\n <button\r\n class=\"btn btn-primary mat-raised-button eqp-attachments-confirm-btn me-2\"\r\n type=\"button\"\r\n (click)=\"confirmAddAttachment()\">\r\n {{ confirmLabel }}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-abort-btn\" type=\"button\" (click)=\"abortFile()\">\r\n {{ abortLabel }}\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center mt-2 mb-2 crop-small\">\r\n <div class=\"col-6 d-flex align-items-center justify-content-center\" style=\"font-size: 20px\">\r\n <i class=\"fa fa-times\" (click)=\"abortFile()\"></i>\r\n </div>\r\n <div class=\"col-6 d-flex align-items-center justify-content-center\" style=\"font-size: 20px\">\r\n <i class=\"fa fa-check\" (click)=\"confirmAddAttachment()\"></i>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER FORM DI AGGIUNTA DI UN LINK -->\r\n<ng-template #addingLinkTemplate>\r\n <span class=\"mb-1\" style=\"font-size: 20px\"><i class=\"fa fa-link\"></i>Inserisci l'URL</span>\r\n <form [formGroup]=\"newAttachmentForm\" *ngIf=\"newAttachmentForm\">\r\n <div class=\"row mb-2\" style=\"height: 80px\">\r\n <div class=\"col-6 d-grid gap-2 mx-auto\">\r\n <div class=\"input-group mb-1\">\r\n <input\r\n type=\"text\"\r\n class=\"form-control\"\r\n placeholder=\"{{ fileNameLabel }}\"\r\n formControlName=\"name\"\r\n [(ngModel)]=\"newAttachment.FileName\" />\r\n </div>\r\n </div>\r\n <div class=\"col-12 d-grid gap-2\">\r\n <div class=\"input-group\">\r\n <input\r\n required\r\n type=\"text\"\r\n class=\"form-control\"\r\n placeholder=\"Link\"\r\n formControlName=\"path\"\r\n [(ngModel)]=\"newAttachment.FilePath\" />\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-6 d-grid gap-2\">\r\n <button\r\n class=\"btn btn-secondary mat-raised-button\"\r\n (click)=\"selectedAttachment = null; addingLinkMode = false\"\r\n type=\"button\">\r\n {{ exitLabel }}\r\n </button>\r\n </div>\r\n <div class=\"col-6 d-grid gap-2\">\r\n <button\r\n class=\"btn btn-primary mat-raised-button\"\r\n type=\"submit\"\r\n (click)=\"confirmAddAttachment(); selectedAttachment = null; addingLinkMode = false\">\r\n {{ saveLabel }}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</ng-template>\r\n", styles: ["ngx-file-drop ::ng-deep .ngx-file-drop__drop-zone{min-height:30vh;border-radius:5px!important;background-color:#e4e6ea!important;cursor:pointer;font-size:17px!important;border:dotted!important;padding-top:7vh}ngx-file-drop ::ng-deep .ngx-file-drop__drop-zone .ngx-file-drop__content{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#73777a!important;margin:auto}.custom-height .mat-form-field-wrapper{height:20px}.eqp-attachments-header-title{font-weight:700;font-size:19px;line-height:24px;margin-bottom:auto}.single-attachment-inline-preview-container{max-height:400px;max-width:400px;display:flex;align-items:center}.single-attachment-inline-preview-container img{max-width:100%;max-height:120px}.inline-preview-container{max-height:100px;max-width:100px;display:flex;align-items:center;justify-content:center;width:100%;cursor:pointer}.inline-preview-container img{max-width:100%;max-height:100px}.inline-preview-container i{font-size:25px;margin:auto}.preview-container{max-height:60vh;max-width:100%}.preview-container .image-preview{max-width:100%;max-height:100%}.preview-container .link-preview{width:70vw;height:55vh}.closeButton{float:right}@media (max-width: 768px){.crop-large{display:none}}@media (min-width: 768px){.crop-small{display:none}}@media (max-width: 768px){.crop-container{max-width:55%}}@media (min-width: 768px){.crop-container{max-width:35%}}\n"], dependencies: [{ kind: "component", type: i6.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6.MatMiniFabButton, selector: "button[mat-mini-fab]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i7.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i8.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "component", type: i9.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { kind: "component", type: i9.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { kind: "directive", type: i9.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { kind: "component", type: i10.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i10.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i11.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i12.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i13.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i13.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i13.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: i14.ImageCropperComponent, selector: "image-cropper", inputs: ["imageChangedEvent", "imageURL", "imageBase64", "imageFile", "imageAltText", "cropperFrameAriaLabel", "output", "format", "transform", "maintainAspectRatio", "aspectRatio", "resetCropOnAspectRatioChange", "resizeToWidth", "resizeToHeight", "cropperMinWidth", "cropperMinHeight", "cropperMaxHeight", "cropperMaxWidth", "cropperStaticWidth", "cropperStaticHeight", "canvasRotation", "initialStepSize", "roundCropper", "onlyScaleDown", "imageQuality", "autoCrop", "backgroundColor", "containWithinAspectRatio", "hideResizeSquares", "allowMoveImage", "cropper", "alignImage", "disabled", "hidden"], outputs: ["imageCropped", "startCropImage", "imageLoaded", "cropperReady", "loadImageFailed", "transformChange"] }, { kind: "component", type: i15.EqpTableComponent, selector: "eqp-table" }, { kind: "component", type: i16.NgxFileDropComponent, selector: "ngx-file-drop", inputs: ["accept", "directory", "multiple", "dropZoneLabel", "dropZoneClassName", "useDragEnter", "contentClassName", "showBrowseBtn", "browseBtnClassName", "browseBtnLabel", "disabled"], outputs: ["onFileDrop", "onFileOver", "onFileLeave"] }, { kind: "directive", type: i16.NgxFileDropContentTemplateDirective, selector: "[ngx-file-drop-content-tmp]" }] });
1103
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentsComponent, decorators: [{
1104
+ type: Component,
1105
+ args: [{ selector: "eqp-attachments", template: "<!-- Se richiesta la gestione singola mostra il pulsante di caricamento di un singolo file -->\r\n<div *ngIf=\"multipleAttachment != true\">\r\n <div *ngIf=\"!singleAttachmentDragAndDrop\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <div *ngIf=\"!addingLinkMode\" class=\"text-center\">\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n </div>\r\n <!-- Template della form per l'aggiunta di un link -->\r\n <div *ngIf=\"addingLinkMode\" class=\"text-center\">\r\n <ng-container *ngTemplateOutlet=\"addingLinkTemplate\"></ng-container>\r\n </div>\r\n </div>\r\n <div *ngIf=\"singleAttachmentDragAndDrop\">\r\n <input\r\n #fileInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <ngx-file-drop\r\n (onFileDrop)=\"fileDropped($event)\"\r\n (click)=\"onSelectFile($event, fileInput)\"\r\n *ngIf=\"\r\n allowedTypes &&\r\n allowedTypes.includes(1) &&\r\n (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \">\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"!addingLinkMode\">\r\n <i class=\"fa-solid fa-cloud-upload-alt fa-3x mt-3\"></i>\r\n Trascina i file qui\r\n <div class=\"btn-group mt-1\" role=\"group\">\r\n <button type=\"button\" class=\"btn btn-light border-end\" (click)=\"fileInput.click()\">Scegli un file</button>\r\n <div class=\"btn-group\" role=\"group\">\r\n <button\r\n type=\"button\"\r\n class=\"btn btn-light border-start dropdown-toggle\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\"></button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n mat-menu-item\r\n (click)=\"fileInput.click()\"\r\n class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n mat-menu-item\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n mat-menu-item\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </mat-menu>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"addingLinkMode\">\r\n <ng-container *ngTemplateOutlet=\"addingLinkTemplate\"></ng-container>\r\n </ng-template>\r\n </ngx-file-drop>\r\n </div>\r\n <div class=\"text-center\">\r\n <button\r\n class=\"mb-2 me-2 eqp-attachments-download-btn\"\r\n (click)=\"viewAttachment(attachmentsList[0])\"\r\n type=\"button\"\r\n mat-raised-button\r\n *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\"\r\n color=\"primary\">\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType == AttachmentType.FILE\">download</mat-icon>\r\n <mat-icon *ngIf=\"attachmentsList[0].AttachmentType != AttachmentType.FILE\">open_in_new</mat-icon>\r\n {{ attachmentsList[0].AttachmentType == AttachmentType.FILE ? downloadLabel : openLinkLabel }}\r\n </button>\r\n <button\r\n class=\"mb-2 me-2 eqp-attachments-preview-btn\"\r\n (click)=\"openPreviewDialog(attachmentsList[0])\"\r\n type=\"button\"\r\n mat-raised-button\r\n color=\"primary\"\r\n *ngIf=\"\r\n showPreview &&\r\n attachmentsList &&\r\n attachmentsList.length > 0 &&\r\n attachmentsList[0] &&\r\n (!attachmentsList[0].FileContentType ||\r\n (!attachmentsList[0].FileContentType.startsWith('video') &&\r\n !attachmentsList[0].FileContentType.startsWith('audio'))) &&\r\n attachmentsList[0].IsImage == true\r\n \">\r\n <mat-icon>visibility</mat-icon> {{ previewLabel }}\r\n </button>\r\n <button\r\n class=\"mb-2 eqp-attachments-delete-btn\"\r\n (click)=\"deleteAttachment(attachmentsList[0])\"\r\n type=\"button\"\r\n mat-raised-button\r\n *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\"\r\n [disabled]=\"isDisabled\">\r\n <mat-icon>delete</mat-icon> {{ deleteLabel }}\r\n </button>\r\n </div>\r\n <div\r\n class=\"row\"\r\n style=\"margin-top: 10px\"\r\n *ngIf=\"\r\n attachmentsList.length > 0 &&\r\n attachmentsList[0] &&\r\n attachmentsList[0].FileDataBase64 &&\r\n attachmentsList[0].IsImage == true\r\n \">\r\n <div class=\"col-sm-12 d-flex justify-content-center\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{ attachmentsList[0].FileDataBase64 }}\" />\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row\" *ngIf=\"attachmentsList.length > 0 && attachmentsList[0] && attachmentsList[0].IsImage != true\">\r\n <div class=\"col-sm-12\">\r\n <mat-form-field>\r\n <mat-label>{{ fileNameLabel }}</mat-label>\r\n <input readonly matInput [(ngModel)]=\"attachmentsList[0].FileName\" />\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<div *ngIf=\"multipleAttachment == true\">\r\n <input\r\n #fileInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <ngx-file-drop (onFileDrop)=\"fileDropped($event)\" (click)=\"onSelectFile($event, fileInput)\">\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"!addingLinkMode\">\r\n <i class=\"fa-solid fa-cloud-upload-alt fa-3x mt-3\"></i>\r\n Trascina i file qui\r\n <div class=\"btn-group mt-1\" role=\"group\">\r\n <button type=\"button\" class=\"btn btn-light border-end\" (click)=\"fileInput.click()\">Scegli un file</button>\r\n <div class=\"btn-group\" role=\"group\">\r\n <button\r\n type=\"button\"\r\n class=\"btn btn-light border-start dropdown-toggle\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\"></button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n mat-menu-item\r\n (click)=\"fileInput.click()\"\r\n class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n mat-menu-item\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n mat-menu-item\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </mat-menu>\r\n </div>\r\n </div>\r\n </ng-template>\r\n <ng-template ngx-file-drop-content-tmp *ngIf=\"addingLinkMode\">\r\n <ng-container *ngTemplateOutlet=\"addingLinkTemplate\"></ng-container>\r\n </ng-template>\r\n </ngx-file-drop>\r\n <div class=\"mt-2\">\r\n <eqp-table\r\n #attachmentTable\r\n [createMatCard]=\"false\"\r\n #table\r\n [columns]=\"attachmentsColumns\"\r\n [isMultiLanguage]=\"isEqpTableMultiLanguage\"\r\n [data]=\"attachmentsList\"\r\n [paginatorVisible]=\"tablePaginatorVisible\"\r\n [matPaginatorSize]=\"tablePaginatorSize\"\r\n [emptyTableMessage]=\"emptyTableMessage\"\r\n [searchText]=\"eqpTableSearchText\"\r\n [isTableSearcheable]=\"isTableSearcheable\">\r\n </eqp-table>\r\n </div>\r\n</div>\r\n\r\n<ng-template #dialogCropImage>\r\n <!-- Richiama il template per le funzionalit\u00E0 del CROPPIE -->\r\n <div style=\"overflow-x: hidden\" [ngClass]=\"cropDialogClass\">\r\n <ng-container\r\n [ngTemplateOutlet]=\"croppieTemplate\"\r\n [ngTemplateOutletContext]=\"{ form: newAttachmentForm }\"\r\n *ngIf=\"showCropImage == true\"></ng-container>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #inlinePreviewTemplate let-row=\"row\">\r\n <div\r\n class=\"inline-preview-container\"\r\n *ngIf=\"row.AttachmentType != AttachmentType.LINK && row.IsImage\"\r\n (click)=\"openPreviewDialog(row)\">\r\n <img src=\"data:image/png;base64,{{ row.FileThumbnailBase64 ? row.FileThumbnailBase64 : row.FileDataBase64 }}\" />\r\n </div>\r\n <div\r\n class=\"inline-preview-container\"\r\n *ngIf=\"row.AttachmentType != AttachmentType.LINK && !row.IsImage\"\r\n (click)=\"openPreviewDialog(row)\">\r\n <i [ngClass]=\"getAttachmentIcon(row)\"></i>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #dialogPreview>\r\n <mat-card class=\"example-card\" *ngIf=\"selectedAttachment\">\r\n <mat-card-content>\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">\r\n {{ previewLabel }} {{ selectedAttachment?.AttachmentType == attachmentType.FILE ? \"File\" : \"Link\" }}\r\n <button\r\n type=\"button\"\r\n class=\"btn-close closeButton\"\r\n mat-dialog-close\r\n (click)=\"selectedAttachment = null\"></button>\r\n </div>\r\n </div>\r\n <div class=\"row mt-2\">\r\n <!-- ANTEPRIMA IMMAGINE -->\r\n <div class=\"col-12 text-center preview-container\" *ngIf=\"selectedAttachment.IsImage\">\r\n <img\r\n class=\"image-preview\"\r\n src=\"data:image/png;base64,{{\r\n selectedAttachment.FileDataBase64\r\n ? selectedAttachment.FileDataBase64\r\n : selectedAttachment.FileThumbnailBase64\r\n }}\" />\r\n </div>\r\n\r\n <!-- ANTEPRIMA LINK -->\r\n <div class=\"col-12 preview-container\" *ngIf=\"!selectedAttachment.IsImage\">\r\n <iframe\r\n class=\"link-preview\"\r\n [src]=\"selectedAttachment.TrustedUrl\"\r\n [title]=\"selectedAttachment.FileName\"></iframe>\r\n </div>\r\n </div>\r\n <div class=\"row mt-3\">\r\n <div class=\"col-sm-12 text-center\">\r\n <button\r\n mat-mini-fab\r\n color=\"primary\"\r\n matTooltip=\"Download\"\r\n (click)=\"viewAttachment(selectedAttachment)\"\r\n *ngIf=\"selectedAttachment.AttachmentType != AttachmentType.LINK\">\r\n <mat-icon>download</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n </mat-card-content>\r\n </mat-card>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER IL PULSANTE DI AGGIUNTA NUOVO ALLEGATO -->\r\n<ng-template #addAttachmentButton>\r\n <!--\r\n Pulsanti per l'aggiunta di un file o un link. Ne viene visualizzato uno se:\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK)\r\n e sono nella gestione di pi\u00F9 allegati (multipleAttachment == true)\r\n OPPURE\r\n - gli allowedTypes sono stati specificati, nell'array ne \u00E8 presente uno solo, quello inserito \u00E8 AttachmentType.FILE (o AttachmentType.LINK)\r\n e sono nella gestione di un singolo allegato (multipleAttachment == true) e non ne \u00E8 ancora stato selezionato uno (ovvero attachmentsList non esiste o non ha elementi)\r\n -->\r\n <input\r\n #fileInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <button\r\n class=\"btn btn-primary mb-4 me-5 eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"primary\"\r\n type=\"button\"\r\n *ngIf=\"\r\n allowedTypes &&\r\n allowedTypes.length == 1 &&\r\n (multipleAttachment == true ||\r\n !attachmentsList ||\r\n attachmentsList.length == 0 ||\r\n (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \"\r\n (click)=\"addFile(allowedTypes[0], fileInput)\"\r\n [disabled]=\"isDisabled\">\r\n <!-- Per l'aggiunta dei file mostro un'icona diversa dall'aggiunta dei link -->\r\n <mat-icon *ngIf=\"allowedTypes[0] == 1\">cloud_upload</mat-icon>\r\n <i class=\"fas fa-link\" *ngIf=\"allowedTypes[0] == 2\"></i>\r\n <i class=\"fa-brands fa-dropbox\" *ngIf=\"allowedTypes[0] == 3\"></i>\r\n <span style=\"margin-left: 10px\">\r\n {{\r\n allowedTypes[0] == 1\r\n ? addButtonLabel + \" file\"\r\n : allowedTypes[0] == 2\r\n ? addButtonLabel + \" link\"\r\n : uploadWithDropboxLabel\r\n }}</span\r\n >\r\n </button>\r\n\r\n <!-- Pulsante per aprire il menu per la scelta del tipo di Attachment da creare -->\r\n <button\r\n class=\"btn btn-primary mb-4 me-5 eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"primary\"\r\n type=\"button\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\"\r\n [disabled]=\"isDisabled\"\r\n *ngIf=\"\r\n !separatedUploadButtons &&\r\n allowedTypes &&\r\n allowedTypes.length > 1 &&\r\n (multipleAttachment == true ||\r\n !attachmentsList ||\r\n attachmentsList.length == 0 ||\r\n (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \">\r\n <mat-icon *ngIf=\"multipleAttachment != true\">cloud_upload</mat-icon>\r\n <mat-icon *ngIf=\"multipleAttachment == true\">add</mat-icon>\r\n <span style=\"margin-left: 0px\"> {{ addButtonLabel }} </span>\r\n </button>\r\n <mat-menu #attachmentTypeMenu=\"matMenu\">\r\n <input\r\n #imageInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n mat-menu-item\r\n (click)=\"imageInput.click()\"\r\n class=\"eqp-attachments-file-btn\">\r\n <i class=\"fas fa-file\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n mat-menu-item\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n mat-menu-item\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"eqp-attachments-link-btn\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </mat-menu>\r\n\r\n <div\r\n *ngIf=\"\r\n separatedUploadButtons &&\r\n allowedTypes &&\r\n allowedTypes.length > 1 &&\r\n (multipleAttachment == true ||\r\n !attachmentsList ||\r\n attachmentsList.length == 0 ||\r\n (attachmentsList.length > 0 && !attachmentsList[0]))\r\n \">\r\n <div class=\"btn-group\">\r\n <button\r\n *ngIf=\"allowedTypes.includes(1)\"\r\n (click)=\"imageInput.click()\"\r\n class=\"btn btn-secondary eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"secondary\"\r\n type=\"button\">\r\n <i class=\"fa-solid fa-cloud-upload\"></i>\r\n <span style=\"margin-left: 10px\">File</span>\r\n </button>\r\n <input\r\n #imageInput\r\n style=\"display: none\"\r\n id=\"file_attachment\"\r\n name=\"file_attachment\"\r\n type=\"file\"\r\n (change)=\"onFileAdded($event)\"\r\n [accept]=\"acceptedFileTypes\"\r\n [multiple]=\"loadMultipleFiles\" />\r\n <button\r\n *ngIf=\"allowedTypes.includes(2)\"\r\n (click)=\"switchToAddingLinkMode()\"\r\n class=\"btn btn-secondary eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"secondary\"\r\n type=\"button\">\r\n <i class=\"fas fa-link\"></i>\r\n <span style=\"margin-left: 10px\">Link</span>\r\n </button>\r\n <button\r\n *ngIf=\"allowedTypes.includes(3)\"\r\n (click)=\"chooseDropboxFile()\"\r\n class=\"btn btn-secondary eqp-attachments-add-btn\"\r\n mat-raised-button\r\n color=\"secondary\"\r\n type=\"button\">\r\n <i class=\"fa-brands fa-dropbox\"></i>\r\n <span style=\"margin-left: 10px\">Dropbox</span>\r\n </button>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #croppieTemplate>\r\n <div class=\"row m-3\">\r\n <h4>{{ cropLabel }}</h4>\r\n </div>\r\n <div class=\"row m-2 crop-large\">\r\n <div class=\"col-md-12 d-flex align-items-center justify-content-center\">\r\n <button\r\n [matTooltip]=\"rotateLeftLabel\"\r\n *ngIf=\"cropOptions.includes(1)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"rotateLeft()\">\r\n <mat-icon style=\"vertical-align: middle\">rotate_left</mat-icon>\r\n </button>\r\n <button\r\n [matTooltip]=\"rotateRightLabel\"\r\n *ngIf=\"cropOptions.includes(1)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"rotateRight()\">\r\n <mat-icon style=\"vertical-align: middle\">rotate_right</mat-icon>\r\n </button>\r\n <button\r\n [matTooltip]=\"flipHorinzontalLabel\"\r\n *ngIf=\"cropOptions.includes(2)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"flipHorizontal()\">\r\n <mat-icon style=\"vertical-align: middle\">flip_horizontal</mat-icon>\r\n </button>\r\n <button\r\n [matTooltip]=\"flipVerticalLabel\"\r\n *ngIf=\"cropOptions.includes(2)\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"flipVertical()\">\r\n <div style=\"transform: rotate(90deg)\"><mat-icon style=\"vertical-align: middle\">flip_vertical</mat-icon></div>\r\n </button>\r\n <button\r\n [matTooltip]=\"'Reset'\"\r\n class=\"btn btn-primary mat-raised-button ms-2\"\r\n (click)=\"restoreOriginalDimensions()\">\r\n <mat-icon style=\"vertical-align: middle\">replay</mat-icon>\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"row m-2 crop-small\">\r\n <div class=\"col-md-12 d-flex align-items-center justify-content-center\">\r\n <mat-icon *ngIf=\"cropOptions.includes(1)\" style=\"font-size: 27px; vertical-align: middle\" (click)=\"rotateLeft()\"\r\n >rotate_left</mat-icon\r\n >\r\n <mat-icon\r\n class=\"ms-3\"\r\n *ngIf=\"cropOptions.includes(1)\"\r\n style=\"font-size: 27px; vertical-align: middle\"\r\n (click)=\"rotateRight()\"\r\n >rotate_right</mat-icon\r\n >\r\n <mat-icon\r\n class=\"ms-3\"\r\n *ngIf=\"cropOptions.includes(2)\"\r\n style=\"font-size: 27px; vertical-align: middle\"\r\n (click)=\"flipHorizontal()\"\r\n >flip_horizontal</mat-icon\r\n >\r\n <div class=\"ms-3\" style=\"transform: rotate(90deg)\">\r\n <mat-icon\r\n *ngIf=\"cropOptions.includes(2)\"\r\n style=\"font-size: 27px; vertical-align: middle\"\r\n (click)=\"flipVertical()\"\r\n >flip_vertical</mat-icon\r\n >\r\n </div>\r\n <mat-icon class=\"ms-3\" (click)=\"restoreOriginalDimensions()\" style=\"font-size: 27px; vertical-align: middle\"\r\n >replay</mat-icon\r\n >\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center\">\r\n <div class=\"col-12 d-flex align-items-center justify-content-center\">\r\n <div class=\"crop-container\">\r\n <image-cropper\r\n [imageFile]=\"selectedFile\"\r\n [maintainAspectRatio]=\"false\"\r\n [autoCrop]=\"false\"\r\n [containWithinAspectRatio]=\"false\"\r\n [aspectRatio]=\"4 / 3\"\r\n [cropperMinWidth]=\"128\"\r\n [onlyScaleDown]=\"true\"\r\n [roundCropper]=\"false\"\r\n [canvasRotation]=\"0\"\r\n [transform]=\"transform\"\r\n [alignImage]=\"'left'\"\r\n format=\"png\"\r\n (imageCropped)=\"imageCropped($event)\"\r\n [resizeToWidth]=\"customWidth\"\r\n [resizeToHeight]=\"customHeight\"\r\n [canvasRotation]=\"canvasRotation\">\r\n </image-cropper>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center mt-2 mb-2 crop-large\">\r\n <div class=\"col-12 d-flex align-items-center justify-content-center\">\r\n <button\r\n class=\"btn btn-primary mat-raised-button eqp-attachments-confirm-btn me-2\"\r\n type=\"button\"\r\n (click)=\"confirmAddAttachment()\">\r\n {{ confirmLabel }}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-abort-btn\" type=\"button\" (click)=\"abortFile()\">\r\n {{ abortLabel }}\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center mt-2 mb-2 crop-small\">\r\n <div class=\"col-6 d-flex align-items-center justify-content-center\" style=\"font-size: 20px\">\r\n <i class=\"fa fa-times\" (click)=\"abortFile()\"></i>\r\n </div>\r\n <div class=\"col-6 d-flex align-items-center justify-content-center\" style=\"font-size: 20px\">\r\n <i class=\"fa fa-check\" (click)=\"confirmAddAttachment()\"></i>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<!-- TEMPLATE PER FORM DI AGGIUNTA DI UN LINK -->\r\n<ng-template #addingLinkTemplate>\r\n <span class=\"mb-1\" style=\"font-size: 20px\"><i class=\"fa fa-link\"></i>Inserisci l'URL</span>\r\n <form [formGroup]=\"newAttachmentForm\" *ngIf=\"newAttachmentForm\">\r\n <div class=\"row mb-2\" style=\"height: 80px\">\r\n <div class=\"col-6 d-grid gap-2 mx-auto\">\r\n <div class=\"input-group mb-1\">\r\n <input\r\n type=\"text\"\r\n class=\"form-control\"\r\n placeholder=\"{{ fileNameLabel }}\"\r\n formControlName=\"name\"\r\n [(ngModel)]=\"newAttachment.FileName\" />\r\n </div>\r\n </div>\r\n <div class=\"col-12 d-grid gap-2\">\r\n <div class=\"input-group\">\r\n <input\r\n required\r\n type=\"text\"\r\n class=\"form-control\"\r\n placeholder=\"Link\"\r\n formControlName=\"path\"\r\n [(ngModel)]=\"newAttachment.FilePath\" />\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"row\">\r\n <div class=\"col-6 d-grid gap-2\">\r\n <button\r\n class=\"btn btn-secondary mat-raised-button\"\r\n (click)=\"selectedAttachment = null; addingLinkMode = false\"\r\n type=\"button\">\r\n {{ exitLabel }}\r\n </button>\r\n </div>\r\n <div class=\"col-6 d-grid gap-2\">\r\n <button\r\n class=\"btn btn-primary mat-raised-button\"\r\n type=\"submit\"\r\n (click)=\"confirmAddAttachment(); selectedAttachment = null; addingLinkMode = false\">\r\n {{ saveLabel }}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n</ng-template>\r\n", styles: ["ngx-file-drop ::ng-deep .ngx-file-drop__drop-zone{min-height:30vh;border-radius:5px!important;background-color:#e4e6ea!important;cursor:pointer;font-size:17px!important;border:dotted!important;padding-top:7vh}ngx-file-drop ::ng-deep .ngx-file-drop__drop-zone .ngx-file-drop__content{display:flex;flex-direction:column;align-items:center;justify-content:center;color:#73777a!important;margin:auto}.custom-height .mat-form-field-wrapper{height:20px}.eqp-attachments-header-title{font-weight:700;font-size:19px;line-height:24px;margin-bottom:auto}.single-attachment-inline-preview-container{max-height:400px;max-width:400px;display:flex;align-items:center}.single-attachment-inline-preview-container img{max-width:100%;max-height:120px}.inline-preview-container{max-height:100px;max-width:100px;display:flex;align-items:center;justify-content:center;width:100%;cursor:pointer}.inline-preview-container img{max-width:100%;max-height:100px}.inline-preview-container i{font-size:25px;margin:auto}.preview-container{max-height:60vh;max-width:100%}.preview-container .image-preview{max-width:100%;max-height:100%}.preview-container .link-preview{width:70vw;height:55vh}.closeButton{float:right}@media (max-width: 768px){.crop-large{display:none}}@media (min-width: 768px){.crop-small{display:none}}@media (max-width: 768px){.crop-container{max-width:55%}}@media (min-width: 768px){.crop-container{max-width:35%}}\n"] }]
1106
+ }], ctorParameters: function () { return [{ type: i1.MatDialog }, { type: i2.FormBuilder }, { type: i3.DomSanitizer }, { type: i4.HttpClient }, { type: i0.ChangeDetectorRef }, { type: EqpAttachmentService }]; }, propDecorators: { disableAction: [{
1107
+ type: Input,
1108
+ args: ["disableAction"]
1109
+ }], showHeader: [{
1110
+ type: Input,
1111
+ args: ["showHeader"]
1112
+ }], headerTitle: [{
1113
+ type: Input,
1114
+ args: ["headerTitle"]
1115
+ }], attachmentsList: [{
1116
+ type: Input,
1117
+ args: ["attachmentsList"]
1118
+ }], showMatCard: [{
1119
+ type: Input,
1120
+ args: ["showMatCard"]
1121
+ }], multipleAttachment: [{
1122
+ type: Input,
1123
+ args: ["multipleAttachment"]
1124
+ }], loadMultipleFiles: [{
1125
+ type: Input,
1126
+ args: ["loadMultipleFiles"]
1127
+ }], attachmentsColumns: [{
1128
+ type: Input,
1129
+ args: ["attachmentsColumns"]
1130
+ }], emptyTableMessage: [{
1131
+ type: Input,
1132
+ args: ["emptyTableMessage"]
1133
+ }], allowOnlyImages: [{
1134
+ type: Input,
1135
+ args: ["allowOnlyImages"]
1136
+ }], acceptedFileTypes: [{
1137
+ type: Input,
1138
+ args: ["acceptedFileTypes"]
1139
+ }], isDisabled: [{
1140
+ type: Input,
1141
+ args: ["isDisabled"]
1142
+ }], showInlinePreview: [{
1143
+ type: Input,
1144
+ args: ["showInlinePreview"]
1145
+ }], getAttachmentEndpoint: [{
1146
+ type: Input,
1147
+ args: ["getAttachmentEndpoint"]
1148
+ }], productionBaseUrl: [{
1149
+ type: Input,
1150
+ args: ["productionBaseUrl"]
1151
+ }], compressionOptions: [{
1152
+ type: Input,
1153
+ args: ["compressionOptions"]
1154
+ }], allowedTypes: [{
1155
+ type: Input,
1156
+ args: ["allowedTypes"]
1157
+ }], isEqpTableMultiLanguage: [{
1158
+ type: Input,
1159
+ args: ["isEqpTableMultiLanguage"]
1160
+ }], tablePaginatorVisible: [{
1161
+ type: Input,
1162
+ args: ["tablePaginatorVisible"]
1163
+ }], isTableSearcheable: [{
1164
+ type: Input,
1165
+ args: ["isTableSearcheable"]
1166
+ }], tablePaginatorSize: [{
1167
+ type: Input,
1168
+ args: ["tablePaginatorSize"]
1169
+ }], separatedUploadButtons: [{
1170
+ type: Input,
1171
+ args: ["separatedUploadButtons"]
1172
+ }], showPreview: [{
1173
+ type: Input,
1174
+ args: ["showPreview"]
1175
+ }], singleAttachmentDragAndDrop: [{
1176
+ type: Input,
1177
+ args: ["singleAttachmentDragAndDrop"]
1178
+ }], cropOptions: [{
1179
+ type: Input,
1180
+ args: ["cropOptions"]
1181
+ }], cropDialogClass: [{
1182
+ type: Input,
1183
+ args: ["cropDialogClass"]
1184
+ }], downloadTooltipPosition: [{
1185
+ type: Input,
1186
+ args: ["downloadTooltipPosition"]
1187
+ }], openLinkLabel: [{
1188
+ type: Input,
1189
+ args: ["openLinkLabel"]
1190
+ }], addButtonLabel: [{
1191
+ type: Input,
1192
+ args: ["addButtonLabel"]
1193
+ }], downloadLabel: [{
1194
+ type: Input,
1195
+ args: ["downloadLabel"]
1196
+ }], deleteLabel: [{
1197
+ type: Input,
1198
+ args: ["deleteLabel"]
1199
+ }], fileNameLabel: [{
1200
+ type: Input,
1201
+ args: ["fileNameLabel"]
1202
+ }], previewLabel: [{
1203
+ type: Input,
1204
+ args: ["previewLabel"]
1205
+ }], uploadFileLabel: [{
1206
+ type: Input,
1207
+ args: ["uploadFileLabel"]
1208
+ }], confirmLabel: [{
1209
+ type: Input,
1210
+ args: ["confirmLabel"]
1211
+ }], abortLabel: [{
1212
+ type: Input,
1213
+ args: ["abortLabel"]
1214
+ }], saveLabel: [{
1215
+ type: Input,
1216
+ args: ["saveLabel"]
1217
+ }], exitLabel: [{
1218
+ type: Input,
1219
+ args: ["exitLabel"]
1220
+ }], uploadWithDropboxLabel: [{
1221
+ type: Input,
1222
+ args: ["uploadWithDropboxLabel"]
1223
+ }], cropLabel: [{
1224
+ type: Input,
1225
+ args: ["cropLabel"]
1226
+ }], eqpTableSearchText: [{
1227
+ type: Input,
1228
+ args: ["eqpTableSearchText"]
1229
+ }], deleteDialogTitle: [{
1230
+ type: Input,
1231
+ args: ["deleteDialogTitle"]
1232
+ }], deleteDialogMessage: [{
1233
+ type: Input,
1234
+ args: ["deleteDialogMessage"]
1235
+ }], noImageSelectedErrorMessage: [{
1236
+ type: Input,
1237
+ args: ["noImageSelectedErrorMessage"]
1238
+ }], wrongTypeSelectedErrorMessage: [{
1239
+ type: Input,
1240
+ args: ["wrongTypeSelectedErrorMessage"]
1241
+ }], videoPreviewErrorMessage: [{
1242
+ type: Input,
1243
+ args: ["videoPreviewErrorMessage"]
1244
+ }], audioPreviewErrorMessage: [{
1245
+ type: Input,
1246
+ args: ["videoPreviewErrorMessage"]
1247
+ }], flipHorinzontalLabel: [{
1248
+ type: Input,
1249
+ args: ["flipHorinzontalLabel"]
1250
+ }], flipVerticalLabel: [{
1251
+ type: Input,
1252
+ args: ["flipVerticalLabel"]
1253
+ }], rotateRightLabel: [{
1254
+ type: Input,
1255
+ args: ["rotateRightLabel"]
1256
+ }], rotateLeftLabel: [{
1257
+ type: Input,
1258
+ args: ["rotateLeftLabel"]
1259
+ }], localEditedAttachments: [{
1260
+ type: Output
1261
+ }], abortAddAttachment: [{
1262
+ type: Output
1263
+ }], downloadAttachment: [{
1264
+ type: Output,
1265
+ args: ["downloadAttachment"]
1266
+ }], onDeleteAttachment: [{
1267
+ type: Output,
1268
+ args: ["onDeleteAttachment"]
1269
+ }], dialogAddAttachment: [{
1270
+ type: ViewChild,
1271
+ args: ["dialogAddAttachment", { static: true }]
1272
+ }], dialogAddMultipleAttachment: [{
1273
+ type: ViewChild,
1274
+ args: ["dialogAddMultipleAttachment", { static: true }]
1275
+ }], dialogCropImage: [{
1276
+ type: ViewChild,
1277
+ args: ["dialogCropImage", { static: true }]
1278
+ }], imageCropper: [{
1279
+ type: ViewChild,
1280
+ args: [ImageCropperComponent]
1281
+ }], imageInput: [{
1282
+ type: ViewChild,
1283
+ args: ["imageInput"]
1284
+ }], attachmentTable: [{
1285
+ type: ViewChild,
1286
+ args: ["attachmentTable", { static: false }]
1287
+ }], inlinePreviewTemplate: [{
1288
+ type: ViewChild,
1289
+ args: ["inlinePreviewTemplate", { static: true }]
1290
+ }], dialogPreview: [{
1291
+ type: ViewChild,
1292
+ args: ["dialogPreview", { static: true }]
1293
+ }] } });
1294
+
1295
+ class MaterialModule {
1296
+ }
1297
+ MaterialModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1298
+ MaterialModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: MaterialModule, imports: [MatCheckboxModule,
1299
+ MatButtonModule,
1300
+ MatInputModule,
1301
+ MatAutocompleteModule,
1302
+ MatDatepickerModule,
1303
+ MatFormFieldModule,
1304
+ MatRadioModule,
1305
+ MatSelectModule,
1306
+ MatSliderModule,
1307
+ MatSlideToggleModule,
1308
+ MatMenuModule,
1309
+ MatSidenavModule,
1310
+ MatToolbarModule,
1311
+ MatListModule,
1312
+ MatGridListModule,
1313
+ MatCardModule,
1314
+ MatStepperModule,
1315
+ MatTabsModule,
1316
+ MatExpansionModule,
1317
+ MatButtonToggleModule,
1318
+ MatChipsModule,
1319
+ MatIconModule,
1320
+ MatProgressSpinnerModule,
1321
+ MatProgressBarModule,
1322
+ MatDialogModule,
1323
+ MatTooltipModule,
1324
+ MatSnackBarModule,
1325
+ MatTableModule,
1326
+ MatSortModule,
1327
+ MatPaginatorModule,
1328
+ MatDatepickerModule,
1329
+ MatNativeDateModule], exports: [MatCheckboxModule,
1330
+ MatButtonModule,
1331
+ MatInputModule,
1332
+ MatAutocompleteModule,
1333
+ MatDatepickerModule,
1334
+ MatFormFieldModule,
1335
+ MatRadioModule,
1336
+ MatSelectModule,
1337
+ MatSliderModule,
1338
+ MatSlideToggleModule,
1339
+ MatMenuModule,
1340
+ MatSidenavModule,
1341
+ MatToolbarModule,
1342
+ MatListModule,
1343
+ MatGridListModule,
1344
+ MatCardModule,
1345
+ MatStepperModule,
1346
+ MatTabsModule,
1347
+ MatExpansionModule,
1348
+ MatButtonToggleModule,
1349
+ MatChipsModule,
1350
+ MatIconModule,
1351
+ MatProgressSpinnerModule,
1352
+ MatProgressBarModule,
1353
+ MatDialogModule,
1354
+ MatTooltipModule,
1355
+ MatSnackBarModule,
1356
+ MatTableModule,
1357
+ MatSortModule,
1358
+ MatPaginatorModule] });
1359
+ MaterialModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MaterialModule, imports: [MatCheckboxModule,
1360
+ MatButtonModule,
1361
+ MatInputModule,
1362
+ MatAutocompleteModule,
1363
+ MatDatepickerModule,
1364
+ MatFormFieldModule,
1365
+ MatRadioModule,
1366
+ MatSelectModule,
1367
+ MatSliderModule,
1368
+ MatSlideToggleModule,
1369
+ MatMenuModule,
1370
+ MatSidenavModule,
1371
+ MatToolbarModule,
1372
+ MatListModule,
1373
+ MatGridListModule,
1374
+ MatCardModule,
1375
+ MatStepperModule,
1376
+ MatTabsModule,
1377
+ MatExpansionModule,
1378
+ MatButtonToggleModule,
1379
+ MatChipsModule,
1380
+ MatIconModule,
1381
+ MatProgressSpinnerModule,
1382
+ MatProgressBarModule,
1383
+ MatDialogModule,
1384
+ MatTooltipModule,
1385
+ MatSnackBarModule,
1386
+ MatTableModule,
1387
+ MatSortModule,
1388
+ MatPaginatorModule,
1389
+ MatDatepickerModule,
1390
+ MatNativeDateModule, MatCheckboxModule,
1391
+ MatButtonModule,
1392
+ MatInputModule,
1393
+ MatAutocompleteModule,
1394
+ MatDatepickerModule,
1395
+ MatFormFieldModule,
1396
+ MatRadioModule,
1397
+ MatSelectModule,
1398
+ MatSliderModule,
1399
+ MatSlideToggleModule,
1400
+ MatMenuModule,
1401
+ MatSidenavModule,
1402
+ MatToolbarModule,
1403
+ MatListModule,
1404
+ MatGridListModule,
1405
+ MatCardModule,
1406
+ MatStepperModule,
1407
+ MatTabsModule,
1408
+ MatExpansionModule,
1409
+ MatButtonToggleModule,
1410
+ MatChipsModule,
1411
+ MatIconModule,
1412
+ MatProgressSpinnerModule,
1413
+ MatProgressBarModule,
1414
+ MatDialogModule,
1415
+ MatTooltipModule,
1416
+ MatSnackBarModule,
1417
+ MatTableModule,
1418
+ MatSortModule,
1419
+ MatPaginatorModule] });
1420
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MaterialModule, decorators: [{
1421
+ type: NgModule,
1422
+ args: [{
1423
+ imports: [
1424
+ MatCheckboxModule,
1425
+ MatButtonModule,
1426
+ MatInputModule,
1427
+ MatAutocompleteModule,
1428
+ MatDatepickerModule,
1429
+ MatFormFieldModule,
1430
+ MatRadioModule,
1431
+ MatSelectModule,
1432
+ MatSliderModule,
1433
+ MatSlideToggleModule,
1434
+ MatMenuModule,
1435
+ MatSidenavModule,
1436
+ MatToolbarModule,
1437
+ MatListModule,
1438
+ MatGridListModule,
1439
+ MatCardModule,
1440
+ MatStepperModule,
1441
+ MatTabsModule,
1442
+ MatExpansionModule,
1443
+ MatButtonToggleModule,
1444
+ MatChipsModule,
1445
+ MatIconModule,
1446
+ MatProgressSpinnerModule,
1447
+ MatProgressBarModule,
1448
+ MatDialogModule,
1449
+ MatTooltipModule,
1450
+ MatSnackBarModule,
1451
+ MatTableModule,
1452
+ MatSortModule,
1453
+ MatPaginatorModule,
1454
+ MatDatepickerModule,
1455
+ MatNativeDateModule
1456
+ ],
1457
+ exports: [
1458
+ MatCheckboxModule,
1459
+ MatButtonModule,
1460
+ MatInputModule,
1461
+ MatAutocompleteModule,
1462
+ MatDatepickerModule,
1463
+ MatFormFieldModule,
1464
+ MatRadioModule,
1465
+ MatSelectModule,
1466
+ MatSliderModule,
1467
+ MatSlideToggleModule,
1468
+ MatMenuModule,
1469
+ MatSidenavModule,
1470
+ MatToolbarModule,
1471
+ MatListModule,
1472
+ MatGridListModule,
1473
+ MatCardModule,
1474
+ MatStepperModule,
1475
+ MatTabsModule,
1476
+ MatExpansionModule,
1477
+ MatButtonToggleModule,
1478
+ MatChipsModule,
1479
+ MatIconModule,
1480
+ MatProgressSpinnerModule,
1481
+ MatProgressBarModule,
1482
+ MatDialogModule,
1483
+ MatTooltipModule,
1484
+ MatSnackBarModule,
1485
+ MatTableModule,
1486
+ MatSortModule,
1487
+ MatPaginatorModule
1488
+ ],
1489
+ }]
1490
+ }] });
1491
+
1492
+ class EqpAttachmentsModule {
1493
+ }
1494
+ EqpAttachmentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1495
+ EqpAttachmentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentsModule, declarations: [EqpAttachmentsComponent], imports: [MaterialModule,
1496
+ FormsModule,
1497
+ CommonModule,
1498
+ ReactiveFormsModule,
1499
+ ImageCropperModule,
1500
+ EqpTableModule,
1501
+ NgxFileDropModule], exports: [EqpAttachmentsComponent] });
1502
+ EqpAttachmentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentsModule, imports: [MaterialModule,
1503
+ FormsModule,
1504
+ CommonModule,
1505
+ ReactiveFormsModule,
1506
+ ImageCropperModule,
1507
+ EqpTableModule,
1508
+ NgxFileDropModule] });
1509
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: EqpAttachmentsModule, decorators: [{
1510
+ type: NgModule,
1511
+ args: [{
1512
+ declarations: [EqpAttachmentsComponent],
1513
+ imports: [
1514
+ MaterialModule,
1515
+ FormsModule,
1516
+ CommonModule,
1517
+ ReactiveFormsModule,
1518
+ ImageCropperModule,
1519
+ EqpTableModule,
1520
+ NgxFileDropModule
1521
+ ],
1522
+ exports: [EqpAttachmentsComponent]
1523
+ }]
1524
+ }] });
1525
+
1526
+ /*
1527
+ * Public API Surface of eqp-attachments
1528
+ */
1529
+
1530
+ /**
1531
+ * Generated bundle index. Do not edit.
1532
+ */
1533
+
1534
+ export { AttachmentHelperService, AttachmentType, CropOptionEnum, EqpAttachmentDialogService, EqpAttachmentsComponent, EqpAttachmentsModule };
1535
+ //# sourceMappingURL=eqproject-eqp-attachments.mjs.map