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.
Files changed (210) hide show
  1. package/ng-package.json +10 -0
  2. package/package.json +5 -11
  3. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.html +3 -0
  4. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.scss +13 -0
  5. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.spec.ts +70 -0
  6. package/src/Shared/components/confirmation-dialog/confirmation-dialog.component.ts +133 -0
  7. package/src/Shared/components/table-primary/table-primary.component.html +66 -0
  8. package/src/Shared/components/table-primary/table-primary.component.scss +227 -0
  9. package/src/Shared/components/table-primary/table-primary.component.spec.ts +23 -0
  10. package/src/Shared/components/table-primary/table-primary.component.ts +143 -0
  11. package/src/Shared/components/table-primary/table-primary.model.ts +21 -0
  12. package/src/Shared/constant/ERROR.ts +55 -0
  13. package/src/Shared/constant/PERMISSIONS.ts +17 -0
  14. package/src/Shared/constant/SHARED.ts +936 -0
  15. package/{Shared/constant/URLS.d.ts → src/Shared/constant/URLS.ts} +31 -25
  16. package/src/Shared/services/app-config.service.spec.ts +19 -0
  17. package/src/Shared/services/app-config.service.ts +73 -0
  18. package/{Shared/services/global-error.handler.d.ts → src/Shared/services/global-error.handler.ts} +11 -9
  19. package/src/Shared/services/session.service.spec.ts +16 -0
  20. package/src/Shared/services/session.service.ts +76 -0
  21. package/src/Shared/shared.module.ts +25 -0
  22. package/src/lib/document/components/csv-viewer/csv-viewer.component.ts +1 -0
  23. package/src/lib/document/components/document-actions/document-actions.component.html +59 -0
  24. package/src/lib/document/components/document-actions/document-actions.component.scss +362 -0
  25. package/src/lib/document/components/document-actions/document-actions.component.spec.ts +297 -0
  26. package/src/lib/document/components/document-actions/document-actions.component.ts +163 -0
  27. package/src/lib/document/components/document-container/document-container.component.html +36 -0
  28. package/src/lib/document/components/document-container/document-container.component.scss +144 -0
  29. package/src/lib/document/components/document-container/document-container.component.spec.ts +110 -0
  30. package/src/lib/document/components/document-container/document-container.component.ts +363 -0
  31. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.html +332 -0
  32. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.scss +1877 -0
  33. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.spec.ts +258 -0
  34. package/src/lib/document/components/document-content-viewer/document-content-viewer.component.ts +664 -0
  35. package/src/lib/document/components/document-history/document-history.component.html +96 -0
  36. package/src/lib/document/components/document-history/document-history.component.scss +392 -0
  37. package/src/lib/document/components/document-history/document-history.component.spec.ts +93 -0
  38. package/src/lib/document/components/document-history/document-history.component.ts +373 -0
  39. package/src/lib/document/components/document-list/document-list.component.html +46 -0
  40. package/src/lib/document/components/document-list/document-list.component.scss +513 -0
  41. package/src/lib/document/components/document-list/document-list.component.spec.ts +486 -0
  42. package/src/lib/document/components/document-list/document-list.component.ts +682 -0
  43. package/src/lib/document/components/document-list-item/document-list-item.component.html +36 -0
  44. package/src/lib/document/components/document-list-item/document-list-item.component.scss +34 -0
  45. package/src/lib/document/components/document-list-item/document-list-item.component.spec.ts +75 -0
  46. package/src/lib/document/components/document-list-item/document-list-item.component.ts +40 -0
  47. package/src/lib/document/components/document-search/document-search.component.html +64 -0
  48. package/src/lib/document/components/document-search/document-search.component.scss +206 -0
  49. package/src/lib/document/components/document-search/document-search.component.spec.ts +82 -0
  50. package/src/lib/document/components/document-search/document-search.component.ts +163 -0
  51. package/src/lib/document/components/document-status/document-status.component.html +31 -0
  52. package/src/lib/document/components/document-status/document-status.component.scss +192 -0
  53. package/src/lib/document/components/document-status/document-status.component.spec.ts +23 -0
  54. package/src/lib/document/components/document-status/document-status.component.ts +87 -0
  55. package/src/lib/document/components/document-upload/document-upload.component.html +160 -0
  56. package/src/lib/document/components/document-upload/document-upload.component.scss +235 -0
  57. package/src/lib/document/components/document-upload/document-upload.component.spec.ts +95 -0
  58. package/src/lib/document/components/document-upload/document-upload.component.ts +668 -0
  59. package/src/lib/document/components/document-viewer/document-viewer.component.html +50 -0
  60. package/src/lib/document/components/document-viewer/document-viewer.component.scss +187 -0
  61. package/src/lib/document/components/document-viewer/document-viewer.component.spec.ts +79 -0
  62. package/src/lib/document/components/document-viewer/document-viewer.component.ts +261 -0
  63. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.html +48 -0
  64. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.scss +320 -0
  65. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.spec.ts +59 -0
  66. package/src/lib/document/components/document-zoom-controls/document-zoom-controls.component.ts +150 -0
  67. package/src/lib/document/components/documents-menu/documents-menu.component.html +44 -0
  68. package/src/lib/document/components/documents-menu/documents-menu.component.scss +363 -0
  69. package/src/lib/document/components/documents-menu/documents-menu.component.spec.ts +23 -0
  70. package/src/lib/document/components/documents-menu/documents-menu.component.ts +316 -0
  71. package/src/lib/document/components/folder-block/folder-block.component.html +46 -0
  72. package/src/lib/document/components/folder-block/folder-block.component.scss +9 -0
  73. package/src/lib/document/components/folder-block/folder-block.component.spec.ts +70 -0
  74. package/{lib/document/components/folder-block/folder-block.component.d.ts → src/lib/document/components/folder-block/folder-block.component.ts} +28 -12
  75. package/src/lib/document/components/folder-container/folder-container.component.html +56 -0
  76. package/src/lib/document/components/folder-container/folder-container.component.scss +20 -0
  77. package/src/lib/document/components/folder-container/folder-container.component.spec.ts +27 -0
  78. package/src/lib/document/components/folder-container/folder-container.component.ts +328 -0
  79. package/src/lib/document/components/linked-document/linked-document.component.html +23 -0
  80. package/src/lib/document/components/linked-document/linked-document.component.scss +10 -0
  81. package/src/lib/document/components/linked-document/linked-document.component.spec.ts +61 -0
  82. package/src/lib/document/components/linked-document/linked-document.component.ts +49 -0
  83. package/src/lib/document/components/request-document/request-document.component.html +86 -0
  84. package/src/lib/document/components/request-document/request-document.component.scss +16 -0
  85. package/src/lib/document/components/request-document/request-document.component.ts +278 -0
  86. package/src/lib/document/components/sidebar/sidebar.component.html +75 -0
  87. package/src/lib/document/components/sidebar/sidebar.component.scss +157 -0
  88. package/src/lib/document/components/sidebar/sidebar.component.spec.ts +114 -0
  89. package/src/lib/document/components/sidebar/sidebar.component.ts +223 -0
  90. package/src/lib/document/components/user-list/user-list.component.html +33 -0
  91. package/src/lib/document/components/user-list/user-list.component.scss +118 -0
  92. package/src/lib/document/components/user-list/user-list.component.spec.ts +23 -0
  93. package/src/lib/document/components/user-list/user-list.component.ts +181 -0
  94. package/src/lib/document/constant/DOCUMENT_HISTORY.ts +52 -0
  95. package/src/lib/document/directives/document.directive.ts +32 -0
  96. package/src/lib/document/directives/permission.directive.spec.ts +0 -0
  97. package/src/lib/document/directives/permission.directive.ts +72 -0
  98. package/src/lib/document/document.module.ts +351 -0
  99. package/{lib/document/models/document-alert.model.d.ts → src/lib/document/models/document-alert.model.ts} +11 -4
  100. package/src/lib/document/models/document-category.model.ts +30 -0
  101. package/src/lib/document/models/document-history.model.ts +109 -0
  102. package/src/lib/document/models/document-list-response.model.ts +37 -0
  103. package/src/lib/document/models/document-type.model.ts +44 -0
  104. package/src/lib/document/models/document.model.ts +53 -0
  105. package/{lib/document/models/folder.model.d.ts → src/lib/document/models/folder.model.ts} +10 -4
  106. package/src/lib/document/models/status-data.model.ts +31 -0
  107. package/src/lib/document/models/uploaded-file-response.model.ts +7 -0
  108. package/src/lib/document/models/user-list.model.ts +10 -0
  109. package/src/lib/document/services/csv-parser.service.spec.ts +97 -0
  110. package/src/lib/document/services/csv-parser.service.ts +303 -0
  111. package/src/lib/document/services/document-actions.service.ts +125 -0
  112. package/src/lib/document/services/document-content-type.service.ts +193 -0
  113. package/src/lib/document/services/document-history-style.service.ts +138 -0
  114. package/src/lib/document/services/document-history.service.ts +129 -0
  115. package/src/lib/document/services/document-http.service.spec.ts +119 -0
  116. package/src/lib/document/services/document-http.service.ts +497 -0
  117. package/src/lib/document/services/document-list.service.ts +195 -0
  118. package/src/lib/document/services/document-menu.service.ts +277 -0
  119. package/src/lib/document/services/document-scroll.service.ts +138 -0
  120. package/src/lib/document/services/document-severity.service.ts +98 -0
  121. package/src/lib/document/services/document-table-builder.service.ts +82 -0
  122. package/src/lib/document/services/document-upload-business.service.ts +326 -0
  123. package/src/lib/document/services/document-upload-data.service.ts +82 -0
  124. package/src/lib/document/services/document-upload-form.service.ts +149 -0
  125. package/src/lib/document/services/document-upload.service.spec.ts +99 -0
  126. package/src/lib/document/services/document-upload.service.ts +209 -0
  127. package/src/lib/document/services/document-viewer.service.ts +279 -0
  128. package/src/lib/document/services/document-zoom.service.spec.ts +56 -0
  129. package/src/lib/document/services/document-zoom.service.ts +164 -0
  130. package/src/lib/document/services/document.service.ts +356 -0
  131. package/src/lib/document/services/eml-parser.service.ts +444 -0
  132. package/src/lib/document/services/excel-parser.service.spec.ts +66 -0
  133. package/src/lib/document/services/excel-parser.service.ts +483 -0
  134. package/src/lib/document/services/file-format.service.spec.ts +16 -0
  135. package/src/lib/document/services/file-format.service.ts +63 -0
  136. package/src/lib/document/services/status-calculator.service.ts +44 -0
  137. package/src/lib/document/services/user-list.service.ts +77 -0
  138. package/src/lib/document/state/document.query.ts +378 -0
  139. package/{lib/document/state/document.service.d.ts → src/lib/document/state/document.service.ts} +46 -15
  140. package/src/lib/document/state/document.state.ts +100 -0
  141. package/src/lib/document/state/document.store.ts +200 -0
  142. package/{public-api.d.ts → src/public-api.ts} +4 -0
  143. package/tsconfig.lib.json +15 -0
  144. package/tsconfig.lib.prod.json +11 -0
  145. package/tsconfig.spec.json +15 -0
  146. package/Shared/components/confirmation-dialog/confirmation-dialog.component.d.ts +0 -44
  147. package/Shared/components/table-primary/table-primary.component.d.ts +0 -31
  148. package/Shared/components/table-primary/table-primary.model.d.ts +0 -19
  149. package/Shared/constant/ERROR.d.ts +0 -52
  150. package/Shared/constant/SHARED.d.ts +0 -546
  151. package/Shared/services/app-config.service.d.ts +0 -51
  152. package/Shared/services/session.service.d.ts +0 -46
  153. package/Shared/shared.module.d.ts +0 -14
  154. package/fesm2022/cat-documents-ng.mjs +0 -11392
  155. package/fesm2022/cat-documents-ng.mjs.map +0 -1
  156. package/index.d.ts +0 -5
  157. package/lib/document/components/document-actions/document-actions.component.d.ts +0 -78
  158. package/lib/document/components/document-container/document-container.component.d.ts +0 -162
  159. package/lib/document/components/document-content-viewer/document-content-viewer.component.d.ts +0 -291
  160. package/lib/document/components/document-history/document-history.component.d.ts +0 -160
  161. package/lib/document/components/document-list/document-list.component.d.ts +0 -299
  162. package/lib/document/components/document-list-item/document-list-item.component.d.ts +0 -28
  163. package/lib/document/components/document-search/document-search.component.d.ts +0 -77
  164. package/lib/document/components/document-status/document-status.component.d.ts +0 -24
  165. package/lib/document/components/document-upload/document-upload.component.d.ts +0 -321
  166. package/lib/document/components/document-viewer/document-viewer.component.d.ts +0 -137
  167. package/lib/document/components/document-zoom-controls/document-zoom-controls.component.d.ts +0 -33
  168. package/lib/document/components/documents-menu/documents-menu.component.d.ts +0 -110
  169. package/lib/document/components/folder-container/folder-container.component.d.ts +0 -162
  170. package/lib/document/components/linked-document/linked-document.component.d.ts +0 -39
  171. package/lib/document/components/request-document/request-document.component.d.ts +0 -69
  172. package/lib/document/components/sidebar/sidebar.component.d.ts +0 -109
  173. package/lib/document/components/user-list/user-list.component.d.ts +0 -34
  174. package/lib/document/constant/DOCUMENT_HISTORY.d.ts +0 -41
  175. package/lib/document/directives/document.directive.d.ts +0 -20
  176. package/lib/document/directives/permission.directive.d.ts +0 -38
  177. package/lib/document/document.module.d.ts +0 -60
  178. package/lib/document/models/document-category.model.d.ts +0 -24
  179. package/lib/document/models/document-history.model.d.ts +0 -94
  180. package/lib/document/models/document-list-response.model.d.ts +0 -33
  181. package/lib/document/models/document-type.model.d.ts +0 -37
  182. package/lib/document/models/document.model.d.ts +0 -44
  183. package/lib/document/models/status-data.model.d.ts +0 -27
  184. package/lib/document/models/uploaded-file-response.model.d.ts +0 -7
  185. package/lib/document/models/user-list.model.d.ts +0 -8
  186. package/lib/document/services/csv-parser.service.d.ts +0 -88
  187. package/lib/document/services/document-actions.service.d.ts +0 -48
  188. package/lib/document/services/document-content-type.service.d.ts +0 -85
  189. package/lib/document/services/document-history-style.service.d.ts +0 -34
  190. package/lib/document/services/document-history.service.d.ts +0 -42
  191. package/lib/document/services/document-http.service.d.ts +0 -179
  192. package/lib/document/services/document-list.service.d.ts +0 -74
  193. package/lib/document/services/document-menu.service.d.ts +0 -122
  194. package/lib/document/services/document-scroll.service.d.ts +0 -55
  195. package/lib/document/services/document-table-builder.service.d.ts +0 -38
  196. package/lib/document/services/document-upload-business.service.d.ts +0 -107
  197. package/lib/document/services/document-upload-data.service.d.ts +0 -40
  198. package/lib/document/services/document-upload-form.service.d.ts +0 -41
  199. package/lib/document/services/document-upload.service.d.ts +0 -99
  200. package/lib/document/services/document-viewer.service.d.ts +0 -97
  201. package/lib/document/services/document-zoom.service.d.ts +0 -81
  202. package/lib/document/services/document.service.d.ts +0 -161
  203. package/lib/document/services/eml-parser.service.d.ts +0 -116
  204. package/lib/document/services/excel-parser.service.d.ts +0 -169
  205. package/lib/document/services/file-format.service.d.ts +0 -34
  206. package/lib/document/services/status-calculator.service.d.ts +0 -20
  207. package/lib/document/services/user-list.service.d.ts +0 -29
  208. package/lib/document/state/document.query.d.ts +0 -243
  209. package/lib/document/state/document.state.d.ts +0 -61
  210. package/lib/document/state/document.store.d.ts +0 -56
