@gen-epix/ui-client-casedb 4.0.0 → 4.0.2

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 (393) hide show
  1. package/dist/@types/mui.d.ts +1 -1
  2. package/dist/@types/{ui-casedb.d.ts → ui-client-casedb.d.ts} +1 -1
  3. package/dist/_chunks/AddCasesToEventDialog.js +74 -74
  4. package/dist/_chunks/AddCasesToEventDialog.js.map +1 -1
  5. package/dist/_chunks/CaseContentForm.js +2 -2
  6. package/dist/_chunks/CaseContentForm.js.map +1 -1
  7. package/dist/_chunks/CaseDbDownloadUtil.js +40 -35
  8. package/dist/_chunks/CaseDbDownloadUtil.js.map +1 -1
  9. package/dist/_chunks/CaseInfoDialog.js +195 -195
  10. package/dist/_chunks/CaseInfoDialog.js.map +1 -1
  11. package/dist/_chunks/CaseSetInfoDialog.js +131 -131
  12. package/dist/_chunks/CaseSetInfoDialog.js.map +1 -1
  13. package/dist/_chunks/CaseTypeInfoDialog.js +63 -61
  14. package/dist/_chunks/CaseTypeInfoDialog.js.map +1 -1
  15. package/dist/_chunks/CasesAlreadyInCaseSetWarning.js +6 -6
  16. package/dist/_chunks/CasesAlreadyInCaseSetWarning.js.map +1 -1
  17. package/dist/_chunks/CompletCaseTypeLoader.js +3 -3
  18. package/dist/_chunks/CompletCaseTypeLoader.js.map +1 -1
  19. package/dist/_chunks/CreateEventDialogSuccessNotificationMessage.js +1 -1
  20. package/dist/_chunks/CreateEventDialogSuccessNotificationMessage.js.map +1 -1
  21. package/dist/_chunks/CustomTabPanel.js.map +1 -1
  22. package/dist/_chunks/Dashboard.js +399 -386
  23. package/dist/_chunks/Dashboard.js.map +1 -1
  24. package/dist/_chunks/DashboardStoreLoader.js +5 -5
  25. package/dist/_chunks/DashboardStoreLoader.js.map +1 -1
  26. package/dist/_chunks/DataCollectionAccessInfo.js +21 -21
  27. package/dist/_chunks/DataCollectionAccessInfo.js.map +1 -1
  28. package/dist/_chunks/EpiCurveUtil.js +4 -4
  29. package/dist/_chunks/EpiCurveUtil.js.map +1 -1
  30. package/dist/_chunks/EpiCurveWidget.js +189 -183
  31. package/dist/_chunks/EpiCurveWidget.js.map +1 -1
  32. package/dist/_chunks/FilterUtil.js +103 -101
  33. package/dist/_chunks/FilterUtil.js.map +1 -1
  34. package/dist/_chunks/FindSimilarCasesDialog.js +16 -16
  35. package/dist/_chunks/FindSimilarCasesDialog.js.map +1 -1
  36. package/dist/_chunks/FindSimilarCasesUtil.js +9 -9
  37. package/dist/_chunks/FindSimilarCasesUtil.js.map +1 -1
  38. package/dist/_chunks/HomePageTrends.js +8 -8
  39. package/dist/_chunks/HomePageTrends.js.map +1 -1
  40. package/dist/_chunks/LegendaItem.js +3 -3
  41. package/dist/_chunks/LegendaItem.js.map +1 -1
  42. package/dist/_chunks/LineListWidget.js +23 -21
  43. package/dist/_chunks/LineListWidget.js.map +1 -1
  44. package/dist/_chunks/PanelSeparator.js +374 -384
  45. package/dist/_chunks/PanelSeparator.js.map +1 -1
  46. package/dist/_chunks/Upload.js +222 -207
  47. package/dist/_chunks/Upload.js.map +1 -1
  48. package/dist/_chunks/UploadUtil.js +1970 -841
  49. package/dist/_chunks/UploadUtil.js.map +1 -1
  50. package/dist/_chunks/UserRightsDialog.js +12 -12
  51. package/dist/_chunks/UserRightsDialog.js.map +1 -1
  52. package/dist/_chunks/_MapCache.js +2 -2
  53. package/dist/_chunks/_baseGet.js +1 -1
  54. package/dist/_chunks/_baseGet.js.map +1 -1
  55. package/dist/_chunks/_baseIteratee.js +1 -1
  56. package/dist/_chunks/_baseIteratee.js.map +1 -1
  57. package/dist/_chunks/_setToString.js.map +1 -1
  58. package/dist/_chunks/{chunk-KS7C4IRE.js → chunk-BV7QT456.js} +330 -495
  59. package/dist/_chunks/chunk-BV7QT456.js.map +1 -0
  60. package/dist/_chunks/cloneDeep.js +11 -9
  61. package/dist/_chunks/cloneDeep.js.map +1 -1
  62. package/dist/_chunks/dashboardStore.js +259 -261
  63. package/dist/_chunks/dashboardStore.js.map +1 -1
  64. package/dist/_chunks/esm.js +2900 -2868
  65. package/dist/_chunks/esm.js.map +1 -1
  66. package/dist/_chunks/format.js +8 -8
  67. package/dist/_chunks/format.js.map +1 -1
  68. package/dist/_chunks/index.esm.js +919 -796
  69. package/dist/_chunks/index.esm.js.map +1 -1
  70. package/dist/_chunks/index.module.js +1 -1
  71. package/dist/_chunks/index.module.js.map +1 -1
  72. package/dist/_chunks/protectedTokens.js +79 -81
  73. package/dist/_chunks/protectedTokens.js.map +1 -1
  74. package/dist/_chunks/react.js +1 -1
  75. package/dist/_chunks/react.js.map +1 -1
  76. package/dist/_chunks/round.js +1 -1
  77. package/dist/_chunks/round.js.map +1 -1
  78. package/dist/_chunks/shallow.js +2 -2
  79. package/dist/_chunks/shallow.js.map +1 -1
  80. package/dist/_chunks/sync.js +198 -161
  81. package/dist/_chunks/sync.js.map +1 -1
  82. package/dist/_chunks/toDate.js +1 -1
  83. package/dist/_chunks/toDate.js.map +1 -1
  84. package/dist/_chunks/toString.js +1 -1
  85. package/dist/_chunks/toString.js.map +1 -1
  86. package/dist/_chunks/useUnit.js.map +1 -1
  87. package/dist/_chunks/vanilla.js +1 -1
  88. package/dist/_chunks/vanilla.js.map +1 -1
  89. package/dist/_chunks/yup.js +5 -5
  90. package/dist/_chunks/yup.js.map +1 -1
  91. package/dist/classes/filters/SelectionFilter.d.ts +2 -2
  92. package/dist/classes/filters/TreeFilter.d.ts +2 -2
  93. package/dist/classes/services/DataService/index.js +3 -3
  94. package/dist/classes/services/DataService/index.js.map +1 -1
  95. package/dist/classes/services/EventBusService/EventBusService.d.ts +1 -1
  96. package/dist/classes/services/EventBusService/index.js.map +1 -1
  97. package/dist/classes/services/LineListService/LineListServiceAbstract/index.js +1 -1
  98. package/dist/classes/services/LineListService/LineListServiceAbstract/index.js.map +1 -1
  99. package/dist/components/app/CaseDbApp/index.js +8 -5
  100. package/dist/components/app/CaseDbApp/index.js.map +1 -1
  101. package/dist/components/form/fields/ArrangementEditor/index.js +83 -83
  102. package/dist/components/form/fields/ArrangementEditor/index.js.map +1 -1
  103. package/dist/components/ui/AddCasesToEventDialog/AddCasesToEventDialog.d.ts +2 -2
  104. package/dist/components/ui/CaseContentFormDialog/CaseContentFormDialog.d.ts +2 -2
  105. package/dist/components/ui/CaseContentFormDialog/index.js +1 -1
  106. package/dist/components/ui/CaseContentFormDialog/index.js.map +1 -1
  107. package/dist/components/ui/CaseInfoDialog/CaseInfoDialog.d.ts +2 -2
  108. package/dist/components/ui/CaseSetInfoDialog/CaseSetInfoDialog.d.ts +2 -2
  109. package/dist/components/ui/CaseSummary/index.js +1 -1
  110. package/dist/components/ui/CaseSummary/index.js.map +1 -1
  111. package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoDialog.d.ts +2 -2
  112. package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoDialogContent.d.ts +1 -1
  113. package/dist/components/ui/CaseTypeInfoDialog/CaseTypeInfoDialogWithLoader.d.ts +2 -2
  114. package/dist/components/ui/ContextMenu/index.js.map +1 -1
  115. package/dist/components/ui/CreateEventDialog/CreateEventDialog.d.ts +2 -2
  116. package/dist/components/ui/CreateEventDialog/index.js +9 -9
  117. package/dist/components/ui/CreateEventDialog/index.js.map +1 -1
  118. package/dist/components/ui/Dashboard/DashboardDownloadSidebarItem.d.ts +1 -1
  119. package/dist/components/ui/Dashboard/DashboardSettingsSidebarItem.d.ts +1 -1
  120. package/dist/components/ui/Dashboard/DashboardWidget.d.ts +1 -1
  121. package/dist/components/ui/DashboardEditCases/index.js +1 -1
  122. package/dist/components/ui/DashboardEditCases/index.js.map +1 -1
  123. package/dist/components/ui/FileSelector/index.js +46 -46
  124. package/dist/components/ui/FileSelector/index.js.map +1 -1
  125. package/dist/components/ui/FindSimilarCasesDialog/FindSimilarCasesDialog.d.ts +2 -2
  126. package/dist/components/ui/Grouping/index.js +50 -50
  127. package/dist/components/ui/Grouping/index.js.map +1 -1
  128. package/dist/components/ui/HistogramWidget/index.js +1 -1
  129. package/dist/components/ui/HistogramWidget/index.js.map +1 -1
  130. package/dist/components/ui/MapWidget/index.js +7 -3
  131. package/dist/components/ui/MapWidget/index.js.map +1 -1
  132. package/dist/components/ui/RemoveCasesFromEventDialog/RemoveCasesFromEventDialog.d.ts +2 -2
  133. package/dist/components/ui/RemoveCasesFromEventDialog/index.js +6 -6
  134. package/dist/components/ui/RemoveCasesFromEventDialog/index.js.map +1 -1
  135. package/dist/components/ui/RemoveFindSimilarCasesResultDialog/RemoveFindSimilarCasesResultDialog.d.ts +2 -2
  136. package/dist/components/ui/SequenceDownloadDialog/SequenceDownloadDialog.d.ts +2 -2
  137. package/dist/components/ui/SequenceDownloadDialog/index.js +22 -22
  138. package/dist/components/ui/SequenceDownloadDialog/index.js.map +1 -1
  139. package/dist/components/ui/TreeDescription/index.js.map +1 -1
  140. package/dist/components/ui/TreeWidget/index.js +11 -11
  141. package/dist/components/ui/TreeWidget/index.js.map +1 -1
  142. package/dist/components/ui/Upload/UploadCaseResultTable.d.ts +2 -2
  143. package/dist/components/ui/Upload/UploadEditColumnValuesDialog.d.ts +2 -2
  144. package/dist/components/ui/UserRightsDialog/UserRightsDialog.d.ts +2 -2
  145. package/dist/components/ui/UsersEffectiveRightsDetailsDialog/UsersEffectiveRightsDetailsDialog.d.ts +2 -2
  146. package/dist/components/ui/UsersEffectiveRightsDetailsDialog/index.js +25 -11
  147. package/dist/components/ui/UsersEffectiveRightsDetailsDialog/index.js.map +1 -1
  148. package/dist/components/ui/Warning/index.js.map +1 -1
  149. package/dist/components/ui/WidgetHeaderIconButton/index.js.map +1 -1
  150. package/dist/components/ui/WidgetMenu/WidgetMenu.d.ts +1 -1
  151. package/dist/components/ui/WidgetMenu/index.js +2 -2
  152. package/dist/components/ui/WidgetMenu/index.js.map +1 -1
  153. package/dist/components/ui/WidgetUnavailable/index.js.map +1 -1
  154. package/dist/constants/query.d.ts +1 -1
  155. package/dist/constants/query.js +1 -1
  156. package/dist/constants/query.js.map +1 -1
  157. package/dist/context/caseAbac/CaseAbacContext.d.ts +1 -1
  158. package/dist/dataHooks/useAssemblyProtocolsQuery/index.js +3 -3
  159. package/dist/dataHooks/useAssemblyProtocolsQuery/index.js.map +1 -1
  160. package/dist/dataHooks/useAssemblyProtocolsQuery/useAssemblyProtocolsQuery.d.ts +1 -1
  161. package/dist/dataHooks/useCaseRightsQuery/index.js +2 -2
  162. package/dist/dataHooks/useCaseRightsQuery/index.js.map +1 -1
  163. package/dist/dataHooks/useCaseSetCategoriesQuery/index.js +3 -3
  164. package/dist/dataHooks/useCaseSetCategoriesQuery/index.js.map +1 -1
  165. package/dist/dataHooks/useCaseSetCategoriesQuery/useCaseSetCategoriesQuery.d.ts +1 -1
  166. package/dist/dataHooks/useCaseSetRightsQuery/index.js +2 -2
  167. package/dist/dataHooks/useCaseSetRightsQuery/index.js.map +1 -1
  168. package/dist/dataHooks/useCaseSetStatsQuery/index.js +3 -3
  169. package/dist/dataHooks/useCaseSetStatsQuery/index.js.map +1 -1
  170. package/dist/dataHooks/useCaseSetStatsQuery/useCaseSetStatsQuery.d.ts +1 -1
  171. package/dist/dataHooks/useCaseSetStatusesQuery/index.js +3 -3
  172. package/dist/dataHooks/useCaseSetStatusesQuery/index.js.map +1 -1
  173. package/dist/dataHooks/useCaseSetStatusesQuery/useCaseSetStatusesQuery.d.ts +1 -1
  174. package/dist/dataHooks/useCaseSetsQuery/index.js +3 -3
  175. package/dist/dataHooks/useCaseSetsQuery/index.js.map +1 -1
  176. package/dist/dataHooks/useCaseSetsQuery/useCaseSetsQuery.d.ts +1 -1
  177. package/dist/dataHooks/useCaseTypeSetCategoriesQuery/index.js +3 -3
  178. package/dist/dataHooks/useCaseTypeSetCategoriesQuery/index.js.map +1 -1
  179. package/dist/dataHooks/useCaseTypeSetCategoriesQuery/useCaseTypeSetCategoriesQuery.d.ts +1 -1
  180. package/dist/dataHooks/useCaseTypeSetCategoryPurposeQuery/index.js.map +1 -1
  181. package/dist/dataHooks/useCaseTypeSetCategoryPurposeQuery/useCaseTypeSetCategoryPurposeQuery.d.ts +1 -1
  182. package/dist/dataHooks/useCaseTypeSetMembersQuery/index.js +2 -2
  183. package/dist/dataHooks/useCaseTypeSetMembersQuery/index.js.map +1 -1
  184. package/dist/dataHooks/useCaseTypeSetsQuery/index.js +3 -3
  185. package/dist/dataHooks/useCaseTypeSetsQuery/index.js.map +1 -1
  186. package/dist/dataHooks/useCaseTypeSetsQuery/useCaseTypeSetsQuery.d.ts +1 -1
  187. package/dist/dataHooks/useCaseTypeStatsQuery/index.js +2 -2
  188. package/dist/dataHooks/useCaseTypeStatsQuery/index.js.map +1 -1
  189. package/dist/dataHooks/useCaseTypesQuery/index.js +3 -3
  190. package/dist/dataHooks/useCaseTypesQuery/index.js.map +1 -1
  191. package/dist/dataHooks/useCaseTypesQuery/useCaseTypesQuery.d.ts +1 -1
  192. package/dist/dataHooks/useColSetMembersQuery/index.js +2 -2
  193. package/dist/dataHooks/useColSetMembersQuery/index.js.map +1 -1
  194. package/dist/dataHooks/useColSetsQuery/index.js +3 -3
  195. package/dist/dataHooks/useColSetsQuery/index.js.map +1 -1
  196. package/dist/dataHooks/useColSetsQuery/useColSetsQuery.d.ts +1 -1
  197. package/dist/dataHooks/useColTypesQuery/index.js.map +1 -1
  198. package/dist/dataHooks/useColTypesQuery/useColTypesQuery.d.ts +1 -1
  199. package/dist/dataHooks/useColsQuery/index.js +3 -3
  200. package/dist/dataHooks/useColsQuery/index.js.map +1 -1
  201. package/dist/dataHooks/useColsQuery/useColsQuery.d.ts +1 -1
  202. package/dist/dataHooks/useConceptQuery/index.js +3 -3
  203. package/dist/dataHooks/useConceptQuery/index.js.map +1 -1
  204. package/dist/dataHooks/useConceptQuery/useConceptQuery.d.ts +1 -1
  205. package/dist/dataHooks/useConceptRelationTypeQuery/index.js.map +1 -1
  206. package/dist/dataHooks/useConceptRelationTypeQuery/useConceptRelationTypeQuery.d.ts +1 -1
  207. package/dist/dataHooks/useConceptSetTypeQuery/index.js.map +1 -1
  208. package/dist/dataHooks/useConceptSetTypeQuery/useConceptSetTypeQuery.d.ts +1 -1
  209. package/dist/dataHooks/useConceptSetsQuery/index.js +3 -3
  210. package/dist/dataHooks/useConceptSetsQuery/index.js.map +1 -1
  211. package/dist/dataHooks/useConceptSetsQuery/useConceptSetsQuery.d.ts +1 -1
  212. package/dist/dataHooks/useDataCollectionSetMembersQuery/index.js +2 -2
  213. package/dist/dataHooks/useDataCollectionSetMembersQuery/index.js.map +1 -1
  214. package/dist/dataHooks/useDataCollectionsQuery/index.js +3 -3
  215. package/dist/dataHooks/useDataCollectionsQuery/index.js.map +1 -1
  216. package/dist/dataHooks/useDataCollectionsQuery/useDataCollectionsQuery.d.ts +1 -1
  217. package/dist/dataHooks/useDimTypesQuery/index.js.map +1 -1
  218. package/dist/dataHooks/useDimTypesQuery/useDimTypesQuery.d.ts +1 -1
  219. package/dist/dataHooks/useDimsQuery/index.js +3 -3
  220. package/dist/dataHooks/useDimsQuery/index.js.map +1 -1
  221. package/dist/dataHooks/useDimsQuery/useDimsQuery.d.ts +1 -1
  222. package/dist/dataHooks/useDiseasesQuery/index.js +3 -3
  223. package/dist/dataHooks/useDiseasesQuery/index.js.map +1 -1
  224. package/dist/dataHooks/useDiseasesQuery/useDiseasesQuery.d.ts +1 -1
  225. package/dist/dataHooks/useEtiologicalAgentsQuery/index.js +3 -3
  226. package/dist/dataHooks/useEtiologicalAgentsQuery/index.js.map +1 -1
  227. package/dist/dataHooks/useEtiologicalAgentsQuery/useEtiologicalAgentsQuery.d.ts +1 -1
  228. package/dist/dataHooks/useGeneticDistanceProtocolsQuery/index.js +3 -3
  229. package/dist/dataHooks/useGeneticDistanceProtocolsQuery/index.js.map +1 -1
  230. package/dist/dataHooks/useGeneticDistanceProtocolsQuery/useGeneticDistanceProtocolsQuery.d.ts +1 -1
  231. package/dist/dataHooks/useOrganizationAccessCasePoliciesQuery/index.js +2 -2
  232. package/dist/dataHooks/useOrganizationAccessCasePoliciesQuery/index.js.map +1 -1
  233. package/dist/dataHooks/useOrganizationShareCasePoliciesQuery/index.js +2 -2
  234. package/dist/dataHooks/useOrganizationShareCasePoliciesQuery/index.js.map +1 -1
  235. package/dist/dataHooks/useRefColsQuery/index.js +3 -3
  236. package/dist/dataHooks/useRefColsQuery/index.js.map +1 -1
  237. package/dist/dataHooks/useRefColsQuery/useRefColsQuery.d.ts +1 -1
  238. package/dist/dataHooks/useRefColsValidationRulesQuery/index.js +2 -2
  239. package/dist/dataHooks/useRefColsValidationRulesQuery/index.js.map +1 -1
  240. package/dist/dataHooks/useRefDimsQuery/index.js +3 -3
  241. package/dist/dataHooks/useRefDimsQuery/index.js.map +1 -1
  242. package/dist/dataHooks/useRefDimsQuery/useRefDimsQuery.d.ts +1 -1
  243. package/dist/dataHooks/useRegionQuery/index.js +3 -3
  244. package/dist/dataHooks/useRegionQuery/index.js.map +1 -1
  245. package/dist/dataHooks/useRegionQuery/useRegionQuery.d.ts +1 -1
  246. package/dist/dataHooks/useRegionRelationTypeQuery/index.js.map +1 -1
  247. package/dist/dataHooks/useRegionRelationTypeQuery/useRegionRelationTypeQuery.d.ts +1 -1
  248. package/dist/dataHooks/useRegionSetsQuery/index.js +3 -3
  249. package/dist/dataHooks/useRegionSetsQuery/index.js.map +1 -1
  250. package/dist/dataHooks/useRegionSetsQuery/useRegionSetsQuery.d.ts +1 -1
  251. package/dist/dataHooks/useSequencingProtocolsQuery/index.js +3 -3
  252. package/dist/dataHooks/useSequencingProtocolsQuery/index.js.map +1 -1
  253. package/dist/dataHooks/useSequencingProtocolsQuery/useSequencingProtocolsQuery.d.ts +1 -1
  254. package/dist/dataHooks/useTreeAlgorithmCodesQuery/index.js.map +1 -1
  255. package/dist/dataHooks/useTreeAlgorithmCodesQuery/useTreeAlgorithmCodesQuery.d.ts +1 -1
  256. package/dist/dataHooks/useUnitQuery/useUnit.d.ts +1 -1
  257. package/dist/dataHooks/useUserAccessCasePoliciesQuery/index.js +2 -2
  258. package/dist/dataHooks/useUserAccessCasePoliciesQuery/index.js.map +1 -1
  259. package/dist/dataHooks/useUserEffectiveRightsQuery/index.js +3 -3
  260. package/dist/dataHooks/useUserEffectiveRightsQuery/index.js.map +1 -1
  261. package/dist/dataHooks/useUserEffectiveRightsQuery/useUserEffectiveRightsQuery.d.ts +1 -1
  262. package/dist/dataHooks/useUserShareCasePoliciesQuery/index.js +2 -2
  263. package/dist/dataHooks/useUserShareCasePoliciesQuery/index.js.map +1 -1
  264. package/dist/hooks/useOrganizationCasePolicyNameFactory/index.js +2 -2
  265. package/dist/hooks/useOrganizationCasePolicyNameFactory/index.js.map +1 -1
  266. package/dist/hooks/useOrganizationCasePolicyNameFactory/useOrganizationCasePolicyNameFactory.d.ts +1 -1
  267. package/dist/hooks/useUserCasePolicyNameFactory/index.js +3 -3
  268. package/dist/hooks/useUserCasePolicyNameFactory/index.js.map +1 -1
  269. package/dist/hooks/useUserCasePolicyNameFactory/useUserCasePolicyNameFactory.d.ts +1 -1
  270. package/dist/locale/nl.json +1 -1
  271. package/dist/models/config.d.ts +1 -1
  272. package/dist/models/dashboard.d.ts +1 -1
  273. package/dist/models/dashboard.js.map +1 -1
  274. package/dist/models/theme.d.ts +2 -2
  275. package/dist/pages/CaseDbUsersAdminPage/index.js +5 -5
  276. package/dist/pages/CaseDbUsersAdminPage/index.js.map +1 -1
  277. package/dist/pages/CaseSetCategoryAdminPage/index.js +4 -4
  278. package/dist/pages/CaseSetCategoryAdminPage/index.js.map +1 -1
  279. package/dist/pages/CaseSetStatusAdminPage/index.js +4 -4
  280. package/dist/pages/CaseSetStatusAdminPage/index.js.map +1 -1
  281. package/dist/pages/CaseTypeSetCategoriesAdminPage/index.js +4 -4
  282. package/dist/pages/CaseTypeSetCategoriesAdminPage/index.js.map +1 -1
  283. package/dist/pages/CaseTypeSetsAdminPage/index.js +6 -6
  284. package/dist/pages/CaseTypeSetsAdminPage/index.js.map +1 -1
  285. package/dist/pages/CaseTypesAdminPage/index.js +5 -5
  286. package/dist/pages/CaseTypesAdminPage/index.js.map +1 -1
  287. package/dist/pages/CasesDetailPage/index.js +5 -5
  288. package/dist/pages/CasesDetailPage/index.js.map +1 -1
  289. package/dist/pages/CasesPage/index.js +10 -10
  290. package/dist/pages/CasesPage/index.js.map +1 -1
  291. package/dist/pages/ColSetsAdminPage/index.js +6 -6
  292. package/dist/pages/ColSetsAdminPage/index.js.map +1 -1
  293. package/dist/pages/ColsAdminPage/index.js +5 -5
  294. package/dist/pages/ColsAdminPage/index.js.map +1 -1
  295. package/dist/pages/ConceptRelationsAdminPage/index.js +19 -19
  296. package/dist/pages/ConceptRelationsAdminPage/index.js.map +1 -1
  297. package/dist/pages/ConceptSetsAdminPage/index.js +5 -5
  298. package/dist/pages/ConceptSetsAdminPage/index.js.map +1 -1
  299. package/dist/pages/ConceptsAdminPage/index.js +5 -5
  300. package/dist/pages/ConceptsAdminPage/index.js.map +1 -1
  301. package/dist/pages/DataCollectionSetsAdminPage/index.js +12 -12
  302. package/dist/pages/DataCollectionSetsAdminPage/index.js.map +1 -1
  303. package/dist/pages/DataCollectionVisualizationPage/index.js +4 -4
  304. package/dist/pages/DataCollectionVisualizationPage/index.js.map +1 -1
  305. package/dist/pages/DataCollectionsAdminPage/index.js +4 -4
  306. package/dist/pages/DataCollectionsAdminPage/index.js.map +1 -1
  307. package/dist/pages/DimsAdminPage/index.js +6 -6
  308. package/dist/pages/DimsAdminPage/index.js.map +1 -1
  309. package/dist/pages/DiseasesAdminPage/index.js +4 -4
  310. package/dist/pages/DiseasesAdminPage/index.js.map +1 -1
  311. package/dist/pages/EtiologicalAgentsAdminPage/index.js +4 -4
  312. package/dist/pages/EtiologicalAgentsAdminPage/index.js.map +1 -1
  313. package/dist/pages/EtiologiesAdminPage/index.js +3 -3
  314. package/dist/pages/EtiologiesAdminPage/index.js.map +1 -1
  315. package/dist/pages/EventsDetailPage/index.js +5 -5
  316. package/dist/pages/EventsDetailPage/index.js.map +1 -1
  317. package/dist/pages/EventsPage/index.js +11 -11
  318. package/dist/pages/EventsPage/index.js.map +1 -1
  319. package/dist/pages/HomePage/index.js +2 -2
  320. package/dist/pages/HomePage/index.js.map +1 -1
  321. package/dist/pages/OrganizationAccessCasePoliciesAdminPage/index.js +4 -4
  322. package/dist/pages/OrganizationAccessCasePoliciesAdminPage/index.js.map +1 -1
  323. package/dist/pages/OrganizationShareCasePoliciesAdminPage/index.js +4 -4
  324. package/dist/pages/OrganizationShareCasePoliciesAdminPage/index.js.map +1 -1
  325. package/dist/pages/RefColsAdminPage/index.js +7 -7
  326. package/dist/pages/RefColsAdminPage/index.js.map +1 -1
  327. package/dist/pages/RefDimsAdminPage/index.js +5 -5
  328. package/dist/pages/RefDimsAdminPage/index.js.map +1 -1
  329. package/dist/pages/RegionRelationsAdminPage/index.js +3 -3
  330. package/dist/pages/RegionRelationsAdminPage/index.js.map +1 -1
  331. package/dist/pages/RegionSetShapesAdminPage/index.js +4 -4
  332. package/dist/pages/RegionSetShapesAdminPage/index.js.map +1 -1
  333. package/dist/pages/RegionSetsAdminPage/index.js +5 -5
  334. package/dist/pages/RegionSetsAdminPage/index.js.map +1 -1
  335. package/dist/pages/RegionsAdminPage/index.js +5 -5
  336. package/dist/pages/RegionsAdminPage/index.js.map +1 -1
  337. package/dist/pages/TrendsPage/index.js +1 -1
  338. package/dist/pages/TrendsPage/index.js.map +1 -1
  339. package/dist/pages/UploadPage/index.js +1 -1
  340. package/dist/pages/UploadPage/index.js.map +1 -1
  341. package/dist/pages/UserAccessCasePoliciesAdminPage/index.js +4 -4
  342. package/dist/pages/UserAccessCasePoliciesAdminPage/index.js.map +1 -1
  343. package/dist/pages/UserEffectiveRightsAdminPage/index.js +12 -12
  344. package/dist/pages/UserEffectiveRightsAdminPage/index.js.map +1 -1
  345. package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js +8 -8
  346. package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js.map +1 -1
  347. package/dist/pages/UserShareCasePoliciesAdminPage/index.js +4 -4
  348. package/dist/pages/UserShareCasePoliciesAdminPage/index.js.map +1 -1
  349. package/dist/routes/adminRoutes.d.ts +1 -1
  350. package/dist/routes/index.js +11 -8
  351. package/dist/routes/index.js.map +1 -1
  352. package/dist/routes/routes.d.ts +1 -1
  353. package/dist/setup/setup.js +5 -5
  354. package/dist/setup/setup.js.map +1 -1
  355. package/dist/stores/dashboardStore/dashboardStore.d.ts +1 -1
  356. package/dist/stores/uploadStore/index.js +2 -2
  357. package/dist/stores/uploadStore/index.js.map +1 -1
  358. package/dist/stores/uploadStore/uploadStore.d.ts +1 -1
  359. package/dist/stores/userProfileStore/index.js +2 -2
  360. package/dist/stores/userProfileStore/index.js.map +1 -1
  361. package/dist/theme/demoTheme/index.js +2 -2
  362. package/dist/theme/demoTheme/index.js.map +1 -1
  363. package/dist/utils/CaseDbDataUtil/CaseDbDataUtil.d.ts +1 -1
  364. package/dist/utils/CaseDbDataUtil/index.js +1 -1
  365. package/dist/utils/CaseDbDataUtil/index.js.map +1 -1
  366. package/dist/utils/CaseDbStandardConfigUtil/index.js +2488 -1408
  367. package/dist/utils/CaseDbStandardConfigUtil/index.js.map +1 -1
  368. package/dist/utils/CaseDbTableUtil/CaseDbTableUtil.d.ts +1 -1
  369. package/dist/utils/CaseDbTableUtil/index.js +1 -1
  370. package/dist/utils/CaseDbTableUtil/index.js.map +1 -1
  371. package/dist/utils/CaseSelectionUtil/index.js.map +1 -1
  372. package/dist/utils/CaseTypeFormUtil/CaseTypeFormUtil.d.ts +1 -1
  373. package/dist/utils/CaseTypeFormUtil/index.js +7 -10
  374. package/dist/utils/CaseTypeFormUtil/index.js.map +1 -1
  375. package/dist/utils/CaseTypeUtil/index.js +1 -1
  376. package/dist/utils/CaseTypeUtil/index.js.map +1 -1
  377. package/dist/utils/CaseUtil/index.js +3 -3
  378. package/dist/utils/CaseUtil/index.js.map +1 -1
  379. package/dist/utils/DashboardUtil/index.js +1 -1
  380. package/dist/utils/DashboardUtil/index.js.map +1 -1
  381. package/dist/utils/DataSetUtil/index.js.map +1 -1
  382. package/dist/utils/FileUtil/index.js +1 -1
  383. package/dist/utils/FileUtil/index.js.map +1 -1
  384. package/dist/utils/FilterUtil/FilterUtil.d.ts +2 -2
  385. package/dist/utils/HistogramUtil/index.js +1 -1
  386. package/dist/utils/HistogramUtil/index.js.map +1 -1
  387. package/dist/utils/MapUtil/index.js +1 -1
  388. package/dist/utils/MapUtil/index.js.map +1 -1
  389. package/dist/utils/StratificationUtil/index.js +3 -2
  390. package/dist/utils/StratificationUtil/index.js.map +1 -1
  391. package/dist/utils/UploadUtil/UploadUtil.d.ts +1 -1
  392. package/package.json +19 -11
  393. package/dist/_chunks/chunk-KS7C4IRE.js.map +0 -1
