cat-documents-ng 0.2.36 → 0.2.39

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.
@@ -0,0 +1,61 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { DocumentHistoryItem, DocumentHistorySection } from '../../models/document-history.model';
3
+ import { DocumentHistoryStyleService } from '../../services/document-history-style.service';
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
+ /**
18
+ * Component for displaying document history in a timeline format.
19
+ */
20
+ export declare class DocumentHistoryComponent implements OnInit {
21
+ private documentHistoryStyleService;
22
+ /**
23
+ * Input data for document history sections
24
+ */
25
+ historyData: DocumentHistorySection[];
26
+ /**
27
+ * Whether to show the history component
28
+ */
29
+ showHistory: boolean;
30
+ /**
31
+ * Active accordion index for expansion control
32
+ */
33
+ activeAccordionIndex: number;
34
+ /**
35
+ * Whether the accordion is expanded
36
+ */
37
+ isAccordionExpanded: boolean;
38
+ constructor(documentHistoryStyleService: DocumentHistoryStyleService);
39
+ ngOnInit(): void;
40
+ /**
41
+ * Toggle accordion expansion state
42
+ */
43
+ toggleAccordion(): void;
44
+ /**
45
+ * Get the CSS class for accordion styling based on the section's label
46
+ */
47
+ getAccordionClass(section: ProcessedDocumentHistorySection): string;
48
+ /**
49
+ * Process history data to add computed properties
50
+ */
51
+ get processedHistoryData(): ProcessedDocumentHistorySection[];
52
+ /**
53
+ * Downloads a document when clicked
54
+ * @param documentUrl - The URL of the document to download
55
+ * @param docName - The name of the document
56
+ */
57
+ downloadDocument(documentUrl: string, docName?: string): void;
58
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHistoryComponent, never>;
59
+ static ɵcmp: i0.ɵɵComponentDeclaration<DocumentHistoryComponent, "document-history", never, { "historyData": { "alias": "historyData"; "required": false; }; "showHistory": { "alias": "showHistory"; "required": false; }; }, {}, never, never, false, never>;
60
+ }
61
+ export {};
@@ -3,6 +3,7 @@ import { DynamicDialogRef } from 'primeng/dynamicdialog';
3
3
  import { DocumentHttpService } from '../../services/document-http.service';
4
4
  import { DocumentHelperService } from '../../services/document.service';
5
5
  import { DocumentListItem } from '../../models/document-list-response.model';
6
+ import { DocumentHistorySection } from '../../models/document-history.model';
6
7
  import * as i0 from "@angular/core";
7
8
  /**
8
9
  * Component for viewing and managing document details.
@@ -42,6 +43,16 @@ export declare class DocumentViewerComponent implements OnChanges, OnDestroy {
42
43
  * @type {any}
43
44
  */
44
45
  alertData: any;
46
+ /**
47
+ * Document history data
48
+ * @type {DocumentHistorySection[]}
49
+ */
50
+ documentHistory: DocumentHistorySection[];
51
+ /**
52
+ * Whether to show document history
53
+ * @type {boolean}
54
+ */
55
+ showDocumentHistory: boolean;
45
56
  /**
46
57
  * Holds the subscription to manage observable cleanup.
47
58
  * @private
@@ -60,6 +71,11 @@ export declare class DocumentViewerComponent implements OnChanges, OnDestroy {
60
71
  */
61
72
  ngOnChanges(): void;
62
73
  handleSelectedDocument(document: DocumentListItem): void;
