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.
Files changed (211) hide show
  1. package/README.md +322 -322
  2. package/Shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +44 -0
  3. package/Shared/components/table-primary/table-primary.component.d.ts +31 -0
  4. package/Shared/components/table-primary/table-primary.model.d.ts +19 -0
  5. package/Shared/constant/ERROR.d.ts +52 -0
  6. package/Shared/constant/SHARED.d.ts +546 -0
  7. package/{src/Shared/constant/URLS.ts → Shared/constant/URLS.d.ts} +25 -31
  8. package/Shared/services/app-config.service.d.ts +51 -0
  9. package/{src/Shared/services/global-error.handler.ts → Shared/services/global-error.handler.d.ts} +9 -11
  10. package/Shared/services/session.service.d.ts +46 -0
  11. package/Shared/shared.module.d.ts +14 -0
  12. package/fesm2022/cat-documents-ng.mjs +11405 -0
  13. package/fesm2022/cat-documents-ng.mjs.map +1 -0
  14. package/index.d.ts +5 -0
  15. package/lib/document/components/document-actions/document-actions.component.d.ts +78 -0
  16. package/lib/document/components/document-container/document-container.component.d.ts +162 -0
  17. package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +291 -0
  18. package/lib/document/components/document-history/document-history.component.d.ts +160 -0
  19. package/lib/document/components/document-list/document-list.component.d.ts +299 -0
  20. package/lib/document/components/document-list-item/document-list-item.component.d.ts +28 -0
  21. package/lib/document/components/document-search/document-search.component.d.ts +77 -0
  22. package/lib/document/components/document-status/document-status.component.d.ts +24 -0
  23. package/lib/document/components/document-upload/document-upload.component.d.ts +321 -0
  24. package/lib/document/components/document-viewer/document-viewer.component.d.ts +137 -0
  25. package/lib/document/components/document-zoom-controls/document-zoom-controls.component.d.ts +33 -0
  26. package/lib/document/components/documents-menu/documents-menu.component.d.ts +110 -0
  27. package/{src/lib/document/components/folder-block/folder-block.component.ts → lib/document/components/folder-block/folder-block.component.d.ts} +12 -28
  28. package/lib/document/components/folder-container/folder-container.component.d.ts +162 -0
  29. package/lib/document/components/linked-document/linked-document.component.d.ts +39 -0
  30. package/lib/document/components/request-document/request-document.component.d.ts +69 -0
  31. package/lib/document/components/sidebar/sidebar.component.d.ts +109 -0
  32. package/lib/document/components/user-list/user-list.component.d.ts +34 -0
  33. package/lib/document/constant/DOCUMENT_HISTORY.d.ts +41 -0
  34. package/lib/document/directives/document.directive.d.ts +20 -0
  35. package/lib/document/directives/permission.directive.d.ts +38 -0
  36. package/lib/document/document.module.d.ts +60 -0
  37. package/{src/lib/document/models/document-alert.model.ts → lib/document/models/document-alert.model.d.ts} +4 -11
  38. package/lib/document/models/document-category.model.d.ts +24 -0
  39. package/lib/document/models/document-history.model.d.ts +94 -0
  40. package/lib/document/models/document-list-response.model.d.ts +33 -0
  41. package/lib/document/models/document-type.model.d.ts +37 -0
  42. package/lib/document/models/document.model.d.ts +44 -0
  43. package/{src/lib/document/models/folder.model.ts → lib/document/models/folder.model.d.ts} +4 -10
  44. package/lib/document/models/status-data.model.d.ts +27 -0
  45. package/lib/document/models/uploaded-file-response.model.d.ts +7 -0
  46. package/lib/document/models/user-list.model.d.ts +8 -0
  47. package/lib/document/services/csv-parser.service.d.ts +88 -0
  48. package/lib/document/services/document-actions.service.d.ts +48 -0
  49. package/lib/document/services/document-content-type.service.d.ts +85 -0
  50. package/lib/document/services/document-history-style.service.d.ts +34 -0
  51. package/lib/document/services/document-history.service.d.ts +42 -0
  52. package/lib/document/services/document-http.service.d.ts +179 -0
  53. package/lib/document/services/document-list.service.d.ts +74 -0
  54. package/lib/document/services/document-menu.service.d.ts +122 -0
  55. package/lib/document/services/document-scroll.service.d.ts +55 -0
  56. package/lib/document/services/document-table-builder.service.d.ts +38 -0
  57. package/lib/document/services/document-upload-business.service.d.ts +107 -0
  58. package/lib/document/services/document-upload-data.service.d.ts +40 -0
  59. package/lib/document/services/document-upload-form.service.d.ts +41 -0
  60. package/lib/document/services/document-upload.service.d.ts +99 -0
  61. package/lib/document/services/document-viewer.service.d.ts +97 -0
  62. package/lib/document/services/document-zoom.service.d.ts +81 -0
  63. package/lib/document/services/document.service.d.ts +161 -0
  64. package/lib/document/services/eml-parser.service.d.ts +116 -0
  65. package/lib/document/services/excel-parser.service.d.ts +169 -0
  66. package/lib/document/services/file-format.service.d.ts +34 -0
  67. package/lib/document/services/status-calculator.service.d.ts +20 -0
  68. package/lib/document/services/user-list.service.d.ts +29 -0
  69. package/lib/document/state/document.query.d.ts +243 -0
  70. package/{src/lib/document/state/document.service.ts → lib/document/state/document.service.d.ts} +15 -46
  71. package/lib/document/state/document.state.d.ts +61 -0
  72. package/lib/document/state/document.store.d.ts +56 -0
  73. package/package.json +11 -5
  74. package/{src/public-api.ts → public-api.d.ts} +0 -4
  75. package/ng-package.json +0 -10
  76. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.html +0 -3
  77. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.scss +0 -13
  78. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.spec.ts +0 -70
  79. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +0 -133
  80. package/src/Shared/components/table-primary/table-primary.component.html +0 -66
  81. package/src/Shared/components/table-primary/table-primary.component.scss +0 -227
  82. package/src/Shared/components/table-primary/table-primary.component.spec.ts +0 -23
  83. package/src/Shared/components/table-primary/table-primary.component.ts +0 -143
  84. package/src/Shared/components/table-primary/table-primary.model.ts +0 -21
  85. package/src/Shared/constant/ERROR.ts +0 -55
  86. package/src/Shared/constant/PERMISSIONS.ts +0 -17
  87. package/src/Shared/constant/SHARED.ts +0 -936
  88. package/src/Shared/services/app-config.service.spec.ts +0 -19
  89. package/src/Shared/services/app-config.service.ts +0 -73
  90. package/src/Shared/services/session.service.spec.ts +0 -16
  91. package/src/Shared/services/session.service.ts +0 -76
  92. package/src/Shared/shared.module.ts +0 -25
  93. package/src/lib/document/components/csv-viewer/csv-viewer.component.ts +0 -1
  94. package/src/lib/document/components/document-actions/document-actions.component.html +0 -59
  95. package/src/lib/document/components/document-actions/document-actions.component.scss +0 -362
  96. package/src/lib/document/components/document-actions/document-actions.component.spec.ts +0 -297
  97. package/src/lib/document/components/document-actions/document-actions.component.ts +0 -163
  98. package/src/lib/document/components/document-container/document-container.component.html +0 -36
  99. package/src/lib/document/components/document-container/document-container.component.scss +0 -144
  100. package/src/lib/document/components/document-container/document-container.component.spec.ts +0 -110
  101. package/src/lib/document/components/document-container/document-container.component.ts +0 -363
  102. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.html +0 -332
  103. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.scss +0 -1877
  104. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.spec.ts +0 -258
  105. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.ts +0 -664
  106. package/src/lib/document/components/document-history/document-history.component.html +0 -96
  107. package/src/lib/document/components/document-history/document-history.component.scss +0 -392
  108. package/src/lib/document/components/document-history/document-history.component.spec.ts +0 -93
  109. package/src/lib/document/components/document-history/document-history.component.ts +0 -373
  110. package/src/lib/document/components/document-list/document-list.component.html +0 -46
  111. package/src/lib/document/components/document-list/document-list.component.scss +0 -513
  112. package/src/lib/document/components/document-list/document-list.component.spec.ts +0 -486
  113. package/src/lib/document/components/document-list/document-list.component.ts +0 -682
  114. package/src/lib/document/components/document-list-item/document-list-item.component.html +0 -36
  115. package/src/lib/document/components/document-list-item/document-list-item.component.scss +0 -34
  116. package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +0 -75
  117. package/src/lib/document/components/document-list-item/document-list-item.component.ts +0 -40
  118. package/src/lib/document/components/document-search/document-search.component.html +0 -64
  119. package/src/lib/document/components/document-search/document-search.component.scss +0 -206
  120. package/src/lib/document/components/document-search/document-search.component.spec.ts +0 -82
  121. package/src/lib/document/components/document-search/document-search.component.ts +0 -163
  122. package/src/lib/document/components/document-status/document-status.component.html +0 -31
  123. package/src/lib/document/components/document-status/document-status.component.scss +0 -192
  124. package/src/lib/document/components/document-status/document-status.component.spec.ts +0 -23
  125. package/src/lib/document/components/document-status/document-status.component.ts +0 -87
  126. package/src/lib/document/components/document-upload/document-upload.component.html +0 -160
  127. package/src/lib/document/components/document-upload/document-upload.component.scss +0 -235
  128. package/src/lib/document/components/document-upload/document-upload.component.spec.ts +0 -95
  129. package/src/lib/document/components/document-upload/document-upload.component.ts +0 -668
  130. package/src/lib/document/components/document-viewer/document-viewer.component.html +0 -50
  131. package/src/lib/document/components/document-viewer/document-viewer.component.scss +0 -187
  132. package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +0 -79
  133. package/src/lib/document/components/document-viewer/document-viewer.component.ts +0 -261
  134. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html +0 -48
  135. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.scss +0 -320
  136. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.spec.ts +0 -59
  137. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.ts +0 -150
  138. package/src/lib/document/components/documents-menu/documents-menu.component.html +0 -44
  139. package/src/lib/document/components/documents-menu/documents-menu.component.scss +0 -363
  140. package/src/lib/document/components/documents-menu/documents-menu.component.spec.ts +0 -23
  141. package/src/lib/document/components/documents-menu/documents-menu.component.ts +0 -316
  142. package/src/lib/document/components/folder-block/folder-block.component.html +0 -46
  143. package/src/lib/document/components/folder-block/folder-block.component.scss +0 -9
  144. package/src/lib/document/components/folder-block/folder-block.component.spec.ts +0 -70
  145. package/src/lib/document/components/folder-container/folder-container.component.html +0 -56
  146. package/src/lib/document/components/folder-container/folder-container.component.scss +0 -20
  147. package/src/lib/document/components/folder-container/folder-container.component.spec.ts +0 -27
  148. package/src/lib/document/components/folder-container/folder-container.component.ts +0 -328
  149. package/src/lib/document/components/linked-document/linked-document.component.html +0 -23
  150. package/src/lib/document/components/linked-document/linked-document.component.scss +0 -10
  151. package/src/lib/document/components/linked-document/linked-document.component.spec.ts +0 -61
  152. package/src/lib/document/components/linked-document/linked-document.component.ts +0 -49
  153. package/src/lib/document/components/request-document/request-document.component.html +0 -86
  154. package/src/lib/document/components/request-document/request-document.component.scss +0 -16
  155. package/src/lib/document/components/request-document/request-document.component.ts +0 -278
  156. package/src/lib/document/components/sidebar/sidebar.component.html +0 -75
  157. package/src/lib/document/components/sidebar/sidebar.component.scss +0 -157
  158. package/src/lib/document/components/sidebar/sidebar.component.spec.ts +0 -114
  159. package/src/lib/document/components/sidebar/sidebar.component.ts +0 -223
  160. package/src/lib/document/components/user-list/user-list.component.html +0 -33
  161. package/src/lib/document/components/user-list/user-list.component.scss +0 -118
  162. package/src/lib/document/components/user-list/user-list.component.spec.ts +0 -23
  163. package/src/lib/document/components/user-list/user-list.component.ts +0 -181
  164. package/src/lib/document/constant/DOCUMENT_HISTORY.ts +0 -52
  165. package/src/lib/document/directives/document.directive.ts +0 -32
  166. package/src/lib/document/directives/permission.directive.spec.ts +0 -0
  167. package/src/lib/document/directives/permission.directive.ts +0 -72
  168. package/src/lib/document/document.module.ts +0 -351
  169. package/src/lib/document/models/document-category.model.ts +0 -30
  170. package/src/lib/document/models/document-history.model.ts +0 -109
  171. package/src/lib/document/models/document-list-response.model.ts +0 -37
  172. package/src/lib/document/models/document-type.model.ts +0 -44
  173. package/src/lib/document/models/document.model.ts +0 -53
  174. package/src/lib/document/models/status-data.model.ts +0 -31
  175. package/src/lib/document/models/uploaded-file-response.model.ts +0 -7
  176. package/src/lib/document/models/user-list.model.ts +0 -10
  177. package/src/lib/document/services/csv-parser.service.spec.ts +0 -97
  178. package/src/lib/document/services/csv-parser.service.ts +0 -303
  179. package/src/lib/document/services/document-actions.service.ts +0 -125
  180. package/src/lib/document/services/document-content-type.service.ts +0 -193
  181. package/src/lib/document/services/document-history-style.service.ts +0 -138
  182. package/src/lib/document/services/document-history.service.ts +0 -129
  183. package/src/lib/document/services/document-http.service.spec.ts +0 -119
  184. package/src/lib/document/services/document-http.service.ts +0 -497
  185. package/src/lib/document/services/document-list.service.ts +0 -195
  186. package/src/lib/document/services/document-menu.service.ts +0 -277
  187. package/src/lib/document/services/document-scroll.service.ts +0 -138
  188. package/src/lib/document/services/document-severity.service.ts +0 -98
  189. package/src/lib/document/services/document-table-builder.service.ts +0 -82
  190. package/src/lib/document/services/document-upload-business.service.ts +0 -326
  191. package/src/lib/document/services/document-upload-data.service.ts +0 -82
  192. package/src/lib/document/services/document-upload-form.service.ts +0 -149
  193. package/src/lib/document/services/document-upload.service.spec.ts +0 -99
  194. package/src/lib/document/services/document-upload.service.ts +0 -209
  195. package/src/lib/document/services/document-viewer.service.ts +0 -279
  196. package/src/lib/document/services/document-zoom.service.spec.ts +0 -56
  197. package/src/lib/document/services/document-zoom.service.ts +0 -164
  198. package/src/lib/document/services/document.service.ts +0 -356
  199. package/src/lib/document/services/eml-parser.service.ts +0 -444
  200. package/src/lib/document/services/excel-parser.service.spec.ts +0 -66
  201. package/src/lib/document/services/excel-parser.service.ts +0 -483
  202. package/src/lib/document/services/file-format.service.spec.ts +0 -16
  203. package/src/lib/document/services/file-format.service.ts +0 -63
  204. package/src/lib/document/services/status-calculator.service.ts +0 -44
  205. package/src/lib/document/services/user-list.service.ts +0 -77
  206. package/src/lib/document/state/document.query.ts +0 -378
  207. package/src/lib/document/state/document.state.ts +0 -100
  208. package/src/lib/document/state/document.store.ts +0 -200
  209. package/tsconfig.lib.json +0 -15
  210. package/tsconfig.lib.prod.json +0 -11
  211. package/tsconfig.spec.json +0 -15
