@jbrowse/plugin-grid-bookmark 2.9.0 → 2.10.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.
Files changed (65) hide show
  1. package/dist/GridBookmarkWidget/components/BookmarkGrid.js +57 -48
  2. package/dist/GridBookmarkWidget/components/GridBookmarkWidget.js +110 -15
  3. package/dist/GridBookmarkWidget/components/Highlight/Highlight.d.ts +7 -0
  4. package/dist/GridBookmarkWidget/components/Highlight/Highlight.js +92 -0
  5. package/dist/GridBookmarkWidget/components/Highlight/index.d.ts +2 -0
  6. package/dist/GridBookmarkWidget/components/Highlight/index.js +19 -0
  7. package/dist/GridBookmarkWidget/components/{DeleteBookmarksDialog.d.ts → dialogs/DeleteBookmarksDialog.d.ts} +1 -1
  8. package/{esm/GridBookmarkWidget/components → dist/GridBookmarkWidget/components/dialogs}/EditBookmarkLabelDialog.d.ts +1 -1
  9. package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +7 -0
  10. package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +48 -0
  11. package/dist/GridBookmarkWidget/components/{ExportBookmarksDialog.d.ts → dialogs/ExportBookmarksDialog.d.ts} +1 -1
  12. package/dist/GridBookmarkWidget/components/{ExportBookmarksDialog.js → dialogs/ExportBookmarksDialog.js} +12 -6
  13. package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +7 -0
  14. package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +27 -0
  15. package/{esm/GridBookmarkWidget/components → dist/GridBookmarkWidget/components/dialogs}/ImportBookmarksDialog.d.ts +1 -1
  16. package/dist/GridBookmarkWidget/components/{ImportBookmarksDialog.js → dialogs/ImportBookmarksDialog.js} +2 -2
  17. package/dist/GridBookmarkWidget/components/{ShareBookmarksDialog.d.ts → dialogs/ShareBookmarksDialog.d.ts} +1 -1
  18. package/dist/GridBookmarkWidget/components/{ShareBookmarksDialog.js → dialogs/ShareBookmarksDialog.js} +1 -1
  19. package/dist/GridBookmarkWidget/index.js +3 -0
  20. package/dist/GridBookmarkWidget/model.d.ts +101 -0
  21. package/dist/GridBookmarkWidget/model.js +109 -5
  22. package/dist/index.js +55 -7
  23. package/esm/GridBookmarkWidget/components/BookmarkGrid.js +58 -49
  24. package/esm/GridBookmarkWidget/components/GridBookmarkWidget.js +87 -15
  25. package/esm/GridBookmarkWidget/components/Highlight/Highlight.d.ts +7 -0
  26. package/esm/GridBookmarkWidget/components/Highlight/Highlight.js +64 -0
  27. package/esm/GridBookmarkWidget/components/Highlight/index.d.ts +2 -0
  28. package/esm/GridBookmarkWidget/components/Highlight/index.js +13 -0
  29. package/esm/GridBookmarkWidget/components/{DeleteBookmarksDialog.d.ts → dialogs/DeleteBookmarksDialog.d.ts} +1 -1
  30. package/{dist/GridBookmarkWidget/components → esm/GridBookmarkWidget/components/dialogs}/EditBookmarkLabelDialog.d.ts +1 -1
  31. package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +7 -0
  32. package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +23 -0
  33. package/esm/GridBookmarkWidget/components/{ExportBookmarksDialog.d.ts → dialogs/ExportBookmarksDialog.d.ts} +1 -1
  34. package/esm/GridBookmarkWidget/components/{ExportBookmarksDialog.js → dialogs/ExportBookmarksDialog.js} +12 -6
  35. package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +7 -0
  36. package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +22 -0
  37. package/{dist/GridBookmarkWidget/components → esm/GridBookmarkWidget/components/dialogs}/ImportBookmarksDialog.d.ts +1 -1
  38. package/esm/GridBookmarkWidget/components/{ImportBookmarksDialog.js → dialogs/ImportBookmarksDialog.js} +2 -2
  39. package/esm/GridBookmarkWidget/components/{ShareBookmarksDialog.d.ts → dialogs/ShareBookmarksDialog.d.ts} +1 -1
  40. package/esm/GridBookmarkWidget/components/{ShareBookmarksDialog.js → dialogs/ShareBookmarksDialog.js} +1 -1
  41. package/esm/GridBookmarkWidget/index.js +3 -0
  42. package/esm/GridBookmarkWidget/model.d.ts +101 -0
  43. package/esm/GridBookmarkWidget/model.js +109 -5
  44. package/esm/index.js +55 -7
  45. package/package.json +2 -2
  46. package/dist/GridBookmarkWidget/components/DeleteBookmarks.d.ts +0 -6
  47. package/dist/GridBookmarkWidget/components/DeleteBookmarks.js +0 -41
  48. package/dist/GridBookmarkWidget/components/ExportBookmarks.d.ts +0 -6
  49. package/dist/GridBookmarkWidget/components/ExportBookmarks.js +0 -41
  50. package/dist/GridBookmarkWidget/components/ImportBookmarks.d.ts +0 -6
  51. package/dist/GridBookmarkWidget/components/ImportBookmarks.js +0 -42
  52. package/dist/GridBookmarkWidget/components/ShareBookmarks.d.ts +0 -6
  53. package/dist/GridBookmarkWidget/components/ShareBookmarks.js +0 -37
  54. package/esm/GridBookmarkWidget/components/DeleteBookmarks.d.ts +0 -6
  55. package/esm/GridBookmarkWidget/components/DeleteBookmarks.js +0 -13
  56. package/esm/GridBookmarkWidget/components/ExportBookmarks.d.ts +0 -6
  57. package/esm/GridBookmarkWidget/components/ExportBookmarks.js +0 -13
  58. package/esm/GridBookmarkWidget/components/ImportBookmarks.d.ts +0 -6
  59. package/esm/GridBookmarkWidget/components/ImportBookmarks.js +0 -14
  60. package/esm/GridBookmarkWidget/components/ShareBookmarks.d.ts +0 -6
  61. package/esm/GridBookmarkWidget/components/ShareBookmarks.js +0 -12
  62. /package/dist/GridBookmarkWidget/components/{DeleteBookmarksDialog.js → dialogs/DeleteBookmarksDialog.js} +0 -0
  63. /package/dist/GridBookmarkWidget/components/{EditBookmarkLabelDialog.js → dialogs/EditBookmarkLabelDialog.js} +0 -0
  64. /package/esm/GridBookmarkWidget/components/{DeleteBookmarksDialog.js → dialogs/DeleteBookmarksDialog.js} +0 -0
  65. /package/esm/GridBookmarkWidget/components/{EditBookmarkLabelDialog.js → dialogs/EditBookmarkLabelDialog.js} +0 -0
