cat-documents-ng 1.0.6 → 1.0.7
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/README.md +322 -322
- package/Shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +44 -0
- package/Shared/components/table-primary/table-primary.component.d.ts +31 -0
- package/Shared/components/table-primary/table-primary.model.d.ts +19 -0
- package/Shared/constant/ERROR.d.ts +52 -0
- package/Shared/constant/SHARED.d.ts +546 -0
- package/{src/Shared/constant/URLS.ts → Shared/constant/URLS.d.ts} +25 -31
- package/Shared/services/app-config.service.d.ts +51 -0
- package/{src/Shared/services/global-error.handler.ts → Shared/services/global-error.handler.d.ts} +9 -11
- package/Shared/services/session.service.d.ts +46 -0
- package/Shared/shared.module.d.ts +14 -0
- package/fesm2022/cat-documents-ng.mjs +11405 -0
- package/fesm2022/cat-documents-ng.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/document/components/document-actions/document-actions.component.d.ts +78 -0
- package/lib/document/components/document-container/document-container.component.d.ts +162 -0
- package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +291 -0
- package/lib/document/components/document-history/document-history.component.d.ts +160 -0
- package/lib/document/components/document-list/document-list.component.d.ts +299 -0
- package/lib/document/components/document-list-item/document-list-item.component.d.ts +28 -0
- package/lib/document/components/document-search/document-search.component.d.ts +77 -0
- package/lib/document/components/document-status/document-status.component.d.ts +24 -0
- package/lib/document/components/document-upload/document-upload.component.d.ts +321 -0
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +137 -0
- package/lib/document/components/document-zoom-controls/document-zoom-controls.component.d.ts +33 -0
- package/lib/document/components/documents-menu/documents-menu.component.d.ts +110 -0
- package/{src/lib/document/components/folder-block/folder-block.component.ts → lib/document/components/folder-block/folder-block.component.d.ts} +12 -28
- package/lib/document/components/folder-container/folder-container.component.d.ts +162 -0
- package/lib/document/components/linked-document/linked-document.component.d.ts +39 -0
- package/lib/document/components/request-document/request-document.component.d.ts +69 -0
- package/lib/document/components/sidebar/sidebar.component.d.ts +109 -0
- package/lib/document/components/user-list/user-list.component.d.ts +34 -0
- package/lib/document/constant/DOCUMENT_HISTORY.d.ts +41 -0
- package/lib/document/directives/document.directive.d.ts +20 -0
- package/lib/document/directives/permission.directive.d.ts +38 -0
- package/lib/document/document.module.d.ts +60 -0
- package/{src/lib/document/models/document-alert.model.ts → lib/document/models/document-alert.model.d.ts} +4 -11
- package/lib/document/models/document-category.model.d.ts +24 -0
- package/lib/document/models/document-history.model.d.ts +94 -0
- package/lib/document/models/document-list-response.model.d.ts +33 -0
- package/lib/document/models/document-type.model.d.ts +37 -0
- package/lib/document/models/document.model.d.ts +44 -0
- package/{src/lib/document/models/folder.model.ts → lib/document/models/folder.model.d.ts} +4 -10
- package/lib/document/models/status-data.model.d.ts +27 -0
- package/lib/document/models/uploaded-file-response.model.d.ts +7 -0
- package/lib/document/models/user-list.model.d.ts +8 -0
- package/lib/document/services/csv-parser.service.d.ts +88 -0
- package/lib/document/services/document-actions.service.d.ts +48 -0
- package/lib/document/services/document-content-type.service.d.ts +85 -0
- package/lib/document/services/document-history-style.service.d.ts +34 -0
- package/lib/document/services/document-history.service.d.ts +42 -0
- package/lib/document/services/document-http.service.d.ts +179 -0
- package/lib/document/services/document-list.service.d.ts +74 -0
- package/lib/document/services/document-menu.service.d.ts +122 -0
- package/lib/document/services/document-scroll.service.d.ts +55 -0
- package/lib/document/services/document-table-builder.service.d.ts +38 -0
- package/lib/document/services/document-upload-business.service.d.ts +107 -0
- package/lib/document/services/document-upload-data.service.d.ts +40 -0
- package/lib/document/services/document-upload-form.service.d.ts +41 -0
- package/lib/document/services/document-upload.service.d.ts +99 -0
- package/lib/document/services/document-viewer.service.d.ts +97 -0
- package/lib/document/services/document-zoom.service.d.ts +81 -0
- package/lib/document/services/document.service.d.ts +161 -0
- package/lib/document/services/eml-parser.service.d.ts +116 -0
- package/lib/document/services/excel-parser.service.d.ts +169 -0
- package/lib/document/services/file-format.service.d.ts +34 -0
- package/lib/document/services/status-calculator.service.d.ts +20 -0
- package/lib/document/services/user-list.service.d.ts +29 -0
- package/lib/document/state/document.query.d.ts +243 -0
- package/{src/lib/document/state/document.service.ts → lib/document/state/document.service.d.ts} +15 -46
- package/lib/document/state/document.state.d.ts +61 -0
- package/lib/document/state/document.store.d.ts +56 -0
- package/package.json +11 -5
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/ng-package.json +0 -10
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.html +0 -3
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.scss +0 -13
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.spec.ts +0 -70
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +0 -133
- package/src/Shared/components/table-primary/table-primary.component.html +0 -66
- package/src/Shared/components/table-primary/table-primary.component.scss +0 -227
- package/src/Shared/components/table-primary/table-primary.component.spec.ts +0 -23
- package/src/Shared/components/table-primary/table-primary.component.ts +0 -143
- package/src/Shared/components/table-primary/table-primary.model.ts +0 -21
- package/src/Shared/constant/ERROR.ts +0 -55
- package/src/Shared/constant/PERMISSIONS.ts +0 -17
- package/src/Shared/constant/SHARED.ts +0 -936
- package/src/Shared/services/app-config.service.spec.ts +0 -19
- package/src/Shared/services/app-config.service.ts +0 -73
- package/src/Shared/services/session.service.spec.ts +0 -16
- package/src/Shared/services/session.service.ts +0 -76
- package/src/Shared/shared.module.ts +0 -25
- package/src/lib/document/components/csv-viewer/csv-viewer.component.ts +0 -1
- package/src/lib/document/components/document-actions/document-actions.component.html +0 -59
- package/src/lib/document/components/document-actions/document-actions.component.scss +0 -362
- package/src/lib/document/components/document-actions/document-actions.component.spec.ts +0 -297
- package/src/lib/document/components/document-actions/document-actions.component.ts +0 -163
- package/src/lib/document/components/document-container/document-container.component.html +0 -36
- package/src/lib/document/components/document-container/document-container.component.scss +0 -144
- package/src/lib/document/components/document-container/document-container.component.spec.ts +0 -110
- package/src/lib/document/components/document-container/document-container.component.ts +0 -363
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.html +0 -332
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.scss +0 -1877
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.spec.ts +0 -258
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.ts +0 -664
- package/src/lib/document/components/document-history/document-history.component.html +0 -96
- package/src/lib/document/components/document-history/document-history.component.scss +0 -392
- package/src/lib/document/components/document-history/document-history.component.spec.ts +0 -93
- package/src/lib/document/components/document-history/document-history.component.ts +0 -373
- package/src/lib/document/components/document-list/document-list.component.html +0 -46
- package/src/lib/document/components/document-list/document-list.component.scss +0 -513
- package/src/lib/document/components/document-list/document-list.component.spec.ts +0 -486
- package/src/lib/document/components/document-list/document-list.component.ts +0 -682
- package/src/lib/document/components/document-list-item/document-list-item.component.html +0 -36
- package/src/lib/document/components/document-list-item/document-list-item.component.scss +0 -34
- package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +0 -75
- package/src/lib/document/components/document-list-item/document-list-item.component.ts +0 -40
- package/src/lib/document/components/document-search/document-search.component.html +0 -64
- package/src/lib/document/components/document-search/document-search.component.scss +0 -206
- package/src/lib/document/components/document-search/document-search.component.spec.ts +0 -82
- package/src/lib/document/components/document-search/document-search.component.ts +0 -163
- package/src/lib/document/components/document-status/document-status.component.html +0 -31
- package/src/lib/document/components/document-status/document-status.component.scss +0 -192
- package/src/lib/document/components/document-status/document-status.component.spec.ts +0 -23
- package/src/lib/document/components/document-status/document-status.component.ts +0 -87
- package/src/lib/document/components/document-upload/document-upload.component.html +0 -160
- package/src/lib/document/components/document-upload/document-upload.component.scss +0 -235
- package/src/lib/document/components/document-upload/document-upload.component.spec.ts +0 -95
- package/src/lib/document/components/document-upload/document-upload.component.ts +0 -668
- package/src/lib/document/components/document-viewer/document-viewer.component.html +0 -50
- package/src/lib/document/components/document-viewer/document-viewer.component.scss +0 -187
- package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +0 -79
- package/src/lib/document/components/document-viewer/document-viewer.component.ts +0 -261
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html +0 -48
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.scss +0 -320
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.spec.ts +0 -59
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.ts +0 -150
- package/src/lib/document/components/documents-menu/documents-menu.component.html +0 -44
- package/src/lib/document/components/documents-menu/documents-menu.component.scss +0 -363
- package/src/lib/document/components/documents-menu/documents-menu.component.spec.ts +0 -23
- package/src/lib/document/components/documents-menu/documents-menu.component.ts +0 -316
- package/src/lib/document/components/folder-block/folder-block.component.html +0 -46
- package/src/lib/document/components/folder-block/folder-block.component.scss +0 -9
- package/src/lib/document/components/folder-block/folder-block.component.spec.ts +0 -70
- package/src/lib/document/components/folder-container/folder-container.component.html +0 -56
- package/src/lib/document/components/folder-container/folder-container.component.scss +0 -20
- package/src/lib/document/components/folder-container/folder-container.component.spec.ts +0 -27
- package/src/lib/document/components/folder-container/folder-container.component.ts +0 -328
- package/src/lib/document/components/linked-document/linked-document.component.html +0 -23
- package/src/lib/document/components/linked-document/linked-document.component.scss +0 -10
- package/src/lib/document/components/linked-document/linked-document.component.spec.ts +0 -61
- package/src/lib/document/components/linked-document/linked-document.component.ts +0 -49
- package/src/lib/document/components/request-document/request-document.component.html +0 -86
- package/src/lib/document/components/request-document/request-document.component.scss +0 -16
- package/src/lib/document/components/request-document/request-document.component.ts +0 -278
- package/src/lib/document/components/sidebar/sidebar.component.html +0 -75
- package/src/lib/document/components/sidebar/sidebar.component.scss +0 -157
- package/src/lib/document/components/sidebar/sidebar.component.spec.ts +0 -114
- package/src/lib/document/components/sidebar/sidebar.component.ts +0 -223
- package/src/lib/document/components/user-list/user-list.component.html +0 -33
- package/src/lib/document/components/user-list/user-list.component.scss +0 -118
- package/src/lib/document/components/user-list/user-list.component.spec.ts +0 -23
- package/src/lib/document/components/user-list/user-list.component.ts +0 -181
- package/src/lib/document/constant/DOCUMENT_HISTORY.ts +0 -52
- package/src/lib/document/directives/document.directive.ts +0 -32
- package/src/lib/document/directives/permission.directive.spec.ts +0 -0
- package/src/lib/document/directives/permission.directive.ts +0 -72
- package/src/lib/document/document.module.ts +0 -351
- package/src/lib/document/models/document-category.model.ts +0 -30
- package/src/lib/document/models/document-history.model.ts +0 -109
- package/src/lib/document/models/document-list-response.model.ts +0 -37
- package/src/lib/document/models/document-type.model.ts +0 -44
- package/src/lib/document/models/document.model.ts +0 -53
- package/src/lib/document/models/status-data.model.ts +0 -31
- package/src/lib/document/models/uploaded-file-response.model.ts +0 -7
- package/src/lib/document/models/user-list.model.ts +0 -10
- package/src/lib/document/services/csv-parser.service.spec.ts +0 -97
- package/src/lib/document/services/csv-parser.service.ts +0 -303
- package/src/lib/document/services/document-actions.service.ts +0 -125
- package/src/lib/document/services/document-content-type.service.ts +0 -193
- package/src/lib/document/services/document-history-style.service.ts +0 -138
- package/src/lib/document/services/document-history.service.ts +0 -129
- package/src/lib/document/services/document-http.service.spec.ts +0 -119
- package/src/lib/document/services/document-http.service.ts +0 -497
- package/src/lib/document/services/document-list.service.ts +0 -195
- package/src/lib/document/services/document-menu.service.ts +0 -277
- package/src/lib/document/services/document-scroll.service.ts +0 -138
- package/src/lib/document/services/document-severity.service.ts +0 -98
- package/src/lib/document/services/document-table-builder.service.ts +0 -82
- package/src/lib/document/services/document-upload-business.service.ts +0 -326
- package/src/lib/document/services/document-upload-data.service.ts +0 -82
- package/src/lib/document/services/document-upload-form.service.ts +0 -149
- package/src/lib/document/services/document-upload.service.spec.ts +0 -99
- package/src/lib/document/services/document-upload.service.ts +0 -209
- package/src/lib/document/services/document-viewer.service.ts +0 -279
- package/src/lib/document/services/document-zoom.service.spec.ts +0 -56
- package/src/lib/document/services/document-zoom.service.ts +0 -164
- package/src/lib/document/services/document.service.ts +0 -356
- package/src/lib/document/services/eml-parser.service.ts +0 -444
- package/src/lib/document/services/excel-parser.service.spec.ts +0 -66
- package/src/lib/document/services/excel-parser.service.ts +0 -483
- package/src/lib/document/services/file-format.service.spec.ts +0 -16
- package/src/lib/document/services/file-format.service.ts +0 -63
- package/src/lib/document/services/status-calculator.service.ts +0 -44
- package/src/lib/document/services/user-list.service.ts +0 -77
- package/src/lib/document/state/document.query.ts +0 -378
- package/src/lib/document/state/document.state.ts +0 -100
- package/src/lib/document/state/document.store.ts +0 -200
- package/tsconfig.lib.json +0 -15
- package/tsconfig.lib.prod.json +0 -11
- package/tsconfig.spec.json +0 -15
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import * as XLSX from 'xlsx';
|
|
3
|
-
import { SHARED } from '../../../Shared/constant/SHARED';
|
|
4
|
-
/**
|
|
5
|
-
* Interface for Excel cell styling information
|
|
6
|
-
*/
|
|
7
|
-
export interface ExcelCellStyle {
|
|
8
|
-
backgroundColor?: string;
|
|
9
|
-
fontColor?: string;
|
|
10
|
-
bold?: boolean;
|
|
11
|
-
italic?: boolean;
|
|
12
|
-
border?: {
|
|
13
|
-
top?: string;
|
|
14
|
-
bottom?: string;
|
|
15
|
-
left?: string;
|
|
16
|
-
right?: string;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Interface for Excel cell data with styling
|
|
22
|
-
*/
|
|
23
|
-
export interface ExcelCellData {
|
|
24
|
-
value: any;
|
|
25
|
-
style?: ExcelCellStyle;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Interface for Excel row data
|
|
30
|
-
*/
|
|
31
|
-
export interface ExcelRowData {
|
|
32
|
-
cells: ExcelCellData[];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Interface for parsed Excel data
|
|
37
|
-
*/
|
|
38
|
-
export interface ParsedExcelData {
|
|
39
|
-
sheets: string[];
|
|
40
|
-
currentSheet: string;
|
|
41
|
-
styledData: ExcelRowData[];
|
|
42
|
-
tableData: any[][];
|
|
43
|
-
hasStyling: boolean;
|
|
44
|
-
workbook: XLSX.WorkBook;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Service for parsing Excel files and extracting styling information
|
|
49
|
-
*/
|
|
50
|
-
@Injectable({
|
|
51
|
-
providedIn: 'root'
|
|
52
|
-
})
|
|
53
|
-
export class ExcelParserService {
|
|
54
|
-
|
|
55
|
-
private workbookColors: { [key: number]: string } = {};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Parses Excel data from ArrayBuffer
|
|
59
|
-
*/
|
|
60
|
-
parseExcelData(data: ArrayBuffer): ParsedExcelData | null {
|
|
61
|
-
try {
|
|
62
|
-
const workbook = this.createWorkbook(data);
|
|
63
|
-
|
|
64
|
-
// Extract color palette from workbook
|
|
65
|
-
this.extractWorkbookColors(workbook);
|
|
66
|
-
|
|
67
|
-
const sheets = this.getSheetNames(workbook);
|
|
68
|
-
const currentSheet = this.getFirstSheet(sheets);
|
|
69
|
-
const styledData = this.parseSheetData(workbook, currentSheet);
|
|
70
|
-
const tableData = this.convertToLegacyFormat(styledData);
|
|
71
|
-
const hasStyling = this.hasWorkbookStyling(workbook);
|
|
72
|
-
|
|
73
|
-
return {
|
|
74
|
-
sheets,
|
|
75
|
-
currentSheet,
|
|
76
|
-
styledData,
|
|
77
|
-
tableData,
|
|
78
|
-
hasStyling,
|
|
79
|
-
workbook
|
|
80
|
-
};
|
|
81
|
-
} catch (error) {
|
|
82
|
-
console.error('Error parsing Excel data:', error);
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Creates workbook from ArrayBuffer
|
|
89
|
-
*/
|
|
90
|
-
private createWorkbook(data: ArrayBuffer): XLSX.WorkBook {
|
|
91
|
-
return XLSX.read(data, {
|
|
92
|
-
type: 'array',
|
|
93
|
-
cellStyles: true,
|
|
94
|
-
cellDates: true,
|
|
95
|
-
cellNF: false,
|
|
96
|
-
cellHTML: false
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Gets sheet names from workbook
|
|
102
|
-
*/
|
|
103
|
-
private getSheetNames(workbook: XLSX.WorkBook): string[] {
|
|
104
|
-
return workbook.SheetNames;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Gets the first sheet name
|
|
109
|
-
*/
|
|
110
|
-
private getFirstSheet(sheets: string[]): string {
|
|
111
|
-
return sheets[0] || 'Sheet1';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Parses sheet data with styling
|
|
116
|
-
*/
|
|
117
|
-
parseSheetData(workbook: XLSX.WorkBook, sheetName: string): ExcelRowData[] {
|
|
118
|
-
try {
|
|
119
|
-
const worksheet = this.getWorksheet(workbook, sheetName);
|
|
120
|
-
if (!worksheet) {
|
|
121
|
-
return this.createNoDataRow();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const range = this.getWorksheetRange(worksheet);
|
|
125
|
-
return this.processWorksheetRows(worksheet, range);
|
|
126
|
-
} catch (error) {
|
|
127
|
-
console.error('Error parsing sheet data:', error);
|
|
128
|
-
return this.createErrorRow();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Gets worksheet from workbook
|
|
134
|
-
*/
|
|
135
|
-
private getWorksheet(workbook: XLSX.WorkBook, sheetName: string): XLSX.WorkSheet | null {
|
|
136
|
-
return workbook.Sheets[sheetName] || null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Gets worksheet range
|
|
141
|
-
*/
|
|
142
|
-
private getWorksheetRange(worksheet: XLSX.WorkSheet): XLSX.Range {
|
|
143
|
-
return XLSX.utils.decode_range(worksheet['!ref'] || 'A1');
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Processes worksheet rows
|
|
148
|
-
*/
|
|
149
|
-
private processWorksheetRows(worksheet: XLSX.WorkSheet, range: XLSX.Range): ExcelRowData[] {
|
|
150
|
-
const styledData: ExcelRowData[] = [];
|
|
151
|
-
|
|
152
|
-
for (let row = range.s.r; row <= range.e.r; row++) {
|
|
153
|
-
const rowData = this.processRow(worksheet, range, row);
|
|
154
|
-
if (this.hasRowContent(rowData)) {
|
|
155
|
-
styledData.push(rowData);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return styledData;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Processes a single row
|
|
164
|
-
*/
|
|
165
|
-
private processRow(worksheet: XLSX.WorkSheet, range: XLSX.Range, rowIndex: number): ExcelRowData {
|
|
166
|
-
const rowData: ExcelRowData = { cells: [] };
|
|
167
|
-
|
|
168
|
-
for (let col = range.s.c; col <= range.e.c; col++) {
|
|
169
|
-
const cell = this.getCell(worksheet, rowIndex, col);
|
|
170
|
-
const cellData = this.createCellData(cell);
|
|
171
|
-
rowData.cells.push(cellData);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return rowData;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Gets cell from worksheet
|
|
179
|
-
*/
|
|
180
|
-
private getCell(worksheet: XLSX.WorkSheet, row: number, col: number): XLSX.CellObject | null {
|
|
181
|
-
const cellAddress = XLSX.utils.encode_cell({ r: row, c: col });
|
|
182
|
-
return worksheet[cellAddress] || null;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Creates cell data with styling
|
|
187
|
-
*/
|
|
188
|
-
private createCellData(cell: XLSX.CellObject | null): ExcelCellData {
|
|
189
|
-
if (!cell) {
|
|
190
|
-
return { value: SHARED.EMPTY };
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
value: cell.v || SHARED.EMPTY,
|
|
195
|
-
style: this.extractCellStyle(cell)
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Checks if row has content
|
|
201
|
-
*/
|
|
202
|
-
private hasRowContent(rowData: ExcelRowData): boolean {
|
|
203
|
-
return rowData.cells.some(cell => cell.value !== SHARED.EMPTY);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Creates no data row
|
|
208
|
-
*/
|
|
209
|
-
private createNoDataRow(): ExcelRowData[] {
|
|
210
|
-
return [{ cells: [{ value: SHARED.NO_DATA_FOUND }] }];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Creates error row
|
|
215
|
-
*/
|
|
216
|
-
private createErrorRow(): ExcelRowData[] {
|
|
217
|
-
return [{ cells: [{ value: SHARED.ERROR_PARSING_SHEET_DATA }] }];
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Extracts styling from cell
|
|
222
|
-
*/
|
|
223
|
-
extractCellStyle(cell: XLSX.CellObject): ExcelCellStyle | undefined {
|
|
224
|
-
if (!cell.s) return undefined;
|
|
225
|
-
|
|
226
|
-
const style: ExcelCellStyle = {};
|
|
227
|
-
|
|
228
|
-
this.extractBackgroundColor(cell.s, style);
|
|
229
|
-
this.extractFontColor(cell.s, style);
|
|
230
|
-
this.extractFontFormatting(cell.s, style);
|
|
231
|
-
this.extractBorders(cell.s, style);
|
|
232
|
-
|
|
233
|
-
return Object.keys(style).length > 0 ? style : undefined;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Extracts background color
|
|
238
|
-
*/
|
|
239
|
-
private extractBackgroundColor(cellStyle: any, style: ExcelCellStyle): void {
|
|
240
|
-
if (cellStyle.fgColor) {
|
|
241
|
-
console.log('Found fgColor:', cellStyle.fgColor);
|
|
242
|
-
style.backgroundColor = this.getColorValue(cellStyle.fgColor);
|
|
243
|
-
if (style.backgroundColor) {
|
|
244
|
-
console.log('Extracted background color from fgColor:', style.backgroundColor);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
if (!style.backgroundColor && cellStyle.bgColor) {
|
|
249
|
-
console.log('Found bgColor:', cellStyle.bgColor);
|
|
250
|
-
style.backgroundColor = this.getColorValue(cellStyle.bgColor);
|
|
251
|
-
if (style.backgroundColor) {
|
|
252
|
-
console.log('Extracted background color from bgColor:', style.backgroundColor);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Extracts font color
|
|
259
|
-
*/
|
|
260
|
-
private extractFontColor(cellStyle: any, style: ExcelCellStyle): void {
|
|
261
|
-
if (cellStyle.font?.color) {
|
|
262
|
-
console.log('Found font color:', cellStyle.font.color);
|
|
263
|
-
style.fontColor = this.getColorValue(cellStyle.font.color);
|
|
264
|
-
if (style.fontColor) {
|
|
265
|
-
console.log('Extracted font color:', style.fontColor);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Extracts font formatting
|
|
272
|
-
*/
|
|
273
|
-
private extractFontFormatting(cellStyle: any, style: ExcelCellStyle): void {
|
|
274
|
-
if (cellStyle.font?.bold) {
|
|
275
|
-
style.bold = true;
|
|
276
|
-
}
|
|
277
|
-
if (cellStyle.font?.italic) {
|
|
278
|
-
style.italic = true;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Extracts borders
|
|
284
|
-
*/
|
|
285
|
-
private extractBorders(cellStyle: any, style: ExcelCellStyle): void {
|
|
286
|
-
if (!cellStyle.border) return;
|
|
287
|
-
|
|
288
|
-
style.border = {};
|
|
289
|
-
const borders = ['top', 'bottom', 'left', 'right'] as const;
|
|
290
|
-
|
|
291
|
-
borders.forEach(side => {
|
|
292
|
-
const border = cellStyle.border[side];
|
|
293
|
-
if (border?.color) {
|
|
294
|
-
style.border![side] = this.getColorValue(border.color);
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Gets color value from color object
|
|
301
|
-
*/
|
|
302
|
-
private getColorValue(colorObj: any): string | undefined {
|
|
303
|
-
|
|
304
|
-
if (colorObj.rgb) {
|
|
305
|
-
const result = this.rgbToHex(colorObj.rgb);
|
|
306
|
-
return result;
|
|
307
|
-
}
|
|
308
|
-
if (colorObj.theme !== undefined) {
|
|
309
|
-
const result = this.extractThemeColor(colorObj.theme);
|
|
310
|
-
return result;
|
|
311
|
-
}
|
|
312
|
-
if (colorObj.indexed !== undefined) {
|
|
313
|
-
const result = this.extractIndexedColor(colorObj.indexed);
|
|
314
|
-
return result;
|
|
315
|
-
}
|
|
316
|
-
return undefined;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Converts RGB to hex
|
|
321
|
-
*/
|
|
322
|
-
private rgbToHex(rgb: string): string {
|
|
323
|
-
if (!rgb) return SHARED.EMPTY;
|
|
324
|
-
|
|
325
|
-
if (rgb.length === 8) {
|
|
326
|
-
// Excel RGB format: AARRGGBB (Alpha, Red, Green, Blue)
|
|
327
|
-
const red = parseInt(rgb.substring(2, 4), 16);
|
|
328
|
-
const green = parseInt(rgb.substring(4, 6), 16);
|
|
329
|
-
const blue = parseInt(rgb.substring(6, 8), 16);
|
|
330
|
-
return `#${red.toString(16).padStart(2, '0')}${green.toString(16).padStart(2, '0')}${blue.toString(16).padStart(2, '0')}`;
|
|
331
|
-
} else if (rgb.length === 6) {
|
|
332
|
-
// Standard hex format: RRGGBB
|
|
333
|
-
return `#${rgb}`;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return SHARED.EMPTY;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Extracts theme color dynamically from Excel
|
|
341
|
-
*/
|
|
342
|
-
private extractThemeColor(theme: number): string {
|
|
343
|
-
const baseThemeColors: { [key: number]: string } = {
|
|
344
|
-
0: '#000000', // Black
|
|
345
|
-
1: '#FFFFFF', // White
|
|
346
|
-
2: '#FF0000', // Red
|
|
347
|
-
3: '#00FF00', // Green
|
|
348
|
-
4: '#0000FF', // Blue
|
|
349
|
-
5: '#FFFF00', // Yellow
|
|
350
|
-
6: '#FF00FF', // Magenta
|
|
351
|
-
7: '#00FFFF', // Cyan
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
return baseThemeColors[theme] || this.generateThemeColor(theme);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* Generates a theme color based on index (fallback)
|
|
359
|
-
*/
|
|
360
|
-
private generateThemeColor(theme: number): string {
|
|
361
|
-
// Generate a color based on the theme index
|
|
362
|
-
// This is a fallback when we don't have the actual theme colors
|
|
363
|
-
const hue = (theme * 137.508) % 360; // Golden angle approximation
|
|
364
|
-
return `hsl(${hue}, 70%, 50%)`;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Extracts indexed color dynamically from Excel
|
|
369
|
-
*/
|
|
370
|
-
private extractIndexedColor(indexed: number): string {
|
|
371
|
-
// Instead of hardcoded colors, we'll try to extract the actual color
|
|
372
|
-
// from the Excel file's color palette
|
|
373
|
-
if (this.workbookColors && this.workbookColors[indexed]) {
|
|
374
|
-
return this.rgbToHex(this.workbookColors[indexed]);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// Fallback to a generated color if we don't have the palette
|
|
378
|
-
return this.generateIndexedColor(indexed);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Generates an indexed color based on index (fallback)
|
|
383
|
-
*/
|
|
384
|
-
private generateIndexedColor(indexed: number): string {
|
|
385
|
-
// Generate a color based on the indexed number
|
|
386
|
-
// This ensures we always have a unique color for each index
|
|
387
|
-
const hue = (indexed * 25) % 360;
|
|
388
|
-
const saturation = 60 + (indexed % 20);
|
|
389
|
-
const lightness = 40 + (indexed % 30);
|
|
390
|
-
return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Extracts color palette from Excel workbook
|
|
395
|
-
*/
|
|
396
|
-
private extractWorkbookColors(workbook: XLSX.WorkBook): void {
|
|
397
|
-
this.workbookColors = {};
|
|
398
|
-
|
|
399
|
-
// Try to extract colors from the workbook's color palette
|
|
400
|
-
const workbookProps = workbook.Workbook as any;
|
|
401
|
-
if (workbookProps && workbookProps.Colors) {
|
|
402
|
-
const colors = workbookProps.Colors;
|
|
403
|
-
if (colors.IndexedColors) {
|
|
404
|
-
colors.IndexedColors.forEach((color: any, index: number) => {
|
|
405
|
-
if (color.rgb) {
|
|
406
|
-
this.workbookColors[index] = color.rgb;
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// Also try to extract from theme
|
|
413
|
-
if (workbookProps && workbookProps.Theme) {
|
|
414
|
-
const theme = workbookProps.Theme;
|
|
415
|
-
if (theme.ThemeElements && theme.ThemeElements.ClrScheme) {
|
|
416
|
-
const clrScheme = theme.ThemeElements.ClrScheme;
|
|
417
|
-
// Extract theme colors if available
|
|
418
|
-
Object.keys(clrScheme).forEach((key, index) => {
|
|
419
|
-
const color = clrScheme[key];
|
|
420
|
-
if (color && color.SrgbClr) {
|
|
421
|
-
this.workbookColors[index] = color.SrgbClr.val;
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
console.log('Extracted workbook colors:', this.workbookColors);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
/**
|
|
431
|
-
* Checks if workbook has styling
|
|
432
|
-
*/
|
|
433
|
-
hasWorkbookStyling(workbook: XLSX.WorkBook): boolean {
|
|
434
|
-
for (const sheetName of workbook.SheetNames) {
|
|
435
|
-
const worksheet = workbook.Sheets[sheetName];
|
|
436
|
-
if (worksheet && this.hasWorksheetStyling(worksheet)) {
|
|
437
|
-
return true;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
return false;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Checks if worksheet has styling
|
|
445
|
-
*/
|
|
446
|
-
private hasWorksheetStyling(worksheet: XLSX.WorkSheet): boolean {
|
|
447
|
-
for (const cellAddress in worksheet) {
|
|
448
|
-
if (cellAddress.startsWith('!')) continue;
|
|
449
|
-
const cell = worksheet[cellAddress];
|
|
450
|
-
if (cell?.s) {
|
|
451
|
-
return true;
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
return false;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Converts styled data to legacy format
|
|
459
|
-
*/
|
|
460
|
-
convertToLegacyFormat(styledData: ExcelRowData[]): any[][] {
|
|
461
|
-
return styledData.map(row => row.cells.map(cell => cell.value));
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
/**
|
|
465
|
-
* Ensures data consistency
|
|
466
|
-
*/
|
|
467
|
-
ensureDataConsistency(styledData: ExcelRowData[]): ExcelRowData[] {
|
|
468
|
-
if (styledData.length === 0) {
|
|
469
|
-
return [{ cells: [{ value: 'No data found' }] }];
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
const maxColumns = Math.max(...styledData.map(row => row.cells.length));
|
|
473
|
-
const minColumns = Math.max(maxColumns, 3);
|
|
474
|
-
|
|
475
|
-
return styledData.map(row => {
|
|
476
|
-
const normalizedRow: ExcelRowData = { cells: [...row.cells] };
|
|
477
|
-
while (normalizedRow.cells.length < minColumns) {
|
|
478
|
-
normalizedRow.cells.push({ value: SHARED.EMPTY });
|
|
479
|
-
}
|
|
480
|
-
return normalizedRow;
|
|
481
|
-
});
|
|
482
|
-
}
|
|
483
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FileFormatService } from './file-format.service';
|
|
4
|
-
|
|
5
|
-
describe('FileFormatService', () => {
|
|
6
|
-
let service: FileFormatService;
|
|
7
|
-
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
TestBed.configureTestingModule({});
|
|
10
|
-
service = TestBed.inject(FileFormatService);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should be created', () => {
|
|
14
|
-
expect(service).toBeTruthy();
|
|
15
|
-
});
|
|
16
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { SHARED } from '../../../Shared/constant/SHARED';
|
|
3
|
-
import { PrimeNGConfig } from 'primeng/api';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Description placeholder
|
|
7
|
-
* @class FileFormatService
|
|
8
|
-
* @typedef {FileFormatService}
|
|
9
|
-
*/
|
|
10
|
-
@Injectable({
|
|
11
|
-
providedIn: 'root'
|
|
12
|
-
})
|
|
13
|
-
export class FileFormatService {
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Creates an instance of FileFormatService.
|
|
17
|
-
* @constructor
|
|
18
|
-
*/
|
|
19
|
-
constructor() { }
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Description placeholder
|
|
23
|
-
* @param {number} bytes
|
|
24
|
-
* @param {PrimeNGConfig} config
|
|
25
|
-
* @returns {string}
|
|
26
|
-
*/
|
|
27
|
-
formatFileSize(bytes: number, config:PrimeNGConfig): string {
|
|
28
|
-
const kilobyte = 1024;
|
|
29
|
-
const decimalPlaces = SHARED.ONE;
|
|
30
|
-
const sizes = config.translation.fileSizeTypes || SHARED.FILE_SIZE_UNITS;
|
|
31
|
-
if (bytes < kilobyte) {
|
|
32
|
-
return `${bytes} ${sizes[SHARED.INITIAL_COUNT]}`;
|
|
33
|
-
} else if (bytes < kilobyte * kilobyte) {
|
|
34
|
-
const kbSize = bytes / kilobyte;
|
|
35
|
-
return `${parseFloat(kbSize.toFixed(decimalPlaces))} ${sizes[SHARED.ONE]}`;
|
|
36
|
-
} else {
|
|
37
|
-
const mbSize = bytes / (kilobyte * kilobyte);
|
|
38
|
-
return `${parseFloat(mbSize.toFixed(decimalPlaces))} ${sizes[SHARED.TWO]}`;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Validates if a file has an allowed extension
|
|
44
|
-
* @param fileName - The name of the file to validate
|
|
45
|
-
* @returns True if the file extension is allowed, false otherwise
|
|
46
|
-
*/
|
|
47
|
-
isAllowedFileType(fileName: string): boolean {
|
|
48
|
-
const allowedExtensions = SHARED.FILE_TYPES;
|
|
49
|
-
|
|
50
|
-
const fileExtension = fileName.toLowerCase().split('.').pop();
|
|
51
|
-
return fileExtension ? allowedExtensions.includes(fileExtension) : false;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Gets the list of allowed file extensions
|
|
56
|
-
* @returns Array of allowed file extensions
|
|
57
|
-
*/
|
|
58
|
-
getAllowedFileExtensions(): string[] {
|
|
59
|
-
return SHARED.FILE_TYPES;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { SHARED } from '../../../Shared/constant/SHARED';
|
|
3
|
-
|
|
4
|
-
export interface StatusData {
|
|
5
|
-
status: string;
|
|
6
|
-
count: number;
|
|
7
|
-
color?: string;
|
|
8
|
-
icon?: string;
|
|
9
|
-
_id?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface CalculatedStatusData extends StatusData {
|
|
13
|
-
percentage: number;
|
|
14
|
-
isSelected: boolean;
|
|
15
|
-
statusClass: string;
|
|
16
|
-
iconClass: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Injectable({
|
|
20
|
-
providedIn: 'root'
|
|
21
|
-
})
|
|
22
|
-
export class StatusCalculatorService {
|
|
23
|
-
|
|
24
|
-
calculateTotalCount(statusData: StatusData[]): number {
|
|
25
|
-
return statusData?.reduce((total, status) => total + (status.count ?? 0), 0) || 0;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
calculateStatusDataWithPercentages(
|
|
29
|
-
statusData: StatusData[],
|
|
30
|
-
selectedStatus: string | null
|
|
31
|
-
): CalculatedStatusData[] {
|
|
32
|
-
if (!statusData) return [];
|
|
33
|
-
|
|
34
|
-
const totalCount = this.calculateTotalCount(statusData);
|
|
35
|
-
|
|
36
|
-
return statusData.map((status) => ({
|
|
37
|
-
...status,
|
|
38
|
-
percentage: totalCount > 0 ? (status.count ?? 0) / totalCount * 100 : 0,
|
|
39
|
-
isSelected: selectedStatus === status.status,
|
|
40
|
-
statusClass: status.status ? SHARED.STATUS_WITH_DASH + status.status.toLowerCase() : SHARED.EMPTY,
|
|
41
|
-
iconClass: SHARED.ICON_WITH_DASH + (status?.status?.toLowerCase() || SHARED.EMPTY)
|
|
42
|
-
}));
|
|
43
|
-
}
|
|
44
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { UserListModel } from '../models/user-list.model';
|
|
3
|
-
import { SHARED } from '../../../Shared/constant/SHARED'
|
|
4
|
-
import { DocumentStore } from '../state/document.store';
|
|
5
|
-
import { DocumentQuery } from '../state/document.query';
|
|
6
|
-
import { DocumentCategory } from '../models/document-category.model';
|
|
7
|
-
|
|
8
|
-
@Injectable({
|
|
9
|
-
providedIn: 'root'
|
|
10
|
-
})
|
|
11
|
-
export class UserListService {
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
private documentStore: DocumentStore,
|
|
15
|
-
private documentQuery: DocumentQuery
|
|
16
|
-
) { }
|
|
17
|
-
|
|
18
|
-
getInitials(name: string): string {
|
|
19
|
-
if (!name || name.trim() === SHARED.EMPTY) {
|
|
20
|
-
return SHARED.EMPTY;
|
|
21
|
-
}
|
|
22
|
-
const words = name.trim().split(SHARED.EMPTY_SPACE).filter(word => word.length > SHARED.INITIAL_COUNT);
|
|
23
|
-
if (words.length === 1) {
|
|
24
|
-
return words[0].substring(0, 2).toUpperCase();
|
|
25
|
-
} else if (words.length >= 2) {
|
|
26
|
-
const firstWord = words[0];
|
|
27
|
-
const lastWord = words[words.length - 1];
|
|
28
|
-
return (firstWord.charAt(0) + lastWord.charAt(0)).toUpperCase();
|
|
29
|
-
}
|
|
30
|
-
return SHARED.EMPTY;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getColorByIndex(index: number): string {
|
|
34
|
-
const colors = SHARED.COLORS;
|
|
35
|
-
return colors[index % colors.length];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
getColorValue(colorName: string): string {
|
|
39
|
-
const colorMap: { [key: string]: string } = SHARED.COLOR_MAP;
|
|
40
|
-
return colorMap[colorName] || SHARED.DEFAULT_COLOR;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
processUserData(userList: UserListModel[]): UserListModel[] {
|
|
44
|
-
return userList.map((user, index) => ({
|
|
45
|
-
...user,
|
|
46
|
-
initials: this.getInitials(user.name),
|
|
47
|
-
color: this.getColorByIndex(index)
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Filters user list based on selected menu item category
|
|
53
|
-
* @param userList - The complete user list
|
|
54
|
-
* @param categories - The document categories
|
|
55
|
-
* @returns Filtered user list
|
|
56
|
-
*/
|
|
57
|
-
filterUsersByCategory(userList: UserListModel[], categories: DocumentCategory[]): UserListModel[] {
|
|
58
|
-
return userList;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
selectUser(userId: string, userData: UserListModel[]): { selectedUser: string | undefined; name: string | undefined } {
|
|
62
|
-
const user = userData.find(u => u._id === userId);
|
|
63
|
-
if (user) {
|
|
64
|
-
this.documentStore.setSelectedUserId(userId);
|
|
65
|
-
return { selectedUser: user.name, name: user.name };
|
|
66
|
-
}
|
|
67
|
-
return { selectedUser: undefined, name: undefined };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
unselectUser(): void {
|
|
71
|
-
this.documentStore.setSelectedUserId(null);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
isUserSelected(userId: string, userData: UserListModel[], selectedUser: string | undefined): boolean {
|
|
75
|
-
return selectedUser === userData.find(u => u._id === userId)?.name;
|
|
76
|
-
}
|
|
77
|
-
}
|