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
package/ng-package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cat-documents-ng",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^19.0.0",
|
|
6
6
|
"@angular/core": "^19.0.0"
|
|
@@ -11,15 +11,9 @@
|
|
|
11
11
|
"typings": "index.d.ts",
|
|
12
12
|
"sideEffects": false,
|
|
13
13
|
"main": "bundles/cat-document-lib.umd.js",
|
|
14
|
-
"module": "
|
|
14
|
+
"module": "fesm2015/cat-document-lib.js",
|
|
15
15
|
"es2015": "fesm2015/cat-document-lib.js",
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"default": "./package.json"
|
|
19
|
-
},
|
|
20
|
-
".": {
|
|
21
|
-
"types": "./index.d.ts",
|
|
22
|
-
"default": "./fesm2022/cat-documents-ng.mjs"
|
|
23
|
-
}
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/jest": "^29.5.14"
|
|
24
18
|
}
|
|
25
|
-
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// PrimeNG ConfirmDialog component handles all styling
|
|
2
|
+
// Custom styles are no longer needed
|
|
3
|
+
.btn-danger{
|
|
4
|
+
background-color: #ef4444;
|
|
5
|
+
color: #ffffff;
|
|
6
|
+
border-color: #e53e3e;
|
|
7
|
+
max-width: 100px;
|
|
8
|
+
}
|
|
9
|
+
.btn-secondary{
|
|
10
|
+
background-color: #f3f4f6;
|
|
11
|
+
color: black;
|
|
12
|
+
max-width: 100px;
|
|
13
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { ConfirmationDialogComponent } from './confirmation-dialog.component';
|
|
3
|
+
import { ConfirmationService } from 'primeng/api';
|
|
4
|
+
import { ConfirmDialogModule } from 'primeng/confirmdialog';
|
|
5
|
+
|
|
6
|
+
describe('ConfirmationDialogComponent', () => {
|
|
7
|
+
let component: ConfirmationDialogComponent;
|
|
8
|
+
let fixture: ComponentFixture<ConfirmationDialogComponent>;
|
|
9
|
+
let confirmationService: jasmine.SpyObj<ConfirmationService>;
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
const confirmationServiceSpy = jasmine.createSpyObj('ConfirmationService', ['confirm']);
|
|
13
|
+
|
|
14
|
+
await TestBed.configureTestingModule({
|
|
15
|
+
declarations: [ ConfirmationDialogComponent ],
|
|
16
|
+
imports: [ ConfirmDialogModule ],
|
|
17
|
+
providers: [
|
|
18
|
+
{ provide: ConfirmationService, useValue: confirmationServiceSpy }
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
.compileComponents();
|
|
22
|
+
|
|
23
|
+
confirmationService = TestBed.inject(ConfirmationService) as jasmine.SpyObj<ConfirmationService>;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
fixture = TestBed.createComponent(ConfirmationDialogComponent);
|
|
28
|
+
component = fixture.componentInstance;
|
|
29
|
+
fixture.detectChanges();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should create', () => {
|
|
33
|
+
expect(component).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should call confirmationService.confirm when confirm method is called', () => {
|
|
37
|
+
const options = { message: 'Test message' };
|
|
38
|
+
const acceptCallback = () => {};
|
|
39
|
+
const rejectCallback = () => {};
|
|
40
|
+
|
|
41
|
+
component.confirm(options, acceptCallback, rejectCallback);
|
|
42
|
+
|
|
43
|
+
expect(confirmationService.confirm).toHaveBeenCalledWith(
|
|
44
|
+
jasmine.objectContaining({
|
|
45
|
+
message: 'Test message',
|
|
46
|
+
accept: acceptCallback,
|
|
47
|
+
reject: rejectCallback
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should call confirmationService.confirm with delete options when confirmDelete is called', () => {
|
|
53
|
+
const itemName = 'Test Document';
|
|
54
|
+
const acceptCallback = () => {};
|
|
55
|
+
const rejectCallback = () => {};
|
|
56
|
+
|
|
57
|
+
component.confirmDelete(itemName, acceptCallback, rejectCallback);
|
|
58
|
+
|
|
59
|
+
expect(confirmationService.confirm).toHaveBeenCalledWith(
|
|
60
|
+
jasmine.objectContaining({
|
|
61
|
+
message: `Are you sure you want to delete "${itemName}"?`,
|
|
62
|
+
header: 'Delete Confirmation',
|
|
63
|
+
acceptLabel: 'Delete',
|
|
64
|
+
rejectLabel: 'Cancel',
|
|
65
|
+
accept: acceptCallback,
|
|
66
|
+
reject: rejectCallback
|
|
67
|
+
})
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { Component, Input, Injectable } from '@angular/core';
|
|
2
|
+
import { ConfirmationService, Confirmation } from 'primeng/api';
|
|
3
|
+
|
|
4
|
+
export interface ConfirmationOptions {
|
|
5
|
+
message: string;
|
|
6
|
+
header?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
acceptLabel?: string;
|
|
9
|
+
rejectLabel?: string;
|
|
10
|
+
acceptIcon?: string;
|
|
11
|
+
rejectIcon?: string;
|
|
12
|
+
acceptButtonClass?: string;
|
|
13
|
+
rejectButtonClass?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@Injectable({
|
|
17
|
+
providedIn: 'root'
|
|
18
|
+
})
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'app-confirmation-dialog',
|
|
21
|
+
templateUrl: './confirmation-dialog.component.html',
|
|
22
|
+
standalone: false,
|
|
23
|
+
styleUrls: ['./confirmation-dialog.component.scss']
|
|
24
|
+
})
|
|
25
|
+
export class ConfirmationDialogComponent {
|
|
26
|
+
@Input() confirmationOptions: ConfirmationOptions = {
|
|
27
|
+
message: 'Are you sure that you want to proceed?',
|
|
28
|
+
header: '',
|
|
29
|
+
icon: '',
|
|
30
|
+
acceptLabel: 'Yes',
|
|
31
|
+
rejectLabel: 'No',
|
|
32
|
+
acceptIcon: 'pi pi-check',
|
|
33
|
+
rejectIcon: 'pi pi-times',
|
|
34
|
+
acceptButtonClass: 'btn-danger',
|
|
35
|
+
rejectButtonClass: 'btn-secondary'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
constructor(private confirmationService: ConfirmationService) {}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Shows the confirmation dialog with the specified options
|
|
42
|
+
* @param options - Configuration options for the confirmation dialog
|
|
43
|
+
* @param acceptCallback - Function to execute when user accepts
|
|
44
|
+
* @param rejectCallback - Function to execute when user rejects
|
|
45
|
+
*/
|
|
46
|
+
confirm(
|
|
47
|
+
options: Partial<ConfirmationOptions>,
|
|
48
|
+
acceptCallback: () => void,
|
|
49
|
+
rejectCallback?: () => void
|
|
50
|
+
): void {
|
|
51
|
+
const confirmation: Confirmation = {
|
|
52
|
+
message: options.message || this.confirmationOptions.message,
|
|
53
|
+
header: options.header || this.confirmationOptions.header,
|
|
54
|
+
icon: options.icon || this.confirmationOptions.icon,
|
|
55
|
+
acceptLabel: options.acceptLabel || this.confirmationOptions.acceptLabel,
|
|
56
|
+
rejectLabel: options.rejectLabel || this.confirmationOptions.rejectLabel,
|
|
57
|
+
acceptIcon: options.acceptIcon || this.confirmationOptions.acceptIcon,
|
|
58
|
+
rejectIcon: options.rejectIcon || this.confirmationOptions.rejectIcon,
|
|
59
|
+
accept: acceptCallback,
|
|
60
|
+
reject: rejectCallback
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
this.confirmationService.confirm(confirmation);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Static method to show a confirmation dialog (for components that don't want to inject this component)
|
|
69
|
+
* @param confirmationService - The ConfirmationService instance
|
|
70
|
+
* @param options - Configuration options for the confirmation dialog
|
|
71
|
+
* @param acceptCallback - Function to execute when user accepts
|
|
72
|
+
* @param rejectCallback - Function to execute when user rejects
|
|
73
|
+
*/
|
|
74
|
+
static confirm(
|
|
75
|
+
confirmationService: ConfirmationService,
|
|
76
|
+
options: Partial<ConfirmationOptions>,
|
|
77
|
+
acceptCallback: () => void,
|
|
78
|
+
rejectCallback?: () => void
|
|
79
|
+
): void {
|
|
80
|
+
const defaultOptions: ConfirmationOptions = {
|
|
81
|
+
message: 'Are you sure that you want to proceed?',
|
|
82
|
+
header: '',
|
|
83
|
+
icon: '',
|
|
84
|
+
acceptLabel: 'Yes',
|
|
85
|
+
rejectLabel: 'No',
|
|
86
|
+
acceptIcon: 'pi pi-check',
|
|
87
|
+
rejectIcon: 'pi pi-times',
|
|
88
|
+
acceptButtonClass: 'btn-success',
|
|
89
|
+
rejectButtonClass: 'btn-secondary'
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const confirmation: Confirmation = {
|
|
93
|
+
message: options.message || defaultOptions.message,
|
|
94
|
+
header: options.header || defaultOptions.header,
|
|
95
|
+
icon: options.icon || defaultOptions.icon,
|
|
96
|
+
acceptLabel: options.acceptLabel || defaultOptions.acceptLabel,
|
|
97
|
+
rejectLabel: options.rejectLabel || defaultOptions.rejectLabel,
|
|
98
|
+
acceptIcon: options.acceptIcon || defaultOptions.acceptIcon,
|
|
99
|
+
rejectIcon: options.rejectIcon || defaultOptions.rejectIcon,
|
|
100
|
+
accept: acceptCallback,
|
|
101
|
+
reject: rejectCallback
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
confirmationService.confirm(confirmation);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Static method to show a delete confirmation dialog
|
|
109
|
+
* @param confirmationService - The ConfirmationService instance
|
|
110
|
+
* @param itemName - Name of the item to be deleted
|
|
111
|
+
* @param acceptCallback - Function to execute when user accepts deletion
|
|
112
|
+
* @param rejectCallback - Function to execute when user rejects deletion
|
|
113
|
+
*/
|
|
114
|
+
static confirmDelete(
|
|
115
|
+
confirmationService: ConfirmationService,
|
|
116
|
+
itemName: string,
|
|
117
|
+
acceptCallback: () => void,
|
|
118
|
+
rejectCallback?: () => void
|
|
119
|
+
): void {
|
|
120
|
+
ConfirmationDialogComponent.confirm(
|
|
121
|
+
confirmationService,
|
|
122
|
+
{
|
|
123
|
+
message: `Are you sure you want to delete "${itemName}"?`,
|
|
124
|
+
header: 'Delete Confirmation',
|
|
125
|
+
acceptLabel: 'Delete',
|
|
126
|
+
rejectLabel: 'Cancel',
|
|
127
|
+
acceptButtonClass: 'btn-danger'
|
|
128
|
+
},
|
|
129
|
+
acceptCallback,
|
|
130
|
+
rejectCallback
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<div class="table-primary">
|
|
2
|
+
<p-table [value]="processedData" [tableStyle]="tableStyle">
|
|
3
|
+
<ng-template pTemplate="header" *ngIf="showHeader">
|
|
4
|
+
<tr>
|
|
5
|
+
<ng-container *ngFor="let col of visibleColumns">
|
|
6
|
+
<th [style.width]="col.width">
|
|
7
|
+
{{ col.header }}
|
|
8
|
+
</th>
|
|
9
|
+
</ng-container>
|
|
10
|
+
</tr>
|
|
11
|
+
</ng-template>
|
|
12
|
+
<ng-template pTemplate="body" let-rowData>
|
|
13
|
+
<tr (click)="onRowClick($event, rowData)" class="clickable-row">
|
|
14
|
+
<ng-container *ngFor="let col of visibleColumns">
|
|
15
|
+
<td [style.width]="col.width">
|
|
16
|
+
<!-- Document Cell -->
|
|
17
|
+
<div *ngIf="col.type === SHARED.CELL_TYPE_DOCUMENT" class="document-cell">
|
|
18
|
+
<div class="document-info">
|
|
19
|
+
<div class="document-icon">
|
|
20
|
+
<i [class]="SHARED.ICON_FILE_PDF" *ngIf="rowData._isPdfFile"></i>
|
|
21
|
+
<i [class]="SHARED.ICON_IMAGE" *ngIf="rowData._isImageFile"></i>
|
|
22
|
+
<i [class]="SHARED.ICON_FILE_EXCEL" *ngIf="rowData._isExcelFile"></i>
|
|
23
|
+
<i [class]="SHARED.ICON_FILE" *ngIf="rowData._isOtherFile"></i>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="document-details">
|
|
26
|
+
<div class="document-name" [innerHTML]="formatDocumentDisplayName(rowData)"></div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- Status Cell -->
|
|
32
|
+
|
|
33
|
+
<div *ngIf="col.type === SHARED.CELL_TYPE_STATUS" class="status-cell">
|
|
34
|
+
<span class="status-pill" [ngClass]="rowData._statusClass">
|
|
35
|
+
<i [class]="rowData._statusIcon"></i>
|
|
36
|
+
{{ rowData[col.field] }}
|
|
37
|
+
</span>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<!-- Actions Cell -->
|
|
41
|
+
<div *ngIf="col.type === SHARED.CELL_TYPE_ACTIONS" class="actions-cell">
|
|
42
|
+
<!-- Actions content can be added here if needed -->
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<!-- Default Text Cell -->
|
|
46
|
+
<div *ngIf="!col.type || col.type === SHARED.CELL_TYPE_TEXT" class="text-cell">
|
|
47
|
+
{{ rowData[col.field] }}
|
|
48
|
+
</div>
|
|
49
|
+
</td>
|
|
50
|
+
</ng-container>
|
|
51
|
+
</tr>
|
|
52
|
+
</ng-template>
|
|
53
|
+
|
|
54
|
+
<!-- No Records Template -->
|
|
55
|
+
<ng-template pTemplate="emptymessage">
|
|
56
|
+
<tr>
|
|
57
|
+
<td [attr.colspan]="getVisibleColumnCount()" class="no-records-cell">
|
|
58
|
+
<div class="no-records-content">
|
|
59
|
+
<i class="pi pi-inbox" style="font-size: 2rem; color: #6c757d;"></i>
|
|
60
|
+
<p class="no-records-text">No records found</p>
|
|
61
|
+
</div>
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
</ng-template>
|
|
65
|
+
</p-table>
|
|
66
|
+
</div>
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
// Document table styles
|
|
2
|
+
.document-cell {
|
|
3
|
+
.document-info {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: 0.75rem;
|
|
7
|
+
text-align: left; // Ensure left alignment
|
|
8
|
+
|
|
9
|
+
.document-icon {
|
|
10
|
+
width: 40px;
|
|
11
|
+
height: 40px;
|
|
12
|
+
background-color: #e3f2fd;
|
|
13
|
+
border-radius: 6px;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
color: #1976d2;
|
|
18
|
+
font-size: 1.25rem;
|
|
19
|
+
flex-shrink: 0; // Prevent icon from shrinking
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.document-details {
|
|
23
|
+
flex: 1; // Take remaining space
|
|
24
|
+
min-width: 0; // Allow text to wrap if needed
|
|
25
|
+
|
|
26
|
+
.document-name {
|
|
27
|
+
font-weight: 400;
|
|
28
|
+
color: #334155;
|
|
29
|
+
line-height: 18px;
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
text-align: left;
|
|
32
|
+
word-break: break-word;
|
|
33
|
+
|
|
34
|
+
// Style for multi-line document names
|
|
35
|
+
br {
|
|
36
|
+
margin-bottom: 0.125rem;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Alias name styling (first line)
|
|
40
|
+
.alias-name {
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
color: #1e40af;
|
|
43
|
+
font-size: 13px;
|
|
44
|
+
line-height: 16px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Document info styling (second line)
|
|
48
|
+
.document-info {
|
|
49
|
+
font-weight: 400;
|
|
50
|
+
color: #334155;
|
|
51
|
+
font-size: 14px;
|
|
52
|
+
line-height: 18px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.status-cell {
|
|
60
|
+
.status-pill {
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center; // Center content within the pill
|
|
64
|
+
gap: 0.375rem;
|
|
65
|
+
padding: 0.375rem 0.75rem;
|
|
66
|
+
border-radius: 20px;
|
|
67
|
+
font-size: 0.75rem;
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
min-width: 80px; // Ensure consistent pill width
|
|
71
|
+
|
|
72
|
+
i {
|
|
73
|
+
font-size: 0.875rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&.status-pending {
|
|
77
|
+
background-color: #f3f4f6;
|
|
78
|
+
color: #6b7280;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.status-approved {
|
|
82
|
+
background-color: #d1fae5;
|
|
83
|
+
color: #065f46;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&.status-alert {
|
|
87
|
+
background-color: #fee2e2;
|
|
88
|
+
color: #dc2626;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&.status-uploaded {
|
|
92
|
+
background-color: #d1fae5;
|
|
93
|
+
color: #065f46;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&.status-reviewing {
|
|
97
|
+
background-color: #fef3c7;
|
|
98
|
+
color: #d97706;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&.status-rejected {
|
|
102
|
+
background-color: #fee2e2;
|
|
103
|
+
color: #dc2626;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.actions-cell {
|
|
109
|
+
text-align: left; // Changed from center to left to match design
|
|
110
|
+
|
|
111
|
+
.p-button {
|
|
112
|
+
width: 2rem;
|
|
113
|
+
height: 2rem;
|
|
114
|
+
border-radius: 50%;
|
|
115
|
+
background-color: transparent;
|
|
116
|
+
border: none;
|
|
117
|
+
color: #6c757d;
|
|
118
|
+
|
|
119
|
+
&:hover {
|
|
120
|
+
background-color: #f8f9fa;
|
|
121
|
+
color: #495057;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.text-cell {
|
|
127
|
+
font-weight: 500;
|
|
128
|
+
color: #475569;
|
|
129
|
+
font-size: 14px;
|
|
130
|
+
line-height: 20px;
|
|
131
|
+
text-align: left; // Ensure left alignment
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Clickable row styles
|
|
135
|
+
.clickable-row {
|
|
136
|
+
cursor: pointer;
|
|
137
|
+
transition: background-color 0.2s ease;
|
|
138
|
+
|
|
139
|
+
&:hover {
|
|
140
|
+
background-color: #f8f9fa !important;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&:active {
|
|
144
|
+
background-color: #e9ecef !important;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Table styling
|
|
149
|
+
::ng-deep .p-datatable {
|
|
150
|
+
|
|
151
|
+
.p-datatable-wrapper {
|
|
152
|
+
// border: none;
|
|
153
|
+
border: 1px solid #E2E8F0;
|
|
154
|
+
border-radius: 10px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.p-datatable-thead > tr > th {
|
|
158
|
+
background-color: #f8f9fa;
|
|
159
|
+
border: none;
|
|
160
|
+
border-bottom: 1px solid #dee2e6;
|
|
161
|
+
padding: 1rem 1.5rem;
|
|
162
|
+
font-weight: 600;
|
|
163
|
+
color: #64748B;
|
|
164
|
+
font-size: 0.875rem;
|
|
165
|
+
text-transform: capitalize;
|
|
166
|
+
letter-spacing: 0.5px;
|
|
167
|
+
text-align: left; // Ensure headers are left-aligned
|
|
168
|
+
border-radius: 8px 8px 0 0; // Rounded top corners for header
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// First column header - left rounded corner
|
|
172
|
+
.p-datatable-thead > tr > th:first-child {
|
|
173
|
+
border-top-left-radius: 8px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Last column header - right rounded corner
|
|
177
|
+
.p-datatable-thead > tr > th:last-child {
|
|
178
|
+
border-top-right-radius: 8px;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.p-datatable-tbody > tr {
|
|
182
|
+
border-bottom: 1px solid #f1f3f4;
|
|
183
|
+
|
|
184
|
+
&:hover {
|
|
185
|
+
background-color: #f8f9fa;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Last row - bottom rounded corners
|
|
189
|
+
&:last-child {
|
|
190
|
+
> td:first-child {
|
|
191
|
+
border-bottom-left-radius: 8px;
|
|
192
|
+
}
|
|
193
|
+
> td:last-child {
|
|
194
|
+
border-bottom-right-radius: 8px;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
> td {
|
|
199
|
+
border: none;
|
|
200
|
+
padding: 1rem 1.5rem;
|
|
201
|
+
vertical-align: middle;
|
|
202
|
+
text-align: left; // Ensure all cells are left-aligned
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// No records found styling
|
|
208
|
+
.no-records-cell {
|
|
209
|
+
text-align: center;
|
|
210
|
+
padding: 3rem 1.5rem !important;
|
|
211
|
+
border: none;
|
|
212
|
+
|
|
213
|
+
.no-records-content {
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
align-items: center;
|
|
217
|
+
justify-content: center;
|
|
218
|
+
gap: 1rem;
|
|
219
|
+
|
|
220
|
+
.no-records-text {
|
|
221
|
+
margin: 0;
|
|
222
|
+
color: #6c757d;
|
|
223
|
+
font-size: 1rem;
|
|
224
|
+
font-weight: 500;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { TablePrimaryComponent } from './table-primary.component';
|
|
4
|
+
|
|
5
|
+
describe('TablePrimaryComponent', () => {
|
|
6
|
+
let component: TablePrimaryComponent;
|
|
7
|
+
let fixture: ComponentFixture<TablePrimaryComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [TablePrimaryComponent]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(TablePrimaryComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|