@jbrowse/plugin-data-management 2.11.1 → 2.11.2
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/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +48 -16
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.d.ts +0 -5
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.js +0 -26
- package/dist/HierarchicalTrackSelectorWidget/model.d.ts +3 -3
- package/dist/HierarchicalTrackSelectorWidget/model.js +31 -27
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +26 -17
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.d.ts +0 -5
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.js +1 -27
- package/esm/HierarchicalTrackSelectorWidget/model.d.ts +3 -3
- package/esm/HierarchicalTrackSelectorWidget/model.js +31 -27
- package/package.json +2 -2
|
@@ -1,9 +1,32 @@
|
|
|
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_1 = require("mobx");
|
|
8
31
|
const mobx_react_1 = require("mobx-react");
|
|
9
32
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
@@ -11,9 +34,7 @@ const x_data_grid_1 = require("@mui/x-data-grid");
|
|
|
11
34
|
// jbrowse
|
|
12
35
|
const ui_1 = require("@jbrowse/core/ui");
|
|
13
36
|
const SanitizedHTML_1 = __importDefault(require("@jbrowse/core/ui/SanitizedHTML"));
|
|
14
|
-
const ResizeBar_1 = __importDefault(require("@jbrowse/core/ui/ResizeBar"));
|
|
15
37
|
const util_1 = require("@jbrowse/core/util");
|
|
16
|
-
const useResizeBar_1 = require("@jbrowse/core/ui/useResizeBar");
|
|
17
38
|
const mui_1 = require("tss-react/mui");
|
|
18
39
|
const FacetedHeader_1 = __importDefault(require("./FacetedHeader"));
|
|
19
40
|
const FacetFilters_1 = __importDefault(require("./FacetFilters"));
|
|
@@ -35,10 +56,25 @@ const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ mo
|
|
|
35
56
|
var _a;
|
|
36
57
|
const { classes } = useStyles();
|
|
37
58
|
const { view, selection, shownTrackIds, faceted } = model;
|
|
38
|
-
const { rows, panelWidth, showFilters, useShoppingCart, showOptions, filteredRows, filteredNonMetadataKeys, filteredMetadataKeys, visible,
|
|
59
|
+
const { rows, panelWidth, showFilters, useShoppingCart, showOptions, filteredRows, filteredNonMetadataKeys, filteredMetadataKeys, visible, } = faceted;
|
|
39
60
|
const { pluginManager } = (0, util_1.getEnv)(model);
|
|
40
|
-
const
|
|
41
|
-
|
|
61
|
+
const [widths, setWidths] = (0, react_1.useState)({
|
|
62
|
+
name: (0, util_1.measureGridWidth)(rows.map(r => r.name), { maxWidth: 500, stripHTML: true }) + 15,
|
|
63
|
+
...Object.fromEntries(filteredNonMetadataKeys
|
|
64
|
+
.filter(f => visible[f])
|
|
65
|
+
.map(e => [
|
|
66
|
+
e,
|
|
67
|
+
(0, util_1.measureGridWidth)(rows.map(r => r[e]), { maxWidth: 400, stripHTML: true }),
|
|
68
|
+
])),
|
|
69
|
+
...Object.fromEntries(filteredMetadataKeys
|
|
70
|
+
.filter(f => visible['metadata.' + f])
|
|
71
|
+
.map(e => {
|
|
72
|
+
return [
|
|
73
|
+
'metadata.' + e,
|
|
74
|
+
(0, util_1.measureGridWidth)(rows.map(r => r.metadata[e]), { maxWidth: 400, stripHTML: true }),
|
|
75
|
+
];
|
|
76
|
+
})),
|
|
77
|
+
});
|
|
42
78
|
const columns = [
|
|
43
79
|
{
|
|
44
80
|
field: 'name',
|
|
@@ -50,13 +86,13 @@ const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ mo
|
|
|
50
86
|
react_1.default.createElement(SanitizedHTML_1.default, { html: value }),
|
|
51
87
|
react_1.default.createElement(TrackLabelMenu_1.default, { id: id, conf: conf, trackId: id, model: model })));
|
|
52
88
|
},
|
|
53
|
-
width: (_a =
|
|
89
|
+
width: (_a = widths.name) !== null && _a !== void 0 ? _a : 100,
|
|
54
90
|
},
|
|
55
91
|
...filteredNonMetadataKeys.map(e => {
|
|
56
92
|
var _a;
|
|
57
93
|
return {
|
|
58
94
|
field: e,
|
|
59
|
-
width: (_a =
|
|
95
|
+
width: (_a = widths[e]) !== null && _a !== void 0 ? _a : 100,
|
|
60
96
|
renderCell: params => {
|
|
61
97
|
const val = params.value;
|
|
62
98
|
return val ? (react_1.default.createElement(SanitizedHTML_1.default, { className: classes.cell, html: val })) : ('');
|
|
@@ -70,8 +106,8 @@ const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ mo
|
|
|
70
106
|
headerName: ['name', ...filteredNonMetadataKeys].includes(e)
|
|
71
107
|
? `${e} (from metadata)`
|
|
72
108
|
: e,
|
|
73
|
-
width: (_a =
|
|
74
|
-
valueGetter: (_, row) => `${row.metadata[e]}
|
|
109
|
+
width: (_a = widths['metadata.' + e]) !== null && _a !== void 0 ? _a : 100,
|
|
110
|
+
valueGetter: (_, row) => { var _a; return `${(_a = row.metadata[e]) !== null && _a !== void 0 ? _a : ''}`; },
|
|
75
111
|
renderCell: params => {
|
|
76
112
|
const val = params.value;
|
|
77
113
|
return val ? (react_1.default.createElement(SanitizedHTML_1.default, { className: classes.cell, html: val })) : ('');
|
|
@@ -81,7 +117,7 @@ const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ mo
|
|
|
81
117
|
];
|
|
82
118
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
83
119
|
react_1.default.createElement(FacetedHeader_1.default, { model: model }),
|
|
84
|
-
react_1.default.createElement("div", {
|
|
120
|
+
react_1.default.createElement("div", { style: {
|
|
85
121
|
display: 'flex',
|
|
86
122
|
overflow: 'hidden',
|
|
87
123
|
height: window.innerHeight * frac,
|
|
@@ -91,11 +127,7 @@ const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ mo
|
|
|
91
127
|
height: window.innerHeight * frac,
|
|
92
128
|
width: window.innerWidth * frac - (showFilters ? panelWidth : 0),
|
|
93
129
|
} },
|
|
94
|
-
react_1.default.createElement(
|
|
95
|
-
entry[0],
|
|
96
|
-
newWidths[idx],
|
|
97
|
-
]))), scrollLeft: scrollLeft }),
|
|
98
|
-
react_1.default.createElement(x_data_grid_1.DataGrid, { rows: filteredRows, columnVisibilityModel: visible, onColumnVisibilityModelChange: n => faceted.setVisible(n), columnHeaderHeight: 35, checkboxSelection: true, disableRowSelectionOnClick: true, keepNonExistentRowsSelected: true, onRowSelectionModelChange: userSelectedIds => {
|
|
130
|
+
react_1.default.createElement(x_data_grid_1.DataGrid, { rows: filteredRows, onColumnWidthChange: arg => setWidths({ ...widths, [arg.colDef.field]: arg.width }), columnVisibilityModel: visible, onColumnVisibilityModelChange: n => faceted.setVisible(n), columnHeaderHeight: 35, checkboxSelection: true, disableRowSelectionOnClick: true, keepNonExistentRowsSelected: true, onRowSelectionModelChange: userSelectedIds => {
|
|
99
131
|
if (!useShoppingCart) {
|
|
100
132
|
const a1 = shownTrackIds;
|
|
101
133
|
const a2 = new Set(userSelectedIds);
|
|
@@ -25,7 +25,6 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
25
25
|
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
26
26
|
}, {
|
|
27
27
|
visible: Record<string, boolean>;
|
|
28
|
-
widths: Record<string, number | undefined>;
|
|
29
28
|
useShoppingCart: boolean;
|
|
30
29
|
filters: import("mobx").ObservableMap<string, string[]>;
|
|
31
30
|
} & {
|
|
@@ -118,10 +117,6 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
118
117
|
* #action
|
|
119
118
|
*/
|
|
120
119
|
setVisible(args: Record<string, boolean>): void;
|
|
121
|
-
/**
|
|
122
|
-
* #action
|
|
123
|
-
*/
|
|
124
|
-
setWidths(args: Record<string, number | undefined>): void;
|
|
125
120
|
afterAttach(): void;
|
|
126
121
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
127
122
|
export type FacetedStateModel = ReturnType<typeof facetedStateTreeF>;
|
|
@@ -39,7 +39,6 @@ function facetedStateTreeF() {
|
|
|
39
39
|
})
|
|
40
40
|
.volatile(() => ({
|
|
41
41
|
visible: {},
|
|
42
|
-
widths: {},
|
|
43
42
|
useShoppingCart: false,
|
|
44
43
|
filters: mobx_1.observable.map(),
|
|
45
44
|
}))
|
|
@@ -167,35 +166,10 @@ function facetedStateTreeF() {
|
|
|
167
166
|
setVisible(args) {
|
|
168
167
|
self.visible = args;
|
|
169
168
|
},
|
|
170
|
-
/**
|
|
171
|
-
* #action
|
|
172
|
-
*/
|
|
173
|
-
setWidths(args) {
|
|
174
|
-
self.widths = args;
|
|
175
|
-
},
|
|
176
169
|
afterAttach() {
|
|
177
170
|
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
178
171
|
this.setVisible(Object.fromEntries(self.fields.map(c => [c, true])));
|
|
179
172
|
}));
|
|
180
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
181
|
-
this.setWidths({
|
|
182
|
-
name: (0, util_2.measureGridWidth)(self.rows.map(r => r.name), { maxWidth: 500, stripHTML: true }) + 15,
|
|
183
|
-
...Object.fromEntries(self.filteredNonMetadataKeys
|
|
184
|
-
.filter(f => self.visible[f])
|
|
185
|
-
.map(e => [
|
|
186
|
-
e,
|
|
187
|
-
(0, util_2.measureGridWidth)(self.rows.map(r => r[e]), { maxWidth: 400, stripHTML: true }),
|
|
188
|
-
])),
|
|
189
|
-
...Object.fromEntries(self.filteredMetadataKeys
|
|
190
|
-
.filter(f => self.visible['metadata.' + f])
|
|
191
|
-
.map(e => {
|
|
192
|
-
return [
|
|
193
|
-
'metadata.' + e,
|
|
194
|
-
(0, util_2.measureGridWidth)(self.rows.map(r => r.metadata[e]), { maxWidth: 400, stripHTML: true }),
|
|
195
|
-
];
|
|
196
|
-
})),
|
|
197
|
-
});
|
|
198
|
-
}));
|
|
199
173
|
},
|
|
200
174
|
}));
|
|
201
175
|
}
|
|
@@ -29,7 +29,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
29
29
|
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
30
30
|
}, {
|
|
31
31
|
visible: Record<string, boolean>;
|
|
32
|
-
widths: Record<string, number | undefined>;
|
|
33
32
|
useShoppingCart: boolean;
|
|
34
33
|
filters: import("mobx").ObservableMap<string, string[]>;
|
|
35
34
|
} & {
|
|
@@ -38,7 +37,9 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
38
37
|
setUseShoppingCart(f: boolean): void;
|
|
39
38
|
setFilterText(str: string): void;
|
|
40
39
|
setShowSparse(f: boolean): void;
|
|
41
|
-
setShowOptions(f: boolean): void;
|
|
40
|
+
setShowOptions(f: boolean): void; /**
|
|
41
|
+
* #property
|
|
42
|
+
*/
|
|
42
43
|
setShowFilters(f: boolean): void;
|
|
43
44
|
} & {
|
|
44
45
|
readonly allTrackConfigurations: ({
|
|
@@ -80,7 +81,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
80
81
|
}[];
|
|
81
82
|
} & {
|
|
82
83
|
setVisible(args: Record<string, boolean>): void;
|
|
83
|
-
setWidths(args: Record<string, number | undefined>): void;
|
|
84
84
|
afterAttach(): void;
|
|
85
85
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
86
86
|
}, {
|
|
@@ -454,44 +454,48 @@ function stateTreeFactory(pluginManager) {
|
|
|
454
454
|
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
455
455
|
const { assemblyNames, view } = self;
|
|
456
456
|
self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), '[]'));
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
457
|
+
if (view) {
|
|
458
|
+
const val = (0, util_1.localStorageGetItem)(collapsedK(assemblyNames, view.type));
|
|
459
|
+
if (!val) {
|
|
460
|
+
self.expandAllCategories();
|
|
461
|
+
const session = (0, util_1.getSession)(self);
|
|
462
|
+
if ((0, configuration_1.getConf)(session, [
|
|
463
|
+
'hierarchical',
|
|
464
|
+
'defaultCollapsed',
|
|
465
|
+
'topLevelCategories',
|
|
466
|
+
])) {
|
|
467
|
+
self.collapseTopLevelCategories();
|
|
468
|
+
}
|
|
469
|
+
if ((0, configuration_1.getConf)(session, [
|
|
470
|
+
'hierarchical',
|
|
471
|
+
'defaultCollapsed',
|
|
472
|
+
'subCategories',
|
|
473
|
+
])) {
|
|
474
|
+
self.collapseSubCategories();
|
|
475
|
+
}
|
|
476
|
+
for (const entry of (0, configuration_1.getConf)(session, [
|
|
477
|
+
'hierarchical',
|
|
478
|
+
'defaultCollapsed',
|
|
479
|
+
'categoryNames',
|
|
480
|
+
])) {
|
|
481
|
+
self.setCategoryCollapsed(`Tracks-${entry}`, true);
|
|
482
|
+
}
|
|
467
483
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
'defaultCollapsed',
|
|
471
|
-
'subCategories',
|
|
472
|
-
])) {
|
|
473
|
-
self.collapseSubCategories();
|
|
484
|
+
else {
|
|
485
|
+
self.setCollapsedCategories(JSON.parse(val));
|
|
474
486
|
}
|
|
475
|
-
for (const entry of (0, configuration_1.getConf)(session, [
|
|
476
|
-
'hierarchical',
|
|
477
|
-
'defaultCollapsed',
|
|
478
|
-
'categoryNames',
|
|
479
|
-
])) {
|
|
480
|
-
self.setCategoryCollapsed(`Tracks-${entry}`, true);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
else {
|
|
484
|
-
self.setCollapsedCategories(JSON.parse(val));
|
|
485
487
|
}
|
|
486
488
|
}));
|
|
487
489
|
// this should be the second autorun
|
|
488
490
|
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
489
491
|
const { assemblyNames, collapsed, view } = self;
|
|
490
492
|
localStorageSetJSON(recentlyUsedK(assemblyNames), self.recentlyUsed);
|
|
491
|
-
localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
|
|
492
493
|
localStorageSetJSON(favoritesK(), self.favorites);
|
|
493
494
|
localStorageSetJSON(sortTrackNamesK(), self.sortTrackNames);
|
|
494
495
|
localStorageSetJSON(sortCategoriesK(), self.sortCategories);
|
|
496
|
+
if (view) {
|
|
497
|
+
localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
|
|
498
|
+
}
|
|
495
499
|
}));
|
|
496
500
|
},
|
|
497
501
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { transaction } from 'mobx';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { getRoot, resolveIdentifier } from 'mobx-state-tree';
|
|
@@ -6,9 +6,7 @@ import { DataGrid, GridToolbar } from '@mui/x-data-grid';
|
|
|
6
6
|
// jbrowse
|
|
7
7
|
import { ResizeHandle } from '@jbrowse/core/ui';
|
|
8
8
|
import SanitizedHTML from '@jbrowse/core/ui/SanitizedHTML';
|
|
9
|
-
import
|
|
10
|
-
import { getEnv, useDebounce } from '@jbrowse/core/util';
|
|
11
|
-
import { useResizeBar } from '@jbrowse/core/ui/useResizeBar';
|
|
9
|
+
import { getEnv, measureGridWidth } from '@jbrowse/core/util';
|
|
12
10
|
import { makeStyles } from 'tss-react/mui';
|
|
13
11
|
import FacetedHeader from './FacetedHeader';
|
|
14
12
|
import FacetFilters from './FacetFilters';
|
|
@@ -30,10 +28,25 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
|
30
28
|
var _a;
|
|
31
29
|
const { classes } = useStyles();
|
|
32
30
|
const { view, selection, shownTrackIds, faceted } = model;
|
|
33
|
-
const { rows, panelWidth, showFilters, useShoppingCart, showOptions, filteredRows, filteredNonMetadataKeys, filteredMetadataKeys, visible,
|
|
31
|
+
const { rows, panelWidth, showFilters, useShoppingCart, showOptions, filteredRows, filteredNonMetadataKeys, filteredMetadataKeys, visible, } = faceted;
|
|
34
32
|
const { pluginManager } = getEnv(model);
|
|
35
|
-
const
|
|
36
|
-
|
|
33
|
+
const [widths, setWidths] = useState({
|
|
34
|
+
name: measureGridWidth(rows.map(r => r.name), { maxWidth: 500, stripHTML: true }) + 15,
|
|
35
|
+
...Object.fromEntries(filteredNonMetadataKeys
|
|
36
|
+
.filter(f => visible[f])
|
|
37
|
+
.map(e => [
|
|
38
|
+
e,
|
|
39
|
+
measureGridWidth(rows.map(r => r[e]), { maxWidth: 400, stripHTML: true }),
|
|
40
|
+
])),
|
|
41
|
+
...Object.fromEntries(filteredMetadataKeys
|
|
42
|
+
.filter(f => visible['metadata.' + f])
|
|
43
|
+
.map(e => {
|
|
44
|
+
return [
|
|
45
|
+
'metadata.' + e,
|
|
46
|
+
measureGridWidth(rows.map(r => r.metadata[e]), { maxWidth: 400, stripHTML: true }),
|
|
47
|
+
];
|
|
48
|
+
})),
|
|
49
|
+
});
|
|
37
50
|
const columns = [
|
|
38
51
|
{
|
|
39
52
|
field: 'name',
|
|
@@ -45,13 +58,13 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
|
45
58
|
React.createElement(SanitizedHTML, { html: value }),
|
|
46
59
|
React.createElement(TrackLabelMenu, { id: id, conf: conf, trackId: id, model: model })));
|
|
47
60
|
},
|
|
48
|
-
width: (_a =
|
|
61
|
+
width: (_a = widths.name) !== null && _a !== void 0 ? _a : 100,
|
|
49
62
|
},
|
|
50
63
|
...filteredNonMetadataKeys.map(e => {
|
|
51
64
|
var _a;
|
|
52
65
|
return {
|
|
53
66
|
field: e,
|
|
54
|
-
width: (_a =
|
|
67
|
+
width: (_a = widths[e]) !== null && _a !== void 0 ? _a : 100,
|
|
55
68
|
renderCell: params => {
|
|
56
69
|
const val = params.value;
|
|
57
70
|
return val ? (React.createElement(SanitizedHTML, { className: classes.cell, html: val })) : ('');
|
|
@@ -65,8 +78,8 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
|
65
78
|
headerName: ['name', ...filteredNonMetadataKeys].includes(e)
|
|
66
79
|
? `${e} (from metadata)`
|
|
67
80
|
: e,
|
|
68
|
-
width: (_a =
|
|
69
|
-
valueGetter: (_, row) => `${row.metadata[e]}
|
|
81
|
+
width: (_a = widths['metadata.' + e]) !== null && _a !== void 0 ? _a : 100,
|
|
82
|
+
valueGetter: (_, row) => { var _a; return `${(_a = row.metadata[e]) !== null && _a !== void 0 ? _a : ''}`; },
|
|
70
83
|
renderCell: params => {
|
|
71
84
|
const val = params.value;
|
|
72
85
|
return val ? (React.createElement(SanitizedHTML, { className: classes.cell, html: val })) : ('');
|
|
@@ -76,7 +89,7 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
|
76
89
|
];
|
|
77
90
|
return (React.createElement(React.Fragment, null,
|
|
78
91
|
React.createElement(FacetedHeader, { model: model }),
|
|
79
|
-
React.createElement("div", {
|
|
92
|
+
React.createElement("div", { style: {
|
|
80
93
|
display: 'flex',
|
|
81
94
|
overflow: 'hidden',
|
|
82
95
|
height: window.innerHeight * frac,
|
|
@@ -86,11 +99,7 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
|
86
99
|
height: window.innerHeight * frac,
|
|
87
100
|
width: window.innerWidth * frac - (showFilters ? panelWidth : 0),
|
|
88
101
|
} },
|
|
89
|
-
React.createElement(
|
|
90
|
-
entry[0],
|
|
91
|
-
newWidths[idx],
|
|
92
|
-
]))), scrollLeft: scrollLeft }),
|
|
93
|
-
React.createElement(DataGrid, { rows: filteredRows, columnVisibilityModel: visible, onColumnVisibilityModelChange: n => faceted.setVisible(n), columnHeaderHeight: 35, checkboxSelection: true, disableRowSelectionOnClick: true, keepNonExistentRowsSelected: true, onRowSelectionModelChange: userSelectedIds => {
|
|
102
|
+
React.createElement(DataGrid, { rows: filteredRows, onColumnWidthChange: arg => setWidths({ ...widths, [arg.colDef.field]: arg.width }), columnVisibilityModel: visible, onColumnVisibilityModelChange: n => faceted.setVisible(n), columnHeaderHeight: 35, checkboxSelection: true, disableRowSelectionOnClick: true, keepNonExistentRowsSelected: true, onRowSelectionModelChange: userSelectedIds => {
|
|
94
103
|
if (!useShoppingCart) {
|
|
95
104
|
const a1 = shownTrackIds;
|
|
96
105
|
const a2 = new Set(userSelectedIds);
|
|
@@ -25,7 +25,6 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
25
25
|
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
26
26
|
}, {
|
|
27
27
|
visible: Record<string, boolean>;
|
|
28
|
-
widths: Record<string, number | undefined>;
|
|
29
28
|
useShoppingCart: boolean;
|
|
30
29
|
filters: import("mobx").ObservableMap<string, string[]>;
|
|
31
30
|
} & {
|
|
@@ -118,10 +117,6 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
118
117
|
* #action
|
|
119
118
|
*/
|
|
120
119
|
setVisible(args: Record<string, boolean>): void;
|
|
121
|
-
/**
|
|
122
|
-
* #action
|
|
123
|
-
*/
|
|
124
|
-
setWidths(args: Record<string, number | undefined>): void;
|
|
125
120
|
afterAttach(): void;
|
|
126
121
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
127
122
|
export type FacetedStateModel = ReturnType<typeof facetedStateTreeF>;
|
|
@@ -2,7 +2,7 @@ import { addDisposer, getParent, types } from 'mobx-state-tree';
|
|
|
2
2
|
import { matches } from './util';
|
|
3
3
|
import { readConfObject, } from '@jbrowse/core/configuration';
|
|
4
4
|
import { getTrackName } from '@jbrowse/core/util/tracks';
|
|
5
|
-
import { getSession, localStorageGetItem
|
|
5
|
+
import { getSession, localStorageGetItem } from '@jbrowse/core/util';
|
|
6
6
|
import { autorun, observable } from 'mobx';
|
|
7
7
|
import { getRootKeys, findNonSparseKeys } from './facetedUtil';
|
|
8
8
|
import { getRowStr } from './components/faceted/util';
|
|
@@ -36,7 +36,6 @@ export function facetedStateTreeF() {
|
|
|
36
36
|
})
|
|
37
37
|
.volatile(() => ({
|
|
38
38
|
visible: {},
|
|
39
|
-
widths: {},
|
|
40
39
|
useShoppingCart: false,
|
|
41
40
|
filters: observable.map(),
|
|
42
41
|
}))
|
|
@@ -164,35 +163,10 @@ export function facetedStateTreeF() {
|
|
|
164
163
|
setVisible(args) {
|
|
165
164
|
self.visible = args;
|
|
166
165
|
},
|
|
167
|
-
/**
|
|
168
|
-
* #action
|
|
169
|
-
*/
|
|
170
|
-
setWidths(args) {
|
|
171
|
-
self.widths = args;
|
|
172
|
-
},
|
|
173
166
|
afterAttach() {
|
|
174
167
|
addDisposer(self, autorun(() => {
|
|
175
168
|
this.setVisible(Object.fromEntries(self.fields.map(c => [c, true])));
|
|
176
169
|
}));
|
|
177
|
-
addDisposer(self, autorun(() => {
|
|
178
|
-
this.setWidths({
|
|
179
|
-
name: measureGridWidth(self.rows.map(r => r.name), { maxWidth: 500, stripHTML: true }) + 15,
|
|
180
|
-
...Object.fromEntries(self.filteredNonMetadataKeys
|
|
181
|
-
.filter(f => self.visible[f])
|
|
182
|
-
.map(e => [
|
|
183
|
-
e,
|
|
184
|
-
measureGridWidth(self.rows.map(r => r[e]), { maxWidth: 400, stripHTML: true }),
|
|
185
|
-
])),
|
|
186
|
-
...Object.fromEntries(self.filteredMetadataKeys
|
|
187
|
-
.filter(f => self.visible['metadata.' + f])
|
|
188
|
-
.map(e => {
|
|
189
|
-
return [
|
|
190
|
-
'metadata.' + e,
|
|
191
|
-
measureGridWidth(self.rows.map(r => r.metadata[e]), { maxWidth: 400, stripHTML: true }),
|
|
192
|
-
];
|
|
193
|
-
})),
|
|
194
|
-
});
|
|
195
|
-
}));
|
|
196
170
|
},
|
|
197
171
|
}));
|
|
198
172
|
}
|
|
@@ -29,7 +29,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
29
29
|
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
30
30
|
}, {
|
|
31
31
|
visible: Record<string, boolean>;
|
|
32
|
-
widths: Record<string, number | undefined>;
|
|
33
32
|
useShoppingCart: boolean;
|
|
34
33
|
filters: import("mobx").ObservableMap<string, string[]>;
|
|
35
34
|
} & {
|
|
@@ -38,7 +37,9 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
38
37
|
setUseShoppingCart(f: boolean): void;
|
|
39
38
|
setFilterText(str: string): void;
|
|
40
39
|
setShowSparse(f: boolean): void;
|
|
41
|
-
setShowOptions(f: boolean): void;
|
|
40
|
+
setShowOptions(f: boolean): void; /**
|
|
41
|
+
* #property
|
|
42
|
+
*/
|
|
42
43
|
setShowFilters(f: boolean): void;
|
|
43
44
|
} & {
|
|
44
45
|
readonly allTrackConfigurations: ({
|
|
@@ -80,7 +81,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
80
81
|
}[];
|
|
81
82
|
} & {
|
|
82
83
|
setVisible(args: Record<string, boolean>): void;
|
|
83
|
-
setWidths(args: Record<string, number | undefined>): void;
|
|
84
84
|
afterAttach(): void;
|
|
85
85
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
86
86
|
}, {
|
|
@@ -452,44 +452,48 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
452
452
|
addDisposer(self, autorun(() => {
|
|
453
453
|
const { assemblyNames, view } = self;
|
|
454
454
|
self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), '[]'));
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
455
|
+
if (view) {
|
|
456
|
+
const val = localStorageGetItem(collapsedK(assemblyNames, view.type));
|
|
457
|
+
if (!val) {
|
|
458
|
+
self.expandAllCategories();
|
|
459
|
+
const session = getSession(self);
|
|
460
|
+
if (getConf(session, [
|
|
461
|
+
'hierarchical',
|
|
462
|
+
'defaultCollapsed',
|
|
463
|
+
'topLevelCategories',
|
|
464
|
+
])) {
|
|
465
|
+
self.collapseTopLevelCategories();
|
|
466
|
+
}
|
|
467
|
+
if (getConf(session, [
|
|
468
|
+
'hierarchical',
|
|
469
|
+
'defaultCollapsed',
|
|
470
|
+
'subCategories',
|
|
471
|
+
])) {
|
|
472
|
+
self.collapseSubCategories();
|
|
473
|
+
}
|
|
474
|
+
for (const entry of getConf(session, [
|
|
475
|
+
'hierarchical',
|
|
476
|
+
'defaultCollapsed',
|
|
477
|
+
'categoryNames',
|
|
478
|
+
])) {
|
|
479
|
+
self.setCategoryCollapsed(`Tracks-${entry}`, true);
|
|
480
|
+
}
|
|
465
481
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
'defaultCollapsed',
|
|
469
|
-
'subCategories',
|
|
470
|
-
])) {
|
|
471
|
-
self.collapseSubCategories();
|
|
482
|
+
else {
|
|
483
|
+
self.setCollapsedCategories(JSON.parse(val));
|
|
472
484
|
}
|
|
473
|
-
for (const entry of getConf(session, [
|
|
474
|
-
'hierarchical',
|
|
475
|
-
'defaultCollapsed',
|
|
476
|
-
'categoryNames',
|
|
477
|
-
])) {
|
|
478
|
-
self.setCategoryCollapsed(`Tracks-${entry}`, true);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
else {
|
|
482
|
-
self.setCollapsedCategories(JSON.parse(val));
|
|
483
485
|
}
|
|
484
486
|
}));
|
|
485
487
|
// this should be the second autorun
|
|
486
488
|
addDisposer(self, autorun(() => {
|
|
487
489
|
const { assemblyNames, collapsed, view } = self;
|
|
488
490
|
localStorageSetJSON(recentlyUsedK(assemblyNames), self.recentlyUsed);
|
|
489
|
-
localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
|
|
490
491
|
localStorageSetJSON(favoritesK(), self.favorites);
|
|
491
492
|
localStorageSetJSON(sortTrackNamesK(), self.sortTrackNames);
|
|
492
493
|
localStorageSetJSON(sortCategoriesK(), self.sortCategories);
|
|
494
|
+
if (view) {
|
|
495
|
+
localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
|
|
496
|
+
}
|
|
493
497
|
}));
|
|
494
498
|
},
|
|
495
499
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-data-management",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"distModule": "esm/index.js",
|
|
61
61
|
"srcModule": "src/index.ts",
|
|
62
62
|
"module": "esm/index.js",
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "511048cb6965f0bf624c96de244e7fd47fce17d6"
|
|
64
64
|
}
|