cat-documents-ng 0.3.20 → 0.3.22
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/constant/SHARED.d.ts +13 -0
- package/fesm2022/cat-documents-ng.mjs +515 -137
- package/fesm2022/cat-documents-ng.mjs.map +1 -1
- package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +68 -8
- package/lib/document/services/csv-parser.service.d.ts +88 -0
- package/lib/document/services/document-http.service.d.ts +15 -0
- package/package.json +1 -1
package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OnChanges, SimpleChanges, OnInit } from '@angular/core';
|
|
2
|
-
import { HttpClient } from '@angular/common/http';
|
|
3
2
|
import { ExcelParserService, ExcelRowData } from '../../services/excel-parser.service';
|
|
3
|
+
import { CsvParserService, CsvRowData } from '../../services/csv-parser.service';
|
|
4
|
+
import { DocumentHttpService } from '../../services/document-http.service';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
/**
|
|
6
7
|
* Component for viewing different types of document content.
|
|
@@ -9,8 +10,9 @@ import * as i0 from "@angular/core";
|
|
|
9
10
|
* @typedef {DocumentContentViewerComponent}
|
|
10
11
|
*/
|
|
11
12
|
export declare class DocumentContentViewerComponent implements OnChanges, OnInit {
|
|
12
|
-
private http;
|
|
13
13
|
private excelParserService;
|
|
14
|
+
private csvParserService;
|
|
15
|
+
private documentHttpService;
|
|
14
16
|
/**
|
|
15
17
|
* The document URL to display
|
|
16
18
|
* @type {string}
|
|
@@ -61,11 +63,47 @@ export declare class DocumentContentViewerComponent implements OnChanges, OnInit
|
|
|
61
63
|
* @type {string | null}
|
|
62
64
|
*/
|
|
63
65
|
excelError: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Loading state specifically for Word documents
|
|
68
|
+
* @type {boolean}
|
|
69
|
+
*/
|
|
70
|
+
isLoadingWordDocument: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* CSV data for display
|
|
73
|
+
* @type {any}
|
|
74
|
+
*/
|
|
75
|
+
csvData: any;
|
|
76
|
+
/**
|
|
77
|
+
* Parsed CSV data as table rows
|
|
78
|
+
* @type {any[][]}
|
|
79
|
+
*/
|
|
80
|
+
csvTableData: any[][];
|
|
81
|
+
/**
|
|
82
|
+
* Enhanced CSV data with styling information
|
|
83
|
+
* @type {CsvRowData[]}
|
|
84
|
+
*/
|
|
85
|
+
csvStyledData: CsvRowData[];
|
|
86
|
+
/**
|
|
87
|
+
* Loading state for CSV files
|
|
88
|
+
* @type {boolean}
|
|
89
|
+
*/
|
|
90
|
+
isLoadingCsv: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Error state for CSV files
|
|
93
|
+
* @type {string | null}
|
|
94
|
+
*/
|
|
95
|
+
csvError: string | null;
|
|
64
96
|
/**
|
|
65
97
|
* Configuration for the document viewer
|
|
66
98
|
* @type {any}
|
|
67
99
|
*/
|
|
68
100
|
docViewerConfig: any;
|
|
101
|
+
/**
|
|
102
|
+
* Constructor
|
|
103
|
+
* @param {ExcelParserService} excelParserService - Service for parsing Excel files
|
|
104
|
+
* @param {DocumentHttpService} documentHttpService - Service for making HTTP requests with authentication
|
|
105
|
+
*/
|
|
106
|
+
constructor(excelParserService: ExcelParserService, csvParserService: CsvParserService, documentHttpService: DocumentHttpService);
|
|
69
107
|
/**
|
|
70
108
|
* Computed property to determine if the document is an image
|
|
71
109
|
* @type {boolean}
|
|
@@ -121,6 +159,11 @@ export declare class DocumentContentViewerComponent implements OnChanges, OnInit
|
|
|
121
159
|
* @type {ExcelRowData[]}
|
|
122
160
|
*/
|
|
123
161
|
get safeExcelStyledData(): ExcelRowData[];
|
|
162
|
+
/**
|
|
163
|
+
* Safely gets the styled CSV data for display
|
|
164
|
+
* @type {CsvRowData[]}
|
|
165
|
+
*/
|
|
166
|
+
get safeCsvStyledData(): CsvRowData[];
|
|
124
167
|
/**
|
|
125
168
|
* Handles changes to input properties
|
|
126
169
|
* @param {SimpleChanges} changes - The changes object
|
|
@@ -157,13 +200,30 @@ export declare class DocumentContentViewerComponent implements OnChanges, OnInit
|
|
|
157
200
|
*/
|
|
158
201
|
private resetExcelData;
|
|
159
202
|
/**
|
|
160
|
-
*
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
*
|
|
203
|
+
* Loads CSV data for display
|
|
204
|
+
*/
|
|
205
|
+
private loadCsvData;
|
|
206
|
+
/**
|
|
207
|
+
* Parses CSV data using the service
|
|
208
|
+
* @param {string} data - CSV file data
|
|
209
|
+
*/
|
|
210
|
+
private parseCsvData;
|
|
211
|
+
/**
|
|
212
|
+
* Resets CSV data to initial state
|
|
213
|
+
*/
|
|
214
|
+
private resetCsvData;
|
|
215
|
+
/**
|
|
216
|
+
* TrackBy function for CSV cells to improve performance
|
|
217
|
+
* @param index - Cell index
|
|
218
|
+
* @param cell - Cell object
|
|
219
|
+
* @returns Unique identifier for the cell
|
|
220
|
+
*/
|
|
221
|
+
trackByCell(index: number, cell: any): any;
|
|
222
|
+
/**
|
|
223
|
+
* Checks if CSV data is valid and ready for display
|
|
224
|
+
* @returns {boolean} True if CSV data is valid
|
|
165
225
|
*/
|
|
166
|
-
|
|
226
|
+
private isCsvDataValid;
|
|
167
227
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentContentViewerComponent, never>;
|
|
168
228
|
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentContentViewerComponent, "document-content-viewer", never, { "documentUrl": { "alias": "documentUrl"; "required": false; }; "contentType": { "alias": "contentType"; "required": false; }; "documentName": { "alias": "documentName"; "required": false; }; }, {}, never, never, false, never>;
|
|
169
229
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export interface CsvRowData {
|
|
3
|
+
cells: Array<{
|
|
4
|
+
value: string;
|
|
5
|
+
isHeader?: boolean;
|
|
6
|
+
style?: any;
|
|
7
|
+
}>;
|
|
8
|
+
}
|
|
9
|
+
export interface ParsedCsvData {
|
|
10
|
+
headers: string[];
|
|
11
|
+
rows: string[][];
|
|
12
|
+
styledData: CsvRowData[];
|
|
13
|
+
totalRows: number;
|
|
14
|
+
totalColumns: number;
|
|
15
|
+
hasHeaders: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare class CsvParserService {
|
|
18
|
+
constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Parses CSV data from a string
|
|
21
|
+
* @param csvContent - The CSV content as a string
|
|
22
|
+
* @param options - Parsing options
|
|
23
|
+
* @returns Parsed CSV data
|
|
24
|
+
*/
|
|
25
|
+
parseCsvData(csvContent: string, options?: {
|
|
26
|
+
delimiter?: string;
|
|
27
|
+
hasHeaders?: boolean;
|
|
28
|
+
maxRows?: number;
|
|
29
|
+
}): ParsedCsvData;
|
|
30
|
+
/**
|
|
31
|
+
* Parses a single CSV line with proper handling of quoted fields
|
|
32
|
+
* @param line - Single CSV line
|
|
33
|
+
* @param delimiter - Field delimiter
|
|
34
|
+
* @returns Array of field values
|
|
35
|
+
*/
|
|
36
|
+
private parseCsvLine;
|
|
37
|
+
/**
|
|
38
|
+
* Creates styled data for display in tables
|
|
39
|
+
* @param headers - Column headers
|
|
40
|
+
* @param rows - Data rows
|
|
41
|
+
* @param hasHeaders - Whether the data has headers
|
|
42
|
+
* @returns Styled data array
|
|
43
|
+
*/
|
|
44
|
+
private createStyledData;
|
|
45
|
+
/**
|
|
46
|
+
* Creates empty CSV data structure
|
|
47
|
+
* @returns Empty CSV data
|
|
48
|
+
*/
|
|
49
|
+
private createEmptyCsvData;
|
|
50
|
+
/**
|
|
51
|
+
* Validates CSV content
|
|
52
|
+
* @param csvContent - CSV content to validate
|
|
53
|
+
* @returns Validation result
|
|
54
|
+
*/
|
|
55
|
+
validateCsvContent(csvContent: string): {
|
|
56
|
+
isValid: boolean;
|
|
57
|
+
errors: string[];
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Counts columns in a CSV line
|
|
61
|
+
* @param line - CSV line
|
|
62
|
+
* @returns Number of columns
|
|
63
|
+
*/
|
|
64
|
+
private countColumns;
|
|
65
|
+
/**
|
|
66
|
+
* Exports data to CSV format
|
|
67
|
+
* @param data - Data to export
|
|
68
|
+
* @param headers - Column headers
|
|
69
|
+
* @param delimiter - Field delimiter
|
|
70
|
+
* @returns CSV string
|
|
71
|
+
*/
|
|
72
|
+
exportToCsv(data: string[][], headers: string[], delimiter?: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Escapes a CSV field value
|
|
75
|
+
* @param field - Field value to escape
|
|
76
|
+
* @returns Escaped field value
|
|
77
|
+
*/
|
|
78
|
+
private escapeCsvField;
|
|
79
|
+
/**
|
|
80
|
+
* Gets CSV preview (first few rows)
|
|
81
|
+
* @param csvContent - Full CSV content
|
|
82
|
+
* @param maxRows - Maximum number of rows to preview
|
|
83
|
+
* @returns Preview data
|
|
84
|
+
*/
|
|
85
|
+
getCsvPreview(csvContent: string, maxRows?: number): ParsedCsvData;
|
|
86
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CsvParserService, never>;
|
|
87
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CsvParserService>;
|
|
88
|
+
}
|
|
@@ -13,6 +13,7 @@ import { DocumentHistorySection } from '../models/document-history.model';
|
|
|
13
13
|
import * as i0 from "@angular/core";
|
|
14
14
|
/**
|
|
15
15
|
* Service for making HTTP requests related to documents.
|
|
16
|
+
* Authentication is handled automatically by the HTTP interceptor in the main project.
|
|
16
17
|
* @class DocumentHttpService
|
|
17
18
|
* @typedef {DocumentHttpService}
|
|
18
19
|
*/
|
|
@@ -146,6 +147,20 @@ export declare class DocumentHttpService {
|
|
|
146
147
|
* @returns {Observable<any>} Observable that emits the delete response
|
|
147
148
|
*/
|
|
148
149
|
deleteDocument(documentId: string, contextId: string): Observable<any>;
|
|
150
|
+
/**
|
|
151
|
+
* Downloads an Excel file with proper authentication headers
|
|
152
|
+
* Authentication is handled automatically by the HTTP interceptor
|
|
153
|
+
* @param {string} documentUrl - The URL of the Excel file to download
|
|
154
|
+
* @returns {Observable<ArrayBuffer>} Observable that emits the file data as ArrayBuffer
|
|
155
|
+
*/
|
|
156
|
+
downloadExcelFile(documentUrl: string): Observable<ArrayBuffer>;
|
|
157
|
+
/**
|
|
158
|
+
* Downloads a CSV file with proper authentication headers
|
|
159
|
+
* Authentication is handled automatically by the HTTP interceptor
|
|
160
|
+
* @param {string} documentUrl - The URL of the CSV file to download
|
|
161
|
+
* @returns {Observable<string>} Observable that emits the file data as string
|
|
162
|
+
*/
|
|
163
|
+
downloadCsvFile(documentUrl: string): Observable<string>;
|
|
149
164
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentHttpService, never>;
|
|
150
165
|
static ɵprov: i0.ɵɵInjectableDeclaration<DocumentHttpService>;
|
|
151
166
|
}
|