74
+ /**
75
+ * Loads document history data
76
+ * @returns {void}
77
+ */
78
+ loadDocumentHistory(documentId: string): void;
63
79
  /**
64
80
  * Determines if the given content type is an image.
65
81
  * @param {string | undefined} contentType - The MIME type of the content.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Constants for Document History labels and styling
3
+ */
4
+ export declare const DOCUMENT_HISTORY: {
5
+ LABELS: {
6
+ DOCUMENT_REQUESTED: string;
7
+ DOCUMENT_UPLOADED: string;
8
+ DOCUMENT_REJECTED: string;
9
+ DOCUMENT_ACCEPTED: string;
10
+ };
11
+ ICONS: {
12
+ DOCUMENT_REQUESTED: string;
13
+ DOCUMENT_UPLOADED: string;
14
+ DOCUMENT_REJECTED: string;
15
+ DOCUMENT_ACCEPTED: string;
16
+ };
17
+ TEXT_COLORS: {
18
+ DOCUMENT_REQUESTED: string;
19
+ DOCUMENT_UPLOADED: string;
20
+ DOCUMENT_REJECTED: string;
21
+ DOCUMENT_ACCEPTED: string;
22
+ };
23
+ BG_COLORS: {
24
+ DOCUMENT_REQUESTED: string;
25
+ DOCUMENT_UPLOADED: string;
26
+ DOCUMENT_REJECTED: string;
27
+ DOCUMENT_ACCEPTED: string;
28
+ };
29
+ BORDER_COLORS: {
30
+ DOCUMENT_REQUESTED: string;
31
+ DOCUMENT_UPLOADED: string;
32
+ DOCUMENT_REJECTED: string;
33
+ DOCUMENT_ACCEPTED: string;
34
+ };
35
+ ICON_BG_COLORS: {
36
+ DOCUMENT_REQUESTED: string;
37
+ DOCUMENT_UPLOADED: string;
38
+ DOCUMENT_REJECTED: string;
39
+ DOCUMENT_ACCEPTED: string;
40
+ };
41
+ };
@@ -6,34 +6,35 @@ import * as i4 from "./components/document-list/document-list.component";
6
6
  import * as i5 from "./components/document-list-item/document-list-item.component";
7
7
  import * as i6 from "./components/document-upload/document-upload.component";
8
8
  import * as i7 from "./components/document-viewer/document-viewer.component";
9
- import * as i8 from "./directives/document.directive";
10
- import * as i9 from "./directives/permission.directive";
11
- import * as i10 from "./components/linked-document/linked-document.component";
12
- import * as i11 from "./components/documents-menu/documents-menu.component";
13
- import * as i12 from "./components/user-list/user-list.component";
14
- import * as i13 from "./components/document-status/document-status.component";
15
- import * as i14 from "@angular/common";
16
- import * as i15 from "primeng/accordion";
17
- import * as i16 from "@angular/common/http";
18
- import * as i17 from "primeng/button";
19
- import * as i18 from "primeng/sidebar";
20
- import * as i19 from "primeng/fileupload";
21
- import * as i20 from "primeng/progressbar";
22
- import * as i21 from "primeng/badge";
23
- import * as i22 from "primeng/listbox";
24
- import * as i23 from "primeng/checkbox";
25
- import * as i24 from "primeng/timeline";
26
- import * as i25 from "primeng/inputtextarea";
27
- import * as i26 from "@angular/forms";
28
- import * as i27 from "ng2-pdf-viewer";
29
- import * as i28 from "primeng/dialog";
30
- import * as i29 from "primeng/dropdown";
31
- import * as i30 from "primeng/inputtext";
32
- import * as i31 from "primeng/menu";
33
- import * as i32 from "primeng/panelmenu";
34
- import * as i33 from "primeng/card";
35
- import * as i34 from "primeng/table";
36
- import * as i35 from "../../Shared/shared.module";
9
+ import * as i8 from "./components/document-history/document-history.component";
10
+ import * as i9 from "./directives/document.directive";
11
+ import * as i10 from "./directives/permission.directive";
12
+ import * as i11 from "./components/linked-document/linked-document.component";
13
+ import * as i12 from "./components/documents-menu/documents-menu.component";
14
+ import * as i13 from "./components/user-list/user-list.component";
15
+ import * as i14 from "./components/document-status/document-status.component";
16
+ import * as i15 from "@angular/common";
17
+ import * as i16 from "primeng/accordion";
18
+ import * as i17 from "@angular/common/http";
19
+ import * as i18 from "primeng/button";
20
+ import * as i19 from "primeng/sidebar";
21
+ import * as i20 from "primeng/fileupload";
22
+ import * as i21 from "primeng/progressbar";
23
+ import * as i22 from "primeng/badge";
24
+ import * as i23 from "primeng/listbox";
25
+ import * as i24 from "primeng/checkbox";
26
+ import * as i25 from "primeng/timeline";
27
+ import * as i26 from "primeng/inputtextarea";
28
+ import * as i27 from "@angular/forms";
29
+ import * as i28 from "ng2-pdf-viewer";
30
+ import * as i29 from "primeng/dialog";
31
+ import * as i30 from "primeng/dropdown";
32
+ import * as i31 from "primeng/inputtext";
33
+ import * as i32 from "primeng/menu";
34
+ import * as i33 from "primeng/panelmenu";
35
+ import * as i34 from "primeng/card";
36
+ import * as i35 from "primeng/table";
37
+ import * as i36 from "../../Shared/shared.module";
37
38
  /**
38
39
  * @module DocumentModule
39
40
  *
@@ -43,6 +44,6 @@ import * as i35 from "../../Shared/shared.module";
43
44
  */
