@jbrowse/core 2.10.1 → 2.10.3
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/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/util.d.ts +0 -1
- package/BaseFeatureWidget/BaseFeatureDetail/util.js +1 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +6 -6
- package/BaseFeatureWidget/SequenceFeatureDetails/index.js +12 -8
- package/BaseFeatureWidget/configSchema.d.ts +2 -0
- package/BaseFeatureWidget/configSchema.js +6 -0
- package/BaseFeatureWidget/index.d.ts +2 -128
- package/BaseFeatureWidget/index.js +4 -168
- package/BaseFeatureWidget/stateModelFactory.d.ts +126 -0
- package/BaseFeatureWidget/stateModelFactory.js +168 -0
- package/Plugin.d.ts +1 -1
- package/Plugin.js +0 -3
- package/ReExports/modules.js +5 -5
- package/package.json +3 -2
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +3 -2
- package/rpc/BaseRpcDriver.d.ts +3 -3
- package/rpc/WebWorkerRpcDriver.d.ts +2 -3
- package/rpc/WebWorkerRpcDriver.js +1 -1
- package/rpc/methods/CoreRender.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/ErrorMessage.js +33 -10
- package/ui/ErrorMessageStackTraceDialog.d.ts +5 -0
- package/ui/ErrorMessageStackTraceDialog.js +158 -0
- package/ui/RedErrorMessageBox.d.ts +4 -0
- package/ui/RedErrorMessageBox.js +17 -0
- package/ui/Snackbar.js +1 -1
- package/util/tracks.js +1 -1
- package/util/types/index.d.ts +0 -4
- package/util/types/index.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IAnyStateTreeNode } from 'mobx-state-tree';
|
|
3
|
-
import { BaseCardProps, BaseProps } from '../types';
|
|
4
3
|
import { SimpleFeatureSerialized } from '../../util';
|
|
4
|
+
import { BaseCardProps, BaseProps } from '../types';
|
|
5
5
|
export declare function BaseCard({ children, title, defaultExpanded, }: BaseCardProps): React.JSX.Element;
|
|
6
6
|
export declare const BaseCoreDetails: (props: BaseProps) => React.JSX.Element;
|
|
7
7
|
export declare const BaseAttributes: (props: BaseProps) => React.JSX.Element;
|
|
@@ -96,7 +96,7 @@ function CoreDetails(props) {
|
|
|
96
96
|
const { start, end } = formattedFeat;
|
|
97
97
|
const displayedDetails = {
|
|
98
98
|
...formattedFeat,
|
|
99
|
-
length: (0,
|
|
99
|
+
length: (0, util_1.toLocale)(end - start),
|
|
100
100
|
};
|
|
101
101
|
const coreRenderedDetails = {
|
|
102
102
|
description: 'Description',
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare function isEmpty(obj: Record<string, unknown>): boolean;
|
|
2
2
|
export declare function generateTitle(name: unknown, id: unknown, type: unknown): string;
|
|
3
3
|
export declare function generateMaxWidth(array: unknown[][], prefix: string[]): number;
|
|
4
|
-
export declare function toLocale(n: number): string;
|
|
5
4
|
export declare function accessNested(arr: string[], obj?: Record<string, unknown>): string | undefined;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.accessNested = exports.
|
|
6
|
+
exports.accessNested = exports.generateMaxWidth = exports.generateTitle = exports.isEmpty = void 0;
|
|
7
7
|
const is_object_1 = __importDefault(require("is-object"));
|
|
8
8
|
const util_1 = require("../../util");
|
|
9
9
|
const util_2 = require("../util");
|
|
@@ -21,10 +21,6 @@ function generateMaxWidth(array, prefix) {
|
|
|
21
21
|
return (Math.ceil((0, util_1.max)(array.map(key => (0, util_1.measureText)([...prefix, key[0]].join('.'), 12)))) + 10);
|
|
22
22
|
}
|
|
23
23
|
exports.generateMaxWidth = generateMaxWidth;
|
|
24
|
-
function toLocale(n) {
|
|
25
|
-
return n.toLocaleString('en-US');
|
|
26
|
-
}
|
|
27
|
-
exports.toLocale = toLocale;
|
|
28
24
|
// pick using a path from an object, similar to _.get from lodash with special
|
|
29
25
|
// logic for Descriptions from e.g. VCF headers
|
|
30
26
|
//
|
|
@@ -37,7 +37,7 @@ const ui_1 = require("../../ui");
|
|
|
37
37
|
const Settings_1 = __importDefault(require("@mui/icons-material/Settings"));
|
|
38
38
|
const hooks_1 = require("./hooks");
|
|
39
39
|
// lazies
|
|
40
|
-
const
|
|
40
|
+
const SettingsDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./SequenceFeatureSettingsDialog'))));
|
|
41
41
|
const SequencePanel = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./SequencePanel'))));
|
|
42
42
|
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
43
43
|
button: {
|
|
@@ -126,18 +126,18 @@ function SequenceFeatureDetails({ model, feature: prefeature, }) {
|
|
|
126
126
|
exports.default = SequenceFeatureDetails;
|
|
127
127
|
function Settings({ intronBp, upDownBp, setIntronBp, setUpDownBp, }) {
|
|
128
128
|
const { classes } = useStyles();
|
|
129
|
-
const [
|
|
129
|
+
const [settingsDialogOpen, setSettingsDialogOpen] = (0, react_1.useState)(false);
|
|
130
130
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
131
131
|
react_1.default.createElement(material_1.FormControl, { className: classes.formControl },
|
|
132
|
-
react_1.default.createElement(material_1.IconButton, { onClick: () =>
|
|
132
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => setSettingsDialogOpen(true) },
|
|
133
133
|
react_1.default.createElement(Settings_1.default, null))),
|
|
134
|
-
|
|
135
|
-
react_1.default.createElement(
|
|
134
|
+
settingsDialogOpen ? (react_1.default.createElement(react_1.Suspense, { fallback: null },
|
|
135
|
+
react_1.default.createElement(SettingsDialog, { handleClose: arg => {
|
|
136
136
|
if (arg) {
|
|
137
137
|
const { upDownBp, intronBp } = arg;
|
|
138
138
|
setIntronBp(intronBp);
|
|
139
139
|
setUpDownBp(upDownBp);
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
setSettingsDialogOpen(false);
|
|
142
142
|
}, upDownBp: upDownBp, intronBp: intronBp }))) : null));
|
|
143
143
|
}
|
|
@@ -29,11 +29,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const material_1 = require("@mui/material");
|
|
31
31
|
const mui_1 = require("tss-react/mui");
|
|
32
|
+
const mobx_react_1 = require("mobx-react");
|
|
32
33
|
const ui_1 = require("../../ui");
|
|
34
|
+
const util_1 = require("../../util");
|
|
33
35
|
// icons
|
|
34
36
|
const Help_1 = __importDefault(require("@mui/icons-material/Help"));
|
|
35
37
|
// lazies
|
|
36
|
-
const
|
|
38
|
+
const HelpDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./SequenceHelpDialog'))));
|
|
37
39
|
const SequenceFeatureDetails = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./SequenceFeatureDetails'))));
|
|
38
40
|
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
39
41
|
formControl: {
|
|
@@ -44,25 +46,27 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
44
46
|
marginBottom: theme.spacing(4),
|
|
45
47
|
},
|
|
46
48
|
}));
|
|
49
|
+
const SequenceFeatureDetailsHelpButton = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
50
|
+
const { classes } = useStyles();
|
|
51
|
+
const session = (0, util_1.getSession)(model);
|
|
52
|
+
return (react_1.default.createElement(material_1.FormControl, { className: classes.formControl },
|
|
53
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => session.queueDialog(handleClose => [HelpDialog, { handleClose }]) },
|
|
54
|
+
react_1.default.createElement(Help_1.default, null))));
|
|
55
|
+
});
|
|
47
56
|
// display the stitched-together sequence of a gene's CDS, cDNA, or protein
|
|
48
57
|
// sequence. this is a best effort and weird genomic phenomena could lead these
|
|
49
58
|
// to not be 100% accurate
|
|
50
59
|
function SequenceFeaturePanel({ model, feature }) {
|
|
51
60
|
const { classes } = useStyles();
|
|
52
61
|
const [shown, setShown] = (0, react_1.useState)(false);
|
|
53
|
-
const [helpShown, setHelpShown] = (0, react_1.useState)(false);
|
|
54
62
|
return !model ? null : (react_1.default.createElement("div", { className: classes.container },
|
|
55
63
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => setShown(!shown) }, shown ? 'Hide feature sequence' : 'Show feature sequence'),
|
|
56
|
-
react_1.default.createElement(
|
|
57
|
-
react_1.default.createElement(material_1.IconButton, { onClick: () => setHelpShown(true) },
|
|
58
|
-
react_1.default.createElement(Help_1.default, null))),
|
|
64
|
+
react_1.default.createElement(SequenceFeatureDetailsHelpButton, { model: model }),
|
|
59
65
|
shown ? (react_1.default.createElement(react_1.Suspense, { fallback: react_1.default.createElement(ui_1.LoadingEllipses, null) },
|
|
60
66
|
react_1.default.createElement(SequenceFeatureDetails
|
|
61
67
|
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion */
|
|
62
68
|
, {
|
|
63
69
|
/* eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion */
|
|
64
|
-
key: feature.uniqueId, model: model, feature: feature }))) : null
|
|
65
|
-
helpShown ? (react_1.default.createElement(react_1.Suspense, { fallback: react_1.default.createElement("div", null) },
|
|
66
|
-
react_1.default.createElement(HelpDlg, { handleClose: () => setHelpShown(false) }))) : null));
|
|
70
|
+
key: feature.uniqueId, model: model, feature: feature }))) : null));
|
|
67
71
|
}
|
|
68
72
|
exports.default = SequenceFeaturePanel;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.configSchema = void 0;
|
|
4
|
+
const configuration_1 = require("../configuration");
|
|
5
|
+
const configSchema = (0, configuration_1.ConfigurationSchema)('BaseFeatureWidget', {});
|
|
6
|
+
exports.configSchema = configSchema;
|
|
@@ -1,128 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* #stateModel BaseFeatureWidget
|
|
5
|
-
* displays data about features, allowing configuration callbacks to modify the
|
|
6
|
-
* contents of what is displayed
|
|
7
|
-
*
|
|
8
|
-
* see: formatDetails-\>feature,formatDetails-\>subfeatures
|
|
9
|
-
*/
|
|
10
|
-
export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
11
|
-
/**
|
|
12
|
-
* #property
|
|
13
|
-
*/
|
|
14
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
15
|
-
/**
|
|
16
|
-
* #property
|
|
17
|
-
*/
|
|
18
|
-
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
19
|
-
/**
|
|
20
|
-
* #property
|
|
21
|
-
*/
|
|
22
|
-
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
23
|
-
/**
|
|
24
|
-
* #property
|
|
25
|
-
*/
|
|
26
|
-
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
27
|
-
/**
|
|
28
|
-
* #property
|
|
29
|
-
*/
|
|
30
|
-
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
31
|
-
/**
|
|
32
|
-
* #property
|
|
33
|
-
*/
|
|
34
|
-
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
35
|
-
/**
|
|
36
|
-
* #property
|
|
37
|
-
*/
|
|
38
|
-
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
39
|
-
/**
|
|
40
|
-
* #property
|
|
41
|
-
*/
|
|
42
|
-
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
43
|
-
/**
|
|
44
|
-
* #property
|
|
45
|
-
*/
|
|
46
|
-
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
47
|
-
/**
|
|
48
|
-
* #property
|
|
49
|
-
*/
|
|
50
|
-
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
51
|
-
}, {
|
|
52
|
-
error: unknown;
|
|
53
|
-
} & {
|
|
54
|
-
/**
|
|
55
|
-
* #action
|
|
56
|
-
*/
|
|
57
|
-
setFeatureData(featureData: Record<string, unknown>): void;
|
|
58
|
-
/**
|
|
59
|
-
* #action
|
|
60
|
-
*/
|
|
61
|
-
clearFeatureData(): void;
|
|
62
|
-
/**
|
|
63
|
-
* #action
|
|
64
|
-
*/
|
|
65
|
-
setFormattedData(feat: Record<string, unknown>): void;
|
|
66
|
-
/**
|
|
67
|
-
* #action
|
|
68
|
-
*/
|
|
69
|
-
setExtra(type?: string, trackId?: string, maxDepth?: number): void;
|
|
70
|
-
/**
|
|
71
|
-
* #action
|
|
72
|
-
*/
|
|
73
|
-
setError(e: unknown): void;
|
|
74
|
-
} & {
|
|
75
|
-
afterCreate(): void;
|
|
76
|
-
}, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
77
|
-
/**
|
|
78
|
-
* #property
|
|
79
|
-
*/
|
|
80
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
81
|
-
/**
|
|
82
|
-
* #property
|
|
83
|
-
*/
|
|
84
|
-
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
85
|
-
/**
|
|
86
|
-
* #property
|
|
87
|
-
*/
|
|
88
|
-
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
89
|
-
/**
|
|
90
|
-
* #property
|
|
91
|
-
*/
|
|
92
|
-
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
93
|
-
/**
|
|
94
|
-
* #property
|
|
95
|
-
*/
|
|
96
|
-
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
97
|
-
/**
|
|
98
|
-
* #property
|
|
99
|
-
*/
|
|
100
|
-
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
101
|
-
/**
|
|
102
|
-
* #property
|
|
103
|
-
*/
|
|
104
|
-
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
105
|
-
/**
|
|
106
|
-
* #property
|
|
107
|
-
*/
|
|
108
|
-
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
109
|
-
/**
|
|
110
|
-
* #property
|
|
111
|
-
*/
|
|
112
|
-
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
113
|
-
/**
|
|
114
|
-
* #property
|
|
115
|
-
*/
|
|
116
|
-
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
117
|
-
}>>, {
|
|
118
|
-
type: "BaseFeatureWidget";
|
|
119
|
-
id: string;
|
|
120
|
-
track: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
121
|
-
view: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
122
|
-
trackId: string | undefined;
|
|
123
|
-
trackType: string | undefined;
|
|
124
|
-
maxDepth: number | undefined;
|
|
125
|
-
formattedFields: any;
|
|
126
|
-
finalizedFeatureData: any;
|
|
127
|
-
}>;
|
|
128
|
-
export { configSchema, stateModelFactory };
|
|
1
|
+
export { configSchema } from './configSchema';
|
|
2
|
+
export { stateModelFactory } from './stateModelFactory';
|
|
@@ -1,171 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.stateModelFactory = exports.configSchema = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const util_1 = require("../util");
|
|
12
|
-
const mst_1 = require("../util/types/mst");
|
|
13
|
-
const configSchema = (0, configuration_1.ConfigurationSchema)('BaseFeatureWidget', {});
|
|
14
|
-
exports.configSchema = configSchema;
|
|
15
|
-
function formatSubfeatures(obj, depth, parse, currentDepth = 0, returnObj = {}) {
|
|
16
|
-
var _a;
|
|
17
|
-
if (depth <= currentDepth) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
(_a = obj.subfeatures) === null || _a === void 0 ? void 0 : _a.map(sub => {
|
|
21
|
-
formatSubfeatures(sub, depth, parse, currentDepth + 1, returnObj);
|
|
22
|
-
parse(sub);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* #stateModel BaseFeatureWidget
|
|
27
|
-
* displays data about features, allowing configuration callbacks to modify the
|
|
28
|
-
* contents of what is displayed
|
|
29
|
-
*
|
|
30
|
-
* see: formatDetails-\>feature,formatDetails-\>subfeatures
|
|
31
|
-
*/
|
|
32
|
-
function stateModelFactory(pluginManager) {
|
|
33
|
-
return mobx_state_tree_1.types
|
|
34
|
-
.model('BaseFeatureWidget', {
|
|
35
|
-
/**
|
|
36
|
-
* #property
|
|
37
|
-
*/
|
|
38
|
-
id: mst_1.ElementId,
|
|
39
|
-
/**
|
|
40
|
-
* #property
|
|
41
|
-
*/
|
|
42
|
-
type: mobx_state_tree_1.types.literal('BaseFeatureWidget'),
|
|
43
|
-
/**
|
|
44
|
-
* #property
|
|
45
|
-
*/
|
|
46
|
-
featureData: mobx_state_tree_1.types.frozen(),
|
|
47
|
-
/**
|
|
48
|
-
* #property
|
|
49
|
-
*/
|
|
50
|
-
formattedFields: mobx_state_tree_1.types.frozen(),
|
|
51
|
-
/**
|
|
52
|
-
* #property
|
|
53
|
-
*/
|
|
54
|
-
unformattedFeatureData: mobx_state_tree_1.types.frozen(),
|
|
55
|
-
/**
|
|
56
|
-
* #property
|
|
57
|
-
*/
|
|
58
|
-
view: mobx_state_tree_1.types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
|
|
59
|
-
/**
|
|
60
|
-
* #property
|
|
61
|
-
*/
|
|
62
|
-
track: mobx_state_tree_1.types.safeReference(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
63
|
-
/**
|
|
64
|
-
* #property
|
|
65
|
-
*/
|
|
66
|
-
trackId: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
67
|
-
/**
|
|
68
|
-
* #property
|
|
69
|
-
*/
|
|
70
|
-
trackType: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
71
|
-
/**
|
|
72
|
-
* #property
|
|
73
|
-
*/
|
|
74
|
-
maxDepth: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
75
|
-
})
|
|
76
|
-
.volatile(() => ({
|
|
77
|
-
error: undefined,
|
|
78
|
-
}))
|
|
79
|
-
.actions(self => ({
|
|
80
|
-
/**
|
|
81
|
-
* #action
|
|
82
|
-
*/
|
|
83
|
-
setFeatureData(featureData) {
|
|
84
|
-
self.unformattedFeatureData = featureData;
|
|
85
|
-
},
|
|
86
|
-
/**
|
|
87
|
-
* #action
|
|
88
|
-
*/
|
|
89
|
-
clearFeatureData() {
|
|
90
|
-
self.featureData = undefined;
|
|
91
|
-
},
|
|
92
|
-
/**
|
|
93
|
-
* #action
|
|
94
|
-
*/
|
|
95
|
-
setFormattedData(feat) {
|
|
96
|
-
self.featureData = feat;
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* #action
|
|
100
|
-
*/
|
|
101
|
-
setExtra(type, trackId, maxDepth) {
|
|
102
|
-
self.trackId = trackId;
|
|
103
|
-
self.trackType = type;
|
|
104
|
-
self.maxDepth = maxDepth;
|
|
105
|
-
},
|
|
106
|
-
/**
|
|
107
|
-
* #action
|
|
108
|
-
*/
|
|
109
|
-
setError(e) {
|
|
110
|
-
self.error = e;
|
|
111
|
-
},
|
|
112
|
-
}))
|
|
113
|
-
.actions(self => ({
|
|
114
|
-
afterCreate() {
|
|
115
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
116
|
-
try {
|
|
117
|
-
const { unformattedFeatureData, track } = self;
|
|
118
|
-
const session = (0, util_1.getSession)(self);
|
|
119
|
-
if (track) {
|
|
120
|
-
self.setExtra(track.type, track.configuration.trackId, (0, configuration_1.getConf)(track, ['formatDetails', 'maxDepth']));
|
|
121
|
-
}
|
|
122
|
-
if (unformattedFeatureData) {
|
|
123
|
-
const feature = (0, clone_1.default)(unformattedFeatureData);
|
|
124
|
-
const combine = (arg2, feature) => ({
|
|
125
|
-
...(0, configuration_1.getConf)(session, ['formatDetails', arg2], { feature }),
|
|
126
|
-
...(0, configuration_1.getConf)(track, ['formatDetails', arg2], { feature }),
|
|
127
|
-
});
|
|
128
|
-
if (track) {
|
|
129
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
130
|
-
feature.__jbrowsefmt = combine('feature', feature);
|
|
131
|
-
formatSubfeatures(feature, (0, configuration_1.getConf)(track, ['formatDetails', 'depth']), sub => {
|
|
132
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
133
|
-
sub.__jbrowsefmt = combine('subfeatures', sub);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
self.setFormattedData(feature);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
catch (e) {
|
|
140
|
-
console.error(e);
|
|
141
|
-
self.setError(e);
|
|
142
|
-
}
|
|
143
|
-
}));
|
|
144
|
-
},
|
|
145
|
-
}))
|
|
146
|
-
.preProcessSnapshot(snap => {
|
|
147
|
-
// @ts-expect-error
|
|
148
|
-
const { featureData, finalizedFeatureData, ...rest } = snap;
|
|
149
|
-
return {
|
|
150
|
-
unformattedFeatureData: featureData,
|
|
151
|
-
featureData: finalizedFeatureData,
|
|
152
|
-
...rest,
|
|
153
|
-
};
|
|
154
|
-
})
|
|
155
|
-
.postProcessSnapshot(snap => {
|
|
156
|
-
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
157
|
-
const { unformattedFeatureData, featureData, ...rest } = snap;
|
|
158
|
-
// finalizedFeatureData avoids running formatter twice if loading from
|
|
159
|
-
// snapshot
|
|
160
|
-
return {
|
|
161
|
-
// replacing undefined with null helps with allowing fields to be
|
|
162
|
-
// hidden, setting null is not allowed by jexl so we set it to
|
|
163
|
-
// undefined to hide. see config guide. this replacement happens both
|
|
164
|
-
// here and when displaying the featureData in base feature widget
|
|
165
|
-
finalizedFeatureData: JSON.parse(JSON.stringify(featureData, (_, v) => (v === undefined ? null : v))),
|
|
166
|
-
...rest,
|
|
167
|
-
};
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
exports.default = stateModelFactory;
|
|
171
|
-
exports.stateModelFactory = stateModelFactory;
|
|
4
|
+
var configSchema_1 = require("./configSchema");
|
|
5
|
+
Object.defineProperty(exports, "configSchema", { enumerable: true, get: function () { return configSchema_1.configSchema; } });
|
|
6
|
+
var stateModelFactory_1 = require("./stateModelFactory");
|
|
7
|
+
Object.defineProperty(exports, "stateModelFactory", { enumerable: true, get: function () { return stateModelFactory_1.stateModelFactory; } });
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import PluginManager from '../PluginManager';
|
|
2
|
+
/**
|
|
3
|
+
* #stateModel BaseFeatureWidget
|
|
4
|
+
* displays data about features, allowing configuration callbacks to modify the
|
|
5
|
+
* contents of what is displayed
|
|
6
|
+
*
|
|
7
|
+
* see: formatDetails-\>feature,formatDetails-\>subfeatures
|
|
8
|
+
*/
|
|
9
|
+
export declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
10
|
+
/**
|
|
11
|
+
* #property
|
|
12
|
+
*/
|
|
13
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
14
|
+
/**
|
|
15
|
+
* #property
|
|
16
|
+
*/
|
|
17
|
+
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
18
|
+
/**
|
|
19
|
+
* #property
|
|
20
|
+
*/
|
|
21
|
+
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
22
|
+
/**
|
|
23
|
+
* #property
|
|
24
|
+
*/
|
|
25
|
+
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
26
|
+
/**
|
|
27
|
+
* #property
|
|
28
|
+
*/
|
|
29
|
+
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
30
|
+
/**
|
|
31
|
+
* #property
|
|
32
|
+
*/
|
|
33
|
+
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
34
|
+
/**
|
|
35
|
+
* #property
|
|
36
|
+
*/
|
|
37
|
+
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
38
|
+
/**
|
|
39
|
+
* #property
|
|
40
|
+
*/
|
|
41
|
+
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
42
|
+
/**
|
|
43
|
+
* #property
|
|
44
|
+
*/
|
|
45
|
+
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
46
|
+
/**
|
|
47
|
+
* #property
|
|
48
|
+
*/
|
|
49
|
+
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
50
|
+
}, {
|
|
51
|
+
error: unknown;
|
|
52
|
+
} & {
|
|
53
|
+
/**
|
|
54
|
+
* #action
|
|
55
|
+
*/
|
|
56
|
+
setFeatureData(featureData: Record<string, unknown>): void;
|
|
57
|
+
/**
|
|
58
|
+
* #action
|
|
59
|
+
*/
|
|
60
|
+
clearFeatureData(): void;
|
|
61
|
+
/**
|
|
62
|
+
* #action
|
|
63
|
+
*/
|
|
64
|
+
setFormattedData(feat: Record<string, unknown>): void;
|
|
65
|
+
/**
|
|
66
|
+
* #action
|
|
67
|
+
*/
|
|
68
|
+
setExtra(type?: string, trackId?: string, maxDepth?: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* #action
|
|
71
|
+
*/
|
|
72
|
+
setError(e: unknown): void;
|
|
73
|
+
} & {
|
|
74
|
+
afterCreate(): void;
|
|
75
|
+
}, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
|
|
76
|
+
/**
|
|
77
|
+
* #property
|
|
78
|
+
*/
|
|
79
|
+
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
80
|
+
/**
|
|
81
|
+
* #property
|
|
82
|
+
*/
|
|
83
|
+
type: import("mobx-state-tree").ISimpleType<"BaseFeatureWidget">;
|
|
84
|
+
/**
|
|
85
|
+
* #property
|
|
86
|
+
*/
|
|
87
|
+
featureData: import("mobx-state-tree").IType<any, any, any>;
|
|
88
|
+
/**
|
|
89
|
+
* #property
|
|
90
|
+
*/
|
|
91
|
+
formattedFields: import("mobx-state-tree").IType<any, any, any>;
|
|
92
|
+
/**
|
|
93
|
+
* #property
|
|
94
|
+
*/
|
|
95
|
+
unformattedFeatureData: import("mobx-state-tree").IType<any, any, any>;
|
|
96
|
+
/**
|
|
97
|
+
* #property
|
|
98
|
+
*/
|
|
99
|
+
view: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
100
|
+
/**
|
|
101
|
+
* #property
|
|
102
|
+
*/
|
|
103
|
+
track: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
104
|
+
/**
|
|
105
|
+
* #property
|
|
106
|
+
*/
|
|
107
|
+
trackId: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
108
|
+
/**
|
|
109
|
+
* #property
|
|
110
|
+
*/
|
|
111
|
+
trackType: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
112
|
+
/**
|
|
113
|
+
* #property
|
|
114
|
+
*/
|
|
115
|
+
maxDepth: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
116
|
+
}>>, {
|
|
117
|
+
id: string;
|
|
118
|
+
type: "BaseFeatureWidget";
|
|
119
|
+
track: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
120
|
+
view: import("mobx-state-tree").ReferenceIdentifier | undefined;
|
|
121
|
+
trackId: string | undefined;
|
|
122
|
+
trackType: string | undefined;
|
|
123
|
+
maxDepth: number | undefined;
|
|
124
|
+
formattedFields: any;
|
|
125
|
+
finalizedFeatureData: any;
|
|
126
|
+
}>;
|