@eqproject/eqp-attachments 2.0.2 → 2.0.3

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,12 +1,14 @@
1
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
- import { AttachmentType, IAttachmentDTO } from './interfaces/IAttachment';
4
+ import { AttachmentType, CropOptionEnum, IAttachmentDTO } from './interfaces/IAttachment';
5
5
  import { ConfigColumn, EqpTableComponent, TooltipPositionType } from '@eqproject/eqp-table';
6
6
  import { MatDialog, MatDialogRef } from '@angular/material/dialog';
7
7
  import { DomSanitizer } from '@angular/platform-browser';
8
8
  import { HttpClient } from '@angular/common/http';
9
9
  import { IOptions } from './interfaces/IOptions';
10
+ import { ScriptService } from 'ngx-script-loader';
11
+ import { EqpAttachmentService } from './services/eqp-attachment.service';
10
12
  import * as i0 from "@angular/core";
11
13
  export declare class EqpAttachmentsComponent implements OnInit {
12
14
  private dialog;
@@ -14,6 +16,8 @@ export declare class EqpAttachmentsComponent implements OnInit {
14
16
  private sanitizer;
15
17
  private http;
16
18
  private cd;
19
+ private eqpAttachmentService;
20
+ private scriptLoaderService;
17
21
  /**
18
22
  * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso "multipleAttachment" è TRUE).
19
23
  */
@@ -102,11 +106,35 @@ export declare class EqpAttachmentsComponent implements OnInit {
102
106
  * degli allegati deve essere paginata oppure no
103
107
  */
104
108
  tablePaginatorVisible: boolean;
109
+ /**
110
+ * Permette di stabilire, in caso di gestione allegati multipli, se la tabella contenente l'elenco
111
+ * degli allegati deve contenere il campo di ricerca oppure no
112
+ */
113
+ isTableSearcheable: boolean;
105
114
  /**
106
115
  * In caso di gestione allegati multipli, permette di stabilire la dimensione pagina di default
107
116
  * per la tabella contenente l'elenco degli allegati
108
117
  */
109
118
  tablePaginatorSize: number;
119
+ /**
120
+ * Permette di scegliere il modo in cui i file devono essere caricati
121
+ */
122
+ /**
123
+ * Permette di stabilire se i pulsanti per il caricamento dei file sono separati o in un menù a tendina
124
+ */
125
+ separatedUploadButtons: boolean;
126
+ /**
127
+ * Permette di scegliere se dare la possibilità di vedere o no l'anteprima
128
+ */
129
+ showPreview: boolean;
130
+ /**
131
+ * In caso di allegato singolo, permette di scegliere se aggiungere file tramite drag and drop
132
+ */
133
+ singleAttachmentDragAndDrop: boolean;
134
+ /**
135
+ * Array di opzioni che si possono utilizzare per il crop
136
+ */
137
+ cropOptions: Array<CropOptionEnum>;
110
138
  /**
111
139
  * Input per definire le label da usare nel componente
112
140
  */
@@ -122,6 +150,8 @@ export declare class EqpAttachmentsComponent implements OnInit {
122
150
  abortLabel: string;
123
151
  saveLabel: string;
124
152
  exitLabel: string;
153
+ uploadWithDropboxLabel: string;
154
+ cropLabel: string;
125
155
  eqpTableSearchText: string;
126
156
  deleteDialogTitle: string;
127
157
  deleteDialogMessage: string;
@@ -129,6 +159,10 @@ export declare class EqpAttachmentsComponent implements OnInit {
129
159
  wrongTypeSelectedErrorMessage: string;
130
160
  videoPreviewErrorMessage: string;
131
161
  audioPreviewErrorMessage: string;
162
+ flipHorinzontalLabel: string;
163
+ flipVerticalLabel: string;
164
+ rotateRightLabel: string;
165
+ rotateLeftLabel: string;
132
166
  /**
133
167
  * Restituisce la lista aggiornata degli allegati.
134
168
  */
@@ -147,17 +181,20 @@ export declare class EqpAttachmentsComponent implements OnInit {
147
181
  onDeleteAttachment: EventEmitter<IAttachmentDTO>;
148
182
  newAttachment: IAttachmentDTO;
149
183
  newMultipleAttachments: Array<IAttachmentDTO>;
150
- dialofRefAddAttachment: MatDialogRef<TemplateRef<any>>;
151
184
  attachmentType: typeof AttachmentType;
152
185
  newAttachmentForm: FormGroup;
153
186
  selectedFile: File;
154
187
  selectedFiles: Array<File>;
155
188
  showCropImage: boolean;
156
189
  dialogAddAttachment: TemplateRef<any>;
190
+ dialogRefAddAttachment: MatDialogRef<TemplateRef<any>>;
157
191
  dialogAddMultipleAttachment: TemplateRef<any>;
192
+ dialogRefCropImage: MatDialogRef<TemplateRef<any>>;
193
+ dialogCropImage: TemplateRef<any>;
158
194
  imageChangedEvent: any;
159
195
  croppedImage: any;
160
196
  transform: ImageTransform;
197
+ canvasRotation: number;
161
198
  imageCropper: ImageCropperComponent;
162
199
  imageInput: any;
163
200
  AttachmentType: typeof AttachmentType;
@@ -169,8 +206,10 @@ export declare class EqpAttachmentsComponent implements OnInit {
169
206
  attachmentTable: EqpTableComponent;
170
207
  inlinePreviewTemplate: TemplateRef<any>;
171
208
  dialogPreview: TemplateRef<any>;
172
- constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient, cd: ChangeDetectorRef);
173
- ngOnInit(): void;
209
+ imageFile: File;
210
+ addingLinkMode: boolean;
211
+ constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient, cd: ChangeDetectorRef, eqpAttachmentService: EqpAttachmentService, scriptLoaderService: ScriptService);
212
+ ngOnInit(): Promise<void>;
174
213
  reloadData(): void;
175
214
  checkAttachmentImage(): void;
176
215
  /**
@@ -199,9 +238,9 @@ export declare class EqpAttachmentsComponent implements OnInit {
199
238
  */
200
239
  getAttachmentIcon(attachment: IAttachmentDTO): string;
201
240
  /**
202
- * Apre la modale per la definizione dei parametri del nuovo file
241
+ * In caso di allegato singolo, sceglie quale metodo richiamare in base al tipo di allegato
203
242
  */
204
- openModalAddAttachment(attachmentType: AttachmentType): void;
243
+ addFile(attachmentType: AttachmentType, imageInput?: any): void;
205
244
  createAttachmentForm(): void;
206
245
  close(emitCloseEvent?: boolean): void;
207
246
  /**
@@ -210,7 +249,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
210
249
  * @returns
211
250
  */
212
251
  disableSave(): boolean;
213
- confirmAddAttachment(): void;
252
+ confirmAddAttachment(multipleAttachments?: boolean): void;
214
253
  /**
215
254
  * Apre il dialog per l'anteprima dell'allegato selezionato.
216
255
  * @param row
@@ -226,7 +265,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
226
265
  * Se invece il caricamento dei file è MULTIPLO e sono presenti più file allora esegue le stesse operazioni ignorando però il contrllo
227
266
  * immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
228
267
  */
229
- onFileInputChange(event: any): Promise<void>;
268
+ onFileAdded(event: any, isFileDropped?: boolean): Promise<void>;
230
269
  /**
231
270
  * A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
232
271
  * Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
@@ -258,12 +297,21 @@ export declare class EqpAttachmentsComponent implements OnInit {
258
297
  restoreOriginalDimensions(): void;
259
298
  onDimensionsChange(dimension: string): void;
260
299
  imageCropped(event: ImageCroppedEvent): void;
261
- getCroppedAndUpload(file: any): void;
300
+ getCroppedAndUpload(file: any, newAttachment: IAttachmentDTO): void;
262
301
  confirmCrop(): void;
302
+ rotateLeft(): void;
303
+ rotateRight(): void;
304
+ private flipAfterRotate;
305
+ flipHorizontal(): void;
306
+ flipVertical(): void;
263
307
  /**
264
308
  * Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO
265
309
  */
266
310
  abortFile(): void;
311
+ fileDropped(files: any): void;
312
+ chooseDropboxFile(): void;
313
+ onSelectFile(event: any, fileInput: any): void;
314
+ switchToAddingLinkMode(): void;
267
315
  static ɵfac: i0.ɵɵFactoryDeclaration<EqpAttachmentsComponent, never>;
268
- static ɵcmp: i0.ɵɵComponentDeclaration<EqpAttachmentsComponent, "eqp-attachments", never, { "disableAction": "disableAction"; "showHeader": "showHeader"; "headerTitle": "headerTitle"; "attachmentsList": "attachmentsList"; "showMatCard": "showMatCard"; "multipleAttachment": "multipleAttachment"; "loadMultipleFiles": "loadMultipleFiles"; "attachmentsColumns": "attachmentsColumns"; "emptyTableMessage": "emptyTableMessage"; "allowOnlyImages": "allowOnlyImages"; "acceptedFileTypes": "acceptedFileTypes"; "isDisabled": "isDisabled"; "showInlinePreview": "showInlinePreview"; "getAttachmentEndpoint": "getAttachmentEndpoint"; "productionBaseUrl": "productionBaseUrl"; "compressionOptions": "compressionOptions"; "allowedTypes": "allowedTypes"; "isEqpTableMultiLanguage": "isEqpTableMultiLanguage"; "tablePaginatorVisible": "tablePaginatorVisible"; "tablePaginatorSize": "tablePaginatorSize"; "downloadTooltipPosition": "downloadTooltipPosition"; "openLinkLabel": "openLinkLabel"; "addButtonLabel": "addButtonLabel"; "downloadLabel": "downloadLabel"; "deleteLabel": "deleteLabel"; "fileNameLabel": "fileNameLabel"; "previewLabel": "previewLabel"; "uploadFileLabel": "uploadFileLabel"; "confirmLabel": "confirmLabel"; "abortLabel": "abortLabel"; "saveLabel": "saveLabel"; "exitLabel": "exitLabel"; "eqpTableSearchText": "eqpTableSearchText"; "deleteDialogTitle": "deleteDialogTitle"; "deleteDialogMessage": "deleteDialogMessage"; "noImageSelectedErrorMessage": "noImageSelectedErrorMessage"; "wrongTypeSelectedErrorMessage": "wrongTypeSelectedErrorMessage"; "videoPreviewErrorMessage": "videoPreviewErrorMessage"; "audioPreviewErrorMessage": "videoPreviewErrorMessage"; }, { "localEditedAttachments": "localEditedAttachments"; "abortAddAttachment": "abortAddAttachment"; "downloadAttachment": "downloadAttachment"; "onDeleteAttachment": "onDeleteAttachment"; }, never, never, false, never>;
316
+ static ɵcmp: i0.ɵɵComponentDeclaration<EqpAttachmentsComponent, "eqp-attachments", never, { "disableAction": "disableAction"; "showHeader": "showHeader"; "headerTitle": "headerTitle"; "attachmentsList": "attachmentsList"; "showMatCard": "showMatCard"; "multipleAttachment": "multipleAttachment"; "loadMultipleFiles": "loadMultipleFiles"; "attachmentsColumns": "attachmentsColumns"; "emptyTableMessage": "emptyTableMessage"; "allowOnlyImages": "allowOnlyImages"; "acceptedFileTypes": "acceptedFileTypes"; "isDisabled": "isDisabled"; "showInlinePreview": "showInlinePreview"; "getAttachmentEndpoint": "getAttachmentEndpoint"; "productionBaseUrl": "productionBaseUrl"; "compressionOptions": "compressionOptions"; "allowedTypes": "allowedTypes"; "isEqpTableMultiLanguage": "isEqpTableMultiLanguage"; "tablePaginatorVisible": "tablePaginatorVisible"; "isTableSearcheable": "isTableSearcheable"; "tablePaginatorSize": "tablePaginatorSize"; "separatedUploadButtons": "separatedUploadButtons"; "showPreview": "showPreview"; "singleAttachmentDragAndDrop": "singleAttachmentDragAndDrop"; "cropOptions": "cropOptions"; "downloadTooltipPosition": "downloadTooltipPosition"; "openLinkLabel": "openLinkLabel"; "addButtonLabel": "addButtonLabel"; "downloadLabel": "downloadLabel"; "deleteLabel": "deleteLabel"; "fileNameLabel": "fileNameLabel"; "previewLabel": "previewLabel"; "uploadFileLabel": "uploadFileLabel"; "confirmLabel": "confirmLabel"; "abortLabel": "abortLabel"; "saveLabel": "saveLabel"; "exitLabel": "exitLabel"; "uploadWithDropboxLabel": "uploadWithDropboxLabel"; "cropLabel": "cropLabel"; "eqpTableSearchText": "eqpTableSearchText"; "deleteDialogTitle": "deleteDialogTitle"; "deleteDialogMessage": "deleteDialogMessage"; "noImageSelectedErrorMessage": "noImageSelectedErrorMessage"; "wrongTypeSelectedErrorMessage": "wrongTypeSelectedErrorMessage"; "videoPreviewErrorMessage": "videoPreviewErrorMessage"; "audioPreviewErrorMessage": "videoPreviewErrorMessage"; "flipHorinzontalLabel": "flipHorinzontalLabel"; "flipVerticalLabel": "flipVerticalLabel"; "rotateRightLabel": "rotateRightLabel"; "rotateLeftLabel": "rotateLeftLabel"; }, { "localEditedAttachments": "localEditedAttachments"; "abortAddAttachment": "abortAddAttachment"; "downloadAttachment": "downloadAttachment"; "onDeleteAttachment": "onDeleteAttachment"; }, never, never, false, never>;
269
317
  }
@@ -5,8 +5,9 @@ import * as i3 from "@angular/forms";
5
5
  import * as i4 from "@angular/common";
6
6
  import * as i5 from "ngx-image-cropper";
7
7
  import * as i6 from "@eqproject/eqp-table";
8
+ import * as i7 from "ngx-file-drop";
8
9
  export declare class EqpAttachmentsModule {
9
10
  static ɵfac: i0.ɵɵFactoryDeclaration<EqpAttachmentsModule, never>;
10
- static ɵmod: i0.ɵɵNgModuleDeclaration<EqpAttachmentsModule, [typeof i1.EqpAttachmentsComponent], [typeof i2.MaterialModule, typeof i3.FormsModule, typeof i4.CommonModule, typeof i3.ReactiveFormsModule, typeof i5.ImageCropperModule, typeof i6.EqpTableModule], [typeof i1.EqpAttachmentsComponent]>;
11
+ static ɵmod: i0.ɵɵNgModuleDeclaration<EqpAttachmentsModule, [typeof i1.EqpAttachmentsComponent], [typeof i2.MaterialModule, typeof i3.FormsModule, typeof i4.CommonModule, typeof i3.ReactiveFormsModule, typeof i5.ImageCropperModule, typeof i6.EqpTableModule, typeof i7.NgxFileDropModule], [typeof i1.EqpAttachmentsComponent]>;
11
12
  static ɵinj: i0.ɵɵInjectorDeclaration<EqpAttachmentsModule>;
12
13
  }
@@ -2,6 +2,7 @@ import * as i0 from "@angular/core";
2
2
  export declare class AttachmentHelperService {
3
3
  static readonly imageMimeTypes: string[];
4
4
  static readonly fileExtensionIcon: any;
5
+ static readonly dropboxCredentials: any;
5
6
  constructor();
6
7
  /**
7
8
  * Restituisce TRUE se il mime type passato nel parametro corrisponde ad un mime type di un'immagine
@@ -12,5 +12,10 @@ export interface IAttachmentDTO {
12
12
  }
13
13
  export declare enum AttachmentType {
14
14
  FILE = 1,
15
- LINK = 2
15
+ LINK = 2,
16
+ DROPBOX = 3
17
+ }
18
+ export declare enum CropOptionEnum {
19
+ ROTATE = 1,
20
+ FLIP = 2
16
21
  }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class EqpAttachmentService {
3
+ constructor();
4
+ loadDropboxScript(): void;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<EqpAttachmentService, never>;
6
+ static ɵprov: i0.ɵɵInjectableDeclaration<EqpAttachmentService>;
7
+ }
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@eqproject/eqp-attachments",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Dynamic attachments component - Angular Material based",
5
5
  "author": {
6
6
  "name": "EqProject"
7
7
  },
8
8
  "bundledDependencies": [],
9
9
  "peerDependencies": {
10
+ "@angular/cdk": "^15.1.2",
10
11
  "@angular/common": "^15.1.2",
11
- "@angular/core": "^15.1.2",
12
- "@angular/cdk": "^15.1.2"
12
+ "@angular/core": "^15.1.2"
13
13
  },
14
14
  "dependencies": {
15
15
  "@eqproject/eqp-table": "latest",
16
16
  "browser-image-compression": "^2.0.0",
17
+ "ngx-file-drop": "^15.0.0",
17
18
  "ngx-image-cropper": "^6.3.2",
18
19
  "sweetalert2": "^11.7.1",
19
20
  "tslib": "^2.4.0"