@jbrowse/core 1.7.4 → 1.7.5
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/SequenceFeatureDetails.js +2 -2
- package/TextSearch/TextSearchManager.d.ts +2 -3
- package/TextSearch/TextSearchManager.js +17 -3
- package/assemblyManager/assemblyManager.js +8 -26
- package/package.json +2 -2
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -1
- package/pluggableElementTypes/models/BaseTrackModel.js +5 -7
- package/pluggableElementTypes/renderers/BoxRendererType.d.ts +6 -4
- package/pluggableElementTypes/renderers/BoxRendererType.js +14 -16
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +1 -1
- package/pluggableElementTypes/renderers/FeatureRendererType.js +1 -1
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +6 -13
- package/rpc/BaseRpcDriver.js +3 -0
- package/rpc/coreRpcMethods.d.ts +15 -2
- package/rpc/coreRpcMethods.js +308 -116
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/App.d.ts +2 -2
- package/ui/Icons.d.ts +1 -0
- package/ui/Icons.js +8 -0
- package/ui/Snackbar.d.ts +2 -2
- package/ui/Snackbar.js +13 -6
- package/ui/SnackbarModel.d.ts +3 -3
- package/ui/SnackbarModel.js +4 -4
- package/util/index.d.ts +5 -0
- package/util/index.js +18 -2
- package/util/layouts/BaseLayout.d.ts +3 -3
- package/util/layouts/GranularRectLayout.d.ts +2 -1
- package/util/layouts/GranularRectLayout.js +16 -16
- package/util/layouts/GranularRectLayout.test.js +4 -12
- package/util/layouts/MultiLayout.d.ts +1 -0
- package/util/layouts/MultiLayout.js +32 -8
- package/util/types/index.d.ts +5 -1
package/ui/App.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { NotificationLevel, SessionWithDrawerWidgets } from '../util';
|
|
2
|
+
import { NotificationLevel, SessionWithDrawerWidgets, SnackAction } from '../util';
|
|
3
3
|
import { MenuItem as JBMenuItem } from './index';
|
|
4
|
-
declare type SnackbarMessage = [string, NotificationLevel];
|
|
4
|
+
declare type SnackbarMessage = [string, NotificationLevel, SnackAction];
|
|
5
5
|
declare const App: ({ session, HeaderButtons, }: {
|
|
6
6
|
HeaderButtons?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
7
7
|
session: SessionWithDrawerWidgets & {
|
package/ui/Icons.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SvgIconProps } from '@material-ui/core/SvgIcon';
|
|
3
3
|
export declare function ContentCopy(props: SvgIconProps): JSX.Element;
|
|
4
|
+
export declare function Indexing(props: SvgIconProps): JSX.Element;
|
|
4
5
|
export declare function ContentCut(props: SvgIconProps): JSX.Element;
|
|
5
6
|
export declare function ContentPaste(props: SvgIconProps): JSX.Element;
|
|
6
7
|
export declare function TrackSelector(props: SvgIconProps): JSX.Element;
|
package/ui/Icons.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.ContentCopy = ContentCopy;
|
|
|
10
10
|
exports.ContentCut = ContentCut;
|
|
11
11
|
exports.ContentPaste = ContentPaste;
|
|
12
12
|
exports.DNA = DNA;
|
|
13
|
+
exports.Indexing = Indexing;
|
|
13
14
|
exports.Save = Save;
|
|
14
15
|
exports.SaveAs = SaveAs;
|
|
15
16
|
exports.TrackSelector = TrackSelector;
|
|
@@ -23,6 +24,13 @@ function ContentCopy(props) {
|
|
|
23
24
|
return /*#__PURE__*/_react.default.createElement(_SvgIcon.default, props, /*#__PURE__*/_react.default.createElement("path", {
|
|
24
25
|
d: "M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"
|
|
25
26
|
}));
|
|
27
|
+
} // https://materialdesignicons.com/ text-search icon
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function Indexing(props) {
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_SvgIcon.default, props, /*#__PURE__*/_react.default.createElement("path", {
|
|
32
|
+
d: "M19.31 18.9L22.39 22L21 23.39L17.88 20.32C17.19 20.75 16.37 21 15.5 21C13 21 11 19 11 16.5C11 14 13 12 15.5 12C18 12 20 14 20 16.5C20 17.38 19.75 18.21 19.31 18.9M15.5 19C16.88 19 18 17.88 18 16.5C18 15.12 16.88 14 15.5 14C14.12 14 13 15.12 13 16.5C13 17.88 14.12 19 15.5 19M21 4V6H3V4H21M3 16V14H9V16H3M3 11V9H21V11H18.97C17.96 10.37 16.77 10 15.5 10C14.23 10 13.04 10.37 12.03 11H3Z"
|
|
33
|
+
}));
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
function ContentCut(props) {
|
package/ui/Snackbar.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { IAnyStateTreeNode } from 'mobx-state-tree';
|
|
3
|
-
import { AbstractSessionModel, NotificationLevel } from '../util';
|
|
4
|
-
declare type SnackbarMessage = [string, NotificationLevel];
|
|
3
|
+
import { AbstractSessionModel, NotificationLevel, SnackAction } from '../util';
|
|
4
|
+
declare type SnackbarMessage = [string, NotificationLevel, SnackAction];
|
|
5
5
|
interface SnackbarSession extends AbstractSessionModel {
|
|
6
6
|
snackbarMessages: SnackbarMessage[];
|
|
7
7
|
popSnackbarMessage: () => unknown;
|
package/ui/Snackbar.js
CHANGED
|
@@ -74,20 +74,27 @@ function MessageSnackbar(_ref) {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
var _ref2 = snackbarMessage || [],
|
|
77
|
-
_ref3 = (0, _slicedToArray2.default)(_ref2,
|
|
77
|
+
_ref3 = (0, _slicedToArray2.default)(_ref2, 3),
|
|
78
78
|
message = _ref3[0],
|
|
79
|
-
level = _ref3[1]
|
|
79
|
+
level = _ref3[1],
|
|
80
|
+
action = _ref3[2];
|
|
80
81
|
|
|
81
82
|
return /*#__PURE__*/_react.default.createElement(_core.Snackbar, {
|
|
82
83
|
open: open && !!message,
|
|
84
|
+
onClose: handleClose
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement(_Alert.default, {
|
|
83
86
|
onClose: handleClose,
|
|
84
|
-
action: /*#__PURE__*/_react.default.createElement(_core.
|
|
87
|
+
action: action ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
88
|
+
color: "inherit",
|
|
89
|
+
onClick: function onClick(e) {
|
|
90
|
+
action.onClick();
|
|
91
|
+
handleClose(e);
|
|
92
|
+
}
|
|
93
|
+
}, action.name), /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
85
94
|
"aria-label": "close",
|
|
86
95
|
color: "inherit",
|
|
87
96
|
onClick: handleClose
|
|
88
|
-
}, /*#__PURE__*/_react.default.createElement(_Close.default, null))
|
|
89
|
-
}, /*#__PURE__*/_react.default.createElement(_Alert.default, {
|
|
90
|
-
onClose: handleClose,
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement(_Close.default, null))) : null,
|
|
91
98
|
severity: level || 'warning'
|
|
92
99
|
}, message));
|
|
93
100
|
}
|
package/ui/SnackbarModel.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IModelType, ModelProperties } from 'mobx-state-tree';
|
|
2
2
|
import { IObservableArray } from 'mobx';
|
|
3
|
-
import { NotificationLevel } from '../util/types';
|
|
3
|
+
import { NotificationLevel, SnackAction } from '../util/types';
|
|
4
4
|
declare function makeExtension(snackbarMessages: IObservableArray<any>): {
|
|
5
5
|
views: {
|
|
6
6
|
readonly snackbarMessages: IObservableArray<any>;
|
|
7
7
|
};
|
|
8
8
|
actions: {
|
|
9
|
-
notify(message: string, level?: NotificationLevel | undefined): void;
|
|
10
|
-
pushSnackbarMessage(message: string, level?: NotificationLevel | undefined): number;
|
|
9
|
+
notify(message: string, level?: NotificationLevel | undefined, action?: SnackAction | undefined): void;
|
|
10
|
+
pushSnackbarMessage(message: string, level?: NotificationLevel | undefined, action?: SnackAction | undefined): number;
|
|
11
11
|
popSnackbarMessage(): any;
|
|
12
12
|
removeSnackbarMessage(message: string): void;
|
|
13
13
|
};
|
package/ui/SnackbarModel.js
CHANGED
|
@@ -17,10 +17,10 @@ function makeExtension(snackbarMessages) {
|
|
|
17
17
|
|
|
18
18
|
},
|
|
19
19
|
actions: {
|
|
20
|
-
notify: function notify(message, level) {
|
|
20
|
+
notify: function notify(message, level, action) {
|
|
21
21
|
var _this = this;
|
|
22
22
|
|
|
23
|
-
this.pushSnackbarMessage(message, level);
|
|
23
|
+
this.pushSnackbarMessage(message, level, action);
|
|
24
24
|
|
|
25
25
|
if (level === 'info' || level === 'success') {
|
|
26
26
|
setTimeout(function () {
|
|
@@ -28,8 +28,8 @@ function makeExtension(snackbarMessages) {
|
|
|
28
28
|
}, 5000);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
|
-
pushSnackbarMessage: function pushSnackbarMessage(message, level) {
|
|
32
|
-
return snackbarMessages.push([message, level]);
|
|
31
|
+
pushSnackbarMessage: function pushSnackbarMessage(message, level, action) {
|
|
32
|
+
return snackbarMessages.push([message, level, action]);
|
|
33
33
|
},
|
|
34
34
|
popSnackbarMessage: function popSnackbarMessage() {
|
|
35
35
|
return snackbarMessages.pop();
|
package/util/index.d.ts
CHANGED
|
@@ -340,6 +340,7 @@ export declare function viewBpToPx({ refName, coord, regionNumber, self, }: {
|
|
|
340
340
|
index: number;
|
|
341
341
|
offsetPx: number;
|
|
342
342
|
} | undefined;
|
|
343
|
+
export declare function supportedIndexingAdapters(type: string): boolean;
|
|
343
344
|
export declare function getBpDisplayStr(totalBp: number): string;
|
|
344
345
|
export declare function getViewParams(model: IAnyStateTreeNode, exportSVG?: boolean): {
|
|
345
346
|
offsetPx: number;
|
|
@@ -347,3 +348,7 @@ export declare function getViewParams(model: IAnyStateTreeNode, exportSVG?: bool
|
|
|
347
348
|
start: any;
|
|
348
349
|
end: any;
|
|
349
350
|
};
|
|
351
|
+
export declare function getLayoutId({ sessionId, layoutId, }: {
|
|
352
|
+
sessionId: string;
|
|
353
|
+
layoutId: string;
|
|
354
|
+
}): string;
|
package/util/index.js
CHANGED
|
@@ -56,8 +56,10 @@ var _exportNames = {
|
|
|
56
56
|
objectHash: true,
|
|
57
57
|
bytesForRegions: true,
|
|
58
58
|
viewBpToPx: true,
|
|
59
|
+
supportedIndexingAdapters: true,
|
|
59
60
|
getBpDisplayStr: true,
|
|
60
61
|
getViewParams: true,
|
|
62
|
+
getLayoutId: true,
|
|
61
63
|
SimpleFeature: true,
|
|
62
64
|
isFeature: true
|
|
63
65
|
};
|
|
@@ -87,6 +89,7 @@ exports.getBpDisplayStr = getBpDisplayStr;
|
|
|
87
89
|
exports.getContainingDisplay = getContainingDisplay;
|
|
88
90
|
exports.getContainingTrack = getContainingTrack;
|
|
89
91
|
exports.getContainingView = getContainingView;
|
|
92
|
+
exports.getLayoutId = getLayoutId;
|
|
90
93
|
exports.getSession = getSession;
|
|
91
94
|
exports.getViewParams = getViewParams;
|
|
92
95
|
exports.hashCode = hashCode;
|
|
@@ -114,6 +117,7 @@ exports.renameRegionsIfNeeded = renameRegionsIfNeeded;
|
|
|
114
117
|
exports.revcom = revcom;
|
|
115
118
|
exports.springAnimate = springAnimate;
|
|
116
119
|
exports.stringify = stringify;
|
|
120
|
+
exports.supportedIndexingAdapters = supportedIndexingAdapters;
|
|
117
121
|
exports.updateStatus = updateStatus;
|
|
118
122
|
exports.useDebounce = useDebounce;
|
|
119
123
|
exports.useDebouncedCallback = useDebouncedCallback;
|
|
@@ -1005,7 +1009,7 @@ function _renameRegionsIfNeeded() {
|
|
|
1005
1009
|
_context3.t0 = Object;
|
|
1006
1010
|
_context3.next = 7;
|
|
1007
1011
|
return Promise.all(assemblyNames.map( /*#__PURE__*/function () {
|
|
1008
|
-
var
|
|
1012
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(assemblyName) {
|
|
1009
1013
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
1010
1014
|
while (1) {
|
|
1011
1015
|
switch (_context2.prev = _context2.next) {
|
|
@@ -1027,7 +1031,7 @@ function _renameRegionsIfNeeded() {
|
|
|
1027
1031
|
}));
|
|
1028
1032
|
|
|
1029
1033
|
return function (_x10) {
|
|
1030
|
-
return
|
|
1034
|
+
return _ref6.apply(this, arguments);
|
|
1031
1035
|
};
|
|
1032
1036
|
}()));
|
|
1033
1037
|
|
|
@@ -1397,6 +1401,12 @@ function viewBpToPx(_ref4) {
|
|
|
1397
1401
|
}
|
|
1398
1402
|
|
|
1399
1403
|
return undefined;
|
|
1404
|
+
} // supported adapter types by text indexer
|
|
1405
|
+
// ensure that this matches the method found in @jbrowse/text-indexing/util
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
function supportedIndexingAdapters(type) {
|
|
1409
|
+
return ['Gff3TabixAdapter', 'VcfTabixAdapter', 'Gff3Adapter', 'VcfAdapter'].includes(type);
|
|
1400
1410
|
}
|
|
1401
1411
|
|
|
1402
1412
|
function getBpDisplayStr(totalBp) {
|
|
@@ -1429,4 +1439,10 @@ function getViewParams(model, exportSVG) {
|
|
|
1429
1439
|
start: b.start,
|
|
1430
1440
|
end: b.end
|
|
1431
1441
|
};
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
function getLayoutId(_ref5) {
|
|
1445
|
+
var sessionId = _ref5.sessionId,
|
|
1446
|
+
layoutId = _ref5.layoutId;
|
|
1447
|
+
return sessionId + '-' + layoutId;
|
|
1432
1448
|
}
|
|
@@ -12,12 +12,12 @@ export interface Rectangle<T> {
|
|
|
12
12
|
top: number | null;
|
|
13
13
|
h: number;
|
|
14
14
|
originalHeight: number;
|
|
15
|
-
data?:
|
|
15
|
+
data?: T;
|
|
16
16
|
}
|
|
17
17
|
export interface BaseLayout<T> {
|
|
18
|
-
addRect(id: string, left: number, right: number, height: number, data?:
|
|
18
|
+
addRect(id: string, left: number, right: number, height: number, data?: unknown): number | null;
|
|
19
19
|
collides(rect: Rectangle<T>, top: number): boolean;
|
|
20
|
-
addRectToBitmap(rect: Rectangle<T>, data:
|
|
20
|
+
addRectToBitmap(rect: Rectangle<T>, data: unknown): void;
|
|
21
21
|
getRectangles(): Map<string, RectTuple>;
|
|
22
22
|
discardRange(left: number, right: number): void;
|
|
23
23
|
serializeRegion(region: {
|
|
@@ -20,7 +20,7 @@ export default class GranularRectLayout<T> implements BaseLayout<T> {
|
|
|
20
20
|
* @returns top position for the rect, or Null if laying
|
|
21
21
|
* out the rect would exceed maxHeight
|
|
22
22
|
*/
|
|
23
|
-
addRect(id: string, left: number, right: number, height: number, data?:
|
|
23
|
+
addRect(id: string, left: number, right: number, height: number, data?: T): number | null;
|
|
24
24
|
collides(rect: Rectangle<T>, top: number): boolean;
|
|
25
25
|
/**
|
|
26
26
|
* make a subarray if it does not exist
|
|
@@ -35,6 +35,7 @@ export default class GranularRectLayout<T> implements BaseLayout<T> {
|
|
|
35
35
|
hasSeen(id: string): boolean;
|
|
36
36
|
getByCoord(x: number, y: number): Record<string, T> | string | undefined;
|
|
37
37
|
getByID(id: string): RectTuple | undefined;
|
|
38
|
+
getDataByID(id: string): unknown;
|
|
38
39
|
cleanup(): void;
|
|
39
40
|
getTotalHeight(): number;
|
|
40
41
|
get totalHeight(): number;
|
|
@@ -150,8 +150,7 @@ var LayoutRow = /*#__PURE__*/function () {
|
|
|
150
150
|
|
|
151
151
|
var oLeft = left - this.rowState.offset;
|
|
152
152
|
var oRight = right - this.rowState.offset;
|
|
153
|
-
var currLength = this.rowState.bits.length; //
|
|
154
|
-
// expand rightward if necessary
|
|
153
|
+
var currLength = this.rowState.bits.length; // expand rightward if necessary
|
|
155
154
|
|
|
156
155
|
if (oRight >= this.rowState.bits.length) {
|
|
157
156
|
var additionalLength = oRight + 1;
|
|
@@ -179,18 +178,14 @@ var LayoutRow = /*#__PURE__*/function () {
|
|
|
179
178
|
}
|
|
180
179
|
|
|
181
180
|
oRight = right - this.rowState.offset;
|
|
182
|
-
oLeft = left - this.rowState.offset;
|
|
183
|
-
|
|
184
|
-
// if (oRight < 0) debugger
|
|
185
|
-
// if (oRight <= oLeft) debugger
|
|
186
|
-
// if (oRight > this.rowState.bits.length) debugger
|
|
181
|
+
oLeft = left - this.rowState.offset;
|
|
182
|
+
var w = oRight - oLeft;
|
|
187
183
|
|
|
188
|
-
if (
|
|
189
|
-
console.warn("Layout X pitch set too low, feature spans ".concat(
|
|
184
|
+
if (w > maxFeaturePitchWidth) {
|
|
185
|
+
console.warn("Layout X pitch set too low, feature spans ".concat(w, " bits in a single row."), rect, data);
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
for (var x = oLeft; x < oRight; x += 1) {
|
|
193
|
-
// if (this.rowState.bits[x] && this.rowState.bits[x].get('name') !== data.get('name')) debugger
|
|
194
189
|
this.rowState.bits[x] = data;
|
|
195
190
|
}
|
|
196
191
|
|
|
@@ -200,8 +195,7 @@ var LayoutRow = /*#__PURE__*/function () {
|
|
|
200
195
|
|
|
201
196
|
if (right > this.rowState.max) {
|
|
202
197
|
this.rowState.max = right;
|
|
203
|
-
}
|
|
204
|
-
|
|
198
|
+
}
|
|
205
199
|
}
|
|
206
200
|
/**
|
|
207
201
|
* Given a range of interbase coordinates, deletes all data dealing with that range
|
|
@@ -435,8 +429,7 @@ var GranularRectLayout = /*#__PURE__*/function () {
|
|
|
435
429
|
return;
|
|
436
430
|
}
|
|
437
431
|
|
|
438
|
-
var data = rect.
|
|
439
|
-
var bitmap = this.bitmap;
|
|
432
|
+
var data = rect.id;
|
|
440
433
|
var yEnd = rect.top + rect.h;
|
|
441
434
|
|
|
442
435
|
if (rect.r - rect.l > maxFeaturePitchWidth) {
|
|
@@ -446,11 +439,11 @@ var GranularRectLayout = /*#__PURE__*/function () {
|
|
|
446
439
|
// along the genome at the same zoom level. but most users will not do
|
|
447
440
|
// that. hopefully.
|
|
448
441
|
for (var y = rect.top; y < yEnd; y += 1) {
|
|
449
|
-
this.autovivifyRow(bitmap, y).setAllFilled(data);
|
|
442
|
+
this.autovivifyRow(this.bitmap, y).setAllFilled(data);
|
|
450
443
|
}
|
|
451
444
|
} else {
|
|
452
445
|
for (var _y = rect.top; _y < yEnd; _y += 1) {
|
|
453
|
-
this.autovivifyRow(bitmap, _y).addRect(rect, data);
|
|
446
|
+
this.autovivifyRow(this.bitmap, _y).addRect(rect, data);
|
|
454
447
|
}
|
|
455
448
|
}
|
|
456
449
|
}
|
|
@@ -505,6 +498,13 @@ var GranularRectLayout = /*#__PURE__*/function () {
|
|
|
505
498
|
|
|
506
499
|
return undefined;
|
|
507
500
|
}
|
|
501
|
+
}, {
|
|
502
|
+
key: "getDataByID",
|
|
503
|
+
value: function getDataByID(id) {
|
|
504
|
+
var _this$rectangles$get;
|
|
505
|
+
|
|
506
|
+
return (_this$rectangles$get = this.rectangles.get(id)) === null || _this$rectangles$get === void 0 ? void 0 : _this$rectangles$get.data;
|
|
507
|
+
}
|
|
508
508
|
}, {
|
|
509
509
|
key: "cleanup",
|
|
510
510
|
value: function cleanup() {}
|
|
@@ -90,18 +90,10 @@ describe('GranularRectLayout', function () {
|
|
|
90
90
|
maxHeight: 600
|
|
91
91
|
});
|
|
92
92
|
expect(l.getByCoord(50000, 0)).toEqual(undefined);
|
|
93
|
-
l.addRect('test1', 0, 100000000, 1,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
expect(l.getByCoord(
|
|
97
|
-
id: 'feat1'
|
|
98
|
-
});
|
|
99
|
-
l.addRect('test2', 0, 1000, 1, {
|
|
100
|
-
id: 'feat2'
|
|
101
|
-
});
|
|
102
|
-
expect(l.getByCoord(500, 1)).toEqual({
|
|
103
|
-
id: 'feat2'
|
|
104
|
-
});
|
|
93
|
+
l.addRect('test1', 0, 100000000, 1, 'feat1');
|
|
94
|
+
expect(l.getByCoord(50000, 0)).toEqual('test1');
|
|
95
|
+
l.addRect('test2', 0, 1000, 1, 'feat2');
|
|
96
|
+
expect(l.getByCoord(500, 1)).toEqual('test2');
|
|
105
97
|
expect(l.rectangles.size).toBe(2);
|
|
106
98
|
});
|
|
107
99
|
});
|
|
@@ -9,6 +9,7 @@ export default class MultiLayout<SUB_LAYOUT_CLASS extends BaseLayout<T>, T> {
|
|
|
9
9
|
* `{ layout1: new GranularRectLayout(), layout2: new GranularRectLayout() ...}`
|
|
10
10
|
*/
|
|
11
11
|
constructor(SubLayoutClass: new (...args: any[]) => SUB_LAYOUT_CLASS, layoutArgs?: Record<string, any>);
|
|
12
|
+
getDataByID(id: string): unknown;
|
|
12
13
|
getSublayout(layoutName: string): SUB_LAYOUT_CLASS;
|
|
13
14
|
addRect(layoutName: string, id: string, left: number, right: number, height: number, data?: Record<string, T>): number | null;
|
|
14
15
|
discardRange(layoutName: string, left: number, right: number): void | undefined;
|
|
@@ -39,6 +39,30 @@ var MultiLayout = /*#__PURE__*/function () {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
(0, _createClass2.default)(MultiLayout, [{
|
|
42
|
+
key: "getDataByID",
|
|
43
|
+
value: function getDataByID(id) {
|
|
44
|
+
var _iterator = _createForOfIteratorHelper(this.subLayouts.values()),
|
|
45
|
+
_step;
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
49
|
+
var layout = _step.value;
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
var r = layout.getDataByID(id);
|
|
52
|
+
|
|
53
|
+
if (r) {
|
|
54
|
+
return r;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
_iterator.e(err);
|
|
59
|
+
} finally {
|
|
60
|
+
_iterator.f();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
42
66
|
key: "getSublayout",
|
|
43
67
|
value: function getSublayout(layoutName) {
|
|
44
68
|
var subLayout = this.subLayouts.get(layoutName);
|
|
@@ -68,21 +92,21 @@ var MultiLayout = /*#__PURE__*/function () {
|
|
|
68
92
|
value: function toJSON() {
|
|
69
93
|
var data = {};
|
|
70
94
|
|
|
71
|
-
var
|
|
72
|
-
|
|
95
|
+
var _iterator2 = _createForOfIteratorHelper(this.subLayouts.entries()),
|
|
96
|
+
_step2;
|
|
73
97
|
|
|
74
98
|
try {
|
|
75
|
-
for (
|
|
76
|
-
var
|
|
77
|
-
layoutName =
|
|
78
|
-
sublayout =
|
|
99
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
100
|
+
var _step2$value = (0, _slicedToArray2.default)(_step2.value, 2),
|
|
101
|
+
layoutName = _step2$value[0],
|
|
102
|
+
sublayout = _step2$value[1];
|
|
79
103
|
|
|
80
104
|
data[layoutName] = sublayout.toJSON();
|
|
81
105
|
}
|
|
82
106
|
} catch (err) {
|
|
83
|
-
|
|
107
|
+
_iterator2.e(err);
|
|
84
108
|
} finally {
|
|
85
|
-
|
|
109
|
+
_iterator2.f();
|
|
86
110
|
}
|
|
87
111
|
|
|
88
112
|
return data;
|
package/util/types/index.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ export interface AbstractViewContainer extends IAnyStateTreeNode {
|
|
|
17
17
|
}
|
|
18
18
|
export declare function isViewContainer(thing: unknown): thing is AbstractViewContainer;
|
|
19
19
|
export declare type NotificationLevel = 'error' | 'info' | 'warning' | 'success';
|
|
20
|
+
export interface SnackAction {
|
|
21
|
+
name: string;
|
|
22
|
+
onClick: () => void;
|
|
23
|
+
}
|
|
20
24
|
export declare type AssemblyManager = Instance<ReturnType<typeof assemblyManager>>;
|
|
21
25
|
export type { TextSearchManager };
|
|
22
26
|
export interface BasePlugin {
|
|
@@ -47,7 +51,7 @@ export interface AbstractSessionModel extends AbstractViewContainer {
|
|
|
47
51
|
assemblies: AnyConfigurationModel[];
|
|
48
52
|
selection?: unknown;
|
|
49
53
|
duplicateCurrentSession?(): void;
|
|
50
|
-
notify(message: string, level?: NotificationLevel): void;
|
|
54
|
+
notify(message: string, level?: NotificationLevel, action?: SnackAction): void;
|
|
51
55
|
assemblyManager: AssemblyManager;
|
|
52
56
|
version: string;
|
|
53
57
|
getTrackActionMenuItems?: Function;
|