@jbrowse/plugin-grid-bookmark 3.1.0 → 3.3.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 +7 -3
- package/dist/GridBookmarkWidget/model.js +8 -8
- package/dist/GridBookmarkWidget/utils.js +2 -2
- package/esm/GridBookmarkWidget/components/BookmarkGrid.js +7 -3
- package/esm/GridBookmarkWidget/model.js +8 -8
- package/esm/GridBookmarkWidget/utils.js +2 -2
- package/package.json +8 -8
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const ColorPicker_1 = __importDefault(require("@jbrowse/core/ui/ColorPicker"));
|
|
8
|
+
const DataGridFlexContainer_1 = __importDefault(require("@jbrowse/core/ui/DataGridFlexContainer"));
|
|
8
9
|
const util_1 = require("@jbrowse/core/util");
|
|
9
10
|
const material_1 = require("@mui/material");
|
|
10
11
|
const x_data_grid_1 = require("@mui/x-data-grid");
|
|
@@ -42,7 +43,7 @@ const BookmarkGrid = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
|
42
43
|
Math.max((0, util_1.measureText)('Assembly', 12) + 30, (0, util_1.measureGridWidth)(rows.map(row => row.assemblyName))),
|
|
43
44
|
100,
|
|
44
45
|
];
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(DataGridFlexContainer_1.default, { children: (0, jsx_runtime_1.jsx)(x_data_grid_1.DataGrid, { density: "compact", rows: rows, columns: [
|
|
46
47
|
{
|
|
47
48
|
...x_data_grid_1.GRID_CHECKBOX_SELECTION_COL_DEF,
|
|
48
49
|
width: widths[0],
|
|
@@ -84,10 +85,13 @@ const BookmarkGrid = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
|
84
85
|
session.notifyError(`${e}`, e);
|
|
85
86
|
}, checkboxSelection: true, onRowSelectionModelChange: newRowSelectionModel => {
|
|
86
87
|
if (bookmarksWithValidAssemblies.length > 0) {
|
|
87
|
-
model.setSelectedBookmarks(newRowSelectionModel.map(value => ({
|
|
88
|
+
model.setSelectedBookmarks([...newRowSelectionModel.ids].map(value => ({
|
|
88
89
|
...rows[value],
|
|
89
90
|
})));
|
|
90
91
|
}
|
|
91
|
-
}, rowSelectionModel:
|
|
92
|
+
}, rowSelectionModel: {
|
|
93
|
+
type: 'include',
|
|
94
|
+
ids: new Set(selectedBookmarks.map(r => r.id)),
|
|
95
|
+
} }) }));
|
|
92
96
|
});
|
|
93
97
|
exports.default = BookmarkGrid;
|
|
@@ -97,9 +97,9 @@ function f(_pluginManager) {
|
|
|
97
97
|
bookmark.correspondingObj.setHighlight(color);
|
|
98
98
|
},
|
|
99
99
|
updateBulkBookmarkHighlights(color) {
|
|
100
|
-
self.selectedBookmarks
|
|
100
|
+
for (const bookmark of self.selectedBookmarks) {
|
|
101
101
|
this.updateBookmarkHighlight(bookmark, color);
|
|
102
|
-
}
|
|
102
|
+
}
|
|
103
103
|
},
|
|
104
104
|
setSelectedBookmarks(bookmarks) {
|
|
105
105
|
self.selectedBookmarks = bookmarks;
|
|
@@ -108,26 +108,26 @@ function f(_pluginManager) {
|
|
|
108
108
|
self.bookmarks = (0, mobx_state_tree_1.cast)(regions);
|
|
109
109
|
},
|
|
110
110
|
setBookmarkHighlightsVisible(arg) {
|
|
111
|
+
var _a, _b;
|
|
111
112
|
const { views } = (0, util_1.getSession)(self);
|
|
112
|
-
|
|
113
|
-
var _a, _b;
|
|
113
|
+
for (const view of views) {
|
|
114
114
|
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
115
115
|
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
116
116
|
var _a;
|
|
117
117
|
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
118
118
|
});
|
|
119
|
-
}
|
|
119
|
+
}
|
|
120
120
|
},
|
|
121
121
|
setBookmarkLabelsVisible(arg) {
|
|
122
|
+
var _a, _b;
|
|
122
123
|
const { views } = (0, util_1.getSession)(self);
|
|
123
|
-
|
|
124
|
-
var _a, _b;
|
|
124
|
+
for (const view of views) {
|
|
125
125
|
(_a = view.setBookmarkLabelsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
126
126
|
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
127
127
|
var _a;
|
|
128
128
|
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
129
129
|
});
|
|
130
|
-
}
|
|
130
|
+
}
|
|
131
131
|
},
|
|
132
132
|
}))
|
|
133
133
|
.actions(self => ({
|
|
@@ -68,7 +68,7 @@ function downloadBookmarkFile(fileFormat, model) {
|
|
|
68
68
|
if (fileFormat === 'BED') {
|
|
69
69
|
const fileHeader = '';
|
|
70
70
|
const fileContents = {};
|
|
71
|
-
|
|
71
|
+
for (const bookmark of bookmarksToDownload) {
|
|
72
72
|
const { label } = bookmark;
|
|
73
73
|
const labelVal = label === '' ? '.' : label;
|
|
74
74
|
const line = `${bookmark.refName}\t${bookmark.start}\t${bookmark.end}\t${labelVal}\n`;
|
|
@@ -78,7 +78,7 @@ function downloadBookmarkFile(fileFormat, model) {
|
|
|
78
78
|
else {
|
|
79
79
|
fileContents[bookmark.assemblyName] = [line];
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
82
|
for (const assembly in fileContents) {
|
|
83
83
|
const fileContent = fileContents[assembly].reduce((a, b) => a + b, fileHeader);
|
|
84
84
|
const blob = new Blob([fileContent || ''], {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import ColorPicker from '@jbrowse/core/ui/ColorPicker';
|
|
3
|
+
import DataGridFlexContainer from '@jbrowse/core/ui/DataGridFlexContainer';
|
|
3
4
|
import { assembleLocString, getSession, measureGridWidth, measureText, } from '@jbrowse/core/util';
|
|
4
5
|
import { Link } from '@mui/material';
|
|
5
6
|
import { DataGrid, GRID_CHECKBOX_SELECTION_COL_DEF } from '@mui/x-data-grid';
|
|
@@ -37,7 +38,7 @@ const BookmarkGrid = observer(function ({ model, }) {
|
|
|
37
38
|
Math.max(measureText('Assembly', 12) + 30, measureGridWidth(rows.map(row => row.assemblyName))),
|
|
38
39
|
100,
|
|
39
40
|
];
|
|
40
|
-
return (_jsx(
|
|
41
|
+
return (_jsx(DataGridFlexContainer, { children: _jsx(DataGrid, { density: "compact", rows: rows, columns: [
|
|
41
42
|
{
|
|
42
43
|
...GRID_CHECKBOX_SELECTION_COL_DEF,
|
|
43
44
|
width: widths[0],
|
|
@@ -79,10 +80,13 @@ const BookmarkGrid = observer(function ({ model, }) {
|
|
|
79
80
|
session.notifyError(`${e}`, e);
|
|
80
81
|
}, checkboxSelection: true, onRowSelectionModelChange: newRowSelectionModel => {
|
|
81
82
|
if (bookmarksWithValidAssemblies.length > 0) {
|
|
82
|
-
model.setSelectedBookmarks(newRowSelectionModel.map(value => ({
|
|
83
|
+
model.setSelectedBookmarks([...newRowSelectionModel.ids].map(value => ({
|
|
83
84
|
...rows[value],
|
|
84
85
|
})));
|
|
85
86
|
}
|
|
86
|
-
}, rowSelectionModel:
|
|
87
|
+
}, rowSelectionModel: {
|
|
88
|
+
type: 'include',
|
|
89
|
+
ids: new Set(selectedBookmarks.map(r => r.id)),
|
|
90
|
+
} }) }));
|
|
87
91
|
});
|
|
88
92
|
export default BookmarkGrid;
|
|
@@ -94,9 +94,9 @@ export default function f(_pluginManager) {
|
|
|
94
94
|
bookmark.correspondingObj.setHighlight(color);
|
|
95
95
|
},
|
|
96
96
|
updateBulkBookmarkHighlights(color) {
|
|
97
|
-
self.selectedBookmarks
|
|
97
|
+
for (const bookmark of self.selectedBookmarks) {
|
|
98
98
|
this.updateBookmarkHighlight(bookmark, color);
|
|
99
|
-
}
|
|
99
|
+
}
|
|
100
100
|
},
|
|
101
101
|
setSelectedBookmarks(bookmarks) {
|
|
102
102
|
self.selectedBookmarks = bookmarks;
|
|
@@ -105,26 +105,26 @@ export default function f(_pluginManager) {
|
|
|
105
105
|
self.bookmarks = cast(regions);
|
|
106
106
|
},
|
|
107
107
|
setBookmarkHighlightsVisible(arg) {
|
|
108
|
+
var _a, _b;
|
|
108
109
|
const { views } = getSession(self);
|
|
109
|
-
|
|
110
|
-
var _a, _b;
|
|
110
|
+
for (const view of views) {
|
|
111
111
|
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
112
112
|
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
113
113
|
var _a;
|
|
114
114
|
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
115
115
|
});
|
|
116
|
-
}
|
|
116
|
+
}
|
|
117
117
|
},
|
|
118
118
|
setBookmarkLabelsVisible(arg) {
|
|
119
|
+
var _a, _b;
|
|
119
120
|
const { views } = getSession(self);
|
|
120
|
-
|
|
121
|
-
var _a, _b;
|
|
121
|
+
for (const view of views) {
|
|
122
122
|
(_a = view.setBookmarkLabelsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
123
123
|
(_b = view.views) === null || _b === void 0 ? void 0 : _b.map(view => {
|
|
124
124
|
var _a;
|
|
125
125
|
(_a = view.setBookmarkHighlightsVisible) === null || _a === void 0 ? void 0 : _a.call(view, arg);
|
|
126
126
|
});
|
|
127
|
-
}
|
|
127
|
+
}
|
|
128
128
|
},
|
|
129
129
|
}))
|
|
130
130
|
.actions(self => ({
|
|
@@ -28,7 +28,7 @@ export function downloadBookmarkFile(fileFormat, model) {
|
|
|
28
28
|
if (fileFormat === 'BED') {
|
|
29
29
|
const fileHeader = '';
|
|
30
30
|
const fileContents = {};
|
|
31
|
-
|
|
31
|
+
for (const bookmark of bookmarksToDownload) {
|
|
32
32
|
const { label } = bookmark;
|
|
33
33
|
const labelVal = label === '' ? '.' : label;
|
|
34
34
|
const line = `${bookmark.refName}\t${bookmark.start}\t${bookmark.end}\t${labelVal}\n`;
|
|
@@ -38,7 +38,7 @@ export function downloadBookmarkFile(fileFormat, model) {
|
|
|
38
38
|
else {
|
|
39
39
|
fileContents[bookmark.assemblyName] = [line];
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
for (const assembly in fileContents) {
|
|
43
43
|
const fileContent = fileContents[assembly].reduce((a, b) => a + b, fileHeader);
|
|
44
44
|
const blob = new Blob([fileContent || ''], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-grid-bookmark",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "JBrowse 2 grid bookmark widget",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@jbrowse/core": "^3.
|
|
40
|
-
"@jbrowse/plugin-config": "^3.
|
|
41
|
-
"@jbrowse/plugin-linear-genome-view": "^3.
|
|
42
|
-
"@mui/icons-material": "^
|
|
43
|
-
"@mui/material": "^
|
|
44
|
-
"@mui/x-data-grid": "^
|
|
39
|
+
"@jbrowse/core": "^3.3.0",
|
|
40
|
+
"@jbrowse/plugin-config": "^3.3.0",
|
|
41
|
+
"@jbrowse/plugin-linear-genome-view": "^3.3.0",
|
|
42
|
+
"@mui/icons-material": "^7.0.0",
|
|
43
|
+
"@mui/material": "^7.0.0",
|
|
44
|
+
"@mui/x-data-grid": "^8.0.0",
|
|
45
45
|
"@types/file-saver": "^2.0.1",
|
|
46
46
|
"copy-to-clipboard": "^3.3.1",
|
|
47
47
|
"file-saver": "^2.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"distModule": "esm/index.js",
|
|
60
60
|
"srcModule": "src/index.ts",
|
|
61
61
|
"module": "esm/index.js",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "0bb64d8cc7ecdd167515308b31eec3d9acbc59e4"
|
|
63
63
|
}
|