-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(multimonitor): Add simple multi-monitor support to open another …
…study(#4178)
- Loading branch information
1 parent
a4a6de0
commit 07c628e
Showing
49 changed files
with
1,473 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import React from 'react'; | ||
import { | ||
DropdownMenu, | ||
DropdownMenuContent, | ||
DropdownMenuTrigger, | ||
Icons, | ||
Button, | ||
} from '@ohif/ui-next'; | ||
|
||
/** | ||
* The default sub-menu appearance and setup is defined here, but this can be | ||
* replaced by | ||
*/ | ||
const getMenuItemsDefault = ({ commandsManager, items, servicesManager, ...props }) => { | ||
const { customizationService } = servicesManager.services; | ||
|
||
// This allows replacing the default child item for menus, whereas the entire | ||
// getMenuItems can also be replaced by providing it to the MoreDropdownMenu | ||
const menuContent = customizationService.getCustomization('ohif.menuContent'); | ||
|
||
return ( | ||
<DropdownMenuContent | ||
hideWhenDetached | ||
align="start" | ||
onClick={e => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
}} | ||
> | ||
{items?.map(item => | ||
menuContent.content({ | ||
key: item.id, | ||
item, | ||
commandsManager, | ||
servicesManager, | ||
...props, | ||
}) | ||
)} | ||
</DropdownMenuContent> | ||
); | ||
}; | ||
|
||
/** | ||
* The component provides a ... sub-menu for various components which appears | ||
* on hover over the main component. | ||
* | ||
* @param bindProps - properties to define the sub-menu | ||
* @returns Component bound to the bindProps | ||
*/ | ||
export default function MoreDropdownMenu(bindProps) { | ||
const { | ||
menuItemsKey, | ||
getMenuItems = getMenuItemsDefault, | ||
commandsManager, | ||
servicesManager, | ||
} = bindProps; | ||
const { customizationService } = servicesManager.services; | ||
|
||
const items = customizationService.getCustomization(menuItemsKey)?.value; | ||
|
||
if (!items) { | ||
return null; | ||
} | ||
|
||
function BoundMoreDropdownMenu(props) { | ||
return ( | ||
<DropdownMenu> | ||
<DropdownMenuTrigger asChild> | ||
<Button | ||
variant="ghost" | ||
size="icon" | ||
className="hidden group-hover:inline-flex data-[state=open]:inline-flex" | ||
onClick={e => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
}} | ||
> | ||
<Icons.More /> | ||
</Button> | ||
</DropdownMenuTrigger> | ||
{getMenuItems({ | ||
...props, | ||
commandsManager: commandsManager, | ||
servicesManager: servicesManager, | ||
items, | ||
})} | ||
</DropdownMenu> | ||
); | ||
} | ||
return BoundMoreDropdownMenu; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.