@@ -0,0 +1,56 @@
1
+ import { EntityStore } from '@datorama/akita';
2
+ import { DocumentState } from './document.state';
3
+ import { DocumentCategory } from '../models/document-category.model';
4
+ import { Message } from 'primeng/api';
5
+ import { DocumentModel } from '../models/document.model';
6
+ import { UserListModel } from '../models/user-list.model';
7
+ import { StatusDataModel } from '../models/status-data.model';
8
+ import { DocumentListResponse } from '../models/document-list-response.model';
9
+ import { DocumentListItem } from '../models/document-list-response.model';
10
+ import { DocumentHistorySection } from '../models/document-history.model';
11
+ import * as i0 from "@angular/core";
12
+ /**
13
+ * Store that manages the state of documents in the application.
14
+ * The `DocumentStore` class extends Akita's `EntityStore` to manage the entity state for documents.
15
+ * It uses the `createInitialState` function to initialize the store with default values and
16
+ * is configured with the name `'documents'`.
17
+ * @augments EntityStore<DocumentState>
18
+ */
19
+ export declare class DocumentStore extends EntityStore<DocumentState> {
20
+ /**
21
+ * Creates an instance of `DocumentStore` with the initial state of the documents.
22
+ */
23
+ constructor();
24
+ setUploadedDocumentFiles(files: any[]): void;
25
+ setFolders(folders: any): void;
26
+ setDocumentTypes(documentType: any): void;
27
+ setDocumentAlert(documentAlert: any): void;
28
+ setParentDocumentTypeId(parentDocumentTypeId: string): void;
29
+ setMessage(message: Message[]): void;
30
+ setDocumentList(documents: DocumentModel[]): void;
31
+ setDocumentCategories(categories: DocumentCategory[]): void;
32
+ setSelectedMenuItem(menuItem: string | null): void;
33
+ setSelectedUserId(userId: string | null): void;
34
+ setSelectedStatus(status: string | null): void;
35
+ setSearchKey(searchKey: string | null): void;
36
+ setSelectionState(menuItem: string | null, userId: string | null, status: string | null, searchKey?: string | null): void;
37
+ clearSelectionState(): void;
38
+ setShowUserList(show: boolean): void;
39
+ setCurrentDocument(document: DocumentModel | null): void;
40
+ setUserList(userList: UserListModel[]): void;
41
+ setStatusData(statusData: StatusDataModel[]): void;
42
+ setDocumentListResponse(response: DocumentListResponse[] | null): void;
43
+ setSelectedDocument(document: DocumentListItem | undefined): void;
44
+ setDocumentHistory(history: DocumentHistorySection[]): void;
45
+ setShowDocumentHistory(show: boolean): void;
46
+ setIsActionLoading(loading: boolean): void;
47
+ setDocumentStatus(status: 'pending' | 'accepted' | 'rejected'): void;
48
+ setDocumentIsUploaded(uploaded: boolean): void;
49
+ setAlertData(alertData: any): void;
50
+ setDeleteError(error: any): void;
51
+ setDeleteSuccess(success: boolean): void;
52
+ updateDocumentViewerState(document?: DocumentListItem, history?: DocumentHistorySection[], showHistory?: boolean, loading?: boolean, status?: 'pending' | 'accepted' | 'rejected', uploaded?: boolean, alertData?: any): void;
53
+ clearDocumentViewerState(): void;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<DocumentStore, never>;
55
+ static ɵprov: i0.ɵɵInjectableDeclaration<DocumentStore>;
56
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cat-documents-ng",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.0.0",
6
6
  "@angular/core": "^19.0.0"
@@ -11,9 +11,15 @@
11
11
  "typings": "index.d.ts",
12
12
  "sideEffects": false,
13
13
  "main": "bundles/cat-document-lib.umd.js",
14
- "module": "fesm2015/cat-document-lib.js",
14
+ "module": "fesm2022/cat-documents-ng.mjs",
15
15
  "es2015": "fesm2015/cat-document-lib.js",
16
- "devDependencies": {
17
- "@types/jest": "^29.5.14"
16
+ "exports": {
17
+ "./package.json": {
18
+ "default": "./package.json"
19
+ },
20
+ ".": {
21
+ "types": "./index.d.ts",
22
+ "default": "./fesm2022/cat-documents-ng.mjs"
23
+ }
18
24
  }
19
- }
25
+ }
@@ -1,7 +1,3 @@
1
- /*
2
- * Public API Surface of cat-document-lib
3
- */
4
-
5
1
  export * from './lib/document/document.module';
6
2
  export * from './lib/document/components/document-container/document-container.component';
7
3
  export * from './lib/document/components/document-upload/document-upload.component';
package/ng-package.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/cat-document-lib",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- },
7
- "assets": [
8
- "src/assets"
9
- ]
10
- }
@@ -1,3 +0,0 @@
1
- <!-- This component no longer renders a p-confirmDialog element -->
2
- <!-- The p-confirmDialog should be placed only once in the main app component -->
3
- <!-- This component now only provides methods to trigger confirmations via ConfirmationService -->
@@ -1,13 +0,0 @@
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
- }
@@ -1,70 +0,0 @@
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
- });
@@ -1,133 +0,0 @@
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
- }
@@ -1,66 +0,0 @@
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>
@@ -1,227 +0,0 @@
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
- }
@@ -1,23 +0,0 @@
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
- });