cat-documents-ng 0.2.44 → 0.2.47

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,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,11 +56,19 @@ 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}
62
66
  */
63
67
  ngOnInit(): void;
68
+ /**
69
+ * Initialize all data with proper sequencing to avoid duplicate API calls
70
+ */
71
+ private initializeData;
64
72
  /**
65
73
  * Sets up subscriptions to monitor menu item and user selection changes
66
74
  * to trigger status data fetching and user list refreshing
@@ -78,12 +86,16 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy {
78
86
  * Fetches document catagory data.
79
87
  */
80
88
  fetchDocumentCatagories(): void;
89
+ /**
90
+ * Refetches all data when contextId changes
91
+ */
92
+ private refetchAllDataForNewContext;
81
93
  /**
82
94
  * Sets up subscription to listen for filtered document responses
83
95
  */
84
96
  private setupFilteredDocumentSubscription;
85
97
  /**
86
- * Unsubscribe subscription on destroy of component .
98
+ * Unsubscribe subscription on destroy of component and clean up state.
87
99
  */
88
100
  ngOnDestroy(): void;
89
101
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentContainerComponent, never>;
@@ -1,7 +1,14 @@
1
- import { DocumentHistoryItem, DocumentHistorySection } from '../../models/document-history.model';
2
- import { DocumentHistoryStyleService } from '../../services/document-history-style.service';
1
+ import { DocumentHistorySection } from '../../models/document-history.model';
2
+ import { DocumentHistoryService } from '../../services/document-history.service';
3
3
  import * as i0 from "@angular/core";
