@eqproject/eqp-attachments 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/bundles/eqproject-eqp-attachments.umd.js +229 -86
- package/bundles/eqproject-eqp-attachments.umd.js.map +1 -1
- package/bundles/eqproject-eqp-attachments.umd.min.js +1 -1
- package/bundles/eqproject-eqp-attachments.umd.min.js.map +1 -1
- package/eqproject-eqp-attachments.metadata.json +1 -1
- package/esm2015/lib/eqp-attachments.component.js +190 -71
- package/esm5/lib/eqp-attachments.component.js +232 -89
- package/fesm2015/eqproject-eqp-attachments.js +189 -70
- package/fesm2015/eqproject-eqp-attachments.js.map +1 -1
- package/fesm5/eqproject-eqp-attachments.js +231 -88
- package/fesm5/eqproject-eqp-attachments.js.map +1 -1
- package/lib/eqp-attachments.component.d.ts +27 -9
- package/package.json +2 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { __decorate, __awaiter } from 'tslib';
|
|
2
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
3
|
import { ɵɵdefineInjectable, Injectable, EventEmitter, ChangeDetectorRef, Input, Output, ViewChild, Component, NgModule } from '@angular/core';
|
|
3
4
|
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
5
|
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
|
8
|
-
import Swal from 'sweetalert2';
|
|
9
6
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
10
|
-
import {
|
|
7
|
+
import { TooltipPositionType, TypeColumn, EqpTableModule } from '@eqproject/eqp-table';
|
|
8
|
+
import imageCompression from 'browser-image-compression';
|
|
9
|
+
import * as JSZip from 'jszip';
|
|
10
|
+
import { base64ToFile, ImageCropperComponent, ImageCropperModule } from 'ngx-image-cropper';
|
|
11
|
+
import Swal from 'sweetalert2';
|
|
11
12
|
import { CommonModule } from '@angular/common';
|
|
12
13
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
13
14
|
import { MatButtonModule } from '@angular/material/button';
|
|
@@ -40,12 +41,6 @@ import { MatSortModule } from '@angular/material/sort';
|
|
|
40
41
|
import { MatPaginatorModule } from '@angular/material/paginator';
|
|
41
42
|
import { MatNativeDateModule } from '@angular/material/core';
|
|
42
43
|
|
|
43
|
-
var AttachmentType;
|
|
44
|
-
(function (AttachmentType) {
|
|
45
|
-
AttachmentType[AttachmentType["FILE"] = 1] = "FILE";
|
|
46
|
-
AttachmentType[AttachmentType["LINK"] = 2] = "LINK";
|
|
47
|
-
})(AttachmentType || (AttachmentType = {}));
|
|
48
|
-
|
|
49
44
|
let AttachmentHelperService = class AttachmentHelperService {
|
|
50
45
|
constructor() {
|
|
51
46
|
}
|
|
@@ -104,6 +99,12 @@ AttachmentHelperService = __decorate([
|
|
|
104
99
|
})
|
|
105
100
|
], AttachmentHelperService);
|
|
106
101
|
|
|
102
|
+
var AttachmentType;
|
|
103
|
+
(function (AttachmentType) {
|
|
104
|
+
AttachmentType[AttachmentType["FILE"] = 1] = "FILE";
|
|
105
|
+
AttachmentType[AttachmentType["LINK"] = 2] = "LINK";
|
|
106
|
+
})(AttachmentType || (AttachmentType = {}));
|
|
107
|
+
|
|
107
108
|
let EqpAttachmentDialogService = class EqpAttachmentDialogService {
|
|
108
109
|
constructor() {
|
|
109
110
|
}
|
|
@@ -203,11 +204,11 @@ EqpAttachmentDialogService = __decorate([
|
|
|
203
204
|
})
|
|
204
205
|
], EqpAttachmentDialogService);
|
|
205
206
|
|
|
206
|
-
const toBase64 = file => new Promise((resolve, reject) => {
|
|
207
|
+
const toBase64 = (file) => new Promise((resolve, reject) => {
|
|
207
208
|
const reader = new FileReader();
|
|
208
209
|
reader.readAsDataURL(file);
|
|
209
210
|
reader.onload = () => resolve(reader.result.toString());
|
|
210
|
-
reader.onerror = error => reject(error);
|
|
211
|
+
reader.onerror = (error) => reject(error);
|
|
211
212
|
});
|
|
212
213
|
const ɵ0 = toBase64;
|
|
213
214
|
let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
@@ -287,7 +288,11 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
287
288
|
/**
|
|
288
289
|
* Opzioni per la compressione delle immagini caricate.
|
|
289
290
|
*/
|
|
290
|
-
this.compressionOptions = {
|
|
291
|
+
this.compressionOptions = {
|
|
292
|
+
maxSizeMB: 0.5,
|
|
293
|
+
maxWidthOrHeight: 1920,
|
|
294
|
+
useWebWorker: true
|
|
295
|
+
};
|
|
291
296
|
/**
|
|
292
297
|
* Array di AttachmentType che si possono aggiungere
|
|
293
298
|
*/
|
|
@@ -307,6 +312,22 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
307
312
|
* per la tabella contenente l'elenco degli allegati
|
|
308
313
|
*/
|
|
309
314
|
this.tablePaginatorSize = null;
|
|
315
|
+
/**
|
|
316
|
+
* Abilitare caricamento video
|
|
317
|
+
*/
|
|
318
|
+
this.allowVideo = false;
|
|
319
|
+
/**
|
|
320
|
+
* Abilitare la compressione al caricamento di un video (allowVideo dev'essere true)
|
|
321
|
+
*/
|
|
322
|
+
this.allowVideoCompression = false;
|
|
323
|
+
/**
|
|
324
|
+
* Lista di formati video non ammessi
|
|
325
|
+
*/
|
|
326
|
+
this.videoFormatsNotAllowed = ["mkv", "avi"];
|
|
327
|
+
/**
|
|
328
|
+
* dimensione massima ammessa per file
|
|
329
|
+
*/
|
|
330
|
+
this.allowedMBForFile = 100;
|
|
310
331
|
/**
|
|
311
332
|
* Input per definire le label da usare nel componente
|
|
312
333
|
*/
|
|
@@ -365,11 +386,12 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
365
386
|
this.showCropImage = false;
|
|
366
387
|
//#endregion
|
|
367
388
|
//#region Proprietà per gestione ridimensionamento file di tipo image
|
|
368
|
-
this.imageChangedEvent =
|
|
369
|
-
this.croppedImage =
|
|
389
|
+
this.imageChangedEvent = "";
|
|
390
|
+
this.croppedImage = "";
|
|
370
391
|
this.transform = {};
|
|
371
392
|
//#endregion
|
|
372
393
|
this.AttachmentType = AttachmentType;
|
|
394
|
+
this.showZipSpinner = false;
|
|
373
395
|
}
|
|
374
396
|
ngOnInit() {
|
|
375
397
|
//Se è stata richiesta la gestione delle sole immagini allora imposta il filtro per le estensioni possibili da caricare
|
|
@@ -381,8 +403,8 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
381
403
|
// Se non sono stati specificati i tipi da gestire ma è stato passato null o un array vuoto imposto i tipi di default.
|
|
382
404
|
if (!this.allowedTypes || this.allowedTypes.length == 0)
|
|
383
405
|
this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];
|
|
384
|
-
else if (this.allowedTypes.find(t => t != AttachmentType.FILE && t != AttachmentType.LINK)) {
|
|
385
|
-
EqpAttachmentDialogService.Warning(
|
|
406
|
+
else if (this.allowedTypes.find((t) => t != AttachmentType.FILE && t != AttachmentType.LINK)) {
|
|
407
|
+
EqpAttachmentDialogService.Warning('Almeno uno degli AttachmentType selezionati nel parametro "allowedTypes" non esiste.');
|
|
386
408
|
this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];
|
|
387
409
|
}
|
|
388
410
|
//Se è stata richiesta la gestione multipla degli allegati allora configura l'eqp-table
|
|
@@ -401,7 +423,7 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
401
423
|
this.attachmentTable.reloadDatatable();
|
|
402
424
|
}
|
|
403
425
|
checkAttachmentImage() {
|
|
404
|
-
this.attachmentsList.forEach(a => {
|
|
426
|
+
this.attachmentsList.forEach((a) => {
|
|
405
427
|
a.IsImage = AttachmentHelperService.checkImageFromMimeType(a.FileContentType);
|
|
406
428
|
});
|
|
407
429
|
}
|
|
@@ -413,27 +435,45 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
413
435
|
this.attachmentsColumns = [];
|
|
414
436
|
if (this.disableAction != true) {
|
|
415
437
|
this.attachmentsColumns.push({
|
|
416
|
-
key: "action",
|
|
417
|
-
|
|
438
|
+
key: "action",
|
|
439
|
+
display: "",
|
|
440
|
+
type: TypeColumn.MenuAction,
|
|
441
|
+
buttonMenuIcon: "more_vert",
|
|
442
|
+
styles: { flex: "0 0 6%" },
|
|
418
443
|
actions: [
|
|
419
|
-
{ name: this.deleteLabel, icon: "delete", fn: (element, index, col) => this.deleteAttachment(element) }
|
|
420
|
-
]
|
|
444
|
+
{ name: this.deleteLabel, icon: "delete", fn: (element, index, col) => this.deleteAttachment(element) }
|
|
445
|
+
]
|
|
421
446
|
});
|
|
422
447
|
}
|
|
423
448
|
let downloadColumn = {
|
|
424
|
-
key: "attachment",
|
|
425
|
-
|
|
449
|
+
key: "attachment",
|
|
450
|
+
display: "",
|
|
451
|
+
type: TypeColumn.SimpleAction,
|
|
452
|
+
styles: { flex: "0 0 6%" },
|
|
426
453
|
actions: [
|
|
427
454
|
{
|
|
428
|
-
name:
|
|
429
|
-
|
|
455
|
+
name: "",
|
|
456
|
+
fontawesome: true,
|
|
457
|
+
icon: (element) => {
|
|
458
|
+
return this.showInlinePreview
|
|
459
|
+
? element.AttachmentType == AttachmentType.FILE
|
|
460
|
+
? "fas fa-cloud-download-alt"
|
|
461
|
+
: "fas fa-external-link-alt"
|
|
462
|
+
: this.getAttachmentIcon(element);
|
|
463
|
+
},
|
|
430
464
|
fn: (element, col, elementIndex) => this.viewAttachment(element),
|
|
431
|
-
tooltip: {
|
|
432
|
-
|
|
465
|
+
tooltip: {
|
|
466
|
+
tooltipText: (element) => {
|
|
467
|
+
return element.AttachmentType == AttachmentType.FILE ? this.downloadLabel : this.openLinkLabel;
|
|
468
|
+
},
|
|
469
|
+
tooltipPosition: this.downloadTooltipPosition
|
|
470
|
+
}
|
|
471
|
+
}
|
|
433
472
|
]
|
|
434
473
|
};
|
|
435
474
|
let inlinePreviewColumn = {
|
|
436
|
-
key: "InlinePreview",
|
|
475
|
+
key: "InlinePreview",
|
|
476
|
+
display: this.previewLabel,
|
|
437
477
|
type: TypeColumn.ExternalTemplate,
|
|
438
478
|
externalTemplate: this.inlinePreviewTemplate,
|
|
439
479
|
styles: { flex: "0 0 10%" }
|
|
@@ -475,7 +515,7 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
475
515
|
*/
|
|
476
516
|
viewAttachment(attachment) {
|
|
477
517
|
if (attachment.AttachmentType == AttachmentType.LINK) {
|
|
478
|
-
window.open(attachment.FilePath,
|
|
518
|
+
window.open(attachment.FilePath, "_blank");
|
|
479
519
|
return;
|
|
480
520
|
}
|
|
481
521
|
if (attachment.FileDataBase64 && attachment.FileContentType && attachment.FileName) {
|
|
@@ -505,6 +545,7 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
505
545
|
* Apre la modale per la definizione dei parametri del nuovo file
|
|
506
546
|
*/
|
|
507
547
|
openModalAddAttachment(attachmentType) {
|
|
548
|
+
this.showZipSpinner = false;
|
|
508
549
|
//Se è stato richiesto il caricamento di un LINK o è impostato il caricamento di FILE SINGOLO allora apre la modale per
|
|
509
550
|
//il caricamento singolo del file altrimenti apre quella per il caricamento multiplo
|
|
510
551
|
// if (attachmentType == AttachmentType.LINK || (attachmentType == AttachmentType.FILE && this.loadMultipleFiles != true)) {
|
|
@@ -519,8 +560,8 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
519
560
|
this.dialofRefAddAttachment = this.dialog.open(this.dialogAddAttachment, {
|
|
520
561
|
disableClose: true,
|
|
521
562
|
hasBackdrop: true,
|
|
522
|
-
width:
|
|
523
|
-
maxHeight:
|
|
563
|
+
width: "60%",
|
|
564
|
+
maxHeight: "80%"
|
|
524
565
|
});
|
|
525
566
|
}
|
|
526
567
|
createAttachmentForm() {
|
|
@@ -558,7 +599,8 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
558
599
|
}
|
|
559
600
|
}
|
|
560
601
|
else {
|
|
561
|
-
return this.newMultipleAttachments.filter(p => (p.AttachmentType == AttachmentType.FILE && !p.FileDataBase64) ||
|
|
602
|
+
return (this.newMultipleAttachments.filter((p) => (p.AttachmentType == AttachmentType.FILE && !p.FileDataBase64) ||
|
|
603
|
+
(p.AttachmentType == AttachmentType.LINK && !p.FilePath)).length > 0);
|
|
562
604
|
}
|
|
563
605
|
}
|
|
564
606
|
confirmAddAttachment() {
|
|
@@ -601,13 +643,19 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
601
643
|
}
|
|
602
644
|
if (this.getAttachmentEndpoint && this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64) {
|
|
603
645
|
yield this.getAttachmentByID()
|
|
604
|
-
.then((res) => {
|
|
605
|
-
.
|
|
646
|
+
.then((res) => {
|
|
647
|
+
this.selectedAttachment.FileDataBase64 = res.FileDataBase64;
|
|
648
|
+
})
|
|
649
|
+
.catch((err) => {
|
|
650
|
+
EqpAttachmentDialogService.Error(err);
|
|
651
|
+
});
|
|
606
652
|
}
|
|
607
653
|
if (this.selectedAttachment.AttachmentType == AttachmentType.LINK) {
|
|
608
654
|
this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.selectedAttachment.FilePath);
|
|
609
655
|
}
|
|
610
|
-
else if (this.selectedAttachment.IsImage &&
|
|
656
|
+
else if (this.selectedAttachment.IsImage &&
|
|
657
|
+
!this.selectedAttachment.FileDataBase64 &&
|
|
658
|
+
!this.selectedAttachment.FileThumbnailBase64) {
|
|
611
659
|
EqpAttachmentDialogService.Info("Impossibile aprire l'anteprima dell'allegato, file mancante.");
|
|
612
660
|
return;
|
|
613
661
|
}
|
|
@@ -626,7 +674,7 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
626
674
|
}
|
|
627
675
|
this.dialog.open(this.dialogPreview, {
|
|
628
676
|
disableClose: true,
|
|
629
|
-
hasBackdrop: true
|
|
677
|
+
hasBackdrop: true
|
|
630
678
|
});
|
|
631
679
|
});
|
|
632
680
|
}
|
|
@@ -645,6 +693,7 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
645
693
|
* immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
|
|
646
694
|
*/
|
|
647
695
|
onFileInputChange(event) {
|
|
696
|
+
var _a;
|
|
648
697
|
return __awaiter(this, void 0, void 0, function* () {
|
|
649
698
|
this.showCropImage = false;
|
|
650
699
|
//Se è stato richiesto il caricamento SINGOLO oppure se il caricamento è MULTIPLO ma è stato selezionato un solo file
|
|
@@ -654,18 +703,21 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
654
703
|
this.selectedFiles = event.target.files;
|
|
655
704
|
if (!this.selectedFile)
|
|
656
705
|
return;
|
|
657
|
-
|
|
706
|
+
this.showZipSpinner = true;
|
|
707
|
+
//Memorizza i dati per l'allegato
|
|
658
708
|
this.newAttachment = yield this.createAttachmentFromUploadedFile(this.selectedFile, false);
|
|
659
709
|
this.newMultipleAttachments = new Array();
|
|
660
710
|
this.newMultipleAttachments.push(this.newAttachment);
|
|
661
711
|
//Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine
|
|
662
712
|
let checkOnlyImage = this.checkAllowOnlyImageFile(this.newAttachment);
|
|
663
|
-
if (checkOnlyImage == false)
|
|
713
|
+
if (checkOnlyImage == false) {
|
|
714
|
+
this.showZipSpinner = false;
|
|
664
715
|
return;
|
|
716
|
+
}
|
|
665
717
|
if (this.loadMultipleFiles == true && [...event.target.files].length == 1)
|
|
666
718
|
this.createAttachmentForm();
|
|
667
719
|
//Verifica se il file caricato è un'immagine oppure no. Se è un immagine, prima di caricarla mostra il croppie per il resize.
|
|
668
|
-
//Se non è un immagine allora genera il Base64
|
|
720
|
+
//Se non è un immagine allora genera il Base64
|
|
669
721
|
if (this.newAttachment.IsImage == true) {
|
|
670
722
|
this.getImageDimensions(event.target.files[0]);
|
|
671
723
|
//Mostra il croppie e disabilita la form finchè non termina la modifica dell'immagine
|
|
@@ -678,26 +730,62 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
678
730
|
else {
|
|
679
731
|
this.showCropImage = false;
|
|
680
732
|
let base64Result = yield this.getBase64FromFile(this.selectedFile);
|
|
681
|
-
this.
|
|
682
|
-
|
|
733
|
+
if (this.allowVideo && this.allowVideoCompression && this.selectedFile.type.startsWith("video")) {
|
|
734
|
+
this.newAttachment = yield this.zipVideo(this.newAttachment, base64Result.Base64File);
|
|
735
|
+
}
|
|
736
|
+
else {
|
|
737
|
+
this.newAttachment.FileDataBase64 = base64Result.Base64File;
|
|
738
|
+
this.newAttachment.FileContentType = base64Result.ContentType;
|
|
739
|
+
}
|
|
683
740
|
}
|
|
741
|
+
this.showZipSpinner = false;
|
|
684
742
|
}
|
|
685
743
|
else {
|
|
686
744
|
this.selectedFiles = event.target.files;
|
|
687
745
|
if (!this.selectedFiles || this.selectedFiles.length == 0)
|
|
688
746
|
return;
|
|
689
747
|
this.newMultipleAttachments = new Array();
|
|
690
|
-
|
|
748
|
+
this.showZipSpinner = true;
|
|
749
|
+
for (let i = 0; i < ((_a = this.selectedFiles) === null || _a === void 0 ? void 0 : _a.length); i++) {
|
|
691
750
|
let newAttachment = yield this.createAttachmentFromUploadedFile(this.selectedFiles[i], true);
|
|
751
|
+
if (this.allowVideo && this.allowVideoCompression && this.selectedFiles[i].type.startsWith("video")) {
|
|
752
|
+
newAttachment = yield this.zipVideo(newAttachment, newAttachment.FileDataBase64);
|
|
753
|
+
}
|
|
692
754
|
//Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine
|
|
693
755
|
let checkOnlyImage = this.checkAllowOnlyImageFile(newAttachment);
|
|
694
|
-
if (checkOnlyImage == false)
|
|
756
|
+
if (checkOnlyImage == false) {
|
|
757
|
+
this.showZipSpinner = false;
|
|
695
758
|
return;
|
|
759
|
+
}
|
|
696
760
|
this.newMultipleAttachments.push(newAttachment);
|
|
697
761
|
}
|
|
762
|
+
this.showZipSpinner = false;
|
|
698
763
|
}
|
|
699
764
|
});
|
|
700
765
|
}
|
|
766
|
+
zipVideo(newAttachment, base64) {
|
|
767
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
768
|
+
const zip = new JSZip();
|
|
769
|
+
const videoFolder = zip.folder("videos");
|
|
770
|
+
videoFolder.file(newAttachment.FileName, base64, { base64: true });
|
|
771
|
+
let content = yield zip.generateAsync({
|
|
772
|
+
type: "blob",
|
|
773
|
+
compression: "DEFLATE",
|
|
774
|
+
compressionOptions: {
|
|
775
|
+
/* compression level ranges from 1 (best speed) to 9 (best compression) */
|
|
776
|
+
level: 9
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
let base64Result = yield this.getBase64FromFile(content);
|
|
780
|
+
newAttachment.FileContentType = content.type;
|
|
781
|
+
newAttachment.FileName = newAttachment.FileName.replace(/\.[^/.]+$/, "") + ".zip";
|
|
782
|
+
newAttachment.FileExtension = newAttachment.FileName.substring(newAttachment.FileName.lastIndexOf(".") + 1);
|
|
783
|
+
newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(content.type);
|
|
784
|
+
newAttachment.FileDataBase64 = base64Result.Base64File;
|
|
785
|
+
newAttachment.FileContentType = base64Result.ContentType;
|
|
786
|
+
return newAttachment;
|
|
787
|
+
});
|
|
788
|
+
}
|
|
701
789
|
/**
|
|
702
790
|
* A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
|
|
703
791
|
* Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
|
|
@@ -709,11 +797,11 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
709
797
|
createAttachmentFromUploadedFile(currentFile, getBase64 = true) {
|
|
710
798
|
return __awaiter(this, void 0, void 0, function* () {
|
|
711
799
|
let newAttachment = {};
|
|
712
|
-
//Memorizza i dati per l'allegato
|
|
800
|
+
//Memorizza i dati per l'allegato
|
|
713
801
|
newAttachment.AttachmentType = AttachmentType.FILE;
|
|
714
802
|
newAttachment.FileContentType = currentFile.type;
|
|
715
803
|
newAttachment.FileName = currentFile.name;
|
|
716
|
-
newAttachment.FileExtension = currentFile.name.
|
|
804
|
+
newAttachment.FileExtension = currentFile.name.substring(currentFile.name.lastIndexOf(".") + 1);
|
|
717
805
|
newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(currentFile.type);
|
|
718
806
|
if (getBase64 == true) {
|
|
719
807
|
let base64Result = yield this.getBase64FromFile(currentFile);
|
|
@@ -753,9 +841,28 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
753
841
|
* @returns
|
|
754
842
|
*/
|
|
755
843
|
checkAcceptedFiles() {
|
|
756
|
-
|
|
757
|
-
|
|
844
|
+
var _a, _b;
|
|
845
|
+
if (!this.allowVideo) {
|
|
846
|
+
if ((!this.loadMultipleFiles && this.selectedFile.type.startsWith("video")) ||
|
|
847
|
+
(this.loadMultipleFiles == true && [...this.selectedFiles].filter((p) => p.type.startsWith("video")).length > 0))
|
|
848
|
+
return false;
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
if ((!this.loadMultipleFiles &&
|
|
852
|
+
this.videoFormatsNotAllowed.includes((_a = this.selectedFile) === null || _a === void 0 ? void 0 : _a.name.substring(this.selectedFile.name.lastIndexOf(".") + 1))) ||
|
|
853
|
+
(this.loadMultipleFiles &&
|
|
854
|
+
this.selectedFiles &&
|
|
855
|
+
[...this.selectedFiles].filter((p) => this.videoFormatsNotAllowed.includes(p.name.substring(p.name.lastIndexOf(".") + 1))).length > 0))
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
if (!this.loadMultipleFiles && ((_b = this.selectedFile) === null || _b === void 0 ? void 0 : _b.size) / (1024 * 1024) > this.allowedMBForFile) {
|
|
859
|
+
return false;
|
|
860
|
+
}
|
|
861
|
+
if (this.loadMultipleFiles &&
|
|
862
|
+
this.selectedFiles &&
|
|
863
|
+
[...this.selectedFiles].filter((p) => { var _a; return ((_a = p) === null || _a === void 0 ? void 0 : _a.size) / (1024 * 1024) > this.allowedMBForFile; }).length > 0) {
|
|
758
864
|
return false;
|
|
865
|
+
}
|
|
759
866
|
if (this.acceptedFileTypes == "*")
|
|
760
867
|
return true;
|
|
761
868
|
//Verifica che i tipi del file (o dei file) caricati siano coerenti con quelli accettati dalla direttiva
|
|
@@ -763,15 +870,15 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
763
870
|
if (this.loadMultipleFiles != true)
|
|
764
871
|
accepted = this.acceptedFileTypes.includes(this.selectedFile.type);
|
|
765
872
|
else {
|
|
766
|
-
let uploadedFileTypes = [...this.selectedFiles].map(p => p.type);
|
|
767
|
-
uploadedFileTypes.forEach(type => {
|
|
873
|
+
let uploadedFileTypes = [...this.selectedFiles].map((p) => p.type);
|
|
874
|
+
uploadedFileTypes.forEach((type) => {
|
|
768
875
|
if (!this.acceptedFileTypes.includes(type))
|
|
769
876
|
accepted = false;
|
|
770
877
|
});
|
|
771
878
|
}
|
|
772
879
|
//Questo controllo permette di gestire le casistiche per cui vengono indicati come tipi validi, ad esempio, 'image/*'
|
|
773
880
|
if (!accepted && this.loadMultipleFiles != true) {
|
|
774
|
-
for (let t of this.acceptedFileTypes.split(",").filter(t => t.includes("*"))) {
|
|
881
|
+
for (let t of this.acceptedFileTypes.split(",").filter((t) => t.includes("*"))) {
|
|
775
882
|
accepted = this.selectedFile.type.startsWith(t.split("*")[0]);
|
|
776
883
|
if (accepted)
|
|
777
884
|
break;
|
|
@@ -802,16 +909,16 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
802
909
|
reader.onload = (e) => {
|
|
803
910
|
const image = new Image();
|
|
804
911
|
image.src = e.target.result;
|
|
805
|
-
image.onload = rs => {
|
|
806
|
-
this.originalHeight = rs.currentTarget[
|
|
807
|
-
this.originalWidth = rs.currentTarget[
|
|
912
|
+
image.onload = (rs) => {
|
|
913
|
+
this.originalHeight = rs.currentTarget["height"];
|
|
914
|
+
this.originalWidth = rs.currentTarget["width"];
|
|
808
915
|
if (this.originalWidth > 1280) {
|
|
809
916
|
this.customWidth = 1280;
|
|
810
917
|
this.customHeight = Math.round((1280 * this.originalHeight) / this.originalWidth);
|
|
811
918
|
}
|
|
812
919
|
else {
|
|
813
|
-
this.customHeight = rs.currentTarget[
|
|
814
|
-
this.customWidth = rs.currentTarget[
|
|
920
|
+
this.customHeight = rs.currentTarget["height"];
|
|
921
|
+
this.customWidth = rs.currentTarget["width"];
|
|
815
922
|
}
|
|
816
923
|
};
|
|
817
924
|
};
|
|
@@ -840,18 +947,18 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
840
947
|
/**
|
|
841
948
|
* Comprime l'immagine passando come parametri le options create nell'oggetto sopra, e il file dal reader principale
|
|
842
949
|
*/
|
|
843
|
-
imageCompression(file, options).then((fileCompressed => {
|
|
950
|
+
imageCompression(file, options).then((fileCompressed) => {
|
|
844
951
|
let fileReader = new FileReader();
|
|
845
952
|
//Faccio la push di ogni file all'interno dell'array di file dell'item da mandare al server
|
|
846
953
|
fileReader.onload = function () {
|
|
847
954
|
let resultReader = fileReader.result;
|
|
848
|
-
var marker =
|
|
955
|
+
var marker = ";base64,";
|
|
849
956
|
self.newAttachment.FileDataBase64 = resultReader.substring(resultReader.indexOf(marker) + marker.length);
|
|
850
957
|
self.showCropImage = false;
|
|
851
958
|
self.newAttachmentForm.enable();
|
|
852
959
|
};
|
|
853
960
|
fileReader.readAsDataURL(fileCompressed);
|
|
854
|
-
})
|
|
961
|
+
});
|
|
855
962
|
}
|
|
856
963
|
confirmCrop() {
|
|
857
964
|
this.imageCropper.crop();
|
|
@@ -860,9 +967,9 @@ let EqpAttachmentsComponent = class EqpAttachmentsComponent {
|
|
|
860
967
|
* Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO
|
|
861
968
|
*/
|
|
862
969
|
abortFile() {
|
|
863
|
-
this.imageChangedEvent =
|
|
970
|
+
this.imageChangedEvent = "";
|
|
864
971
|
if (this.imageInput)
|
|
865
|
-
this.imageInput.nativeElement.value =
|
|
972
|
+
this.imageInput.nativeElement.value = "";
|
|
866
973
|
this.selectedFile = null;
|
|
867
974
|
this.selectedFiles = null;
|
|
868
975
|
this.showCropImage = false;
|
|
@@ -945,6 +1052,18 @@ __decorate([
|
|
|
945
1052
|
__decorate([
|
|
946
1053
|
Input("tablePaginatorSize")
|
|
947
1054
|
], EqpAttachmentsComponent.prototype, "tablePaginatorSize", void 0);
|
|
1055
|
+
__decorate([
|
|
1056
|
+
Input("allowVideo")
|
|
1057
|
+
], EqpAttachmentsComponent.prototype, "allowVideo", void 0);
|
|
1058
|
+
__decorate([
|
|
1059
|
+
Input("allowVideoCompression")
|
|
1060
|
+
], EqpAttachmentsComponent.prototype, "allowVideoCompression", void 0);
|
|
1061
|
+
__decorate([
|
|
1062
|
+
Input("videoFormatsNotAllowed")
|
|
1063
|
+
], EqpAttachmentsComponent.prototype, "videoFormatsNotAllowed", void 0);
|
|
1064
|
+
__decorate([
|
|
1065
|
+
Input("allowedMBForFile")
|
|
1066
|
+
], EqpAttachmentsComponent.prototype, "allowedMBForFile", void 0);
|
|
948
1067
|
__decorate([
|
|
949
1068
|
Input("downloadTooltipPosition")
|
|
950
1069
|
], EqpAttachmentsComponent.prototype, "downloadTooltipPosition", void 0);
|
|
@@ -1018,30 +1137,30 @@ __decorate([
|
|
|
1018
1137
|
Output("onComponentLoaded")
|
|
1019
1138
|
], EqpAttachmentsComponent.prototype, "onComponentLoaded", void 0);
|
|
1020
1139
|
__decorate([
|
|
1021
|
-
ViewChild(
|
|
1140
|
+
ViewChild("dialogAddAttachment", { static: true })
|
|
1022
1141
|
], EqpAttachmentsComponent.prototype, "dialogAddAttachment", void 0);
|
|
1023
1142
|
__decorate([
|
|
1024
|
-
ViewChild(
|
|
1143
|
+
ViewChild("dialogAddMultipleAttachment", { static: true })
|
|
1025
1144
|
], EqpAttachmentsComponent.prototype, "dialogAddMultipleAttachment", void 0);
|
|
1026
1145
|
__decorate([
|
|
1027
1146
|
ViewChild(ImageCropperComponent)
|
|
1028
1147
|
], EqpAttachmentsComponent.prototype, "imageCropper", void 0);
|
|
1029
1148
|
__decorate([
|
|
1030
|
-
ViewChild(
|
|
1149
|
+
ViewChild("imageInput")
|
|
1031
1150
|
], EqpAttachmentsComponent.prototype, "imageInput", void 0);
|
|
1032
1151
|
__decorate([
|
|
1033
|
-
ViewChild(
|
|
1152
|
+
ViewChild("attachmentTable", { static: false })
|
|
1034
1153
|
], EqpAttachmentsComponent.prototype, "attachmentTable", void 0);
|
|
1035
1154
|
__decorate([
|
|
1036
|
-
ViewChild(
|
|
1155
|
+
ViewChild("inlinePreviewTemplate", { static: true })
|
|
1037
1156
|
], EqpAttachmentsComponent.prototype, "inlinePreviewTemplate", void 0);
|
|
1038
1157
|
__decorate([
|
|
1039
|
-
ViewChild(
|
|
1158
|
+
ViewChild("dialogPreview", { static: true })
|
|
1040
1159
|
], EqpAttachmentsComponent.prototype, "dialogPreview", void 0);
|
|
1041
1160
|
EqpAttachmentsComponent = __decorate([
|
|
1042
1161
|
Component({
|
|
1043
|
-
selector:
|
|
1044
|
-
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 [paginatorVisible]=\"tablePaginatorVisible\" [matPaginatorSize]=\"tablePaginatorSize\"\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>",
|
|
1162
|
+
selector: "eqp-attachments",
|
|
1163
|
+
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 [paginatorVisible]=\"tablePaginatorVisible\" [matPaginatorSize]=\"tablePaginatorSize\"\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 eqp-attachments-save-btn mr-2\" type=\"submit\"\r\n [disabled]=\"showCropImage == true || (loadMultipleFiles != true && newAttachmentForm?.disabled == true) || disableSave()\">\r\n <span *ngIf=\"showZipSpinner\" class=\"spinner-border spinner-border-sm eqp-attachments-save-spinner\" role=\"status\" aria-hidden=\"true\"></span>\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>",
|
|
1045
1164
|
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}"]
|
|
1046
1165
|
})
|
|
1047
1166
|
], EqpAttachmentsComponent);
|