44
45
  export declare class DocumentModule {
45
46
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentModule, never>;
46
- static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentModule, [typeof i1.DocumentContainerComponent, typeof i2.FolderContainerComponent, typeof i3.FolderBlockComponent, typeof i4.DocumentListComponent, typeof i5.DocumentListItemComponent, typeof i6.DocumentUploadComponent, typeof i7.DocumentViewerComponent, typeof i8.DocumentDirective, typeof i9.HasPermissionDirective, typeof i10.LinkedDocumentComponent, typeof i11.DocumentsMenuComponent, typeof i12.UserListComponent, typeof i13.DocumentStatusComponent], [typeof i14.CommonModule, typeof i15.AccordionModule, typeof i16.HttpClientModule, typeof i17.ButtonModule, typeof i18.SidebarModule, typeof i19.FileUploadModule, typeof i20.ProgressBarModule, typeof i21.BadgeModule, typeof i22.ListboxModule, typeof i23.CheckboxModule, typeof i24.TimelineModule, typeof i25.InputTextareaModule, typeof i26.FormsModule, typeof i27.PdfViewerModule, typeof i28.DialogModule, typeof i29.DropdownModule, typeof i30.InputTextModule, typeof i31.MenuModule, typeof i32.PanelMenuModule, typeof i33.CardModule, typeof i34.TableModule, typeof i35.SharedModule], [typeof i9.HasPermissionDirective, typeof i1.DocumentContainerComponent, typeof i7.DocumentViewerComponent, typeof i4.DocumentListComponent, typeof i8.DocumentDirective]>;
47
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentModule, [typeof i1.DocumentContainerComponent, typeof i2.FolderContainerComponent, typeof i3.FolderBlockComponent, typeof i4.DocumentListComponent, typeof i5.DocumentListItemComponent, typeof i6.DocumentUploadComponent, typeof i7.DocumentViewerComponent, typeof i8.DocumentHistoryComponent, typeof i9.DocumentDirective, typeof i10.HasPermissionDirective, typeof i11.LinkedDocumentComponent, typeof i12.DocumentsMenuComponent, typeof i13.UserListComponent, typeof i14.DocumentStatusComponent], [typeof i15.CommonModule, typeof i16.AccordionModule, typeof i17.HttpClientModule, typeof i18.ButtonModule, typeof i19.SidebarModule, typeof i20.FileUploadModule, typeof i21.ProgressBarModule, typeof i22.BadgeModule, typeof i23.ListboxModule, typeof i24.CheckboxModule, typeof i25.TimelineModule, typeof i26.InputTextareaModule, typeof i27.FormsModule, typeof i28.PdfViewerModule, typeof i29.DialogModule, typeof i30.DropdownModule, typeof i31.InputTextModule, typeof i32.MenuModule, typeof i33.PanelMenuModule, typeof i34.CardModule, typeof i35.TableModule, typeof i36.SharedModule], [typeof i10.HasPermissionDirective, typeof i1.DocumentContainerComponent, typeof i7.DocumentViewerComponent, typeof i4.DocumentListComponent, typeof i9.DocumentDirective]>;
47
48
  static ɵinj: i0.ɵɵInjectorDeclaration<DocumentModule>;
48
49
  }
@@ -1,8 +1,12 @@
1
1
  export interface DocumentCategoryStatus {
2
- Pending: number;
3
- Reviewing: number;
4
- Accepted: number;
5
- Rejected: number;
2
+ Pending?: number;
3
+ Reviewing?: number;
4
+ Accepted?: number;
5
+ Rejected?: number;
6
+ pending?: number;
7
+ reviewing?: number;
8
+ approved?: number;
9
+ rejected?: number;
6
10
  }
