@eqproject/eqp-attachments 0.1.14 → 2.0.0

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 (48) hide show
  1. package/README.md +3 -0
  2. package/esm2020/eqproject-eqp-attachments.mjs +5 -0
  3. package/esm2020/lib/eqp-attachments.component.mjs +830 -0
  4. package/esm2020/lib/eqp-attachments.module.mjs +39 -0
  5. package/esm2020/lib/helpers/attachment.helper.mjs +61 -0
  6. package/esm2020/lib/interfaces/IAttachment.mjs +6 -0
  7. package/esm2020/lib/interfaces/IOptions.mjs +2 -0
  8. package/esm2020/lib/modules/material.module.mjs +231 -0
  9. package/esm2020/lib/services/eqp-attachment-dialog.service.mjs +103 -0
  10. package/esm2020/public-api.mjs +10 -0
  11. package/fesm2015/eqproject-eqp-attachments.mjs +1275 -0
  12. package/fesm2015/eqproject-eqp-attachments.mjs.map +1 -0
  13. package/fesm2020/eqproject-eqp-attachments.mjs +1264 -0
  14. package/fesm2020/eqproject-eqp-attachments.mjs.map +1 -0
  15. package/{eqproject-eqp-attachments.d.ts → index.d.ts} +1 -1
  16. package/lib/eqp-attachments.component.d.ts +15 -1
  17. package/lib/eqp-attachments.module.d.ts +10 -0
  18. package/lib/helpers/attachment.helper.d.ts +3 -0
  19. package/lib/modules/material.module.d.ts +35 -0
  20. package/lib/services/eqp-attachment-dialog.service.d.ts +3 -0
  21. package/package.json +29 -16
  22. package/bundles/eqproject-eqp-attachments.umd.js +0 -1378
  23. package/bundles/eqproject-eqp-attachments.umd.js.map +0 -1
  24. package/bundles/eqproject-eqp-attachments.umd.min.js +0 -2
  25. package/bundles/eqproject-eqp-attachments.umd.min.js.map +0 -1
  26. package/eqproject-eqp-attachments.metadata.json +0 -1
  27. package/esm2015/eqproject-eqp-attachments.js +0 -6
  28. package/esm2015/lib/eqp-attachments.component.js +0 -826
  29. package/esm2015/lib/eqp-attachments.module.js +0 -26
  30. package/esm2015/lib/helpers/attachment.helper.js +0 -62
  31. package/esm2015/lib/interfaces/IAttachment.js +0 -6
  32. package/esm2015/lib/interfaces/IOptions.js +0 -1
  33. package/esm2015/lib/modules/material.module.js +0 -108
  34. package/esm2015/lib/services/eqp-attachment-dialog.service.js +0 -104
  35. package/esm2015/public-api.js +0 -9
  36. package/esm5/eqproject-eqp-attachments.js +0 -6
  37. package/esm5/lib/eqp-attachments.component.js +0 -885
  38. package/esm5/lib/eqp-attachments.module.js +0 -29
  39. package/esm5/lib/helpers/attachment.helper.js +0 -63
  40. package/esm5/lib/interfaces/IAttachment.js +0 -6
  41. package/esm5/lib/interfaces/IOptions.js +0 -1
  42. package/esm5/lib/modules/material.module.js +0 -111
  43. package/esm5/lib/services/eqp-attachment-dialog.service.js +0 -113
  44. package/esm5/public-api.js +0 -9
  45. package/fesm2015/eqproject-eqp-attachments.js +0 -1117
  46. package/fesm2015/eqproject-eqp-attachments.js.map +0 -1
  47. package/fesm5/eqproject-eqp-attachments.js +0 -1192
  48. package/fesm5/eqproject-eqp-attachments.js.map +0 -1
