cat-documents-ng 0.2.45 → 0.2.48

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.
@@ -65,6 +65,10 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy, On
65
65
  * @returns {void}
66
66
  */
67
67
  ngOnInit(): void;
68
+ /**
69
+ * Initialize all data with proper sequencing to avoid duplicate API calls
70
+ */
71
+ private initializeData;
68
72
  /**
69
73
  * Sets up subscriptions to monitor menu item and user selection changes
70
74
  * to trigger status data fetching and user list refreshing
@@ -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,14 +1,8 @@
1
1
  import { OnInit, OnDestroy, OnChanges, SimpleChanges } 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';
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.
@@ -16,12 +10,7 @@ import * as i0 from "@angular/core";
16
10
  * @class DocumentListComponent
17
11
  */
18
12
  export declare class DocumentListComponent implements OnInit, OnDestroy, OnChanges {
19
- documentUploadService: DocumentUploadService;
20
- documentHttpService: DocumentHttpService;
21
- documentQuery: DocumentQuery;
22
- documentStore: DocumentStore;
23
- private documentTableBuilder;
24
- private documentHelperService;
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, OnChang
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, OnChang
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, OnChang
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,36 +89,20 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
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
99
  * Handles changes to input properties
136
100
  */
137
101
  ngOnChanges(changes: SimpleChanges): void;
138
102
  /**
139
- * Initializes the component by fetching the document type list.
103
+ * Initializes the component by setting up document list subscription.
140
104
  */
141
105
  ngOnInit(): void;
142
- /**
143
- * Handles the click event for file upload.
144
- * Prevents event propagation and displays the sidebar.
145
- * @param {MouseEvent} event - The click event triggered by the user.
146
- * @memberof DocumentListComponent
147
- */
148
- handleFileUploadClick(event: MouseEvent): void;
149
106
  /**
150
107
  * Handles the save click event to update the document's file name.
151
108
  * This method creates a payload with the updated file name and calls the
@@ -161,25 +118,11 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
161
118
  */
162
119
  handleUploadDocument(): void;
163
120
  /**
164
- * Fetches the list of document types from the server.
165
- * 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.
166
123
  * @memberof DocumentListComponent
167
- * @returns {void}
168
124
  */
169
- getDocumentTypeList(): void;
170
125
  handleOpenSideBar(isVisible: boolean): void;
171
- /**
172
- * Gets completion count for a category
173
- */
174
- getCompletionCount(category: DocumentListResponse): string;
175
- /**
176
- * Gets pending document count for a category
177
- */
178
- getPendingDocumentCount(category: DocumentListResponse): number;
179
- /**
180
- * Gets approved document count for a category
181
- */
182
- getApprovedDocumentCount(category: DocumentListResponse): number;
183
126
  /**
184
127
  * Builds document categories from the API response
185
128
  */
@@ -188,16 +131,15 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
188
131
  * Sets up subscription to document list response from store
189
132
  */
190
133
  private setupDocumentListSubscription;
134
+ /**
135
+ * Handles table row click event
136
+ */
191
137
  handleTableRowClick(rowData: any): void;
192
138
  /**
193
139
  * Handles the delete action from the table component
194
140
  * @param {any} rowData - The row data containing the document to delete
195
141
  */
196
142
  handleDeleteAction(rowData: any): void;
197
- /**
198
- * Refreshes the document list for a new context
199
- */
200
- private refreshDocumentListForNewContext;
201
143
  /**
202
144
  * Refreshes the document list after a status update
203
145
  */
@@ -207,5 +149,5 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
207
149
  */
208
150
  ngOnDestroy(): void;
209
151
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListComponent, never>;
210
- 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>;
211
153
  }
@@ -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
@@ -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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.2.45",
3
+ "version": "0.2.48",
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
- }