cat-documents-ng 0.2.85 → 0.2.87

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.
@@ -3,6 +3,7 @@ import { FileUpload } from 'primeng/fileupload';
3
3
  import { MessageService } from 'primeng/api';
4
4
  import { PrimeNGConfig } from 'primeng/api';
5
5
  import { FileFormatService } from '../../services/file-format.service';
6
+ import { DocumentService } from '../../state/document.service';
6
7
  import { DocumentUploadService } from '../../services/document-upload.service';
7
8
  import { DocumentUploadBusinessService, UploadedFile } from '../../services/document-upload-business.service';
8
9
  import { DocumentUploadFormService } from '../../services/document-upload-form.service';
@@ -17,7 +18,8 @@ import * as i0 from "@angular/core";
17
18
  * categories, document types, and applicant selection.
18
19
  */
19
20
  export declare class DocumentUploadComponent implements OnDestroy {
20
- private documentUploadService;
21
+ documentUpload: DocumentUploadService;
22
+ uploadService: DocumentService;
21
23
  private config;
22
24
  fileFormatService: FileFormatService;
23
25
  messageService: MessageService;
@@ -79,7 +81,7 @@ export declare class DocumentUploadComponent implements OnDestroy {
79
81
  * @param formService - Service for form validation and handling
80
82
  * @param dataService - Service for data loading operations
81
83
  */
82
- constructor(documentUploadService: DocumentUploadService, config: PrimeNGConfig, fileFormatService: FileFormatService, messageService: MessageService, cdr: ChangeDetectorRef, businessService: DocumentUploadBusinessService, formService: DocumentUploadFormService, dataService: DocumentUploadDataService);
84
+ constructor(documentUpload: DocumentUploadService, uploadService: DocumentService, config: PrimeNGConfig, fileFormatService: FileFormatService, messageService: MessageService, cdr: ChangeDetectorRef, businessService: DocumentUploadBusinessService, formService: DocumentUploadFormService, dataService: DocumentUploadDataService);
83
85
  /**
84
86
  * Handles changes in assignment type selection.
85
87
  * Resets form selections, loads categories, and handles applicant loading.
@@ -102,12 +104,17 @@ export declare class DocumentUploadComponent implements OnDestroy {
102
104
  onApplicantSelectionChange(): void;
103
105
  /**
104
106
  * Handles file selection from the file upload component.
105
- * Processes each selected file for templated upload.
107
+ * Processes each selected file for templated upload sequentially.
106
108
  * @param event - Event containing the selected files
107
109
  */
108
110
  onSelectedFiles(event: {
109
111
  currentFiles: File[];
110
112
  }): Promise<void>;
113
+ /**
114
+ * Processes files sequentially for upload
115
+ * @param files - Array of files to process
116
+ */
117
+ private processFilesSequentially;
111
118
  /**
112
119
  * Loads the list of applicants for the current context.
113
120
  * Sets loading state and handles success/error responses.
@@ -128,12 +135,6 @@ export declare class DocumentUploadComponent implements OnDestroy {
128
135
  * Validates payload and required fields before proceeding with upload.
129
136
  */
130
137
  saveDocumentUpload(): void;
131
- /**
132
- * Handles templated upload for a single file.
133
- * Sets up progress tracking and upload listener for the file.
134
- * @param file - The file to be uploaded
135
- */
136
- handleTemplatedUpload(file: File): Promise<void>;
137
138
  /**
138
139
  * Removes a document from the uploaded files list.
139
140
  * Updates progress tracking and validates form.
@@ -244,6 +245,12 @@ export declare class DocumentUploadComponent implements OnDestroy {
244
245
  * Prepares upload payload and calls business service to save.
245
246
  */
246
247
  saveDocumentMetadata(): void;
248
+ /**
249
+ * Sets up a listener for file upload completion.
250
+ * Updates progress tracking and emits validation change when upload completes.
251
+ * @param file - The file to monitor for upload completion
252
+ */
253
+ setupFileUploadListener(file: File): void;
247
254
  /**
248
255
  * Handles errors during data loading operations.
249
256
  * Resets loading state and can be extended for error logging.
@@ -1,7 +1,7 @@
1
+ import { EventEmitter } from '@angular/core';
1
2
  import { DocumentService } from '../state/document.service';
2
3
  import { DocumentStore } from '../state/document.store';
3
4
  import { MessageService } from 'primeng/api';
4
- import { UploadedFileResponse } from '../models/uploaded-file-response.model';
5
5
  import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Service for handling document uploads.
@@ -12,6 +12,13 @@ export declare class DocumentUploadService {
12
12
  documentService: DocumentService;
13
13
  documentUploadStore: DocumentStore;
14
14
  messageService: MessageService;
15
+ /**
16
+ * Event emitter for upload completion
17
+ */
18
+ uploadCompleted: EventEmitter<{
19
+ file: File;
20
+ response: any;
21
+ }>;
15
22
  /**
16
23
  * The file to upload.
17
24
  * @type {*}
@@ -41,17 +48,43 @@ export declare class DocumentUploadService {
41
48
  */
42
49
  constructor(documentService: DocumentService, documentUploadStore: DocumentStore, messageService: MessageService);
43
50
  /**
44
- * Handle the creation of formdata.
45
- * @returns {*} - The formdata object.
51
+ * Prepares the files for upload by creating a FormData object.
52
+ * This method appends each file to the FormData for submission.
53
+ * @returns {Promise<any>} Promise that resolves when upload completes
54
+ */
55
+ handleTemplatedUpload(file: File, contextId: string): Promise<any>;
56
+ /**
57
+ * Uploads multiple files sequentially using promises
58
+ * @param files - Array of files to upload
59
+ * @param contextId - The context ID for upload
60
+ * @returns {Promise<any[]>} Promise that resolves with all upload responses
61
+ */
62
+ uploadFilesSequentially(files: File[], contextId: string): Promise<any[]>;
63
+ /**
64
+ * Alternative method to upload files sequentially with progress tracking
65
+ * @param files - Array of files to upload
66
+ * @param contextId - The context ID for upload
67
+ * @param onProgress - Optional callback for progress updates
68
+ * @returns {Promise<any[]>} Promise that resolves with all upload responses
69
+ */
70
+ uploadFilesSequentiallyWithProgress(files: File[], contextId: string, onProgress?: (currentFile: File, currentIndex: number, totalFiles: number) => void): Promise<any[]>;
71
+ /**
72
+ * Get the file and contextId
73
+ * @param file - The file to upload.
74
+ * @param contextId - The contextId to upload.
46
75
  */
47
- handleCreateFormData(uploadedFile?: any, contextId?: string): FormData | null;
76
+ getUploadFileData(file: File, contextId: string): void;
48
77
  /**
49
- * Upload a file and return the response.
50
- * @param {File} file - The file to upload
51
- * @param {string} contextId - The context ID for the upload
52
- * @returns {Promise<UploadedFileResponse>} - Promise that resolves with the upload response
78
+ * Get the document name and document type id
79
+ * @param documentName - The document name to upload.
80
+ * @param documentTypeId - The document type id to upload.
81
+ */
82
+ getDocumentNameAndType(documentTypeId: string): void;
83
+ /**
84
+ * Handle the creation of formdata.
85
+ * @returns {*} - The formdata object.
53
86
  */
54
- uploadFile(file: File, contextId: string): Promise<UploadedFileResponse>;
87
+ handleCreateFormData(uploadedFile?: File, contextId?: string): FormData | null;
55
88
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentUploadService, never>;
56
89
  static ɵprov: i0.ɵɵInjectableDeclaration<DocumentUploadService>;
57
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.2.85",
3
+ "version": "0.2.87",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"