@@ -1,1192 +0,0 @@
1
- import { __decorate, __awaiter, __generator, __spread, __values } from 'tslib';
2
- import { ɵɵdefineInjectable, Injectable, EventEmitter, ChangeDetectorRef, Input, Output, ViewChild, Component, NgModule } from '@angular/core';
3
- import { Validators, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
4
- import { base64ToFile, ImageCropperComponent, ImageCropperModule } from 'ngx-image-cropper';
5
- import imageCompression from 'browser-image-compression';
6
- import { TooltipPositionType, TypeColumn, EqpTableModule } from '@eqproject/eqp-table';
7
- import { MatDialog, MatDialogModule } from '@angular/material/dialog';
8
- import Swal from 'sweetalert2';
9
- import { DomSanitizer } from '@angular/platform-browser';
10
- import { HttpClient } from '@angular/common/http';
11
- import { CommonModule } from '@angular/common';
12
- import { MatCheckboxModule } from '@angular/material/checkbox';
13
- import { MatButtonModule } from '@angular/material/button';
14
- import { MatInputModule } from '@angular/material/input';
15
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
16
- import { MatDatepickerModule } from '@angular/material/datepicker';
17
- import { MatFormFieldModule } from '@angular/material/form-field';
18
- import { MatRadioModule } from '@angular/material/radio';
19
- import { MatSelectModule } from '@angular/material/select';
20
- import { MatSliderModule } from '@angular/material/slider';
21
- import { MatSlideToggleModule } from '@angular/material/slide-toggle';
22
- import { MatMenuModule } from '@angular/material/menu';
23
- import { MatSidenavModule } from '@angular/material/sidenav';
24
- import { MatToolbarModule } from '@angular/material/toolbar';
25
- import { MatListModule } from '@angular/material/list';
26
- import { MatGridListModule } from '@angular/material/grid-list';
27
- import { MatCardModule } from '@angular/material/card';
28
- import { MatStepperModule } from '@angular/material/stepper';
29
- import { MatTabsModule } from '@angular/material/tabs';
30
- import { MatExpansionModule } from '@angular/material/expansion';
31
- import { MatButtonToggleModule } from '@angular/material/button-toggle';
32
- import { MatChipsModule } from '@angular/material/chips';
33
- import { MatIconModule } from '@angular/material/icon';
34
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
35
- import { MatProgressBarModule } from '@angular/material/progress-bar';
36
- import { MatTooltipModule } from '@angular/material/tooltip';
37
- import { MatSnackBarModule } from '@angular/material/snack-bar';
38
- import { MatTableModule } from '@angular/material/table';
39
- import { MatSortModule } from '@angular/material/sort';
40
- import { MatPaginatorModule } from '@angular/material/paginator';
41
- import { MatNativeDateModule } from '@angular/material/core';
42
-
43
- var AttachmentType;
44
- (function (AttachmentType) {
45
- AttachmentType[AttachmentType["FILE"] = 1] = "FILE";
46
- AttachmentType[AttachmentType["LINK"] = 2] = "LINK";
47
- })(AttachmentType || (AttachmentType = {}));
48
-
49
- var AttachmentHelperService = /** @class */ (function () {
50
- function AttachmentHelperService() {
51
- }
52
- /**
53
- * Restituisce TRUE se il mime type passato nel parametro corrisponde ad un mime type di un'immagine
54
- * @param mimeType Mime Type da verificare
55
- */
56
- AttachmentHelperService.checkImageFromMimeType = function (mimeType) {
57
- return this.imageMimeTypes.find(function (s) { return s == mimeType; }) != null;
58
- };
59
- /**
60
- * In base all'estensione passata come parametro, restituisce la FontAwesome corretta da utilizzare.
61
- * Se l'estensione non viene trovata nella costante riportata dentro common.model.ts restituisce un icona standard
62
- * @param extension Estensione del file per cui restituire l'icona corretta
63
- */
64
- AttachmentHelperService.getIconFromFileExtensione = function (extension) {
65
- var fileIcon = this.fileExtensionIcon[extension];
66
- return (fileIcon !== null && fileIcon !== void 0 ? fileIcon : "fas fa-file");
67
- };
68
- AttachmentHelperService.imageMimeTypes = ["image/bmp", "image/gif", "image/jpeg", "image/tiff", "image/png"];
69
- AttachmentHelperService.fileExtensionIcon = {
70
- "txt": "fas fa-file-text",
71
- "pdf": "fas fa-file-pdf",
72
- "doc": "fas fa-file-word",
73
- "docx": "fas fa-file-word",
74
- "xls": "fas fa-file-excel",
75
- "xlsx": "fas fa-file-excel",
76
- "jpg": "fas fa-file-image",
77
- "jpeg": "fas fa-file-image",
78
- "png": "fas fa-file-image",
79
- "bmp": "fas fa-file-image",
80
- "mkv": "fas fa-file-video",
81
- "flv": "fas fa-file-video",
82
- "gif": "fas fa-file-video",
83
- "gifv": "fas fa-file-video",
84
- "avi": "fas fa-file-video",
85
- "wmv": "fas fa-file-video",
86
- "mp4": "fas fa-file-video",
87
- "m4p": "fas fa-file-video",
88
- "m4v": "fas fa-file-video",
89
- "mpg": "fas fa-file-video",
90
- "mp2": "fas fa-file-video",
91
- "mpeg": "fas fa-file-video",
92
- "mpe": "fas fa-file-video",
93
- "mpv": "fas fa-file-video",
94
- "m2v": "fas fa-file-video",
95
- "3gp": "fas fa-file-video",
96
- "3g2": "fas fa-file-video",
97
- "mp3": "fas fa-file-audio",
98
- };
99
- AttachmentHelperService.ɵprov = ɵɵdefineInjectable({ factory: function AttachmentHelperService_Factory() { return new AttachmentHelperService(); }, token: AttachmentHelperService, providedIn: "root" });
100
- AttachmentHelperService = __decorate([
101
- Injectable({
102
- providedIn: 'root'
103
- })
104
- ], AttachmentHelperService);
105
- return AttachmentHelperService;
106
- }());
107
-
108
- var EqpAttachmentDialogService = /** @class */ (function () {
109
- function EqpAttachmentDialogService() {
110
- }
111
- /**
112
- * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.
113
- * @param message Messaggio d'errore da mostrare nello sweetalert
114
- * @param title Titolo dello sweetalert (di default mostra 'Errore')
115
- */
116
- EqpAttachmentDialogService.Error = function (message, title) {
117
- if (title === void 0) { title = null; }
118
- var currentTitle = title != null ? title : 'Errore';
119
- if (Array.isArray(message)) {
120
- currentTitle = title != null ? title : 'Errore';
121
- var htmlErrors = message.join("<br>");
122
- Swal.fire({
123
- title: currentTitle,
124
- html: htmlErrors,
125
- icon: 'error'
126
- });
127
- }
128
- else {
129
- Swal.fire(currentTitle, message, 'error');
130
- }
131
- };
132
- /**
133
- * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto
134
- * CONFERMA lancia la funzione di callback passata come parametro
135
- * @param message Messaggio da mostrare nello sweetalert
136
- * @param title Titolo dello sweetalert (di default mostra 'Info')
137
- */
138
- EqpAttachmentDialogService.Confirm = function (message, confirmCallback, isWarning, title, customWidth) {
139
- if (isWarning === void 0) { isWarning = false; }
140
- if (title === void 0) { title = null; }
141
- if (customWidth === void 0) { customWidth = null; }
142
- var currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';
143
- if (Array.isArray(message)) {
144
- var htmlErrors = message.join("<br>");
145
- Swal.fire({
146
- title: currentTitle,
147
- html: htmlErrors,
148
- width: customWidth ? customWidth : '32rem',
149
- icon: !isWarning ? 'question' : 'warning',
150
- showCancelButton: true,
151
- allowOutsideClick: false,
152
- allowEscapeKey: false
153
- }).then(function (result) {
154
- if (result.value && confirmCallback) {
155
- confirmCallback();
156
- }
157
- });
158
- }
159
- else {
160
- Swal.fire({
161
- title: currentTitle,
162
- text: message,
163
- width: customWidth ? customWidth : '32rem',
164
- icon: !isWarning ? 'question' : 'warning',
165
- showCancelButton: true,
166
- allowOutsideClick: false,
167
- allowEscapeKey: false
168
- }).then(function (result) {
169
- if (result.value && confirmCallback) {
170
- confirmCallback();
171
- }
172
- });
173
- }
174
- };
175
- /**
176
- * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro
177
- * @param message Messaggio da mostrare nello sweetalert
178
- * @param title Titolo dello sweetalert (di default mostra 'Info')
179
- */
180
- EqpAttachmentDialogService.Info = function (message, title, isToast) {
181
- if (title === void 0) { title = null; }
182
- if (isToast === void 0) { isToast = null; }
183
- var currentTitle = title != null ? title : "Informazione:";
184
- Swal.fire(currentTitle, message, 'info');
185
- };
186
- /**
187
- * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro
188
- * @param message Messaggio da mostrare nello sweetalert
189
- * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')
190
- */
191
- EqpAttachmentDialogService.Warning = function (message, title, isToast) {
192
- if (title === void 0) { title = null; }
193
- if (isToast === void 0) { isToast = null; }
194
- var currentTitle = title != null ? title : "Attenzione!";
195
- if (Array.isArray(message)) {
196
- var htmlWarnings = message.join("<br>");
197
- Swal.fire({
198
- title: currentTitle,
199
- html: htmlWarnings,
200
- icon: 'warning'
201
- });
202
- }
203
- else {
204
- Swal.fire(currentTitle, message, 'warning');
205
- }
206
- };
207
- EqpAttachmentDialogService.ɵprov = ɵɵdefineInjectable({ factory: function EqpAttachmentDialogService_Factory() { return new EqpAttachmentDialogService(); }, token: EqpAttachmentDialogService, providedIn: "root" });
208
- EqpAttachmentDialogService = __decorate([
209
- Injectable({
210
- providedIn: 'root'
211
- })
212
- ], EqpAttachmentDialogService);
213
- return EqpAttachmentDialogService;
214
- }());
215
-
216
- var toBase64 = function (file) { return new Promise(function (resolve, reject) {
217
- var reader = new FileReader();
218
- reader.readAsDataURL(file);
219
- reader.onload = function () { return resolve(reader.result.toString()); };
220
- reader.onerror = function (error) { return reject(error); };
221
- }); };
222
- var ɵ0 = toBase64;
223
- var EqpAttachmentsComponent = /** @class */ (function () {
224
- function EqpAttachmentsComponent(dialog, formBuilder, sanitizer, http, cd) {
225
- this.dialog = dialog;
226
- this.formBuilder = formBuilder;
227
- this.sanitizer = sanitizer;
228
- this.http = http;
229
- this.cd = cd;
230
- //#region @Input del componente
231
- /**
232
- * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso "multipleAttachment" è TRUE).
233
- */
234
- this.disableAction = false;
235
- /**
236
- * Se TRUE mostra il titolo nell'header nel caso in cui "multipleAttachment" è TRUE ("Elenco allegati" di default).
237
- */
238
- this.showHeader = true;
239
- /**
240
- * Titolo da visualizzare se il parametro "showHeader" è TRUE. Di devault viene visualizzato "Elenco allegati".
241
- */
242
- this.headerTitle = "Elenco allegati";
243
- /**
244
- * Sorgente dati da visualizzare. Nel caso si vuole gestire un singolo allegato va passato in ogni caso come Array.
245
- */
246
- this.attachmentsList = null;
247
- /**
248
- * Se TRUE non mostra la MatCard (nel caso in cui "multipleAttachment" è TRUE).
249
- */
250
- this.showMatCard = true;
251
- /**
252
- * 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".
253
- * Se TRUE allora il componente mostra l'elenco di tutti gli allegati ricevuto nel parametro "attachmentsList".
254
- */
255
- this.multipleAttachment = true;
256
- /**
257
- * Se assume il valore TRUE allora sarà possibile caricare più file per volta. Questa funzionalità è attiva
258
- * SOLO se si gestiscono allegati multipli, quindi se l'input 'multipleAttachment' assume il valore TRUE, altrimenti è sempre disabilitata.
259
- */
260
- this.loadMultipleFiles = false;
261
- /**
262
- * Configurazione delle colonne della eqp-table per la visualizzazione degli allegati (caso "multipleAttachment" è TRUE).
263
- */
264
- this.attachmentsColumns = null;
265
- /**
266
- * Imposta il messaggio da visualizzare nel caso in cui la tabella degli allegati (nel caso in cui "multipleAttachment" è TRUE) è vuota.
267
- */
268
- this.emptyTableMessage = "Nessun dato trovato";
269
- /**
270
- * Se TRUE allora permette di selezionare soltanto file di tipo immagine, avente uno dei mimetype
271
- * specificati dentro AttachmentHelperService.
272
- * Se FALSE permette di selezionare qualsiasi tipo di file
273
- */
274
- this.allowOnlyImages = false;
275
- /**
276
- * Se TRUE disabilita il pulsante di Aggiunta allegato (a prescindere dal valore del parametro "multipleAttachment").
277
- */
278
- this.isDisabled = false;
279
- /**
280
- * Mostra/nasconde la colonna per visualizzare l'anteprima dei file nella tabella (caso multipleAtatchments = true).
281
- */
282
- this.showInlinePreview = false;
283
- /**
284
- * Endpoint da chiamare per recueprare l'IAttachmentDTO completo da vedere nell'anteprima. La chiamata sarà in POST e nel body
285
- * conterrà l'IAttachmentDTO selezionato dall'utente.
286
- * La chiamata viene eseguita solo per l'anteprima delle immagini essendo necessario il base64 completo dell'immagine a dimensione reale.
287
- * Per documenti/link basta che sia popolata la proprietà FilePath di IAttachmentDTO.
288
- */
289
- this.getAttachmentEndpoint = null;
290
- /**
291
- * Hostname dell'ambiente di produzione dell'applicativo. Necessario per visualizzare l'anteprima dei documenti
292
- * tramite il viewer di google.
293
- * NOTA: Per visualizzare l'anteprima è necessario che la prorietà FilePath dell'IAttachmentDTO sia popolata e che
294
- * sia abilitato l'accesso alla cartella sul server tramite hostname.
295
- */
296
- this.productionBaseUrl = null;
297
- /**
298
- * Opzioni per la compressione delle immagini caricate.
299
- */
300
- this.compressionOptions = { maxSizeMB: 0.5, maxWidthOrHeight: 1920, useWebWorker: true };
301
- /**
302
- * Array di AttachmentType che si possono aggiungere
303
- */
304
- this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];
305
- /**
306
- * Booleano per impostare la eqp-table nella modalità multilingua
307
- */
308
- this.isEqpTableMultiLanguage = false;
309
- /**
310
- * Input per definire le label da usare nel componente
311
- */
312
- this.downloadTooltipPosition = TooltipPositionType.Below;
313
- this.openLinkLabel = "Apri link";
314
- this.addButtonLabel = "Aggiungi";
315
- this.downloadLabel = "Download";
316
- this.deleteLabel = "Elimina";
317
- this.fileNameLabel = "Nome file";
318
- this.previewLabel = "Anteprima";
319
- this.uploadFileLabel = "Carica file";
320
- this.confirmLabel = "Conferma";
321
- this.abortLabel = "Annulla";
322
- this.saveLabel = "Salva";
323
- this.exitLabel = "Esci";
324
- this.eqpTableSearchText = "Cerca";
325
- this.deleteDialogTitle = null;
326
- this.deleteDialogMessage = "Sei sicuro di voler cancellare quest'allegato?";
327
- this.noImageSelectedErrorMessage = "Non è possibile selezionare un file che non sia un'immagine.";
328
- this.wrongTypeSelectedErrorMessage = "Non è possibile caricare il file selezionato.";
329
- this.videoPreviewErrorMessage = "Impossibile aprire l'anteprima di un file video.";
330
- this.audioPreviewErrorMessage = "Impossibile aprire l'anteprima di un file audio.";
331
- //#endregion
332
- //#region @Output del componente
333
- /**
334
- * Restituisce la lista aggiornata degli allegati.
335
- */
336
- this.localEditedAttachments = new EventEmitter();
337
- /**
338
- * Evento scatenato alla pressione del pulsante ESCI della modale di caricamento file.
339
- */
340
- this.abortAddAttachment = new EventEmitter();
341
- /**
342
- * Evento di output che restituisce l'IAttachmentDTO selezionato per il download nel caso FileDataBase64, FileContentType o FileName non fossero specificati.
343
- */
344
- this.downloadAttachment = new EventEmitter();
345
- /**
346
- * Evento di output che restituisce l'elemento eliminato prima che questo venga effettivamente rismosso dalla lista.
347
- */
348
- this.onDeleteAttachment = new EventEmitter();
349
- //#endregion
350
- //#region Proprietà per gestione caricamento nuovo allegato
351
- this.newAttachment = {};
352
- this.newMultipleAttachments = [];
353
- this.attachmentType = AttachmentType;
354
- this.selectedFile = null;
355
- this.selectedFiles = null;
356
- this.showCropImage = false;
357
- //#endregion
358
- //#region Proprietà per gestione ridimensionamento file di tipo image
359
- this.imageChangedEvent = '';
360
- this.croppedImage = '';
361
- this.transform = {};
362
- //#endregion
363
- this.AttachmentType = AttachmentType;
364
- }
365
- EqpAttachmentsComponent.prototype.ngOnInit = function () {
366
- //Se è stata richiesta la gestione delle sole immagini allora imposta il filtro per le estensioni possibili da caricare
367
- if (!this.acceptedFileTypes)
368
- if (this.allowOnlyImages == true)
369
- this.acceptedFileTypes = "image/*";
370
- else
371
- this.acceptedFileTypes = "*";
372
- // Se non sono stati specificati i tipi da gestire ma è stato passato null o un array vuoto imposto i tipi di default.
373
- if (!this.allowedTypes || this.allowedTypes.length == 0)
374
- this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];
375
- else if (this.allowedTypes.find(function (t) { return t != AttachmentType.FILE && t != AttachmentType.LINK; })) {
376
- EqpAttachmentDialogService.Warning("Almeno uno degli AttachmentType selezionati nel parametro \"allowedTypes\" non esiste.");
377
- this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];
378
- }
379
- //Se è stata richiesta la gestione multipla degli allegati allora configura l'eqp-table
380
- if (this.multipleAttachment == true && (!this.attachmentsColumns || this.attachmentsColumns.length == 0)) {
381
- this.configureColumns();
382
- }
383
- if (this.attachmentsList == null)
384
- this.attachmentsList = new Array();
385
- this.checkAttachmentImage();
386
- };
387
- EqpAttachmentsComponent.prototype.reloadData = function () {
388
- if (this.attachmentTable)
389
- this.attachmentTable.reloadDatatable();
390
- };
391
- EqpAttachmentsComponent.prototype.checkAttachmentImage = function () {
392
- this.attachmentsList.forEach(function (a) {
393
- a.IsImage = AttachmentHelperService.checkImageFromMimeType(a.FileContentType);
394
- });
395
- };
396
- //#region Gestione elenco allegati
397
- /**
398
- * Configura le colonne per l'eqp-table nel caso in cui il parametro "multipleAttachments" è TRUE.
399
- */
400
- EqpAttachmentsComponent.prototype.configureColumns = function () {
401
- var _this = this;
402
- this.attachmentsColumns = [];
403
- if (this.disableAction != true) {
404
- this.attachmentsColumns.push({
405
- key: "action", display: "",
406
- type: TypeColumn.MenuAction, buttonMenuIcon: "more_vert", styles: { flex: "0 0 6%" },
407
- actions: [
408
- { name: this.deleteLabel, icon: "delete", fn: function (element, index, col) { return _this.deleteAttachment(element); } },
409
- ],
410
- });
411
- }
412
- var downloadColumn = {
413
- key: "attachment", display: "",
414
- type: TypeColumn.SimpleAction, styles: { flex: "0 0 6%" },
415
- actions: [
416
- {
417
- name: '', fontawesome: true,
418
- icon: function (element) { return _this.showInlinePreview ? (element.AttachmentType == AttachmentType.FILE ? "fas fa-cloud-download-alt" : "fas fa-external-link-alt") : _this.getAttachmentIcon(element); },
419
- fn: function (element, col, elementIndex) { return _this.viewAttachment(element); },
420
- tooltip: { tooltipText: function (element) { return element.AttachmentType == AttachmentType.FILE ? _this.downloadLabel : _this.openLinkLabel; }, tooltipPosition: this.downloadTooltipPosition }
421
- },
422
- ]
423
- };
424
- var inlinePreviewColumn = {
425
- key: "InlinePreview", display: this.previewLabel,
426
- type: TypeColumn.ExternalTemplate,
427
- externalTemplate: this.inlinePreviewTemplate,
428
- styles: { flex: "0 0 10%" }
429
- };
430
- var fileNameColumn = { key: "FileName", display: this.fileNameLabel };
431
- if (this.showInlinePreview) {
432
- this.attachmentsColumns.push(inlinePreviewColumn);
433
- this.attachmentsColumns.push(fileNameColumn);
434
- this.attachmentsColumns.push(downloadColumn);
435
- }
436
- else {
437
- this.attachmentsColumns.push(downloadColumn);
438
- this.attachmentsColumns.push(fileNameColumn);
439
- }
440
- };
441
- /**
442
- * Elimina un allegato eliminando anche il file presente nello storage di archiviazione utilizzato (AWS o cartella progetto)
443
- * @param element IAttachmentDTO da cancellare
444
- */
445
- EqpAttachmentsComponent.prototype.deleteAttachment = function (element) {
446
- var _this = this;
447
- EqpAttachmentDialogService.Confirm(this.deleteDialogMessage, function () {
448
- _this.removeAttachmentFromList(_this.attachmentsList.indexOf(element));
449
- }, true, this.deleteDialogTitle);
450
- };
451
- /**
452
- * Rimuove l'allegato selezionato dalla lista "attachmentsList" e invoca l'evento di output che restituisce la lista aggiornata.
453
- * @param attachmentIndex Indice dell'attachment da rimuovere
454
- */
455
- EqpAttachmentsComponent.prototype.removeAttachmentFromList = function (attachmentIndex) {
456
- this.onDeleteAttachment.emit(this.attachmentsList[attachmentIndex]);
457
- this.attachmentsList.splice(attachmentIndex, 1);
458
- if (this.attachmentTable)
459
- this.attachmentTable.reloadDatatable();
460
- this.localEditedAttachments.emit(this.attachmentsList);
461
- };
462
- /**
463
- * Scarica l'allegato o apre il link
464
- * @param element Allegato da mostrare
465
- */
466
- EqpAttachmentsComponent.prototype.viewAttachment = function (attachment) {
467
- if (attachment.AttachmentType == AttachmentType.LINK) {
468
- window.open(attachment.FilePath, '_blank');
469
- return;
470
- }
471
- if (attachment.FileDataBase64 && attachment.FileContentType && attachment.FileName) {
472
- var source = "data:" + attachment.FileContentType + ";base64," + attachment.FileDataBase64;
473
- var link = document.createElement("a");
474
- link.href = source;
475
- link.download = "" + attachment.FileName;
476
- link.click();
477
- }
478
- else {
479
- this.downloadAttachment.emit(attachment);
480
- }
481
- };
482
- /**
483
- * Ridefinisce l'icona da mostrare nella colonna dell'eqp-table per ogni file.
484
- * L'icona varia in base all'estensione del file
485
- * @param attachment
486
- */
487
- EqpAttachmentsComponent.prototype.getAttachmentIcon = function (attachment) {
488
- if (attachment.AttachmentType == AttachmentType.LINK)
489
- return "fas fa-link";
490
- else
491
- return AttachmentHelperService.getIconFromFileExtensione(attachment.FileExtension);
492
- };
493
- //#endregion
494
- /**
495
- * Apre la modale per la definizione dei parametri del nuovo file
496
- */
497
- EqpAttachmentsComponent.prototype.openModalAddAttachment = function (attachmentType) {
498
- //Se è stato richiesto il caricamento di un LINK o è impostato il caricamento di FILE SINGOLO allora apre la modale per
499
- //il caricamento singolo del file altrimenti apre quella per il caricamento multiplo
500
- // if (attachmentType == AttachmentType.LINK || (attachmentType == AttachmentType.FILE && this.loadMultipleFiles != true)) {
501
- this.newAttachment = {};
502
- this.newAttachment.IsImage = false;
503
- this.newAttachment.AttachmentType = attachmentType;
504
- this.newMultipleAttachments = new Array();
505
- if (attachmentType == AttachmentType.LINK)
506
- this.newMultipleAttachments.push(this.newAttachment);
507
- this.createAttachmentForm();
508
- //Apre la modale
509
- this.dialofRefAddAttachment = this.dialog.open(this.dialogAddAttachment, {
510
- disableClose: true,
511
- hasBackdrop: true,
512
- width: '60%',
513
- maxHeight: '80%'
514
- });
515
- };
516
- EqpAttachmentsComponent.prototype.createAttachmentForm = function () {
517
- //Crea la form per la validazione dei campi
518
- this.newAttachmentForm = this.formBuilder.group({
519
- type: [this.newAttachment.AttachmentType, Validators.required],
520
- name: [this.newAttachment.FileName],
521
- path: [this.newAttachment.FilePath],
522
- customHeight: [this.customHeight],
523
- customWidth: [this.customWidth]
524
- });
525
- };
526
- EqpAttachmentsComponent.prototype.close = function (emitCloseEvent) {
527
- if (emitCloseEvent === void 0) { emitCloseEvent = true; }
528
- this.newAttachment = {};
529
- this.newMultipleAttachments = new Array();
530
- this.abortFile();
531
- if (this.newAttachmentForm)
532
- this.newAttachmentForm.reset();
533
- this.dialofRefAddAttachment.close();
534
- if (emitCloseEvent == true && this.abortAddAttachment)
535
- this.abortAddAttachment.emit();
536
- };
537
- /**
538
- * In base al tipo di allegato controlla se disabilitare o meno il pulsante per salvare.
539
- * Funzione usata nel [disable] del pulsante "Salva" del dialog per l'aggiunta di un allegato.
540
- * @returns
541
- */
542
- EqpAttachmentsComponent.prototype.disableSave = function () {
543
- if (this.loadMultipleFiles != true) {
544
- if (this.newAttachment.AttachmentType == AttachmentType.FILE) {
545
- return !this.newAttachment.FileDataBase64;
546
- }
547
- else {
548
- return !this.newAttachment.FilePath;
549
- }
550
- }
551
- else {
552
- return this.newMultipleAttachments.filter(function (p) { return (p.AttachmentType == AttachmentType.FILE && !p.FileDataBase64) || (p.AttachmentType == AttachmentType.LINK && !p.FilePath); }).length > 0;
553
- }
554
- };
555
- EqpAttachmentsComponent.prototype.confirmAddAttachment = function () {
556
- if (this.loadMultipleFiles != true) {
557
- if (this.newAttachment.AttachmentType == AttachmentType.LINK && !this.newAttachment.FileName)
558
- this.newAttachment.FileName = this.newAttachment.FilePath;
559
- if (this.attachmentsList == null)
560
- this.attachmentsList = new Array();
561
- this.attachmentsList.push(this.newAttachment);
562
- }
563
- else {
564
- if (this.newMultipleAttachments == null || this.newMultipleAttachments.length == 0)
565
- return;
566
- if (this.attachmentsList == null)
567
- this.attachmentsList = new Array();
568
- this.attachmentsList = this.attachmentsList.concat(this.newMultipleAttachments);
569
- }
570
- if (this.attachmentTable)
571
- this.attachmentTable.reloadDatatable();
572
- this.localEditedAttachments.emit(this.attachmentsList);
573
- this.close(false);
574
- };
575
- /**
576
- * Apre il dialog per l'anteprima dell'allegato selezionato.
577
- * @param row
578
- * @returns
579
- */
580
- EqpAttachmentsComponent.prototype.openPreviewDialog = function (row) {
581
- return __awaiter(this, void 0, void 0, function () {
582
- var _this = this;
583
- return __generator(this, function (_a) {
584
- switch (_a.label) {
585
- case 0:
586
- this.selectedAttachment = JSON.parse(JSON.stringify(row));
587
- if (this.selectedAttachment.AttachmentType == AttachmentType.FILE) {
588
- if (this.selectedAttachment.FileContentType.startsWith("video")) {
589
- EqpAttachmentDialogService.Warning(this.videoPreviewErrorMessage);
590
- return [2 /*return*/];
591
- }
592
- else if (this.selectedAttachment.FileContentType.startsWith("audio")) {
593
- EqpAttachmentDialogService.Warning(this.audioPreviewErrorMessage);
594
- return [2 /*return*/];
595
- }
596
- }
597
- if (!(this.getAttachmentEndpoint && this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64)) return [3 /*break*/, 2];
598
- return [4 /*yield*/, this.getAttachmentByID()
599
- .then(function (res) { _this.selectedAttachment.FileDataBase64 = res.FileDataBase64; })
600
- .catch(function (err) { EqpAttachmentDialogService.Error(err); })];
601
- case 1:
602
- _a.sent();
603
- _a.label = 2;
604
- case 2:
605
- if (this.selectedAttachment.AttachmentType == AttachmentType.LINK) {
606
- this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.selectedAttachment.FilePath);
607
- }
608
- else if (this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64 && !this.selectedAttachment.FileThumbnailBase64) {
609
- EqpAttachmentDialogService.Info("Impossibile aprire l'anteprima dell'allegato, file mancante.");
610
- return [2 /*return*/];
611
- }
612
- else if (!this.selectedAttachment.IsImage) {
613
- if (this.selectedAttachment.FilePath && this.productionBaseUrl) {
614
- this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl("https://docs.google.com/gview?url=" +
615
- this.productionBaseUrl +
616
- "/" +
617
- this.selectedAttachment.FilePath +
618
- "&embedded=true");
619
- }
620
- else {
621
- EqpAttachmentDialogService.Info("Impossibile aprire l'anteprima del documento!");
622
- return [2 /*return*/];
623
- }
624
- }
625
- this.dialog.open(this.dialogPreview, {
626
- disableClose: true,
627
- hasBackdrop: true,
628
- });
629
- return [2 /*return*/];
630
- }
631
- });
632
- });
633
- };
634
- EqpAttachmentsComponent.prototype.getAttachmentByID = function () {
635
- return __awaiter(this, void 0, void 0, function () {
636
- return __generator(this, function (_a) {
637
- return [2 /*return*/, this.http.post(this.getAttachmentEndpoint, this.selectedAttachment).toPromise()];
638
- });
639
- });
640
- };
641
- //#region Gestione caricamento file
642
- /**
643
- * Evento scatenato alla selezione del file (o dei file).
644
- * 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
645
- * mostrare le funzionalità del croppie (per ritagliare l'immagine) oppure no.
646
- * Se il file caricato non è un immagine allora genera direttamente il base64 e lo associa all'allegato da salvare.
647
- * Se invece il caricamento dei file è MULTIPLO e sono presenti più file allora esegue le stesse operazioni ignorando però il contrllo
648
- * immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
649
- */
650
- EqpAttachmentsComponent.prototype.onFileInputChange = function (event) {
651
- return __awaiter(this, void 0, void 0, function () {
652
- var _a, checkOnlyImage, base64Result, i, newAttachment, checkOnlyImage;
653
- return __generator(this, function (_b) {
654
- switch (_b.label) {
655
- case 0:
656
- this.showCropImage = false;
657
- if (!(__spread(event.target.files).length == 1 || this.loadMultipleFiles != true)) return [3 /*break*/, 5];
658
- this.selectedFile = event.target.files[0];
659
- this.selectedFiles = event.target.files;
660
- if (!this.selectedFile)
661
- return [2 /*return*/];
662
- //Memorizza i dati per l'allegato
663
- _a = this;
664
- return [4 /*yield*/, this.createAttachmentFromUploadedFile(this.selectedFile, false)];
665
- case 1:
666
- //Memorizza i dati per l'allegato
667
- _a.newAttachment = _b.sent();
668
- this.newMultipleAttachments = new Array();
669
- this.newMultipleAttachments.push(this.newAttachment);
670
- checkOnlyImage = this.checkAllowOnlyImageFile(this.newAttachment);
671
- if (checkOnlyImage == false)
672
- return [2 /*return*/];
673
- if (this.loadMultipleFiles == true && __spread(event.target.files).length == 1)
674
- this.createAttachmentForm();
675
- if (!(this.newAttachment.IsImage == true)) return [3 /*break*/, 2];
676
- this.getImageDimensions(event.target.files[0]);
677
- //Mostra il croppie e disabilita la form finchè non termina la modifica dell'immagine
678
- this.newAttachmentForm.disable();
679
- this.newAttachmentForm.controls["customWidth"].enable();
680
- this.newAttachmentForm.controls["customHeight"].enable();
681
- this.showCropImage = true;
682
- this.imageChangedEvent = event;
683
- return [3 /*break*/, 4];
684
- case 2:
685
- this.showCropImage = false;
686
- return [4 /*yield*/, this.getBase64FromFile(this.selectedFile)];
687
- case 3:
688
- base64Result = _b.sent();
689
- this.newAttachment.FileDataBase64 = base64Result.Base64File;
690
- this.newAttachment.FileContentType = base64Result.ContentType;
691
- _b.label = 4;
692
- case 4: return [3 /*break*/, 9];
693
- case 5:
694
- this.selectedFiles = event.target.files;
695
- if (!this.selectedFiles || this.selectedFiles.length == 0)
696
- return [2 /*return*/];
697
- this.newMultipleAttachments = new Array();
698
- i = 0;
699
- _b.label = 6;
700
- case 6:
701
- if (!(i < this.selectedFiles.length)) return [3 /*break*/, 9];
702
- return [4 /*yield*/, this.createAttachmentFromUploadedFile(this.selectedFiles[i], true)];
703
- case 7:
704
- newAttachment = _b.sent();
705
- checkOnlyImage = this.checkAllowOnlyImageFile(newAttachment);
706
- if (checkOnlyImage == false)
707
- return [2 /*return*/];
708
- this.newMultipleAttachments.push(newAttachment);
709
- _b.label = 8;
710
- case 8:
711
- i++;
712
- return [3 /*break*/, 6];
713
- case 9: return [2 /*return*/];
714
- }
715
- });
716
- });
717
- };
718
- /**
719
- * A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
720
- * Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
721
- * ricava il ContentType da associare all'oggetto IAttachmentDTO da restituire
722
- * @param currentFile Oggetto FILE da processare
723
- * @param getBase64 Se TRUE allora calcola base64 e ContentType del file passato in input
724
- * @returns Restituisce un oggetto di tipo IAttachmentDTO
725
- */
726
- EqpAttachmentsComponent.prototype.createAttachmentFromUploadedFile = function (currentFile, getBase64) {
727
- if (getBase64 === void 0) { getBase64 = true; }
728
- return __awaiter(this, void 0, void 0, function () {
729
- var newAttachment, base64Result;
730
- return __generator(this, function (_a) {
731
- switch (_a.label) {
732
- case 0:
733
- newAttachment = {};
734
- //Memorizza i dati per l'allegato
735
- newAttachment.AttachmentType = AttachmentType.FILE;
736
- newAttachment.FileContentType = currentFile.type;
737
- newAttachment.FileName = currentFile.name;
738
- newAttachment.FileExtension = currentFile.name.substr(currentFile.name.lastIndexOf('.') + 1);
739
- newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(currentFile.type);
740
- if (!(getBase64 == true)) return [3 /*break*/, 2];
741
- return [4 /*yield*/, this.getBase64FromFile(currentFile)];
742
- case 1:
743
- base64Result = _a.sent();
744
- newAttachment.FileDataBase64 = base64Result.Base64File;
745
- newAttachment.FileContentType = base64Result.ContentType;
746
- _a.label = 2;
747
- case 2: return [2 /*return*/, newAttachment];
748
- }
749
- });
750
- });
751
- };
752
- /**
753
- * A partire dal file passato in input restituisce un oggetto
754
- * contenente il base64 del file e il suo contentType
755
- * @param currentFile Oggetto File da cui estrapolare base64 e contentType
756
- * @returns Restituisce un oggetto avente le proprietà Base64File e ContentType
757
- */
758
- EqpAttachmentsComponent.prototype.getBase64FromFile = function (currentFile) {
759
- return __awaiter(this, void 0, void 0, function () {
760
- var base64File, contentType, result;
761
- return __generator(this, function (_a) {
762
- switch (_a.label) {
763
- case 0: return [4 /*yield*/, toBase64(currentFile)];
764
- case 1:
765
- base64File = _a.sent();
766
- contentType = null;
767
- if (base64File) {
768
- // Loris 20/01/2022: PROBLEMA - Quando eseguo l'upload di un file .sql non viene salvato/scaricato correttamente.
769
- // Questo succede perchè non viene popolato il FileContentType. Per risolvere il problema
770
- // faccio un controllo e se non esiste il FileContentType allora lo recupero dal base64 ottenuto.
771
- contentType = base64File.split(",")[0].split(":")[1].split(";")[0];
772
- // Un altro metodo per leggere il ccontent type del file è tramite una regular expression:
773
- base64File = base64File.split(",")[1];
774
- }
775
- result = {
776
- Base64File: base64File,
777
- ContentType: contentType
778
- };
779
- return [2 /*return*/, result];
780
- }
781
- });
782
- });
783
- };
784
- /**
785
- * Controlla se il file che si sta caricando è supportato dal sistema.
786
- * @returns
787
- */
788
- EqpAttachmentsComponent.prototype.checkAcceptedFiles = function () {
789
- var e_1, _a;
790
- var _this = this;
791
- if ((this.loadMultipleFiles != true && this.selectedFile.type.startsWith("video"))
792
- || (this.loadMultipleFiles == true && __spread(this.selectedFiles).filter(function (p) { return p.type.startsWith("video"); }).length > 0))
793
- return false;
794
- if (this.acceptedFileTypes == "*")
795
- return true;
796
- //Verifica che i tipi del file (o dei file) caricati siano coerenti con quelli accettati dalla direttiva
797
- var accepted = true;
798
- if (this.loadMultipleFiles != true)
799
- accepted = this.acceptedFileTypes.includes(this.selectedFile.type);
800
- else {
801
- var uploadedFileTypes = __spread(this.selectedFiles).map(function (p) { return p.type; });
802
- uploadedFileTypes.forEach(function (type) {
803
- if (!_this.acceptedFileTypes.includes(type))
804
- accepted = false;
805
- });
806
- }
807
- //Questo controllo permette di gestire le casistiche per cui vengono indicati come tipi validi, ad esempio, 'image/*'
808
- if (!accepted && this.loadMultipleFiles != true) {
809
- try {
810
- for (var _b = __values(this.acceptedFileTypes.split(",").filter(function (t) { return t.includes("*"); })), _c = _b.next(); !_c.done; _c = _b.next()) {
811
- var t = _c.value;
812
- accepted = this.selectedFile.type.startsWith(t.split("*")[0]);
813
- if (accepted)
814
- break;
815
- }
816
- }
817
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
818
- finally {
819
- try {
820
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
821
- }
822
- finally { if (e_1) throw e_1.error; }
823
- }
824
- }
825
- return accepted;
826
- };
827
- /**
828
- * Se eqp-attachments è stata configurata per il caricamento delle sole immagini allora verifica che il file passato in
829
- * input sia effettivamente un immagine o no.
830
- * Se il controllo va a buon fine restituisce TRUE altrimenti mostra un messaggio d'errore e restituisce FALSE
831
- */
832
- EqpAttachmentsComponent.prototype.checkAllowOnlyImageFile = function (newAttachment) {
833
- if (this.allowOnlyImages == true && newAttachment.IsImage != true) {
834
- EqpAttachmentDialogService.Error(this.noImageSelectedErrorMessage);
835
- this.abortFile();
836
- return false;
837
- }
838
- else if (!this.checkAcceptedFiles()) {
839
- EqpAttachmentDialogService.Error(this.wrongTypeSelectedErrorMessage);
840
- this.abortFile();
841
- return false;
842
- }
843
- return true;
844
- };
845
- EqpAttachmentsComponent.prototype.getImageDimensions = function (img) {
846
- var _this = this;
847
- var reader = new FileReader();
848
- reader.onload = function (e) {
849
- var image = new Image();
850
- image.src = e.target.result;
851
- image.onload = function (rs) {
852
- _this.originalHeight = rs.currentTarget['height'];
853
- _this.originalWidth = rs.currentTarget['width'];
854
- if (_this.originalWidth > 1280) {
855
- _this.customWidth = 1280;
856
- _this.customHeight = Math.round((1280 * _this.originalHeight) / _this.originalWidth);
857
- }
858
- else {
859
- _this.customHeight = rs.currentTarget['height'];
860
- _this.customWidth = rs.currentTarget['width'];
861
- }
862
- };
863
- };
864
- reader.readAsDataURL(img);
865
- };
866
- EqpAttachmentsComponent.prototype.restoreOriginalDimensions = function () {
867
- this.customWidth = this.originalWidth;
868
- this.customHeight = this.originalHeight;
869
- };
870
- EqpAttachmentsComponent.prototype.onDimensionsChange = function (dimension) {
871
- if (dimension == "H") {
872
- this.customWidth = Math.round((this.customHeight * this.originalWidth) / this.originalHeight);
873
- }
874
- else if (dimension == "W") {
875
- this.customHeight = Math.round((this.customWidth * this.originalHeight) / this.originalWidth);
876
- }
877
- };
878
- EqpAttachmentsComponent.prototype.imageCropped = function (event) {
879
- this.croppedImage = event.base64;
880
- this.getCroppedAndUpload(this.croppedImage);
881
- };
882
- EqpAttachmentsComponent.prototype.getCroppedAndUpload = function (file) {
883
- var self = this;
884
- var file = base64ToFile(file);
885
- var options = this.compressionOptions;
886
- /**
887
- * Comprime l'immagine passando come parametri le options create nell'oggetto sopra, e il file dal reader principale
888
- */
889
- imageCompression(file, options).then((function (fileCompressed) {
890
- var fileReader = new FileReader();
891
- //Faccio la push di ogni file all'interno dell'array di file dell'item da mandare al server
892
- fileReader.onload = function () {
893
- var resultReader = fileReader.result;
894
- var marker = ';base64,';
895
- self.newAttachment.FileDataBase64 = resultReader.substring(resultReader.indexOf(marker) + marker.length);
896
- self.showCropImage = false;
897
- self.newAttachmentForm.enable();
898
- };
899
- fileReader.readAsDataURL(fileCompressed);
900
- }));
901
- };
902
- EqpAttachmentsComponent.prototype.confirmCrop = function () {
903
- this.imageCropper.crop();
904
- };
905
- /**
906
- * Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO
907
- */
908
- EqpAttachmentsComponent.prototype.abortFile = function () {
909
- this.imageChangedEvent = '';
910
- if (this.imageInput)
911
- this.imageInput.nativeElement.value = '';
912
- this.selectedFile = null;
913
- this.selectedFiles = null;
914
- this.showCropImage = false;
915
- this.newAttachment.IsImage = false;
916
- this.newAttachment.FileDataBase64 = null;
917
- this.newAttachment.FileName = null;
918
- this.newAttachment.FileExtension = null;
919
- this.newAttachment.FileContentType = null;
920
- this.newMultipleAttachments = new Array();
921
- this.customHeight = null;
922
- this.customWidth = null;
923
- this.originalHeight = null;
924
- this.originalWidth = null;
925
- };
926
- EqpAttachmentsComponent.ctorParameters = function () { return [
927
- { type: MatDialog },
928
- { type: FormBuilder },
929
- { type: DomSanitizer },
930
- { type: HttpClient },
931
- { type: ChangeDetectorRef }
932
- ]; };
933
- __decorate([
934
- Input("disableAction")
935
- ], EqpAttachmentsComponent.prototype, "disableAction", void 0);
936
- __decorate([
937
- Input("showHeader")
938
- ], EqpAttachmentsComponent.prototype, "showHeader", void 0);
939
- __decorate([
940
- Input("headerTitle")
941
- ], EqpAttachmentsComponent.prototype, "headerTitle", void 0);
942
- __decorate([
943
- Input("attachmentsList")
944
- ], EqpAttachmentsComponent.prototype, "attachmentsList", void 0);
945
- __decorate([
946
- Input("showMatCard")
947
- ], EqpAttachmentsComponent.prototype, "showMatCard", void 0);
948
- __decorate([
949
- Input("multipleAttachment")
950
- ], EqpAttachmentsComponent.prototype, "multipleAttachment", void 0);
951
- __decorate([
952
- Input("loadMultipleFiles")
953
- ], EqpAttachmentsComponent.prototype, "loadMultipleFiles", void 0);
954
- __decorate([
955
- Input("attachmentsColumns")
956
- ], EqpAttachmentsComponent.prototype, "attachmentsColumns", void 0);
957
- __decorate([
958
- Input("emptyTableMessage")
959
- ], EqpAttachmentsComponent.prototype, "emptyTableMessage", void 0);
960
- __decorate([
961
- Input("allowOnlyImages")
962
- ], EqpAttachmentsComponent.prototype, "allowOnlyImages", void 0);
963
- __decorate([
964
- Input("acceptedFileTypes")
965
- ], EqpAttachmentsComponent.prototype, "acceptedFileTypes", void 0);
966
- __decorate([
967
- Input("isDisabled")
968
- ], EqpAttachmentsComponent.prototype, "isDisabled", void 0);
969
- __decorate([
970
- Input("showInlinePreview")
971
- ], EqpAttachmentsComponent.prototype, "showInlinePreview", void 0);
972
- __decorate([
973
- Input("getAttachmentEndpoint")
974
- ], EqpAttachmentsComponent.prototype, "getAttachmentEndpoint", void 0);
975
- __decorate([
976
- Input("productionBaseUrl")
977
- ], EqpAttachmentsComponent.prototype, "productionBaseUrl", void 0);
978
- __decorate([
979
- Input("compressionOptions")
980
- ], EqpAttachmentsComponent.prototype, "compressionOptions", void 0);
981
- __decorate([
982
- Input("allowedTypes")
983
- ], EqpAttachmentsComponent.prototype, "allowedTypes", void 0);
984
- __decorate([
985
- Input("isEqpTableMultiLanguage")
986
- ], EqpAttachmentsComponent.prototype, "isEqpTableMultiLanguage", void 0);
987
- __decorate([
988
- Input("downloadTooltipPosition")
989
- ], EqpAttachmentsComponent.prototype, "downloadTooltipPosition", void 0);
990
- __decorate([
991
- Input("openLinkLabel")
992
- ], EqpAttachmentsComponent.prototype, "openLinkLabel", void 0);
993
- __decorate([
994
- Input("addButtonLabel")
995
- ], EqpAttachmentsComponent.prototype, "addButtonLabel", void 0);
996
- __decorate([
997
- Input("downloadLabel")
998
- ], EqpAttachmentsComponent.prototype, "downloadLabel", void 0);
999
- __decorate([
1000
- Input("deleteLabel")
1001
- ], EqpAttachmentsComponent.prototype, "deleteLabel", void 0);
1002
- __decorate([
1003
- Input("fileNameLabel")
1004
- ], EqpAttachmentsComponent.prototype, "fileNameLabel", void 0);
1005
- __decorate([
1006
- Input("previewLabel")
1007
- ], EqpAttachmentsComponent.prototype, "previewLabel", void 0);
1008
- __decorate([
1009
- Input("uploadFileLabel")
1010
- ], EqpAttachmentsComponent.prototype, "uploadFileLabel", void 0);
1011
- __decorate([
1012
- Input("confirmLabel")
1013
- ], EqpAttachmentsComponent.prototype, "confirmLabel", void 0);
1014
- __decorate([
1015
- Input("abortLabel")
1016
- ], EqpAttachmentsComponent.prototype, "abortLabel", void 0);
1017
- __decorate([
1018
- Input("saveLabel")
1019
- ], EqpAttachmentsComponent.prototype, "saveLabel", void 0);
1020
- __decorate([
1021
- Input("exitLabel")
1022
- ], EqpAttachmentsComponent.prototype, "exitLabel", void 0);
1023
- __decorate([
1024
- Input("eqpTableSearchText")
1025
- ], EqpAttachmentsComponent.prototype, "eqpTableSearchText", void 0);
1026
- __decorate([
1027
- Input("deleteDialogTitle")
1028
- ], EqpAttachmentsComponent.prototype, "deleteDialogTitle", void 0);
1029
- __decorate([
1030
- Input("deleteDialogMessage")
1031
- ], EqpAttachmentsComponent.prototype, "deleteDialogMessage", void 0);
1032
- __decorate([
1033
- Input("noImageSelectedErrorMessage")
1034
- ], EqpAttachmentsComponent.prototype, "noImageSelectedErrorMessage", void 0);
1035
- __decorate([
1036
- Input("wrongTypeSelectedErrorMessage")
1037
- ], EqpAttachmentsComponent.prototype, "wrongTypeSelectedErrorMessage", void 0);
1038
- __decorate([
1039
- Input("videoPreviewErrorMessage")
1040
- ], EqpAttachmentsComponent.prototype, "videoPreviewErrorMessage", void 0);
1041
- __decorate([
1042
- Input("videoPreviewErrorMessage")
1043
- ], EqpAttachmentsComponent.prototype, "audioPreviewErrorMessage", void 0);
1044
- __decorate([
1045
- Output()
1046
- ], EqpAttachmentsComponent.prototype, "localEditedAttachments", void 0);
1047
- __decorate([
1048
- Output()
1049
- ], EqpAttachmentsComponent.prototype, "abortAddAttachment", void 0);
1050
- __decorate([
1051
- Output("downloadAttachment")
1052
- ], EqpAttachmentsComponent.prototype, "downloadAttachment", void 0);
1053
- __decorate([
1054
- Output("onDeleteAttachment")
1055
- ], EqpAttachmentsComponent.prototype, "onDeleteAttachment", void 0);
1056
- __decorate([
1057
- ViewChild('dialogAddAttachment', { static: true })
1058
- ], EqpAttachmentsComponent.prototype, "dialogAddAttachment", void 0);
1059
- __decorate([
1060
- ViewChild('dialogAddMultipleAttachment', { static: true })
1061
- ], EqpAttachmentsComponent.prototype, "dialogAddMultipleAttachment", void 0);
1062
- __decorate([
1063
- ViewChild(ImageCropperComponent)
1064
- ], EqpAttachmentsComponent.prototype, "imageCropper", void 0);
1065
- __decorate([
1066
- ViewChild('imageInput')
1067
- ], EqpAttachmentsComponent.prototype, "imageInput", void 0);
1068
- __decorate([
1069
- ViewChild('attachmentTable', { static: false })
1070
- ], EqpAttachmentsComponent.prototype, "attachmentTable", void 0);
1071
- __decorate([
1072
- ViewChild('inlinePreviewTemplate', { static: true })
1073
- ], EqpAttachmentsComponent.prototype, "inlinePreviewTemplate", void 0);
1074
- __decorate([
1075
- ViewChild('dialogPreview', { static: true })
1076
- ], EqpAttachmentsComponent.prototype, "dialogPreview", void 0);
1077
- EqpAttachmentsComponent = __decorate([
1078
- Component({
1079
- selector: 'eqp-attachments',
1080
- template: "<!-- Se richiesta la gestione multipla mostra il pulsante di aggiunta e la tabella con l'elenco allegati -->\r\n<div *ngIf=\"multipleAttachment == true\">\r\n <mat-card [ngStyle]=\"{ 'box-shadow': showMatCard == false ? 'none' : null }\">\r\n <mat-card-header>\r\n <div class=\"col-md-6\">\r\n <div class=\"text-nowrap eqp-attachments-header-title\" *ngIf=\"showHeader == true\">\r\n {{headerTitle}}\r\n </div>\r\n </div>\r\n <div class=\"col-md-6 text-right\">\r\n <div class=\"row justify-content-end\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n </div>\r\n </div>\r\n </mat-card-header>\r\n <mat-card-content>\r\n <eqp-table #attachmentTable [createMatCard]=\"false\" #table [columns]=\"attachmentsColumns\"\r\n [isMultiLanguage]=\"isEqpTableMultiLanguage\" [data]=\"attachmentsList\"\r\n [emptyTableMessage]=\"emptyTableMessage\" [searchText]=\"eqpTableSearchText\">\r\n </eqp-table>\r\n </mat-card-content>\r\n </mat-card>\r\n</div>\r\n\r\n<!-- Se richiesta la gestione singola mostra il pulsante di caricamento di un singolo file -->\r\n<div *ngIf=\"multipleAttachment != true\">\r\n <!-- Template del button per l'aggiunta di un allegato -->\r\n <ng-container *ngTemplateOutlet=\"addAttachmentButton\"></ng-container>\r\n\r\n <button class=\"mb-2 mr-2 eqp-attachments-download-btn\" (click)=\"viewAttachment(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\" 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 class=\"mb-2 mr-2 eqp-attachments-preview-btn\" (click)=\"openPreviewDialog(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button color=\"primary\"\r\n *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0] && (!attachmentsList[0].FileContentType || (!attachmentsList[0].FileContentType.startsWith('video') && !attachmentsList[0].FileContentType.startsWith('audio')))\">\r\n <mat-icon>visibility</mat-icon> {{previewLabel}}\r\n </button>\r\n <button class=\"mb-2 eqp-attachments-delete-btn\" (click)=\"deleteAttachment(attachmentsList[0])\" type=\"button\"\r\n mat-raised-button *ngIf=\"attachmentsList && attachmentsList.length > 0 && attachmentsList[0]\"\r\n [disabled]=\"isDisabled\">\r\n <mat-icon>delete</mat-icon> {{deleteLabel}}\r\n </button>\r\n\r\n <div class=\"row\" style=\"margin-top: 10px;\"\r\n *ngIf=\"attachmentsList.length > 0 && attachmentsList[0] && attachmentsList[0].FileDataBase64 && attachmentsList[0].IsImage == true\">\r\n <div class=\"col-sm-12\">\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\r\n\r\n<ng-template #dialogAddAttachment>\r\n <div class=\"container-fluid eqp-attachments-dialog-add-container\"\r\n style=\"max-height: 70vh !important; overflow-x: hidden; overflow-y: auto;\">\r\n <form [formGroup]=\"newAttachmentForm\" (ngSubmit)=\"confirmAddAttachment()\" *ngIf=\"newAttachmentForm\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\"> {{addButtonLabel}} {{ newAttachment.AttachmentType ==\r\n attachmentType.FILE ?\r\n 'File' : 'Link'}} </div>\r\n </div>\r\n <div class=\"row\" style=\"margin-top: 20px;\">\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == attachmentType.FILE\">\r\n <input #imageInput style=\"display:none;\" id=\"file_attachment\"\r\n name=\"file_attachment\" type=\"file\" (change)=\"onFileInputChange($event)\"\r\n [accept]=\"acceptedFileTypes\" [multiple]=\"loadMultipleFiles\"/>\r\n <button (click)=\"imageInput.click()\" type=\"button\" style=\"margin-left: 10px;\" id=\"file_attachment\"\r\n mat-raised-button color=\"primary\" [disabled]=\"showCropImage == true\"\r\n class=\"mb-2 btn btn-primary eqp-attachments-upload-btn\" *ngIf=\"(loadMultipleFiles != true && !newAttachment.FileDataBase64) || (loadMultipleFiles == true && newMultipleAttachments && newMultipleAttachments.length == 0)\">\r\n <mat-icon>cloud_upload</mat-icon>\r\n {{uploadFileLabel}}\r\n </button>\r\n <button (click)=\"abortFile()\" type=\"button\" style=\"margin-left: 10px;\" mat-raised-button\r\n *ngIf=\"(loadMultipleFiles != true && newAttachment.FileDataBase64) || (loadMultipleFiles == true && newMultipleAttachments && newMultipleAttachments.length > 0)\" class=\"mb-2 eqp-attachments-delete-btn\">\r\n <mat-icon>delete</mat-icon> {{deleteLabel}}\r\n </button>\r\n </div>\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == 2 || (selectedFile && loadMultipleFiles != true)\">\r\n <mat-form-field style=\"width: 100%;\">\r\n <mat-label> {{fileNameLabel}} </mat-label>\r\n <input formControlName=\"name\" matInput [(ngModel)]=\"newAttachment.FileName\">\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-sm-12\" *ngIf=\"newAttachment.AttachmentType == 2\">\r\n <mat-form-field style=\"width: 100%;\">\r\n <mat-label> Link </mat-label>\r\n <input formControlName=\"path\" required matInput [(ngModel)]=\"newAttachment.FilePath\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <!-- Riporta l'elenco dei nomi dei file caricati contemporaneamente (visibile solo se loadMultipleFiles = TRUE e se ci sono realmente pi\u00F9 file senza link) -->\r\n <div class=\"row\" *ngIf=\"loadMultipleFiles == true && newMultipleAttachments && newMultipleAttachments.length > 0 && newMultipleAttachments[0].AttachmentType != attachmentType.LINK\">\r\n <div class=\"col-12\" *ngFor=\"let attach of newMultipleAttachments\">\r\n <mat-form-field style=\"width: 100%\">\r\n <mat-label> {{fileNameLabel}} </mat-label>\r\n <input disabled matInput [(ngModel)]=\"attach.FileName\" [ngModelOptions]=\"{standalone: true}\">\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n\r\n <!-- Riporta la preview dell'immagine quando \u00E8 richiesto il caricamento MULTIPLO ma \u00E8 stata selezionata una sola immagine (quindi \u00E8 entrato in gioco anche il croppie) -->\r\n <div class=\"row\" *ngIf=\"loadMultipleFiles == true && showCropImage != true && newMultipleAttachments && newMultipleAttachments.length == 1 && newMultipleAttachments[0].IsImage == true\" style=\"margin-top: 10px;\">\r\n <div class=\"col-4\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{newMultipleAttachments[0].FileDataBase64}}\">\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Riporta la preview dell'immagine quando \u00E8 richiesto il caricamento SINGOLO ed \u00E8 stata selezionata un'immagine -->\r\n <div class=\"row\" *ngIf=\"loadMultipleFiles != true && showCropImage != true && newAttachment.FileDataBase64 && newAttachment.IsImage == true\" style=\"margin-top: 10px;\">\r\n <div class=\"col-4\">\r\n <div class=\"single-attachment-inline-preview-container\">\r\n <img src=\"data:image/png;base64,{{newAttachment.FileDataBase64}}\">\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Richiama il template per le funzionalit\u00E0 del CROPPIE -->\r\n <ng-container [ngTemplateOutlet]=\"croppieTemplate\" [ngTemplateOutletContext]=\"{form: newAttachmentForm}\" *ngIf=\"showCropImage == true\"></ng-container>\r\n\r\n <div class=\"row mt-2\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-save-btn mr-2\" type=\"submit\"\r\n [disabled]=\"showCropImage == true || (loadMultipleFiles != true && newAttachmentForm?.disabled == true) || disableSave()\">\r\n {{saveLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-exit-btn\" (click)=\"close()\"\r\n [disabled]=\"showCropImage == true\" type=\"button\">\r\n {{exitLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #inlinePreviewTemplate let-row=\"row\">\r\n <div class=\"inline-preview-container\" *ngIf=\"row.AttachmentType != AttachmentType.LINK && row.IsImage\" (click)=\"openPreviewDialog(row)\">\r\n <img src=\"data:image/png;base64,{{row.FileThumbnailBase64 ? row.FileThumbnailBase64 : row.FileDataBase64}}\">\r\n </div>\r\n <div class=\"inline-preview-container\" *ngIf=\"row.AttachmentType != AttachmentType.LINK && !row.IsImage\" (click)=\"openPreviewDialog(row)\">\r\n <i [ngClass]=\"getAttachmentIcon(row)\"></i>\r\n </div>\r\n</ng-template>\r\n\r\n\r\n<ng-template #dialogPreview>\r\n <div class=\"container-fluid\" style=\"max-height: 70vh !important;\" *ngIf=\"selectedAttachment\">\r\n <div class=\"row\">\r\n <div class=\"header-title-standard\">\r\n {{previewLabel}} {{ selectedAttachment?.AttachmentType == attachmentType.FILE ? 'File' : 'Link'}}\r\n </div>\r\n </div>\r\n\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 class=\"image-preview\"\r\n src=\"data:image/png;base64,{{selectedAttachment.FileDataBase64 ? selectedAttachment.FileDataBase64 : selectedAttachment.FileThumbnailBase64}}\">\r\n </div>\r\n\r\n <!-- ANTEPRIMA LINK -->\r\n <div class=\"col-12 preview-container\" *ngIf=\"!selectedAttachment.IsImage\">\r\n <iframe class=\"link-preview\" [src]=\"selectedAttachment.TrustedUrl\"\r\n [title]=\"selectedAttachment.FileName\"></iframe>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row mt-3\">\r\n <div class=\"col-sm-12 text-right\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-save-btn mr-2\" type=\"submit\"\r\n (click)=\"viewAttachment(selectedAttachment)\"\r\n *ngIf=\"selectedAttachment.AttachmentType != AttachmentType.LINK\">\r\n {{downloadLabel}}\r\n </button>\r\n <button class=\"btn mat-raised-button eqp-attachments-exit-btn\" mat-dialog-close type=\"button\"\r\n (click)=\"selectedAttachment = null\">\r\n {{exitLabel}}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n\r\n<!-- TEMPLATE PER IL PULSANTE DI AGGIUNTA NUOVO ALLEGATO -->\r\n<ng-template #addAttachmentButton>\r\n\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 <button class=\"btn btn-primary mb-4 mr-5 eqp-attachments-add-btn\" mat-raised-button color=\"primary\" type=\"button\"\r\n *ngIf=\"allowedTypes && allowedTypes.length == 1 && (multipleAttachment == true || (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0])))\"\r\n (click)=\"openModalAddAttachment(allowedTypes[0])\" [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 <span style=\"margin-left: 10px;\">{{addButtonLabel}} {{allowedTypes[0] == 1 ? \"file\" : \"link\"}}</span>\r\n </button>\r\n\r\n\r\n <!-- Pulsante per aprire il menu per la scelta del tipo di Attachment da creare -->\r\n <button class=\"btn btn-primary mb-4 mr-5 eqp-attachments-add-btn\" mat-raised-button color=\"primary\" type=\"button\"\r\n [matMenuTriggerFor]=\"attachmentTypeMenu\" [disabled]=\"isDisabled\"\r\n *ngIf=\"allowedTypes && allowedTypes.length > 1 && (multipleAttachment == true || (!attachmentsList || attachmentsList.length == 0 || (attachmentsList.length > 0 && !attachmentsList[0])))\">\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 <button mat-menu-item (click)=\"openModalAddAttachment(1)\" 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 mat-menu-item (click)=\"openModalAddAttachment(2)\" 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 </mat-menu>\r\n</ng-template>\r\n\r\n\r\n<ng-template #croppieTemplate let-form=\"form\">\r\n <div class=\"row mt-2 mb-2\" [formGroup]=\"form\">\r\n <div class=\"col-md-12 d-flex align-items-center justify-content-center\">\r\n <span class=\"mr-1\">Max H(px):</span>\r\n <mat-form-field>\r\n <input formControlName=\"customHeight\" type=\"number\" matInput [(ngModel)]=\"customHeight\"\r\n (change)=\"onDimensionsChange('H')\">\r\n </mat-form-field>\r\n\r\n <span class=\"ml-2 mr-1\">Max W(px):</span>\r\n <mat-form-field>\r\n <input formControlName=\"customWidth\" type=\"number\" matInput [(ngModel)]=\"customWidth\"\r\n (change)=\"onDimensionsChange('W')\">\r\n </mat-form-field>\r\n\r\n <button class=\"btn btn-primary mat-raised-button ml-2\" (click)=\"restoreOriginalDimensions()\"\r\n [disabled]=\"customWidth == originalWidth && customHeight == originalHeight\">\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 justify-content-center\">\r\n <div style=\"max-height: 450px; max-width: 450px;\">\r\n <image-cropper [imageChangedEvent]=\"imageChangedEvent\" [maintainAspectRatio]=\"false\"\r\n [autoCrop]=\"false\" [containWithinAspectRatio]=\"false\" [aspectRatio]=\"4/3\"\r\n [cropperMinWidth]=\"128\" [onlyScaleDown]=\"true\" [roundCropper]=\"false\" [canvasRotation]=\"0\"\r\n [transform]=\"transform\" [alignImage]=\"'left'\" format=\"png\" (imageCropped)=\"imageCropped($event)\"\r\n [resizeToWidth]=\"customWidth\" [resizeToHeight]=\"customHeight\">\r\n </image-cropper>\r\n </div>\r\n </div>\r\n <div class=\"row justify-content-center mt-2\">\r\n <div style=\"max-height: 450px; max-width: 450px;\">\r\n <button class=\"btn btn-primary mat-raised-button eqp-attachments-confirm-btn mr-2\" type=\"button\"\r\n (click)=\"confirmCrop()\">\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</ng-template>",
1081
- styles: [".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}"]
1082
- })
1083
- ], EqpAttachmentsComponent);
1084
- return EqpAttachmentsComponent;
1085
- }());
1086
-
1087
- var MaterialModule = /** @class */ (function () {
1088
- function MaterialModule() {
1089
- }
1090
- MaterialModule = __decorate([
1091
- NgModule({
1092
- imports: [
1093
- MatCheckboxModule,
1094
- MatButtonModule,
1095
- MatInputModule,
1096
- MatAutocompleteModule,
1097
- MatDatepickerModule,
1098
- MatFormFieldModule,
1099
- MatRadioModule,
1100
- MatSelectModule,
1101
- MatSliderModule,
1102
- MatSlideToggleModule,
1103
- MatMenuModule,
1104
- MatSidenavModule,
1105
- MatToolbarModule,
1106
- MatListModule,
1107
- MatGridListModule,
1108
- MatCardModule,
1109
- MatStepperModule,
1110
- MatTabsModule,
1111
- MatExpansionModule,
1112
- MatButtonToggleModule,
1113
- MatChipsModule,
1114
- MatIconModule,
1115
- MatProgressSpinnerModule,
1116
- MatProgressBarModule,
1117
- MatDialogModule,
1118
- MatTooltipModule,
1119
- MatSnackBarModule,
1120
- MatTableModule,
1121
- MatSortModule,
1122
- MatPaginatorModule,
1123
- MatDatepickerModule,
1124
- MatNativeDateModule
1125
- ],
1126
- exports: [
1127
- MatCheckboxModule,
1128
- MatButtonModule,
1129
- MatInputModule,
1130
- MatAutocompleteModule,
1131
- MatDatepickerModule,
1132
- MatFormFieldModule,
1133
- MatRadioModule,
1134
- MatSelectModule,
1135
- MatSliderModule,
1136
- MatSlideToggleModule,
1137
- MatMenuModule,
1138
- MatSidenavModule,
1139
- MatToolbarModule,
1140
- MatListModule,
1141
- MatGridListModule,
1142
- MatCardModule,
1143
- MatStepperModule,
1144
- MatTabsModule,
1145
- MatExpansionModule,
1146
- MatButtonToggleModule,
1147
- MatChipsModule,
1148
- MatIconModule,
1149
- MatProgressSpinnerModule,
1150
- MatProgressBarModule,
1151
- MatDialogModule,
1152
- MatTooltipModule,
1153
- MatSnackBarModule,
1154
- MatTableModule,
1155
- MatSortModule,
1156
- MatPaginatorModule
1157
- ],
1158
- })
1159
- ], MaterialModule);
1160
- return MaterialModule;
1161
- }());
1162
-
1163
- var EqpAttachmentsModule = /** @class */ (function () {
1164
- function EqpAttachmentsModule() {
1165
- }
1166
- EqpAttachmentsModule = __decorate([
1167
- NgModule({
1168
- declarations: [EqpAttachmentsComponent],
1169
- imports: [
1170
- MaterialModule,
1171
- FormsModule,
1172
- CommonModule,
1173
- ReactiveFormsModule,
1174
- ImageCropperModule,
1175
- EqpTableModule
1176
- ],
1177
- exports: [EqpAttachmentsComponent]
1178
- })
1179
- ], EqpAttachmentsModule);
1180
- return EqpAttachmentsModule;
1181
- }());
1182
-
1183
- /*
1184
- * Public API Surface of eqp-attachments
1185
- */
1186
-
1187
- /**
1188
- * Generated bundle index. Do not edit.
1189
- */
1190
-
1191
- export { AttachmentHelperService, AttachmentType, EqpAttachmentDialogService, EqpAttachmentsComponent, EqpAttachmentsModule, ɵ0, MaterialModule as ɵa };
1192
- //# sourceMappingURL=eqproject-eqp-attachments.js.map