@jbrowse/plugin-config 1.7.9 → 2.0.0
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.d.ts +10 -7
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js +108 -115
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/CodeEditor.d.ts +4 -3
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js +78 -73
- package/dist/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ColorEditor.d.ts +9 -33
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js +82 -116
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ColorPicker.d.ts +0 -7
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js +64 -67
- package/dist/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +7 -3
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +113 -160
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js +74 -75
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +11 -1
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js +228 -423
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +12 -0
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +81 -0
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
- package/dist/ConfigurationEditorWidget/components/TypeSelector.d.ts +8 -6
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js +16 -46
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
- package/dist/ConfigurationEditorWidget/index.js +25 -42
- package/dist/ConfigurationEditorWidget/index.js.map +1 -0
- package/dist/ConfigurationEditorWidget/model.js +18 -26
- package/dist/ConfigurationEditorWidget/model.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigAdapter.js +172 -204
- package/dist/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js +151 -142
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js +182 -181
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
- package/dist/FromConfigAdapter/configSchema.js +33 -49
- package/dist/FromConfigAdapter/configSchema.js.map +1 -0
- package/dist/FromConfigAdapter/index.js +16 -50
- package/dist/FromConfigAdapter/index.js.map +1 -0
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js +111 -123
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
- package/dist/RefNameAliasAdapter/configSchema.js +16 -25
- package/dist/RefNameAliasAdapter/configSchema.js.map +1 -0
- package/dist/RefNameAliasAdapter/index.js +10 -22
- package/dist/RefNameAliasAdapter/index.js.map +1 -0
- package/dist/index.d.ts +9 -3
- package/dist/index.js +129 -144
- package/dist/index.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.d.ts +12 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +71 -0
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.d.ts +5 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js +42 -0
- package/esm/ConfigurationEditorWidget/components/CodeEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.d.ts +20 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js +37 -0
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.d.ts +7 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js +26 -0
- package/esm/ConfigurationEditorWidget/components/ColorPicker.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +8 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +83 -0
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +9 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js +39 -0
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +16 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +176 -0
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +12 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js +36 -0
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js.map +1 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.d.ts +9 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.js +12 -0
- package/esm/ConfigurationEditorWidget/components/TypeSelector.js.map +1 -0
- package/esm/ConfigurationEditorWidget/index.d.ts +3 -0
- package/esm/ConfigurationEditorWidget/index.js +20 -0
- package/esm/ConfigurationEditorWidget/index.js.map +1 -0
- package/esm/ConfigurationEditorWidget/model.d.ts +8 -0
- package/esm/ConfigurationEditorWidget/model.js +16 -0
- package/esm/ConfigurationEditorWidget/model.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +24 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.js +63 -0
- package/esm/FromConfigAdapter/FromConfigAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.d.ts +23 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js +50 -0
- package/esm/FromConfigAdapter/FromConfigRegionsAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.d.ts +25 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js +73 -0
- package/esm/FromConfigAdapter/FromConfigSequenceAdapter.js.map +1 -0
- package/esm/FromConfigAdapter/configSchema.d.ts +3 -0
- package/esm/FromConfigAdapter/configSchema.js +32 -0
- package/esm/FromConfigAdapter/configSchema.js.map +1 -0
- package/esm/FromConfigAdapter/index.d.ts +4 -0
- package/esm/FromConfigAdapter/index.js +5 -0
- package/esm/FromConfigAdapter/index.js.map +1 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +8 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js +24 -0
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js.map +1 -0
- package/esm/RefNameAliasAdapter/configSchema.d.ts +2 -0
- package/esm/RefNameAliasAdapter/configSchema.js +15 -0
- package/esm/RefNameAliasAdapter/configSchema.js.map +1 -0
- package/esm/RefNameAliasAdapter/index.d.ts +2 -0
- package/esm/RefNameAliasAdapter/index.js +3 -0
- package/esm/RefNameAliasAdapter/index.js.map +1 -0
- package/esm/index.d.ts +18 -0
- package/esm/index.js +72 -0
- package/esm/index.js.map +1 -0
- package/package.json +20 -13
- package/src/ConfigurationEditorWidget/components/{CallbackEditor.js → CallbackEditor.tsx} +36 -21
- package/src/ConfigurationEditorWidget/components/CodeEditor.tsx +59 -0
- package/src/ConfigurationEditorWidget/components/ColorEditor.tsx +8 -33
- package/src/ConfigurationEditorWidget/components/ColorPicker.tsx +4 -13
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.tsx +169 -0
- package/src/ConfigurationEditorWidget/components/JsonEditor.js +4 -8
- package/src/ConfigurationEditorWidget/components/SlotEditor.js +11 -69
- package/src/ConfigurationEditorWidget/components/StringArrayEditor.tsx +115 -0
- package/src/ConfigurationEditorWidget/components/{TypeSelector.js → TypeSelector.tsx} +15 -7
- package/src/ConfigurationEditorWidget/components/__snapshots__/ConfigurationEditor.test.js.snap +883 -691
- package/src/ConfigurationEditorWidget/index.js +2 -2
- package/src/RefNameAliasAdapter/RefNameAliasAdapter.ts +1 -1
- package/src/index.ts +20 -14
- package/dist/ConfigurationEditorWidget/components/ColorEditor.test.js +0 -31
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.test.js +0 -121
- package/dist/FromConfigAdapter/FromConfigAdapter.test.js +0 -100
- package/dist/FromConfigAdapter/FromConfigRegionsAdapter.test.js +0 -200
- package/dist/FromConfigAdapter/FromConfigSequenceAdapter.test.js +0 -110
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.test.js +0 -41
- package/dist/index.test.js +0 -41
- package/src/ConfigurationEditorWidget/components/CodeEditor.js +0 -60
- package/src/ConfigurationEditorWidget/components/ConfigurationEditor.js +0 -154
|
@@ -18,21 +18,20 @@ import {
|
|
|
18
18
|
IconButton,
|
|
19
19
|
InputAdornment,
|
|
20
20
|
InputLabel,
|
|
21
|
-
List,
|
|
22
|
-
ListItem,
|
|
23
21
|
MenuItem,
|
|
24
22
|
Paper,
|
|
25
23
|
SvgIcon,
|
|
26
24
|
TextField,
|
|
27
|
-
|
|
28
|
-
} from '
|
|
25
|
+
} from '@mui/material'
|
|
26
|
+
import { makeStyles } from 'tss-react/mui'
|
|
29
27
|
|
|
30
28
|
// icons
|
|
31
|
-
import DeleteIcon from '@
|
|
32
|
-
import AddIcon from '@
|
|
33
|
-
import RadioButtonUncheckedIcon from '@
|
|
29
|
+
import DeleteIcon from '@mui/icons-material/Delete'
|
|
30
|
+
import AddIcon from '@mui/icons-material/Add'
|
|
31
|
+
import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked'
|
|
34
32
|
|
|
35
33
|
// locals
|
|
34
|
+
import StringArrayEditor from './StringArrayEditor'
|
|
36
35
|
import CallbackEditor from './CallbackEditor'
|
|
37
36
|
import ColorEditor from './ColorEditor'
|
|
38
37
|
import JsonEditor from './JsonEditor'
|
|
@@ -40,7 +39,6 @@ import JsonEditor from './JsonEditor'
|
|
|
40
39
|
// adds ability to have html in helperText. note that FormHelperTextProps is
|
|
41
40
|
// div because the default is p which does not like div children
|
|
42
41
|
const MyTextField = props => {
|
|
43
|
-
// eslint-disable-next-line react/prop-types
|
|
44
42
|
const { helperText } = props
|
|
45
43
|
return (
|
|
46
44
|
<TextField
|
|
@@ -80,70 +78,14 @@ const SvgCheckbox = () => (
|
|
|
80
78
|
</SvgIcon>
|
|
81
79
|
)
|
|
82
80
|
|
|
83
|
-
const
|
|
84
|
-
const [value, setValue] = useState('')
|
|
85
|
-
return (
|
|
86
|
-
<>
|
|
87
|
-
{slot.name ? <InputLabel>{slot.name}</InputLabel> : null}
|
|
88
|
-
<List disablePadding>
|
|
89
|
-
{slot.value.map((val, idx) => (
|
|
90
|
-
<ListItem key={idx} disableGutters>
|
|
91
|
-
<TextField
|
|
92
|
-
value={val}
|
|
93
|
-
onChange={evt => slot.setAtIndex(idx, evt.target.value)}
|
|
94
|
-
InputProps={{
|
|
95
|
-
endAdornment: (
|
|
96
|
-
<InputAdornment position="end">
|
|
97
|
-
<IconButton
|
|
98
|
-
color="secondary"
|
|
99
|
-
onClick={() => slot.removeAtIndex(idx)}
|
|
100
|
-
>
|
|
101
|
-
<DeleteIcon />
|
|
102
|
-
</IconButton>
|
|
103
|
-
</InputAdornment>
|
|
104
|
-
),
|
|
105
|
-
}}
|
|
106
|
-
/>
|
|
107
|
-
</ListItem>
|
|
108
|
-
))}
|
|
109
|
-
<ListItem disableGutters>
|
|
110
|
-
<TextField
|
|
111
|
-
value={value}
|
|
112
|
-
placeholder="add new"
|
|
113
|
-
onChange={event => setValue(event.target.value)}
|
|
114
|
-
InputProps={{
|
|
115
|
-
endAdornment: (
|
|
116
|
-
<InputAdornment position="end">
|
|
117
|
-
<IconButton
|
|
118
|
-
onClick={() => {
|
|
119
|
-
slot.add(value)
|
|
120
|
-
setValue('')
|
|
121
|
-
}}
|
|
122
|
-
disabled={value === ''}
|
|
123
|
-
color="secondary"
|
|
124
|
-
data-testid={`stringArrayAdd-${slot.name}`}
|
|
125
|
-
>
|
|
126
|
-
<AddIcon />
|
|
127
|
-
</IconButton>
|
|
128
|
-
</InputAdornment>
|
|
129
|
-
),
|
|
130
|
-
}}
|
|
131
|
-
/>
|
|
132
|
-
</ListItem>
|
|
133
|
-
</List>
|
|
134
|
-
<FormHelperText>{slot.description}</FormHelperText>
|
|
135
|
-
</>
|
|
136
|
-
)
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
const useMapEditorStyles = makeStyles(theme => ({
|
|
81
|
+
const useMapEditorStyles = makeStyles()(theme => ({
|
|
140
82
|
card: {
|
|
141
83
|
marginTop: theme.spacing(1),
|
|
142
84
|
},
|
|
143
85
|
}))
|
|
144
86
|
|
|
145
87
|
const StringArrayMapEditor = observer(({ slot }) => {
|
|
146
|
-
const classes = useMapEditorStyles()
|
|
88
|
+
const { classes } = useMapEditorStyles()
|
|
147
89
|
const [value, setValue] = useState('')
|
|
148
90
|
return (
|
|
149
91
|
<>
|
|
@@ -212,7 +154,7 @@ const StringArrayMapEditor = observer(({ slot }) => {
|
|
|
212
154
|
})
|
|
213
155
|
|
|
214
156
|
const NumberMapEditor = observer(({ slot }) => {
|
|
215
|
-
const classes = useMapEditorStyles()
|
|
157
|
+
const { classes } = useMapEditorStyles()
|
|
216
158
|
const [value, setValue] = useState('')
|
|
217
159
|
return (
|
|
218
160
|
<>
|
|
@@ -377,7 +319,7 @@ const valueComponents = {
|
|
|
377
319
|
configRelationships: JsonEditor,
|
|
378
320
|
}
|
|
379
321
|
|
|
380
|
-
export const useSlotEditorStyles = makeStyles(theme => ({
|
|
322
|
+
export const useSlotEditorStyles = makeStyles()(theme => ({
|
|
381
323
|
paper: {
|
|
382
324
|
display: 'flex',
|
|
383
325
|
marginBottom: theme.spacing(2),
|
|
@@ -396,7 +338,7 @@ export const useSlotEditorStyles = makeStyles(theme => ({
|
|
|
396
338
|
}))
|
|
397
339
|
|
|
398
340
|
const SlotEditor = observer(({ slot, slotSchema }) => {
|
|
399
|
-
const classes = useSlotEditorStyles()
|
|
341
|
+
const { classes } = useSlotEditorStyles()
|
|
400
342
|
const { type } = slot
|
|
401
343
|
let ValueComponent = slot.isCallback ? CallbackEditor : valueComponents[type]
|
|
402
344
|
if (!ValueComponent) {
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { observer } from 'mobx-react'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
Button,
|
|
6
|
+
FormHelperText,
|
|
7
|
+
IconButton,
|
|
8
|
+
InputAdornment,
|
|
9
|
+
InputLabel,
|
|
10
|
+
List,
|
|
11
|
+
ListItem,
|
|
12
|
+
TextField,
|
|
13
|
+
} from '@mui/material'
|
|
14
|
+
|
|
15
|
+
// icons
|
|
16
|
+
import DeleteIcon from '@mui/icons-material/Delete'
|
|
17
|
+
|
|
18
|
+
const StringArrayEditor = observer(
|
|
19
|
+
({
|
|
20
|
+
slot,
|
|
21
|
+
}: {
|
|
22
|
+
slot: {
|
|
23
|
+
name: string
|
|
24
|
+
value: string[]
|
|
25
|
+
setAtIndex: Function
|
|
26
|
+
removeAtIndex: Function
|
|
27
|
+
add: Function
|
|
28
|
+
description: string
|
|
29
|
+
}
|
|
30
|
+
}) => {
|
|
31
|
+
const [value, setValue] = useState('')
|
|
32
|
+
const [addNew, setAddNew] = useState(false)
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
{slot.name ? <InputLabel>{slot.name}</InputLabel> : null}
|
|
36
|
+
<List disablePadding>
|
|
37
|
+
{slot.value.map((val, idx) => (
|
|
38
|
+
<ListItem key={idx} disableGutters>
|
|
39
|
+
<TextField
|
|
40
|
+
value={val}
|
|
41
|
+
onChange={evt => slot.setAtIndex(idx, evt.target.value)}
|
|
42
|
+
InputProps={{
|
|
43
|
+
endAdornment: (
|
|
44
|
+
<InputAdornment position="end">
|
|
45
|
+
<IconButton
|
|
46
|
+
color="secondary"
|
|
47
|
+
onClick={() => slot.removeAtIndex(idx)}
|
|
48
|
+
>
|
|
49
|
+
<DeleteIcon />
|
|
50
|
+
</IconButton>
|
|
51
|
+
</InputAdornment>
|
|
52
|
+
),
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</ListItem>
|
|
56
|
+
))}
|
|
57
|
+
|
|
58
|
+
{addNew ? (
|
|
59
|
+
<ListItem disableGutters>
|
|
60
|
+
<TextField
|
|
61
|
+
value={value}
|
|
62
|
+
placeholder="add new"
|
|
63
|
+
onChange={event => setValue(event.target.value)}
|
|
64
|
+
InputProps={{
|
|
65
|
+
endAdornment: (
|
|
66
|
+
<InputAdornment position="end">
|
|
67
|
+
<>
|
|
68
|
+
<Button
|
|
69
|
+
color="primary"
|
|
70
|
+
variant="contained"
|
|
71
|
+
style={{ margin: 2 }}
|
|
72
|
+
data-testid={`stringArrayAdd-${slot.name}`}
|
|
73
|
+
onClick={() => {
|
|
74
|
+
setAddNew(false)
|
|
75
|
+
slot.add(value)
|
|
76
|
+
setValue('')
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
OK
|
|
80
|
+
</Button>
|
|
81
|
+
<Button
|
|
82
|
+
color="primary"
|
|
83
|
+
variant="contained"
|
|
84
|
+
style={{ margin: 2 }}
|
|
85
|
+
onClick={() => {
|
|
86
|
+
setAddNew(false)
|
|
87
|
+
setValue('')
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
Cancel
|
|
91
|
+
</Button>
|
|
92
|
+
</>
|
|
93
|
+
</InputAdornment>
|
|
94
|
+
),
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
</ListItem>
|
|
98
|
+
) : null}
|
|
99
|
+
<Button
|
|
100
|
+
color="primary"
|
|
101
|
+
variant="contained"
|
|
102
|
+
style={{ margin: 4 }}
|
|
103
|
+
disabled={addNew}
|
|
104
|
+
onClick={() => setAddNew(true)}
|
|
105
|
+
>
|
|
106
|
+
Add item
|
|
107
|
+
</Button>
|
|
108
|
+
</List>
|
|
109
|
+
<FormHelperText>{slot.description}</FormHelperText>
|
|
110
|
+
</>
|
|
111
|
+
)
|
|
112
|
+
},
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
export default StringArrayEditor
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import MenuItem from '@material-ui/core/MenuItem'
|
|
2
|
-
import Paper from '@material-ui/core/Paper'
|
|
3
|
-
import TextField from '@material-ui/core/TextField'
|
|
4
|
-
import { observer } from 'mobx-react'
|
|
5
1
|
import React from 'react'
|
|
2
|
+
import { MenuItem, Paper, TextField } from '@mui/material'
|
|
3
|
+
import { observer } from 'mobx-react'
|
|
6
4
|
import { useSlotEditorStyles } from './SlotEditor'
|
|
5
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
7
6
|
|
|
8
7
|
const TypeSelector = observer(
|
|
9
|
-
({
|
|
10
|
-
|
|
8
|
+
({
|
|
9
|
+
typeNameChoices,
|
|
10
|
+
slot,
|
|
11
|
+
slotName,
|
|
12
|
+
onChange,
|
|
13
|
+
}: {
|
|
14
|
+
typeNameChoices: string[]
|
|
15
|
+
slot: AnyConfigurationModel
|
|
16
|
+
slotName: string
|
|
17
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
18
|
+
}) => {
|
|
19
|
+
const { classes } = useSlotEditorStyles()
|
|
11
20
|
return (
|
|
12
21
|
<Paper className={classes.paper}>
|
|
13
22
|
<div className={classes.paperContent}>
|
|
@@ -15,7 +24,6 @@ const TypeSelector = observer(
|
|
|
15
24
|
value={slot.type}
|
|
16
25
|
label="Type"
|
|
17
26
|
select
|
|
18
|
-
// error={filterError}
|
|
19
27
|
helperText={`Type of ${slotName} to use`}
|
|
20
28
|
fullWidth
|
|
21
29
|
onChange={onChange}
|