7
11
  export interface DocumentCategoryItem {
8
12
  _id: string;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Represents a document history item.
3
+ */
4
+ export interface DocumentHistoryItem {
5
+ /**
6
+ * The label/action type (e.g., "Document Uploaded", "Document Rejected", "Document Accepted")
7
+ */
8
+ label: string;
9
+ /**
10
+ * The date and time of the action
11
+ */
12
+ dateTime: string;
13
+ /**
14
+ * Description or comment for the action
15
+ */
16
+ requestDescription: string;
17
+ /**
18
+ * URL of the document (optional)
19
+ */
20
+ documentUrl?: string;
21
+ /**
22
+ * Name of the document (optional)
23
+ */
24
+ docName?: string;
25
+ /**
26
+ * Name of the user who performed the action
27
+ */
28
+ userName: string;
29
+ /**
30
+ * Role of the user who performed the action
31
+ */
32
+ userRole: string;
33
+ actionColor: string;
34
+ actionIcon: string;
35
+ actionIconBgColor: string;
36
+ actionBgColor: string;
37
+ actionBorderColor: string;
38
+ }
39
+ /**
40
+ * Represents a document history section with header and list of items.
41
+ */
42
+ export interface DocumentHistorySection {
43
+ /**
44
+ * The header/title of the section (e.g., "Initial Request", "Document History")
45
+ */
46
+ header: string;
47
+ /**
48
+ * List of history items in this section
49
+ */
50
+ list: DocumentHistoryItem[];
51
+ }
52
+ /**
53
+ * Represents the complete document history response.
54
+ */
55
+ export interface DocumentHistoryResponse {
56
+ /**
57
+ * Array of document history sections
58
+ */
59
+ sections: DocumentHistorySection[];
60
+ }
@@ -0,0 +1,34 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * Service for handling document history styling logic
4
+ */
5
+ export declare class DocumentHistoryStyleService {
6
+ constructor();
7
+ /**
8
+ * Get the appropriate icon class based on the action label
9
+ */
10
+ getActionIcon(label: string): string;
11
+ /**
12
+ * Get the appropriate color class based on the action label
13
+ */
14
+ getActionColor(label: string): string;
15
+ /**
16
+ * Get the appropriate background color class based on the action label
17
+ */
18
+ getActionBgColor(label: string): string;
19
+ /**
20
+ * Get the appropriate border color class based on the action label
21
+ */
22
+ getActionBorderColor(label: string): string;
23
+ /**
24
+ * Get the appropriate icon background color class based on the action label
25
+ */
26
+ getActionIconBgColor(label: string): string;
27
+ /**
28
+ * Check if a section has valid content to display
29
+ */
30
+ checkValidContent(section: any): boolean;
31
+ getAccordionClass(section: any): string;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHistoryStyleService, never>;
33
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentHistoryStyleService>;
34
+ }
@@ -9,6 +9,7 @@ import { FolderBlockModel } from '../models/folder.model';
9
9
  import { DocumentCategory } from '../models/document-category.model';
10
10
  import { UserListModel } from '../models/user-list.model';
11
11
  import { StatusDataModel } from '../models/status-data.model';
12
+ import { DocumentHistorySection } from '../models/document-history.model';
12
13
  import * as i0 from "@angular/core";
13
14
  /**
14
15
  * Service for making HTTP requests related to documents.
@@ -99,6 +100,7 @@ export declare class DocumentHttpService {
99
100
  * @returns {Observable<any>} An observable that emits the filtered document data.
100
101
  */
101
102
  getDocumentsBySelection(contextId: string, menuItem: string | null, userId: string | null, status: string | null, searchKey?: string | null): Observable<any>;
103
+ getDocumentHistory(documentId: string): Observable<DocumentHistorySection[]>;
102
104
  static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHttpService, never>;
103
105
  static ɵprov: i0.ɵɵInjectableDeclaration<DocumentHttpService>;
104
106
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "0.2.36",
3
+ "version": "0.2.39",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"
package/public-api.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export * from './lib/document/document.module';
2
2
  export * from './lib/document/components/document-container/document-container.component';
3
3
  export * from './lib/document/components/document-viewer/document-viewer.component';
4
+ export * from './lib/document/components/document-history/document-history.component';
4
5
  export * from './lib/document/components/document-list/document-list.component';
6
+ export * from './lib/document/models/document-history.model';
5
7
  export * from './lib/document/services/document-table-builder.service';
6
8
  export * from './lib/document/directives/document.directive';
7
9
  export * from './lib/document/directives/permission.directive';