@eqproject/eqp-attachments 2.0.2 → 2.0.4

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,13 @@
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 { EqpAttachmentService } from './services/eqp-attachment.service';
10
11
  import * as i0 from "@angular/core";
11
12
  export declare class EqpAttachmentsComponent implements OnInit {
12
13
  private dialog;
@@ -14,6 +15,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
14
15
  private sanitizer;
15
16
  private http;
16
17
  private cd;
18
+ private eqpAttachmentService;
17
19
  /**
18
20
  * Se TRUE allora nasconde la colonna per le azioni sull'allegato (nel caso "multipleAttachment" è TRUE).
19
21
  */
@@ -102,11 +104,35 @@ export declare class EqpAttachmentsComponent implements OnInit {
102
104
  * degli allegati deve essere paginata oppure no
103
105
  */
104
106
  tablePaginatorVisible: boolean;
107
+ /**
108
+ * Permette di stabilire, in caso di gestione allegati multipli, se la tabella contenente l'elenco
109
+ * degli allegati deve contenere il campo di ricerca oppure no
110
+ */
111
+ isTableSearcheable: boolean;
105
112
  /**
106
113
  * In caso di gestione allegati multipli, permette di stabilire la dimensione pagina di default
107
114
  * per la tabella contenente l'elenco degli allegati
108
115
  */
109
116
  tablePaginatorSize: number;
117
+ /**
118
+ * Permette di scegliere il modo in cui i file devono essere caricati
119
+ */
120
+ /**
121
+ * Permette di stabilire se i pulsanti per il caricamento dei file sono separati o in un menù a tendina
122
+ */
123
+ separatedUploadButtons: boolean;
124
+ /**
125
+ * Permette di scegliere se dare la possibilità di vedere o no l'anteprima
126
+ */
127
+ showPreview: boolean;
128
+ /**
129
+ * In caso di allegato singolo, permette di scegliere se aggiungere file tramite drag and drop
130
+ */
131
+ singleAttachmentDragAndDrop: boolean;
132
+ /**
133
+ * Array di opzioni che si possono utilizzare per il crop
134
+ */
135
+ cropOptions: Array<CropOptionEnum>;
110
136
  /**
111
137
  * Input per definire le label da usare nel componente
112
138
  */
@@ -122,6 +148,8 @@ export declare class EqpAttachmentsComponent implements OnInit {
122
148
  abortLabel: string;
123
149
  saveLabel: string;
124
150
  exitLabel: string;
151
+ uploadWithDropboxLabel: string;
152
+ cropLabel: string;
125
153
  eqpTableSearchText: string;
126
154
  deleteDialogTitle: string;
127
155
  deleteDialogMessage: string;
@@ -129,6 +157,10 @@ export declare class EqpAttachmentsComponent implements OnInit {
129
157
  wrongTypeSelectedErrorMessage: string;
130
158
  videoPreviewErrorMessage: string;
131
159
  audioPreviewErrorMessage: string;
160
+ flipHorinzontalLabel: string;
161
+ flipVerticalLabel: string;
162
+ rotateRightLabel: string;
163
+ rotateLeftLabel: string;
132
164
  /**
133
165
  * Restituisce la lista aggiornata degli allegati.
134
166
  */
@@ -147,17 +179,20 @@ export declare class EqpAttachmentsComponent implements OnInit {
147
179
  onDeleteAttachment: EventEmitter<IAttachmentDTO>;
148
180
  newAttachment: IAttachmentDTO;
149
181
  newMultipleAttachments: Array<IAttachmentDTO>;
150
- dialofRefAddAttachment: MatDialogRef<TemplateRef<any>>;
151
182
  attachmentType: typeof AttachmentType;
152
183
  newAttachmentForm: FormGroup;
153
184
  selectedFile: File;
154
185
  selectedFiles: Array<File>;
155
186
  showCropImage: boolean;
156
187
  dialogAddAttachment: TemplateRef<any>;
188
+ dialogRefAddAttachment: MatDialogRef<TemplateRef<any>>;
157
189
  dialogAddMultipleAttachment: TemplateRef<any>;
190
+ dialogRefCropImage: MatDialogRef<TemplateRef<any>>;
191
+ dialogCropImage: TemplateRef<any>;
158
192
  imageChangedEvent: any;
159
193
  croppedImage: any;
160
194
  transform: ImageTransform;
195
+ canvasRotation: number;
161
196
  imageCropper: ImageCropperComponent;
162
197
  imageInput: any;
163
198
  AttachmentType: typeof AttachmentType;
@@ -169,8 +204,10 @@ export declare class EqpAttachmentsComponent implements OnInit {
169
204
  attachmentTable: EqpTableComponent;
170
205
  inlinePreviewTemplate: TemplateRef<any>;
171
206
  dialogPreview: TemplateRef<any>;
172
- constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient, cd: ChangeDetectorRef);
173
- ngOnInit(): void;
207
+ imageFile: File;
208
+ addingLinkMode: boolean;
209
+ constructor(dialog: MatDialog, formBuilder: FormBuilder, sanitizer: DomSanitizer, http: HttpClient, cd: ChangeDetectorRef, eqpAttachmentService: EqpAttachmentService);
210
+ ngOnInit(): Promise<void>;
174
211
  reloadData(): void;
175
212
  checkAttachmentImage(): void;
176
213
  /**
@@ -199,9 +236,9 @@ export declare class EqpAttachmentsComponent implements OnInit {
199
236
  */
200
237
  getAttachmentIcon(attachment: IAttachmentDTO): string;
201
238
  /**
202
- * Apre la modale per la definizione dei parametri del nuovo file
239
+ * In caso di allegato singolo, sceglie quale metodo richiamare in base al tipo di allegato
203
240
  */
204
- openModalAddAttachment(attachmentType: AttachmentType): void;
241
+ addFile(attachmentType: AttachmentType, imageInput?: any): void;
205
242
  createAttachmentForm(): void;
206
243
  close(emitCloseEvent?: boolean): void;
207
244
  /**
@@ -210,7 +247,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
210
247
  * @returns
211
248
  */
212
249
  disableSave(): boolean;
213
- confirmAddAttachment(): void;
250
+ confirmAddAttachment(multipleAttachments?: boolean): void;
214
251
  /**
215
252
  * Apre il dialog per l'anteprima dell'allegato selezionato.
216
253
  * @param row
@@ -226,7 +263,7 @@ export declare class EqpAttachmentsComponent implements OnInit {
226
263
  * Se invece il caricamento dei file è MULTIPLO e sono presenti più file allora esegue le stesse operazioni ignorando però il contrllo
227
264
  * immagine per il croppie (in caso di caricamento multiplo le funzionalità del croppie sono disabilitate).
228
265
  */
229
- onFileInputChange(event: any): Promise<void>;
266
+ onFileAdded(event: any, isFileDropped?: boolean): Promise<void>;
230
267
  /**
231
268
  * A partire dal FILE ricevuto in input ricostruisce l'oggetto IAttachmentDTO e lo restituisce.
232
269
  * Se il parametro getBase64 viene passato a TRUE allora, sempre a partire dal file,genera il base64 e
@@ -258,12 +295,21 @@ export declare class EqpAttachmentsComponent implements OnInit {
258
295
  restoreOriginalDimensions(): void;
259
296
  onDimensionsChange(dimension: string): void;
260
297
  imageCropped(event: ImageCroppedEvent): void;
261
- getCroppedAndUpload(file: any): void;
298
+ getCroppedAndUpload(file: any, newAttachment: IAttachmentDTO): void;
262
299
  confirmCrop(): void;
300
+ rotateLeft(): void;
301
+ rotateRight(): void;
302
+ private flipAfterRotate;
303
+ flipHorizontal(): void;
304
+ flipVertical(): void;
263
305
  /**
264
306
  * Annulla la selezione del file, svuotando l'input e resettando tutte le proprietà dell'IAttachmentDTO
265
307
  */
266
308
  abortFile(): void;
309
+ fileDropped(files: any): void;
310
+ chooseDropboxFile(): void;
311
+ onSelectFile(event: any, fileInput: any): void;
312
+ switchToAddingLinkMode(): void;
267
313
  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>;
314
+ 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
315
  }
@@ -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.4",
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"