@@ -1,14 +1,15 @@
1
- import React, { Suspense, lazy, useState } from 'react';
1
+ import React, { lazy, useState } from 'react';
2
2
  import { observer } from 'mobx-react';
3
3
  import { Link } from '@mui/material';
4
4
  import { makeStyles } from 'tss-react/mui';
5
5
  import { DataGrid, GRID_CHECKBOX_SELECTION_COL_DEF } from '@mui/x-data-grid';
6
6
  import { getSession, assembleLocString, measureGridWidth, measureText, } from '@jbrowse/core/util';
7
- // locals
8
- import { navToBookmark } from '../utils';
9
7
  import { useResizeBar } from '@jbrowse/core/ui/useResizeBar';
10
8
  import ResizeBar from '@jbrowse/core/ui/ResizeBar';
11
- const EditBookmarkLabelDialog = lazy(() => import('./EditBookmarkLabelDialog'));
9
+ import ColorPicker from '@jbrowse/core/ui/ColorPicker';
10
+ // locals
11
+ import { navToBookmark } from '../utils';
12
+ const EditBookmarkLabelDialog = lazy(() => import('./dialogs/EditBookmarkLabelDialog'));
12
13
  const useStyles = makeStyles()(() => ({
13
14
  link: {
14
15
  cursor: 'pointer',
@@ -21,7 +22,6 @@ const useStyles = makeStyles()(() => ({
21
22
  }));
22
23
  const BookmarkGrid = observer(function ({ model, }) {
23
24
  const { classes, cx } = useStyles();
24
- const [dialogRow, setDialogRow] = useState();
25
25
  const { ref, scrollLeft } = useResizeBar();
26
26
  const { bookmarks, bookmarksWithValidAssemblies, selectedAssemblies, selectedBookmarks, } = model;
27
27
  const session = getSession(model);
@@ -38,55 +38,64 @@ const BookmarkGrid = observer(function ({ model, }) {
38
38
  correspondingObj: region,
39
39
  };
40
40
  });
41
- // reset selections if bookmarked regions change
42
- // needed especially if bookmarked regions are deleted, then
43
41
  const [widths, setWidths] = useState([
44
42
  50,
45
43
  Math.max(measureText('Bookmark link', 12) + 30, measureGridWidth(rows.map(row => row.locString))),
46
44
  Math.max(measureText('Label', 12) + 30, measureGridWidth(rows.map(row => row.label))),
47
45
  Math.max(measureText('Assembly', 12) + 30, measureGridWidth(rows.map(row => row.assemblyName))),
46
+ 100,
48
47
  ]);
49
- return (React.createElement(React.Fragment, null,
50
- React.createElement("div", { ref: ref },
51
- React.createElement(ResizeBar, { widths: widths, setWidths: setWidths, scrollLeft: scrollLeft }),
52
- React.createElement(DataGrid, { autoHeight: true, density: "compact", rows: rows, columns: [
53
- {
54
- ...GRID_CHECKBOX_SELECTION_COL_DEF,
55
- width: widths[0],
56
- },
57
- {
58
- field: 'locString',
59
- headerName: 'Bookmark link',
60
- width: widths[1],
61
- renderCell: ({ value, row }) => (React.createElement(Link, { className: cx(classes.link, classes.cell), href: "#", onClick: async (event) => {
62
- event.preventDefault();
63
- const { views } = session;
64
- await navToBookmark(value, row.assemblyName, views, model);
65
- } }, value)),
66
- },
67
- {
68
- field: 'label',
69
- headerName: 'Label',
70
- width: widths[2],
71
- editable: true,
72
- },
73
- {
74
- field: 'assemblyName',
75
- headerName: 'Assembly',
76
- width: widths[3],
77
- },
78
- ], onCellDoubleClick: ({ row }) => setDialogRow(row), processRowUpdate: row => {
79
- const target = rows[row.id];
80
- model.updateBookmarkLabel(target, row.label);
81
- return row;
82
- }, onProcessRowUpdateError: e => session.notify(e.message, 'error'), checkboxSelection: true, onRowSelectionModelChange: newRowSelectionModel => {
83
- if (bookmarksWithValidAssemblies.length > 0) {
84
- model.setSelectedBookmarks(newRowSelectionModel.map(value => ({
85
- ...rows[value],
86
- })));
87
- }
88
- }, rowSelectionModel: selectedBookmarks.map(r => r.id), disableRowSelectionOnClick: true })),
89
- dialogRow ? (React.createElement(Suspense, { fallback: React.createElement(React.Fragment, null) },
90
- React.createElement(EditBookmarkLabelDialog, { onClose: () => setDialogRow(undefined), model: model, dialogRow: dialogRow }))) : null));
48
+ return (React.createElement("div", { ref: ref },
49
+ React.createElement(ResizeBar, { widths: widths, setWidths: setWidths, scrollLeft: scrollLeft }),
50
+ React.createElement(DataGrid, { autoHeight: true, density: "compact", rows: rows, columns: [
51
+ {
52
+ ...GRID_CHECKBOX_SELECTION_COL_DEF,
53
+ width: widths[0],
54
+ },
55
+ {
56
+ field: 'locString',
57
+ headerName: 'Bookmark link',
58
+ width: widths[1],
59
+ renderCell: ({ value, row }) => (React.createElement(Link, { className: cx(classes.link, classes.cell), href: "#", onClick: async (event) => {
60
+ event.preventDefault();
61
+ const { views } = session;
62
+ await navToBookmark(value, row.assemblyName, views, model);
63
+ } }, value)),
64
+ },
65
+ {
66
+ field: 'label',
67
+ headerName: 'Label',
68
+ width: widths[2],
69
+ editable: true,
70
+ },
71
+ {
72
+ field: 'assemblyName',
73
+ headerName: 'Assembly',
74
+ width: widths[3],
75
+ },
76
+ {
77
+ field: 'highlight',
78
+ headerName: 'Highlight',
79
+ width: widths[4],
80
+ renderCell: ({ value, row }) => (React.createElement(ColorPicker, { color: value || 'black', onChange: event => {
81
+ model.updateBookmarkHighlight(row, event);
82
+ } })),
83
+ },
84
+ ], onCellDoubleClick: ({ row }) => {
85
+ getSession(model).queueDialog(onClose => [
86
+ EditBookmarkLabelDialog,
87
+ { onClose, model, dialogRow: row },
88
+ ]);
89
+ }, processRowUpdate: row => {
90
+ const target = rows[row.id];
91
+ model.updateBookmarkLabel(target, row.label);
92
+ return row;
93
+ }, onProcessRowUpdateError: e => session.notify(e.message, 'error'), checkboxSelection: true, onRowSelectionModelChange: newRowSelectionModel => {
94
+ if (bookmarksWithValidAssemblies.length > 0) {
95
+ model.setSelectedBookmarks(newRowSelectionModel.map(value => ({
96
+ ...rows[value],
97
+ })));
98
+ }
99
+ }, rowSelectionModel: selectedBookmarks.map(r => r.id), disableRowSelectionOnClick: true })));
91
100
  });
92
101
  export default BookmarkGrid;
@@ -1,17 +1,30 @@
1
- import React from 'react';
1
+ import React, { lazy } from 'react';
2
2
  import { observer } from 'mobx-react';
3
- import { Alert } from '@mui/material';
4
3
  import { makeStyles } from 'tss-react/mui';
4
+ import { getSession } from '@jbrowse/core/util';
5
+ import { Alert } from '@mui/material';
6
+ import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
5
7
  // locals
6
8
  import BookmarkGrid from './BookmarkGrid';
7
- import DeleteBookmarks from './DeleteBookmarks';
8
- import ExportBookmarks from './ExportBookmarks';
9
- import ImportBookmarks from './ImportBookmarks';
10
9
  import AssemblySelector from './AssemblySelector';
11
- import ShareBookmarks from './ShareBookmarks';
10
+ // icons
11
+ import Menu from '@mui/icons-material/Menu';
12
+ import GetApp from '@mui/icons-material/GetApp';
13
+ import Publish from '@mui/icons-material/Publish';
14
+ import Settings from '@mui/icons-material/Settings';
15
+ import Palette from '@mui/icons-material/Palette';
16
+ import Share from '@mui/icons-material/Share';
17
+ import Delete from '@mui/icons-material/Delete';
18
+ // lazies
19
+ const ExportBookmarksDialog = lazy(() => import('./dialogs/ExportBookmarksDialog'));
20
+ const ImportBookmarksDialog = lazy(() => import('./dialogs/ImportBookmarksDialog'));
21
+ const ShareBookmarksDialog = lazy(() => import('./dialogs/ShareBookmarksDialog'));
22
+ const HighlightSettingsDialog = lazy(() => import('./dialogs/HighlightSettingsDialog'));
23
+ const EditHighlightColorDialog = lazy(() => import('./dialogs/EditHighlightColorDialog'));
24
+ const DeleteBookmarksDialog = lazy(() => import('./dialogs/DeleteBookmarksDialog'));
12
25
  const useStyles = makeStyles()({
13
- card: {
14
- marginTop: 5,
26
+ flex: {
27
+ display: 'flex',
15
28
  },
16
29
  });
17
30
  const GridBookmarkWidget = observer(function GridBookmarkWidget({ model, }) {
@@ -19,19 +32,78 @@ const GridBookmarkWidget = observer(function GridBookmarkWidget({ model, }) {
19
32
  if (!model) {
20
33
  return null;
21
34
  }
22
- return (React.createElement("div", { className: classes.card },
23
- React.createElement("div", null,
24
- React.createElement(ExportBookmarks, { model: model }),
25
- React.createElement(ImportBookmarks, { model: model }),
26
- React.createElement(ShareBookmarks, { model: model }),
27
- React.createElement(DeleteBookmarks, { model: model })),
35
+ return (React.createElement("div", null,
28
36
  React.createElement(Alert, { severity: "info" },
29
37
  "Click and type within the ",
30
38
  React.createElement("strong", null, "label"),
31
39
  " field to annotate your bookmark. Double click the ",
32
40
  React.createElement("strong", null, "label"),
33
41
  " field to do so within a dialog."),
34
- React.createElement(AssemblySelector, { model: model }),
42
+ React.createElement("div", { className: classes.flex },
43
+ React.createElement(CascadingMenuButton, { "data-testid": "grid_bookmark_menu", menuItems: [
44
+ {
45
+ label: 'Export',
46
+ icon: GetApp,
47
+ onClick: () => {
48
+ getSession(model).queueDialog(onClose => [
49
+ ExportBookmarksDialog,
50
+ { onClose, model },
51
+ ]);
52
+ },
53
+ },
54
+ {
55
+ label: 'Import',
56
+ icon: Publish,
57
+ onClick: () => {
58
+ getSession(model).queueDialog(onClose => [
59
+ ImportBookmarksDialog,
60
+ { model, onClose },
61
+ ]);
62
+ },
63
+ },
64
+ {
65
+ label: 'Delete',
66
+ icon: Delete,
67
+ onClick: () => {
68
+ getSession(model).queueDialog(onClose => [
69
+ DeleteBookmarksDialog,
70
+ { model, onClose },
71
+ ]);
72
+ },
73
+ },
74
+ {
75
+ label: 'Share',
76
+ icon: Share,
77
+ onClick: () => {
78
+ getSession(model).queueDialog(onClose => [
79
+ ShareBookmarksDialog,
80
+ { model, onClose },
81
+ ]);
82
+ },
83
+ },
84
+ {
85
+ label: 'Edit colors',
86
+ icon: Palette,
87
+ onClick: () => {
88
+ getSession(model).queueDialog(onClose => [
89
+ EditHighlightColorDialog,
90
+ { model, onClose },
91
+ ]);
92
+ },
93
+ },
94
+ {
95
+ label: 'Settings',
96
+ icon: Settings,
97
+ onClick: () => {
98
+ getSession(model).queueDialog(onClose => [
99
+ HighlightSettingsDialog,
100
+ { model, onClose },
101
+ ]);
102
+ },
103
+ },
104
+ ] },
105
+ React.createElement(Menu, null)),
106
+ React.createElement(AssemblySelector, { model: model })),
35
107
  React.createElement(BookmarkGrid, { model: model })));
36
108
  });
37
109
  export default GridBookmarkWidget;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { IExtendedLGV } from '../../model';
3
+ type LGV = IExtendedLGV;
4
+ declare const Highlight: ({ model }: {
5
+ model: LGV;
6
+ }) => React.JSX.Element;
7
+ export default Highlight;
@@ -0,0 +1,64 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { makeStyles } from 'tss-react/mui';
4
+ import { getSession, notEmpty } from '@jbrowse/core/util';
5
+ import { colord } from '@jbrowse/core/util/colord';
6
+ // icons
7
+ import BookmarkIcon from '@mui/icons-material/Bookmark';
8
+ // locals
9
+ import { Tooltip } from '@mui/material';
10
+ const useStyles = makeStyles()({
11
+ highlight: {
12
+ height: '100%',
13
+ position: 'absolute',
14
+ textAlign: 'center',
15
+ overflow: 'hidden',
16
+ display: 'flex',
17
+ alignItems: 'start',
18
+ },
19
+ });
20
+ const Highlight = observer(function Highlight({ model }) {
21
+ var _a;
22
+ const { classes } = useStyles();
23
+ const session = getSession(model);
24
+ const { showBookmarkHighlights, showBookmarkLabels } = model;
25
+ const assemblyNames = new Set(session.assemblyNames);
26
+ const bookmarkWidget = session.widgets.get('GridBookmark');
27
+ const bookmarks = useRef((_a = bookmarkWidget === null || bookmarkWidget === void 0 ? void 0 : bookmarkWidget.bookmarks) !== null && _a !== void 0 ? _a : []);
28
+ useEffect(() => {
29
+ if (!bookmarkWidget) {
30
+ const newBookmarkWidget = session.addWidget('GridBookmarkWidget', 'GridBookmark');
31
+ bookmarks.current = newBookmarkWidget.bookmarks;
32
+ }
33
+ }, [session, bookmarkWidget]);
34
+ return (React.createElement(React.Fragment, null, showBookmarkHighlights && bookmarks.current
35
+ ? bookmarks.current
36
+ .filter(value => assemblyNames.has(value.assemblyName))
37
+ .map(r => {
38
+ const s = model.bpToPx({
39
+ refName: r.refName,
40
+ coord: r.start,
41
+ });
42
+ const e = model.bpToPx({
43
+ refName: r.refName,
44
+ coord: r.end,
45
+ });
46
+ return s && e
47
+ ? {
48
+ width: Math.max(Math.abs(e.offsetPx - s.offsetPx), 3),
49
+ left: Math.min(s.offsetPx, e.offsetPx) - model.offsetPx,
50
+ highlight: r.highlight,
51
+ label: r.label,
52
+ }
53
+ : undefined;
54
+ })
55
+ .filter(notEmpty)
56
+ .map(({ left, width, highlight, label }, idx) => (React.createElement("div", { key: `${left}_${width}_${idx}`, className: classes.highlight, style: { left, width, background: highlight } }, showBookmarkLabels ? (React.createElement(Tooltip, { title: label, arrow: true },
57
+ React.createElement(BookmarkIcon, { fontSize: "small", sx: {
58
+ color: `${colord(highlight).alpha() !== 0
59
+ ? colord(highlight).alpha(0.8).toRgbString()
60
+ : colord(highlight).alpha(0).toRgbString()}`,
61
+ } }))) : null)))
62
+ : null));
63
+ });
64
+ export default Highlight;
@@ -0,0 +1,2 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function AddHighlightModelF(pluginManager: PluginManager): void;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ // locals
3
+ import Highlight from './Highlight';
4
+ export default function AddHighlightModelF(pluginManager) {
5
+ pluginManager.addToExtensionPoint('LinearGenomeView-TracksContainerComponent',
6
+ // @ts-expect-error
7
+ (rest = [], { model }) => {
8
+ return [
9
+ ...rest,
10
+ React.createElement(Highlight, { key: `highlight_grid_bookmark`, model: model }),
11
+ ];
12
+ });
13
+ }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { GridBookmarkModel } from '../model';
2
+ import { GridBookmarkModel } from '../../model';
3
3
  declare const DeleteBookmarksDialog: ({ onClose, model, }: {
4
4
  onClose: () => void;
5
5
  model: GridBookmarkModel;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { GridBookmarkModel, IExtendedLabeledRegionModel } from '../model';
2
+ import { GridBookmarkModel, IExtendedLabeledRegionModel } from '../../model';
3
3
  declare const EditBookmarkLabelDialog: ({ model, onClose, dialogRow, }: {
4
4
  model: GridBookmarkModel;
5
5
  dialogRow: IExtendedLabeledRegionModel;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { GridBookmarkModel } from '../../model';
3
+ declare const EditHighlightColorDialog: ({ onClose, model, }: {
4
+ onClose: () => void;
5
+ model: GridBookmarkModel;
6
+ }) => React.JSX.Element;
7
+ export default EditHighlightColorDialog;
@@ -0,0 +1,23 @@
1
+ import React, { useState } from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { Button, DialogContent, DialogActions, Alert, Typography, } from '@mui/material';
4
+ import { Dialog } from '@jbrowse/core/ui';
5
+ import { ColorPicker } from '@jbrowse/core/ui/ColorPicker';
6
+ const EditHighlightColorDialog = observer(function ({ onClose, model, }) {
7
+ var _a, _b;
8
+ const { selectedBookmarks } = model;
9
+ const editNone = selectedBookmarks.length === 0;
10
+ const [color, setColor] = useState((_b = (_a = selectedBookmarks[0]) === null || _a === void 0 ? void 0 : _a.highlight) !== null && _b !== void 0 ? _b : 'rgba(247, 129, 192, 0.35)');
11
+ return (React.createElement(Dialog, { open: true, onClose: onClose, title: "Highlight bookmarks" },
12
+ React.createElement(DialogContent, null,
13
+ React.createElement(Typography, { variant: "h6" }, "Bulk highlight selector"),
14
+ React.createElement(Alert, { severity: "info" }, editNone ? (React.createElement("span", null, "Use the checkboxes to select individual bookmarks to edit.")) : ('Only selected bookmarks will be edited.')),
15
+ !editNone ? (React.createElement(ColorPicker, { color: color, onChange: event => setColor(event) })) : null),
16
+ React.createElement(DialogActions, null,
17
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => onClose() }, "Cancel"),
18
+ React.createElement(Button, { variant: "contained", color: "primary", onClick: () => {
19
+ model.updateBulkBookmarkHighlights(color);
20
+ onClose();
21
+ } }, "Confirm"))));
22
+ });
23
+ export default EditHighlightColorDialog;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { GridBookmarkModel } from '../model';
2
+ import { GridBookmarkModel } from '../../model';
3
3
  declare const ExportBookmarksDialog: ({ model, onClose, }: {
4
4
  model: GridBookmarkModel;
5
5
  onClose: (arg: boolean) => void;
@@ -1,22 +1,28 @@
1
1
  import React, { useState } from 'react';
2
2
  import { observer } from 'mobx-react';
3
3
  import { Button, DialogContent, DialogActions, MenuItem, Select, Typography, Alert, } from '@mui/material';
4
- import GetAppIcon from '@mui/icons-material/GetApp';
5
4
  import { makeStyles } from 'tss-react/mui';
6
5
  import { Dialog } from '@jbrowse/core/ui';
7
- import { downloadBookmarkFile } from '../utils';
8
- const useStyles = makeStyles()(() => ({
6
+ // Icons
7
+ import GetAppIcon from '@mui/icons-material/GetApp';
8
+ import { downloadBookmarkFile } from '../../utils';
9
+ const useStyles = makeStyles()({
9
10
  flexItem: {
10
11
  margin: 5,
11
12
  },
12
- }));
13
+ container: {
14
+ display: 'flex',
15
+ flexFlow: 'column',
16
+ gap: '5px',
17
+ },
18
+ });
13
19
  const ExportBookmarksDialog = observer(function ExportBookmarksDialog({ model, onClose, }) {
14
20
  const { classes } = useStyles();
15
21
  const [fileType, setFileType] = useState('BED');
16
22
  const { selectedBookmarks } = model;
17
23
  const exportAll = selectedBookmarks.length === 0;
18
24
  return (React.createElement(Dialog, { open: true, onClose: onClose, title: "Export bookmarks" },
19
- React.createElement(DialogContent, { style: { display: 'flex', flexFlow: 'column', gap: '5px' } },
25
+ React.createElement(DialogContent, { className: classes.container },
20
26
  React.createElement(Alert, { severity: "info" }, exportAll ? (React.createElement(React.Fragment, null,
21
27
  React.createElement("span", null, "All bookmarks will be exported."),
22
28
  React.createElement("br", null),
@@ -27,7 +33,7 @@ const ExportBookmarksDialog = observer(function ExportBookmarksDialog({ model, o
27
33
  React.createElement(MenuItem, { value: "BED" }, "BED"),
28
34
  React.createElement(MenuItem, { value: "TSV" }, "TSV")))),
29
35
  React.createElement(DialogActions, null,
30
- React.createElement(Button, { className: classes.flexItem, "data-testid": "dialogDownload", variant: "contained", color: "primary", startIcon: React.createElement(GetAppIcon, null), onClick: () => {
36
+ React.createElement(Button, { variant: "contained", color: "primary", startIcon: React.createElement(GetAppIcon, null), onClick: () => {
31
37
  downloadBookmarkFile(fileType, model);
32
38
  onClose(false);
33
39
  } }, "Download"))));
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { GridBookmarkModel } from '../../model';
3
+ declare const HighlightSettingsDialog: ({ onClose, model, }: {
4
+ onClose: () => void;
5
+ model: GridBookmarkModel;
6
+ }) => React.JSX.Element;
7
+ export default HighlightSettingsDialog;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { Button, DialogContent, DialogActions, Stack, Typography, Switch, } from '@mui/material';
4
+ import { Dialog } from '@jbrowse/core/ui';
5
+ const HighlightSettingsDialog = observer(function ({ onClose, model, }) {
6
+ return (React.createElement(Dialog, { open: true, onClose: onClose, title: "Highlight bookmarks" },
7
+ React.createElement(DialogContent, null,
8
+ React.createElement(Typography, { variant: "h6" }, "Highlight toggles"),
9
+ React.createElement(Stack, { direction: "row", alignItems: "center" },
10
+ React.createElement(Switch, { "data-testid": "toggle_highlight_all_switch", checked: model.areBookmarksHighlightedOnAllOpenViews, onChange: () => {
11
+ model.setHighlightToggle(!model.areBookmarksHighlightedOnAllOpenViews);
12
+ } }),
13
+ React.createElement(Typography, null, "Toggle bookmark highlights on all open views")),
14
+ React.createElement(Stack, { direction: "row", alignItems: "center" },
15
+ React.createElement(Switch, { "data-testid": "toggle_highlight_label_all_switch", checked: model.areBookmarksHighlightLabelsOnAllOpenViews, onChange: () => {
16
+ model.setLabelToggle(!model.areBookmarksHighlightLabelsOnAllOpenViews);
17
+ } }),
18
+ React.createElement(Typography, null, "Toggle 'bookmark' icon on LGV tracks"))),
19
+ React.createElement(DialogActions, null,
20
+ React.createElement(Button, { variant: "contained", color: "primary", onClick: () => onClose() }, "Close"))));
21
+ });
22
+ export default HighlightSettingsDialog;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { GridBookmarkModel } from '../model';
2
+ import { GridBookmarkModel } from '../../model';
3
3
  declare const ImportBookmarksDialog: ({ onClose, model, }: {
4
4
  onClose: () => void;
5
5
  model: GridBookmarkModel;
@@ -12,8 +12,8 @@ import { makeStyles } from 'tss-react/mui';
12
12
  import ImportIcon from '@mui/icons-material/Publish';
13
13
  import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
14
14
  import HelpIcon from '@mui/icons-material/Help';
15
- import { fromUrlSafeB64 } from '../utils';
16
- import { readSessionFromDynamo } from '../sessionSharing';
15
+ import { fromUrlSafeB64 } from '../../utils';
16
+ import { readSessionFromDynamo } from '../../sessionSharing';
17
17
  const useStyles = makeStyles()(theme => {
18
18
  var _a;
19
19
  return ({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { GridBookmarkModel } from '../model';
2
+ import { GridBookmarkModel } from '../../model';
3
3
  declare const ShareBookmarksDialog: ({ onClose, model, }: {
4
4
  onClose: () => void;
5
5
  model: GridBookmarkModel;
@@ -8,7 +8,7 @@ import { getSession, isSessionWithShareURL } from '@jbrowse/core/util';
8
8
  import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
9
9
  import { ContentCopy as ContentCopyIcon } from '@jbrowse/core/ui/Icons';
10
10
  // locals
11
- import { shareSessionToDynamo } from '../sessionSharing';
11
+ import { shareSessionToDynamo } from '../../sessionSharing';
12
12
  const useStyles = makeStyles()(() => ({
13
13
  flexItem: {
14
14
  margin: 5,
@@ -1,7 +1,9 @@
1
1
  import { lazy } from 'react';
2
2
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
3
  import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
4
+ // locals
4
5
  import stateModelFactory from './model';
6
+ import AddHighlightModelF from './components/Highlight';
5
7
  const configSchema = ConfigurationSchema('GridBookmarkWidget', {});
6
8
  export default (pluginManager) => {
7
9
  pluginManager.addWidgetType(() => {
@@ -13,4 +15,5 @@ export default (pluginManager) => {
13
15
  ReactComponent: lazy(() => import('./components/GridBookmarkWidget')),
14
16
  });
15
17
  });
18
+ AddHighlightModelF(pluginManager);
16
19
  };