cat-documents-ng 1.0.6 → 1.0.8
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,114 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
import { SidebarComponent } from './sidebar.component';
|
|
3
|
-
import { SidebarModule } from 'primeng/sidebar';
|
|
4
|
-
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
5
|
-
import { ConfirmationService } from 'primeng/api';
|
|
6
|
-
import { Injector } from '@angular/core';
|
|
7
|
-
|
|
8
|
-
describe('SidebarComponent', () => {
|
|
9
|
-
let component: SidebarComponent;
|
|
10
|
-
let fixture: ComponentFixture<SidebarComponent>;
|
|
11
|
-
let mockConfirmationService: jasmine.SpyObj<ConfirmationService>;
|
|
12
|
-
let mockInjector: jasmine.SpyObj<Injector>;
|
|
13
|
-
|
|
14
|
-
beforeEach(async () => {
|
|
15
|
-
mockConfirmationService = jasmine.createSpyObj('ConfirmationService', ['confirm']);
|
|
16
|
-
mockInjector = jasmine.createSpyObj('Injector', ['get']);
|
|
17
|
-
mockInjector.get.and.returnValue(mockConfirmationService);
|
|
18
|
-
|
|
19
|
-
await TestBed.configureTestingModule({
|
|
20
|
-
declarations: [ SidebarComponent ],
|
|
21
|
-
imports: [ SidebarModule, ConfirmDialogModule ],
|
|
22
|
-
providers: [
|
|
23
|
-
ConfirmationService
|
|
24
|
-
]
|
|
25
|
-
})
|
|
26
|
-
.compileComponents();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
fixture = TestBed.createComponent(SidebarComponent);
|
|
31
|
-
component = fixture.componentInstance;
|
|
32
|
-
|
|
33
|
-
// Mock the injector
|
|
34
|
-
(component as any).injector = mockInjector;
|
|
35
|
-
(component as any).confirmationService = mockConfirmationService;
|
|
36
|
-
|
|
37
|
-
fixture.detectChanges();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should create', () => {
|
|
41
|
-
expect(component).toBeTruthy();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should open sidebar when open() is called', () => {
|
|
45
|
-
component.open();
|
|
46
|
-
expect(component.visible).toBe(true);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should close sidebar when close() is called', () => {
|
|
50
|
-
component.visible = true;
|
|
51
|
-
component.close();
|
|
52
|
-
expect(component.visible).toBe(false);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('should show confirmation dialog when close button is clicked with unsaved changes', () => {
|
|
56
|
-
component.visible = true;
|
|
57
|
-
component.hasUnsavedChanges = true;
|
|
58
|
-
|
|
59
|
-
component.handleClose();
|
|
60
|
-
|
|
61
|
-
expect(mockConfirmationService.confirm).toHaveBeenCalled();
|
|
62
|
-
expect(component.visible).toBe(true); // Should still be open
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should close sidebar when close button is clicked without unsaved changes', () => {
|
|
66
|
-
component.visible = true;
|
|
67
|
-
component.hasUnsavedChanges = false;
|
|
68
|
-
|
|
69
|
-
component.handleClose();
|
|
70
|
-
|
|
71
|
-
expect(component.visible).toBe(false);
|
|
72
|
-
expect(mockConfirmationService.confirm).not.toHaveBeenCalled();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should close and emit onClose when confirmation is accepted', () => {
|
|
76
|
-
component.visible = true;
|
|
77
|
-
component.hasUnsavedChanges = true;
|
|
78
|
-
|
|
79
|
-
// Simulate confirmation accepted
|
|
80
|
-
mockConfirmationService.confirm.and.callFake((options: any) => {
|
|
81
|
-
options.accept();
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
spyOn(component.onClose, 'emit');
|
|
85
|
-
component.handleClose();
|
|
86
|
-
|
|
87
|
-
expect(component.visible).toBe(false);
|
|
88
|
-
expect(mockConfirmationService.confirm).toHaveBeenCalled();
|
|
89
|
-
expect(component.onClose.emit).toHaveBeenCalled();
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should keep sidebar open when confirmation is rejected', () => {
|
|
93
|
-
component.visible = true;
|
|
94
|
-
component.hasUnsavedChanges = true;
|
|
95
|
-
|
|
96
|
-
// Simulate confirmation rejected
|
|
97
|
-
mockConfirmationService.confirm.and.callFake((options: any) => {
|
|
98
|
-
options.reject();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
component.handleClose();
|
|
102
|
-
|
|
103
|
-
expect(component.visible).toBe(true);
|
|
104
|
-
expect(mockConfirmationService.confirm).toHaveBeenCalled();
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should check for unsaved changes correctly', () => {
|
|
108
|
-
component.hasUnsavedChanges = true;
|
|
109
|
-
expect(component.checkForUnsavedChanges()).toBe(true);
|
|
110
|
-
|
|
111
|
-
component.hasUnsavedChanges = false;
|
|
112
|
-
expect(component.checkForUnsavedChanges()).toBe(false);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { Component, Input, Output, EventEmitter, OnDestroy, HostListener } from '@angular/core';
|
|
2
|
-
import { SHARED } from '../../../../Shared/constant/SHARED';
|
|
3
|
-
import { Subject } from 'rxjs';
|
|
4
|
-
import { ConfirmationService } from 'primeng/api';
|
|
5
|
-
import { ConfirmationDialogComponent } from '../../../../Shared/components/confirmation-dialog/confirmation-dialog.component';
|
|
6
|
-
|
|
7
|
-
// Interface for confirmation options
|
|
8
|
-
interface ConfirmationOptions {
|
|
9
|
-
message: string;
|
|
10
|
-
header?: string;
|
|
11
|
-
icon?: string;
|
|
12
|
-
acceptLabel?: string;
|
|
13
|
-
rejectLabel?: string;
|
|
14
|
-
acceptIcon?: string;
|
|
15
|
-
rejectIcon?: string;
|
|
16
|
-
acceptButtonClass?: string;
|
|
17
|
-
rejectButtonClass?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Component({
|
|
21
|
-
selector: 'lib-sidebar',
|
|
22
|
-
templateUrl: './sidebar.component.html',
|
|
23
|
-
styleUrls: ['./sidebar.component.scss'],
|
|
24
|
-
standalone: false
|
|
25
|
-
})
|
|
26
|
-
export class SidebarComponent implements OnDestroy {
|
|
27
|
-
// Flag to prevent multiple confirmations
|
|
28
|
-
private isShowingConfirmation: boolean = false;
|
|
29
|
-
|
|
30
|
-
@Input() set visible(value: boolean) {
|
|
31
|
-
this._visible = value;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
get visible(): boolean {
|
|
35
|
-
return this._visible;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
private _visible: boolean = false;
|
|
39
|
-
|
|
40
|
-
@Input() position: 'left' | 'right' = 'right';
|
|
41
|
-
@Input() width: string = SHARED.WIDTH;
|
|
42
|
-
@Input() title: string = SHARED.EMPTY;
|
|
43
|
-
@Input() showCloseButton: boolean = true;
|
|
44
|
-
@Input() modal: boolean = true;
|
|
45
|
-
@Input() dismissible: boolean = true;
|
|
46
|
-
@Input() styleClass: string = SHARED.EMPTY;
|
|
47
|
-
@Input() appendTo: string = 'body';
|
|
48
|
-
@Input() blockScroll: boolean = true;
|
|
49
|
-
@Input() closeIcon: string = SHARED.CLOSE_ICON;
|
|
50
|
-
@Input() showSaveButton: boolean = false;
|
|
51
|
-
@Input() saveButtonText: string = SHARED.SAVE;
|
|
52
|
-
@Input() saveButtonDisabled: boolean = false;
|
|
53
|
-
@Input() successMessage: string = SHARED.SUCCESS_MESSAGE;
|
|
54
|
-
@Input() errorMessage: string = SHARED.EMPTY;
|
|
55
|
-
@Input() hasUnsavedChanges: boolean = false;
|
|
56
|
-
|
|
57
|
-
@Output() visibleChange = new EventEmitter<boolean>();
|
|
58
|
-
@Output() onShow = new EventEmitter<void>();
|
|
59
|
-
@Output() onHide = new EventEmitter<void>();
|
|
60
|
-
@Output() onSave = new EventEmitter<void>();
|
|
61
|
-
@Output() onClose = new EventEmitter<void>();
|
|
62
|
-
|
|
63
|
-
showSuccessMessage: boolean = false;
|
|
64
|
-
showErrorMessage: boolean = false;
|
|
65
|
-
private destroy$ = new Subject<void>();
|
|
66
|
-
|
|
67
|
-
unsavedChangesConfirmationOptions: ConfirmationOptions = {
|
|
68
|
-
message: SHARED.UNSAVED_CHANGES_MESSAGE,
|
|
69
|
-
acceptLabel: SHARED.YES,
|
|
70
|
-
rejectLabel: SHARED.NO,
|
|
71
|
-
acceptIcon: SHARED.ACCEPT_ICON,
|
|
72
|
-
rejectIcon: SHARED.REJECT_ICON,
|
|
73
|
-
acceptButtonClass: SHARED.ACCEPT_BUTTON_STYLE_CLASS,
|
|
74
|
-
rejectButtonClass: SHARED.REJECT_BUTTON_STYLE_CLASS
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
constructor(private confirmationService: ConfirmationService) {}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Handles the onHide event from PrimeNG sidebar
|
|
81
|
-
* Only emits when actually closing, not when showing confirmation
|
|
82
|
-
*/
|
|
83
|
-
onSidebarHide(): void {
|
|
84
|
-
if (!this.isShowingConfirmation) {
|
|
85
|
-
this.onHide.emit();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Handles the visibleChange event from PrimeNG sidebar
|
|
91
|
-
* Intercepts automatic closing to show confirmation if needed
|
|
92
|
-
*/
|
|
93
|
-
onVisibleChange(value: boolean): void {
|
|
94
|
-
if (!value && this.hasUnsavedChanges && !this.isShowingConfirmation) {
|
|
95
|
-
this._visible = true;
|
|
96
|
-
this.showUnsavedChangesConfirmation();
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this.visibleChange.emit(value);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Opens the sidebar
|
|
105
|
-
*/
|
|
106
|
-
open(): void {
|
|
107
|
-
this._visible = true;
|
|
108
|
-
this.clearMessages();
|
|
109
|
-
this.visibleChange.emit(this._visible);
|
|
110
|
-
this.onShow.emit();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Closes the sidebar
|
|
115
|
-
*/
|
|
116
|
-
close(): void {
|
|
117
|
-
this._visible = false;
|
|
118
|
-
this.clearMessages();
|
|
119
|
-
this.visibleChange.emit(this._visible);
|
|
120
|
-
this.onHide.emit();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Handles escape key press
|
|
125
|
-
* Shows confirmation if there are unsaved changes
|
|
126
|
-
*/
|
|
127
|
-
@HostListener('document:keydown.escape', ['$event'])
|
|
128
|
-
handleEscapeKey(event: KeyboardEvent): void {
|
|
129
|
-
if (this.visible) {
|
|
130
|
-
event.preventDefault();
|
|
131
|
-
this.handleClose();
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Handles backdrop click events
|
|
137
|
-
* Prevents default PrimeNG behavior and shows confirmation if needed
|
|
138
|
-
*/
|
|
139
|
-
handleBackdropClick(event: Event): void {
|
|
140
|
-
event.preventDefault();
|
|
141
|
-
event.stopPropagation();
|
|
142
|
-
this.handleClose();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Handles all closing scenarios (backdrop click, escape key, close button, etc.)
|
|
147
|
-
* This is the single entry point for all closing logic
|
|
148
|
-
*/
|
|
149
|
-
handleClose(): void {
|
|
150
|
-
if (this.hasUnsavedChanges && !this.isShowingConfirmation) {
|
|
151
|
-
this.showUnsavedChangesConfirmation();
|
|
152
|
-
} else {
|
|
153
|
-
this.close();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Shows confirmation dialog for unsaved changes
|
|
159
|
-
*/
|
|
160
|
-
private showUnsavedChangesConfirmation(): void {
|
|
161
|
-
if (this.isShowingConfirmation) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
this.isShowingConfirmation = true;
|
|
165
|
-
ConfirmationDialogComponent.confirm(
|
|
166
|
-
this.confirmationService,
|
|
167
|
-
this.unsavedChangesConfirmationOptions,
|
|
168
|
-
() => {
|
|
169
|
-
this.isShowingConfirmation = false;
|
|
170
|
-
this.close();
|
|
171
|
-
this.onClose.emit();
|
|
172
|
-
},
|
|
173
|
-
() => {
|
|
174
|
-
this.isShowingConfirmation = false;
|
|
175
|
-
}
|
|
176
|
-
);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Shows success message and closes sidebar after delay
|
|
181
|
-
*/
|
|
182
|
-
showSuccess(): void {
|
|
183
|
-
this.showSuccessMessage = true;
|
|
184
|
-
this.showErrorMessage = false;
|
|
185
|
-
setTimeout(() => {
|
|
186
|
-
this.close();
|
|
187
|
-
}, 2000);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Shows error message
|
|
192
|
-
*/
|
|
193
|
-
showError(message?: string): void {
|
|
194
|
-
this.showErrorMessage = true;
|
|
195
|
-
this.showSuccessMessage = false;
|
|
196
|
-
this.errorMessage = message || SHARED.EMPTY;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Clears all messages
|
|
201
|
-
*/
|
|
202
|
-
clearMessages(): void {
|
|
203
|
-
this.showSuccessMessage = false;
|
|
204
|
-
this.showErrorMessage = false;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Checks if there are unsaved changes
|
|
209
|
-
* @returns True if there are unsaved changes, false otherwise
|
|
210
|
-
*/
|
|
211
|
-
checkForUnsavedChanges(): boolean {
|
|
212
|
-
return this.hasUnsavedChanges;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Lifecycle hook that is called when component is destroyed.
|
|
217
|
-
* Cleans up subscriptions.
|
|
218
|
-
*/
|
|
219
|
-
ngOnDestroy(): void {
|
|
220
|
-
this.destroy$.next();
|
|
221
|
-
this.destroy$.complete();
|
|
222
|
-
}
|
|
223
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<div class="user-list-container" [@slideInFromTop]>
|
|
2
|
-
<div class="user-cards">
|
|
3
|
-
<div
|
|
4
|
-
*ngFor="let user of filteredUserData"
|
|
5
|
-
class="user-card"
|
|
6
|
-
[class.selected]="selectedUser === user.name"
|
|
7
|
-
[style.border-color]="selectedUser === user.name ? getAvatarColor(user.color) : 'transparent'"
|
|
8
|
-
(click)="onUserSelect(user.name, user._id)"
|
|
9
|
-
>
|
|
10
|
-
@if(user.name === "Application Docs"){
|
|
11
|
-
<div class="user-avatar" [ngClass]="'avatar-' + user.color">
|
|
12
|
-
<span class="initials"><i class="pi pi-user"></i></span>
|
|
13
|
-
</div>
|
|
14
|
-
}@else {
|
|
15
|
-
<div class="user-avatar" [ngClass]="'avatar-' + user.color">
|
|
16
|
-
<span class="initials">{{ user.initials }}</span>
|
|
17
|
-
</div>
|
|
18
|
-
}
|
|
19
|
-
<div class="user-info">
|
|
20
|
-
<div class="username">{{ user.name }}</div>
|
|
21
|
-
<div class="document-counts">
|
|
22
|
-
<span style="color : #16A34A;"> {{ user.approved }} approved </span><span>/ {{ user.pending }} outstanding</span>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<!-- Show message when filtered list is empty -->
|
|
29
|
-
<div *ngIf="filteredUserData.length === 0 && shouldShowContainer" class="no-users-message" [@slideInFromTop]>
|
|
30
|
-
<p>No users available for this category.</p>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
.user-list-container {
|
|
2
|
-
padding: 1rem;
|
|
3
|
-
padding-bottom: 0.5rem;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.user-cards {
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-wrap: wrap;
|
|
9
|
-
transition: all 0.3s ease-in-out;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.user-card {
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
gap: 0.75rem;
|
|
16
|
-
padding: 1rem;
|
|
17
|
-
border: 2px solid transparent;
|
|
18
|
-
border-radius: 8px;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
transition: all 0.2s ease;
|
|
21
|
-
background: white;
|
|
22
|
-
min-width: 140px;
|
|
23
|
-
max-width: 300px;
|
|
24
|
-
height: 70px;
|
|
25
|
-
position: relative;
|
|
26
|
-
flex-shrink: 0;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.user-card:hover {
|
|
30
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.user-card.selected {
|
|
34
|
-
background-color: #f8fafc;
|
|
35
|
-
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
|
|
36
|
-
border-width: 2px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.user-avatar {
|
|
40
|
-
width: 40px;
|
|
41
|
-
height: 40px;
|
|
42
|
-
border-radius: 50%;
|
|
43
|
-
display: flex;
|
|
44
|
-
align-items: center;
|
|
45
|
-
justify-content: center;
|
|
46
|
-
font-weight: bold;
|
|
47
|
-
color: white;
|
|
48
|
-
font-size: 14px;
|
|
49
|
-
flex-shrink: 0;
|
|
50
|
-
font-weight: 400;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.avatar-orange { background-color: #FEF3C7; color: #B45309;}
|
|
54
|
-
.avatar-blue { background-color: #DBEAFE; color: #1D4ED8;}
|
|
55
|
-
.avatar-green { background-color: #22C55E1A; color: #36AA86;}
|
|
56
|
-
.avatar-grey { background-color: #EBECED; color: #5B6676;}
|
|
57
|
-
.avatar-purple { background-color: #3B82F61A; color: #3B82F6;}
|
|
58
|
-
|
|
59
|
-
.user-info {
|
|
60
|
-
flex: 1;
|
|
61
|
-
min-width: 0;
|
|
62
|
-
overflow: hidden;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.username {
|
|
66
|
-
font-weight: 600;
|
|
67
|
-
color: #1f2937;
|
|
68
|
-
margin-bottom: 0.25rem;
|
|
69
|
-
white-space: nowrap;
|
|
70
|
-
overflow: hidden;
|
|
71
|
-
text-overflow: ellipsis;
|
|
72
|
-
line-height: 1.2;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.document-counts {
|
|
76
|
-
font-size: 0.875rem;
|
|
77
|
-
color: #6b7280;
|
|
78
|
-
white-space: nowrap;
|
|
79
|
-
overflow: hidden;
|
|
80
|
-
text-overflow: ellipsis;
|
|
81
|
-
line-height: 1.35;
|
|
82
|
-
padding-bottom: 2px;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.selection-indicator {
|
|
86
|
-
position: absolute;
|
|
87
|
-
top: 8px;
|
|
88
|
-
right: 8px;
|
|
89
|
-
width: 20px;
|
|
90
|
-
height: 20px;
|
|
91
|
-
background-color: #10b981;
|
|
92
|
-
border-radius: 50%;
|
|
93
|
-
display: flex;
|
|
94
|
-
align-items: center;
|
|
95
|
-
justify-content: center;
|
|
96
|
-
color: white;
|
|
97
|
-
font-size: 12px;
|
|
98
|
-
flex-shrink: 0;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.no-users-message {
|
|
102
|
-
display: flex;
|
|
103
|
-
justify-content: center;
|
|
104
|
-
align-items: center;
|
|
105
|
-
padding: 2rem;
|
|
106
|
-
background: #f8fafc;
|
|
107
|
-
border-radius: 8px;
|
|
108
|
-
border: 2px dashed #d1d5db;
|
|
109
|
-
margin: 1rem 0;
|
|
110
|
-
|
|
111
|
-
p {
|
|
112
|
-
color: #6b7280;
|
|
113
|
-
font-size: 0.875rem;
|
|
114
|
-
font-weight: 500;
|
|
115
|
-
margin: 0;
|
|
116
|
-
text-align: center;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { UserListComponent } from './user-list.component';
|
|
4
|
-
|
|
5
|
-
describe('UserListComponent', () => {
|
|
6
|
-
let component: UserListComponent;
|
|
7
|
-
let fixture: ComponentFixture<UserListComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
await TestBed.configureTestingModule({
|
|
11
|
-
declarations: [UserListComponent]
|
|
12
|
-
})
|
|
13
|
-
.compileComponents();
|
|
14
|
-
|
|
15
|
-
fixture = TestBed.createComponent(UserListComponent);
|
|
16
|
-
component = fixture.componentInstance;
|
|
17
|
-
fixture.detectChanges();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should create', () => {
|
|
21
|
-
expect(component).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, ChangeDetectorRef, ChangeDetectionStrategy } from '@angular/core';
|
|
3
|
-
import { trigger, state, style, transition, animate } from '@angular/animations';
|
|
4
|
-
import { SHARED, USERLIST } from '../../../../Shared/constant/SHARED';
|
|
5
|
-
import { DocumentStore } from '../../state/document.store';
|
|
6
|
-
import { DocumentQuery } from '../../state/document.query';
|
|
7
|
-
import { UserListModel } from '../../models/user-list.model';
|
|
8
|
-
import { UserListService } from '../../services/user-list.service';
|
|
9
|
-
import { DocumentCategory } from '../../models/document-category.model';
|
|
10
|
-
import { DocumentHelperService } from '../../services/document.service';
|
|
11
|
-
import { Subscription } from 'rxjs';
|
|
12
|
-
|
|
13
|
-
@Component({
|
|
14
|
-
selector: 'lib-user-list',
|
|
15
|
-
standalone : false,
|
|
16
|
-
templateUrl: './user-list.component.html',
|
|
17
|
-
styleUrls: ['./user-list.component.scss'],
|
|
18
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
19
|
-
animations: [
|
|
20
|
-
trigger('slideInFromTop', [
|
|
21
|
-
state('void', style({
|
|
22
|
-
opacity: 0,
|
|
23
|
-
transform: 'translateY(-10px)'
|
|
24
|
-
})),
|
|
25
|
-
state('*', style({
|
|
26
|
-
opacity: 1,
|
|
27
|
-
transform: 'translateY(0)'
|
|
28
|
-
})),
|
|
29
|
-
transition('void => *', [
|
|
30
|
-
animate('300ms ease-out')
|
|
31
|
-
])
|
|
32
|
-
]),
|
|
33
|
-
trigger('fadeIn', [
|
|
34
|
-
state('void', style({
|
|
35
|
-
opacity: 0,
|
|
36
|
-
transform: 'scale(0.8)'
|
|
37
|
-
})),
|
|
38
|
-
state('*', style({
|
|
39
|
-
opacity: 1,
|
|
40
|
-
transform: 'scale(1)'
|
|
41
|
-
})),
|
|
42
|
-
transition('void => *', [
|
|
43
|
-
animate('200ms ease-in-out')
|
|
44
|
-
])
|
|
45
|
-
])
|
|
46
|
-
]
|
|
47
|
-
})
|
|
48
|
-
export class UserListComponent implements OnInit, OnChanges {
|
|
49
|
-
|
|
50
|
-
@Input() userList: UserListModel[] = SHARED.EMPTY_ARRAY;
|
|
51
|
-
@Input() categories: DocumentCategory[] = SHARED.EMPTY_ARRAY;
|
|
52
|
-
@Output() userSelected = new EventEmitter<string>();
|
|
53
|
-
|
|
54
|
-
userData: UserListModel[] = SHARED.EMPTY_ARRAY;
|
|
55
|
-
filteredUserData: UserListModel[] = SHARED.EMPTY_ARRAY;
|
|
56
|
-
selectedUser: string | undefined;
|
|
57
|
-
shouldShowContainer: boolean = true;
|
|
58
|
-
|
|
59
|
-
private userListSubscription: Subscription = new Subscription();
|
|
60
|
-
private categoriesSubscription: Subscription = new Subscription();
|
|
61
|
-
|
|
62
|
-
constructor(
|
|
63
|
-
public documentService : DocumentHelperService,
|
|
64
|
-
private documentStore: DocumentStore,
|
|
65
|
-
private documentQuery: DocumentQuery,
|
|
66
|
-
private userListService: UserListService,
|
|
67
|
-
private cdr: ChangeDetectorRef
|
|
68
|
-
){
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
73
|
-
if (changes[SHARED.USER_LIST] && !changes[SHARED.USER_LIST].firstChange) {
|
|
74
|
-
this.initializeUserData();
|
|
75
|
-
}
|
|
76
|
-
if (changes[SHARED.CATEGORIES] && !changes[SHARED.CATEGORIES].firstChange) {
|
|
77
|
-
this.updateFilteredUserData();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
initializeUserData(): void {
|
|
82
|
-
if (this.userList && this.userList.length > 0) {
|
|
83
|
-
this.userData = this.userListService.processUserData(this.userList);
|
|
84
|
-
this.updateFilteredUserData();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
updateFilteredUserData(): void {
|
|
89
|
-
if (this.userData.length > 0 && this.categories.length > 0) {
|
|
90
|
-
this.filteredUserData = this.userListService.filterUsersByCategory(this.userData, this.categories);
|
|
91
|
-
this.shouldShowContainer = true;
|
|
92
|
-
if (this.selectedUser) {
|
|
93
|
-
const selectedUserInFiltered = this.filteredUserData.find(user => user.name === this.selectedUser);
|
|
94
|
-
if (!selectedUserInFiltered) {
|
|
95
|
-
this.selectedUser = undefined;
|
|
96
|
-
this.documentStore.setSelectedUserId(null);
|
|
97
|
-
this.userSelected.emit(SHARED.EMPTY);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
} else {
|
|
101
|
-
this.filteredUserData = this.userData;
|
|
102
|
-
this.shouldShowContainer = true;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
ngOnInit(): void {
|
|
107
|
-
this.initializeUserData();
|
|
108
|
-
this.userListSubscription.add(
|
|
109
|
-
this.documentQuery.selectUserList().subscribe(userList => {
|
|
110
|
-
if (userList && userList.length > 0) {
|
|
111
|
-
this.userList = userList;
|
|
112
|
-
this.initializeUserData();
|
|
113
|
-
this.cdr.markForCheck();
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
this.categoriesSubscription.add(
|
|
119
|
-
this.documentQuery.selectDocumentCategories().subscribe(categories => {
|
|
120
|
-
if (categories && categories.length > 0) {
|
|
121
|
-
this.categories = categories;
|
|
122
|
-
this.updateFilteredUserData();
|
|
123
|
-
this.cdr.markForCheck();
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
this.userListSubscription.add(
|
|
129
|
-
this.documentQuery.selectDocumentListResponse().subscribe(() => {
|
|
130
|
-
const currentUserList = this.documentQuery.getUserList();
|
|
131
|
-
if (currentUserList && currentUserList.length > 0) {
|
|
132
|
-
this.userList = currentUserList;
|
|
133
|
-
this.initializeUserData();
|
|
134
|
-
this.cdr.markForCheck();
|
|
135
|
-
}
|
|
136
|
-
})
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
this.documentQuery.selectSelectedUserId().subscribe(userId => {
|
|
140
|
-
if (userId) {
|
|
141
|
-
const user = this.userData.find(u => u._id === userId);
|
|
142
|
-
this.selectedUser = user ? user.name : undefined;
|
|
143
|
-
} else {
|
|
144
|
-
this.selectedUser = undefined;
|
|
145
|
-
}
|
|
146
|
-
this.cdr.markForCheck();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
this.documentQuery.selectShowUserList().subscribe(show => {
|
|
150
|
-
if (!show && this.selectedUser) {
|
|
151
|
-
this.selectedUser = undefined;
|
|
152
|
-
this.userSelected.emit(SHARED.EMPTY);
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
onUserSelect(username: string, id: string): void {
|
|
158
|
-
if (this.selectedUser === username) {
|
|
159
|
-
this.selectedUser = undefined;
|
|
160
|
-
this.userListService.unselectUser();
|
|
161
|
-
this.userSelected.emit(SHARED.EMPTY);
|
|
162
|
-
} else {
|
|
163
|
-
this.selectedUser = username;
|
|
164
|
-
this.documentStore.setSelectedUserId(id);
|
|
165
|
-
this.userSelected.emit(username);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
getAvatarColor(color: string | undefined): string {
|
|
170
|
-
if (!color) {
|
|
171
|
-
return SHARED.DEFAULT_COLOR;
|
|
172
|
-
}
|
|
173
|
-
return SHARED.COLOR_MAP[color as keyof typeof SHARED.COLOR_MAP] || SHARED.DEFAULT_COLOR;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
ngOnDestroy(): void {
|
|
178
|
-
this.userListSubscription.unsubscribe();
|
|
179
|
-
this.categoriesSubscription.unsubscribe();
|
|
180
|
-
}
|
|
181
|
-
}
|