feat(customization): enable custom onDropHandler for viewportGrid (#4641)
This commit is contained in:
parent
3dac0f9e73
commit
054b262e9c
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
customOnDropHandler: () => {
|
||||
return Promise.resolve({ handled: false });
|
||||
},
|
||||
};
|
||||
@ -10,6 +10,7 @@ import menuContentCustomization from './customizations/menuContentCustomization'
|
||||
import getDataSourceConfigurationCustomization from './customizations/dataSourceConfigurationCustomization';
|
||||
import progressDropdownCustomization from './customizations/progressDropdownCustomization';
|
||||
import sortingCriteriaCustomization from './customizations/sortingCriteriaCustomization';
|
||||
import onDropHandlerCustomization from './customizations/onDropHandlerCustomization';
|
||||
|
||||
/**
|
||||
*
|
||||
@ -46,6 +47,7 @@ export default function getCustomizationModule({ servicesManager, extensionManag
|
||||
...progressDropdownCustomization,
|
||||
...sortingCriteriaCustomization,
|
||||
...defaultContextMenuCustomization,
|
||||
...onDropHandlerCustomization,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@ -24,8 +24,13 @@ function ViewerViewportGrid(props: withAppTypes) {
|
||||
});
|
||||
const layoutHash = useRef(null);
|
||||
|
||||
const { displaySetService, measurementService, hangingProtocolService, uiNotificationService } =
|
||||
servicesManager.services;
|
||||
const {
|
||||
displaySetService,
|
||||
measurementService,
|
||||
hangingProtocolService,
|
||||
uiNotificationService,
|
||||
customizationService,
|
||||
} = servicesManager.services;
|
||||
|
||||
const generateLayoutHash = () => `${numCols}-${numRows}`;
|
||||
|
||||
@ -208,8 +213,20 @@ function ViewerViewportGrid(props: withAppTypes) {
|
||||
}, [viewports]);
|
||||
|
||||
const onDropHandler = (viewportId, { displaySetInstanceUID }) => {
|
||||
const updatedViewports = _getUpdatedViewports(viewportId, displaySetInstanceUID);
|
||||
viewportGridService.setDisplaySetsForViewports(updatedViewports);
|
||||
const customOnDropHandler = customizationService.getCustomization('customOnDropHandler');
|
||||
const dropHandlerPromise = customOnDropHandler({
|
||||
...props,
|
||||
viewportId,
|
||||
displaySetInstanceUID,
|
||||
appConfig,
|
||||
});
|
||||
|
||||
dropHandlerPromise.then(({ handled }) => {
|
||||
if (!handled) {
|
||||
const updatedViewports = _getUpdatedViewports(viewportId, displaySetInstanceUID);
|
||||
viewportGridService.setDisplaySetsForViewports(updatedViewports);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const getViewportPanes = useCallback(() => {
|
||||
|
||||
@ -590,6 +590,26 @@ window.config = {
|
||||
};
|
||||
`,
|
||||
},
|
||||
{
|
||||
id: 'customOnDropHandler ',
|
||||
description:
|
||||
'CustomOnDropHandler in the viewport grid enables users to handle additional functionalities during the onDrop event in the viewport.',
|
||||
default: props => {
|
||||
return Promise.resolve({ handled: false });
|
||||
},
|
||||
configuration: `
|
||||
window.config = {
|
||||
// rest of window config
|
||||
customizationService: [
|
||||
{
|
||||
customOnDropHandler: {
|
||||
$set: customOnDropHandler
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
`,
|
||||
},
|
||||
];
|
||||
|
||||
export const segmentationCustomizations = [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user