@jbrowse/plugin-config 2.17.0 → 3.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/BooleanEditor.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/BooleanEditor.js +5 -10
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/CallbackEditor.js +19 -57
- package/dist/ConfigurationEditorWidget/components/ColorEditor.d.ts +2 -3
- package/dist/ConfigurationEditorWidget/components/ColorEditor.js +12 -38
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +3 -4
- package/dist/ConfigurationEditorWidget/components/ConfigurationEditor.js +14 -32
- package/dist/ConfigurationEditorWidget/components/ConfigurationTextField.d.ts +2 -3
- package/dist/ConfigurationEditorWidget/components/ConfigurationTextField.js +3 -8
- package/dist/ConfigurationEditorWidget/components/HeadingComponent.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/HeadingComponent.js +2 -5
- package/dist/ConfigurationEditorWidget/components/JsonEditor.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/JsonEditor.js +12 -40
- package/dist/ConfigurationEditorWidget/components/NumberEditor.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/NumberEditor.js +3 -25
- package/dist/ConfigurationEditorWidget/components/NumberMapEditor.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/NumberMapEditor.js +22 -56
- package/dist/ConfigurationEditorWidget/components/SlotEditor.d.ts +2 -3
- package/dist/ConfigurationEditorWidget/components/SlotEditor.js +21 -52
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/StringArrayEditor.js +28 -64
- package/dist/ConfigurationEditorWidget/components/StringArrayMapEditor.d.ts +1 -2
- package/dist/ConfigurationEditorWidget/components/StringArrayMapEditor.js +30 -65
- package/dist/ConfigurationEditorWidget/components/TypeSelector.d.ts +2 -3
- package/dist/ConfigurationEditorWidget/components/TypeSelector.js +2 -7
- package/dist/ConfigurationEditorWidget/index.d.ts +1 -1
- package/dist/ConfigurationEditorWidget/index.js +18 -8
- package/dist/ConfigurationEditorWidget/model.d.ts +1 -1
- package/dist/ConfigurationEditorWidget/model.js +1 -3
- package/dist/FromConfigAdapter/FromConfigAdapter.d.ts +5 -5
- package/dist/FromConfigAdapter/FromConfigAdapter.js +3 -4
- package/dist/FromConfigAdapter/configSchema.d.ts +0 -3
- package/dist/FromConfigAdapter/configSchema.js +1 -7
- package/dist/FromConfigAdapter/index.d.ts +1 -1
- package/dist/FromConfigAdapter/index.js +17 -7
- package/dist/FromConfigRegionsAdapter/FromConfigRegionsAdapter.d.ts +5 -12
- package/dist/FromConfigRegionsAdapter/FromConfigRegionsAdapter.js +2 -12
- package/dist/FromConfigRegionsAdapter/configSchema.d.ts +0 -3
- package/dist/FromConfigRegionsAdapter/configSchema.js +1 -8
- package/dist/FromConfigRegionsAdapter/index.d.ts +1 -1
- package/dist/FromConfigRegionsAdapter/index.js +17 -7
- package/dist/FromConfigSequenceAdapter/FromConfigSequenceAdapter.d.ts +3 -16
- package/dist/FromConfigSequenceAdapter/FromConfigSequenceAdapter.js +3 -18
- package/dist/FromConfigSequenceAdapter/configSchema.d.ts +0 -3
- package/dist/FromConfigSequenceAdapter/configSchema.js +1 -7
- package/dist/FromConfigSequenceAdapter/index.d.ts +1 -1
- package/dist/FromConfigSequenceAdapter/index.js +17 -7
- package/dist/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.d.ts +2 -1
- package/dist/NcbiSequenceReportAliasAdapter/configSchema.d.ts +0 -3
- package/dist/NcbiSequenceReportAliasAdapter/configSchema.js +1 -8
- package/dist/NcbiSequenceReportAliasAdapter/index.d.ts +1 -1
- package/dist/NcbiSequenceReportAliasAdapter/index.js +17 -7
- package/dist/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +2 -1
- package/dist/RefNameAliasAdapter/configSchema.d.ts +0 -8
- package/dist/RefNameAliasAdapter/configSchema.js +1 -14
- package/dist/RefNameAliasAdapter/index.d.ts +1 -1
- package/dist/RefNameAliasAdapter/index.js +17 -7
- package/dist/index.d.ts +2 -2
- package/dist/index.js +19 -9
- package/esm/ConfigurationEditorWidget/components/BooleanEditor.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/BooleanEditor.js +5 -7
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +19 -34
- package/esm/ConfigurationEditorWidget/components/ColorEditor.d.ts +2 -3
- package/esm/ConfigurationEditorWidget/components/ColorEditor.js +12 -15
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +3 -4
- package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +15 -33
- package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.d.ts +2 -3
- package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.js +3 -5
- package/esm/ConfigurationEditorWidget/components/HeadingComponent.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/HeadingComponent.js +3 -3
- package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/JsonEditor.js +12 -17
- package/esm/ConfigurationEditorWidget/components/NumberEditor.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/NumberEditor.js +3 -2
- package/esm/ConfigurationEditorWidget/components/NumberMapEditor.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/NumberMapEditor.js +22 -33
- package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +2 -3
- package/esm/ConfigurationEditorWidget/components/SlotEditor.js +22 -30
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js +28 -41
- package/esm/ConfigurationEditorWidget/components/StringArrayMapEditor.d.ts +1 -2
- package/esm/ConfigurationEditorWidget/components/StringArrayMapEditor.js +30 -42
- package/esm/ConfigurationEditorWidget/components/TypeSelector.d.ts +2 -3
- package/esm/ConfigurationEditorWidget/components/TypeSelector.js +2 -4
- package/esm/ConfigurationEditorWidget/index.d.ts +1 -1
- package/esm/ConfigurationEditorWidget/index.js +1 -1
- package/esm/ConfigurationEditorWidget/model.d.ts +1 -1
- package/esm/ConfigurationEditorWidget/model.js +1 -3
- package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +5 -5
- package/esm/FromConfigAdapter/FromConfigAdapter.js +3 -4
- package/esm/FromConfigAdapter/configSchema.d.ts +0 -3
- package/esm/FromConfigAdapter/configSchema.js +1 -7
- package/esm/FromConfigAdapter/index.d.ts +1 -1
- package/esm/FromConfigRegionsAdapter/FromConfigRegionsAdapter.d.ts +5 -12
- package/esm/FromConfigRegionsAdapter/FromConfigRegionsAdapter.js +3 -13
- package/esm/FromConfigRegionsAdapter/configSchema.d.ts +0 -3
- package/esm/FromConfigRegionsAdapter/configSchema.js +1 -8
- package/esm/FromConfigRegionsAdapter/index.d.ts +1 -1
- package/esm/FromConfigSequenceAdapter/FromConfigSequenceAdapter.d.ts +3 -16
- package/esm/FromConfigSequenceAdapter/FromConfigSequenceAdapter.js +3 -18
- package/esm/FromConfigSequenceAdapter/configSchema.d.ts +0 -3
- package/esm/FromConfigSequenceAdapter/configSchema.js +1 -7
- package/esm/FromConfigSequenceAdapter/index.d.ts +1 -1
- package/esm/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.d.ts +2 -1
- package/esm/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.js +1 -1
- package/esm/NcbiSequenceReportAliasAdapter/configSchema.d.ts +0 -3
- package/esm/NcbiSequenceReportAliasAdapter/configSchema.js +1 -8
- package/esm/NcbiSequenceReportAliasAdapter/index.d.ts +1 -1
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +2 -1
- package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js +1 -1
- package/esm/RefNameAliasAdapter/configSchema.d.ts +0 -8
- package/esm/RefNameAliasAdapter/configSchema.js +1 -14
- package/esm/RefNameAliasAdapter/index.d.ts +1 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +2 -2
- package/package.json +2 -2
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { useDebounce } from '@jbrowse/core/util';
|
|
4
4
|
import { stringToJexlExpression } from '@jbrowse/core/util/jexlStrings';
|
|
5
|
-
import
|
|
5
|
+
import HelpIcon from '@mui/icons-material/Help';
|
|
6
|
+
import { IconButton, TextField, Tooltip } from '@mui/material';
|
|
6
7
|
import { observer } from 'mobx-react';
|
|
8
|
+
import { getEnv } from 'mobx-state-tree';
|
|
7
9
|
import { makeStyles } from 'tss-react/mui';
|
|
8
|
-
// icons
|
|
9
|
-
import HelpIcon from '@mui/icons-material/Help';
|
|
10
|
-
// Optimize by using system default fonts:
|
|
11
|
-
// https://css-tricks.com/snippets/css/font-stacks/
|
|
12
10
|
const fontFamily = 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace';
|
|
13
11
|
const useStyles = makeStyles()(theme => ({
|
|
14
12
|
callbackEditor: {
|
|
@@ -52,32 +50,19 @@ const CallbackEditor = observer(function ({ slot, }) {
|
|
|
52
50
|
setCodeError(e);
|
|
53
51
|
}
|
|
54
52
|
}, [debouncedCode, slot]);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
React.createElement("p", null, slot.description),
|
|
70
|
-
React.createElement(Tooltip, { title: React.createElement("div", null,
|
|
71
|
-
"Callbacks are written in Jexl format. Click to learn more.",
|
|
72
|
-
React.createElement("br", null),
|
|
73
|
-
" Names of available context items: ",
|
|
74
|
-
slot.contextVariable), arrow: true },
|
|
75
|
-
React.createElement(IconButton, { color: "primary", onClick: () => {
|
|
76
|
-
const newWindow = window.open('https://github.com/TomFrost/Jexl', '_blank', 'noopener,noreferrer');
|
|
77
|
-
if (newWindow) {
|
|
78
|
-
newWindow.opener = null;
|
|
79
|
-
}
|
|
80
|
-
} },
|
|
81
|
-
React.createElement(HelpIcon, null))))));
|
|
53
|
+
return (_jsxs(_Fragment, { children: [error ? _jsx("p", { className: classes.error, children: `${error}` }) : null, _jsxs("div", { className: classes.callbackContainer, children: [_jsx(TextField, { multiline: true, className: classes.callbackEditor, value: code.startsWith('jexl:') ? code.split('jexl:')[1] : code, onChange: event => {
|
|
54
|
+
setCode(event.target.value);
|
|
55
|
+
}, style: { background: error ? '#fdd' : undefined }, slotProps: {
|
|
56
|
+
input: {
|
|
57
|
+
classes: {
|
|
58
|
+
input: classes.textAreaFont,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
} }), _jsx("p", { children: slot.description }), _jsx(Tooltip, { title: _jsxs("div", { children: ["Callbacks are written in Jexl format. Click to learn more.", _jsx("br", {}), " Names of available context items: ", slot.contextVariable] }), arrow: true, children: _jsx(IconButton, { color: "primary", onClick: () => {
|
|
62
|
+
const newWindow = window.open('https://github.com/TomFrost/Jexl', '_blank', 'noopener,noreferrer');
|
|
63
|
+
if (newWindow) {
|
|
64
|
+
newWindow.opener = null;
|
|
65
|
+
}
|
|
66
|
+
}, children: _jsx(HelpIcon, {}) }) })] })] }));
|
|
82
67
|
});
|
|
83
68
|
export default CallbackEditor;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
export declare const ColorSlot: (props: {
|
|
3
2
|
value: string;
|
|
4
3
|
label?: string;
|
|
@@ -7,7 +6,7 @@ export declare const ColorSlot: (props: {
|
|
|
7
6
|
fullWidth: boolean;
|
|
8
7
|
};
|
|
9
8
|
onChange: (arg: string) => void;
|
|
10
|
-
}) =>
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
declare const ColorEditor: (props: {
|
|
12
11
|
slot: {
|
|
13
12
|
name: string;
|
|
@@ -15,5 +14,5 @@ declare const ColorEditor: (props: {
|
|
|
15
14
|
description: string;
|
|
16
15
|
set: (arg: string) => void;
|
|
17
16
|
};
|
|
18
|
-
}) =>
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
18
|
export default ColorEditor;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { TextField } from '@mui/material';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, useState } from 'react';
|
|
4
3
|
import ColorPicker from '@jbrowse/core/ui/ColorPicker';
|
|
4
|
+
import { TextField } from '@mui/material';
|
|
5
|
+
import { observer } from 'mobx-react';
|
|
5
6
|
export const ColorSlot = (props) => {
|
|
6
7
|
const { value = '#000', label = '', TextFieldProps = {}, onChange } = props;
|
|
7
8
|
const [displayed, setDisplayed] = useState(false);
|
|
8
|
-
return (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
onChange
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
React.createElement(React.Suspense, { fallback: null },
|
|
16
|
-
React.createElement(ColorPicker, { color: value, onChange: event => {
|
|
17
|
-
onChange(event);
|
|
18
|
-
} })))));
|
|
9
|
+
return (_jsxs("div", { style: { display: 'flex' }, children: [_jsx(TextField, { value: value, label: label, onClick: () => {
|
|
10
|
+
setDisplayed(!displayed);
|
|
11
|
+
}, onChange: event => {
|
|
12
|
+
onChange(event.target.value);
|
|
13
|
+
}, ...TextFieldProps }), _jsx("div", { style: { marginTop: 10 }, children: _jsx(Suspense, { fallback: null, children: _jsx(ColorPicker, { color: value, onChange: event => {
|
|
14
|
+
onChange(event);
|
|
15
|
+
} }) }) })] }));
|
|
19
16
|
};
|
|
20
17
|
const ColorEditor = observer(function (props) {
|
|
21
18
|
const { slot } = props;
|
|
22
|
-
return (
|
|
19
|
+
return (_jsx(ColorSlot, { label: slot.name, value: slot.value, onChange: color => {
|
|
23
20
|
slot.set(color);
|
|
24
21
|
}, TextFieldProps: {
|
|
25
22
|
helperText: slot.description,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { AbstractSessionModel } from '@jbrowse/core/util';
|
|
3
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
1
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
+
import type { AbstractSessionModel } from '@jbrowse/core/util';
|
|
4
3
|
declare const ConfigurationEditor: ({ model, }: {
|
|
5
4
|
model: {
|
|
6
5
|
target: AnyConfigurationModel;
|
|
7
6
|
};
|
|
8
7
|
session?: AbstractSessionModel;
|
|
9
|
-
}) =>
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export default ConfigurationEditor;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getTypeNamesFromExplicitlyTypedUnion, isConfigurationSchemaType, isConfigurationSlotType, readConfObject, } from '@jbrowse/core/configuration';
|
|
3
|
+
import SanitizedHTML from '@jbrowse/core/ui/SanitizedHTML';
|
|
4
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
|
+
import { Accordion, AccordionDetails, AccordionSummary, FormGroup, Typography, } from '@mui/material';
|
|
4
6
|
import { observer } from 'mobx-react';
|
|
5
7
|
import { getMembers } from 'mobx-state-tree';
|
|
6
8
|
import { singular } from 'pluralize';
|
|
7
|
-
import
|
|
8
|
-
import { readConfObject, getTypeNamesFromExplicitlyTypedUnion, isConfigurationSchemaType, isConfigurationSlotType, } from '@jbrowse/core/configuration';
|
|
9
|
-
// icons
|
|
10
|
-
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
11
|
-
// locals
|
|
9
|
+
import { makeStyles } from 'tss-react/mui';
|
|
12
10
|
import SlotEditor from './SlotEditor';
|
|
13
11
|
import TypeSelector from './TypeSelector';
|
|
14
12
|
const useStyles = makeStyles()(theme => ({
|
|
@@ -36,26 +34,18 @@ const Member = observer(function (props) {
|
|
|
36
34
|
const key = subslot.type
|
|
37
35
|
? `${singular(slotName)} ${subslot.type}`
|
|
38
36
|
: `${singular(slotName)} ${slotIndex + 1}`;
|
|
39
|
-
return
|
|
37
|
+
return _jsx(Member, { ...props, slot: subslot, slotName: key }, key);
|
|
40
38
|
});
|
|
41
39
|
}
|
|
42
|
-
// if this is an explicitly typed schema, make a type-selecting dropdown
|
|
43
|
-
// that can be used to change its type
|
|
44
40
|
const typeNameChoices = getTypeNamesFromExplicitlyTypedUnion(slotSchema);
|
|
45
|
-
return (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (evt.target.value !== slot.type) {
|
|
51
|
-
schema.setSubschema(slotName, { type: evt.target.value });
|
|
52
|
-
}
|
|
53
|
-
} })) : null,
|
|
54
|
-
React.createElement(FormGroup, { className: classes.noOverflow },
|
|
55
|
-
React.createElement(Schema, { schema: slot, path: [...path, slotName] })))));
|
|
41
|
+
return (_jsxs(Accordion, { defaultExpanded: true, className: classes.accordion, children: [_jsx(AccordionSummary, { expandIcon: _jsx(ExpandMoreIcon, { className: classes.icon }), children: _jsx(Typography, { children: [...path, slotName].join('➔') }) }), _jsxs(AccordionDetails, { className: classes.expansionPanelDetails, children: [typeNameChoices.length ? (_jsx(TypeSelector, { typeNameChoices: typeNameChoices, slotName: slotName, slot: slot, onChange: evt => {
|
|
42
|
+
if (evt.target.value !== slot.type) {
|
|
43
|
+
schema.setSubschema(slotName, { type: evt.target.value });
|
|
44
|
+
}
|
|
45
|
+
} })) : null, _jsx(FormGroup, { className: classes.noOverflow, children: _jsx(Schema, { schema: slot, path: [...path, slotName] }) })] })] }));
|
|
56
46
|
}
|
|
57
47
|
else if (isConfigurationSlotType(slotSchema)) {
|
|
58
|
-
return
|
|
48
|
+
return _jsx(SlotEditor, { slot: slot, slotSchema: slotSchema }, slotName);
|
|
59
49
|
}
|
|
60
50
|
else {
|
|
61
51
|
return null;
|
|
@@ -63,21 +53,13 @@ const Member = observer(function (props) {
|
|
|
63
53
|
});
|
|
64
54
|
const Schema = observer(function ({ schema, path = [], }) {
|
|
65
55
|
const properties = getMembers(schema).properties;
|
|
66
|
-
return (
|
|
56
|
+
return (_jsx(_Fragment, { children: Object.entries(properties).map(([slotName, slotSchema]) => (_jsx(Member, { slotName: slotName, slotSchema: slotSchema, path: path, schema: schema }, slotName))) }));
|
|
67
57
|
});
|
|
68
58
|
const ConfigurationEditor = observer(function ({ model, }) {
|
|
69
59
|
const { classes } = useStyles();
|
|
70
|
-
// key forces a re-render, otherwise the same field can end up being used for
|
|
71
|
-
// different tracks since only the backing model changes for example see pr
|
|
72
|
-
// #804
|
|
73
60
|
const { target } = model;
|
|
74
61
|
const key = readConfObject(target, 'trackId');
|
|
75
62
|
const name = readConfObject(target, 'name');
|
|
76
|
-
return (
|
|
77
|
-
React.createElement(AccordionSummary, { expandIcon: React.createElement(ExpandMoreIcon, { className: classes.icon }) },
|
|
78
|
-
React.createElement(Typography, null,
|
|
79
|
-
React.createElement(SanitizedHTML, { html: name !== null && name !== void 0 ? name : 'Configuration' }))),
|
|
80
|
-
React.createElement(AccordionDetails, { className: classes.expansionPanelDetails, "data-testid": "configEditor" },
|
|
81
|
-
React.createElement(Schema, { schema: target }))));
|
|
63
|
+
return (_jsxs(Accordion, { defaultExpanded: true, className: classes.accordion, children: [_jsx(AccordionSummary, { expandIcon: _jsx(ExpandMoreIcon, { className: classes.icon }), children: _jsx(Typography, { children: _jsx(SanitizedHTML, { html: name !== null && name !== void 0 ? name : 'Configuration' }) }) }), _jsx(AccordionDetails, { className: classes.expansionPanelDetails, "data-testid": "configEditor", children: _jsx(Schema, { schema: target }) })] }, key));
|
|
82
64
|
});
|
|
83
65
|
export default ConfigurationEditor;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TextFieldProps } from '@mui/material';
|
|
1
|
+
import type { TextFieldProps } from '@mui/material';
|
|
3
2
|
export default function ConfigurationTextField(props: {
|
|
4
3
|
helperText?: string;
|
|
5
|
-
} & TextFieldProps):
|
|
4
|
+
} & TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TextField } from '@mui/material';
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
2
|
import { SanitizedHTML } from '@jbrowse/core/ui';
|
|
4
|
-
|
|
5
|
-
// div because the default is p which does not like div children
|
|
3
|
+
import { TextField } from '@mui/material';
|
|
6
4
|
export default function ConfigurationTextField(props) {
|
|
7
5
|
const { helperText } = props;
|
|
8
|
-
return (
|
|
6
|
+
return (_jsx(TextField, { ...props, helperText: _jsx(SanitizedHTML, { html: helperText || '' }), fullWidth: true, slotProps: {
|
|
9
7
|
formHelperText: {
|
|
10
8
|
component: 'div',
|
|
11
9
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
|
-
import {
|
|
3
|
+
import { getType, isStateTreeNode } from 'mobx-state-tree';
|
|
4
4
|
const HeadingComponent = observer(function ({ model, }) {
|
|
5
5
|
if (model === null || model === void 0 ? void 0 : model.target) {
|
|
6
6
|
if (model.target.type) {
|
|
@@ -13,6 +13,6 @@ const HeadingComponent = observer(function ({ model, }) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return _jsx(_Fragment, { children: "Settings" });
|
|
17
17
|
});
|
|
18
18
|
export default HeadingComponent;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
declare const JsonEditor: ({ slot, }: {
|
|
3
2
|
slot: {
|
|
4
3
|
name: string;
|
|
@@ -6,5 +5,5 @@ declare const JsonEditor: ({ slot, }: {
|
|
|
6
5
|
value: unknown;
|
|
7
6
|
set: (arg: unknown) => void;
|
|
8
7
|
};
|
|
9
|
-
}) =>
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export default JsonEditor;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
2
3
|
import { InputLabel, TextField } from '@mui/material';
|
|
3
|
-
import { makeStyles } from 'tss-react/mui';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
|
-
|
|
5
|
+
import { makeStyles } from 'tss-react/mui';
|
|
6
6
|
const fontSize = '12px';
|
|
7
|
-
// Optimize by using system default fonts: https://css-tricks.com/snippets/css/font-stacks/
|
|
8
7
|
const fontFamily = 'Consolas, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", Monaco, "Courier New", Courier, monospace';
|
|
9
8
|
const useStyles = makeStyles()(theme => ({
|
|
10
9
|
error: {
|
|
@@ -41,18 +40,14 @@ const JsonEditor = observer(function JsonEditor({ slot, }) {
|
|
|
41
40
|
setError(e);
|
|
42
41
|
}
|
|
43
42
|
}, [contents, slot]);
|
|
44
|
-
return (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
input: classes.textAreaFont,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
} }))));
|
|
43
|
+
return (_jsxs(_Fragment, { children: [error ? _jsx("p", { className: classes.error, children: `${error}` }) : null, _jsxs("div", { className: classes.callbackContainer, children: [_jsx(InputLabel, { shrink: true, htmlFor: "json-editor", children: slot.name }), _jsx(TextField, { id: "json-editor", className: classes.callbackEditor, value: contents, helperText: slot.description, multiline: true, onChange: event => {
|
|
44
|
+
setContents(event.target.value);
|
|
45
|
+
}, style: { background: error ? '#fdd' : undefined }, slotProps: {
|
|
46
|
+
input: {
|
|
47
|
+
classes: {
|
|
48
|
+
input: classes.textAreaFont,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
} })] })] }));
|
|
57
52
|
});
|
|
58
53
|
export default JsonEditor;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
declare const NumberEditor: ({ slot, }: {
|
|
3
2
|
slot: {
|
|
4
3
|
name?: string;
|
|
@@ -7,5 +6,5 @@ declare const NumberEditor: ({ slot, }: {
|
|
|
7
6
|
set: (val: number) => void;
|
|
8
7
|
reset?: () => void;
|
|
9
8
|
};
|
|
10
|
-
}) =>
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export default NumberEditor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
2
3
|
import { observer } from 'mobx-react';
|
|
3
4
|
import ConfigurationTextField from './ConfigurationTextField';
|
|
4
5
|
const NumberEditor = observer(function ({ slot, }) {
|
|
@@ -13,7 +14,7 @@ const NumberEditor = observer(function ({ slot, }) {
|
|
|
13
14
|
slot.set(num);
|
|
14
15
|
}
|
|
15
16
|
}, [slot, val]);
|
|
16
|
-
return (
|
|
17
|
+
return (_jsx(ConfigurationTextField, { label: slot.name, helperText: slot.description, value: val, type: "number", onChange: evt => {
|
|
17
18
|
setVal(evt.target.value);
|
|
18
19
|
} }));
|
|
19
20
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
declare const NumberMapEditor: ({ slot, }: {
|
|
3
2
|
slot: {
|
|
4
3
|
name: string;
|
|
@@ -7,5 +6,5 @@ declare const NumberMapEditor: ({ slot, }: {
|
|
|
7
6
|
add: (key: string, val: number) => void;
|
|
8
7
|
description: string;
|
|
9
8
|
};
|
|
10
|
-
}) =>
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export default NumberMapEditor;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
4
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
3
5
|
import { Card, CardContent, CardHeader, FormHelperText, IconButton, InputAdornment, InputLabel, TextField, } from '@mui/material';
|
|
6
|
+
import { observer } from 'mobx-react';
|
|
4
7
|
import { makeStyles } from 'tss-react/mui';
|
|
5
|
-
// icons
|
|
6
|
-
import DeleteIcon from '@mui/icons-material/Delete';
|
|
7
|
-
import AddIcon from '@mui/icons-material/Add';
|
|
8
8
|
import NumberEditor from './NumberEditor';
|
|
9
9
|
const useStyles = makeStyles()(theme => ({
|
|
10
10
|
card: {
|
|
@@ -14,33 +14,22 @@ const useStyles = makeStyles()(theme => ({
|
|
|
14
14
|
const NumberMapEditor = observer(function ({ slot, }) {
|
|
15
15
|
const { classes } = useStyles();
|
|
16
16
|
const [value, setValue] = useState('');
|
|
17
|
-
return (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}, slotProps: {
|
|
35
|
-
input: {
|
|
36
|
-
endAdornment: (React.createElement(InputAdornment, { position: "end" },
|
|
37
|
-
React.createElement(IconButton, { disabled: value === '', onClick: () => {
|
|
38
|
-
slot.add(value, 0);
|
|
39
|
-
setValue('');
|
|
40
|
-
} },
|
|
41
|
-
React.createElement(AddIcon, null)))),
|
|
42
|
-
},
|
|
43
|
-
} }) })),
|
|
44
|
-
React.createElement(FormHelperText, null, slot.description)));
|
|
17
|
+
return (_jsxs(_Fragment, { children: [_jsx(InputLabel, { children: slot.name }), [...slot.value].map(([key, val]) => (_jsxs(Card, { raised: true, className: classes.card, children: [_jsx(CardHeader, { title: key, action: _jsx(IconButton, { onClick: () => {
|
|
18
|
+
slot.remove(key);
|
|
19
|
+
}, children: _jsx(DeleteIcon, {}) }) }), _jsx(CardContent, { children: _jsx(NumberEditor, { slot: {
|
|
20
|
+
value: val,
|
|
21
|
+
set: (val) => {
|
|
22
|
+
slot.add(key, val);
|
|
23
|
+
},
|
|
24
|
+
} }) })] }, key))), _jsx(Card, { raised: true, className: classes.card, children: _jsx(CardHeader, { disableTypography: true, title: _jsx(TextField, { fullWidth: true, value: value, placeholder: "add new", onChange: event => {
|
|
25
|
+
setValue(event.target.value);
|
|
26
|
+
}, slotProps: {
|
|
27
|
+
input: {
|
|
28
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { disabled: value === '', onClick: () => {
|
|
29
|
+
slot.add(value, 0);
|
|
30
|
+
setValue('');
|
|
31
|
+
}, children: _jsx(AddIcon, {}) }) })),
|
|
32
|
+
},
|
|
33
|
+
} }) }) }), _jsx(FormHelperText, { children: slot.description })] }));
|
|
45
34
|
});
|
|
46
35
|
export default NumberMapEditor;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IAnyType } from 'mobx-state-tree';
|
|
1
|
+
import type { IAnyType } from 'mobx-state-tree';
|
|
3
2
|
declare const SlotEditor: ({ slot, slotSchema, }: {
|
|
4
3
|
slot: any;
|
|
5
4
|
slotSchema: IAnyType;
|
|
6
|
-
}) =>
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export default SlotEditor;
|
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { getPropertyMembers } from 'mobx-state-tree';
|
|
4
|
-
import { getEnv } from '@jbrowse/core/util';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
5
3
|
import { FileSelector } from '@jbrowse/core/ui';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
// icons
|
|
4
|
+
import { getEnv } from '@jbrowse/core/util';
|
|
5
|
+
import { getSubType, getUnionSubTypes } from '@jbrowse/core/util/mst-reflection';
|
|
9
6
|
import RadioButtonUncheckedIcon from '@mui/icons-material/RadioButtonUnchecked';
|
|
10
|
-
|
|
11
|
-
import
|
|
7
|
+
import { IconButton, MenuItem, Paper, SvgIcon, TextField } from '@mui/material';
|
|
8
|
+
import { observer } from 'mobx-react';
|
|
9
|
+
import { getPropertyMembers } from 'mobx-state-tree';
|
|
10
|
+
import BooleanEditor from './BooleanEditor';
|
|
12
11
|
import CallbackEditor from './CallbackEditor';
|
|
13
12
|
import ColorEditor from './ColorEditor';
|
|
14
|
-
import JsonEditor from './JsonEditor';
|
|
15
|
-
import StringArrayMapEditor from './StringArrayMapEditor';
|
|
16
13
|
import ConfigurationTextField from './ConfigurationTextField';
|
|
17
|
-
import
|
|
14
|
+
import JsonEditor from './JsonEditor';
|
|
18
15
|
import NumberEditor from './NumberEditor';
|
|
19
|
-
import
|
|
16
|
+
import NumberMapEditor from './NumberMapEditor';
|
|
17
|
+
import StringArrayEditor from './StringArrayEditor';
|
|
18
|
+
import StringArrayMapEditor from './StringArrayMapEditor';
|
|
20
19
|
import { useSlotEditorStyles } from './useSlotEditorStyles';
|
|
21
20
|
const StringEditor = observer(function ({ slot, }) {
|
|
22
|
-
return (
|
|
21
|
+
return (_jsx(ConfigurationTextField, { label: slot.name, helperText: slot.description, value: slot.value, onChange: evt => {
|
|
23
22
|
slot.set(evt.target.value);
|
|
24
23
|
} }));
|
|
25
24
|
});
|
|
26
25
|
const TextEditor = observer(function ({ slot, }) {
|
|
27
|
-
return (
|
|
26
|
+
return (_jsx(TextField, { label: slot.name, helperText: slot.description, multiline: true, value: slot.value, onChange: evt => {
|
|
28
27
|
slot.set(evt.target.value);
|
|
29
28
|
} }));
|
|
30
29
|
});
|
|
31
|
-
|
|
32
|
-
const SvgCheckbox = () => (React.createElement(SvgIcon, null,
|
|
33
|
-
React.createElement("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" })));
|
|
30
|
+
const SvgCheckbox = () => (_jsx(SvgIcon, { children: _jsx("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" }) }));
|
|
34
31
|
const IntegerEditor = observer(function ({ slot, }) {
|
|
35
32
|
const [val, setVal] = useState(slot.value);
|
|
36
33
|
useEffect(() => {
|
|
@@ -39,24 +36,22 @@ const IntegerEditor = observer(function ({ slot, }) {
|
|
|
39
36
|
slot.set(num);
|
|
40
37
|
}
|
|
41
38
|
}, [slot, val]);
|
|
42
|
-
return (
|
|
39
|
+
return (_jsx(ConfigurationTextField, { label: slot.name, helperText: slot.description, value: val, type: "number", onChange: evt => {
|
|
43
40
|
setVal(evt.target.value);
|
|
44
41
|
} }));
|
|
45
42
|
});
|
|
46
43
|
const StringEnumEditor = observer(function ({ slot, slotSchema, }) {
|
|
47
44
|
const p = getPropertyMembers(getSubType(slotSchema));
|
|
48
45
|
const choices = getUnionSubTypes(getUnionSubTypes(getSubType(p.properties.value))[1]).map(t => t.value);
|
|
49
|
-
return (
|
|
46
|
+
return (_jsx(ConfigurationTextField, { value: slot.value, label: slot.name, select: true, helperText: slot.description, onChange: evt => {
|
|
50
47
|
slot.set(evt.target.value);
|
|
51
|
-
}
|
|
48
|
+
}, children: choices.map(str => (_jsx(MenuItem, { value: str, children: str }, str))) }));
|
|
52
49
|
});
|
|
53
50
|
const FileSelectorWrapper = observer(function ({ slot, }) {
|
|
54
51
|
var _a;
|
|
55
|
-
return (
|
|
52
|
+
return (_jsx(FileSelector, { location: slot.value, setLocation: location => {
|
|
56
53
|
slot.set(location);
|
|
57
|
-
}, name: slot.name, description: slot.description,
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
59
|
-
rootModel: (_a = getEnv(slot).pluginManager) === null || _a === void 0 ? void 0 : _a.rootModel }));
|
|
54
|
+
}, name: slot.name, description: slot.description, rootModel: (_a = getEnv(slot).pluginManager) === null || _a === void 0 ? void 0 : _a.rootModel }));
|
|
60
55
|
});
|
|
61
56
|
const valueComponents = {
|
|
62
57
|
string: StringEditor,
|
|
@@ -78,7 +73,7 @@ const SlotEditor = observer(function ({ slot, slotSchema, }) {
|
|
|
78
73
|
const { type } = slot;
|
|
79
74
|
let ValueComponent = slot.isCallback
|
|
80
75
|
? CallbackEditor
|
|
81
|
-
:
|
|
76
|
+
:
|
|
82
77
|
valueComponents[type];
|
|
83
78
|
if (!ValueComponent) {
|
|
84
79
|
console.warn(`no slot editor defined for ${type}, editing as string`);
|
|
@@ -87,9 +82,6 @@ const SlotEditor = observer(function ({ slot, slotSchema, }) {
|
|
|
87
82
|
if (!(type in valueComponents)) {
|
|
88
83
|
console.warn(`SlotEditor needs to implement ${type}`);
|
|
89
84
|
}
|
|
90
|
-
return (
|
|
91
|
-
React.createElement("div", { className: classes.paperContent },
|
|
92
|
-
React.createElement(ValueComponent, { slot: slot, slotSchema: slotSchema })),
|
|
93
|
-
React.createElement("div", { className: classes.slotModeSwitch }, slot.contextVariable.length ? (React.createElement(IconButton, { onClick: () => slot.isCallback ? slot.convertToValue() : slot.convertToCallback(), title: `convert to ${slot.isCallback ? 'regular value' : 'callback'}` }, slot.isCallback ? React.createElement(SvgCheckbox, null) : React.createElement(RadioButtonUncheckedIcon, null))) : null)));
|
|
85
|
+
return (_jsxs(Paper, { className: classes.paper, children: [_jsx("div", { className: classes.paperContent, children: _jsx(ValueComponent, { slot: slot, slotSchema: slotSchema }) }), _jsx("div", { className: classes.slotModeSwitch, children: slot.contextVariable.length ? (_jsx(IconButton, { onClick: () => slot.isCallback ? slot.convertToValue() : slot.convertToCallback(), title: `convert to ${slot.isCallback ? 'regular value' : 'callback'}`, children: slot.isCallback ? _jsx(SvgCheckbox, {}) : _jsx(RadioButtonUncheckedIcon, {}) })) : null })] }));
|
|
94
86
|
});
|
|
95
87
|
export default SlotEditor;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
declare const StringArrayEditor: ({ slot, }: {
|
|
3
2
|
slot: {
|
|
4
3
|
name: string;
|
|
@@ -8,5 +7,5 @@ declare const StringArrayEditor: ({ slot, }: {
|
|
|
8
7
|
add: (arg: string) => void;
|
|
9
8
|
description: string;
|
|
10
9
|
};
|
|
11
|
-
}) =>
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
export default StringArrayEditor;
|