@jbrowse/plugin-data-management 2.10.0 → 2.10.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/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.d.ts +1 -2
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.js +6 -5
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.d.ts +3 -3
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.js +7 -7
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +3 -9
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/util.d.ts +6 -0
- package/dist/HierarchicalTrackSelectorWidget/components/faceted/util.js +10 -0
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.d.ts +2 -2
- package/dist/HierarchicalTrackSelectorWidget/facetedModel.js +3 -7
- package/dist/HierarchicalTrackSelectorWidget/model.d.ts +14 -10
- package/dist/HierarchicalTrackSelectorWidget/model.js +7 -0
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.d.ts +1 -2
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilter.js +6 -5
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.d.ts +3 -3
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetFilters.js +7 -7
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/FacetedSelector.js +3 -9
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/util.d.ts +6 -0
- package/esm/HierarchicalTrackSelectorWidget/components/faceted/util.js +6 -0
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.d.ts +2 -2
- package/esm/HierarchicalTrackSelectorWidget/facetedModel.js +3 -7
- package/esm/HierarchicalTrackSelectorWidget/model.d.ts +14 -10
- package/esm/HierarchicalTrackSelectorWidget/model.js +7 -0
- package/package.json +2 -2
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HierarchicalTrackSelectorModel } from '../../model';
|
|
3
|
-
declare const FacetFilter: ({ column, vals,
|
|
3
|
+
declare const FacetFilter: ({ column, vals, model, }: {
|
|
4
4
|
column: {
|
|
5
5
|
field: string;
|
|
6
6
|
};
|
|
7
7
|
vals: [string, number][];
|
|
8
|
-
width: number;
|
|
9
8
|
model: HierarchicalTrackSelectorModel;
|
|
10
9
|
}) => React.JSX.Element;
|
|
11
10
|
export default FacetFilter;
|
|
@@ -53,15 +53,16 @@ function ExpandButton({ visible, onClick, }) {
|
|
|
53
53
|
return (react_1.default.createElement(material_1.Tooltip, { title: "Minimize/expand this facet filter" },
|
|
54
54
|
react_1.default.createElement(material_1.IconButton, { onClick: () => onClick(), size: "small" }, visible ? react_1.default.createElement(Minimize_1.default, null) : react_1.default.createElement(Add_1.default, null))));
|
|
55
55
|
}
|
|
56
|
-
const FacetFilter = (0, mobx_react_1.observer)(function ({ column, vals,
|
|
56
|
+
const FacetFilter = (0, mobx_react_1.observer)(function ({ column, vals, model, }) {
|
|
57
57
|
const { classes } = useStyles();
|
|
58
58
|
const [visible, setVisible] = (0, react_1.useState)(true);
|
|
59
59
|
const { faceted } = model;
|
|
60
60
|
const { filters } = faceted;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
react_1.default.createElement(
|
|
61
|
+
const { field } = column;
|
|
62
|
+
return (react_1.default.createElement(material_1.FormControl, { className: classes.facet, fullWidth: true },
|
|
63
|
+
react_1.default.createElement("div", null,
|
|
64
|
+
react_1.default.createElement(material_1.Typography, { component: "span" }, field),
|
|
65
|
+
react_1.default.createElement(ClearButton, { onClick: () => faceted.setFilter(field, []) }),
|
|
65
66
|
react_1.default.createElement(ExpandButton, { visible: visible, onClick: () => setVisible(!visible) })),
|
|
66
67
|
visible ? (react_1.default.createElement(material_1.Select, { multiple: true, native: true, className: classes.select, value: filters.get(column.field) || [], onChange: event => {
|
|
67
68
|
faceted.setFilter(column.field,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HierarchicalTrackSelectorModel } from '../../model';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { Row } from './util';
|
|
4
|
+
declare const FacetFilters: ({ rows, columns, model, }: {
|
|
5
|
+
rows: Row[];
|
|
5
6
|
columns: {
|
|
6
7
|
field: string;
|
|
7
8
|
}[];
|
|
8
|
-
width: number;
|
|
9
9
|
model: HierarchicalTrackSelectorModel;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
11
|
export default FacetFilters;
|
|
@@ -4,9 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const FacetFilter_1 = __importDefault(require("./FacetFilter"));
|
|
8
7
|
const mobx_react_1 = require("mobx-react");
|
|
9
|
-
|
|
8
|
+
// locals
|
|
9
|
+
const FacetFilter_1 = __importDefault(require("./FacetFilter"));
|
|
10
|
+
const util_1 = require("./util");
|
|
11
|
+
const FacetFilters = (0, mobx_react_1.observer)(function ({ rows, columns, model, }) {
|
|
10
12
|
var _a, _b;
|
|
11
13
|
const { faceted } = model;
|
|
12
14
|
const { filters } = faceted;
|
|
@@ -31,7 +33,7 @@ const FacetFilters = (0, mobx_react_1.observer)(function ({ rows, columns, width
|
|
|
31
33
|
for (const facet of ret) {
|
|
32
34
|
const elt = uniqs.get(facet);
|
|
33
35
|
for (const row of currentRows) {
|
|
34
|
-
const key =
|
|
36
|
+
const key = (0, util_1.getRowStr)(facet, row);
|
|
35
37
|
const val = elt.get(key);
|
|
36
38
|
// we don't allow filtering on empty yet
|
|
37
39
|
if (key) {
|
|
@@ -46,10 +48,8 @@ const FacetFilters = (0, mobx_react_1.observer)(function ({ rows, columns, width
|
|
|
46
48
|
const filter = ((_b = filters.get(facet)) === null || _b === void 0 ? void 0 : _b.length)
|
|
47
49
|
? new Set(filters.get(facet))
|
|
48
50
|
: undefined;
|
|
49
|
-
currentRows = currentRows.filter(row =>
|
|
50
|
-
return filter !== undefined ? filter.has(row[facet]) : true;
|
|
51
|
-
});
|
|
51
|
+
currentRows = currentRows.filter(row => filter !== undefined ? filter.has((0, util_1.getRowStr)(facet, row)) : true);
|
|
52
52
|
}
|
|
53
|
-
return (react_1.default.createElement("div", null, facets.map(
|
|
53
|
+
return (react_1.default.createElement("div", null, facets.map(c => (react_1.default.createElement(FacetFilter_1.default, { key: c.field, vals: [...uniqs.get(c.field)], column: c, model: model })))));
|
|
54
54
|
});
|
|
55
55
|
exports.default = FacetFilters;
|
|
@@ -34,11 +34,10 @@ const frac = 0.75;
|
|
|
34
34
|
const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ model, }) {
|
|
35
35
|
var _a;
|
|
36
36
|
const { classes } = useStyles();
|
|
37
|
-
const { view, selection, faceted } = model;
|
|
37
|
+
const { view, selection, shownTrackIds, faceted } = model;
|
|
38
38
|
const { rows, panelWidth, showFilters, useShoppingCart, showOptions, filteredRows, filteredNonMetadataKeys, filteredMetadataKeys, visible, widths, } = faceted;
|
|
39
39
|
const { pluginManager } = (0, util_1.getEnv)(model);
|
|
40
40
|
const { ref, scrollLeft } = (0, useResizeBar_1.useResizeBar)();
|
|
41
|
-
const tracks = view.tracks;
|
|
42
41
|
const widthsDebounced = (0, util_1.useDebounce)(widths, 200);
|
|
43
42
|
const columns = [
|
|
44
43
|
{
|
|
@@ -80,7 +79,6 @@ const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ mo
|
|
|
80
79
|
});
|
|
81
80
|
}),
|
|
82
81
|
];
|
|
83
|
-
const shownTrackIds = new Set(tracks.map(t => t.configuration.trackId));
|
|
84
82
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
85
83
|
react_1.default.createElement(FacetedHeader_1.default, { model: model }),
|
|
86
84
|
react_1.default.createElement("div", { ref: ref, style: {
|
|
@@ -130,11 +128,7 @@ const FacetedSelector = (0, mobx_react_1.observer)(function FacetedSelector({ mo
|
|
|
130
128
|
}, columns: columns, rowHeight: 25 })),
|
|
131
129
|
showFilters ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
132
130
|
react_1.default.createElement(ui_1.ResizeHandle, { vertical: true, onDrag: dist => faceted.setPanelWidth(panelWidth - dist), className: classes.resizeHandle }),
|
|
133
|
-
react_1.default.createElement("div", { style: {
|
|
134
|
-
|
|
135
|
-
overflowY: 'auto',
|
|
136
|
-
overflowX: 'hidden',
|
|
137
|
-
} },
|
|
138
|
-
react_1.default.createElement(FacetFilters_1.default, { model: model, width: panelWidth - 10, rows: rows, columns: columns })))) : null)));
|
|
131
|
+
react_1.default.createElement("div", { style: { width: panelWidth, overflow: 'auto' } },
|
|
132
|
+
react_1.default.createElement(FacetFilters_1.default, { model: model, rows: rows, columns: columns })))) : null)));
|
|
139
133
|
});
|
|
140
134
|
exports.default = FacetedSelector;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRowStr = void 0;
|
|
4
|
+
function getRowStr(facet, row) {
|
|
5
|
+
var _a;
|
|
6
|
+
return `${(facet.startsWith('metadata.')
|
|
7
|
+
? (_a = row.metadata) === null || _a === void 0 ? void 0 : _a[facet.replace('metadata.', '')]
|
|
8
|
+
: row[facet]) || ''}`;
|
|
9
|
+
}
|
|
10
|
+
exports.getRowStr = getRowStr;
|
|
@@ -81,7 +81,7 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
81
81
|
readonly category: string;
|
|
82
82
|
readonly adapter: string;
|
|
83
83
|
readonly description: string;
|
|
84
|
-
readonly metadata:
|
|
84
|
+
readonly metadata: Record<string, unknown>;
|
|
85
85
|
}[];
|
|
86
86
|
} & {
|
|
87
87
|
/**
|
|
@@ -111,7 +111,7 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
111
111
|
readonly category: string;
|
|
112
112
|
readonly adapter: string;
|
|
113
113
|
readonly description: string;
|
|
114
|
-
readonly metadata:
|
|
114
|
+
readonly metadata: Record<string, unknown>;
|
|
115
115
|
}[];
|
|
116
116
|
} & {
|
|
117
117
|
/**
|
|
@@ -8,6 +8,7 @@ const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
|
8
8
|
const util_2 = require("@jbrowse/core/util");
|
|
9
9
|
const mobx_1 = require("mobx");
|
|
10
10
|
const facetedUtil_1 = require("./facetedUtil");
|
|
11
|
+
const util_3 = require("./components/faceted/util");
|
|
11
12
|
const nonMetadataKeys = ['category', 'adapter', 'description'];
|
|
12
13
|
/**
|
|
13
14
|
* #stateModel FacetedModel
|
|
@@ -101,13 +102,10 @@ function facetedStateTreeF() {
|
|
|
101
102
|
get rows() {
|
|
102
103
|
const session = (0, util_2.getSession)(self);
|
|
103
104
|
const { allTrackConfigurations, filterText } = self;
|
|
104
|
-
// metadata is spread onto the object for easier access and sorting
|
|
105
|
-
// by the mui data grid (it's unable to sort by nested objects)
|
|
106
105
|
return allTrackConfigurations
|
|
107
106
|
.filter(conf => (0, util_1.matches)(filterText, conf, session))
|
|
108
107
|
.map(track => {
|
|
109
108
|
var _a, _b;
|
|
110
|
-
const metadata = (0, configuration_1.readConfObject)(track, 'metadata');
|
|
111
109
|
return {
|
|
112
110
|
id: track.trackId,
|
|
113
111
|
conf: track,
|
|
@@ -115,7 +113,7 @@ function facetedStateTreeF() {
|
|
|
115
113
|
category: (_a = (0, configuration_1.readConfObject)(track, 'category')) === null || _a === void 0 ? void 0 : _a.join(', '),
|
|
116
114
|
adapter: (_b = (0, configuration_1.readConfObject)(track, 'adapter')) === null || _b === void 0 ? void 0 : _b.type,
|
|
117
115
|
description: (0, configuration_1.readConfObject)(track, 'description'),
|
|
118
|
-
metadata,
|
|
116
|
+
metadata: (0, configuration_1.readConfObject)(track, 'metadata'),
|
|
119
117
|
};
|
|
120
118
|
});
|
|
121
119
|
},
|
|
@@ -159,9 +157,7 @@ function facetedStateTreeF() {
|
|
|
159
157
|
const arrFilters = [...self.filters.entries()]
|
|
160
158
|
.filter(f => f[1].length > 0)
|
|
161
159
|
.map(([key, val]) => [key, new Set(val)]);
|
|
162
|
-
return self.rows.filter(row =>
|
|
163
|
-
// @ts-expect-error
|
|
164
|
-
arrFilters.every(([key, val]) => val.has(row[key])));
|
|
160
|
+
return self.rows.filter(row => arrFilters.every(([key, val]) => val.has((0, util_3.getRowStr)(key, row))));
|
|
165
161
|
},
|
|
166
162
|
}))
|
|
167
163
|
.actions(self => ({
|
|
@@ -42,23 +42,23 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
42
42
|
showSparse: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
43
43
|
showFilters: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
44
44
|
showOptions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
45
|
-
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
46
|
-
* #property
|
|
47
|
-
*/
|
|
45
|
+
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
48
46
|
}, {
|
|
49
47
|
visible: Record<string, boolean>;
|
|
50
|
-
widths: Record<string, number | undefined>;
|
|
48
|
+
widths: Record<string, number | undefined>; /**
|
|
49
|
+
* #property
|
|
50
|
+
*/
|
|
51
51
|
useShoppingCart: boolean;
|
|
52
|
-
filters: import("mobx").ObservableMap<string, string[]>;
|
|
52
|
+
filters: import("mobx").ObservableMap<string, string[]>; /**
|
|
53
|
+
* #property
|
|
54
|
+
*/
|
|
53
55
|
} & {
|
|
54
56
|
setFilter(key: string, value: string[]): void;
|
|
55
57
|
setPanelWidth(width: number): void;
|
|
56
58
|
setUseShoppingCart(f: boolean): void;
|
|
57
59
|
setFilterText(str: string): void;
|
|
58
60
|
setShowSparse(f: boolean): void;
|
|
59
|
-
setShowOptions(f: boolean): void;
|
|
60
|
-
* #getter
|
|
61
|
-
*/
|
|
61
|
+
setShowOptions(f: boolean): void;
|
|
62
62
|
setShowFilters(f: boolean): void;
|
|
63
63
|
} & {
|
|
64
64
|
readonly allTrackConfigurations: ({
|
|
@@ -78,7 +78,7 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
78
78
|
readonly category: string;
|
|
79
79
|
readonly adapter: string;
|
|
80
80
|
readonly description: string;
|
|
81
|
-
readonly metadata:
|
|
81
|
+
readonly metadata: Record<string, unknown>;
|
|
82
82
|
}[];
|
|
83
83
|
} & {
|
|
84
84
|
readonly filteredNonMetadataKeys: string[] | readonly ["category", "adapter", "description"];
|
|
@@ -96,7 +96,7 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
96
96
|
readonly category: string;
|
|
97
97
|
readonly adapter: string;
|
|
98
98
|
readonly description: string;
|
|
99
|
-
readonly metadata:
|
|
99
|
+
readonly metadata: Record<string, unknown>;
|
|
100
100
|
}[];
|
|
101
101
|
} & {
|
|
102
102
|
setVisible(args: Record<string, boolean>): void;
|
|
@@ -115,6 +115,10 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
115
115
|
recentlyUsedCounter: number;
|
|
116
116
|
favoritesCounter: number;
|
|
117
117
|
} & {
|
|
118
|
+
/**
|
|
119
|
+
* #getter
|
|
120
|
+
*/
|
|
121
|
+
readonly shownTrackIds: Set<string>;
|
|
118
122
|
/**
|
|
119
123
|
* #getter
|
|
120
124
|
*/
|
|
@@ -74,6 +74,13 @@ function stateTreeFactory(pluginManager) {
|
|
|
74
74
|
favoritesCounter: 0,
|
|
75
75
|
}))
|
|
76
76
|
.views(self => ({
|
|
77
|
+
/**
|
|
78
|
+
* #getter
|
|
79
|
+
*/
|
|
80
|
+
get shownTrackIds() {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
return new Set((_b = (_a = self.view) === null || _a === void 0 ? void 0 : _a.tracks) === null || _b === void 0 ? void 0 : _b.map((t) => t.configuration.trackId));
|
|
83
|
+
},
|
|
77
84
|
/**
|
|
78
85
|
* #getter
|
|
79
86
|
*/
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HierarchicalTrackSelectorModel } from '../../model';
|
|
3
|
-
declare const FacetFilter: ({ column, vals,
|
|
3
|
+
declare const FacetFilter: ({ column, vals, model, }: {
|
|
4
4
|
column: {
|
|
5
5
|
field: string;
|
|
6
6
|
};
|
|
7
7
|
vals: [string, number][];
|
|
8
|
-
width: number;
|
|
9
8
|
model: HierarchicalTrackSelectorModel;
|
|
10
9
|
}) => React.JSX.Element;
|
|
11
10
|
export default FacetFilter;
|
|
@@ -25,15 +25,16 @@ function ExpandButton({ visible, onClick, }) {
|
|
|
25
25
|
return (React.createElement(Tooltip, { title: "Minimize/expand this facet filter" },
|
|
26
26
|
React.createElement(IconButton, { onClick: () => onClick(), size: "small" }, visible ? React.createElement(MinimizeIcon, null) : React.createElement(AddIcon, null))));
|
|
27
27
|
}
|
|
28
|
-
const FacetFilter = observer(function ({ column, vals,
|
|
28
|
+
const FacetFilter = observer(function ({ column, vals, model, }) {
|
|
29
29
|
const { classes } = useStyles();
|
|
30
30
|
const [visible, setVisible] = useState(true);
|
|
31
31
|
const { faceted } = model;
|
|
32
32
|
const { filters } = faceted;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
React.createElement(
|
|
33
|
+
const { field } = column;
|
|
34
|
+
return (React.createElement(FormControl, { className: classes.facet, fullWidth: true },
|
|
35
|
+
React.createElement("div", null,
|
|
36
|
+
React.createElement(Typography, { component: "span" }, field),
|
|
37
|
+
React.createElement(ClearButton, { onClick: () => faceted.setFilter(field, []) }),
|
|
37
38
|
React.createElement(ExpandButton, { visible: visible, onClick: () => setVisible(!visible) })),
|
|
38
39
|
visible ? (React.createElement(Select, { multiple: true, native: true, className: classes.select, value: filters.get(column.field) || [], onChange: event => {
|
|
39
40
|
faceted.setFilter(column.field,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { HierarchicalTrackSelectorModel } from '../../model';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { Row } from './util';
|
|
4
|
+
declare const FacetFilters: ({ rows, columns, model, }: {
|
|
5
|
+
rows: Row[];
|
|
5
6
|
columns: {
|
|
6
7
|
field: string;
|
|
7
8
|
}[];
|
|
8
|
-
width: number;
|
|
9
9
|
model: HierarchicalTrackSelectorModel;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
11
|
export default FacetFilters;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import FacetFilter from './FacetFilter';
|
|
3
2
|
import { observer } from 'mobx-react';
|
|
4
|
-
|
|
3
|
+
// locals
|
|
4
|
+
import FacetFilter from './FacetFilter';
|
|
5
|
+
import { getRowStr } from './util';
|
|
6
|
+
const FacetFilters = observer(function ({ rows, columns, model, }) {
|
|
5
7
|
var _a, _b;
|
|
6
8
|
const { faceted } = model;
|
|
7
9
|
const { filters } = faceted;
|
|
@@ -26,7 +28,7 @@ const FacetFilters = observer(function ({ rows, columns, width, model, }) {
|
|
|
26
28
|
for (const facet of ret) {
|
|
27
29
|
const elt = uniqs.get(facet);
|
|
28
30
|
for (const row of currentRows) {
|
|
29
|
-
const key =
|
|
31
|
+
const key = getRowStr(facet, row);
|
|
30
32
|
const val = elt.get(key);
|
|
31
33
|
// we don't allow filtering on empty yet
|
|
32
34
|
if (key) {
|
|
@@ -41,10 +43,8 @@ const FacetFilters = observer(function ({ rows, columns, width, model, }) {
|
|
|
41
43
|
const filter = ((_b = filters.get(facet)) === null || _b === void 0 ? void 0 : _b.length)
|
|
42
44
|
? new Set(filters.get(facet))
|
|
43
45
|
: undefined;
|
|
44
|
-
currentRows = currentRows.filter(row =>
|
|
45
|
-
return filter !== undefined ? filter.has(row[facet]) : true;
|
|
46
|
-
});
|
|
46
|
+
currentRows = currentRows.filter(row => filter !== undefined ? filter.has(getRowStr(facet, row)) : true);
|
|
47
47
|
}
|
|
48
|
-
return (React.createElement("div", null, facets.map(
|
|
48
|
+
return (React.createElement("div", null, facets.map(c => (React.createElement(FacetFilter, { key: c.field, vals: [...uniqs.get(c.field)], column: c, model: model })))));
|
|
49
49
|
});
|
|
50
50
|
export default FacetFilters;
|
|
@@ -29,11 +29,10 @@ const frac = 0.75;
|
|
|
29
29
|
const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
30
30
|
var _a;
|
|
31
31
|
const { classes } = useStyles();
|
|
32
|
-
const { view, selection, faceted } = model;
|
|
32
|
+
const { view, selection, shownTrackIds, faceted } = model;
|
|
33
33
|
const { rows, panelWidth, showFilters, useShoppingCart, showOptions, filteredRows, filteredNonMetadataKeys, filteredMetadataKeys, visible, widths, } = faceted;
|
|
34
34
|
const { pluginManager } = getEnv(model);
|
|
35
35
|
const { ref, scrollLeft } = useResizeBar();
|
|
36
|
-
const tracks = view.tracks;
|
|
37
36
|
const widthsDebounced = useDebounce(widths, 200);
|
|
38
37
|
const columns = [
|
|
39
38
|
{
|
|
@@ -75,7 +74,6 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
|
75
74
|
});
|
|
76
75
|
}),
|
|
77
76
|
];
|
|
78
|
-
const shownTrackIds = new Set(tracks.map(t => t.configuration.trackId));
|
|
79
77
|
return (React.createElement(React.Fragment, null,
|
|
80
78
|
React.createElement(FacetedHeader, { model: model }),
|
|
81
79
|
React.createElement("div", { ref: ref, style: {
|
|
@@ -125,11 +123,7 @@ const FacetedSelector = observer(function FacetedSelector({ model, }) {
|
|
|
125
123
|
}, columns: columns, rowHeight: 25 })),
|
|
126
124
|
showFilters ? (React.createElement(React.Fragment, null,
|
|
127
125
|
React.createElement(ResizeHandle, { vertical: true, onDrag: dist => faceted.setPanelWidth(panelWidth - dist), className: classes.resizeHandle }),
|
|
128
|
-
React.createElement("div", { style: {
|
|
129
|
-
|
|
130
|
-
overflowY: 'auto',
|
|
131
|
-
overflowX: 'hidden',
|
|
132
|
-
} },
|
|
133
|
-
React.createElement(FacetFilters, { model: model, width: panelWidth - 10, rows: rows, columns: columns })))) : null)));
|
|
126
|
+
React.createElement("div", { style: { width: panelWidth, overflow: 'auto' } },
|
|
127
|
+
React.createElement(FacetFilters, { model: model, rows: rows, columns: columns })))) : null)));
|
|
134
128
|
});
|
|
135
129
|
export default FacetedSelector;
|
|
@@ -81,7 +81,7 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
81
81
|
readonly category: string;
|
|
82
82
|
readonly adapter: string;
|
|
83
83
|
readonly description: string;
|
|
84
|
-
readonly metadata:
|
|
84
|
+
readonly metadata: Record<string, unknown>;
|
|
85
85
|
}[];
|
|
86
86
|
} & {
|
|
87
87
|
/**
|
|
@@ -111,7 +111,7 @@ export declare function facetedStateTreeF(): import("mobx-state-tree").IModelTyp
|
|
|
111
111
|
readonly category: string;
|
|
112
112
|
readonly adapter: string;
|
|
113
113
|
readonly description: string;
|
|
114
|
-
readonly metadata:
|
|
114
|
+
readonly metadata: Record<string, unknown>;
|
|
115
115
|
}[];
|
|
116
116
|
} & {
|
|
117
117
|
/**
|
|
@@ -5,6 +5,7 @@ import { getTrackName } from '@jbrowse/core/util/tracks';
|
|
|
5
5
|
import { getSession, localStorageGetItem, measureGridWidth, } from '@jbrowse/core/util';
|
|
6
6
|
import { autorun, observable } from 'mobx';
|
|
7
7
|
import { getRootKeys, findNonSparseKeys } from './facetedUtil';
|
|
8
|
+
import { getRowStr } from './components/faceted/util';
|
|
8
9
|
const nonMetadataKeys = ['category', 'adapter', 'description'];
|
|
9
10
|
/**
|
|
10
11
|
* #stateModel FacetedModel
|
|
@@ -98,13 +99,10 @@ export function facetedStateTreeF() {
|
|
|
98
99
|
get rows() {
|
|
99
100
|
const session = getSession(self);
|
|
100
101
|
const { allTrackConfigurations, filterText } = self;
|
|
101
|
-
// metadata is spread onto the object for easier access and sorting
|
|
102
|
-
// by the mui data grid (it's unable to sort by nested objects)
|
|
103
102
|
return allTrackConfigurations
|
|
104
103
|
.filter(conf => matches(filterText, conf, session))
|
|
105
104
|
.map(track => {
|
|
106
105
|
var _a, _b;
|
|
107
|
-
const metadata = readConfObject(track, 'metadata');
|
|
108
106
|
return {
|
|
109
107
|
id: track.trackId,
|
|
110
108
|
conf: track,
|
|
@@ -112,7 +110,7 @@ export function facetedStateTreeF() {
|
|
|
112
110
|
category: (_a = readConfObject(track, 'category')) === null || _a === void 0 ? void 0 : _a.join(', '),
|
|
113
111
|
adapter: (_b = readConfObject(track, 'adapter')) === null || _b === void 0 ? void 0 : _b.type,
|
|
114
112
|
description: readConfObject(track, 'description'),
|
|
115
|
-
metadata,
|
|
113
|
+
metadata: readConfObject(track, 'metadata'),
|
|
116
114
|
};
|
|
117
115
|
});
|
|
118
116
|
},
|
|
@@ -156,9 +154,7 @@ export function facetedStateTreeF() {
|
|
|
156
154
|
const arrFilters = [...self.filters.entries()]
|
|
157
155
|
.filter(f => f[1].length > 0)
|
|
158
156
|
.map(([key, val]) => [key, new Set(val)]);
|
|
159
|
-
return self.rows.filter(row =>
|
|
160
|
-
// @ts-expect-error
|
|
161
|
-
arrFilters.every(([key, val]) => val.has(row[key])));
|
|
157
|
+
return self.rows.filter(row => arrFilters.every(([key, val]) => val.has(getRowStr(key, row))));
|
|
162
158
|
},
|
|
163
159
|
}))
|
|
164
160
|
.actions(self => ({
|
|
@@ -42,23 +42,23 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
42
42
|
showSparse: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
43
43
|
showFilters: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
44
44
|
showOptions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
45
|
-
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
46
|
-
* #property
|
|
47
|
-
*/
|
|
45
|
+
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
48
46
|
}, {
|
|
49
47
|
visible: Record<string, boolean>;
|
|
50
|
-
widths: Record<string, number | undefined>;
|
|
48
|
+
widths: Record<string, number | undefined>; /**
|
|
49
|
+
* #property
|
|
50
|
+
*/
|
|
51
51
|
useShoppingCart: boolean;
|
|
52
|
-
filters: import("mobx").ObservableMap<string, string[]>;
|
|
52
|
+
filters: import("mobx").ObservableMap<string, string[]>; /**
|
|
53
|
+
* #property
|
|
54
|
+
*/
|
|
53
55
|
} & {
|
|
54
56
|
setFilter(key: string, value: string[]): void;
|
|
55
57
|
setPanelWidth(width: number): void;
|
|
56
58
|
setUseShoppingCart(f: boolean): void;
|
|
57
59
|
setFilterText(str: string): void;
|
|
58
60
|
setShowSparse(f: boolean): void;
|
|
59
|
-
setShowOptions(f: boolean): void;
|
|
60
|
-
* #getter
|
|
61
|
-
*/
|
|
61
|
+
setShowOptions(f: boolean): void;
|
|
62
62
|
setShowFilters(f: boolean): void;
|
|
63
63
|
} & {
|
|
64
64
|
readonly allTrackConfigurations: ({
|
|
@@ -78,7 +78,7 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
78
78
|
readonly category: string;
|
|
79
79
|
readonly adapter: string;
|
|
80
80
|
readonly description: string;
|
|
81
|
-
readonly metadata:
|
|
81
|
+
readonly metadata: Record<string, unknown>;
|
|
82
82
|
}[];
|
|
83
83
|
} & {
|
|
84
84
|
readonly filteredNonMetadataKeys: string[] | readonly ["category", "adapter", "description"];
|
|
@@ -96,7 +96,7 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
96
96
|
readonly category: string;
|
|
97
97
|
readonly adapter: string;
|
|
98
98
|
readonly description: string;
|
|
99
|
-
readonly metadata:
|
|
99
|
+
readonly metadata: Record<string, unknown>;
|
|
100
100
|
}[];
|
|
101
101
|
} & {
|
|
102
102
|
setVisible(args: Record<string, boolean>): void;
|
|
@@ -115,6 +115,10 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
115
115
|
recentlyUsedCounter: number;
|
|
116
116
|
favoritesCounter: number;
|
|
117
117
|
} & {
|
|
118
|
+
/**
|
|
119
|
+
* #getter
|
|
120
|
+
*/
|
|
121
|
+
readonly shownTrackIds: Set<string>;
|
|
118
122
|
/**
|
|
119
123
|
* #getter
|
|
120
124
|
*/
|
|
@@ -72,6 +72,13 @@ export default function stateTreeFactory(pluginManager) {
|
|
|
72
72
|
favoritesCounter: 0,
|
|
73
73
|
}))
|
|
74
74
|
.views(self => ({
|
|
75
|
+
/**
|
|
76
|
+
* #getter
|
|
77
|
+
*/
|
|
78
|
+
get shownTrackIds() {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
return new Set((_b = (_a = self.view) === null || _a === void 0 ? void 0 : _a.tracks) === null || _b === void 0 ? void 0 : _b.map((t) => t.configuration.trackId));
|
|
81
|
+
},
|
|
75
82
|
/**
|
|
76
83
|
* #getter
|
|
77
84
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-data-management",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.1",
|
|
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": "442b5f87efddfdf4ccf520b4d9dd01ddd370cb07"
|
|
64
64
|
}
|