@eqproject/eqp-attachments 3.1.3 → 3.1.5
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 +31 -4
- package/esm2022/lib/eqp-attachments.component.mjs +293 -86
- package/esm2022/lib/interfaces/IAttachment.mjs +1 -1
- package/fesm2022/eqproject-eqp-attachments.mjs +292 -85
- package/fesm2022/eqproject-eqp-attachments.mjs.map +1 -1
- package/lib/eqp-attachments.component.d.ts +28 -7
- package/lib/interfaces/IAttachment.d.ts +12 -0
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HttpClient } from "@angular/common/http";
|
|
2
|
-
import {
|
|
2
|
+
import { EventEmitter, OnInit, TemplateRef } from "@angular/core";
|
|
3
3
|
import { FormBuilder, FormGroup } from "@angular/forms";
|
|
4
4
|
import { MatDialog, MatDialogRef } from "@angular/material/dialog";
|
|
5
5
|
import { DomSanitizer } from "@angular/platform-browser";
|
|
6
6
|
import { ImageCroppedEvent, ImageCropperComponent, ImageTransform } from "ngx-image-cropper";
|
|
7
|
-
import { AttachmentCardSize, AttachmentFieldColumn, AttachmentType, CropOptionEnum, IAttachmentDTO } from "./interfaces/IAttachment";
|
|
7
|
+
import { AttachmentCardSize, AttachmentFieldColumn, AttachmentMenuAction, AttachmentType, CropOptionEnum, IAttachmentDTO } from "./interfaces/IAttachment";
|
|
8
8
|
import { IOptions } from "./interfaces/IOptions";
|
|
9
9
|
import { EqpAttachmentService } from "./services/eqp-attachment.service";
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
@@ -14,7 +14,6 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
14
14
|
private formBuilder;
|
|
15
15
|
private sanitizer;
|
|
16
16
|
private http;
|
|
17
|
-
private cd;
|
|
18
17
|
private eqpAttachmentService;
|
|
19
18
|
/**
|
|
20
19
|
* Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso "multipleAttachment" è TRUE).
|
|
@@ -164,6 +163,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
164
163
|
flipVerticalLabel: string;
|
|
165
164
|
rotateRightLabel: string;
|
|
166
165
|
rotateLeftLabel: string;
|
|
166
|
+
base64LimitMB: number;
|
|
167
167
|
uploadTitle: string;
|
|
168
168
|
uploadSubtitle: string;
|
|
169
169
|
dropHereLabel: string;
|
|
@@ -178,10 +178,25 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
178
178
|
chooseView: boolean;
|
|
179
179
|
showSummary: boolean;
|
|
180
180
|
viewMode: 'card' | 'table';
|
|
181
|
+
showUploadTitle: boolean;
|
|
182
|
+
showDropArea: boolean;
|
|
183
|
+
hiddenColumns: string[];
|
|
184
|
+
hiddenActions: string[];
|
|
185
|
+
videoCompression: {
|
|
186
|
+
enabled: boolean;
|
|
187
|
+
maxWidth?: number;
|
|
188
|
+
bitrate?: number;
|
|
189
|
+
};
|
|
190
|
+
private _customMenuActions;
|
|
191
|
+
_sortedMenuActions: AttachmentMenuAction[];
|
|
192
|
+
/**
|
|
193
|
+
* SOLO quando [customMenuActions]="..." cambia.
|
|
194
|
+
*/
|
|
195
|
+
set customMenuActions(value: AttachmentMenuAction[]);
|
|
196
|
+
get customMenuActions(): AttachmentMenuAction[];
|
|
181
197
|
private _customColumns;
|
|
182
198
|
/**
|
|
183
|
-
*
|
|
184
|
-
* Questo blocco di codice viene eseguito SOLO quando [customColumns]="..." cambia.
|
|
199
|
+
* SOLO quando [customColumns]="..." cambia.
|
|
185
200
|
*/
|
|
186
201
|
set customColumns(value: AttachmentFieldColumn[]);
|
|
187
202
|
get customColumns(): AttachmentFieldColumn[];
|
|
@@ -245,7 +260,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
245
260
|
get totalSizeFormatted(): string;
|
|
246
261
|
formatFileSize(bytes: number): string;
|
|
247
262
|
showToast(message: string, type?: 'success' | 'error', durationMs?: number): void;
|
|
248
|
-
constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient,
|
|
263
|
+
constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient, eqpAttachmentService: EqpAttachmentService);
|
|
249
264
|
ngOnInit(): void;
|
|
250
265
|
setViewMode(mode: 'card' | 'table'): void;
|
|
251
266
|
private recomputeTotalsAndProgress;
|
|
@@ -287,6 +302,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
287
302
|
*/
|
|
288
303
|
disableSave(): boolean;
|
|
289
304
|
confirmAddAttachment(): void;
|
|
305
|
+
private resetSelectedFiles;
|
|
290
306
|
/**
|
|
291
307
|
* Apre il dialog per l'anteprima dell'allegato selezionato.
|
|
292
308
|
* @param row
|
|
@@ -365,10 +381,15 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
365
381
|
* @returns `true` if a preview is available, otherwise `false`.
|
|
366
382
|
*/
|
|
367
383
|
canBePreviewed(att: IAttachmentDTO): boolean;
|
|
384
|
+
private isColumnHidden;
|
|
385
|
+
isActionHidden(action: AttachmentMenuAction, att?: IAttachmentDTO): boolean;
|
|
368
386
|
/**
|
|
369
387
|
* Unisce le colonne di default con quelle custom e le ordina.
|
|
370
388
|
*/
|
|
371
389
|
private setupTableColumns;
|
|
390
|
+
private setupMenuActions;
|
|
391
|
+
private generateVideoThumbnail;
|
|
392
|
+
private compressVideoNative;
|
|
372
393
|
static ɵfac: i0.ɵɵFactoryDeclaration<EqpAttachmentsComponent, never>;
|
|
373
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EqpAttachmentsComponent, "eqp-attachments", never, { "disableAction": { "alias": "disableAction"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "attachmentsList": { "alias": "attachmentsList"; "required": false; }; "singleAttachment": { "alias": "singleAttachment"; "required": false; }; "showMatCard": { "alias": "showMatCard"; "required": false; }; "multipleAttachment": { "alias": "multipleAttachment"; "required": false; }; "loadMultipleFiles": { "alias": "loadMultipleFiles"; "required": false; }; "emptyTableMessage": { "alias": "emptyTableMessage"; "required": false; }; "allowOnlyImages": { "alias": "allowOnlyImages"; "required": false; }; "acceptedFileTypes": { "alias": "acceptedFileTypes"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; "showInlinePreview": { "alias": "showInlinePreview"; "required": false; }; "getAttachmentEndpoint": { "alias": "getAttachmentEndpoint"; "required": false; }; "productionBaseUrl": { "alias": "productionBaseUrl"; "required": false; }; "compressionOptions": { "alias": "compressionOptions"; "required": false; }; "allowedTypes": { "alias": "allowedTypes"; "required": false; }; "isEqpTableMultiLanguage": { "alias": "isEqpTableMultiLanguage"; "required": false; }; "tablePaginatorVisible": { "alias": "tablePaginatorVisible"; "required": false; }; "isTableSearcheable": { "alias": "isTableSearcheable"; "required": false; }; "tablePaginatorSize": { "alias": "tablePaginatorSize"; "required": false; }; "separatedUploadButtons": { "alias": "separatedUploadButtons"; "required": false; }; "showPreview": { "alias": "showPreview"; "required": false; }; "singleAttachmentDragAndDrop": { "alias": "singleAttachmentDragAndDrop"; "required": false; }; "cropOptions": { "alias": "cropOptions"; "required": false; }; "cropDialogClass": { "alias": "cropDialogClass"; "required": false; }; "maxFileSizeMB": { "alias": "maxFileSizeMB"; "required": false; }; "cardSize": { "alias": "cardSize"; "required": false; }; "customCardWidthPx": { "alias": "customCardWidthPx"; "required": false; }; "customCardHeightPx": { "alias": "customCardHeightPx"; "required": false; }; "layout": { "alias": "layout"; "required": false; }; "openLinkLabel": { "alias": "openLinkLabel"; "required": false; }; "addButtonLabel": { "alias": "addButtonLabel"; "required": false; }; "downloadLabel": { "alias": "downloadLabel"; "required": false; }; "deleteLabel": { "alias": "deleteLabel"; "required": false; }; "fileNameLabel": { "alias": "fileNameLabel"; "required": false; }; "previewLabel": { "alias": "previewLabel"; "required": false; }; "uploadFileLabel": { "alias": "uploadFileLabel"; "required": false; }; "confirmLabel": { "alias": "confirmLabel"; "required": false; }; "abortLabel": { "alias": "abortLabel"; "required": false; }; "saveLabel": { "alias": "saveLabel"; "required": false; }; "exitLabel": { "alias": "exitLabel"; "required": false; }; "uploadWithDropboxLabel": { "alias": "uploadWithDropboxLabel"; "required": false; }; "cropLabel": { "alias": "cropLabel"; "required": false; }; "deleteDialogTitle": { "alias": "deleteDialogTitle"; "required": false; }; "deleteDialogMessage": { "alias": "deleteDialogMessage"; "required": false; }; "noImageSelectedErrorMessage": { "alias": "noImageSelectedErrorMessage"; "required": false; }; "wrongTypeSelectedErrorMessage": { "alias": "wrongTypeSelectedErrorMessage"; "required": false; }; "videoPreviewErrorMessage": { "alias": "videoPreviewErrorMessage"; "required": false; }; "audioPreviewErrorMessage": { "alias": "videoPreviewErrorMessage"; "required": false; }; "flipHorinzontalLabel": { "alias": "flipHorinzontalLabel"; "required": false; }; "flipVerticalLabel": { "alias": "flipVerticalLabel"; "required": false; }; "rotateRightLabel": { "alias": "rotateRightLabel"; "required": false; }; "rotateLeftLabel": { "alias": "rotateLeftLabel"; "required": false; }; "uploadTitle": { "alias": "uploadTitle"; "required": false; }; "uploadSubtitle": { "alias": "uploadSubtitle"; "required": false; }; "dropHereLabel": { "alias": "dropHereLabel"; "required": false; }; "supportedFormatsLabel": { "alias": "supportedFormatsLabel"; "required": false; }; "browseFilesLabel": { "alias": "browseFilesLabel"; "required": false; }; "uploadSummaryLabel": { "alias": "uploadSummaryLabel"; "required": false; }; "filesLabel": { "alias": "filesLabel"; "required": false; }; "totalSizeLabel": { "alias": "totalSizeLabel"; "required": false; }; "emptyStateLabel": { "alias": "emptyStateLabel"; "required": false; }; "addedSuccessfullyLabel": { "alias": "addedSuccessfullyLabel"; "required": false; }; "removedLabel": { "alias": "removedLabel"; "required": false; }; "chooseView": { "alias": "chooseView"; "required": false; }; "showSummary": { "alias": "showSummary"; "required": false; }; "viewMode": { "alias": "viewMode"; "required": false; }; "customColumns": { "alias": "customColumns"; "required": false; }; }, { "localEditedAttachments": "localEditedAttachments"; "abortAddAttachment": "abortAddAttachment"; "downloadAttachment": "downloadAttachment"; "onDeleteAttachment": "onDeleteAttachment"; }, never, never, false, never>;
|
|
394
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EqpAttachmentsComponent, "eqp-attachments", never, { "disableAction": { "alias": "disableAction"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "attachmentsList": { "alias": "attachmentsList"; "required": false; }; "singleAttachment": { "alias": "singleAttachment"; "required": false; }; "showMatCard": { "alias": "showMatCard"; "required": false; }; "multipleAttachment": { "alias": "multipleAttachment"; "required": false; }; "loadMultipleFiles": { "alias": "loadMultipleFiles"; "required": false; }; "emptyTableMessage": { "alias": "emptyTableMessage"; "required": false; }; "allowOnlyImages": { "alias": "allowOnlyImages"; "required": false; }; "acceptedFileTypes": { "alias": "acceptedFileTypes"; "required": false; }; "isDisabled": { "alias": "isDisabled"; "required": false; }; "showInlinePreview": { "alias": "showInlinePreview"; "required": false; }; "getAttachmentEndpoint": { "alias": "getAttachmentEndpoint"; "required": false; }; "productionBaseUrl": { "alias": "productionBaseUrl"; "required": false; }; "compressionOptions": { "alias": "compressionOptions"; "required": false; }; "allowedTypes": { "alias": "allowedTypes"; "required": false; }; "isEqpTableMultiLanguage": { "alias": "isEqpTableMultiLanguage"; "required": false; }; "tablePaginatorVisible": { "alias": "tablePaginatorVisible"; "required": false; }; "isTableSearcheable": { "alias": "isTableSearcheable"; "required": false; }; "tablePaginatorSize": { "alias": "tablePaginatorSize"; "required": false; }; "separatedUploadButtons": { "alias": "separatedUploadButtons"; "required": false; }; "showPreview": { "alias": "showPreview"; "required": false; }; "singleAttachmentDragAndDrop": { "alias": "singleAttachmentDragAndDrop"; "required": false; }; "cropOptions": { "alias": "cropOptions"; "required": false; }; "cropDialogClass": { "alias": "cropDialogClass"; "required": false; }; "maxFileSizeMB": { "alias": "maxFileSizeMB"; "required": false; }; "cardSize": { "alias": "cardSize"; "required": false; }; "customCardWidthPx": { "alias": "customCardWidthPx"; "required": false; }; "customCardHeightPx": { "alias": "customCardHeightPx"; "required": false; }; "layout": { "alias": "layout"; "required": false; }; "openLinkLabel": { "alias": "openLinkLabel"; "required": false; }; "addButtonLabel": { "alias": "addButtonLabel"; "required": false; }; "downloadLabel": { "alias": "downloadLabel"; "required": false; }; "deleteLabel": { "alias": "deleteLabel"; "required": false; }; "fileNameLabel": { "alias": "fileNameLabel"; "required": false; }; "previewLabel": { "alias": "previewLabel"; "required": false; }; "uploadFileLabel": { "alias": "uploadFileLabel"; "required": false; }; "confirmLabel": { "alias": "confirmLabel"; "required": false; }; "abortLabel": { "alias": "abortLabel"; "required": false; }; "saveLabel": { "alias": "saveLabel"; "required": false; }; "exitLabel": { "alias": "exitLabel"; "required": false; }; "uploadWithDropboxLabel": { "alias": "uploadWithDropboxLabel"; "required": false; }; "cropLabel": { "alias": "cropLabel"; "required": false; }; "deleteDialogTitle": { "alias": "deleteDialogTitle"; "required": false; }; "deleteDialogMessage": { "alias": "deleteDialogMessage"; "required": false; }; "noImageSelectedErrorMessage": { "alias": "noImageSelectedErrorMessage"; "required": false; }; "wrongTypeSelectedErrorMessage": { "alias": "wrongTypeSelectedErrorMessage"; "required": false; }; "videoPreviewErrorMessage": { "alias": "videoPreviewErrorMessage"; "required": false; }; "audioPreviewErrorMessage": { "alias": "videoPreviewErrorMessage"; "required": false; }; "flipHorinzontalLabel": { "alias": "flipHorinzontalLabel"; "required": false; }; "flipVerticalLabel": { "alias": "flipVerticalLabel"; "required": false; }; "rotateRightLabel": { "alias": "rotateRightLabel"; "required": false; }; "rotateLeftLabel": { "alias": "rotateLeftLabel"; "required": false; }; "base64LimitMB": { "alias": "base64LimitMB"; "required": false; }; "uploadTitle": { "alias": "uploadTitle"; "required": false; }; "uploadSubtitle": { "alias": "uploadSubtitle"; "required": false; }; "dropHereLabel": { "alias": "dropHereLabel"; "required": false; }; "supportedFormatsLabel": { "alias": "supportedFormatsLabel"; "required": false; }; "browseFilesLabel": { "alias": "browseFilesLabel"; "required": false; }; "uploadSummaryLabel": { "alias": "uploadSummaryLabel"; "required": false; }; "filesLabel": { "alias": "filesLabel"; "required": false; }; "totalSizeLabel": { "alias": "totalSizeLabel"; "required": false; }; "emptyStateLabel": { "alias": "emptyStateLabel"; "required": false; }; "addedSuccessfullyLabel": { "alias": "addedSuccessfullyLabel"; "required": false; }; "removedLabel": { "alias": "removedLabel"; "required": false; }; "chooseView": { "alias": "chooseView"; "required": false; }; "showSummary": { "alias": "showSummary"; "required": false; }; "viewMode": { "alias": "viewMode"; "required": false; }; "showUploadTitle": { "alias": "showUploadTitle"; "required": false; }; "showDropArea": { "alias": "showDropArea"; "required": false; }; "hiddenColumns": { "alias": "hiddenColumns"; "required": false; }; "hiddenActions": { "alias": "hiddenActions"; "required": false; }; "videoCompression": { "alias": "videoCompression"; "required": false; }; "customMenuActions": { "alias": "customMenuActions"; "required": false; }; "customColumns": { "alias": "customColumns"; "required": false; }; }, { "localEditedAttachments": "localEditedAttachments"; "abortAddAttachment": "abortAddAttachment"; "downloadAttachment": "downloadAttachment"; "onDeleteAttachment": "onDeleteAttachment"; }, never, never, false, never>;
|
|
374
395
|
}
|
|
@@ -11,6 +11,8 @@ export interface IAttachmentDTO {
|
|
|
11
11
|
FileThumbnailBase64?: string;
|
|
12
12
|
TrustedUrl?: any;
|
|
13
13
|
isUploading?: boolean;
|
|
14
|
+
LargeFile?: File;
|
|
15
|
+
IsLargeFile?: boolean;
|
|
14
16
|
}
|
|
15
17
|
export declare enum AttachmentType {
|
|
16
18
|
FILE = 1,
|
|
@@ -33,6 +35,16 @@ export interface AttachmentFieldColumn {
|
|
|
33
35
|
externalTemplate?: TemplateRef<any>;
|
|
34
36
|
position?: number;
|
|
35
37
|
class?: string;
|
|
38
|
+
hidden?: boolean | (() => boolean);
|
|
39
|
+
}
|
|
40
|
+
export interface AttachmentMenuAction {
|
|
41
|
+
key?: string;
|
|
42
|
+
name: string;
|
|
43
|
+
icon: string;
|
|
44
|
+
fn: (attachment: IAttachmentDTO) => void;
|
|
45
|
+
disabled?: (attachment: IAttachmentDTO) => boolean;
|
|
46
|
+
hidden?: (attachment: IAttachmentDTO) => boolean;
|
|
47
|
+
position?: number;
|
|
36
48
|
}
|
|
37
49
|
export declare enum TypeAttachmentColumn {
|
|
38
50
|
DATE = "date",
|