cat-documents-ng 0.2.43 → 0.2.44

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;
@@ -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,17 @@ 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 all data with current filters after accept/reject/delete operations
122
+ * This includes document categories, status data, user list, and document list
123
123
  *
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)
124
+ * This method ensures that after a document action (accept/reject/delete):
125
+ * 1. Document categories are refreshed
126
+ * 2. Status counts are refreshed with current menu item and user filters
127
+ * 3. User list is refreshed with current filters (if applicable)
128
+ * 4. Document list is refreshed with all current filters (menu item, user, status, search)
128
129
  *
129
130
  * Filter application:
131
+ * - Document categories: Uses base contextId
130
132
  * - Status data: Uses userId as contextId and menuItem as categoryId
131
133
  * - User list: Uses base contextId (can be enhanced with additional filters if API supports)
132
134
  * - 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.44",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"