@jbrowse/plugin-grid-bookmark 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/GridBookmarkWidget/components/AssemblySelector.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/AssemblySelector.js +10 -25
- package/dist/GridBookmarkWidget/components/BookmarkGrid.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/BookmarkGrid.js +52 -82
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.js +90 -93
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.js +34 -58
- package/dist/GridBookmarkWidget/components/Highlight/OverviewHighlight.d.ts +3 -4
- package/dist/GridBookmarkWidget/components/Highlight/OverviewHighlight.js +8 -31
- package/dist/GridBookmarkWidget/components/Highlight/index.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/Highlight/index.js +5 -10
- package/dist/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.js +12 -23
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +12 -41
- package/dist/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.d.ts +3 -4
- package/dist/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.js +14 -47
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +10 -23
- package/dist/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.js +39 -81
- package/dist/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.d.ts +2 -3
- package/dist/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.js +19 -53
- package/dist/GridBookmarkWidget/index.d.ts +1 -1
- package/dist/GridBookmarkWidget/index.js +18 -9
- package/dist/GridBookmarkWidget/model.d.ts +10 -86
- package/dist/GridBookmarkWidget/model.js +18 -94
- package/dist/GridBookmarkWidget/sessionSharing.d.ts +1 -1
- package/dist/GridBookmarkWidget/sessionSharing.js +20 -16
- package/dist/GridBookmarkWidget/types.d.ts +1 -1
- package/dist/GridBookmarkWidget/utils.d.ts +2 -16
- package/dist/GridBookmarkWidget/utils.js +19 -30
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -29
- package/esm/GridBookmarkWidget/components/AssemblySelector.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/AssemblySelector.js +10 -22
- package/esm/GridBookmarkWidget/components/BookmarkGrid.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/BookmarkGrid.js +52 -59
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.js +73 -86
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.js +34 -35
- package/esm/GridBookmarkWidget/components/Highlight/OverviewHighlight.d.ts +3 -4
- package/esm/GridBookmarkWidget/components/Highlight/OverviewHighlight.js +8 -8
- package/esm/GridBookmarkWidget/components/Highlight/index.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/Highlight/index.js +5 -10
- package/esm/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/DeleteBookmarksDialog.js +12 -20
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +12 -18
- package/esm/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.d.ts +3 -4
- package/esm/GridBookmarkWidget/components/dialogs/ExportBookmarksDialog.js +14 -24
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +10 -20
- package/esm/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/ImportBookmarksDialog.js +40 -59
- package/esm/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.d.ts +2 -3
- package/esm/GridBookmarkWidget/components/dialogs/ShareBookmarksDialog.js +19 -30
- package/esm/GridBookmarkWidget/index.d.ts +1 -1
- package/esm/GridBookmarkWidget/index.js +1 -2
- package/esm/GridBookmarkWidget/model.d.ts +10 -86
- package/esm/GridBookmarkWidget/model.js +18 -94
- package/esm/GridBookmarkWidget/sessionSharing.d.ts +1 -1
- package/esm/GridBookmarkWidget/sessionSharing.js +3 -9
- package/esm/GridBookmarkWidget/types.d.ts +1 -1
- package/esm/GridBookmarkWidget/utils.d.ts +2 -16
- package/esm/GridBookmarkWidget/utils.js +2 -23
- package/esm/index.d.ts +1 -1
- package/esm/index.js +10 -29
- package/package.json +2 -2
- package/dist/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.d.ts +0 -8
- package/dist/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.js +0 -54
- package/esm/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.d.ts +0 -8
- package/esm/GridBookmarkWidget/components/dialogs/EditBookmarkLabelDialog.js +0 -29
|
@@ -15,34 +15,38 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.navToBookmark = navToBookmark;
|
|
27
37
|
exports.downloadBookmarkFile = downloadBookmarkFile;
|
|
28
38
|
exports.b64PadSuffix = b64PadSuffix;
|
|
29
39
|
exports.fromUrlSafeB64 = fromUrlSafeB64;
|
|
30
40
|
exports.toUrlSafeB64 = toUrlSafeB64;
|
|
31
|
-
const file_saver_1 = require("file-saver");
|
|
32
41
|
const util_1 = require("@jbrowse/core/util");
|
|
42
|
+
const file_saver_1 = require("file-saver");
|
|
33
43
|
async function navToBookmark(locString, assembly, views, model) {
|
|
34
44
|
const session = (0, util_1.getSession)(model);
|
|
35
45
|
try {
|
|
36
|
-
// get the focused view
|
|
37
46
|
let view = views.find(view => view.id === session.focusedViewId);
|
|
38
|
-
// check if the focused view is the appropriate assembly, if not proceed
|
|
39
47
|
if ((view === null || view === void 0 ? void 0 : view.assemblyNames[0]) !== assembly) {
|
|
40
|
-
view = views.find(elt =>
|
|
41
|
-
// @ts-expect-error
|
|
42
|
-
elt.type === 'LinearGenomeView' && elt.assemblyNames[0] === assembly);
|
|
48
|
+
view = views.find(elt => elt.type === 'LinearGenomeView' && elt.assemblyNames[0] === assembly);
|
|
43
49
|
}
|
|
44
|
-
// if no view is opened of the selectedAssembly, open a new
|
|
45
|
-
// view with that assembly
|
|
46
50
|
if (!view) {
|
|
47
51
|
const newViewId = `${model.id}_${assembly}`;
|
|
48
52
|
view = session.addView('LinearGenomeView', {
|
|
@@ -85,7 +89,6 @@ function downloadBookmarkFile(fileFormat, model) {
|
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
else {
|
|
88
|
-
// TSV
|
|
89
92
|
const fileHeader = 'chrom\tstart\tend\tlabel\tassembly_name\tcoord_range\n';
|
|
90
93
|
const fileContents = bookmarksToDownload
|
|
91
94
|
.map(bookmark => {
|
|
@@ -102,10 +105,6 @@ function downloadBookmarkFile(fileFormat, model) {
|
|
|
102
105
|
(0, file_saver_1.saveAs)(blob, fileName);
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Pad the end of a base64 string with "=" to make it valid
|
|
107
|
-
* @param b64 - unpadded b64 string
|
|
108
|
-
*/
|
|
109
108
|
function b64PadSuffix(b64) {
|
|
110
109
|
let num = 0;
|
|
111
110
|
const mo = b64.length % 4;
|
|
@@ -124,11 +123,6 @@ function b64PadSuffix(b64) {
|
|
|
124
123
|
}
|
|
125
124
|
return b64 + '='.repeat(num);
|
|
126
125
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Decode and inflate a url-safe base64 to a string
|
|
129
|
-
* See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}
|
|
130
|
-
* @param b64 - a base64 string to decode and inflate
|
|
131
|
-
*/
|
|
132
126
|
async function fromUrlSafeB64(b64) {
|
|
133
127
|
const originalB64 = b64PadSuffix(b64.replaceAll('-', '+').replaceAll('_', '/'));
|
|
134
128
|
const { toByteArray } = await Promise.resolve().then(() => __importStar(require('base64-js')));
|
|
@@ -137,11 +131,6 @@ async function fromUrlSafeB64(b64) {
|
|
|
137
131
|
const inflated = inflate(bytes);
|
|
138
132
|
return new TextDecoder().decode(inflated);
|
|
139
133
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Compress and encode a string as url-safe base64
|
|
142
|
-
* See {@link https://en.wikipedia.org/wiki/Base64#URL_applications}
|
|
143
|
-
* @param str- a string to compress and encode
|
|
144
|
-
*/
|
|
145
134
|
async function toUrlSafeB64(str) {
|
|
146
135
|
const bytes = new TextEncoder().encode(str);
|
|
147
136
|
const { deflate } = await Promise.resolve().then(() => __importStar(require('pako')));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
3
|
export default class GridBookmarkPlugin extends Plugin {
|
|
4
4
|
name: string;
|
|
5
5
|
install(pluginManager: PluginManager): void;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
|
|
7
7
|
const util_1 = require("@jbrowse/core/util");
|
|
8
|
-
// icons
|
|
9
8
|
const Bookmark_1 = __importDefault(require("@mui/icons-material/Bookmark"));
|
|
10
9
|
const Bookmarks_1 = __importDefault(require("@mui/icons-material/Bookmarks"));
|
|
11
10
|
const Highlight_1 = __importDefault(require("@mui/icons-material/Highlight"));
|
|
@@ -24,31 +23,15 @@ class GridBookmarkPlugin extends Plugin_1.default {
|
|
|
24
23
|
const lgv = stateModel;
|
|
25
24
|
const newStateModel = lgv
|
|
26
25
|
.props({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* show the bookmark highlights on this track
|
|
30
|
-
*/
|
|
31
|
-
showBookmarkHighlights: true,
|
|
32
|
-
/**
|
|
33
|
-
* #property
|
|
34
|
-
* show the bookmark labels on this track
|
|
35
|
-
*/
|
|
36
|
-
showBookmarkLabels: true,
|
|
26
|
+
bookmarkHighlightsVisible: true,
|
|
27
|
+
bookmarkLabelsVisible: true,
|
|
37
28
|
})
|
|
38
29
|
.actions(self => ({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
toggleShowBookmarkHighlights(toggle) {
|
|
43
|
-
self.showBookmarkHighlights =
|
|
44
|
-
toggle !== undefined ? toggle : !self.showBookmarkHighlights;
|
|
30
|
+
setBookmarkHighlightsVisible(arg) {
|
|
31
|
+
self.bookmarkHighlightsVisible = arg;
|
|
45
32
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*/
|
|
49
|
-
toggleShowBookmarkLabels(toggle) {
|
|
50
|
-
self.showBookmarkLabels =
|
|
51
|
-
toggle !== undefined ? toggle : !self.showBookmarkLabels;
|
|
33
|
+
setBookmarkLabelsVisible(arg) {
|
|
34
|
+
self.bookmarkLabelsVisible = arg;
|
|
52
35
|
},
|
|
53
36
|
activateBookmarkWidget() {
|
|
54
37
|
const session = (0, util_1.getSession)(self);
|
|
@@ -115,18 +98,18 @@ class GridBookmarkPlugin extends Plugin_1.default {
|
|
|
115
98
|
label: 'Toggle bookmark highlights',
|
|
116
99
|
icon: Highlight_1.default,
|
|
117
100
|
type: 'checkbox',
|
|
118
|
-
checked: self.
|
|
101
|
+
checked: self.bookmarkHighlightsVisible,
|
|
119
102
|
onClick: () => {
|
|
120
|
-
self.
|
|
103
|
+
self.setBookmarkHighlightsVisible(!self.bookmarkHighlightsVisible);
|
|
121
104
|
},
|
|
122
105
|
},
|
|
123
106
|
{
|
|
124
107
|
label: 'Toggle bookmark labels',
|
|
125
108
|
icon: Label_1.default,
|
|
126
109
|
type: 'checkbox',
|
|
127
|
-
checked: self.
|
|
110
|
+
checked: self.bookmarkLabelsVisible,
|
|
128
111
|
onClick: () => {
|
|
129
|
-
self.
|
|
112
|
+
self.setBookmarkLabelsVisible(!self.bookmarkLabelsVisible);
|
|
130
113
|
},
|
|
131
114
|
},
|
|
132
115
|
],
|
|
@@ -159,14 +142,12 @@ class GridBookmarkPlugin extends Plugin_1.default {
|
|
|
159
142
|
afterCreate() {
|
|
160
143
|
document.addEventListener('keydown', e => {
|
|
161
144
|
const activationSequence = (e.ctrlKey || e.metaKey) && e.shiftKey;
|
|
162
|
-
// ctrl+shift+d or cmd+shift+d
|
|
163
145
|
if (activationSequence && e.code === 'KeyD') {
|
|
164
146
|
e.preventDefault();
|
|
165
147
|
self.activateBookmarkWidget();
|
|
166
148
|
self.bookmarkCurrentRegion();
|
|
167
149
|
(0, util_1.getSession)(self).notify('Bookmark created.', 'success');
|
|
168
150
|
}
|
|
169
|
-
// ctrl+shift+m or cmd+shift+m
|
|
170
151
|
if (activationSequence && e.code === 'KeyM') {
|
|
171
152
|
e.preventDefault();
|
|
172
153
|
self.navigateNewestBookmark();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { GridBookmarkModel } from '../model';
|
|
1
|
+
import type { GridBookmarkModel } from '../model';
|
|
3
2
|
declare const AssemblySelector: ({ model, }: {
|
|
4
3
|
model: GridBookmarkModel;
|
|
5
|
-
}) =>
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export default AssemblySelector;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { Checkbox, FormControl, InputLabel, ListItemText, MenuItem, OutlinedInput, Select, } from '@mui/material';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
4
|
const AssemblySelector = observer(function ({ model, }) {
|
|
5
5
|
const { validAssemblies, selectedAssemblies } = model;
|
|
6
6
|
const noAssemblies = validAssemblies.size === 0;
|
|
@@ -8,25 +8,13 @@ const AssemblySelector = observer(function ({ model, }) {
|
|
|
8
8
|
const id = 'select-assemblies-label';
|
|
9
9
|
const selectedSet = new Set(selectedAssemblies);
|
|
10
10
|
const isAllSelected = [...validAssemblies].every(e => selectedSet.has(e));
|
|
11
|
-
return (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
model.setSelectedAssemblies([]);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
model.setSelectedAssemblies(undefined);
|
|
23
|
-
}
|
|
24
|
-
event.preventDefault();
|
|
25
|
-
} },
|
|
26
|
-
React.createElement(Checkbox, { checked: isAllSelected, indeterminate: !isAllSelected && selectedAssemblies.length > 0 }),
|
|
27
|
-
React.createElement(ListItemText, { primary: "Select all" })),
|
|
28
|
-
[...validAssemblies].map(name => (React.createElement(MenuItem, { key: name, value: name },
|
|
29
|
-
React.createElement(Checkbox, { checked: selectedAssemblies.includes(name) }),
|
|
30
|
-
React.createElement(ListItemText, { primary: name })))))));
|
|
11
|
+
return (_jsxs(FormControl, { disabled: noAssemblies, fullWidth: true, children: [_jsx(InputLabel, { id: id, children: label }), _jsxs(Select, { labelId: id, multiple: true, value: selectedAssemblies, onChange: event => {
|
|
12
|
+
model.setSelectedAssemblies(typeof event.target.value === 'string'
|
|
13
|
+
? [event.target.value]
|
|
14
|
+
: event.target.value);
|
|
15
|
+
}, input: _jsx(OutlinedInput, { label: label }), renderValue: selected => selected.join(', '), children: [_jsxs(MenuItem, { onClickCapture: event => {
|
|
16
|
+
model.setSelectedAssemblies(isAllSelected ? [] : undefined);
|
|
17
|
+
event.preventDefault();
|
|
18
|
+
}, children: [_jsx(Checkbox, { checked: isAllSelected, indeterminate: !isAllSelected && selectedAssemblies.length > 0 }), _jsx(ListItemText, { primary: "Select all" })] }), [...validAssemblies].map(name => (_jsxs(MenuItem, { value: name, children: [_jsx(Checkbox, { checked: selectedAssemblies.includes(name) }), _jsx(ListItemText, { primary: name })] }, name)))] })] }));
|
|
31
19
|
});
|
|
32
20
|
export default AssemblySelector;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { GridBookmarkModel } from '../model';
|
|
1
|
+
import type { GridBookmarkModel } from '../model';
|
|
3
2
|
declare const BookmarkGrid: ({ model, }: {
|
|
4
3
|
model: GridBookmarkModel;
|
|
5
|
-
}) =>
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export default BookmarkGrid;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ColorPicker from '@jbrowse/core/ui/ColorPicker';
|
|
3
|
+
import { assembleLocString, getSession, measureGridWidth, measureText, } from '@jbrowse/core/util';
|
|
3
4
|
import { Link } from '@mui/material';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
5
|
import { DataGrid, GRID_CHECKBOX_SELECTION_COL_DEF } from '@mui/x-data-grid';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
// locals
|
|
6
|
+
import { observer } from 'mobx-react';
|
|
7
|
+
import { makeStyles } from 'tss-react/mui';
|
|
9
8
|
import { navToBookmark } from '../utils';
|
|
10
|
-
const EditBookmarkLabelDialog = lazy(() => import('./dialogs/EditBookmarkLabelDialog'));
|
|
11
9
|
const useStyles = makeStyles()(() => ({
|
|
12
10
|
cell: {
|
|
13
11
|
whiteSpace: 'nowrap',
|
|
@@ -39,57 +37,52 @@ const BookmarkGrid = observer(function ({ model, }) {
|
|
|
39
37
|
Math.max(measureText('Assembly', 12) + 30, measureGridWidth(rows.map(row => row.assemblyName))),
|
|
40
38
|
100,
|
|
41
39
|
];
|
|
42
|
-
return (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
model.setSelectedBookmarks(newRowSelectionModel.map(value => ({
|
|
90
|
-
...rows[value],
|
|
91
|
-
})));
|
|
92
|
-
}
|
|
93
|
-
}, rowSelectionModel: selectedBookmarks.map(r => r.id), disableRowSelectionOnClick: true }));
|
|
40
|
+
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsx(DataGrid, { density: "compact", rows: rows, columns: [
|
|
41
|
+
{
|
|
42
|
+
...GRID_CHECKBOX_SELECTION_COL_DEF,
|
|
43
|
+
width: widths[0],
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
field: 'locString',
|
|
47
|
+
headerName: 'Bookmark link',
|
|
48
|
+
width: widths[1],
|
|
49
|
+
renderCell: ({ value, row }) => (_jsx(Link, { className: classes.cell, href: "#", onClick: async (event) => {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
const { views } = session;
|
|
52
|
+
await navToBookmark(value, row.assemblyName, views, model);
|
|
53
|
+
}, children: value })),
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
field: 'label',
|
|
57
|
+
headerName: 'Label',
|
|
58
|
+
width: widths[2],
|
|
59
|
+
editable: true,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
field: 'assemblyName',
|
|
63
|
+
headerName: 'Assembly',
|
|
64
|
+
width: widths[3],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
field: 'highlight',
|
|
68
|
+
headerName: 'Highlight',
|
|
69
|
+
width: widths[4],
|
|
70
|
+
renderCell: ({ value, row }) => (_jsx(ColorPicker, { color: value || 'black', onChange: event => {
|
|
71
|
+
model.updateBookmarkHighlight(row, event);
|
|
72
|
+
} })),
|
|
73
|
+
},
|
|
74
|
+
], processRowUpdate: row => {
|
|
75
|
+
const target = rows[row.id];
|
|
76
|
+
model.updateBookmarkLabel(target, row.label);
|
|
77
|
+
return row;
|
|
78
|
+
}, onProcessRowUpdateError: e => {
|
|
79
|
+
session.notifyError(`${e}`, e);
|
|
80
|
+
}, checkboxSelection: true, onRowSelectionModelChange: newRowSelectionModel => {
|
|
81
|
+
if (bookmarksWithValidAssemblies.length > 0) {
|
|
82
|
+
model.setSelectedBookmarks(newRowSelectionModel.map(value => ({
|
|
83
|
+
...rows[value],
|
|
84
|
+
})));
|
|
85
|
+
}
|
|
86
|
+
}, rowSelectionModel: selectedBookmarks.map(r => r.id), disableRowSelectionOnClick: true }) }));
|
|
94
87
|
});
|
|
95
88
|
export default BookmarkGrid;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { GridBookmarkModel } from '../model';
|
|
1
|
+
import type { GridBookmarkModel } from '../model';
|
|
3
2
|
declare const GridBookmarkWidget: ({ model, }: {
|
|
4
3
|
model: GridBookmarkModel;
|
|
5
|
-
}) =>
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export default GridBookmarkWidget;
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { makeStyles } from 'tss-react/mui';
|
|
4
|
-
import { getSession } from '@jbrowse/core/util';
|
|
5
|
-
import { Alert } from '@mui/material';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { lazy } from 'react';
|
|
6
3
|
import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import AssemblySelector from './AssemblySelector';
|
|
10
|
-
// icons
|
|
11
|
-
import Menu from '@mui/icons-material/Menu';
|
|
4
|
+
import { getSession } from '@jbrowse/core/util';
|
|
5
|
+
import Delete from '@mui/icons-material/Delete';
|
|
12
6
|
import GetApp from '@mui/icons-material/GetApp';
|
|
7
|
+
import Menu from '@mui/icons-material/Menu';
|
|
8
|
+
import Palette from '@mui/icons-material/Palette';
|
|
13
9
|
import Publish from '@mui/icons-material/Publish';
|
|
14
10
|
import Settings from '@mui/icons-material/Settings';
|
|
15
|
-
import Palette from '@mui/icons-material/Palette';
|
|
16
11
|
import Share from '@mui/icons-material/Share';
|
|
17
|
-
import
|
|
18
|
-
|
|
12
|
+
import { Alert } from '@mui/material';
|
|
13
|
+
import { observer } from 'mobx-react';
|
|
14
|
+
import { makeStyles } from 'tss-react/mui';
|
|
15
|
+
import AssemblySelector from './AssemblySelector';
|
|
16
|
+
import BookmarkGrid from './BookmarkGrid';
|
|
19
17
|
const ExportBookmarksDialog = lazy(() => import('./dialogs/ExportBookmarksDialog'));
|
|
20
18
|
const ImportBookmarksDialog = lazy(() => import('./dialogs/ImportBookmarksDialog'));
|
|
21
19
|
const ShareBookmarksDialog = lazy(() => import('./dialogs/ShareBookmarksDialog'));
|
|
@@ -29,78 +27,67 @@ const useStyles = makeStyles()({
|
|
|
29
27
|
});
|
|
30
28
|
const GridBookmarkWidget = observer(function GridBookmarkWidget({ model, }) {
|
|
31
29
|
const { classes } = useStyles();
|
|
32
|
-
return (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
onClick: () => {
|
|
95
|
-
getSession(model).queueDialog(onClose => [
|
|
96
|
-
HighlightSettingsDialog,
|
|
97
|
-
{ model, onClose },
|
|
98
|
-
]);
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
] },
|
|
102
|
-
React.createElement(Menu, null)),
|
|
103
|
-
React.createElement(AssemblySelector, { model: model })),
|
|
104
|
-
React.createElement(BookmarkGrid, { model: model })));
|
|
30
|
+
return (_jsxs("div", { children: [_jsxs(Alert, { severity: "info", children: ["Click and type within the ", _jsx("strong", { children: "label" }), " field to annotate your bookmark. Double click the ", _jsx("strong", { children: "label" }), " field to do so within a dialog."] }), _jsxs("div", { className: classes.flex, children: [_jsx(CascadingMenuButton, { "data-testid": "grid_bookmark_menu", menuItems: [
|
|
31
|
+
{
|
|
32
|
+
label: 'Export',
|
|
33
|
+
icon: GetApp,
|
|
34
|
+
onClick: () => {
|
|
35
|
+
getSession(model).queueDialog(onClose => [
|
|
36
|
+
ExportBookmarksDialog,
|
|
37
|
+
{ onClose, model },
|
|
38
|
+
]);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: 'Import',
|
|
43
|
+
icon: Publish,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
getSession(model).queueDialog(onClose => [
|
|
46
|
+
ImportBookmarksDialog,
|
|
47
|
+
{ model, onClose },
|
|
48
|
+
]);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
label: 'Delete',
|
|
53
|
+
icon: Delete,
|
|
54
|
+
onClick: () => {
|
|
55
|
+
getSession(model).queueDialog(onClose => [
|
|
56
|
+
DeleteBookmarksDialog,
|
|
57
|
+
{ model, onClose },
|
|
58
|
+
]);
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: 'Share',
|
|
63
|
+
icon: Share,
|
|
64
|
+
onClick: () => {
|
|
65
|
+
getSession(model).queueDialog(onClose => [
|
|
66
|
+
ShareBookmarksDialog,
|
|
67
|
+
{ model, onClose },
|
|
68
|
+
]);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: 'Edit colors',
|
|
73
|
+
icon: Palette,
|
|
74
|
+
onClick: () => {
|
|
75
|
+
getSession(model).queueDialog(onClose => [
|
|
76
|
+
EditHighlightColorDialog,
|
|
77
|
+
{ model, onClose },
|
|
78
|
+
]);
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
label: 'Settings',
|
|
83
|
+
icon: Settings,
|
|
84
|
+
onClick: () => {
|
|
85
|
+
getSession(model).queueDialog(onClose => [
|
|
86
|
+
HighlightSettingsDialog,
|
|
87
|
+
{ model, onClose },
|
|
88
|
+
]);
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
], children: _jsx(Menu, {}) }), _jsx(AssemblySelector, { model: model })] }), _jsx(BookmarkGrid, { model: model })] }));
|
|
105
92
|
});
|
|
106
93
|
export default GridBookmarkWidget;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IExtendedLGV } from '../../model';
|
|
1
|
+
import type { IExtendedLGV } from '../../model';
|
|
3
2
|
type LGV = IExtendedLGV;
|
|
4
3
|
declare const Highlight: ({ model }: {
|
|
5
4
|
model: LGV;
|
|
6
|
-
}) =>
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element[] | null;
|
|
7
6
|
export default Highlight;
|