@@ -0,0 +1,363 @@
1
+ .expand-icon-wrapper {
2
+ border: 1px solid var(--primary-color);
3
+ height: 24px;
4
+ width: 24px;
5
+ border-radius: 50%;
6
+ background: var(--blue-bg-light);
7
+ }
8
+
9
+ ::ng-deep {
10
+ .p-badge.p-badge-success {
11
+ background-color: #DCFCE7;
12
+ color: #16A34A;
13
+ font-family: inherit;
14
+ font-size: 12px;
15
+ font-weight: 400;
16
+ font-style: inherit;
17
+ }
18
+
19
+ .p-badge.p-badge-danger {
20
+ background-color: #FEE2E2;
21
+ color: #DC2626;
22
+ font-family: inherit;
23
+ font-size: 12px;
24
+ font-weight: 400;
25
+ font-style: inherit;
26
+ }
27
+
28
+ .p-badge.p-badge-warning {
29
+ background-color: #FEF3C7;
30
+ color: #D97706;
31
+ font-family: inherit;
32
+ font-size: 12px;
33
+ font-weight: 400;
34
+ font-style: inherit;
35
+ }
36
+
37
+ .p-badge.p-badge-info{
38
+ background-color: #E5E7EB;
39
+ color: black;
40
+ font-family: inherit;
41
+ font-size: 12px;
42
+ font-weight: 400;
43
+ font-style: inherit;
44
+ }
45
+ .p-menu .p-menuitem > .p-menuitem-content .p-menuitem-link {
46
+ color: #1f2937;
47
+ }
48
+ @media screen and (min-width: 768px) {
49
+ .md\:w-15rem {
50
+ width: 100% !important;
51
+ }
52
+ }
53
+
54
+ .p-menu{
55
+ // .p-menuitem:not(p-highlight):not(p-disabled)>.p-menuitem-content:hover{
56
+ // color: rgba(0, 102, 255, 1) !important;
57
+ // border: none !important;
58
+ // // background: transparent !important;
59
+ // // background-color: transparent !important;
60
+ // }
61
+ }
62
+
63
+ .p-menu {
64
+ border: none;
65
+ }
66
+ .custom-scroll{
67
+ scrollbar-gutter: inherit;
68
+ }
69
+
70
+ // Styles for selected menu items
71
+ .selected-menu-item {
72
+ background-color: rgba(0, 102, 255, 0.1) !important;
73
+ color: var(--primary-color) !important;
74
+ border: 1px solid rgba(68, 72, 109, 0.1) !important;
75
+ border-radius: 10px !important;
76
+
77
+ .text-xl {
78
+ color: var(--primary-color) !important;
79
+ }
80
+
81
+ }
82
+
83
+ // Styles for disabled menu items
84
+ .disabled-menu-item {
85
+ opacity: 0.5 !important;
86
+ cursor: not-allowed !important;
87
+ pointer-events: none !important;
88
+
89
+ .text-xl {
90
+ color: #9EA0B3 !important;
91
+ }
92
+
93
+ .ml-2 {
94
+ color: #9EA0B3 !important;
95
+ }
96
+
97
+ .p-badge {
98
+ opacity: 0.5 !important;
99
+ }
100
+ }
101
+
102
+ // Ensure deselected items have no background immediately
103
+ .p-menuitem-link:not(.selected-menu-item) {
104
+ background-color: #ffffff !important;
105
+ border: none !important;
106
+ border-radius: 0 !important;
107
+
108
+ .text-xl {
109
+ color: var(--text-color) !important;
110
+ }
111
+ }
112
+ }
113
+ ::ng-deep {
114
+ .p-panelmenu .p-panelmenu-content {
115
+ border: none !important;
116
+ }
117
+ }
118
+ .application-title-wrapper {
119
+ color: #9ea0b3;
120
+ font-weight: 500;
121
+ }
122
+
123
+ .widget-menu-wrapper {
124
+ margin-top: 8px;
125
+ }
126
+
127
+ .widget-menu-header-wrapper {
128
+ padding: 4px 4px 4px 16px;
129
+ }
130
+
131
+ .widget-menu-container {
132
+ overflow-y: auto;
133
+ overflow-x: hidden;
134
+ }
135
+
136
+ .custom-scroll {
137
+ overflow-y: hidden;
138
+ scrollbar-gutter: stable;
139
+ }
140
+
141
+ .custom-scroll:hover {
142
+ overflow-y: auto;
143
+ }
144
+
145
+ ::ng-deep {
146
+ .document-sidebar-container {
147
+ .p-card {
148
+ height: 100%;
149
+ box-shadow: none;
150
+
151
+ .p-card-content {
152
+ height: 100%;
153
+ padding: 0 !important;
154
+ }
155
+
156
+ .p-card-body {
157
+ height: 100%;
158
+ width: 100%;
159
+ padding: 12px 8px;
160
+ border-radius: 10px;
161
+ border: 1px solid #e5e7eb;
162
+ }
163
+ }
164
+ .widget-menu-wrapper
165
+ .p-panelmenu-panel
166
+ .p-panelmenu-expanded
167
+ .p-panelmenu-content {
168
+ border: none !important;
169
+ }
170
+ }
171
+
172
+ .widget-menu-wrapper {
173
+ .p-panelmenu {
174
+ .p-panelmenu-header {
175
+ .p-panelmenu-header-content {
176
+ border: none;
177
+ color: var(--text-color);
178
+ font-weight: 400 !important;
179
+ background-color: var(--surface-0) !important;
180
+
181
+ .p-panelmenu-header-action {
182
+ color: var(--text-color);
183
+ font-weight: 400 !important;
184
+ position: relative;
185
+ padding: 12px;
186
+
187
+ .p-icon-wrapper {
188
+ position: absolute;
189
+ right: 0;
190
+ top: 16px;
191
+ margin-right: 7px;
192
+ transform: rotate(90deg) !important;
193
+ transition: none !important;
194
+ }
195
+
196
+ .p-menuitem-text {
197
+ max-width: 75%;
198
+ display: -webkit-box;
199
+ -webkit-line-clamp: 1;
200
+ -webkit-box-orient: vertical;
201
+ overflow: hidden;
202
+ text-overflow: ellipsis;
203
+ white-space: normal;
204
+ word-break: break-all;
205
+ }
206
+ }
207
+
208
+ .p-menuitem-link-active {
209
+ border: 1px solid rgba(68, 72, 109, 0.1);
210
+ border-radius: 10px;
211
+ padding: 12px;
212
+ color: var(--primary-color);
213
+ background-color: rgba(0, 102, 255, 0.1) !important;
214
+
215
+ .p-menuitem-icon {
216
+ color: var(--primary-color);
217
+ }
218
+
219
+ .p-menuitem-text {
220
+ color: var(--primary-color);
221
+ }
222
+ }
223
+ }
224
+ }
225
+
226
+ .company-action-wrapper:not(.p-disabled).p-highlight
227
+ .p-panelmenu-header-content {
228
+ margin: 12px 0 !important;
229
+ }
230
+
231
+ .no-highlight.p-panelmenu-header:not(.p-disabled).p-highlight
232
+ .p-panelmenu-header-content {
233
+ background-color: transparent !important;
234
+ border-radius: 10px;
235
+ padding: 12px;
236
+ // border: 1px solid rgba(68, 72, 109, 0.1) !important;
237
+ border-bottom: 0 !important;
238
+ border-bottom-left-radius: 0 !important;
239
+ border-bottom-right-radius: 0 !important;
240
+
241
+ .p-panelmenu-header-action {
242
+ padding: 0 !important;
243
+
244
+ .p-icon-wrapper {
245
+ transform: rotate(180deg) !important;
246
+ transition: none !important;
247
+ top: 0 !important;
248
+ }
249
+ }
250
+ }
251
+ }
252
+
253
+ .p-panelmenu
254
+ .p-panelmenu-content
255
+ .p-menuitem
256
+ > .p-menuitem-content
257
+ .p-menuitem-link {
258
+ background-color: #ffffff !important;
259
+ color: var(--text-color);
260
+ padding: 12px 6px !important;
261
+
262
+ .p-menuitem-text {
263
+ max-width: 75%;
264
+ display: -webkit-box;
265
+ -webkit-line-clamp: 2;
266
+ -webkit-box-orient: vertical;
267
+ overflow: hidden;
268
+ text-overflow: ellipsis;
269
+ white-space: normal;
270
+ word-break: break-all;
271
+ }
272
+ }
273
+
274
+ .p-panelmenu
275
+ .p-panelmenu-content
276
+ .p-menuitem
277
+ > .p-menuitem-content
278
+ .p-menuitem-link-active {
279
+ border: 1px solid rgba(68, 72, 109, 0.1);
280
+ border-radius: 10px;
281
+ padding: 12px;
282
+ color: var(--primary-color);
283
+ box-shadow: none !important;
284
+ background-color: rgba(0, 102, 255, 0.1) !important;
285
+
286
+ .p-menuitem-icon {
287
+ color: var(--primary-color);
288
+ }
289
+
290
+ .p-menuitem-text {
291
+ color: var(--primary-color);
292
+ }
293
+ }
294
+
295
+ .p-panelmenu
296
+ .p-panelmenu-content
297
+ .p-menuitem.p-focus
298
+ > .p-menuitem-content {
299
+ background-color: #ffffff !important;
300
+ }
301
+
302
+ // Ensure deselected items have white background when not focused
303
+ .p-panelmenu
304
+ .p-panelmenu-content
305
+ .p-menuitem:not(.p-focus)
306
+ > .p-menuitem-content
307
+ .p-menuitem-link {
308
+ background-color: #ffffff !important;
309
+ }
310
+
311
+ // Immediate deselection styling - ensure no lingering selected styles
312
+ .p-panelmenu
313
+ .p-panelmenu-content
314
+ .p-menuitem
315
+ > .p-menuitem-content
316
+ .p-menuitem-link:not(.selected-menu-item) {
317
+ background-color: #ffffff !important;
318
+ border: none !important;
319
+ border-radius: 0 !important;
320
+ color: var(--text-color) !important;
321
+
322
+ .p-menuitem-icon {
323
+ color: var(--text-color) !important;
324
+ }
325
+
326
+ .p-menuitem-text {
327
+ color: var(--text-color) !important;
328
+ }
329
+ }
330
+
331
+ .p-panelmenu-panel {
332
+ .p-panelmenu-expanded {
333
+ .p-panelmenu-content {
334
+ border: 1px solid rgba(68, 72, 109, 0.1) !important;
335
+ border-top: 0 !important;
336
+ border-bottom-left-radius: 10px;
337
+ border-bottom-right-radius: 10px;
338
+ }
339
+ }
340
+
341
+ .widget-separator {
342
+ border-top: 1px solid rgba(68, 72, 109, 0.1) !important;
343
+
344
+ .p-panelmenu-header-content {
345
+ .p-panelmenu-header-action {
346
+ padding: 0 !important;
347
+ }
348
+ }
349
+ }
350
+ }
351
+ }
352
+ }
353
+
354
+ .no-documents-message {
355
+ padding: 12px 16px;
356
+ text-align: center;
357
+
358
+ .text-muted {
359
+ color: #9EA0B3;
360
+ font-size: 14px;
361
+ font-style: italic;
362
+ }
363
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { DocumentsMenuComponent } from './documents-menu.component';
4
+
5
+ describe('DocumentsMenuComponent', () => {
6
+ let component: DocumentsMenuComponent;
7
+ let fixture: ComponentFixture<DocumentsMenuComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [DocumentsMenuComponent]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(DocumentsMenuComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,316 @@
1
+ import { Component, Input, OnInit, OnChanges, SimpleChanges, Output, EventEmitter, OnDestroy } from '@angular/core';
2
+ import { Subscription } from 'rxjs';
3
+ import { DocumentStore } from '../../state/document.store';
4
+ import { DocumentQuery } from '../../state/document.query';
5
+ import { DocumentCategory, DocumentCategoryItem } from '../../models/document-category.model';
6
+ import { DocumentMenuService } from '../../services/document-menu.service';
7
+ import { DocumentHelperService } from '../../services/document.service';
8
+ import { SHARED } from '../../../../Shared/constant/SHARED';
9
+
10
+ interface MenuItemData {
11
+ totalDocuments: number;
12
+ approvedDocuments: number;
13
+ badgeValue: string;
14
+ badgeSeverity: 'success' | 'info' | 'warning' | 'danger';
15
+ shouldShowBadge: boolean;
16
+ }
17
+
18
+ @Component({
19
+ selector: 'lib-documents-menu',
20
+ standalone: false,
21
+ templateUrl: './documents-menu.component.html',
22
+ styleUrl: './documents-menu.component.scss'
23
+ })
24
+ export class DocumentsMenuComponent implements OnInit, OnChanges, OnDestroy {
25
+ @Input() catagories: DocumentCategory[] = SHARED.EMPTY_ARRAY
26
+ @Input() applicationNumber : string = SHARED.EMPTY
27
+ @Input() contextId: string = SHARED.EMPTY;
28
+ @Output() menuItemSelected = new EventEmitter<{
29
+ item: DocumentCategoryItem;
30
+ category: DocumentCategory;
31
+ navigationInfo?: {
32
+ menuItemId: string;
33
+ menuItemLabel: string;
34
+ categoryLabel: string;
35
+ categoryIndex: number;
36
+ };
37
+ }>();
38
+
39
+ selectedMenuItem: string | null = null;
40
+ selectedMenuItemId: string | null = null;
41
+
42
+ // Store the categories from the store
43
+ private storeCategories: DocumentCategory[] = SHARED.EMPTY_ARRAY;
44
+
45
+ // Cache for categories to avoid repeated processing
46
+ private _cachedCategories: DocumentCategory[] = SHARED.EMPTY_ARRAY;
47
+
48
+ // Subscriptions to track for cleanup
49
+ private selectedMenuItemSubscription!: Subscription;
50
+ private documentCategoriesSubscription!: Subscription;
51
+ private documentListResponseSubscription!: Subscription;
52
+
53
+ constructor(
54
+ private documentStore: DocumentStore,
55
+ private documentQuery: DocumentQuery,
56
+ private documentMenuService: DocumentMenuService,
57
+ private documentHelperService: DocumentHelperService
58
+ ) {}
59
+
60
+ /**
61
+ * Initialize the component
62
+ * @returns {void}
63
+ * @memberof DocumentsMenuComponent
64
+ */
65
+ ngOnInit(): void {
66
+ this.selectedMenuItemSubscription = this.documentQuery.selectSelectedMenuItem().subscribe(menuItemId => {
67
+ this.selectedMenuItemId = menuItemId;
68
+ this.selectedMenuItem = this.findMenuItemLabelById(menuItemId);
69
+ });
70
+
71
+ // Subscribe to document categories from the store
72
+ this.documentCategoriesSubscription = this.documentQuery.selectDocumentCategories().subscribe(categories => {
73
+ if (categories && categories.length > 0) {
74
+ this.storeCategories = categories;
75
+ this.updateCachedCategories();
76
+ this.updateMenuItemsData();
77
+ }
78
+ });
79
+
80
+ // Subscribe to document list response to update menu item selectability
81
+ this.setupDocumentListResponseSubscription();
82
+ }
83
+
84
+ /**
85
+ * Handle changes to input properties
86
+ * @param {SimpleChanges} changes - The changes to the input properties
87
+ * @returns {void}
88
+ * @memberof DocumentsMenuComponent
89
+ */
90
+ ngOnChanges(changes: SimpleChanges): void {
91
+ if (changes[SHARED.CATAGORIES] && this.catagories) {
92
+ this.updateCachedCategories();
93
+ this.updateMenuItemsData();
94
+ }
95
+
96
+ if (changes[SHARED.CONTEXT_ID] && !changes[SHARED.CONTEXT_ID].firstChange) {
97
+ this.handleContextIdChange();
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Gets the categories to use for the menu
103
+ * Priority: Store categories > Input categories
104
+ * Categories maintain their original order as provided by the API
105
+ */
106
+ get categories(): DocumentCategory[] {
107
+ return this._cachedCategories;
108
+ }
109
+
110
+ /**
111
+ * Updates the cached categories when data changes
112
+ * Maintains the original order as provided by the API
113
+ */
114
+ private updateCachedCategories(): void {
115
+ const nextCategories = this.storeCategories.length > 0 ? this.storeCategories : this.catagories;
116
+ if (!this._cachedCategories || this._cachedCategories.length === 0) {
117
+ this._cachedCategories = nextCategories;
118
+ return;
119
+ }
120
+ const previousById = new Map<string, boolean>();
121
+ this._cachedCategories.forEach(category => {
122
+ category.items?.forEach(item => {
123
+ if ((item as any).isSelectable !== undefined) {
124
+ previousById.set(item._id, (item as any).isSelectable);
125
+ }
126
+ });
127
+ });
128
+
129
+ this._cachedCategories = nextCategories.map(category => ({
130
+ ...category,
131
+ items: category.items?.map(item => ({
132
+ ...item,
133
+ isSelectable: previousById.has(item._id) ? previousById.get(item._id)! : (item as any).isSelectable
134
+ }))
135
+ }));
136
+ }
137
+
138
+ /**
139
+ * Finds the label of a menu item by its _id
140
+ * @param id The _id to search for
141
+ * @returns The label of the menu item or null if not found
142
+ */
143
+ private findMenuItemLabelById(id: string | null): string | null {
144
+ if (!id) return null;
145
+
146
+ for (const category of this.categories) {
147
+ if (category.items) {
148
+ const item = category.items.find(item => item._id === id);
149
+ if (item) {
150
+ return item.label;
151
+ }
152
+ }
153
+ }
154
+ return null;
155
+ }
156
+
157
+ /**
158
+ * Finds the category for a menu item by its _id
159
+ * @param id The _id to search for
160
+ * @returns The category or null if not found
161
+ */
162
+ private findMenuItemCategoryById(id: string | null): DocumentCategory | null {
163
+ if (!id) return null;
164
+
165
+ for (const category of this.categories) {
166
+ if (category.items) {
167
+ const item = category.items.find(item => item._id === id);
168
+ if (item) {
169
+ return category;
170
+ }
171
+ }
172
+ }
173
+ return null;
174
+ }
175
+
176
+ /**
177
+ * Update menu use catagories
178
+ */
179
+ private updateMenuItemsData(): void {
180
+ this.updateCachedCategories();
181
+
182
+ this._cachedCategories.forEach(category => {
183
+ if (category.items) {
184
+ category.items.forEach(item => {
185
+ const menuData = {
186
+ totalDocuments: this.documentMenuService.getTotalDocuments(item),
187
+ approvedDocuments: this.documentMenuService.getApprovedDocuments(item),
188
+ badgeValue: this.documentMenuService.getBadgeValue(item),
189
+ badgeSeverity: this.documentMenuService.getBadgeSeverity(item),
190
+ shouldShowBadge: this.documentMenuService.shouldShowBadge(item)
191
+ };
192
+ (item as any).menuData = menuData;
193
+
194
+ // Initialize isSelectable as true (default state)
195
+ if (item.isSelectable === undefined) {
196
+ item.isSelectable = true;
197
+ }
198
+ });
199
+ }
200
+ });
201
+ }
202
+
203
+ /**
204
+ * Sets up subscription to document list response to update menu item selectability
205
+ */
206
+ private setupDocumentListResponseSubscription(): void {
207
+ this.documentListResponseSubscription = this.documentQuery.selectDocumentListResponse().subscribe(documentListResponse => {
208
+ this.updateMenuItemsSelectability(documentListResponse);
209
+ });
210
+ }
211
+
212
+ /**
213
+ * Updates menu items with selectability status based on filtered document list
214
+ * @param documentListResponse - The filtered document list response
215
+ */
216
+ private updateMenuItemsSelectability(documentListResponse: any): void {
217
+ if (this._cachedCategories && this._cachedCategories.length > 0) {
218
+ // Only update if we have a valid response (not null/undefined)
219
+ // If response is null, keep previous selectability to avoid flicker/reset during refresh
220
+ if (documentListResponse !== null && documentListResponse !== undefined) {
221
+ this._cachedCategories = this.documentMenuService.updateMenuItemsWithSelectabilityStatus(
222
+ this._cachedCategories,
223
+ documentListResponse
224
+ );
225
+ } else {
226
+ // Do nothing; preserve existing isSelectable values
227
+ }
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Handle the menu item click for navigation
233
+ * @param {*} event - Event
234
+ * @param {DocumentCategoryItem} item - catagory item
235
+ */
236
+ onMenuItemClick(event: any, item: DocumentCategoryItem): void {
237
+ // Prevent selection if the menu item is not selectable
238
+ if (item.isSelectable === false) {
239
+ event.preventDefault();
240
+ event.stopPropagation();
241
+ return;
242
+ }
243
+
244
+ if (this.selectedMenuItemId === item._id) {
245
+ this.selectedMenuItem = null;
246
+ this.selectedMenuItemId = null;
247
+ this.documentStore.setSelectedMenuItem(null);
248
+ this.menuItemSelected.emit({
249
+ item: item,
250
+ category: this.findMenuItemCategoryById(item._id)!,
251
+ navigationInfo: undefined
252
+ });
253
+ } else {
254
+ this.selectedMenuItem = item.label;
255
+ this.selectedMenuItemId = item._id;
256
+ this.documentStore.setSelectedMenuItem(item._id);
257
+ const category = this.findMenuItemCategoryById(item._id);
258
+ if (category) {
259
+ this.menuItemSelected.emit({
260
+ item: item,
261
+ category: category,
262
+ navigationInfo: {
263
+ menuItemId: item._id,
264
+ menuItemLabel: item.label,
265
+ categoryLabel: category.label,
266
+ categoryIndex: this.categories.findIndex(cat => cat === category)
267
+ }
268
+ });
269
+ }
270
+ }
271
+ }
272
+
273
+
274
+ /**
275
+ * Get the selected menu item
276
+ * @returns {string | null} - The selected menu item
277
+ */
278
+ getSelectedMenuItem(): string | null {
279
+ return this.selectedMenuItem;
280
+ }
281
+
282
+ /**
283
+ * Handles contextId changes by clearing current selection
284
+ */
285
+ private handleContextIdChange(): void {
286
+ if (this.contextId && this.contextId !== SHARED.EMPTY) {
287
+ this.selectedMenuItem = null;
288
+ this.selectedMenuItemId = null;
289
+ this.documentStore.setSelectedMenuItem(null);
290
+ }
291
+ }
292
+
293
+ /**
294
+ * Get the selected menu item id
295
+ * @returns {string | null} - The selected menu item id
296
+ */
297
+ getSelectedMenuItemId(): string | null {
298
+ return this.selectedMenuItemId;
299
+ }
300
+
301
+ /**
302
+ * Clean up subscriptions when component is destroyed
303
+ * Prevents memory leaks and ensures proper cleanup
304
+ */
305
+ ngOnDestroy(): void {
306
+ if (this.selectedMenuItemSubscription) {
307
+ this.selectedMenuItemSubscription.unsubscribe();
308
+ }
309
+ if (this.documentCategoriesSubscription) {
310
+ this.documentCategoriesSubscription.unsubscribe();
311
+ }
312
+ if (this.documentListResponseSubscription) {
313
+ this.documentListResponseSubscription.unsubscribe();
314
+ }
315
+ }
316
+ }