cat-documents-ng 0.4.1 → 0.4.3
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.
- package/Shared/components/table-primary/table-primary.component.d.ts +2 -3
- package/Shared/constant/SHARED.d.ts +2 -0
- package/fesm2022/cat-documents-ng.mjs +517 -169
- package/fesm2022/cat-documents-ng.mjs.map +1 -1
- package/lib/document/components/document-container/document-container.component.d.ts +2 -12
- package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +37 -2
- package/lib/document/components/document-list/document-list.component.d.ts +1 -14
- package/lib/document/services/document-http.service.d.ts +6 -0
- package/lib/document/services/eml-parser.service.d.ts +116 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -6,7 +6,7 @@ import { DocumentStore } from '../../state/document.store';
|
|
|
6
6
|
import { DocumentCategory } from '../../models/document-category.model';
|
|
7
7
|
import { UserListModel } from '../../models/user-list.model';
|
|
8
8
|
import { StatusDataModel } from '../../models/status-data.model';
|
|
9
|
-
import { DocumentListResponse
|
|
9
|
+
import { DocumentListResponse } from '../../models/document-list-response.model';
|
|
10
10
|
import { DocumentHelperService } from '../../services/document.service';
|
|
11
11
|
import { DocumentMenuService } from '../../services/document-menu.service';
|
|
12
12
|
import * as i0 from "@angular/core";
|
|
@@ -49,11 +49,6 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy, On
|
|
|
49
49
|
*/
|
|
50
50
|
contentScrollContainer: ElementRef;
|
|
51
51
|
selectedDocument: EventEmitter<any>;
|
|
52
|
-
documentOpenedInNewTab: EventEmitter<{
|
|
53
|
-
selectedDocument: DocumentListItem;
|
|
54
|
-
contextId: string;
|
|
55
|
-
documentList: DocumentListItem[];
|
|
56
|
-
}>;
|
|
57
52
|
/**
|
|
58
53
|
* Subscription to track selected menu item changes
|
|
59
54
|
*/
|
|
@@ -152,15 +147,10 @@ export declare class DocumentContainerComponent implements OnInit, OnDestroy, On
|
|
|
152
147
|
*/
|
|
153
148
|
setupFilteredDocumentSubscription(): void;
|
|
154
149
|
onDocumentSelected(document: any): void;
|
|
155
|
-
onDocumentOpenedInNewTab(data: {
|
|
156
|
-
selectedDocument: DocumentListItem;
|
|
157
|
-
contextId: string;
|
|
158
|
-
documentList: DocumentListItem[];
|
|
159
|
-
}): void;
|
|
160
150
|
/**
|
|
161
151
|
* Unsubscribe subscription on destroy of component and clean up state.
|
|
162
152
|
*/
|
|
163
153
|
ngOnDestroy(): void;
|
|
164
154
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentContainerComponent, never>;
|
|
165
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentContainerComponent, "lib-document-container", never, { "contextId": { "alias": "contextId"; "required": false; }; }, { "selectedDocument": "selectedDocument";
|
|
155
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentContainerComponent, "lib-document-container", never, { "contextId": { "alias": "contextId"; "required": false; }; }, { "selectedDocument": "selectedDocument"; }, never, ["*"], false, never>;
|
|
166
156
|
}
|
package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { OnChanges, SimpleChanges, OnInit } from '@angular/core';
|
|
2
2
|
import { ExcelParserService, ExcelRowData } from '../../services/excel-parser.service';
|
|
3
3
|
import { CsvParserService, CsvRowData } from '../../services/csv-parser.service';
|
|
4
|
+
import { EmlParserService, ParsedEmailData } from '../../services/eml-parser.service';
|
|
4
5
|
import { DocumentHttpService } from '../../services/document-http.service';
|
|
5
6
|
import { DocumentZoomService } from '../../services/document-zoom.service';
|
|
6
7
|
import { DocumentListItem } from '../../models/document-list-response.model';
|
|
8
|
+
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
7
9
|
import * as i0 from "@angular/core";
|
|
8
10
|
/**
|
|
9
11
|
* Component for viewing different types of document content.
|
|
@@ -14,8 +16,10 @@ import * as i0 from "@angular/core";
|
|
|
14
16
|
export declare class DocumentContentViewerComponent implements OnChanges, OnInit {
|
|
15
17
|
private excelParserService;
|
|
16
18
|
private csvParserService;
|
|
19
|
+
private emlParserService;
|
|
17
20
|
private documentHttpService;
|
|
18
21
|
private zoomService;
|
|
22
|
+
private sanitizer;
|
|
19
23
|
/**
|
|
20
24
|
* The document URL to display
|
|
21
25
|
* @type {string}
|
|
@@ -116,13 +120,31 @@ export declare class DocumentContentViewerComponent implements OnChanges, OnInit
|
|
|
116
120
|
* @type {number}
|
|
117
121
|
*/
|
|
118
122
|
currentZoom: number;
|
|
123
|
+
/**
|
|
124
|
+
* Email data for display
|
|
125
|
+
* @type {ParsedEmailData | null}
|
|
126
|
+
*/
|
|
127
|
+
emailData: ParsedEmailData | null;
|
|
128
|
+
/**
|
|
129
|
+
* Loading state for Email files
|
|
130
|
+
* @type {boolean}
|
|
131
|
+
*/
|
|
132
|
+
isLoadingEmail: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Error state for Email files
|
|
135
|
+
* @type {string | null}
|
|
136
|
+
*/
|
|
137
|
+
emailError: string | null;
|
|
119
138
|
/**
|
|
120
139
|
* Constructor
|
|
121
140
|
* @param {ExcelParserService} excelParserService - Service for parsing Excel files
|
|
122
|
-
* @param {
|
|
141
|
+
* @param {CsvParserService} csvParserService - Service for parsing CSV files
|
|
142
|
+
* @param {EmlParserService} emlParserService - Service for parsing EML files
|
|
143
|
+
* @param {DocumentHttpService} documentHttpService - Service for making HTTP requests for Excel/CSV files
|
|
123
144
|
* @param {DocumentZoomService} zoomService - Service for handling zoom functionality
|
|
145
|
+
* @param {DomSanitizer} sanitizer - Service for sanitizing HTML content
|
|
124
146
|
*/
|
|
125
|
-
constructor(excelParserService: ExcelParserService, csvParserService: CsvParserService, documentHttpService: DocumentHttpService, zoomService: DocumentZoomService);
|
|
147
|
+
constructor(excelParserService: ExcelParserService, csvParserService: CsvParserService, emlParserService: EmlParserService, documentHttpService: DocumentHttpService, zoomService: DocumentZoomService, sanitizer: DomSanitizer);
|
|
126
148
|
/**
|
|
127
149
|
* Computed property to determine if the document is a PDF
|
|
128
150
|
* @type {boolean}
|
|
@@ -256,6 +278,19 @@ export declare class DocumentContentViewerComponent implements OnChanges, OnInit
|
|
|
256
278
|
private isCsvDataValid;
|
|
257
279
|
private getFileExtension;
|
|
258
280
|
get isImage(): boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Loads Email data for display
|
|
283
|
+
*/
|
|
284
|
+
private loadEmailData;
|
|
285
|
+
/**
|
|
286
|
+
* Resets Email data to initial state
|
|
287
|
+
*/
|
|
288
|
+
private resetEmailData;
|
|
289
|
+
/**
|
|
290
|
+
* Gets sanitized HTML for email body
|
|
291
|
+
* @returns {SafeHtml} Sanitized HTML
|
|
292
|
+
*/
|
|
293
|
+
getSafeEmailHtml(): SafeHtml;
|
|
259
294
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentContentViewerComponent, never>;
|
|
260
295
|
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentContentViewerComponent, "document-content-viewer", never, { "documentUrl": { "alias": "documentUrl"; "required": false; }; "contentType": { "alias": "contentType"; "required": false; }; "documentName": { "alias": "documentName"; "required": false; }; "selectedDocument": { "alias": "selectedDocument"; "required": false; }; "contextId": { "alias": "contextId"; "required": false; }; "isFormHide": { "alias": "isFormHide"; "required": false; }; }, {}, never, never, false, never>;
|
|
261
296
|
}
|
|
@@ -127,11 +127,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
|
|
|
127
127
|
*/
|
|
128
128
|
deleteMessage: Message[];
|
|
129
129
|
handleSelectedDocument: EventEmitter<DocumentListItem>;
|
|
130
|
-
handleSelectedDocumentInNewTab: EventEmitter<{
|
|
131
|
-
selectedDocument: DocumentListItem;
|
|
132
|
-
contextId: string;
|
|
133
|
-
documentList: DocumentListItem[];
|
|
134
|
-
}>;
|
|
135
130
|
/**
|
|
136
131
|
* Getter to return category labels as they come from the API
|
|
137
132
|
*/
|
|
@@ -176,14 +171,6 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
|
|
|
176
171
|
* Handles table row click event
|
|
177
172
|
*/
|
|
178
173
|
handleTableRowClick(rowData: any): void;
|
|
179
|
-
/**
|
|
180
|
-
* Handles table row Ctrl+Click event to open document in new tab
|
|
181
|
-
*/
|
|
182
|
-
handleTableRowCtrlClick(rowData: any): void;
|
|
183
|
-
/**
|
|
184
|
-
* Opens the document viewer in a new browser tab
|
|
185
|
-
*/
|
|
186
|
-
private openDocumentInNewTab;
|
|
187
174
|
/**
|
|
188
175
|
* Handles the delete action from the table component
|
|
189
176
|
* @param {any} rowData - The row data containing the document to delete
|
|
@@ -302,5 +289,5 @@ export declare class DocumentListComponent implements OnInit, OnDestroy, OnChang
|
|
|
302
289
|
*/
|
|
303
290
|
ngOnDestroy(): void;
|
|
304
291
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentListComponent, never>;
|
|
305
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "selectedMenuItemId": { "alias": "selectedMenuItemId"; "required": false; }; "navigationInfo": { "alias": "navigationInfo"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, { "handleSelectedDocument": "handleSelectedDocument";
|
|
292
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentListComponent, "lib-document-list", never, { "contextId": { "alias": "contextId"; "required": false; }; "documentListResponse": { "alias": "documentListResponse"; "required": false; }; "selectedMenuItemId": { "alias": "selectedMenuItemId"; "required": false; }; "navigationInfo": { "alias": "navigationInfo"; "required": false; }; "documentList": { "alias": "documentList"; "required": false; }; }, { "handleSelectedDocument": "handleSelectedDocument"; }, never, ["*"], false, never>;
|
|
306
293
|
}
|
|
@@ -161,6 +161,12 @@ export declare class DocumentHttpService {
|
|
|
161
161
|
* @returns {Observable<string>} Observable that emits the file data as string
|
|
162
162
|
*/
|
|
163
163
|
downloadCsvFile(documentUrl: string): Observable<string>;
|
|
164
|
+
/**
|
|
165
|
+
* Downloads an email file (EML) with appropriate handling for different storage types
|
|
166
|
+
* @param documentUrl - URL of the email file
|
|
167
|
+
* @returns Observable of file content as text
|
|
168
|
+
*/
|
|
169
|
+
downloadEmailFile(documentUrl: string): Observable<string>;
|
|
164
170
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHttpService, never>;
|
|
165
171
|
static ɵprov: i0.ɵɵInjectableDeclaration<DocumentHttpService>;
|
|
166
172
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { HttpClient } from '@angular/common/http';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* Interface for parsed email data
|
|
7
|
+
*/
|
|
8
|
+
export interface ParsedEmailData {
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
cc?: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
date: string;
|
|
14
|
+
body: string;
|
|
15
|
+
isHtml: boolean;
|
|
16
|
+
attachments?: EmailAttachment[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Interface for email attachments
|
|
20
|
+
*/
|
|
21
|
+
export interface EmailAttachment {
|
|
22
|
+
filename: string;
|
|
23
|
+
contentType: string;
|
|
24
|
+
size: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Service for parsing EML (email message) files
|
|
28
|
+
* Handles both plain text and HTML email content
|
|
29
|
+
*/
|
|
30
|
+
export declare class EmlParserService {
|
|
31
|
+
private sanitizer;
|
|
32
|
+
private http;
|
|
33
|
+
constructor(sanitizer: DomSanitizer, http: HttpClient);
|
|
34
|
+
/**
|
|
35
|
+
* Parses EML file content
|
|
36
|
+
* @param emlContent - Raw EML file content as string
|
|
37
|
+
* @returns Parsed email data
|
|
38
|
+
*/
|
|
39
|
+
parseEmlData(emlContent: string): ParsedEmailData | null;
|
|
40
|
+
/**
|
|
41
|
+
* Parses email headers from EML content
|
|
42
|
+
* @param lines - Lines of the EML file
|
|
43
|
+
* @returns Object containing parsed headers
|
|
44
|
+
*/
|
|
45
|
+
private parseHeaders;
|
|
46
|
+
/**
|
|
47
|
+
* Parses the email body from EML content
|
|
48
|
+
* @param lines - Lines of the EML file
|
|
49
|
+
* @returns Object containing body content and format information
|
|
50
|
+
*/
|
|
51
|
+
private parseBody;
|
|
52
|
+
/**
|
|
53
|
+
* Extracts body from multipart email
|
|
54
|
+
* @param content - Email content
|
|
55
|
+
* @param boundary - Multipart boundary string
|
|
56
|
+
* @param preferredType - Preferred content type
|
|
57
|
+
* @returns Array of body lines
|
|
58
|
+
*/
|
|
59
|
+
private extractMultipartBody;
|
|
60
|
+
/**
|
|
61
|
+
* Decodes quoted-printable encoded content
|
|
62
|
+
* @param content - Quoted-printable encoded string
|
|
63
|
+
* @returns Decoded string
|
|
64
|
+
*/
|
|
65
|
+
private decodeQuotedPrintable;
|
|
66
|
+
/**
|
|
67
|
+
* Sanitizes HTML content for safe display
|
|
68
|
+
* @param html - Raw HTML content
|
|
69
|
+
* @returns Sanitized HTML
|
|
70
|
+
*/
|
|
71
|
+
private sanitizeHtmlContent;
|
|
72
|
+
/**
|
|
73
|
+
* Parses attachment information from EML content
|
|
74
|
+
* @param emlContent - Raw EML content
|
|
75
|
+
* @returns Array of attachment information
|
|
76
|
+
*/
|
|
77
|
+
private parseAttachments;
|
|
78
|
+
/**
|
|
79
|
+
* Cleans and formats email addresses
|
|
80
|
+
* @param email - Raw email address string
|
|
81
|
+
* @returns Cleaned email address
|
|
82
|
+
*/
|
|
83
|
+
private cleanEmailAddress;
|
|
84
|
+
/**
|
|
85
|
+
* Decodes encoded email headers (RFC 2047)
|
|
86
|
+
* @param header - Encoded header string
|
|
87
|
+
* @returns Decoded header string
|
|
88
|
+
*/
|
|
89
|
+
private decodeHeader;
|
|
90
|
+
/**
|
|
91
|
+
* Formats email date to readable format
|
|
92
|
+
* @param dateStr - Raw date string from email
|
|
93
|
+
* @returns Formatted date string
|
|
94
|
+
*/
|
|
95
|
+
private formatDate;
|
|
96
|
+
/**
|
|
97
|
+
* Sanitizes HTML for Angular display
|
|
98
|
+
* @param html - HTML string
|
|
99
|
+
* @returns SafeHtml for Angular templates
|
|
100
|
+
*/
|
|
101
|
+
getSafeHtml(html: string): SafeHtml;
|
|
102
|
+
/**
|
|
103
|
+
* Downloads and parses an EML file from a URL
|
|
104
|
+
* @param documentUrl - URL of the EML file
|
|
105
|
+
* @returns Observable of parsed email data
|
|
106
|
+
*/
|
|
107
|
+
loadAndParseEmail(documentUrl: string): Observable<ParsedEmailData>;
|
|
108
|
+
/**
|
|
109
|
+
* Downloads an email file with appropriate authentication handling
|
|
110
|
+
* @param documentUrl - URL of the email file
|
|
111
|
+
* @returns Observable of file content as text
|
|
112
|
+
*/
|
|
113
|
+
private downloadEmailFile;
|
|
114
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EmlParserService, never>;
|
|
115
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<EmlParserService>;
|
|
116
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -14,6 +14,9 @@ export * from './lib/document/models/uploaded-file-response.model';
|
|
|
14
14
|
export * from './lib/document/services/document-table-builder.service';
|
|
15
15
|
export * from './lib/document/services/document-content-type.service';
|
|
16
16
|
export * from './lib/document/services/document-zoom.service';
|
|
17
|
+
export * from './lib/document/services/eml-parser.service';
|
|
18
|
+
export * from './lib/document/services/excel-parser.service';
|
|
19
|
+
export * from './lib/document/services/csv-parser.service';
|
|
17
20
|
export * from './lib/document/directives/document.directive';
|
|
18
21
|
export * from './lib/document/directives/permission.directive';
|
|
19
22
|
export * from './Shared/components/confirmation-dialog/confirmation-dialog.component';
|