4
- interface ProcessedDocumentHistoryItem extends DocumentHistoryItem {
4
+ interface ProcessedDocumentHistoryItem {
5
+ label: string;
6
+ dateTime: string;
7
+ requestDescription: string;
8
+ userName: string;
9
+ userRole: string;
10
+ documentUrl?: string;
11
+ docName?: string;
5
12
  actionIcon: string;
6
13
  actionColor: string;
7
14
  actionBgColor: string;
@@ -17,7 +24,7 @@ interface ProcessedDocumentHistorySection extends DocumentHistorySection {
17
24
  * Component for displaying document history in a timeline format.
18
25
  */
19
26
  export declare class DocumentHistoryComponent {
20
- private documentHistoryStyleService;
27
+ private documentHistoryService;
21
28
  /**
22
29
  * Input data for document history sections
23
30
  */
@@ -34,7 +41,7 @@ export declare class DocumentHistoryComponent {
34
41
  * Whether the accordion is expanded
35
42
  */
36
43
  isAccordionExpanded: boolean;
37
- constructor(documentHistoryStyleService: DocumentHistoryStyleService);
44
+ constructor(documentHistoryService: DocumentHistoryService);
38
45
  /**
39
46
  * Handle accordion open event
40
47
  */
@@ -47,14 +54,6 @@ export declare class DocumentHistoryComponent {
47
54
  * Toggle accordion state
48
55
  */
49
56
  toggleAccordion(): void;
50
- /**
51
- * Get the CSS class for accordion styling based on the section's label
52
- */
53
- private getAccordionClass;
54
- /**
55
- * Check if a section has valid content to display
56
- */
57
- private checkValidContent;
58
57
  /**
59
58
  * Process history data to add computed properties
60
59
  */
@@ -1,27 +1,16 @@
1
- import { OnInit, OnDestroy } from '@angular/core';
2
- import { DocumentHttpService } from '../../services/document-http.service';
3
- import { DocumentUploadService } from '../../services/document-upload.service';
4
- import { Message } from 'primeng/api';
5
- import { DocumentQuery } from '../../state/document.query';
6
- import { DocumentStore } from '../../state/document.store';
7
- import { PERMISSIONS } from '../../../../Shared/constant/PERMISSIONS';
8
- import { DocumentTableBuilderService } from '../../services/document-table-builder.service';
1
+ import { OnInit, OnDestroy, OnChanges, SimpleChanges } from '@angular/core';
9
2
  import { DocumentListItem, DocumentListResponse } from '../../models/document-list-response.model';
10
3
  import { TableData } from '../../../../Shared/components/table-primary/table-primary.model';
11
- import { DocumentHelperService } from '../../services/document.service';
4
+ import { DocumentListService } from '../../services/document-list.service';
5
+ import { Message } from 'primeng/api';
12
6
  import * as i0 from "@angular/core";
13
7
  /**
14
8
  * This component is responsible for displaying and managing a list of documents.
15
9
  * Provides functionality for file upload, document selection, and dialog management.
16
10
  * @class DocumentListComponent
17
11
  */
18
- export declare class DocumentListComponent implements OnInit, OnDestroy {
19
- documentUploadService: DocumentUploadService;
20
- documentHttpService: DocumentHttpService;
21
- documentQuery: DocumentQuery;
22
- documentStore: DocumentStore;
23
- private documentTableBuilder;
24
- private documentHelperService;
12
+ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChanges {
13
+ private documentListService;
25
14
  /**
26
15
  * Represents the context ID for the document list.
27
16
  * This value is passed from the parent component.
@@ -39,12 +28,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
39
28
  * Subscription to document list response from store
40
29
  */
41
30
  private documentListSubscription;
42
- /**
43
- * Default visibility of the upload button.
44
- * @type {boolean}
45
- * @memberof DocumentListComponent
46
- */
47
- isUploadButtonVisible: boolean;
48
31
  /**
49
32
  * The currently selected document.
50
33
  * @type {DocumentModel}
@@ -76,12 +59,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
76
59
  * @memberof DocumentListComponent
77
60
  */
78
61
  documentList: DocumentListItem[];
79
- /**
80
- * The name of the document being uploaded or managed.
81
- * @type {string}
82
- * @memberof DocumentListComponent
83
- */
84
- documentName: string;
85
62
  /**
86
63
  * Available document types for selection.
87
64
  * @type {string[]}
@@ -94,10 +71,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
94
71
  * @memberof DocumentListComponent
95
72
  */
96
73
  selectedOption: string | null;
97
- /**
98
- * The set of permissions available for this component.
99
- */
100
- PERMISSION: typeof PERMISSIONS;
101
74
  /**
102
75
  * The file name associated with the document.
103
76
  * It may be undefined until a file is selected or loaded.
@@ -116,32 +89,20 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
116
89
  * Completion counts for each category
117
90
  */
118
91
  categoryCompletionCounts: string[];
119
- /**
120
- * Filter properties
121
- */
122
- status: string | null;
123
- category: string | null;
124
- searchKey: string | null;
125
92
  /**
126
93
  * Creates an instance of DocumentListComponent.
127
94
  * @class
128
- * @param {DocumentUploadService} documentUploadService - The service responsible for uploading documents.
129
- * @param {DocumentHttpService} documentHttpService - The service responsible for fetching documents from the server.
130
- * @param {DocumentQuery} documentQuery - The service responsible for geting stored documents.
131
- * @param {DocumentStore} documentStore - The service responsible for storing documents.
95
+ * @param {DocumentListService} documentListService - The service responsible for document list operations.
132
96
  */
133
- constructor(documentUploadService: DocumentUploadService, documentHttpService: DocumentHttpService, documentQuery: DocumentQuery, documentStore: DocumentStore, documentTableBuilder: DocumentTableBuilderService, documentHelperService: DocumentHelperService);
97
+ constructor(documentListService: DocumentListService);
134
98
  /**
135
- * Initializes the component by fetching the document type list.
99
+ * Handles changes to input properties
136
100
  */
137
- ngOnInit(): void;
101
+ ngOnChanges(changes: SimpleChanges): void;
138
102
  /**
139
- * Handles the click event for file upload.
140
- * Prevents event propagation and displays the sidebar.
141
- * @param {MouseEvent} event - The click event triggered by the user.
142
- * @memberof DocumentListComponent
103
+ * Initializes the component by setting up document list subscription.
143
104
  */
144
- handleFileUploadClick(event: MouseEvent): void;
105
+ ngOnInit(): void;
145
106
  /**
146
107
  * Handles the save click event to update the document's file name.
147
108
  * This method creates a payload with the updated file name and calls the
@@ -157,25 +118,11 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
157
118
  */
158
119
  handleUploadDocument(): void;
159
120
  /**
160
- * Fetches the list of document types from the server.
161
- * Updates the options array with the available document types.
121
+ * Handles the visibility of the sidebar.
122
+ * @param {boolean} isVisible - Indicates whether the sidebar should be visible or not.
162
123
  * @memberof DocumentListComponent
163
- * @returns {void}
164
124
  */
165
- getDocumentTypeList(): void;
166
125
  handleOpenSideBar(isVisible: boolean): void;
167
- /**
168
- * Gets completion count for a category
169
- */
170
- getCompletionCount(category: DocumentListResponse): string;
171
- /**
172
- * Gets pending document count for a category
173
- */
174
- getPendingDocumentCount(category: DocumentListResponse): number;
175
- /**
176
- * Gets approved document count for a category
177
- */
178
- getApprovedDocumentCount(category: DocumentListResponse): number;
179
126
  /**
180
127
  * Builds document categories from the API response
181
128
  */
@@ -184,6 +131,9 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
184
131
  * Sets up subscription to document list response from store
185
132
  */
186
133
  private setupDocumentListSubscription;
134
+ /**
135
+ * Handles table row click event
136
+ */
187
137
  handleTableRowClick(rowData: any): void;
188
138
  /**
189
139
  * Handles the delete action from the table component
@@ -199,5 +149,5 @@ export declare class DocumentListComponent implements OnInit, OnDestroy {
199
149
  */
200
150
  ngOnDestroy(): void;
201
151
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListComponent, never>;
202
- static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "isUploadButtonVisible": { "alias": "isUploadButtonVisible"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; "status": { "alias": "status"; "required": false; }; "category": { "alias": "category"; "required": false; }; "searchKey": { "alias": "searchKey"; "required": false; }; }, {}, never, ["*"], false, never>;
152
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, {}, never, ["*"], false, never>;
203
153
  }
@@ -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
  }
@@ -15,9 +15,15 @@ export declare class DocumentsMenuComponent implements OnInit, OnChanges {
15
15
  contextId: string;
16
16
  selectedMenuItem: string | null;
17
17
  selectedMenuItemId: string | null;
18
+ private storeCategories;
18
19
  constructor(documentStore: DocumentStore, documentQuery: DocumentQuery, documentMenuService: DocumentMenuService, documentHelperService: DocumentHelperService);
19
20
  ngOnInit(): void;
20
21
  ngOnChanges(changes: SimpleChanges): void;
22
+ /**
23
+ * Gets the categories to use for the menu
24
+ * Priority: Store categories > Input categories
25
+ */
26
+ get categories(): DocumentCategory[];
21
27
  /**
22
28
  * Finds the label of a menu item by its _id
23
29
  * @param id The _id to search for
@@ -37,6 +43,10 @@ export declare class DocumentsMenuComponent implements OnInit, OnChanges {
37
43
  onSelectMenuItem(menuItemId: string): void;
38
44
  onUnselectMenuItem(): void;
39
45
  getSelectedMenuItem(): string | null;
46
+ /**
47
+ * Handles contextId changes by clearing current selection and refreshing data
48
+ */
49
+ private handleContextIdChange;
40
50
  getSelectedMenuItemId(): string | null;
41
51
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentsMenuComponent, never>;
42
52
  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>;
@@ -0,0 +1,42 @@
1
+ import { DocumentHistoryItem, DocumentHistorySection } from '../models/document-history.model';
2
+ import { DocumentHistoryStyleService } from './document-history-style.service';
3
+ import { HttpClient } from '@angular/common/http';
4
+ import * as i0 from "@angular/core";
5
+ interface ProcessedDocumentHistoryItem extends DocumentHistoryItem {
6
+ actionIcon: string;
7
+ actionColor: string;
8
+ actionBgColor: string;
9
+ actionBorderColor: string;
10
+ actionIconBgColor: string;
11
+ }
12
+ interface ProcessedDocumentHistorySection extends DocumentHistorySection {
13
+ list: ProcessedDocumentHistoryItem[];
14
+ accordionClass?: string;
15
+ hasValidContent?: boolean;
16
+ }
17
+ export declare class DocumentHistoryService {
18
+ private documentHistoryStyleService;
19
+ private http;
20
+ constructor(documentHistoryStyleService: DocumentHistoryStyleService, http: HttpClient);
21
+ /**
22
+ * Get the CSS class for accordion styling based on the section's label
23
+ */
24
+ private getAccordionClass;
25
+ /**
26
+ * Check if a section has valid content to display
27
+ */
28
+ private checkValidContent;
29
+ /**
30
+ * Process history data to add computed properties
31
+ */
32
+ processHistoryData(historyData: DocumentHistorySection[]): ProcessedDocumentHistorySection[];
33
+ /**
34
+ * Downloads a document when clicked
35
+ * @param documentUrl - The URL of the document to download
36
+ * @param docName - The name of the document
37
+ */
38
+ downloadDocument(documentUrl: string, docName?: string): void;
39
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHistoryService, never>;
40
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentHistoryService>;
41
+ }
42
+ export {};
@@ -2,11 +2,9 @@ import { Observable } from 'rxjs';
2
2
  import { AppConfigService } from '../../../Shared/services/app-config.service';
3
3
  import { DocumentStore } from '../state/document.store';
4
4
  import { HttpClient } from '@angular/common/http';
5
- import { DocumentTypeModel } from '../models/document-type.model';
6
5
  import { DocumentAlertModel } from '../models/document-alert.model';
7
6
  import { DocumentModel } from '../models/document.model';
8
7
  import { FolderBlockModel } from '../models/folder.model';
9
- import { DocumentCategory } from '../models/document-category.model';
10
8
  import { UserListModel } from '../models/user-list.model';
11
9
  import { StatusDataModel } from '../models/status-data.model';
12
10
  import { DocumentHistorySection } from '../models/document-history.model';
@@ -46,13 +44,12 @@ export declare class DocumentHttpService {
46
44
  * @param {string} contextId - The context ID to fetch the document.
47
45
  * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
48
46
  */
49
- getDocumentCatagories(contextId: string): Observable<DocumentCategory[]>;
47
+ getDocumentCatagories(contextId: string): Observable<any>;
50
48
  /**
51
49
  * Fetches a document by its path name and transforms the response for dropdown options.
52
50
  * Includes error handling for failed API requests.
53
51
  * @returns {Observable<any>} Observable that emits the transformed data for dropdown options.
54
52
  */
55
- getDocumentTypes(): Observable<DocumentTypeModel[]>;
56
53
  /**
57
54
  * Fetches a document by its path name and transforms the response for dropdown options.
58
55
  * @param {string} documentId - The document ID to fetch the document.
@@ -0,0 +1,78 @@
1
+ import { Observable } from 'rxjs';
2
+ import { DocumentUploadService } from './document-upload.service';
3
+ import { DocumentHttpService } from './document-http.service';
4
+ import { DocumentQuery } from '../state/document.query';
5
+ import { DocumentStore } from '../state/document.store';
6
+ import { DocumentTableBuilderService } from './document-table-builder.service';
7
+ import { DocumentHelperService } from './document.service';
8
+ import { DocumentListItem, DocumentListResponse } from '../models/document-list-response.model';
9
+ import { TableData } from '../../../Shared/components/table-primary/table-primary.model';
10
+ import { Message } from 'primeng/api';
11
+ import * as i0 from "@angular/core";
12
+ export declare class DocumentListService {
13
+ private documentUploadService;
14
+ private documentHttpService;
15
+ private documentQuery;
16
+ private documentStore;
17
+ private documentTableBuilder;
18
+ private documentHelperService;
19
+ constructor(documentUploadService: DocumentUploadService, documentHttpService: DocumentHttpService, documentQuery: DocumentQuery, documentStore: DocumentStore, documentTableBuilder: DocumentTableBuilderService, documentHelperService: DocumentHelperService);
20
+ /**
21
+ * Handle file upload click event
22
+ */
23
+ handleFileUploadClick(): void;
24
+ /**
25
+ * Handle save click to update document name
26
+ */
27
+ handleSaveClick(fileName: string, selectedDocument: DocumentListItem): Observable<any>;
28
+ /**
29
+ * Handle document upload
30
+ */
31
+ handleUploadDocument(selectedOption: string | null): Observable<Message[]>;
32
+ /**
33
+ * Get completion count for a category
34
+ */
35
+ getCompletionCount(category: DocumentListResponse): string;
36
+ /**
37
+ * Get pending document count for a category
38
+ */
39
+ getPendingDocumentCount(category: DocumentListResponse): number;
40
+ /**
41
+ * Get approved document count for a category
42
+ */
43
+ getApprovedDocumentCount(category: DocumentListResponse): number;
44
+ /**
45
+ * Build document categories from API response
46
+ */
47
+ buildDocumentCategories(documentListResponse: DocumentListResponse[] | null): {
48
+ documentCategories: DocumentListResponse[];
49
+ categoryTables: TableData[];
50
+ categoryCompletionCounts: string[];
51
+ };
52
+ /**
53
+ * Handle table row click
54
+ */
55
+ handleTableRowClick(rowData: any): DocumentListItem;
56
+ /**
57
+ * Handle delete action
58
+ */
59
+ handleDeleteAction(rowData: any, contextId: string): Observable<any>;
60
+ /**
61
+ * Refresh document list for new context
62
+ */
63
+ refreshDocumentListForNewContext(contextId: string): void;
64
+ /**
65
+ * Refresh document list after status update
66
+ */
67
+ refreshDocumentList(contextId: string): void;
68
+ /**
69
+ * Setup subscription to document list response
70
+ */
71
+ setupDocumentListSubscription(): Observable<DocumentListResponse[] | null>;
72
+ /**
73
+ * Refresh all data with current filters
74
+ */
75
+ refreshAllDataWithCurrentFilters(contextId: string): void;
76
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListService, never>;
77
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentListService>;
78
+ }
@@ -117,6 +117,13 @@ export declare class DocumentHelperService {
117
117
  * @param contextId - The context ID to use for the API call
118
118
  */
119
119
  refreshDocumentsWithoutFilters(contextId: string): void;
120
+ /**
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;
120
127
  /**
121
128
  * Refresh all data with current filters after accept/reject/delete operations
122
129
  * This includes document categories, status data, user list, and document list
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.2.44",
3
+ "version": "0.2.47",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"
@@ -1,14 +0,0 @@
1
- /**
2
- * Storing all permission properties.
3
- * @export
4
- * @class PERMISSIONS
5
- * @typedef {PERMISSIONS}
6
- */
7
- export declare class PERMISSIONS {
8
- /**
9
- * Access permission.
10
- * @static
11
- * @type {string}
12
- */
13
- static DOCUMENT_POST: string;
14
- }