feat(typings): Enhance typing support with withAppTypes and custom services throughout OHIF (#4090)
This commit is contained in:
1 parent
b2cd0172d6
commit
374065bc3b
153 files changed
+842
-657
No files matched your search
@@ -4,7 +4,7 @@ const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.js`,
|
||||
app: `${SRC_DIR}/index.ts`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
|
||||
@@ -9,7 +9,7 @@ const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.js`,
|
||||
app: `${SRC_DIR}/index.ts`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"license": "MIT",
|
||||
"repository": "OHIF/Viewers",
|
||||
"main": "dist/ohif-mode-basic-dev-mode.umd.js",
|
||||
"module": "src/index.js",
|
||||
"module": "src/index.ts",
|
||||
"engines": {
|
||||
"node": ">=10",
|
||||
"npm": ">=6",
|
||||
|
||||
@@ -50,7 +50,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
/**
|
||||
* Lifecycle hooks
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager }) => {
|
||||
onModeEnter: ({ servicesManager, extensionManager }: withAppTypes) => {
|
||||
const { toolbarService, toolGroupService } = servicesManager.services;
|
||||
const utilityModule = extensionManager.getModuleEntry(
|
||||
'@ohif/extension-cornerstone.utilityModule.tools'
|
||||
@@ -101,7 +101,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
'MoreTools',
|
||||
]);
|
||||
},
|
||||
onModeExit: ({ servicesManager }) => {
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
toolGroupService,
|
||||
measurementService,
|
||||
@@ -64,7 +64,7 @@ function modeFactory() {
|
||||
/**
|
||||
* Lifecycle hooks
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }: withAppTypes) => {
|
||||
const { measurementService, toolbarService, toolGroupService, customizationService } =
|
||||
servicesManager.services;
|
||||
|
||||
@@ -91,7 +91,7 @@ function modeFactory() {
|
||||
'MoreTools',
|
||||
]);
|
||||
},
|
||||
onModeExit: ({ servicesManager }) => {
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
toolGroupService,
|
||||
syncGroupService,
|
||||
|
||||
@@ -4,7 +4,7 @@ const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.js`,
|
||||
app: `${SRC_DIR}/index.ts`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ const ROOT_DIR = path.join(__dirname, './../');
|
||||
const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.js`,
|
||||
app: `${SRC_DIR}/index.ts`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"license": "MIT",
|
||||
"repository": "OHIF/Viewers",
|
||||
"main": "dist/ohif-mode-longitudinal.js",
|
||||
"module": "src/index.js",
|
||||
"module": "src/index.ts",
|
||||
"engines": {
|
||||
"node": ">=14",
|
||||
"npm": ">=6",
|
||||
|
||||
@@ -70,7 +70,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
/**
|
||||
* Lifecycle hooks
|
||||
*/
|
||||
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }) {
|
||||
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }: withAppTypes) {
|
||||
const { measurementService, toolbarService, toolGroupService, customizationService } =
|
||||
servicesManager.services;
|
||||
|
||||
@@ -135,7 +135,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
// ]),
|
||||
// ];
|
||||
},
|
||||
onModeExit: ({ servicesManager }) => {
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
toolGroupService,
|
||||
syncGroupService,
|
||||
@@ -47,14 +47,14 @@ function modeFactory({ modeConfiguration }) {
|
||||
/**
|
||||
* Lifecycle hooks
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }: withAppTypes) => {
|
||||
const { toolbarService } = servicesManager.services;
|
||||
|
||||
toolbarService.addButtons(toolbarButtons);
|
||||
toolbarService.createButtonSection('primary', ['MeasurementTools', 'dragPan', 'TagBrowser']);
|
||||
},
|
||||
|
||||
onModeExit: ({ servicesManager }) => {
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const { toolbarService, uiDialogService, uiModalService } = servicesManager.services;
|
||||
|
||||
uiDialogService.dismissAll();
|
||||
|
||||
@@ -37,7 +37,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
id,
|
||||
routeName: 'dynamic-volume',
|
||||
displayName: '4D PT/CT',
|
||||
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }) {
|
||||
onModeEnter: function ({ servicesManager, extensionManager, commandsManager }: withAppTypes) {
|
||||
const {
|
||||
measurementService,
|
||||
toolbarService,
|
||||
@@ -86,12 +86,12 @@ function modeFactory({ modeConfiguration }) {
|
||||
}
|
||||
);
|
||||
},
|
||||
onSetupRouteComplete: ({ servicesManager }) => {
|
||||
onSetupRouteComplete: ({ servicesManager }: withAppTypes) => {
|
||||
// This needs to run after hanging protocol matching process because
|
||||
// it may change the protocol/stage based on workflow stage settings
|
||||
initWorkflowSteps({ servicesManager });
|
||||
},
|
||||
onModeExit: ({ servicesManager }) => {
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
toolGroupService,
|
||||
syncGroupService,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import getWorkflowSettings from './getWorkflowSettings';
|
||||
|
||||
export default function initWorkflowSteps({ servicesManager }): void {
|
||||
export default function initWorkflowSteps({ servicesManager }: withAppTypes): void {
|
||||
const { workflowStepsService } = servicesManager.services;
|
||||
const workflowSettings = getWorkflowSettings({ servicesManager });
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
* Runs when the Mode Route is mounted to the DOM. Usually used to initialize
|
||||
* Services and other resources.
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }: withAppTypes) => {
|
||||
const { measurementService, toolbarService, toolGroupService } = servicesManager.services;
|
||||
|
||||
measurementService.clearMeasurements();
|
||||
@@ -76,7 +76,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
]);
|
||||
toolbarService.createButtonSection('segmentationToolbox', ['BrushTools', 'Shapes']);
|
||||
},
|
||||
onModeExit: ({ servicesManager }) => {
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
toolGroupService,
|
||||
syncGroupService,
|
||||
|
||||
@@ -4,7 +4,7 @@ const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.js`,
|
||||
app: `${SRC_DIR}/index.ts`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
|
||||
@@ -11,7 +11,7 @@ const SRC_DIR = path.join(__dirname, '../src');
|
||||
const DIST_DIR = path.join(__dirname, '../dist');
|
||||
|
||||
const ENTRY = {
|
||||
app: `${SRC_DIR}/index.js`,
|
||||
app: `${SRC_DIR}/index.ts`,
|
||||
};
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"license": "MIT",
|
||||
"repository": "OHIF/Viewers",
|
||||
"main": "dist/ohif-mode-tmtv.umd.js",
|
||||
"module": "src/index.js",
|
||||
"module": "src/index.ts",
|
||||
"engines": {
|
||||
"node": ">=14",
|
||||
"npm": ">=6",
|
||||
|
||||
@@ -35,7 +35,7 @@ const extensionDependencies = {
|
||||
'@ohif/extension-tmtv': '^3.0.0',
|
||||
};
|
||||
|
||||
let unsubscriptions = [];
|
||||
const unsubscriptions = [];
|
||||
function modeFactory({ modeConfiguration }) {
|
||||
return {
|
||||
// TODO: We're using this as a route segment
|
||||
@@ -46,7 +46,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
/**
|
||||
* Lifecycle hooks
|
||||
*/
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }) => {
|
||||
onModeEnter: ({ servicesManager, extensionManager, commandsManager }: withAppTypes) => {
|
||||
const {
|
||||
toolbarService,
|
||||
toolGroupService,
|
||||
@@ -146,7 +146,7 @@ function modeFactory({ modeConfiguration }) {
|
||||
}
|
||||
);
|
||||
},
|
||||
onModeExit: ({ servicesManager }) => {
|
||||
onModeExit: ({ servicesManager }: withAppTypes) => {
|
||||
const {
|
||||
toolGroupService,
|
||||
syncGroupService,
|
||||
Reference in new issue
Block a user