@vitessce/biomarker-select 3.5.7 → 3.5.9
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.
- package/dist/index.js +368 -19
- package/dist-tsc/BiomarkerSelectSubscriber.d.ts.map +1 -1
- package/dist-tsc/BiomarkerSelectSubscriber.js +65 -9
- package/dist-tsc/ComparativeHeadingSubscriber.d.ts +2 -0
- package/dist-tsc/ComparativeHeadingSubscriber.d.ts.map +1 -0
- package/dist-tsc/ComparativeHeadingSubscriber.js +45 -0
- package/dist-tsc/default-async-functions.d.ts.map +1 -1
- package/dist-tsc/default-async-functions.js +1 -0
- package/dist-tsc/index.d.ts +1 -0
- package/dist-tsc/index.js +1 -0
- package/dist-tsc/scmd-ui.d.ts.map +1 -1
- package/dist-tsc/scmd-ui.js +3 -2
- package/dist-tsc/{confirmatory-stepper.d.ts → stepper-confirmatory.d.ts} +1 -1
- package/dist-tsc/stepper-confirmatory.d.ts.map +1 -0
- package/dist-tsc/stepper-exploratory.d.ts +2 -0
- package/dist-tsc/stepper-exploratory.d.ts.map +1 -0
- package/dist-tsc/stepper-exploratory.js +61 -0
- package/package.json +4 -4
- package/src/BiomarkerSelectSubscriber.js +82 -8
- package/src/ComparativeHeadingSubscriber.js +87 -0
- package/src/default-async-functions.js +1 -0
- package/src/index.js +1 -0
- package/src/scmd-ui.js +18 -2
- package/src/stepper-exploratory.js +175 -0
- package/dist-tsc/confirmatory-stepper.d.ts.map +0 -1
- /package/dist-tsc/{confirmatory-stepper.js → stepper-confirmatory.js} +0 -0
- /package/src/{confirmatory-stepper.js → stepper-confirmatory.js} +0 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Stepper, Step, StepLabel, Button, Grid, Box, Typography } from '@material-ui/core';
|
|
3
|
+
import { ConfirmatoryCart } from './cart.js';
|
|
4
|
+
import { SelectStratification } from './select-stratification.js';
|
|
5
|
+
import { useStyles } from './styles.js';
|
|
6
|
+
|
|
7
|
+
const steps = [
|
|
8
|
+
'Define case-control stratification',
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export function ExploratoryStepper(props) {
|
|
12
|
+
const {
|
|
13
|
+
autocompleteNode,
|
|
14
|
+
|
|
15
|
+
currentModalityAgnosticSelection,
|
|
16
|
+
setCurrentModalityAgnosticSelection,
|
|
17
|
+
currentModalitySpecificSelection,
|
|
18
|
+
setCurrentModalitySpecificSelection,
|
|
19
|
+
currentStratificationSelection,
|
|
20
|
+
setCurrentStratificationSelection,
|
|
21
|
+
|
|
22
|
+
getEdges,
|
|
23
|
+
stratifications,
|
|
24
|
+
onFinish,
|
|
25
|
+
} = props;
|
|
26
|
+
const classes = useStyles();
|
|
27
|
+
const [activeStep, setActiveStep] = React.useState(0);
|
|
28
|
+
const [skipped, setSkipped] = React.useState(new Set());
|
|
29
|
+
|
|
30
|
+
const isStepOptional = step => step === 2;
|
|
31
|
+
|
|
32
|
+
const isStepSkipped = step => skipped.has(step);
|
|
33
|
+
|
|
34
|
+
const handleNext = () => {
|
|
35
|
+
let newSkipped = skipped;
|
|
36
|
+
if (isStepSkipped(activeStep)) {
|
|
37
|
+
newSkipped = new Set(newSkipped.values());
|
|
38
|
+
newSkipped.delete(activeStep);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setActiveStep(prevActiveStep => prevActiveStep + 1);
|
|
42
|
+
setSkipped(newSkipped);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const handleBack = () => {
|
|
46
|
+
setActiveStep(prevActiveStep => prevActiveStep - 1);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleSkip = () => {
|
|
50
|
+
if (!isStepOptional(activeStep)) {
|
|
51
|
+
// You probably want to guard against something like this,
|
|
52
|
+
// it should never occur unless someone's actively trying to break something.
|
|
53
|
+
throw new Error("You can't skip a step that isn't optional.");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
setActiveStep(prevActiveStep => prevActiveStep + 1);
|
|
57
|
+
setSkipped((prevSkipped) => {
|
|
58
|
+
const newSkipped = new Set(prevSkipped.values());
|
|
59
|
+
newSkipped.add(activeStep);
|
|
60
|
+
return newSkipped;
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const handleReset = () => {
|
|
65
|
+
setActiveStep(0);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (activeStep === steps.length) {
|
|
70
|
+
onFinish();
|
|
71
|
+
}
|
|
72
|
+
}, [activeStep, steps]);
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<Grid item container xs={12}>
|
|
77
|
+
<Grid item container xs={12}>
|
|
78
|
+
<Box className={classes.fullWidthBox}>
|
|
79
|
+
<Stepper activeStep={activeStep}>
|
|
80
|
+
{steps.map((label, index) => {
|
|
81
|
+
const stepProps = {};
|
|
82
|
+
const labelProps = {};
|
|
83
|
+
if (isStepOptional(index)) {
|
|
84
|
+
labelProps.optional = (
|
|
85
|
+
<Typography variant="caption">Optional</Typography>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
if (isStepSkipped(index)) {
|
|
89
|
+
stepProps.completed = false;
|
|
90
|
+
}
|
|
91
|
+
return (
|
|
92
|
+
<Step key={label} {...stepProps}>
|
|
93
|
+
<StepLabel {...labelProps}>{label}</StepLabel>
|
|
94
|
+
</Step>
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
97
|
+
</Stepper>
|
|
98
|
+
</Box>
|
|
99
|
+
</Grid>
|
|
100
|
+
<Grid item container xs={12} style={{ marginTop: '20px' }} alignItems="flex-start">
|
|
101
|
+
{/* Step contents to left of cart */}
|
|
102
|
+
<Grid item container xs={8}>
|
|
103
|
+
{activeStep === steps.length ? (
|
|
104
|
+
<>
|
|
105
|
+
<Typography style={{ marginTop: '20px', marginBottom: '10px' }}>
|
|
106
|
+
All steps completed - you're finished
|
|
107
|
+
</Typography>
|
|
108
|
+
</>
|
|
109
|
+
) : (
|
|
110
|
+
<>
|
|
111
|
+
{activeStep === 0 ? (
|
|
112
|
+
<SelectStratification
|
|
113
|
+
autocompleteNode={autocompleteNode}
|
|
114
|
+
|
|
115
|
+
currentModalityAgnosticSelection={currentModalityAgnosticSelection}
|
|
116
|
+
setCurrentModalityAgnosticSelection={setCurrentModalityAgnosticSelection}
|
|
117
|
+
currentModalitySpecificSelection={currentModalitySpecificSelection}
|
|
118
|
+
setCurrentModalitySpecificSelection={setCurrentModalitySpecificSelection}
|
|
119
|
+
currentStratificationSelection={currentStratificationSelection}
|
|
120
|
+
setCurrentStratificationSelection={setCurrentStratificationSelection}
|
|
121
|
+
|
|
122
|
+
getEdges={getEdges}
|
|
123
|
+
stratifications={stratifications}
|
|
124
|
+
/>
|
|
125
|
+
) : null}
|
|
126
|
+
</>
|
|
127
|
+
)}
|
|
128
|
+
</Grid>
|
|
129
|
+
{/* Cart */}
|
|
130
|
+
<Grid item container xs={4}>
|
|
131
|
+
<ConfirmatoryCart
|
|
132
|
+
currentModalityAgnosticSelection={currentModalityAgnosticSelection}
|
|
133
|
+
setCurrentModalityAgnosticSelection={setCurrentModalityAgnosticSelection}
|
|
134
|
+
currentModalitySpecificSelection={currentModalitySpecificSelection}
|
|
135
|
+
setCurrentModalitySpecificSelection={setCurrentModalitySpecificSelection}
|
|
136
|
+
currentStratificationSelection={currentStratificationSelection}
|
|
137
|
+
setCurrentStratificationSelection={setCurrentStratificationSelection}
|
|
138
|
+
stratifications={stratifications}
|
|
139
|
+
/>
|
|
140
|
+
</Grid>
|
|
141
|
+
{/* Step navigation button footer */}
|
|
142
|
+
<Box className={classes.fullWidthBox}>
|
|
143
|
+
{activeStep === steps.length ? (
|
|
144
|
+
<>
|
|
145
|
+
<Box style={{ display: 'flex', flexDirection: 'row', paddingTop: '20px' }}>
|
|
146
|
+
<Box style={{ flex: '1 1 auto' }} />
|
|
147
|
+
<Button onClick={handleReset}>Reset</Button>
|
|
148
|
+
</Box>
|
|
149
|
+
</>
|
|
150
|
+
) : (
|
|
151
|
+
<Box style={{ display: 'flex', flexDirection: 'row', paddingTop: '20px' }}>
|
|
152
|
+
<Button
|
|
153
|
+
color="inherit"
|
|
154
|
+
disabled={activeStep === 0}
|
|
155
|
+
onClick={handleBack}
|
|
156
|
+
style={{ mr: 1 }}
|
|
157
|
+
>
|
|
158
|
+
Back
|
|
159
|
+
</Button>
|
|
160
|
+
<Box style={{ flex: '1 1 auto' }} />
|
|
161
|
+
{isStepOptional(activeStep) && (
|
|
162
|
+
<Button color="inherit" onClick={handleSkip} style={{ marginRight: '10px' }}>
|
|
163
|
+
Skip
|
|
164
|
+
</Button>
|
|
165
|
+
)}
|
|
166
|
+
<Button onClick={handleNext}>
|
|
167
|
+
{activeStep === steps.length - 1 ? 'Finish' : 'Next'}
|
|
168
|
+
</Button>
|
|
169
|
+
</Box>
|
|
170
|
+
)}
|
|
171
|
+
</Box>
|
|
172
|
+
</Grid>
|
|
173
|
+
</Grid>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"confirmatory-stepper.d.ts","sourceRoot":"","sources":["../src/confirmatory-stepper.js"],"names":[],"mappings":"AAcA,6DAkMC"}
|
|
File without changes
|
|
File without changes
|