@jbrowse/app-core 2.6.2 → 2.7.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/AppFocus/index.d.ts +13 -0
- package/dist/AppFocus/index.js +24 -0
- package/dist/HistoryManagement/index.js +5 -2
- package/dist/JBrowseConfig/index.d.ts +29 -18
- package/dist/JBrowseConfig/index.js +8 -47
- package/dist/JBrowseModel/index.d.ts +34 -7
- package/dist/JBrowseModel/index.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ui/App/App.d.ts +4 -4
- package/dist/ui/App/AppFab.d.ts +2 -2
- package/dist/ui/App/AppFab.js +2 -1
- package/dist/ui/App/DialogQueue.d.ts +2 -2
- package/dist/ui/App/DialogQueue.js +2 -1
- package/dist/ui/App/Drawer.d.ts +5 -6
- package/dist/ui/App/Drawer.js +49 -5
- package/dist/ui/App/DrawerHeader.d.ts +7 -0
- package/dist/ui/App/DrawerHeader.js +124 -0
- package/dist/ui/App/DrawerWidget.d.ts +2 -2
- package/dist/ui/App/DrawerWidget.js +2 -76
- package/dist/ui/App/ViewContainer.d.ts +2 -2
- package/dist/ui/App/ViewContainer.js +28 -3
- package/dist/ui/App/ViewContainerTitle.d.ts +2 -2
- package/dist/ui/App/ViewContainerTitle.js +2 -1
- package/dist/ui/App/ViewMenu.d.ts +1 -1
- package/dist/ui/App/ViewMenu.js +1 -1
- package/esm/AppFocus/index.d.ts +13 -0
- package/esm/AppFocus/index.js +20 -0
- package/esm/HistoryManagement/index.js +5 -2
- package/esm/JBrowseConfig/index.d.ts +29 -18
- package/esm/JBrowseConfig/index.js +8 -47
- package/esm/JBrowseModel/index.d.ts +34 -7
- package/esm/JBrowseModel/index.js +16 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/ui/App/App.d.ts +4 -4
- package/esm/ui/App/AppFab.d.ts +2 -2
- package/esm/ui/App/AppFab.js +2 -1
- package/esm/ui/App/DialogQueue.d.ts +2 -2
- package/esm/ui/App/DialogQueue.js +2 -1
- package/esm/ui/App/Drawer.d.ts +5 -6
- package/esm/ui/App/Drawer.js +26 -5
- package/esm/ui/App/DrawerHeader.d.ts +7 -0
- package/esm/ui/App/DrawerHeader.js +96 -0
- package/esm/ui/App/DrawerWidget.d.ts +2 -2
- package/esm/ui/App/DrawerWidget.js +1 -75
- package/esm/ui/App/ViewContainer.d.ts +2 -2
- package/esm/ui/App/ViewContainer.js +29 -4
- package/esm/ui/App/ViewContainerTitle.d.ts +2 -2
- package/esm/ui/App/ViewContainerTitle.js +2 -1
- package/esm/ui/App/ViewMenu.d.ts +1 -1
- package/esm/ui/App/ViewMenu.js +1 -1
- package/package.json +8 -8
package/esm/ui/App/Drawer.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
declare
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
|
+
declare const Drawer: ({ children, session, }: {
|
|
4
4
|
children: React.ReactNode;
|
|
5
|
-
session:
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
export default _default;
|
|
5
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default Drawer;
|
package/esm/ui/App/Drawer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { Paper } from '@mui/material';
|
|
3
3
|
import { makeStyles } from 'tss-react/mui';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
@@ -18,12 +18,33 @@ const useStyles = makeStyles()(theme => ({
|
|
|
18
18
|
zIndex: theme.zIndex.drawer + 1,
|
|
19
19
|
},
|
|
20
20
|
}));
|
|
21
|
-
|
|
21
|
+
const Drawer = observer(function ({ children, session, }) {
|
|
22
22
|
const { drawerPosition, drawerWidth } = session;
|
|
23
23
|
const { classes } = useStyles();
|
|
24
|
-
|
|
24
|
+
const ref = useRef(null);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
function handleSelectView(e) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (e.target instanceof Element) {
|
|
29
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
const visibleWidgetId = (_b = (_a = session.visibleWidget) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.id;
|
|
32
|
+
if (visibleWidgetId) {
|
|
33
|
+
session.setFocusedViewId(visibleWidgetId);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
document.addEventListener('mousedown', handleSelectView);
|
|
39
|
+
document.addEventListener('keydown', handleSelectView);
|
|
40
|
+
return () => {
|
|
41
|
+
document.removeEventListener('mousedown', handleSelectView);
|
|
42
|
+
document.removeEventListener('keydown', handleSelectView);
|
|
43
|
+
};
|
|
44
|
+
}, [ref, session]);
|
|
45
|
+
return (React.createElement(Paper, { ref: ref, className: classes.paper, elevation: 16, square: true },
|
|
25
46
|
drawerPosition === 'right' ? (React.createElement(ResizeHandle, { onDrag: session.resizeDrawer, className: classes.resizeHandle, vertical: true })) : null,
|
|
26
47
|
children,
|
|
27
48
|
drawerPosition === 'left' ? (React.createElement(ResizeHandle, { onDrag: session.resizeDrawer, className: classes.resizeHandle, style: { left: drawerWidth }, vertical: true })) : null));
|
|
28
|
-
}
|
|
29
|
-
export default
|
|
49
|
+
});
|
|
50
|
+
export default Drawer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
|
+
declare const DrawerHeader: ({ session, setToolbarHeight, }: {
|
|
4
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
5
|
+
setToolbarHeight: (arg: number) => void;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default DrawerHeader;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { AppBar, FormControl, IconButton, Menu, MenuItem, Select, Toolbar, Tooltip, Typography, } from '@mui/material';
|
|
3
|
+
import { makeStyles } from 'tss-react/mui';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
import { getEnv } from '@jbrowse/core/util';
|
|
6
|
+
// icons
|
|
7
|
+
import DeleteIcon from '@mui/icons-material/Delete';
|
|
8
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
9
|
+
import MinimizeIcon from '@mui/icons-material/Minimize';
|
|
10
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
11
|
+
const useStyles = makeStyles()(theme => ({
|
|
12
|
+
formControl: {
|
|
13
|
+
margin: 0,
|
|
14
|
+
},
|
|
15
|
+
spacer: {
|
|
16
|
+
flexGrow: 1,
|
|
17
|
+
},
|
|
18
|
+
drawerSelect: {
|
|
19
|
+
margin: 0,
|
|
20
|
+
color: theme.palette.secondary.contrastText,
|
|
21
|
+
},
|
|
22
|
+
dropDownIcon: {
|
|
23
|
+
color: theme.palette.secondary.contrastText,
|
|
24
|
+
},
|
|
25
|
+
headerFocused: {
|
|
26
|
+
background: theme.palette.secondary.main,
|
|
27
|
+
},
|
|
28
|
+
headerUnfocused: {
|
|
29
|
+
background: theme.palette.secondary.dark,
|
|
30
|
+
},
|
|
31
|
+
}));
|
|
32
|
+
const DrawerHeader = observer(function ({ session, setToolbarHeight, }) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const { classes } = useStyles();
|
|
35
|
+
const focusedViewId = session.focusedViewId;
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
const viewWidgetId = (_b = (_a = session.visibleWidget) === null || _a === void 0 ? void 0 : _a.view) === null || _b === void 0 ? void 0 : _b.id;
|
|
38
|
+
return (React.createElement(AppBar, { position: "sticky", className: focusedViewId === viewWidgetId
|
|
39
|
+
? classes.headerFocused
|
|
40
|
+
: classes.headerUnfocused, ref: ref => setToolbarHeight((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect().height) || 0) },
|
|
41
|
+
React.createElement(Toolbar, { disableGutters: true },
|
|
42
|
+
React.createElement(DrawerWidgetSelector, { session: session }),
|
|
43
|
+
React.createElement("div", { className: classes.spacer }),
|
|
44
|
+
React.createElement(DrawerControls, { session: session }))));
|
|
45
|
+
});
|
|
46
|
+
const DrawerWidgetSelector = observer(function ({ session, }) {
|
|
47
|
+
const { visibleWidget, activeWidgets } = session;
|
|
48
|
+
const { classes } = useStyles();
|
|
49
|
+
const { pluginManager } = getEnv(session);
|
|
50
|
+
return (React.createElement(FormControl, { className: classes.formControl },
|
|
51
|
+
React.createElement(Select, { value: visibleWidget === null || visibleWidget === void 0 ? void 0 : visibleWidget.id, "data-testid": "widget-drawer-selects", className: classes.drawerSelect, classes: { icon: classes.dropDownIcon }, renderValue: widgetId => {
|
|
52
|
+
const widget = session.activeWidgets.get(widgetId);
|
|
53
|
+
if (!widget) {
|
|
54
|
+
return (React.createElement(Typography, { variant: "h6", color: "inherit" }, "Unknown widget"));
|
|
55
|
+
}
|
|
56
|
+
const widgetType = pluginManager.getWidgetType(widget.type);
|
|
57
|
+
const { HeadingComponent, heading } = widgetType;
|
|
58
|
+
return HeadingComponent ? (React.createElement(HeadingComponent, { model: widget })) : (React.createElement(Typography, { variant: "h6", color: "inherit" }, heading));
|
|
59
|
+
}, onChange: e => {
|
|
60
|
+
const w = session.activeWidgets.get(e.target.value);
|
|
61
|
+
if (w) {
|
|
62
|
+
session.showWidget(w);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
session.notify(`Widget not found ${e.target.value}`, 'warning');
|
|
66
|
+
}
|
|
67
|
+
} }, [...activeWidgets.values()].map(widget => {
|
|
68
|
+
const widgetType = pluginManager.getWidgetType(widget.type);
|
|
69
|
+
const { HeadingComponent, heading } = widgetType;
|
|
70
|
+
return (React.createElement(MenuItem, { "data-testid": `widget-drawer-selects-item-${widget.type}`, key: widget.id, value: widget.id },
|
|
71
|
+
HeadingComponent ? (React.createElement(HeadingComponent, { model: widget })) : (React.createElement(Typography, { variant: "h6", color: "inherit" }, heading)),
|
|
72
|
+
React.createElement(IconButton, { "data-testid": `${widget.type}-drawer-delete`, color: "inherit", "aria-label": "Delete", onClick: () => session.hideWidget(widget) },
|
|
73
|
+
React.createElement(DeleteIcon, null))));
|
|
74
|
+
}))));
|
|
75
|
+
});
|
|
76
|
+
const DrawerControls = observer(function ({ session, }) {
|
|
77
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
78
|
+
const { drawerPosition, visibleWidget } = session;
|
|
79
|
+
return (React.createElement(React.Fragment, null,
|
|
80
|
+
React.createElement(IconButton, { color: "inherit", onClick: event => setAnchorEl(event.currentTarget) },
|
|
81
|
+
React.createElement(MoreVertIcon, null)),
|
|
82
|
+
React.createElement(Tooltip, { title: "Minimize drawer" },
|
|
83
|
+
React.createElement(IconButton, { "data-testid": "drawer-minimize", color: "inherit", onClick: () => {
|
|
84
|
+
session.notify(`Drawer minimized, click button on ${drawerPosition} side of screen to re-open`, 'info');
|
|
85
|
+
session.minimizeWidgetDrawer();
|
|
86
|
+
} },
|
|
87
|
+
React.createElement(MinimizeIcon, null))),
|
|
88
|
+
React.createElement(Tooltip, { title: "Close drawer" },
|
|
89
|
+
React.createElement(IconButton, { color: "inherit", onClick: () => session.hideWidget(visibleWidget) },
|
|
90
|
+
React.createElement(CloseIcon, null))),
|
|
91
|
+
React.createElement(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: () => setAnchorEl(null) }, ['left', 'right'].map(option => (React.createElement(MenuItem, { key: option, selected: drawerPosition === 'option', onClick: () => {
|
|
92
|
+
session.setDrawerPosition(option);
|
|
93
|
+
setAnchorEl(null);
|
|
94
|
+
} }, option))))));
|
|
95
|
+
});
|
|
96
|
+
export default DrawerHeader;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
3
3
|
declare const DrawerWidget: ({ session, }: {
|
|
4
|
-
session:
|
|
4
|
+
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
6
|
export default DrawerWidget;
|
|
@@ -1,86 +1,12 @@
|
|
|
1
1
|
import React, { Suspense, useState } from 'react';
|
|
2
2
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
3
|
-
import { AppBar, FormControl, IconButton, Menu, MenuItem, Select, Toolbar, Tooltip, Typography, } from '@mui/material';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
3
|
import { observer } from 'mobx-react';
|
|
6
4
|
import { getEnv } from '@jbrowse/core/util';
|
|
7
5
|
import LoadingEllipses from '@jbrowse/core/ui/LoadingEllipses';
|
|
8
6
|
import ErrorMessage from '@jbrowse/core/ui/ErrorMessage';
|
|
9
|
-
// icons
|
|
10
|
-
import DeleteIcon from '@mui/icons-material/Delete';
|
|
11
|
-
import CloseIcon from '@mui/icons-material/Close';
|
|
12
|
-
import MinimizeIcon from '@mui/icons-material/Minimize';
|
|
13
|
-
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
14
7
|
// locals
|
|
15
8
|
import Drawer from './Drawer';
|
|
16
|
-
|
|
17
|
-
formControl: {
|
|
18
|
-
margin: 0,
|
|
19
|
-
},
|
|
20
|
-
spacer: {
|
|
21
|
-
flexGrow: 1,
|
|
22
|
-
},
|
|
23
|
-
drawerSelect: {
|
|
24
|
-
margin: 0,
|
|
25
|
-
color: theme.palette.secondary.contrastText,
|
|
26
|
-
},
|
|
27
|
-
dropDownIcon: {
|
|
28
|
-
color: theme.palette.secondary.contrastText,
|
|
29
|
-
},
|
|
30
|
-
header: {
|
|
31
|
-
background: theme.palette.secondary.main,
|
|
32
|
-
},
|
|
33
|
-
}));
|
|
34
|
-
const DrawerHeader = observer(function ({ session, setToolbarHeight, }) {
|
|
35
|
-
const { pluginManager } = getEnv(session);
|
|
36
|
-
const { visibleWidget, activeWidgets, drawerPosition } = session;
|
|
37
|
-
const { classes } = useStyles();
|
|
38
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
39
|
-
return (React.createElement(AppBar, { position: "sticky", className: classes.header, ref: ref => setToolbarHeight((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect().height) || 0) },
|
|
40
|
-
React.createElement(Toolbar, { disableGutters: true },
|
|
41
|
-
React.createElement(FormControl, { className: classes.formControl },
|
|
42
|
-
React.createElement(Select, { value: visibleWidget === null || visibleWidget === void 0 ? void 0 : visibleWidget.id, "data-testid": "widget-drawer-selects", className: classes.drawerSelect, classes: { icon: classes.dropDownIcon }, renderValue: widgetId => {
|
|
43
|
-
const widget = session.activeWidgets.get(widgetId);
|
|
44
|
-
if (!widget) {
|
|
45
|
-
return (React.createElement(Typography, { variant: "h6", color: "inherit" }, "Unknown widget"));
|
|
46
|
-
}
|
|
47
|
-
const widgetType = pluginManager.getWidgetType(widget.type);
|
|
48
|
-
const { HeadingComponent, heading } = widgetType;
|
|
49
|
-
return HeadingComponent ? (React.createElement(HeadingComponent, { model: widget })) : (React.createElement(Typography, { variant: "h6", color: "inherit" }, heading));
|
|
50
|
-
}, onChange: e => {
|
|
51
|
-
const w = session.activeWidgets.get(e.target.value);
|
|
52
|
-
if (w) {
|
|
53
|
-
session.showWidget(w);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
session.notify(`Widget not found ${e.target.value}`, 'warning');
|
|
57
|
-
}
|
|
58
|
-
} }, [...activeWidgets.values()].map(widget => {
|
|
59
|
-
const widgetType = pluginManager.getWidgetType(widget.type);
|
|
60
|
-
const { HeadingComponent, heading } = widgetType;
|
|
61
|
-
return (React.createElement(MenuItem, { "data-testid": `widget-drawer-selects-item-${widget.type}`, key: widget.id, value: widget.id },
|
|
62
|
-
HeadingComponent ? (React.createElement(HeadingComponent, { model: widget })) : (React.createElement(Typography, { variant: "h6", color: "inherit" }, heading)),
|
|
63
|
-
React.createElement(IconButton, { "data-testid": `${widget.type}-drawer-delete`, color: "inherit", "aria-label": "Delete", onClick: () => session.hideWidget(widget) },
|
|
64
|
-
React.createElement(DeleteIcon, null))));
|
|
65
|
-
}))),
|
|
66
|
-
React.createElement("div", { className: classes.spacer }),
|
|
67
|
-
React.createElement("div", null,
|
|
68
|
-
React.createElement(IconButton, { "data-testid": "drawer-close", color: "inherit", onClick: event => setAnchorEl(event.currentTarget) },
|
|
69
|
-
React.createElement(MoreVertIcon, null)),
|
|
70
|
-
React.createElement(Tooltip, { title: "Minimize drawer" },
|
|
71
|
-
React.createElement(IconButton, { "data-testid": "drawer-minimize", color: "inherit", onClick: () => {
|
|
72
|
-
session.notify(`Drawer minimized, click button on ${drawerPosition} side of screen to re-open`, 'info');
|
|
73
|
-
session.minimizeWidgetDrawer();
|
|
74
|
-
} },
|
|
75
|
-
React.createElement(MinimizeIcon, null))),
|
|
76
|
-
React.createElement(Tooltip, { title: "Close drawer" },
|
|
77
|
-
React.createElement(IconButton, { "data-testid": "drawer-close", color: "inherit", onClick: () => session.hideWidget(visibleWidget) },
|
|
78
|
-
React.createElement(CloseIcon, null))))),
|
|
79
|
-
React.createElement(Menu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: () => setAnchorEl(null) }, ['left', 'right'].map(option => (React.createElement(MenuItem, { key: option, selected: drawerPosition === 'option', onClick: () => {
|
|
80
|
-
session.setDrawerPosition(option);
|
|
81
|
-
setAnchorEl(null);
|
|
82
|
-
} }, option))))));
|
|
83
|
-
});
|
|
9
|
+
import DrawerHeader from './DrawerHeader';
|
|
84
10
|
const DrawerWidget = observer(function ({ session, }) {
|
|
85
11
|
const { visibleWidget } = session;
|
|
86
12
|
const { pluginManager } = getEnv(session);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
|
-
declare const
|
|
3
|
+
declare const ViewContainer: ({ view, onClose, onMinimize, children, }: {
|
|
4
4
|
view: IBaseViewModel;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
onMinimize: () => void;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}) => React.JSX.Element;
|
|
9
|
-
export default
|
|
9
|
+
export default ViewContainer;
|
|
@@ -2,7 +2,8 @@ import React, { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { IconButton, Paper, useTheme } from '@mui/material';
|
|
3
3
|
import { makeStyles } from 'tss-react/mui';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
|
-
import { useWidthSetter } from '@jbrowse/core/util';
|
|
5
|
+
import { getSession, useWidthSetter } from '@jbrowse/core/util';
|
|
6
|
+
import clsx from 'clsx';
|
|
6
7
|
// icons
|
|
7
8
|
import CloseIcon from '@mui/icons-material/Close';
|
|
8
9
|
import MinimizeIcon from '@mui/icons-material/Minimize';
|
|
@@ -13,7 +14,6 @@ import ViewContainerTitle from './ViewContainerTitle';
|
|
|
13
14
|
const useStyles = makeStyles()(theme => ({
|
|
14
15
|
viewContainer: {
|
|
15
16
|
overflow: 'hidden',
|
|
16
|
-
background: theme.palette.secondary.main,
|
|
17
17
|
margin: theme.spacing(0.5),
|
|
18
18
|
padding: `0 ${theme.spacing(1)} ${theme.spacing(1)}`,
|
|
19
19
|
},
|
|
@@ -23,19 +23,43 @@ const useStyles = makeStyles()(theme => ({
|
|
|
23
23
|
grow: {
|
|
24
24
|
flexGrow: 1,
|
|
25
25
|
},
|
|
26
|
+
focusedView: {
|
|
27
|
+
background: theme.palette.secondary.main,
|
|
28
|
+
},
|
|
29
|
+
unfocusedView: {
|
|
30
|
+
background: theme.palette.secondary.dark,
|
|
31
|
+
},
|
|
26
32
|
}));
|
|
27
|
-
|
|
33
|
+
const ViewContainer = observer(function ({ view, onClose, onMinimize, children, }) {
|
|
28
34
|
const { classes } = useStyles();
|
|
29
35
|
const theme = useTheme();
|
|
30
36
|
const ref = useWidthSetter(view, theme.spacing(1));
|
|
31
37
|
const scrollRef = useRef(null);
|
|
38
|
+
const session = getSession(view);
|
|
32
39
|
// scroll the view into view when first mounted. note: this effect will run
|
|
33
40
|
// only once, because of the empty array second param
|
|
34
41
|
useEffect(() => {
|
|
35
42
|
var _a, _b;
|
|
36
43
|
(_b = (_a = scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView) === null || _b === void 0 ? void 0 : _b.call(_a, { block: 'center' });
|
|
37
44
|
}, []);
|
|
38
|
-
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
function handleSelectView(e) {
|
|
47
|
+
if (e.target instanceof Element) {
|
|
48
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.contains(e.target)) {
|
|
49
|
+
session.setFocusedViewId(view.id);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
document.addEventListener('mousedown', handleSelectView);
|
|
54
|
+
document.addEventListener('keydown', handleSelectView);
|
|
55
|
+
return () => {
|
|
56
|
+
document.removeEventListener('mousedown', handleSelectView);
|
|
57
|
+
document.removeEventListener('keydown', handleSelectView);
|
|
58
|
+
};
|
|
59
|
+
}, [ref, session, view]);
|
|
60
|
+
return (React.createElement(Paper, { ref: ref, elevation: 12, className: clsx(classes.viewContainer, session.focusedViewId === view.id
|
|
61
|
+
? classes.focusedView
|
|
62
|
+
: classes.unfocusedView) },
|
|
39
63
|
React.createElement("div", { ref: scrollRef, style: { display: 'flex' } },
|
|
40
64
|
React.createElement(ViewMenu, { model: view, IconProps: { className: classes.icon } }),
|
|
41
65
|
React.createElement("div", { className: classes.grow }),
|
|
@@ -46,3 +70,4 @@ export default observer(function ({ view, onClose, onMinimize, children, }) {
|
|
|
46
70
|
React.createElement(CloseIcon, { className: classes.icon, fontSize: "small" }))),
|
|
47
71
|
React.createElement(Paper, null, children)));
|
|
48
72
|
});
|
|
73
|
+
export default ViewContainer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes';
|
|
3
|
-
declare const
|
|
3
|
+
declare const ViewContainerTitle: ({ view, }: {
|
|
4
4
|
view: IBaseViewModel;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
|
-
export default
|
|
6
|
+
export default ViewContainerTitle;
|
|
@@ -22,7 +22,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
22
22
|
backgroundColor: theme.palette.secondary.light,
|
|
23
23
|
},
|
|
24
24
|
}));
|
|
25
|
-
|
|
25
|
+
const ViewContainerTitle = observer(function ({ view, }) {
|
|
26
26
|
var _a;
|
|
27
27
|
const { classes } = useStyles();
|
|
28
28
|
return (React.createElement(Tooltip, { title: "Rename view", arrow: true },
|
|
@@ -35,3 +35,4 @@ export default observer(function ViewContainerTitle({ view, }) {
|
|
|
35
35
|
inputFocused: classes.inputFocused,
|
|
36
36
|
} })));
|
|
37
37
|
});
|
|
38
|
+
export default ViewContainerTitle;
|
package/esm/ui/App/ViewMenu.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SvgIconProps, IconButtonProps as IconButtonPropsType } from '@mui/material';
|
|
3
3
|
import { IBaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
4
|
-
declare const ViewMenu: ({ model,
|
|
4
|
+
declare const ViewMenu: ({ model, IconProps, }: {
|
|
5
5
|
model: IBaseViewModel;
|
|
6
6
|
IconButtonProps?: IconButtonPropsType | undefined;
|
|
7
7
|
IconProps: SvgIconProps;
|
package/esm/ui/App/ViewMenu.js
CHANGED
|
@@ -6,7 +6,7 @@ import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
|
|
|
6
6
|
import MenuIcon from '@mui/icons-material/Menu';
|
|
7
7
|
import ArrowDownward from '@mui/icons-material/ArrowDownward';
|
|
8
8
|
import ArrowUpward from '@mui/icons-material/ArrowUpward';
|
|
9
|
-
const ViewMenu = observer(function ({ model,
|
|
9
|
+
const ViewMenu = observer(function ({ model, IconProps, }) {
|
|
10
10
|
const { menuItems } = model;
|
|
11
11
|
const session = getSession(model);
|
|
12
12
|
const items = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/app-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "JBrowse 2 code shared between the 'full featured' apps e.g. jbrowse-web and jbrowse-desktop",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -42,24 +42,24 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime": "^7.16.3",
|
|
45
|
-
"@jbrowse/product-core": "^2.
|
|
45
|
+
"@jbrowse/product-core": "^2.7.0",
|
|
46
46
|
"@mui/icons-material": "^5.0.0",
|
|
47
47
|
"@mui/material": "^5.10.17",
|
|
48
|
+
"clsx": "^2.0.0",
|
|
48
49
|
"copy-to-clipboard": "^3.3.1",
|
|
49
|
-
"react-error-boundary": "^4.0.3"
|
|
50
|
-
"shortid": "^2.2.15"
|
|
50
|
+
"react-error-boundary": "^4.0.3"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"mobx": "^6.0.0",
|
|
54
|
-
"mobx-react": "^
|
|
54
|
+
"mobx-react": "^9.0.0",
|
|
55
55
|
"mobx-state-tree": "^5.0.0",
|
|
56
|
-
"react": "
|
|
57
|
-
"react-dom": "
|
|
56
|
+
"react": ">=17.0.0",
|
|
57
|
+
"react-dom": ">=17.0.0",
|
|
58
58
|
"rxjs": "^7.0.0",
|
|
59
59
|
"tss-react": "^4.0.0"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "dbe7fb1af01fc89f833d2744635eb44a17365b41"
|
|
65
65
|
}
|