cat-documents-ng 0.2.43 → 0.2.45

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.
@@ -14,16 +14,23 @@ export declare class DocumentActionsComponent implements OnChanges {
14
14
  showAcceptDialog: boolean;
15
15
  showRejectDialog: boolean;
16
16
  acceptNote: string;
17
- rejectNote: string;
17
+ private _rejectNote;
18
18
  cardClass: string;
19
19
  rejectButtonClass: string;
20
20
  acceptButtonClass: string;
21
+ isRejectNoteEmpty: boolean;
21
22
  constructor(documentActionsService: DocumentActionsService);
23
+ get rejectNote(): string;
24
+ set rejectNote(value: string);
22
25
  ngOnChanges(changes: SimpleChanges): void;
23
26
  /**
24
27
  * Updates computed properties based on currentStatus and statusId
25
28
  */
26
29
  private updateComputedProperties;
30
+ /**
31
+ * Updates the isRejectNoteEmpty property based on current rejectNote value
32
+ */
33
+ private updateRejectNoteEmpty;
27
34
  onAcceptClick(): void;
28
35
  onRejectClick(): void;
29
36
  onDeleteClick(): void;
@@ -1,4 +1,4 @@
1
- import { OnInit, OnDestroy } from '@angular/core';
1
+ import { OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { DocumentService } from '../../state/document.service';
3
3
  import { DocumentHttpService } from '../../services/document-http.service';
4
4
  import { DocumentQuery } from '../../state/document.query';
@@ -14,7 +14,7 @@ import * as i0 from "@angular/core";
14
14
  * @class DocumentContainerComponent
15
15
  * @typedef {DocumentContainerComponent}
16
16
  */
17
- export declare class DocumentContainerComponent implements OnInit, OnDestroy {
17
+ export declare class DocumentContainerComponent implements OnInit, OnDestroy, OnChanges {
18
18
  documentStore: DocumentStore;
19
19
  documentService: DocumentService;
20
20
  documentQuery: DocumentQuery;
@@ -56,6 +56,10 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy {
56
56
  * @type {Subscription}
57
57
  */
58
58
  private subscription;
59
+ /**
60
+ * Handles changes to input properties
61
+ */
62
+ ngOnChanges(changes: SimpleChanges): void;
59
63
  /**
60
64
  * Fetches the folder and document data on initialization.
61
65
  * @returns {void}
@@ -78,12 +82,16 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy {
78
82
  * Fetches document catagory data.
79
83
  */
80
84
  fetchDocumentCatagories(): void;
85
+ /**
86
+ * Refetches all data when contextId changes
87
+ */
88
+ private refetchAllDataForNewContext;
81
89
  /**
82
90
  * Sets up subscription to listen for filtered document responses
83
91
  */
84
92
  private setupFilteredDocumentSubscription;
85
93
  /**
86
- * Unsubscribe subscription on destroy of component .
94
+ * Unsubscribe subscription on destroy of component and clean up state.
87
95
  */
88
96
  ngOnDestroy(): void;
89
97
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentContainerComponent, never>;
@@ -1,4 +1,4 @@
1
- import { OnInit, OnDestroy } from '@angular/core';
1
+ import { OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { DocumentHttpService } from '../../services/document-http.service';
3
3
  import { DocumentUploadService } from '../../services/document-upload.service';
4
4
  import { Message } from 'primeng/api';
@@ -15,7 +15,7 @@ import * as i0 from "@angular/core";
15
15
  * Provides functionality for file upload, document selection, and dialog management.
16
16
  * @class DocumentListComponent
17
17
  */
18
- export declare class DocumentListComponent implements OnInit, OnDestroy {
18
+ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChanges {
19
19
  documentUploadService: DocumentUploadService;
20
20
  documentHttpService: DocumentHttpService;
21
21
  documentQuery: DocumentQuery;
@@ -131,6 +131,10 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
131
131
  * @param {DocumentStore} documentStore - The service responsible for storing documents.
132
132
  */
133
133
  constructor(documentUploadService: DocumentUploadService, documentHttpService: DocumentHttpService, documentQuery: DocumentQuery, documentStore: DocumentStore, documentTableBuilder: DocumentTableBuilderService, documentHelperService: DocumentHelperService);
134
+ /**
135
+ * Handles changes to input properties
136
+ */
137
+ ngOnChanges(changes: SimpleChanges): void;
134
138
  /**
135
139
  * Initializes the component by fetching the document type list.
136
140
  */
@@ -190,6 +194,10 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
190
194
  * @param {any} rowData - The row data containing the document to delete
191
195
  */
192
196
  handleDeleteAction(rowData: any): void;
197
+ /**
198
+ * Refreshes the document list for a new context
199
+ */
200
+ private refreshDocumentListForNewContext;
193
201
  /**
194
202
  * Refreshes the document list after a status update
195
203
  */
@@ -1,9 +1,9 @@
1
- import { OnInit, OnDestroy } from '@angular/core';
1
+ import { OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
2
2
  import { DocumentQuery } from '../../state/document.query';
3
3
  import { StatusCalculatorService, CalculatedStatusData } from '../../services/status-calculator.service';
4
4
  import { DocumentHelperService } from '../../services/document.service';
5
5
  import * as i0 from "@angular/core";
6
- export declare class DocumentStatusComponent implements OnInit, OnDestroy {
6
+ export declare class DocumentStatusComponent implements OnInit, OnDestroy, OnChanges {
7
7
  private documentQuery;
8
8
  private documentService;
9
9
  private statusCalculatorService;
@@ -13,10 +13,12 @@ export declare class DocumentStatusComponent implements OnInit, OnDestroy {
13
13
  statusDataWithPercentages: CalculatedStatusData[];
14
14
  private subscription;
15
15
  constructor(documentQuery: DocumentQuery, documentService: DocumentHelperService, statusCalculatorService: StatusCalculatorService);
16
+ ngOnChanges(changes: SimpleChanges): void;
16
17
  ngOnInit(): void;
17
- ngOnDestroy(): void;
18
+ private refetchStatusData;
18
19
  selectStatus(status: string): void;
19
20
  private updateCalculatedStatusData;
21
+ ngOnDestroy(): void;
20
22
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentStatusComponent, never>;
21
23
  static ɵcmp: i0.ɵɵComponentDeclaration<DocumentStatusComponent, "lib-document-status", never, { "contextId": { "alias": "contextId"; "required": false; }; "statusData": { "alias": "statusData"; "required": false; }; }, {}, never, never, false, never>;
22
24
  }
@@ -37,6 +37,10 @@ export declare class DocumentsMenuComponent implements OnInit, OnChanges {
37
37
  onSelectMenuItem(menuItemId: string): void;
38
38
  onUnselectMenuItem(): void;
39
39
  getSelectedMenuItem(): string | null;
40
+ /**
41
+ * Handles contextId changes by clearing current selection and refreshing data
42
+ */
43
+ private handleContextIdChange;
40
44
  getSelectedMenuItemId(): string | null;
41
45
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentsMenuComponent, never>;
42
46
  static ɵcmp: i0.ɵɵComponentDeclaration<DocumentsMenuComponent, "lib-documents-menu", never, { "catagories": { "alias": "catagories"; "required": false; }; "applicationNumber": { "alias": "applicationNumber"; "required": false; }; "contextId": { "alias": "contextId"; "required": false; }; }, {}, never, never, false, never>;
@@ -116,9 +116,9 @@ export declare class DocumentHttpService {
116
116
  */
117
117
  private normalizeStatus;
118
118
  /**
119
- * Deletes a document by its ID and refreshes the document list
119
+ * Deletes a document by its ID and refreshes all data (categories, userlist, status, and document list)
120
120
  * @param {string} documentId - The ID of the document to delete
121
- * @param {string} contextId - The context ID to refresh the document list
121
+ * @param {string} contextId - The context ID to refresh all data
122
122
  * @returns {Observable<any>} Observable that emits the delete response
123
123
  */
124
124
  deleteDocument(documentId: string, contextId: string): Observable<any>;
@@ -1,8 +1,10 @@
1
1
  import { DocumentListResponse, DocumentListItem } from '../models/document-list-response.model';
2
2
  import { TableData } from '../../../Shared/components/table-primary/table-primary.model';
3
+ import { SessionService } from '../../../Shared/services/session.service';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class DocumentTableBuilderService {
5
- constructor();
6
+ private sessionService;
7
+ constructor(sessionService: SessionService);
6
8
  /**
7
9
  * Builds a single table from document list items
8
10
  * @param documents Array of document list items
@@ -5,6 +5,8 @@ import { DocumentListItem } from '../models/document-list-response.model';
5
5
  import { DocumentHistorySection } from '../models/document-history.model';
6
6
  import { DocumentAction } from './document-actions.service';
7
7
  import { MessageService } from 'primeng/api';
8
+ import { DocumentStore } from '../state/document.store';
9
+ import { DocumentQuery } from '../state/document.query';
8
10
  import * as i0 from "@angular/core";
9
11
  export interface DocumentViewerState {
10
12
  selectedDocument?: DocumentListItem;
@@ -19,9 +21,17 @@ export declare class DocumentViewerService {
19
21
  private documentHttpService;
20
22
  private documentService;
21
23
  private messageService;
22
- private stateSubject;
23
- state$: Observable<DocumentViewerState>;
24
- constructor(documentHttpService: DocumentHttpService, documentService: DocumentHelperService, messageService: MessageService);
24
+ private documentStore;
25
+ private documentQuery;
26
+ constructor(documentHttpService: DocumentHttpService, documentService: DocumentHelperService, messageService: MessageService, documentStore: DocumentStore, documentQuery: DocumentQuery);
27
+ /**
28
+ * Gets the current document viewer state as an observable
29
+ */
30
+ get state$(): Observable<DocumentViewerState>;
31
+ /**
32
+ * Gets the current document viewer state synchronously
33
+ */
34
+ getCurrentState(): DocumentViewerState;
25
35
  /**
26
36
  * Updates the selected document and recalculates all computed properties
27
37
  * @param document The selected document
@@ -51,6 +61,12 @@ export declare class DocumentViewerService {
51
61
  * @param contextId The context ID for API calls
52
62
  */
53
63
  private updateDocumentStatus;
64
+ /**
65
+ * Deletes a document and refreshes all data while preserving current filters
66
+ * @param documentId The ID of the document to delete
67
+ * @param contextId The context ID for API calls
68
+ */
69
+ private deleteDocument;
54
70
  /**
55
71
  * Refreshes all related data after document status update
56
72
  * @param contextId The context ID for API calls
@@ -74,11 +90,6 @@ export declare class DocumentViewerService {
74
90
  * @returns True if document is uploaded
75
91
  */
76
92
  private calculateIsDocumentUploaded;
77
- /**
78
- * Gets the current state
79
- * @returns The current state
80
- */
81
- getCurrentState(): DocumentViewerState;
82
93
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentViewerService, never>;
83
94
  static ɵprov: i0.ɵɵInjectableDeclaration<DocumentViewerService>;
84
95
  }
@@ -118,15 +118,24 @@ export declare class DocumentHelperService {
118
118
  */
119
119
  refreshDocumentsWithoutFilters(contextId: string): void;
120
120
  /**
121
- * Refresh all data with current filters after accept/reject operations
122
- * This includes status data, user list, and document list
121
+ * Refresh status data for a specific context
122
+ * @param contextId - The context ID to use for the API call
123
+ * @param statusContextId - The status context ID (usually userId)
124
+ * @param categoryId - The category ID (usually menuItem)
125
+ */
126
+ refreshStatusData(contextId: string, statusContextId: string | null, categoryId: string | null): void;
127
+ /**
128
+ * Refresh all data with current filters after accept/reject/delete operations
129
+ * This includes document categories, status data, user list, and document list
123
130
  *
124
- * This method ensures that after a document status change (accept/reject):
125
- * 1. Status counts are refreshed with current menu item and user filters
126
- * 2. User list is refreshed with current filters (if applicable)
127
- * 3. Document list is refreshed with all current filters (menu item, user, status, search)
131
+ * This method ensures that after a document action (accept/reject/delete):
132
+ * 1. Document categories are refreshed
133
+ * 2. Status counts are refreshed with current menu item and user filters
134
+ * 3. User list is refreshed with current filters (if applicable)
135
+ * 4. Document list is refreshed with all current filters (menu item, user, status, search)
128
136
  *
129
137
  * Filter application:
138
+ * - Document categories: Uses base contextId
130
139
  * - Status data: Uses userId as contextId and menuItem as categoryId
131
140
  * - User list: Uses base contextId (can be enhanced with additional filters if API supports)
132
141
  * - Document list: Uses all current filters (menuItem, userId, status, searchKey)
@@ -8,6 +8,8 @@ import { DocumentCategory } from '../models/document-category.model';
8
8
  import { UserListModel } from '../models/user-list.model';
9
9
  import { StatusDataModel } from '../models/status-data.model';
10
10
  import { DocumentListResponse } from '../models/document-list-response.model';
11
+ import { DocumentListItem } from '../models/document-list-response.model';
12
+ import { DocumentHistorySection } from '../models/document-history.model';
11
13
  import * as i0 from "@angular/core";
12
14
  /**
13
15
  * Query service for managing document state.
@@ -136,6 +138,102 @@ export declare class DocumentQuery extends QueryEntity<DocumentState> {
136
138
  * @returns {DocumentListResponse[] | null} The current document list response.
137
139
  */
138
140
  getDocumentListResponse(): DocumentListResponse[] | null;
141
+ /**
142
+ * Selects the selected document for viewing.
143
+ * @returns {Observable<DocumentListItem | undefined>} Observable that emits the selected document.
144
+ */
145
+ selectSelectedDocument(): Observable<DocumentListItem | undefined>;
146
+ /**
147
+ * Gets the current selected document value (synchronous).
148
+ * @returns {DocumentListItem | undefined} The current selected document.
149
+ */
150
+ getSelectedDocument(): DocumentListItem | undefined;
151
+ /**
152
+ * Selects the document history.
153
+ * @returns {Observable<DocumentHistorySection[]>} Observable that emits the document history.
154
+ */
155
+ selectDocumentHistory(): Observable<DocumentHistorySection[]>;
156
+ /**
157
+ * Gets the current document history value (synchronous).
158
+ * @returns {DocumentHistorySection[]} The current document history.
159
+ */
160
+ getDocumentHistory(): DocumentHistorySection[];
161
+ /**
162
+ * Selects the document history visibility state.
163
+ * @returns {Observable<boolean>} Observable that emits the current document history visibility.
164
+ */
165
+ selectShowDocumentHistory(): Observable<boolean>;
166
+ /**
167
+ * Gets the current document history visibility value (synchronous).
168
+ * @returns {boolean} The current document history visibility.
169
+ */
170
+ getShowDocumentHistory(): boolean;
171
+ /**
172
+ * Selects the action loading state.
173
+ * @returns {Observable<boolean>} Observable that emits the current action loading state.
174
+ */
175
+ selectIsActionLoading(): Observable<boolean>;
176
+ /**
177
+ * Gets the current action loading value (synchronous).
178
+ * @returns {boolean} The current action loading state.
179
+ */
180
+ getIsActionLoading(): boolean;
181
+ /**
182
+ * Selects the document status.
183
+ * @returns {Observable<'pending' | 'accepted' | 'rejected'>} Observable that emits the current document status.
184
+ */
185
+ selectDocumentStatus(): Observable<'pending' | 'accepted' | 'rejected'>;
186
+ /**
187
+ * Gets the current document status value (synchronous).
188
+ * @returns {'pending' | 'accepted' | 'rejected'} The current document status.
189
+ */
190
+ getDocumentStatus(): 'pending' | 'accepted' | 'rejected';
191
+ /**
192
+ * Selects the document uploaded state.
193
+ * @returns {Observable<boolean>} Observable that emits the current document uploaded state.
194
+ */
195
+ selectDocumentIsUploaded(): Observable<boolean>;
196
+ /**
197
+ * Gets the current document uploaded value (synchronous).
198
+ * @returns {boolean} The current document uploaded state.
199
+ */
200
+ getDocumentIsUploaded(): boolean;
201
+ /**
202
+ * Selects the alert data.
203
+ * @returns {Observable<any>} Observable that emits the current alert data.
204
+ */
205
+ selectAlertData(): Observable<any>;
206
+ /**
207
+ * Gets the current alert data value (synchronous).
208
+ * @returns {any} The current alert data.
209
+ */
210
+ getAlertData(): any;
211
+ /**
212
+ * Selects all document viewer state properties.
213
+ * @returns {Observable<{selectedDocument?: DocumentListItem, documentHistory: DocumentHistorySection[], showDocumentHistory: boolean, isActionLoading: boolean, documentStatus: 'pending' | 'accepted' | 'rejected', documentIsUploaded: boolean, alertData: any}>} Observable that emits the current document viewer state.
214
+ */
215
+ selectDocumentViewerState(): Observable<{
216
+ selectedDocument?: DocumentListItem;
217
+ documentHistory: DocumentHistorySection[];
218
+ showDocumentHistory: boolean;
219
+ isActionLoading: boolean;
220
+ documentStatus: 'pending' | 'accepted' | 'rejected';
221
+ documentIsUploaded: boolean;
222
+ alertData: any;
223
+ }>;
224
+ /**
225
+ * Gets the current document viewer state values (synchronous).
226
+ * @returns {Object} The current document viewer state values.
227
+ */
228
+ getDocumentViewerState(): {
229
+ selectedDocument?: DocumentListItem;
230
+ documentHistory: DocumentHistorySection[];
231
+ showDocumentHistory: boolean;
232
+ isActionLoading: boolean;
233
+ documentStatus: 'pending' | 'accepted' | 'rejected';
234
+ documentIsUploaded: boolean;
235
+ alertData: any;
236
+ };
139
237
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentQuery, never>;
140
238
  static ɵprov: i0.ɵɵInjectableDeclaration<DocumentQuery>;
141
239
  }
@@ -8,6 +8,8 @@ import { Message } from 'primeng/api';
8
8
  import { UserListModel } from '../models/user-list.model';
9
9
  import { StatusDataModel } from '../models/status-data.model';
10
10
  import { DocumentListResponse } from '../models/document-list-response.model';
11
+ import { DocumentListItem } from '../models/document-list-response.model';
12
+ import { DocumentHistorySection } from '../models/document-history.model';
11
13
  /**
12
14
  * Represents the state of the documents in the application.
13
15
  * This interface extends Akita's `EntityState` to include additional properties
@@ -40,6 +42,13 @@ export interface DocumentState extends EntityState<DocumentModel, string> {
40
42
  userList: UserListModel[];
41
43
  statusData: StatusDataModel[];
42
44
  documentListResponse: DocumentListResponse[] | null;
45
+ selectedDocument?: DocumentListItem;
46
+ documentHistory: DocumentHistorySection[];
47
+ showDocumentHistory: boolean;
48
+ isActionLoading: boolean;
49
+ documentStatus: 'pending' | 'accepted' | 'rejected';
50
+ documentIsUploaded: boolean;
51
+ alertData: any;
43
52
  }
44
53
  /**
45
54
  * Creates the initial state for the `DocumentState` store.
@@ -6,6 +6,8 @@ import { DocumentModel } from '../models/document.model';
6
6
  import { UserListModel } from '../models/user-list.model';
7
7
  import { StatusDataModel } from '../models/status-data.model';
8
8
  import { DocumentListResponse } from '../models/document-list-response.model';
9
+ import { DocumentListItem } from '../models/document-list-response.model';
10
+ import { DocumentHistorySection } from '../models/document-history.model';
9
11
  import * as i0 from "@angular/core";
10
12
  /**
11
13
  * Store that manages the state of documents in the application.
@@ -38,6 +40,15 @@ export declare class DocumentStore extends EntityStore<DocumentState> {
38
40
  setUserList(userList: UserListModel[]): void;
39
41
  setStatusData(statusData: StatusDataModel[]): void;
40
42
  setDocumentListResponse(response: DocumentListResponse[] | null): void;
43
+ setSelectedDocument(document: DocumentListItem | undefined): void;
44
+ setDocumentHistory(history: DocumentHistorySection[]): void;
45
+ setShowDocumentHistory(show: boolean): void;
46
+ setIsActionLoading(loading: boolean): void;
47
+ setDocumentStatus(status: 'pending' | 'accepted' | 'rejected'): void;
48
+ setDocumentIsUploaded(uploaded: boolean): void;
49
+ setAlertData(alertData: any): void;
50
+ updateDocumentViewerState(document?: DocumentListItem, history?: DocumentHistorySection[], showHistory?: boolean, loading?: boolean, status?: 'pending' | 'accepted' | 'rejected', uploaded?: boolean, alertData?: any): void;
51
+ clearDocumentViewerState(): void;
41
52
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentStore, never>;
42
53
  static ɵprov: i0.ɵɵInjectableDeclaration<DocumentStore>;
43
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.2.43",
3
+ "version": "0.2.45",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"