@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,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@eqproject/eqp-attachments', ['exports', '@angular/core', '@angular/forms', '
|
|
4
|
-
(global = global || self, factory((global.eqproject = global.eqproject || {}, global.eqproject['eqp-attachments'] = {}), global.ng.core, global.ng.forms, global.
|
|
5
|
-
}(this, (function (exports, core, forms,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common/http'), require('@angular/core'), require('@angular/forms'), require('@angular/material/dialog'), require('@angular/platform-browser'), require('@eqproject/eqp-table'), require('browser-image-compression'), require('jszip'), require('ngx-image-cropper'), require('sweetalert2'), require('@angular/common'), require('@angular/material/checkbox'), require('@angular/material/button'), require('@angular/material/input'), require('@angular/material/autocomplete'), require('@angular/material/datepicker'), require('@angular/material/form-field'), require('@angular/material/radio'), require('@angular/material/select'), require('@angular/material/slider'), require('@angular/material/slide-toggle'), require('@angular/material/menu'), require('@angular/material/sidenav'), require('@angular/material/toolbar'), require('@angular/material/list'), require('@angular/material/grid-list'), require('@angular/material/card'), require('@angular/material/stepper'), require('@angular/material/tabs'), require('@angular/material/expansion'), require('@angular/material/button-toggle'), require('@angular/material/chips'), require('@angular/material/icon'), require('@angular/material/progress-spinner'), require('@angular/material/progress-bar'), require('@angular/material/tooltip'), require('@angular/material/snack-bar'), require('@angular/material/table'), require('@angular/material/sort'), require('@angular/material/paginator'), require('@angular/material/core')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@eqproject/eqp-attachments', ['exports', '@angular/common/http', '@angular/core', '@angular/forms', '@angular/material/dialog', '@angular/platform-browser', '@eqproject/eqp-table', 'browser-image-compression', 'jszip', 'ngx-image-cropper', 'sweetalert2', '@angular/common', '@angular/material/checkbox', '@angular/material/button', '@angular/material/input', '@angular/material/autocomplete', '@angular/material/datepicker', '@angular/material/form-field', '@angular/material/radio', '@angular/material/select', '@angular/material/slider', '@angular/material/slide-toggle', '@angular/material/menu', '@angular/material/sidenav', '@angular/material/toolbar', '@angular/material/list', '@angular/material/grid-list', '@angular/material/card', '@angular/material/stepper', '@angular/material/tabs', '@angular/material/expansion', '@angular/material/button-toggle', '@angular/material/chips', '@angular/material/icon', '@angular/material/progress-spinner', '@angular/material/progress-bar', '@angular/material/tooltip', '@angular/material/snack-bar', '@angular/material/table', '@angular/material/sort', '@angular/material/paginator', '@angular/material/core'], factory) :
|
|
4
|
+
(global = global || self, factory((global.eqproject = global.eqproject || {}, global.eqproject['eqp-attachments'] = {}), global.ng.common.http, global.ng.core, global.ng.forms, global.ng.material.dialog, global.ng.platformBrowser, global.eqpTable, global.imageCompression, global.JSZip, global.ngxImageCropper, global.Swal, global.ng.common, global.ng.material.checkbox, global.ng.material.button, global.ng.material.input, global.ng.material.autocomplete, global.ng.material.datepicker, global.ng.material.formField, global.ng.material.radio, global.ng.material.select, global.ng.material.slider, global.ng.material.slideToggle, global.ng.material.menu, global.ng.material.sidenav, global.ng.material.toolbar, global.ng.material.list, global.ng.material.gridList, global.ng.material.card, global.ng.material.stepper, global.ng.material.tabs, global.ng.material.expansion, global.ng.material.buttonToggle, global.ng.material.chips, global.ng.material.icon, global.ng.material.progressSpinner, global.ng.material.progressBar, global.ng.material.tooltip, global.ng.material.snackBar, global.ng.material.table, global.ng.material.sort, global.ng.material.paginator, global.ng.material.core));
|
|
5
|
+
}(this, (function (exports, http, core, forms, dialog, platformBrowser, eqpTable, imageCompression, JSZip, ngxImageCropper, Swal, common, checkbox, button, input, autocomplete, datepicker, formField, radio, select, slider, slideToggle, menu, sidenav, toolbar, list, gridList, card, stepper, tabs, expansion, buttonToggle, chips, icon, progressSpinner, progressBar, tooltip, snackBar, table, sort, paginator, core$1) { 'use strict';
|
|
6
6
|
|
|
7
7
|
imageCompression = imageCompression && Object.prototype.hasOwnProperty.call(imageCompression, 'default') ? imageCompression['default'] : imageCompression;
|
|
8
8
|
Swal = Swal && Object.prototype.hasOwnProperty.call(Swal, 'default') ? Swal['default'] : Swal;
|
|
@@ -226,11 +226,6 @@
|
|
|
226
226
|
return value;
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
(function (AttachmentType) {
|
|
230
|
-
AttachmentType[AttachmentType["FILE"] = 1] = "FILE";
|
|
231
|
-
AttachmentType[AttachmentType["LINK"] = 2] = "LINK";
|
|
232
|
-
})(exports.AttachmentType || (exports.AttachmentType = {}));
|
|
233
|
-
|
|
234
229
|
var AttachmentHelperService = /** @class */ (function () {
|
|
235
230
|
function AttachmentHelperService() {
|
|
236
231
|
}
|
|
@@ -290,6 +285,12 @@
|
|
|
290
285
|
return AttachmentHelperService;
|
|
291
286
|
}());
|
|
292
287
|
|
|
288
|
+
|
|
289
|
+
(function (AttachmentType) {
|
|
290
|
+
AttachmentType[AttachmentType["FILE"] = 1] = "FILE";
|
|
291
|
+
AttachmentType[AttachmentType["LINK"] = 2] = "LINK";
|
|
292
|
+
})(exports.AttachmentType || (exports.AttachmentType = {}));
|
|
293
|
+
|
|
293
294
|
var EqpAttachmentDialogService = /** @class */ (function () {
|
|
294
295
|
function EqpAttachmentDialogService() {
|
|
295
296
|
}
|
|
@@ -398,12 +399,14 @@
|
|
|
398
399
|
return EqpAttachmentDialogService;
|
|
399
400
|
}());
|
|
400
401
|
|
|
401
|
-
var toBase64 = function (file) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
402
|
+
var toBase64 = function (file) {
|
|
403
|
+
return new Promise(function (resolve, reject) {
|
|
404
|
+
var reader = new FileReader();
|
|
405
|
+
reader.readAsDataURL(file);
|
|
406
|
+
reader.onload = function () { return resolve(reader.result.toString()); };
|
|
407
|
+
reader.onerror = function (error) { return reject(error); };
|
|
408
|
+
});
|
|
409
|
+
};
|
|
407
410
|
var ɵ0 = toBase64;
|
|
408
411
|
var EqpAttachmentsComponent = /** @class */ (function () {
|
|
409
412
|
function EqpAttachmentsComponent(dialog, formBuilder, sanitizer, http, cd) {
|
|
@@ -482,7 +485,11 @@
|
|
|
482
485
|
/**
|
|
483
486
|
* Opzioni per la compressione delle immagini caricate.
|
|
484
487
|
*/
|
|
485
|
-
this.compressionOptions = {
|
|
488
|
+
this.compressionOptions = {
|
|
489
|
+
maxSizeMB: 0.5,
|
|
490
|
+
maxWidthOrHeight: 1920,
|
|
491
|
+
useWebWorker: true
|
|
492
|
+
};
|
|
486
493
|
/**
|
|
487
494
|
* Array di AttachmentType che si possono aggiungere
|
|
488
495
|
*/
|
|
@@ -502,6 +509,22 @@
|
|
|
502
509
|
* per la tabella contenente l'elenco degli allegati
|
|
503
510
|
*/
|
|
504
511
|
this.tablePaginatorSize = null;
|
|
512
|
+
/**
|
|
513
|
+
* Abilitare caricamento video
|
|
514
|
+
*/
|
|
515
|
+
this.allowVideo = false;
|
|
516
|
+
/**
|
|
517
|
+
* Abilitare la compressione al caricamento di un video (allowVideo dev'essere true)
|
|
518
|
+
*/
|
|
519
|
+
this.allowVideoCompression = false;
|
|
520
|
+
/**
|
|
521
|
+
* Lista di formati video non ammessi
|
|
522
|
+
*/
|
|
523
|
+
this.videoFormatsNotAllowed = ["mkv", "avi"];
|
|
524
|
+
/**
|
|
525
|
+
* dimensione massima ammessa per file
|
|
526
|
+
*/
|
|
527
|
+
this.allowedMBForFile = 100;
|
|
505
528
|
/**
|
|
506
529
|
* Input per definire le label da usare nel componente
|
|
507
530
|
*/
|
|
@@ -560,11 +583,12 @@
|
|
|
560
583
|
this.showCropImage = false;
|
|
561
584
|
//#endregion
|
|
562
585
|
//#region Proprietà per gestione ridimensionamento file di tipo image
|
|
563
|
-
this.imageChangedEvent =
|
|
564
|
-
this.croppedImage =
|
|
586
|
+
this.imageChangedEvent = "";
|
|
587
|
+
this.croppedImage = "";
|
|
565
588
|
this.transform = {};
|
|
566
589
|
//#endregion
|
|
567
590
|
this.AttachmentType = exports.AttachmentType;
|
|
591
|
+
this.showZipSpinner = false;
|
|
568
592
|
}
|
|
569
593
|
EqpAttachmentsComponent.prototype.ngOnInit = function () {
|
|
570
594
|
//Se è stata richiesta la gestione delle sole immagini allora imposta il filtro per le estensioni possibili da caricare
|
|
@@ -577,7 +601,7 @@
|
|
|
577
601
|
if (!this.allowedTypes || this.allowedTypes.length == 0)
|
|
578
602
|
this.allowedTypes = [exports.AttachmentType.FILE, exports.AttachmentType.LINK];
|
|
579
603
|
else if (this.allowedTypes.find(function (t) { return t != exports.AttachmentType.FILE && t != exports.AttachmentType.LINK; })) {
|
|
580
|
-
EqpAttachmentDialogService.Warning(
|
|
604
|
+
EqpAttachmentDialogService.Warning('Almeno uno degli AttachmentType selezionati nel parametro "allowedTypes" non esiste.');
|
|
581
605
|
this.allowedTypes = [exports.AttachmentType.FILE, exports.AttachmentType.LINK];
|
|
582
606
|
}
|
|
583
607
|
//Se è stata richiesta la gestione multipla degli allegati allora configura l'eqp-table
|
|
@@ -609,27 +633,45 @@
|
|
|
609
633
|
this.attachmentsColumns = [];
|
|
610
634
|
if (this.disableAction != true) {
|
|
611
635
|
this.attachmentsColumns.push({
|
|
612
|
-
key: "action",
|
|
613
|
-
|
|
636
|
+
key: "action",
|
|
637
|
+
display: "",
|
|
638
|
+
type: eqpTable.TypeColumn.MenuAction,
|
|
639
|
+
buttonMenuIcon: "more_vert",
|
|
640
|
+
styles: { flex: "0 0 6%" },
|
|
614
641
|
actions: [
|
|
615
|
-
{ name: this.deleteLabel, icon: "delete", fn: function (element, index, col) { return _this.deleteAttachment(element); } }
|
|
616
|
-
]
|
|
642
|
+
{ name: this.deleteLabel, icon: "delete", fn: function (element, index, col) { return _this.deleteAttachment(element); } }
|
|
643
|
+
]
|
|
617
644
|
});
|
|
618
645
|
}
|
|
619
646
|
var downloadColumn = {
|
|
620
|
-
key: "attachment",
|
|
621
|
-
|
|
647
|
+
key: "attachment",
|
|
648
|
+
display: "",
|
|
649
|
+
type: eqpTable.TypeColumn.SimpleAction,
|
|
650
|
+
styles: { flex: "0 0 6%" },
|
|
622
651
|
actions: [
|
|
623
652
|
{
|
|
624
|
-
name:
|
|
625
|
-
|
|
653
|
+
name: "",
|
|
654
|
+
fontawesome: true,
|
|
655
|
+
icon: function (element) {
|
|
656
|
+
return _this.showInlinePreview
|
|
657
|
+
? element.AttachmentType == exports.AttachmentType.FILE
|
|
658
|
+
? "fas fa-cloud-download-alt"
|
|
659
|
+
: "fas fa-external-link-alt"
|
|
660
|
+
: _this.getAttachmentIcon(element);
|
|
661
|
+
},
|
|
626
662
|
fn: function (element, col, elementIndex) { return _this.viewAttachment(element); },
|
|
627
|
-
tooltip: {
|
|
628
|
-
|
|
663
|
+
tooltip: {
|
|
664
|
+
tooltipText: function (element) {
|
|
665
|
+
return element.AttachmentType == exports.AttachmentType.FILE ? _this.downloadLabel : _this.openLinkLabel;
|
|
666
|
+
},
|
|
667
|
+
tooltipPosition: this.downloadTooltipPosition
|
|
668
|
+
}
|
|
669
|
+
}
|
|
629
670
|
]
|
|
630
671
|
};
|
|
631
672
|
var inlinePreviewColumn = {
|
|
632
|
-
key: "InlinePreview",
|
|
673
|
+
key: "InlinePreview",
|
|
674
|
+
display: this.previewLabel,
|
|
633
675
|
type: eqpTable.TypeColumn.ExternalTemplate,
|
|
634
676
|
externalTemplate: this.inlinePreviewTemplate,
|
|
635
677
|
styles: { flex: "0 0 10%" }
|
|
@@ -672,7 +714,7 @@
|
|
|
672
714
|
*/
|
|
673
715
|
EqpAttachmentsComponent.prototype.viewAttachment = function (attachment) {
|
|
674
716
|
if (attachment.AttachmentType == exports.AttachmentType.LINK) {
|
|
675
|
-
window.open(attachment.FilePath,
|
|
717
|
+
window.open(attachment.FilePath, "_blank");
|
|
676
718
|
return;
|
|
677
719
|
}
|
|
678
720
|
if (attachment.FileDataBase64 && attachment.FileContentType && attachment.FileName) {
|
|
@@ -702,6 +744,7 @@
|
|
|
702
744
|
* Apre la modale per la definizione dei parametri del nuovo file
|
|
703
745
|
*/
|
|
704
746
|
EqpAttachmentsComponent.prototype.openModalAddAttachment = function (attachmentType) {
|
|
747
|
+
this.showZipSpinner = false;
|
|
705
748
|
//Se è stato richiesto il caricamento di un LINK o è impostato il caricamento di FILE SINGOLO allora apre la modale per
|
|
706
749
|
//il caricamento singolo del file altrimenti apre quella per il caricamento multiplo
|
|
707
750
|
// if (attachmentType == AttachmentType.LINK || (attachmentType == AttachmentType.FILE && this.loadMultipleFiles != true)) {
|
|
@@ -716,8 +759,8 @@
|
|
|
716
759
|
this.dialofRefAddAttachment = this.dialog.open(this.dialogAddAttachment, {
|
|
717
760
|
disableClose: true,
|
|
718
761
|
hasBackdrop: true,
|
|
719
|
-
width:
|
|
720
|
-
maxHeight:
|
|
762
|
+
width: "60%",
|
|
763
|
+
maxHeight: "80%"
|
|
721
764
|
});
|
|
722
765
|
};
|
|
723
766
|
EqpAttachmentsComponent.prototype.createAttachmentForm = function () {
|
|
@@ -756,7 +799,10 @@
|
|
|
756
799
|
}
|
|
757
800
|
}
|
|
758
801
|
else {
|
|
759
|
-
return this.newMultipleAttachments.filter(function (p) {
|
|
802
|
+
return (this.newMultipleAttachments.filter(function (p) {
|
|
803
|
+
return (p.AttachmentType == exports.AttachmentType.FILE && !p.FileDataBase64) ||
|
|
804
|
+
(p.AttachmentType == exports.AttachmentType.LINK && !p.FilePath);
|
|
805
|
+
}).length > 0);
|
|
760
806
|
}
|
|
761
807
|
};
|
|
762
808
|
EqpAttachmentsComponent.prototype.confirmAddAttachment = function () {
|
|
@@ -803,8 +849,12 @@
|
|
|
803
849
|
}
|
|
804
850
|
if (!(this.getAttachmentEndpoint && this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64)) return [3 /*break*/, 2];
|
|
805
851
|
return [4 /*yield*/, this.getAttachmentByID()
|
|
806
|
-
.then(function (res) {
|
|
807
|
-
.
|
|
852
|
+
.then(function (res) {
|
|
853
|
+
_this.selectedAttachment.FileDataBase64 = res.FileDataBase64;
|
|
854
|
+
})
|
|
855
|
+
.catch(function (err) {
|
|
856
|
+
EqpAttachmentDialogService.Error(err);
|
|
857
|
+
})];
|
|
808
858
|
case 1:
|
|
809
859
|
_a.sent();
|
|
810
860
|
_a.label = 2;
|
|
@@ -812,7 +862,9 @@
|
|
|
812
862
|
if (this.selectedAttachment.AttachmentType == exports.AttachmentType.LINK) {
|
|
813
863
|
this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.selectedAttachment.FilePath);
|
|
814
864
|
}
|
|
815
|
-
else if (this.selectedAttachment.IsImage &&
|
|
865
|
+
else if (this.selectedAttachment.IsImage &&
|
|
866
|
+
!this.selectedAttachment.FileDataBase64 &&
|
|
867
|
+
!this.selectedAttachment.FileThumbnailBase64) {
|
|
816
868
|
EqpAttachmentDialogService.Info("Impossibile aprire l'anteprima dell'allegato, file mancante.");
|
|
817
869
|
return [2 /*return*/];
|
|
818
870
|
}
|
|
@@ -831,7 +883,7 @@
|
|
|
831
883
|
}
|
|
832
884
|
this.dialog.open(this.dialogPreview, {
|
|
833
885
|
disableClose: true,
|
|
834
|
-
hasBackdrop: true
|
|
886
|
+
hasBackdrop: true
|
|
835
887
|
});
|
|
836
888
|
return [2 /*return*/];
|
|
837
889
|
}
|
|
@@ -855,28 +907,32 @@
|
|
|
855
907
|
* immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
|
|
856
908
|
*/
|
|
857
909
|
EqpAttachmentsComponent.prototype.onFileInputChange = function (event) {
|
|
910
|
+
var _a;
|
|
858
911
|
return __awaiter(this, void 0, void 0, function () {
|
|
859
|
-
var
|
|
860
|
-
return __generator(this, function (
|
|
861
|
-
switch (
|
|
912
|
+
var _b, checkOnlyImage, base64Result, _c, i, newAttachment, checkOnlyImage;
|
|
913
|
+
return __generator(this, function (_d) {
|
|
914
|
+
switch (_d.label) {
|
|
862
915
|
case 0:
|
|
863
916
|
this.showCropImage = false;
|
|
864
|
-
if (!(__spread(event.target.files).length == 1 || this.loadMultipleFiles != true)) return [3 /*break*/,
|
|
917
|
+
if (!(__spread(event.target.files).length == 1 || this.loadMultipleFiles != true)) return [3 /*break*/, 7];
|
|
865
918
|
this.selectedFile = event.target.files[0];
|
|
866
919
|
this.selectedFiles = event.target.files;
|
|
867
920
|
if (!this.selectedFile)
|
|
868
921
|
return [2 /*return*/];
|
|
869
|
-
|
|
870
|
-
|
|
922
|
+
this.showZipSpinner = true;
|
|
923
|
+
//Memorizza i dati per l'allegato
|
|
924
|
+
_b = this;
|
|
871
925
|
return [4 /*yield*/, this.createAttachmentFromUploadedFile(this.selectedFile, false)];
|
|
872
926
|
case 1:
|
|
873
|
-
//Memorizza i dati per l'allegato
|
|
874
|
-
|
|
927
|
+
//Memorizza i dati per l'allegato
|
|
928
|
+
_b.newAttachment = _d.sent();
|
|
875
929
|
this.newMultipleAttachments = new Array();
|
|
876
930
|
this.newMultipleAttachments.push(this.newAttachment);
|
|
877
931
|
checkOnlyImage = this.checkAllowOnlyImageFile(this.newAttachment);
|
|
878
|
-
if (checkOnlyImage == false)
|
|
932
|
+
if (checkOnlyImage == false) {
|
|
933
|
+
this.showZipSpinner = false;
|
|
879
934
|
return [2 /*return*/];
|
|
935
|
+
}
|
|
880
936
|
if (this.loadMultipleFiles == true && __spread(event.target.files).length == 1)
|
|
881
937
|
this.createAttachmentForm();
|
|
882
938
|
if (!(this.newAttachment.IsImage == true)) return [3 /*break*/, 2];
|
|
@@ -887,37 +943,91 @@
|
|
|
887
943
|
this.newAttachmentForm.controls["customHeight"].enable();
|
|
888
944
|
this.showCropImage = true;
|
|
889
945
|
this.imageChangedEvent = event;
|
|
890
|
-
return [3 /*break*/,
|
|
946
|
+
return [3 /*break*/, 6];
|
|
891
947
|
case 2:
|
|
892
948
|
this.showCropImage = false;
|
|
893
949
|
return [4 /*yield*/, this.getBase64FromFile(this.selectedFile)];
|
|
894
950
|
case 3:
|
|
895
|
-
base64Result =
|
|
951
|
+
base64Result = _d.sent();
|
|
952
|
+
if (!(this.allowVideo && this.allowVideoCompression && this.selectedFile.type.startsWith("video"))) return [3 /*break*/, 5];
|
|
953
|
+
_c = this;
|
|
954
|
+
return [4 /*yield*/, this.zipVideo(this.newAttachment, base64Result.Base64File)];
|
|
955
|
+
case 4:
|
|
956
|
+
_c.newAttachment = _d.sent();
|
|
957
|
+
return [3 /*break*/, 6];
|
|
958
|
+
case 5:
|
|
896
959
|
this.newAttachment.FileDataBase64 = base64Result.Base64File;
|
|
897
960
|
this.newAttachment.FileContentType = base64Result.ContentType;
|
|
898
|
-
|
|
899
|
-
case
|
|
900
|
-
|
|
961
|
+
_d.label = 6;
|
|
962
|
+
case 6:
|
|
963
|
+
this.showZipSpinner = false;
|
|
964
|
+
return [3 /*break*/, 14];
|
|
965
|
+
case 7:
|
|
901
966
|
this.selectedFiles = event.target.files;
|
|
902
967
|
if (!this.selectedFiles || this.selectedFiles.length == 0)
|
|
903
968
|
return [2 /*return*/];
|
|
904
969
|
this.newMultipleAttachments = new Array();
|
|
970
|
+
this.showZipSpinner = true;
|
|
905
971
|
i = 0;
|
|
906
|
-
|
|
907
|
-
case
|
|
908
|
-
if (!(i < this.selectedFiles.length)) return [3 /*break*/,
|
|
972
|
+
_d.label = 8;
|
|
973
|
+
case 8:
|
|
974
|
+
if (!(i < ((_a = this.selectedFiles) === null || _a === void 0 ? void 0 : _a.length))) return [3 /*break*/, 13];
|
|
909
975
|
return [4 /*yield*/, this.createAttachmentFromUploadedFile(this.selectedFiles[i], true)];
|
|
910
|
-
case
|
|
911
|
-
newAttachment =
|
|
976
|
+
case 9:
|
|
977
|
+
newAttachment = _d.sent();
|
|
978
|
+
if (!(this.allowVideo && this.allowVideoCompression && this.selectedFiles[i].type.startsWith("video"))) return [3 /*break*/, 11];
|
|
979
|
+
return [4 /*yield*/, this.zipVideo(newAttachment, newAttachment.FileDataBase64)];
|
|
980
|
+
case 10:
|
|
981
|
+
newAttachment = _d.sent();
|
|
982
|
+
_d.label = 11;
|
|
983
|
+
case 11:
|
|
912
984
|
checkOnlyImage = this.checkAllowOnlyImageFile(newAttachment);
|
|
913
|
-
if (checkOnlyImage == false)
|
|
985
|
+
if (checkOnlyImage == false) {
|
|
986
|
+
this.showZipSpinner = false;
|
|
914
987
|
return [2 /*return*/];
|
|
988
|
+
}
|
|
915
989
|
this.newMultipleAttachments.push(newAttachment);
|
|
916
|
-
|
|
917
|
-
case
|
|
990
|
+
_d.label = 12;
|
|
991
|
+
case 12:
|
|
918
992
|
i++;
|
|
919
|
-
return [3 /*break*/,
|
|
920
|
-
case
|
|
993
|
+
return [3 /*break*/, 8];
|
|
994
|
+
case 13:
|
|
995
|
+
this.showZipSpinner = false;
|
|
996
|
+
_d.label = 14;
|
|
997
|
+
case 14: return [2 /*return*/];
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
});
|
|
1001
|
+
};
|
|
1002
|
+
EqpAttachmentsComponent.prototype.zipVideo = function (newAttachment, base64) {
|
|
1003
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1004
|
+
var zip, videoFolder, content, base64Result;
|
|
1005
|
+
return __generator(this, function (_a) {
|
|
1006
|
+
switch (_a.label) {
|
|
1007
|
+
case 0:
|
|
1008
|
+
zip = new JSZip();
|
|
1009
|
+
videoFolder = zip.folder("videos");
|
|
1010
|
+
videoFolder.file(newAttachment.FileName, base64, { base64: true });
|
|
1011
|
+
return [4 /*yield*/, zip.generateAsync({
|
|
1012
|
+
type: "blob",
|
|
1013
|
+
compression: "DEFLATE",
|
|
1014
|
+
compressionOptions: {
|
|
1015
|
+
/* compression level ranges from 1 (best speed) to 9 (best compression) */
|
|
1016
|
+
level: 9
|
|
1017
|
+
}
|
|
1018
|
+
})];
|
|
1019
|
+
case 1:
|
|
1020
|
+
content = _a.sent();
|
|
1021
|
+
return [4 /*yield*/, this.getBase64FromFile(content)];
|
|
1022
|
+
case 2:
|
|
1023
|
+
base64Result = _a.sent();
|
|
1024
|
+
newAttachment.FileContentType = content.type;
|
|
1025
|
+
newAttachment.FileName = newAttachment.FileName.replace(/\.[^/.]+$/, "") + ".zip";
|
|
1026
|
+
newAttachment.FileExtension = newAttachment.FileName.substring(newAttachment.FileName.lastIndexOf(".") + 1);
|
|
1027
|
+
newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(content.type);
|
|
1028
|
+
newAttachment.FileDataBase64 = base64Result.Base64File;
|
|
1029
|
+
newAttachment.FileContentType = base64Result.ContentType;
|
|
1030
|
+
return [2 /*return*/, newAttachment];
|
|
921
1031
|
}
|
|
922
1032
|
});
|
|
923
1033
|
});
|
|
@@ -938,11 +1048,11 @@
|
|
|
938
1048
|
switch (_a.label) {
|
|
939
1049
|
case 0:
|
|
940
1050
|
newAttachment = {};
|
|
941
|
-
//Memorizza i dati per l'allegato
|
|
1051
|
+
//Memorizza i dati per l'allegato
|
|
942
1052
|
newAttachment.AttachmentType = exports.AttachmentType.FILE;
|
|
943
1053
|
newAttachment.FileContentType = currentFile.type;
|
|
944
1054
|
newAttachment.FileName = currentFile.name;
|
|
945
|
-
newAttachment.FileExtension = currentFile.name.
|
|
1055
|
+
newAttachment.FileExtension = currentFile.name.substring(currentFile.name.lastIndexOf(".") + 1);
|
|
946
1056
|
newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(currentFile.type);
|
|
947
1057
|
if (!(getBase64 == true)) return [3 /*break*/, 2];
|
|
948
1058
|
return [4 /*yield*/, this.getBase64FromFile(currentFile)];
|
|
@@ -995,9 +1105,30 @@
|
|
|
995
1105
|
EqpAttachmentsComponent.prototype.checkAcceptedFiles = function () {
|
|
996
1106
|
var e_1, _a;
|
|
997
1107
|
var _this = this;
|
|
998
|
-
|
|
999
|
-
|
|
1108
|
+
var _b, _c;
|
|
1109
|
+
if (!this.allowVideo) {
|
|
1110
|
+
if ((!this.loadMultipleFiles && this.selectedFile.type.startsWith("video")) ||
|
|
1111
|
+
(this.loadMultipleFiles == true && __spread(this.selectedFiles).filter(function (p) { return p.type.startsWith("video"); }).length > 0))
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
1114
|
+
else {
|
|
1115
|
+
if ((!this.loadMultipleFiles &&
|
|
1116
|
+
this.videoFormatsNotAllowed.includes((_b = this.selectedFile) === null || _b === void 0 ? void 0 : _b.name.substring(this.selectedFile.name.lastIndexOf(".") + 1))) ||
|
|
1117
|
+
(this.loadMultipleFiles &&
|
|
1118
|
+
this.selectedFiles &&
|
|
1119
|
+
__spread(this.selectedFiles).filter(function (p) {
|
|
1120
|
+
return _this.videoFormatsNotAllowed.includes(p.name.substring(p.name.lastIndexOf(".") + 1));
|
|
1121
|
+
}).length > 0))
|
|
1122
|
+
return false;
|
|
1123
|
+
}
|
|
1124
|
+
if (!this.loadMultipleFiles && ((_c = this.selectedFile) === null || _c === void 0 ? void 0 : _c.size) / (1024 * 1024) > this.allowedMBForFile) {
|
|
1000
1125
|
return false;
|
|
1126
|
+
}
|
|
1127
|
+
if (this.loadMultipleFiles &&
|
|
1128
|
+
this.selectedFiles &&
|
|
1129
|
+
__spread(this.selectedFiles).filter(function (p) { var _a; return ((_a = p) === null || _a === void 0 ? void 0 : _a.size) / (1024 * 1024) > _this.allowedMBForFile; }).length > 0) {
|
|
1130
|
+
return false;
|
|
1131
|
+
}
|
|
1001
1132
|
if (this.acceptedFileTypes == "*")
|
|
1002
1133
|
return true;
|
|
1003
1134
|
//Verifica che i tipi del file (o dei file) caricati siano coerenti con quelli accettati dalla direttiva
|
|
@@ -1014,8 +1145,8 @@
|
|
|
1014
1145
|
//Questo controllo permette di gestire le casistiche per cui vengono indicati come tipi validi, ad esempio, 'image/*'
|
|
1015
1146
|
if (!accepted && this.loadMultipleFiles != true) {
|
|
1016
1147
|
try {
|
|
1017
|
-
for (var
|
|
1018
|
-
var t =
|
|
1148
|
+
for (var _d = __values(this.acceptedFileTypes.split(",").filter(function (t) { return t.includes("*"); })), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1149
|
+
var t = _e.value;
|
|
1019
1150
|
accepted = this.selectedFile.type.startsWith(t.split("*")[0]);
|
|
1020
1151
|
if (accepted)
|
|
1021
1152
|
break;
|
|
@@ -1024,7 +1155,7 @@
|
|
|
1024
1155
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1025
1156
|
finally {
|
|
1026
1157
|
try {
|
|
1027
|
-
if (
|
|
1158
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1028
1159
|
}
|
|
1029
1160
|
finally { if (e_1) throw e_1.error; }
|
|
1030
1161
|
}
|
|
@@ -1056,15 +1187,15 @@
|
|
|
1056
1187
|
var image = new Image();
|
|
1057
1188
|
image.src = e.target.result;
|
|
1058
1189
|
image.onload = function (rs) {
|
|
1059
|
-
_this.originalHeight = rs.currentTarget[
|
|
1060
|
-
_this.originalWidth = rs.currentTarget[
|
|
1190
|
+
_this.originalHeight = rs.currentTarget["height"];
|
|
1191
|
+
_this.originalWidth = rs.currentTarget["width"];
|
|
1061
1192
|
if (_this.originalWidth > 1280) {
|
|
1062
1193
|
_this.customWidth = 1280;
|
|
1063
1194
|
_this.customHeight = Math.round((1280 * _this.originalHeight) / _this.originalWidth);
|
|
1064
1195
|
}
|
|
1065
1196
|
else {
|
|
1066
|
-
_this.customHeight = rs.currentTarget[
|
|
1067
|
-
_this.customWidth = rs.currentTarget[
|
|
1197
|
+
_this.customHeight = rs.currentTarget["height"];
|
|
1198
|
+
_this.customWidth = rs.currentTarget["width"];
|
|
1068
1199
|
}
|
|
1069
1200
|
};
|
|
1070
1201
|
};
|
|
@@ -1093,18 +1224,18 @@
|
|
|
1093
1224
|
/**
|
|
1094
1225
|
* Comprime l'immagine passando come parametri le options create nell'oggetto sopra, e il file dal reader principale
|
|
1095
1226
|
*/
|
|
1096
|
-
imageCompression(file, options).then(
|
|
1227
|
+
imageCompression(file, options).then(function (fileCompressed) {
|
|
1097
1228
|
var fileReader = new FileReader();
|
|
1098
1229
|
//Faccio la push di ogni file all'interno dell'array di file dell'item da mandare al server
|
|
1099
1230
|
fileReader.onload = function () {
|
|
1100
1231
|
var resultReader = fileReader.result;
|
|
1101
|
-
var marker =
|
|
1232
|
+
var marker = ";base64,";
|
|
1102
1233
|
self.newAttachment.FileDataBase64 = resultReader.substring(resultReader.indexOf(marker) + marker.length);
|
|
1103
1234
|
self.showCropImage = false;
|
|
1104
1235
|
self.newAttachmentForm.enable();
|
|
1105
1236
|
};
|
|
1106
1237
|
fileReader.readAsDataURL(fileCompressed);
|
|
1107
|
-
})
|
|
1238
|
+
});
|
|
1108
1239
|
};
|
|
1109
1240
|
EqpAttachmentsComponent.prototype.confirmCrop = function () {
|
|
1110
1241
|
this.imageCropper.crop();
|
|
@@ -1113,9 +1244,9 @@
|
|
|
1113
1244
|
* Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO
|
|
1114
1245
|
*/
|
|
1115
1246
|
EqpAttachmentsComponent.prototype.abortFile = function () {
|
|
1116
|
-
this.imageChangedEvent =
|
|
1247
|
+
this.imageChangedEvent = "";
|
|
1117
1248
|
if (this.imageInput)
|
|
1118
|
-
this.imageInput.nativeElement.value =
|
|
1249
|
+
this.imageInput.nativeElement.value = "";
|
|
1119
1250
|
this.selectedFile = null;
|
|
1120
1251
|
this.selectedFiles = null;
|
|
1121
1252
|
this.showCropImage = false;
|
|
@@ -1197,6 +1328,18 @@
|
|
|
1197
1328
|
__decorate([
|
|
1198
1329
|
core.Input("tablePaginatorSize")
|
|
1199
1330
|
], EqpAttachmentsComponent.prototype, "tablePaginatorSize", void 0);
|
|
1331
|
+
__decorate([
|
|
1332
|
+
core.Input("allowVideo")
|
|
1333
|
+
], EqpAttachmentsComponent.prototype, "allowVideo", void 0);
|
|
1334
|
+
__decorate([
|
|
1335
|
+
core.Input("allowVideoCompression")
|
|
1336
|
+
], EqpAttachmentsComponent.prototype, "allowVideoCompression", void 0);
|
|
1337
|
+
__decorate([
|
|
1338
|
+
core.Input("videoFormatsNotAllowed")
|
|
1339
|
+
], EqpAttachmentsComponent.prototype, "videoFormatsNotAllowed", void 0);
|
|
1340
|
+
__decorate([
|
|
1341
|
+
core.Input("allowedMBForFile")
|
|
1342
|
+
], EqpAttachmentsComponent.prototype, "allowedMBForFile", void 0);
|
|
1200
1343
|
__decorate([
|
|
1201
1344
|
core.Input("downloadTooltipPosition")
|
|
1202
1345
|
], EqpAttachmentsComponent.prototype, "downloadTooltipPosition", void 0);
|
|
@@ -1270,30 +1413,30 @@
|
|
|
1270
1413
|
core.Output("onComponentLoaded")
|
|
1271
1414
|
], EqpAttachmentsComponent.prototype, "onComponentLoaded", void 0);
|
|
1272
1415
|
__decorate([
|
|
1273
|
-
core.ViewChild(
|
|
1416
|
+
core.ViewChild("dialogAddAttachment", { static: true })
|
|
1274
1417
|
], EqpAttachmentsComponent.prototype, "dialogAddAttachment", void 0);
|
|
1275
1418
|
__decorate([
|
|
1276
|
-
core.ViewChild(
|
|
1419
|
+
core.ViewChild("dialogAddMultipleAttachment", { static: true })
|
|
1277
1420
|
], EqpAttachmentsComponent.prototype, "dialogAddMultipleAttachment", void 0);
|
|
1278
1421
|
__decorate([
|
|
1279
1422
|
core.ViewChild(ngxImageCropper.ImageCropperComponent)
|
|
1280
1423
|
], EqpAttachmentsComponent.prototype, "imageCropper", void 0);
|
|
1281
1424
|
__decorate([
|
|
1282
|
-
core.ViewChild(
|
|
1425
|
+
core.ViewChild("imageInput")
|
|
1283
1426
|
], EqpAttachmentsComponent.prototype, "imageInput", void 0);
|
|
1284
1427
|
__decorate([
|
|
1285
|
-
core.ViewChild(
|
|
1428
|
+
core.ViewChild("attachmentTable", { static: false })
|
|
1286
1429
|
], EqpAttachmentsComponent.prototype, "attachmentTable", void 0);
|
|
1287
1430
|
__decorate([
|
|
1288
|
-
core.ViewChild(
|
|
1431
|
+
core.ViewChild("inlinePreviewTemplate", { static: true })
|
|
1289
1432
|
], EqpAttachmentsComponent.prototype, "inlinePreviewTemplate", void 0);
|
|
1290
1433
|
__decorate([
|
|
1291
|
-
core.ViewChild(
|
|
1434
|
+
core.ViewChild("dialogPreview", { static: true })
|
|
1292
1435
|
], EqpAttachmentsComponent.prototype, "dialogPreview", void 0);
|
|
1293
1436
|
EqpAttachmentsComponent = __decorate([
|
|
1294
1437
|
core.Component({
|
|
1295
|
-
selector:
|
|
1296
|
-
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>",
|
|
1438
|
+
selector: "eqp-attachments",
|
|
1439
|
+
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>",
|
|
1297
1440
|
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}"]
|
|
1298
1441
|
})
|
|
1299
1442
|
], EqpAttachmentsComponent);
|