@ohif/ui-next 3.14.0-beta.12 → 3.14.0-beta.121
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.
- package/dist/ohif-ui-next.css +6 -6
- package/dist/ohif-ui-next.umd.js +4 -1838
- package/package.json +31 -14
- package/src/__mocks__/fileMock.js +7 -0
- package/src/assets/fonts.css +50 -0
- package/src/assets/styles.css +55 -0
- package/src/assets/woff2/latin.woff2 +0 -0
- package/src/components/Accordion/Accordion.tsx +70 -0
- package/src/components/Accordion/index.ts +3 -0
- package/src/components/AllInOneMenu/BackItem.tsx +32 -0
- package/src/components/AllInOneMenu/DividerItem.tsx +11 -0
- package/src/components/AllInOneMenu/HeaderItem.tsx +15 -0
- package/src/components/AllInOneMenu/IconMenu.tsx +83 -0
- package/src/components/AllInOneMenu/Item.tsx +51 -0
- package/src/components/AllInOneMenu/ItemPanel.tsx +38 -0
- package/src/components/AllInOneMenu/Menu.tsx +231 -0
- package/src/components/AllInOneMenu/PanelSelector.tsx +32 -0
- package/src/components/AllInOneMenu/SubMenu.tsx +36 -0
- package/src/components/AllInOneMenu/index.ts +42 -0
- package/src/components/BackgroundColorSelect/BackgroundColorSelect.tsx +38 -0
- package/src/components/BackgroundColorSelect/index.tsx +1 -0
- package/src/components/Badge/Badge.tsx +38 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/Button/Button.tsx +65 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Calendar/Calendar.tsx +258 -0
- package/src/components/Calendar/index.tsx +3 -0
- package/src/components/Card/Card.tsx +83 -0
- package/src/components/Card/index.ts +2 -0
- package/src/components/Checkbox/Checkbox.tsx +27 -0
- package/src/components/Checkbox/index.tsx +3 -0
- package/src/components/CinePlayer/CinePlayer.tsx +187 -0
- package/src/components/CinePlayer/index.ts +5 -0
- package/src/components/Clipboard/Clipboard.tsx +58 -0
- package/src/components/Clipboard/index.tsx +3 -0
- package/src/components/ColorCircle.tsx +12 -0
- package/src/components/Combobox/Combobox.tsx +66 -0
- package/src/components/Combobox/index.ts +3 -0
- package/src/components/Command/Command.tsx +149 -0
- package/src/components/Command/index.ts +23 -0
- package/src/components/ContextMenu/ContextMenu.tsx +202 -0
- package/src/components/ContextMenu/index.ts +35 -0
- package/src/components/ContextMenuViewport/ContextMenuViewport.tsx +47 -0
- package/src/components/ContextMenuViewport/index.ts +1 -0
- package/src/components/DataRow/DataRow.tsx +532 -0
- package/src/components/DataRow/index.ts +1 -0
- package/src/components/DataRow/types.ts +31 -0
- package/src/components/DataTable/ActionOverlayCell.tsx +153 -0
- package/src/components/DataTable/ColumnHeader.tsx +70 -0
- package/src/components/DataTable/DataTable.tsx +532 -0
- package/src/components/DataTable/FilterRow.tsx +52 -0
- package/src/components/DataTable/Pagination.tsx +78 -0
- package/src/components/DataTable/Title.tsx +5 -0
- package/src/components/DataTable/Toolbar.tsx +5 -0
- package/src/components/DataTable/ViewOptions.tsx +86 -0
- package/src/components/DataTable/context.tsx +21 -0
- package/src/components/DataTable/index.ts +5 -0
- package/src/components/DataTable/types.ts +27 -0
- package/src/components/DataTable/useResponsiveColumns.tsx +346 -0
- package/src/components/DateRange/DateRange.tsx +163 -0
- package/src/components/DateRange/index.ts +3 -0
- package/src/components/Dialog/Dialog.tsx +201 -0
- package/src/components/Dialog/index.ts +25 -0
- package/src/components/Dialog/useDraggable.ts +108 -0
- package/src/components/DisplaySetMessageListTooltip/DisplaySetMessageListTooltip.tsx +64 -0
- package/src/components/DisplaySetMessageListTooltip/index.ts +3 -0
- package/src/components/DoubleSlider/DoubleSlider.test.ts +232 -0
- package/src/components/DoubleSlider/DoubleSlider.tsx +211 -0
- package/src/components/DoubleSlider/index.tsx +3 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +213 -0
- package/src/components/DropdownMenu/index.ts +35 -0
- package/src/components/Errorboundary/ErrorBoundary.tsx +345 -0
- package/src/components/Errorboundary/index.tsx +3 -0
- package/src/components/FooterAction/FooterAction.tsx +115 -0
- package/src/components/FooterAction/index.tsx +3 -0
- package/src/components/Header/Header.tsx +140 -0
- package/src/components/Header/index.js +2 -0
- package/src/components/HoverCard/HoverCard.tsx +30 -0
- package/src/components/HoverCard/index.ts +1 -0
- package/src/components/Icons/Icons.tsx +852 -0
- package/src/components/Icons/Sources/ActionNewDialog.tsx +64 -0
- package/src/components/Icons/Sources/Actions.tsx +47 -0
- package/src/components/Icons/Sources/Add.tsx +51 -0
- package/src/components/Icons/Sources/Alert.tsx +32 -0
- package/src/components/Icons/Sources/AlertOutline.tsx +30 -0
- package/src/components/Icons/Sources/ArrowLeftBold.tsx +49 -0
- package/src/components/Icons/Sources/ArrowRight.tsx +25 -0
- package/src/components/Icons/Sources/Cancel.tsx +37 -0
- package/src/components/Icons/Sources/CheckBoxChecked.tsx +39 -0
- package/src/components/Icons/Sources/CheckBoxUnChecked.tsx +25 -0
- package/src/components/Icons/Sources/Checked.tsx +23 -0
- package/src/components/Icons/Sources/ChevronClosed.tsx +40 -0
- package/src/components/Icons/Sources/ChevronLeft.tsx +28 -0
- package/src/components/Icons/Sources/ChevronOpen.tsx +38 -0
- package/src/components/Icons/Sources/Clear.tsx +34 -0
- package/src/components/Icons/Sources/Clipboard.tsx +15 -0
- package/src/components/Icons/Sources/Close.tsx +28 -0
- package/src/components/Icons/Sources/CloudSettings.tsx +34 -0
- package/src/components/Icons/Sources/Code.tsx +7 -0
- package/src/components/Icons/Sources/ColorChange.tsx +100 -0
- package/src/components/Icons/Sources/ContentNext.tsx +35 -0
- package/src/components/Icons/Sources/ContentPrev.tsx +35 -0
- package/src/components/Icons/Sources/Controls.tsx +99 -0
- package/src/components/Icons/Sources/Copy.tsx +44 -0
- package/src/components/Icons/Sources/Database.tsx +33 -0
- package/src/components/Icons/Sources/Delete.tsx +58 -0
- package/src/components/Icons/Sources/DicomTagBrowser.tsx +79 -0
- package/src/components/Icons/Sources/DisplayFillAndOutline.tsx +49 -0
- package/src/components/Icons/Sources/DisplayFillOnly.tsx +40 -0
- package/src/components/Icons/Sources/DisplayOutlineOnly.tsx +40 -0
- package/src/components/Icons/Sources/Download.tsx +75 -0
- package/src/components/Icons/Sources/Export.tsx +53 -0
- package/src/components/Icons/Sources/ExternalLink.tsx +26 -0
- package/src/components/Icons/Sources/EyeHidden.tsx +32 -0
- package/src/components/Icons/Sources/EyeVisible.tsx +28 -0
- package/src/components/Icons/Sources/FeedbackComplete.tsx +35 -0
- package/src/components/Icons/Sources/GearSettings.tsx +59 -0
- package/src/components/Icons/Sources/GroupLayers.tsx +33 -0
- package/src/components/Icons/Sources/Helpers.tsx +398 -0
- package/src/components/Icons/Sources/Hide.tsx +45 -0
- package/src/components/Icons/Sources/IconColorLUT.tsx +103 -0
- package/src/components/Icons/Sources/IconMPR.tsx +55 -0
- package/src/components/Icons/Sources/IconTransferring.tsx +25 -0
- package/src/components/Icons/Sources/IllustrationNotFound.tsx +102 -0
- package/src/components/Icons/Sources/Info.tsx +55 -0
- package/src/components/Icons/Sources/InfoLink.tsx +23 -0
- package/src/components/Icons/Sources/InfoSeries.tsx +52 -0
- package/src/components/Icons/Sources/InvestigationalUse.tsx +82 -0
- package/src/components/Icons/Sources/JumpToSlice.tsx +69 -0
- package/src/components/Icons/Sources/LaunchArrow.tsx +34 -0
- package/src/components/Icons/Sources/LaunchInfo.tsx +38 -0
- package/src/components/Icons/Sources/LayerBackground.tsx +28 -0
- package/src/components/Icons/Sources/LayerForeground.tsx +34 -0
- package/src/components/Icons/Sources/LayerSegmentation.tsx +20 -0
- package/src/components/Icons/Sources/Layout.tsx +433 -0
- package/src/components/Icons/Sources/Link.tsx +58 -0
- package/src/components/Icons/Sources/ListView.tsx +79 -0
- package/src/components/Icons/Sources/LoadingOHIFMark.tsx +21 -0
- package/src/components/Icons/Sources/LoadingSpinner.tsx +49 -0
- package/src/components/Icons/Sources/Lock.tsx +35 -0
- package/src/components/Icons/Sources/Magnifier.tsx +37 -0
- package/src/components/Icons/Sources/Minus.tsx +40 -0
- package/src/components/Icons/Sources/MissingIcon.tsx +6 -0
- package/src/components/Icons/Sources/More.tsx +53 -0
- package/src/components/Icons/Sources/MultiplePatients.tsx +76 -0
- package/src/components/Icons/Sources/NavigationPanelReveal.tsx +25 -0
- package/src/components/Icons/Sources/NotificationInfo.tsx +33 -0
- package/src/components/Icons/Sources/NotificationWarning.tsx +44 -0
- package/src/components/Icons/Sources/OHIFLogo.tsx +72 -0
- package/src/components/Icons/Sources/OHIFLogoColorDarkBackground.tsx +78 -0
- package/src/components/Icons/Sources/OHIFLogoHorizontal.tsx +139 -0
- package/src/components/Icons/Sources/Opacity.tsx +106 -0
- package/src/components/Icons/Sources/OrientationSwitch.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchA.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchC.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchR.tsx +41 -0
- package/src/components/Icons/Sources/OrientationSwitchS.tsx +41 -0
- package/src/components/Icons/Sources/PanelRight.tsx +29 -0
- package/src/components/Icons/Sources/Patient.tsx +58 -0
- package/src/components/Icons/Sources/PatientStudyList.tsx +62 -0
- package/src/components/Icons/Sources/Pause.tsx +26 -0
- package/src/components/Icons/Sources/Pencil.tsx +16 -0
- package/src/components/Icons/Sources/Pin.tsx +50 -0
- package/src/components/Icons/Sources/PinFill.tsx +51 -0
- package/src/components/Icons/Sources/Play.tsx +25 -0
- package/src/components/Icons/Sources/Plus.tsx +29 -0
- package/src/components/Icons/Sources/PowerOff.tsx +19 -0
- package/src/components/Icons/Sources/Redo.tsx +51 -0
- package/src/components/Icons/Sources/Refresh.tsx +42 -0
- package/src/components/Icons/Sources/Rename.tsx +50 -0
- package/src/components/Icons/Sources/Search.tsx +35 -0
- package/src/components/Icons/Sources/SegActions.tsx +594 -0
- package/src/components/Icons/Sources/Series.tsx +47 -0
- package/src/components/Icons/Sources/SeriesPlaceholder.tsx +40 -0
- package/src/components/Icons/Sources/Settings.tsx +105 -0
- package/src/components/Icons/Sources/SettingsStudyList.tsx +28 -0
- package/src/components/Icons/Sources/Show.tsx +67 -0
- package/src/components/Icons/Sources/SidePanelCloseLeft.tsx +75 -0
- package/src/components/Icons/Sources/SidePanelCloseRight.tsx +74 -0
- package/src/components/Icons/Sources/SocialGithub.tsx +39 -0
- package/src/components/Icons/Sources/Sorting.tsx +39 -0
- package/src/components/Icons/Sources/SortingAscending.tsx +28 -0
- package/src/components/Icons/Sources/SortingDescending.tsx +26 -0
- package/src/components/Icons/Sources/SortingNew.tsx +20 -0
- package/src/components/Icons/Sources/SortingNewAscending.tsx +35 -0
- package/src/components/Icons/Sources/SortingNewDescending.tsx +35 -0
- package/src/components/Icons/Sources/StatusAlert.tsx +36 -0
- package/src/components/Icons/Sources/StatusError.tsx +57 -0
- package/src/components/Icons/Sources/StatusLocked.tsx +35 -0
- package/src/components/Icons/Sources/StatusSuccess.tsx +45 -0
- package/src/components/Icons/Sources/StatusTracking.tsx +37 -0
- package/src/components/Icons/Sources/StatusUntracked.tsx +30 -0
- package/src/components/Icons/Sources/StatusWarning.tsx +58 -0
- package/src/components/Icons/Sources/Tab4D.tsx +54 -0
- package/src/components/Icons/Sources/TabContours.tsx +63 -0
- package/src/components/Icons/Sources/TabLinear.tsx +47 -0
- package/src/components/Icons/Sources/TabPatientInfo.tsx +33 -0
- package/src/components/Icons/Sources/TabRoiThreshold.tsx +38 -0
- package/src/components/Icons/Sources/TabSegmentation.tsx +38 -0
- package/src/components/Icons/Sources/TabStudies.tsx +62 -0
- package/src/components/Icons/Sources/Threshold.tsx +38 -0
- package/src/components/Icons/Sources/ThumbnailView.tsx +67 -0
- package/src/components/Icons/Sources/Tools.tsx +3659 -0
- package/src/components/Icons/Sources/Trash.tsx +17 -0
- package/src/components/Icons/Sources/Undo.tsx +51 -0
- package/src/components/Icons/Sources/Upload.tsx +29 -0
- package/src/components/Icons/Sources/ViewportViews.tsx +45 -0
- package/src/components/Icons/Sources/ViewportWindowLevel.tsx +58 -0
- package/src/components/Icons/Sources/WindowLevelAdvanced.tsx +30 -0
- package/src/components/Icons/index.ts +4 -0
- package/src/components/Icons/types.ts +3 -0
- package/src/components/Input/Input.tsx +25 -0
- package/src/components/Input/index.tsx +3 -0
- package/src/components/InputFilter/InputFilter.tsx +200 -0
- package/src/components/InputFilter/index.ts +2 -0
- package/src/components/InputMultiSelect/InputMultiSelect.tsx +370 -0
- package/src/components/InputMultiSelect/index.ts +1 -0
- package/src/components/InputNumber/InputNumber.tsx +439 -0
- package/src/components/InputNumber/index.ts +3 -0
- package/src/components/InvestigationalUseDialog/InvestigationalUseDialog.tsx +98 -0
- package/src/components/InvestigationalUseDialog/index.ts +3 -0
- package/src/components/Label/Label.tsx +24 -0
- package/src/components/Label/index.tsx +3 -0
- package/src/components/Labelling/LabellingFlow.tsx +92 -0
- package/src/components/Labelling/index.ts +2 -0
- package/src/components/LayoutSelector/LayoutSelector.tsx +345 -0
- package/src/components/LayoutSelector/index.ts +4 -0
- package/src/components/LineChart/LineChart.css +40 -0
- package/src/components/LineChart/LineChart.tsx +101 -0
- package/src/components/LineChart/d3LineChart/chart.ts +365 -0
- package/src/components/LineChart/d3LineChart/events.ts +149 -0
- package/src/components/LineChart/d3LineChart/index.ts +3 -0
- package/src/components/LineChart/d3LineChart/lineChart.ts +272 -0
- package/src/components/LineChart/index.ts +1 -0
- package/src/components/LoadingIndicatorProgress/LoadingIndicatorProgress.tsx +29 -0
- package/src/components/LoadingIndicatorProgress/index.ts +2 -0
- package/src/components/LoadingIndicatorTotalPercent/LoadingIndicatorTotalPercent.tsx +49 -0
- package/src/components/LoadingIndicatorTotalPercent/index.ts +2 -0
- package/src/components/MeasurementTable/MeasurementTable.tsx +144 -0
- package/src/components/MeasurementTable/index.js +3 -0
- package/src/components/Modal/Modal.tsx +44 -0
- package/src/components/NavBar/NavBar.tsx +32 -0
- package/src/components/NavBar/index.js +2 -0
- package/src/components/Numeric/Numeric.test.ts +124 -0
- package/src/components/Numeric/Numeric.tsx +576 -0
- package/src/components/Numeric/index.ts +3 -0
- package/src/components/OHIFDialogs/InputDialog.tsx +287 -0
- package/src/components/OHIFDialogs/PresetDialog.tsx +106 -0
- package/src/components/OHIFDialogs/index.ts +2 -0
- package/src/components/OHIFModals/AboutModal.tsx +114 -0
- package/src/components/OHIFModals/AppearanceModal.tsx +38 -0
- package/src/components/OHIFModals/ImageModal.tsx +251 -0
- package/src/components/OHIFModals/UserPreferencesModal.tsx +229 -0
- package/src/components/OHIFModals/index.ts +4 -0
- package/src/components/OHIFPanels/WindowLevel.tsx +162 -0
- package/src/components/OHIFPanels/WindowLevelHistogram.tsx +237 -0
- package/src/components/OHIFPanels/index.ts +3 -0
- package/src/components/OHIFPanels/types.ts +41 -0
- package/src/components/OHIFToolSettings/RowDoubleRange.tsx +67 -0
- package/src/components/OHIFToolSettings/RowInputRange.tsx +65 -0
- package/src/components/OHIFToolSettings/RowSegmentedControl.tsx +77 -0
- package/src/components/OHIFToolSettings/ToolSettings.tsx +253 -0
- package/src/components/OHIFToolSettings/index.ts +1 -0
- package/src/components/OHIFToolbox/ToolboxUI.tsx +104 -0
- package/src/components/OHIFToolbox/index.ts +1 -0
- package/src/components/Onboarding/Onboarding.css +48 -0
- package/src/components/Onboarding/Onboarding.tsx +58 -0
- package/src/components/Onboarding/index.ts +3 -0
- package/src/components/Onboarding/utilities.ts +91 -0
- package/src/components/PanelSection/PanelSection.tsx +70 -0
- package/src/components/PanelSection/index.ts +2 -0
- package/src/components/Popover/Popover.tsx +35 -0
- package/src/components/Popover/index.ts +3 -0
- package/src/components/ProgressDropdown/ProgressDiscreteBar.tsx +24 -0
- package/src/components/ProgressDropdown/ProgressDropdown.tsx +158 -0
- package/src/components/ProgressDropdown/ProgressItem.tsx +27 -0
- package/src/components/ProgressDropdown/ProgressItemDetail.tsx +89 -0
- package/src/components/ProgressDropdown/index.ts +1 -0
- package/src/components/ProgressDropdown/types.ts +9 -0
- package/src/components/ProgressLoadingBar/ProgressLoadingBar.css +26 -0
- package/src/components/ProgressLoadingBar/ProgressLoadingBar.tsx +32 -0
- package/src/components/ProgressLoadingBar/index.ts +2 -0
- package/src/components/Resizable/Resizable.tsx +43 -0
- package/src/components/Resizable/index.ts +3 -0
- package/src/components/ScrollArea/ScrollArea.tsx +127 -0
- package/src/components/ScrollArea/index.tsx +3 -0
- package/src/components/SegmentationTable/AddSegmentRow.tsx +78 -0
- package/src/components/SegmentationTable/AddSegmentationRow.tsx +56 -0
- package/src/components/SegmentationTable/SegmentStatistics.tsx +104 -0
- package/src/components/SegmentationTable/SegmentationCollapsed.tsx +211 -0
- package/src/components/SegmentationTable/SegmentationExpanded.tsx +173 -0
- package/src/components/SegmentationTable/SegmentationHeader.tsx +58 -0
- package/src/components/SegmentationTable/SegmentationLabel.tsx +27 -0
- package/src/components/SegmentationTable/SegmentationSegments.tsx +206 -0
- package/src/components/SegmentationTable/SegmentationTable.tsx +169 -0
- package/src/components/SegmentationTable/SegmentationTableConfig.tsx +194 -0
- package/src/components/SegmentationTable/contexts/SegmentStatisticsContext.tsx +45 -0
- package/src/components/SegmentationTable/contexts/SegmentationExpandedContext.tsx +45 -0
- package/src/components/SegmentationTable/contexts/SegmentationTableContext.tsx +148 -0
- package/src/components/SegmentationTable/contexts/index.ts +16 -0
- package/src/components/SegmentationTable/index.ts +27 -0
- package/src/components/Select/Select.tsx +167 -0
- package/src/components/Select/index.tsx +40 -0
- package/src/components/Separator/Separator.tsx +32 -0
- package/src/components/Separator/index.ts +3 -0
- package/src/components/Separator/index.tsx +3 -0
- package/src/components/SidePanel/SidePanel.tsx +479 -0
- package/src/components/SidePanel/index.ts +2 -0
- package/src/components/Slider/Slider.tsx +24 -0
- package/src/components/Slider/index.tsx +3 -0
- package/src/components/SmartScrollbar/SmartScrollbar.tsx +349 -0
- package/src/components/SmartScrollbar/SmartScrollbarEndpoints.tsx +82 -0
- package/src/components/SmartScrollbar/SmartScrollbarFill.tsx +54 -0
- package/src/components/SmartScrollbar/SmartScrollbarIndicator.tsx +59 -0
- package/src/components/SmartScrollbar/SmartScrollbarTrack.tsx +104 -0
- package/src/components/SmartScrollbar/defaultSmartScrollbarIndicatorConfig.tsx +48 -0
- package/src/components/SmartScrollbar/index.ts +11 -0
- package/src/components/SmartScrollbar/useByteArray.ts +146 -0
- package/src/components/SmartScrollbar/utils.test.ts +124 -0
- package/src/components/SmartScrollbar/utils.ts +168 -0
- package/src/components/Sonner/Sonner.tsx +31 -0
- package/src/components/Sonner/index.ts +4 -0
- package/src/components/StudyBrowser/StudyBrowser.tsx +89 -0
- package/src/components/StudyBrowser/index.ts +2 -0
- package/src/components/StudyBrowserSort/StudyBrowserSort.tsx +87 -0
- package/src/components/StudyBrowserSort/index.ts +3 -0
- package/src/components/StudyBrowserViewOptions/StudyBrowserViewOptions.tsx +50 -0
- package/src/components/StudyBrowserViewOptions/index.ts +3 -0
- package/src/components/StudyItem/StudyItem.tsx +100 -0
- package/src/components/StudyItem/index.ts +2 -0
- package/src/components/StudyList/columns/defaultColumns.tsx +258 -0
- package/src/components/StudyList/components/ActionCell.tsx +19 -0
- package/src/components/StudyList/components/Layout.tsx +206 -0
- package/src/components/StudyList/components/PreviewContainer.tsx +45 -0
- package/src/components/StudyList/components/PreviewContent.tsx +186 -0
- package/src/components/StudyList/components/PreviewHeader.tsx +5 -0
- package/src/components/StudyList/components/PreviewPatientSummary.tsx +224 -0
- package/src/components/StudyList/components/PreviewSeriesList.tsx +64 -0
- package/src/components/StudyList/components/PreviewToggleButton.tsx +69 -0
- package/src/components/StudyList/components/SettingsPopover.tsx +214 -0
- package/src/components/StudyList/components/Table.tsx +247 -0
- package/src/components/StudyList/components/WorkflowMenu.tsx +72 -0
- package/src/components/StudyList/components/WorkflowsProvider.tsx +169 -0
- package/src/components/StudyList/hooks/useDefaultWorkflow.ts +60 -0
- package/src/components/StudyList/index.ts +52 -0
- package/src/components/StudyList/types/types.ts +42 -0
- package/src/components/StudyList/utils/tokenizeModalities.ts +6 -0
- package/src/components/StudySummary/StudySummary.tsx +27 -0
- package/src/components/StudySummary/index.tsx +3 -0
- package/src/components/Switch/Switch.tsx +28 -0
- package/src/components/Switch/index.tsx +3 -0
- package/src/components/Table/Table.tsx +134 -0
- package/src/components/Table/index.ts +11 -0
- package/src/components/Tabs/Tabs.tsx +56 -0
- package/src/components/Tabs/index.ts +3 -0
- package/src/components/Tabs/index.tsx +3 -0
- package/src/components/ThemeWrapper/ThemeWrapper.tsx +5 -0
- package/src/components/ThemeWrapper/index.ts +1 -0
- package/src/components/Thumbnail/Thumbnail.test.ts +71 -0
- package/src/components/Thumbnail/Thumbnail.tsx +351 -0
- package/src/components/Thumbnail/index.ts +2 -0
- package/src/components/ThumbnailList/ThumbnailList.tsx +94 -0
- package/src/components/ThumbnailList/index.ts +2 -0
- package/src/components/Toggle/Toggle.tsx +45 -0
- package/src/components/Toggle/index.ts +3 -0
- package/src/components/Toggle/index.tsx +3 -0
- package/src/components/ToggleGroup/ToggleGroup.tsx +63 -0
- package/src/components/ToggleGroup/index.ts +3 -0
- package/src/components/ToolButton/ToolButton.tsx +134 -0
- package/src/components/ToolButton/ToolButtonList.tsx +243 -0
- package/src/components/ToolButton/index.ts +8 -0
- package/src/components/Tooltip/Tooltip.tsx +34 -0
- package/src/components/Tooltip/index.ts +3 -0
- package/src/components/Viewport/ImageScrollbar.module.css +89 -0
- package/src/components/Viewport/ImageScrollbar.tsx +71 -0
- package/src/components/Viewport/PatientInfo.tsx +126 -0
- package/src/components/Viewport/ViewportActionArrows.tsx +36 -0
- package/src/components/Viewport/ViewportActionBar.tsx +107 -0
- package/src/components/Viewport/ViewportActionButton.tsx +25 -0
- package/src/components/Viewport/ViewportActionCorners.tsx +171 -0
- package/src/components/Viewport/ViewportGrid.tsx +24 -0
- package/src/components/Viewport/ViewportOverlay.css +32 -0
- package/src/components/Viewport/ViewportOverlay.tsx +54 -0
- package/src/components/Viewport/ViewportPane.tsx +82 -0
- package/src/components/Viewport/index.ts +9 -0
- package/src/components/ViewportDialog/ViewportDialog.tsx +128 -0
- package/src/components/ViewportDialog/index.ts +2 -0
- package/src/components/index.ts +330 -0
- package/src/contextProviders/ActiveThemeProvider.tsx +204 -0
- package/src/contextProviders/CineProvider.tsx +98 -0
- package/src/contextProviders/DialogProvider.tsx +103 -0
- package/src/contextProviders/DragAndDropProvider.tsx +37 -0
- package/src/contextProviders/IconPresentationProvider.tsx +88 -0
- package/src/contextProviders/ImageViewerProvider.tsx +15 -0
- package/src/contextProviders/ManagedDialog.tsx +176 -0
- package/src/contextProviders/ModalProvider.tsx +102 -0
- package/src/contextProviders/NotificationProvider.tsx +246 -0
- package/src/contextProviders/UserAuthenticationProvider.tsx +118 -0
- package/src/contextProviders/ViewportDialogProvider.tsx +42 -0
- package/src/contextProviders/ViewportGridProvider.tsx +556 -0
- package/src/contextProviders/index.ts +26 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useDynamicMaxHeight.ts +105 -0
- package/src/hooks/useSessionStorage.test.js +103 -0
- package/src/hooks/useSessionStorage.tsx +71 -0
- package/src/index.ts +7 -0
- package/src/lib/utils.ts +6 -0
- package/src/tailwind.css +266 -0
- package/src/themes/arctic.json +31 -0
- package/src/themes/deep.json +31 -0
- package/src/themes/index.ts +16 -0
- package/src/themes/midnight.json +31 -0
- package/src/themes/orchid.json +31 -0
- package/src/themes/slate.json +31 -0
- package/src/themes/themes.css +206 -0
- package/src/themes/verdant.json +31 -0
- package/src/types/ActionCorners.ts +18 -0
- package/src/types/AppTypes.ts +24 -0
- package/src/types/ContextMenuItem.ts +9 -0
- package/src/types/Predicate.ts +1 -0
- package/src/types/ThumbnailType.ts +3 -0
- package/src/types/ViewportActionCornersTypes.ts +13 -0
- package/src/types/global.d.ts +4 -0
- package/src/types/index.ts +21 -0
- package/src/utils/formatDICOMDate.test.ts +61 -0
- package/src/utils/formatDICOMDate.ts +65 -0
- package/src/utils/formatDICOMTime.test.ts +62 -0
- package/src/utils/formatDICOMTime.ts +49 -0
- package/src/utils/getToggledClassName.tsx +5 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/parseStudyDateTimestamp.test.ts +47 -0
- package/src/utils/parseStudyDateTimestamp.ts +27 -0
- package/src/utils/roundNumber.ts +43 -0
- package/tailwind.config.js +120 -0
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useReducer,
|
|
7
|
+
ReactNode,
|
|
8
|
+
} from 'react';
|
|
9
|
+
import merge from 'lodash.merge';
|
|
10
|
+
|
|
11
|
+
// NOTE: `@ohif/core` is intentionally NOT declared in this package's
|
|
12
|
+
// package.json (neither as a dependency nor a peerDependency). It is treated as
|
|
13
|
+
// an implicit peer, satisfied by the consuming application via the monorepo
|
|
14
|
+
// workspace. Declaring it as `"@ohif/core": "workspace:*"` was tried and
|
|
15
|
+
// reverted: the release/publish process does not rewrite `workspace:*` ranges
|
|
16
|
+
// inside `peerDependencies`, so the published tarball shipped a literal
|
|
17
|
+
// `workspace:*` peer that non-pnpm package managers (npm/yarn) cannot resolve.
|
|
18
|
+
// A plain `"*"` range would be an acceptable workaround if we ever want it
|
|
19
|
+
// declared, but for now it stays undeclared. Note: the docs site (platform/docs)
|
|
20
|
+
// must therefore add `@ohif/core` as a devDependency itself, because pulling in
|
|
21
|
+
// the ui-next barrel reaches this module and nothing else anchors the import.
|
|
22
|
+
import { ViewportGridService, utils } from '@ohif/core';
|
|
23
|
+
|
|
24
|
+
const DEFAULT_STATE: AppTypes.ViewportGrid.State = {
|
|
25
|
+
activeViewportId: null,
|
|
26
|
+
layout: {
|
|
27
|
+
numRows: 0,
|
|
28
|
+
numCols: 0,
|
|
29
|
+
layoutType: 'grid',
|
|
30
|
+
},
|
|
31
|
+
// this flag is used to determine if the hanging protocol layout is active
|
|
32
|
+
// so that we can inherit the viewport options from the previous state
|
|
33
|
+
// otherwise we will not allow that. Basically the issue is that we need
|
|
34
|
+
// to be able to come out of the hanging protocol layout and go back to the
|
|
35
|
+
// regular layout e.g., if we are in the MPR hanging protocol, and someone use
|
|
36
|
+
// 1x1 layout by custom layout selector, there is no way to drag and drop
|
|
37
|
+
// a non-reconstructible series to the viewport since it will always
|
|
38
|
+
// inherit the hanging protocol layout options (volume viewport),
|
|
39
|
+
// so we need to be able to switch back to the regular layout.
|
|
40
|
+
isHangingProtocolLayout: false,
|
|
41
|
+
// Viewports structure has been changed to Map (previously it was
|
|
42
|
+
// tied to the viewportIndex which caused multiple issues. Now we have
|
|
43
|
+
// moved completely to viewportId which is unique for each viewport.
|
|
44
|
+
viewports: new Map(
|
|
45
|
+
Object.entries({
|
|
46
|
+
default: {
|
|
47
|
+
viewportId: 'default',
|
|
48
|
+
displaySetInstanceUIDs: [],
|
|
49
|
+
isReady: false,
|
|
50
|
+
viewportOptions: {
|
|
51
|
+
viewportId: 'default',
|
|
52
|
+
},
|
|
53
|
+
displaySetSelectors: [],
|
|
54
|
+
displaySetOptions: [{}],
|
|
55
|
+
x: 0, // left
|
|
56
|
+
y: 0, // top
|
|
57
|
+
width: 100,
|
|
58
|
+
height: 100,
|
|
59
|
+
viewportLabel: null,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
),
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const determineActiveViewportId = (
|
|
66
|
+
state: AppTypes.ViewportGrid.State,
|
|
67
|
+
newViewports: Map<string, AppTypes.ViewportGrid.Viewport>
|
|
68
|
+
) => {
|
|
69
|
+
const { activeViewportId } = state;
|
|
70
|
+
const currentActiveViewport = state.viewports.get(activeViewportId);
|
|
71
|
+
|
|
72
|
+
if (!currentActiveViewport) {
|
|
73
|
+
// if there is no active viewport, we should just return the first viewport
|
|
74
|
+
const firstViewport = newViewports.values().next().value;
|
|
75
|
+
return firstViewport.viewportOptions.viewportId;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// for the new viewports, we should rank them by the displaySetInstanceUIDs
|
|
79
|
+
// they are displaying and the orientation then we can find the active viewport
|
|
80
|
+
const currentActiveDisplaySetInstanceUIDs = currentActiveViewport.displaySetInstanceUIDs;
|
|
81
|
+
|
|
82
|
+
// This doesn't take into account where stack viewport is converting to volumeViewport
|
|
83
|
+
// since in stack viewport we don't have a concept of "orientation" as a string
|
|
84
|
+
// maybe we should calculate the orientation based on the active imageId
|
|
85
|
+
// so that we can compare it with the new viewports (which might be volume viewports)
|
|
86
|
+
// and find the best match
|
|
87
|
+
const currentOrientation = currentActiveViewport.viewportOptions.orientation;
|
|
88
|
+
|
|
89
|
+
const filteredNewViewports = Array.from(newViewports.values()).filter(
|
|
90
|
+
viewport => viewport.displaySetInstanceUIDs?.length > 0
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const sortedViewports = Array.from(filteredNewViewports.values()).sort((a, b) => {
|
|
94
|
+
// Compare orientations
|
|
95
|
+
const aOrientationMatch = a.viewportOptions.orientation === currentOrientation;
|
|
96
|
+
const bOrientationMatch = b.viewportOptions.orientation === currentOrientation;
|
|
97
|
+
if (aOrientationMatch !== bOrientationMatch) {
|
|
98
|
+
return bOrientationMatch - aOrientationMatch;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Compare displaySetInstanceUIDs
|
|
102
|
+
const aMatch = a.displaySetInstanceUIDs.some(uid =>
|
|
103
|
+
currentActiveDisplaySetInstanceUIDs.includes(uid)
|
|
104
|
+
);
|
|
105
|
+
const bMatch = b.displaySetInstanceUIDs.some(uid =>
|
|
106
|
+
currentActiveDisplaySetInstanceUIDs.includes(uid)
|
|
107
|
+
);
|
|
108
|
+
if (aMatch !== bMatch) {
|
|
109
|
+
return bMatch - aMatch;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return 0; // Return 0 if no differences found
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (!sortedViewports?.length) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return sortedViewports[0].viewportId;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// Define the API interface
|
|
123
|
+
interface ViewportGridApi {
|
|
124
|
+
getState: () => AppTypes.ViewportGrid.State;
|
|
125
|
+
setActiveViewportId: (index: string) => void;
|
|
126
|
+
setDisplaySetsForViewport: (props: any) => void;
|
|
127
|
+
setDisplaySetsForViewports: (props: any[]) => void;
|
|
128
|
+
setLayout: (layout: AppTypes.ViewportGrid.Layout) => void;
|
|
129
|
+
reset: () => void;
|
|
130
|
+
set: (gridLayoutState: Partial<AppTypes.ViewportGrid.State>) => void;
|
|
131
|
+
getNumViewportPanes: () => number;
|
|
132
|
+
setViewportIsReady: (viewportId: string, isReady: boolean) => void;
|
|
133
|
+
getGridViewportsReady: () => boolean;
|
|
134
|
+
getActiveViewportOptionByKey: (key: string) => any;
|
|
135
|
+
setViewportGridSizeChanged: (props: any) => void;
|
|
136
|
+
publishViewportsReady: () => void;
|
|
137
|
+
getDisplaySetsUIDsForViewport: (viewportId: string) => string[];
|
|
138
|
+
isReferenceViewable: (viewportId: string, viewRef, options?) => boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Update the context type
|
|
142
|
+
export const ViewportGridContext = createContext<[AppTypes.ViewportGrid.State, ViewportGridApi]>([
|
|
143
|
+
DEFAULT_STATE,
|
|
144
|
+
{} as ViewportGridApi,
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
// Update the provider props type
|
|
148
|
+
interface ViewportGridProviderProps {
|
|
149
|
+
children: ReactNode;
|
|
150
|
+
service: ViewportGridService;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function ViewportGridProvider({ children, service }: ViewportGridProviderProps) {
|
|
154
|
+
const viewportGridReducer = (state: AppTypes.ViewportGrid.State, action) => {
|
|
155
|
+
switch (action.type) {
|
|
156
|
+
case 'SET_ACTIVE_VIEWPORT_ID': {
|
|
157
|
+
return { ...state, ...{ activeViewportId: action.payload } };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Sets the display sets for multiple viewports.
|
|
162
|
+
* This is a replacement for the older set display set for viewport (single)
|
|
163
|
+
* because the old one had race conditions wherein the viewports could
|
|
164
|
+
* render partially in various ways causing exceptions.
|
|
165
|
+
*/
|
|
166
|
+
case 'SET_DISPLAYSETS_FOR_VIEWPORTS': {
|
|
167
|
+
const { payload } = action;
|
|
168
|
+
const viewports = new Map(state.viewports);
|
|
169
|
+
|
|
170
|
+
payload.forEach(updatedViewport => {
|
|
171
|
+
const { viewportId, displaySetInstanceUIDs } = updatedViewport;
|
|
172
|
+
|
|
173
|
+
if (!viewportId) {
|
|
174
|
+
throw new Error('ViewportId is required to set display sets for viewport');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const previousViewport = viewports.get(viewportId);
|
|
178
|
+
|
|
179
|
+
// remove options that were meant for one time usage
|
|
180
|
+
if (previousViewport?.viewportOptions?.initialImageOptions) {
|
|
181
|
+
const { useOnce } = previousViewport.viewportOptions.initialImageOptions;
|
|
182
|
+
if (useOnce) {
|
|
183
|
+
previousViewport.viewportOptions.initialImageOptions = null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Use the newly provide viewportOptions and display set options
|
|
188
|
+
// when provided, and otherwise fall back to the previous ones.
|
|
189
|
+
// That allows for easy updates of just the display set.
|
|
190
|
+
let viewportOptions = merge(
|
|
191
|
+
{},
|
|
192
|
+
previousViewport?.viewportOptions,
|
|
193
|
+
updatedViewport?.viewportOptions
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
const displaySetOptions = updatedViewport?.displaySetOptions || [];
|
|
197
|
+
if (!displaySetOptions.length) {
|
|
198
|
+
// Copy all the display set options, assuming a full set of displaySet UID's is provided.
|
|
199
|
+
if (state.isHangingProtocolLayout) {
|
|
200
|
+
displaySetOptions.push(...(previousViewport.displaySetOptions || []));
|
|
201
|
+
}
|
|
202
|
+
if (!displaySetOptions.length) {
|
|
203
|
+
displaySetOptions.push({});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// if it is not part of the hanging protocol layout, we should remove the toolGroupId
|
|
208
|
+
// and viewportType from the viewportOptions so that it doesn't
|
|
209
|
+
// inherit the hanging protocol layout options, only when
|
|
210
|
+
// the viewport options is not provided (e.g., when drag and drop)
|
|
211
|
+
// otherwise, programmatically set options should be preserved
|
|
212
|
+
if (!updatedViewport.viewportOptions && !state.isHangingProtocolLayout) {
|
|
213
|
+
viewportOptions = {
|
|
214
|
+
viewportId: viewportOptions.viewportId,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const newViewport = {
|
|
219
|
+
...previousViewport,
|
|
220
|
+
displaySetInstanceUIDs,
|
|
221
|
+
viewportOptions,
|
|
222
|
+
displaySetOptions,
|
|
223
|
+
// viewportLabel: getViewportLabel(viewports, viewportId),
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
viewportOptions.presentationIds = service.getPresentationIds({
|
|
227
|
+
viewport: newViewport,
|
|
228
|
+
viewports,
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
viewports.set(viewportId, {
|
|
232
|
+
...viewports.get(viewportId),
|
|
233
|
+
...newViewport,
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
return { ...state, viewports };
|
|
238
|
+
}
|
|
239
|
+
case 'SET_LAYOUT': {
|
|
240
|
+
const {
|
|
241
|
+
numCols,
|
|
242
|
+
numRows,
|
|
243
|
+
layoutOptions,
|
|
244
|
+
layoutType = 'grid',
|
|
245
|
+
activeViewportId,
|
|
246
|
+
findOrCreateViewport,
|
|
247
|
+
isHangingProtocolLayout,
|
|
248
|
+
} = action.payload;
|
|
249
|
+
|
|
250
|
+
// If empty viewportOptions, we use numRow and numCols to calculate number of viewports
|
|
251
|
+
const hasOptions = layoutOptions?.length;
|
|
252
|
+
const viewports = new Map<string, AppTypes.ViewportGrid.Viewport>();
|
|
253
|
+
// Options is a temporary state store which can be used by the
|
|
254
|
+
// findOrCreate to store state about already found viewports. Typically,
|
|
255
|
+
// it will be used to store the display set UID's which are already
|
|
256
|
+
// in view so that the find or create can decide which display sets
|
|
257
|
+
// haven't been viewed yet, and add them in the appropriate order.
|
|
258
|
+
const options = {};
|
|
259
|
+
|
|
260
|
+
let activeViewportIdToSet = activeViewportId;
|
|
261
|
+
for (let row = 0; row < numRows; row++) {
|
|
262
|
+
for (let col = 0; col < numCols; col++) {
|
|
263
|
+
const position = col + row * numCols;
|
|
264
|
+
const layoutOption = layoutOptions[position];
|
|
265
|
+
|
|
266
|
+
let xPos, yPos, w, h;
|
|
267
|
+
if (layoutOptions && layoutOptions[position]) {
|
|
268
|
+
({ x: xPos, y: yPos, width: w, height: h } = layoutOptions[position]);
|
|
269
|
+
} else {
|
|
270
|
+
w = 1 / numCols;
|
|
271
|
+
h = 1 / numRows;
|
|
272
|
+
xPos = col * w;
|
|
273
|
+
yPos = row * h;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const colIndex = Math.round(xPos * numCols);
|
|
277
|
+
const rowIndex = Math.round(yPos * numRows);
|
|
278
|
+
|
|
279
|
+
const positionId = layoutOption?.positionId || `${colIndex}-${rowIndex}`;
|
|
280
|
+
|
|
281
|
+
if (hasOptions && position >= layoutOptions.length) {
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const viewport = findOrCreateViewport(position, positionId, options);
|
|
286
|
+
|
|
287
|
+
if (!viewport) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
viewport.positionId = positionId;
|
|
292
|
+
|
|
293
|
+
// If the viewport doesn't have a viewportId, we create one
|
|
294
|
+
if (!viewport.viewportOptions?.viewportId) {
|
|
295
|
+
const randomUID = utils.uuidv4().substring(0, 8);
|
|
296
|
+
viewport.viewportOptions = viewport.viewportOptions || {};
|
|
297
|
+
viewport.viewportOptions.viewportId = `viewport-${randomUID}`;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
viewport.viewportId = viewport.viewportOptions.viewportId;
|
|
301
|
+
|
|
302
|
+
// Create a new viewport object as it is getting updated here
|
|
303
|
+
// and it is part of the read only state
|
|
304
|
+
viewports.set(viewport.viewportId, viewport);
|
|
305
|
+
|
|
306
|
+
Object.assign(viewport, {
|
|
307
|
+
width: w,
|
|
308
|
+
height: h,
|
|
309
|
+
x: xPos,
|
|
310
|
+
y: yPos,
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
viewport.isReady = false;
|
|
314
|
+
|
|
315
|
+
if (!viewport.viewportOptions.presentationIds) {
|
|
316
|
+
const presentationIds = service.getPresentationIds({
|
|
317
|
+
viewport,
|
|
318
|
+
viewports,
|
|
319
|
+
});
|
|
320
|
+
viewport.viewportOptions.presentationIds = presentationIds;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
activeViewportIdToSet =
|
|
326
|
+
activeViewportIdToSet ?? determineActiveViewportId(state, viewports);
|
|
327
|
+
|
|
328
|
+
const ret = {
|
|
329
|
+
...state,
|
|
330
|
+
activeViewportId: activeViewportIdToSet,
|
|
331
|
+
layout: {
|
|
332
|
+
...state.layout,
|
|
333
|
+
numCols,
|
|
334
|
+
numRows,
|
|
335
|
+
layoutType,
|
|
336
|
+
},
|
|
337
|
+
viewports,
|
|
338
|
+
isHangingProtocolLayout,
|
|
339
|
+
};
|
|
340
|
+
return ret;
|
|
341
|
+
}
|
|
342
|
+
case 'RESET': {
|
|
343
|
+
return DEFAULT_STATE;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
case 'SET': {
|
|
347
|
+
return {
|
|
348
|
+
...state,
|
|
349
|
+
...action.payload,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
case 'VIEWPORT_IS_READY': {
|
|
354
|
+
const { viewportId, isReady } = action.payload;
|
|
355
|
+
const viewports = new Map(state.viewports);
|
|
356
|
+
const viewport = viewports.get(viewportId);
|
|
357
|
+
if (!viewport) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
viewports.set(viewportId, {
|
|
362
|
+
...viewport,
|
|
363
|
+
isReady,
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
return {
|
|
367
|
+
...state,
|
|
368
|
+
viewports,
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
default:
|
|
373
|
+
return action.payload;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
const [viewportGridState, dispatch] = useReducer(viewportGridReducer, DEFAULT_STATE);
|
|
378
|
+
|
|
379
|
+
const getState = useCallback(() => {
|
|
380
|
+
return viewportGridState;
|
|
381
|
+
}, [viewportGridState]);
|
|
382
|
+
|
|
383
|
+
const getActiveViewportOptionByKey = (key: string) => {
|
|
384
|
+
const { viewports, activeViewportId } = viewportGridState;
|
|
385
|
+
return viewports.get(activeViewportId)?.viewportOptions?.[key];
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
const setActiveViewportId = useCallback(
|
|
389
|
+
index => dispatch({ type: 'SET_ACTIVE_VIEWPORT_ID', payload: index }),
|
|
390
|
+
[dispatch]
|
|
391
|
+
);
|
|
392
|
+
|
|
393
|
+
const setDisplaySetsForViewports = useCallback(
|
|
394
|
+
viewports =>
|
|
395
|
+
dispatch({
|
|
396
|
+
type: 'SET_DISPLAYSETS_FOR_VIEWPORTS',
|
|
397
|
+
payload: viewports,
|
|
398
|
+
}),
|
|
399
|
+
[dispatch]
|
|
400
|
+
);
|
|
401
|
+
|
|
402
|
+
const setViewportIsReady = useCallback(
|
|
403
|
+
(viewportId, isReady) => {
|
|
404
|
+
dispatch({
|
|
405
|
+
type: 'VIEWPORT_IS_READY',
|
|
406
|
+
payload: {
|
|
407
|
+
viewportId,
|
|
408
|
+
isReady,
|
|
409
|
+
},
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
[dispatch, viewportGridState]
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
const getGridViewportsReady = useCallback(() => {
|
|
416
|
+
const { viewports } = viewportGridState;
|
|
417
|
+
// Filter viewports that have display sets (i.e., have content to display)
|
|
418
|
+
const viewportsWithContent = Array.from(viewports.values()).filter(
|
|
419
|
+
viewport => viewport.displaySetInstanceUIDs?.length > 0
|
|
420
|
+
);
|
|
421
|
+
// If there are no viewports with content, return false
|
|
422
|
+
if (viewportsWithContent.length === 0) {
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
// Check if all viewports with content are ready
|
|
426
|
+
const readyViewports = viewportsWithContent.filter(viewport => viewport.isReady);
|
|
427
|
+
return readyViewports.length === viewportsWithContent.length;
|
|
428
|
+
}, [viewportGridState]);
|
|
429
|
+
|
|
430
|
+
const setLayout = useCallback(
|
|
431
|
+
({
|
|
432
|
+
layoutType,
|
|
433
|
+
numRows,
|
|
434
|
+
numCols,
|
|
435
|
+
layoutOptions = [],
|
|
436
|
+
activeViewportId,
|
|
437
|
+
findOrCreateViewport,
|
|
438
|
+
isHangingProtocolLayout,
|
|
439
|
+
}) =>
|
|
440
|
+
dispatch({
|
|
441
|
+
type: 'SET_LAYOUT',
|
|
442
|
+
payload: {
|
|
443
|
+
layoutType,
|
|
444
|
+
numRows,
|
|
445
|
+
numCols,
|
|
446
|
+
layoutOptions,
|
|
447
|
+
activeViewportId,
|
|
448
|
+
findOrCreateViewport,
|
|
449
|
+
isHangingProtocolLayout,
|
|
450
|
+
},
|
|
451
|
+
}),
|
|
452
|
+
[dispatch]
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
const reset = useCallback(
|
|
456
|
+
() =>
|
|
457
|
+
dispatch({
|
|
458
|
+
type: 'RESET',
|
|
459
|
+
payload: {},
|
|
460
|
+
}),
|
|
461
|
+
[dispatch]
|
|
462
|
+
);
|
|
463
|
+
|
|
464
|
+
const set = useCallback(
|
|
465
|
+
payload =>
|
|
466
|
+
dispatch({
|
|
467
|
+
type: 'SET',
|
|
468
|
+
payload,
|
|
469
|
+
}),
|
|
470
|
+
[dispatch]
|
|
471
|
+
);
|
|
472
|
+
|
|
473
|
+
const getViewportState = useCallback(
|
|
474
|
+
viewportId => {
|
|
475
|
+
const { viewports } = viewportGridState;
|
|
476
|
+
return viewports.get(viewportId);
|
|
477
|
+
},
|
|
478
|
+
[viewportGridState]
|
|
479
|
+
);
|
|
480
|
+
|
|
481
|
+
const getNumViewportPanes = useCallback(() => {
|
|
482
|
+
const { layout, viewports } = viewportGridState;
|
|
483
|
+
const { numRows, numCols } = layout;
|
|
484
|
+
return Math.min(viewports.size, numCols * numRows);
|
|
485
|
+
}, [viewportGridState]);
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Sets the implementation of ViewportGridService that can be used by extensions.
|
|
489
|
+
*
|
|
490
|
+
* @returns void
|
|
491
|
+
*/
|
|
492
|
+
useEffect(() => {
|
|
493
|
+
if (service) {
|
|
494
|
+
service.setServiceImplementation({
|
|
495
|
+
getState,
|
|
496
|
+
setActiveViewportId,
|
|
497
|
+
setDisplaySetsForViewports,
|
|
498
|
+
isReferenceViewable: () => false,
|
|
499
|
+
setLayout,
|
|
500
|
+
reset,
|
|
501
|
+
onModeExit: reset,
|
|
502
|
+
set,
|
|
503
|
+
getNumViewportPanes,
|
|
504
|
+
setViewportIsReady,
|
|
505
|
+
getViewportState,
|
|
506
|
+
getGridViewportsReady,
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
}, [
|
|
510
|
+
getState,
|
|
511
|
+
service,
|
|
512
|
+
setActiveViewportId,
|
|
513
|
+
setDisplaySetsForViewports,
|
|
514
|
+
setLayout,
|
|
515
|
+
reset,
|
|
516
|
+
set,
|
|
517
|
+
getNumViewportPanes,
|
|
518
|
+
setViewportIsReady,
|
|
519
|
+
getGridViewportsReady,
|
|
520
|
+
getViewportState,
|
|
521
|
+
]);
|
|
522
|
+
|
|
523
|
+
// run many of the calls through the service itself since we want to publish events
|
|
524
|
+
const api = {
|
|
525
|
+
getState,
|
|
526
|
+
setActiveViewportId: index => service.setActiveViewportId(index),
|
|
527
|
+
setDisplaySetsForViewport: props => service.setDisplaySetsForViewports([props]),
|
|
528
|
+
setDisplaySetsForViewports: props => service.setDisplaySetsForViewports(props),
|
|
529
|
+
isReferenceViewable: (viewportId, isReferenceViewable, options) =>
|
|
530
|
+
service.isReferenceViewable(viewportId, isReferenceViewable, options),
|
|
531
|
+
setLayout: layout => service.setLayout(layout),
|
|
532
|
+
getViewportState: viewportId => service.getViewportState(viewportId),
|
|
533
|
+
reset: () => service.reset(),
|
|
534
|
+
set: gridLayoutState => service.setState(gridLayoutState), // run it through the service itself since we want to publish events
|
|
535
|
+
getNumViewportPanes,
|
|
536
|
+
setViewportIsReady,
|
|
537
|
+
getGridViewportsReady,
|
|
538
|
+
getActiveViewportOptionByKey,
|
|
539
|
+
setViewportGridSizeChanged: props => service.setViewportGridSizeChanged(props),
|
|
540
|
+
publishViewportsReady: () => service.publishViewportsReady(),
|
|
541
|
+
getLayoutOptionsFromState: state => service.getLayoutOptionsFromState(state),
|
|
542
|
+
getDisplaySetsUIDsForViewport: viewportId => service.getDisplaySetsUIDsForViewport(viewportId),
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
return (
|
|
546
|
+
<ViewportGridContext.Provider value={[viewportGridState, api]}>
|
|
547
|
+
{children}
|
|
548
|
+
</ViewportGridContext.Provider>
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
// Update the useViewportGrid hook
|
|
555
|
+
export const useViewportGrid = (): [AppTypes.ViewportGrid.State, ViewportGridApi] =>
|
|
556
|
+
useContext(ViewportGridContext);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import NotificationProvider, { useNotification } from './NotificationProvider';
|
|
2
|
+
import { ViewportGridContext, ViewportGridProvider, useViewportGrid } from './ViewportGridProvider';
|
|
3
|
+
import { ModalProvider, useModal } from './ModalProvider';
|
|
4
|
+
import { DialogProvider, useDialog } from './DialogProvider';
|
|
5
|
+
import ManagedDialog from './ManagedDialog';
|
|
6
|
+
import ViewportDialogProvider from './ViewportDialogProvider';
|
|
7
|
+
import { useViewportDialog } from './ViewportDialogProvider';
|
|
8
|
+
import { UserAuthenticationProvider, useUserAuthentication } from './UserAuthenticationProvider';
|
|
9
|
+
import { ImageViewerContext, ImageViewerProvider, useImageViewer } from './ImageViewerProvider';
|
|
10
|
+
import DragAndDropProvider from './DragAndDropProvider';
|
|
11
|
+
import CineProvider, { useCine } from './CineProvider';
|
|
12
|
+
|
|
13
|
+
export { useNotification, NotificationProvider };
|
|
14
|
+
export { ViewportGridContext, ViewportGridProvider, useViewportGrid };
|
|
15
|
+
export { ModalProvider, useModal };
|
|
16
|
+
export { DialogProvider, useDialog };
|
|
17
|
+
export { ManagedDialog };
|
|
18
|
+
export { ViewportDialogProvider, useViewportDialog };
|
|
19
|
+
export { UserAuthenticationProvider, useUserAuthentication };
|
|
20
|
+
export { ImageViewerContext, ImageViewerProvider, useImageViewer };
|
|
21
|
+
export { DragAndDropProvider };
|
|
22
|
+
export { CineProvider, useCine };
|
|
23
|
+
export { IconPresentationProvider, useIconPresentation } from './IconPresentationProvider';
|
|
24
|
+
export { ActiveThemeProvider, useActiveTheme } from './ActiveThemeProvider';
|
|
25
|
+
export { themePresets } from '../themes';
|
|
26
|
+
export type { ThemePreset } from '../themes';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useRef, useState, useEffect, RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
const _getMovementIntersectionObserver = ({
|
|
4
|
+
callback,
|
|
5
|
+
rootMargin,
|
|
6
|
+
threshold,
|
|
7
|
+
}: {
|
|
8
|
+
callback: () => void;
|
|
9
|
+
rootMargin: string;
|
|
10
|
+
threshold: number[];
|
|
11
|
+
}): IntersectionObserver => {
|
|
12
|
+
return new IntersectionObserver(
|
|
13
|
+
entries => {
|
|
14
|
+
entries.forEach(entry => {
|
|
15
|
+
if (entry.isIntersecting) {
|
|
16
|
+
callback();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
threshold,
|
|
22
|
+
rootMargin,
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Calculates the maximum height for an element based on its position
|
|
29
|
+
* relative to the bottom of the viewport.
|
|
30
|
+
*
|
|
31
|
+
* @param data The data that, when changed, should trigger a recalculation.
|
|
32
|
+
* @param buffer Optional buffer space (in pixels) to leave below the element. Defaults to 20.
|
|
33
|
+
* @param minHeight Optional minimum height (in pixels) for the element. Defaults to 100.
|
|
34
|
+
* @returns An object containing:
|
|
35
|
+
* - `ref`: A RefObject to attach to the target DOM element.
|
|
36
|
+
* - `maxHeight`: The calculated maximum height string (e.g., "500px").
|
|
37
|
+
*/
|
|
38
|
+
export function useDynamicMaxHeight(
|
|
39
|
+
data: any,
|
|
40
|
+
buffer = 20,
|
|
41
|
+
minHeight = 100
|
|
42
|
+
): {
|
|
43
|
+
ref: RefObject<HTMLDivElement | null>;
|
|
44
|
+
maxHeight: string;
|
|
45
|
+
} {
|
|
46
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
47
|
+
const [maxHeight, setMaxHeight] = useState<string>('100vh'); // Start with full viewport height initially
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const calculateMaxHeight = () => {
|
|
51
|
+
if (ref.current) {
|
|
52
|
+
const rect = ref.current.getBoundingClientRect();
|
|
53
|
+
const availableHeight = window.innerHeight - rect.top - buffer;
|
|
54
|
+
setMaxHeight(`${Math.max(minHeight, availableHeight)}px`);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Two intersection observers to trigger a recalculation when the target element
|
|
59
|
+
// moves up or down. One for moving up and one for moving down.
|
|
60
|
+
// Note that with this approach we don't need to use a resize observer nor
|
|
61
|
+
// a window resize listener.
|
|
62
|
+
|
|
63
|
+
// The trick is to use a margin for the IntersectionObserver to detect movement.
|
|
64
|
+
// See more below.
|
|
65
|
+
const rootMarginHeight = maxHeight === '100vh' ? `${window.innerHeight}px` : `${maxHeight}`;
|
|
66
|
+
|
|
67
|
+
// Note that we use a fine grained threshold because we don't know how
|
|
68
|
+
// much it will move and we want any movement to trigger the intersection observer.
|
|
69
|
+
const threshold = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0];
|
|
70
|
+
|
|
71
|
+
// The trick here is to use the calculated maxHeight as the root margin height
|
|
72
|
+
// so that any movement of the target element down (i.e. "out of the" viewport)
|
|
73
|
+
// will trigger the intersection observer.
|
|
74
|
+
const moveDownIntersectionObserver = _getMovementIntersectionObserver({
|
|
75
|
+
callback: calculateMaxHeight,
|
|
76
|
+
rootMargin: `0px 0px ${rootMarginHeight} 0px`,
|
|
77
|
+
threshold,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// The trick here is to use the calculated maxHeight as the negative
|
|
81
|
+
// root margin height so that any movement of the target element up
|
|
82
|
+
// (i.e. "into the" viewport) will trigger the intersection observer.
|
|
83
|
+
const moveUpIntersectionObserver = _getMovementIntersectionObserver({
|
|
84
|
+
callback: calculateMaxHeight,
|
|
85
|
+
rootMargin: `0px 0px -${rootMarginHeight} 0px`,
|
|
86
|
+
threshold,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
if (ref.current) {
|
|
90
|
+
moveUpIntersectionObserver.observe(ref.current);
|
|
91
|
+
moveDownIntersectionObserver.observe(ref.current);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Cleanup listener and requestAnimationFrame on component unmount
|
|
95
|
+
return () => {
|
|
96
|
+
moveUpIntersectionObserver.disconnect();
|
|
97
|
+
moveDownIntersectionObserver.disconnect();
|
|
98
|
+
};
|
|
99
|
+
// Dependencies: buffer, minHeight, and data.
|
|
100
|
+
}, [data, buffer, minHeight, maxHeight]);
|
|
101
|
+
|
|
102
|
+
return { ref, maxHeight };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default useDynamicMaxHeight;
|