@jbrowse/app-core 4.2.1 → 5.0.0-beta.1
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/esm/AppSession/AppRootModel.d.ts +30 -0
- package/esm/AppSession/AppRootModel.js +1 -0
- package/esm/AppSession/AppSessionMixin.d.ts +1598 -0
- package/esm/AppSession/AppSessionMixin.js +62 -0
- package/esm/AppSession/index.d.ts +2 -0
- package/esm/AppSession/index.js +1 -0
- package/esm/Assemblies/AssembliesMixin.d.ts +225 -0
- package/esm/Assemblies/AssembliesMixin.js +149 -0
- package/esm/Assemblies/index.d.ts +1 -2
- package/esm/Assemblies/index.js +1 -2
- package/esm/HistoryManagement/index.d.ts +19 -0
- package/esm/HistoryManagement/index.js +42 -5
- package/esm/JBrowseConfig/RootConfiguration.d.ts +167 -78
- package/esm/JBrowseConfig/RootConfiguration.js +85 -7
- package/esm/JBrowseConfig/index.d.ts +169 -84
- package/esm/JBrowseConfig/index.js +62 -2
- package/esm/JBrowseModel/index.d.ts +176 -95
- package/esm/JBrowseModel/index.js +122 -21
- package/esm/RootMenu/index.d.ts +77 -2
- package/esm/RootMenu/index.js +107 -61
- package/esm/SessionSpec/index.d.ts +6 -0
- package/esm/SessionSpec/index.js +3 -0
- package/esm/SessionSpec/lgvUrlInit.d.ts +79 -0
- package/esm/SessionSpec/lgvUrlInit.js +158 -0
- package/esm/SessionSpec/loadSessionSpec.d.ts +21 -0
- package/esm/SessionSpec/loadSessionSpec.js +311 -0
- package/esm/SessionSpec/parseSessionSpecUrl.d.ts +13 -0
- package/esm/SessionSpec/parseSessionSpecUrl.js +196 -0
- package/esm/SessionSpec/types.d.ts +33 -0
- package/esm/SessionSpec/types.js +1 -0
- package/esm/WorkspaceLayout/LayoutRenderer.d.ts +24 -0
- package/esm/WorkspaceLayout/LayoutRenderer.js +185 -0
- package/esm/WorkspaceLayout/PanelView.d.ts +13 -0
- package/esm/WorkspaceLayout/PanelView.js +99 -0
- package/esm/WorkspaceLayout/TabStrip.d.ts +14 -0
- package/esm/WorkspaceLayout/TabStrip.js +226 -0
- package/esm/WorkspaceLayout/WorkspaceContainer.d.ts +16 -0
- package/esm/WorkspaceLayout/WorkspaceContainer.js +105 -0
- package/esm/WorkspaceLayout/WorkspacePanelActions.d.ts +24 -0
- package/esm/WorkspaceLayout/WorkspacePanelActions.js +120 -0
- package/esm/WorkspaceLayout/WorkspaceTab.d.ts +27 -0
- package/esm/WorkspaceLayout/WorkspaceTab.js +109 -0
- package/esm/WorkspaceLayout/dockviewTheme.d.ts +69 -0
- package/esm/WorkspaceLayout/dockviewTheme.js +82 -0
- package/esm/WorkspaceLayout/dropZone.d.ts +105 -0
- package/esm/WorkspaceLayout/dropZone.js +113 -0
- package/esm/WorkspaceLayout/index.d.ts +8 -0
- package/esm/WorkspaceLayout/index.js +4 -0
- package/esm/WorkspaceLayout/model.d.ts +240 -0
- package/esm/WorkspaceLayout/model.js +527 -0
- package/esm/WorkspaceLayout/panelChrome.d.ts +19 -0
- package/esm/WorkspaceLayout/panelChrome.js +4 -0
- package/esm/WorkspaceLayout/spec.d.ts +58 -0
- package/esm/WorkspaceLayout/spec.js +153 -0
- package/esm/WorkspaceLayout/splitter.d.ts +25 -0
- package/esm/WorkspaceLayout/splitter.js +37 -0
- package/esm/WorkspaceLayout/tree.d.ts +158 -0
- package/esm/WorkspaceLayout/tree.js +379 -0
- package/esm/WorkspaceLayout/useLayoutDrag.d.ts +34 -0
- package/esm/WorkspaceLayout/useLayoutDrag.js +232 -0
- package/esm/index.d.ts +16 -9
- package/esm/index.js +13 -9
- package/esm/menus.d.ts +63 -62
- package/esm/menus.js +131 -84
- package/esm/queryParams.d.ts +9 -0
- package/esm/queryParams.js +92 -0
- package/esm/sessionModelFactory.d.ts +18 -0
- package/esm/sessionModelFactory.js +1 -0
- package/esm/ui/App/App.d.ts +3 -14
- package/esm/ui/App/App.js +30 -17
- package/esm/ui/App/AppFab.d.ts +12 -3
- package/esm/ui/App/AppFab.js +15 -8
- package/esm/ui/App/AppReadyMarker.d.ts +34 -0
- package/esm/ui/App/AppReadyMarker.js +56 -0
- package/esm/ui/App/AppToolbar.d.ts +2 -14
- package/esm/ui/App/AppToolbar.js +23 -24
- package/esm/ui/App/ClassicViewsContainer.d.ts +3 -9
- package/esm/ui/App/ClassicViewsContainer.js +9 -8
- package/esm/ui/App/DialogQueue.d.ts +17 -1
- package/esm/ui/App/DialogQueue.js +30 -1
- package/esm/ui/App/Drawer.d.ts +1 -1
- package/esm/ui/App/Drawer.js +10 -39
- package/esm/ui/App/DrawerControls.d.ts +1 -5
- package/esm/ui/App/DrawerControls.js +1 -25
- package/esm/ui/App/DrawerHeader.d.ts +2 -3
- package/esm/ui/App/DrawerHeader.js +24 -10
- package/esm/ui/App/DrawerHeaderHelpButton.d.ts +1 -1
- package/esm/ui/App/DrawerHeaderHelpButton.js +3 -3
- package/esm/ui/App/DrawerHeaderHelpDialog.d.ts +2 -2
- package/esm/ui/App/DrawerHeaderHelpDialog.js +3 -4
- package/esm/ui/App/DrawerWidget.d.ts +1 -1
- package/esm/ui/App/DrawerWidget.js +9 -21
- package/esm/ui/App/JBrowseTabMenu.d.ts +2 -3
- package/esm/ui/App/JBrowseTabMenu.js +24 -5
- package/esm/ui/App/ViewButtons.d.ts +2 -4
- package/esm/ui/App/ViewButtons.js +15 -3
- package/esm/ui/App/ViewContainer.d.ts +3 -2
- package/esm/ui/App/ViewContainer.js +144 -24
- package/esm/ui/App/ViewContainerTitle.d.ts +1 -1
- package/esm/ui/App/ViewContainerTitle.js +9 -2
- package/esm/ui/App/ViewErrorFallback.d.ts +18 -0
- package/esm/ui/App/ViewErrorFallback.js +42 -0
- package/esm/ui/App/ViewHeader.d.ts +3 -4
- package/esm/ui/App/ViewHeader.js +28 -17
- package/esm/ui/App/ViewLauncher.d.ts +2 -8
- package/esm/ui/App/ViewLauncher.js +7 -5
- package/esm/ui/App/ViewMenu.d.ts +3 -5
- package/esm/ui/App/ViewMenu.js +87 -92
- package/esm/ui/App/ViewStack.d.ts +7 -0
- package/esm/ui/App/ViewStack.js +42 -0
- package/esm/ui/App/ViewWrapper.d.ts +15 -1
- package/esm/ui/App/ViewWrapper.js +26 -10
- package/esm/ui/App/ViewsContainer.d.ts +3 -8
- package/esm/ui/App/ViewsContainer.js +9 -6
- package/esm/ui/App/copyView.js +1 -1
- package/esm/ui/App/index.d.ts +2 -1
- package/esm/ui/App/index.js +3 -2
- package/esm/ui/App/lazyChunk.d.ts +13 -0
- package/esm/ui/App/lazyChunk.js +91 -0
- package/esm/ui/App/types.d.ts +12 -3
- package/esm/ui/App/types.js +1 -1
- package/esm/ui/App/useViewVisibility.d.ts +34 -0
- package/esm/ui/App/useViewVisibility.js +87 -0
- package/esm/ui/App/viewTitle.d.ts +5 -0
- package/esm/ui/App/viewTitle.js +9 -0
- package/esm/ui/index.d.ts +1 -1
- package/esm/ui/index.js +1 -1
- package/package.json +12 -17
- package/esm/AppFocus/index.d.ts +0 -5
- package/esm/AppFocus/index.js +0 -12
- package/esm/Assemblies/SessionAssembliesMixin.d.ts +0 -92
- package/esm/Assemblies/SessionAssembliesMixin.js +0 -53
- package/esm/Assemblies/TemporaryAssembliesMixin.d.ts +0 -10
- package/esm/Assemblies/TemporaryAssembliesMixin.js +0 -37
- package/esm/DockviewLayout/index.d.ts +0 -35
- package/esm/DockviewLayout/index.js +0 -111
- package/esm/ui/App/DockviewContext.d.ts +0 -22
- package/esm/ui/App/DockviewContext.js +0 -29
- package/esm/ui/App/DockviewLeftHeaderActions.d.ts +0 -2
- package/esm/ui/App/DockviewLeftHeaderActions.js +0 -58
- package/esm/ui/App/DockviewRightHeaderActions.d.ts +0 -2
- package/esm/ui/App/DockviewRightHeaderActions.js +0 -100
- package/esm/ui/App/DrawerWidgetSelector.d.ts +0 -5
- package/esm/ui/App/DrawerWidgetSelector.js +0 -47
- package/esm/ui/App/JBrowseViewPanel.d.ts +0 -8
- package/esm/ui/App/JBrowseViewPanel.js +0 -40
- package/esm/ui/App/JBrowseViewTab.d.ts +0 -8
- package/esm/ui/App/JBrowseViewTab.js +0 -97
- package/esm/ui/App/ModalWidget.d.ts +0 -6
- package/esm/ui/App/ModalWidget.js +0 -48
- package/esm/ui/App/TiledViewsContainer.d.ts +0 -6
- package/esm/ui/App/TiledViewsContainer.js +0 -366
- package/esm/ui/App/dockviewUtils.d.ts +0 -46
- package/esm/ui/App/dockviewUtils.js +0 -55
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
|
|
3
|
-
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
4
|
-
import CloseIcon from '@mui/icons-material/Close';
|
|
5
|
-
import DynamicFeedIcon from '@mui/icons-material/DynamicFeed';
|
|
6
|
-
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
|
|
7
|
-
import TableRowsIcon from '@mui/icons-material/TableRows';
|
|
8
|
-
import ViewColumnIcon from '@mui/icons-material/ViewColumn';
|
|
9
|
-
import ViewModuleIcon from '@mui/icons-material/ViewModule';
|
|
10
|
-
import { IconButton, Tooltip } from '@mui/material';
|
|
11
|
-
import { useDockview } from "./DockviewContext.js";
|
|
12
|
-
import { rearrangePanelsWithDirection } from "./dockviewUtils.js";
|
|
13
|
-
const useStyles = makeStyles()(theme => ({
|
|
14
|
-
headerActions: {
|
|
15
|
-
display: 'flex',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
height: '100%',
|
|
18
|
-
},
|
|
19
|
-
headerButton: {
|
|
20
|
-
padding: 4,
|
|
21
|
-
color: theme.palette.primary.contrastText,
|
|
22
|
-
},
|
|
23
|
-
headerIcon: {
|
|
24
|
-
fontSize: 16,
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
export default function DockviewRightHeaderActions({ containerApi, group, }) {
|
|
28
|
-
const { classes } = useStyles();
|
|
29
|
-
const { rearrangePanels } = useDockview();
|
|
30
|
-
const tileHorizontally = () => {
|
|
31
|
-
rearrangePanels(api => {
|
|
32
|
-
rearrangePanelsWithDirection(api, (idx, states) => idx === 0
|
|
33
|
-
? undefined
|
|
34
|
-
: { referencePanel: states[0].id, direction: 'right' });
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
const tileVertically = () => {
|
|
38
|
-
rearrangePanels(api => {
|
|
39
|
-
rearrangePanelsWithDirection(api, (idx, states) => idx === 0
|
|
40
|
-
? undefined
|
|
41
|
-
: { referencePanel: states[0].id, direction: 'below' });
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
const tileGrid = () => {
|
|
45
|
-
rearrangePanels(api => {
|
|
46
|
-
const panels = api.panels;
|
|
47
|
-
if (panels.length <= 1) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const cols = Math.ceil(Math.sqrt(panels.length));
|
|
51
|
-
rearrangePanelsWithDirection(api, (idx, states) => {
|
|
52
|
-
if (idx === 0) {
|
|
53
|
-
return undefined;
|
|
54
|
-
}
|
|
55
|
-
const col = idx % cols;
|
|
56
|
-
const row = Math.floor(idx / cols);
|
|
57
|
-
if (col === 0) {
|
|
58
|
-
const refIdx = (row - 1) * cols;
|
|
59
|
-
return { referencePanel: states[refIdx].id, direction: 'below' };
|
|
60
|
-
}
|
|
61
|
-
return { referencePanel: states[idx - 1].id, direction: 'right' };
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
const stackAll = () => {
|
|
66
|
-
rearrangePanels(api => {
|
|
67
|
-
rearrangePanelsWithDirection(api, (idx, states) => idx === 0
|
|
68
|
-
? undefined
|
|
69
|
-
: { referencePanel: states[0].id, direction: 'within' });
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
const showLayoutOptions = containerApi.panels.length > 1;
|
|
73
|
-
const showCloseGroup = containerApi.groups.length > 1;
|
|
74
|
-
return (_jsxs("div", { className: classes.headerActions, children: [showLayoutOptions && (_jsx(CascadingMenuButton, { menuItems: [
|
|
75
|
-
{
|
|
76
|
-
label: 'Global: change layout into set of tabs',
|
|
77
|
-
icon: DynamicFeedIcon,
|
|
78
|
-
onClick: stackAll,
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
label: 'Global: tile horizontally',
|
|
82
|
-
icon: ViewColumnIcon,
|
|
83
|
-
onClick: tileHorizontally,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
label: 'Global: tile vertically',
|
|
87
|
-
icon: TableRowsIcon,
|
|
88
|
-
onClick: tileVertically,
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
label: 'Global: tile grid',
|
|
92
|
-
icon: ViewModuleIcon,
|
|
93
|
-
onClick: tileGrid,
|
|
94
|
-
},
|
|
95
|
-
], size: "small", className: classes.headerButton, children: _jsx(MoreHorizIcon, { className: classes.headerIcon }) })), showCloseGroup && (_jsx(Tooltip, { title: "Close group", children: _jsx(IconButton, { size: "small", onClick: () => {
|
|
96
|
-
for (const panel of group.panels) {
|
|
97
|
-
panel.api.close();
|
|
98
|
-
}
|
|
99
|
-
}, className: classes.headerButton, children: _jsx(CloseIcon, { className: classes.headerIcon }) }) }))] }));
|
|
100
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { SessionWithFocusedViewAndDrawerWidgets } from '@jbrowse/core/util/types';
|
|
2
|
-
declare const DrawerWidgetSelector: ({ session, }: {
|
|
3
|
-
session: SessionWithFocusedViewAndDrawerWidgets;
|
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export default DrawerWidgetSelector;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getEnv } from '@jbrowse/core/util';
|
|
3
|
-
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
4
|
-
import DeleteIcon from '@mui/icons-material/Delete';
|
|
5
|
-
import { FormControl, IconButton, MenuItem, Select, Typography, } from '@mui/material';
|
|
6
|
-
import { observer } from 'mobx-react';
|
|
7
|
-
const useStyles = makeStyles()(theme => ({
|
|
8
|
-
formControl: {
|
|
9
|
-
margin: 0,
|
|
10
|
-
},
|
|
11
|
-
drawerSelect: {
|
|
12
|
-
margin: 0,
|
|
13
|
-
color: theme.palette.secondary.contrastText,
|
|
14
|
-
},
|
|
15
|
-
dropDownIcon: {
|
|
16
|
-
color: theme.palette.secondary.contrastText,
|
|
17
|
-
},
|
|
18
|
-
}));
|
|
19
|
-
const DrawerWidgetSelector = observer(function DrawerWidgetSelector({ session, }) {
|
|
20
|
-
const { visibleWidget, activeWidgets } = session;
|
|
21
|
-
const { classes } = useStyles();
|
|
22
|
-
const { pluginManager } = getEnv(session);
|
|
23
|
-
return (_jsx(FormControl, { className: classes.formControl, children: _jsx(Select, { value: visibleWidget?.id, "data-testid": "widget-drawer-selects", className: classes.drawerSelect, classes: { icon: classes.dropDownIcon }, renderValue: widgetId => {
|
|
24
|
-
const widget = session.activeWidgets.get(widgetId);
|
|
25
|
-
if (!widget) {
|
|
26
|
-
return (_jsx(Typography, { variant: "h6", color: "inherit", children: "Unknown widget" }));
|
|
27
|
-
}
|
|
28
|
-
const widgetType = pluginManager.getWidgetType(widget.type);
|
|
29
|
-
const { HeadingComponent, heading } = widgetType;
|
|
30
|
-
return HeadingComponent ? (_jsx(HeadingComponent, { model: widget })) : (_jsx(Typography, { variant: "h6", color: "inherit", children: heading }));
|
|
31
|
-
}, onChange: e => {
|
|
32
|
-
const w = session.activeWidgets.get(e.target.value);
|
|
33
|
-
if (w) {
|
|
34
|
-
session.showWidget(w);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
session.notify(`Widget not found ${e.target.value}`, 'warning');
|
|
38
|
-
}
|
|
39
|
-
}, children: [...activeWidgets.values()].map(widget => {
|
|
40
|
-
const widgetType = pluginManager.getWidgetType(widget.type);
|
|
41
|
-
const { HeadingComponent, heading } = widgetType;
|
|
42
|
-
return (_jsxs(MenuItem, { "data-testid": `widget-drawer-selects-item-${widget.type}`, value: widget.id, children: [HeadingComponent ? (_jsx(HeadingComponent, { model: widget })) : (_jsx(Typography, { variant: "h6", color: "inherit", children: heading })), _jsx(IconButton, { "data-testid": `${widget.type}-drawer-delete`, color: "inherit", "aria-label": "Delete", onClick: () => {
|
|
43
|
-
session.hideWidget(widget);
|
|
44
|
-
}, children: _jsx(DeleteIcon, {}) })] }, widget.id));
|
|
45
|
-
}) }) }));
|
|
46
|
-
});
|
|
47
|
-
export default DrawerWidgetSelector;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { DockviewSessionType } from './types.ts';
|
|
2
|
-
import type { IDockviewPanelProps } from 'dockview-react';
|
|
3
|
-
export interface JBrowseViewPanelParams {
|
|
4
|
-
panelId: string;
|
|
5
|
-
session?: DockviewSessionType;
|
|
6
|
-
}
|
|
7
|
-
declare const JBrowseViewPanel: ({ params, }: IDockviewPanelProps<JBrowseViewPanelParams>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default JBrowseViewPanel;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense, lazy } from 'react';
|
|
3
|
-
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
4
|
-
import { observer } from 'mobx-react';
|
|
5
|
-
import ViewContainer from "./ViewContainer.js";
|
|
6
|
-
import { getViewsForPanel } from "./dockviewUtils.js";
|
|
7
|
-
const ViewLauncher = lazy(() => import("./ViewLauncher.js"));
|
|
8
|
-
const useStyles = makeStyles()(theme => ({
|
|
9
|
-
container: {
|
|
10
|
-
height: '100%',
|
|
11
|
-
overflowY: 'auto',
|
|
12
|
-
background: theme.palette.background.default,
|
|
13
|
-
},
|
|
14
|
-
viewStack: {
|
|
15
|
-
display: 'flex',
|
|
16
|
-
flexDirection: 'column',
|
|
17
|
-
},
|
|
18
|
-
spacer: {
|
|
19
|
-
height: 300,
|
|
20
|
-
},
|
|
21
|
-
emptyPanel: {
|
|
22
|
-
display: 'flex',
|
|
23
|
-
alignItems: 'center',
|
|
24
|
-
justifyContent: 'center',
|
|
25
|
-
height: '100%',
|
|
26
|
-
},
|
|
27
|
-
}));
|
|
28
|
-
const JBrowseViewPanel = observer(function JBrowseViewPanel({ params, }) {
|
|
29
|
-
const { panelId, session } = params;
|
|
30
|
-
const { classes } = useStyles();
|
|
31
|
-
if (!session) {
|
|
32
|
-
return _jsx("div", { className: classes.container, children: "Loading..." });
|
|
33
|
-
}
|
|
34
|
-
const views = getViewsForPanel(panelId, session);
|
|
35
|
-
if (views.length === 0) {
|
|
36
|
-
return (_jsx("div", { className: classes.container, children: _jsx("div", { className: classes.emptyPanel, children: _jsx(Suspense, { fallback: null, children: _jsx(ViewLauncher, { session: session }) }) }) }));
|
|
37
|
-
}
|
|
38
|
-
return (_jsx("div", { className: classes.container, children: _jsxs("div", { className: classes.viewStack, children: [views.map(view => (_jsx(ViewContainer, { view: view, session: session }, view.id))), _jsx("div", { className: classes.spacer })] }) }));
|
|
39
|
-
});
|
|
40
|
-
export default JBrowseViewPanel;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { DockviewSessionType } from './types.ts';
|
|
2
|
-
import type { IDockviewPanelHeaderProps } from 'dockview-react';
|
|
3
|
-
export interface JBrowseViewPanelParams {
|
|
4
|
-
panelId: string;
|
|
5
|
-
session?: DockviewSessionType;
|
|
6
|
-
}
|
|
7
|
-
declare const JBrowseViewTab: ({ params, api, }: IDockviewPanelHeaderProps<JBrowseViewPanelParams>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export default JBrowseViewTab;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
4
|
-
import { InputBase, Typography } from '@mui/material';
|
|
5
|
-
import { observer } from 'mobx-react';
|
|
6
|
-
import JBrowseTabMenu from "./JBrowseTabMenu.js";
|
|
7
|
-
import { getViewsForPanel } from "./dockviewUtils.js";
|
|
8
|
-
const useStyles = makeStyles()(theme => ({
|
|
9
|
-
tabContainer: {
|
|
10
|
-
display: 'flex',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
height: '100%',
|
|
13
|
-
padding: '0 4px',
|
|
14
|
-
gap: 4,
|
|
15
|
-
},
|
|
16
|
-
tabTitle: {
|
|
17
|
-
display: 'flex',
|
|
18
|
-
alignItems: 'center',
|
|
19
|
-
flex: 1,
|
|
20
|
-
overflow: 'hidden',
|
|
21
|
-
minWidth: 0,
|
|
22
|
-
},
|
|
23
|
-
tabTitleText: {
|
|
24
|
-
overflow: 'hidden',
|
|
25
|
-
textOverflow: 'ellipsis',
|
|
26
|
-
whiteSpace: 'nowrap',
|
|
27
|
-
fontSize: '0.8rem',
|
|
28
|
-
},
|
|
29
|
-
editInput: {
|
|
30
|
-
fontSize: '0.8rem',
|
|
31
|
-
padding: '2px 4px',
|
|
32
|
-
color: 'inherit',
|
|
33
|
-
backgroundColor: theme.palette.action.selected,
|
|
34
|
-
borderRadius: theme.shape.borderRadius,
|
|
35
|
-
flex: 1,
|
|
36
|
-
},
|
|
37
|
-
}));
|
|
38
|
-
function stopEvent(e) {
|
|
39
|
-
e.stopPropagation();
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
}
|
|
42
|
-
function getTabDisplayName(views, session) {
|
|
43
|
-
if (views.length === 0) {
|
|
44
|
-
return 'Empty';
|
|
45
|
-
}
|
|
46
|
-
if (views.length === 1) {
|
|
47
|
-
const view = views[0];
|
|
48
|
-
return (view.displayName ||
|
|
49
|
-
view.assemblyNames
|
|
50
|
-
?.map(r => session.assemblyManager.get(r)?.displayName)
|
|
51
|
-
.join(',') ||
|
|
52
|
-
'View');
|
|
53
|
-
}
|
|
54
|
-
return `${views.length} views`;
|
|
55
|
-
}
|
|
56
|
-
const JBrowseViewTab = observer(function JBrowseViewTab({ params, api, }) {
|
|
57
|
-
const { panelId, session } = params;
|
|
58
|
-
const { classes } = useStyles();
|
|
59
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
60
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
61
|
-
const [editValue, setEditValue] = useState('');
|
|
62
|
-
if (!session) {
|
|
63
|
-
return (_jsx("div", { className: classes.tabContainer, children: _jsx("span", { className: classes.tabTitleText, children: "Loading..." }) }));
|
|
64
|
-
}
|
|
65
|
-
const views = getViewsForPanel(panelId, session);
|
|
66
|
-
const displayValue = getTabDisplayName(views, session);
|
|
67
|
-
const handleStartEdit = () => {
|
|
68
|
-
setEditValue(api.title || displayValue);
|
|
69
|
-
setIsEditing(true);
|
|
70
|
-
};
|
|
71
|
-
const handleSave = () => {
|
|
72
|
-
if (editValue.trim()) {
|
|
73
|
-
api.setTitle(editValue.trim());
|
|
74
|
-
}
|
|
75
|
-
setIsEditing(false);
|
|
76
|
-
};
|
|
77
|
-
const handleKeyDown = (e) => {
|
|
78
|
-
if (e.key === 'Enter') {
|
|
79
|
-
handleSave();
|
|
80
|
-
}
|
|
81
|
-
else if (e.key === 'Escape') {
|
|
82
|
-
setIsEditing(false);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
return (_jsx("div", { className: classes.tabContainer, onMouseEnter: () => {
|
|
86
|
-
setIsHovered(true);
|
|
87
|
-
}, onMouseLeave: () => {
|
|
88
|
-
setIsHovered(false);
|
|
89
|
-
}, children: _jsx("div", { className: classes.tabTitle, children: isEditing ? (_jsx(InputBase, { autoFocus: true, className: classes.editInput, value: editValue, onChange: e => {
|
|
90
|
-
setEditValue(e.target.value);
|
|
91
|
-
}, onFocus: e => {
|
|
92
|
-
e.target.select();
|
|
93
|
-
}, onBlur: handleSave, onKeyDown: handleKeyDown, onClick: stopEvent })) : (_jsxs(_Fragment, { children: [_jsx(Typography, { className: classes.tabTitleText, variant: "body2", onDoubleClick: handleStartEdit, children: api.title || displayValue }), _jsx(JBrowseTabMenu, { isHovered: isHovered, onRename: handleStartEdit, onClose: () => {
|
|
94
|
-
api.close();
|
|
95
|
-
} })] })) }) }));
|
|
96
|
-
});
|
|
97
|
-
export default JBrowseViewTab;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense } from 'react';
|
|
3
|
-
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
-
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
5
|
-
import { getEnv } from '@jbrowse/mobx-state-tree';
|
|
6
|
-
import CloseIcon from '@mui/icons-material/Close';
|
|
7
|
-
import { AppBar, IconButton, Paper, Toolbar, Typography } from '@mui/material';
|
|
8
|
-
import { observer } from 'mobx-react';
|
|
9
|
-
const useStyles = makeStyles()(theme => ({
|
|
10
|
-
paper: {
|
|
11
|
-
overflow: 'auto',
|
|
12
|
-
minWidth: 800,
|
|
13
|
-
},
|
|
14
|
-
closeButton: {
|
|
15
|
-
position: 'absolute',
|
|
16
|
-
right: theme.spacing(1),
|
|
17
|
-
top: theme.spacing(1),
|
|
18
|
-
color: theme.palette.grey[500],
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
21
|
-
const DrawerAppBar = observer(function DrawerAppBar({ session, onClose, }) {
|
|
22
|
-
const { classes } = useStyles();
|
|
23
|
-
const { visibleWidget } = session;
|
|
24
|
-
const { pluginManager } = getEnv(session);
|
|
25
|
-
if (!visibleWidget) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
const { HeadingComponent, heading } = pluginManager.getWidgetType(visibleWidget.type);
|
|
29
|
-
return (_jsxs(AppBar, { position: "static", children: [_jsx(Toolbar, { children: HeadingComponent ? (_jsx(HeadingComponent, { model: visibleWidget })) : (_jsx(Typography, { variant: "h6", children: heading })) }), _jsx(IconButton, { className: classes.closeButton, onClick: onClose, children: _jsx(CloseIcon, {}) })] }));
|
|
30
|
-
});
|
|
31
|
-
const ModalWidget = observer(function ModalWidget({ session, onClose, }) {
|
|
32
|
-
const { classes } = useStyles();
|
|
33
|
-
const { visibleWidget } = session;
|
|
34
|
-
const { pluginManager } = getEnv(session);
|
|
35
|
-
if (!visibleWidget) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const { ReactComponent } = pluginManager.getWidgetType(visibleWidget.type);
|
|
39
|
-
const Component = pluginManager.evaluateExtensionPoint('Core-replaceWidget', ReactComponent, {
|
|
40
|
-
session,
|
|
41
|
-
model: visibleWidget,
|
|
42
|
-
});
|
|
43
|
-
return (_jsx(Dialog, { open: true, onClose: onClose, maxWidth: "xl", header: _jsx(DrawerAppBar, { onClose: onClose, session: session }), children: Component ? (_jsx(Suspense, { fallback: _jsx("div", { children: "Loading..." }), children: _jsx(Paper, { className: classes.paper, children: _jsx(Component, { model: visibleWidget, session: session, modal: true, overrideDimensions: {
|
|
44
|
-
height: (window.innerHeight * 5) / 8,
|
|
45
|
-
width: 800,
|
|
46
|
-
} }) }) })) : null }));
|
|
47
|
-
});
|
|
48
|
-
export default ModalWidget;
|