synapse-react-client 4.0.44 → 4.0.46

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 (415) hide show
  1. package/dist/SWC.index.d.ts +1 -1
  2. package/dist/SWC.index.js +2 -2
  3. package/dist/SWC.index.js.map +1 -1
  4. package/dist/aridhia-queries/AridhiaKeyFactory.d.ts +1 -0
  5. package/dist/aridhia-queries/AridhiaKeyFactory.d.ts.map +1 -1
  6. package/dist/aridhia-queries/AridhiaKeyFactory.js +3 -0
  7. package/dist/aridhia-queries/AridhiaKeyFactory.js.map +1 -1
  8. package/dist/aridhia-queries/aridhiaTokenExchange.js +6 -6
  9. package/dist/aridhia-queries/index.d.ts +1 -0
  10. package/dist/aridhia-queries/index.d.ts.map +1 -1
  11. package/dist/aridhia-queries/index.js +11 -10
  12. package/dist/aridhia-queries/useGetAridhiaVocabularyTerm.d.ts +19 -0
  13. package/dist/aridhia-queries/useGetAridhiaVocabularyTerm.d.ts.map +1 -0
  14. package/dist/aridhia-queries/useGetAridhiaVocabularyTerm.js +14 -0
  15. package/dist/aridhia-queries/useGetAridhiaVocabularyTerm.js.map +1 -0
  16. package/dist/components/AccessRequirementList/AccessApprovalCheckMark.d.ts.map +1 -1
  17. package/dist/components/AccessRequirementList/AccessApprovalCheckMark.js +6 -4
  18. package/dist/components/AccessRequirementList/AccessApprovalCheckMark.js.map +1 -1
  19. package/dist/components/AccessRequirementList/AccessRequirementList.d.ts +2 -1
  20. package/dist/components/AccessRequirementList/AccessRequirementList.d.ts.map +1 -1
  21. package/dist/components/AccessRequirementList/AccessRequirementList.js +126 -125
  22. package/dist/components/AccessRequirementList/AccessRequirementList.js.map +1 -1
  23. package/dist/components/AccessRequirementList/AccessRequirementListItem.d.ts +1 -1
  24. package/dist/components/AccessRequirementList/AccessRequirementListItem.d.ts.map +1 -1
  25. package/dist/components/AccessRequirementList/AccessRequirementListItem.js.map +1 -1
  26. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.js +1 -1
  27. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/AccessorRequirementHelpText.js.map +1 -1
  28. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.d.ts.map +1 -1
  29. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js +28 -16
  30. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/EDucPreviewStep/EDucPreviewStep.js.map +1 -1
  31. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.d.ts.map +1 -1
  32. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.js +99 -97
  33. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManualUploadDucStep/ManualUploadDucStep.js.map +1 -1
  34. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js +1 -1
  35. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.js.map +1 -1
  36. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewCollaboratorsAndSigningOfficialAccordion.js +1 -1
  37. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ReviewCollaboratorsAndSigningOfficialAccordion.js.map +1 -1
  38. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.d.ts.map +1 -1
  39. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.js +11 -8
  40. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/SignatureStatusStep/SignatureStatusStep.js.map +1 -1
  41. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.d.ts +1 -1
  42. package/dist/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/requestFlowTypes.d.ts.map +1 -1
  43. package/dist/components/AccessRequirementList/RequestDataStep.d.ts +1 -4
  44. package/dist/components/AccessRequirementList/RequestDataStep.d.ts.map +1 -1
  45. package/dist/components/AccessRequirementList/RequestDataStep.js +15 -18
  46. package/dist/components/AccessRequirementList/RequestDataStep.js.map +1 -1
  47. package/dist/components/AccessTokenPage/AccessTokenPage.js +1 -1
  48. package/dist/components/AccessTokenPage/AccessTokenPage.js.map +1 -1
  49. package/dist/components/AcknowledgementsPage/AcknowledgementsPage.js +1 -1
  50. package/dist/components/AcknowledgementsPage/AcknowledgementsPage.js.map +1 -1
  51. package/dist/components/Aridhia/DarWizard/DarSectionForm.d.ts.map +1 -1
  52. package/dist/components/Aridhia/DarWizard/DarSectionForm.js +17 -13
  53. package/dist/components/Aridhia/DarWizard/DarSectionForm.js.map +1 -1
  54. package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.d.ts +3 -3
  55. package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.d.ts.map +1 -1
  56. package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js +33 -34
  57. package/dist/components/Aridhia/DarWizard/DarSubmittedPanel.js.map +1 -1
  58. package/dist/components/Aridhia/fairFormToRjsf.js +1 -1
  59. package/dist/components/Aridhia/fairFormToRjsf.js.map +1 -1
  60. package/dist/components/Authentication/LastLoginInfo.js +1 -1
  61. package/dist/components/Authentication/LastLoginInfo.js.map +1 -1
  62. package/dist/components/CertificationQuiz/CertificationQuiz.js +1 -1
  63. package/dist/components/CertificationQuiz/CertificationQuiz.js.map +1 -1
  64. package/dist/components/ChallengeSubmission/AvailableEvaluationQueueList.js +1 -1
  65. package/dist/components/ChallengeSubmission/AvailableEvaluationQueueList.js.map +1 -1
  66. package/dist/components/ChallengeSubmission/EvaluationQueueCurrentRoundInfo.js +1 -1
  67. package/dist/components/ChallengeSubmission/EvaluationQueueCurrentRoundInfo.js.map +1 -1
  68. package/dist/components/ChallengeSubmission/SubmissionDirectoryList.js +6 -6
  69. package/dist/components/ChallengeSubmission/SubmissionDirectoryList.js.map +1 -1
  70. package/dist/components/ChallengeTeamWizard/ChallengeTeamTable.d.ts.map +1 -1
  71. package/dist/components/ChallengeTeamWizard/ChallengeTeamTable.js +4 -4
  72. package/dist/components/ChallengeTeamWizard/ChallengeTeamTable.js.map +1 -1
  73. package/dist/components/ChallengeTeamWizard/SelectChallengeTeam.js +4 -4
  74. package/dist/components/CitationPopover/CitationPopoverContent.js +4 -4
  75. package/dist/components/CitationPopover/CitationPopoverContent.js.map +1 -1
  76. package/dist/components/ComponentCollapse.d.ts.map +1 -1
  77. package/dist/components/ComponentCollapse.js +2 -1
  78. package/dist/components/ComponentCollapse.js.map +1 -1
  79. package/dist/components/CreateOrUpdateAccessRequirementWizard/CreateOrUpdateAccessRequirementWizard.d.ts.map +1 -1
  80. package/dist/components/CreateOrUpdateAccessRequirementWizard/CreateOrUpdateAccessRequirementWizard.js +52 -49
  81. package/dist/components/CreateOrUpdateAccessRequirementWizard/CreateOrUpdateAccessRequirementWizard.js.map +1 -1
  82. package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
  83. package/dist/components/DataGrid/SynapseGrid.js +231 -219
  84. package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
  85. package/dist/components/DataGrid/SyncGridWithSourceButton.d.ts.map +1 -1
  86. package/dist/components/DataGrid/SyncGridWithSourceButton.js +5 -4
  87. package/dist/components/DataGrid/SyncGridWithSourceButton.js.map +1 -1
  88. package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.d.ts.map +1 -1
  89. package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js +7 -5
  90. package/dist/components/DataGrid/components/ColumnHeaderWithTooltip.js.map +1 -1
  91. package/dist/components/DataGrid/components/ExportCsvFromGridButton.js +4 -4
  92. package/dist/components/DataGrid/components/ExportCsvFromGridButton.js.map +1 -1
  93. package/dist/components/DataGrid/components/ReorderColumnsButton.js +4 -4
  94. package/dist/components/DataGrid/components/ReorderColumnsButton.js.map +1 -1
  95. package/dist/components/DataGrid/components/ReorderColumnsDialog.d.ts.map +1 -1
  96. package/dist/components/DataGrid/components/ReorderColumnsDialog.js +12 -8
  97. package/dist/components/DataGrid/components/ReorderColumnsDialog.js.map +1 -1
  98. package/dist/components/DataGrid/components/UploadCsvToGridButton.js +1 -1
  99. package/dist/components/DataGrid/components/UploadCsvToGridButton.js.map +1 -1
  100. package/dist/components/DataGrid/hooks/useGridUndoRedo.js +5 -5
  101. package/dist/components/DataGrid/utils/applyModelChange.d.ts.map +1 -1
  102. package/dist/components/DataGrid/utils/applyModelChange.js +14 -14
  103. package/dist/components/DataGrid/utils/applyModelChange.js.map +1 -1
  104. package/dist/components/DataGrid/utils/columnFactory.js +1 -1
  105. package/dist/components/DataGrid/utils/columnFactory.js.map +1 -1
  106. package/dist/components/DataGrid/utils/splitPatch.d.ts.map +1 -1
  107. package/dist/components/DataGrid/utils/splitPatch.js +22 -13
  108. package/dist/components/DataGrid/utils/splitPatch.js.map +1 -1
  109. package/dist/components/DownloadCart/DownloadCartPage.js +1 -1
  110. package/dist/components/DownloadCart/DownloadCartPage.js.map +1 -1
  111. package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.d.ts.map +1 -1
  112. package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.js +2 -1
  113. package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.js.map +1 -1
  114. package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.js.map +1 -1
  115. package/dist/components/DownloadCart/DownloadIneligibleForPackagingFilesFromListButton.module.scss +1 -3
  116. package/dist/components/EntityBadgeIcons/EntityBadgeIcons.d.ts.map +1 -1
  117. package/dist/components/EntityBadgeIcons/EntityBadgeIcons.js +16 -10
  118. package/dist/components/EntityBadgeIcons/EntityBadgeIcons.js.map +1 -1
  119. package/dist/components/EntityDownloadButton/EntityDownloadButton.js +1 -1
  120. package/dist/components/EntityDownloadButton/EntityDownloadButton.js.map +1 -1
  121. package/dist/components/EntityFinder/EntityFinder.js +4 -4
  122. package/dist/components/EntityFinder/EntityIdTextField.js +1 -1
  123. package/dist/components/EntityFinder/EntityIdTextField.js.map +1 -1
  124. package/dist/components/EntityFinder/tree/VirtualizedTree.d.ts.map +1 -1
  125. package/dist/components/EntityFinder/tree/VirtualizedTree.js +5 -4
  126. package/dist/components/EntityFinder/tree/VirtualizedTree.js.map +1 -1
  127. package/dist/components/EntityHeaderTable/EntityHeaderTable.js +1 -1
  128. package/dist/components/EntityHeaderTable/EntityHeaderTable.js.map +1 -1
  129. package/dist/components/EntityTreeTable/components/EntityNameCell.d.ts.map +1 -1
  130. package/dist/components/EntityTreeTable/components/EntityNameCell.js +2 -1
  131. package/dist/components/EntityTreeTable/components/EntityNameCell.js.map +1 -1
  132. package/dist/components/EntityUpload/FileUploadProgress.d.ts.map +1 -1
  133. package/dist/components/EntityUpload/FileUploadProgress.js +11 -7
  134. package/dist/components/EntityUpload/FileUploadProgress.js.map +1 -1
  135. package/dist/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.d.ts.map +1 -1
  136. package/dist/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.js +4 -3
  137. package/dist/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.js.map +1 -1
  138. package/dist/components/ExperimentalMode/ExperimentalMode.js +1 -1
  139. package/dist/components/ExperimentalMode/ExperimentalMode.js.map +1 -1
  140. package/dist/components/ExternalFileHandleLink/ExternalFileHandleLink.js +1 -1
  141. package/dist/components/ExternalFileHandleLink/ExternalFileHandleLink.js.map +1 -1
  142. package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.d.ts.map +1 -1
  143. package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js +2 -1
  144. package/dist/components/FormTemplateEditor/ChoiceOptionsEditor.js.map +1 -1
  145. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.d.ts.map +1 -1
  146. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js +2 -1
  147. package/dist/components/FormTemplateEditor/FieldDefinitionDrawer.js.map +1 -1
  148. package/dist/components/FormTemplateEditor/FieldLibrary.d.ts.map +1 -1
  149. package/dist/components/FormTemplateEditor/FieldLibrary.js +2 -1
  150. package/dist/components/FormTemplateEditor/FieldLibrary.js.map +1 -1
  151. package/dist/components/FormTemplateEditor/FieldLibraryRow.js +4 -4
  152. package/dist/components/FormTemplateEditor/FieldLibraryRow.js.map +1 -1
  153. package/dist/components/FormTemplateEditor/FormStructurePanel.js +1 -1
  154. package/dist/components/FormTemplateEditor/FormStructurePanel.js.map +1 -1
  155. package/dist/components/FormTemplateEditor/FormTemplateEditorForm.js +1 -1
  156. package/dist/components/FormTemplateEditor/FormTemplateEditorForm.js.map +1 -1
  157. package/dist/components/FormTemplateEditor/StepCard.d.ts.map +1 -1
  158. package/dist/components/FormTemplateEditor/StepCard.js +15 -10
  159. package/dist/components/FormTemplateEditor/StepCard.js.map +1 -1
  160. package/dist/components/FormTemplateEditor/StepFieldRow.d.ts.map +1 -1
  161. package/dist/components/FormTemplateEditor/StepFieldRow.js +11 -6
  162. package/dist/components/FormTemplateEditor/StepFieldRow.js.map +1 -1
  163. package/dist/components/FormTemplateEditor/TemplateFileHandleField.d.ts.map +1 -1
  164. package/dist/components/FormTemplateEditor/TemplateFileHandleField.js +2 -1
  165. package/dist/components/FormTemplateEditor/TemplateFileHandleField.js.map +1 -1
  166. package/dist/components/FormTemplateEditor/useSaveFormTemplate.d.ts.map +1 -1
  167. package/dist/components/FormTemplateEditor/useSaveFormTemplate.js.map +1 -1
  168. package/dist/components/FormTemplateReferenceField/FormTemplatePreviewDialog.d.ts +9 -0
  169. package/dist/components/FormTemplateReferenceField/FormTemplatePreviewDialog.d.ts.map +1 -0
  170. package/dist/components/FormTemplateReferenceField/FormTemplatePreviewDialog.js +45 -0
  171. package/dist/components/FormTemplateReferenceField/FormTemplatePreviewDialog.js.map +1 -0
  172. package/dist/components/FormTemplateReferenceField/FormTemplateReferenceField.d.ts +22 -0
  173. package/dist/components/FormTemplateReferenceField/FormTemplateReferenceField.d.ts.map +1 -0
  174. package/dist/components/FormTemplateReferenceField/FormTemplateReferenceField.js +139 -0
  175. package/dist/components/FormTemplateReferenceField/FormTemplateReferenceField.js.map +1 -0
  176. package/dist/components/Forum/ForumTable.d.ts +17 -5
  177. package/dist/components/Forum/ForumTable.d.ts.map +1 -1
  178. package/dist/components/Forum/ForumTable.js +94 -77
  179. package/dist/components/Forum/ForumTable.js.map +1 -1
  180. package/dist/components/GenericCard/DuoTermTags/DuoTermTags.js +45 -45
  181. package/dist/components/GenericCard/PortalDOI/PortalDOI.js +5 -5
  182. package/dist/components/GenericCard/PortalDOI/PortalDOI.js.map +1 -1
  183. package/dist/components/GenericCard/TableRowGenericCard.js +1 -1
  184. package/dist/components/GenericCard/TableRowGenericCard.js.map +1 -1
  185. package/dist/components/HelpPopover/HelpPopover.js +1 -1
  186. package/dist/components/HelpPopover/HelpPopover.js.map +1 -1
  187. package/dist/components/IconSvg/IconSvg.d.ts.map +1 -1
  188. package/dist/components/IconSvg/IconSvg.js +154 -47
  189. package/dist/components/IconSvg/IconSvg.js.map +1 -1
  190. package/dist/components/JsonSchemaForm/templates/ButtonTemplate.d.ts.map +1 -1
  191. package/dist/components/JsonSchemaForm/templates/ButtonTemplate.js +19 -16
  192. package/dist/components/JsonSchemaForm/templates/ButtonTemplate.js.map +1 -1
  193. package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.d.ts.map +1 -1
  194. package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js +2 -1
  195. package/dist/components/JsonSchemaForm/templates/RJSFInputLabel.js.map +1 -1
  196. package/dist/components/JsonSchemaForm/widgets/PhoneWidget.d.ts +9 -0
  197. package/dist/components/JsonSchemaForm/widgets/PhoneWidget.d.ts.map +1 -0
  198. package/dist/components/JsonSchemaForm/widgets/PhoneWidget.js +21 -0
  199. package/dist/components/JsonSchemaForm/widgets/PhoneWidget.js.map +1 -0
  200. package/dist/components/Markdown/MarkdownCollapse.d.ts.map +1 -1
  201. package/dist/components/Markdown/MarkdownCollapse.js +3 -1
  202. package/dist/components/Markdown/MarkdownCollapse.js.map +1 -1
  203. package/dist/components/MissingQueryResultsWarning/MissingQueryResultsWarning.js +1 -1
  204. package/dist/components/MissingQueryResultsWarning/MissingQueryResultsWarning.js.map +1 -1
  205. package/dist/components/OAuthClientManagement/OAuthManagement.js +14 -13
  206. package/dist/components/OAuthClientManagement/OAuthManagement.js.map +1 -1
  207. package/dist/components/PortalList/PortalCard.d.ts.map +1 -1
  208. package/dist/components/PortalList/PortalCard.js +6 -5
  209. package/dist/components/PortalList/PortalCard.js.map +1 -1
  210. package/dist/components/PortalList/PortalList.js +4 -4
  211. package/dist/components/PortalList/PortalList.js.map +1 -1
  212. package/dist/components/ProjectVisibilityChip/ProjectVisibilityChip.js +6 -6
  213. package/dist/components/QueryBuilder/FilterConditionRow.js +4 -4
  214. package/dist/components/QueryCountButton/QueryCountButton.js +5 -5
  215. package/dist/components/QueryCountButton/QueryCountButton.js.map +1 -1
  216. package/dist/components/ReleaseCard/ReleaseCardLarge.js +5 -5
  217. package/dist/components/ReleaseCard/ReleaseCardLarge.js.map +1 -1
  218. package/dist/components/SetAccessRequirementCommonFields/SetAccessRequirementCommonFields.d.ts.map +1 -1
  219. package/dist/components/SetAccessRequirementCommonFields/SetAccessRequirementCommonFields.js +142 -108
  220. package/dist/components/SetAccessRequirementCommonFields/SetAccessRequirementCommonFields.js.map +1 -1
  221. package/dist/components/SetBasicAccessRequirementFields/AccessorRequirements.d.ts.map +1 -1
  222. package/dist/components/SetBasicAccessRequirementFields/AccessorRequirements.js +15 -15
  223. package/dist/components/SetBasicAccessRequirementFields/AccessorRequirements.js.map +1 -1
  224. package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.d.ts.map +1 -1
  225. package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.js +57 -55
  226. package/dist/components/SetManagedAccessRequirementFields/SetManagedAccessRequirementFields.js.map +1 -1
  227. package/dist/components/ShareThisPage/ShareThisPage.js +4 -4
  228. package/dist/components/ShareThisPage/ShareThisPage.js.map +1 -1
  229. package/dist/components/SustainabilityScorecard/DialLayout.js +1 -1
  230. package/dist/components/SustainabilityScorecard/DialLayout.js.map +1 -1
  231. package/dist/components/SustainabilityScorecard/SustainabilityScorecard.js +1 -1
  232. package/dist/components/SustainabilityScorecard/SustainabilityScorecard.js.map +1 -1
  233. package/dist/components/SynapseChat/SynapseChat.js +1 -1
  234. package/dist/components/SynapseChat/SynapseChat.js.map +1 -1
  235. package/dist/components/SynapseChat/SynapseChatInteraction.d.ts.map +1 -1
  236. package/dist/components/SynapseChat/SynapseChatInteraction.js +2 -1
  237. package/dist/components/SynapseChat/SynapseChatInteraction.js.map +1 -1
  238. package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.js +1 -1
  239. package/dist/components/SynapseChat/components/ChatInputArea/ChatInputArea.js.map +1 -1
  240. package/dist/components/SynapseFooter/SynapseFooter.js +1 -1
  241. package/dist/components/SynapseFooter/SynapseFooter.js.map +1 -1
  242. package/dist/components/SynapseHomepageV2/SynapseFeaturedDatasetItem.js +1 -1
  243. package/dist/components/SynapseHomepageV2/SynapseFeaturedDatasetItem.js.map +1 -1
  244. package/dist/components/SynapseHomepageV2/SynapseHomepageNavBar.d.ts.map +1 -1
  245. package/dist/components/SynapseHomepageV2/SynapseHomepageNavBar.js +2 -1
  246. package/dist/components/SynapseHomepageV2/SynapseHomepageNavBar.js.map +1 -1
  247. package/dist/components/SynapseHomepageV2/SynapseInActionItem.js +4 -4
  248. package/dist/components/SynapseHomepageV2/SynapseInActionItem.js.map +1 -1
  249. package/dist/components/SynapseHomepageV2/SynapseTrendingProjectsItem.js +1 -1
  250. package/dist/components/SynapseHomepageV2/SynapseTrendingProjectsItem.js.map +1 -1
  251. package/dist/components/SynapseNavDrawer/SynapseNavDrawer.d.ts.map +1 -1
  252. package/dist/components/SynapseNavDrawer/SynapseNavDrawer.js +4 -1
  253. package/dist/components/SynapseNavDrawer/SynapseNavDrawer.js.map +1 -1
  254. package/dist/components/SynapsePortalBanners/SynapsePortalBanners.js +1 -1
  255. package/dist/components/SynapsePortalBanners/SynapsePortalBanners.js.map +1 -1
  256. package/dist/components/SynapseSearchPageResults/SynapseSearchPageResults.js +1 -1
  257. package/dist/components/SynapseSearchPageResults/SynapseSearchPageResults.js.map +1 -1
  258. package/dist/components/SynapseSearchPageResults/SynapseSearchResultsCard.d.ts.map +1 -1
  259. package/dist/components/SynapseSearchPageResults/SynapseSearchResultsCard.js +12 -9
  260. package/dist/components/SynapseSearchPageResults/SynapseSearchResultsCard.js.map +1 -1
  261. package/dist/components/SynapseTable/RowSelection/RowSelectionControls.js +4 -4
  262. package/dist/components/SynapseTable/RowSelection/RowSelectionControls.js.map +1 -1
  263. package/dist/components/SynapseTable/datasets/DatasetItemsEditor.js +140 -140
  264. package/dist/components/SynapseTable/datasets/DatasetItemsEditor.js.map +1 -1
  265. package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js +1 -1
  266. package/dist/components/TableColumnSchemaEditor/ColumnModelForm.js.map +1 -1
  267. package/dist/components/TableColumnSchemaEditor/ImportTableColumnsButton.js +1 -1
  268. package/dist/components/TableColumnSchemaEditor/ImportTableColumnsButton.js.map +1 -1
  269. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.d.ts.map +1 -1
  270. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaEditorUtils.js.map +1 -1
  271. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js +9 -9
  272. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaForm.js.map +1 -1
  273. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormActions.d.ts.map +1 -1
  274. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormActions.js +6 -4
  275. package/dist/components/TableColumnSchemaEditor/TableColumnSchemaFormActions.js.map +1 -1
  276. package/dist/components/TanStackTable/ColumnHeader.js +1 -1
  277. package/dist/components/TanStackTable/ColumnHeader.js.map +1 -1
  278. package/dist/components/TeamSubjectsSelector/TeamBadgeOrError.js +1 -1
  279. package/dist/components/TeamSubjectsSelector/TeamBadgeOrError.js.map +1 -1
  280. package/dist/components/TeamSubjectsSelector/TeamSubjectsSelector.d.ts.map +1 -1
  281. package/dist/components/TeamSubjectsSelector/TeamSubjectsSelector.js +4 -3
  282. package/dist/components/TeamSubjectsSelector/TeamSubjectsSelector.js.map +1 -1
  283. package/dist/components/Webhook/WebhookDashboard.js +1 -1
  284. package/dist/components/Webhook/WebhookDashboard.js.map +1 -1
  285. package/dist/components/dataaccess/AccessRequirementDashboard.js +4 -4
  286. package/dist/components/dataaccess/AccessRequirementDashboard.js.map +1 -1
  287. package/dist/components/dataaccess/AccessRequirementTable.js +1 -1
  288. package/dist/components/dataaccess/AccessRequirementTable.js.map +1 -1
  289. package/dist/components/dataaccess/EDucTemplateTable.d.ts.map +1 -1
  290. package/dist/components/dataaccess/EDucTemplateTable.js +13 -11
  291. package/dist/components/dataaccess/EDucTemplateTable.js.map +1 -1
  292. package/dist/components/dataaccess/FormTemplateTable.js +6 -6
  293. package/dist/components/dataaccess/FormTemplateTable.js.map +1 -1
  294. package/dist/components/dataaccess/ReviewerDashboard.js +17 -17
  295. package/dist/components/dataaccess/ReviewerDashboard.js.map +1 -1
  296. package/dist/components/dataaccess/SubmissionPage/SubmissionPage.js +4 -4
  297. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.d.ts.map +1 -1
  298. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js +4 -1
  299. package/dist/components/dataaccess/UserAccessRequestHistory/InFlightEDucSignaturesTable.js.map +1 -1
  300. package/dist/components/doi/CreateOrUpdateDoiModal.js +1 -1
  301. package/dist/components/doi/CreateOrUpdateDoiModal.js.map +1 -1
  302. package/dist/components/download_list/DownloadDetails.d.ts.map +1 -1
  303. package/dist/components/download_list/DownloadDetails.js +12 -10
  304. package/dist/components/download_list/DownloadDetails.js.map +1 -1
  305. package/dist/components/entity/metadata/AnnotationsTable.js +1 -1
  306. package/dist/components/entity/metadata/AnnotationsTable.js.map +1 -1
  307. package/dist/components/entity/page/CreatedByModifiedBy.js +1 -1
  308. package/dist/components/entity/page/CreatedByModifiedBy.js.map +1 -1
  309. package/dist/components/entity/page/action_menu/EntityActionMenu.d.ts.map +1 -1
  310. package/dist/components/entity/page/action_menu/EntityActionMenu.js.map +1 -1
  311. package/dist/components/entity/page/title_bar/useGetEntityTitleBarProperties.js +1 -1
  312. package/dist/components/entity/page/title_bar/useGetEntityTitleBarProperties.js.map +1 -1
  313. package/dist/components/error/ErrorChip.d.ts.map +1 -1
  314. package/dist/components/error/ErrorChip.js +2 -1
  315. package/dist/components/error/ErrorChip.js.map +1 -1
  316. package/dist/components/table/CsvPreview/CreateTableFromCsvDialog.js +14 -14
  317. package/dist/components/table/CsvPreview/CsvPreviewWithOptions.js +4 -4
  318. package/dist/components/table/CsvPreview/CsvPreviewWithOptions.js.map +1 -1
  319. package/dist/components/widgets/facet-nav/FacetNavPanel.js +1 -1
  320. package/dist/components/widgets/facet-nav/FacetNavPanel.js.map +1 -1
  321. package/dist/features/curator/dashboard/components/NextStepButton.d.ts.map +1 -1
  322. package/dist/features/curator/dashboard/components/NextStepButton.js +7 -6
  323. package/dist/features/curator/dashboard/components/NextStepButton.js.map +1 -1
  324. package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.js +8 -8
  325. package/dist/features/entity/metadata-task/components/CreateOrUpdateCurationTaskDialog.js.map +1 -1
  326. package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.js +4 -4
  327. package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.js.map +1 -1
  328. package/dist/features/entity/metadata-task/components/MetadataTasksPage.js +4 -4
  329. package/dist/features/entity/metadata-task/components/MetadataTasksPage.js.map +1 -1
  330. package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js +1 -1
  331. package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js.map +1 -1
  332. package/dist/features/entity/metadata-task/create-task/CurateTaskForm.js +4 -4
  333. package/dist/features/entity/metadata-task/create-task/CurateTaskForm.js.map +1 -1
  334. package/dist/features/entity/metadata-task/create-task/TaskCategoryCard.js +1 -1
  335. package/dist/features/entity/metadata-task/create-task/TaskCategoryCard.js.map +1 -1
  336. package/dist/features/entity/metadata-task/create-task/TaskFormHeader.js +1 -1
  337. package/dist/features/entity/metadata-task/create-task/TaskFormHeader.js.map +1 -1
  338. package/dist/features/entity/metadata-task/create-task/curationTaskFlowRoutes.js +10 -10
  339. package/dist/features/entity/metadata-task/create-task/curationTaskFlowRoutes.js.map +1 -1
  340. package/dist/features/team/invitation/components/OpenInvitationsToUserCard.js +1 -1
  341. package/dist/features/team/invitation/components/OpenInvitationsToUserCard.js.map +1 -1
  342. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts +5 -0
  343. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.d.ts.map +1 -1
  344. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js +37 -26
  345. package/dist/mocks/accessRequirement/mockJsonSchemaAccessRequirements.js.map +1 -1
  346. package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts +8 -0
  347. package/dist/mocks/msw/handlers/aridhiaHandlers.d.ts.map +1 -1
  348. package/dist/mocks/msw/handlers/aridhiaHandlers.js +52 -41
  349. package/dist/mocks/msw/handlers/aridhiaHandlers.js.map +1 -1
  350. package/dist/mocks/msw/handlers/discussionHandlers.d.ts.map +1 -1
  351. package/dist/mocks/msw/handlers/discussionHandlers.js +40 -33
  352. package/dist/mocks/msw/handlers/discussionHandlers.js.map +1 -1
  353. package/dist/mocks/msw/handlers/entityHandlers.d.ts.map +1 -1
  354. package/dist/mocks/msw/handlers/entityHandlers.js +70 -67
  355. package/dist/mocks/msw/handlers/entityHandlers.js.map +1 -1
  356. package/dist/mocks/msw/handlers/gridHandlers.js +2 -2
  357. package/dist/mocks/msw/handlers/gridHandlers.js.map +1 -1
  358. package/dist/mocks/msw/server.d.ts.map +1 -1
  359. package/dist/mocks/msw/server.js +4 -2
  360. package/dist/mocks/msw/server.js.map +1 -1
  361. package/dist/synapse-client/SynapseClient.d.ts +10 -0
  362. package/dist/synapse-client/SynapseClient.d.ts.map +1 -1
  363. package/dist/synapse-client/SynapseClient.js +486 -482
  364. package/dist/synapse-client/SynapseClient.js.map +1 -1
  365. package/dist/synapse-client/index.js +3 -3
  366. package/dist/synapse-queries/KeyFactory.d.ts +13 -1
  367. package/dist/synapse-queries/KeyFactory.d.ts.map +1 -1
  368. package/dist/synapse-queries/KeyFactory.js +11 -1
  369. package/dist/synapse-queries/KeyFactory.js.map +1 -1
  370. package/dist/synapse-queries/dataaccess/index.js +4 -4
  371. package/dist/synapse-queries/dataaccess/useAccessRequirements.d.ts.map +1 -1
  372. package/dist/synapse-queries/dataaccess/useAccessRequirements.js +4 -1
  373. package/dist/synapse-queries/dataaccess/useAccessRequirements.js.map +1 -1
  374. package/dist/synapse-queries/dataaccess/useEDuc.d.ts +19 -5
  375. package/dist/synapse-queries/dataaccess/useEDuc.d.ts.map +1 -1
  376. package/dist/synapse-queries/dataaccess/useEDuc.js +29 -21
  377. package/dist/synapse-queries/dataaccess/useEDuc.js.map +1 -1
  378. package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts +12 -0
  379. package/dist/synapse-queries/dataaccess/useFormTemplate.d.ts.map +1 -1
  380. package/dist/synapse-queries/dataaccess/useFormTemplate.js +52 -30
  381. package/dist/synapse-queries/dataaccess/useFormTemplate.js.map +1 -1
  382. package/dist/synapse-queries/forum/useForum.d.ts +5 -1
  383. package/dist/synapse-queries/forum/useForum.d.ts.map +1 -1
  384. package/dist/synapse-queries/forum/useForum.js +23 -1
  385. package/dist/synapse-queries/forum/useForum.js.map +1 -1
  386. package/dist/synapse-queries/index.js +185 -184
  387. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts +5 -3
  388. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.d.ts.map +1 -1
  389. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js +12 -15
  390. package/dist/synapse-queries/jsonschema/useCreateJsonSchema.js.map +1 -1
  391. package/dist/synapse-queries/user/useGetUserChallenges.d.ts.map +1 -1
  392. package/dist/synapse-queries/user/useGetUserChallenges.js.map +1 -1
  393. package/dist/theme/DefaultTheme.d.ts.map +1 -1
  394. package/dist/theme/DefaultTheme.js +4 -1
  395. package/dist/theme/DefaultTheme.js.map +1 -1
  396. package/dist/tsconfig.build.tsbuildinfo +1 -1
  397. package/dist/utils/APIConstants.d.ts.map +1 -1
  398. package/dist/utils/APIConstants.js.map +1 -1
  399. package/dist/utils/AppUtils/AppUtils.js +1 -1
  400. package/dist/utils/AppUtils/AppUtils.js.map +1 -1
  401. package/dist/utils/featureflag/FeatureFlags.d.ts.map +1 -1
  402. package/dist/utils/featureflag/FeatureFlags.js.map +1 -1
  403. package/dist/utils/functions/EntityTypeUtils.d.ts.map +1 -1
  404. package/dist/utils/functions/EntityTypeUtils.js.map +1 -1
  405. package/dist/utils/functions/getEndpoint.d.ts +1 -0
  406. package/dist/utils/functions/getEndpoint.d.ts.map +1 -1
  407. package/dist/utils/functions/getEndpoint.js +3 -3
  408. package/dist/utils/functions/getEndpoint.js.map +1 -1
  409. package/dist/utils/types/RequestableAccessRequirement.d.ts +8 -0
  410. package/dist/utils/types/RequestableAccessRequirement.d.ts.map +1 -0
  411. package/dist/utils/types/RequestableAccessRequirement.js +9 -0
  412. package/dist/utils/types/RequestableAccessRequirement.js.map +1 -0
  413. package/package.json +6 -5
  414. package/dist/testutils/ReactQueryMockUtils.js +0 -676
  415. package/dist/testutils/ReactQueryMockUtils.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"EntityIdTextField.js","names":[],"sources":["../../../src/components/EntityFinder/EntityIdTextField.tsx"],"sourcesContent":["import { SearchOutlined } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { useState } from 'react'\nimport { TextField } from '../TextField'\nimport { EntityFinderModal, EntityFinderModalProps } from './EntityFinderModal'\n\nexport type EntityIdTextFieldProps = {\n label: string\n value: string\n onChange: (value: string) => void\n description?: string\n disabled?: boolean\n required?: boolean\n entityFinderModalProps: Omit<\n EntityFinderModalProps,\n 'show' | 'onConfirm' | 'onCancel'\n >\n}\n\n/**\n * A text field with an adornment button that opens an EntityFinderModal to select an entity.\n * The selected entity's ID is set as the value of the text field. Users may also type or paste\n * a raw synId.\n */\nfunction EntityIdTextField(props: EntityIdTextFieldProps) {\n const {\n label,\n value,\n description,\n onChange,\n disabled,\n required,\n entityFinderModalProps,\n } = props\n const [showEntityFinder, setShowEntityFinder] = useState(false)\n return (\n <>\n <EntityFinderModal\n show={showEntityFinder}\n onConfirm={selected => {\n onChange(selected[0].targetId)\n setShowEntityFinder(false)\n }}\n onCancel={() => setShowEntityFinder(false)}\n {...entityFinderModalProps}\n />\n <TextField\n label={label}\n description={description}\n type=\"text\"\n fullWidth\n required={required}\n value={value}\n disabled={disabled}\n onChange={e => onChange(e.target.value)}\n slotProps={{\n input: {\n endAdornment: !disabled && (\n <IconButton onClick={() => setShowEntityFinder(true)}>\n <SearchOutlined />\n </IconButton>\n ),\n },\n }}\n />\n </>\n )\n}\n\nexport default EntityIdTextField\n"],"mappings":";;;;;;;;AAwBA,SAAS,EAAkB,GAA+B;CACxD,IAAM,EACJ,UACA,UACA,gBACA,aACA,aACA,aACA,8BACE,GACE,CAAC,GAAkB,KAAuB,EAAS,EAAK;CAC9D,OACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;EACE,MAAM;EACN,YAAW,MAAY;GAErB,AADA,EAAS,EAAS,GAAG,QAAQ,GAC7B,EAAoB,EAAK;EAC3B;EACA,gBAAgB,EAAoB,EAAK;EACzC,GAAI;CACL,CAAA,GACD,kBAAC,GAAD;EACS;EACM;EACb,MAAK;EACL,WAAA;EACU;EACH;EACG;EACV,WAAU,MAAK,EAAS,EAAE,OAAO,KAAK;EACtC,WAAW,EACT,OAAO,EACL,cAAc,CAAC,KACb,kBAAC,GAAD;GAAY,eAAe,EAAoB,EAAI;aACjD,kBAAC,GAAD,CAAiB,CAAA;EACP,CAAA,EAEhB,EACF;CACD,CAAA,CACD,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"EntityIdTextField.js","names":[],"sources":["../../../src/components/EntityFinder/EntityIdTextField.tsx"],"sourcesContent":["import SearchOutlined from '@mui/icons-material/SearchOutlined'\nimport { IconButton } from '@mui/material'\nimport { useState } from 'react'\nimport { TextField } from '../TextField'\nimport { EntityFinderModal, EntityFinderModalProps } from './EntityFinderModal'\n\nexport type EntityIdTextFieldProps = {\n label: string\n value: string\n onChange: (value: string) => void\n description?: string\n disabled?: boolean\n required?: boolean\n entityFinderModalProps: Omit<\n EntityFinderModalProps,\n 'show' | 'onConfirm' | 'onCancel'\n >\n}\n\n/**\n * A text field with an adornment button that opens an EntityFinderModal to select an entity.\n * The selected entity's ID is set as the value of the text field. Users may also type or paste\n * a raw synId.\n */\nfunction EntityIdTextField(props: EntityIdTextFieldProps) {\n const {\n label,\n value,\n description,\n onChange,\n disabled,\n required,\n entityFinderModalProps,\n } = props\n const [showEntityFinder, setShowEntityFinder] = useState(false)\n return (\n <>\n <EntityFinderModal\n show={showEntityFinder}\n onConfirm={selected => {\n onChange(selected[0].targetId)\n setShowEntityFinder(false)\n }}\n onCancel={() => setShowEntityFinder(false)}\n {...entityFinderModalProps}\n />\n <TextField\n label={label}\n description={description}\n type=\"text\"\n fullWidth\n required={required}\n value={value}\n disabled={disabled}\n onChange={e => onChange(e.target.value)}\n slotProps={{\n input: {\n endAdornment: !disabled && (\n <IconButton onClick={() => setShowEntityFinder(true)}>\n <SearchOutlined />\n </IconButton>\n ),\n },\n }}\n />\n </>\n )\n}\n\nexport default EntityIdTextField\n"],"mappings":";;;;;;;;AAwBA,SAAS,EAAkB,GAA+B;CACxD,IAAM,EACJ,UACA,UACA,gBACA,aACA,aACA,aACA,8BACE,GACE,CAAC,GAAkB,KAAuB,EAAS,EAAK;CAC9D,OACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,GAAD;EACE,MAAM;EACN,YAAW,MAAY;GAErB,AADA,EAAS,EAAS,GAAG,QAAQ,GAC7B,EAAoB,EAAK;EAC3B;EACA,gBAAgB,EAAoB,EAAK;EACzC,GAAI;CACL,CAAA,GACD,kBAAC,GAAD;EACS;EACM;EACb,MAAK;EACL,WAAA;EACU;EACH;EACG;EACV,WAAU,MAAK,EAAS,EAAE,OAAO,KAAK;EACtC,WAAW,EACT,OAAO,EACL,cAAc,CAAC,KACb,kBAAC,GAAD;GAAY,eAAe,EAAoB,EAAI;aACjD,kBAAC,GAAD,CAAiB,CAAA;EACP,CAAA,EAEhB,EACF;CACD,CAAA,CACD,EAAA,CAAA;AAEN"}
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedTree.d.ts","sourceRoot":"","sources":["../../../../src/components/EntityFinder/tree/VirtualizedTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAGjD,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAQ7D,OAAO,EACL,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,2BAA2B,EAE5B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAK7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAE9D,oBAAY,kBAAkB;IAC5B,kJAAkJ;IAClJ,WAAW,IAAA;IAC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I,CAAA;IACzC,QAAQ,EAAE,sBAAsB,CAAA;IAEhC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;IACzC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;IACzC,eAAe,EAAE,UAAU,EAAE,CAAA;IAC7B,YAAY,EAAE,UAAU,EAAE,CAAA;CAC3B,CAAC,CAAA;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,oBAAoB,KAC1B,KAAK,CAAC,SAwIR,CAAA"}
@@ -14,8 +14,9 @@ import { cloneDeep as p } from "lodash-es";
14
14
  import { Skeleton as m, Tooltip as h, Typography as g } from "@mui/material";
