@jbrowse/plugin-grid-bookmark 2.8.0 → 2.10.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/BookmarkGrid.js +57 -48
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.js +110 -15
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.d.ts +7 -0
- package/dist/GridBookmarkWidget/components/Highlight/Highlight.js +92 -0
- package/dist/GridBookmarkWidget/components/Highlight/index.d.ts +2 -0
- package/dist/GridBookmarkWidget/components/Highlight/index.js +19 -0
- package/dist/GridBookmarkWidget/components/{DeleteBookmarksDialog.d.ts → dialogs/DeleteBookmarksDialog.d.ts} +1 -1
- package/{esm/GridBookmarkWidget/components → dist/GridBookmarkWidget/components/dialogs}/EditBookmarkLabelDialog.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +7 -0
- package/dist/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +48 -0
- package/dist/GridBookmarkWidget/components/{ExportBookmarksDialog.d.ts → dialogs/ExportBookmarksDialog.d.ts} +1 -1
- package/dist/GridBookmarkWidget/components/{ExportBookmarksDialog.js → dialogs/ExportBookmarksDialog.js} +12 -6
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +7 -0
- package/dist/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +27 -0
- package/{esm/GridBookmarkWidget/components → dist/GridBookmarkWidget/components/dialogs}/ImportBookmarksDialog.d.ts +1 -1
- package/dist/GridBookmarkWidget/components/{ImportBookmarksDialog.js → dialogs/ImportBookmarksDialog.js} +2 -2
- package/dist/GridBookmarkWidget/components/{ShareBookmarksDialog.d.ts → dialogs/ShareBookmarksDialog.d.ts} +1 -1
- package/dist/GridBookmarkWidget/components/{ShareBookmarksDialog.js → dialogs/ShareBookmarksDialog.js} +1 -1
- package/dist/GridBookmarkWidget/index.js +3 -0
- package/dist/GridBookmarkWidget/model.d.ts +101 -0
- package/dist/GridBookmarkWidget/model.js +109 -5
- package/dist/index.js +55 -7
- package/esm/GridBookmarkWidget/components/BookmarkGrid.js +58 -49
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.js +87 -15
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.d.ts +7 -0
- package/esm/GridBookmarkWidget/components/Highlight/Highlight.js +64 -0
- package/esm/GridBookmarkWidget/components/Highlight/index.d.ts +2 -0
- package/esm/GridBookmarkWidget/components/Highlight/index.js +13 -0
- package/esm/GridBookmarkWidget/components/{DeleteBookmarksDialog.d.ts → dialogs/DeleteBookmarksDialog.d.ts} +1 -1
- package/{dist/GridBookmarkWidget/components → esm/GridBookmarkWidget/components/dialogs}/EditBookmarkLabelDialog.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.d.ts +7 -0
- package/esm/GridBookmarkWidget/components/dialogs/EditHighlightColorDialog.js +23 -0
- package/esm/GridBookmarkWidget/components/{ExportBookmarksDialog.d.ts → dialogs/ExportBookmarksDialog.d.ts} +1 -1
- package/esm/GridBookmarkWidget/components/{ExportBookmarksDialog.js → dialogs/ExportBookmarksDialog.js} +12 -6
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.d.ts +7 -0
- package/esm/GridBookmarkWidget/components/dialogs/HighlightSettingsDialog.js +22 -0
- package/{dist/GridBookmarkWidget/components → esm/GridBookmarkWidget/components/dialogs}/ImportBookmarksDialog.d.ts +1 -1
- package/esm/GridBookmarkWidget/components/{ImportBookmarksDialog.js → dialogs/ImportBookmarksDialog.js} +2 -2
- package/esm/GridBookmarkWidget/components/{ShareBookmarksDialog.d.ts → dialogs/ShareBookmarksDialog.d.ts} +1 -1
- package/esm/GridBookmarkWidget/components/{ShareBookmarksDialog.js → dialogs/ShareBookmarksDialog.js} +1 -1
- package/esm/GridBookmarkWidget/index.js +3 -0
- package/esm/GridBookmarkWidget/model.d.ts +101 -0
- package/esm/GridBookmarkWidget/model.js +109 -5
- package/esm/index.js +55 -7
- package/package.json +2 -2
- package/dist/GridBookmarkWidget/components/DeleteBookmarks.d.ts +0 -6
- package/dist/GridBookmarkWidget/components/DeleteBookmarks.js +0 -41
- package/dist/GridBookmarkWidget/components/ExportBookmarks.d.ts +0 -6
- package/dist/GridBookmarkWidget/components/ExportBookmarks.js +0 -41
- package/dist/GridBookmarkWidget/components/ImportBookmarks.d.ts +0 -6
- package/dist/GridBookmarkWidget/components/ImportBookmarks.js +0 -42
- package/dist/GridBookmarkWidget/components/ShareBookmarks.d.ts +0 -6
- package/dist/GridBookmarkWidget/components/ShareBookmarks.js +0 -37
- package/esm/GridBookmarkWidget/components/DeleteBookmarks.d.ts +0 -6
- package/esm/GridBookmarkWidget/components/DeleteBookmarks.js +0 -13
- package/esm/GridBookmarkWidget/components/ExportBookmarks.d.ts +0 -6
- package/esm/GridBookmarkWidget/components/ExportBookmarks.js +0 -13
- package/esm/GridBookmarkWidget/components/ImportBookmarks.d.ts +0 -6
- package/esm/GridBookmarkWidget/components/ImportBookmarks.js +0 -14
- package/esm/GridBookmarkWidget/components/ShareBookmarks.d.ts +0 -6
- package/esm/GridBookmarkWidget/components/ShareBookmarks.js +0 -12
- /package/dist/GridBookmarkWidget/components/{DeleteBookmarksDialog.js → dialogs/DeleteBookmarksDialog.js} +0 -0
- /package/dist/GridBookmarkWidget/components/{EditBookmarkLabelDialog.js → dialogs/EditBookmarkLabelDialog.js} +0 -0
- /package/esm/GridBookmarkWidget/components/{DeleteBookmarksDialog.js → dialogs/DeleteBookmarksDialog.js} +0 -0
- /package/esm/GridBookmarkWidget/components/{EditBookmarkLabelDialog.js → dialogs/EditBookmarkLabelDialog.js} +0 -0
|
@@ -32,11 +32,12 @@ const material_1 = require("@mui/material");
|
|
|
32
32
|
const mui_1 = require("tss-react/mui");
|
|
33
33
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
34
34
|
const util_1 = require("@jbrowse/core/util");
|
|
35
|
-
// locals
|
|
36
|
-
const utils_1 = require("../utils");
|
|
37
35
|
const useResizeBar_1 = require("@jbrowse/core/ui/useResizeBar");
|
|
38
36
|
const ResizeBar_1 = __importDefault(require("@jbrowse/core/ui/ResizeBar"));
|
|
39
|
-
const
|
|
37
|
+
const ColorPicker_1 = __importDefault(require("@jbrowse/core/ui/ColorPicker"));
|
|
38
|
+
// locals
|
|
39
|
+
const utils_1 = require("../utils");
|
|
40
|
+
const EditBookmarkLabelDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./dialogs/EditBookmarkLabelDialog'))));
|
|
40
41
|
const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
41
42
|
link: {
|
|
42
43
|
cursor: 'pointer',
|
|
@@ -49,7 +50,6 @@ const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
|
49
50
|
}));
|
|
50
51
|
const BookmarkGrid = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
51
52
|
const { classes, cx } = useStyles();
|
|
52
|
-
const [dialogRow, setDialogRow] = (0, react_1.useState)();
|
|
53
53
|
const { ref, scrollLeft } = (0, useResizeBar_1.useResizeBar)();
|
|
54
54
|
const { bookmarks, bookmarksWithValidAssemblies, selectedAssemblies, selectedBookmarks, } = model;
|
|
55
55
|
const session = (0, util_1.getSession)(model);
|
|
@@ -66,55 +66,64 @@ const BookmarkGrid = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
|
66
66
|
correspondingObj: region,
|
|
67
67
|
};
|
|
68
68
|
});
|
|
69
|
-
// reset selections if bookmarked regions change
|
|
70
|
-
// needed especially if bookmarked regions are deleted, then
|
|
71
69
|
const [widths, setWidths] = (0, react_1.useState)([
|
|
72
70
|
50,
|
|
73
71
|
Math.max((0, util_1.measureText)('Bookmark link', 12) + 30, (0, util_1.measureGridWidth)(rows.map(row => row.locString))),
|
|
74
72
|
Math.max((0, util_1.measureText)('Label', 12) + 30, (0, util_1.measureGridWidth)(rows.map(row => row.label))),
|
|
75
73
|
Math.max((0, util_1.measureText)('Assembly', 12) + 30, (0, util_1.measureGridWidth)(rows.map(row => row.assemblyName))),
|
|
74
|
+
100,
|
|
76
75
|
]);
|
|
77
|
-
return (react_1.default.createElement(
|
|
78
|
-
react_1.default.createElement(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
76
|
+
return (react_1.default.createElement("div", { ref: ref },
|
|
77
|
+
react_1.default.createElement(ResizeBar_1.default, { widths: widths, setWidths: setWidths, scrollLeft: scrollLeft }),
|
|
78
|
+
react_1.default.createElement(x_data_grid_1.DataGrid, { autoHeight: true, density: "compact", rows: rows, columns: [
|
|
79
|
+
{
|
|
80
|
+
...x_data_grid_1.GRID_CHECKBOX_SELECTION_COL_DEF,
|
|
81
|
+
width: widths[0],
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
field: 'locString',
|
|
85
|
+
headerName: 'Bookmark link',
|
|
86
|
+
width: widths[1],
|
|
87
|
+
renderCell: ({ value, row }) => (react_1.default.createElement(material_1.Link, { className: cx(classes.link, classes.cell), href: "#", onClick: async (event) => {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
const { views } = session;
|
|
90
|
+
await (0, utils_1.navToBookmark)(value, row.assemblyName, views, model);
|
|
91
|
+
} }, value)),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
field: 'label',
|
|
95
|
+
headerName: 'Label',
|
|
96
|
+
width: widths[2],
|
|
97
|
+
editable: true,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
field: 'assemblyName',
|
|
101
|
+
headerName: 'Assembly',
|
|
102
|
+
width: widths[3],
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
field: 'highlight',
|
|
106
|
+
headerName: 'Highlight',
|
|
107
|
+
width: widths[4],
|
|
108
|
+
renderCell: ({ value, row }) => (react_1.default.createElement(ColorPicker_1.default, { color: value || 'black', onChange: event => {
|
|
109
|
+
model.updateBookmarkHighlight(row, event);
|
|
110
|
+
} })),
|
|
111
|
+
},
|
|
112
|
+
], onCellDoubleClick: ({ row }) => {
|
|
113
|
+
(0, util_1.getSession)(model).queueDialog(onClose => [
|
|
114
|
+
EditBookmarkLabelDialog,
|
|
115
|
+
{ onClose, model, dialogRow: row },
|
|
116
|
+
]);
|
|
117
|
+
}, processRowUpdate: row => {
|
|
118
|
+
const target = rows[row.id];
|
|
119
|
+
model.updateBookmarkLabel(target, row.label);
|
|
120
|
+
return row;
|
|
121
|
+
}, onProcessRowUpdateError: e => session.notify(e.message, 'error'), checkboxSelection: true, onRowSelectionModelChange: newRowSelectionModel => {
|
|
122
|
+
if (bookmarksWithValidAssemblies.length > 0) {
|
|
123
|
+
model.setSelectedBookmarks(newRowSelectionModel.map(value => ({
|
|
124
|
+
...rows[value],
|
|
125
|
+
})));
|
|
126
|
+
}
|
|
127
|
+
}, rowSelectionModel: selectedBookmarks.map(r => r.id), disableRowSelectionOnClick: true })));
|
|
119
128
|
});
|
|
120
129
|
exports.default = BookmarkGrid;
|
|
@@ -1,22 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 =
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
7
30
|
const mobx_react_1 = require("mobx-react");
|
|
8
|
-
const material_1 = require("@mui/material");
|
|
9
31
|
const mui_1 = require("tss-react/mui");
|
|
32
|
+
const util_1 = require("@jbrowse/core/util");
|
|
33
|
+
const material_1 = require("@mui/material");
|
|
34
|
+
const CascadingMenuButton_1 = __importDefault(require("@jbrowse/core/ui/CascadingMenuButton"));
|
|
10
35
|
// locals
|
|
11
36
|
const BookmarkGrid_1 = __importDefault(require("./BookmarkGrid"));
|
|
12
|
-
const DeleteBookmarks_1 = __importDefault(require("./DeleteBookmarks"));
|
|
13
|
-
const ExportBookmarks_1 = __importDefault(require("./ExportBookmarks"));
|
|
14
|
-
const ImportBookmarks_1 = __importDefault(require("./ImportBookmarks"));
|
|
15
37
|
const AssemblySelector_1 = __importDefault(require("./AssemblySelector"));
|
|
16
|
-
|
|
38
|
+
// icons
|
|
39
|
+
const Menu_1 = __importDefault(require("@mui/icons-material/Menu"));
|
|
40
|
+
const GetApp_1 = __importDefault(require("@mui/icons-material/GetApp"));
|
|
41
|
+
const Publish_1 = __importDefault(require("@mui/icons-material/Publish"));
|
|
42
|
+
const Settings_1 = __importDefault(require("@mui/icons-material/Settings"));
|
|
43
|
+
const Palette_1 = __importDefault(require("@mui/icons-material/Palette"));
|
|
44
|
+
const Share_1 = __importDefault(require("@mui/icons-material/Share"));
|
|
45
|
+
const Delete_1 = __importDefault(require("@mui/icons-material/Delete"));
|
|
46
|
+
// lazies
|
|
47
|
+
const ExportBookmarksDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./dialogs/ExportBookmarksDialog'))));
|
|
48
|
+
const ImportBookmarksDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./dialogs/ImportBookmarksDialog'))));
|
|
49
|
+
const ShareBookmarksDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./dialogs/ShareBookmarksDialog'))));
|
|
50
|
+
const HighlightSettingsDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./dialogs/HighlightSettingsDialog'))));
|
|
51
|
+
const EditHighlightColorDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./dialogs/EditHighlightColorDialog'))));
|
|
52
|
+
const DeleteBookmarksDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./dialogs/DeleteBookmarksDialog'))));
|
|
17
53
|
const useStyles = (0, mui_1.makeStyles)()({
|
|
18
|
-
|
|
19
|
-
|
|
54
|
+
flex: {
|
|
55
|
+
display: 'flex',
|
|
20
56
|
},
|
|
21
57
|
});
|
|
22
58
|
const GridBookmarkWidget = (0, mobx_react_1.observer)(function GridBookmarkWidget({ model, }) {
|
|
@@ -24,19 +60,78 @@ const GridBookmarkWidget = (0, mobx_react_1.observer)(function GridBookmarkWidge
|
|
|
24
60
|
if (!model) {
|
|
25
61
|
return null;
|
|
26
62
|
}
|
|
27
|
-
return (react_1.default.createElement("div",
|
|
28
|
-
react_1.default.createElement("div", null,
|
|
29
|
-
react_1.default.createElement(ExportBookmarks_1.default, { model: model }),
|
|
30
|
-
react_1.default.createElement(ImportBookmarks_1.default, { model: model }),
|
|
31
|
-
react_1.default.createElement(ShareBookmarks_1.default, { model: model }),
|
|
32
|
-
react_1.default.createElement(DeleteBookmarks_1.default, { model: model })),
|
|
63
|
+
return (react_1.default.createElement("div", null,
|
|
33
64
|
react_1.default.createElement(material_1.Alert, { severity: "info" },
|
|
34
65
|
"Click and type within the ",
|
|
35
66
|
react_1.default.createElement("strong", null, "label"),
|
|
36
67
|
" field to annotate your bookmark. Double click the ",
|
|
37
68
|
react_1.default.createElement("strong", null, "label"),
|
|
38
69
|
" field to do so within a dialog."),
|
|
39
|
-
react_1.default.createElement(
|
|
70
|
+
react_1.default.createElement("div", { className: classes.flex },
|
|
71
|
+
react_1.default.createElement(CascadingMenuButton_1.default, { "data-testid": "grid_bookmark_menu", menuItems: [
|
|
72
|
+
{
|
|
73
|
+
label: 'Export bookmarks',
|
|
74
|
+
icon: GetApp_1.default,
|
|
75
|
+
onClick: () => {
|
|
76
|
+
(0, util_1.getSession)(model).queueDialog(onClose => [
|
|
77
|
+
ExportBookmarksDialog,
|
|
78
|
+
{ onClose, model },
|
|
79
|
+
]);
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: 'Import',
|
|
84
|
+
icon: Publish_1.default,
|
|
85
|
+
onClick: () => {
|
|
86
|
+
(0, util_1.getSession)(model).queueDialog(onClose => [
|
|
87
|
+
ImportBookmarksDialog,
|
|
88
|
+
{ model, onClose },
|
|
89
|
+
]);
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: 'Delete',
|
|
94
|
+
icon: Delete_1.default,
|
|
95
|
+
onClick: () => {
|
|
96
|
+
(0, util_1.getSession)(model).queueDialog(onClose => [
|
|
97
|
+
DeleteBookmarksDialog,
|
|
98
|
+
{ model, onClose },
|
|
99
|
+
]);
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
label: 'Share',
|
|
104
|
+
icon: Share_1.default,
|
|
105
|
+
onClick: () => {
|
|
106
|
+
(0, util_1.getSession)(model).queueDialog(onClose => [
|
|
107
|
+
ShareBookmarksDialog,
|
|
108
|
+
{ model, onClose },
|
|
109
|
+
]);
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: 'Edit colors',
|
|
114
|
+
icon: Palette_1.default,
|
|
115
|
+
onClick: () => {
|
|
116
|
+
(0, util_1.getSession)(model).queueDialog(onClose => [
|
|
117
|
+
EditHighlightColorDialog,
|
|
118
|
+
{ model, onClose },
|
|
119
|
+
]);
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
label: 'Settings',
|
|
124
|
+
icon: Settings_1.default,
|
|
125
|
+
onClick: () => {
|
|
126
|
+
(0, util_1.getSession)(model).queueDialog(onClose => [
|
|
127
|
+
HighlightSettingsDialog,
|
|
128
|
+
{ model, onClose },
|
|
129
|
+
]);
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
] },
|
|
133
|
+
react_1.default.createElement(Menu_1.default, null)),
|
|
134
|
+
react_1.default.createElement(AssemblySelector_1.default, { model: model })),
|
|
40
135
|
react_1.default.createElement(BookmarkGrid_1.default, { model: model })));
|
|
41
136
|
});
|
|
42
137
|
exports.default = GridBookmarkWidget;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const mobx_react_1 = require("mobx-react");
|
|
31
|
+
const mui_1 = require("tss-react/mui");
|
|
32
|
+
const util_1 = require("@jbrowse/core/util");
|
|
33
|
+
const colord_1 = require("@jbrowse/core/util/colord");
|
|
34
|
+
// icons
|
|
35
|
+
const Bookmark_1 = __importDefault(require("@mui/icons-material/Bookmark"));
|
|
36
|
+
// locals
|
|
37
|
+
const material_1 = require("@mui/material");
|
|
38
|
+
const useStyles = (0, mui_1.makeStyles)()({
|
|
39
|
+
highlight: {
|
|
40
|
+
height: '100%',
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
textAlign: 'center',
|
|
43
|
+
overflow: 'hidden',
|
|
44
|
+
display: 'flex',
|
|
45
|
+
alignItems: 'start',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
const Highlight = (0, mobx_react_1.observer)(function Highlight({ model }) {
|
|
49
|
+
var _a;
|
|
50
|
+
const { classes } = useStyles();
|
|
51
|
+
const session = (0, util_1.getSession)(model);
|
|
52
|
+
const { showBookmarkHighlights, showBookmarkLabels } = model;
|
|
53
|
+
const assemblyNames = new Set(session.assemblyNames);
|
|
54
|
+
const bookmarkWidget = session.widgets.get('GridBookmark');
|
|
55
|
+
const bookmarks = (0, react_1.useRef)((_a = bookmarkWidget === null || bookmarkWidget === void 0 ? void 0 : bookmarkWidget.bookmarks) !== null && _a !== void 0 ? _a : []);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
if (!bookmarkWidget) {
|
|
58
|
+
const newBookmarkWidget = session.addWidget('GridBookmarkWidget', 'GridBookmark');
|
|
59
|
+
bookmarks.current = newBookmarkWidget.bookmarks;
|
|
60
|
+
}
|
|
61
|
+
}, [session, bookmarkWidget]);
|
|
62
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, showBookmarkHighlights && bookmarks.current
|
|
63
|
+
? bookmarks.current
|
|
64
|
+
.filter(value => assemblyNames.has(value.assemblyName))
|
|
65
|
+
.map(r => {
|
|
66
|
+
const s = model.bpToPx({
|
|
67
|
+
refName: r.refName,
|
|
68
|
+
coord: r.start,
|
|
69
|
+
});
|
|
70
|
+
const e = model.bpToPx({
|
|
71
|
+
refName: r.refName,
|
|
72
|
+
coord: r.end,
|
|
73
|
+
});
|
|
74
|
+
return s && e
|
|
75
|
+
? {
|
|
76
|
+
width: Math.max(Math.abs(e.offsetPx - s.offsetPx), 3),
|
|
77
|
+
left: Math.min(s.offsetPx, e.offsetPx) - model.offsetPx,
|
|
78
|
+
highlight: r.highlight,
|
|
79
|
+
label: r.label,
|
|
80
|
+
}
|
|
81
|
+
: undefined;
|
|
82
|
+
})
|
|
83
|
+
.filter(util_1.notEmpty)
|
|
84
|
+
.map(({ left, width, highlight, label }, idx) => (react_1.default.createElement("div", { key: `${left}_${width}_${idx}`, className: classes.highlight, style: { left, width, background: highlight } }, showBookmarkLabels ? (react_1.default.createElement(material_1.Tooltip, { title: label, arrow: true },
|
|
85
|
+
react_1.default.createElement(Bookmark_1.default, { fontSize: "small", sx: {
|
|
86
|
+
color: `${(0, colord_1.colord)(highlight).alpha() !== 0
|
|
87
|
+
? (0, colord_1.colord)(highlight).alpha(0.8).toRgbString()
|
|
88
|
+
: (0, colord_1.colord)(highlight).alpha(0).toRgbString()}`,
|
|
89
|
+
} }))) : null)))
|
|
90
|
+
: null));
|
|
91
|
+
});
|
|
92
|
+
exports.default = Highlight;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
// locals
|
|
8
|
+
const Highlight_1 = __importDefault(require("./Highlight"));
|
|
9
|
+
function AddHighlightModelF(pluginManager) {
|
|
10
|
+
pluginManager.addToExtensionPoint('LinearGenomeView-TracksContainerComponent',
|
|
11
|
+
// @ts-expect-error
|
|
12
|
+
(rest = [], { model }) => {
|
|
13
|
+
return [
|
|
14
|
+
...rest,
|
|
15
|
+
react_1.default.createElement(Highlight_1.default, { key: `highlight_grid_bookmark`, model: model }),
|
|
16
|
+
];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
exports.default = AddHighlightModelF;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { GridBookmarkModel, IExtendedLabeledRegionModel } from '
|
|
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,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
|
+
const mobx_react_1 = require("mobx-react");
|
|
28
|
+
const material_1 = require("@mui/material");
|
|
29
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
30
|
+
const ColorPicker_1 = require("@jbrowse/core/ui/ColorPicker");
|
|
31
|
+
const EditHighlightColorDialog = (0, mobx_react_1.observer)(function ({ onClose, model, }) {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const { selectedBookmarks } = model;
|
|
34
|
+
const editNone = selectedBookmarks.length === 0;
|
|
35
|
+
const [color, setColor] = (0, react_1.useState)((_b = (_a = selectedBookmarks[0]) === null || _a === void 0 ? void 0 : _a.highlight) !== null && _b !== void 0 ? _b : 'rgba(247, 129, 192, 0.35)');
|
|
36
|
+
return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: onClose, title: "Highlight bookmarks" },
|
|
37
|
+
react_1.default.createElement(material_1.DialogContent, null,
|
|
38
|
+
react_1.default.createElement(material_1.Typography, { variant: "h6" }, "Bulk highlight selector"),
|
|
39
|
+
react_1.default.createElement(material_1.Alert, { severity: "info" }, editNone ? (react_1.default.createElement("span", null, "Use the checkboxes to select individual bookmarks to edit.")) : ('Only selected bookmarks will be edited.')),
|
|
40
|
+
!editNone ? (react_1.default.createElement(ColorPicker_1.ColorPicker, { color: color, onChange: event => setColor(event) })) : null),
|
|
41
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
42
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => onClose() }, "Cancel"),
|
|
43
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", onClick: () => {
|
|
44
|
+
model.updateBulkBookmarkHighlights(color);
|
|
45
|
+
onClose();
|
|
46
|
+
} }, "Confirm"))));
|
|
47
|
+
});
|
|
48
|
+
exports.default = EditHighlightColorDialog;
|
|
@@ -29,22 +29,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const mobx_react_1 = require("mobx-react");
|
|
31
31
|
const material_1 = require("@mui/material");
|
|
32
|
-
const GetApp_1 = __importDefault(require("@mui/icons-material/GetApp"));
|
|
33
32
|
const mui_1 = require("tss-react/mui");
|
|
34
33
|
const ui_1 = require("@jbrowse/core/ui");
|
|
35
|
-
|
|
36
|
-
const
|
|
34
|
+
// Icons
|
|
35
|
+
const GetApp_1 = __importDefault(require("@mui/icons-material/GetApp"));
|
|
36
|
+
const utils_1 = require("../../utils");
|
|
37
|
+
const useStyles = (0, mui_1.makeStyles)()({
|
|
37
38
|
flexItem: {
|
|
38
39
|
margin: 5,
|
|
39
40
|
},
|
|
40
|
-
|
|
41
|
+
container: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexFlow: 'column',
|
|
44
|
+
gap: '5px',
|
|
45
|
+
},
|
|
46
|
+
});
|
|
41
47
|
const ExportBookmarksDialog = (0, mobx_react_1.observer)(function ExportBookmarksDialog({ model, onClose, }) {
|
|
42
48
|
const { classes } = useStyles();
|
|
43
49
|
const [fileType, setFileType] = (0, react_1.useState)('BED');
|
|
44
50
|
const { selectedBookmarks } = model;
|
|
45
51
|
const exportAll = selectedBookmarks.length === 0;
|
|
46
52
|
return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: onClose, title: "Export bookmarks" },
|
|
47
|
-
react_1.default.createElement(material_1.DialogContent, {
|
|
53
|
+
react_1.default.createElement(material_1.DialogContent, { className: classes.container },
|
|
48
54
|
react_1.default.createElement(material_1.Alert, { severity: "info" }, exportAll ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
49
55
|
react_1.default.createElement("span", null, "All bookmarks will be exported."),
|
|
50
56
|
react_1.default.createElement("br", null),
|
|
@@ -55,7 +61,7 @@ const ExportBookmarksDialog = (0, mobx_react_1.observer)(function ExportBookmark
|
|
|
55
61
|
react_1.default.createElement(material_1.MenuItem, { value: "BED" }, "BED"),
|
|
56
62
|
react_1.default.createElement(material_1.MenuItem, { value: "TSV" }, "TSV")))),
|
|
57
63
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
58
|
-
react_1.default.createElement(material_1.Button, {
|
|
64
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", startIcon: react_1.default.createElement(GetApp_1.default, null), onClick: () => {
|
|
59
65
|
(0, utils_1.downloadBookmarkFile)(fileType, model);
|
|
60
66
|
onClose(false);
|
|
61
67
|
} }, "Download"))));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const mobx_react_1 = require("mobx-react");
|
|
8
|
+
const material_1 = require("@mui/material");
|
|
9
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
10
|
+
const HighlightSettingsDialog = (0, mobx_react_1.observer)(function ({ onClose, model, }) {
|
|
11
|
+
return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: onClose, title: "Highlight bookmarks" },
|
|
12
|
+
react_1.default.createElement(material_1.DialogContent, null,
|
|
13
|
+
react_1.default.createElement(material_1.Typography, { variant: "h6" }, "Highlight toggles"),
|
|
14
|
+
react_1.default.createElement(material_1.Stack, { direction: "row", alignItems: "center" },
|
|
15
|
+
react_1.default.createElement(material_1.Switch, { "data-testid": "toggle_highlight_all_switch", checked: model.areBookmarksHighlightedOnAllOpenViews, onChange: () => {
|
|
16
|
+
model.setHighlightToggle(!model.areBookmarksHighlightedOnAllOpenViews);
|
|
17
|
+
} }),
|
|
18
|
+
react_1.default.createElement(material_1.Typography, null, "Toggle bookmark highlights on all open views")),
|
|
19
|
+
react_1.default.createElement(material_1.Stack, { direction: "row", alignItems: "center" },
|
|
20
|
+
react_1.default.createElement(material_1.Switch, { "data-testid": "toggle_highlight_label_all_switch", checked: model.areBookmarksHighlightLabelsOnAllOpenViews, onChange: () => {
|
|
21
|
+
model.setLabelToggle(!model.areBookmarksHighlightLabelsOnAllOpenViews);
|
|
22
|
+
} }),
|
|
23
|
+
react_1.default.createElement(material_1.Typography, null, "Toggle 'bookmark' icon on LGV tracks"))),
|
|
24
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
25
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", onClick: () => onClose() }, "Close"))));
|
|
26
|
+
});
|
|
27
|
+
exports.default = HighlightSettingsDialog;
|
|
@@ -40,8 +40,8 @@ const mui_1 = require("tss-react/mui");
|
|
|
40
40
|
const Publish_1 = __importDefault(require("@mui/icons-material/Publish"));
|
|
41
41
|
const ExpandMore_1 = __importDefault(require("@mui/icons-material/ExpandMore"));
|
|
42
42
|
const Help_1 = __importDefault(require("@mui/icons-material/Help"));
|
|
43
|
-
const utils_1 = require("
|
|
44
|
-
const sessionSharing_1 = require("
|
|
43
|
+
const utils_1 = require("../../utils");
|
|
44
|
+
const sessionSharing_1 = require("../../sessionSharing");
|
|
45
45
|
const useStyles = (0, mui_1.makeStyles)()(theme => {
|
|
46
46
|
var _a;
|
|
47
47
|
return ({
|
|
@@ -36,7 +36,7 @@ const util_1 = require("@jbrowse/core/util");
|
|
|
36
36
|
const ui_1 = require("@jbrowse/core/ui");
|
|
37
37
|
const Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
38
38
|
// locals
|
|
39
|
-
const sessionSharing_1 = require("
|
|
39
|
+
const sessionSharing_1 = require("../../sessionSharing");
|
|
40
40
|
const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
41
41
|
flexItem: {
|
|
42
42
|
margin: 5,
|
|
@@ -29,7 +29,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const react_1 = require("react");
|
|
30
30
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
31
31
|
const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
|
|
32
|
+
// locals
|
|
32
33
|
const model_1 = __importDefault(require("./model"));
|
|
34
|
+
const Highlight_1 = __importDefault(require("./components/Highlight"));
|
|
33
35
|
const configSchema = (0, configuration_1.ConfigurationSchema)('GridBookmarkWidget', {});
|
|
34
36
|
exports.default = (pluginManager) => {
|
|
35
37
|
pluginManager.addWidgetType(() => {
|
|
@@ -41,4 +43,5 @@ exports.default = (pluginManager) => {
|
|
|
41
43
|
ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/GridBookmarkWidget')))),
|
|
42
44
|
});
|
|
43
45
|
});
|
|
46
|
+
(0, Highlight_1.default)(pluginManager);
|
|
44
47
|
};
|