cat-documents-ng 1.0.4 → 1.0.6
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/ng-package.json +10 -0
- package/package.json +5 -11
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.html +3 -0
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.scss +13 -0
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.spec.ts +70 -0
- package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +133 -0
- package/src/Shared/components/table-primary/table-primary.component.html +66 -0
- package/src/Shared/components/table-primary/table-primary.component.scss +227 -0
- package/src/Shared/components/table-primary/table-primary.component.spec.ts +23 -0
- package/src/Shared/components/table-primary/table-primary.component.ts +143 -0
- package/src/Shared/components/table-primary/table-primary.model.ts +21 -0
- package/src/Shared/constant/ERROR.ts +55 -0
- package/src/Shared/constant/PERMISSIONS.ts +17 -0
- package/src/Shared/constant/SHARED.ts +936 -0
- package/{Shared/constant/URLS.d.ts → src/Shared/constant/URLS.ts} +31 -25
- package/src/Shared/services/app-config.service.spec.ts +19 -0
- package/src/Shared/services/app-config.service.ts +73 -0
- package/{Shared/services/global-error.handler.d.ts → src/Shared/services/global-error.handler.ts} +11 -9
- package/src/Shared/services/session.service.spec.ts +16 -0
- package/src/Shared/services/session.service.ts +76 -0
- package/src/Shared/shared.module.ts +25 -0
- package/src/lib/document/components/csv-viewer/csv-viewer.component.ts +1 -0
- package/src/lib/document/components/document-actions/document-actions.component.html +59 -0
- package/src/lib/document/components/document-actions/document-actions.component.scss +362 -0
- package/src/lib/document/components/document-actions/document-actions.component.spec.ts +297 -0
- package/src/lib/document/components/document-actions/document-actions.component.ts +163 -0
- package/src/lib/document/components/document-container/document-container.component.html +36 -0
- package/src/lib/document/components/document-container/document-container.component.scss +144 -0
- package/src/lib/document/components/document-container/document-container.component.spec.ts +110 -0
- package/src/lib/document/components/document-container/document-container.component.ts +363 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.html +332 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.scss +1877 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.spec.ts +258 -0
- package/src/lib/document/components/document-content-viewer/document-content-viewer.component.ts +664 -0
- package/src/lib/document/components/document-history/document-history.component.html +96 -0
- package/src/lib/document/components/document-history/document-history.component.scss +392 -0
- package/src/lib/document/components/document-history/document-history.component.spec.ts +93 -0
- package/src/lib/document/components/document-history/document-history.component.ts +373 -0
- package/src/lib/document/components/document-list/document-list.component.html +46 -0
- package/src/lib/document/components/document-list/document-list.component.scss +513 -0
- package/src/lib/document/components/document-list/document-list.component.spec.ts +486 -0
- package/src/lib/document/components/document-list/document-list.component.ts +682 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.html +36 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.scss +34 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +75 -0
- package/src/lib/document/components/document-list-item/document-list-item.component.ts +40 -0
- package/src/lib/document/components/document-search/document-search.component.html +64 -0
- package/src/lib/document/components/document-search/document-search.component.scss +206 -0
- package/src/lib/document/components/document-search/document-search.component.spec.ts +82 -0
- package/src/lib/document/components/document-search/document-search.component.ts +163 -0
- package/src/lib/document/components/document-status/document-status.component.html +31 -0
- package/src/lib/document/components/document-status/document-status.component.scss +192 -0
- package/src/lib/document/components/document-status/document-status.component.spec.ts +23 -0
- package/src/lib/document/components/document-status/document-status.component.ts +87 -0
- package/src/lib/document/components/document-upload/document-upload.component.html +160 -0
- package/src/lib/document/components/document-upload/document-upload.component.scss +235 -0
- package/src/lib/document/components/document-upload/document-upload.component.spec.ts +95 -0
- package/src/lib/document/components/document-upload/document-upload.component.ts +668 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.html +50 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.scss +187 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +79 -0
- package/src/lib/document/components/document-viewer/document-viewer.component.ts +261 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html +48 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.scss +320 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.spec.ts +59 -0
- package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.ts +150 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.html +44 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.scss +363 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.spec.ts +23 -0
- package/src/lib/document/components/documents-menu/documents-menu.component.ts +316 -0
- package/src/lib/document/components/folder-block/folder-block.component.html +46 -0
- package/src/lib/document/components/folder-block/folder-block.component.scss +9 -0
- package/src/lib/document/components/folder-block/folder-block.component.spec.ts +70 -0
- package/{lib/document/components/folder-block/folder-block.component.d.ts → src/lib/document/components/folder-block/folder-block.component.ts} +28 -12
- package/src/lib/document/components/folder-container/folder-container.component.html +56 -0
- package/src/lib/document/components/folder-container/folder-container.component.scss +20 -0
- package/src/lib/document/components/folder-container/folder-container.component.spec.ts +27 -0
- package/src/lib/document/components/folder-container/folder-container.component.ts +328 -0
- package/src/lib/document/components/linked-document/linked-document.component.html +23 -0
- package/src/lib/document/components/linked-document/linked-document.component.scss +10 -0
- package/src/lib/document/components/linked-document/linked-document.component.spec.ts +61 -0
- package/src/lib/document/components/linked-document/linked-document.component.ts +49 -0
- package/src/lib/document/components/request-document/request-document.component.html +86 -0
- package/src/lib/document/components/request-document/request-document.component.scss +16 -0
- package/src/lib/document/components/request-document/request-document.component.ts +278 -0
- package/src/lib/document/components/sidebar/sidebar.component.html +75 -0
- package/src/lib/document/components/sidebar/sidebar.component.scss +157 -0
- package/src/lib/document/components/sidebar/sidebar.component.spec.ts +114 -0
- package/src/lib/document/components/sidebar/sidebar.component.ts +223 -0
- package/src/lib/document/components/user-list/user-list.component.html +33 -0
- package/src/lib/document/components/user-list/user-list.component.scss +118 -0
- package/src/lib/document/components/user-list/user-list.component.spec.ts +23 -0
- package/src/lib/document/components/user-list/user-list.component.ts +181 -0
- package/src/lib/document/constant/DOCUMENT_HISTORY.ts +52 -0
- package/src/lib/document/directives/document.directive.ts +32 -0
- package/src/lib/document/directives/permission.directive.spec.ts +0 -0
- package/src/lib/document/directives/permission.directive.ts +72 -0
- package/src/lib/document/document.module.ts +351 -0
- package/{lib/document/models/document-alert.model.d.ts → src/lib/document/models/document-alert.model.ts} +11 -4
- package/src/lib/document/models/document-category.model.ts +30 -0
- package/src/lib/document/models/document-history.model.ts +109 -0
- package/src/lib/document/models/document-list-response.model.ts +37 -0
- package/src/lib/document/models/document-type.model.ts +44 -0
- package/src/lib/document/models/document.model.ts +53 -0
- package/{lib/document/models/folder.model.d.ts → src/lib/document/models/folder.model.ts} +10 -4
- package/src/lib/document/models/status-data.model.ts +31 -0
- package/src/lib/document/models/uploaded-file-response.model.ts +7 -0
- package/src/lib/document/models/user-list.model.ts +10 -0
- package/src/lib/document/services/csv-parser.service.spec.ts +97 -0
- package/src/lib/document/services/csv-parser.service.ts +303 -0
- package/src/lib/document/services/document-actions.service.ts +125 -0
- package/src/lib/document/services/document-content-type.service.ts +193 -0
- package/src/lib/document/services/document-history-style.service.ts +138 -0
- package/src/lib/document/services/document-history.service.ts +129 -0
- package/src/lib/document/services/document-http.service.spec.ts +119 -0
- package/src/lib/document/services/document-http.service.ts +497 -0
- package/src/lib/document/services/document-list.service.ts +195 -0
- package/src/lib/document/services/document-menu.service.ts +277 -0
- package/src/lib/document/services/document-scroll.service.ts +138 -0
- package/src/lib/document/services/document-severity.service.ts +98 -0
- package/src/lib/document/services/document-table-builder.service.ts +82 -0
- package/src/lib/document/services/document-upload-business.service.ts +326 -0
- package/src/lib/document/services/document-upload-data.service.ts +82 -0
- package/src/lib/document/services/document-upload-form.service.ts +149 -0
- package/src/lib/document/services/document-upload.service.spec.ts +99 -0
- package/src/lib/document/services/document-upload.service.ts +209 -0
- package/src/lib/document/services/document-viewer.service.ts +279 -0
- package/src/lib/document/services/document-zoom.service.spec.ts +56 -0
- package/src/lib/document/services/document-zoom.service.ts +164 -0
- package/src/lib/document/services/document.service.ts +356 -0
- package/src/lib/document/services/eml-parser.service.ts +444 -0
- package/src/lib/document/services/excel-parser.service.spec.ts +66 -0
- package/src/lib/document/services/excel-parser.service.ts +483 -0
- package/src/lib/document/services/file-format.service.spec.ts +16 -0
- package/src/lib/document/services/file-format.service.ts +63 -0
- package/src/lib/document/services/status-calculator.service.ts +44 -0
- package/src/lib/document/services/user-list.service.ts +77 -0
- package/src/lib/document/state/document.query.ts +378 -0
- package/{lib/document/state/document.service.d.ts → src/lib/document/state/document.service.ts} +46 -15
- package/src/lib/document/state/document.state.ts +100 -0
- package/src/lib/document/state/document.store.ts +200 -0
- package/{public-api.d.ts → src/public-api.ts} +4 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +15 -0
- package/Shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +0 -44
- package/Shared/components/table-primary/table-primary.component.d.ts +0 -31
- package/Shared/components/table-primary/table-primary.model.d.ts +0 -19
- package/Shared/constant/ERROR.d.ts +0 -52
- package/Shared/constant/SHARED.d.ts +0 -546
- package/Shared/services/app-config.service.d.ts +0 -51
- package/Shared/services/session.service.d.ts +0 -46
- package/Shared/shared.module.d.ts +0 -14
- package/fesm2022/cat-documents-ng.mjs +0 -11392
- package/fesm2022/cat-documents-ng.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/document/components/document-actions/document-actions.component.d.ts +0 -78
- package/lib/document/components/document-container/document-container.component.d.ts +0 -162
- package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +0 -291
- package/lib/document/components/document-history/document-history.component.d.ts +0 -160
- package/lib/document/components/document-list/document-list.component.d.ts +0 -299
- package/lib/document/components/document-list-item/document-list-item.component.d.ts +0 -28
- package/lib/document/components/document-search/document-search.component.d.ts +0 -77
- package/lib/document/components/document-status/document-status.component.d.ts +0 -24
- package/lib/document/components/document-upload/document-upload.component.d.ts +0 -321
- package/lib/document/components/document-viewer/document-viewer.component.d.ts +0 -137
- package/lib/document/components/document-zoom-controls/document-zoom-controls.component.d.ts +0 -33
- package/lib/document/components/documents-menu/documents-menu.component.d.ts +0 -110
- package/lib/document/components/folder-container/folder-container.component.d.ts +0 -162
- package/lib/document/components/linked-document/linked-document.component.d.ts +0 -39
- package/lib/document/components/request-document/request-document.component.d.ts +0 -69
- package/lib/document/components/sidebar/sidebar.component.d.ts +0 -109
- package/lib/document/components/user-list/user-list.component.d.ts +0 -34
- package/lib/document/constant/DOCUMENT_HISTORY.d.ts +0 -41
- package/lib/document/directives/document.directive.d.ts +0 -20
- package/lib/document/directives/permission.directive.d.ts +0 -38
- package/lib/document/document.module.d.ts +0 -60
- package/lib/document/models/document-category.model.d.ts +0 -24
- package/lib/document/models/document-history.model.d.ts +0 -94
- package/lib/document/models/document-list-response.model.d.ts +0 -33
- package/lib/document/models/document-type.model.d.ts +0 -37
- package/lib/document/models/document.model.d.ts +0 -44
- package/lib/document/models/status-data.model.d.ts +0 -27
- package/lib/document/models/uploaded-file-response.model.d.ts +0 -7
- package/lib/document/models/user-list.model.d.ts +0 -8
- package/lib/document/services/csv-parser.service.d.ts +0 -88
- package/lib/document/services/document-actions.service.d.ts +0 -48
- package/lib/document/services/document-content-type.service.d.ts +0 -85
- package/lib/document/services/document-history-style.service.d.ts +0 -34
- package/lib/document/services/document-history.service.d.ts +0 -42
- package/lib/document/services/document-http.service.d.ts +0 -179
- package/lib/document/services/document-list.service.d.ts +0 -74
- package/lib/document/services/document-menu.service.d.ts +0 -122
- package/lib/document/services/document-scroll.service.d.ts +0 -55
- package/lib/document/services/document-table-builder.service.d.ts +0 -38
- package/lib/document/services/document-upload-business.service.d.ts +0 -107
- package/lib/document/services/document-upload-data.service.d.ts +0 -40
- package/lib/document/services/document-upload-form.service.d.ts +0 -41
- package/lib/document/services/document-upload.service.d.ts +0 -99
- package/lib/document/services/document-viewer.service.d.ts +0 -97
- package/lib/document/services/document-zoom.service.d.ts +0 -81
- package/lib/document/services/document.service.d.ts +0 -161
- package/lib/document/services/eml-parser.service.d.ts +0 -116
- package/lib/document/services/excel-parser.service.d.ts +0 -169
- package/lib/document/services/file-format.service.d.ts +0 -34
- package/lib/document/services/status-calculator.service.d.ts +0 -20
- package/lib/document/services/user-list.service.d.ts +0 -29
- package/lib/document/state/document.query.d.ts +0 -243
- package/lib/document/state/document.state.d.ts +0 -61
- package/lib/document/state/document.store.d.ts +0 -56
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<div class="document-viewer-container grid p-formgrid">
|
|
2
|
+
<div class="main-content col-12 md:col-12">
|
|
3
|
+
@if(messages.length > 0) {
|
|
4
|
+
<p-messages [(value)]="messages" [enableService]="false"></p-messages>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
<div class="content-grid col-12 md:col-12">
|
|
8
|
+
@if(selectedDocument){
|
|
9
|
+
<div class="document-preview p-0 col-12 md:col-9">
|
|
10
|
+
<document-content-viewer
|
|
11
|
+
[documentUrl]="selectedDocument?.documentUrl"
|
|
12
|
+
[contentType]="selectedDocument?.contentType"
|
|
13
|
+
[documentName]="selectedDocument?.docName"
|
|
14
|
+
[selectedDocument]="selectedDocument"
|
|
15
|
+
[contextId]="contextId"
|
|
16
|
+
[isFormHide]="isFormHide"
|
|
17
|
+
(documentNameUpdated)="onDocumentNameUpdated()"
|
|
18
|
+
></document-content-viewer>
|
|
19
|
+
</div>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
<div class="sidebar col-12 md:col-3 pt-0">
|
|
23
|
+
<div class="sidebar card">
|
|
24
|
+
<document-history
|
|
25
|
+
[historyData]="currentState.documentHistory"
|
|
26
|
+
[showHistory]="currentState.showDocumentHistory"
|
|
27
|
+
[contextId]="contextId"
|
|
28
|
+
[selectedDocument]="selectedDocument"
|
|
29
|
+
(deleteTaskRequested)="onDeleteTaskRequested()"
|
|
30
|
+
(documentSelected)="onDocumentSelected($event)">
|
|
31
|
+
|
|
32
|
+
<!-- Document Actions Component inside the history component -->
|
|
33
|
+
<div actions-component *ngIf="selectedDocument?.status !=='Pending' && !selectedDocument?.isUploaded && selectedDocument?.status === 'Reviewing'">
|
|
34
|
+
<document-actions
|
|
35
|
+
[document]="selectedDocument"
|
|
36
|
+
[documentId]="selectedDocument?._id"
|
|
37
|
+
[currentStatus]="currentState.documentStatus"
|
|
38
|
+
[isLoading]="currentState.isActionLoading"
|
|
39
|
+
[isUploaded]="currentState.documentIsUploaded"
|
|
40
|
+
[statusId]="selectedDocument?.statusId"
|
|
41
|
+
(actionPerformed)="handleDocumentAction($event)">
|
|
42
|
+
</document-actions>
|
|
43
|
+
</div>
|
|
44
|
+
<ng-content [select]="'action-launcher'"></ng-content>
|
|
45
|
+
</document-history>
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// Global overflow prevention
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
height: 100%;
|
|
5
|
+
width: 100%;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
position: relative;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// Ensure the component is properly constrained in its parent
|
|
11
|
+
.document-viewer-container {
|
|
12
|
+
height: 100%;
|
|
13
|
+
width: 100%;
|
|
14
|
+
position: relative;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
overflow: hidden;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
|
|
20
|
+
.main-content {
|
|
21
|
+
height: 100%;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
min-height: 0; // Important for flexbox sizing
|
|
26
|
+
|
|
27
|
+
.p-messages {
|
|
28
|
+
margin-bottom: 0.5rem;
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.content-grid {
|
|
33
|
+
display: grid;
|
|
34
|
+
grid-template-columns: 1fr 400px;
|
|
35
|
+
gap: 1rem;
|
|
36
|
+
height: 0; // Let flexbox handle height
|
|
37
|
+
min-height: 0;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
flex: 1;
|
|
40
|
+
|
|
41
|
+
.document-preview {
|
|
42
|
+
background: transparent;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
height: 100%;
|
|
45
|
+
width: 100%;
|
|
46
|
+
min-width: 0;
|
|
47
|
+
overflow: auto;
|
|
48
|
+
border-radius: 10px;
|
|
49
|
+
// Hide scroll bars
|
|
50
|
+
scrollbar-width: none;
|
|
51
|
+
-ms-overflow-style: none;
|
|
52
|
+
|
|
53
|
+
&::-webkit-scrollbar {
|
|
54
|
+
display: none;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.sidebar {
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
gap: 0.75rem;
|
|
62
|
+
height: 100%;
|
|
63
|
+
overflow-y: auto;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
width: 100%;
|
|
66
|
+
|
|
67
|
+
// Hide scroll bars
|
|
68
|
+
scrollbar-width: none;
|
|
69
|
+
-ms-overflow-style: none;
|
|
70
|
+
|
|
71
|
+
&::-webkit-scrollbar {
|
|
72
|
+
display: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Reduce spacing in child components
|
|
76
|
+
::ng-deep {
|
|
77
|
+
.document-actions-container {
|
|
78
|
+
margin: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.document-history-container {
|
|
82
|
+
padding: 0.75rem;
|
|
83
|
+
max-height: none;
|
|
84
|
+
|
|
85
|
+
// Hide scroll bars in document history
|
|
86
|
+
scrollbar-width: none;
|
|
87
|
+
-ms-overflow-style: none;
|
|
88
|
+
|
|
89
|
+
&::-webkit-scrollbar {
|
|
90
|
+
display: none;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Handle potential parent container issues
|
|
100
|
+
::ng-deep {
|
|
101
|
+
.p-dialog-content {
|
|
102
|
+
overflow: hidden !important;
|
|
103
|
+
height: 100% !important;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.p-dialog {
|
|
107
|
+
overflow: hidden !important;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Responsive design
|
|
112
|
+
@media (max-width: 1200px) {
|
|
113
|
+
.document-viewer-container .main-content .content-grid {
|
|
114
|
+
grid-template-columns: 1fr 380px;
|
|
115
|
+
gap: 0.75rem;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@media (max-width: 768px) {
|
|
120
|
+
.document-viewer-container .main-content .content-grid {
|
|
121
|
+
grid-template-columns: 1fr;
|
|
122
|
+
gap: 0.5rem;
|
|
123
|
+
|
|
124
|
+
.sidebar {
|
|
125
|
+
order: -1; // Move sidebar above content on mobile
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Legacy styles for backward compatibility
|
|
131
|
+
.alert-card {
|
|
132
|
+
background-color: #fb392d1a;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.success-alert {
|
|
136
|
+
border-radius: 10px;
|
|
137
|
+
border: 1px solid rgba(251, 57, 45, 0.1);
|
|
138
|
+
background: linear-gradient(0deg, #dedede 0%, #dedede 100%), #fff;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.p-timeline-event-opposite {
|
|
142
|
+
display: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.decription {
|
|
146
|
+
color: #676b89;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.textAreaControl textarea {
|
|
150
|
+
width: 100%;
|
|
151
|
+
resize: vertical;
|
|
152
|
+
max-width: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.document-btn-wrapper {
|
|
156
|
+
.p-button-outlined {
|
|
157
|
+
color: #f57c00;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.document-viewer{
|
|
162
|
+
// Ensure dialogs are properly positioned
|
|
163
|
+
position: relative;
|
|
164
|
+
z-index: 1;
|
|
165
|
+
|
|
166
|
+
.p-dialog{
|
|
167
|
+
width: 100%;
|
|
168
|
+
height: 100%;
|
|
169
|
+
max-height: 100% !important;
|
|
170
|
+
box-shadow: none !important;
|
|
171
|
+
z-index: 9999 !important; // Ensure dialog appears above everything
|
|
172
|
+
}
|
|
173
|
+
.p-dialog-header-close-icon{
|
|
174
|
+
height: 20px;
|
|
175
|
+
width: 20px;
|
|
176
|
+
}
|
|
177
|
+
.p-dialog-header{
|
|
178
|
+
background-color:#FFF;
|
|
179
|
+
border-radius: 0;
|
|
180
|
+
padding: 0.5rem;
|
|
181
|
+
}
|
|
182
|
+
.p-dialog-content{
|
|
183
|
+
background-color:#FFF;
|
|
184
|
+
border-radius: 0;
|
|
185
|
+
overflow: hidden;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { DocumentViewerComponent } from './document-viewer.component';
|
|
3
|
+
import { TimelineModule } from 'primeng/timeline';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
6
|
+
import { HttpClientModule } from '@angular/common/http';
|
|
7
|
+
import { DocumentService } from '../../services/document.service';
|
|
8
|
+
import { DocumentHttpService } from '../../services/document-http.service';
|
|
9
|
+
import { of } from 'rxjs';
|
|
10
|
+
import { DocumentModel } from '../../models/document.model';
|
|
11
|
+
import { LinkedDocumentComponent } from '../linked-document/linked-document.component';
|
|
12
|
+
|
|
13
|
+
describe('DocumentViewerComponent', () => {
|
|
14
|
+
let component: DocumentViewerComponent;
|
|
15
|
+
let fixture: ComponentFixture<DocumentViewerComponent>;
|
|
16
|
+
let documentService: jasmine.SpyObj<DocumentService>;
|
|
17
|
+
|
|
18
|
+
beforeEach(async () => {
|
|
19
|
+
const documentServiceSpy = jasmine.createSpyObj('DocumentService', ['set']);
|
|
20
|
+
|
|
21
|
+
await TestBed.configureTestingModule({
|
|
22
|
+
declarations: [DocumentViewerComponent, LinkedDocumentComponent],
|
|
23
|
+
imports: [TimelineModule, FormsModule, CheckboxModule, HttpClientModule],
|
|
24
|
+
providers: [
|
|
25
|
+
{ provide: DocumentService, useValue: documentServiceSpy },
|
|
26
|
+
DocumentHttpService,
|
|
27
|
+
],
|
|
28
|
+
}).compileComponents();
|
|
29
|
+
|
|
30
|
+
fixture = TestBed.createComponent(DocumentViewerComponent);
|
|
31
|
+
component = fixture.componentInstance;
|
|
32
|
+
documentService = TestBed.inject(DocumentService) as jasmine.SpyObj<DocumentService>;
|
|
33
|
+
fixture.detectChanges();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should create', () => {
|
|
37
|
+
expect(component).toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should call set method of documentService on ngOnChanges when selectedDocument is set', () => {
|
|
41
|
+
const document: DocumentModel = { _id: '22', contentType: 'image/png', documentUrl: 'http://example.com/image.png', status: 'approved' };
|
|
42
|
+
component.selectedDocument = document;
|
|
43
|
+
component.ngOnChanges();
|
|
44
|
+
expect(documentService.set).toHaveBeenCalledWith(document);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should determine if content type is an image', () => {
|
|
48
|
+
const validImageType = 'image/png';
|
|
49
|
+
const invalidImageType = 'application/pdf';
|
|
50
|
+
expect(component.isImage(validImageType)).toBeTrue();
|
|
51
|
+
expect(component.isImage(invalidImageType)).toBeFalse();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should set selectedDocument correctly when handleSelectedDocument is called', () => {
|
|
55
|
+
const document: DocumentModel = { _id: '22', contentType: 'image/png', documentUrl: 'http://example.com/image.png' };
|
|
56
|
+
component.handleSelectedDocument(document);
|
|
57
|
+
expect(component.selectedDocument).toEqual(document);
|
|
58
|
+
expect(documentService.set).toHaveBeenCalledWith(document);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should display the document image if selectedDocument is an image', () => {
|
|
62
|
+
const imageDocument: DocumentModel = {
|
|
63
|
+
_id : "122",
|
|
64
|
+
contentType: 'image/png',
|
|
65
|
+
documentUrl: 'http://example.com/image.png',
|
|
66
|
+
};
|
|
67
|
+
component.selectedDocument = imageDocument;
|
|
68
|
+
fixture.detectChanges();
|
|
69
|
+
const imgElement = fixture.debugElement.nativeElement.querySelector('.img-container img');
|
|
70
|
+
expect(imgElement).toBeTruthy();
|
|
71
|
+
expect(imgElement.src).toContain('http://example.com/image.png');
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should update isVerified flag', () => {
|
|
75
|
+
component.isVerified = true;
|
|
76
|
+
fixture.detectChanges();
|
|
77
|
+
expect(component.isVerified).toBeTrue();
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
Input,
|
|
4
|
+
Output,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
OnChanges,
|
|
7
|
+
OnDestroy,
|
|
8
|
+
SimpleChanges,
|
|
9
|
+
ViewEncapsulation,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
12
|
+
import { SHARED, SUPPORTED_IMAGE_TYPES } from '../../../../Shared/constant/SHARED';
|
|
13
|
+
import { DocumentHttpService } from '../../services/document-http.service';
|
|
14
|
+
import { Subscription } from 'rxjs';
|
|
15
|
+
import { DocumentModel } from '../../models/document.model';
|
|
16
|
+
import { DocumentHelperService } from '../../services/document.service';
|
|
17
|
+
import { DocumentListItem } from '../../models/document-list-response.model';
|
|
18
|
+
import { DocumentHistorySection } from '../../models/document-history.model';
|
|
19
|
+
import { DocumentAction } from '../../services/document-actions.service';
|
|
20
|
+
import { MessageService } from 'primeng/api';
|
|
21
|
+
import { DocumentViewerService, DocumentViewerState } from '../../services/document-viewer.service';
|
|
22
|
+
import { DocumentStore } from '../../state/document.store';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Component for viewing and managing document details.
|
|
26
|
+
* @class DocumentViewerComponent
|
|
27
|
+
* @typedef {DocumentViewerComponent}
|
|
28
|
+
*/
|
|
29
|
+
@Component({
|
|
30
|
+
selector: 'document-viewer',
|
|
31
|
+
templateUrl: './document-viewer.component.html',
|
|
32
|
+
standalone : false,
|
|
33
|
+
styleUrl: './document-viewer.component.scss',
|
|
34
|
+
encapsulation: ViewEncapsulation.None,
|
|
35
|
+
})
|
|
36
|
+
export class DocumentViewerComponent implements OnChanges, OnDestroy {
|
|
37
|
+
/**
|
|
38
|
+
* Get the selected document by user.
|
|
39
|
+
* @type {*}
|
|
40
|
+
*/
|
|
41
|
+
@Input() selectedDocument?: DocumentListItem; // <-- Made optional to prevent undefined issues
|
|
42
|
+
/**
|
|
43
|
+
* Get the selected document by user.
|
|
44
|
+
* @type {*}
|
|
45
|
+
*/
|
|
46
|
+
@Input() documentList?: DocumentListItem[]; // <-- Made optional to prevent undefined issues
|
|
47
|
+
/**
|
|
48
|
+
* The context ID for API calls
|
|
49
|
+
* @type {string}
|
|
50
|
+
*/
|
|
51
|
+
@Input() contextId?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Flag to hide form elements
|
|
55
|
+
* @type {boolean}
|
|
56
|
+
*/
|
|
57
|
+
@Input() isFormHide: boolean = false;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Event emitted when document status is updated to refresh the document list
|
|
61
|
+
* @type {EventEmitter<void>}
|
|
62
|
+
*/
|
|
63
|
+
@Output() documentStatusUpdated = new EventEmitter<{ actionType?: string }>();
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Event emitted when a delete error occurs
|
|
67
|
+
* @type {EventEmitter<any>}
|
|
68
|
+
*/
|
|
69
|
+
@Output() deleteError = new EventEmitter<any>();
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Event emitted when a delete operation succeeds
|
|
73
|
+
* @type {EventEmitter<void>}
|
|
74
|
+
*/
|
|
75
|
+
@Output() deleteSuccess = new EventEmitter<void>();
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Event emitted when the document viewer is destroyed to trigger refresh
|
|
79
|
+
* @type {EventEmitter<void>}
|
|
80
|
+
*/
|
|
81
|
+
@Output() viewerDestroyed = new EventEmitter<void>();
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Indicates whether a checkbox is selected.
|
|
85
|
+
* @type {boolean}
|
|
86
|
+
*/
|
|
87
|
+
checked: boolean = false;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reference to the dynamic dialog used for displaying additional details.
|
|
91
|
+
* @type {(DynamicDialogRef | undefined)}
|
|
92
|
+
*/
|
|
93
|
+
ref: DynamicDialogRef | undefined;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Indicates whether the document has been verified.
|
|
97
|
+
* @type {boolean}
|
|
98
|
+
*/
|
|
99
|
+
isVerified: boolean = false;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Messages for user feedback
|
|
103
|
+
* @type {any[]}
|
|
104
|
+
*/
|
|
105
|
+
messages: any[] = [];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Current state from the service
|
|
109
|
+
* @type {DocumentViewerState}
|
|
110
|
+
*/
|
|
111
|
+
currentState: DocumentViewerState = {
|
|
112
|
+
documentHistory: [],
|
|
113
|
+
showDocumentHistory: false,
|
|
114
|
+
isActionLoading: false,
|
|
115
|
+
documentStatus: SHARED.STATUS_PENDING as 'pending',
|
|
116
|
+
documentIsUploaded: false,
|
|
117
|
+
alertData: null,
|
|
118
|
+
deleteError: null,
|
|
119
|
+
deleteSuccess: false
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Holds the subscription to manage observable cleanup.
|
|
126
|
+
* @private
|
|
127
|
+
* @type {Subscription}
|
|
128
|
+
*/
|
|
129
|
+
private subscription: Subscription = new Subscription();
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Initializes a new instance of the DocumentViewerComponent.
|
|
133
|
+
* @param {DocumentHttpService} documentHttpService - Handle the http service.
|
|
134
|
+
* @param {DocumentService} documentService - Handle the states.
|
|
135
|
+
* @param {DocumentViewerService} documentViewerService - Handle the viewer business logic.
|
|
136
|
+
*/
|
|
137
|
+
constructor(
|
|
138
|
+
public documentHttpService : DocumentHttpService,
|
|
139
|
+
private documentService: DocumentHelperService,
|
|
140
|
+
private messageService: MessageService,
|
|
141
|
+
private documentViewerService: DocumentViewerService,
|
|
142
|
+
public documentStore: DocumentStore
|
|
143
|
+
) {
|
|
144
|
+
// Subscribe to state changes from the service
|
|
145
|
+
this.subscription.add(
|
|
146
|
+
this.documentViewerService.state$.subscribe(state => {
|
|
147
|
+
this.currentState = state;
|
|
148
|
+
|
|
149
|
+
// Check for delete errors and emit them to parent
|
|
150
|
+
if (state.deleteError) {
|
|
151
|
+
this.deleteError.emit(state.deleteError);
|
|
152
|
+
// Clear the error from state after emitting
|
|
153
|
+
this.documentStore.setDeleteError(null);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Check for delete success and emit to parent
|
|
157
|
+
if (state.deleteSuccess) {
|
|
158
|
+
this.deleteSuccess.emit();
|
|
159
|
+
// Clear the success flag from state after emitting
|
|
160
|
+
this.documentStore.setDeleteSuccess(false);
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Fetches the alerts for the selected document.
|
|
168
|
+
* @returns {void}
|
|
169
|
+
*/
|
|
170
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
171
|
+
if (changes['selectedDocument'] && this.selectedDocument) {
|
|
172
|
+
this.documentViewerService.updateSelectedDocument(this.selectedDocument);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Handles document selection from template
|
|
178
|
+
* @param document The selected document
|
|
179
|
+
*/
|
|
180
|
+
handleSelectedDocument(document: DocumentListItem): void {
|
|
181
|
+
this.selectedDocument = document;
|
|
182
|
+
this.documentViewerService.updateSelectedDocument(document);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Handles document actions from the actions component
|
|
189
|
+
* @param {DocumentAction} action - The action performed
|
|
190
|
+
*/
|
|
191
|
+
handleDocumentAction(action: DocumentAction): void {
|
|
192
|
+
this.documentViewerService.handleDocumentAction(action, this.contextId);
|
|
193
|
+
this.documentStatusUpdated.emit({ actionType: action.type });
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
ngOnDestroy(): void {
|
|
197
|
+
this.subscription.unsubscribe();
|
|
198
|
+
if (this.contextId) {
|
|
199
|
+
this.refreshDocumentData();
|
|
200
|
+
}
|
|
201
|
+
this.viewerDestroyed.emit();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Handles document name update event from content viewer
|
|
206
|
+
*/
|
|
207
|
+
onDocumentNameUpdated(): void {
|
|
208
|
+
this.documentStatusUpdated.emit({ actionType: SHARED.NAME_UPDATE_ACTION });
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Handles delete task request from history component
|
|
213
|
+
*/
|
|
214
|
+
onDeleteTaskRequested(): void {
|
|
215
|
+
this.documentStatusUpdated.emit({ actionType: 'delete' });
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Handles document selection from history component
|
|
220
|
+
* @param document - The selected document from history
|
|
221
|
+
*/
|
|
222
|
+
onDocumentSelected(document: any): void {
|
|
223
|
+
if (document && document.documentUrl && document.docName) {
|
|
224
|
+
const tempDocument: DocumentListItem = {
|
|
225
|
+
_id: document._id,
|
|
226
|
+
docName: document.docName,
|
|
227
|
+
fileName: document.docName,
|
|
228
|
+
documentUrl: document.documentUrl,
|
|
229
|
+
contentType: document.contentType,
|
|
230
|
+
status: this.selectedDocument?.status || '',
|
|
231
|
+
documentTypeName:document.documentTypeName,
|
|
232
|
+
isUploaded: this.selectedDocument?.isUploaded || false,
|
|
233
|
+
isAliasEditable: document.isAliasEditable,
|
|
234
|
+
parentDocumentId: document.parentDocumentId,
|
|
235
|
+
aliasName: document.aliasName,
|
|
236
|
+
isSystemDocument: document.isSystemDocument || false,
|
|
237
|
+
fileSize: '0',
|
|
238
|
+
uploadedOn: new Date().toISOString(),
|
|
239
|
+
ownerName: 'History Document'
|
|
240
|
+
};
|
|
241
|
+
this.selectedDocument = tempDocument;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Refreshes document data when the viewer is closed
|
|
247
|
+
*/
|
|
248
|
+
private refreshDocumentData(): void {
|
|
249
|
+
this.documentStore.clearSelectionState();
|
|
250
|
+
this.documentStore.setDocumentListResponse(null);
|
|
251
|
+
this.documentStore.setDocumentList([]);
|
|
252
|
+
this.documentStore.setDocumentCategories([]);
|
|
253
|
+
this.documentStore.setUserList([]);
|
|
254
|
+
this.documentStore.setStatusData([]);
|
|
255
|
+
this.documentStore.setCurrentDocument(null);
|
|
256
|
+
this.documentStore.setFolders([]);
|
|
257
|
+
this.documentStore.setDocumentAlert(null);
|
|
258
|
+
// Clear document viewer state including history data
|
|
259
|
+
this.documentStore.clearDocumentViewerState();
|
|
260
|
+
}
|
|
261
|
+
}
|
package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<div class="control-container">
|
|
2
|
+
<div class="inline-flex align-items-center justify-content-center gap-2">
|
|
3
|
+
<!-- Document name display with hover edit icon -->
|
|
4
|
+
<div *ngIf="!isEditingDocumentName" class="document-name-display"
|
|
5
|
+
[class.clickable-doc-name]="selectedDocument?.isAliasEditable"
|
|
6
|
+
[class.non-clickable-doc-name]="!selectedDocument?.isAliasEditable"
|
|
7
|
+
(click)="selectedDocument?.isAliasEditable ? onDocumentNameClick() : null"
|
|
8
|
+
[title]="selectedDocument?.isAliasEditable ? 'Click to edit document name' : 'Document name is not editable'">
|
|
9
|
+
<div class="alias-name">
|
|
10
|
+
{{ selectedDocument?.aliasName || selectedDocument?.docName }}
|
|
11
|
+
<i *ngIf="selectedDocument?.isAliasEditable && !isFormHide" class="pi pi-pencil edit-icon-small"></i>
|
|
12
|
+
</div>
|
|
13
|
+
<!-- Subline: show `ownerName documentTypeName` (falls back to just type if no owner) -->
|
|
14
|
+
<div class="document-name">
|
|
15
|
+
<ng-container [ngTemplateOutlet]="ownerTypeDisplay"></ng-container>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div *ngIf="isEditingDocumentName" class="document-edit-container">
|
|
19
|
+
<input #fileInput type="text" class="h-3rem file-input-wrapper document-name-input" pInputText
|
|
20
|
+
[(ngModel)]="documentName" (input)="onDocumentNameChange($event)" (keydown.escape)="cancelDocumentNameEdit()"
|
|
21
|
+
(keydown.enter)="handleSaveClick()" (blur)="handleSaveClick()" />
|
|
22
|
+
<div class="document-name-subline">
|
|
23
|
+
<ng-container [ngTemplateOutlet]="ownerTypeDisplay"></ng-container>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div *ngIf="fileNameError" class="error-message-wrapper">
|
|
27
|
+
{{ fileNameError }}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="zoom-controls">
|
|
31
|
+
<p-button type="button" icon="pi pi-minus" [rounded]="true" severity="secondary" [outlined]="true" (click)="zoomOut()" [disabled]="isZoomOutDisabled" title="Zoom Out">
|
|
32
|
+
</p-button>
|
|
33
|
+
<p-button type="button" icon="pi pi-plus" [rounded]="true" severity="secondary" [outlined]="true" (click)="zoomIn()" [disabled]="isZoomInDisabled" title="Zoom In">
|
|
34
|
+
</p-button>
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Shared template for displaying Owner + Type -->
|
|
41
|
+
<ng-template #ownerTypeDisplay>
|
|
42
|
+
<ng-container *ngIf="((selectedDocument?.ownerName || '').trim()).length > 0; else onlyTypeTpl">
|
|
43
|
+
{{ selectedDocument?.ownerName }}<ng-container *ngIf="selectedDocument?.documentTypeName"> {{ selectedDocument?.documentTypeName }}</ng-container>
|
|
44
|
+
</ng-container>
|
|
45
|
+
</ng-template>
|
|
46
|
+
<ng-template #onlyTypeTpl>
|
|
47
|
+
{{ selectedDocument?.documentTypeName }}
|
|
48
|
+
|