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 getDataSourceConfigurationCustomization from './customizations/dataSourceConfigurationCustomization';
|
||||||
import progressDropdownCustomization from './customizations/progressDropdownCustomization';
|
import progressDropdownCustomization from './customizations/progressDropdownCustomization';
|
||||||
import sortingCriteriaCustomization from './customizations/sortingCriteriaCustomization';
|
import sortingCriteriaCustomization from './customizations/sortingCriteriaCustomization';
|
||||||
|
import onDropHandlerCustomization from './customizations/onDropHandlerCustomization';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -46,6 +47,7 @@ export default function getCustomizationModule({ servicesManager, extensionManag
|
|||||||
...progressDropdownCustomization,
|
...progressDropdownCustomization,
|
||||||
...sortingCriteriaCustomization,
|
...sortingCriteriaCustomization,
|
||||||
...defaultContextMenuCustomization,
|
...defaultContextMenuCustomization,
|
||||||
|
...onDropHandlerCustomization,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@ -24,8 +24,13 @@ function ViewerViewportGrid(props: withAppTypes) {
|
|||||||
});
|
});
|
||||||
const layoutHash = useRef(null);
|
const layoutHash = useRef(null);
|
||||||
|
|
||||||
const { displaySetService, measurementService, hangingProtocolService, uiNotificationService } =
|
const {
|
||||||
servicesManager.services;
|
displaySetService,
|
||||||
|
measurementService,
|
||||||
|
hangingProtocolService,
|
||||||
|
uiNotificationService,
|
||||||
|
customizationService,
|
||||||
|
} = servicesManager.services;
|
||||||
|
|
||||||
const generateLayoutHash = () => `${numCols}-${numRows}`;
|
const generateLayoutHash = () => `${numCols}-${numRows}`;
|
||||||
|
|
||||||
@ -208,8 +213,20 @@ function ViewerViewportGrid(props: withAppTypes) {
|
|||||||
}, [viewports]);
|
}, [viewports]);
|
||||||
|
|
||||||
const onDropHandler = (viewportId, { displaySetInstanceUID }) => {
|
const onDropHandler = (viewportId, { displaySetInstanceUID }) => {
|
||||||
|
const customOnDropHandler = customizationService.getCustomization('customOnDropHandler');
|
||||||
|
const dropHandlerPromise = customOnDropHandler({
|
||||||
|
...props,
|
||||||
|
viewportId,
|
||||||
|
displaySetInstanceUID,
|
||||||
|
appConfig,
|
||||||
|
});
|
||||||
|
|
||||||
|
dropHandlerPromise.then(({ handled }) => {
|
||||||
|
if (!handled) {
|
||||||
const updatedViewports = _getUpdatedViewports(viewportId, displaySetInstanceUID);
|
const updatedViewports = _getUpdatedViewports(viewportId, displaySetInstanceUID);
|
||||||
viewportGridService.setDisplaySetsForViewports(updatedViewports);
|
viewportGridService.setDisplaySetsForViewports(updatedViewports);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getViewportPanes = useCallback(() => {
|
const getViewportPanes = useCallback(() => {
|
||||||
|
|||||||
@ -587,6 +587,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
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user