cat-documents-ng 0.2.84 → 0.2.86

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.
@@ -31,10 +31,6 @@ export declare class DocumentSearchComponent implements OnInit, OnDestroy {
31
31
  * Clears the search input
32
32
  */
33
33
  onClearSearch(): void;
34
- /**
35
- * Clears all filters including search, menu item, user, and status selections
36
- */
37
- onClearAllFilters(): void;
38
34
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentSearchComponent, never>;
39
35
  static ɵcmp: i0.ɵɵComponentDeclaration<DocumentSearchComponent, "document-search", never, { "contextId": { "alias": "contextId"; "required": false; }; }, { "onActionClick": "onActionClick"; }, never, never, false, never>;
40
36
  }
@@ -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 all selected files in parallel 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,11 +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
- * @param file - The file to be uploaded
134
- */
135
- handleTemplatedUpload(file: File): Promise<void>;
136
138
  /**
137
139
  * Removes a document from the uploaded files list.
138
140
  * Updates progress tracking and validates form.
@@ -243,6 +245,12 @@ export declare class DocumentUploadComponent implements OnDestroy {
243
245
  * Prepares upload payload and calls business service to save.
244
246
  */
245
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;
246
254
  /**
247
255
  * Handles errors during data loading operations.
248
256
  * Resets loading state and can be extended for error logging.
@@ -4,17 +4,14 @@ import { FileFormatService } from './file-format.service';
4
4
  import { UserListModel } from '../models/user-list.model';
5
5
  import { DocumentCategory } from '../models/document-category.model';
6
6
  import { DocumentTypeModel } from '../models/document-type.model';
7
- import { UploadedFileResponse } from '../models/uploaded-file-response.model';
8
7
  import * as i0 from "@angular/core";
9
8
  export interface UploadedFile {
10
9
  file: File;
11
- formattedSize?: string;
12
- progress?: number;
13
- uploadResponse?: UploadedFileResponse;
10
+ formattedSize: string;
11
+ progress: number;
12
+ uploadResponse?: any;
14
13
  url?: string;
15
14
  contentType?: string;
16
- fileName?: string;
17
- size?: string;
18
15
  }
19
16
  export interface DocumentUploadPayload {
20
17
  source: 'Applicant' | 'Application';
@@ -28,7 +25,6 @@ export interface DocumentUploadPayload {
28
25
  uploadedFileId?: string;
29
26
  url?: string;
30
27
  contentType?: string;
31
- size?: string;
32
28
  }[];
33
29
  }
34
30
  export declare class DocumentUploadBusinessService {
@@ -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
  }
@@ -46,11 +46,6 @@ export declare class DocumentQuery extends QueryEntity<DocumentState> {
46
46
  * @returns {Observable<DocumentCategory[]>} Observable that emits the document categories.
47
47
  */
48
48
  selectDocumentCategories(): Observable<DocumentCategory[]>;
49
- /**
50
- * Gets the current document categories value (synchronous).
51
- * @returns {DocumentCategory[]} The current document categories.
52
- */
53
- getDocumentCategories(): DocumentCategory[];
54
49
  /**
55
50
  * Selects the currently selected menu item.
56
51
  * @returns {Observable<string | null>} Observable that emits the currently selected menu item _id (not the label).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.2.84",
3
+ "version": "0.2.86",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"
package/public-api.d.ts CHANGED
@@ -7,7 +7,6 @@ export * from './lib/document/components/document-list/document-list.component';
7
7
  export * from './lib/document/components/document-search/document-search.component';
8
8
  export * from './lib/document/components/sidebar/sidebar.component';
9
9
  export * from './lib/document/models/document-history.model';
10
- export * from './lib/document/models/uploaded-file-response.model';
11
10
  export * from './lib/document/services/document-table-builder.service';
12
11
  export * from './lib/document/directives/document.directive';
13
12
  export * from './lib/document/directives/permission.directive';
@@ -1,7 +0,0 @@
1
- export interface UploadedFileResponse {
2
- id?: string;
3
- fileName: string;
4
- contentType: string;
5
- url: string;
6
- size: string;
7
- }