@eqproject/eqp-attachments 0.1.10 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"eqproject-eqp-attachments.js","sources":["ng://@eqproject/eqp-attachments/lib/interfaces/IAttachment.ts","ng://@eqproject/eqp-attachments/lib/helpers/attachment.helper.ts","ng://@eqproject/eqp-attachments/lib/services/eqp-attachment-dialog.service.ts","ng://@eqproject/eqp-attachments/lib/eqp-attachments.component.ts","ng://@eqproject/eqp-attachments/lib/modules/material.module.ts","ng://@eqproject/eqp-attachments/lib/eqp-attachments.module.ts","ng://@eqproject/eqp-attachments/public-api.ts","ng://@eqproject/eqp-attachments/eqproject-eqp-attachments.ts"],"sourcesContent":["export interface IAttachmentDTO {\r\n ID: number | string;\r\n FileName?: string;\r\n FileContentType?: string;\r\n FileExtension?: string;\r\n FilePath?: string;\r\n AttachmentType?: AttachmentType;\r\n FileDataBase64?: string;\r\n IsImage?: boolean;\r\n FileThumbnailBase64?: string;\r\n TrustedUrl?: any;\r\n}\r\n\r\nexport enum AttachmentType {\r\n FILE = 1,\r\n LINK = 2\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AttachmentHelperService {\r\n\r\n static readonly imageMimeTypes: string[] = [\"image/bmp\", \"image/gif\", \"image/jpeg\", \"image/tiff\", \"image/png\"];\r\n\r\n static readonly fileExtensionIcon: any = {\r\n \"txt\": \"fas fa-file-text\",\r\n \"pdf\": \"fas fa-file-pdf\",\r\n \"doc\": \"fas fa-file-word\",\r\n \"docx\": \"fas fa-file-word\",\r\n \"xls\": \"fas fa-file-excel\",\r\n \"xlsx\": \"fas fa-file-excel\",\r\n \"jpg\": \"fas fa-file-image\",\r\n \"jpeg\": \"fas fa-file-image\",\r\n \"png\": \"fas fa-file-image\",\r\n \"bmp\": \"fas fa-file-image\",\r\n\r\n \"mkv\": \"fas fa-file-video\",\r\n \"flv\": \"fas fa-file-video\",\r\n \"gif\": \"fas fa-file-video\",\r\n \"gifv\": \"fas fa-file-video\",\r\n \"avi\": \"fas fa-file-video\",\r\n \"wmv\": \"fas fa-file-video\",\r\n \"mp4\": \"fas fa-file-video\",\r\n \"m4p\": \"fas fa-file-video\",\r\n \"m4v\": \"fas fa-file-video\",\r\n \"mpg\": \"fas fa-file-video\",\r\n \"mp2\": \"fas fa-file-video\",\r\n \"mpeg\": \"fas fa-file-video\",\r\n \"mpe\": \"fas fa-file-video\",\r\n \"mpv\": \"fas fa-file-video\",\r\n \"m2v\": \"fas fa-file-video\",\r\n \"3gp\": \"fas fa-file-video\",\r\n \"3g2\": \"fas fa-file-video\",\r\n\r\n \"mp3\": \"fas fa-file-audio\",\r\n };\r\n\r\n constructor() { }\r\n\r\n /**\r\n * Restituisce TRUE se il mime type passato nel parametro corrisponde ad un mime type di un'immagine\r\n * @param mimeType Mime Type da verificare\r\n */\r\n static checkImageFromMimeType(mimeType: string): boolean {\r\n return this.imageMimeTypes.find(s => s == mimeType) != null;\r\n }\r\n\r\n /**\r\n * In base all'estensione passata come parametro, restituisce la FontAwesome corretta da utilizzare.\r\n * Se l'estensione non viene trovata nella costante riportata dentro common.model.ts restituisce un icona standard\r\n * @param extension Estensione del file per cui restituire l'icona corretta\r\n */\r\n static getIconFromFileExtensione(extension: string): string {\r\n let fileIcon = this.fileExtensionIcon[extension];\r\n return fileIcon ?? \"fas fa-file\";\r\n }\r\n\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport Swal from 'sweetalert2';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class EqpAttachmentDialogService {\r\n\r\n constructor() { }\r\n\r\n /**\r\n * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.\r\n * @param message Messaggio d'errore da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Errore')\r\n */\r\n static Error(message: string | string[], title: string = null) {\r\n let currentTitle = title != null ? title : 'Errore';\r\n if (Array.isArray(message)) {\r\n currentTitle = title != null ? title : 'Errore';\r\n let htmlErrors: string = message.join(\"<br>\");\r\n Swal.fire({\r\n title: currentTitle,\r\n html: htmlErrors,\r\n icon: 'error'\r\n });\r\n }\r\n else {\r\n Swal.fire(currentTitle, message, 'error');\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto\r\n * CONFERMA lancia la funzione di callback passata come parametro\r\n * @param message Messaggio da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Info')\r\n */\r\n static Confirm(message: string | string[], confirmCallback: any, isWarning: boolean = false, title: string = null, customWidth: string = null) {\r\n\r\n let currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';\r\n if (Array.isArray(message)) {\r\n let htmlErrors: string = message.join(\"<br>\");\r\n Swal.fire({\r\n title: currentTitle,\r\n html: htmlErrors,\r\n width: customWidth ? customWidth : '32rem',\r\n icon: !isWarning ? 'question' : 'warning',\r\n showCancelButton: true,\r\n allowOutsideClick: false,\r\n allowEscapeKey: false\r\n }).then((result) => {\r\n if (result.value && confirmCallback) {\r\n confirmCallback();\r\n }\r\n });\r\n }\r\n else {\r\n Swal.fire({\r\n title: currentTitle,\r\n text: message,\r\n width: customWidth ? customWidth : '32rem',\r\n icon: !isWarning ? 'question' : 'warning',\r\n showCancelButton: true,\r\n allowOutsideClick: false,\r\n allowEscapeKey: false\r\n }).then((result) => {\r\n if (result.value && confirmCallback) {\r\n confirmCallback();\r\n }\r\n })\r\n }\r\n }\r\n\r\n /**\r\n * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro\r\n * @param message Messaggio da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Info')\r\n */\r\n static Info(message: string, title: string = null, isToast: boolean = null) {\r\n let currentTitle = title != null ? title : \"Informazione:\";\r\n Swal.fire(currentTitle, message, 'info');\r\n }\r\n\r\n /**\r\n * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro\r\n * @param message Messaggio da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')\r\n */\r\n static Warning(message: string | string[], title: string = null, isToast: boolean = null) {\r\n let currentTitle = title != null ? title : \"Attenzione!\";\r\n\r\n if (Array.isArray(message)) {\r\n let htmlWarnings: string = message.join(\"<br>\");\r\n Swal.fire({\r\n title: currentTitle,\r\n html: htmlWarnings,\r\n icon: 'warning'\r\n });\r\n } else {\r\n Swal.fire(currentTitle, message, 'warning');\r\n }\r\n }\r\n}\r\n","import { Component, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';\r\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { base64ToFile, ImageCroppedEvent, ImageCropperComponent, ImageTransform } from 'ngx-image-cropper';\r\nimport imageCompression from 'browser-image-compression'\r\nimport { AttachmentType, IAttachmentDTO } from './interfaces/IAttachment';\r\nimport { ConfigColumn, EqpTableComponent, TooltipPositionType, TypeColumn } from '@eqproject/eqp-table';\r\nimport { MatDialog, MatDialogRef } from '@angular/material/dialog';\r\nimport { AttachmentHelperService } from './helpers/attachment.helper';\r\nimport { EqpAttachmentDialogService } from './services/eqp-attachment-dialog.service';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { IOptions } from './interfaces/IOptions';\r\n\r\nconst toBase64 = file => new Promise<string>((resolve, reject) => {\r\n const reader = new FileReader();\r\n reader.readAsDataURL(file);\r\n reader.onload = () => resolve(reader.result.toString());\r\n reader.onerror = error => reject(error);\r\n});\r\n\r\n@Component({\r\n selector: 'eqp-attachments',\r\n templateUrl: './eqp-attachments.component.html',\r\n styleUrls: ['./eqp-attachments.component.scss']\r\n})\r\nexport class EqpAttachmentsComponent implements OnInit {\r\n\r\n //#region @Input del componente\r\n\r\n /**\r\n * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso \"multipleAttachment\" è TRUE).\r\n */\r\n @Input(\"disableAction\") disableAction: boolean = false;\r\n\r\n /**\r\n * Se TRUE mostra il titolo nell'header nel caso in cui \"multipleAttachment\" è TRUE (\"Elenco allegati\" di default).\r\n */\r\n @Input(\"showHeader\") showHeader: boolean = true;\r\n\r\n /**\r\n * Titolo da visualizzare se il parametro \"showHeader\" è TRUE. Di devault viene visualizzato \"Elenco allegati\".\r\n */\r\n @Input(\"headerTitle\") headerTitle: string = \"Elenco allegati\";\r\n\r\n /**\r\n * Sorgente dati da visualizzare. Nel caso si vuole gestire un singolo allegato va passato in ogni caso come Array.\r\n */\r\n @Input(\"attachmentsList\") attachmentsList: Array<IAttachmentDTO> = null;\r\n\r\n /**\r\n * Se TRUE non mostra la MatCard (nel caso in cui \"multipleAttachment\" è TRUE).\r\n */\r\n @Input(\"showMatCard\") showMatCard: boolean = true;\r\n\r\n /**\r\n * Se FALSE allora il componente mostra solo il pulsante di caricamento di un singolo file, una volta caricato il file invoca l'evento di output \"localEditedAttachments\".\r\n * Se TRUE allora il componente mostra l'elenco di tutti gli allegati ricevuto nel parametro \"attachmentsList\".\r\n */\r\n @Input(\"multipleAttachment\") multipleAttachment: boolean = true;\r\n\r\n /**\r\n * Configurazione delle colonne della eqp-table per la visualizzazione degli allegati (caso \"multipleAttachment\" è TRUE).\r\n */\r\n @Input(\"attachmentsColumns\") attachmentsColumns: Array<ConfigColumn> = null;\r\n\r\n /**\r\n * Imposta il messaggio da visualizzare nel caso in cui la tabella degli allegati (nel caso in cui \"multipleAttachment\" è TRUE) è vuota.\r\n */\r\n @Input(\"emptyTableMessage\") emptyTableMessage: string = \"Nessun dato trovato\";\r\n\r\n /**\r\n * Se TRUE allora permette di selezionare soltanto file di tipo immagine, avente uno dei mimetype\r\n * specificati dentro AttachmentHelperService.\r\n * Se FALSE permette di selezionare qualsiasi tipo di file\r\n */\r\n @Input(\"allowOnlyImages\") allowOnlyImages: boolean = false;\r\n\r\n /**\r\n * Specifica i tipi di file che è possibile caricare\r\n */\r\n @Input(\"acceptedFileTypes\") acceptedFileTypes: string;\r\n\r\n /**\r\n * Se TRUE disabilita il pulsante di Aggiunta allegato (a prescindere dal valore del parametro \"multipleAttachment\").\r\n */\r\n @Input(\"isDisabled\") isDisabled: boolean = false;\r\n\r\n /**\r\n * Mostra/nasconde la colonna per visualizzare l'anteprima dei file nella tabella (caso multipleAtatchments = true).\r\n */\r\n @Input(\"showInlinePreview\") showInlinePreview: boolean = false;\r\n\r\n /**\r\n * Endpoint da chiamare per recueprare l'IAttachmentDTO completo da vedere nell'anteprima. La chiamata sarà in POST e nel body\r\n * conterrà l'IAttachmentDTO selezionato dall'utente.\r\n * La chiamata viene eseguita solo per l'anteprima delle immagini essendo necessario il base64 completo dell'immagine a dimensione reale.\r\n * Per documenti/link basta che sia popolata la proprietà FilePath di IAttachmentDTO.\r\n */\r\n @Input(\"getAttachmentEndpoint\") getAttachmentEndpoint: string = null;\r\n\r\n /**\r\n * Hostname dell'ambiente di produzione dell'applicativo. Necessario per visualizzare l'anteprima dei documenti\r\n * tramite il viewer di google.\r\n * NOTA: Per visualizzare l'anteprima è necessario che la prorietà FilePath dell'IAttachmentDTO sia popolata e che\r\n * sia abilitato l'accesso alla cartella sul server tramite hostname.\r\n */\r\n @Input(\"productionBaseUrl\") productionBaseUrl: string = null;\r\n\r\n /**\r\n * Opzioni per la compressione delle immagini caricate.\r\n */\r\n @Input(\"compressionOptions\") compressionOptions: IOptions = { maxSizeMB: 0.5, maxWidthOrHeight: 1920, useWebWorker: true };\r\n\r\n /**\r\n * Array di AttachmentType che si possono aggiungere\r\n */\r\n @Input(\"allowedTypes\") allowedTypes: Array<AttachmentType> = [AttachmentType.FILE, AttachmentType.LINK];\r\n\r\n /**\r\n * Input per definire le label da usare nel componente\r\n */\r\n @Input(\"downloadTooltipPosition\") downloadTooltipPosition: TooltipPositionType = TooltipPositionType.Below;\r\n @Input(\"openLinkLabel\") openLinkLabel: string = \"Apri link\";\r\n @Input(\"addButtonLabel\") addButtonLabel: string = \"Aggiungi\";\r\n @Input(\"downloadLabel\") downloadLabel: string = \"Download\";\r\n @Input(\"deleteLabel\") deleteLabel: string = \"Elimina\";\r\n @Input(\"fileNameLabel\") fileNameLabel: string = \"Nome file\";\r\n @Input(\"previewLabel\") previewLabel: string = \"Anteprima\";\r\n @Input(\"uploadFileLabel\") uploadFileLabel: string = \"Carica file\";\r\n @Input(\"confirmLabel\") confirmLabel: string = \"Conferma\";\r\n @Input(\"abortLabel\") abortLabel: string = \"Annulla\";\r\n @Input(\"saveLabel\") saveLabel: string = \"Salva\";\r\n @Input(\"exitLabel\") exitLabel: string = \"Esci\";\r\n @Input(\"eqpTableSearchText\") eqpTableSearchText: string = \"Cerca\";\r\n @Input(\"deleteDialogTitle\") deleteDialogTitle: string = null;\r\n @Input(\"deleteDialogMessage\") deleteDialogMessage: string = \"Sei sicuro di voler cancellare quest'allegato?\";\r\n @Input(\"noImageSelectedErrorMessage\") noImageSelectedErrorMessage: string = \"Non è possibile selezionare un file che non sia un'immagine.\";\r\n @Input(\"wrongTypeSelectedErrorMessage\") wrongTypeSelectedErrorMessage: string = \"Non è possibile caricare il file selezionato.\";\r\n @Input(\"videoPreviewErrorMessage\") videoPreviewErrorMessage: string = \"Impossibile aprire l'anteprima di un file video.\";\r\n @Input(\"videoPreviewErrorMessage\") audioPreviewErrorMessage: string = \"Impossibile aprire l'anteprima di un file audio.\";\r\n //#endregion\r\n\r\n //#region @Output del componente\r\n\r\n /**\r\n * Restituisce la lista aggiornata degli allegati.\r\n */\r\n @Output() localEditedAttachments: EventEmitter<Array<IAttachmentDTO>> = new EventEmitter<Array<IAttachmentDTO>>();\r\n\r\n /**\r\n * Evento di output che restituisce l'IAttachmentDTO selezionato per il download nel caso FileDataBase64, FileContentType o FileName non fossero specificati.\r\n */\r\n @Output(\"downloadAttachment\") downloadAttachment: EventEmitter<IAttachmentDTO> = new EventEmitter<IAttachmentDTO>();\r\n\r\n /**\r\n * Evento di output che restituisce l'elemento eliminato prima che questo venga effettivamente rismosso dalla lista.\r\n */\r\n @Output(\"onDeleteAttachment\") onDeleteAttachment: EventEmitter<IAttachmentDTO> = new EventEmitter<IAttachmentDTO>();\r\n\r\n //#endregion\r\n\r\n //#region Proprietà per gestione caricamento nuovo allegato\r\n newAttachment: IAttachmentDTO = {} as IAttachmentDTO;\r\n dialofRefAddAttachment: MatDialogRef<TemplateRef<any>>;\r\n attachmentType = AttachmentType;\r\n newAttachmentForm: FormGroup;\r\n selectedFile: File = null;\r\n showCropImage: boolean = false;\r\n @ViewChild('dialogAddAttachment', { static: true }) dialogAddAttachment: TemplateRef<any>;\r\n //#endregion\r\n\r\n //#region Proprietà per gestione ridimensionamento file di tipo image\r\n imageChangedEvent: any = '';\r\n croppedImage: any = '';\r\n transform: ImageTransform = {};\r\n @ViewChild(ImageCropperComponent) imageCropper: ImageCropperComponent;\r\n @ViewChild('imageInput') imageInput: any;\r\n //#endregion\r\n\r\n AttachmentType = AttachmentType;\r\n selectedAttachment: IAttachmentDTO;\r\n\r\n originalWidth: number;\r\n originalHeight: number;\r\n customWidth: number;\r\n customHeight: number;\r\n\r\n @ViewChild('attachmentTable', { static: false }) attachmentTable: EqpTableComponent;\r\n @ViewChild('inlinePreviewTemplate', { static: true }) inlinePreviewTemplate: TemplateRef<any>;\r\n @ViewChild('dialogPreview', { static: true }) dialogPreview: TemplateRef<any>;\r\n\r\n constructor(\r\n private dialog: MatDialog,\r\n private formBuilder: FormBuilder,\r\n private sanitizer: DomSanitizer,\r\n private http: HttpClient\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n\r\n //Se è stata richiesta la gestione delle sole immagini allora imposta il filtro per le estensioni possibili da caricare\r\n if (!this.acceptedFileTypes)\r\n if (this.allowOnlyImages == true)\r\n this.acceptedFileTypes = \"image/*\";\r\n else\r\n this.acceptedFileTypes = \"*\";\r\n\r\n // Se non sono stati specificati i tipi da gestire ma è stato passato null o un array vuoto imposto i tipi di default.\r\n if (!this.allowedTypes || this.allowedTypes.length == 0)\r\n this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];\r\n else if (this.allowedTypes.find(t => t != AttachmentType.FILE && t != AttachmentType.LINK)) {\r\n EqpAttachmentDialogService.Warning(\"Almeno uno degli AttachmentType selezionati nel parametro \\\"allowedTypes\\\" non esiste.\")\r\n this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];\r\n }\r\n\r\n\r\n //Se è stata richiesta la gestione multipla degli allegati allora configura l'eqp-table\r\n if (this.multipleAttachment == true && (!this.attachmentsColumns || this.attachmentsColumns.length == 0)) {\r\n this.configureColumns();\r\n }\r\n\r\n if (this.attachmentsList == null)\r\n this.attachmentsList = new Array<IAttachmentDTO>();\r\n\r\n this.checkAttachmentImage();\r\n\r\n // if (!this.compressionOptions || !this.compressionOptions.maxSizeMB || !this.compressionOptions.maxWidthOrHeight)\r\n // this.compressionOptions = { maxSizeMB: 0.5, maxWidthOrHeight: 1920, useWebWorker: true };\r\n }\r\n\r\n public reloadData() {\r\n if (this.attachmentTable)\r\n this.attachmentTable.reloadDatatable();\r\n }\r\n\r\n checkAttachmentImage() {\r\n this.attachmentsList.forEach(a => {\r\n a.IsImage = AttachmentHelperService.checkImageFromMimeType(a.FileContentType);\r\n });\r\n }\r\n\r\n //#region Gestione elenco allegati\r\n\r\n /**\r\n * Configura le colonne per l'eqp-table nel caso in cui il parametro \"multipleAttachments\" è TRUE.\r\n */\r\n configureColumns() {\r\n this.attachmentsColumns = [];\r\n if (this.disableAction != true) {\r\n this.attachmentsColumns.push({\r\n key: \"action\", display: \"\",\r\n type: TypeColumn.MenuAction, buttonMenuIcon: \"more_vert\", styles: { flex: \"0 0 6%\" },\r\n actions: [\r\n { name: this.deleteLabel, icon: \"delete\", fn: (element, index, col) => this.deleteAttachment(element) },\r\n ],\r\n })\r\n }\r\n\r\n let downloadColumn = {\r\n key: \"attachment\", display: \"\",\r\n type: TypeColumn.SimpleAction, styles: { flex: \"0 0 6%\" },\r\n actions: [\r\n {\r\n name: '', fontawesome: true,\r\n icon: (element) => { return this.showInlinePreview ? (element.AttachmentType == AttachmentType.FILE ? \"fas fa-cloud-download-alt\" : \"fas fa-external-link-alt\") : this.getAttachmentIcon(element); },\r\n fn: (element, col, elementIndex) => this.viewAttachment(element),\r\n tooltip: { tooltipText: (element) => { return element.AttachmentType == AttachmentType.FILE ? this.downloadLabel : this.openLinkLabel; }, tooltipPosition: this.downloadTooltipPosition }\r\n },\r\n ]\r\n };\r\n\r\n let inlinePreviewColumn = {\r\n key: \"InlinePreview\", display: this.previewLabel,\r\n type: TypeColumn.ExternalTemplate,\r\n externalTemplate: this.inlinePreviewTemplate,\r\n styles: { flex: \"0 0 10%\" }\r\n };\r\n\r\n let fileNameColumn = { key: \"FileName\", display: this.fileNameLabel };\r\n\r\n if (this.showInlinePreview) {\r\n this.attachmentsColumns.push(inlinePreviewColumn);\r\n this.attachmentsColumns.push(fileNameColumn);\r\n this.attachmentsColumns.push(downloadColumn);\r\n } else {\r\n this.attachmentsColumns.push(downloadColumn);\r\n this.attachmentsColumns.push(fileNameColumn);\r\n }\r\n }\r\n\r\n /**\r\n * Elimina un allegato eliminando anche il file presente nello storage di archiviazione utilizzato (AWS o cartella progetto)\r\n * @param element IAttachmentDTO da cancellare\r\n */\r\n deleteAttachment(element: IAttachmentDTO) {\r\n EqpAttachmentDialogService.Confirm(this.deleteDialogMessage, () => {\r\n this.removeAttachmentFromList(this.attachmentsList.indexOf(element));\r\n }, true, this.deleteDialogTitle);\r\n }\r\n\r\n /**\r\n * Rimuove l'allegato selezionato dalla lista \"attachmentsList\" e invoca l'evento di output che restituisce la lista aggiornata.\r\n * @param attachmentIndex Indice dell'attachment da rimuovere\r\n */\r\n removeAttachmentFromList(attachmentIndex: number) {\r\n this.onDeleteAttachment.emit(this.attachmentsList[attachmentIndex]);\r\n\r\n this.attachmentsList.splice(attachmentIndex, 1);\r\n if (this.attachmentTable)\r\n this.attachmentTable.reloadDatatable();\r\n this.localEditedAttachments.emit(this.attachmentsList);\r\n }\r\n\r\n\r\n /**\r\n * Scarica l'allegato o apre il link\r\n * @param element Allegato da mostrare\r\n */\r\n viewAttachment(attachment: IAttachmentDTO) {\r\n\r\n if (attachment.AttachmentType == AttachmentType.LINK) {\r\n window.open(attachment.FilePath, '_blank');\r\n return;\r\n }\r\n\r\n if (attachment.FileDataBase64 && attachment.FileContentType && attachment.FileName) {\r\n let source = `data:${attachment.FileContentType};base64,${attachment.FileDataBase64}`;\r\n const link = document.createElement(\"a\");\r\n link.href = source;\r\n link.download = `${attachment.FileName}`\r\n link.click();\r\n } else {\r\n this.downloadAttachment.emit(attachment);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Ridefinisce l'icona da mostrare nella colonna dell'eqp-table per ogni file.\r\n * L'icona varia in base all'estensione del file\r\n * @param attachment \r\n */\r\n getAttachmentIcon(attachment: IAttachmentDTO) {\r\n if (attachment.AttachmentType == AttachmentType.LINK)\r\n return \"fas fa-link\";\r\n else\r\n return AttachmentHelperService.getIconFromFileExtensione(attachment.FileExtension);\r\n }\r\n\r\n //#endregion\r\n\r\n /**\r\n * Apre la modale per la definizione dei parametri del nuovo file\r\n */\r\n openModalAddAttachment(attachmentType: AttachmentType) {\r\n this.newAttachment = {} as IAttachmentDTO;\r\n this.newAttachment.IsImage = false;\r\n this.newAttachment.AttachmentType = attachmentType;\r\n\r\n //Crea la form per la validazione dei campi\r\n this.newAttachmentForm = this.formBuilder.group({\r\n type: [this.newAttachment.AttachmentType, Validators.required],\r\n name: [this.newAttachment.FileName],\r\n path: [this.newAttachment.FilePath],\r\n customHeight: [this.customHeight],\r\n customWidth: [this.customWidth]\r\n });\r\n\r\n //Apre la modale\r\n this.dialofRefAddAttachment = this.dialog.open(this.dialogAddAttachment, {\r\n disableClose: true,\r\n hasBackdrop: true,\r\n width: '60%',\r\n maxHeight: '80%'\r\n });\r\n }\r\n\r\n close() {\r\n this.newAttachment = {} as IAttachmentDTO;\r\n this.abortFile();\r\n this.newAttachmentForm.reset();\r\n this.dialofRefAddAttachment.close();\r\n }\r\n\r\n /**\r\n * In base al tipo di allegato controlla se disabilitare o meno il pulsante per salvare.\r\n * Funzione usata nel [disable] del pulsante \"Salva\" del dialog per l'aggiunta di un allegato.\r\n * @returns \r\n */\r\n disableSave() {\r\n if (this.newAttachment.AttachmentType == AttachmentType.FILE) {\r\n return !this.newAttachment.FileDataBase64;\r\n } else {\r\n return !this.newAttachment.FilePath;\r\n }\r\n }\r\n\r\n confirmAddAttachment() {\r\n if (this.newAttachment.AttachmentType == AttachmentType.LINK && !this.newAttachment.FileName)\r\n this.newAttachment.FileName = this.newAttachment.FilePath;\r\n\r\n if (this.attachmentsList == null)\r\n this.attachmentsList = new Array<IAttachmentDTO>();\r\n\r\n this.attachmentsList.push(this.newAttachment);\r\n if (this.attachmentTable)\r\n this.attachmentTable.reloadDatatable();\r\n this.localEditedAttachments.emit(this.attachmentsList);\r\n this.dialofRefAddAttachment.close();\r\n }\r\n\r\n /**\r\n * Apre il dialog per l'anteprima dell'allegato selezionato.\r\n * @param row \r\n * @returns \r\n */\r\n async openPreviewDialog(row: IAttachmentDTO) {\r\n this.selectedAttachment = JSON.parse(JSON.stringify(row));\r\n\r\n if (this.selectedAttachment.AttachmentType == AttachmentType.FILE) {\r\n if (this.selectedAttachment.FileContentType.startsWith(\"video\")) {\r\n EqpAttachmentDialogService.Warning(this.videoPreviewErrorMessage);\r\n return;\r\n } else if (this.selectedAttachment.FileContentType.startsWith(\"audio\")) {\r\n EqpAttachmentDialogService.Warning(this.audioPreviewErrorMessage);\r\n return;\r\n }\r\n }\r\n\r\n if (this.getAttachmentEndpoint && this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64) {\r\n await this.getAttachmentByID()\r\n .then((res) => { this.selectedAttachment.FileDataBase64 = res.FileDataBase64; })\r\n .catch((err) => { EqpAttachmentDialogService.Error(err); });\r\n }\r\n\r\n if (this.selectedAttachment.AttachmentType == AttachmentType.LINK) {\r\n this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.selectedAttachment.FilePath);\r\n } else if (this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64 && !this.selectedAttachment.FileThumbnailBase64) {\r\n EqpAttachmentDialogService.Info(\"Impossibile aprire l'anteprima dell'allegato, file mancante.\")\r\n return;\r\n } else if (!this.selectedAttachment.IsImage) {\r\n if (this.selectedAttachment.FilePath && this.productionBaseUrl) {\r\n this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(\r\n \"https://docs.google.com/gview?url=\" +\r\n this.productionBaseUrl +\r\n \"/\" +\r\n this.selectedAttachment.FilePath +\r\n \"&embedded=true\"\r\n );\r\n } else {\r\n EqpAttachmentDialogService.Info(\"Impossibile aprire l'anteprima del documento!\");\r\n return;\r\n }\r\n }\r\n\r\n this.dialog.open(this.dialogPreview, {\r\n disableClose: true,\r\n hasBackdrop: true,\r\n });\r\n }\r\n\r\n async getAttachmentByID() {\r\n return this.http.post<IAttachmentDTO>(this.getAttachmentEndpoint, this.selectedAttachment).toPromise();\r\n }\r\n\r\n //#region Gestione caricamento file\r\n\r\n /** \r\n * Se il file caricato è un immagine allora mostra le funzionalità del croppie per ritagliare l'immagine altrimenti\r\n * converte il file in base64 e lo associa all'allegato da salvare\r\n */\r\n async onFileInputChange(event) {\r\n this.showCropImage = false;\r\n this.selectedFile = event.target.files[0];\r\n if (!this.selectedFile)\r\n return;\r\n\r\n //Memorizza i dati per l'allegato \r\n this.newAttachment.FileContentType = this.selectedFile.type;\r\n this.newAttachment.FileName = this.selectedFile.name;\r\n this.newAttachment.FileExtension = this.selectedFile.name.substr(this.selectedFile.name.lastIndexOf('.') + 1);\r\n this.newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(this.selectedFile.type);\r\n\r\n //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine\r\n if (this.allowOnlyImages == true && this.newAttachment.IsImage != true) {\r\n EqpAttachmentDialogService.Error(this.noImageSelectedErrorMessage);\r\n this.abortFile();\r\n return;\r\n } else if (!this.checkAcceptedFiles()) {\r\n EqpAttachmentDialogService.Error(this.wrongTypeSelectedErrorMessage);\r\n this.abortFile();\r\n return;\r\n }\r\n\r\n\r\n\r\n //Verifica se il file caricato è un'immagine oppure no. Se è un immagine, prima di caricarla mostra il croppie per il resize.\r\n //Se non è un immagine allora genera il Base64 \r\n if (this.newAttachment.IsImage == true) {\r\n this.getImageDimensions(event.target.files[0])\r\n\r\n //Mostra il croppie e disabilita la form finchè non termina la modifica dell'immagine\r\n this.newAttachmentForm.disable();\r\n this.newAttachmentForm.controls[\"customWidth\"].enable();\r\n this.newAttachmentForm.controls[\"customHeight\"].enable();\r\n this.showCropImage = true;\r\n this.imageChangedEvent = event;\r\n }\r\n else {\r\n this.showCropImage = false;\r\n let base64File = await toBase64(this.selectedFile);\r\n if (base64File) {\r\n // Loris 20/01/2022: PROBLEMA - Quando eseguo l'upload di un file .sql non viene salvato/scaricato correttamente.\r\n // Questo succede perchè non viene popolato il FileContentType. Per risolvere il problema\r\n // faccio un controllo e se non esiste il FileContentType allora lo recupero dal base64 ottenuto.\r\n this.newAttachment.FileContentType = !this.newAttachment.FileContentType ? base64File.split(\",\")[0].split(\":\")[1].split(\";\")[0] : this.newAttachment.FileContentType;\r\n // Un altro metodo per leggere il ccontent type del file è tramite una regular expression:\r\n // this.newAttachment.FileContentType = !this.newAttachment.FileContentType ? base64File.match(/[^:]\\w+\\/[\\w-+\\d.]+(?=;|,)/)[0] : this.newAttachment.FileContentType;\r\n\r\n this.newAttachment.FileDataBase64 = base64File.split(\",\")[1];\r\n }\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Controlla se il file che si sta caricando è supportato dal sistema.\r\n * @returns \r\n */\r\n checkAcceptedFiles(): boolean {\r\n if (this.selectedFile.type.startsWith(\"video\"))\r\n return false;\r\n\r\n if (this.acceptedFileTypes == \"*\")\r\n return true;\r\n let accepted: boolean = this.acceptedFileTypes.includes(this.selectedFile.type);\r\n if (!accepted) {\r\n for (let t of this.acceptedFileTypes.split(\",\").filter(t => t.includes(\"*\"))) {\r\n accepted = this.selectedFile.type.startsWith(t.split(\"*\")[0]);\r\n if (accepted)\r\n break;\r\n }\r\n }\r\n return accepted;\r\n }\r\n\r\n getImageDimensions(img: any) {\r\n const reader = new FileReader();\r\n reader.onload = (e: any) => {\r\n const image = new Image();\r\n image.src = e.target.result;\r\n image.onload = rs => {\r\n this.originalHeight = rs.currentTarget['height'];\r\n this.originalWidth = rs.currentTarget['width'];\r\n\r\n if (this.originalWidth > 1280) {\r\n this.customWidth = 1280;\r\n this.customHeight = Math.round((1280 * this.originalHeight) / this.originalWidth);\r\n } else {\r\n this.customHeight = rs.currentTarget['height'];\r\n this.customWidth = rs.currentTarget['width'];\r\n }\r\n };\r\n };\r\n reader.readAsDataURL(img);\r\n }\r\n\r\n restoreOriginalDimensions() {\r\n this.customWidth = this.originalWidth;\r\n this.customHeight = this.originalHeight;\r\n }\r\n\r\n onDimensionsChange(dimension: string) {\r\n if (dimension == \"H\") {\r\n this.customWidth = Math.round((this.customHeight * this.originalWidth) / this.originalHeight);\r\n } else if (dimension == \"W\") {\r\n this.customHeight = Math.round((this.customWidth * this.originalHeight) / this.originalWidth);\r\n }\r\n }\r\n\r\n imageCropped(event: ImageCroppedEvent) {\r\n this.croppedImage = event.base64;\r\n this.getCroppedAndUpload(this.croppedImage);\r\n }\r\n\r\n getCroppedAndUpload(file) {\r\n var self = this;\r\n\r\n var file: any = base64ToFile(file);\r\n\r\n const options = this.compressionOptions;\r\n\r\n /**\r\n * Comprime l'immagine passando come parametri le options create nell'oggetto sopra, e il file dal reader principale\r\n */\r\n imageCompression(file, options).then((fileCompressed => {\r\n\r\n let fileReader = new FileReader();\r\n\r\n //Faccio la push di ogni file all'interno dell'array di file dell'item da mandare al server\r\n fileReader.onload = function () {\r\n let resultReader = <string>fileReader.result;\r\n var marker = ';base64,';\r\n self.newAttachment.FileDataBase64 = resultReader.substring(resultReader.indexOf(marker) + marker.length);\r\n self.showCropImage = false;\r\n self.newAttachmentForm.enable();\r\n };\r\n\r\n fileReader.readAsDataURL(fileCompressed);\r\n\r\n }));\r\n\r\n }\r\n\r\n confirmCrop() {\r\n this.imageCropper.crop();\r\n }\r\n\r\n /**\r\n * Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO\r\n */\r\n abortFile() {\r\n this.imageChangedEvent = '';\r\n if (this.imageInput)\r\n this.imageInput.nativeElement.value = '';\r\n\r\n this.selectedFile = null;\r\n this.showCropImage = false;\r\n\r\n this.newAttachment.IsImage = false;\r\n this.newAttachment.FileDataBase64 = null;\r\n this.newAttachment.FileName = null;\r\n this.newAttachment.FileExtension = null;\r\n this.newAttachment.FileContentType = null;\r\n\r\n this.customHeight = null;\r\n this.customWidth = null;\r\n this.originalHeight = null;\r\n this.originalWidth = null;\r\n }\r\n\r\n //#endregion\r\n}","import { NgModule } from '@angular/core';\r\n\r\n//Angular Material Components\r\nimport { MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport { MatDatepickerModule } from '@angular/material/datepicker';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatRadioModule } from '@angular/material/radio';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { MatSliderModule } from '@angular/material/slider';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\nimport { MatMenuModule } from '@angular/material/menu';\r\nimport { MatSidenavModule } from '@angular/material/sidenav';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { MatGridListModule } from '@angular/material/grid-list';\r\nimport { MatCardModule } from '@angular/material/card';\r\nimport { MatStepperModule } from '@angular/material/stepper';\r\nimport { MatTabsModule } from '@angular/material/tabs';\r\nimport { MatExpansionModule } from '@angular/material/expansion';\r\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\r\nimport { MatChipsModule } from '@angular/material/chips';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\r\nimport { MatDialogModule } from '@angular/material/dialog';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatSnackBarModule } from '@angular/material/snack-bar';\r\nimport { MatTableModule } from '@angular/material/table';\r\nimport { MatSortModule } from '@angular/material/sort';\r\nimport { MatPaginatorModule } from '@angular/material/paginator';\r\nimport { MatNativeDateModule } from '@angular/material/core';\r\n\r\n\r\n@NgModule({\r\n imports: [\r\n MatCheckboxModule,\r\n MatButtonModule,\r\n MatInputModule,\r\n MatAutocompleteModule,\r\n MatDatepickerModule,\r\n MatFormFieldModule,\r\n MatRadioModule,\r\n MatSelectModule,\r\n MatSliderModule,\r\n MatSlideToggleModule,\r\n MatMenuModule,\r\n MatSidenavModule,\r\n MatToolbarModule,\r\n MatListModule,\r\n MatGridListModule,\r\n MatCardModule,\r\n MatStepperModule,\r\n MatTabsModule,\r\n MatExpansionModule,\r\n MatButtonToggleModule,\r\n MatChipsModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n MatProgressBarModule,\r\n MatDialogModule,\r\n MatTooltipModule,\r\n MatSnackBarModule,\r\n MatTableModule,\r\n MatSortModule,\r\n MatPaginatorModule,\r\n MatDatepickerModule,\r\n MatNativeDateModule\r\n ],\r\n exports: [\r\n MatCheckboxModule,\r\n MatButtonModule,\r\n MatInputModule,\r\n MatAutocompleteModule,\r\n MatDatepickerModule,\r\n MatFormFieldModule,\r\n MatRadioModule,\r\n MatSelectModule,\r\n MatSliderModule,\r\n MatSlideToggleModule,\r\n MatMenuModule,\r\n MatSidenavModule,\r\n MatToolbarModule,\r\n MatListModule,\r\n MatGridListModule,\r\n MatCardModule,\r\n MatStepperModule,\r\n MatTabsModule,\r\n MatExpansionModule,\r\n MatButtonToggleModule,\r\n MatChipsModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n MatProgressBarModule,\r\n MatDialogModule,\r\n MatTooltipModule,\r\n MatSnackBarModule,\r\n MatTableModule,\r\n MatSortModule,\r\n MatPaginatorModule],\r\n})\r\nexport class MaterialModule { }","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { EqpAttachmentsComponent } from './eqp-attachments.component';\r\nimport { MaterialModule } from './modules/material.module';\r\nimport { ImageCropperModule } from 'ngx-image-cropper';\r\nimport { EqpTableModule } from '@eqproject/eqp-table';\r\n\r\n\r\n@NgModule({\r\n declarations: [EqpAttachmentsComponent],\r\n imports: [\r\n MaterialModule,\r\n FormsModule,\r\n CommonModule,\r\n ReactiveFormsModule,\r\n ImageCropperModule,\r\n EqpTableModule\r\n ],\r\n exports: [EqpAttachmentsComponent]\r\n})\r\nexport class EqpAttachmentsModule { }\r\n","/*\r\n * Public API Surface of eqp-attachments\r\n */\r\n\r\nexport * from './lib/eqp-attachments.component';\r\nexport * from './lib/eqp-attachments.module';\r\nexport * from './lib/interfaces/IAttachment';\r\nexport * from './lib/interfaces/IOptions';\r\nexport * from './lib/helpers/attachment.helper';\r\nexport * from './lib/services/eqp-attachment-dialog.service';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {MaterialModule as ɵa} from './lib/modules/material.module';"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaY;AAAZ,WAAY,cAAc;IACtB,mDAAQ,CAAA;IACR,mDAAQ,CAAA;AACZ,CAAC,EAHW,cAAc,KAAd,cAAc;;;IC8BtB;KAAiB;;;;;IAMV,8CAAsB,GAA7B,UAA8B,QAAgB;QAC1C,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,UAAA,CAAC,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;IAAxB,oBAAoB;QAZhC,QAAQ,CAAC;YACR,YAAY,EAAE,CAAC,uBAAuB,CAAC;YACvC,OAAO,EAAE;gBACP,cAAc;gBACd,WAAW;gBACX,YAAY;gBACZ,mBAAmB;gBACnB,kBAAkB;gBAClB,cAAc;aACf;YACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;SACnC,CAAC;OACW,oBAAoB,CAAI;IAAD,2BAAC;CAArC;;ACrBA;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"eqproject-eqp-attachments.js","sources":["ng://@eqproject/eqp-attachments/lib/interfaces/IAttachment.ts","ng://@eqproject/eqp-attachments/lib/helpers/attachment.helper.ts","ng://@eqproject/eqp-attachments/lib/services/eqp-attachment-dialog.service.ts","ng://@eqproject/eqp-attachments/lib/eqp-attachments.component.ts","ng://@eqproject/eqp-attachments/lib/modules/material.module.ts","ng://@eqproject/eqp-attachments/lib/eqp-attachments.module.ts","ng://@eqproject/eqp-attachments/public-api.ts","ng://@eqproject/eqp-attachments/eqproject-eqp-attachments.ts"],"sourcesContent":["export interface IAttachmentDTO {\r\n ID: number | string;\r\n FileName?: string;\r\n FileContentType?: string;\r\n FileExtension?: string;\r\n FilePath?: string;\r\n AttachmentType?: AttachmentType;\r\n FileDataBase64?: string;\r\n IsImage?: boolean;\r\n FileThumbnailBase64?: string;\r\n TrustedUrl?: any;\r\n}\r\n\r\nexport enum AttachmentType {\r\n FILE = 1,\r\n LINK = 2\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\n\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class AttachmentHelperService {\r\n\r\n static readonly imageMimeTypes: string[] = [\"image/bmp\", \"image/gif\", \"image/jpeg\", \"image/tiff\", \"image/png\"];\r\n\r\n static readonly fileExtensionIcon: any = {\r\n \"txt\": \"fas fa-file-text\",\r\n \"pdf\": \"fas fa-file-pdf\",\r\n \"doc\": \"fas fa-file-word\",\r\n \"docx\": \"fas fa-file-word\",\r\n \"xls\": \"fas fa-file-excel\",\r\n \"xlsx\": \"fas fa-file-excel\",\r\n \"jpg\": \"fas fa-file-image\",\r\n \"jpeg\": \"fas fa-file-image\",\r\n \"png\": \"fas fa-file-image\",\r\n \"bmp\": \"fas fa-file-image\",\r\n\r\n \"mkv\": \"fas fa-file-video\",\r\n \"flv\": \"fas fa-file-video\",\r\n \"gif\": \"fas fa-file-video\",\r\n \"gifv\": \"fas fa-file-video\",\r\n \"avi\": \"fas fa-file-video\",\r\n \"wmv\": \"fas fa-file-video\",\r\n \"mp4\": \"fas fa-file-video\",\r\n \"m4p\": \"fas fa-file-video\",\r\n \"m4v\": \"fas fa-file-video\",\r\n \"mpg\": \"fas fa-file-video\",\r\n \"mp2\": \"fas fa-file-video\",\r\n \"mpeg\": \"fas fa-file-video\",\r\n \"mpe\": \"fas fa-file-video\",\r\n \"mpv\": \"fas fa-file-video\",\r\n \"m2v\": \"fas fa-file-video\",\r\n \"3gp\": \"fas fa-file-video\",\r\n \"3g2\": \"fas fa-file-video\",\r\n\r\n \"mp3\": \"fas fa-file-audio\",\r\n };\r\n\r\n constructor() { }\r\n\r\n /**\r\n * Restituisce TRUE se il mime type passato nel parametro corrisponde ad un mime type di un'immagine\r\n * @param mimeType Mime Type da verificare\r\n */\r\n static checkImageFromMimeType(mimeType: string): boolean {\r\n return this.imageMimeTypes.find(s => s == mimeType) != null;\r\n }\r\n\r\n /**\r\n * In base all'estensione passata come parametro, restituisce la FontAwesome corretta da utilizzare.\r\n * Se l'estensione non viene trovata nella costante riportata dentro common.model.ts restituisce un icona standard\r\n * @param extension Estensione del file per cui restituire l'icona corretta\r\n */\r\n static getIconFromFileExtensione(extension: string): string {\r\n let fileIcon = this.fileExtensionIcon[extension];\r\n return fileIcon ?? \"fas fa-file\";\r\n }\r\n\r\n}\r\n","import { Injectable } from \"@angular/core\";\r\nimport Swal from 'sweetalert2';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class EqpAttachmentDialogService {\r\n\r\n constructor() { }\r\n\r\n /**\r\n * Mostra uno sweet alert di tipo ERROR con il messaggio passato come parametro.\r\n * @param message Messaggio d'errore da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Errore')\r\n */\r\n static Error(message: string | string[], title: string = null) {\r\n let currentTitle = title != null ? title : 'Errore';\r\n if (Array.isArray(message)) {\r\n currentTitle = title != null ? title : 'Errore';\r\n let htmlErrors: string = message.join(\"<br>\");\r\n Swal.fire({\r\n title: currentTitle,\r\n html: htmlErrors,\r\n icon: 'error'\r\n });\r\n }\r\n else {\r\n Swal.fire(currentTitle, message, 'error');\r\n }\r\n }\r\n\r\n\r\n /**\r\n * Mostra uno sweetalert di tipo CONFIRM con il messaggio passato come parametro e se viene premuto\r\n * CONFERMA lancia la funzione di callback passata come parametro\r\n * @param message Messaggio da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Info')\r\n */\r\n static Confirm(message: string | string[], confirmCallback: any, isWarning: boolean = false, title: string = null, customWidth: string = null) {\r\n\r\n let currentTitle = title != null ? title : 'Sei sicuro di voler procedere?';\r\n if (Array.isArray(message)) {\r\n let htmlErrors: string = message.join(\"<br>\");\r\n Swal.fire({\r\n title: currentTitle,\r\n html: htmlErrors,\r\n width: customWidth ? customWidth : '32rem',\r\n icon: !isWarning ? 'question' : 'warning',\r\n showCancelButton: true,\r\n allowOutsideClick: false,\r\n allowEscapeKey: false\r\n }).then((result) => {\r\n if (result.value && confirmCallback) {\r\n confirmCallback();\r\n }\r\n });\r\n }\r\n else {\r\n Swal.fire({\r\n title: currentTitle,\r\n text: message,\r\n width: customWidth ? customWidth : '32rem',\r\n icon: !isWarning ? 'question' : 'warning',\r\n showCancelButton: true,\r\n allowOutsideClick: false,\r\n allowEscapeKey: false\r\n }).then((result) => {\r\n if (result.value && confirmCallback) {\r\n confirmCallback();\r\n }\r\n })\r\n }\r\n }\r\n\r\n /**\r\n * Mostra uno sweetalert di tipo INFO con il messaggio passato come parametro\r\n * @param message Messaggio da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Info')\r\n */\r\n static Info(message: string, title: string = null, isToast: boolean = null) {\r\n let currentTitle = title != null ? title : \"Informazione:\";\r\n Swal.fire(currentTitle, message, 'info');\r\n }\r\n\r\n /**\r\n * Mostra uno sweetalert di tipo WARNING con il messaggio passato come parametro\r\n * @param message Messaggio da mostrare nello sweetalert\r\n * @param title Titolo dello sweetalert (di default mostra 'Attenzione!')\r\n */\r\n static Warning(message: string | string[], title: string = null, isToast: boolean = null) {\r\n let currentTitle = title != null ? title : \"Attenzione!\";\r\n\r\n if (Array.isArray(message)) {\r\n let htmlWarnings: string = message.join(\"<br>\");\r\n Swal.fire({\r\n title: currentTitle,\r\n html: htmlWarnings,\r\n icon: 'warning'\r\n });\r\n } else {\r\n Swal.fire(currentTitle, message, 'warning');\r\n }\r\n }\r\n}\r\n","import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';\r\nimport { FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { base64ToFile, ImageCroppedEvent, ImageCropperComponent, ImageTransform } from 'ngx-image-cropper';\r\nimport imageCompression from 'browser-image-compression'\r\nimport { AttachmentType, IAttachmentDTO } from './interfaces/IAttachment';\r\nimport { ConfigColumn, EqpTableComponent, TooltipPositionType, TypeColumn } from '@eqproject/eqp-table';\r\nimport { MatDialog, MatDialogRef } from '@angular/material/dialog';\r\nimport { AttachmentHelperService } from './helpers/attachment.helper';\r\nimport { EqpAttachmentDialogService } from './services/eqp-attachment-dialog.service';\r\nimport { DomSanitizer } from '@angular/platform-browser';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport { IOptions } from './interfaces/IOptions';\r\n\r\nconst toBase64 = file => new Promise<string>((resolve, reject) => {\r\n const reader = new FileReader();\r\n reader.readAsDataURL(file);\r\n reader.onload = () => resolve(reader.result.toString());\r\n reader.onerror = error => reject(error);\r\n});\r\n\r\n@Component({\r\n selector: 'eqp-attachments',\r\n templateUrl: './eqp-attachments.component.html',\r\n styleUrls: ['./eqp-attachments.component.scss']\r\n})\r\nexport class EqpAttachmentsComponent implements OnInit {\r\n\r\n //#region @Input del componente\r\n\r\n /**\r\n * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso \"multipleAttachment\" è TRUE).\r\n */\r\n @Input(\"disableAction\") disableAction: boolean = false;\r\n\r\n /**\r\n * Se TRUE mostra il titolo nell'header nel caso in cui \"multipleAttachment\" è TRUE (\"Elenco allegati\" di default).\r\n */\r\n @Input(\"showHeader\") showHeader: boolean = true;\r\n\r\n /**\r\n * Titolo da visualizzare se il parametro \"showHeader\" è TRUE. Di devault viene visualizzato \"Elenco allegati\".\r\n */\r\n @Input(\"headerTitle\") headerTitle: string = \"Elenco allegati\";\r\n\r\n /**\r\n * Sorgente dati da visualizzare. Nel caso si vuole gestire un singolo allegato va passato in ogni caso come Array.\r\n */\r\n @Input(\"attachmentsList\") attachmentsList: Array<IAttachmentDTO> = null;\r\n\r\n /**\r\n * Se TRUE non mostra la MatCard (nel caso in cui \"multipleAttachment\" è TRUE).\r\n */\r\n @Input(\"showMatCard\") showMatCard: boolean = true;\r\n\r\n /**\r\n * Se FALSE allora il componente mostra solo il pulsante di caricamento di un singolo file, una volta caricato il file invoca l'evento di output \"localEditedAttachments\".\r\n * Se TRUE allora il componente mostra l'elenco di tutti gli allegati ricevuto nel parametro \"attachmentsList\".\r\n */\r\n @Input(\"multipleAttachment\") multipleAttachment: boolean = true;\r\n\r\n /**\r\n * Se assume il valore TRUE allora sarà possibile caricare più file per volta. Questa funzionalità è attiva\r\n * SOLO se si gestiscono allegati multipli, quindi se l'input 'multipleAttachment' assume il valore TRUE, altrimenti è sempre disabilitata.\r\n */\r\n @Input(\"loadMultipleFiles\") loadMultipleFiles: boolean = false;\r\n\r\n /**\r\n * Configurazione delle colonne della eqp-table per la visualizzazione degli allegati (caso \"multipleAttachment\" è TRUE).\r\n */\r\n @Input(\"attachmentsColumns\") attachmentsColumns: Array<ConfigColumn> = null;\r\n\r\n /**\r\n * Imposta il messaggio da visualizzare nel caso in cui la tabella degli allegati (nel caso in cui \"multipleAttachment\" è TRUE) è vuota.\r\n */\r\n @Input(\"emptyTableMessage\") emptyTableMessage: string = \"Nessun dato trovato\";\r\n\r\n /**\r\n * Se TRUE allora permette di selezionare soltanto file di tipo immagine, avente uno dei mimetype\r\n * specificati dentro AttachmentHelperService.\r\n * Se FALSE permette di selezionare qualsiasi tipo di file\r\n */\r\n @Input(\"allowOnlyImages\") allowOnlyImages: boolean = false;\r\n\r\n /**\r\n * Specifica i tipi di file che è possibile caricare\r\n */\r\n @Input(\"acceptedFileTypes\") acceptedFileTypes: string;\r\n\r\n /**\r\n * Se TRUE disabilita il pulsante di Aggiunta allegato (a prescindere dal valore del parametro \"multipleAttachment\").\r\n */\r\n @Input(\"isDisabled\") isDisabled: boolean = false;\r\n\r\n /**\r\n * Mostra/nasconde la colonna per visualizzare l'anteprima dei file nella tabella (caso multipleAtatchments = true).\r\n */\r\n @Input(\"showInlinePreview\") showInlinePreview: boolean = false;\r\n\r\n /**\r\n * Endpoint da chiamare per recueprare l'IAttachmentDTO completo da vedere nell'anteprima. La chiamata sarà in POST e nel body\r\n * conterrà l'IAttachmentDTO selezionato dall'utente.\r\n * La chiamata viene eseguita solo per l'anteprima delle immagini essendo necessario il base64 completo dell'immagine a dimensione reale.\r\n * Per documenti/link basta che sia popolata la proprietà FilePath di IAttachmentDTO.\r\n */\r\n @Input(\"getAttachmentEndpoint\") getAttachmentEndpoint: string = null;\r\n\r\n /**\r\n * Hostname dell'ambiente di produzione dell'applicativo. Necessario per visualizzare l'anteprima dei documenti\r\n * tramite il viewer di google.\r\n * NOTA: Per visualizzare l'anteprima è necessario che la prorietà FilePath dell'IAttachmentDTO sia popolata e che\r\n * sia abilitato l'accesso alla cartella sul server tramite hostname.\r\n */\r\n @Input(\"productionBaseUrl\") productionBaseUrl: string = null;\r\n\r\n /**\r\n * Opzioni per la compressione delle immagini caricate.\r\n */\r\n @Input(\"compressionOptions\") compressionOptions: IOptions = { maxSizeMB: 0.5, maxWidthOrHeight: 1920, useWebWorker: true };\r\n\r\n /**\r\n * Array di AttachmentType che si possono aggiungere\r\n */\r\n @Input(\"allowedTypes\") allowedTypes: Array<AttachmentType> = [AttachmentType.FILE, AttachmentType.LINK];\r\n\r\n /**\r\n * Booleano per impostare la eqp-table nella modalità multilingua\r\n */\r\n @Input(\"isEqpTableMultiLanguage\") isEqpTableMultiLanguage: boolean = false;\r\n\r\n /**\r\n * Input per definire le label da usare nel componente\r\n */\r\n @Input(\"downloadTooltipPosition\") downloadTooltipPosition: TooltipPositionType = TooltipPositionType.Below;\r\n @Input(\"openLinkLabel\") openLinkLabel: string = \"Apri link\";\r\n @Input(\"addButtonLabel\") addButtonLabel: string = \"Aggiungi\";\r\n @Input(\"downloadLabel\") downloadLabel: string = \"Download\";\r\n @Input(\"deleteLabel\") deleteLabel: string = \"Elimina\";\r\n @Input(\"fileNameLabel\") fileNameLabel: string = \"Nome file\";\r\n @Input(\"previewLabel\") previewLabel: string = \"Anteprima\";\r\n @Input(\"uploadFileLabel\") uploadFileLabel: string = \"Carica file\";\r\n @Input(\"confirmLabel\") confirmLabel: string = \"Conferma\";\r\n @Input(\"abortLabel\") abortLabel: string = \"Annulla\";\r\n @Input(\"saveLabel\") saveLabel: string = \"Salva\";\r\n @Input(\"exitLabel\") exitLabel: string = \"Esci\";\r\n @Input(\"eqpTableSearchText\") eqpTableSearchText: string = \"Cerca\";\r\n @Input(\"deleteDialogTitle\") deleteDialogTitle: string = null;\r\n @Input(\"deleteDialogMessage\") deleteDialogMessage: string = \"Sei sicuro di voler cancellare quest'allegato?\";\r\n @Input(\"noImageSelectedErrorMessage\") noImageSelectedErrorMessage: string = \"Non è possibile selezionare un file che non sia un'immagine.\";\r\n @Input(\"wrongTypeSelectedErrorMessage\") wrongTypeSelectedErrorMessage: string = \"Non è possibile caricare il file selezionato.\";\r\n @Input(\"videoPreviewErrorMessage\") videoPreviewErrorMessage: string = \"Impossibile aprire l'anteprima di un file video.\";\r\n @Input(\"videoPreviewErrorMessage\") audioPreviewErrorMessage: string = \"Impossibile aprire l'anteprima di un file audio.\";\r\n //#endregion\r\n\r\n //#region @Output del componente\r\n\r\n /**\r\n * Restituisce la lista aggiornata degli allegati.\r\n */\r\n @Output() localEditedAttachments: EventEmitter<Array<IAttachmentDTO>> = new EventEmitter<Array<IAttachmentDTO>>();\r\n\r\n /**\r\n * Evento di output che restituisce l'IAttachmentDTO selezionato per il download nel caso FileDataBase64, FileContentType o FileName non fossero specificati.\r\n */\r\n @Output(\"downloadAttachment\") downloadAttachment: EventEmitter<IAttachmentDTO> = new EventEmitter<IAttachmentDTO>();\r\n\r\n /**\r\n * Evento di output che restituisce l'elemento eliminato prima che questo venga effettivamente rismosso dalla lista.\r\n */\r\n @Output(\"onDeleteAttachment\") onDeleteAttachment: EventEmitter<IAttachmentDTO> = new EventEmitter<IAttachmentDTO>();\r\n\r\n //#endregion\r\n\r\n //#region Proprietà per gestione caricamento nuovo allegato\r\n newAttachment: IAttachmentDTO = {} as IAttachmentDTO;\r\n newMultipleAttachments: Array<IAttachmentDTO> = [];\r\n dialofRefAddAttachment: MatDialogRef<TemplateRef<any>>;\r\n attachmentType = AttachmentType;\r\n newAttachmentForm: FormGroup;\r\n selectedFile: File = null;\r\n selectedFiles: Array<File> = null;\r\n showCropImage: boolean = false;\r\n @ViewChild('dialogAddAttachment', { static: true }) dialogAddAttachment: TemplateRef<any>;\r\n @ViewChild('dialogAddMultipleAttachment', { static: true }) dialogAddMultipleAttachment: TemplateRef<any>;\r\n //#endregion\r\n\r\n //#region Proprietà per gestione ridimensionamento file di tipo image\r\n imageChangedEvent: any = '';\r\n croppedImage: any = '';\r\n transform: ImageTransform = {};\r\n @ViewChild(ImageCropperComponent) imageCropper: ImageCropperComponent;\r\n @ViewChild('imageInput') imageInput: any;\r\n //#endregion\r\n\r\n AttachmentType = AttachmentType;\r\n selectedAttachment: IAttachmentDTO;\r\n\r\n originalWidth: number;\r\n originalHeight: number;\r\n customWidth: number;\r\n customHeight: number;\r\n\r\n @ViewChild('attachmentTable', { static: false }) attachmentTable: EqpTableComponent;\r\n @ViewChild('inlinePreviewTemplate', { static: true }) inlinePreviewTemplate: TemplateRef<any>;\r\n @ViewChild('dialogPreview', { static: true }) dialogPreview: TemplateRef<any>;\r\n\r\n constructor(\r\n private dialog: MatDialog,\r\n private formBuilder: FormBuilder,\r\n private sanitizer: DomSanitizer,\r\n private http: HttpClient,\r\n private cd: ChangeDetectorRef\r\n ) {\r\n }\r\n\r\n ngOnInit() {\r\n\r\n //Se è stata richiesta la gestione delle sole immagini allora imposta il filtro per le estensioni possibili da caricare\r\n if (!this.acceptedFileTypes)\r\n if (this.allowOnlyImages == true)\r\n this.acceptedFileTypes = \"image/*\";\r\n else\r\n this.acceptedFileTypes = \"*\";\r\n\r\n // Se non sono stati specificati i tipi da gestire ma è stato passato null o un array vuoto imposto i tipi di default.\r\n if (!this.allowedTypes || this.allowedTypes.length == 0)\r\n this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];\r\n else if (this.allowedTypes.find(t => t != AttachmentType.FILE && t != AttachmentType.LINK)) {\r\n EqpAttachmentDialogService.Warning(\"Almeno uno degli AttachmentType selezionati nel parametro \\\"allowedTypes\\\" non esiste.\")\r\n this.allowedTypes = [AttachmentType.FILE, AttachmentType.LINK];\r\n }\r\n\r\n\r\n //Se è stata richiesta la gestione multipla degli allegati allora configura l'eqp-table\r\n if (this.multipleAttachment == true && (!this.attachmentsColumns || this.attachmentsColumns.length == 0)) {\r\n this.configureColumns();\r\n }\r\n\r\n if (this.attachmentsList == null)\r\n this.attachmentsList = new Array<IAttachmentDTO>();\r\n\r\n this.checkAttachmentImage();\r\n }\r\n\r\n public reloadData() {\r\n if (this.attachmentTable)\r\n this.attachmentTable.reloadDatatable();\r\n }\r\n\r\n checkAttachmentImage() {\r\n this.attachmentsList.forEach(a => {\r\n a.IsImage = AttachmentHelperService.checkImageFromMimeType(a.FileContentType);\r\n });\r\n }\r\n\r\n //#region Gestione elenco allegati\r\n\r\n /**\r\n * Configura le colonne per l'eqp-table nel caso in cui il parametro \"multipleAttachments\" è TRUE.\r\n */\r\n configureColumns() {\r\n this.attachmentsColumns = [];\r\n if (this.disableAction != true) {\r\n this.attachmentsColumns.push({\r\n key: \"action\", display: \"\",\r\n type: TypeColumn.MenuAction, buttonMenuIcon: \"more_vert\", styles: { flex: \"0 0 6%\" },\r\n actions: [\r\n { name: this.deleteLabel, icon: \"delete\", fn: (element, index, col) => this.deleteAttachment(element) },\r\n ],\r\n })\r\n }\r\n\r\n let downloadColumn = {\r\n key: \"attachment\", display: \"\",\r\n type: TypeColumn.SimpleAction, styles: { flex: \"0 0 6%\" },\r\n actions: [\r\n {\r\n name: '', fontawesome: true,\r\n icon: (element) => { return this.showInlinePreview ? (element.AttachmentType == AttachmentType.FILE ? \"fas fa-cloud-download-alt\" : \"fas fa-external-link-alt\") : this.getAttachmentIcon(element); },\r\n fn: (element, col, elementIndex) => this.viewAttachment(element),\r\n tooltip: { tooltipText: (element) => { return element.AttachmentType == AttachmentType.FILE ? this.downloadLabel : this.openLinkLabel; }, tooltipPosition: this.downloadTooltipPosition }\r\n },\r\n ]\r\n };\r\n\r\n let inlinePreviewColumn = {\r\n key: \"InlinePreview\", display: this.previewLabel,\r\n type: TypeColumn.ExternalTemplate,\r\n externalTemplate: this.inlinePreviewTemplate,\r\n styles: { flex: \"0 0 10%\" }\r\n };\r\n\r\n let fileNameColumn = { key: \"FileName\", display: this.fileNameLabel };\r\n\r\n if (this.showInlinePreview) {\r\n this.attachmentsColumns.push(inlinePreviewColumn);\r\n this.attachmentsColumns.push(fileNameColumn);\r\n this.attachmentsColumns.push(downloadColumn);\r\n } else {\r\n this.attachmentsColumns.push(downloadColumn);\r\n this.attachmentsColumns.push(fileNameColumn);\r\n }\r\n }\r\n\r\n /**\r\n * Elimina un allegato eliminando anche il file presente nello storage di archiviazione utilizzato (AWS o cartella progetto)\r\n * @param element IAttachmentDTO da cancellare\r\n */\r\n deleteAttachment(element: IAttachmentDTO) {\r\n EqpAttachmentDialogService.Confirm(this.deleteDialogMessage, () => {\r\n this.removeAttachmentFromList(this.attachmentsList.indexOf(element));\r\n }, true, this.deleteDialogTitle);\r\n }\r\n\r\n /**\r\n * Rimuove l'allegato selezionato dalla lista \"attachmentsList\" e invoca l'evento di output che restituisce la lista aggiornata.\r\n * @param attachmentIndex Indice dell'attachment da rimuovere\r\n */\r\n removeAttachmentFromList(attachmentIndex: number) {\r\n this.onDeleteAttachment.emit(this.attachmentsList[attachmentIndex]);\r\n\r\n this.attachmentsList.splice(attachmentIndex, 1);\r\n if (this.attachmentTable)\r\n this.attachmentTable.reloadDatatable();\r\n this.localEditedAttachments.emit(this.attachmentsList);\r\n }\r\n\r\n\r\n /**\r\n * Scarica l'allegato o apre il link\r\n * @param element Allegato da mostrare\r\n */\r\n viewAttachment(attachment: IAttachmentDTO) {\r\n\r\n if (attachment.AttachmentType == AttachmentType.LINK) {\r\n window.open(attachment.FilePath, '_blank');\r\n return;\r\n }\r\n\r\n if (attachment.FileDataBase64 && attachment.FileContentType && attachment.FileName) {\r\n let source = `data:${attachment.FileContentType};base64,${attachment.FileDataBase64}`;\r\n const link = document.createElement(\"a\");\r\n link.href = source;\r\n link.download = `${attachment.FileName}`\r\n link.click();\r\n } else {\r\n this.downloadAttachment.emit(attachment);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Ridefinisce l'icona da mostrare nella colonna dell'eqp-table per ogni file.\r\n * L'icona varia in base all'estensione del file\r\n * @param attachment \r\n */\r\n getAttachmentIcon(attachment: IAttachmentDTO) {\r\n if (attachment.AttachmentType == AttachmentType.LINK)\r\n return \"fas fa-link\";\r\n else\r\n return AttachmentHelperService.getIconFromFileExtensione(attachment.FileExtension);\r\n }\r\n\r\n //#endregion\r\n\r\n /**\r\n * Apre la modale per la definizione dei parametri del nuovo file\r\n */\r\n openModalAddAttachment(attachmentType: AttachmentType) {\r\n\r\n //Se è stato richiesto il caricamento di un LINK o è impostato il caricamento di FILE SINGOLO allora apre la modale per\r\n //il caricamento singolo del file altrimenti apre quella per il caricamento multiplo\r\n // if (attachmentType == AttachmentType.LINK || (attachmentType == AttachmentType.FILE && this.loadMultipleFiles != true)) {\r\n this.newAttachment = {} as IAttachmentDTO;\r\n this.newAttachment.IsImage = false;\r\n this.newAttachment.AttachmentType = attachmentType;\r\n this.newMultipleAttachments = new Array<IAttachmentDTO>();\r\n if(attachmentType == AttachmentType.LINK)\r\n this.newMultipleAttachments.push(this.newAttachment);\r\n\r\n this.createAttachmentForm();\r\n\r\n //Apre la modale\r\n this.dialofRefAddAttachment = this.dialog.open(this.dialogAddAttachment, {\r\n disableClose: true,\r\n hasBackdrop: true,\r\n width: '60%',\r\n maxHeight: '80%'\r\n });\r\n \r\n\r\n }\r\n\r\n createAttachmentForm() {\r\n //Crea la form per la validazione dei campi\r\n this.newAttachmentForm = this.formBuilder.group({\r\n type: [this.newAttachment.AttachmentType, Validators.required],\r\n name: [this.newAttachment.FileName],\r\n path: [this.newAttachment.FilePath],\r\n customHeight: [this.customHeight],\r\n customWidth: [this.customWidth]\r\n });\r\n }\r\n\r\n close() {\r\n this.newAttachment = {} as IAttachmentDTO;\r\n this.newMultipleAttachments = new Array<IAttachmentDTO>();\r\n this.abortFile();\r\n if (this.newAttachmentForm)\r\n this.newAttachmentForm.reset();\r\n\r\n this.dialofRefAddAttachment.close();\r\n }\r\n\r\n /**\r\n * In base al tipo di allegato controlla se disabilitare o meno il pulsante per salvare.\r\n * Funzione usata nel [disable] del pulsante \"Salva\" del dialog per l'aggiunta di un allegato.\r\n * @returns \r\n */\r\n disableSave() {\r\n if (this.loadMultipleFiles != true) {\r\n if (this.newAttachment.AttachmentType == AttachmentType.FILE) {\r\n return !this.newAttachment.FileDataBase64;\r\n } else {\r\n return !this.newAttachment.FilePath;\r\n }\r\n }\r\n else {\r\n return this.newMultipleAttachments.filter(p => (p.AttachmentType == AttachmentType.FILE && !p.FileDataBase64) || (p.AttachmentType == AttachmentType.LINK && !p.FilePath)).length > 0;\r\n }\r\n\r\n }\r\n\r\n confirmAddAttachment() {\r\n\r\n if (this.loadMultipleFiles != true) {\r\n if (this.newAttachment.AttachmentType == AttachmentType.LINK && !this.newAttachment.FileName)\r\n this.newAttachment.FileName = this.newAttachment.FilePath;\r\n\r\n if (this.attachmentsList == null)\r\n this.attachmentsList = new Array<IAttachmentDTO>();\r\n\r\n this.attachmentsList.push(this.newAttachment);\r\n }\r\n else {\r\n if (this.newMultipleAttachments == null || this.newMultipleAttachments.length == 0)\r\n return;\r\n\r\n if (this.attachmentsList == null)\r\n this.attachmentsList = new Array<IAttachmentDTO>();\r\n\r\n this.attachmentsList = this.attachmentsList.concat(this.newMultipleAttachments);\r\n }\r\n\r\n if (this.attachmentTable)\r\n this.attachmentTable.reloadDatatable();\r\n\r\n this.localEditedAttachments.emit(this.attachmentsList);\r\n this.close();\r\n }\r\n\r\n /**\r\n * Apre il dialog per l'anteprima dell'allegato selezionato.\r\n * @param row \r\n * @returns \r\n */\r\n async openPreviewDialog(row: IAttachmentDTO) {\r\n this.selectedAttachment = JSON.parse(JSON.stringify(row));\r\n\r\n if (this.selectedAttachment.AttachmentType == AttachmentType.FILE) {\r\n if (this.selectedAttachment.FileContentType.startsWith(\"video\")) {\r\n EqpAttachmentDialogService.Warning(this.videoPreviewErrorMessage);\r\n return;\r\n } else if (this.selectedAttachment.FileContentType.startsWith(\"audio\")) {\r\n EqpAttachmentDialogService.Warning(this.audioPreviewErrorMessage);\r\n return;\r\n }\r\n }\r\n\r\n if (this.getAttachmentEndpoint && this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64) {\r\n await this.getAttachmentByID()\r\n .then((res) => { this.selectedAttachment.FileDataBase64 = res.FileDataBase64; })\r\n .catch((err) => { EqpAttachmentDialogService.Error(err); });\r\n }\r\n\r\n if (this.selectedAttachment.AttachmentType == AttachmentType.LINK) {\r\n this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.selectedAttachment.FilePath);\r\n } else if (this.selectedAttachment.IsImage && !this.selectedAttachment.FileDataBase64 && !this.selectedAttachment.FileThumbnailBase64) {\r\n EqpAttachmentDialogService.Info(\"Impossibile aprire l'anteprima dell'allegato, file mancante.\")\r\n return;\r\n } else if (!this.selectedAttachment.IsImage) {\r\n if (this.selectedAttachment.FilePath && this.productionBaseUrl) {\r\n this.selectedAttachment.TrustedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(\r\n \"https://docs.google.com/gview?url=\" +\r\n this.productionBaseUrl +\r\n \"/\" +\r\n this.selectedAttachment.FilePath +\r\n \"&embedded=true\"\r\n );\r\n } else {\r\n EqpAttachmentDialogService.Info(\"Impossibile aprire l'anteprima del documento!\");\r\n return;\r\n }\r\n }\r\n\r\n this.dialog.open(this.dialogPreview, {\r\n disableClose: true,\r\n hasBackdrop: true,\r\n });\r\n }\r\n\r\n async getAttachmentByID() {\r\n return this.http.post<IAttachmentDTO>(this.getAttachmentEndpoint, this.selectedAttachment).toPromise();\r\n }\r\n\r\n //#region Gestione caricamento file\r\n\r\n /** \r\n * Evento scatenato alla selezione del file (o dei file).\r\n * Se il caricamento è SINGOLO o se comunque è stato selezionato un solo file allora si occupa di controllare se si tratta di un immagine in modo da\r\n * mostrare le funzionalità del croppie (per ritagliare l'immagine) oppure no.\r\n * Se il file caricato non è un immagine allora genera direttamente il base64 e lo associa all'allegato da salvare.\r\n * Se invece il caricamento dei file è MULTIPLO e sono presenti più file allora esegue le stesse operazioni ignorando però il contrllo\r\n * immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).\r\n */\r\n async onFileInputChange(event) {\r\n this.showCropImage = false;\r\n\r\n //Se è stato richiesto il caricamento SINGOLO oppure se il caricamento è MULTIPLO ma è stato selezionato un solo file\r\n //allora verifica se il file è un immagine (per mostrare il CROPPIE)\r\n if ([...event.target.files].length == 1 || this.loadMultipleFiles != true) {\r\n this.selectedFile = event.target.files[0];\r\n this.selectedFiles = event.target.files;\r\n if (!this.selectedFile)\r\n return;\r\n\r\n //Memorizza i dati per l'allegato \r\n this.newAttachment = await this.createAttachmentFromUploadedFile(this.selectedFile, false);\r\n this.newMultipleAttachments = new Array<IAttachmentDTO>();\r\n this.newMultipleAttachments.push(this.newAttachment);\r\n\r\n //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine\r\n let checkOnlyImage = this.checkAllowOnlyImageFile(this.newAttachment);\r\n if (checkOnlyImage == false)\r\n return;\r\n\r\n\r\n if (this.loadMultipleFiles == true && [...event.target.files].length == 1)\r\n this.createAttachmentForm();\r\n\r\n //Verifica se il file caricato è un'immagine oppure no. Se è un immagine, prima di caricarla mostra il croppie per il resize.\r\n //Se non è un immagine allora genera il Base64 \r\n if (this.newAttachment.IsImage == true) {\r\n this.getImageDimensions(event.target.files[0])\r\n\r\n //Mostra il croppie e disabilita la form finchè non termina la modifica dell'immagine\r\n this.newAttachmentForm.disable();\r\n this.newAttachmentForm.controls[\"customWidth\"].enable();\r\n this.newAttachmentForm.controls[\"customHeight\"].enable();\r\n this.showCropImage = true;\r\n this.imageChangedEvent = event;\r\n }\r\n else {\r\n this.showCropImage = false;\r\n let base64Result = await this.getBase64FromFile(this.selectedFile);\r\n this.newAttachment.FileDataBase64 = base64Result.Base64File;\r\n this.newAttachment.FileContentType = base64Result.ContentType;\r\n }\r\n }\r\n else {\r\n this.selectedFiles = event.target.files;\r\n if (!this.selectedFiles || this.selectedFiles.length == 0)\r\n return;\r\n\r\n this.newMultipleAttachments = new Array<IAttachmentDTO>();\r\n for (let i = 0; i < this.selectedFiles.length; i++) {\r\n let newAttachment: IAttachmentDTO = await this.createAttachmentFromUploadedFile(this.selectedFiles[i], true);\r\n\r\n //Se è stata richiesta la gestione delle sole immagini ma per errore è stato selezionato un file che non è un immagine\r\n let checkOnlyImage = this.checkAllowOnlyImageFile(newAttachment);\r\n if (checkOnlyImage == false)\r\n return;\r\n\r\n this.newMultipleAttachments.push(newAttachment);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.\r\n * Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e \r\n * ricava il ContentType da associare all'oggetto IAttachmentDTO da restituire\r\n * @param currentFile Oggetto FILE da processare\r\n * @param getBase64 Se TRUE allora calcola base64 e ContentType del file passato in input\r\n * @returns Restituisce un oggetto di tipo IAttachmentDTO\r\n */\r\n private async createAttachmentFromUploadedFile(currentFile: File, getBase64: boolean = true): Promise<IAttachmentDTO> {\r\n let newAttachment: IAttachmentDTO = {} as IAttachmentDTO;\r\n\r\n //Memorizza i dati per l'allegato \r\n newAttachment.AttachmentType = AttachmentType.FILE;\r\n newAttachment.FileContentType = currentFile.type;\r\n newAttachment.FileName = currentFile.name;\r\n newAttachment.FileExtension = currentFile.name.substr(currentFile.name.lastIndexOf('.') + 1);\r\n newAttachment.IsImage = AttachmentHelperService.checkImageFromMimeType(currentFile.type);\r\n\r\n if (getBase64 == true) {\r\n let base64Result = await this.getBase64FromFile(currentFile);\r\n newAttachment.FileDataBase64 = base64Result.Base64File;\r\n newAttachment.FileContentType = base64Result.ContentType;\r\n }\r\n\r\n return newAttachment;\r\n }\r\n\r\n /**\r\n * A partire dal file passato in input restituisce un oggetto\r\n * contenente il base64 del file e il suo contentType\r\n * @param currentFile Oggetto File da cui estrapolare base64 e contentType\r\n * @returns Restituisce un oggetto avente le proprietà Base64File e ContentType\r\n */\r\n private async getBase64FromFile(currentFile: File): Promise<any> {\r\n let base64File = await toBase64(currentFile);\r\n let contentType: string = null;\r\n if (base64File) {\r\n // Loris 20/01/2022: PROBLEMA - Quando eseguo l'upload di un file .sql non viene salvato/scaricato correttamente.\r\n // Questo succede perchè non viene popolato il FileContentType. Per risolvere il problema\r\n // faccio un controllo e se non esiste il FileContentType allora lo recupero dal base64 ottenuto.\r\n contentType = base64File.split(\",\")[0].split(\":\")[1].split(\";\")[0];\r\n // Un altro metodo per leggere il ccontent type del file è tramite una regular expression:\r\n base64File = base64File.split(\",\")[1];\r\n }\r\n\r\n let result = {\r\n Base64File: base64File,\r\n ContentType: contentType\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Controlla se il file che si sta caricando è supportato dal sistema.\r\n * @returns \r\n */\r\n private checkAcceptedFiles(): boolean {\r\n if ((this.loadMultipleFiles != true && this.selectedFile.type.startsWith(\"video\"))\r\n || (this.loadMultipleFiles == true && [...this.selectedFiles].filter(p => p.type.startsWith(\"video\")).length > 0))\r\n return false;\r\n\r\n if (this.acceptedFileTypes == \"*\")\r\n return true;\r\n\r\n //Verifica che i tipi del file (o dei file) caricati siano coerenti con quelli accettati dalla direttiva\r\n let accepted: boolean = true\r\n if (this.loadMultipleFiles != true)\r\n accepted = this.acceptedFileTypes.includes(this.selectedFile.type);\r\n else {\r\n let uploadedFileTypes: string[] = [...this.selectedFiles].map(p => p.type);\r\n uploadedFileTypes.forEach(type => {\r\n if (!this.acceptedFileTypes.includes(type))\r\n accepted = false;\r\n });\r\n }\r\n\r\n //Questo controllo permette di gestire le casistiche per cui vengono indicati come tipi validi, ad esempio, 'image/*'\r\n if (!accepted && this.loadMultipleFiles != true) {\r\n for (let t of this.acceptedFileTypes.split(\",\").filter(t => t.includes(\"*\"))) {\r\n accepted = this.selectedFile.type.startsWith(t.split(\"*\")[0]);\r\n if (accepted)\r\n break;\r\n }\r\n }\r\n return accepted;\r\n }\r\n\r\n /**\r\n * Se eqp-attachments è stata configurata per il caricamento delle sole immagini allora verifica che il file passato in\r\n * input sia effettivamente un immagine o no.\r\n * Se il controllo va a buon fine restituisce TRUE altrimenti mostra un messaggio d'errore e restituisce FALSE\r\n */\r\n private checkAllowOnlyImageFile(newAttachment): boolean {\r\n if (this.allowOnlyImages == true && newAttachment.IsImage != true) {\r\n EqpAttachmentDialogService.Error(this.noImageSelectedErrorMessage);\r\n this.abortFile();\r\n return false;\r\n } else if (!this.checkAcceptedFiles()) {\r\n EqpAttachmentDialogService.Error(this.wrongTypeSelectedErrorMessage);\r\n this.abortFile();\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n getImageDimensions(img: any) {\r\n const reader = new FileReader();\r\n reader.onload = (e: any) => {\r\n const image = new Image();\r\n image.src = e.target.result;\r\n image.onload = rs => {\r\n this.originalHeight = rs.currentTarget['height'];\r\n this.originalWidth = rs.currentTarget['width'];\r\n\r\n if (this.originalWidth > 1280) {\r\n this.customWidth = 1280;\r\n this.customHeight = Math.round((1280 * this.originalHeight) / this.originalWidth);\r\n } else {\r\n this.customHeight = rs.currentTarget['height'];\r\n this.customWidth = rs.currentTarget['width'];\r\n }\r\n };\r\n };\r\n reader.readAsDataURL(img);\r\n }\r\n\r\n restoreOriginalDimensions() {\r\n this.customWidth = this.originalWidth;\r\n this.customHeight = this.originalHeight;\r\n }\r\n\r\n onDimensionsChange(dimension: string) {\r\n if (dimension == \"H\") {\r\n this.customWidth = Math.round((this.customHeight * this.originalWidth) / this.originalHeight);\r\n } else if (dimension == \"W\") {\r\n this.customHeight = Math.round((this.customWidth * this.originalHeight) / this.originalWidth);\r\n }\r\n }\r\n\r\n imageCropped(event: ImageCroppedEvent) {\r\n this.croppedImage = event.base64;\r\n this.getCroppedAndUpload(this.croppedImage);\r\n }\r\n\r\n getCroppedAndUpload(file) {\r\n var self = this;\r\n\r\n var file: any = base64ToFile(file);\r\n\r\n const options = this.compressionOptions;\r\n\r\n /**\r\n * Comprime l'immagine passando come parametri le options create nell'oggetto sopra, e il file dal reader principale\r\n */\r\n imageCompression(file, options).then((fileCompressed => {\r\n\r\n let fileReader = new FileReader();\r\n\r\n //Faccio la push di ogni file all'interno dell'array di file dell'item da mandare al server\r\n fileReader.onload = function () {\r\n let resultReader = <string>fileReader.result;\r\n var marker = ';base64,';\r\n self.newAttachment.FileDataBase64 = resultReader.substring(resultReader.indexOf(marker) + marker.length);\r\n self.showCropImage = false;\r\n self.newAttachmentForm.enable();\r\n };\r\n\r\n fileReader.readAsDataURL(fileCompressed);\r\n\r\n }));\r\n\r\n }\r\n\r\n confirmCrop() {\r\n this.imageCropper.crop();\r\n }\r\n\r\n /**\r\n * Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO\r\n */\r\n abortFile() {\r\n this.imageChangedEvent = '';\r\n if (this.imageInput)\r\n this.imageInput.nativeElement.value = '';\r\n\r\n this.selectedFile = null;\r\n this.selectedFiles = null;\r\n this.showCropImage = false;\r\n\r\n this.newAttachment.IsImage = false;\r\n this.newAttachment.FileDataBase64 = null;\r\n this.newAttachment.FileName = null;\r\n this.newAttachment.FileExtension = null;\r\n this.newAttachment.FileContentType = null;\r\n\r\n this.newMultipleAttachments = new Array<IAttachmentDTO>();\r\n\r\n this.customHeight = null;\r\n this.customWidth = null;\r\n this.originalHeight = null;\r\n this.originalWidth = null;\r\n }\r\n\r\n //#endregion\r\n}","import { NgModule } from '@angular/core';\r\n\r\n//Angular Material Components\r\nimport { MatCheckboxModule } from '@angular/material/checkbox';\r\nimport { MatButtonModule } from '@angular/material/button';\r\nimport { MatInputModule } from '@angular/material/input';\r\nimport { MatAutocompleteModule } from '@angular/material/autocomplete';\r\nimport { MatDatepickerModule } from '@angular/material/datepicker';\r\nimport { MatFormFieldModule } from '@angular/material/form-field';\r\nimport { MatRadioModule } from '@angular/material/radio';\r\nimport { MatSelectModule } from '@angular/material/select';\r\nimport { MatSliderModule } from '@angular/material/slider';\r\nimport { MatSlideToggleModule } from '@angular/material/slide-toggle';\r\nimport { MatMenuModule } from '@angular/material/menu';\r\nimport { MatSidenavModule } from '@angular/material/sidenav';\r\nimport { MatToolbarModule } from '@angular/material/toolbar';\r\nimport { MatListModule } from '@angular/material/list';\r\nimport { MatGridListModule } from '@angular/material/grid-list';\r\nimport { MatCardModule } from '@angular/material/card';\r\nimport { MatStepperModule } from '@angular/material/stepper';\r\nimport { MatTabsModule } from '@angular/material/tabs';\r\nimport { MatExpansionModule } from '@angular/material/expansion';\r\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\r\nimport { MatChipsModule } from '@angular/material/chips';\r\nimport { MatIconModule } from '@angular/material/icon';\r\nimport { MatProgressSpinnerModule } from '@angular/material/progress-spinner';\r\nimport { MatProgressBarModule } from '@angular/material/progress-bar';\r\nimport { MatDialogModule } from '@angular/material/dialog';\r\nimport { MatTooltipModule } from '@angular/material/tooltip';\r\nimport { MatSnackBarModule } from '@angular/material/snack-bar';\r\nimport { MatTableModule } from '@angular/material/table';\r\nimport { MatSortModule } from '@angular/material/sort';\r\nimport { MatPaginatorModule } from '@angular/material/paginator';\r\nimport { MatNativeDateModule } from '@angular/material/core';\r\n\r\n\r\n@NgModule({\r\n imports: [\r\n MatCheckboxModule,\r\n MatButtonModule,\r\n MatInputModule,\r\n MatAutocompleteModule,\r\n MatDatepickerModule,\r\n MatFormFieldModule,\r\n MatRadioModule,\r\n MatSelectModule,\r\n MatSliderModule,\r\n MatSlideToggleModule,\r\n MatMenuModule,\r\n MatSidenavModule,\r\n MatToolbarModule,\r\n MatListModule,\r\n MatGridListModule,\r\n MatCardModule,\r\n MatStepperModule,\r\n MatTabsModule,\r\n MatExpansionModule,\r\n MatButtonToggleModule,\r\n MatChipsModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n MatProgressBarModule,\r\n MatDialogModule,\r\n MatTooltipModule,\r\n MatSnackBarModule,\r\n MatTableModule,\r\n MatSortModule,\r\n MatPaginatorModule,\r\n MatDatepickerModule,\r\n MatNativeDateModule\r\n ],\r\n exports: [\r\n MatCheckboxModule,\r\n MatButtonModule,\r\n MatInputModule,\r\n MatAutocompleteModule,\r\n MatDatepickerModule,\r\n MatFormFieldModule,\r\n MatRadioModule,\r\n MatSelectModule,\r\n MatSliderModule,\r\n MatSlideToggleModule,\r\n MatMenuModule,\r\n MatSidenavModule,\r\n MatToolbarModule,\r\n MatListModule,\r\n MatGridListModule,\r\n MatCardModule,\r\n MatStepperModule,\r\n MatTabsModule,\r\n MatExpansionModule,\r\n MatButtonToggleModule,\r\n MatChipsModule,\r\n MatIconModule,\r\n MatProgressSpinnerModule,\r\n MatProgressBarModule,\r\n MatDialogModule,\r\n MatTooltipModule,\r\n MatSnackBarModule,\r\n MatTableModule,\r\n MatSortModule,\r\n MatPaginatorModule],\r\n})\r\nexport class MaterialModule { }","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\r\nimport { EqpAttachmentsComponent } from './eqp-attachments.component';\r\nimport { MaterialModule } from './modules/material.module';\r\nimport { ImageCropperModule } from 'ngx-image-cropper';\r\nimport { EqpTableModule } from '@eqproject/eqp-table';\r\n\r\n\r\n@NgModule({\r\n declarations: [EqpAttachmentsComponent],\r\n imports: [\r\n MaterialModule,\r\n FormsModule,\r\n CommonModule,\r\n ReactiveFormsModule,\r\n ImageCropperModule,\r\n EqpTableModule\r\n ],\r\n exports: [EqpAttachmentsComponent]\r\n})\r\nexport class EqpAttachmentsModule { }\r\n","/*\r\n * Public API Surface of eqp-attachments\r\n */\r\n\r\nexport * from './lib/eqp-attachments.component';\r\nexport * from './lib/eqp-attachments.module';\r\nexport * from './lib/interfaces/IAttachment';\r\nexport * from './lib/interfaces/IOptions';\r\nexport * from './lib/helpers/attachment.helper';\r\nexport * from './lib/services/eqp-attachment-dialog.service';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {MaterialModule as ɵa} from './lib/modules/material.module';"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAaY;AAAZ,WAAY,cAAc;IACtB,mDAAQ,CAAA;IACR,mDAAQ,CAAA;AACZ,CAAC,EAHW,cAAc,KAAd,cAAc;;;IC8BtB;KAAiB;;;;;IAMV,8CAAsB,GAA7B,UAA8B,QAAgB;QAC1C,OAAO,IAAI,CAAC,cAAc,CAAC,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B;gBACrB,cAAc;gBACd,aAAa;gBACb,wBAAwB;gBACxB,oBAAoB;gBACpB,eAAe;gBACf,gBAAgB;gBAChB,iBAAiB;gBACjB,cAAc;gBACd,aAAa;gBACb,kBAAkB;gBAClB,mBAAmB;gBACnB,mBAAmB;aACpB;YACD,OAAO,EAAE;gBACP,iBAAiB;gBACjB,eAAe;gBACf,cAAc;gBACd,qBAAqB;gBACrB,mBAAmB;gBACnB,kBAAkB;gBAClB,cAAc;gBACd,eAAe;gBACf,eAAe;gBACf,oBAAoB;gBACpB,aAAa;gBACb,gBAAgB;gBAChB,gBAAgB;gBAChB,aAAa;gBACb,iBAAiB;gBACjB,aAAa;gBACb,gBAAgB;gBAChB,aAAa;gBACb,kBAAkB;gBAClB,qBAAqB;gBACrB,cAAc;gBACd,aAAa;gBACb,wBAAwB;gBACxB,oBAAoB;gBACpB,eAAe;gBACf,gBAAgB;gBAChB,iBAAiB;gBACjB,cAAc;gBACd,aAAa;gBACb,kBAAkB;aAAC;SACtB,CAAC;OACW,cAAc,CAAI;IAAD,qBAAC;CAA/B;;;IClFA;KAAqC;IAAxB,oBAAoB;QAZhC,QAAQ,CAAC;YACR,YAAY,EAAE,CAAC,uBAAuB,CAAC;YACvC,OAAO,EAAE;gBACP,cAAc;gBACd,WAAW;gBACX,YAAY;gBACZ,mBAAmB;gBACnB,kBAAkB;gBAClB,cAAc;aACf;YACD,OAAO,EAAE,CAAC,uBAAuB,CAAC;SACnC,CAAC;OACW,oBAAoB,CAAI;IAAD,2BAAC;CAArC;;ACrBA;;;;ACAA;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { EventEmitter, OnInit, TemplateRef } from '@angular/core';
1
+ import { ChangeDetectorRef, EventEmitter, OnInit, TemplateRef } from '@angular/core';
2
2
  import { FormBuilder, FormGroup } from '@angular/forms';
3
3
  import { ImageCroppedEvent, ImageCropperComponent, ImageTransform } from 'ngx-image-cropper';
4
4
  import { AttachmentType, IAttachmentDTO } from './interfaces/IAttachment';
@@ -12,6 +12,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
12
12
  private formBuilder;
13
13
  private sanitizer;
14
14
  private http;
15
+ private cd;
15
16
  /**
16
17
  * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso "multipleAttachment" è TRUE).
17
18
  */
@@ -37,6 +38,11 @@ export declare class EqpAttachmentsComponent implements OnInit {
37
38
  * Se TRUE allora il componente mostra l'elenco di tutti gli allegati ricevuto nel parametro "attachmentsList".
38
39
  */
39
40
  multipleAttachment: boolean;
41
+ /**
42
+ * Se assume il valore TRUE allora sarà possibile caricare più file per volta. Questa funzionalità è attiva
43
+ * SOLO se si gestiscono allegati multipli, quindi se l'input 'multipleAttachment' assume il valore TRUE, altrimenti è sempre disabilitata.
44
+ */
45
+ loadMultipleFiles: boolean;
40
46
  /**
41
47
  * Configurazione delle colonne della eqp-table per la visualizzazione degli allegati (caso "multipleAttachment" è TRUE).
42
48
  */
@@ -85,6 +91,10 @@ export declare class EqpAttachmentsComponent implements OnInit {
85
91
  * Array di AttachmentType che si possono aggiungere
86
92
  */
87
93
  allowedTypes: Array<AttachmentType>;
94
+ /**
95
+ * Booleano per impostare la eqp-table nella modalità multilingua
96
+ */
97
+ isEqpTableMultiLanguage: boolean;
88
98
  /**
89
99
  * Input per definire le label da usare nel componente
90
100
  */
@@ -120,12 +130,15 @@ export declare class EqpAttachmentsComponent implements OnInit {
120
130
  */
121
131
  onDeleteAttachment: EventEmitter<IAttachmentDTO>;
122
132
  newAttachment: IAttachmentDTO;
133
+ newMultipleAttachments: Array<IAttachmentDTO>;
123
134
  dialofRefAddAttachment: MatDialogRef<TemplateRef<any>>;
124
135
  attachmentType: typeof AttachmentType;
125
136
  newAttachmentForm: FormGroup;
126
137
  selectedFile: File;
138
+ selectedFiles: Array<File>;
127
139
  showCropImage: boolean;
128
140
  dialogAddAttachment: TemplateRef<any>;
141
+ dialogAddMultipleAttachment: TemplateRef<any>;
129
142
  imageChangedEvent: any;
130
143
  croppedImage: any;
131
144
  transform: ImageTransform;
@@ -140,7 +153,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
140
153
  attachmentTable: EqpTableComponent;
141
154
  inlinePreviewTemplate: TemplateRef<any>;
142
155
  dialogPreview: TemplateRef<any>;
143
- constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient);
156
+ constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient, cd: ChangeDetectorRef);
144
157
  ngOnInit(): void;
145
158
  reloadData(): void;
146
159
  checkAttachmentImage(): void;
@@ -173,6 +186,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
173
186
  * Apre la modale per la definizione dei parametri del nuovo file
174
187
  */
175
188
  openModalAddAttachment(attachmentType: AttachmentType): void;
189
+ createAttachmentForm(): void;
176
190
  close(): void;
177
191
  /**
178
192
  * In base al tipo di allegato controlla se disabilitare o meno il pulsante per salvare.
@@ -189,15 +203,41 @@ export declare class EqpAttachmentsComponent implements OnInit {
189
203
  openPreviewDialog(row: IAttachmentDTO): Promise<void>;
190
204
  getAttachmentByID(): Promise<IAttachmentDTO>;
191
205
  /**
192
- * Se il file caricato è un immagine allora mostra le funzionalità del croppie per ritagliare l'immagine altrimenti
193
- * converte il file in base64 e lo associa all'allegato da salvare
206
+ * Evento scatenato alla selezione del file (o dei file).
207
+ * Se il caricamento è SINGOLO o se comunque è stato selezionato un solo file allora si occupa di controllare se si tratta di un immagine in modo da
208
+ * mostrare le funzionalità del croppie (per ritagliare l'immagine) oppure no.
209
+ * Se il file caricato non è un immagine allora genera direttamente il base64 e lo associa all'allegato da salvare.
210
+ * Se invece il caricamento dei file è MULTIPLO e sono presenti più file allora esegue le stesse operazioni ignorando però il contrllo
211
+ * immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
194
212
  */
195
213
  onFileInputChange(event: any): Promise<void>;
214
+ /**
215
+ * A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
216
+ * Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
217
+ * ricava il ContentType da associare all'oggetto IAttachmentDTO da restituire
218
+ * @param currentFile Oggetto FILE da processare
219
+ * @param getBase64 Se TRUE allora calcola base64 e ContentType del file passato in input
220
+ * @returns Restituisce un oggetto di tipo IAttachmentDTO
221
+ */
222
+ private createAttachmentFromUploadedFile;
223
+ /**
224
+ * A partire dal file passato in input restituisce un oggetto
225
+ * contenente il base64 del file e il suo contentType
226
+ * @param currentFile Oggetto File da cui estrapolare base64 e contentType
227
+ * @returns Restituisce un oggetto avente le proprietà Base64File e ContentType
228
+ */
229
+ private getBase64FromFile;
196
230
  /**
197
231
  * Controlla se il file che si sta caricando è supportato dal sistema.
198
232
  * @returns
199
233
  */
200
- checkAcceptedFiles(): boolean;
234
+ private checkAcceptedFiles;
235
+ /**
236
+ * Se eqp-attachments è stata configurata per il caricamento delle sole immagini allora verifica che il file passato in
237
+ * input sia effettivamente un immagine o no.
238
+ * Se il controllo va a buon fine restituisce TRUE altrimenti mostra un messaggio d'errore e restituisce FALSE
239
+ */
240
+ private checkAllowOnlyImageFile;
201
241
  getImageDimensions(img: any): void;
202
242
  restoreOriginalDimensions(): void;
203
243
  onDimensionsChange(dimension: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eqproject/eqp-attachments",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "Dynamic attachments component - Angular Material based",
5
5
  "author": {
6
6
  "name": "EqProject"
@@ -11,7 +11,7 @@
11
11
  "sweetalert2": "^9.10.9"
12
12
  },
13
13
  "dependencies": {
14
- "@eqproject/eqp-table": "^0.8.4",
14
+ "@eqproject/eqp-table": "^0.8.9",
15
15
  "browser-image-compression": "^1.0.15",
16
16
  "ngx-image-cropper": "^3.3.5",
17
17
  "tslib": "^1.10.0"