@jbrowse/plugin-grid-bookmark 1.7.10 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GridBookmarkWidget/components/AssemblySelector.js +40 -74
- package/dist/GridBookmarkWidget/components/AssemblySelector.js.map +1 -0
- package/dist/GridBookmarkWidget/components/ClearBookmarks.js +79 -80
- package/dist/GridBookmarkWidget/components/ClearBookmarks.js.map +1 -0
- package/dist/GridBookmarkWidget/components/DeleteBookmark.js +47 -61
- package/dist/GridBookmarkWidget/components/DeleteBookmark.js.map +1 -0
- package/dist/GridBookmarkWidget/components/DownloadBookmarks.js +85 -104
- package/dist/GridBookmarkWidget/components/DownloadBookmarks.js.map +1 -0
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.js +159 -185
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.js.map +1 -0
- package/dist/GridBookmarkWidget/components/ImportBookmarks.js +164 -181
- package/dist/GridBookmarkWidget/components/ImportBookmarks.js.map +1 -0
- package/dist/GridBookmarkWidget/index.d.ts +0 -1
- package/dist/GridBookmarkWidget/index.js +10 -28
- package/dist/GridBookmarkWidget/index.js.map +1 -0
- package/dist/GridBookmarkWidget/model.js +77 -67
- package/dist/GridBookmarkWidget/model.js.map +1 -0
- package/dist/GridBookmarkWidget/types.js +2 -4
- package/dist/GridBookmarkWidget/types.js.map +1 -0
- package/dist/GridBookmarkWidget/utils.js +129 -129
- package/dist/GridBookmarkWidget/utils.js.map +1 -0
- package/dist/index.js +181 -187
- package/dist/index.js.map +1 -0
- package/esm/GridBookmarkWidget/components/AssemblySelector.d.ts +7 -0
- package/esm/GridBookmarkWidget/components/AssemblySelector.js +41 -0
- package/esm/GridBookmarkWidget/components/AssemblySelector.js.map +1 -0
- package/esm/GridBookmarkWidget/components/ClearBookmarks.d.ts +7 -0
- package/esm/GridBookmarkWidget/components/ClearBookmarks.js +40 -0
- package/esm/GridBookmarkWidget/components/ClearBookmarks.js.map +1 -0
- package/esm/GridBookmarkWidget/components/DeleteBookmark.d.ts +9 -0
- package/esm/GridBookmarkWidget/components/DeleteBookmark.js +46 -0
- package/esm/GridBookmarkWidget/components/DeleteBookmark.js.map +1 -0
- package/esm/GridBookmarkWidget/components/DownloadBookmarks.d.ts +7 -0
- package/esm/GridBookmarkWidget/components/DownloadBookmarks.js +50 -0
- package/esm/GridBookmarkWidget/components/DownloadBookmarks.js.map +1 -0
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +7 -0
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.js +95 -0
- package/esm/GridBookmarkWidget/components/GridBookmarkWidget.js.map +1 -0
- package/esm/GridBookmarkWidget/components/ImportBookmarks.d.ts +8 -0
- package/esm/GridBookmarkWidget/components/ImportBookmarks.js +79 -0
- package/esm/GridBookmarkWidget/components/ImportBookmarks.js.map +1 -0
- package/esm/GridBookmarkWidget/index.d.ts +2 -0
- package/esm/GridBookmarkWidget/index.js +4 -0
- package/esm/GridBookmarkWidget/index.js.map +1 -0
- package/esm/GridBookmarkWidget/model.d.ts +35 -0
- package/esm/GridBookmarkWidget/model.js +54 -0
- package/esm/GridBookmarkWidget/model.js.map +1 -0
- package/esm/GridBookmarkWidget/types.d.ts +7 -0
- package/esm/GridBookmarkWidget/types.js +2 -0
- package/esm/GridBookmarkWidget/types.js.map +1 -0
- package/esm/GridBookmarkWidget/utils.d.ts +5 -0
- package/esm/GridBookmarkWidget/utils.js +77 -0
- package/esm/GridBookmarkWidget/utils.js.map +1 -0
- package/esm/index.d.ts +7 -0
- package/esm/index.js +116 -0
- package/esm/index.js.map +1 -0
- package/package.json +23 -15
- package/src/GridBookmarkWidget/components/AssemblySelector.tsx +9 -20
- package/src/GridBookmarkWidget/components/ClearBookmarks.tsx +6 -6
- package/src/GridBookmarkWidget/components/DeleteBookmark.tsx +5 -5
- package/src/GridBookmarkWidget/components/DownloadBookmarks.tsx +6 -6
- package/src/GridBookmarkWidget/components/GridBookmarkWidget.tsx +94 -111
- package/src/GridBookmarkWidget/components/ImportBookmarks.tsx +6 -6
- package/src/GridBookmarkWidget/index.js +0 -2
- package/src/index.ts +2 -2
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.test.js +0 -302
- package/dist/index.test.js +0 -35
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { saveAs } from 'file-saver';
|
|
2
|
+
import { getSession, parseLocString, when, assembleLocString, } from '@jbrowse/core/util';
|
|
3
|
+
export async function navToBookmark(locString, views, model) {
|
|
4
|
+
const { selectedAssembly } = model;
|
|
5
|
+
const lgv = views.find(view => view.type === 'LinearGenomeView' &&
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
view.assemblyNames[0] === selectedAssembly);
|
|
8
|
+
if (lgv) {
|
|
9
|
+
lgv.navToLocString(locString);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
const session = getSession(model);
|
|
13
|
+
const { assemblyManager } = session;
|
|
14
|
+
const assembly = await assemblyManager.waitForAssembly(selectedAssembly);
|
|
15
|
+
if (assembly) {
|
|
16
|
+
try {
|
|
17
|
+
const loc = parseLocString(locString, refName => session.assemblyManager.isValidRefName(refName, selectedAssembly));
|
|
18
|
+
const { refName } = loc;
|
|
19
|
+
const { regions } = assembly;
|
|
20
|
+
const canonicalRefName = assembly.getCanonicalRefName(refName);
|
|
21
|
+
let newDisplayedRegion;
|
|
22
|
+
if (regions) {
|
|
23
|
+
newDisplayedRegion = regions.find(region => region.refName === canonicalRefName);
|
|
24
|
+
}
|
|
25
|
+
const view = session.addView('LinearGenomeView', {
|
|
26
|
+
displayName: selectedAssembly,
|
|
27
|
+
});
|
|
28
|
+
await when(() => view.initialized);
|
|
29
|
+
view.setDisplayedRegions([
|
|
30
|
+
JSON.parse(JSON.stringify(newDisplayedRegion)),
|
|
31
|
+
]);
|
|
32
|
+
view.navToLocString(locString);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
session.notify(`${e}`, 'error');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function downloadBookmarkFile(bookmarkedRegions, fileFormat, model) {
|
|
41
|
+
const { selectedAssembly } = model;
|
|
42
|
+
const fileHeader = fileFormat === 'TSV'
|
|
43
|
+
? 'chrom\tstart\tend\tlabel\tassembly_name\tcoord_range\n'
|
|
44
|
+
: '';
|
|
45
|
+
const fileContents = bookmarkedRegions
|
|
46
|
+
.map(b => {
|
|
47
|
+
const { label } = b;
|
|
48
|
+
const labelVal = label === '' ? '.' : label;
|
|
49
|
+
const locString = assembleLocString(b);
|
|
50
|
+
if (fileFormat === 'BED') {
|
|
51
|
+
if (b.assemblyName === selectedAssembly || selectedAssembly === 'all') {
|
|
52
|
+
// the "name" column (column 4) in a BED has a max of 255 characters
|
|
53
|
+
// according to the new spec: https://github.com/samtools/hts-specs/pull/570
|
|
54
|
+
return `${b.refName}\t${b.start}\t${b.end}\t${labelVal.slice(0, 255)}\n`;
|
|
55
|
+
}
|
|
56
|
+
return '';
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return `${b.refName}\t${b.start + 1}\t${b.end}\t${labelVal}\t${b.assemblyName}\t${locString}\n`;
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
.reduce((a, b) => a + b, fileHeader);
|
|
63
|
+
const blob = new Blob([fileContents || ''], {
|
|
64
|
+
type: fileFormat === 'BED'
|
|
65
|
+
? 'text/x-bed;charset=utf-8'
|
|
66
|
+
: 'text/tab-separated-values;charset=utf-8',
|
|
67
|
+
});
|
|
68
|
+
let fileName;
|
|
69
|
+
if (fileFormat === 'BED') {
|
|
70
|
+
fileName = `jbrowse_bookmarks_${selectedAssembly}.bed`;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
fileName = 'jbrowse_bookmarks.tsv';
|
|
74
|
+
}
|
|
75
|
+
saveAs(blob, fileName);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=utils.js.map
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BACpE,4EAA4E;gBAC5E,OAAO,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,GAAG,KAAK,QAAQ,CAAC,KAAK,CAC1D,CAAC,EACD,GAAG,CACJ,IAAI,CAAA;aACN;YACD,OAAO,EAAE,CAAA;SACV;aAAM;YACL,OAAO,GAAG,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,QAAQ,KACxD,CAAC,CAAC,YACJ,KAAK,SAAS,IAAI,CAAA;SACnB;IACH,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAA;IAEtC,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC,EAAE;QAC1C,IAAI,EACF,UAAU,KAAK,KAAK;YAClB,CAAC,CAAC,0BAA0B;YAC5B,CAAC,CAAC,yCAAyC;KAChD,CAAC,CAAA;IAEF,IAAI,QAAQ,CAAA;IACZ,IAAI,UAAU,KAAK,KAAK,EAAE;QACxB,QAAQ,GAAG,qBAAqB,gBAAgB,MAAM,CAAA;KACvD;SAAM;QACL,QAAQ,GAAG,uBAAuB,CAAA;KACnC;IAED,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AACxB,CAAC"}
|
package/esm/index.d.ts
ADDED
package/esm/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import BookmarkIcon from '@mui/icons-material/Bookmark';
|
|
3
|
+
import BookmarksIcon from '@mui/icons-material/Bookmarks';
|
|
4
|
+
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
5
|
+
import Plugin from '@jbrowse/core/Plugin';
|
|
6
|
+
import { getSession, isSessionModelWithWidgets } from '@jbrowse/core/util';
|
|
7
|
+
import { stateModelFactory as GridBookmarkStateModelFactory, configSchema as GridBookmarkConfigSchema, } from './GridBookmarkWidget';
|
|
8
|
+
export default class extends Plugin {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(...arguments);
|
|
11
|
+
this.name = 'GridBookmarkPlugin';
|
|
12
|
+
}
|
|
13
|
+
install(pluginManager) {
|
|
14
|
+
pluginManager.addWidgetType(() => {
|
|
15
|
+
return new WidgetType({
|
|
16
|
+
name: 'GridBookmarkWidget',
|
|
17
|
+
heading: 'Bookmarked regions',
|
|
18
|
+
configSchema: GridBookmarkConfigSchema,
|
|
19
|
+
stateModel: GridBookmarkStateModelFactory(pluginManager),
|
|
20
|
+
ReactComponent: lazy(() => import('./GridBookmarkWidget/components/GridBookmarkWidget')),
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
pluginManager.addToExtensionPoint('Core-extendPluggableElement', (pluggableElement) => {
|
|
24
|
+
if (pluggableElement.name === 'LinearGenomeView') {
|
|
25
|
+
const { stateModel } = pluggableElement;
|
|
26
|
+
const newStateModel = stateModel.extend((self) => {
|
|
27
|
+
const superMenuItems = self.menuItems;
|
|
28
|
+
const superRubberBandMenuItems = self.rubberBandMenuItems;
|
|
29
|
+
return {
|
|
30
|
+
actions: {
|
|
31
|
+
activateBookmarkWidget() {
|
|
32
|
+
const session = getSession(self);
|
|
33
|
+
if (isSessionModelWithWidgets(session)) {
|
|
34
|
+
let bookmarkWidget = session.widgets.get('GridBookmark');
|
|
35
|
+
if (!bookmarkWidget) {
|
|
36
|
+
bookmarkWidget = session.addWidget('GridBookmarkWidget', 'GridBookmark', { view: self });
|
|
37
|
+
}
|
|
38
|
+
session.showWidget(bookmarkWidget);
|
|
39
|
+
return bookmarkWidget;
|
|
40
|
+
}
|
|
41
|
+
throw new Error('Could not open bookmark widget');
|
|
42
|
+
},
|
|
43
|
+
bookmarkCurrentRegion() {
|
|
44
|
+
const selectedRegions = self.getSelectedRegions(self.leftOffset, self.rightOffset);
|
|
45
|
+
const firstRegion = selectedRegions[0];
|
|
46
|
+
const session = getSession(self);
|
|
47
|
+
if (isSessionModelWithWidgets(session)) {
|
|
48
|
+
const { widgets } = session;
|
|
49
|
+
let bookmarkWidget = widgets.get('GridBookmark');
|
|
50
|
+
if (!bookmarkWidget) {
|
|
51
|
+
this.activateBookmarkWidget();
|
|
52
|
+
bookmarkWidget = widgets.get('GridBookmark');
|
|
53
|
+
}
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
bookmarkWidget.addBookmark(firstRegion);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
views: {
|
|
60
|
+
menuItems() {
|
|
61
|
+
const newMenuItems = [
|
|
62
|
+
...superMenuItems(),
|
|
63
|
+
{ type: 'divider' },
|
|
64
|
+
{
|
|
65
|
+
label: 'Open bookmark widget',
|
|
66
|
+
icon: BookmarksIcon,
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
onClick: self.activateBookmarkWidget,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: 'Bookmark current region',
|
|
72
|
+
icon: BookmarkIcon,
|
|
73
|
+
// @ts-ignore
|
|
74
|
+
onClick: self.bookmarkCurrentRegion,
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
return newMenuItems;
|
|
78
|
+
},
|
|
79
|
+
rubberBandMenuItems() {
|
|
80
|
+
const newRubberBandMenuItems = [
|
|
81
|
+
...superRubberBandMenuItems(),
|
|
82
|
+
{
|
|
83
|
+
label: 'Bookmark region',
|
|
84
|
+
icon: BookmarkIcon,
|
|
85
|
+
onClick: () => {
|
|
86
|
+
const { leftOffset, rightOffset } = self;
|
|
87
|
+
const selectedRegions = self.getSelectedRegions(leftOffset, rightOffset);
|
|
88
|
+
const firstRegion = selectedRegions[0];
|
|
89
|
+
const session = getSession(self);
|
|
90
|
+
if (isSessionModelWithWidgets(session)) {
|
|
91
|
+
const { widgets } = session;
|
|
92
|
+
let bookmarkWidget = widgets.get('GridBookmark');
|
|
93
|
+
if (!bookmarkWidget) {
|
|
94
|
+
// @ts-ignore
|
|
95
|
+
self.activateBookmarkWidget();
|
|
96
|
+
bookmarkWidget = widgets.get('GridBookmark');
|
|
97
|
+
}
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
bookmarkWidget.addBookmark(firstRegion);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
return newRubberBandMenuItems;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
pluggableElement.stateModel = newStateModel;
|
|
110
|
+
}
|
|
111
|
+
return pluggableElement;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
configure(_pluginManager) { }
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAE5B,OAAO,YAAY,MAAM,8BAA8B,CAAA;AACvD,OAAO,aAAa,MAAM,+BAA+B,CAAA;AAEzD,OAAO,UAAU,MAAM,gDAAgD,CAAA;AACvE,OAAO,MAAM,MAAM,sBAAsB,CAAA;AAGzC,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAG1E,OAAO,EACL,iBAAiB,IAAI,6BAA6B,EAClD,YAAY,IAAI,wBAAwB,GACzC,MAAM,sBAAsB,CAAA;AAG7B,MAAM,CAAC,OAAO,MAAO,SAAQ,MAAM;IAAnC;;QACE,SAAI,GAAG,oBAAoB,CAAA;IAkI7B,CAAC;IAhIC,OAAO,CAAC,aAA4B;QAClC,aAAa,CAAC,aAAa,CAAC,GAAG,EAAE;YAC/B,OAAO,IAAI,UAAU,CAAC;gBACpB,IAAI,EAAE,oBAAoB;gBAC1B,OAAO,E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CAAA;4CACtC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;4CAChC,IAAI,yBAAyB,CAAC,OAAO,CAAC,EAAE;gDACtC,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAA;gDAC3B,IAAI,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;gDAChD,IAAI,CAAC,cAAc,EAAE;oDACnB,aAAa;oDACb,IAAI,CAAC,sBAAsB,EAAE,CAAA;oDAC7B,cAAc,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;iDAC7C;gDACD,aAAa;gDACb,cAAc,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;6CACxC;wCACH,CAAC;qCACF;iCACF,CAAA;gCAED,OAAO,sBAAsB,CAAA;4BAC/B,CAAC;yBACF;qBACF,CAAA;gBACH,CAAC,CACF,CAEA;gBAAC,gBAA6B,CAAC,UAAU,GAAG,aAAa,CAAA;aAC3D;YACD,OAAO,gBAAgB,CAAA;QACzB,CAAC,CACF,CAAA;IACH,CAAC;IAED,SAAS,CAAC,cAA6B,IAAG,CAAC;CAC5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-grid-bookmark",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "JBrowse 2 grid bookmark widget",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -20,37 +20,45 @@
|
|
|
20
20
|
"main": "dist/index.js",
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"src"
|
|
23
|
+
"src",
|
|
24
|
+
"esm"
|
|
24
25
|
],
|
|
25
26
|
"scripts": {
|
|
26
|
-
"build": "
|
|
27
|
+
"build": "npm-run-all build:*",
|
|
27
28
|
"test": "cd ../..; jest plugins/grid-bookmark",
|
|
28
29
|
"prepublishOnly": "yarn test",
|
|
29
30
|
"prepack": "yarn build; yarn useDist",
|
|
30
31
|
"postpack": "yarn useSrc",
|
|
31
32
|
"useDist": "node ../../scripts/useDist.js",
|
|
32
33
|
"useSrc": "node ../../scripts/useSrc.js",
|
|
33
|
-
"
|
|
34
|
+
"prebuild": "npm run clean",
|
|
35
|
+
"build:esm": "tsc --build tsconfig.build.esm.json",
|
|
36
|
+
"build:es5": "tsc --build tsconfig.build.es5.json",
|
|
37
|
+
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
34
38
|
},
|
|
35
39
|
"dependencies": {
|
|
36
40
|
"@babel/runtime": "^7.17.9",
|
|
37
|
-
"@
|
|
41
|
+
"@mui/icons-material": "^5.0.1",
|
|
38
42
|
"file-saver": "^2.0.0"
|
|
39
43
|
},
|
|
40
44
|
"peerDependencies": {
|
|
41
|
-
"@jbrowse/core": "^
|
|
42
|
-
"@jbrowse/plugin-config": "^
|
|
43
|
-
"@jbrowse/plugin-linear-genome-view": "^
|
|
44
|
-
"@material
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"mobx-react": "^
|
|
48
|
-
"mobx-state-tree": "
|
|
45
|
+
"@jbrowse/core": "^2.0.0",
|
|
46
|
+
"@jbrowse/plugin-config": "^2.0.0",
|
|
47
|
+
"@jbrowse/plugin-linear-genome-view": "^2.0.0",
|
|
48
|
+
"@mui/material": "^5.0.0",
|
|
49
|
+
"@mui/x-data-grid": "^5.0.1",
|
|
50
|
+
"mobx": "^6.0.0",
|
|
51
|
+
"mobx-react": "^7.0.0",
|
|
52
|
+
"mobx-state-tree": "^5.0.0",
|
|
49
53
|
"prop-types": "^15.0.0",
|
|
50
|
-
"react": ">=16.8.0"
|
|
54
|
+
"react": ">=16.8.0",
|
|
55
|
+
"tss-react": "^3.0.0"
|
|
51
56
|
},
|
|
52
57
|
"publishConfig": {
|
|
53
58
|
"access": "public"
|
|
54
59
|
},
|
|
55
|
-
"
|
|
60
|
+
"distModule": "esm/index.js",
|
|
61
|
+
"srcModule": "src/index.ts",
|
|
62
|
+
"module": "esm/index.js",
|
|
63
|
+
"gitHead": "ed935bf5612af3818abdc8ef52d100d5d81d33a2"
|
|
56
64
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { observer } from 'mobx-react'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
makeStyles,
|
|
7
|
-
Select,
|
|
8
|
-
MenuItem,
|
|
9
|
-
FormControl,
|
|
10
|
-
} from '@material-ui/core'
|
|
4
|
+
import { Typography, Select, MenuItem, FormControl } from '@mui/material'
|
|
5
|
+
import { makeStyles } from 'tss-react/mui'
|
|
11
6
|
|
|
12
7
|
import { GridBookmarkModel } from '../model'
|
|
13
8
|
|
|
14
|
-
const useStyles = makeStyles(() => ({
|
|
9
|
+
const useStyles = makeStyles()(() => ({
|
|
15
10
|
container: {
|
|
16
11
|
display: 'flex',
|
|
17
12
|
flexDirection: 'row',
|
|
@@ -27,17 +22,15 @@ const useStyles = makeStyles(() => ({
|
|
|
27
22
|
}))
|
|
28
23
|
|
|
29
24
|
function AssemblySelector({ model }: { model: GridBookmarkModel }) {
|
|
30
|
-
const classes = useStyles()
|
|
25
|
+
const { classes } = useStyles()
|
|
31
26
|
const { assemblies, selectedAssembly, setSelectedAssembly } = model
|
|
32
27
|
const noAssemblies = assemblies.length === 0 ? true : false
|
|
33
28
|
|
|
34
29
|
const determineCurrentValue = (selectedAssembly: string) => {
|
|
35
30
|
if (selectedAssembly === 'all') {
|
|
36
31
|
return 'all'
|
|
37
|
-
} else {
|
|
38
|
-
|
|
39
|
-
return selectedAssembly
|
|
40
|
-
}
|
|
32
|
+
} else if (assemblies.includes(selectedAssembly)) {
|
|
33
|
+
return selectedAssembly
|
|
41
34
|
}
|
|
42
35
|
|
|
43
36
|
return 'none'
|
|
@@ -49,14 +42,10 @@ function AssemblySelector({ model }: { model: GridBookmarkModel }) {
|
|
|
49
42
|
<FormControl className={classes.flexItem} disabled={noAssemblies}>
|
|
50
43
|
<Select
|
|
51
44
|
value={determineCurrentValue(selectedAssembly)}
|
|
52
|
-
onChange={event => setSelectedAssembly(event.target.value
|
|
45
|
+
onChange={event => setSelectedAssembly(event.target.value)}
|
|
53
46
|
>
|
|
54
|
-
<MenuItem value="none"
|
|
55
|
-
|
|
56
|
-
</MenuItem>
|
|
57
|
-
<MenuItem value="all" key="all-assemblies">
|
|
58
|
-
all
|
|
59
|
-
</MenuItem>
|
|
47
|
+
<MenuItem value="none">none</MenuItem>
|
|
48
|
+
<MenuItem value="all">all</MenuItem>
|
|
60
49
|
{assemblies.map(assembly => (
|
|
61
50
|
<MenuItem value={assembly} key={assembly}>
|
|
62
51
|
{assembly}
|
|
@@ -9,14 +9,14 @@ import {
|
|
|
9
9
|
DialogContent,
|
|
10
10
|
DialogActions,
|
|
11
11
|
Typography,
|
|
12
|
-
|
|
13
|
-
} from '
|
|
14
|
-
import ClearAllIcon from '@
|
|
15
|
-
import CloseIcon from '@
|
|
12
|
+
} from '@mui/material'
|
|
13
|
+
import { makeStyles } from 'tss-react/mui'
|
|
14
|
+
import ClearAllIcon from '@mui/icons-material/ClearAll'
|
|
15
|
+
import CloseIcon from '@mui/icons-material/Close'
|
|
16
16
|
|
|
17
17
|
import { GridBookmarkModel } from '../model'
|
|
18
18
|
|
|
19
|
-
const useStyles = makeStyles(() => ({
|
|
19
|
+
const useStyles = makeStyles()(() => ({
|
|
20
20
|
closeDialog: {
|
|
21
21
|
position: 'absolute',
|
|
22
22
|
right: 0,
|
|
@@ -28,7 +28,7 @@ const useStyles = makeStyles(() => ({
|
|
|
28
28
|
}))
|
|
29
29
|
|
|
30
30
|
function ClearBookmarks({ model }: { model: GridBookmarkModel }) {
|
|
31
|
-
const classes = useStyles()
|
|
31
|
+
const { classes } = useStyles()
|
|
32
32
|
const [dialogOpen, setDialogOpen] = useState(false)
|
|
33
33
|
|
|
34
34
|
const { clearAllBookmarks } = model
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
DialogContent,
|
|
12
12
|
DialogActions,
|
|
13
13
|
Typography,
|
|
14
|
-
|
|
15
|
-
} from '
|
|
16
|
-
import CloseIcon from '@
|
|
14
|
+
} from '@mui/material'
|
|
15
|
+
import { makeStyles } from 'tss-react/mui'
|
|
16
|
+
import CloseIcon from '@mui/icons-material/Close'
|
|
17
17
|
|
|
18
18
|
import { GridBookmarkModel } from '../model'
|
|
19
19
|
|
|
20
|
-
const useStyles = makeStyles(() => ({
|
|
20
|
+
const useStyles = makeStyles()(() => ({
|
|
21
21
|
closeDialog: {
|
|
22
22
|
position: 'absolute',
|
|
23
23
|
right: 0,
|
|
@@ -37,7 +37,7 @@ function DeleteBookmarkDialog({
|
|
|
37
37
|
model: GridBookmarkModel
|
|
38
38
|
onClose: () => void
|
|
39
39
|
}) {
|
|
40
|
-
const classes = useStyles()
|
|
40
|
+
const { classes } = useStyles()
|
|
41
41
|
|
|
42
42
|
const { removeBookmark } = model
|
|
43
43
|
|
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
MenuItem,
|
|
12
12
|
Select,
|
|
13
13
|
Typography,
|
|
14
|
-
|
|
15
|
-
} from '
|
|
16
|
-
import CloseIcon from '@
|
|
17
|
-
import GetAppIcon from '@
|
|
14
|
+
} from '@mui/material'
|
|
15
|
+
import { makeStyles } from 'tss-react/mui'
|
|
16
|
+
import CloseIcon from '@mui/icons-material/Close'
|
|
17
|
+
import GetAppIcon from '@mui/icons-material/GetApp'
|
|
18
18
|
|
|
19
19
|
import { GridBookmarkModel } from '../model'
|
|
20
20
|
import { downloadBookmarkFile } from '../utils'
|
|
21
21
|
|
|
22
|
-
const useStyles = makeStyles(() => ({
|
|
22
|
+
const useStyles = makeStyles()(() => ({
|
|
23
23
|
closeDialog: {
|
|
24
24
|
position: 'absolute',
|
|
25
25
|
right: 0,
|
|
@@ -39,7 +39,7 @@ const useStyles = makeStyles(() => ({
|
|
|
39
39
|
}))
|
|
40
40
|
|
|
41
41
|
function DownloadBookmarks({ model }: { model: GridBookmarkModel }) {
|
|
42
|
-
const classes = useStyles()
|
|
42
|
+
const { classes } = useStyles()
|
|
43
43
|
const [dialogOpen, setDialogOpen] = useState(false)
|
|
44
44
|
const [fileType, setFileType] = useState('BED')
|
|
45
45
|
const { bookmarkedRegions } = model
|