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,682 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDestroy, OnChanges, SimpleChanges, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
|
3
|
-
import { DocumentModel } from '../../models/document.model';
|
|
4
|
-
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
5
|
-
import { DocumentListItem, DocumentListResponse } from '../../models/document-list-response.model';
|
|
6
|
-
import { Subscription } from 'rxjs';
|
|
7
|
-
import { TableData } from '../../../../Shared/components/table-primary/table-primary.model';
|
|
8
|
-
import { DocumentListService } from '../../services/document-list.service';
|
|
9
|
-
import { Message } from 'primeng/api';
|
|
10
|
-
import { ERRORS } from '../../../../Shared/constant/ERROR';
|
|
11
|
-
import { DocumentHttpService } from '../../services/document-http.service';
|
|
12
|
-
import { DocumentMenuService } from '../../services/document-menu.service';
|
|
13
|
-
import { DocumentStore } from '../../state/document.store';
|
|
14
|
-
import { DocumentScrollService } from '../../services/document-scroll.service';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* This component is responsible for displaying and managing a list of documents.
|
|
19
|
-
* Provides functionality for file upload, document selection, and dialog management.
|
|
20
|
-
* @class DocumentListComponent
|
|
21
|
-
*/
|
|
22
|
-
@Component({
|
|
23
|
-
selector: 'lib-document-list',
|
|
24
|
-
standalone: false,
|
|
25
|
-
templateUrl: './document-list.component.html',
|
|
26
|
-
styleUrls: ['./document-list.component.scss'],
|
|
27
|
-
encapsulation: ViewEncapsulation.None
|
|
28
|
-
})
|
|
29
|
-
export class DocumentListComponent implements OnInit, OnDestroy, OnChanges, AfterViewInit {
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Represents the context ID for the document list.
|
|
33
|
-
* This value is passed from the parent component.
|
|
34
|
-
* @type {string}
|
|
35
|
-
* @memberof DocumentListComponent
|
|
36
|
-
*/
|
|
37
|
-
@Input() contextId: string = SHARED.EMPTY;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* The document list response data passed from the parent component.
|
|
41
|
-
* @type {DocumentListResponse[] | null}
|
|
42
|
-
* @memberof DocumentListComponent
|
|
43
|
-
*/
|
|
44
|
-
@Input() documentListResponse: DocumentListResponse[] | null = null;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* The selected menu item ID for scrolling to specific sections
|
|
48
|
-
* @type {string | null}
|
|
49
|
-
* @memberof DocumentListComponent
|
|
50
|
-
*/
|
|
51
|
-
@Input() selectedMenuItemId: string | null = null;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Additional navigation information for precise scrolling
|
|
55
|
-
* @type {object | null}
|
|
56
|
-
* @memberof DocumentListComponent
|
|
57
|
-
*/
|
|
58
|
-
@Input() navigationInfo: {
|
|
59
|
-
menuItemId: string;
|
|
60
|
-
menuItemLabel: string;
|
|
61
|
-
categoryLabel: string;
|
|
62
|
-
categoryIndex: number;
|
|
63
|
-
} | null = null;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Reference to the document categories container for scrolling
|
|
69
|
-
*/
|
|
70
|
-
@ViewChild('documentCategoriesContainer', { static: false }) documentCategoriesContainer!: ElementRef;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Subscription to document list response from store
|
|
74
|
-
*/
|
|
75
|
-
private documentListSubscription: Subscription = new Subscription();
|
|
76
|
-
|
|
77
|
-
@Output() handleSelectedDocumentInNewTab = new EventEmitter<{
|
|
78
|
-
selectedDocument: DocumentListItem;
|
|
79
|
-
contextId: string;
|
|
80
|
-
documentList: DocumentListItem[];
|
|
81
|
-
}>();
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* The currently selected document.
|
|
85
|
-
* @type {DocumentModel}
|
|
86
|
-
* @memberof DocumentListComponent
|
|
87
|
-
*/
|
|
88
|
-
selectedDocument!: DocumentListItem;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Default visibility of the sidebar.
|
|
92
|
-
* @type {boolean}
|
|
93
|
-
* @memberof DocumentListComponent
|
|
94
|
-
*/
|
|
95
|
-
isSidebarVisible: boolean = SHARED.FALSE;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Default visibility of the messages.
|
|
99
|
-
* @type {Message[]}
|
|
100
|
-
* @memberof DocumentListComponent
|
|
101
|
-
*/
|
|
102
|
-
messages: Message[] = SHARED.EMPTY_ARRAY;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Default visibility of the dialog.
|
|
106
|
-
* @type {boolean}
|
|
107
|
-
* @memberof DocumentListComponent
|
|
108
|
-
*/
|
|
109
|
-
isdialogVisible: boolean = SHARED.FALSE;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The list of documents to display.
|
|
113
|
-
* This value is passed from the parent component.
|
|
114
|
-
* @type {DocumentModel[]}
|
|
115
|
-
* @memberof DocumentListComponent
|
|
116
|
-
*/
|
|
117
|
-
@Input() documentList: DocumentListItem[] = SHARED.EMPTY_ARRAY;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Available document types for selection.
|
|
121
|
-
* @type {string[]}
|
|
122
|
-
* @memberof DocumentListComponent
|
|
123
|
-
*/
|
|
124
|
-
options: any[] = SHARED.EMPTY_ARRAY;
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* The selected option for the document type.
|
|
128
|
-
* @type {(string | null)}
|
|
129
|
-
* @memberof DocumentListComponent
|
|
130
|
-
*/
|
|
131
|
-
selectedOption: string | null = null;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* The file name associated with the document.
|
|
135
|
-
* It may be undefined until a file is selected or loaded.
|
|
136
|
-
* @type {string | undefined}
|
|
137
|
-
*/
|
|
138
|
-
fileName!: string | undefined;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Table data for each category
|
|
142
|
-
*/
|
|
143
|
-
categoryTables: TableData[] = SHARED.EMPTY_ARRAY;
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Document categories from the response
|
|
147
|
-
*/
|
|
148
|
-
documentCategories: DocumentListResponse[] = SHARED.EMPTY_ARRAY;
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Completion counts for each category
|
|
152
|
-
*/
|
|
153
|
-
categoryCompletionCounts: string[] = SHARED.EMPTY_ARRAY;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Severity levels for each category completion badge
|
|
157
|
-
*/
|
|
158
|
-
categorySeverities: ('success' | 'info' | 'warning' | 'danger')[] = SHARED.EMPTY_ARRAY;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Message to display for document deletion
|
|
162
|
-
*/
|
|
163
|
-
deleteMessage: Message[] = SHARED.EMPTY_ARRAY;
|
|
164
|
-
|
|
165
|
-
// Document name editing functionality moved to zoom controls component
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// Alias name functionality moved to zoom controls component
|
|
170
|
-
|
|
171
|
-
@Output() handleSelectedDocument = new EventEmitter<DocumentListItem>();
|
|
172
|
-
|
|
173
|
-
// Document name validation moved to zoom controls component
|
|
174
|
-
/**
|
|
175
|
-
* Getter to return category labels as they come from the API
|
|
176
|
-
*/
|
|
177
|
-
get formattedCategoryLabels(): string[] {
|
|
178
|
-
return this.documentCategories.map(category => category.label);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Getter to generate safe category IDs for HTML elements
|
|
183
|
-
*/
|
|
184
|
-
get categoryIds(): string[] {
|
|
185
|
-
return this.documentCategories.map((category, index) => {
|
|
186
|
-
if (category?.label) {
|
|
187
|
-
return `section-${category.label.toLowerCase().replace(' ', '-')}`;
|
|
188
|
-
}
|
|
189
|
-
return `section-category-${index}`;
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Creates an instance of DocumentListComponent.
|
|
195
|
-
* @class
|
|
196
|
-
* @param {DocumentListService} documentListService - The service responsible for document list operations.
|
|
197
|
-
*/
|
|
198
|
-
constructor(
|
|
199
|
-
private documentListService: DocumentListService,
|
|
200
|
-
private documentHttpService: DocumentHttpService,
|
|
201
|
-
private documentMenuService: DocumentMenuService,
|
|
202
|
-
private documentStore: DocumentStore,
|
|
203
|
-
private documentScrollService: DocumentScrollService
|
|
204
|
-
) {}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Handles changes to input properties
|
|
208
|
-
*/
|
|
209
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
210
|
-
if (changes[SHARED.CONTEXT_ID] && !changes[SHARED.CONTEXT_ID].firstChange) {
|
|
211
|
-
this.documentListService.refreshDocumentListForNewContext(this.contextId);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (changes['selectedMenuItemId']) {
|
|
215
|
-
if (this.selectedMenuItemId) {
|
|
216
|
-
this.scrollToCategorySection(this.selectedMenuItemId);
|
|
217
|
-
} else {
|
|
218
|
-
// Reset to top when menu item is deselected
|
|
219
|
-
this.resetToTop();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (changes['navigationInfo'] && this.navigationInfo) {
|
|
224
|
-
this.scrollToCategorySectionWithNavigationInfo(this.navigationInfo);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Handle document list changes due to filtering
|
|
228
|
-
if (changes['documentListResponse'] && !changes['documentListResponse'].firstChange) {
|
|
229
|
-
this.handleDocumentListFilteringChange();
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Initializes the component by setting up document list subscription.
|
|
235
|
-
*/
|
|
236
|
-
ngOnInit(): void {
|
|
237
|
-
this.setupDocumentListSubscription();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Called after the view is initialized
|
|
242
|
-
*/
|
|
243
|
-
ngAfterViewInit(): void {
|
|
244
|
-
if (this.selectedMenuItemId) {
|
|
245
|
-
setTimeout(() => {
|
|
246
|
-
this.scrollToCategorySection(this.selectedMenuItemId!);
|
|
247
|
-
}, 100);
|
|
248
|
-
}
|
|
249
|
-
this.documentScrollService.setupScrollListeners(this.documentCategoriesContainer.nativeElement);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Handles the visibility of the sidebar.
|
|
254
|
-
* @param {boolean} isVisible - Indicates whether the sidebar should be visible or not.
|
|
255
|
-
* @memberof DocumentListComponent
|
|
256
|
-
*/
|
|
257
|
-
handleOpenSideBar(isVisible: boolean): void {
|
|
258
|
-
this.isSidebarVisible = isVisible;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Builds document categories from the API response
|
|
265
|
-
*/
|
|
266
|
-
buildDocumentCategories(): void {
|
|
267
|
-
const result = this.documentListService.buildDocumentCategories(this.documentListResponse);
|
|
268
|
-
this.documentCategories = result.documentCategories;
|
|
269
|
-
this.categoryTables = result.categoryTables;
|
|
270
|
-
this.categoryCompletionCounts = result.categoryCompletionCounts;
|
|
271
|
-
this.categorySeverities = result.categorySeverities;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Sets up subscription to document list response from store
|
|
280
|
-
*/
|
|
281
|
-
setupDocumentListSubscription(): void {
|
|
282
|
-
this.documentListSubscription.add(
|
|
283
|
-
this.documentListService.setupDocumentListSubscription().subscribe({
|
|
284
|
-
next: (response: any) => {
|
|
285
|
-
this.documentListResponse = response;
|
|
286
|
-
this.buildDocumentCategories();
|
|
287
|
-
},
|
|
288
|
-
error: (error: any) => {
|
|
289
|
-
console.error(ERRORS.ERROR_FETCHING_DOCUMENTS, error);
|
|
290
|
-
}
|
|
291
|
-
})
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Handles table row click event
|
|
299
|
-
*/
|
|
300
|
-
handleTableRowClick(rowData: any): void {
|
|
301
|
-
this.isdialogVisible = SHARED.TRUE;
|
|
302
|
-
this.selectedDocument = this.documentListService.handleTableRowClick(rowData);
|
|
303
|
-
this.handleSelectedDocument.emit(this.selectedDocument);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Handles the delete action from the table component
|
|
308
|
-
* @param {any} rowData - The row data containing the document to delete
|
|
309
|
-
*/
|
|
310
|
-
handleDeleteAction(rowData: any): void {
|
|
311
|
-
this.documentListService.handleDeleteAction(rowData, this.contextId)
|
|
312
|
-
.subscribe({
|
|
313
|
-
next: (response) => {
|
|
314
|
-
if (this.selectedDocument && this.selectedDocument._id === rowData._id) {
|
|
315
|
-
this.handleCloseModal();
|
|
316
|
-
}
|
|
317
|
-
this.documentListService.refreshAllDataWithCurrentFilters(this.contextId);
|
|
318
|
-
},
|
|
319
|
-
error: (error) => {
|
|
320
|
-
this.showDeleteErrorMessage(error);
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
// Document name editing methods moved to zoom controls component
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* Closes the document viewer dialog and resets the selected document
|
|
329
|
-
*/
|
|
330
|
-
handleCloseModal(): void {
|
|
331
|
-
this.isdialogVisible = SHARED.FALSE;
|
|
332
|
-
this.selectedDocument = {} as DocumentListItem;
|
|
333
|
-
this.fileName = SHARED.EMPTY;
|
|
334
|
-
this.documentListService.refreshAllDataWithCurrentFilters(this.contextId);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Refreshes the document list after a status update
|
|
339
|
-
* @param {boolean} isDeleteAction - Optional flag indicating if this refresh is due to a delete action
|
|
340
|
-
*/
|
|
341
|
-
refreshDocumentList(isDeleteAction: boolean = false): void {
|
|
342
|
-
this.documentListService.refreshDocumentList(this.contextId);
|
|
343
|
-
if (isDeleteAction) {
|
|
344
|
-
this.deleteMessage = [{severity: SHARED.SUCCESS_SEVERITY, detail: SHARED.DOCUMENT_DELETED_SUCCESSFULLY}];
|
|
345
|
-
setTimeout(() => {
|
|
346
|
-
this.deleteMessage = SHARED.EMPTY_ARRAY;
|
|
347
|
-
this.handleCloseModal();
|
|
348
|
-
}, 2000);
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
handleTableRowCtrlClick(rowData: any): void {
|
|
353
|
-
this.selectedDocument = this.documentListService.handleTableRowClick(rowData);
|
|
354
|
-
this.handleSelectedDocument.emit(this.selectedDocument);
|
|
355
|
-
this.handleSelectedDocumentInNewTab.emit({
|
|
356
|
-
selectedDocument: this.selectedDocument,
|
|
357
|
-
contextId: this.contextId,
|
|
358
|
-
documentList: this.documentList
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
/**
|
|
363
|
-
* Handles document status update events from viewer
|
|
364
|
-
* @param event - The status update event
|
|
365
|
-
*/
|
|
366
|
-
handleDocumentStatusUpdate(event: { actionType?: string }): void {
|
|
367
|
-
if (event.actionType === SHARED.DELETE_ACTION) {
|
|
368
|
-
// Delete success is now handled separately via handleDeleteSuccess()
|
|
369
|
-
// Don't call refreshDocumentList here for delete actions
|
|
370
|
-
} else if (event.actionType === SHARED.NAME_UPDATE_ACTION) {
|
|
371
|
-
this.handleDocumentNameUpdate();
|
|
372
|
-
} else {
|
|
373
|
-
this.refreshDocumentList();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Shows delete error message for 2 seconds without closing dialog
|
|
379
|
-
* @param error - The error object from the delete operation
|
|
380
|
-
*/
|
|
381
|
-
private showDeleteErrorMessage(error: any): void {
|
|
382
|
-
const errorMessage = error?.error?.message || error?.message || 'Failed to delete document. Please try again.';
|
|
383
|
-
this.deleteMessage = [{severity: 'error', detail: errorMessage}];
|
|
384
|
-
|
|
385
|
-
// Clear error message after 2 seconds
|
|
386
|
-
setTimeout(() => {
|
|
387
|
-
this.deleteMessage = SHARED.EMPTY_ARRAY;
|
|
388
|
-
}, 2000);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
/**
|
|
392
|
-
* Handles delete error events from the document viewer
|
|
393
|
-
* @param error - The error object from the delete operation
|
|
394
|
-
*/
|
|
395
|
-
handleDeleteError(error: any): void {
|
|
396
|
-
this.showDeleteErrorMessage(error);
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Handles delete success events from the document viewer
|
|
401
|
-
*/
|
|
402
|
-
handleDeleteSuccess(): void {
|
|
403
|
-
this.refreshDocumentList(true);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Handles document name update event from viewer
|
|
408
|
-
*/
|
|
409
|
-
handleDocumentNameUpdate(): void {
|
|
410
|
-
this.documentListService.refreshAllDataWithCurrentFilters(this.contextId);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Handles the event when the document viewer is destroyed
|
|
415
|
-
* Triggers a refresh of the document data
|
|
416
|
-
*/
|
|
417
|
-
handleViewerDestroyed(): void {
|
|
418
|
-
this.documentListService.refreshDocumentList(this.contextId);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Scrolls to the category section that matches the selected menu item
|
|
423
|
-
* @param menuItemId - The ID of the selected menu item
|
|
424
|
-
*/
|
|
425
|
-
scrollToCategorySection(menuItemId: string): void {
|
|
426
|
-
if (!this.documentCategories || !this.documentCategoriesContainer) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
this.documentScrollService.setScrolling();
|
|
431
|
-
let targetCategory = this.findCategoryByMenuItemId(menuItemId);
|
|
432
|
-
if (!targetCategory) {
|
|
433
|
-
targetCategory = this.findCategoryByLegacyMatching(menuItemId);
|
|
434
|
-
}
|
|
435
|
-
if (!targetCategory) {
|
|
436
|
-
targetCategory = this.documentCategories[0];
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
if (targetCategory) {
|
|
440
|
-
const categoryIndex = this.documentCategories.findIndex(cat => cat === targetCategory);
|
|
441
|
-
const categoryElements = this.documentCategoriesContainer.nativeElement.querySelectorAll('.category');
|
|
442
|
-
if (categoryElements[categoryIndex]) {
|
|
443
|
-
categoryElements[categoryIndex].scrollIntoView({
|
|
444
|
-
behavior: SHARED.SMOOTH_SCROLL,
|
|
445
|
-
block: 'start',
|
|
446
|
-
inline: 'nearest'
|
|
447
|
-
});
|
|
448
|
-
this.highlightCategory(categoryElements[categoryIndex]);
|
|
449
|
-
this.documentScrollService.setupSectionObserver(categoryElements[categoryIndex], this.selectedMenuItemId!);
|
|
450
|
-
this.documentScrollService.resetScrollingAfterDelay(1200);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* Finds category by converting menuItemId to readable format and matching exactly
|
|
457
|
-
* @param menuItemId - The menu item ID to match
|
|
458
|
-
* @returns The matching category or null
|
|
459
|
-
*/
|
|
460
|
-
private findCategoryByMenuItemId(menuItemId: string): DocumentListResponse | null {
|
|
461
|
-
const readableLabel = this.convertMenuItemIdToReadableLabel(menuItemId);
|
|
462
|
-
let targetCategory = this.documentCategories.find(category =>
|
|
463
|
-
category.label.toLowerCase() === readableLabel.toLowerCase()
|
|
464
|
-
);
|
|
465
|
-
|
|
466
|
-
if (!targetCategory) {
|
|
467
|
-
targetCategory = this.documentCategories.find(category => {
|
|
468
|
-
const categoryLabel = category.label.toLowerCase();
|
|
469
|
-
const menuLabel = readableLabel.toLowerCase();
|
|
470
|
-
return categoryLabel.includes(menuLabel) &&
|
|
471
|
-
!this.isSubstringOfLongerCategory(menuLabel, categoryLabel);
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
return targetCategory || null;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* Converts menuItemId to readable label format
|
|
479
|
-
* @param menuItemId - The menu item ID
|
|
480
|
-
* @returns Readable label
|
|
481
|
-
*/
|
|
482
|
-
private convertMenuItemIdToReadableLabel(menuItemId: string): string {
|
|
483
|
-
// Convert kebab-case or snake_case to Title Case
|
|
484
|
-
return menuItemId
|
|
485
|
-
.replace(/[-_]/g, ' ')
|
|
486
|
-
.replace(/\b\w/g, l => l.toUpperCase());
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Checks if a menu label is a substring of a longer category name
|
|
491
|
-
* @param menuLabel - The menu label to check
|
|
492
|
-
* @param categoryLabel - The category label to check against
|
|
493
|
-
* @returns True if menuLabel is a substring of a longer category
|
|
494
|
-
*/
|
|
495
|
-
private isSubstringOfLongerCategory(menuLabel: string, categoryLabel: string): boolean {
|
|
496
|
-
// If the category is significantly longer than the menu item, it's likely a substring
|
|
497
|
-
return categoryLabel.length > menuLabel.length + 3; // Allow some tolerance
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
/**
|
|
501
|
-
* Legacy matching for backward compatibility with existing hardcoded keywords
|
|
502
|
-
* @param menuItemId - The menu item ID
|
|
503
|
-
* @returns The matching category or null
|
|
504
|
-
*/
|
|
505
|
-
private findCategoryByLegacyMatching(menuItemId: string): DocumentListResponse | null {
|
|
506
|
-
// Legacy matching for specific hardcoded keywords
|
|
507
|
-
if (menuItemId.includes(SHARED.APPLICATION_LOWERCASE)) {
|
|
508
|
-
return this.documentCategories.find(cat =>
|
|
509
|
-
cat.label.toLowerCase().includes(SHARED.APPLICATION_LOWERCASE)
|
|
510
|
-
) || null;
|
|
511
|
-
} else if (menuItemId.includes(SHARED.APPLICANT_LOWERCASE) || menuItemId.includes(SHARED.USER_LOWERCASE)) {
|
|
512
|
-
return this.documentCategories.find(cat =>
|
|
513
|
-
cat.label.toLowerCase().includes(SHARED.APPLICANT_LOWERCASE) ||
|
|
514
|
-
cat.label.toLowerCase().includes(SHARED.USER_LOWERCASE)
|
|
515
|
-
) || null;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return null;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* Scrolls to the category section using navigationInfo
|
|
523
|
-
* @param navigationInfo - The navigation info object containing menuItemId
|
|
524
|
-
*/
|
|
525
|
-
scrollToCategorySectionWithNavigationInfo(navigationInfo: {
|
|
526
|
-
menuItemId: string;
|
|
527
|
-
menuItemLabel: string;
|
|
528
|
-
categoryLabel: string;
|
|
529
|
-
categoryIndex: number;
|
|
530
|
-
}): void {
|
|
531
|
-
if (!this.documentCategories || !this.documentCategoriesContainer) {
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
// Set scrolling flag
|
|
536
|
-
this.documentScrollService.setScrolling();
|
|
537
|
-
const targetCategory = this.documentCategories.find(category =>
|
|
538
|
-
category.label.toLowerCase() === navigationInfo.menuItemLabel.toLowerCase()
|
|
539
|
-
);
|
|
540
|
-
if (targetCategory) {
|
|
541
|
-
const sectionId = 'section-' + targetCategory.label.toLowerCase().replace(SHARED.EMPTY_SPACE, SHARED.HYPEN);
|
|
542
|
-
let targetElement = this.documentCategoriesContainer.nativeElement.querySelector(`#${sectionId}`);
|
|
543
|
-
if (targetElement) {
|
|
544
|
-
targetElement.scrollIntoView({
|
|
545
|
-
behavior: SHARED.SMOOTH_SCROLL,
|
|
546
|
-
block: 'start',
|
|
547
|
-
inline: 'nearest'
|
|
548
|
-
});
|
|
549
|
-
this.highlightCategory(targetElement);
|
|
550
|
-
this.documentScrollService.setupSectionObserver(targetElement, this.selectedMenuItemId!);
|
|
551
|
-
this.documentScrollService.resetScrollingAfterDelay(1200);
|
|
552
|
-
} else {
|
|
553
|
-
const categoryIndex = this.documentCategories.findIndex(cat => cat === targetCategory);
|
|
554
|
-
const categoryElements = this.documentCategoriesContainer.nativeElement.querySelectorAll('.category');
|
|
555
|
-
if (categoryElements[categoryIndex]) {
|
|
556
|
-
categoryElements[categoryIndex].scrollIntoView({
|
|
557
|
-
behavior: SHARED.SMOOTH_SCROLL,
|
|
558
|
-
block: 'start',
|
|
559
|
-
inline: 'nearest'
|
|
560
|
-
});
|
|
561
|
-
this.highlightCategory(categoryElements[categoryIndex]);
|
|
562
|
-
|
|
563
|
-
// Setup observer to deselect menu item when section scrolls out of view
|
|
564
|
-
this.documentScrollService.setupSectionObserver(categoryElements[categoryIndex], this.selectedMenuItemId!);
|
|
565
|
-
|
|
566
|
-
// Reset scrolling flag after smooth scroll completes
|
|
567
|
-
this.documentScrollService.resetScrollingAfterDelay(500);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Adds a temporary highlight effect to the scrolled category
|
|
575
|
-
* @param categoryElement - The DOM element of the category to highlight
|
|
576
|
-
*/
|
|
577
|
-
highlightCategory(categoryElement: HTMLElement): void {
|
|
578
|
-
categoryElement.classList.add('category-highlight');
|
|
579
|
-
setTimeout(() => {
|
|
580
|
-
categoryElement.classList.remove('category-highlight');
|
|
581
|
-
}, 2000);
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Alternative scrolling method using IntersectionObserver for better performance
|
|
586
|
-
* This method can be used as a fallback or alternative to the current approach
|
|
587
|
-
* @param navigationInfo - The navigation info object
|
|
588
|
-
*/
|
|
589
|
-
scrollToCategorySectionWithIntersectionObserver(navigationInfo: {
|
|
590
|
-
menuItemId: string;
|
|
591
|
-
menuItemLabel: string;
|
|
592
|
-
categoryLabel: string;
|
|
593
|
-
categoryIndex: number;
|
|
594
|
-
}): void {
|
|
595
|
-
if (!this.documentCategories || !this.documentCategoriesContainer) {
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
const targetCategory = this.documentCategories.find(category =>
|
|
599
|
-
category.label.toLowerCase() === navigationInfo.menuItemLabel.toLowerCase()
|
|
600
|
-
);
|
|
601
|
-
if (!targetCategory) {
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
const observer = new IntersectionObserver((entries) => {
|
|
605
|
-
entries.forEach(entry => {
|
|
606
|
-
if (entry.isIntersecting && entry.target.id === `section-${targetCategory.label.toLowerCase().replace(SHARED.EMPTY_SPACE, SHARED.HYPEN)}`) {
|
|
607
|
-
entry.target.scrollIntoView({behavior: SHARED.SMOOTH_SCROLL as ScrollBehavior,block: 'start'});
|
|
608
|
-
this.highlightCategory(entry.target as HTMLElement);
|
|
609
|
-
observer.disconnect();
|
|
610
|
-
this.documentScrollService.setupSectionObserver(entry.target, this.selectedMenuItemId!);
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
}, {threshold: 0.1,rootMargin: '0px 0px -100px 0px'});
|
|
614
|
-
const categoryElements = this.documentCategoriesContainer.nativeElement.querySelectorAll('.category');
|
|
615
|
-
categoryElements.forEach((element: Element) => {
|
|
616
|
-
observer.observe(element);
|
|
617
|
-
});
|
|
618
|
-
setTimeout(() => {
|
|
619
|
-
observer.disconnect();
|
|
620
|
-
this.scrollToCategorySectionWithNavigationInfo(navigationInfo);
|
|
621
|
-
}, 100);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Resets the document list to the top when menu item is deselected
|
|
626
|
-
*/
|
|
627
|
-
private resetToTop(): void {
|
|
628
|
-
if (this.documentCategoriesContainer) {
|
|
629
|
-
this.documentCategoriesContainer.nativeElement.scrollTo({
|
|
630
|
-
top: 0,
|
|
631
|
-
behavior: SHARED.SMOOTH_SCROLL
|
|
632
|
-
});
|
|
633
|
-
}
|
|
634
|
-
this.documentScrollService.disconnectSectionObserver();
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
/**
|
|
638
|
-
* Handles changes in document list due to filtering
|
|
639
|
-
* Checks if the selected menu item's section is still visible and deselects if not
|
|
640
|
-
*/
|
|
641
|
-
private handleDocumentListFilteringChange(): void {
|
|
642
|
-
if (this.selectedMenuItemId && this.documentCategories) {
|
|
643
|
-
// If no categories are available (all filtered out), deselect the menu item
|
|
644
|
-
if (this.documentCategories.length === 0) {
|
|
645
|
-
this.deselectMenuItemAndReset();
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
// Use the document menu service to check visibility
|
|
650
|
-
const isSectionVisible = this.documentMenuService.isMenuItemSectionVisible(
|
|
651
|
-
this.selectedMenuItemId,
|
|
652
|
-
this.documentListResponse
|
|
653
|
-
);
|
|
654
|
-
|
|
655
|
-
if (!isSectionVisible) {
|
|
656
|
-
this.deselectMenuItemAndReset();
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
/**
|
|
664
|
-
* Deselects the current menu item and resets the view
|
|
665
|
-
*/
|
|
666
|
-
private deselectMenuItemAndReset(): void {
|
|
667
|
-
this.selectedMenuItemId = null;
|
|
668
|
-
this.documentStore.setSelectedMenuItem(null);
|
|
669
|
-
this.resetToTop();
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* Cleanup subscriptions on component destroy
|
|
674
|
-
*/
|
|
675
|
-
ngOnDestroy(): void {
|
|
676
|
-
this.documentListSubscription.unsubscribe();
|
|
677
|
-
this.documentScrollService.disconnectSectionObserver();
|
|
678
|
-
if (this.documentCategoriesContainer) {
|
|
679
|
-
this.documentScrollService.cleanupScrollListeners(this.documentCategoriesContainer.nativeElement);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|