@jbrowse/plugin-data-management 2.11.0 → 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/AddConnectionWidget/index.d.ts +1 -2
- package/dist/AddConnectionWidget/index.js +3 -2
- package/dist/AddTrackWidget/index.d.ts +1 -2
- package/dist/AddTrackWidget/index.js +3 -2
- 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/index.d.ts +1 -2
- package/dist/HierarchicalTrackSelectorWidget/index.js +3 -2
- package/dist/HierarchicalTrackSelectorWidget/model.d.ts +16 -36
- package/dist/HierarchicalTrackSelectorWidget/model.js +99 -86
- package/dist/HierarchicalTrackSelectorWidget/util.d.ts +1 -1
- package/dist/HierarchicalTrackSelectorWidget/util.js +4 -3
- package/dist/PluginStoreWidget/index.d.ts +1 -2
- package/dist/PluginStoreWidget/index.js +3 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/ucsc-trackhub/index.d.ts +1 -2
- package/dist/ucsc-trackhub/index.js +3 -2
- package/esm/AddConnectionWidget/index.d.ts +1 -2
- package/esm/AddConnectionWidget/index.js +2 -2
- package/esm/AddTrackWidget/index.d.ts +1 -2
- package/esm/AddTrackWidget/index.js +2 -2
- 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/index.d.ts +1 -2
- package/esm/HierarchicalTrackSelectorWidget/index.js +2 -2
- package/esm/HierarchicalTrackSelectorWidget/model.d.ts +16 -36
- package/esm/HierarchicalTrackSelectorWidget/model.js +100 -87
- package/esm/HierarchicalTrackSelectorWidget/util.d.ts +1 -1
- package/esm/HierarchicalTrackSelectorWidget/util.js +4 -3
- package/esm/PluginStoreWidget/index.d.ts +1 -2
- package/esm/PluginStoreWidget/index.js +2 -2
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/ucsc-trackhub/index.d.ts +1 -2
- package/esm/ucsc-trackhub/index.js +2 -2
- package/package.json +2 -2
|
@@ -31,7 +31,7 @@ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
|
|
|
31
31
|
const react_1 = require("react");
|
|
32
32
|
const model_1 = __importDefault(require("./model"));
|
|
33
33
|
const configSchema = (0, configuration_1.ConfigurationSchema)('AddConnectionWidget', {});
|
|
34
|
-
|
|
34
|
+
function AddConnectionWidgetF(pluginManager) {
|
|
35
35
|
pluginManager.addWidgetType(() => {
|
|
36
36
|
return new pluggableElementTypes_1.WidgetType({
|
|
37
37
|
name: 'AddConnectionWidget',
|
|
@@ -41,4 +41,5 @@ exports.default = (pluginManager) => {
|
|
|
41
41
|
ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/AddConnectionWidget')))),
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = AddConnectionWidgetF;
|
|
@@ -31,7 +31,7 @@ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
|
|
|
31
31
|
const react_1 = require("react");
|
|
32
32
|
const model_1 = __importDefault(require("./model"));
|
|
33
33
|
const configSchema = (0, configuration_1.ConfigurationSchema)('AddTrackWidget', {});
|
|
34
|
-
|
|
34
|
+
function AddTrackWidgetF(pluginManager) {
|
|
35
35
|
pluginManager.addWidgetType(() => {
|
|
36
36
|
return new pluggableElementTypes_1.WidgetType({
|
|
37
37
|
name: 'AddTrackWidget',
|
|
@@ -41,4 +41,5 @@ exports.default = (pluginManager) => {
|
|
|
41
41
|
ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/AddTrackWidget')))),
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = AddTrackWidgetF;
|
|
@@ -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
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
|
|
3
|
-
export default _default;
|
|
2
|
+
export default function HierarchicalTrackSelectorWidgetF(pluginManager: PluginManager): void;
|
|
4
3
|
export { type HierarchicalTrackSelectorModel, default as stateModelFactory, } from './model';
|
|
5
4
|
export { default as configSchema } from './configSchema';
|
|
@@ -31,7 +31,7 @@ const model_1 = __importDefault(require("./model"));
|
|
|
31
31
|
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
32
32
|
const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
|
|
33
33
|
const react_1 = require("react");
|
|
34
|
-
|
|
34
|
+
function HierarchicalTrackSelectorWidgetF(pluginManager) {
|
|
35
35
|
pluginManager.addWidgetType(() => {
|
|
36
36
|
return new pluggableElementTypes_1.WidgetType({
|
|
37
37
|
name: 'HierarchicalTrackSelectorWidget',
|
|
@@ -41,7 +41,8 @@ exports.default = (pluginManager) => {
|
|
|
41
41
|
ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/HierarchicalTrackSelector')))),
|
|
42
42
|
});
|
|
43
43
|
});
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = HierarchicalTrackSelectorWidgetF;
|
|
45
46
|
var model_2 = require("./model");
|
|
46
47
|
Object.defineProperty(exports, "stateModelFactory", { enumerable: true, get: function () { return __importDefault(model_2).default; } });
|
|
47
48
|
var configSchema_2 = require("./configSchema");
|
|
@@ -14,22 +14,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
14
14
|
* #property
|
|
15
15
|
*/
|
|
16
16
|
type: import("mobx-state-tree").ISimpleType<"HierarchicalTrackSelectorWidget">;
|
|
17
|
-
/**
|
|
18
|
-
* #property
|
|
19
|
-
*/
|
|
20
|
-
initialized: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<boolean>>;
|
|
21
|
-
/**
|
|
22
|
-
* #property
|
|
23
|
-
*/
|
|
24
|
-
collapsed: import("mobx-state-tree").IMapType<import("mobx-state-tree").ISimpleType<boolean>>;
|
|
25
|
-
/**
|
|
26
|
-
* #property
|
|
27
|
-
*/
|
|
28
|
-
sortTrackNames: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<boolean>>;
|
|
29
|
-
/**
|
|
30
|
-
* #property
|
|
31
|
-
*/
|
|
32
|
-
sortCategories: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<boolean>>;
|
|
33
17
|
/**
|
|
34
18
|
* #property
|
|
35
19
|
*/
|
|
@@ -45,7 +29,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
45
29
|
panelWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
46
30
|
}, {
|
|
47
31
|
visible: Record<string, boolean>;
|
|
48
|
-
widths: Record<string, number | undefined>;
|
|
49
32
|
useShoppingCart: boolean;
|
|
50
33
|
filters: import("mobx").ObservableMap<string, string[]>;
|
|
51
34
|
} & {
|
|
@@ -54,7 +37,9 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
54
37
|
setUseShoppingCart(f: boolean): void;
|
|
55
38
|
setFilterText(str: string): void;
|
|
56
39
|
setShowSparse(f: boolean): void;
|
|
57
|
-
setShowOptions(f: boolean): void;
|
|
40
|
+
setShowOptions(f: boolean): void; /**
|
|
41
|
+
* #property
|
|
42
|
+
*/
|
|
58
43
|
setShowFilters(f: boolean): void;
|
|
59
44
|
} & {
|
|
60
45
|
readonly allTrackConfigurations: ({
|
|
@@ -96,7 +81,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
96
81
|
}[];
|
|
97
82
|
} & {
|
|
98
83
|
setVisible(args: Record<string, boolean>): void;
|
|
99
|
-
setWidths(args: Record<string, number | undefined>): void;
|
|
100
84
|
afterAttach(): void;
|
|
101
85
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
102
86
|
}, {
|
|
@@ -107,6 +91,9 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
107
91
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
108
92
|
setSubschema(slotName: string, data: unknown): any;
|
|
109
93
|
} & import("mobx-state-tree").IStateTreeNode<import("@jbrowse/core/configuration").AnyConfigurationSchemaType>)[];
|
|
94
|
+
sortTrackNames: boolean;
|
|
95
|
+
sortCategories: boolean;
|
|
96
|
+
collapsed: import("mobx").ObservableMap<string, boolean>;
|
|
110
97
|
filterText: string;
|
|
111
98
|
recentlyUsedCounter: number;
|
|
112
99
|
favoritesCounter: number;
|
|
@@ -131,6 +118,10 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
131
118
|
* #getter
|
|
132
119
|
*/
|
|
133
120
|
readonly recentlyUsedSet: Set<string>;
|
|
121
|
+
/**
|
|
122
|
+
* #getter
|
|
123
|
+
*/
|
|
124
|
+
readonly assemblyNames: string[];
|
|
134
125
|
} & {
|
|
135
126
|
/**
|
|
136
127
|
* #action
|
|
@@ -208,6 +199,10 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
208
199
|
* #action
|
|
209
200
|
*/
|
|
210
201
|
expandAllCategories(): void;
|
|
202
|
+
/**
|
|
203
|
+
* #action
|
|
204
|
+
*/
|
|
205
|
+
setCollapsedCategories(str: [string, boolean][]): void;
|
|
211
206
|
/**
|
|
212
207
|
* #action
|
|
213
208
|
*/
|
|
@@ -237,24 +232,11 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
237
232
|
/**
|
|
238
233
|
* #getter
|
|
239
234
|
*/
|
|
240
|
-
readonly
|
|
241
|
-
} & {
|
|
242
|
-
/**
|
|
243
|
-
* #getter
|
|
244
|
-
*/
|
|
245
|
-
readonly recentlyUsedLocalStorageKey: string;
|
|
235
|
+
readonly activeSortTrackNames: boolean;
|
|
246
236
|
/**
|
|
247
237
|
* #getter
|
|
248
238
|
*/
|
|
249
|
-
readonly
|
|
250
|
-
/**
|
|
251
|
-
* #getter
|
|
252
|
-
*/
|
|
253
|
-
readonly activeSortTrackNames: any;
|
|
254
|
-
/**
|
|
255
|
-
* #getter
|
|
256
|
-
*/
|
|
257
|
-
readonly activeSortCategories: any;
|
|
239
|
+
readonly activeSortCategories: boolean;
|
|
258
240
|
/**
|
|
259
241
|
* #getter
|
|
260
242
|
* filter out tracks that don't match the current assembly/display types
|
|
@@ -340,8 +322,6 @@ export default function stateTreeFactory(pluginManager: PluginManager): import("
|
|
|
340
322
|
* #action
|
|
341
323
|
*/
|
|
342
324
|
collapseTopLevelCategories(): void;
|
|
343
|
-
} & {
|
|
344
|
-
afterCreate(): void;
|
|
345
325
|
} & {
|
|
346
326
|
/**
|
|
347
327
|
* #getter
|
|
@@ -10,21 +10,52 @@ const filterTracks_1 = require("./filterTracks");
|
|
|
10
10
|
const generateHierarchy_1 = require("./generateHierarchy");
|
|
11
11
|
const util_2 = require("./util");
|
|
12
12
|
const facetedModel_1 = require("./facetedModel");
|
|
13
|
-
// for settings that are config dependent
|
|
14
|
-
function
|
|
13
|
+
// for settings that are not config dependent
|
|
14
|
+
function keyNoConfigPostFix() {
|
|
15
15
|
return typeof window !== 'undefined'
|
|
16
16
|
? [window.location.host, window.location.pathname].join('-')
|
|
17
17
|
: 'empty';
|
|
18
18
|
}
|
|
19
|
-
// for settings that are
|
|
20
|
-
function
|
|
19
|
+
// for settings that are config dependent
|
|
20
|
+
function keyConfigPostFix() {
|
|
21
21
|
return typeof window !== 'undefined'
|
|
22
22
|
? [
|
|
23
|
-
|
|
23
|
+
keyNoConfigPostFix(),
|
|
24
24
|
new URLSearchParams(window.location.search).get('config'),
|
|
25
25
|
].join('-')
|
|
26
26
|
: 'empty';
|
|
27
27
|
}
|
|
28
|
+
function recentlyUsedK(assemblyNames) {
|
|
29
|
+
return ['recentlyUsedTracks', keyConfigPostFix(), assemblyNames.join(',')]
|
|
30
|
+
.filter(f => !!f)
|
|
31
|
+
.join('-');
|
|
32
|
+
}
|
|
33
|
+
// this has a extra } at the end because that's how it was initially
|
|
34
|
+
// released
|
|
35
|
+
function favoritesK() {
|
|
36
|
+
return `favoriteTracks-${keyConfigPostFix()}}`;
|
|
37
|
+
}
|
|
38
|
+
function collapsedK(assemblyNames, viewType) {
|
|
39
|
+
return [
|
|
40
|
+
'collapsedCategories',
|
|
41
|
+
keyConfigPostFix(),
|
|
42
|
+
assemblyNames.join(','),
|
|
43
|
+
viewType,
|
|
44
|
+
].join('-');
|
|
45
|
+
}
|
|
46
|
+
function sortTrackNamesK() {
|
|
47
|
+
return 'sortTrackNames';
|
|
48
|
+
}
|
|
49
|
+
function sortCategoriesK() {
|
|
50
|
+
return 'sortCategories';
|
|
51
|
+
}
|
|
52
|
+
function localStorageGetJSON(key, defaultValue) {
|
|
53
|
+
var _a;
|
|
54
|
+
return JSON.parse((_a = (0, util_1.localStorageGetItem)(key)) !== null && _a !== void 0 ? _a : defaultValue);
|
|
55
|
+
}
|
|
56
|
+
function localStorageSetJSON(key, val) {
|
|
57
|
+
(0, util_1.localStorageSetItem)(key, JSON.stringify(val));
|
|
58
|
+
}
|
|
28
59
|
const MAX_RECENTLY_USED = 10;
|
|
29
60
|
/**
|
|
30
61
|
* #stateModel HierarchicalTrackSelectorWidget
|
|
@@ -40,22 +71,6 @@ function stateTreeFactory(pluginManager) {
|
|
|
40
71
|
* #property
|
|
41
72
|
*/
|
|
42
73
|
type: mobx_state_tree_1.types.literal('HierarchicalTrackSelectorWidget'),
|
|
43
|
-
/**
|
|
44
|
-
* #property
|
|
45
|
-
*/
|
|
46
|
-
initialized: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
47
|
-
/**
|
|
48
|
-
* #property
|
|
49
|
-
*/
|
|
50
|
-
collapsed: mobx_state_tree_1.types.map(mobx_state_tree_1.types.boolean),
|
|
51
|
-
/**
|
|
52
|
-
* #property
|
|
53
|
-
*/
|
|
54
|
-
sortTrackNames: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
55
|
-
/**
|
|
56
|
-
* #property
|
|
57
|
-
*/
|
|
58
|
-
sortCategories: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
59
74
|
/**
|
|
60
75
|
* #property
|
|
61
76
|
*/
|
|
@@ -66,9 +81,12 @@ function stateTreeFactory(pluginManager) {
|
|
|
66
81
|
faceted: mobx_state_tree_1.types.optional((0, facetedModel_1.facetedStateTreeF)(), {}),
|
|
67
82
|
})
|
|
68
83
|
.volatile(() => ({
|
|
69
|
-
favorites: [],
|
|
84
|
+
favorites: localStorageGetJSON(favoritesK(), '[]'),
|
|
70
85
|
recentlyUsed: [],
|
|
71
86
|
selection: [],
|
|
87
|
+
sortTrackNames: !!localStorageGetJSON(sortTrackNamesK(), 'false'),
|
|
88
|
+
sortCategories: !!localStorageGetJSON(sortCategoriesK(), 'false'),
|
|
89
|
+
collapsed: mobx_1.observable.map(),
|
|
72
90
|
filterText: '',
|
|
73
91
|
recentlyUsedCounter: 0,
|
|
74
92
|
favoritesCounter: 0,
|
|
@@ -99,6 +117,13 @@ function stateTreeFactory(pluginManager) {
|
|
|
99
117
|
get recentlyUsedSet() {
|
|
100
118
|
return new Set(self.recentlyUsed);
|
|
101
119
|
},
|
|
120
|
+
/**
|
|
121
|
+
* #getter
|
|
122
|
+
*/
|
|
123
|
+
get assemblyNames() {
|
|
124
|
+
var _a;
|
|
125
|
+
return ((_a = self.view) === null || _a === void 0 ? void 0 : _a.assemblyNames) || [];
|
|
126
|
+
},
|
|
102
127
|
}))
|
|
103
128
|
.actions(self => ({
|
|
104
129
|
/**
|
|
@@ -223,6 +248,12 @@ function stateTreeFactory(pluginManager) {
|
|
|
223
248
|
expandAllCategories() {
|
|
224
249
|
self.collapsed.clear();
|
|
225
250
|
},
|
|
251
|
+
/**
|
|
252
|
+
* #action
|
|
253
|
+
*/
|
|
254
|
+
setCollapsedCategories(str) {
|
|
255
|
+
self.collapsed.replace(str);
|
|
256
|
+
},
|
|
226
257
|
/**
|
|
227
258
|
* #action
|
|
228
259
|
*/
|
|
@@ -263,43 +294,17 @@ function stateTreeFactory(pluginManager) {
|
|
|
263
294
|
const assembly = assemblyManager.get(assemblyName);
|
|
264
295
|
const trackConf = assembly === null || assembly === void 0 ? void 0 : assembly.configuration.sequence;
|
|
265
296
|
const viewType = pluginManager.getViewType(self.view.type);
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
return trackConf;
|
|
297
|
+
if (trackConf) {
|
|
298
|
+
for (const display of trackConf.displays) {
|
|
299
|
+
if (viewType.displayTypes.some(d => d.name === display.type)) {
|
|
300
|
+
return trackConf;
|
|
301
|
+
}
|
|
272
302
|
}
|
|
273
303
|
}
|
|
274
304
|
return undefined;
|
|
275
305
|
},
|
|
276
306
|
}))
|
|
277
307
|
.views(self => ({
|
|
278
|
-
/**
|
|
279
|
-
* #getter
|
|
280
|
-
*/
|
|
281
|
-
get assemblyNames() {
|
|
282
|
-
var _a;
|
|
283
|
-
return ((_a = self.view) === null || _a === void 0 ? void 0 : _a.assemblyNames) || [];
|
|
284
|
-
},
|
|
285
|
-
}))
|
|
286
|
-
.views(self => ({
|
|
287
|
-
/**
|
|
288
|
-
* #getter
|
|
289
|
-
*/
|
|
290
|
-
get recentlyUsedLocalStorageKey() {
|
|
291
|
-
return `recentlyUsedTracks-${[postF(), self.assemblyNames.join(',')]
|
|
292
|
-
.filter(f => !!f)
|
|
293
|
-
.join('-')}`;
|
|
294
|
-
},
|
|
295
|
-
/**
|
|
296
|
-
* #getter
|
|
297
|
-
*/
|
|
298
|
-
get favoritesLocalStorageKey() {
|
|
299
|
-
// this has a extra } at the end because that's how it was initially
|
|
300
|
-
// released
|
|
301
|
-
return `favoriteTracks-${postF()}}`;
|
|
302
|
-
},
|
|
303
308
|
/**
|
|
304
309
|
* #getter
|
|
305
310
|
*/
|
|
@@ -434,35 +439,6 @@ function stateTreeFactory(pluginManager) {
|
|
|
434
439
|
self.setCategoryCollapsed(path, true);
|
|
435
440
|
}
|
|
436
441
|
},
|
|
437
|
-
}))
|
|
438
|
-
.actions(self => ({
|
|
439
|
-
afterCreate() {
|
|
440
|
-
if (!self.initialized) {
|
|
441
|
-
const session = (0, util_1.getSession)(self);
|
|
442
|
-
if ((0, configuration_1.getConf)(session, [
|
|
443
|
-
'hierarchical',
|
|
444
|
-
'defaultCollapsed',
|
|
445
|
-
'topLevelCategories',
|
|
446
|
-
])) {
|
|
447
|
-
self.collapseTopLevelCategories();
|
|
448
|
-
}
|
|
449
|
-
if ((0, configuration_1.getConf)(session, [
|
|
450
|
-
'hierarchical',
|
|
451
|
-
'defaultCollapsed',
|
|
452
|
-
'subCategories',
|
|
453
|
-
])) {
|
|
454
|
-
self.collapseSubCategories();
|
|
455
|
-
}
|
|
456
|
-
for (const entry of (0, configuration_1.getConf)(session, [
|
|
457
|
-
'hierarchical',
|
|
458
|
-
'defaultCollapsed',
|
|
459
|
-
'categoryNames',
|
|
460
|
-
])) {
|
|
461
|
-
self.collapsed.set(entry, true);
|
|
462
|
-
}
|
|
463
|
-
self.initialized = true;
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
442
|
}))
|
|
467
443
|
.views(self => ({
|
|
468
444
|
/**
|
|
@@ -476,13 +452,50 @@ function stateTreeFactory(pluginManager) {
|
|
|
476
452
|
afterAttach() {
|
|
477
453
|
// this should be the first autorun to properly initialize
|
|
478
454
|
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
479
|
-
|
|
480
|
-
self.
|
|
455
|
+
const { assemblyNames, view } = self;
|
|
456
|
+
self.setRecentlyUsed(localStorageGetJSON(recentlyUsedK(assemblyNames), '[]'));
|
|
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
|
+
}
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
self.setCollapsedCategories(JSON.parse(val));
|
|
486
|
+
}
|
|
487
|
+
}
|
|
481
488
|
}));
|
|
482
489
|
// this should be the second autorun
|
|
483
490
|
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
484
|
-
|
|
485
|
-
(
|
|
491
|
+
const { assemblyNames, collapsed, view } = self;
|
|
492
|
+
localStorageSetJSON(recentlyUsedK(assemblyNames), self.recentlyUsed);
|
|
493
|
+
localStorageSetJSON(favoritesK(), self.favorites);
|
|
494
|
+
localStorageSetJSON(sortTrackNamesK(), self.sortTrackNames);
|
|
495
|
+
localStorageSetJSON(sortCategoriesK(), self.sortCategories);
|
|
496
|
+
if (view) {
|
|
497
|
+
localStorageSetJSON(collapsedK(assemblyNames, view.type), collapsed);
|
|
498
|
+
}
|
|
486
499
|
}));
|
|
487
500
|
},
|
|
488
501
|
}));
|
|
@@ -7,6 +7,6 @@ interface Node {
|
|
|
7
7
|
children: Node[];
|
|
8
8
|
id: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function findSubCategories(obj: Node[], paths: string[]): boolean;
|
|
10
|
+
export declare function findSubCategories(obj: Node[], paths: string[], depth?: number): boolean;
|
|
11
11
|
export declare function findTopLevelCategories(obj: Node[], paths: string[]): void;
|
|
12
12
|
export {};
|
|
@@ -27,12 +27,13 @@ function matches(query, conf, session) {
|
|
|
27
27
|
!!categories.filter(c => c.toLowerCase().includes(queryLower)).length);
|
|
28
28
|
}
|
|
29
29
|
exports.matches = matches;
|
|
30
|
-
function findSubCategories(obj, paths) {
|
|
30
|
+
function findSubCategories(obj, paths, depth = 0) {
|
|
31
31
|
let hasSubs = false;
|
|
32
32
|
for (const elt of obj) {
|
|
33
33
|
if (elt.children.length) {
|
|
34
|
-
const hasSubCategories = findSubCategories(elt.children, paths);
|
|
35
|
-
|
|
34
|
+
const hasSubCategories = findSubCategories(elt.children, paths, depth + 1);
|
|
35
|
+
// avoid pushing the root "Tracks" node by checking depth>0
|
|
36
|
+
if (hasSubCategories && depth > 0) {
|
|
36
37
|
paths.push(elt.id);
|
|
37
38
|
}
|
|
38
39
|
}
|