@@ -10,39 +10,39 @@ import y from "@mui/icons-material/InsertDriveFile";
10
10
  import b from "@mui/icons-material/CloudUpload";
11
11
  //#region src/components/ui/FileSelector/FileSelector.tsx
12
12
  var x = ({ accept: x, initialDataTransfer: S, numFilesAllowed: C = 1, onDataTransferChange: w }) => {
13
- let { t: T } = m(), E = T(C === 1 ? "Click or drag to upload file ({{accept}})" : "Click or drag to upload files ({{accept}})", { accept: x.split(",").join(", ") }), D = C === 1 ? T`Drop file here` : T`Drop files here`, O = u(), k = f(null), [A, j] = p(d(() => S ?? new DataTransfer(), [S])), [M, N] = p(E), [P, F] = p(null), [I, L] = p(!1), R = f(!0);
13
+ let { t: T } = m(), E = T(C === 1 ? "Click or drag to upload file ({{accept}})" : "Click or drag to upload files ({{accept}})", { accept: x.split(",").join(", ") }), D = C === 1 ? T`Drop file here` : T`Drop files here`, O = u(), k = f(null), A = d(() => S ?? new DataTransfer(), [S]), [j, M] = p(A), [N, P] = p(E), [F, I] = p(null), [L, R] = p(!1), z = f(!0);
14
14
  l(() => {
15
- if (R.current) {
16
- R.current = !1;
15
+ if (z.current) {
16
+ z.current = !1;
17
17
  return;
18
18
  }
19
- w(A);
20
- }, [A, w]);
21
- let z = c((e) => {
19
+ w(j);
20
+ }, [j, w]);
21
+ let B = c((e) => {
22
22
  e.stopPropagation(), e.preventDefault();
23
- }, []), B = c((e) => {
24
- F(null), z(e), L(!0), N(D);
25
- }, [z, D]), V = c((e) => {
26
- z(e), L(!1), N(E);
27
- }, [z, E]), H = c((e) => {
28
- z(e);
29
- }, [z]), U = c((e) => {
23
+ }, []), V = c((e) => {
24
+ I(null), B(e), R(!0), P(D);
25
+ }, [B, D]), H = c((e) => {
26
+ B(e), R(!1), P(E);
27
+ }, [B, E]), U = c((e) => {
28
+ B(e);
29
+ }, [B]), W = c((e) => {
30
30
  for (let t of e) if (!x.split(",").some((e) => {
31
31
  let n = e.trim();
32
32
  return n === t.type || n.startsWith(".") && t.name.endsWith(n);
33
33
  })) return !1;
34
34
  return !0;
35
- }, [x]), W = c((e) => {
36
- F(null), j((t) => {
35
+ }, [x]), G = c((e) => {
36
+ I(null), M((t) => {
37
37
  let n = new DataTransfer();
38
38
  return Array.from(t.files).filter((t) => t.name !== e).forEach((e) => n.items.add(e)), n;
39
39
  });
40
- }, []), G = c((e) => {
41
- F(null), j((t) => {
40
+ }, []), K = c((e) => {
41
+ I(null), M((t) => {
42
42
  if (!e || e.length === 0) return t;
43
- if (!U(e)) return F(T("Invalid file type. Accepted types: {{accept}}", { accept: x })), t;
43
+ if (!W(e)) return I(T("Invalid file type. Accepted types: {{accept}}", { accept: x })), t;
44
44
  let n = Array.from(e).map((e) => e.name), r = new Set(Array.from(t.files).map((e) => e.name)), i = n.filter((e) => r.has(e)).length;
45
- if (r.size + (n.length - i) > C) return F(T("Too many files selected. Maximum allowed: {{numFilesAllowed}}", { numFilesAllowed: C })), t;
45
+ if (r.size + (n.length - i) > C) return I(T("Too many files selected. Maximum allowed: {{numFilesAllowed}}", { numFilesAllowed: C })), t;
46
46
  let a = new DataTransfer();
47
47
  return Array.from(t.files).forEach((e) => {
48
48
  n.includes(e.name) || a.items.add(e);
@@ -52,30 +52,30 @@ var x = ({ accept: x, initialDataTransfer: S, numFilesAllowed: C = 1, onDataTran
52
52
  });
53
53
  }, [
54
54
  x,
55
- U,
55
+ W,
56
56
  C,
57
57
  T
58
- ]), K = c((e) => {
59
- z(e), N(E), L(!1);
58
+ ]), q = c((e) => {
59
+ B(e), P(E), R(!1);
60
60
  let t = e.dataTransfer.files;
61
- G(t);
61
+ K(t);
62
62
  }, [
63
- z,
63
+ B,
64
64
  E,
65
- G
66
- ]), q = c((e) => {
65
+ K
66
+ ]), J = c((e) => {
67
67
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), k.current?.click());
68
- }, []), J = c((e) => {
69
- G(e.target.files);
70
- }, [G]), Y = c(() => {
71
- F(null), j(new DataTransfer());
68
+ }, []), Y = c((e) => {
69
+ K(e.target.files);
70
+ }, [K]), X = c(() => {
71
+ I(null), M(new DataTransfer());
72
72
  }, []);
73
73
  return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g(r, {
74
74
  accept: x,
75
75
  component: "input",
76
76
  id: O,
77
77
  multiple: C > 1,
78
- onChange: J,
78
+ onChange: Y,
79
79
  ref: k,
80
80
  sx: { display: "none" },
81
81
  type: "file"
@@ -88,14 +88,14 @@ var x = ({ accept: x, initialDataTransfer: S, numFilesAllowed: C = 1, onDataTran
88
88
  children: [/* @__PURE__ */ g(r, {
89
89
  component: "label",
90
90
  htmlFor: O,
91
- onDragEnter: B,
92
- onDragLeave: V,
93
- onDragOver: H,
94
- onDrop: K,
95
- onKeyDown: q,
91
+ onDragEnter: V,
92
+ onDragLeave: H,
93
+ onDragOver: U,
94
+ onDrop: q,
95
+ onKeyDown: J,
96
96
  sx: {
97
97
  "&:hover *": { opacity: 1 },
98
- "& p, & svg": { opacity: I ? 1 : .4 },
98
+ "& p, & svg": { opacity: L ? 1 : .4 },
99
99
  cursor: "pointer",
100
100
  display: "flex",
101
101
  height: "100%",
@@ -126,14 +126,14 @@ var x = ({ accept: x, initialDataTransfer: S, numFilesAllowed: C = 1, onDataTran
126
126
  color: "primary",
127
127
  fontSize: "large"
128
128
  }),
129
- P && /* @__PURE__ */ g(s, {
129
+ F && /* @__PURE__ */ g(s, {
130
130
  sx: {
131
131
  color: "error.main",
132
132
  fontWeight: "bold"
133
133
  },
134
- children: P
134
+ children: F
135
135
  }),
136
- /* @__PURE__ */ g(s, { children: M })
136
+ /* @__PURE__ */ g(s, { children: N })
137
137
  ]
138
138
  })
139
139
  })
@@ -142,7 +142,7 @@ var x = ({ accept: x, initialDataTransfer: S, numFilesAllowed: C = 1, onDataTran
142
142
  overflow: "auto",
143
143
  position: "relative"
144
144
  },
145
- children: /* @__PURE__ */ g(r, { children: A.files.length > 0 && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _(r, {
145
+ children: /* @__PURE__ */ g(r, { children: j.files.length > 0 && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _(r, {
146
146
  sx: {
147
147
  alignItems: "center",
148
148
  backgroundColor: (e) => e.palette.background.paper,
@@ -155,23 +155,23 @@ var x = ({ accept: x, initialDataTransfer: S, numFilesAllowed: C = 1, onDataTran
155
155
  },
156
156
  children: [/* @__PURE__ */ g(s, {
157
157
  variant: "h5",
158
- children: T("Selected files: {{numFiles}}", { numFiles: A.files.length })
158
+ children: T("Selected files: {{numFiles}}", { numFiles: j.files.length })
159
159
  }), /* @__PURE__ */ g(a, {
160
160
  "aria-label": T("Clear all selected files"),
161
- onClick: Y,
161
+ onClick: X,
162
162
  size: "small",
163
163
  children: /* @__PURE__ */ g(v, { fontSize: "small" })
164
164
  })]
165
165
  }), /* @__PURE__ */ g(o, {
166
166
  direction: "row",
167
167
  sx: { flexWrap: "wrap" },
168
- children: Array.from(A.files).map((a) => /* @__PURE__ */ g(i, {
168
+ children: Array.from(j.files).map((a) => /* @__PURE__ */ g(i, {
169
169
  deleteIcon: /* @__PURE__ */ g(v, {
170
170
  "aria-hidden": !1,
171
171
  "aria-label": T("Clear {{fileName}}", { fileName: a.name }),
172
172
  focusable: !0,
173
173
  onKeyDown: (e) => {
174
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), W(a.name));
174
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), G(a.name));
175
175
  },
176
176
  tabIndex: 0
177
177
  }),
@@ -190,7 +190,7 @@ var x = ({ accept: x, initialDataTransfer: S, numFilesAllowed: C = 1, onDataTran
190
190
  ]
191
191
  })] }),
192
192
  onDelete: () => {
193
- W(a.name);
193
+ G(a.name);
194
194
  },
195
195
  sx: { margin: .25 },
196
196
  tabIndex: -1,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/FileSelector/FileSelector.tsx"],"sourcesContent":["import {\n Box,\n Chip,\n IconButton,\n Stack,\n Typography,\n} from '@mui/material';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';\nimport type {\n ChangeEvent,\n DragEvent,\n KeyboardEvent as ReactKeyboardEvent,\n} from 'react';\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport CloudUploadIcon from '@mui/icons-material/CloudUpload';\nimport { useTranslation } from 'react-i18next';\nimport { format } from 'date-fns';\nimport { DATE_FORMAT } from '@gen-epix/ui-core/constants/date';\n\nimport { FileUtil } from '../../../utils/FileUtil';\n\n\nexport type FileSelectorProps = {\n readonly accept: string;\n readonly initialDataTransfer?: DataTransfer;\n readonly numFilesAllowed?: number;\n readonly onDataTransferChange: (dataTransfer: DataTransfer) => void;\n};\n\nexport const FileSelector = ({\n accept,\n initialDataTransfer: initialDataTransferProp,\n numFilesAllowed = 1,\n onDataTransferChange,\n}: FileSelectorProps) => {\n const { t } = useTranslation();\n const hoverLabel = numFilesAllowed === 1\n ? t('Click or drag to upload file ({{accept}})', { accept: accept.split(',').join(', ') })\n : t('Click or drag to upload files ({{accept}})', { accept: accept.split(',').join(', ') });\n const dropLabel = numFilesAllowed === 1\n ? t`Drop file here`\n : t`Drop files here`;\n\n const inputId = useId();\n const inputRef = useRef<HTMLInputElement>(null);\n\n const initialDataTransfer = useMemo(() => {\n return initialDataTransferProp ?? new DataTransfer();\n }, [initialDataTransferProp]);\n\n const [dataTransfer, setDataTransfer] = useState<DataTransfer>(initialDataTransfer);\n const [labelText, setLabelText] = useState<string>(hoverLabel);\n const [errorText, setErrorText] = useState<string>(null);\n const [isDragOver, setIsDragOver] = useState<boolean>(false);\n const initialDataTransferEffectRef = useRef(true);\n\n useEffect(() => {\n if (initialDataTransferEffectRef.current) {\n initialDataTransferEffectRef.current = false;\n return;\n }\n onDataTransferChange(dataTransfer);\n }, [dataTransfer, onDataTransferChange]);\n\n const stopDefaults = useCallback((e: DragEvent) => {\n e.stopPropagation();\n e.preventDefault();\n }, []);\n\n const onLabelDragEnter = useCallback((event: DragEvent) => {\n setErrorText(null);\n stopDefaults(event);\n setIsDragOver(true);\n setLabelText(dropLabel);\n }, [stopDefaults, dropLabel]);\n\n const onLabelDragLeave = useCallback((event: DragEvent) => {\n stopDefaults(event);\n setIsDragOver(false);\n setLabelText(hoverLabel);\n }, [stopDefaults, hoverLabel]);\n\n const onLabelDragOver = useCallback((event: DragEvent) => {\n stopDefaults(event);\n }, [stopDefaults]);\n\n const areFileTypesValid = useCallback((fileList: FileList) => {\n for (const file of fileList) {\n const isValid = accept.split(',').some(type => {\n const trimmedType = type.trim();\n return (\n trimmedType === file.type ||\n (trimmedType.startsWith('.') && file.name.endsWith(trimmedType))\n );\n });\n if (!isValid) {\n return false;\n }\n }\n return true;\n }, [accept]);\n\n const removeFile = useCallback((fileName: string) => {\n setErrorText(null);\n setDataTransfer((oldDataTransfer) => {\n const newDataTransfer = new DataTransfer();\n Array.from(oldDataTransfer.files)\n .filter(f => f.name !== fileName)\n .forEach(f => newDataTransfer.items.add(f));\n return newDataTransfer;\n });\n }, []);\n\n const addFileList = useCallback((fileList: FileList) => {\n setErrorText(null);\n setDataTransfer((oldDataTransfer) => {\n if (!fileList || fileList.length === 0) {\n return oldDataTransfer;\n }\n if (!areFileTypesValid(fileList)) {\n setErrorText(t('Invalid file type. Accepted types: {{accept}}', { accept }));\n return oldDataTransfer;\n }\n\n const fileNamesToAppend = Array.from(fileList).map(f => f.name);\n const uniqueOldFileNames = new Set(Array.from(oldDataTransfer.files).map(f => f.name));\n const numDuplicates = fileNamesToAppend.filter(name => uniqueOldFileNames.has(name)).length;\n const numNewFileNames = uniqueOldFileNames.size + (fileNamesToAppend.length - numDuplicates);\n\n if (numNewFileNames > numFilesAllowed) {\n setErrorText(t('Too many files selected. Maximum allowed: {{numFilesAllowed}}', { numFilesAllowed }));\n return oldDataTransfer;\n }\n\n const newDataTransfer = new DataTransfer();\n Array.from(oldDataTransfer.files).forEach(file => {\n if (!fileNamesToAppend.includes(file.name)) {\n newDataTransfer.items.add(file);\n }\n });\n Array.from(fileList).forEach(file => {\n newDataTransfer.items.add(file);\n });\n\n return newDataTransfer;\n\n });\n }, [accept, areFileTypesValid, numFilesAllowed, t]);\n\n const onDrop = useCallback((event: DragEvent<HTMLElement>) => {\n stopDefaults(event);\n setLabelText(hoverLabel);\n setIsDragOver(false);\n\n const fileList = event.dataTransfer.files;\n addFileList(fileList);\n\n }, [stopDefaults, hoverLabel, addFileList]);\n\n const onLabelKeyDown = useCallback((event: ReactKeyboardEvent<HTMLElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n inputRef.current?.click();\n }\n }, []);\n\n const onFileInputChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n addFileList(event.target.files);\n }, [addFileList]);\n\n const onClearAllButtonClick = useCallback(() => {\n setErrorText(null);\n setDataTransfer(new DataTransfer());\n }, []);\n\n return (\n <>\n <Box\n accept={accept}\n component={'input'}\n id={inputId}\n multiple={numFilesAllowed > 1}\n onChange={onFileInputChange}\n ref={inputRef}\n sx={{\n display: 'none',\n }}\n type={'file'}\n />\n <Box\n sx={{\n display: 'grid',\n gridTemplateRows: 'auto fit-content(50%)',\n height: '100%',\n }}\n >\n <Box\n component={'label'}\n htmlFor={inputId}\n onDragEnter={onLabelDragEnter}\n onDragLeave={onLabelDragLeave}\n onDragOver={onLabelDragOver}\n onDrop={onDrop}\n onKeyDown={onLabelKeyDown}\n sx={{\n '&:hover *': {\n opacity: 1,\n },\n '& p, & svg': {\n opacity: isDragOver ? 1 : 0.4,\n },\n cursor: 'pointer',\n display: 'flex',\n height: '100%',\n position: 'relative',\n textAlign: 'center',\n width: '100%',\n }}\n tabIndex={0}\n >\n <Box\n sx={{\n height: '100%',\n pointerEvents: 'none',\n position: 'relative',\n width: '100%',\n }}\n >\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n justifyContent: 'center',\n position: 'absolute',\n width: '100%',\n }}\n >\n <CloudUploadIcon\n color={'primary'}\n fontSize={'large'}\n />\n {errorText && (\n <Typography\n sx={{\n color: 'error.main',\n fontWeight: 'bold',\n }}\n >\n {errorText}\n </Typography>\n )}\n <Typography>\n {labelText}\n </Typography>\n\n </Box>\n </Box>\n </Box>\n <Box\n sx={{\n overflow: 'auto',\n position: 'relative',\n }}\n >\n <Box>\n {dataTransfer.files.length > 0 && (\n <>\n <Box\n sx={{\n alignItems: 'center',\n backgroundColor: (theme) => theme.palette.background.paper,\n display: 'flex',\n gap: 1,\n paddingY: 1,\n position: 'sticky',\n top: 0,\n zIndex: (theme) => theme.zIndex.tooltip - 1,\n }}\n >\n <Typography\n variant={'h5'}\n >\n {t('Selected files: {{numFiles}}', { numFiles: dataTransfer.files.length })}\n </Typography>\n <IconButton\n aria-label={t('Clear all selected files')}\n onClick={onClearAllButtonClick}\n size={'small'}\n >\n <DeleteIcon fontSize={'small'} />\n </IconButton>\n </Box>\n <Stack\n direction={'row'}\n sx={{\n flexWrap: 'wrap',\n }}\n >\n {Array.from(dataTransfer.files).map(file => (\n <Chip\n deleteIcon={(\n <DeleteIcon\n aria-hidden={false}\n aria-label={t('Clear {{fileName}}', { fileName: file.name })}\n focusable\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n removeFile(file.name);\n }\n }}\n tabIndex={0}\n />\n )}\n icon={<InsertDriveFileIcon />}\n key={`${file.name}-${file.size}-${file.lastModified}`}\n label={\n (\n <>\n <Box\n component={'span'}\n sx={{ fontWeight: 'bold' }}\n >\n {file.name}\n </Box>\n <Box component={'span'}>\n {' '}\n {t('(size: {{size}})', { size: FileUtil.getReadableFileSize(file.size) })}\n {' '}\n {t('(last modified: {{lastModified}})', { lastModified: format(new Date(file.lastModified), DATE_FORMAT.DATE_TIME) })}\n </Box>\n </>\n )\n }\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onDelete={() => {\n removeFile(file.name);\n }}\n sx={{\n margin: 0.25,\n }}\n tabIndex={-1}\n variant={'outlined'}\n />\n ))}\n </Stack>\n </>\n )}\n </Box>\n </Box>\n </Box>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;AAqCA,IAAa,KAAgB,EAC3B,WACA,qBAAqB,GACrB,qBAAkB,GAClB,8BACuB;CACvB,IAAM,EAAE,SAAM,EAAe,GACvB,IACF,EADe,MAAoB,IACjC,8CACA,+CAD6C,EAAE,QAAQ,EAAO,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CACG,GACvF,IAAY,MAAoB,IAClC,CAAC,mBACD,CAAC,mBAEC,IAAU,EAAM,GAChB,IAAW,EAAyB,IAAI,GAMxC,CAAC,GAAc,KAAmB,EAJZ,QACnB,KAA2B,IAAI,aAAa,GAClD,CAAC,CAAuB,CAEoC,CAAmB,GAC5E,CAAC,GAAW,KAAgB,EAAiB,CAAU,GACvD,CAAC,GAAW,KAAgB,EAAiB,IAAI,GACjD,CAAC,GAAY,KAAiB,EAAkB,EAAK,GACrD,IAA+B,EAAO,EAAI;CAEhD,QAAgB;EACd,IAAI,EAA6B,SAAS;GACxC,EAA6B,UAAU;GACvC;EACF;EACA,EAAqB,CAAY;CACnC,GAAG,CAAC,GAAc,CAAoB,CAAC;C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AE,UAAU,EAAa,MAAM,OAAO,CAAC;IAChE,CAAA,GACZ,kBAAC,GAAD;KACE,cAAY,EAAE,0BAA0B;KACxC,SAAS;KACT,MAAM;eAEN,kBAAC,GAAD,EAAY,UAAU,QAAU,CAAA;IACtB,CAAA,CACT;OACL,kBAAC,GAAD;IACE,WAAW;IACX,IAAI,EACF,UAAU,OACZ;cAEC,MAAM,KAAK,EAAa,KAAK,CAAC,CAAC,KAAI,MAClC,kBAAC,GAAD;KACE,YACE,kBAAC,GAAD;MACE,eAAa;MACb,cAAY,EAAE,sBAAsB,EAAE,UAAU,EAAK,KAAK,CAAC;MAC3D,WAAA;MAEA,YAAY,MAAU;OACpB,CAAI,EAAM,QAAQ,WAAW,EAAM,QAAQ,SACzC,EAAM,eAAe,GACrB,EAAW,EAAK,IAAI;MAExB;MACA,UAAU;KACX,CAAA;KAEH,MAAM,kBAAC,GAAD,CAAsB,CAAA;KAE5B,OAEI,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;MACE,WAAW;MACX,IAAI,EAAE,YAAY,OAAO;gBAExB,EAAK;KACH,CAAA,GACL,kBAAC,GAAD;MAAK,WAAW;gBAAhB;OACG;OACA,EAAE,oBAAoB,EAAE,MAAM,EAAS,oBAAoB,EAAK,IAAI,EAAE,CAAC;OACvE;OACA,EAAE,qCAAqC,EAAE,cAAc,EAAO,IAAI,KAAK,EAAK,YAAY,GAAG,EAAY,SAAS,EAAE,CAAC;MACjH;OACL,EAAA,CAAA;KAIN,gBAAgB;MACd,EAAW,EAAK,IAAI;KACtB;KACA,IAAI,EACF,QAAQ,IACV;KACA,UAAU;KACV,SAAS;IACV,GA5BM,GAAG,EAAK,KAAK,GAAG,EAAK,KAAK,GAAG,EAAK,cA4BxC,CACF;GACI,CAAA,CACP,EAAA,CAAA,EAED,CAAA;EACF,CAAA,CACF;GACL,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/FileSelector/FileSelector.tsx"],"sourcesContent":["import {\n Box,\n Chip,\n IconButton,\n Stack,\n Typography,\n} from '@mui/material';\nimport DeleteIcon from '@mui/icons-material/Delete';\nimport InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';\nimport type {\n ChangeEvent,\n DragEvent,\n KeyboardEvent as ReactKeyboardEvent,\n} from 'react';\nimport {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport CloudUploadIcon from '@mui/icons-material/CloudUpload';\nimport { useTranslation } from 'react-i18next';\nimport { format } from 'date-fns';\nimport { DATE_FORMAT } from '@gen-epix/ui-core/constants/date';\n\nimport { FileUtil } from '../../../utils/FileUtil';\n\n\nexport type FileSelectorProps = {\n readonly accept: string;\n readonly initialDataTransfer?: DataTransfer;\n readonly numFilesAllowed?: number;\n readonly onDataTransferChange: (dataTransfer: DataTransfer) => void;\n};\n\nexport const FileSelector = ({\n accept,\n initialDataTransfer: initialDataTransferProp,\n numFilesAllowed = 1,\n onDataTransferChange,\n}: FileSelectorProps) => {\n const { t } = useTranslation();\n const hoverLabel = numFilesAllowed === 1\n ? t('Click or drag to upload file ({{accept}})', { accept: accept.split(',').join(', ') })\n : t('Click or drag to upload files ({{accept}})', { accept: accept.split(',').join(', ') });\n const dropLabel = numFilesAllowed === 1\n ? t`Drop file here`\n : t`Drop files here`;\n\n const inputId = useId();\n const inputRef = useRef<HTMLInputElement>(null);\n\n const initialDataTransfer = useMemo(() => {\n return initialDataTransferProp ?? new DataTransfer();\n }, [initialDataTransferProp]);\n\n const [dataTransfer, setDataTransfer] = useState<DataTransfer>(initialDataTransfer);\n const [labelText, setLabelText] = useState<string>(hoverLabel);\n const [errorText, setErrorText] = useState<string>(null);\n const [isDragOver, setIsDragOver] = useState<boolean>(false);\n const initialDataTransferEffectRef = useRef(true);\n\n useEffect(() => {\n if (initialDataTransferEffectRef.current) {\n initialDataTransferEffectRef.current = false;\n return;\n }\n onDataTransferChange(dataTransfer);\n }, [dataTransfer, onDataTransferChange]);\n\n const stopDefaults = useCallback((e: DragEvent) => {\n e.stopPropagation();\n e.preventDefault();\n }, []);\n\n const onLabelDragEnter = useCallback((event: DragEvent) => {\n setErrorText(null);\n stopDefaults(event);\n setIsDragOver(true);\n setLabelText(dropLabel);\n }, [stopDefaults, dropLabel]);\n\n const onLabelDragLeave = useCallback((event: DragEvent) => {\n stopDefaults(event);\n setIsDragOver(false);\n setLabelText(hoverLabel);\n }, [stopDefaults, hoverLabel]);\n\n const onLabelDragOver = useCallback((event: DragEvent) => {\n stopDefaults(event);\n }, [stopDefaults]);\n\n const areFileTypesValid = useCallback((fileList: FileList) => {\n for (const file of fileList) {\n const isValid = accept.split(',').some(type => {\n const trimmedType = type.trim();\n return (\n trimmedType === file.type ||\n (trimmedType.startsWith('.') && file.name.endsWith(trimmedType))\n );\n });\n if (!isValid) {\n return false;\n }\n }\n return true;\n }, [accept]);\n\n const removeFile = useCallback((fileName: string) => {\n setErrorText(null);\n setDataTransfer((oldDataTransfer) => {\n const newDataTransfer = new DataTransfer();\n Array.from(oldDataTransfer.files)\n .filter(f => f.name !== fileName)\n .forEach(f => newDataTransfer.items.add(f));\n return newDataTransfer;\n });\n }, []);\n\n const addFileList = useCallback((fileList: FileList) => {\n setErrorText(null);\n setDataTransfer((oldDataTransfer) => {\n if (!fileList || fileList.length === 0) {\n return oldDataTransfer;\n }\n if (!areFileTypesValid(fileList)) {\n setErrorText(t('Invalid file type. Accepted types: {{accept}}', { accept }));\n return oldDataTransfer;\n }\n\n const fileNamesToAppend = Array.from(fileList).map(f => f.name);\n const uniqueOldFileNames = new Set(Array.from(oldDataTransfer.files).map(f => f.name));\n const numDuplicates = fileNamesToAppend.filter(name => uniqueOldFileNames.has(name)).length;\n const numNewFileNames = uniqueOldFileNames.size + (fileNamesToAppend.length - numDuplicates);\n\n if (numNewFileNames > numFilesAllowed) {\n setErrorText(t('Too many files selected. Maximum allowed: {{numFilesAllowed}}', { numFilesAllowed }));\n return oldDataTransfer;\n }\n\n const newDataTransfer = new DataTransfer();\n Array.from(oldDataTransfer.files).forEach(file => {\n if (!fileNamesToAppend.includes(file.name)) {\n newDataTransfer.items.add(file);\n }\n });\n Array.from(fileList).forEach(file => {\n newDataTransfer.items.add(file);\n });\n\n return newDataTransfer;\n\n });\n }, [accept, areFileTypesValid, numFilesAllowed, t]);\n\n const onDrop = useCallback((event: DragEvent<HTMLElement>) => {\n stopDefaults(event);\n setLabelText(hoverLabel);\n setIsDragOver(false);\n\n const fileList = event.dataTransfer.files;\n addFileList(fileList);\n\n }, [stopDefaults, hoverLabel, addFileList]);\n\n const onLabelKeyDown = useCallback((event: ReactKeyboardEvent<HTMLElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n inputRef.current?.click();\n }\n }, []);\n\n const onFileInputChange = useCallback((event: ChangeEvent<HTMLInputElement>) => {\n addFileList(event.target.files);\n }, [addFileList]);\n\n const onClearAllButtonClick = useCallback(() => {\n setErrorText(null);\n setDataTransfer(new DataTransfer());\n }, []);\n\n return (\n <>\n <Box\n accept={accept}\n component={'input'}\n id={inputId}\n multiple={numFilesAllowed > 1}\n onChange={onFileInputChange}\n ref={inputRef}\n sx={{\n display: 'none',\n }}\n type={'file'}\n />\n <Box\n sx={{\n display: 'grid',\n gridTemplateRows: 'auto fit-content(50%)',\n height: '100%',\n }}\n >\n <Box\n component={'label'}\n htmlFor={inputId}\n onDragEnter={onLabelDragEnter}\n onDragLeave={onLabelDragLeave}\n onDragOver={onLabelDragOver}\n onDrop={onDrop}\n onKeyDown={onLabelKeyDown}\n sx={{\n '&:hover *': {\n opacity: 1,\n },\n '& p, & svg': {\n opacity: isDragOver ? 1 : 0.4,\n },\n cursor: 'pointer',\n display: 'flex',\n height: '100%',\n position: 'relative',\n textAlign: 'center',\n width: '100%',\n }}\n tabIndex={0}\n >\n <Box\n sx={{\n height: '100%',\n pointerEvents: 'none',\n position: 'relative',\n width: '100%',\n }}\n >\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n justifyContent: 'center',\n position: 'absolute',\n width: '100%',\n }}\n >\n <CloudUploadIcon\n color={'primary'}\n fontSize={'large'}\n />\n {errorText && (\n <Typography\n sx={{\n color: 'error.main',\n fontWeight: 'bold',\n }}\n >\n {errorText}\n </Typography>\n )}\n <Typography>\n {labelText}\n </Typography>\n\n </Box>\n </Box>\n </Box>\n <Box\n sx={{\n overflow: 'auto',\n position: 'relative',\n }}\n >\n <Box>\n {dataTransfer.files.length > 0 && (\n <>\n <Box\n sx={{\n alignItems: 'center',\n backgroundColor: (theme) => theme.palette.background.paper,\n display: 'flex',\n gap: 1,\n paddingY: 1,\n position: 'sticky',\n top: 0,\n zIndex: (theme) => theme.zIndex.tooltip - 1,\n }}\n >\n <Typography\n variant={'h5'}\n >\n {t('Selected files: {{numFiles}}', { numFiles: dataTransfer.files.length })}\n </Typography>\n <IconButton\n aria-label={t('Clear all selected files')}\n onClick={onClearAllButtonClick}\n size={'small'}\n >\n <DeleteIcon fontSize={'small'} />\n </IconButton>\n </Box>\n <Stack\n direction={'row'}\n sx={{\n flexWrap: 'wrap',\n }}\n >\n {Array.from(dataTransfer.files).map(file => (\n <Chip\n deleteIcon={(\n <DeleteIcon\n aria-hidden={false}\n aria-label={t('Clear {{fileName}}', { fileName: file.name })}\n focusable\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onKeyDown={(event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n removeFile(file.name);\n }\n }}\n tabIndex={0}\n />\n )}\n icon={<InsertDriveFileIcon />}\n key={`${file.name}-${file.size}-${file.lastModified}`}\n label={\n (\n <>\n <Box\n component={'span'}\n sx={{ fontWeight: 'bold' }}\n >\n {file.name}\n </Box>\n <Box component={'span'}>\n {' '}\n {t('(size: {{size}})', { size: FileUtil.getReadableFileSize(file.size) })}\n {' '}\n {t('(last modified: {{lastModified}})', { lastModified: format(new Date(file.lastModified), DATE_FORMAT.DATE_TIME) })}\n </Box>\n </>\n )\n }\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onDelete={() => {\n removeFile(file.name);\n }}\n sx={{\n margin: 0.25,\n }}\n tabIndex={-1}\n variant={'outlined'}\n />\n ))}\n </Stack>\n </>\n )}\n </Box>\n </Box>\n </Box>\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;AAqCA,IAAa,KAAgB,EAC3B,WACA,qBAAqB,GACrB,qBAAkB,GAClB,8BACuB;CACvB,IAAM,EAAE,SAAM,EAAe,GACvB,IACF,EADe,MAAoB,IACjC,8CACA,+CAD6C,EAAE,QAAQ,EAAO,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CACG,GACvF,IAAY,MAAoB,IAClC,CAAC,mBACD,CAAC,mBAEC,IAAU,EAAM,GAChB,IAAW,EAAyB,IAAI,GAExC,IAAsB,QACnB,KAA2B,IAAI,aAAa,GAClD,CAAC,CAAuB,CAAC,GAEtB,CAAC,GAAc,KAAmB,EAAuB,CAAmB,GAC5E,CAAC,GAAW,KAAgB,EAAiB,CAAU,GACvD,CAAC,GAAW,KAAgB,EAAiB,IAAI,GACjD,CAAC,GAAY,KAAiB,EAAkB,EAAK,GACrD,IAA+B,EAAO,EAAI;CAEhD,QAAgB;EACd,IAAI,EAA6B,SAAS;GACxC,EAA6B,UAAU;GACvC;EACF;EACA,EAAqB,CAAY;CACnC,GAAG,CAAC,GAAc,CAAoB,CAAC;CAEvC,IAAM,IAAe,GAAa,MAAiB;EAEjD,AADA,EAAE,gBAAgB,GAClB,EAAE,eAAe;CACnB,GAAG,CAAC,CAAC,GAEC,IAAmB,GAAa,MAAqB;EAIzD,AAHA,EAAa,IAAI,GACjB,EAAa,CAAK,GAClB,EAAc,EAAI,GAClB,EAAa,CAAS;CACxB,GAAG,CAAC,GAAc,CAAS,CAAC,GAEtB,IAAmB,GAAa,MAAqB;EAGzD,AAFA,EAAa,CAAK,GAClB,EAAc,EAAK,GACnB,EAAa,CAAU;CACzB,GAAG,C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AAI,MAClC,kBAAC,GAAD;KACE,YACE,kBAAC,GAAD;MACE,eAAa;MACb,cAAY,EAAE,sBAAsB,EAAE,UAAU,EAAK,KAAK,CAAC;MAC3D,WAAA;MAEA,YAAY,MAAU;OACpB,CAAI,EAAM,QAAQ,WAAW,EAAM,QAAQ,SACzC,EAAM,eAAe,GACrB,EAAW,EAAK,IAAI;MAExB;MACA,UAAU;KACX,CAAA;KAEH,MAAM,kBAAC,GAAD,CAAsB,CAAA;KAE5B,OAEI,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;MACE,WAAW;MACX,IAAI,EAAE,YAAY,OAAO;MAExB,UAAA,EAAK;KACH,CAAA,GACL,kBAAC,GAAD;MAAK,WAAW;MAAhB,UAAA;OACG;OACA,EAAE,oBAAoB,EAAE,MAAM,EAAS,oBAAoB,EAAK,IAAI,EAAE,CAAC;OACvE;OACA,EAAE,qCAAqC,EAAE,cAAc,EAAO,IAAI,KAAK,EAAK,YAAY,GAAG,EAAY,SAAS,EAAE,CAAC;MACjH;KACL,CAAA,CAAA,EAAA,CAAA;KAIN,gBAAgB;MACd,EAAW,EAAK,IAAI;KACtB;KACA,IAAI,EACF,QAAQ,IACV;KACA,UAAU;KACV,SAAS;IACV,GA5BM,GAAG,EAAK,KAAK,GAAG,EAAK,KAAK,GAAG,EAAK,cA4BxC,CACF;GACI,CAAA,CACP,EAAA,CAAA,EAED,CAAA;EACF,CAAA,CACF;CACL,CAAA,CAAA,EAAA,CAAA;AAEN"}
@@ -1,5 +1,5 @@
1
1
  import { CaseDbCase, CaseDbCompleteCaseType } from '@gen-epix/api-casedb';
2
- import { WithDialogRefMethods, WithDialogRenderProps } from '@gen-epix/ui/hoc/withDialog';
2
+ import { WithDialogRefMethods, WithDialogRenderProps } from '@gen-epix/ui-core-components/hoc/withDialog';
3
3
  export interface FindSimilarCasesDialogOpenProps {
4
4
  allRows: CaseDbCase[];
5
5
  completeCaseType: CaseDbCompleteCaseType;
@@ -8,4 +8,4 @@ export interface FindSimilarCasesDialogOpenProps {
8
8
  export interface FindSimilarCasesDialogProps extends WithDialogRenderProps<FindSimilarCasesDialogOpenProps> {
9
9
  }
10
10
  export type FindSimilarCasesDialogRefMethods = WithDialogRefMethods<FindSimilarCasesDialogProps, FindSimilarCasesDialogOpenProps>;
11
- export declare const FindSimilarCasesDialog: import('react').ComponentClass<FindSimilarCasesDialogProps, import('@gen-epix/ui/hoc/withDialog').WithDialogState<FindSimilarCasesDialogOpenProps>>;
11
+ export declare const FindSimilarCasesDialog: import('react').ComponentClass<FindSimilarCasesDialogProps, import('@gen-epix/ui-core-components/hoc/withDialog').WithDialogState<FindSimilarCasesDialogOpenProps>>;
@@ -2,12 +2,12 @@ import { STRATIFICATION_MODE as e } from "../../../models/stratification.js";
2
2
  import { t } from "../../../_chunks/react.js";
3
3
  import { r as n, t as r } from "../../../_chunks/dashboardStore.js";
4
4
  import { t as i } from "../../../_chunks/LegendaItem.js";
5
- import { ConfigService as a } from "@gen-epix/ui/classes/services/ConfigService";
5
+ import { ConfigService as a } from "@gen-epix/ui-client-common/classes/services/ConfigService";
6
6
  import { Box as o } from "@mui/material";
7
7
  import { use as s, useCallback as c, useMemo as l } from "react";
8
8
  import { useTranslation as u } from "react-i18next";
9
9
  import { jsx as d, jsxs as f } from "react/jsx-runtime";
10
- import { NestedDropdown as p } from "@gen-epix/ui/components/ui/NestedMenu";
10
+ import { NestedDropdown as p } from "@gen-epix/ui-core-components/components/NestedMenu";
11
11
  //#region src/components/ui/Grouping/Grouping.tsx
12
12
  var m = () => {
13
13
  let { t: m } = u(), h = s(r), g = t(h, (e) => e.stratification), _ = t(h, (e) => e.stratify), v = t(h, (e) => e.stratifyableColumns), y = c((t) => {
@@ -16,7 +16,53 @@ var m = () => {
16
16
  return;
17
17
  }
18
18
  _(e.FIELD, t);
19
- }, [g?.col?.id, _]);
19
+ }, [g?.col?.id, _]), b = l(() => {
20
+ let t = m`Grouping`;
21
+ return g && (t = g.mode === e.SELECTION ? m`Grouped by Selected rows` : g.mode === e.SIMILAR_CASES ? m`Grouped by Similar cases` : m("Grouped by {{fieldName}}", { fieldName: g.col.label })), n({
22
+ disabled: v.length === 0,
23
+ items: [
24
+ {
25
+ active: !g,
26
+ callback: () => {
27
+ _(null);
28
+ },
29
+ divider: !0,
30
+ label: "None"
31
+ },
32
+ {
33
+ active: g?.mode === e.SELECTION,
34
+ callback: () => {
35
+ _(g?.mode === e.SELECTION ? null : e.SELECTION);
36
+ },
37
+ divider: !0,
38
+ label: "Selected rows"
39
+ },
40
+ {
41
+ active: g?.mode === e.SIMILAR_CASES,
42
+ callback: () => {
43
+ _(g?.mode === e.SIMILAR_CASES ? null : e.SIMILAR_CASES);
44
+ },
45
+ divider: !0,
46
+ label: "Similar cases"
47
+ }
48
+ ],
49
+ label: t,
50
+ tooltip: m("Grouping allows you to group cases by a selected field. Grouping will be disabled when the maximum unique values of the selected field exceeds {{max_stratification_unique_values}}.", { max_stratification_unique_values: a.getInstance().config.epi.STRATIFICATION.MAX_ALLOWED_UNIQUE_VALUES })
51
+ }, (e) => (v.forEach((t) => {
52
+ e.items.push({
53
+ active: g?.col?.id === t.col.id,
54
+ callback: () => y(t.col),
55
+ disabled: !t.enabled,
56
+ label: t.col.label
57
+ });
58
+ }), e));
59
+ }, [
60
+ g,
61
+ m,
62
+ v,
63
+ _,
64
+ y
65
+ ]);
20
66
  return /* @__PURE__ */ f(o, {
21
67
  sx: {
22
68
  display: "flex",
@@ -35,53 +81,7 @@ var m = () => {
35
81
  },
36
82
  variant: "text"
37
83
  },
38
- menuItemsData: l(() => {
39
- let t = m`Grouping`;
40
- return g && (t = g.mode === e.SELECTION ? m`Grouped by Selected rows` : g.mode === e.SIMILAR_CASES ? m`Grouped by Similar cases` : m("Grouped by {{fieldName}}", { fieldName: g.col.label })), n({
41
- disabled: v.length === 0,
42
- items: [
43
- {
44
- active: !g,
45
- callback: () => {
46
- _(null);
47
- },
48
- divider: !0,
49
- label: "None"
50
- },
51
- {
52
- active: g?.mode === e.SELECTION,
53
- callback: () => {
54
- _(g?.mode === e.SELECTION ? null : e.SELECTION);
55
- },
56
- divider: !0,
57
- label: "Selected rows"
58
- },
59
- {
60
- active: g?.mode === e.SIMILAR_CASES,
61
- callback: () => {
62
- _(g?.mode === e.SIMILAR_CASES ? null : e.SIMILAR_CASES);
63
- },
64
- divider: !0,
65
- label: "Similar cases"
66
- }
67
- ],
68
- label: t,
69
- tooltip: m("Grouping allows you to group cases by a selected field. Grouping will be disabled when the maximum unique values of the selected field exceeds {{max_stratification_unique_values}}.", { max_stratification_unique_values: a.getInstance().config.epi.STRATIFICATION.MAX_ALLOWED_UNIQUE_VALUES })
70
- }, (e) => (v.forEach((t) => {
71
- e.items.push({
72
- active: g?.col?.id === t.col.id,
73
- callback: () => y(t.col),
74
- disabled: !t.enabled,
75
- label: t.col.label
76
- });
77
- }), e));
78
- }, [
79
- g,
80
- m,
81
- v,
82
- _,
83
- y
84
- ]),
84
+ menuItemsData: b,
85
85
  showTopLevelTooltip: !0
86
86
  }) }), g?.legendaItems.map((e) => /* @__PURE__ */ d(o, {
87
87
  sx: { marginX: 1 },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/Grouping/Grouping.tsx"],"sourcesContent":["import { Box } from '@mui/material';\nimport {\n use,\n useCallback,\n useMemo,\n} from 'react';\nimport { useStore } from 'zustand';\nimport { useTranslation } from 'react-i18next';\nimport { produce } from 'immer';\nimport type { CaseDbCol } from '@gen-epix/api-casedb';\nimport type { MenuItemData } from '@gen-epix/ui/models/nestedMenu';\nimport { ConfigService } from '@gen-epix/ui/classes/services/ConfigService';\nimport { NestedDropdown } from '@gen-epix/ui/components/ui/NestedMenu';\n\nimport { LegendaItem } from '../LegendaItem';\nimport { DashboardStoreContext } from '../../../stores/dashboardStore';\nimport { STRATIFICATION_MODE } from '../../../models/stratification';\nimport type { CaseDbConfig } from '../../../models/config';\n\nexport const Grouping = () => {\n const { t } = useTranslation();\n\n const dashboardStore = use(DashboardStoreContext);\n const stratification = useStore(dashboardStore, (state) => state.stratification);\n const stratify = useStore(dashboardStore, (state) => state.stratify);\n const stratifyableColumns = useStore(dashboardStore, (state) => state.stratifyableColumns);\n\n const onStratifyMenuItemClick = useCallback((col: CaseDbCol) => {\n if (col.id === stratification?.col?.id) {\n stratify(null);\n return;\n }\n stratify(STRATIFICATION_MODE.FIELD, col);\n }, [stratification?.col?.id, stratify]);\n\n const stratificationMenu = useMemo<MenuItemData>(() => {\n let label = t`Grouping`;\n if (stratification) {\n if (stratification.mode === STRATIFICATION_MODE.SELECTION) {\n label = t`Grouped by Selected rows`;\n } else if (stratification.mode === STRATIFICATION_MODE.SIMILAR_CASES) {\n label = t`Grouped by Similar cases`;\n } else {\n label = t('Grouped by {{fieldName}}', { fieldName: stratification.col.label });\n }\n }\n\n return produce<MenuItemData>({\n disabled: stratifyableColumns.length === 0,\n items: [\n {\n active: !stratification,\n callback: () => {\n stratify(null);\n },\n divider: true,\n label: 'None',\n },\n {\n active: stratification?.mode === STRATIFICATION_MODE.SELECTION,\n callback: () => {\n stratify(stratification?.mode === STRATIFICATION_MODE.SELECTION ? null : STRATIFICATION_MODE.SELECTION);\n },\n divider: true,\n label: 'Selected rows',\n },\n {\n active: stratification?.mode === STRATIFICATION_MODE.SIMILAR_CASES,\n callback: () => {\n stratify(stratification?.mode === STRATIFICATION_MODE.SIMILAR_CASES ? null : STRATIFICATION_MODE.SIMILAR_CASES);\n },\n divider: true,\n label: 'Similar cases',\n },\n ],\n label,\n tooltip: t('Grouping allows you to group cases by a selected field. Grouping will be disabled when the maximum unique values of the selected field exceeds {{max_stratification_unique_values}}.', {\n max_stratification_unique_values: ConfigService.getInstance<CaseDbConfig>().config.epi.STRATIFICATION.MAX_ALLOWED_UNIQUE_VALUES,\n }),\n }, draft => {\n stratifyableColumns\n .forEach(stratifyableCol => {\n draft.items.push({\n active: stratification?.col?.id === stratifyableCol.col.id,\n callback: () => onStratifyMenuItemClick(stratifyableCol.col),\n disabled: !stratifyableCol.enabled,\n label: stratifyableCol.col.label,\n });\n });\n return draft;\n });\n }, [stratification, t, stratifyableColumns, stratify, onStratifyMenuItemClick]);\n\n return (\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'wrap',\n }}\n >\n <Box>\n <NestedDropdown\n ButtonProps={{\n color: 'inherit',\n size: 'small',\n sx: {\n '& span': {\n margin: 0,\n },\n background: 'none !important',\n margin: 0,\n padding: 0,\n textTransform: 'none',\n },\n variant: 'text',\n }}\n menuItemsData={stratificationMenu}\n showTopLevelTooltip\n />\n </Box>\n {stratification?.legendaItems.map(legendaItem => (\n <Box\n key={legendaItem.rowValue.raw ?? '-'}\n sx={{\n marginX: 1,\n }}\n >\n <LegendaItem\n item={legendaItem}\n tooltip\n tooltipProps={{\n arrow: true,\n placement: 'top',\n }}\n />\n </Box>\n ))}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;AAmBA,IAAa,UAAiB;CAC5B,IAAM,EAAE,SAAM,EAAe,GAEvB,IAAiB,EAAI,CAAqB,GAC1C,IAAiB,EAAS,IAAiB,MAAU,EAAM,cAAc,GACzE,IAAW,EAAS,IAAiB,MAAU,EAAM,QAAQ,GAC7D,IAAsB,EAAS,IAAiB,MAAU,EAAM,mBAAmB,GAEnF,IAA0B,GAAa,MAAmB;EAC9D,IAAI,EAAI,OAAO,GAAgB,KAAK,IAAI;GACtC,EAAS,IAAI;GACb;EACF;EACA,EAAS,EAAoB,OAAO,CAAG;CACzC,GAAG,CAAC,GAAgB,KAAK,IAAI,CAAQ,CAAC;CA4DtC,OACE,kBAAC,GAAD;EACE,IAAI;GACF,SAAS;GACT,UAAU;EACZ;YAJF,CAME,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;GACE,aAAa;IACX,OAAO;IACP,MAAM;IACN,IAAI;KACF,UAAU,EACR,QAAQ,EACV;KACA,YAAY;KACZ,QAAQ;KACR,SAAS;KACT,eAAe;IACjB;IACA,SAAS;GACX;GACA,eAjFm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B,CACN,CACE;;AAET"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/Grouping/Grouping.tsx"],"sourcesContent":["import { Box } from '@mui/material';\nimport {\n use,\n useCallback,\n useMemo,\n} from 'react';\nimport { useStore } from 'zustand';\nimport { useTranslation } from 'react-i18next';\nimport { produce } from 'immer';\nimport type { CaseDbCol } from '@gen-epix/api-casedb';\nimport type { MenuItemData } from '@gen-epix/ui-core-components/models/nestedMenu';\nimport { ConfigService } from '@gen-epix/ui-client-common/classes/services/ConfigService';\nimport { NestedDropdown } from '@gen-epix/ui-core-components/components/NestedMenu';\n\nimport { LegendaItem } from '../LegendaItem';\nimport { DashboardStoreContext } from '../../../stores/dashboardStore';\nimport { STRATIFICATION_MODE } from '../../../models/stratification';\nimport type { CaseDbConfig } from '../../../models/config';\n\nexport const Grouping = () => {\n const { t } = useTranslation();\n\n const dashboardStore = use(DashboardStoreContext);\n const stratification = useStore(dashboardStore, (state) => state.stratification);\n const stratify = useStore(dashboardStore, (state) => state.stratify);\n const stratifyableColumns = useStore(dashboardStore, (state) => state.stratifyableColumns);\n\n const onStratifyMenuItemClick = useCallback((col: CaseDbCol) => {\n if (col.id === stratification?.col?.id) {\n stratify(null);\n return;\n }\n stratify(STRATIFICATION_MODE.FIELD, col);\n }, [stratification?.col?.id, stratify]);\n\n const stratificationMenu = useMemo<MenuItemData>(() => {\n let label = t`Grouping`;\n if (stratification) {\n if (stratification.mode === STRATIFICATION_MODE.SELECTION) {\n label = t`Grouped by Selected rows`;\n } else if (stratification.mode === STRATIFICATION_MODE.SIMILAR_CASES) {\n label = t`Grouped by Similar cases`;\n } else {\n label = t('Grouped by {{fieldName}}', { fieldName: stratification.col.label });\n }\n }\n\n return produce<MenuItemData>({\n disabled: stratifyableColumns.length === 0,\n items: [\n {\n active: !stratification,\n callback: () => {\n stratify(null);\n },\n divider: true,\n label: 'None',\n },\n {\n active: stratification?.mode === STRATIFICATION_MODE.SELECTION,\n callback: () => {\n stratify(stratification?.mode === STRATIFICATION_MODE.SELECTION ? null : STRATIFICATION_MODE.SELECTION);\n },\n divider: true,\n label: 'Selected rows',\n },\n {\n active: stratification?.mode === STRATIFICATION_MODE.SIMILAR_CASES,\n callback: () => {\n stratify(stratification?.mode === STRATIFICATION_MODE.SIMILAR_CASES ? null : STRATIFICATION_MODE.SIMILAR_CASES);\n },\n divider: true,\n label: 'Similar cases',\n },\n ],\n label,\n tooltip: t('Grouping allows you to group cases by a selected field. Grouping will be disabled when the maximum unique values of the selected field exceeds {{max_stratification_unique_values}}.', {\n max_stratification_unique_values: ConfigService.getInstance<CaseDbConfig>().config.epi.STRATIFICATION.MAX_ALLOWED_UNIQUE_VALUES,\n }),\n }, draft => {\n stratifyableColumns\n .forEach(stratifyableCol => {\n draft.items.push({\n active: stratification?.col?.id === stratifyableCol.col.id,\n callback: () => onStratifyMenuItemClick(stratifyableCol.col),\n disabled: !stratifyableCol.enabled,\n label: stratifyableCol.col.label,\n });\n });\n return draft;\n });\n }, [stratification, t, stratifyableColumns, stratify, onStratifyMenuItemClick]);\n\n return (\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'wrap',\n }}\n >\n <Box>\n <NestedDropdown\n ButtonProps={{\n color: 'inherit',\n size: 'small',\n sx: {\n '& span': {\n margin: 0,\n },\n background: 'none !important',\n margin: 0,\n padding: 0,\n textTransform: 'none',\n },\n variant: 'text',\n }}\n menuItemsData={stratificationMenu}\n showTopLevelTooltip\n />\n </Box>\n {stratification?.legendaItems.map(legendaItem => (\n <Box\n key={legendaItem.rowValue.raw ?? '-'}\n sx={{\n marginX: 1,\n }}\n >\n <LegendaItem\n item={legendaItem}\n tooltip\n tooltipProps={{\n arrow: true,\n placement: 'top',\n }}\n />\n </Box>\n ))}\n </Box>\n );\n};\n"],"mappings":";;;;;;;;;;;AAmBA,IAAa,UAAiB;CAC5B,IAAM,EAAE,SAAM,EAAe,GAEvB,IAAiB,EAAI,CAAqB,GAC1C,IAAiB,EAAS,IAAiB,MAAU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GACI,EACR;CACH,GAAG;EAAC;EAAgB;EAAG;EAAqB;EAAU;CAAuB,CAAC;CAE9E,OACE,kBAAC,GAAD;EACE,IAAI;GACF,SAAS;GACT,UAAU;EACZ;EAJF,UAAA,CAME,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;GACE,aAAa;IACX,OAAO;IACP,MAAM;IACN,IAAI;KACF,UAAU,EACR,QAAQ,EACV;KACA,YAAY;KACZ,QAAQ;KACR,SAAS;KACT,eAAe;IACjB;IACA,SAAS;GACX;GACA,eAAe;GACf,qBAAA;EACD,CAAA,EACE,CAAA,GACJ,GAAgB,aAAa,KAAI,MAChC,kBAAC,GAAD;GAEE,IAAI,EACF,SAAS,EACX;GAEA,UAAA,kBAAC,GAAD;IACE,MAAM;IACN,SAAA;IACA,cAAc;KACZ,OAAO;KACP,WAAW;IACb;GACD,CAAA;EACE,GAbE,EAAY,SAAS,OAAO,GAa9B,CACN,CACE;;AAET"}
@@ -14,7 +14,7 @@ import { EventBusService as y } from "../../../classes/services/EventBusService/
14
14
  import { t as b } from "../../../_chunks/CaseDbDownloadUtil.js";
15
15
  import { n as ne } from "../../../_chunks/LegendaItem.js";
16
16
  import { t as re } from "../../../_chunks/Dashboard.js";
17
- import { ConfigService as ie } from "@gen-epix/ui/classes/services/ConfigService";
17
+ import { ConfigService as ie } from "@gen-epix/ui-client-common/classes/services/ConfigService";
18
18
  import { ListItemIcon as ae, ListItemText as oe, MenuItem as se, useTheme as ce } from "@mui/material";
19
19
  import { use as x, useCallback as S, useEffect as C, useMemo as w, useRef as T, useState as E } from "react";
20
20
  import { useTranslation as le } from "react-i18next";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/HistogramWidget/HistogramWidget.tsx"],"sourcesContent":["import { Box } from '@mui/system';\nimport type { ReactElement } from 'react';\nimport {\n use,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { EChartsType } from 'echarts';\nimport {\n LegendComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport {\n dispose,\n getInstanceByDom,\n init,\n use as registerECharts,\n} from 'echarts/core';\nimport type { EChartsReactProps } from 'echarts-for-react';\nimport FilterAltIcon from '@mui/icons-material/FilterAlt';\nimport EChartsReact from 'echarts-for-react';\nimport type {\n CaseDbCol,\n CaseDbColType,\n} from '@gen-epix/api-casedb';\nimport type { MenuItemData } from '@gen-epix/ui/models/nestedMenu';\nimport { ConfigService } from '@gen-epix/ui/classes/services/ConfigService';\nimport { useStore } from 'zustand';\nimport { BarChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useTranslation } from 'react-i18next';\nimport round from 'lodash/round';\nimport {\n ListItemIcon,\n ListItemText,\n MenuItem,\n useTheme,\n} from '@mui/material';\nimport intersection from 'lodash/intersection';\n\nimport { DASHBOARD_COMPONENT_NAME } from '../../../constants/dashboard';\nimport type { ContextMenuConfigWithPosition } from '../ContextMenu';\nimport { ContextMenu } from '../ContextMenu';\nimport { DashboardWidget } from '../Dashboard';\nimport { WidgetUnavailable } from '../WidgetUnavailable';\nimport { DashboardStoreContext } from '../../../stores/dashboardStore';\nimport { DashboardUtil } from '../../../utils/DashboardUtil';\nimport { EventBusService } from '../../../classes/services/EventBusService';\nimport { CaseDbDownloadUtil } from '../../../utils/CaseDbDownloadUtil';\nimport type { HistogramWidgetData } from '../../../models/dashboard';\nimport {\n HISTOGRAM_ALLOWED_COL_TYPES,\n HistogramUtil,\n} from '../../../utils/HistogramUtil';\nimport { DashboardContext } from '../Dashboard/context/DashboardContext';\nimport { CaseUtil } from '../../../utils/CaseUtil';\n\nregisterECharts([TooltipComponent, BarChart, LegendComponent, CanvasRenderer]);\n\nconst echartsCore = {\n dispose,\n getInstanceByDom,\n init,\n};\n\nexport const HistogramWidget = () => {\n const { t } = useTranslation();\n const theme = useTheme();\n const chartRef = useRef<EChartsReact>(null);\n const chartInstanceRef = useRef<EChartsType | null>(null);\n const echartsOpts = useMemo(() => ({\n nonce: ConfigService.getInstance().config.nonce,\n }), []);\n const dashboardStore = use(DashboardStoreContext);\n const dashboardContext = use(DashboardContext);\n const completeCaseType = useStore(dashboardStore, (state) => state.completeCaseType);\n const sortedData = useStore(dashboardStore, (state) => state.sortedData);\n const setFilterValues = useStore(dashboardStore, (state) => state.setFilterValues);\n const updateWidgetData = useStore(dashboardStore, (state) => state.updateWidgetData);\n const histogramWidgetData = useStore(dashboardStore, (state) => state.getWidgetData<HistogramWidgetData>(DASHBOARD_COMPONENT_NAME.HISTOGRAM));\n const [focussedColValues, setFocussedColValues] = useState<{ a: string; b: string }>(null);\n\n const allowedColTypes = useMemo<CaseDbColType[]>(() => {\n return HISTOGRAM_ALLOWED_COL_TYPES;\n }, []);\n\n const allowedCols = useMemo(() => {\n return HistogramUtil.getAllowedCols(completeCaseType, allowedColTypes);\n }, [allowedColTypes, completeCaseType]);\n\n const [aCol, setACol] = useState<CaseDbCol | null>(histogramWidgetData.colAId ? completeCaseType?.cols[histogramWidgetData.colAId] ?? null : null);\n const [bCol, setBCol] = useState<CaseDbCol | null>(histogramWidgetData.colBId ? completeCaseType?.cols[histogramWidgetData.colBId] ?? null : null);\n\n const [contextMenuConfig, setContextMenuConfig] = useState<ContextMenuConfigWithPosition | null>(null);\n\n const onEpiContextMenuClose = useCallback(() => {\n setContextMenuConfig(null);\n setFocussedColValues(null);\n }, []);\n\n const lineListCaseCount = useMemo(() => {\n return DashboardUtil.getCaseCount(sortedData);\n }, [sortedData]);\n\n const defaultCols = useMemo(() => {\n return HistogramUtil.getDefaultCols(allowedCols, completeCaseType);\n }, [allowedCols, completeCaseType]);\n\n\n const canShowWidget = allowedCols.length > 1 && defaultCols?.newColA && defaultCols?.newColB;\n const shouldShowGraph = canShowWidget && aCol && bCol && lineListCaseCount > 0;\n\n const onMenuItemClick = useCallback((x: CaseDbCol, y: CaseDbCol) => {\n setACol(x);\n setBCol(y);\n updateWidgetData(DASHBOARD_COMPONENT_NAME.HISTOGRAM, {\n colAId: x.id,\n colBId: y.id,\n });\n }, [updateWidgetData]);\n\n\n useEffect(() => {\n if (aCol && bCol) {\n return;\n }\n if (!defaultCols) {\n return;\n }\n const { newColA, newColB } = defaultCols;\n\n setACol(newColA);\n setBCol(newColB);\n\n updateWidgetData(DASHBOARD_COMPONENT_NAME.HISTOGRAM, {\n colAId: newColA.id,\n colBId: newColB.id,\n });\n }, [aCol, allowedCols, bCol, completeCaseType, defaultCols, updateWidgetData]);\n\n const [conceptsA, conceptsB] = useMemo(() => {\n return HistogramUtil.getConcepts(aCol, bCol, completeCaseType);\n }, [aCol, bCol, completeCaseType]);\n\n const series = useMemo(() => {\n return HistogramUtil.getSeries(aCol, bCol, completeCaseType, sortedData, conceptsA, conceptsB);\n }, [aCol, bCol, completeCaseType, sortedData, conceptsA, conceptsB]);\n\n const histogramCaseCount = useMemo(() => {\n return HistogramUtil.getCaseCount(series);\n }, [series]);\n\n const missingCasesCount = lineListCaseCount - histogramCaseCount;\n const missingCasesPercentage = missingCasesCount > 0 ? round(missingCasesCount / lineListCaseCount * 100, 1) : 0;\n\n const widgetUnavailableReason = useMemo<ReactElement | string>(() => {\n if (shouldShowGraph) {\n return;\n }\n if (!defaultCols || allowedCols.length < 2) {\n return t`No two compatible columns found to display a histogram.`;\n }\n if (!lineListCaseCount) {\n return t`No cases found.`;\n }\n if (!histogramCaseCount) {\n return t`No cases found with valid values for the selected columns to display a histogram.`;\n }\n return null;\n }, [allowedCols.length, defaultCols, histogramCaseCount, lineListCaseCount, shouldShowGraph, t]);\n\n const colors = useMemo(() => {\n return HistogramUtil.getColors(aCol, completeCaseType, sortedData);\n }, [completeCaseType, aCol, sortedData]);\n\n const getOptions = useCallback(() => {\n if (!shouldShowGraph) {\n return null;\n }\n\n return HistogramUtil.getChartOptions({\n aCol,\n bCol,\n colors,\n conceptsA,\n conceptsB,\n series,\n t,\n theme,\n });\n }, [shouldShowGraph, colors, theme, conceptsB, series, conceptsA, aCol, bCol, t]);\n\n const titleMenu = useMemo<MenuItemData | string>(() => {\n let label: string;\n if (aCol && bCol) {\n label = t('Histogram: {{aColLabel}} and {{bColLabel}}', { aColLabel: aCol.label, bColLabel: bCol.label });\n } else {\n label = t`Histogram`;\n }\n\n if (!defaultCols?.newColA || !defaultCols?.newColB) {\n return label;\n }\n\n const mainMenu: MenuItemData = {\n disabled: !canShowWidget || allowedCols.length < 2,\n items: [],\n label,\n };\n\n\n allowedCols.forEach(x => {\n const subMenu: MenuItemData = {\n active: aCol?.id === x.id || undefined,\n items: [],\n label: t('Grouping: {{label}}', { label: x.label }),\n };\n allowedCols.forEach(y => {\n if (x.id === y.id) {\n return;\n }\n subMenu.items.push({\n active: (aCol?.id === x.id || undefined) && (bCol?.id === y.id || undefined),\n callback: () => {\n onMenuItemClick(x, y);\n },\n label: t('X-Axis: {{label}}', { label: y.label }),\n });\n });\n mainMenu.items.push(subMenu);\n });\n\n\n return mainMenu;\n }, [aCol, bCol, canShowWidget, allowedCols, defaultCols?.newColA, defaultCols?.newColB, t, onMenuItemClick]);\n\n const onChartReady = useCallback((chart: EChartsType) => {\n chartInstanceRef.current = chart;\n if (!aCol || !bCol) {\n return;\n }\n const dom = chart.getDom();\n dom?.setAttribute('aria-label', t('Histogram showing the number of cases for {{aColLabel}} and {{bColLabel}}', { aColLabel: aCol?.label, bColLabel: bCol?.label }));\n dom?.setAttribute('role', 'img');\n }, [aCol, bCol, t]);\n\n\n useEffect(() => {\n const emitDownloadOptions = () => {\n EventBusService.getInstance().emit('onDownloadOptionsChanged', {\n disabled: !canShowWidget,\n items: [\n {\n callback: () => CaseDbDownloadUtil.downloadEchartsImage(t`Histogram`, chartRef.current.getEchartsInstance(), 'png', completeCaseType, t),\n disabled: !shouldShowGraph,\n label: t`Save as PNG`,\n },\n {\n callback: () => CaseDbDownloadUtil.downloadEchartsImage(t`Histogram`, chartRef.current.getEchartsInstance(), 'jpeg', completeCaseType, t),\n disabled: !shouldShowGraph,\n label: t`Save as JPEG`,\n },\n ],\n zone: DASHBOARD_COMPONENT_NAME.HISTOGRAM,\n zoneLabel: t`Histogram`,\n });\n };\n emitDownloadOptions();\n const eventBusManager = EventBusService.getInstance();\n eventBusManager.addEventListener('onDownloadOptionsRequested', emitDownloadOptions);\n return () => {\n eventBusManager.emit('onDownloadOptionsChanged', {\n items: null,\n zone: DASHBOARD_COMPONENT_NAME.HISTOGRAM,\n zoneLabel: t`Histogram`,\n });\n eventBusManager.removeEventListener('onDownloadOptionsRequested', emitDownloadOptions);\n };\n }, [completeCaseType, shouldShowGraph, canShowWidget, t]);\n\n const highlight = useCallback((caseIds: string[]) => {\n dashboardContext.highlight({\n caseIds,\n origin: DASHBOARD_COMPONENT_NAME.HISTOGRAM,\n });\n }, [dashboardContext]);\n\n const onEvents = useMemo<EChartsReactProps['onEvents']>(() => {\n\n const getCaseIdsFromPayload = (payload: unknown): string[] => {\n const colValues = HistogramUtil.getColValuesFromPayload(payload, conceptsA, conceptsB);\n if (!colValues) {\n return [];\n }\n const caseIds = sortedData.filter(caseDbCase => {\n const aValue = CaseUtil.getRowValue(caseDbCase.content, aCol, completeCaseType);\n const bValue = CaseUtil.getRowValue(caseDbCase.content, bCol, completeCaseType);\n return colValues.a === aValue.raw && colValues.b === bValue.raw;\n }).map(caseDbCase => caseDbCase.id);\n return caseIds;\n };\n\n return {\n globalout: () => {\n highlight([]);\n },\n mouseout: () => {\n highlight([]);\n },\n mouseover: (payload: unknown) => {\n highlight(getCaseIdsFromPayload(payload));\n },\n mouseup: (payload: unknown) => {\n const { event } = payload as { event: { event: MouseEvent } };\n setFocussedColValues(HistogramUtil.getColValuesFromPayload(payload, conceptsA, conceptsB));\n setContextMenuConfig({\n caseIds: getCaseIdsFromPayload(payload),\n mouseEvent: event.event,\n position: {\n left: (event.event).clientX,\n top: (event.event).clientY,\n },\n });\n },\n };\n }, [aCol, bCol, completeCaseType, conceptsA, conceptsB, highlight, sortedData]);\n\n const onShowOnlyFocussedColValuesMenuItemClick = useCallback(async (onMenuClose: () => void) => {\n if (!focussedColValues || !aCol || !bCol) {\n return;\n }\n await setFilterValues({\n [aCol.id]: [focussedColValues.a],\n [bCol.id]: [focussedColValues.b],\n });\n\n onMenuClose();\n }, [aCol, bCol, focussedColValues, setFilterValues]);\n\n const getEpiContextMenuExtraItems = useCallback((onMenuClose: () => void): ReactElement => {\n const conceptALabel = conceptsA.find(concept => concept.id === focussedColValues?.a)?.name;\n const conceptBLabel = conceptsB.find(concept => concept.id === focussedColValues?.b)?.name;\n if (!conceptALabel || !conceptBLabel) {\n return null;\n }\n if (!focussedColValues) {\n return null;\n }\n return (\n <MenuItem\n divider\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={async () => await onShowOnlyFocussedColValuesMenuItemClick(onMenuClose)}\n >\n <ListItemIcon>\n <FilterAltIcon fontSize={'small'} />\n </ListItemIcon>\n <ListItemText>\n {t('Filter (show only {{conceptALabel}} and {{conceptBLabel}})', { conceptALabel, conceptBLabel })}\n </ListItemText>\n </MenuItem>\n );\n }, [conceptsA, conceptsB, focussedColValues, onShowOnlyFocussedColValuesMenuItemClick, t]);\n\n useEffect(() => {\n const unsubscribe = dashboardContext.highlightSubject.subscribe((highlighting) => {\n if (highlighting.origin === DASHBOARD_COMPONENT_NAME.HISTOGRAM) {\n return;\n }\n const instance = chartInstanceRef.current;\n if (!instance) {\n return;\n }\n\n if (!highlighting?.caseIds?.length) {\n instance.dispatchAction({\n type: 'downplay',\n });\n return;\n }\n\n const highlightTargetsByDataIndex = new Map<number, Set<number>>();\n series?.forEach((serie, serieIndex) => {\n const castedSerie = serie as { data: unknown[]; xCaseIds: string[][] };\n castedSerie.xCaseIds?.forEach((caseIds: string[], dataIndex: number) => {\n if (intersection(caseIds, highlighting.caseIds).length) {\n const seriesIndices = highlightTargetsByDataIndex.get(dataIndex) ?? new Set<number>();\n seriesIndices.add(serieIndex);\n highlightTargetsByDataIndex.set(dataIndex, seriesIndices);\n }\n });\n });\n\n instance.dispatchAction({\n type: 'downplay',\n });\n\n const highlightBatch: Array<{ dataIndex: number; notBlur?: boolean; seriesIndex?: number }> = [];\n highlightTargetsByDataIndex.forEach((seriesIndices, dataIndex) => {\n if (seriesIndices.size === series?.length) {\n highlightBatch.push({\n dataIndex,\n });\n return;\n }\n\n seriesIndices.forEach((seriesIndex) => {\n highlightBatch.push({\n dataIndex,\n seriesIndex,\n });\n });\n });\n\n highlightBatch.forEach((target, index) => {\n if (index > 0) {\n target.notBlur = true;\n }\n });\n\n instance.dispatchAction({\n batch: highlightBatch,\n type: 'highlight',\n });\n });\n\n return () => {\n unsubscribe();\n };\n }, [dashboardContext, series]);\n\n return (\n <DashboardWidget\n expandDisabled={!canShowWidget}\n title={titleMenu}\n warningMessage={canShowWidget && histogramCaseCount > 0 && missingCasesCount > 0 ? t('Missing cases: {{missingCasesCount}} ({{missingCasesPercentage}}%)', { missingCasesCount, missingCasesPercentage }) : undefined}\n widgetName={DASHBOARD_COMPONENT_NAME.HISTOGRAM}\n >\n {!canShowWidget && (\n <WidgetUnavailable\n reason={widgetUnavailableReason}\n widgetLabel={t`histogram`}\n />\n )}\n {canShowWidget && (\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n {shouldShowGraph && (\n <EChartsReact\n echarts={echartsCore}\n notMerge\n onChartReady={onChartReady}\n onEvents={onEvents}\n option={getOptions()}\n opts={echartsOpts as unknown}\n ref={chartRef}\n style={{\n height: '100%',\n position: 'absolute',\n width: '100%',\n }}\n />\n )}\n <ContextMenu\n config={contextMenuConfig}\n getExtraItems={getEpiContextMenuExtraItems}\n onMenuClose={onEpiContextMenuClose}\n />\n </Box>\n )}\n </DashboardWidget>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,EAAgB;CAAC;CAAkB;CAAU;CAAiB;AAAc,CAAC;AAE7E,IAAM,KAAc;CAClB;CACA;CACA;AACF,GAEa,UAAwB;CACnC,IAAM,EAAE,SAAM,GAAe,GACvB,IAAQ,GAAS,GACjB,IAAW,EAAqB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ACV,QAAQ,GAAW;IACnB,MAAM;IACN,KAAK;IACL,OAAO;KACL,QAAQ;KACR,UAAU;KACV,OAAO;IACT;GACD,CAAA,GAEH,kBAAC,IAAD;IACE,QAAQ;IACR,eAAe;IACf,aAAa;GACd,CAAA,CACE;IAEQ;;AAErB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/ui/HistogramWidget/HistogramWidget.tsx"],"sourcesContent":["import { Box } from '@mui/system';\nimport type { ReactElement } from 'react';\nimport {\n use,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport type { EChartsType } from 'echarts';\nimport {\n LegendComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport {\n dispose,\n getInstanceByDom,\n init,\n use as registerECharts,\n} from 'echarts/core';\nimport type { EChartsReactProps } from 'echarts-for-react';\nimport FilterAltIcon from '@mui/icons-material/FilterAlt';\nimport EChartsReact from 'echarts-for-react';\nimport type {\n CaseDbCol,\n CaseDbColType,\n} from '@gen-epix/api-casedb';\nimport type { MenuItemData } from '@gen-epix/ui-core-components/models/nestedMenu';\nimport { ConfigService } from '@gen-epix/ui-client-common/classes/services/ConfigService';\nimport { useStore } from 'zustand';\nimport { BarChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport { useTranslation } from 'react-i18next';\nimport round from 'lodash/round';\nimport {\n ListItemIcon,\n ListItemText,\n MenuItem,\n useTheme,\n} from '@mui/material';\nimport intersection from 'lodash/intersection';\n\nimport { DASHBOARD_COMPONENT_NAME } from '../../../constants/dashboard';\nimport type { ContextMenuConfigWithPosition } from '../ContextMenu';\nimport { ContextMenu } from '../ContextMenu';\nimport { DashboardWidget } from '../Dashboard';\nimport { WidgetUnavailable } from '../WidgetUnavailable';\nimport { DashboardStoreContext } from '../../../stores/dashboardStore';\nimport { DashboardUtil } from '../../../utils/DashboardUtil';\nimport { EventBusService } from '../../../classes/services/EventBusService';\nimport { CaseDbDownloadUtil } from '../../../utils/CaseDbDownloadUtil';\nimport type { HistogramWidgetData } from '../../../models/dashboard';\nimport {\n HISTOGRAM_ALLOWED_COL_TYPES,\n HistogramUtil,\n} from '../../../utils/HistogramUtil';\nimport { DashboardContext } from '../Dashboard/context/DashboardContext';\nimport { CaseUtil } from '../../../utils/CaseUtil';\n\nregisterECharts([TooltipComponent, BarChart, LegendComponent, CanvasRenderer]);\n\nconst echartsCore = {\n dispose,\n getInstanceByDom,\n init,\n};\n\nexport const HistogramWidget = () => {\n const { t } = useTranslation();\n const theme = useTheme();\n const chartRef = useRef<EChartsReact>(null);\n const chartInstanceRef = useRef<EChartsType | null>(null);\n const echartsOpts = useMemo(() => ({\n nonce: ConfigService.getInstance().config.nonce,\n }), []);\n const dashboardStore = use(DashboardStoreContext);\n const dashboardContext = use(DashboardContext);\n const completeCaseType = useStore(dashboardStore, (state) => state.completeCaseType);\n const sortedData = useStore(dashboardStore, (state) => state.sortedData);\n const setFilterValues = useStore(dashboardStore, (state) => state.setFilterValues);\n const updateWidgetData = useStore(dashboardStore, (state) => state.updateWidgetData);\n const histogramWidgetData = useStore(dashboardStore, (state) => state.getWidgetData<HistogramWidgetData>(DASHBOARD_COMPONENT_NAME.HISTOGRAM));\n const [focussedColValues, setFocussedColValues] = useState<{ a: string; b: string }>(null);\n\n const allowedColTypes = useMemo<CaseDbColType[]>(() => {\n return HISTOGRAM_ALLOWED_COL_TYPES;\n }, []);\n\n const allowedCols = useMemo(() => {\n return HistogramUtil.getAllowedCols(completeCaseType, allowedColTypes);\n }, [allowedColTypes, completeCaseType]);\n\n const [aCol, setACol] = useState<CaseDbCol | null>(histogramWidgetData.colAId ? completeCaseType?.cols[histogramWidgetData.colAId] ?? null : null);\n const [bCol, setBCol] = useState<CaseDbCol | null>(histogramWidgetData.colBId ? completeCaseType?.cols[histogramWidgetData.colBId] ?? null : null);\n\n const [contextMenuConfig, setContextMenuConfig] = useState<ContextMenuConfigWithPosition | null>(null);\n\n const onEpiContextMenuClose = useCallback(() => {\n setContextMenuConfig(null);\n setFocussedColValues(null);\n }, []);\n\n const lineListCaseCount = useMemo(() => {\n return DashboardUtil.getCaseCount(sortedData);\n }, [sortedData]);\n\n const defaultCols = useMemo(() => {\n return HistogramUtil.getDefaultCols(allowedCols, completeCaseType);\n }, [allowedCols, completeCaseType]);\n\n\n const canShowWidget = allowedCols.length > 1 && defaultCols?.newColA && defaultCols?.newColB;\n const shouldShowGraph = canShowWidget && aCol && bCol && lineListCaseCount > 0;\n\n const onMenuItemClick = useCallback((x: CaseDbCol, y: CaseDbCol) => {\n setACol(x);\n setBCol(y);\n updateWidgetData(DASHBOARD_COMPONENT_NAME.HISTOGRAM, {\n colAId: x.id,\n colBId: y.id,\n });\n }, [updateWidgetData]);\n\n\n useEffect(() => {\n if (aCol && bCol) {\n return;\n }\n if (!defaultCols) {\n return;\n }\n const { newColA, newColB } = defaultCols;\n\n setACol(newColA);\n setBCol(newColB);\n\n updateWidgetData(DASHBOARD_COMPONENT_NAME.HISTOGRAM, {\n colAId: newColA.id,\n colBId: newColB.id,\n });\n }, [aCol, allowedCols, bCol, completeCaseType, defaultCols, updateWidgetData]);\n\n const [conceptsA, conceptsB] = useMemo(() => {\n return HistogramUtil.getConcepts(aCol, bCol, completeCaseType);\n }, [aCol, bCol, completeCaseType]);\n\n const series = useMemo(() => {\n return HistogramUtil.getSeries(aCol, bCol, completeCaseType, sortedData, conceptsA, conceptsB);\n }, [aCol, bCol, completeCaseType, sortedData, conceptsA, conceptsB]);\n\n const histogramCaseCount = useMemo(() => {\n return HistogramUtil.getCaseCount(series);\n }, [series]);\n\n const missingCasesCount = lineListCaseCount - histogramCaseCount;\n const missingCasesPercentage = missingCasesCount > 0 ? round(missingCasesCount / lineListCaseCount * 100, 1) : 0;\n\n const widgetUnavailableReason = useMemo<ReactElement | string>(() => {\n if (shouldShowGraph) {\n return;\n }\n if (!defaultCols || allowedCols.length < 2) {\n return t`No two compatible columns found to display a histogram.`;\n }\n if (!lineListCaseCount) {\n return t`No cases found.`;\n }\n if (!histogramCaseCount) {\n return t`No cases found with valid values for the selected columns to display a histogram.`;\n }\n return null;\n }, [allowedCols.length, defaultCols, histogramCaseCount, lineListCaseCount, shouldShowGraph, t]);\n\n const colors = useMemo(() => {\n return HistogramUtil.getColors(aCol, completeCaseType, sortedData);\n }, [completeCaseType, aCol, sortedData]);\n\n const getOptions = useCallback(() => {\n if (!shouldShowGraph) {\n return null;\n }\n\n return HistogramUtil.getChartOptions({\n aCol,\n bCol,\n colors,\n conceptsA,\n conceptsB,\n series,\n t,\n theme,\n });\n }, [shouldShowGraph, colors, theme, conceptsB, series, conceptsA, aCol, bCol, t]);\n\n const titleMenu = useMemo<MenuItemData | string>(() => {\n let label: string;\n if (aCol && bCol) {\n label = t('Histogram: {{aColLabel}} and {{bColLabel}}', { aColLabel: aCol.label, bColLabel: bCol.label });\n } else {\n label = t`Histogram`;\n }\n\n if (!defaultCols?.newColA || !defaultCols?.newColB) {\n return label;\n }\n\n const mainMenu: MenuItemData = {\n disabled: !canShowWidget || allowedCols.length < 2,\n items: [],\n label,\n };\n\n\n allowedCols.forEach(x => {\n const subMenu: MenuItemData = {\n active: aCol?.id === x.id || undefined,\n items: [],\n label: t('Grouping: {{label}}', { label: x.label }),\n };\n allowedCols.forEach(y => {\n if (x.id === y.id) {\n return;\n }\n subMenu.items.push({\n active: (aCol?.id === x.id || undefined) && (bCol?.id === y.id || undefined),\n callback: () => {\n onMenuItemClick(x, y);\n },\n label: t('X-Axis: {{label}}', { label: y.label }),\n });\n });\n mainMenu.items.push(subMenu);\n });\n\n\n return mainMenu;\n }, [aCol, bCol, canShowWidget, allowedCols, defaultCols?.newColA, defaultCols?.newColB, t, onMenuItemClick]);\n\n const onChartReady = useCallback((chart: EChartsType) => {\n chartInstanceRef.current = chart;\n if (!aCol || !bCol) {\n return;\n }\n const dom = chart.getDom();\n dom?.setAttribute('aria-label', t('Histogram showing the number of cases for {{aColLabel}} and {{bColLabel}}', { aColLabel: aCol?.label, bColLabel: bCol?.label }));\n dom?.setAttribute('role', 'img');\n }, [aCol, bCol, t]);\n\n\n useEffect(() => {\n const emitDownloadOptions = () => {\n EventBusService.getInstance().emit('onDownloadOptionsChanged', {\n disabled: !canShowWidget,\n items: [\n {\n callback: () => CaseDbDownloadUtil.downloadEchartsImage(t`Histogram`, chartRef.current.getEchartsInstance(), 'png', completeCaseType, t),\n disabled: !shouldShowGraph,\n label: t`Save as PNG`,\n },\n {\n callback: () => CaseDbDownloadUtil.downloadEchartsImage(t`Histogram`, chartRef.current.getEchartsInstance(), 'jpeg', completeCaseType, t),\n disabled: !shouldShowGraph,\n label: t`Save as JPEG`,\n },\n ],\n zone: DASHBOARD_COMPONENT_NAME.HISTOGRAM,\n zoneLabel: t`Histogram`,\n });\n };\n emitDownloadOptions();\n const eventBusManager = EventBusService.getInstance();\n eventBusManager.addEventListener('onDownloadOptionsRequested', emitDownloadOptions);\n return () => {\n eventBusManager.emit('onDownloadOptionsChanged', {\n items: null,\n zone: DASHBOARD_COMPONENT_NAME.HISTOGRAM,\n zoneLabel: t`Histogram`,\n });\n eventBusManager.removeEventListener('onDownloadOptionsRequested', emitDownloadOptions);\n };\n }, [completeCaseType, shouldShowGraph, canShowWidget, t]);\n\n const highlight = useCallback((caseIds: string[]) => {\n dashboardContext.highlight({\n caseIds,\n origin: DASHBOARD_COMPONENT_NAME.HISTOGRAM,\n });\n }, [dashboardContext]);\n\n const onEvents = useMemo<EChartsReactProps['onEvents']>(() => {\n\n const getCaseIdsFromPayload = (payload: unknown): string[] => {\n const colValues = HistogramUtil.getColValuesFromPayload(payload, conceptsA, conceptsB);\n if (!colValues) {\n return [];\n }\n const caseIds = sortedData.filter(caseDbCase => {\n const aValue = CaseUtil.getRowValue(caseDbCase.content, aCol, completeCaseType);\n const bValue = CaseUtil.getRowValue(caseDbCase.content, bCol, completeCaseType);\n return colValues.a === aValue.raw && colValues.b === bValue.raw;\n }).map(caseDbCase => caseDbCase.id);\n return caseIds;\n };\n\n return {\n globalout: () => {\n highlight([]);\n },\n mouseout: () => {\n highlight([]);\n },\n mouseover: (payload: unknown) => {\n highlight(getCaseIdsFromPayload(payload));\n },\n mouseup: (payload: unknown) => {\n const { event } = payload as { event: { event: MouseEvent } };\n setFocussedColValues(HistogramUtil.getColValuesFromPayload(payload, conceptsA, conceptsB));\n setContextMenuConfig({\n caseIds: getCaseIdsFromPayload(payload),\n mouseEvent: event.event,\n position: {\n left: (event.event).clientX,\n top: (event.event).clientY,\n },\n });\n },\n };\n }, [aCol, bCol, completeCaseType, conceptsA, conceptsB, highlight, sortedData]);\n\n const onShowOnlyFocussedColValuesMenuItemClick = useCallback(async (onMenuClose: () => void) => {\n if (!focussedColValues || !aCol || !bCol) {\n return;\n }\n await setFilterValues({\n [aCol.id]: [focussedColValues.a],\n [bCol.id]: [focussedColValues.b],\n });\n\n onMenuClose();\n }, [aCol, bCol, focussedColValues, setFilterValues]);\n\n const getEpiContextMenuExtraItems = useCallback((onMenuClose: () => void): ReactElement => {\n const conceptALabel = conceptsA.find(concept => concept.id === focussedColValues?.a)?.name;\n const conceptBLabel = conceptsB.find(concept => concept.id === focussedColValues?.b)?.name;\n if (!conceptALabel || !conceptBLabel) {\n return null;\n }\n if (!focussedColValues) {\n return null;\n }\n return (\n <MenuItem\n divider\n // eslint-disable-next-line @eslint-react/kit/jsx-no-bind\n onClick={async () => await onShowOnlyFocussedColValuesMenuItemClick(onMenuClose)}\n >\n <ListItemIcon>\n <FilterAltIcon fontSize={'small'} />\n </ListItemIcon>\n <ListItemText>\n {t('Filter (show only {{conceptALabel}} and {{conceptBLabel}})', { conceptALabel, conceptBLabel })}\n </ListItemText>\n </MenuItem>\n );\n }, [conceptsA, conceptsB, focussedColValues, onShowOnlyFocussedColValuesMenuItemClick, t]);\n\n useEffect(() => {\n const unsubscribe = dashboardContext.highlightSubject.subscribe((highlighting) => {\n if (highlighting.origin === DASHBOARD_COMPONENT_NAME.HISTOGRAM) {\n return;\n }\n const instance = chartInstanceRef.current;\n if (!instance) {\n return;\n }\n\n if (!highlighting?.caseIds?.length) {\n instance.dispatchAction({\n type: 'downplay',\n });\n return;\n }\n\n const highlightTargetsByDataIndex = new Map<number, Set<number>>();\n series?.forEach((serie, serieIndex) => {\n const castedSerie = serie as { data: unknown[]; xCaseIds: string[][] };\n castedSerie.xCaseIds?.forEach((caseIds: string[], dataIndex: number) => {\n if (intersection(caseIds, highlighting.caseIds).length) {\n const seriesIndices = highlightTargetsByDataIndex.get(dataIndex) ?? new Set<number>();\n seriesIndices.add(serieIndex);\n highlightTargetsByDataIndex.set(dataIndex, seriesIndices);\n }\n });\n });\n\n instance.dispatchAction({\n type: 'downplay',\n });\n\n const highlightBatch: Array<{ dataIndex: number; notBlur?: boolean; seriesIndex?: number }> = [];\n highlightTargetsByDataIndex.forEach((seriesIndices, dataIndex) => {\n if (seriesIndices.size === series?.length) {\n highlightBatch.push({\n dataIndex,\n });\n return;\n }\n\n seriesIndices.forEach((seriesIndex) => {\n highlightBatch.push({\n dataIndex,\n seriesIndex,\n });\n });\n });\n\n highlightBatch.forEach((target, index) => {\n if (index > 0) {\n target.notBlur = true;\n }\n });\n\n instance.dispatchAction({\n batch: highlightBatch,\n type: 'highlight',\n });\n });\n\n return () => {\n unsubscribe();\n };\n }, [dashboardContext, series]);\n\n return (\n <DashboardWidget\n expandDisabled={!canShowWidget}\n title={titleMenu}\n warningMessage={canShowWidget && histogramCaseCount > 0 && missingCasesCount > 0 ? t('Missing cases: {{missingCasesCount}} ({{missingCasesPercentage}}%)', { missingCasesCount, missingCasesPercentage }) : undefined}\n widgetName={DASHBOARD_COMPONENT_NAME.HISTOGRAM}\n >\n {!canShowWidget && (\n <WidgetUnavailable\n reason={widgetUnavailableReason}\n widgetLabel={t`histogram`}\n />\n )}\n {canShowWidget && (\n <Box\n sx={{\n height: '100%',\n position: 'relative',\n }}\n >\n {shouldShowGraph && (\n <EChartsReact\n echarts={echartsCore}\n notMerge\n onChartReady={onChartReady}\n onEvents={onEvents}\n option={getOptions()}\n opts={echartsOpts as unknown}\n ref={chartRef}\n style={{\n height: '100%',\n position: 'absolute',\n width: '100%',\n }}\n />\n )}\n <ContextMenu\n config={contextMenuConfig}\n getExtraItems={getEpiContextMenuExtraItems}\n onMenuClose={onEpiContextMenuClose}\n />\n </Box>\n )}\n </DashboardWidget>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,EAAgB;CAAC;CAAkB;CAAU;CAAiB;AAAc,CAAC;AAE7E,IAAM,KAAc;CAClB;CACA;CACA;AACF,GAEa,UAAwB;CACnC,IAAM,EAAE,SAAM,GAAe,GACvB,IAAQ,GAAS,GACjB,IAAW,EAAqB,IAAI,GACpC,IAAmB,EAA2B,IAAI,GAClD,IAAc,SAAe,EACjC,OAAO,GAAc,YAAY,CAAC,CAAC,OAAO,MAC5C,IAAI,CAAC,CAAC,GACA,IAAiB,EAAI,EAAqB,GAC1C,IAAmB,EAAI,EAAgB,GACvC,IAAmB,EAAS,IAAiB,MAAU,EAAM,gBAAgB,GAC7E,IAAa,EAAS,IAAiB,MAAU,EAAM,UAAU,GACjE,IAAkB,EAAS,IAAiB,MAAU,EAAM,eAAe,GAC3E,IAAmB,EAAS,IAAiB,MAAU,EAAM,gBAAgB,GAC7E,IAAsB,EAAS,IAAiB,MAAU,EAAM,cAAmC,EAAyB,SAAS,CAAC,GACtI,CAAC,GAAmB,KAAwB,EAAmC,IAAI,GAEnF,IAAkB,QACf,GACN,CAAC,CAAC,GAEC,IAAc,QACX,EAAc,eAAe,GAAkB,CAAe,GACpE,CAAC,GAAiB,CAAgB,CAAC,GAEhC,CAAC,GAAM,KAAW,EAA2B,EAAoB,SAAS,GAAkB,KAAK,EAAoB,WAAW,OAAO,IAAI,GAC3I,CAAC,GAAM,KAAW,EAA2B,EAAoB,SAAS,GAAkB,KAAK,EAAoB,WAAW,OAAO,IAAI,GAE3I,CAAC,GAAmB,KAAwB,EAA+C,IAAI,GAE/F,KAAwB,QAAkB;EAE9C,AADA,EAAqB,IA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ACF,GAAG,CAAC,GAAkB,CAAM,CAAC,GAG3B,kBAAC,IAAD;EACE,gBAAgB,CAAC;EACjB,OAAO;EACP,gBAAgB,KAAiB,IAAqB,KAAK,IAAoB,IAAI,EAAE,sEAAsE;GAAE;GAAmB;EAAuB,CAAC,IAAI,KAAA;EAC5M,YAAY,EAAyB;EAJvC,UAAA,CAMG,CAAC,KACA,kBAAC,GAAD;GACE,QAAQ;GACR,aAAa,CAAC;EACf,CAAA,GAEF,KACC,kBAAC,IAAD;GACE,IAAI;IACF,QAAQ;IACR,UAAU;GACZ;GAJF,UAAA,CAMG,KACC,kBAAC,GAAD;IACE,SAAS;IACT,UAAA;IACc;IACJ;IACV,QAAQ,GAAW;IACnB,MAAM;IACN,KAAK;IACL,OAAO;KACL,QAAQ;KACR,UAAU;KACV,OAAO;IACT;GACD,CAAA,GAEH,kBAAC,IAAD;IACE,QAAQ;IACR,eAAe;IACf,aAAa;GACd,CAAA,CACE;EAEQ,CAAA,CAAA;;AAErB"}
@@ -18,13 +18,13 @@ import { t as b } from "../../../_chunks/CaseDbDownloadUtil.js";
18
18
  import { n as oe } from "../../../_chunks/LegendaItem.js";
19
19
  import { t as se } from "../../../_chunks/Dashboard.js";
20
20
  import { CaseDbDimType as x, CaseDbGeoApi as ce } from "@gen-epix/api-casedb";
21
- import { QueryClientService as le } from "@gen-epix/ui/classes/services/QueryClientService";
21
+ import { QueryClientService as le } from "@gen-epix/ui-client-common/classes/services/QueryClientService";
22
22
  import { Box as ue, ListItemIcon as de, ListItemText as fe, MenuItem as pe, useTheme as me } from "@mui/material";
23
23
  import { use as S, useCallback as C, useEffect as w, useMemo as T, useRef as E, useState as D } from "react";
24
24
  import { useTranslation as he } from "react-i18next";
25
25
  import ge from "@mui/icons-material/FilterAlt";
26
26
  import { jsx as O, jsxs as k } from "react/jsx-runtime";
27
- import { useQueryMemo as _e } from "@gen-epix/ui/hooks/useQueryMemo";
27
+ import { useQueryMemo as _e } from "@gen-epix/ui-client-common/hooks/useQueryMemo";
28
28
  import { useDimensions as ve } from "@gen-epix/ui-core/hooks/useDimensions";
29
29
  //#region src/components/ui/MapWidget/MapWidget.tsx
30
30
  var ye = /* @__PURE__ */ e(t(), 1), be = /* @__PURE__ */ e(o(), 1), xe = {
@@ -68,7 +68,11 @@ var A = () => {
68
68
  return i.getInstance().data.regionsByRegionSetId[e];
69
69
  }, [o, I.ref_cols]), U = T(() => ee.getCaseCount(M), [M]), Te = C(() => {
70
70
  f(null), R(null);
71
- }, []), Ee = we || Se, De = Ce, W = T(() => !o || !V ? null : V[I.ref_cols[o.ref_col_id].region_set_id], [
71
+ }, []), Ee = we || Se, De = Ce, W = T(() => {
72
+ if (!o || !V) return null;
73
+ let e = I.ref_cols[o.ref_col_id].region_set_id;
74
+ return V[e];
75
+ }, [
72
76
  o,
73
77
  I.ref_cols,
74
78
  V