@eqproject/eqp-attachments 3.0.4 → 3.1.1
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 +246 -184
- package/esm2022/lib/eqp-attachments.component.mjs +333 -151
- package/esm2022/lib/eqp-attachments.module.mjs +5 -13
- package/esm2022/lib/interfaces/IAttachment.mjs +1 -1
- package/fesm2022/eqproject-eqp-attachments.mjs +338 -164
- package/fesm2022/eqproject-eqp-attachments.mjs.map +1 -1
- package/lib/eqp-attachments.component.d.ts +62 -22
- package/lib/eqp-attachments.module.d.ts +1 -3
- package/lib/interfaces/IAttachment.d.ts +2 -0
- package/package.json +3 -6
|
@@ -3,14 +3,13 @@ import { ChangeDetectorRef, EventEmitter, OnInit, TemplateRef } from "@angular/c
|
|
|
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
|
-
import { ConfigColumn, TooltipPositionType } from "@eqproject/eqp-common";
|
|
7
6
|
import { ImageCroppedEvent, ImageCropperComponent, ImageTransform } from "ngx-image-cropper";
|
|
8
|
-
import { AttachmentType, CropOptionEnum, IAttachmentDTO } from "./interfaces/IAttachment";
|
|
7
|
+
import { AttachmentCardSize, AttachmentType, CropOptionEnum, IAttachmentDTO } from "./interfaces/IAttachment";
|
|
9
8
|
import { IOptions } from "./interfaces/IOptions";
|
|
10
9
|
import { EqpAttachmentService } from "./services/eqp-attachment.service";
|
|
11
|
-
import { EqpTableComponent } from "@eqproject/eqp-table";
|
|
12
10
|
import * as i0 from "@angular/core";
|
|
13
11
|
export declare class EqpAttachmentsComponent implements OnInit {
|
|
12
|
+
#private;
|
|
14
13
|
private dialog;
|
|
15
14
|
private formBuilder;
|
|
16
15
|
private sanitizer;
|
|
@@ -25,14 +24,14 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
25
24
|
* Se TRUE mostra il titolo nell'header nel caso in cui "multipleAttachment" è TRUE ("Elenco allegati" di default).
|
|
26
25
|
*/
|
|
27
26
|
showHeader: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Titolo da visualizzare se il parametro "showHeader" è TRUE. Di devault viene visualizzato "Elenco allegati".
|
|
30
|
-
*/
|
|
31
|
-
headerTitle: string;
|
|
32
27
|
/**
|
|
33
28
|
* Sorgente dati da visualizzare. Nel caso si vuole gestire un singolo allegato va passato in ogni caso come Array.
|
|
34
29
|
*/
|
|
35
30
|
attachmentsList: Array<IAttachmentDTO>;
|
|
31
|
+
/**
|
|
32
|
+
* Nel caso si vuole gestire un solo elemento senza passarlo come array, lo passo come singolo allegato e gestisco nella libreria l'array.
|
|
33
|
+
*/
|
|
34
|
+
singleAttachment: IAttachmentDTO;
|
|
36
35
|
/**
|
|
37
36
|
* Se TRUE non mostra la MatCard (nel caso in cui "multipleAttachment" è TRUE).
|
|
38
37
|
*/
|
|
@@ -47,10 +46,6 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
47
46
|
* SOLO se si gestiscono allegati multipli, quindi se l'input 'multipleAttachment' assume il valore TRUE, altrimenti è sempre disabilitata.
|
|
48
47
|
*/
|
|
49
48
|
loadMultipleFiles: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Configurazione delle colonne della eqp-table per la visualizzazione degli allegati (caso "multipleAttachment" è TRUE).
|
|
52
|
-
*/
|
|
53
|
-
attachmentsColumns: Array<ConfigColumn>;
|
|
54
49
|
/**
|
|
55
50
|
* Imposta il messaggio da visualizzare nel caso in cui la tabella degli allegati (nel caso in cui "multipleAttachment" è TRUE) è vuota.
|
|
56
51
|
*/
|
|
@@ -138,10 +133,13 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
138
133
|
* Classe custom da assegnare al dialog del crop immagini
|
|
139
134
|
*/
|
|
140
135
|
cropDialogClass: string;
|
|
136
|
+
maxFileSizeMB: number;
|
|
137
|
+
cardSize: AttachmentCardSize;
|
|
138
|
+
customCardWidthPx: number;
|
|
139
|
+
customCardHeightPx: number;
|
|
141
140
|
/**
|
|
142
141
|
* Input per definire le label da usare nel componente
|
|
143
142
|
*/
|
|
144
|
-
downloadTooltipPosition: TooltipPositionType;
|
|
145
143
|
openLinkLabel: string;
|
|
146
144
|
addButtonLabel: string;
|
|
147
145
|
downloadLabel: string;
|
|
@@ -155,7 +153,6 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
155
153
|
exitLabel: string;
|
|
156
154
|
uploadWithDropboxLabel: string;
|
|
157
155
|
cropLabel: string;
|
|
158
|
-
eqpTableSearchText: string;
|
|
159
156
|
deleteDialogTitle: string;
|
|
160
157
|
deleteDialogMessage: string;
|
|
161
158
|
noImageSelectedErrorMessage: string;
|
|
@@ -166,6 +163,20 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
166
163
|
flipVerticalLabel: string;
|
|
167
164
|
rotateRightLabel: string;
|
|
168
165
|
rotateLeftLabel: string;
|
|
166
|
+
uploadTitle: string;
|
|
167
|
+
uploadSubtitle: string;
|
|
168
|
+
dropHereLabel: string;
|
|
169
|
+
supportedFormatsLabel: string;
|
|
170
|
+
browseFilesLabel: string;
|
|
171
|
+
uploadSummaryLabel: string;
|
|
172
|
+
filesLabel: string;
|
|
173
|
+
totalSizeLabel: string;
|
|
174
|
+
emptyStateLabel: string;
|
|
175
|
+
addedSuccessfullyLabel: string;
|
|
176
|
+
removedLabel: string;
|
|
177
|
+
chooseView: boolean;
|
|
178
|
+
showSummary: boolean;
|
|
179
|
+
viewMode: 'card' | 'table';
|
|
169
180
|
/**
|
|
170
181
|
* Restituisce la lista aggiornata degli allegati.
|
|
171
182
|
*/
|
|
@@ -194,6 +205,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
194
205
|
dialogAddMultipleAttachment: TemplateRef<any>;
|
|
195
206
|
dialogRefCropImage: MatDialogRef<TemplateRef<any>>;
|
|
196
207
|
dialogCropImage: TemplateRef<any>;
|
|
208
|
+
addingLinkTemplate: TemplateRef<any>;
|
|
197
209
|
imageChangedEvent: any;
|
|
198
210
|
croppedImage: any;
|
|
199
211
|
transform: ImageTransform;
|
|
@@ -206,19 +218,29 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
206
218
|
originalHeight: number;
|
|
207
219
|
customWidth: number;
|
|
208
220
|
customHeight: number;
|
|
209
|
-
attachmentTable: EqpTableComponent;
|
|
210
221
|
inlinePreviewTemplate: TemplateRef<any>;
|
|
211
222
|
dialogPreview: TemplateRef<any>;
|
|
212
223
|
imageFile: File;
|
|
213
224
|
addingLinkMode: boolean;
|
|
225
|
+
dragOver: boolean;
|
|
226
|
+
toast: {
|
|
227
|
+
visible: boolean;
|
|
228
|
+
type: "error" | "success";
|
|
229
|
+
text: string;
|
|
230
|
+
timeoutId: any;
|
|
231
|
+
};
|
|
232
|
+
progressPercent: number;
|
|
233
|
+
totalSizeBytes: number;
|
|
234
|
+
get totalSizeFormatted(): string;
|
|
235
|
+
formatFileSize(bytes: number): string;
|
|
236
|
+
showToast(message: string, type?: 'success' | 'error', durationMs?: number): void;
|
|
214
237
|
constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient, cd: ChangeDetectorRef, eqpAttachmentService: EqpAttachmentService);
|
|
215
|
-
ngOnInit():
|
|
216
|
-
|
|
238
|
+
ngOnInit(): void;
|
|
239
|
+
setViewMode(mode: 'card' | 'table'): void;
|
|
240
|
+
private recomputeTotalsAndProgress;
|
|
241
|
+
ngOnDestroy(): void;
|
|
242
|
+
bytesFromBase64(base64: string): number;
|
|
217
243
|
checkAttachmentImage(): void;
|
|
218
|
-
/**
|
|
219
|
-
* Configura le colonne per l'eqp-table nel caso in cui il parametro "multipleAttachments" è TRUE.
|
|
220
|
-
*/
|
|
221
|
-
configureColumns(): void;
|
|
222
244
|
/**
|
|
223
245
|
* Elimina un allegato eliminando anche il file presente nello storage di archiviazione utilizzato (AWS o cartella progetto)
|
|
224
246
|
* @param element IAttachmentDTO da cancellare
|
|
@@ -229,6 +251,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
229
251
|
* @param attachmentIndex Indice dell'attachment da rimuovere
|
|
230
252
|
*/
|
|
231
253
|
removeAttachmentFromList(attachmentIndex: number): void;
|
|
254
|
+
private simulateProgress;
|
|
232
255
|
/**
|
|
233
256
|
* Scarica l'allegato o apre il link
|
|
234
257
|
* @param element Allegato da mostrare
|
|
@@ -269,6 +292,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
269
292
|
* immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
|
|
270
293
|
*/
|
|
271
294
|
onFileAdded(event: any, isFileDropped?: boolean): Promise<void>;
|
|
295
|
+
private validationFile;
|
|
272
296
|
/**
|
|
273
297
|
* A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
|
|
274
298
|
* Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
|
|
@@ -310,10 +334,26 @@ export declare class EqpAttachmentsComponent implements OnInit {
|
|
|
310
334
|
* Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO
|
|
311
335
|
*/
|
|
312
336
|
abortFile(): void;
|
|
313
|
-
fileDropped(
|
|
337
|
+
fileDropped(event: DragEvent): void;
|
|
314
338
|
chooseDropboxFile(): void;
|
|
315
339
|
onSelectFile(event: any, fileInput: any): void;
|
|
340
|
+
/**
|
|
341
|
+
* Apre il dialogo per l'inserimento del link.
|
|
342
|
+
*/
|
|
316
343
|
switchToAddingLinkMode(): void;
|
|
344
|
+
getCardClass(att: IAttachmentDTO): {
|
|
345
|
+
[key: string]: boolean;
|
|
346
|
+
};
|
|
347
|
+
getPreviewsContainerStyle(): {
|
|
348
|
+
[key: string]: string;
|
|
349
|
+
};
|
|
350
|
+
handlePrimaryAction(attachment: IAttachmentDTO): void;
|
|
351
|
+
/**
|
|
352
|
+
* Determines if an attachment can be previewed in the dialog.
|
|
353
|
+
* @param att The attachment to check.
|
|
354
|
+
* @returns `true` if a preview is available, otherwise `false`.
|
|
355
|
+
*/
|
|
356
|
+
canBePreviewed(att: IAttachmentDTO): boolean;
|
|
317
357
|
static ɵfac: i0.ɵɵFactoryDeclaration<EqpAttachmentsComponent, never>;
|
|
318
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<EqpAttachmentsComponent, "eqp-attachments", never, { "disableAction": { "alias": "disableAction"; "required": false; }; "showHeader": { "alias": "showHeader"; "required": false; }; "
|
|
358
|
+
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; }; "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; }; }, { "localEditedAttachments": "localEditedAttachments"; "abortAddAttachment": "abortAddAttachment"; "downloadAttachment": "downloadAttachment"; "onDeleteAttachment": "onDeleteAttachment"; }, never, never, false, never>;
|
|
319
359
|
}
|
|
@@ -4,10 +4,8 @@ import * as i2 from "./modules/material.module";
|
|
|
4
4
|
import * as i3 from "@angular/forms";
|
|
5
5
|
import * as i4 from "@angular/common";
|
|
6
6
|
import * as i5 from "ngx-image-cropper";
|
|
7
|
-
import * as i6 from "@eqproject/eqp-table";
|
|
8
|
-
import * as i7 from "ngx-file-drop";
|
|
9
7
|
export declare class EqpAttachmentsModule {
|
|
10
8
|
static ɵfac: i0.ɵɵFactoryDeclaration<EqpAttachmentsModule, never>;
|
|
11
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<EqpAttachmentsModule, [typeof i1.EqpAttachmentsComponent], [typeof i2.MaterialModule, typeof i3.FormsModule, typeof i4.CommonModule, typeof i3.ReactiveFormsModule, typeof i5.
|
|
9
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<EqpAttachmentsModule, [typeof i1.EqpAttachmentsComponent], [typeof i2.MaterialModule, typeof i3.FormsModule, typeof i4.CommonModule, typeof i3.ReactiveFormsModule, typeof i5.ImageCropperComponent], [typeof i1.EqpAttachmentsComponent]>;
|
|
12
10
|
static ɵinj: i0.ɵɵInjectorDeclaration<EqpAttachmentsModule>;
|
|
13
11
|
}
|
|
@@ -9,6 +9,7 @@ export interface IAttachmentDTO {
|
|
|
9
9
|
IsImage?: boolean;
|
|
10
10
|
FileThumbnailBase64?: string;
|
|
11
11
|
TrustedUrl?: any;
|
|
12
|
+
isUploading?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare enum AttachmentType {
|
|
14
15
|
FILE = 1,
|
|
@@ -19,3 +20,4 @@ export declare enum CropOptionEnum {
|
|
|
19
20
|
ROTATE = 1,
|
|
20
21
|
FLIP = 2
|
|
21
22
|
}
|
|
23
|
+
export type AttachmentCardSize = 'small' | 'medium' | 'large' | 'custom';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eqproject/eqp-attachments",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Dynamic attachments component - Angular Material based",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "EqProject"
|
|
@@ -8,14 +8,11 @@
|
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"@angular/cdk": "^17.0.1",
|
|
10
10
|
"@angular/common": "^17.0.4",
|
|
11
|
-
"@angular/core": "^17.0.4"
|
|
12
|
-
"@eqproject/eqp-common": "latest"
|
|
11
|
+
"@angular/core": "^17.0.4"
|
|
13
12
|
},
|
|
14
13
|
"dependencies": {
|
|
15
|
-
"@eqproject/eqp-table": "latest",
|
|
16
14
|
"browser-image-compression": "^2.0.2",
|
|
17
|
-
"ngx-
|
|
18
|
-
"ngx-image-cropper": "^7.1.2",
|
|
15
|
+
"ngx-image-cropper": "^9.1.5",
|
|
19
16
|
"sweetalert2": "^11.10.1",
|
|
20
17
|
"tslib": "^2.6.2"
|
|
21
18
|
},
|