@argusoft/medplat-app-shell 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/package.json +139 -141
  2. package/src/GlobalErrorBoundary.jsx +31 -0
  3. package/src/SilentErrorFallback.jsx +68 -0
  4. package/src/TrackingProviderWrapper.jsx +40 -0
  5. package/src/_tests_/__mocks__/MockTranslationProvider.jsx +21 -0
  6. package/src/_tests_/__mocks__/ckeditor.js +45 -0
  7. package/src/_tests_/__mocks__/fileMock.js +1 -0
  8. package/src/_tests_/__mocks__/useranalytics.js +5 -0
  9. package/src/_tests_/views/components/Dashboard/DashboardUI.test.jsx +137 -0
  10. package/src/_tests_/views/components/Dashboard/DashboardUIMock.js +877 -0
  11. package/src/_tests_/views/components/ForgotPassword/ForgotPassword.test.jsx +314 -0
  12. package/src/_tests_/views/components/LocationDirective/LocationDirective.test.jsx.disable +229 -0
  13. package/src/_tests_/views/components/LocationDirective/mockLocationDirective.js +810 -0
  14. package/src/_tests_/views/components/LocationType/MockLocationType.js +42259 -0
  15. package/src/_tests_/views/components/LocationType/addlocationtype.test.jsx.disable +276 -0
  16. package/src/_tests_/views/components/LocationType/editlocationtype.test.jsx.disable +262 -0
  17. package/src/_tests_/views/components/LocationType/locationtype.test.jsx.disable +148 -0
  18. package/src/_tests_/views/components/Profile/UpdateProfileModalData.js +4396 -0
  19. package/src/_tests_/views/components/Profile/updateprofilemodal.test.jsx +282 -0
  20. package/src/_tests_/views/components/SideBar/MockSideBar.js +1379 -0
  21. package/src/_tests_/views/components/SideBar/SideBar.test.jsx +98 -0
  22. package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/AddManageSystemConfig.test.jsx.disable +164 -0
  23. package/src/_tests_/views/components/SystemConfig/ManageSystemConfig/UpdateManageSystemConfig.test.jsx.disable +157 -0
  24. package/src/_tests_/views/components/SystemConfig/MockSystemConfig.js +1280 -0
  25. package/src/_tests_/views/components/SystemConfig/SystemConfig.test.jsx.disable +165 -0
  26. package/src/_tests_/views/components/login/Login.test.jsx +276 -0
  27. package/src/_tests_/views/components/login/MockAuthorise.js +2414 -0
  28. package/src/_tests_/views/components/login/ServiceResponse.js +595 -0
  29. package/src/_tests_/views/components/user/MockManageUser.js +7965 -0
  30. package/src/_tests_/views/components/user/manageuser.test.jsx.disable +989 -0
  31. package/src/_tests_/views/components/user/mockUsersData.js +582 -0
  32. package/src/assets/img/OASISLogin.png +0 -0
  33. package/src/assets/img/bahaarNew.png +0 -0
  34. package/src/assets/img/dnhdd4K.png +0 -0
  35. package/src/assets/img/govtofup.png +0 -0
  36. package/src/assets/img/sewarural4K.png +0 -0
  37. package/src/assets/img/techo4K.png +0 -0
  38. package/src/assets/img/up4K.png +0 -0
  39. package/src/common/HolidayList.jsx +573 -0
  40. package/src/common/MalaciaousInputUtil.js +23 -0
  41. package/src/common/SafeHtml.jsx +17 -0
  42. package/src/common/VersionManager.jsx +109 -0
  43. package/src/common/constants/PerformanceDashboard.js +514 -0
  44. package/src/common/constants/app.constant.js +781 -0
  45. package/src/common/constants/cccVerificationConstants.js +18 -0
  46. package/src/common/constants/fhsrConstant.js +33 -0
  47. package/src/common/constants/gvk-verification.constant.js +76 -0
  48. package/src/common/constants/search.constant.js +23 -0
  49. package/src/common/constants/teleconsulatationConstant.jsx +1339 -0
  50. package/src/common/directives/SearchTemplate.jsx +784 -0
  51. package/src/common/directives/SearchTemplate.scss +14 -0
  52. package/src/common/dynamicView/DynamicView.jsx +353 -0
  53. package/src/common/dynamicView/InputFieldComponent.jsx +1501 -0
  54. package/src/common/dynamicView/InputViewComponent.jsx +298 -0
  55. package/src/common/dynamicView/InputViewComponent.scss +15 -0
  56. package/src/common/env.js +5 -0
  57. package/src/common/filters/locationNameFilter.js +26 -0
  58. package/src/common/fontAwesomeIcons/FontAwesomeIcons.jsx +27 -0
  59. package/src/common/fontAwesomeIcons/FontAwesomeIconsNames.js +1968 -0
  60. package/src/common/fontPreferences/fontSizeProvider.jsx +34 -0
  61. package/src/common/fontPreferences/fontSizeSelector.jsx +116 -0
  62. package/src/common/getAssignedFeature/getAssignedFeature.js +32 -0
  63. package/src/common/interceptors/AxiosInterceptor.js +216 -0
  64. package/src/common/languageTranslator/TranslationContext.js +5 -0
  65. package/src/common/languageTranslator/TranslationProvider.jsx +24 -0
  66. package/src/common/languageTranslator/i18n.js +49 -0
  67. package/src/common/services/AuthenticateService.js +116 -0
  68. package/src/common/services/DownloadFile.js +35 -0
  69. package/src/common/services/ForgotPassword.js +18 -0
  70. package/src/common/services/FormConfiguratorService.js +195 -0
  71. package/src/common/services/GlobalApis.js +84 -0
  72. package/src/common/services/InterceptorNavigationService.js +17 -0
  73. package/src/common/services/LocationService.js +65 -0
  74. package/src/common/services/LocationType.js +11 -0
  75. package/src/common/services/QueryBuilder.js +36 -0
  76. package/src/common/services/Roles.js +28 -0
  77. package/src/common/services/SyncWithServer.js +15 -0
  78. package/src/common/services/SystemConfig.js +15 -0
  79. package/src/common/services/TranslationService.js +70 -0
  80. package/src/common/services/TwoFactorService.js +7 -0
  81. package/src/common/services/Users.js +91 -0
  82. package/src/common/services/Webtasks.js +27 -0
  83. package/src/common/services/util/Convert-pad-data-to-API-format.jsx +167 -0
  84. package/src/common/services/util/Convert-to-UI-format.jsx +82 -0
  85. package/src/common/services/util/EmptyPrescriptionPadData.jsx +11 -0
  86. package/src/common/services/util/GeneralUtil.js +456 -0
  87. package/src/common/services/util/Prescription-pad-util.js +339 -0
  88. package/src/common/services/util/PrescriptionPadData.js +67 -0
  89. package/src/common/services/util/PrescriptionpadCommonUtil.js +96 -0
  90. package/src/common/services/util/ReportFieldUtil.jsx +398 -0
  91. package/src/common/services/util/WebSocketContext.jsx +261 -0
  92. package/src/common/syncWithServer/SyncWithServerDialog.jsx +170 -0
  93. package/src/common/syncWithServer/SyncWithServerDialogSkeleton.jsx +67 -0
  94. package/src/common/tests/CustomWrapper.jsx +49 -0
  95. package/src/common/tests/TranslationWrapper.jsx +38 -0
  96. package/src/common/themeProvider/ColorInputs.jsx +97 -0
  97. package/src/common/themeProvider/EditableColorInput.jsx +128 -0
  98. package/src/common/themeProvider/ThemeEditor.jsx +319 -0
  99. package/src/common/themeProvider/ThemeProvider.jsx +210 -0
  100. package/src/common/themeProvider/themeConfig.js +558 -0
  101. package/src/common/toaster/toaster.jsx +30 -0
  102. package/src/firebaseConfig.js +24 -0
  103. package/src/global.scss +221 -0
  104. package/src/hooks/.gitkeep +0 -0
  105. package/src/hooks/useAESEncryption.js +56 -0
  106. package/src/hooks/useCaching.js +43 -0
  107. package/src/hooks/useDebounce.js +34 -0
  108. package/src/hooks/useDebounceFn.js +50 -0
  109. package/src/hooks/useDownloadPdf.js +358 -0
  110. package/src/hooks/useDownloadXlsx.js +55 -0
  111. package/src/hooks/useListValueFieldValues.js +30 -0
  112. package/src/hooks/useLocationHierarchies.js +63 -0
  113. package/src/hooks/useLocationHierarchyTranslate.js +16 -0
  114. package/src/hooks/useOnline.js +27 -0
  115. package/src/hooks/usePagination.js +63 -0
  116. package/src/hooks/useRefreshToken.js +87 -0
  117. package/src/hooks/useScript.js +25 -0
  118. package/src/hooks/useStopwatch.js +75 -0
  119. package/src/hooks/useTrackEvent.js +22 -0
  120. package/src/hooks/useWebAudioRecorder.js +115 -0
  121. package/src/layout/LoaderComponet.jsx +22 -0
  122. package/src/layout/LoaderContext.jsx +29 -0
  123. package/src/layout/mainLayout/AdaptiveZoom.jsx +27 -0
  124. package/src/layout/mainLayout/Chatbot.jsx +243 -0
  125. package/src/layout/mainLayout/Layout.jsx +445 -0
  126. package/src/layout/mainLayout/Profile/UpdateProfileModal.jsx +684 -0
  127. package/src/layout/mainLayout/header/LogoutModal.jsx +131 -0
  128. package/src/layout/mainLayout/header/Navbar.jsx +1677 -0
  129. package/src/layout/mainLayout/header/Navbar.scss +4 -0
  130. package/src/layout/mainLayout/header/index.js +0 -0
  131. package/src/layout/mainLayout/sidebar/SideBar.jsx +1402 -0
  132. package/src/layout/mainLayout/sidebar/Sidebar.css +159 -0
  133. package/src/layout/mainLayout/sidebar/index.js +0 -0
  134. package/src/logo.svg +1 -0
  135. package/src/reportWebVitals.js +13 -0
  136. package/src/setupFirebaseMessaging.js +28 -0
  137. package/src/setupTests.js +8 -0
  138. package/src/store/actions/AuthenticationActions.js +0 -0
  139. package/src/store/actions/ReportsActions.js +0 -0
  140. package/src/store/actions/TranslationAction.js +0 -0
  141. package/src/store/index.js +8 -0
  142. package/src/store/reducer.js +46 -0
  143. package/src/store/reducers/AuthenticationReducer.js +50 -0
  144. package/src/store/reducers/CalendarEventReducer.js +41 -0
  145. package/src/store/reducers/ConditionClipboardReducer.js +45 -0
  146. package/src/store/reducers/FeatureReducer.js +27 -0
  147. package/src/store/reducers/FormConfiguratorReducer.js +38 -0
  148. package/src/store/reducers/LoadingReducer.js +20 -0
  149. package/src/store/reducers/MembersAuthenticationReducer.js +28 -0
  150. package/src/store/reducers/PrescriptionPadReducer.js +329 -0
  151. package/src/store/reducers/QuestionaireReducer.js +29 -0
  152. package/src/store/reducers/ReportsReducer.js +24 -0
  153. package/src/store/reducers/SkeletonReducer.js +20 -0
  154. package/src/store/reducers/ThemeReducer.js +106 -0
  155. package/src/store/reducers/TranslationReducer.js +126 -0
  156. package/src/store/reducers/dashboardEditorSlice.js +77 -0
  157. package/src/store/reducers/districtHealthDashboardSlice.js +58 -0
  158. package/src/store/reducers/immunizationSlice.js +234 -0
  159. package/src/store/slices/dashboardPagesSlice.js +51 -0
  160. package/src/store/slices/dashboardSlice.js +14 -0
  161. package/src/utils/.gitkeep +0 -0
  162. package/src/utils/FormConstants.js +2629 -0
  163. package/src/utils/GujaratTopoChart.jsx +483 -0
  164. package/src/utils/UUIDgenerator.js +8 -0
  165. package/src/utils/appointment-utils/appointment-utils.js +123 -0
  166. package/src/utils/feature.js +42 -0
  167. package/src/utils/getThemeColor.js +12 -0
  168. package/src/utils/localStorageHelper.js +11 -0
  169. package/src/utils/notifications/enable-push-notifications.js +27 -0
  170. package/src/utils/resolveAppliedStyle.js +11 -0
  171. package/src/utils/themeConfigs.js +1483 -0
  172. package/src/views/custom-components/.gitkeep +0 -0
  173. package/src/views/custom-components/AgIconButton/RIf.jsx +14 -0
  174. package/src/views/custom-components/AgIconButton/button.jsx +108 -0
  175. package/src/views/custom-components/AgIconButton/waterDrop.jsx +95 -0
  176. package/src/views/custom-components/AgIconButton/waterDrop.scss +37 -0
  177. package/src/views/custom-components/AlertPlaceholder.jsx +32 -0
  178. package/src/views/custom-components/AllFaIconsSelector.jsx +56 -0
  179. package/src/views/custom-components/CkEditor/CkEditor.js +102 -0
  180. package/src/views/custom-components/CustomAccordion.jsx +72 -0
  181. package/src/views/custom-components/CustomActionIcons.jsx +118 -0
  182. package/src/views/custom-components/CustomAutoComplete.jsx +188 -0
  183. package/src/views/custom-components/CustomCheckBox.jsx +60 -0
  184. package/src/views/custom-components/CustomConfirmationModal.jsx +118 -0
  185. package/src/views/custom-components/CustomCountrySelect.jsx +129 -0
  186. package/src/views/custom-components/CustomDatePicker.jsx +122 -0
  187. package/src/views/custom-components/CustomDropdown.jsx +191 -0
  188. package/src/views/custom-components/CustomFileUpload.jsx +387 -0
  189. package/src/views/custom-components/CustomFullCalendar.jsx +514 -0
  190. package/src/views/custom-components/CustomInfiniteScroll.jsx +126 -0
  191. package/src/views/custom-components/CustomRadioComponent.jsx +65 -0
  192. package/src/views/custom-components/CustomStatsComponent.jsx +114 -0
  193. package/src/views/custom-components/CustomSvgUpload.jsx +170 -0
  194. package/src/views/custom-components/CustomSwitch.jsx +37 -0
  195. package/src/views/custom-components/CustomTabPanel.jsx +19 -0
  196. package/src/views/custom-components/CustomTextArea.jsx +62 -0
  197. package/src/views/custom-components/CustomTextArea.scss +27 -0
  198. package/src/views/custom-components/CustomTextField.jsx +116 -0
  199. package/src/views/custom-components/CustomToggleSwitch.jsx +138 -0
  200. package/src/views/custom-components/CustomTooltip.jsx +51 -0
  201. package/src/views/custom-components/CustomZoomImage.jsx +134 -0
  202. package/src/views/custom-components/CustomizedTable/CustomizedTableV2.jsx +1407 -0
  203. package/src/views/custom-components/CustomizedTable/VirtualizeTableBody.jsx +295 -0
  204. package/src/views/custom-components/CustomizedTable/helper.jsx +159 -0
  205. package/src/views/custom-components/CustomizedTable.jsx +532 -0
  206. package/src/views/custom-components/EditInputField.jsx +174 -0
  207. package/src/views/custom-components/FieldDescription.jsx +22 -0
  208. package/src/views/custom-components/FileDisplayComponent.jsx +138 -0
  209. package/src/views/custom-components/FormItem.jsx +53 -0
  210. package/src/views/custom-components/GenericChart.jsx +80 -0
  211. package/src/views/custom-components/InfoBadge.jsx +60 -0
  212. package/src/views/custom-components/PostgresEditor.jsx +801 -0
  213. package/src/views/custom-components/ResizableEditAutocompleteField.jsx +249 -0
  214. package/src/views/custom-components/ResizableEditInputField.jsx +215 -0
  215. package/src/views/custom-components/ResizeableEditSelectField.jsx +197 -0
  216. package/src/views/custom-components/SideOverlay.jsx +113 -0
  217. package/src/views/custom-components/SideOverlay.scss +42 -0
  218. package/src/views/custom-components/calendar.scss +571 -0
  219. package/src/views/feature-components/.gitkeep +0 -0
  220. package/src/views/feature-components/Dashboard/DashboardUI.jsx +1043 -0
  221. package/src/views/feature-components/Dashboard/DhnddModal/AshaDataQualityVerificationModal.jsx +278 -0
  222. package/src/views/feature-components/Dashboard/PinFeatureModal.jsx +143 -0
  223. package/src/views/feature-components/Dashboard/QuickLinks.jsx +163 -0
  224. package/src/views/feature-components/Dashboard/Taskbar.jsx +56 -0
  225. package/src/views/feature-components/Dashboard/WebtasksFilterForm.jsx +109 -0
  226. package/src/views/feature-components/Dashboard/WidgetCard.jsx +161 -0
  227. package/src/views/feature-components/Dashboard/actionModal.jsx +263 -0
  228. package/src/views/feature-components/Dashboard/ekavachModal/HealthWorkerIncorrectDetailsModal.jsx +332 -0
  229. package/src/views/feature-components/Dashboard/ekavachModal/MoMaternalDeathVerifcationModal.jsx +275 -0
  230. package/src/views/feature-components/Dashboard/ekavachModal/MoVerficationForChildScreeningMoadal.jsx +566 -0
  231. package/src/views/feature-components/FeatureUsageAnalytics/FeatureUsageAnalytics.jsx +989 -0
  232. package/src/views/feature-components/Features/NewServerManagement.jsx +217 -0
  233. package/src/views/feature-components/Features/ServerManagement.scss +120 -0
  234. package/src/views/feature-components/ForgotPassword/ForgotPassword.jsx +226 -0
  235. package/src/views/feature-components/LocationDirective/LocationDirective.jsx +992 -0
  236. package/src/views/feature-components/LocationDirective/LocationDirectiveV2.jsx +909 -0
  237. package/src/views/feature-components/NotFound.jsx +66 -0
  238. package/src/views/feature-components/Onboarding/Onboarding.jsx +1400 -0
  239. package/src/views/feature-components/Skeletons.js +115 -0
  240. package/src/views/feature-components/Unauthorized.jsx +48 -0
  241. package/src/views/feature-components/VerifyRoute.jsx +88 -0
  242. package/src/views/feature-components/YearlyRecap/YearlyRecap.jsx +357 -0
  243. package/src/views/feature-components/YearlyRecap/components/RecapSlide.jsx +183 -0
  244. package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationContext.js +5 -0
  245. package/src/views/feature-components/YearlyRecap/languageTranslator/TranslationProvider.jsx +26 -0
  246. package/src/views/feature-components/YearlyRecap/languageTranslator/i18n.js +46 -0
  247. package/src/views/feature-components/YearlyRecap/languageTranslator/translations.json +167 -0
  248. package/src/views/feature-components/YearlyRecap/slides/IntroSlide.jsx +233 -0
  249. package/src/views/feature-components/YearlyRecap/slides/MaternalHealthSlide.jsx +146 -0
  250. package/src/views/feature-components/YearlyRecap/slides/MetricSlide.jsx +227 -0
  251. package/src/views/feature-components/YearlyRecap/slides/OutroSlide.jsx +701 -0
  252. package/src/views/feature-components/YearlyRecap/slides/ReachSlide.jsx +273 -0
  253. package/src/views/feature-components/login/Login.jsx +840 -0
  254. package/src/views/feature-components/login/Login.scss +154 -0
  255. package/src/views/feature-components/login/LoginConfigurator.jsx +1149 -0
  256. package/src/views/feature-components/login/TwoFactorSetupModal.jsx +411 -0
  257. package/src/views/feature-components/login/simplifyMenu.js +45 -0
  258. package/src/views/feature-components/system-config/ManageSystemConfigs.jsx +284 -0
  259. package/src/views/feature-components/system-config/SystemConfig.jsx +299 -0
  260. package/src/views/feature-components/users/ChangePasswordModal.jsx +243 -0
  261. package/src/views/feature-components/users/PasswordField.jsx +56 -0
  262. package/dist/index.css +0 -1
  263. package/dist/index.js +0 -32001
  264. package/dist/index.js.map +0 -1
