@jbrowse/plugin-config 2.0.0 → 2.1.2
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/ConfigurationEditorWidget/components/CallbackEditor.js +49 -57
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js +14 -56
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +37 -74
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -7
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js +42 -43
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +7 -5
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js +97 -142
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +15 -32
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -1
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js +7 -8
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -1
- package/dist/ConfigurationEditorWidget/index.d.ts +10 -3
- package/dist/ConfigurationEditorWidget/index.js +9 -9
- package/dist/ConfigurationEditorWidget/index.js.map +1 -1
- package/dist/ConfigurationEditorWidget/model.d.ts +3 -2
- package/dist/ConfigurationEditorWidget/model.js +16 -17
- package/dist/ConfigurationEditorWidget/model.js.map +1 -1
- package/dist/FromConfigAdapter/FromConfigAdapter.js +44 -158
- package/dist/FromConfigAdapter/FromConfigAdapter.js.map +1 -1
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js +37 -144
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -1
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +2 -1
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js +48 -179
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -1
- package/dist/FromConfigAdapter/configSchema.js +1 -1
- package/dist/FromConfigAdapter/configSchema.js.map +1 -1
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js +22 -108
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -1
- package/dist/RefNameAliasAdapter/configSchema.js +1 -1
- package/dist/RefNameAliasAdapter/configSchema.js.map +1 -1
- package/dist/index.js +60 -94
- package/dist/index.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +28 -19
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js +6 -21
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +6 -2
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -7
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js +38 -22
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +7 -5
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +33 -27
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -1
- package/esm/ConfigurationEditorWidget/index.d.ts +10 -3
- package/esm/ConfigurationEditorWidget/index.js +4 -3
- package/esm/ConfigurationEditorWidget/index.js.map +1 -1
- package/esm/ConfigurationEditorWidget/model.d.ts +3 -2
- package/esm/ConfigurationEditorWidget/model.js +2 -1
- package/esm/ConfigurationEditorWidget/model.js.map +1 -1
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +2 -1
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js +1 -9
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -1
- package/package.json +4 -6
- package/src/ConfigurationEditorWidget/components/CallbackEditor.tsx +44 -45
- package/src/ConfigurationEditorWidget/components/ColorEditor.tsx +6 -28
- package/src/ConfigurationEditorWidget/components/{ConfigurationEditor.test.js → ConfigurationEditor.test.tsx} +0 -0
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.tsx +6 -2
- package/src/ConfigurationEditorWidget/components/JsonEditor.tsx +84 -0
- package/src/ConfigurationEditorWidget/components/SlotEditor.tsx +484 -0
- package/src/ConfigurationEditorWidget/components/__snapshots__/{ConfigurationEditor.test.js.snap → ConfigurationEditor.test.tsx.snap} +186 -167
- package/src/ConfigurationEditorWidget/index.tsx +25 -0
- package/src/ConfigurationEditorWidget/{model.js → model.ts} +4 -2
- package/src/FromConfigAdapter/FromConfigSequenceAdapter.ts +6 -10
- package/dist/ConfigurationEditorWidget/components/CodeEditor.d.ts +0 -5
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js +0 -85
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js.map +0 -1
- package/dist/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js +0 -69
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js.map +0 -1
- package/esm/ConfigurationEditorWidget/components/CodeEditor.d.ts +0 -5
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js +0 -42
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js.map +0 -1
- package/esm/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js +0 -26
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js.map +0 -1
- package/src/ConfigurationEditorWidget/components/CodeEditor.tsx +0 -59
- package/src/ConfigurationEditorWidget/components/ColorPicker.tsx +0 -43
- package/src/ConfigurationEditorWidget/components/JsonEditor.js +0 -52
- package/src/ConfigurationEditorWidget/components/SlotEditor.js +0 -376
- package/src/ConfigurationEditorWidget/index.js +0 -20
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import { observer } from 'mobx-react'
|
|
3
|
-
import { getPropertyMembers, getEnv } from 'mobx-state-tree'
|
|
4
|
-
import { FileSelector, SanitizedHTML } from '@jbrowse/core/ui'
|
|
5
|
-
import {
|
|
6
|
-
getPropertyType,
|
|
7
|
-
getSubType,
|
|
8
|
-
getUnionSubTypes,
|
|
9
|
-
} from '@jbrowse/core/util/mst-reflection'
|
|
10
|
-
import {
|
|
11
|
-
Card,
|
|
12
|
-
CardContent,
|
|
13
|
-
CardHeader,
|
|
14
|
-
Checkbox,
|
|
15
|
-
FormControl,
|
|
16
|
-
FormControlLabel,
|
|
17
|
-
FormHelperText,
|
|
18
|
-
IconButton,
|
|
19
|
-
InputAdornment,
|
|
20
|
-
InputLabel,
|
|
21
|
-
MenuItem,
|
|
22
|
-
Paper,
|
|
23
|
-
SvgIcon,
|
|
24
|
-
TextField,
|
|
25
|
-
} from '@mui/material'
|
|
26
|
-
import { makeStyles } from 'tss-react/mui'
|
|
27
|
-
|
|
28
|
-
// icons
|
|
29
|
-
import DeleteIcon from '@mui/icons-material/Delete'
|
|
30
|
-
import AddIcon from '@mui/icons-material/Add'
|
|
31
|
-
import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked'
|
|
32
|
-
|
|
33
|
-
// locals
|
|
34
|
-
import StringArrayEditor from './StringArrayEditor'
|
|
35
|
-
import CallbackEditor from './CallbackEditor'
|
|
36
|
-
import ColorEditor from './ColorEditor'
|
|
37
|
-
import JsonEditor from './JsonEditor'
|
|
38
|
-
|
|
39
|
-
// adds ability to have html in helperText. note that FormHelperTextProps is
|
|
40
|
-
// div because the default is p which does not like div children
|
|
41
|
-
const MyTextField = props => {
|
|
42
|
-
const { helperText } = props
|
|
43
|
-
return (
|
|
44
|
-
<TextField
|
|
45
|
-
{...props}
|
|
46
|
-
helperText={<SanitizedHTML html={helperText} />}
|
|
47
|
-
FormHelperTextProps={{
|
|
48
|
-
component: 'div',
|
|
49
|
-
}}
|
|
50
|
-
fullWidth
|
|
51
|
-
/>
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const StringEditor = observer(({ slot }) => (
|
|
56
|
-
<MyTextField
|
|
57
|
-
label={slot.name}
|
|
58
|
-
helperText={slot.description}
|
|
59
|
-
value={slot.value}
|
|
60
|
-
onChange={evt => slot.set(evt.target.value)}
|
|
61
|
-
/>
|
|
62
|
-
))
|
|
63
|
-
|
|
64
|
-
const TextEditor = observer(({ slot }) => (
|
|
65
|
-
<TextField
|
|
66
|
-
label={slot.name}
|
|
67
|
-
helperText={slot.description}
|
|
68
|
-
multiline
|
|
69
|
-
value={slot.value}
|
|
70
|
-
onChange={evt => slot.set(evt.target.value)}
|
|
71
|
-
/>
|
|
72
|
-
))
|
|
73
|
-
|
|
74
|
-
// checked checkbox, looks like a styled (x)
|
|
75
|
-
const SvgCheckbox = () => (
|
|
76
|
-
<SvgIcon>
|
|
77
|
-
<path d="M20.41,3C21.8,5.71 22.35,8.84 22,12C21.8,15.16 20.7,18.29 18.83,21L17.3,20C18.91,17.57 19.85,14.8 20,12C20.34,9.2 19.89,6.43 18.7,4L20.41,3M5.17,3L6.7,4C5.09,6.43 4.15,9.2 4,12C3.66,14.8 4.12,17.57 5.3,20L3.61,21C2.21,18.29 1.65,15.17 2,12C2.2,8.84 3.3,5.71 5.17,3M12.08,10.68L14.4,7.45H16.93L13.15,12.45L15.35,17.37H13.09L11.71,14L9.28,17.33H6.76L10.66,12.21L8.53,7.45H10.8L12.08,10.68Z" />
|
|
78
|
-
</SvgIcon>
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
const useMapEditorStyles = makeStyles()(theme => ({
|
|
82
|
-
card: {
|
|
83
|
-
marginTop: theme.spacing(1),
|
|
84
|
-
},
|
|
85
|
-
}))
|
|
86
|
-
|
|
87
|
-
const StringArrayMapEditor = observer(({ slot }) => {
|
|
88
|
-
const { classes } = useMapEditorStyles()
|
|
89
|
-
const [value, setValue] = useState('')
|
|
90
|
-
return (
|
|
91
|
-
<>
|
|
92
|
-
<InputLabel>{slot.name}</InputLabel>
|
|
93
|
-
{Array.from(slot.value, ([key, val]) => (
|
|
94
|
-
<Card raised key={key} className={classes.card}>
|
|
95
|
-
<CardHeader
|
|
96
|
-
title={key}
|
|
97
|
-
action={
|
|
98
|
-
<IconButton color="secondary" onClick={() => slot.remove(key)}>
|
|
99
|
-
<DeleteIcon />
|
|
100
|
-
</IconButton>
|
|
101
|
-
}
|
|
102
|
-
/>
|
|
103
|
-
<CardContent>
|
|
104
|
-
<StringArrayEditor
|
|
105
|
-
slot={{
|
|
106
|
-
value: val,
|
|
107
|
-
description: `Values associated with entry ${key}`,
|
|
108
|
-
setAtIndex: (idx, strValue) => {
|
|
109
|
-
slot.setAtKeyIndex(key, idx, strValue)
|
|
110
|
-
},
|
|
111
|
-
removeAtIndex: idx => {
|
|
112
|
-
slot.removeAtKeyIndex(key, idx)
|
|
113
|
-
},
|
|
114
|
-
add: strValue => {
|
|
115
|
-
slot.addToKey(key, strValue)
|
|
116
|
-
},
|
|
117
|
-
}}
|
|
118
|
-
/>
|
|
119
|
-
</CardContent>
|
|
120
|
-
</Card>
|
|
121
|
-
))}
|
|
122
|
-
<Card raised className={classes.card}>
|
|
123
|
-
<CardHeader
|
|
124
|
-
disableTypography
|
|
125
|
-
title={
|
|
126
|
-
<TextField
|
|
127
|
-
fullWidth
|
|
128
|
-
value={value}
|
|
129
|
-
placeholder="add new"
|
|
130
|
-
onChange={event => setValue(event.target.value)}
|
|
131
|
-
InputProps={{
|
|
132
|
-
endAdornment: (
|
|
133
|
-
<InputAdornment position="end">
|
|
134
|
-
<IconButton
|
|
135
|
-
disabled={value === ''}
|
|
136
|
-
onClick={() => {
|
|
137
|
-
slot.add(value, [])
|
|
138
|
-
setValue('')
|
|
139
|
-
}}
|
|
140
|
-
color="secondary"
|
|
141
|
-
>
|
|
142
|
-
<AddIcon />
|
|
143
|
-
</IconButton>
|
|
144
|
-
</InputAdornment>
|
|
145
|
-
),
|
|
146
|
-
}}
|
|
147
|
-
/>
|
|
148
|
-
}
|
|
149
|
-
/>
|
|
150
|
-
</Card>
|
|
151
|
-
<FormHelperText>{slot.description}</FormHelperText>
|
|
152
|
-
</>
|
|
153
|
-
)
|
|
154
|
-
})
|
|
155
|
-
|
|
156
|
-
const NumberMapEditor = observer(({ slot }) => {
|
|
157
|
-
const { classes } = useMapEditorStyles()
|
|
158
|
-
const [value, setValue] = useState('')
|
|
159
|
-
return (
|
|
160
|
-
<>
|
|
161
|
-
<InputLabel>{slot.name}</InputLabel>
|
|
162
|
-
{Array.from(slot.value, ([key, val]) => (
|
|
163
|
-
<Card raised key={key} className={classes.card}>
|
|
164
|
-
<CardHeader
|
|
165
|
-
title={key}
|
|
166
|
-
action={
|
|
167
|
-
<IconButton color="secondary" onClick={() => slot.remove(key)}>
|
|
168
|
-
<DeleteIcon />
|
|
169
|
-
</IconButton>
|
|
170
|
-
}
|
|
171
|
-
/>
|
|
172
|
-
<CardContent>
|
|
173
|
-
<NumberEditor
|
|
174
|
-
slot={{
|
|
175
|
-
value: val,
|
|
176
|
-
set: numValue => slot.add(key, numValue),
|
|
177
|
-
}}
|
|
178
|
-
/>
|
|
179
|
-
</CardContent>
|
|
180
|
-
</Card>
|
|
181
|
-
))}
|
|
182
|
-
<Card raised className={classes.card}>
|
|
183
|
-
<CardHeader
|
|
184
|
-
disableTypography
|
|
185
|
-
title={
|
|
186
|
-
<TextField
|
|
187
|
-
fullWidth
|
|
188
|
-
value={value}
|
|
189
|
-
placeholder="add new"
|
|
190
|
-
onChange={event => setValue(event.target.value)}
|
|
191
|
-
InputProps={{
|
|
192
|
-
endAdornment: (
|
|
193
|
-
<InputAdornment position="end">
|
|
194
|
-
<IconButton
|
|
195
|
-
disabled={value === ''}
|
|
196
|
-
onClick={() => {
|
|
197
|
-
slot.add(value, 0)
|
|
198
|
-
setValue('')
|
|
199
|
-
}}
|
|
200
|
-
color="secondary"
|
|
201
|
-
>
|
|
202
|
-
<AddIcon />
|
|
203
|
-
</IconButton>
|
|
204
|
-
</InputAdornment>
|
|
205
|
-
),
|
|
206
|
-
}}
|
|
207
|
-
/>
|
|
208
|
-
}
|
|
209
|
-
/>
|
|
210
|
-
</Card>
|
|
211
|
-
<FormHelperText>{slot.description}</FormHelperText>
|
|
212
|
-
</>
|
|
213
|
-
)
|
|
214
|
-
})
|
|
215
|
-
|
|
216
|
-
const NumberEditor = observer(({ slot }) => {
|
|
217
|
-
const [val, setVal] = useState(slot.value)
|
|
218
|
-
useEffect(() => {
|
|
219
|
-
const num = parseFloat(val, 10)
|
|
220
|
-
if (!Number.isNaN(num)) {
|
|
221
|
-
slot.set(num)
|
|
222
|
-
} else {
|
|
223
|
-
slot.reset()
|
|
224
|
-
}
|
|
225
|
-
}, [slot, val])
|
|
226
|
-
return (
|
|
227
|
-
<MyTextField
|
|
228
|
-
label={slot.name}
|
|
229
|
-
helperText={slot.description}
|
|
230
|
-
value={val}
|
|
231
|
-
type="number"
|
|
232
|
-
onChange={evt => setVal(evt.target.value)}
|
|
233
|
-
/>
|
|
234
|
-
)
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
const IntegerEditor = observer(({ slot }) => {
|
|
238
|
-
const [val, setVal] = useState(slot.value)
|
|
239
|
-
useEffect(() => {
|
|
240
|
-
const num = parseInt(val, 10)
|
|
241
|
-
if (!Number.isNaN(num)) {
|
|
242
|
-
slot.set(num)
|
|
243
|
-
}
|
|
244
|
-
}, [slot, val])
|
|
245
|
-
return (
|
|
246
|
-
<MyTextField
|
|
247
|
-
label={slot.name}
|
|
248
|
-
helperText={slot.description}
|
|
249
|
-
value={val}
|
|
250
|
-
type="number"
|
|
251
|
-
onChange={evt => setVal(evt.target.value)}
|
|
252
|
-
/>
|
|
253
|
-
)
|
|
254
|
-
})
|
|
255
|
-
|
|
256
|
-
const BooleanEditor = observer(({ slot }) => (
|
|
257
|
-
<FormControl>
|
|
258
|
-
<FormControlLabel
|
|
259
|
-
label={slot.name}
|
|
260
|
-
control={
|
|
261
|
-
<Checkbox
|
|
262
|
-
checked={slot.value}
|
|
263
|
-
onChange={evt => slot.set(evt.target.checked)}
|
|
264
|
-
/>
|
|
265
|
-
}
|
|
266
|
-
/>
|
|
267
|
-
<FormHelperText>{slot.description}</FormHelperText>
|
|
268
|
-
</FormControl>
|
|
269
|
-
))
|
|
270
|
-
|
|
271
|
-
const StringEnumEditor = observer(({ slot, slotSchema }) => {
|
|
272
|
-
const p = getPropertyMembers(getSubType(slotSchema))
|
|
273
|
-
const choices = getUnionSubTypes(
|
|
274
|
-
getUnionSubTypes(getSubType(getPropertyType(p, 'value')))[1],
|
|
275
|
-
).map(t => t.value)
|
|
276
|
-
|
|
277
|
-
return (
|
|
278
|
-
<MyTextField
|
|
279
|
-
value={slot.value}
|
|
280
|
-
label={slot.name}
|
|
281
|
-
select
|
|
282
|
-
helperText={slot.description}
|
|
283
|
-
onChange={evt => slot.set(evt.target.value)}
|
|
284
|
-
>
|
|
285
|
-
{choices.map(str => (
|
|
286
|
-
<MenuItem key={str} value={str}>
|
|
287
|
-
{str}
|
|
288
|
-
</MenuItem>
|
|
289
|
-
))}
|
|
290
|
-
</MyTextField>
|
|
291
|
-
)
|
|
292
|
-
})
|
|
293
|
-
|
|
294
|
-
const FileSelectorWrapper = observer(({ slot }) => {
|
|
295
|
-
return (
|
|
296
|
-
<FileSelector
|
|
297
|
-
location={slot.value}
|
|
298
|
-
setLocation={location => slot.set(location)}
|
|
299
|
-
name={slot.name}
|
|
300
|
-
description={slot.description}
|
|
301
|
-
rootModel={getEnv(slot).pluginManager?.rootModel}
|
|
302
|
-
/>
|
|
303
|
-
)
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
const valueComponents = {
|
|
307
|
-
string: StringEditor,
|
|
308
|
-
text: TextEditor,
|
|
309
|
-
fileLocation: FileSelectorWrapper,
|
|
310
|
-
stringArray: StringArrayEditor,
|
|
311
|
-
stringArrayMap: StringArrayMapEditor,
|
|
312
|
-
numberMap: NumberMapEditor,
|
|
313
|
-
number: NumberEditor,
|
|
314
|
-
integer: IntegerEditor,
|
|
315
|
-
color: ColorEditor,
|
|
316
|
-
stringEnum: StringEnumEditor,
|
|
317
|
-
boolean: BooleanEditor,
|
|
318
|
-
frozen: JsonEditor,
|
|
319
|
-
configRelationships: JsonEditor,
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export const useSlotEditorStyles = makeStyles()(theme => ({
|
|
323
|
-
paper: {
|
|
324
|
-
display: 'flex',
|
|
325
|
-
marginBottom: theme.spacing(2),
|
|
326
|
-
position: 'relative',
|
|
327
|
-
},
|
|
328
|
-
paperContent: {
|
|
329
|
-
width: '100%',
|
|
330
|
-
},
|
|
331
|
-
slotModeSwitch: {
|
|
332
|
-
width: 24,
|
|
333
|
-
background: theme.palette.secondary.light,
|
|
334
|
-
display: 'flex',
|
|
335
|
-
justifyContent: 'center',
|
|
336
|
-
alignItems: 'center',
|
|
337
|
-
},
|
|
338
|
-
}))
|
|
339
|
-
|
|
340
|
-
const SlotEditor = observer(({ slot, slotSchema }) => {
|
|
341
|
-
const { classes } = useSlotEditorStyles()
|
|
342
|
-
const { type } = slot
|
|
343
|
-
let ValueComponent = slot.isCallback ? CallbackEditor : valueComponents[type]
|
|
344
|
-
if (!ValueComponent) {
|
|
345
|
-
console.warn(`no slot editor defined for ${type}, editing as string`)
|
|
346
|
-
ValueComponent = StringEditor
|
|
347
|
-
}
|
|
348
|
-
if (!(type in valueComponents)) {
|
|
349
|
-
console.warn(`SlotEditor needs to implement ${type}`)
|
|
350
|
-
}
|
|
351
|
-
return (
|
|
352
|
-
<Paper className={classes.paper}>
|
|
353
|
-
<div className={classes.paperContent}>
|
|
354
|
-
<ValueComponent slot={slot} slotSchema={slotSchema} />
|
|
355
|
-
</div>
|
|
356
|
-
<div className={classes.slotModeSwitch}>
|
|
357
|
-
{slot.contextVariable.length ? (
|
|
358
|
-
<IconButton
|
|
359
|
-
className={classes.slotModeIcon}
|
|
360
|
-
onClick={() =>
|
|
361
|
-
slot.isCallback ? slot.convertToValue() : slot.convertToCallback()
|
|
362
|
-
}
|
|
363
|
-
title={`convert to ${
|
|
364
|
-
slot.isCallback ? 'regular value' : 'callback'
|
|
365
|
-
}`}
|
|
366
|
-
color="secondary"
|
|
367
|
-
>
|
|
368
|
-
{!slot.isCallback ? <RadioButtonUncheckedIcon /> : <SvgCheckbox />}
|
|
369
|
-
</IconButton>
|
|
370
|
-
) : null}
|
|
371
|
-
</div>
|
|
372
|
-
</Paper>
|
|
373
|
-
)
|
|
374
|
-
})
|
|
375
|
-
|
|
376
|
-
export default SlotEditor
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { observer } from 'mobx-react'
|
|
2
|
-
import { isStateTreeNode, getType } from 'mobx-state-tree'
|
|
3
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration'
|
|
4
|
-
|
|
5
|
-
export { default as stateModelFactory } from './model'
|
|
6
|
-
export const configSchema = ConfigurationSchema('ConfigurationEditorWidget', {})
|
|
7
|
-
export const HeadingComponent = observer(({ model }) => {
|
|
8
|
-
if (model?.target) {
|
|
9
|
-
if (model.target.type) {
|
|
10
|
-
return `${model.target.type} settings`
|
|
11
|
-
}
|
|
12
|
-
if (isStateTreeNode(model.target)) {
|
|
13
|
-
const type = getType(model.target)
|
|
14
|
-
if (type?.name) {
|
|
15
|
-
return `${type.name.replace('ConfigurationSchema', '')} settings`
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return 'Settings'
|
|
20
|
-
})
|