@lunit/oui 2.3.2 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { v4 as uuidV4 } from 'uuid';
|
|
4
4
|
import { Score } from '../Score';
|
|
5
5
|
import { Container } from './ModelType.styled';
|
|
@@ -32,6 +32,9 @@ const ModelType = ({ componentType = 'modelType', title, optionTitle, scoreItems
|
|
|
32
32
|
onClickUpdateConfiguration();
|
|
33
33
|
setIsModelTypeChanged(false);
|
|
34
34
|
};
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setSelectedItem(userModelType);
|
|
37
|
+
}, [userModelType]);
|
|
35
38
|
return (_jsxs(Container, { children: [scoreItems[selectedItem].map((item) => {
|
|
36
39
|
return (_jsx(Score, { ...item }, uuidV4()));
|
|
37
40
|
}), _jsx(HorizonDivider, { componentType: "divider" }), _jsx(PresentationTypography, { size: "medium-bold", children: title }), _jsx(Score, { ...currentSensitivity }), _jsx(Score, { ...currentSpecificity }), _jsxs(Dropdown, { value: selectedItem, onChange: handleDropdownChange, sx: { width: '258px' }, children: [optionTitle && _jsx(DropdownSubtitle, { label: optionTitle }), options.map((option) => {
|
|
@@ -2,9 +2,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import { find as _find } from 'lodash';
|
|
4
4
|
import { ModelType } from '../ModelType';
|
|
5
|
+
const initialMemberExtraProperties = {
|
|
6
|
+
egfrPredictionThreshold: {
|
|
7
|
+
type: 'EGFR_BEST',
|
|
8
|
+
value: 60,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
5
11
|
const ModelTypeControl = (modelType) => {
|
|
6
12
|
const [modelTypeState, setModelTypeState] = useState(modelType);
|
|
7
13
|
const [selectedItem, setSelectedItem] = useState('egfrBest');
|
|
14
|
+
const [memberExtraProperties, setMemberExtraProperties] = useState(initialMemberExtraProperties);
|
|
8
15
|
const updateModelType = useCallback((type) => {
|
|
9
16
|
const currentModelType = { ...modelType };
|
|
10
17
|
const currentSensitivity = currentModelType.options.find((option) => option.target.annotation.dimension === type)?.sensitivity;
|
|
@@ -13,12 +20,26 @@ const ModelTypeControl = (modelType) => {
|
|
|
13
20
|
currentModelType.currentSpecificity.metrics.value = currentSpecificity?.toString() || '0.0';
|
|
14
21
|
setModelTypeState(currentModelType);
|
|
15
22
|
}, [modelType]);
|
|
23
|
+
// Update memberExtraProperties after 1 second
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const timer = setTimeout(() => {
|
|
26
|
+
setMemberExtraProperties({
|
|
27
|
+
egfrPredictionThreshold: {
|
|
28
|
+
type: 'MAX_SENSITIVITY',
|
|
29
|
+
value: 21,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}, 1000);
|
|
33
|
+
return () => clearTimeout(timer);
|
|
34
|
+
}, []);
|
|
35
|
+
// useEffect when memberExtraProperties is updated
|
|
16
36
|
useEffect(() => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
37
|
+
const dimension = modelType.options.find((option) => {
|
|
38
|
+
return option.key === memberExtraProperties.egfrPredictionThreshold.type;
|
|
39
|
+
})?.target.annotation.dimension;
|
|
40
|
+
updateModelType(dimension);
|
|
41
|
+
setSelectedItem(dimension);
|
|
42
|
+
}, [modelType.options, memberExtraProperties, updateModelType]);
|
|
22
43
|
const onChangeDropdown = (event) => {
|
|
23
44
|
const item = _find(modelType.options, ['target.annotation.dimension', event.target.value]);
|
|
24
45
|
console.log(`pixelAnnotations.${item?.target.annotation.name}.${item?.target.annotation.dimension}`);
|
package/package.json
CHANGED