fix: customization types (#4321)

This commit is contained in:
Pedro H. Köhler 2024-07-31 12:21:51 -03:00 committed by GitHub
parent 50669867c9
commit 72bef63ef6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -9,6 +9,7 @@ export interface BaseCustomization extends Obj {
description?: string; description?: string;
label?: string; label?: string;
commands?: Command[]; commands?: Command[];
content?: (...props: any) => React.JSX.Element;
} }
export interface LabelCustomization extends BaseCustomization { export interface LabelCustomization extends BaseCustomization {
@ -23,11 +24,16 @@ export interface CommandCustomization extends BaseCustomization {
commands: Command[]; commands: Command[];
} }
export interface ComponentCustomization extends BaseCustomization {
content: (...props: any) => React.JSX.Element;
}
export type Customization = export type Customization =
| BaseCustomization | BaseCustomization
| LabelCustomization | LabelCustomization
| CommandCustomization | CommandCustomization
| CodeCustomization; | CodeCustomization
| ComponentCustomization;
export default Customization; export default Customization;

View File

@ -1,6 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Types } from '@ohif/core';
import MeasurementItem from './MeasurementItem'; import MeasurementItem from './MeasurementItem';
@ -17,9 +18,11 @@ const MeasurementTable = ({
const amount = data.length; const amount = data.length;
const itemCustomization = customizationService.getCustomization('MeasurementItem', { const itemCustomization = customizationService.getCustomization('MeasurementItem', {
id: 'MeasurementItem',
content: MeasurementItem, content: MeasurementItem,
contentProps: {}, contentProps: {},
}); }) as Types.Customization;
const CustomMeasurementItem = itemCustomization.content; const CustomMeasurementItem = itemCustomization.content;
const onMeasurementDeleteHandler = ({ uid }) => { const onMeasurementDeleteHandler = ({ uid }) => {