15
15
  import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
16
16
  import { useQueryClient as b } from "@tanstack/react-query";
17
- import { ChevronRight as x, ExpandMore as S } from "@mui/icons-material";
18
- import C from "dayjs";
17
+ import x from "dayjs";
18
+ import S from "@mui/icons-material/ChevronRight";
19
+ import C from "@mui/icons-material/ExpandMore";
19
20
  import { useInView as w } from "react-intersection-observer";
20
21
  import T from "react-virtualized-auto-sizer";
21
22
  import { VariableSizeTree as E } from "react-vtree";
@@ -111,12 +112,12 @@ function I(e) {
111
112
  "modifiedOn" in n && /* @__PURE__ */ y(_, { children: [
112
113
  /* @__PURE__ */ v("br", {}),
113
114
  /* @__PURE__ */ v("b", { children: "Modified On: " }),
114
- a(C(n.modifiedOn))
115
+ a(x(n.modifiedOn))
115
116
  ] })
116
117
  ]
117
118
  })
118
119
  }));
119
- let U = N ? S : x;
120
+ let U = N ? C : S;
120
121
  return /* @__PURE__ */ y("div", {
121
122
  className: `Node ${E === 0 ? "SelectNode" : "BrowseNode"}`,
122
123
  "aria-selected": D,
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedTree.js","names":[],"sources":["../../../../src/components/EntityFinder/tree/VirtualizedTree.tsx"],"sourcesContent":["import React from 'react'\nimport { getEntityChildren } from '@/synapse-client'\nimport { useSynapseContext } from '@/utils'\nimport { formatDate } from '@/utils/functions/DateFormatter'\nimport {\n getEntityTypeFromHeader,\n isContainerType,\n} from '@/utils/functions/EntityTypeUtils'\nimport { Writable } from '@/utils/types/Writable'\nimport { ChevronRight, ExpandMore } from '@mui/icons-material'\nimport { Skeleton, Tooltip, Typography } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport { EntityChildrenRequest } from '@sage-bionetworks/synapse-types'\nimport { useQueryClient } from '@tanstack/react-query'\nimport dayjs from 'dayjs'\nimport { cloneDeep } from 'lodash-es'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\nimport AutoSizer from 'react-virtualized-auto-sizer'\nimport {\n TreeWalker,\n TreeWalkerValue,\n VariableSizeNodeData,\n VariableSizeNodePublicState,\n VariableSizeTree,\n} from 'react-vtree'\nimport { NodeComponentProps } from 'react-vtree/dist/es/Tree'\nimport { EntityBadgeIcons } from '../../EntityBadgeIcons'\nimport { EntityTypeIcon } from '../../EntityIcon'\nimport { SynapseSpinner } from '../../LoadingScreen/LoadingScreen'\nimport { UserBadge } from '../../UserCard/UserBadge'\nimport { EntityFinderHeader } from '../EntityFinderHeader'\nimport { EntitySelectionMapType } from '../useEntitySelection'\n\nexport enum EntityTreeNodeType {\n /** The tree component's appearance and interactions will facilitate selection. Nodes will be larger and styles will indicate primary selection */\n SINGLE_PANE,\n /** The tree component's appearance and interactions will facilitate browsing. Nodes will be smaller and styles will indicate secondary selection */\n DUAL_PANE,\n}\n\ntype NodeChildren = Readonly<{\n /** The node's children. If undefined, then children have not been fetched. */\n children?: EntityHeaderNode[]\n /** The token used to fetch the next page of children for this entity. If this property is nullish and children is defined, then all children have been fetched. */\n childrenNextPageToken?: string | null\n}>\n\nexport type EntityHeaderNode = (\n | EntityFinderHeader\n // Only will have a subset of fields if the node is fetched via the entity path:\n | Pick<EntityFinderHeader, 'id' | 'name' | 'type'>\n) &\n NodeChildren\ntype PaginationNode = { __paginationNode: true }\n\ntype TreeNode = EntityHeaderNode | RootNodeConfiguration | PaginationNode\n\nfunction getTreeNodeType(\n node: TreeNode,\n): 'entityHeader' | 'rootNodeConfiguration' | 'pagination' {\n if ('__paginationNode' in node) {\n return 'pagination'\n }\n return 'id' in node ? 'entityHeader' : 'rootNodeConfiguration'\n}\n\nfunction isPaginationNode(node: TreeNode): node is PaginationNode {\n return getTreeNodeType(node) === 'pagination'\n}\n\nfunction isEntityHeaderNode(node: TreeNode): node is EntityHeaderNode {\n return getTreeNodeType(node) === 'entityHeader'\n}\n\nfunction isRootNodeConfiguration(\n node: TreeNode,\n): node is RootNodeConfiguration {\n return getTreeNodeType(node) === 'rootNodeConfiguration'\n}\n\nfunction hasMoreChildren(node: TreeNode) {\n if (isPaginationNode(node)) {\n return false\n } else if (isRootNodeConfiguration(node)) {\n return node.hasNextPage\n }\n\n return node.children == null || node.childrenNextPageToken != null\n}\n\nfunction isLeafNode(node: TreeNode) {\n if (isPaginationNode(node)) {\n return true\n } else if (isRootNodeConfiguration(node)) {\n return false\n } else {\n return (\n // Entity is not a container\n !isContainerType(getEntityTypeFromHeader(node)) ||\n // OR Children have been fetched (nonnull) and there are 0 children\n node.children?.length === 0\n )\n }\n}\n\nfunction maybeHasChildren(\n node: TreeNode,\n): node is RootNodeConfiguration | EntityHeaderNode {\n if (isPaginationNode(node)) {\n return false\n } else if (isRootNodeConfiguration(node)) {\n return node.children.length > 0 || node.hasNextPage\n } else {\n return !isLeafNode(node)\n }\n}\n\nexport type TreeData = VariableSizeNodeData &\n Readonly<{\n node: TreeNode\n getNextPageOfChildren: () => Promise<void>\n isLeaf: boolean\n nestingLevel: number\n setSelectedId: (entityId: string) => void\n treeNodeType: EntityTreeNodeType\n isSelected: boolean\n isDisabled: boolean\n }>\n\ntype NodeMeta = Readonly<{\n nestingLevel: number\n node: TreeNode\n}>\n\nexport type RootNodeConfiguration = {\n show: boolean\n nodeText: string\n children: EntityHeaderNode[]\n /** If undefined, no more entities to fetch */\n fetchNextPage: () => Promise<void>\n hasNextPage: boolean\n}\n\n/**\n * Converts a TreeNode and related data into a TreeWalkerValue that react-vtree can use to render the tree.\n * Exported for testing purposes only.\n * @param config\n * @returns\n */\nexport const getNodeData = (config: {\n node: TreeNode\n nestingLevel: number\n getNextPageOfChildren: () => Promise<void>\n setSelectedId: (entityId: string) => void\n treeNodeType: EntityTreeNodeType\n selected: EntitySelectionMapType\n selectableTypes: EntityType[]\n autoExpand: (entityId: string) => boolean\n defaultHeight: number\n currentContainer?: string | 'root' | null\n}): TreeWalkerValue<TreeData, NodeMeta> => {\n const {\n node,\n nestingLevel,\n getNextPageOfChildren,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n defaultHeight,\n currentContainer,\n } = config\n\n if (isPaginationNode(node)) {\n throw new Error('Cannot create data for a pagination node')\n }\n\n const id = isRootNodeConfiguration(node) ? 'root' : node.id\n\n const isSelected =\n treeNodeType === EntityTreeNodeType.SINGLE_PANE\n ? selected.has(id)\n : currentContainer === id\n const isDisabled =\n !isRootNodeConfiguration(node) &&\n !selectableTypes.includes(getEntityTypeFromHeader(node))\n\n const isOpenByDefault = autoExpand(id)\n /*\n * If the node is open by default and we haven't fetched its children,\n * fetch the first page (otherwise we won't fetch unless re-toggled)\n */\n if (isOpenByDefault && node.children == null && hasMoreChildren(node)) {\n getNextPageOfChildren()\n }\n\n return {\n data: {\n node,\n getNextPageOfChildren,\n id: id,\n isLeaf: isLeafNode(node),\n isOpenByDefault: isOpenByDefault,\n nestingLevel,\n setSelectedId,\n treeNodeType,\n isSelected,\n isDisabled,\n defaultHeight,\n },\n nestingLevel,\n node,\n }\n}\n\n/**\n * Node component for the react-vtree virtualized tree. Exported only for testing purposes\n */\nexport function Node(\n props: NodeComponentProps<TreeData, VariableSizeNodePublicState<TreeData>>,\n) {\n const {\n data: {\n node,\n getNextPageOfChildren,\n isLeaf,\n id,\n nestingLevel,\n setSelectedId,\n treeNodeType,\n isSelected,\n isDisabled,\n },\n isOpen,\n style,\n setOpen,\n } = props\n\n const [isLoading, setLoading] = useState(false)\n\n const nodeText = isEntityHeaderNode(node) ? (\n <span>{node.name}</span>\n ) : isRootNodeConfiguration(node) ? (\n <span>{node.nodeText}</span>\n ) : (\n // Pagination node\n <Skeleton width={100} />\n )\n\n // We only use this for pagination nodes. If the pagination node comes into view, then immediately call `getNextPageOfChildren`\n const { ref, inView } = useInView()\n\n useEffect(() => {\n if (isPaginationNode(node) && inView) {\n getNextPageOfChildren()\n }\n }, [node, inView, getNextPageOfChildren])\n\n const toggleExpand = useCallback(async () => {\n if (hasMoreChildren(node)) {\n setLoading(true)\n await getNextPageOfChildren()\n await setOpen(!isOpen)\n setLoading(false)\n } else {\n await setOpen(!isOpen)\n }\n }, [getNextPageOfChildren, node, isOpen, setOpen])\n\n /**\n * If in the dual-pane view, expand a node when it becomes selected\n */\n useEffect(() => {\n if (\n treeNodeType === EntityTreeNodeType.DUAL_PANE &&\n isSelected &&\n !isOpen\n ) {\n toggleExpand()\n }\n // Intentionally only toggle the expanded state when isSelected changes, otherwise the node cannot be un-expanded\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n }, [isSelected])\n\n /**\n * If the height is 0, the node is purposefully hidden. Just render a fragment.\n */\n if ('height' in style && style.height === 0) {\n return <></>\n }\n\n let tooltipContent: ReactNode = ''\n if (isEntityHeaderNode(node)) {\n tooltipContent = (\n <div style={{ textAlign: 'center' }}>\n <Typography\n component=\"span\"\n variant=\"smallText1\"\n sx={{\n display: 'inline',\n }}\n >\n {node.name}\n <br />\n <b>ID: </b>\n {node.id}\n {'modifiedBy' in node && (\n <>\n <br />\n <b>Modified By: </b>\n <UserBadge\n userId={node.modifiedBy.toString()}\n showFullName\n disableLink\n showCardOnHover={false}\n />\n </>\n )}\n {'modifiedOn' in node && (\n <>\n <br />\n <b>Modified On: </b>\n {formatDate(dayjs(node.modifiedOn))}\n </>\n )}\n </Typography>\n </div>\n )\n }\n\n const ExpandIcon = isOpen ? ExpandMore : ChevronRight\n\n return (\n <div\n className={`Node ${\n treeNodeType === EntityTreeNodeType.SINGLE_PANE\n ? 'SelectNode'\n : 'BrowseNode'\n }`}\n aria-selected={isSelected}\n aria-disabled={isDisabled}\n onClick={event => {\n event.stopPropagation()\n if (!isDisabled) {\n setSelectedId(id)\n }\n }}\n style={{\n ...style,\n paddingLeft: `${nestingLevel * 20}px`,\n }}\n >\n {!isLeaf && (\n <>\n {isLoading ? (\n <SynapseSpinner size={10} />\n ) : (\n <button\n aria-label={isOpen ? 'Collapse' : 'Expand'}\n onClick={event => {\n event.stopPropagation()\n toggleExpand()\n }}\n >\n <ExpandIcon className=\"ExpandButton\" />\n </button>\n )}\n </>\n )}\n {treeNodeType === EntityTreeNodeType.SINGLE_PANE && ( // SWC-5592\n <div className=\"EntityIcon\">\n {isEntityHeaderNode(node) && (\n <EntityTypeIcon type={getEntityTypeFromHeader(node)} />\n )}\n </div>\n )}\n\n <Tooltip title={tooltipContent} placement=\"right\">\n <div className=\"EntityName\" ref={ref}>\n {nodeText}\n </div>\n </Tooltip>\n\n {treeNodeType === EntityTreeNodeType.SINGLE_PANE && (\n <EntityBadgeIcons\n entityId={id}\n showHasDiscussionThread={false}\n showHasWiki={false}\n showUnlink={false}\n canOpenModal={false}\n />\n )}\n </div>\n )\n}\n\n/**\n * Extracted from the React component for testing purposes\n * @returns a generator function compatible with react-vtree\n */\nexport function getTreeWalkerFunction(\n rootNode: RootNodeConfiguration,\n setSelectedId: VirtualizedTreeProps['setSelectedId'],\n treeNodeType: VirtualizedTreeProps['treeNodeType'],\n selected: VirtualizedTreeProps['selected'],\n selectableTypes: VirtualizedTreeProps['selectableTypes'],\n autoExpand: VirtualizedTreeProps['autoExpand'],\n itemSize: (index?: number) => number,\n currentContainer: VirtualizedTreeProps['currentContainer'],\n fetchNextPageOfChildren: (node: Writable<EntityHeaderNode>) => Promise<void>,\n): TreeWalker<TreeData, NodeMeta> {\n return function* treeWalker() {\n // Step [1]: Define the root node of our tree.\n yield getNodeData({\n node: rootNode,\n nestingLevel: 0,\n getNextPageOfChildren: rootNode.fetchNextPage,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n defaultHeight: itemSize(),\n currentContainer,\n })\n\n while (true) {\n // Step [2]: Get the parent node and nesting level, which will be passed into the Generator.next function by react-vtree.\n // Yielding `undefined` indicates to react-vtree that we've finished iterating children from the last time we were in the loop.\n const parentMeta = yield\n\n if (maybeHasChildren(parentMeta.node)) {\n // Step [3]: Yielding all the known children of the parent\n if (parentMeta.node.children) {\n for (let i = 0; i < parentMeta.node.children.length; i++) {\n const childNode = parentMeta.node.children[i]\n\n yield getNodeData({\n node: childNode,\n nestingLevel: parentMeta.nestingLevel + 1,\n getNextPageOfChildren: () => fetchNextPageOfChildren(childNode),\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n defaultHeight: itemSize(),\n currentContainer,\n })\n }\n }\n\n // Step [4] - If the parent node has more children, render a \"pagination node\" that will fetch more children when it comes into view (via intersection observer)\n if (hasMoreChildren(parentMeta.node)) {\n const paginationNode: PaginationNode = {\n __paginationNode: true,\n }\n const paginationTreeWalkerValue: TreeWalkerValue<TreeData, NodeMeta> =\n {\n data: {\n id: parentMeta.data.id + '-pagination',\n node: paginationNode,\n isOpenByDefault: false,\n getNextPageOfChildren: parentMeta.data.getNextPageOfChildren,\n isLeaf: true,\n isSelected: false,\n defaultHeight: itemSize(),\n isDisabled: true,\n nestingLevel: parentMeta.nestingLevel + 1,\n setSelectedId: () => {},\n treeNodeType,\n },\n nestingLevel: parentMeta.nestingLevel + 1,\n node: {\n __paginationNode: true,\n },\n }\n yield paginationTreeWalkerValue\n }\n }\n }\n }\n}\n\nexport type VirtualizedTreeProps = Readonly<{\n treeNodeType: EntityTreeNodeType\n rootNodeConfiguration: RootNodeConfiguration\n setSelectedId: (entityId: string) => void\n selected: EntitySelectionMapType\n /* currentContainer is the container whose contents are shown on in the right pane in dual-pane configuration, and may only be defined when treeNodeType is DUAL_PANE */\n currentContainer?: string | 'root' | null\n autoExpand: (entityId: string) => boolean\n selectableTypes: EntityType[]\n visibleTypes: EntityType[]\n}>\n\n/**\n * Component that utilizes react-vtree to efficiently display a tree of entities. react-vtree utilizes react-window\n * to only render visible nodes, which eliminates performance issues as seen in SWC-5978.\n */\nexport const VirtualizedTree = (\n props: VirtualizedTreeProps,\n): React.ReactNode => {\n const {\n rootNodeConfiguration,\n setSelectedId,\n treeNodeType,\n selected,\n currentContainer,\n selectableTypes,\n visibleTypes,\n autoExpand,\n } = props\n\n const { accessToken, keyFactory } = useSynapseContext()\n const queryClient = useQueryClient()\n\n const [rootNode, setRootNode] = useState<RootNodeConfiguration>(\n rootNodeConfiguration,\n )\n\n const treeInstance = useRef<VariableSizeTree<TreeData>>(null)\n\n useEffect(() => {\n setRootNode(rootNodeConfiguration)\n }, [rootNodeConfiguration, rootNodeConfiguration.children])\n\n // This function is used by VariableSizeTree to identify the size of each node in the tree.\n const itemSize = useCallback(\n (index?: number) => {\n /**\n * We must have a root node, but we don't always want to show it.\n * In those cases, set the height of the root node to 0.\n */\n if (index === 0 && !rootNodeConfiguration.show) {\n return 0\n }\n /**\n * The height of all other nodes in the tree varies depending on the tree node type.\n */\n return treeNodeType === EntityTreeNodeType.DUAL_PANE ? 30 : 60\n },\n [treeNodeType, rootNodeConfiguration.show],\n )\n\n /**\n * Fetches the next page of children for a given node. After fetching the children, this method will make a deep clone of the\n * full tree, including the new data, and updates the state of the component\n */\n const fetchNextPageOfChildren = useCallback(\n // Because we update the root node with a copy at the end of this function, we can write to the node under update.\n async (node: Writable<EntityHeaderNode>) => {\n // Fetch the children of the node\n const entityChildrenRequest: EntityChildrenRequest = {\n parentId: node.id,\n nextPageToken: node.childrenNextPageToken,\n includeTypes: visibleTypes,\n }\n const children = await queryClient.fetchQuery({\n queryKey: keyFactory.getEntityChildrenQueryKey(\n entityChildrenRequest,\n false,\n ),\n queryFn: () => getEntityChildren(entityChildrenRequest, accessToken),\n })\n // Update the node data -- add the children and store the nextPageToken\n if (node.children) {\n for (const newChild of children.page) {\n // SWC-6751 - Prevent adding duplicate entries in case this function is called twice\n if (!node.children.find(child => child.id == newChild.id)) {\n node.children.push(newChild)\n }\n }\n } else {\n node.children = children.page\n }\n node.childrenNextPageToken = children.nextPageToken\n\n // Ensure the node for which we fetched children is expanded/open\n if (treeInstance.current) {\n await treeInstance.current.recomputeTree({\n [node.id]: {\n open: true,\n },\n })\n }\n\n // cloneDeep is required to re-render the tree with the new children\n setRootNode(cloneDeep(rootNode))\n },\n [visibleTypes, queryClient, keyFactory, rootNode, accessToken],\n )\n\n /**\n * treeWalker is a generator function used by react-vtree to generate the tree structure. The tree is re-built when the function is updated,\n * so the dependencies specified in useCallback are important.\n */\n const memoizedTreeWalker = useCallback(\n getTreeWalkerFunction(\n rootNode,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n itemSize,\n currentContainer,\n fetchNextPageOfChildren,\n ),\n [\n rootNode,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n currentContainer,\n fetchNextPageOfChildren,\n itemSize,\n ],\n )\n\n return (\n <AutoSizer disableWidth>\n {({ height }: { height: number }) => (\n <VariableSizeTree\n ref={treeInstance}\n treeWalker={memoizedTreeWalker}\n itemSize={itemSize}\n height={height}\n async={true}\n width=\"100%\"\n >\n {Node}\n </VariableSizeTree>\n )}\n </AutoSizer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAY,IAAL,yBAAA,GAAA;QAEL,EAAA,EAAA,cAAA,KAAA,eAEA,EAAA,EAAA,YAAA,KAAA;AACF,EAAA,CAAA,CAAA;AAmBA,SAAS,EACP,GACyD;CAIzD,OAHI,sBAAsB,IACjB,eAEF,QAAQ,IAAO,iBAAiB;AACzC;AAEA,SAAS,EAAiB,GAAwC;CAChE,OAAO,EAAgB,CAAI,MAAM;AACnC;AAEA,SAA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,MAAM,EAAY,WAAW;GAC5C,UAAU,EAAW,0BACnB,GACA,EACF;GACA,eAAe,EAAkB,GAAuB,CAAW;EACrE,CAAC;EAED,IAAI,EAAK,eACF,IAAM,KAAY,EAAS,MAE9B,AAAK,EAAK,SAAS,MAAK,MAAS,EAAM,MAAM,EAAS,EAAE,KACtD,EAAK,SAAS,KAAK,CAAQ;OAI/B,EAAK,WAAW,EAAS;EAc3B,AAZA,EAAK,wBAAwB,EAAS,eAGlC,EAAa,WACf,MAAM,EAAa,QAAQ,cAAc,GACtC,EAAK,KAAK,EACT,MAAM,GACR,EACF,CAAC,GAIH,EAAY,EAAU,CAAQ,CAAC;CACjC,GACA;EAAC;EAAc;EAAa;EAAY;EAAU;CAAW,CAC/D,GAMM,IAAqB,EACzB,EACE,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,CACF,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,OACE,kBAAC,GAAD;EAAW,cAAA;aACP,EAAE,gBACF,kBAAC,GAAD;GACE,KAAK;GACL,YAAY;GACF;GACF;GACR,OAAO;GACP,OAAM;aAEL;EACe,CAAA;CAEX,CAAA;AAEf"}
1
+ {"version":3,"file":"VirtualizedTree.js","names":[],"sources":["../../../../src/components/EntityFinder/tree/VirtualizedTree.tsx"],"sourcesContent":["import React from 'react'\nimport { getEntityChildren } from '@/synapse-client'\nimport { useSynapseContext } from '@/utils'\nimport { formatDate } from '@/utils/functions/DateFormatter'\nimport {\n getEntityTypeFromHeader,\n isContainerType,\n} from '@/utils/functions/EntityTypeUtils'\nimport { Writable } from '@/utils/types/Writable'\nimport ChevronRight from '@mui/icons-material/ChevronRight'\nimport ExpandMore from '@mui/icons-material/ExpandMore'\nimport { Skeleton, Tooltip, Typography } from '@mui/material'\nimport { EntityType } from '@sage-bionetworks/synapse-client'\nimport { EntityChildrenRequest } from '@sage-bionetworks/synapse-types'\nimport { useQueryClient } from '@tanstack/react-query'\nimport dayjs from 'dayjs'\nimport { cloneDeep } from 'lodash-es'\nimport { ReactNode, useCallback, useEffect, useRef, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\nimport AutoSizer from 'react-virtualized-auto-sizer'\nimport {\n TreeWalker,\n TreeWalkerValue,\n VariableSizeNodeData,\n VariableSizeNodePublicState,\n VariableSizeTree,\n} from 'react-vtree'\nimport { NodeComponentProps } from 'react-vtree/dist/es/Tree'\nimport { EntityBadgeIcons } from '../../EntityBadgeIcons'\nimport { EntityTypeIcon } from '../../EntityIcon'\nimport { SynapseSpinner } from '../../LoadingScreen/LoadingScreen'\nimport { UserBadge } from '../../UserCard/UserBadge'\nimport { EntityFinderHeader } from '../EntityFinderHeader'\nimport { EntitySelectionMapType } from '../useEntitySelection'\n\nexport enum EntityTreeNodeType {\n /** The tree component's appearance and interactions will facilitate selection. Nodes will be larger and styles will indicate primary selection */\n SINGLE_PANE,\n /** The tree component's appearance and interactions will facilitate browsing. Nodes will be smaller and styles will indicate secondary selection */\n DUAL_PANE,\n}\n\ntype NodeChildren = Readonly<{\n /** The node's children. If undefined, then children have not been fetched. */\n children?: EntityHeaderNode[]\n /** The token used to fetch the next page of children for this entity. If this property is nullish and children is defined, then all children have been fetched. */\n childrenNextPageToken?: string | null\n}>\n\nexport type EntityHeaderNode = (\n | EntityFinderHeader\n // Only will have a subset of fields if the node is fetched via the entity path:\n | Pick<EntityFinderHeader, 'id' | 'name' | 'type'>\n) &\n NodeChildren\ntype PaginationNode = { __paginationNode: true }\n\ntype TreeNode = EntityHeaderNode | RootNodeConfiguration | PaginationNode\n\nfunction getTreeNodeType(\n node: TreeNode,\n): 'entityHeader' | 'rootNodeConfiguration' | 'pagination' {\n if ('__paginationNode' in node) {\n return 'pagination'\n }\n return 'id' in node ? 'entityHeader' : 'rootNodeConfiguration'\n}\n\nfunction isPaginationNode(node: TreeNode): node is PaginationNode {\n return getTreeNodeType(node) === 'pagination'\n}\n\nfunction isEntityHeaderNode(node: TreeNode): node is EntityHeaderNode {\n return getTreeNodeType(node) === 'entityHeader'\n}\n\nfunction isRootNodeConfiguration(\n node: TreeNode,\n): node is RootNodeConfiguration {\n return getTreeNodeType(node) === 'rootNodeConfiguration'\n}\n\nfunction hasMoreChildren(node: TreeNode) {\n if (isPaginationNode(node)) {\n return false\n } else if (isRootNodeConfiguration(node)) {\n return node.hasNextPage\n }\n\n return node.children == null || node.childrenNextPageToken != null\n}\n\nfunction isLeafNode(node: TreeNode) {\n if (isPaginationNode(node)) {\n return true\n } else if (isRootNodeConfiguration(node)) {\n return false\n } else {\n return (\n // Entity is not a container\n !isContainerType(getEntityTypeFromHeader(node)) ||\n // OR Children have been fetched (nonnull) and there are 0 children\n node.children?.length === 0\n )\n }\n}\n\nfunction maybeHasChildren(\n node: TreeNode,\n): node is RootNodeConfiguration | EntityHeaderNode {\n if (isPaginationNode(node)) {\n return false\n } else if (isRootNodeConfiguration(node)) {\n return node.children.length > 0 || node.hasNextPage\n } else {\n return !isLeafNode(node)\n }\n}\n\nexport type TreeData = VariableSizeNodeData &\n Readonly<{\n node: TreeNode\n getNextPageOfChildren: () => Promise<void>\n isLeaf: boolean\n nestingLevel: number\n setSelectedId: (entityId: string) => void\n treeNodeType: EntityTreeNodeType\n isSelected: boolean\n isDisabled: boolean\n }>\n\ntype NodeMeta = Readonly<{\n nestingLevel: number\n node: TreeNode\n}>\n\nexport type RootNodeConfiguration = {\n show: boolean\n nodeText: string\n children: EntityHeaderNode[]\n /** If undefined, no more entities to fetch */\n fetchNextPage: () => Promise<void>\n hasNextPage: boolean\n}\n\n/**\n * Converts a TreeNode and related data into a TreeWalkerValue that react-vtree can use to render the tree.\n * Exported for testing purposes only.\n * @param config\n * @returns\n */\nexport const getNodeData = (config: {\n node: TreeNode\n nestingLevel: number\n getNextPageOfChildren: () => Promise<void>\n setSelectedId: (entityId: string) => void\n treeNodeType: EntityTreeNodeType\n selected: EntitySelectionMapType\n selectableTypes: EntityType[]\n autoExpand: (entityId: string) => boolean\n defaultHeight: number\n currentContainer?: string | 'root' | null\n}): TreeWalkerValue<TreeData, NodeMeta> => {\n const {\n node,\n nestingLevel,\n getNextPageOfChildren,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n defaultHeight,\n currentContainer,\n } = config\n\n if (isPaginationNode(node)) {\n throw new Error('Cannot create data for a pagination node')\n }\n\n const id = isRootNodeConfiguration(node) ? 'root' : node.id\n\n const isSelected =\n treeNodeType === EntityTreeNodeType.SINGLE_PANE\n ? selected.has(id)\n : currentContainer === id\n const isDisabled =\n !isRootNodeConfiguration(node) &&\n !selectableTypes.includes(getEntityTypeFromHeader(node))\n\n const isOpenByDefault = autoExpand(id)\n /*\n * If the node is open by default and we haven't fetched its children,\n * fetch the first page (otherwise we won't fetch unless re-toggled)\n */\n if (isOpenByDefault && node.children == null && hasMoreChildren(node)) {\n getNextPageOfChildren()\n }\n\n return {\n data: {\n node,\n getNextPageOfChildren,\n id: id,\n isLeaf: isLeafNode(node),\n isOpenByDefault: isOpenByDefault,\n nestingLevel,\n setSelectedId,\n treeNodeType,\n isSelected,\n isDisabled,\n defaultHeight,\n },\n nestingLevel,\n node,\n }\n}\n\n/**\n * Node component for the react-vtree virtualized tree. Exported only for testing purposes\n */\nexport function Node(\n props: NodeComponentProps<TreeData, VariableSizeNodePublicState<TreeData>>,\n) {\n const {\n data: {\n node,\n getNextPageOfChildren,\n isLeaf,\n id,\n nestingLevel,\n setSelectedId,\n treeNodeType,\n isSelected,\n isDisabled,\n },\n isOpen,\n style,\n setOpen,\n } = props\n\n const [isLoading, setLoading] = useState(false)\n\n const nodeText = isEntityHeaderNode(node) ? (\n <span>{node.name}</span>\n ) : isRootNodeConfiguration(node) ? (\n <span>{node.nodeText}</span>\n ) : (\n // Pagination node\n <Skeleton width={100} />\n )\n\n // We only use this for pagination nodes. If the pagination node comes into view, then immediately call `getNextPageOfChildren`\n const { ref, inView } = useInView()\n\n useEffect(() => {\n if (isPaginationNode(node) && inView) {\n getNextPageOfChildren()\n }\n }, [node, inView, getNextPageOfChildren])\n\n const toggleExpand = useCallback(async () => {\n if (hasMoreChildren(node)) {\n setLoading(true)\n await getNextPageOfChildren()\n await setOpen(!isOpen)\n setLoading(false)\n } else {\n await setOpen(!isOpen)\n }\n }, [getNextPageOfChildren, node, isOpen, setOpen])\n\n /**\n * If in the dual-pane view, expand a node when it becomes selected\n */\n useEffect(() => {\n if (\n treeNodeType === EntityTreeNodeType.DUAL_PANE &&\n isSelected &&\n !isOpen\n ) {\n toggleExpand()\n }\n // Intentionally only toggle the expanded state when isSelected changes, otherwise the node cannot be un-expanded\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n }, [isSelected])\n\n /**\n * If the height is 0, the node is purposefully hidden. Just render a fragment.\n */\n if ('height' in style && style.height === 0) {\n return <></>\n }\n\n let tooltipContent: ReactNode = ''\n if (isEntityHeaderNode(node)) {\n tooltipContent = (\n <div style={{ textAlign: 'center' }}>\n <Typography\n component=\"span\"\n variant=\"smallText1\"\n sx={{\n display: 'inline',\n }}\n >\n {node.name}\n <br />\n <b>ID: </b>\n {node.id}\n {'modifiedBy' in node && (\n <>\n <br />\n <b>Modified By: </b>\n <UserBadge\n userId={node.modifiedBy.toString()}\n showFullName\n disableLink\n showCardOnHover={false}\n />\n </>\n )}\n {'modifiedOn' in node && (\n <>\n <br />\n <b>Modified On: </b>\n {formatDate(dayjs(node.modifiedOn))}\n </>\n )}\n </Typography>\n </div>\n )\n }\n\n const ExpandIcon = isOpen ? ExpandMore : ChevronRight\n\n return (\n <div\n className={`Node ${\n treeNodeType === EntityTreeNodeType.SINGLE_PANE\n ? 'SelectNode'\n : 'BrowseNode'\n }`}\n aria-selected={isSelected}\n aria-disabled={isDisabled}\n onClick={event => {\n event.stopPropagation()\n if (!isDisabled) {\n setSelectedId(id)\n }\n }}\n style={{\n ...style,\n paddingLeft: `${nestingLevel * 20}px`,\n }}\n >\n {!isLeaf && (\n <>\n {isLoading ? (\n <SynapseSpinner size={10} />\n ) : (\n <button\n aria-label={isOpen ? 'Collapse' : 'Expand'}\n onClick={event => {\n event.stopPropagation()\n toggleExpand()\n }}\n >\n <ExpandIcon className=\"ExpandButton\" />\n </button>\n )}\n </>\n )}\n {treeNodeType === EntityTreeNodeType.SINGLE_PANE && ( // SWC-5592\n <div className=\"EntityIcon\">\n {isEntityHeaderNode(node) && (\n <EntityTypeIcon type={getEntityTypeFromHeader(node)} />\n )}\n </div>\n )}\n\n <Tooltip title={tooltipContent} placement=\"right\">\n <div className=\"EntityName\" ref={ref}>\n {nodeText}\n </div>\n </Tooltip>\n\n {treeNodeType === EntityTreeNodeType.SINGLE_PANE && (\n <EntityBadgeIcons\n entityId={id}\n showHasDiscussionThread={false}\n showHasWiki={false}\n showUnlink={false}\n canOpenModal={false}\n />\n )}\n </div>\n )\n}\n\n/**\n * Extracted from the React component for testing purposes\n * @returns a generator function compatible with react-vtree\n */\nexport function getTreeWalkerFunction(\n rootNode: RootNodeConfiguration,\n setSelectedId: VirtualizedTreeProps['setSelectedId'],\n treeNodeType: VirtualizedTreeProps['treeNodeType'],\n selected: VirtualizedTreeProps['selected'],\n selectableTypes: VirtualizedTreeProps['selectableTypes'],\n autoExpand: VirtualizedTreeProps['autoExpand'],\n itemSize: (index?: number) => number,\n currentContainer: VirtualizedTreeProps['currentContainer'],\n fetchNextPageOfChildren: (node: Writable<EntityHeaderNode>) => Promise<void>,\n): TreeWalker<TreeData, NodeMeta> {\n return function* treeWalker() {\n // Step [1]: Define the root node of our tree.\n yield getNodeData({\n node: rootNode,\n nestingLevel: 0,\n getNextPageOfChildren: rootNode.fetchNextPage,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n defaultHeight: itemSize(),\n currentContainer,\n })\n\n while (true) {\n // Step [2]: Get the parent node and nesting level, which will be passed into the Generator.next function by react-vtree.\n // Yielding `undefined` indicates to react-vtree that we've finished iterating children from the last time we were in the loop.\n const parentMeta = yield\n\n if (maybeHasChildren(parentMeta.node)) {\n // Step [3]: Yielding all the known children of the parent\n if (parentMeta.node.children) {\n for (let i = 0; i < parentMeta.node.children.length; i++) {\n const childNode = parentMeta.node.children[i]\n\n yield getNodeData({\n node: childNode,\n nestingLevel: parentMeta.nestingLevel + 1,\n getNextPageOfChildren: () => fetchNextPageOfChildren(childNode),\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n defaultHeight: itemSize(),\n currentContainer,\n })\n }\n }\n\n // Step [4] - If the parent node has more children, render a \"pagination node\" that will fetch more children when it comes into view (via intersection observer)\n if (hasMoreChildren(parentMeta.node)) {\n const paginationNode: PaginationNode = {\n __paginationNode: true,\n }\n const paginationTreeWalkerValue: TreeWalkerValue<TreeData, NodeMeta> =\n {\n data: {\n id: parentMeta.data.id + '-pagination',\n node: paginationNode,\n isOpenByDefault: false,\n getNextPageOfChildren: parentMeta.data.getNextPageOfChildren,\n isLeaf: true,\n isSelected: false,\n defaultHeight: itemSize(),\n isDisabled: true,\n nestingLevel: parentMeta.nestingLevel + 1,\n setSelectedId: () => {},\n treeNodeType,\n },\n nestingLevel: parentMeta.nestingLevel + 1,\n node: {\n __paginationNode: true,\n },\n }\n yield paginationTreeWalkerValue\n }\n }\n }\n }\n}\n\nexport type VirtualizedTreeProps = Readonly<{\n treeNodeType: EntityTreeNodeType\n rootNodeConfiguration: RootNodeConfiguration\n setSelectedId: (entityId: string) => void\n selected: EntitySelectionMapType\n /* currentContainer is the container whose contents are shown on in the right pane in dual-pane configuration, and may only be defined when treeNodeType is DUAL_PANE */\n currentContainer?: string | 'root' | null\n autoExpand: (entityId: string) => boolean\n selectableTypes: EntityType[]\n visibleTypes: EntityType[]\n}>\n\n/**\n * Component that utilizes react-vtree to efficiently display a tree of entities. react-vtree utilizes react-window\n * to only render visible nodes, which eliminates performance issues as seen in SWC-5978.\n */\nexport const VirtualizedTree = (\n props: VirtualizedTreeProps,\n): React.ReactNode => {\n const {\n rootNodeConfiguration,\n setSelectedId,\n treeNodeType,\n selected,\n currentContainer,\n selectableTypes,\n visibleTypes,\n autoExpand,\n } = props\n\n const { accessToken, keyFactory } = useSynapseContext()\n const queryClient = useQueryClient()\n\n const [rootNode, setRootNode] = useState<RootNodeConfiguration>(\n rootNodeConfiguration,\n )\n\n const treeInstance = useRef<VariableSizeTree<TreeData>>(null)\n\n useEffect(() => {\n setRootNode(rootNodeConfiguration)\n }, [rootNodeConfiguration, rootNodeConfiguration.children])\n\n // This function is used by VariableSizeTree to identify the size of each node in the tree.\n const itemSize = useCallback(\n (index?: number) => {\n /**\n * We must have a root node, but we don't always want to show it.\n * In those cases, set the height of the root node to 0.\n */\n if (index === 0 && !rootNodeConfiguration.show) {\n return 0\n }\n /**\n * The height of all other nodes in the tree varies depending on the tree node type.\n */\n return treeNodeType === EntityTreeNodeType.DUAL_PANE ? 30 : 60\n },\n [treeNodeType, rootNodeConfiguration.show],\n )\n\n /**\n * Fetches the next page of children for a given node. After fetching the children, this method will make a deep clone of the\n * full tree, including the new data, and updates the state of the component\n */\n const fetchNextPageOfChildren = useCallback(\n // Because we update the root node with a copy at the end of this function, we can write to the node under update.\n async (node: Writable<EntityHeaderNode>) => {\n // Fetch the children of the node\n const entityChildrenRequest: EntityChildrenRequest = {\n parentId: node.id,\n nextPageToken: node.childrenNextPageToken,\n includeTypes: visibleTypes,\n }\n const children = await queryClient.fetchQuery({\n queryKey: keyFactory.getEntityChildrenQueryKey(\n entityChildrenRequest,\n false,\n ),\n queryFn: () => getEntityChildren(entityChildrenRequest, accessToken),\n })\n // Update the node data -- add the children and store the nextPageToken\n if (node.children) {\n for (const newChild of children.page) {\n // SWC-6751 - Prevent adding duplicate entries in case this function is called twice\n if (!node.children.find(child => child.id == newChild.id)) {\n node.children.push(newChild)\n }\n }\n } else {\n node.children = children.page\n }\n node.childrenNextPageToken = children.nextPageToken\n\n // Ensure the node for which we fetched children is expanded/open\n if (treeInstance.current) {\n await treeInstance.current.recomputeTree({\n [node.id]: {\n open: true,\n },\n })\n }\n\n // cloneDeep is required to re-render the tree with the new children\n setRootNode(cloneDeep(rootNode))\n },\n [visibleTypes, queryClient, keyFactory, rootNode, accessToken],\n )\n\n /**\n * treeWalker is a generator function used by react-vtree to generate the tree structure. The tree is re-built when the function is updated,\n * so the dependencies specified in useCallback are important.\n */\n const memoizedTreeWalker = useCallback(\n getTreeWalkerFunction(\n rootNode,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n itemSize,\n currentContainer,\n fetchNextPageOfChildren,\n ),\n [\n rootNode,\n setSelectedId,\n treeNodeType,\n selected,\n selectableTypes,\n autoExpand,\n currentContainer,\n fetchNextPageOfChildren,\n itemSize,\n ],\n )\n\n return (\n <AutoSizer disableWidth>\n {({ height }: { height: number }) => (\n <VariableSizeTree\n ref={treeInstance}\n treeWalker={memoizedTreeWalker}\n itemSize={itemSize}\n height={height}\n async={true}\n width=\"100%\"\n >\n {Node}\n </VariableSizeTree>\n )}\n </AutoSizer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAY,IAAL,yBAAA,GAAA;QAEL,EAAA,EAAA,cAAA,KAAA,eAEA,EAAA,EAAA,YAAA,KAAA;AACF,EAAA,CAAA,CAAA;AAmBA,SAAS,EACP,GACyD;CAIzD,OAHI,sBAAsB,IACjB,eAEF,QAAQ,IAAO,iBAAiB;AACzC;AAEA,SAAS,EAAiB,GAAwC;CAChE,OAAO,EAAgB,CAAI,MAAM;AACnC;AAEA,SAAS,EAAmB,GAA0C;CACpE,OAAO,EAAgB,CAAI,MAAM;AACnC;AAEA,SAAS,EACP,GAC+B;CAC/B,OAAO,EAAgB,CAAI,MAAM;AACnC;AAEA,SAAS,EAAgB,GAAgB;CAOvC,OANI,EAAiB,CAAI,IAChB,KACE,EAAwB,CAAI,IAC9B,EAAK,cAGP,EAAK,YAAY,QAAQ,EAAK,yBAAyB;AAChE;AAEA,SAAS,EAAW,GAAgB;CAMhC,OALE,EAAiB,CAAI,IAChB,KACE,EAAwB,CAAI,IAC9B,KA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tC,EAAK,KAAK,EACT,MAAM,GACR,EACF,CAAC,GAIH,EAAY,EAAU,CAAQ,CAAC;CACjC,GACA;EAAC;EAAc;EAAa;EAAY;EAAU;CAAW,CAC/D,GAMM,IAAqB,EACzB,EACE,GACA,GACA,GACA,GACA,GACA,GACA,GACA,GACA,CACF,GACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,OACE,kBAAC,GAAD;EAAW,cAAA;aACP,EAAE,gBACF,kBAAC,GAAD;GACE,KAAK;GACL,YAAY;GACF;GACF;GACR,OAAO;GACP,OAAM;aAEL;EACe,CAAA;CAEX,CAAA;AAEf"}
@@ -16,7 +16,7 @@ import { Fragment as l, useCallback as u, useEffect as d, useMemo as f, useState
16
16
  import { noop as ue, upperFirst as de } from "lodash-es";
17
17
  import { Alert as fe, AlertTitle as pe, Box as m, Button as h, IconButton as g, InputLabel as me, TextField as he, Tooltip as ge, Typography as _ } from "@mui/material";
18
18
  import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
19
- import { AddCircleTwoTone as _e } from "@mui/icons-material";
19
+ import _e from "@mui/icons-material/AddCircleTwoTone";
20
20
  import ve from "pluralize";
21
21
  import { flexRender as x, getCoreRowModel as ye, getFacetedMinMaxValues as be, getFacetedRowModel as xe, getFacetedUniqueValues as Se, getFilteredRowModel as Ce, getSortedRowModel as S, useReactTable as C } from "@tanstack/react-table";
22
22
  import w from "papaparse";
@@ -1 +1 @@
1
- {"version":3,"file":"EntityHeaderTable.js","names":[],"sources":["../../../src/components/EntityHeaderTable/EntityHeaderTable.tsx"],"sourcesContent":["import React from 'react'\nimport AddAd from '@/assets/icons/AddAd'\nimport { StyledTableContainer } from '@/components/styled/StyledTableContainer'\nimport { useGetEntityHeaders } from '@/synapse-queries/entity/useGetEntityHeaders'\nimport {\n entityTypeToFriendlyName,\n getEntityTypeFromHeader,\n normalizeSynPrefix,\n} from '@/utils/functions/EntityTypeUtils'\nimport { SYNAPSE_ENTITY_ID_REGEX } from '@/utils/functions/RegularExpressions'\nimport { AddCircleTwoTone } from '@mui/icons-material'\nimport {\n Alert,\n AlertTitle,\n Box,\n Button,\n IconButton,\n InputLabel,\n TextField,\n Tooltip,\n Typography,\n} from '@mui/material'\nimport { EntityHeader, ReferenceList } from '@sage-bionetworks/synapse-types'\nimport {\n ColumnDef,\n ColumnFiltersState,\n flexRender,\n getCoreRowModel,\n getFacetedMinMaxValues,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n getSortedRowModel,\n useReactTable,\n} from '@tanstack/react-table'\nimport { noop, upperFirst } from 'lodash-es'\nimport papaparseLib from 'papaparse'\n// papaparse is CJS-only; pull named values from the default export.\nconst { parse } = papaparseLib\nimport pluralize from 'pluralize'\nimport { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\nimport {\n EntityFinderModal,\n EntityFinderModalProps,\n} from '../EntityFinder/EntityFinderModal'\nimport { FinderScope } from '../EntityFinder/tree/EntityTree'\nimport { VersionSelectionType } from '../EntityFinder/VersionSelectionType'\nimport IconSvg from '../IconSvg'\nimport { SkeletonTable } from '../Skeleton'\nimport {\n CheckBoxCell,\n CheckBoxHeader,\n EntityHeaderIDCell,\n EntityHeaderNameCell,\n EntityHeaderTypeCell,\n} from './EntityHeaderTableCellRenderers'\nimport { Filter } from './Filter'\nimport { useEntityHeaderTableState } from './useEntityHeaderTableState'\n\nconst DEFAULT_FINDER_CONFIG: EntityFinderModalProps['configuration'] = {\n selectMultiple: true,\n versionSelection: VersionSelectionType.DISALLOWED,\n initialScope: FinderScope.ALL_PROJECTS,\n initialContainer: 'root',\n}\n\nexport type EntityHeaderTableProps = {\n references: ReferenceList\n isEditable: boolean\n disabled?: boolean\n onUpdate?: (updatedRefs: ReferenceList) => void // when the references are updated, EntityHeaderTable will call this function with the updated list\n removeSelectedRowsButtonText?: string\n onUpdateEntityIDsTextbox?: (value: string) => void // when the entity IDs text box is updated, this is called\n /* The word used to describe the items in the table. Default 'entity' */\n objectNameCopy?: string\n // If true, the text field where IDs are pasted is hidden, and confirming the entity finder will immediately call `onUpdate`\n hideTextFieldToPasteValue?: boolean\n entityFinderConfiguration?: EntityFinderModalProps['configuration']\n}\n\nconst UNMANAGEABLE_SUBJECT_COUNT = 10\n\n// extend EntityHeader to create dummy EntityHeader rows for those that the current user cannot view\nexport type EntityHeaderOrDummy = EntityHeader & { isDummy?: boolean }\n\n/**\n * Renders a sortable/filterable table for a set of entity references. If editable, onUpdate will be called back\n * on any entity added/removed.\n */\nexport const EntityHeaderTable = (\n props: EntityHeaderTableProps,\n): React.ReactNode => {\n const {\n references,\n isEditable,\n disabled,\n onUpdate = noop,\n removeSelectedRowsButtonText = 'Remove Selected Rows',\n onUpdateEntityIDsTextbox,\n objectNameCopy = 'entity',\n hideTextFieldToPasteValue = false,\n entityFinderConfiguration = DEFAULT_FINDER_CONFIG,\n } = props\n const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([])\n const [showEntityFinder, setShowEntityFinder] = useState<boolean>(false)\n\n const {\n rowSelection,\n setRowSelection,\n refsInState,\n setRefsInState,\n newEntityIDs,\n setNewEntityIDs,\n parseErrors,\n setParseErrors,\n } = useEntityHeaderTableState(references, onUpdateEntityIDsTextbox, onUpdate)\n\n const setInvalidEntityIDError = useCallback(\n (invalidEntityIDs: string[]) => {\n setParseErrors([`Invalid Synapse ID(s): ${invalidEntityIDs.join(',')}`])\n },\n [setParseErrors],\n )\n\n const addRefsFromEntityIDs = useCallback(\n (entityIDs: string[]) => {\n const newReferences: ReferenceList = entityIDs.map(id => {\n return {\n targetId: id.trim(),\n }\n })\n setRefsInState([...refsInState, ...newReferences])\n },\n [refsInState, setRefsInState],\n )\n\n const addPastedValuesToArray = useCallback(() => {\n if (newEntityIDs) {\n if (newEntityIDs.includes(',')) {\n parse<string[]>(newEntityIDs, {\n complete: result => {\n if (result.errors.length > 0) {\n const newParseErrors = result.errors.map(\n parseError => parseError.message,\n )\n setParseErrors(newParseErrors)\n } else {\n const newParsedEntityIDs = result.data[0]\n const invalidEntityIDs = newParsedEntityIDs.filter(\n id => !id.trim().match(SYNAPSE_ENTITY_ID_REGEX),\n )\n if (invalidEntityIDs.length > 0) {\n setInvalidEntityIDError(invalidEntityIDs)\n } else {\n addRefsFromEntityIDs(newParsedEntityIDs)\n }\n }\n },\n })\n } else {\n // single item\n if (!newEntityIDs.trim().match(SYNAPSE_ENTITY_ID_REGEX)) {\n setInvalidEntityIDError([newEntityIDs])\n } else {\n addRefsFromEntityIDs([newEntityIDs])\n }\n }\n } else {\n setParseErrors([])\n setNewEntityIDs('')\n }\n }, [\n addRefsFromEntityIDs,\n newEntityIDs,\n setInvalidEntityIDError,\n setNewEntityIDs,\n setParseErrors,\n ])\n\n const pluralObjectName = upperFirst(pluralize(objectNameCopy))\n\n const selectColumns: ColumnDef<EntityHeaderOrDummy, any>[] = useMemo(\n () => [\n {\n id: 'select',\n header: CheckBoxHeader,\n cell: CheckBoxCell,\n },\n ],\n [],\n )\n\n const entityHeaderColumns: ColumnDef<EntityHeaderOrDummy, any>[] = useMemo(\n () => [\n {\n accessorFn: (row: EntityHeaderOrDummy) => row.name,\n id: 'name',\n cell: EntityHeaderNameCell,\n header: 'Name',\n },\n {\n accessorFn: (row: EntityHeaderOrDummy) => row.id,\n id: 'id',\n cell: EntityHeaderIDCell,\n header: 'SynID',\n },\n {\n accessorFn: (row: EntityHeaderOrDummy) =>\n row.isDummy\n ? '-'\n : entityTypeToFriendlyName(getEntityTypeFromHeader(row)),\n id: 'type',\n header: 'Type',\n cell: EntityHeaderTypeCell,\n filterFn: 'includesString',\n },\n ],\n [],\n )\n\n const columns = useMemo<ColumnDef<EntityHeaderOrDummy, any>[]>(\n () =>\n isEditable\n ? selectColumns.concat(entityHeaderColumns)\n : entityHeaderColumns,\n [entityHeaderColumns, isEditable, selectColumns],\n )\n const selectionCount = Object.keys(rowSelection).length\n const {\n data: results,\n isSuccess,\n isLoading,\n } = useGetEntityHeaders(refsInState, {\n throwOnError: true,\n })\n\n const data = useMemo(() => {\n //create dummy entries for values that were not returned by the getEntityHeaders call!\n const newData = results ? results?.results : []\n const newDataEntityIds = new Set()\n newData.forEach(entityHeader =>\n newDataEntityIds.add(normalizeSynPrefix(entityHeader.id)),\n )\n const missingRefs = refsInState.filter(\n ref => !newDataEntityIds.has(normalizeSynPrefix(ref.targetId)),\n )\n const dummyEntityHeaders: EntityHeaderOrDummy[] = missingRefs.map(ref => {\n return {\n id: ref.targetId,\n name: ref.targetId,\n benefactorId: -1,\n type: 'org.sagebionetworks.repo.model.Project',\n createdOn: '',\n modifiedOn: '',\n createdBy: '',\n modifiedBy: '',\n isLatestVersion: true,\n isDummy: true,\n }\n })\n return newData.concat(dummyEntityHeaders)\n }, [refsInState, results])\n const table = useReactTable({\n data,\n columns,\n state: {\n rowSelection,\n columnFilters,\n },\n enableRowSelection: isEditable,\n onRowSelectionChange: setRowSelection,\n onColumnFiltersChange: setColumnFilters,\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getFacetedRowModel: getFacetedRowModel(),\n getFacetedUniqueValues: getFacetedUniqueValues(),\n getFacetedMinMaxValues: getFacetedMinMaxValues(),\n // debugTable: true,\n // debugHeaders: true,\n // debugColumns: false,\n columnResizeMode: 'onChange',\n })\n\n const onRemove = useCallback(() => {\n // rowSelection looks like {3: true. 5: true} where the key is the row index.\n // Create a new ReferenceList based on the entityHeaders in the current table.\n const updatedData = data.filter(\n (_value, index) => !(rowSelection[index] === true),\n )\n const newRowRefs: ReferenceList = updatedData.map(entityHeader => {\n return {\n targetId: entityHeader.id,\n }\n })\n setRefsInState(newRowRefs)\n }, [data, rowSelection, setRefsInState])\n\n const isSelection = selectionCount > 0\n const totalRowCount = data.length\n const filteredRowCount = table.getPrePaginationRowModel().rows.length\n const showFilterControls = totalRowCount > UNMANAGEABLE_SUBJECT_COUNT\n\n /**\n * Reset the column filters when the filter controls are hidden.\n * This handles the following edge case:\n * 1. List contains 100 items of type \"A\" and 1 of type \"B\"\n * 2. User filters to show just \"A\" items\n * 3. User removes all \"A\" items\n * 4. Only the single \"B\" item remains, but the filter is still present on type \"A\".\n * The filter controls are hidden, so the user cannot see the \"B\" item.\n *\n * This effect will clear the filters when the filter controls are hidden, preventing this scenario.\n */\n useEffect(\n function resetFiltersWhenFilterControlsAreHidden() {\n if (!showFilterControls) {\n table.setColumnFilters([])\n }\n },\n [table, showFilterControls],\n )\n\n if (isLoading) {\n return (\n <SkeletonTable numCols={3} numRows={Math.min(10, refsInState.length)} />\n )\n } else if (!isSuccess) {\n return <></>\n }\n return (\n <div>\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'space-between',\n p: '12px 10px 10px 5px',\n }}\n >\n {showFilterControls && (\n <Typography variant=\"body1\" sx={{ marginBottom: '10px' }}>\n {totalRowCount} {pluralObjectName}{' '}\n {filteredRowCount < totalRowCount\n ? `(${filteredRowCount} visible)`\n : ''}\n {isSelection && <span>{` (${selectionCount} selected)`}</span>}\n </Typography>\n )}\n {isEditable && refsInState.length > 0 && (\n <Button\n variant=\"contained\"\n disabled={!isSelection || disabled}\n onClick={onRemove}\n >\n {removeSelectedRowsButtonText}\n </Button>\n )}\n </Box>\n <Box\n sx={{\n display: 'flex',\n pb: 2,\n }}\n >\n {table.getHeaderGroups().map(headerGroup =>\n headerGroup.headers.map(header => {\n return header.isPlaceholder ? null : (\n <Fragment key={header.column.id}>\n {header.column.getCanFilter() && showFilterControls ? (\n <Box sx={{ flexGrow: 1 }}>\n <Filter column={header.column} table={table} />\n </Box>\n ) : null}\n </Fragment>\n )\n }),\n )}\n </Box>\n {totalRowCount > 0 && (\n <StyledTableContainer\n sx={{\n th: {\n zIndex: 100,\n maxHeight: '250px',\n },\n }}\n >\n <table style={{ borderCollapse: 'collapse', width: '100%' }}>\n <thead>\n {table.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(header => {\n let columnSize: string = '5%'\n switch (header.id) {\n case 'name':\n columnSize = '50%'\n break\n case 'id':\n columnSize = '22%'\n break\n case 'type':\n columnSize = '22%'\n break\n default:\n break\n }\n return (\n <th\n key={header.id}\n colSpan={header.colSpan}\n style={{\n width: columnSize,\n position: 'sticky',\n top: '0px',\n }}\n >\n {header.isPlaceholder ? null : (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n }}\n >\n {flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n <Box\n sx={{\n mx: 'auto',\n }}\n />\n {header.column.getCanSort() && (\n <IconButton\n onClick={header.column.getToggleSortingHandler()}\n size={'small'}\n sx={{\n marginLeft: 'auto',\n marginRight: '16px',\n }}\n >\n <IconSvg\n icon={\n header.column.getIsSorted() === 'asc'\n ? 'sortUp'\n : 'sortDown'\n }\n wrap={false}\n fontSize={'inherit'}\n sx={{\n color: header.column.getIsSorted()\n ? 'primary.main'\n : 'grey.700',\n backgroundColor: 'none',\n }}\n />\n </IconButton>\n )}\n </Box>\n )}\n {header.column.getCanResize() && (\n <div\n className={`resizer ${\n header.column.getIsResizing() ? 'isResizing' : ''\n }`}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n />\n )}\n </th>\n )\n })}\n </tr>\n ))}\n </thead>\n <tbody>\n {table.getRowModel().rows.map(row => {\n return (\n <tr key={row.id} style={{ height: '30px' }}>\n {row.getVisibleCells().map(cell => {\n return (\n <td\n key={cell.id}\n style={{\n width: cell.column.getSize(),\n }}\n >\n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext(),\n )}\n </td>\n )\n })}\n </tr>\n )\n })}\n </tbody>\n </table>\n </StyledTableContainer>\n )}\n <EntityFinderModal\n configuration={entityFinderConfiguration}\n promptCopy={`Select ${pluralObjectName} to add to the Synapse ID list`}\n show={showEntityFinder}\n title={`Select ${pluralObjectName}`}\n confirmButtonCopy={`Add ${pluralObjectName}`}\n onConfirm={items => {\n if (hideTextFieldToPasteValue) {\n const newRefs = [...refsInState, ...items]\n setRefsInState(newRefs)\n onUpdate(newRefs)\n } else {\n const newEntityIDsArray = items.map(ref => ref.targetId)\n const newEntityIDsString =\n newEntityIDs.trim().length > 0\n ? newEntityIDs.concat(',')\n : newEntityIDs\n const newValue = newEntityIDsString.concat(\n newEntityIDsArray.join(','),\n )\n setNewEntityIDs(newValue)\n }\n setShowEntityFinder(false)\n }}\n onCancel={() => setShowEntityFinder(false)}\n />\n {isEditable && (\n <Box sx={{ marginTop: '10px' }}>\n {hideTextFieldToPasteValue && (\n <Button\n variant=\"outlined\"\n onClick={() => {\n setShowEntityFinder(true)\n }}\n startIcon={<AddAd />}\n disabled={disabled}\n >\n Add {pluralObjectName}\n </Button>\n )}\n {!hideTextFieldToPasteValue && (\n <>\n <InputLabel htmlFor=\"synIDs\">Add Synapse IDs</InputLabel>\n <Box\n sx={{ display: 'grid', gridTemplateColumns: 'auto 50px 150px' }}\n >\n <TextField\n id=\"synIDs\"\n name=\"synIDs\"\n fullWidth\n onChange={e => {\n setNewEntityIDs(e.target.value)\n }}\n value={newEntityIDs}\n placeholder=\"Enter a list of Synapse IDs (i.e. 'syn123, syn456')\"\n disabled={disabled}\n />\n <Box sx={{ padding: '5px 0px 0px 5px' }}>\n {/* Entity finder button. On select, append the selected entity ID to the newSynIDs list */}\n <Tooltip title=\"Add a Synapse ID to the list via the Entity Finder\">\n <IconButton\n disabled={disabled}\n onClick={() => {\n setShowEntityFinder(true)\n }}\n >\n <AddAd />\n </IconButton>\n </Tooltip>\n </Box>\n <Button\n variant=\"outlined\"\n onClick={addPastedValuesToArray}\n disabled={\n isLoading || newEntityIDs.trim().length == 0 || disabled\n }\n startIcon={<AddCircleTwoTone />}\n >\n Add {pluralObjectName}\n </Button>\n </Box>\n </>\n )}\n {parseErrors && parseErrors.length > 0 && (\n <Alert severity={'error'} sx={{ my: 2 }}>\n <AlertTitle>Parsing errors encountered:</AlertTitle>\n <ul>\n {parseErrors.map((error, index) => {\n return (\n <Typography\n component={parseErrors.length > 1 ? 'li' : 'span'}\n key={index}\n variant={'smallText1'}\n sx={{\n lineHeight: 1.5,\n }}\n >\n {error}\n </Typography>\n )\n })}\n </ul>\n </Alert>\n )}\n </Box>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAM,EAAE,aAAU,GAqBZ,IAAiE;CACrE,gBAAgB;CAChB,kBAAkB,EAAqB;CACvC,cAAc,EAAY;CAC1B,kBAAkB;AACpB,GAgBM,IAA6B,IAStB,KACX,MACoB;CACpB,IAAM,EACJ,eACA,eACA,aACA,cAAW,IACX,kCAA+B,wBAC/B,8BACA,qBAAiB,UACjB,+BAA4B,IAC5B,gCAA4B,MAC1B,GACE,CAAC,IAAe,MAAoB,EAA6B,CAAC,CAAC,GACnE,CAAC,IAAkB,KAAuB,EAAkB,EAAK,GAEjE,EACJ,iBACA,qBACA,gBACA,mBACA,iBACA,oBACA,gBACA,sBACE,EAA0B,GAAY,IAA0B,CAAQ,GAEtE,IAA0B,GAC7B,MAA+B;EAC9B,EAAe,CAAC,0BAA0B,EAAiB,KAAK,GAAG,GAAG,CAAC;CACzE,GACA,CAAC,CAAc,CACjB,GAEM,IAAuB,GAC1B,MAAwB;EACvB,IAAM,IAA+B,EAAU,KAAI,OAC1C,EACL,UAAU,EAAG,KAAK,EACpB,EACD;EACD,EAAe,CAAC,GAAG,GAAa,GAAG,CAAa,CAAC;CACnD,GACA,CAAC,GAAa,CAAc,CAC9B,GAEM,KAAyB,QAAkB;EAC/C,AAAI,IACE,EAAa,SAAS,GAAG,IAC3B,EAAgB,GAAc,EAC5B,WAAU,MAAU;GAClB,IAAI,EAAO,OAAO,SAAS,GAIzB,EAHuB,EAAO,OAAO,KACnC,MAAc,EAAW,OAEZ,CAAc;QACxB;IACL,IAAM,IAAqB,EAAO,KAAK,IACjC,IAAmB,EAAmB,QAC1C,MAAM,CAAC,EAAG,KAAK,EAAE,MAAM,CAAuB,CAChD;IACA,AAAI,EAAiB,SAAS,IAC5B,EA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AEN;;CAEJ,EAAA,CAAA,IAvRE,kBAAA,GAAA,CAAI,CAAA;AAyRf"}
1
+ {"version":3,"file":"EntityHeaderTable.js","names":[],"sources":["../../../src/components/EntityHeaderTable/EntityHeaderTable.tsx"],"sourcesContent":["import React from 'react'\nimport AddAd from '@/assets/icons/AddAd'\nimport { StyledTableContainer } from '@/components/styled/StyledTableContainer'\nimport { useGetEntityHeaders } from '@/synapse-queries/entity/useGetEntityHeaders'\nimport {\n entityTypeToFriendlyName,\n getEntityTypeFromHeader,\n normalizeSynPrefix,\n} from '@/utils/functions/EntityTypeUtils'\nimport { SYNAPSE_ENTITY_ID_REGEX } from '@/utils/functions/RegularExpressions'\nimport AddCircleTwoTone from '@mui/icons-material/AddCircleTwoTone'\nimport {\n Alert,\n AlertTitle,\n Box,\n Button,\n IconButton,\n InputLabel,\n TextField,\n Tooltip,\n Typography,\n} from '@mui/material'\nimport { EntityHeader, ReferenceList } from '@sage-bionetworks/synapse-types'\nimport {\n ColumnDef,\n ColumnFiltersState,\n flexRender,\n getCoreRowModel,\n getFacetedMinMaxValues,\n getFacetedRowModel,\n getFacetedUniqueValues,\n getFilteredRowModel,\n getSortedRowModel,\n useReactTable,\n} from '@tanstack/react-table'\nimport { noop, upperFirst } from 'lodash-es'\nimport papaparseLib from 'papaparse'\n// papaparse is CJS-only; pull named values from the default export.\nconst { parse } = papaparseLib\nimport pluralize from 'pluralize'\nimport { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\nimport {\n EntityFinderModal,\n EntityFinderModalProps,\n} from '../EntityFinder/EntityFinderModal'\nimport { FinderScope } from '../EntityFinder/tree/EntityTree'\nimport { VersionSelectionType } from '../EntityFinder/VersionSelectionType'\nimport IconSvg from '../IconSvg'\nimport { SkeletonTable } from '../Skeleton'\nimport {\n CheckBoxCell,\n CheckBoxHeader,\n EntityHeaderIDCell,\n EntityHeaderNameCell,\n EntityHeaderTypeCell,\n} from './EntityHeaderTableCellRenderers'\nimport { Filter } from './Filter'\nimport { useEntityHeaderTableState } from './useEntityHeaderTableState'\n\nconst DEFAULT_FINDER_CONFIG: EntityFinderModalProps['configuration'] = {\n selectMultiple: true,\n versionSelection: VersionSelectionType.DISALLOWED,\n initialScope: FinderScope.ALL_PROJECTS,\n initialContainer: 'root',\n}\n\nexport type EntityHeaderTableProps = {\n references: ReferenceList\n isEditable: boolean\n disabled?: boolean\n onUpdate?: (updatedRefs: ReferenceList) => void // when the references are updated, EntityHeaderTable will call this function with the updated list\n removeSelectedRowsButtonText?: string\n onUpdateEntityIDsTextbox?: (value: string) => void // when the entity IDs text box is updated, this is called\n /* The word used to describe the items in the table. Default 'entity' */\n objectNameCopy?: string\n // If true, the text field where IDs are pasted is hidden, and confirming the entity finder will immediately call `onUpdate`\n hideTextFieldToPasteValue?: boolean\n entityFinderConfiguration?: EntityFinderModalProps['configuration']\n}\n\nconst UNMANAGEABLE_SUBJECT_COUNT = 10\n\n// extend EntityHeader to create dummy EntityHeader rows for those that the current user cannot view\nexport type EntityHeaderOrDummy = EntityHeader & { isDummy?: boolean }\n\n/**\n * Renders a sortable/filterable table for a set of entity references. If editable, onUpdate will be called back\n * on any entity added/removed.\n */\nexport const EntityHeaderTable = (\n props: EntityHeaderTableProps,\n): React.ReactNode => {\n const {\n references,\n isEditable,\n disabled,\n onUpdate = noop,\n removeSelectedRowsButtonText = 'Remove Selected Rows',\n onUpdateEntityIDsTextbox,\n objectNameCopy = 'entity',\n hideTextFieldToPasteValue = false,\n entityFinderConfiguration = DEFAULT_FINDER_CONFIG,\n } = props\n const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([])\n const [showEntityFinder, setShowEntityFinder] = useState<boolean>(false)\n\n const {\n rowSelection,\n setRowSelection,\n refsInState,\n setRefsInState,\n newEntityIDs,\n setNewEntityIDs,\n parseErrors,\n setParseErrors,\n } = useEntityHeaderTableState(references, onUpdateEntityIDsTextbox, onUpdate)\n\n const setInvalidEntityIDError = useCallback(\n (invalidEntityIDs: string[]) => {\n setParseErrors([`Invalid Synapse ID(s): ${invalidEntityIDs.join(',')}`])\n },\n [setParseErrors],\n )\n\n const addRefsFromEntityIDs = useCallback(\n (entityIDs: string[]) => {\n const newReferences: ReferenceList = entityIDs.map(id => {\n return {\n targetId: id.trim(),\n }\n })\n setRefsInState([...refsInState, ...newReferences])\n },\n [refsInState, setRefsInState],\n )\n\n const addPastedValuesToArray = useCallback(() => {\n if (newEntityIDs) {\n if (newEntityIDs.includes(',')) {\n parse<string[]>(newEntityIDs, {\n complete: result => {\n if (result.errors.length > 0) {\n const newParseErrors = result.errors.map(\n parseError => parseError.message,\n )\n setParseErrors(newParseErrors)\n } else {\n const newParsedEntityIDs = result.data[0]\n const invalidEntityIDs = newParsedEntityIDs.filter(\n id => !id.trim().match(SYNAPSE_ENTITY_ID_REGEX),\n )\n if (invalidEntityIDs.length > 0) {\n setInvalidEntityIDError(invalidEntityIDs)\n } else {\n addRefsFromEntityIDs(newParsedEntityIDs)\n }\n }\n },\n })\n } else {\n // single item\n if (!newEntityIDs.trim().match(SYNAPSE_ENTITY_ID_REGEX)) {\n setInvalidEntityIDError([newEntityIDs])\n } else {\n addRefsFromEntityIDs([newEntityIDs])\n }\n }\n } else {\n setParseErrors([])\n setNewEntityIDs('')\n }\n }, [\n addRefsFromEntityIDs,\n newEntityIDs,\n setInvalidEntityIDError,\n setNewEntityIDs,\n setParseErrors,\n ])\n\n const pluralObjectName = upperFirst(pluralize(objectNameCopy))\n\n const selectColumns: ColumnDef<EntityHeaderOrDummy, any>[] = useMemo(\n () => [\n {\n id: 'select',\n header: CheckBoxHeader,\n cell: CheckBoxCell,\n },\n ],\n [],\n )\n\n const entityHeaderColumns: ColumnDef<EntityHeaderOrDummy, any>[] = useMemo(\n () => [\n {\n accessorFn: (row: EntityHeaderOrDummy) => row.name,\n id: 'name',\n cell: EntityHeaderNameCell,\n header: 'Name',\n },\n {\n accessorFn: (row: EntityHeaderOrDummy) => row.id,\n id: 'id',\n cell: EntityHeaderIDCell,\n header: 'SynID',\n },\n {\n accessorFn: (row: EntityHeaderOrDummy) =>\n row.isDummy\n ? '-'\n : entityTypeToFriendlyName(getEntityTypeFromHeader(row)),\n id: 'type',\n header: 'Type',\n cell: EntityHeaderTypeCell,\n filterFn: 'includesString',\n },\n ],\n [],\n )\n\n const columns = useMemo<ColumnDef<EntityHeaderOrDummy, any>[]>(\n () =>\n isEditable\n ? selectColumns.concat(entityHeaderColumns)\n : entityHeaderColumns,\n [entityHeaderColumns, isEditable, selectColumns],\n )\n const selectionCount = Object.keys(rowSelection).length\n const {\n data: results,\n isSuccess,\n isLoading,\n } = useGetEntityHeaders(refsInState, {\n throwOnError: true,\n })\n\n const data = useMemo(() => {\n //create dummy entries for values that were not returned by the getEntityHeaders call!\n const newData = results ? results?.results : []\n const newDataEntityIds = new Set()\n newData.forEach(entityHeader =>\n newDataEntityIds.add(normalizeSynPrefix(entityHeader.id)),\n )\n const missingRefs = refsInState.filter(\n ref => !newDataEntityIds.has(normalizeSynPrefix(ref.targetId)),\n )\n const dummyEntityHeaders: EntityHeaderOrDummy[] = missingRefs.map(ref => {\n return {\n id: ref.targetId,\n name: ref.targetId,\n benefactorId: -1,\n type: 'org.sagebionetworks.repo.model.Project',\n createdOn: '',\n modifiedOn: '',\n createdBy: '',\n modifiedBy: '',\n isLatestVersion: true,\n isDummy: true,\n }\n })\n return newData.concat(dummyEntityHeaders)\n }, [refsInState, results])\n const table = useReactTable({\n data,\n columns,\n state: {\n rowSelection,\n columnFilters,\n },\n enableRowSelection: isEditable,\n onRowSelectionChange: setRowSelection,\n onColumnFiltersChange: setColumnFilters,\n getCoreRowModel: getCoreRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getFacetedRowModel: getFacetedRowModel(),\n getFacetedUniqueValues: getFacetedUniqueValues(),\n getFacetedMinMaxValues: getFacetedMinMaxValues(),\n // debugTable: true,\n // debugHeaders: true,\n // debugColumns: false,\n columnResizeMode: 'onChange',\n })\n\n const onRemove = useCallback(() => {\n // rowSelection looks like {3: true. 5: true} where the key is the row index.\n // Create a new ReferenceList based on the entityHeaders in the current table.\n const updatedData = data.filter(\n (_value, index) => !(rowSelection[index] === true),\n )\n const newRowRefs: ReferenceList = updatedData.map(entityHeader => {\n return {\n targetId: entityHeader.id,\n }\n })\n setRefsInState(newRowRefs)\n }, [data, rowSelection, setRefsInState])\n\n const isSelection = selectionCount > 0\n const totalRowCount = data.length\n const filteredRowCount = table.getPrePaginationRowModel().rows.length\n const showFilterControls = totalRowCount > UNMANAGEABLE_SUBJECT_COUNT\n\n /**\n * Reset the column filters when the filter controls are hidden.\n * This handles the following edge case:\n * 1. List contains 100 items of type \"A\" and 1 of type \"B\"\n * 2. User filters to show just \"A\" items\n * 3. User removes all \"A\" items\n * 4. Only the single \"B\" item remains, but the filter is still present on type \"A\".\n * The filter controls are hidden, so the user cannot see the \"B\" item.\n *\n * This effect will clear the filters when the filter controls are hidden, preventing this scenario.\n */\n useEffect(\n function resetFiltersWhenFilterControlsAreHidden() {\n if (!showFilterControls) {\n table.setColumnFilters([])\n }\n },\n [table, showFilterControls],\n )\n\n if (isLoading) {\n return (\n <SkeletonTable numCols={3} numRows={Math.min(10, refsInState.length)} />\n )\n } else if (!isSuccess) {\n return <></>\n }\n return (\n <div>\n <Box\n sx={{\n display: 'flex',\n justifyContent: 'space-between',\n p: '12px 10px 10px 5px',\n }}\n >\n {showFilterControls && (\n <Typography variant=\"body1\" sx={{ marginBottom: '10px' }}>\n {totalRowCount} {pluralObjectName}{' '}\n {filteredRowCount < totalRowCount\n ? `(${filteredRowCount} visible)`\n : ''}\n {isSelection && <span>{` (${selectionCount} selected)`}</span>}\n </Typography>\n )}\n {isEditable && refsInState.length > 0 && (\n <Button\n variant=\"contained\"\n disabled={!isSelection || disabled}\n onClick={onRemove}\n >\n {removeSelectedRowsButtonText}\n </Button>\n )}\n </Box>\n <Box\n sx={{\n display: 'flex',\n pb: 2,\n }}\n >\n {table.getHeaderGroups().map(headerGroup =>\n headerGroup.headers.map(header => {\n return header.isPlaceholder ? null : (\n <Fragment key={header.column.id}>\n {header.column.getCanFilter() && showFilterControls ? (\n <Box sx={{ flexGrow: 1 }}>\n <Filter column={header.column} table={table} />\n </Box>\n ) : null}\n </Fragment>\n )\n }),\n )}\n </Box>\n {totalRowCount > 0 && (\n <StyledTableContainer\n sx={{\n th: {\n zIndex: 100,\n maxHeight: '250px',\n },\n }}\n >\n <table style={{ borderCollapse: 'collapse', width: '100%' }}>\n <thead>\n {table.getHeaderGroups().map(headerGroup => (\n <tr key={headerGroup.id}>\n {headerGroup.headers.map(header => {\n let columnSize: string = '5%'\n switch (header.id) {\n case 'name':\n columnSize = '50%'\n break\n case 'id':\n columnSize = '22%'\n break\n case 'type':\n columnSize = '22%'\n break\n default:\n break\n }\n return (\n <th\n key={header.id}\n colSpan={header.colSpan}\n style={{\n width: columnSize,\n position: 'sticky',\n top: '0px',\n }}\n >\n {header.isPlaceholder ? null : (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n }}\n >\n {flexRender(\n header.column.columnDef.header,\n header.getContext(),\n )}\n <Box\n sx={{\n mx: 'auto',\n }}\n />\n {header.column.getCanSort() && (\n <IconButton\n onClick={header.column.getToggleSortingHandler()}\n size={'small'}\n sx={{\n marginLeft: 'auto',\n marginRight: '16px',\n }}\n >\n <IconSvg\n icon={\n header.column.getIsSorted() === 'asc'\n ? 'sortUp'\n : 'sortDown'\n }\n wrap={false}\n fontSize={'inherit'}\n sx={{\n color: header.column.getIsSorted()\n ? 'primary.main'\n : 'grey.700',\n backgroundColor: 'none',\n }}\n />\n </IconButton>\n )}\n </Box>\n )}\n {header.column.getCanResize() && (\n <div\n className={`resizer ${\n header.column.getIsResizing() ? 'isResizing' : ''\n }`}\n onMouseDown={header.getResizeHandler()}\n onTouchStart={header.getResizeHandler()}\n />\n )}\n </th>\n )\n })}\n </tr>\n ))}\n </thead>\n <tbody>\n {table.getRowModel().rows.map(row => {\n return (\n <tr key={row.id} style={{ height: '30px' }}>\n {row.getVisibleCells().map(cell => {\n return (\n <td\n key={cell.id}\n style={{\n width: cell.column.getSize(),\n }}\n >\n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext(),\n )}\n </td>\n )\n })}\n </tr>\n )\n })}\n </tbody>\n </table>\n </StyledTableContainer>\n )}\n <EntityFinderModal\n configuration={entityFinderConfiguration}\n promptCopy={`Select ${pluralObjectName} to add to the Synapse ID list`}\n show={showEntityFinder}\n title={`Select ${pluralObjectName}`}\n confirmButtonCopy={`Add ${pluralObjectName}`}\n onConfirm={items => {\n if (hideTextFieldToPasteValue) {\n const newRefs = [...refsInState, ...items]\n setRefsInState(newRefs)\n onUpdate(newRefs)\n } else {\n const newEntityIDsArray = items.map(ref => ref.targetId)\n const newEntityIDsString =\n newEntityIDs.trim().length > 0\n ? newEntityIDs.concat(',')\n : newEntityIDs\n const newValue = newEntityIDsString.concat(\n newEntityIDsArray.join(','),\n )\n setNewEntityIDs(newValue)\n }\n setShowEntityFinder(false)\n }}\n onCancel={() => setShowEntityFinder(false)}\n />\n {isEditable && (\n <Box sx={{ marginTop: '10px' }}>\n {hideTextFieldToPasteValue && (\n <Button\n variant=\"outlined\"\n onClick={() => {\n setShowEntityFinder(true)\n }}\n startIcon={<AddAd />}\n disabled={disabled}\n >\n Add {pluralObjectName}\n </Button>\n )}\n {!hideTextFieldToPasteValue && (\n <>\n <InputLabel htmlFor=\"synIDs\">Add Synapse IDs</InputLabel>\n <Box\n sx={{ display: 'grid', gridTemplateColumns: 'auto 50px 150px' }}\n >\n <TextField\n id=\"synIDs\"\n name=\"synIDs\"\n fullWidth\n onChange={e => {\n setNewEntityIDs(e.target.value)\n }}\n value={newEntityIDs}\n placeholder=\"Enter a list of Synapse IDs (i.e. 'syn123, syn456')\"\n disabled={disabled}\n />\n <Box sx={{ padding: '5px 0px 0px 5px' }}>\n {/* Entity finder button. On select, append the selected entity ID to the newSynIDs list */}\n <Tooltip title=\"Add a Synapse ID to the list via the Entity Finder\">\n <IconButton\n disabled={disabled}\n onClick={() => {\n setShowEntityFinder(true)\n }}\n >\n <AddAd />\n </IconButton>\n </Tooltip>\n </Box>\n <Button\n variant=\"outlined\"\n onClick={addPastedValuesToArray}\n disabled={\n isLoading || newEntityIDs.trim().length == 0 || disabled\n }\n startIcon={<AddCircleTwoTone />}\n >\n Add {pluralObjectName}\n </Button>\n </Box>\n </>\n )}\n {parseErrors && parseErrors.length > 0 && (\n <Alert severity={'error'} sx={{ my: 2 }}>\n <AlertTitle>Parsing errors encountered:</AlertTitle>\n <ul>\n {parseErrors.map((error, index) => {\n return (\n <Typography\n component={parseErrors.length > 1 ? 'li' : 'span'}\n key={index}\n variant={'smallText1'}\n sx={{\n lineHeight: 1.5,\n }}\n >\n {error}\n </Typography>\n )\n })}\n </ul>\n </Alert>\n )}\n </Box>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsCA,IAAM,EAAE,aAAU,GAqBZ,IAAiE;CACrE,gBAAgB;CAChB,kBAAkB,EAAqB;CACvC,cAAc,EAAY;CAC1B,kBAAkB;AACpB,GAgBM,IAA6B,IAStB,KACX,MACoB;CACpB,IAAM,EACJ,eACA,eACA,aACA,cAAW,IACX,kCAA+B,wBAC/B,8BACA,qBAAiB,UACjB,+BAA4B,IAC5B,gCAA4B,MAC1B,GACE,CAAC,IAAe,MAAoB,EAA6B,CAAC,CAAC,GACnE,CAAC,IAAkB,KAAuB,EAAkB,EAAK,GAEjE,EACJ,iBACA,qBACA,gBACA,mBACA,iBACA,oBACA,gBACA,sBACE,EAA0B,GAAY,IAA0B,CAAQ,GAEtE,IAA0B,GAC7B,MAA+B;EAC9B,EAAe,CAAC,0BAA0B,EAAiB,KAAK,GAAG,GAAG,CAAC;CACzE,GACA,CAAC,CAAc,CACjB,GAEM,IAAuB,GAC1B,MAAwB;EACvB,IAAM,IAA+B,EAAU,KAAI,OAC1C,EACL,UAAU,EAAG,KAAK,EACpB,EACD;EACD,EAAe,CAA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kBAAC,IAAD,CAAmB,CAAA;iBANhC,CAOC,QACM,CACC;;KACL;MACL,EAAA,CAAA;IAEH,KAAe,EAAY,SAAS,KACnC,kBAAC,IAAD;KAAO,UAAU;KAAS,IAAI,EAAE,IAAI,EAAE;eAAtC,CACE,kBAAC,IAAD,EAAA,UAAY,8BAAuC,CAAA,GACnD,kBAAC,MAAD,EAAA,UACG,EAAY,KAAK,GAAO,MAErB,kBAAC,GAAD;MACE,WAAW,EAAY,SAAS,IAAI,OAAO;MAE3C,SAAS;MACT,IAAI,EACF,YAAY,IACd;gBAEC;KACS,GAPL,CAOK,CAEf,EACC,CAAA,CACC;;GAEN;;CAEJ,EAAA,CAAA,IAvRE,kBAAA,GAAA,CAAI,CAAA;AAyRf"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityNameCell.d.ts","sourceRoot":"","sources":["../../../../src/components/EntityTreeTable/components/EntityNameCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAQpD,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,eAAe,EAAE,OAAO,CAAC,CAgEpE,CAAA"}
1
+ {"version":3,"file":"EntityNameCell.d.ts","sourceRoot":"","sources":["../../../../src/components/EntityTreeTable/components/EntityNameCell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AASpD,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAE1C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAAC,eAAe,EAAE,OAAO,CAAC,CAgEpE,CAAA"}
@@ -3,7 +3,8 @@ import { EntityLink as t } from "../../EntityLink.js";
3
3
  import { useEntityTreeTableContext as n } from "./EntityTreeTableContext.js";
4
4
  import { IconButton as r } from "@mui/material";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import { ChevronRight as o, ExpandMore as s } from "@mui/icons-material";
6
+ import o from "@mui/icons-material/ChevronRight";
7
+ import s from "@mui/icons-material/ExpandMore";
7
8
  import { Box as c } from "@mui/system";
8
9
  //#region src/components/EntityTreeTable/components/EntityNameCell.tsx
9
10
  var l = 16, u = ({ row: l }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"EntityNameCell.js","names":[],"sources":["../../../../src/components/EntityTreeTable/components/EntityNameCell.tsx"],"sourcesContent":["import { CellContext } from '@tanstack/react-table'\nimport { EntityBundleRow } from '../EntityTreeTable'\nimport { Box } from '@mui/system'\nimport { IconButton } from '@mui/material'\nimport { ChevronRight, ExpandMore } from '@mui/icons-material'\nimport { useEntityTreeTableContext } from './EntityTreeTableContext'\nimport { EntityLink } from '@/components/EntityLink'\nimport { SynapseSpinner } from '@/components/LoadingScreen/LoadingScreen'\n\nexport const depthPaddingMultiplierPx = 16\n\nexport const NameCell: React.FC<CellContext<EntityBundleRow, unknown>> = ({\n row,\n}) => {\n const {\n expanded,\n loadingIds,\n handleToggleExpanded,\n onEntityIdClicked,\n disableEntityLinks,\n } = useEntityTreeTableContext()\n const { entityHeader, depth, isLeaf } = row.original\n const isExpanded = !!expanded[entityHeader.id]\n const hasChildren = !isLeaf\n return (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n pl: `${depth * depthPaddingMultiplierPx}px`,\n }}\n >\n {hasChildren && (\n <IconButton\n size=\"small\"\n loading={loadingIds.has(entityHeader.id)}\n loadingIndicator={<SynapseSpinner />}\n onClick={() => handleToggleExpanded(entityHeader.id)}\n aria-label={isExpanded ? 'Collapse' : 'Expand'}\n >\n {isExpanded ? <ExpandMore /> : <ChevronRight />}\n </IconButton>\n )}\n {!hasChildren && <Box sx={{ width: 32 }} />}\n\n {/*\n Ensure the name column can shrink and long names are truncated.\n `minWidth: 0` is required on flex children so `overflow: hidden`\n can actually clip the content. We target descendant `a` and `p`\n elements because `EntityLink` renders a MUI Link (anchor) or a p.\n */}\n <Box\n sx={{\n flex: 1,\n minWidth: 0,\n marginLeft: 1,\n // Style the inner Link or paragraph for truncation\n '& a, & p': {\n display: 'block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n }}\n >\n <EntityLink\n entity={entityHeader}\n link={!disableEntityLinks}\n onEntityIdClicked={onEntityIdClicked}\n iconColor={'greyV2.800'}\n iconVariant=\"outlined\"\n />\n </Box>\n </Box>\n )\n}\n"],"mappings":";;;;;;;;AASA,IAAa,IAA2B,IAE3B,KAA6D,EACxE,aACI;CACJ,IAAM,EACJ,aACA,eACA,yBACA,sBACA,0BACE,EAA0B,GACxB,EAAE,iBAAc,UAAO,cAAW,EAAI,UACtC,IAAa,CAAC,CAAC,EAAS,EAAa,KACrC,IAAc,CAAC;CACrB,OACE,kBAAC,GAAD;EACE,IAAI;GACF,SAAS;GACT,YAAY;GACZ,IAAI,GAAG,IAAA,GAAiC;EAC1C;YALF;GAOG,KACC,kBAAC,GAAD;IACE,MAAK;IACL,SAAS,EAAW,IAAI,EAAa,EAAE;IACvC,kBAAkB,kBAAC,GAAD,CAAiB,CAAA;IACnC,eAAe,EAAqB,EAAa,EAAE;IACnD,cAAY,IAAa,aAAa;cAExB,EAAb,IAAc,IAAiB,GAAlB,CAAa,CAAmB;GACpC,CAAA;GAEb,CAAC,KAAe,kBAAC,GAAD,EAAK,IAAI,EAAE,OAAO,GAAG,EAAI,CAAA;GAQ1C,kBAAC,GAAD;IACE,IAAI;KACF,MAAM;KACN,UAAU;KACV,YAAY;KAEZ,YAAY;MACV,SAAS;MACT,UAAU;MACV,cAAc;MACd,YAAY;KACd;IACF;cAEA,kBAAC,GAAD;KACE,QAAQ;KACR,MAAM,CAAC;KACY;KACnB,WAAW;KACX,aAAY;IACb,CAAA;GACE,CAAA;EACF;;AAET"}
1
+ {"version":3,"file":"EntityNameCell.js","names":[],"sources":["../../../../src/components/EntityTreeTable/components/EntityNameCell.tsx"],"sourcesContent":["import { CellContext } from '@tanstack/react-table'\nimport { EntityBundleRow } from '../EntityTreeTable'\nimport { Box } from '@mui/system'\nimport { IconButton } from '@mui/material'\nimport ChevronRight from '@mui/icons-material/ChevronRight'\nimport ExpandMore from '@mui/icons-material/ExpandMore'\nimport { useEntityTreeTableContext } from './EntityTreeTableContext'\nimport { EntityLink } from '@/components/EntityLink'\nimport { SynapseSpinner } from '@/components/LoadingScreen/LoadingScreen'\n\nexport const depthPaddingMultiplierPx = 16\n\nexport const NameCell: React.FC<CellContext<EntityBundleRow, unknown>> = ({\n row,\n}) => {\n const {\n expanded,\n loadingIds,\n handleToggleExpanded,\n onEntityIdClicked,\n disableEntityLinks,\n } = useEntityTreeTableContext()\n const { entityHeader, depth, isLeaf } = row.original\n const isExpanded = !!expanded[entityHeader.id]\n const hasChildren = !isLeaf\n return (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n pl: `${depth * depthPaddingMultiplierPx}px`,\n }}\n >\n {hasChildren && (\n <IconButton\n size=\"small\"\n loading={loadingIds.has(entityHeader.id)}\n loadingIndicator={<SynapseSpinner />}\n onClick={() => handleToggleExpanded(entityHeader.id)}\n aria-label={isExpanded ? 'Collapse' : 'Expand'}\n >\n {isExpanded ? <ExpandMore /> : <ChevronRight />}\n </IconButton>\n )}\n {!hasChildren && <Box sx={{ width: 32 }} />}\n\n {/*\n Ensure the name column can shrink and long names are truncated.\n `minWidth: 0` is required on flex children so `overflow: hidden`\n can actually clip the content. We target descendant `a` and `p`\n elements because `EntityLink` renders a MUI Link (anchor) or a p.\n */}\n <Box\n sx={{\n flex: 1,\n minWidth: 0,\n marginLeft: 1,\n // Style the inner Link or paragraph for truncation\n '& a, & p': {\n display: 'block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n },\n }}\n >\n <EntityLink\n entity={entityHeader}\n link={!disableEntityLinks}\n onEntityIdClicked={onEntityIdClicked}\n iconColor={'greyV2.800'}\n iconVariant=\"outlined\"\n />\n </Box>\n </Box>\n )\n}\n"],"mappings":";;;;;;;;;AAUA,IAAa,IAA2B,IAE3B,KAA6D,EACxE,aACI;CACJ,IAAM,EACJ,aACA,eACA,yBACA,sBACA,0BACE,EAA0B,GACxB,EAAE,iBAAc,UAAO,cAAW,EAAI,UACtC,IAAa,CAAC,CAAC,EAAS,EAAa,KACrC,IAAc,CAAC;CACrB,OACE,kBAAC,GAAD;EACE,IAAI;GACF,SAAS;GACT,YAAY;GACZ,IAAI,GAAG,IAAA,GAAiC;EAC1C;YALF;GAOG,KACC,kBAAC,GAAD;IACE,MAAK;IACL,SAAS,EAAW,IAAI,EAAa,EAAE;IACvC,kBAAkB,kBAAC,GAAD,CAAiB,CAAA;IACnC,eAAe,EAAqB,EAAa,EAAE;IACnD,cAAY,IAAa,aAAa;cAExB,EAAb,IAAc,IAAiB,GAAlB,CAAa,CAAmB;GACpC,CAAA;GAEb,CAAC,KAAe,kBAAC,GAAD,EAAK,IAAI,EAAE,OAAO,GAAG,EAAI,CAAA;GAQ1C,kBAAC,GAAD;IACE,IAAI;KACF,MAAM;KACN,UAAU;KACV,YAAY;KAEZ,YAAY;MACV,SAAS;MACT,UAAU;MACV,cAAc;MACd,YAAY;KACd;IACF;cAEA,kBAAC,GAAD;KACE,QAAQ;KACR,MAAM,CAAC;KACY;KACnB,WAAW;KACX,aAAY;IACb,CAAA;GACE,CAAA;EACF;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadProgress.d.ts","sourceRoot":"","sources":["../../../src/components/EntityUpload/FileUploadProgress.tsx"],"names":[],"mappings":"AAiBA,MAAM,MAAM,uBAAuB,GAAG;IACpC,gCAAgC;IAChC,MAAM,EACF,WAAW,GACX,WAAW,GACX,QAAQ,GACR,kBAAkB,GAClB,QAAQ,GACR,UAAU,CAAA;IACd,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,CAAA;IACxB,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,yCAAyC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,wCAAwC,KAAK,CAAA;AAE1D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CA+KhE"}
1
+ {"version":3,"file":"FileUploadProgress.d.ts","sourceRoot":"","sources":["../../../src/components/EntityUpload/FileUploadProgress.tsx"],"names":[],"mappings":"AAeA,MAAM,MAAM,uBAAuB,GAAG;IACpC,gCAAgC;IAChC,MAAM,EACF,WAAW,GACX,WAAW,GACX,QAAQ,GACR,kBAAkB,GAClB,QAAQ,GACR,UAAU,CAAA;IACd,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,qCAAqC;IACrC,gBAAgB,EAAE,MAAM,CAAA;IACxB,uDAAuD;IACvD,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,yCAAyC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,gCAAgC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,wCAAwC,KAAK,CAAA;AAE1D;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CA+KhE"}
@@ -1,8 +1,12 @@
1
1
  import { calculateFriendlyFileSize as e } from "../../utils/functions/calculateFriendlyFileSize.js";
2
2
  import { Box as t, IconButton as n, LinearProgress as r, Tooltip as i, Typography as a } from "@mui/material";
3
3
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
4
- import { CheckCircleTwoTone as l, DeleteTwoTone as u, ErrorTwoTone as d, Pause as f, PlayArrow as p } from "@mui/icons-material";
5
- import m from "@mui/icons-material/Close";
4
+ import l from "@mui/icons-material/CheckCircleTwoTone";
5
+ import u from "@mui/icons-material/ErrorTwoTone";
6
+ import d from "@mui/icons-material/Close";
7
+ import f from "@mui/icons-material/DeleteTwoTone";
8
+ import p from "@mui/icons-material/Pause";
9
+ import m from "@mui/icons-material/PlayArrow";
6
10
  //#region src/components/EntityUpload/FileUploadProgress.tsx
7
11
  var h = 92;
8
12
  function g(h) {
@@ -40,7 +44,7 @@ function g(h) {
40
44
  children: [
41
45
  O && /* @__PURE__ */ s(i, {
42
46
  title: w,
43
- children: /* @__PURE__ */ s(d, { color: "error" })
47
+ children: /* @__PURE__ */ s(u, { color: "error" })
44
48
  }),
45
49
  !E && /* @__PURE__ */ s(i, {
46
50
  title: "Cancel",
@@ -49,7 +53,7 @@ function g(h) {
49
53
  onClick: () => {
50
54
  v();
51
55
  },
52
- children: /* @__PURE__ */ s(m, {})
56
+ children: /* @__PURE__ */ s(d, {})
53
57
  })
54
58
  }),
55
59
  k && /* @__PURE__ */ s(i, {
@@ -59,7 +63,7 @@ function g(h) {
59
63
  onClick: () => {
60
64
  y();
61
65
  },
62
- children: /* @__PURE__ */ s(f, {})
66
+ children: /* @__PURE__ */ s(p, {})
63
67
  })
64
68
  }),
65
69
  T && /* @__PURE__ */ s(i, {
@@ -69,7 +73,7 @@ function g(h) {
69
73
  onClick: () => {
70
74
  b();
71
75
  },
72
- children: /* @__PURE__ */ s(p, {})
76
+ children: /* @__PURE__ */ s(m, {})
73
77
  })
74
78
  }),
75
79
  E && /* @__PURE__ */ s(i, {
@@ -79,7 +83,7 @@ function g(h) {
79
83
  onClick: () => {
80
84
  x();
81
85
  },
82
- children: /* @__PURE__ */ s(u, {})
86
+ children: /* @__PURE__ */ s(f, {})
83
87
  })
84
88
  })
85
89
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"FileUploadProgress.js","names":[],"sources":["../../../src/components/EntityUpload/FileUploadProgress.tsx"],"sourcesContent":["import { calculateFriendlyFileSize } from '@/utils/functions/calculateFriendlyFileSize'\nimport {\n CheckCircleTwoTone,\n DeleteTwoTone,\n ErrorTwoTone,\n Pause,\n PlayArrow,\n} from '@mui/icons-material'\nimport CloseIcon from '@mui/icons-material/Close'\nimport {\n Box,\n IconButton,\n LinearProgress,\n Tooltip,\n Typography,\n} from '@mui/material'\n\nexport type FileUploadProgressProps = {\n /** The status of the upload. */\n status:\n | 'PREPARING'\n | 'UPLOADING'\n | 'PAUSED'\n | 'CANCELED_BY_USER'\n | 'FAILED'\n | 'COMPLETE'\n /** The name of the file */\n fileName: string\n /** The size of the file, in bytes */\n totalSizeInBytes: number\n /** The number of this file's bytes uploaded so far. */\n uploadedSizeInBytes?: number\n /** Invoked when the upload is cancelled. */\n onCancel: () => void\n /** Invoked when the upload is paused. */\n onPause: () => void\n /** Invoked when the resumed. */\n onResume: () => void\n /** Invoked when the upload is removed from the list. */\n onRemove: () => void\n /** An optional error message to display if the upload has been cancelled due to error. */\n errorMessage?: string\n}\n\nexport const FILE_UPLOAD_PROGRESS_COMPONENT_HEIGHT_PX = 92\n\n/**\n * Component that displays the upload progress of a file, with controls to pause or cancel the upload.\n */\nexport function FileUploadProgress(props: FileUploadProgressProps) {\n const {\n status,\n fileName,\n onCancel,\n onPause,\n onResume,\n onRemove,\n uploadedSizeInBytes = 0,\n totalSizeInBytes,\n errorMessage,\n } = props\n\n const isPaused = status === 'PAUSED'\n const isCanceled = status === 'CANCELED_BY_USER' || status === 'FAILED'\n const isComplete = status === 'COMPLETE'\n const isFailed = status === 'FAILED'\n const isUploading = status === 'UPLOADING'\n const isPreparingUpload = status === 'PREPARING'\n\n let progress: number | undefined =\n (uploadedSizeInBytes / totalSizeInBytes) * 100\n\n if (isPreparingUpload) {\n progress = undefined\n } else if (isFailed || isCanceled) {\n progress = 0\n }\n\n return (\n <Box\n sx={{\n py: 2,\n height: `${FILE_UPLOAD_PROGRESS_COMPONENT_HEIGHT_PX}px`,\n }}\n >\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n height: '35px',\n }}\n >\n <Typography\n variant={'body1'}\n sx={{\n color: 'primary.main',\n fontWeight: 700,\n }}\n >\n {fileName}\n </Typography>\n {!isComplete && (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: 1,\n my: 1,\n }}\n >\n {isFailed && (\n <Tooltip title={errorMessage}>\n <ErrorTwoTone color={'error'} />\n </Tooltip>\n )}\n {!isCanceled && (\n <Tooltip title={'Cancel'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onCancel()\n }}\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n {isUploading && (\n <Tooltip title={'Pause'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onPause()\n }}\n >\n <Pause />\n </IconButton>\n </Tooltip>\n )}\n {isPaused && (\n <Tooltip title={'Resume'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onResume()\n }}\n >\n <PlayArrow />\n </IconButton>\n </Tooltip>\n )}\n {isCanceled && (\n <Tooltip title={'Remove'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onRemove()\n }}\n >\n <DeleteTwoTone />\n </IconButton>\n </Tooltip>\n )}\n </Box>\n )}\n {isComplete && <CheckCircleTwoTone color={'success'} />}\n </Box>\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'nowrap',\n alignItems: 'center',\n }}\n >\n <LinearProgress\n color={'secondary'}\n value={progress}\n variant={isPreparingUpload ? 'indeterminate' : 'determinate'}\n sx={{ width: '100%', mr: 2.5 }}\n />\n {!isCanceled && (\n <Typography\n variant={'body1'}\n sx={{\n whiteSpace: 'nowrap',\n flexShrink: 0,\n }}\n >\n {isPreparingUpload ? (\n 'Preparing to upload...'\n ) : (\n <>\n <span>{calculateFriendlyFileSize(uploadedSizeInBytes, 1)}</span>\n <Box\n component={'span'}\n sx={{\n color: 'grey.600',\n mx: 0.5,\n }}\n >\n |\n </Box>\n <span>{calculateFriendlyFileSize(totalSizeInBytes, 1)}</span>\n </>\n )}\n </Typography>\n )}\n {isCanceled && (\n <Typography\n variant={'body1'}\n sx={{\n whiteSpace: 'nowrap',\n flexShrink: 0,\n }}\n >\n {isFailed ? 'Failed' : 'Canceled'}\n </Typography>\n )}\n </Box>\n </Box>\n )\n}\n"],"mappings":";;;;;;AA4CA,IAAa,IAA2C;AAKxD,SAAgB,EAAmB,GAAgC;CACjE,IAAM,EACJ,WACA,aACA,aACA,YACA,aACA,aACA,yBAAsB,GACtB,qBACA,oBACE,GAEE,IAAW,MAAW,UACtB,IAAa,MAAW,sBAAsB,MAAW,UACzD,IAAa,MAAW,YACxB,IAAW,MAAW,UACtB,IAAc,MAAW,aACzB,IAAoB,MAAW,aAEjC,IACD,IAAsB,IAAoB;CAQ7C,OANI,IACF,IAAW,KAAA,KACF,KAAY,OACrB,IAAW,IAIX,kBAAC,GAAD;EACE,IAAI;GACF,IAAI;GACJ,QAAQ;EACV;YAJF,CAME,kBAAC,GAAD;GACE,IAAI;IACF,SAAS;IACT,UAAU;IACV,eAAe;IACf,gBAAgB;IAChB,YAAY;IACZ,QAAQ;GACV;aARF;IAUE,kBAAC,GAAD;KACE,SAAS;KACT,IAAI;MACF,OAAO;MACP,YAAY;KACd;eAEC;IACS,CAAA;IACX,CAAC,KACA,kBAAC,GAAD;KACE,IAAI;MACF,SAAS;MACT,YAAY;MACZ,KAAK;MACL,IAAI;KACN;eANF;MAQG,KACC,kBAAC,GAAD;O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AAkB,CAAC,EAAQ,CAAA;KAC5D,EAAA,CAAA;IAEM,CAAA;IAEb,KACC,kBAAC,GAAD;KACE,SAAS;KACT,IAAI;MACF,YAAY;MACZ,YAAY;KACd;eAEC,IAAW,WAAW;IACb,CAAA;GAEX;IACF;;AAET"}
1
+ {"version":3,"file":"FileUploadProgress.js","names":[],"sources":["../../../src/components/EntityUpload/FileUploadProgress.tsx"],"sourcesContent":["import { calculateFriendlyFileSize } from '@/utils/functions/calculateFriendlyFileSize'\nimport CheckCircleTwoTone from '@mui/icons-material/CheckCircleTwoTone'\nimport DeleteTwoTone from '@mui/icons-material/DeleteTwoTone'\nimport ErrorTwoTone from '@mui/icons-material/ErrorTwoTone'\nimport Pause from '@mui/icons-material/Pause'\nimport PlayArrow from '@mui/icons-material/PlayArrow'\nimport CloseIcon from '@mui/icons-material/Close'\nimport {\n Box,\n IconButton,\n LinearProgress,\n Tooltip,\n Typography,\n} from '@mui/material'\n\nexport type FileUploadProgressProps = {\n /** The status of the upload. */\n status:\n | 'PREPARING'\n | 'UPLOADING'\n | 'PAUSED'\n | 'CANCELED_BY_USER'\n | 'FAILED'\n | 'COMPLETE'\n /** The name of the file */\n fileName: string\n /** The size of the file, in bytes */\n totalSizeInBytes: number\n /** The number of this file's bytes uploaded so far. */\n uploadedSizeInBytes?: number\n /** Invoked when the upload is cancelled. */\n onCancel: () => void\n /** Invoked when the upload is paused. */\n onPause: () => void\n /** Invoked when the resumed. */\n onResume: () => void\n /** Invoked when the upload is removed from the list. */\n onRemove: () => void\n /** An optional error message to display if the upload has been cancelled due to error. */\n errorMessage?: string\n}\n\nexport const FILE_UPLOAD_PROGRESS_COMPONENT_HEIGHT_PX = 92\n\n/**\n * Component that displays the upload progress of a file, with controls to pause or cancel the upload.\n */\nexport function FileUploadProgress(props: FileUploadProgressProps) {\n const {\n status,\n fileName,\n onCancel,\n onPause,\n onResume,\n onRemove,\n uploadedSizeInBytes = 0,\n totalSizeInBytes,\n errorMessage,\n } = props\n\n const isPaused = status === 'PAUSED'\n const isCanceled = status === 'CANCELED_BY_USER' || status === 'FAILED'\n const isComplete = status === 'COMPLETE'\n const isFailed = status === 'FAILED'\n const isUploading = status === 'UPLOADING'\n const isPreparingUpload = status === 'PREPARING'\n\n let progress: number | undefined =\n (uploadedSizeInBytes / totalSizeInBytes) * 100\n\n if (isPreparingUpload) {\n progress = undefined\n } else if (isFailed || isCanceled) {\n progress = 0\n }\n\n return (\n <Box\n sx={{\n py: 2,\n height: `${FILE_UPLOAD_PROGRESS_COMPONENT_HEIGHT_PX}px`,\n }}\n >\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n justifyContent: 'space-between',\n alignItems: 'center',\n height: '35px',\n }}\n >\n <Typography\n variant={'body1'}\n sx={{\n color: 'primary.main',\n fontWeight: 700,\n }}\n >\n {fileName}\n </Typography>\n {!isComplete && (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n gap: 1,\n my: 1,\n }}\n >\n {isFailed && (\n <Tooltip title={errorMessage}>\n <ErrorTwoTone color={'error'} />\n </Tooltip>\n )}\n {!isCanceled && (\n <Tooltip title={'Cancel'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onCancel()\n }}\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n )}\n {isUploading && (\n <Tooltip title={'Pause'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onPause()\n }}\n >\n <Pause />\n </IconButton>\n </Tooltip>\n )}\n {isPaused && (\n <Tooltip title={'Resume'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onResume()\n }}\n >\n <PlayArrow />\n </IconButton>\n </Tooltip>\n )}\n {isCanceled && (\n <Tooltip title={'Remove'}>\n <IconButton\n size={'small'}\n onClick={() => {\n onRemove()\n }}\n >\n <DeleteTwoTone />\n </IconButton>\n </Tooltip>\n )}\n </Box>\n )}\n {isComplete && <CheckCircleTwoTone color={'success'} />}\n </Box>\n <Box\n sx={{\n display: 'flex',\n flexWrap: 'nowrap',\n alignItems: 'center',\n }}\n >\n <LinearProgress\n color={'secondary'}\n value={progress}\n variant={isPreparingUpload ? 'indeterminate' : 'determinate'}\n sx={{ width: '100%', mr: 2.5 }}\n />\n {!isCanceled && (\n <Typography\n variant={'body1'}\n sx={{\n whiteSpace: 'nowrap',\n flexShrink: 0,\n }}\n >\n {isPreparingUpload ? (\n 'Preparing to upload...'\n ) : (\n <>\n <span>{calculateFriendlyFileSize(uploadedSizeInBytes, 1)}</span>\n <Box\n component={'span'}\n sx={{\n color: 'grey.600',\n mx: 0.5,\n }}\n >\n |\n </Box>\n <span>{calculateFriendlyFileSize(totalSizeInBytes, 1)}</span>\n </>\n )}\n </Typography>\n )}\n {isCanceled && (\n <Typography\n variant={'body1'}\n sx={{\n whiteSpace: 'nowrap',\n flexShrink: 0,\n }}\n >\n {isFailed ? 'Failed' : 'Canceled'}\n </Typography>\n )}\n </Box>\n </Box>\n )\n}\n"],"mappings":";;;;;;;;;;AA0CA,IAAa,IAA2C;AAKxD,SAAgB,EAAmB,GAAgC;CACjE,IAAM,EACJ,WACA,aACA,aACA,YACA,aACA,aACA,yBAAsB,GACtB,qBACA,oBACE,GAEE,IAAW,MAAW,UACtB,IAAa,MAAW,sBAAsB,MAAW,UACzD,IAAa,MAAW,YACxB,IAAW,MAAW,UACtB,IAAc,MAAW,aACzB,IAAoB,MAAW,aAEjC,IACD,IAAsB,IAAoB;CAQ7C,OANI,IACF,IAAW,KAAA,KACF,KAAY,OACrB,IAAW,IAIX,kBAAC,GAAD;EACE,IAAI;GACF,IAAI;GACJ,QAAQ;EACV;YAJF,CAME,kBAAC,GAAD;GACE,IAAI;IACF,SAAS;IACT,UAAU;IACV,eAAe;IACf,gBAAgB;IAChB,YAAY;IACZ,QAAQ;GACV;aARF;IAUE,kBAAC,GAAD;KACE,SAAS;KACT,IAAI;MACF,OAAO;MACP,YAAY;KACd;eAEC;IACS,CAAA;IACX,CAAC,KACA,kBAAC,GAAD;KACE,IAAI;MACF,SA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QACP,IAAI;OACN;iBACD;MAEI,CAAA;MACL,kBAAC,QAAD,EAAA,UAAO,EAA0B,GAAkB,CAAC,EAAQ,CAAA;KAC5D,EAAA,CAAA;IAEM,CAAA;IAEb,KACC,kBAAC,GAAD;KACE,SAAS;KACT,IAAI;MACF,YAAY;MACZ,YAAY;KACd;eAEC,IAAW,WAAW;IACb,CAAA;GAEX;IACF;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"EvaluationRoundLimitOptionsList.d.ts","sourceRoot":"","sources":["../../../../src/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAQlE,MAAM,MAAM,oCAAoC,GAAG;IACjD,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,YAAY,EAAE,CACZ,KAAK,EAAE,MAAM,KACV,CAAC,UAAU,EAAE,yBAAyB,KAAK,IAAI,CAAA;IAEpD,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,IAAI,CAAA;IAEhD,aAAa,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAA;CAC1D,CAAA;AAUD,wBAAgB,+BAA+B,CAAC,EAC9C,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,EAAE,oCAAoC,2CAqEtC"}
1
+ {"version":3,"file":"EvaluationRoundLimitOptionsList.d.ts","sourceRoot":"","sources":["../../../../src/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAQlE,MAAM,MAAM,oCAAoC,GAAG;IACjD,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,YAAY,EAAE,CACZ,KAAK,EAAE,MAAM,KACV,CAAC,UAAU,EAAE,yBAAyB,KAAK,IAAI,CAAA;IAEpD,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,IAAI,CAAA;IAEhD,aAAa,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,IAAI,CAAA;CAC1D,CAAA;AAUD,wBAAgB,+BAA+B,CAAC,EAC9C,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,aAAa,GACd,EAAE,oCAAoC,2CAqEtC"}
@@ -2,7 +2,8 @@ import { EvaluationRoundLimitOptions as e, LIMIT_TYPE_DISPLAY_NAME as t } from "
2
2
  import { Fragment as n, useCallback as r, useEffect as i } from "react";
3
3
  import { IconButton as a } from "@mui/material";
4
4
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
- import { AddBox as c, CloseTwoTone as l } from "@mui/icons-material";
5
+ import c from "@mui/icons-material/CloseTwoTone";
6
+ import l from "@mui/icons-material/AddBox";
6
7
  //#region src/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.tsx
7
8
  var u = Object.keys(t), d = (e) => u.find((t) => !e.has(t));
8
9
  function f({ limitInputs: t, handleChange: f, handleDeleteLimit: p, onAddNewLimit: m }) {
@@ -33,7 +34,7 @@ function f({ limitInputs: t, handleChange: f, handleDeleteLimit: p, onAddNewLimi
33
34
  height: "40px",
34
35
  width: "40px"
35
36
  },
36
- children: /* @__PURE__ */ o(l, {})
37
+ children: /* @__PURE__ */ o(c, {})
37
38
  }),
38
39
  i === t.length - 1 && t.length < u.length && /* @__PURE__ */ o(a, {
39
40
  size: "small",
@@ -45,7 +46,7 @@ function f({ limitInputs: t, handleChange: f, handleDeleteLimit: p, onAddNewLimi
45
46
  height: "40px",
46
47
  width: "40px"
47
48
  },
48
- children: /* @__PURE__ */ o(c, {})
49
+ children: /* @__PURE__ */ o(l, {})
49
50
  })
50
51
  ] }, r.type))
51
52
  });
@@ -1 +1 @@
1
- {"version":3,"file":"EvaluationRoundLimitOptionsList.js","names":[],"sources":["../../../../src/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.tsx"],"sourcesContent":["import { AddBox, CloseTwoTone } from '@mui/icons-material'\nimport { IconButton } from '@mui/material'\nimport { EvaluationRoundLimitType } from '@sage-bionetworks/synapse-types'\nimport { Fragment, useCallback, useEffect } from 'react'\nimport { EvaluationRoundLimitInput } from '../input_models/models'\nimport {\n EvaluationRoundLimitOptions,\n LIMIT_TYPE_DISPLAY_NAME,\n} from './EvaluationRoundLimitOptions'\n\nconst AVAILABLE_LIMIT_TYPES = Object.keys(LIMIT_TYPE_DISPLAY_NAME)\n\nexport type EvaluationRoundLimitOptionsListProps = {\n limitInputs: EvaluationRoundLimitInput[]\n handleChange: (\n index: number,\n ) => (limitInput: EvaluationRoundLimitInput) => void\n\n handleDeleteLimit: (index: number) => () => void\n\n onAddNewLimit: (limit: EvaluationRoundLimitInput) => void\n}\n\nconst selectUnusedType = (\n selectedTypes: Set<EvaluationRoundLimitType>,\n): EvaluationRoundLimitType => {\n return AVAILABLE_LIMIT_TYPES.find(\n key => !selectedTypes.has(key as EvaluationRoundLimitType),\n ) as EvaluationRoundLimitType\n}\n\nexport function EvaluationRoundLimitOptionsList({\n limitInputs,\n handleChange,\n handleDeleteLimit,\n onAddNewLimit,\n}: EvaluationRoundLimitOptionsListProps) {\n // all types that are currently being used\n const selectedTypes: Set<EvaluationRoundLimitType> = new Set(\n limitInputs.map(limit => limit.type),\n )\n\n const addNewLimit = useCallback(() => {\n onAddNewLimit({\n type: selectUnusedType(selectedTypes),\n maxSubmissionString: '',\n })\n }, [onAddNewLimit, selectedTypes])\n\n //display some input even if no limits currently exist\n useEffect(() => {\n if (limitInputs.length === 0) {\n addNewLimit()\n }\n }, [limitInputs, addNewLimit])\n\n return (\n <div\n data-testid=\"EvaluationRoundLimitOptionsList\"\n className=\"advanced-limits-grid\"\n >\n {limitInputs.map((limit, index) => {\n return (\n <Fragment key={limit.type}>\n <EvaluationRoundLimitOptions\n limitInput={limit}\n allSelectedTypes={selectedTypes}\n onChange={handleChange(index)}\n />\n\n {/*remove button for the EvaluationRoundLimitOptions*/}\n <IconButton\n size={'small'}\n color=\"primary\"\n aria-label=\"Remove\"\n className=\"remove-button\"\n onClick={handleDeleteLimit(index)}\n sx={{ height: '40px', width: '40px' }}\n >\n <CloseTwoTone />\n </IconButton>\n\n {/*conditionally create a \"add\" button*/}\n {\n // if last element\n index === limitInputs.length - 1 &&\n // if the are unused limit types\n limitInputs.length < AVAILABLE_LIMIT_TYPES.length && (\n <IconButton\n size={'small'}\n color=\"primary\"\n aria-label=\"Add\"\n onClick={addNewLimit}\n className=\"add-button\"\n sx={{ height: '40px', width: '40px' }}\n >\n <AddBox />\n </IconButton>\n )\n }\n </Fragment>\n )\n })}\n </div>\n )\n}\n"],"mappings":";;;;;;AAUA,IAAM,IAAwB,OAAO,KAAK,CAAuB,GAa3D,KACJ,MAEO,EAAsB,MAC3B,MAAO,CAAC,EAAc,IAAI,CAA+B,CAC3D;AAGF,SAAgB,EAAgC,EAC9C,gBACA,iBACA,sBACA,oBACuC;CAEvC,IAAM,IAA+C,IAAI,IACvD,EAAY,KAAI,MAAS,EAAM,IAAI,CACrC,GAEM,IAAc,QAAkB;EACpC,EAAc;GACZ,MAAM,EAAiB,CAAa;GACpC,qBAAqB;EACvB,CAAC;CACH,GAAG,CAAC,GAAe,CAAa,CAAC;CASjC,OANA,QAAgB;EACd,AAAI,EAAY,WAAW,KACzB,EAAY;CAEhB,GAAG,CAAC,GAAa,CAAW,CAAC,GAG3B,kBAAC,OAAD;EACE,eAAY;EACZ,WAAU;YAET,EAAY,KAAK,GAAO,MAErB,kBAAC,GAAD,EAAA,UAAA;GACE,kBAAC,GAAD;IACE,YAAY;IACZ,kBAAkB;IAClB,UAAU,EAAa,CAAK;GAC7B,CAAA;GAGD,kBAAC,GAAD;IACE,MAAM;IACN,OAAM;IACN,cAAW;IACX,WAAU;IACV,SAAS,EAAkB,CAAK;IAChC,IAAI;KAAE,QAAQ;KAAQ,OAAO;IAAO;cAEpC,kBAAC,GAAD,CAAe,CAAA;GACL,CAAA;GAKV,MAAU,EAAY,SAAS,KAE7B,EAAY,SAAS,EAAsB,UACzC,kBAAC,GAAD;IACE,MAAM;IACN,OAAM;IACN,cAAW;IACX,SAAS;IACT,WAAU;IACV,IAAI;KAAE,QAAQ;KAAQ,OAAO;IAAO;cAEpC,kBAAC,GAAD,CAAS,CAAA;GACC,CAAA;EAGV,EAAA,GArCK,EAAM,IAqCX,CAEb;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"EvaluationRoundLimitOptionsList.js","names":[],"sources":["../../../../src/components/Evaluation/round_limits/EvaluationRoundLimitOptionsList.tsx"],"sourcesContent":["import AddBox from '@mui/icons-material/AddBox'\nimport CloseTwoTone from '@mui/icons-material/CloseTwoTone'\nimport { IconButton } from '@mui/material'\nimport { EvaluationRoundLimitType } from '@sage-bionetworks/synapse-types'\nimport { Fragment, useCallback, useEffect } from 'react'\nimport { EvaluationRoundLimitInput } from '../input_models/models'\nimport {\n EvaluationRoundLimitOptions,\n LIMIT_TYPE_DISPLAY_NAME,\n} from './EvaluationRoundLimitOptions'\n\nconst AVAILABLE_LIMIT_TYPES = Object.keys(LIMIT_TYPE_DISPLAY_NAME)\n\nexport type EvaluationRoundLimitOptionsListProps = {\n limitInputs: EvaluationRoundLimitInput[]\n handleChange: (\n index: number,\n ) => (limitInput: EvaluationRoundLimitInput) => void\n\n handleDeleteLimit: (index: number) => () => void\n\n onAddNewLimit: (limit: EvaluationRoundLimitInput) => void\n}\n\nconst selectUnusedType = (\n selectedTypes: Set<EvaluationRoundLimitType>,\n): EvaluationRoundLimitType => {\n return AVAILABLE_LIMIT_TYPES.find(\n key => !selectedTypes.has(key as EvaluationRoundLimitType),\n ) as EvaluationRoundLimitType\n}\n\nexport function EvaluationRoundLimitOptionsList({\n limitInputs,\n handleChange,\n handleDeleteLimit,\n onAddNewLimit,\n}: EvaluationRoundLimitOptionsListProps) {\n // all types that are currently being used\n const selectedTypes: Set<EvaluationRoundLimitType> = new Set(\n limitInputs.map(limit => limit.type),\n )\n\n const addNewLimit = useCallback(() => {\n onAddNewLimit({\n type: selectUnusedType(selectedTypes),\n maxSubmissionString: '',\n })\n }, [onAddNewLimit, selectedTypes])\n\n //display some input even if no limits currently exist\n useEffect(() => {\n if (limitInputs.length === 0) {\n addNewLimit()\n }\n }, [limitInputs, addNewLimit])\n\n return (\n <div\n data-testid=\"EvaluationRoundLimitOptionsList\"\n className=\"advanced-limits-grid\"\n >\n {limitInputs.map((limit, index) => {\n return (\n <Fragment key={limit.type}>\n <EvaluationRoundLimitOptions\n limitInput={limit}\n allSelectedTypes={selectedTypes}\n onChange={handleChange(index)}\n />\n\n {/*remove button for the EvaluationRoundLimitOptions*/}\n <IconButton\n size={'small'}\n color=\"primary\"\n aria-label=\"Remove\"\n className=\"remove-button\"\n onClick={handleDeleteLimit(index)}\n sx={{ height: '40px', width: '40px' }}\n >\n <CloseTwoTone />\n </IconButton>\n\n {/*conditionally create a \"add\" button*/}\n {\n // if last element\n index === limitInputs.length - 1 &&\n // if the are unused limit types\n limitInputs.length < AVAILABLE_LIMIT_TYPES.length && (\n <IconButton\n size={'small'}\n color=\"primary\"\n aria-label=\"Add\"\n onClick={addNewLimit}\n className=\"add-button\"\n sx={{ height: '40px', width: '40px' }}\n >\n <AddBox />\n </IconButton>\n )\n }\n </Fragment>\n )\n })}\n </div>\n )\n}\n"],"mappings":";;;;;;;AAWA,IAAM,IAAwB,OAAO,KAAK,CAAuB,GAa3D,KACJ,MAEO,EAAsB,MAC3B,MAAO,CAAC,EAAc,IAAI,CAA+B,CAC3D;AAGF,SAAgB,EAAgC,EAC9C,gBACA,iBACA,sBACA,oBACuC;CAEvC,IAAM,IAA+C,IAAI,IACvD,EAAY,KAAI,MAAS,EAAM,IAAI,CACrC,GAEM,IAAc,QAAkB;EACpC,EAAc;GACZ,MAAM,EAAiB,CAAa;GACpC,qBAAqB;EACvB,CAAC;CACH,GAAG,CAAC,GAAe,CAAa,CAAC;CASjC,OANA,QAAgB;EACd,AAAI,EAAY,WAAW,KACzB,EAAY;CAEhB,GAAG,CAAC,GAAa,CAAW,CAAC,GAG3B,kBAAC,OAAD;EACE,eAAY;EACZ,WAAU;YAET,EAAY,KAAK,GAAO,MAErB,kBAAC,GAAD,EAAA,UAAA;GACE,kBAAC,GAAD;IACE,YAAY;IACZ,kBAAkB;IAClB,UAAU,EAAa,CAAK;GAC7B,CAAA;GAGD,kBAAC,GAAD;IACE,MAAM;IACN,OAAM;IACN,cAAW;IACX,WAAU;IACV,SAAS,EAAkB,CAAK;IAChC,IAAI;KAAE,QAAQ;KAAQ,OAAO;IAAO;cAEpC,kBAAC,GAAD,CAAe,CAAA;GACL,CAAA;GAKV,MAAU,EAAY,SAAS,KAE7B,EAAY,SAAS,EAAsB,UACzC,kBAAC,GAAD;IACE,MAAM;IACN,OAAM;IACN,cAAW;IACX,SAAS;IACT,WAAU;IACV,IAAI;KAAE,QAAQ;KAAQ,OAAO;IAAO;cAEpC,kBAAC,GAAD,CAAS,CAAA;GACC,CAAA;EAGV,EAAA,GArCK,EAAM,IAqCX,CAEb;CACE,CAAA;AAET"}
@@ -2,7 +2,7 @@ import { EXPERIMENTAL_MODE_COOKIE as e } from "../../utils/SynapseConstants.js";
2
2
  import { Box as t, IconButton as n, Tooltip as r, Typography as i, useTheme as a } from "@mui/material";
3
3
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
4
  import { useCookieValue as c } from "@react-hookz/web/useCookieValue/index.js";
5
- import { InfoOutlined as l } from "@mui/icons-material";
5
+ import l from "@mui/icons-material/InfoOutlined";
6
6
  import u from "react-switch";
7
7
  //#region src/components/ExperimentalMode/ExperimentalMode.tsx
8
8
  var d = "experimental-mode", f = "This mode gives you early access to features that are still in development. Please note that we do not guarantee an absence of errors, and that the data created using these features may be lost during product upgrade.";
@@ -1 +1 @@
1
- {"version":3,"file":"ExperimentalMode.js","names":[],"sources":["../../../src/components/ExperimentalMode/ExperimentalMode.tsx"],"sourcesContent":["import { EXPERIMENTAL_MODE_COOKIE } from '@/utils/SynapseConstants'\nimport { InfoOutlined } from '@mui/icons-material'\nimport { Box, IconButton, Tooltip, Typography, useTheme } from '@mui/material'\nimport Switch from 'react-switch'\nimport { useCookieValue } from '@react-hookz/web/useCookieValue/index.js'\n\nconst EXPERIMENTAL_MODE_SWITCH_ID = 'experimental-mode'\nconst experimentalModeText =\n 'This mode gives you early access to features that are still in development. Please note that we do not guarantee an absence of errors, and that the data created using these features may be lost during product upgrade.'\n\nexport type ExperimentalModeProps = {\n onExperimentalModeToggle?: (newValue: boolean) => void\n}\nfunction ExperimentalMode({ onExperimentalModeToggle }: ExperimentalModeProps) {\n const theme = useTheme()\n\n const getExperimentalModeCookieOptions = () => {\n const hostname =\n typeof window !== 'undefined'\n ? window.location.hostname.toLowerCase()\n : ''\n return {\n path: '/',\n domain: hostname.endsWith('.synapse.org') ? 'synapse.org' : undefined,\n }\n }\n\n const [\n experimentalModeCookie,\n setExperimentalModeCookie,\n removeExperimentalModeCookie,\n ] = useCookieValue(EXPERIMENTAL_MODE_COOKIE, {\n ...getExperimentalModeCookieOptions(),\n initializeWithValue: false,\n })\n\n const createExperimentalModeCookie = () => {\n setExperimentalModeCookie('true')\n\n if (onExperimentalModeToggle) {\n onExperimentalModeToggle(true)\n }\n }\n\n const deleteExperimentalModeCookie = () => {\n removeExperimentalModeCookie()\n if (onExperimentalModeToggle) {\n onExperimentalModeToggle(false)\n }\n }\n\n return (\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <Typography\n component={'label'}\n variant=\"body1\"\n htmlFor={EXPERIMENTAL_MODE_SWITCH_ID}\n >\n Experimental Mode\n </Typography>\n <Tooltip title={experimentalModeText} arrow placement=\"top\">\n <IconButton\n aria-label=\"info\"\n color=\"inherit\"\n sx={{ '&:hover': { backgroundColor: 'transparent' } }}\n >\n <InfoOutlined sx={{ verticalAlign: 'middle' }} />\n </IconButton>\n </Tooltip>\n <Switch\n id={EXPERIMENTAL_MODE_SWITCH_ID}\n width={35}\n height={20}\n onColor={theme.palette.secondary.main}\n checkedIcon={false}\n uncheckedIcon={false}\n checked={experimentalModeCookie === 'true'}\n onChange={\n experimentalModeCookie === 'true'\n ? deleteExperimentalModeCookie\n : createExperimentalModeCookie\n }\n />\n </Box>\n )\n}\n\nexport default ExperimentalMode\n"],"mappings":";;;;;;;AAMA,IAAM,IAA8B,qBAC9B,IACJ;AAKF,SAAS,EAAiB,EAAE,+BAAmD;CAC7E,IAAM,IAAQ,EAAS,GAajB,CACJ,GACA,GACA,KACE,EAAe,GAA0B;EATzC,MAAM;EACN,SALA,OAAO,SAAW,MACd,OAAO,SAAS,SAAS,YAAY,IACrC,IAGa,SAAS,cAAc,IAAI,gBAAgB,KAAA;EAU9D,qBAAqB;CACvB,CAAC;CAiBD,OACE,kBAAC,GAAD;EAAK,IAAI;GAAE,SAAS;GAAQ,YAAY;EAAS;YAAjD;GACE,kBAAC,GAAD;IACE,WAAW;IACX,SAAQ;IACR,SAAS;cACV;GAEW,CAAA;GACZ,kBAAC,GAAD;IAAS,OAAO;IAAsB,OAAA;IAAM,WAAU;cACpD,kBAAC,GAAD;KACE,cAAW;KACX,OAAM;KACN,IAAI,EAAE,WAAW,EAAE,iBAAiB,cAAc,EAAE;eAEpD,kBAAC,GAAD,EAAc,IAAI,EAAE,eAAe,SAAS,EAAI,CAAA;IACtC,CAAA;GACL,CAAA;GACT,kBAAC,GAAD;IACE,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,SAAS,EAAM,QAAQ,UAAU;IACjC,aAAa;IACb,eAAe;IACf,SAAS,MAA2B;IACpC,UACE,MAA2B,eAlCQ;KAEzC,AADA,EAA6B,GACzB,KACF,EAAyB,EAAK;IAElC,UAb2C;KAGzC,AAFA,EAA0B,MAAM,GAE5B,KACF,EAAyB,EAAI;IAEjC;GAwCK,CAAA;EACE;;AAET"}
1
+ {"version":3,"file":"ExperimentalMode.js","names":[],"sources":["../../../src/components/ExperimentalMode/ExperimentalMode.tsx"],"sourcesContent":["import { EXPERIMENTAL_MODE_COOKIE } from '@/utils/SynapseConstants'\nimport InfoOutlined from '@mui/icons-material/InfoOutlined'\nimport { Box, IconButton, Tooltip, Typography, useTheme } from '@mui/material'\nimport Switch from 'react-switch'\nimport { useCookieValue } from '@react-hookz/web/useCookieValue/index.js'\n\nconst EXPERIMENTAL_MODE_SWITCH_ID = 'experimental-mode'\nconst experimentalModeText =\n 'This mode gives you early access to features that are still in development. Please note that we do not guarantee an absence of errors, and that the data created using these features may be lost during product upgrade.'\n\nexport type ExperimentalModeProps = {\n onExperimentalModeToggle?: (newValue: boolean) => void\n}\nfunction ExperimentalMode({ onExperimentalModeToggle }: ExperimentalModeProps) {\n const theme = useTheme()\n\n const getExperimentalModeCookieOptions = () => {\n const hostname =\n typeof window !== 'undefined'\n ? window.location.hostname.toLowerCase()\n : ''\n return {\n path: '/',\n domain: hostname.endsWith('.synapse.org') ? 'synapse.org' : undefined,\n }\n }\n\n const [\n experimentalModeCookie,\n setExperimentalModeCookie,\n removeExperimentalModeCookie,\n ] = useCookieValue(EXPERIMENTAL_MODE_COOKIE, {\n ...getExperimentalModeCookieOptions(),\n initializeWithValue: false,\n })\n\n const createExperimentalModeCookie = () => {\n setExperimentalModeCookie('true')\n\n if (onExperimentalModeToggle) {\n onExperimentalModeToggle(true)\n }\n }\n\n const deleteExperimentalModeCookie = () => {\n removeExperimentalModeCookie()\n if (onExperimentalModeToggle) {\n onExperimentalModeToggle(false)\n }\n }\n\n return (\n <Box sx={{ display: 'flex', alignItems: 'center' }}>\n <Typography\n component={'label'}\n variant=\"body1\"\n htmlFor={EXPERIMENTAL_MODE_SWITCH_ID}\n >\n Experimental Mode\n </Typography>\n <Tooltip title={experimentalModeText} arrow placement=\"top\">\n <IconButton\n aria-label=\"info\"\n color=\"inherit\"\n sx={{ '&:hover': { backgroundColor: 'transparent' } }}\n >\n <InfoOutlined sx={{ verticalAlign: 'middle' }} />\n </IconButton>\n </Tooltip>\n <Switch\n id={EXPERIMENTAL_MODE_SWITCH_ID}\n width={35}\n height={20}\n onColor={theme.palette.secondary.main}\n checkedIcon={false}\n uncheckedIcon={false}\n checked={experimentalModeCookie === 'true'}\n onChange={\n experimentalModeCookie === 'true'\n ? deleteExperimentalModeCookie\n : createExperimentalModeCookie\n }\n />\n </Box>\n )\n}\n\nexport default ExperimentalMode\n"],"mappings":";;;;;;;AAMA,IAAM,IAA8B,qBAC9B,IACJ;AAKF,SAAS,EAAiB,EAAE,+BAAmD;CAC7E,IAAM,IAAQ,EAAS,GAajB,CACJ,GACA,GACA,KACE,EAAe,GAA0B;EATzC,MAAM;EACN,SALA,OAAO,SAAW,MACd,OAAO,SAAS,SAAS,YAAY,IACrC,IAGa,SAAS,cAAc,IAAI,gBAAgB,KAAA;EAU9D,qBAAqB;CACvB,CAAC;CAiBD,OACE,kBAAC,GAAD;EAAK,IAAI;GAAE,SAAS;GAAQ,YAAY;EAAS;YAAjD;GACE,kBAAC,GAAD;IACE,WAAW;IACX,SAAQ;IACR,SAAS;cACV;GAEW,CAAA;GACZ,kBAAC,GAAD;IAAS,OAAO;IAAsB,OAAA;IAAM,WAAU;cACpD,kBAAC,GAAD;KACE,cAAW;KACX,OAAM;KACN,IAAI,EAAE,WAAW,EAAE,iBAAiB,cAAc,EAAE;eAEpD,kBAAC,GAAD,EAAc,IAAI,EAAE,eAAe,SAAS,EAAI,CAAA;IACtC,CAAA;GACL,CAAA;GACT,kBAAC,GAAD;IACE,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,SAAS,EAAM,QAAQ,UAAU;IACjC,aAAa;IACb,eAAe;IACf,SAAS,MAA2B;IACpC,UACE,MAA2B,eAlCQ;KAEzC,AADA,EAA6B,GACzB,KACF,EAAyB,EAAK;IAElC,UAb2C;KAGzC,AAFA,EAA0B,MAAM,GAE5B,KACF,EAAyB,EAAI;IAEjC;GAwCK,CAAA;EACE;;AAET"}