@@ -0,0 +1,295 @@
1
+ import React, { useMemo } from 'react';
2
+ import { TableVirtuoso } from 'react-virtuoso';
3
+ import TableRow from '@mui/material/TableRow';
4
+ import PropTypes from 'prop-types';
5
+ import { useTranslateProvider } from '@/common/languageTranslator/TranslationContext';
6
+ import { Checkbox, useTheme, Box } from '@mui/material';
7
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
8
+ import { faArrowDownShortWide, faArrowUpWideShort } from '@fortawesome/free-solid-svg-icons';
9
+ export default function VirtualizedTableBody({
10
+ rows,
11
+ StyledTableCell,
12
+ renderCellContent,
13
+ visibleColumns,
14
+ tableHeight = 500,
15
+ rowSelectionConfig = {},
16
+ showAllBorders = false,
17
+ onTogglePin,
18
+ handleSort,
19
+ reorderedGroups = [],
20
+ colspanData = null,
21
+ }) {
22
+ const theme = useTheme();
23
+ /** Proper header rendering with wrapped text */
24
+ const {
25
+ setSelectedRows,
26
+ selectedRows = [],
27
+ rowSelectionEnabled = false,
28
+ handleSelectAllFunc,
29
+ selectAllCheckedFunc,
30
+ // selectedRowsUnique = 'id',
31
+ } = rowSelectionConfig;
32
+ /** Proper header rendering with wrapped text */
33
+ const selectAllChecked = useMemo(() => {
34
+ if (selectAllCheckedFunc) return selectAllCheckedFunc();
35
+ return selectedRows?.length === rows?.length && rows?.length > 0;
36
+ }, [selectedRows, rows]);
37
+ const handleSelectAll = () => {
38
+ if (handleSelectAllFunc) {
39
+ handleSelectAllFunc();
40
+ } else {
41
+ if (selectedRows.length === rows.length) {
42
+ setSelectedRows([]);
43
+ } else {
44
+ setSelectedRows([...rows]);
45
+ }
46
+ }
47
+ };
48
+ const { translate } = useTranslateProvider();
49
+
50
+ const fixedHeaderContent = () => (
51
+ <>
52
+ {colspanData && reorderedGroups.length > 0 && (
53
+ <TableRow>
54
+ {reorderedGroups.map((group, i) => (
55
+ <th
56
+ key={i}
57
+ colSpan={group.span}
58
+ className={group.isSticky ? 'row1-sticky-cell' : ''}
59
+ data-first-child={group.firstChild}
60
+ style={{
61
+ textAlign: 'center',
62
+ padding: '8px',
63
+ fontSize: '0.8rem',
64
+ // Horizontal sticky only – vertical stickiness is handled by <thead>
65
+ position: group.isSticky ? 'sticky' : 'static',
66
+ left: group.isSticky ? `${group.stickyLeft}px` : 'auto',
67
+ zIndex: group.isSticky ? 20 : 10,
68
+ backgroundColor: theme.palette.custom.tableHeader,
69
+ borderLeft: group.label && group.label !== '' ? '1px solid #d1d1d1' : 'none',
70
+ borderRight: (group.label && group.label !== '') || group.isLastSticky ? '1px solid #d1d1d1' : 'none',
71
+ borderBottom: '1px solid #d1d1d1',
72
+ borderTop: '1px solid #d1d1d1',
73
+ boxSizing: 'border-box',
74
+ }}
75
+ dangerouslySetInnerHTML={{ __html: group.label || '' }}
76
+ />
77
+ ))}
78
+ </TableRow>
79
+ )}
80
+ <TableRow>
81
+ {visibleColumns.map((column, index) => {
82
+ const isSticky = column.isSticky === true || column.isSticky === 'true';
83
+ const cellField = column.field || `col-${column.originalIndex}`;
84
+ if (rowSelectionEnabled && column.field === 'rowSelect') {
85
+ return (
86
+ <StyledTableCell
87
+ key={column.field || index}
88
+ padding="checkbox"
89
+ align={column.align || 'center'}
90
+ className={isSticky ? 'row2-sticky-cell' : ''}
91
+ data-field={cellField}
92
+ style={{
93
+ minWidth: column.minWidth || 60,
94
+ whiteSpace: 'normal',
95
+ wordBreak: 'break-word',
96
+ // Horizontal sticky only for pinned columns
97
+ position: isSticky ? 'sticky' : 'static',
98
+ left: isSticky ? `${column.stickyLeft}px` : 'auto',
99
+ zIndex: isSticky ? 15 : 'auto',
100
+ backgroundColor: theme.palette.custom.tableHeader,
101
+ borderLeft: showAllBorders || isSticky ? '1px solid #d1d1d1' : 'none',
102
+ borderRight: showAllBorders || isSticky ? '1px solid #d1d1d1' : 'none',
103
+ boxSizing: 'border-box',
104
+ }}
105
+ >
106
+ <Checkbox color="primary" checked={selectAllChecked} onChange={handleSelectAll} />
107
+ </StyledTableCell>
108
+ );
109
+ }
110
+
111
+ return (
112
+ !column.hide && (
113
+ <StyledTableCell
114
+ variant="head"
115
+ key={index}
116
+ align={column.align || 'center'}
117
+ className={isSticky ? 'row2-sticky-cell' : ''}
118
+ data-field={cellField}
119
+ style={{
120
+ width: column.width,
121
+ minWidth: column.minWidth,
122
+ maxWidth: 'none',
123
+ whiteSpace: 'nowrap',
124
+ overflow: 'hidden',
125
+ textOverflow: 'ellipsis',
126
+ // Horizontal sticky only for pinned columns – <thead> handles vertical
127
+ position: isSticky ? 'sticky' : 'static',
128
+ left: isSticky ? `${column.stickyLeft}px` : 'auto',
129
+ zIndex: isSticky ? 15 : 'auto',
130
+ backgroundColor: theme.palette.custom.tableHeader,
131
+ borderLeft: isSticky ? `1px solid ${theme.palette.divider}` : 'none',
132
+ borderRight: isSticky ? `1px solid ${theme.palette.divider}` : 'none',
133
+ fontSize: '0.75rem',
134
+ padding: '10px 10px',
135
+ cursor: 'pointer',
136
+ borderBottom: `1px solid ${theme.palette.divider}`,
137
+ }}
138
+ >
139
+ <div
140
+ style={{
141
+ position: 'relative',
142
+ zIndex: isSticky ? 9100 : 'inherit',
143
+ display: 'flex',
144
+ alignItems: 'center',
145
+ justifyContent: column.align || 'center',
146
+ }}
147
+ >
148
+ {/* Clicking label text pins the column */}
149
+ <span
150
+ onClick={(e) => {
151
+ e.stopPropagation();
152
+ onTogglePin(e, column.field);
153
+ }}
154
+ style={{
155
+ userSelect: 'none',
156
+ cursor: 'pointer',
157
+ fontWeight: column.isUserPinned ? 700 : 'inherit',
158
+ }}
159
+ >
160
+ {translate(column?.label)}
161
+ </span>
162
+ {/* Sort icon triggers sort */}
163
+ {column.sortable && (
164
+ <span
165
+ onClick={(e) => {
166
+ e.stopPropagation();
167
+ handleSort?.(column);
168
+ }}
169
+ style={{ marginLeft: '6px', cursor: 'pointer', display: 'flex', alignItems: 'center' }}
170
+ >
171
+ {column.sortOrder === 'asc' ? (
172
+ <FontAwesomeIcon icon={faArrowUpWideShort} size="xs" />
173
+ ) : (
174
+ <FontAwesomeIcon icon={faArrowDownShortWide} size="xs" />
175
+ )}
176
+ </span>
177
+ )}
178
+ </div>
179
+ </StyledTableCell>
180
+ )
181
+ );
182
+ })}
183
+ </TableRow>
184
+ </>
185
+ );
186
+
187
+ const itemContent = (index, row) =>
188
+ visibleColumns
189
+ .filter((col) => !col.hide)
190
+ .map((column, colIndex) => {
191
+ const isSticky = column.isSticky === true || column.isSticky === 'true';
192
+ return (
193
+ <StyledTableCell
194
+ key={colIndex}
195
+ align={column.align || 'center'}
196
+ style={{
197
+ width: column.width,
198
+ minWidth: column.minWidth,
199
+ maxWidth: 'none',
200
+ backgroundColor: theme.palette.mode === 'dark' ? theme.palette.background.paper : '#fff',
201
+ position: isSticky ? 'sticky' : 'relative',
202
+ left: isSticky ? `${column.stickyLeft}px` : 'auto',
203
+ zIndex: isSticky ? 500 : 1, // Sync with main table
204
+ borderLeft: showAllBorders || isSticky ? '1px solid #d1d1d1' : 'none',
205
+ borderRight: showAllBorders || isSticky ? '1px solid #d1d1d1' : 'none',
206
+ }}
207
+ >
208
+ {renderCellContent(column, row, index)}
209
+ </StyledTableCell>
210
+ );
211
+ });
212
+
213
+ return (
214
+ <Box
215
+ sx={{
216
+ height: tableHeight,
217
+ width: '100%',
218
+ '& .virtuoso-grid-list': {
219
+ '&::-webkit-scrollbar': {
220
+ width: '8px !important',
221
+ height: '8px !important',
222
+ },
223
+ '&::-webkit-scrollbar-track': {
224
+ backgroundColor: `${theme.palette.mode === 'dark' ? '#1e1e1e' : '#f1f1f1'} !important`,
225
+ },
226
+ '&::-webkit-scrollbar-thumb': {
227
+ backgroundColor: `${theme.palette.mode === 'dark' ? '#555' : '#ccc'} !important`,
228
+ borderRadius: '4px !important',
229
+ },
230
+ '&::-webkit-scrollbar-thumb:hover': {
231
+ backgroundColor: `${theme.palette.mode === 'dark' ? '#777' : '#999'} !important`,
232
+ },
233
+ },
234
+ // Also target the scroller div directly if it's not a grid list
235
+ '& [data-virtuoso-scroller="true"], & .data-virtuoso-scroller': {
236
+ '&::-webkit-scrollbar': {
237
+ width: '8px !important',
238
+ height: '8px !important',
239
+ },
240
+ '&::-webkit-scrollbar-track': {
241
+ backgroundColor: `${theme.palette.mode === 'dark' ? '#1e1e1e' : '#f1f1f1'} !important`,
242
+ },
243
+ '&::-webkit-scrollbar-thumb': {
244
+ backgroundColor: `${theme.palette.mode === 'dark' ? '#555' : '#ccc'} !important`,
245
+ borderRadius: '4px !important',
246
+ },
247
+ '&::-webkit-scrollbar-thumb:hover': {
248
+ backgroundColor: `${theme.palette.mode === 'dark' ? '#777' : '#999'} !important`,
249
+ },
250
+ },
251
+ scrollbarColor: theme.palette.mode === 'dark' ? '#555 #1e1e1e !important' : '#ccc #f1f1f1 !important',
252
+ scrollbarWidth: 'thin !important',
253
+ }}
254
+ >
255
+ <TableVirtuoso
256
+ style={{ height: '100%' }}
257
+ data={rows}
258
+ components={{
259
+ Table: (props) => (
260
+ <table
261
+ {...props}
262
+ style={{
263
+ ...props.style,
264
+ width: 'max-content',
265
+ minWidth: '100%',
266
+ tableLayout: 'auto',
267
+ borderCollapse: 'separate',
268
+ borderSpacing: 0,
269
+ }}
270
+ />
271
+ ),
272
+ TableHead: React.forwardRef((props, ref) => (
273
+ <thead {...props} ref={ref} style={{ ...props.style, zIndex: 1098, position: 'sticky', top: 0 }} />
274
+ )),
275
+ }}
276
+ fixedHeaderContent={fixedHeaderContent}
277
+ itemContent={itemContent}
278
+ />
279
+ </Box>
280
+ );
281
+ }
282
+
283
+ VirtualizedTableBody.propTypes = {
284
+ rows: PropTypes.any,
285
+ StyledTableCell: PropTypes.any,
286
+ renderCellContent: PropTypes.any,
287
+ visibleColumns: PropTypes.any,
288
+ tableHeight: PropTypes.any,
289
+ rowSelectionConfig: PropTypes.any,
290
+ showAllBorders: PropTypes.bool,
291
+ onTogglePin: PropTypes.func,
292
+ handleSort: PropTypes.func,
293
+ reorderedGroups: PropTypes.array,
294
+ colspanData: PropTypes.any,
295
+ };
@@ -0,0 +1,159 @@
1
+ import TableCell, { tableCellClasses } from '@mui/material/TableCell';
2
+ import TableContainer from '@mui/material/TableContainer';
3
+ import { styled } from '@mui/material/styles';
4
+ import TableRow from '@mui/material/TableRow';
5
+ import React, { useEffect, useRef, useState } from 'react';
6
+ import { Tooltip } from '@mui/material';
7
+ import PropTypes from 'prop-types';
8
+ import { useSelector } from 'react-redux';
9
+
10
+ import SafeHtml from '@/common/SafeHtml.jsx';
11
+ // Centralized default styles
12
+ export const defaultStyles = {
13
+ table: (_theme) => ({
14
+ borderRadius: '3px 3px 0 0',
15
+ '&::-webkit-scrollbar': { width: '50px' },
16
+ scrollbarWidth: 'thin',
17
+ maxHeight: 'calc(100vh - 150px)',
18
+ borderCollapse: 'separate',
19
+ borderSpacing: 0,
20
+ }),
21
+ header: (theme) => ({
22
+ border: 'none',
23
+ minWidth: '80px',
24
+ fontSize: '0.875rem',
25
+ position: 'sticky',
26
+ padding: '',
27
+ margin: 0,
28
+ top: 0,
29
+ zIndex: theme.zIndex.appBar - 2,
30
+ cursor: 'pointer',
31
+ whiteSpace: 'nowrap',
32
+ backgroundColor: theme.palette.mode === 'dark' ? theme.palette.custom?.tableHeader || '#1E293B' : '#f8f9fa',
33
+ color: theme.palette.mode === 'dark' ? '#EDF2F7 !important' : '#e5e5e5ff !important',
34
+ // color: '#909FB7 !important',
35
+ borderBottom: `1px solid ${theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.1)' : '#cececeff'}`,
36
+ '&:last-child': {
37
+ borderRight: 'none',
38
+ },
39
+ }),
40
+ cell: (theme) => ({
41
+ borderBottom: `1px solid ${theme.palette.mode === 'dark' ? 'rgba(255,255,255,0.08)' : '#ccc'}`,
42
+ padding: '5px 16px',
43
+ verticalAlign: 'top',
44
+ fontSize: '0.8125rem',
45
+ maxWidth: 400,
46
+ height: 50,
47
+ wordWrap: 'break-word',
48
+ whiteSpace: 'normal',
49
+ lineHeight: '28px',
50
+ color: theme.palette.mode === 'dark' ? '#EDF2F7 !important' : '',
51
+ }),
52
+ row: (theme, mode) => {
53
+ const hoverBg = mode !== 'dark' ? '#D7E5EA' : '#414141ff';
54
+ return {
55
+ '&:not(:first-of-type):hover td': { transform: 'scaleY(1)', transition: 'transform 0.15s' },
56
+ '&:last-child td, &:last-child th': { borderBottom: '.1px solid #ccc' },
57
+
58
+ '&:hover': {
59
+ backgroundColor: hoverBg,
60
+ },
61
+ '&:hover .sticky-cell': {
62
+ backgroundColor: `${hoverBg} !important`,
63
+ },
64
+ };
65
+ },
66
+ actionsContainer: {
67
+ display: 'flex',
68
+ gap: '10px',
69
+ },
70
+ headerTypography: {
71
+ fontSize: '0.875rem',
72
+ fontWeight: 'bold',
73
+ },
74
+ };
75
+
76
+ export const createStyledTableCell = (headerStyle = {}, cellStyle = {}) =>
77
+ styled(TableCell)(({ theme }) => ({
78
+ [`&.${tableCellClasses.head}`]: {
79
+ ...defaultStyles.header(theme),
80
+ ...(typeof headerStyle === 'function' ? headerStyle(theme) : headerStyle),
81
+ },
82
+ [`&.${tableCellClasses.body}`]: {
83
+ ...defaultStyles.cell(theme),
84
+ ...(typeof cellStyle === 'function' ? cellStyle(theme) : cellStyle),
85
+ },
86
+ }));
87
+ export const createStyledTableRow = (rowStyle = {}) =>
88
+ styled(TableRow)(({ theme }) => ({
89
+ ...defaultStyles.row(
90
+ theme,
91
+ useSelector((state) => state?.theme?.mode)
92
+ ),
93
+ ...(typeof rowStyle === 'function' ? rowStyle(theme) : rowStyle),
94
+ }));
95
+ export const createStyledTableContainer = (tableStyle = {}) => {
96
+ return styled(TableContainer)(({ theme, ...props }) => {
97
+ // Merge tableStyle from factory with potential props
98
+ const combinedStyle = {
99
+ ...(typeof tableStyle === 'function' ? tableStyle(theme) : tableStyle),
100
+ ...(typeof props.tableStyle === 'function' ? props.tableStyle(theme) : props.tableStyle),
101
+ };
102
+
103
+ let maxHeight = defaultStyles.table(theme).maxHeight;
104
+ if (combinedStyle && typeof combinedStyle === 'object' && 'maxHeight' in combinedStyle) {
105
+ if (typeof combinedStyle.maxHeight === 'number') {
106
+ maxHeight = `calc(100vh - ${150 + combinedStyle.maxHeight}px)`;
107
+ } else if (combinedStyle.maxHeight) {
108
+ maxHeight = combinedStyle.maxHeight;
109
+ }
110
+ }
111
+
112
+ return {
113
+ ...defaultStyles.table(theme),
114
+ ...combinedStyle,
115
+ maxHeight,
116
+ };
117
+ });
118
+ };
119
+
120
+ export const TooltipContent = ({ content, maxLines, isHtml, showFullContent = false }) => {
121
+ const normalizedContent = Array.isArray(content) ? content.join(', ') : content;
122
+
123
+ const contentRef = useRef(null);
124
+ const [isTruncated, setIsTruncated] = useState(false);
125
+
126
+ useEffect(() => {
127
+ if (contentRef.current) {
128
+ const { scrollHeight, clientHeight } = contentRef.current;
129
+ setIsTruncated(scrollHeight > clientHeight);
130
+ }
131
+ }, [normalizedContent]);
132
+
133
+ return (
134
+ <Tooltip
135
+ title={isHtml ? <div dangerouslySetInnerHTML={{ __html: normalizedContent }} /> : normalizedContent}
136
+ disableHoverListener={!isTruncated}
137
+ arrow
138
+ >
139
+ <div
140
+ ref={contentRef}
141
+ style={{
142
+ display: '-webkit-box',
143
+ WebkitBoxOrient: 'vertical',
144
+ WebkitLineClamp: showFullContent ? 0 : maxLines,
145
+ overflow: 'hidden',
146
+ lineHeight: '1.5',
147
+ }}
148
+ >
149
+ {isHtml ? <div dangerouslySetInnerHTML={{ __html: normalizedContent }} /> : <span>{normalizedContent}</span>}
150
+ </div>
151
+ </Tooltip>
152
+ );
153
+ };
154
+
155
+ TooltipContent.propTypes = {
156
+ isHtml: PropTypes.any,
157
+ content: PropTypes.any,
158
+ maxLines: PropTypes.any,
159
+ };