@jbrowse/plugin-grid-bookmark 1.7.0 → 1.7.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/GridBookmarkWidget/components/AssemblySelector.d.ts +7 -7
- package/dist/GridBookmarkWidget/components/ClearBookmarks.d.ts +7 -7
- package/dist/GridBookmarkWidget/components/DeleteBookmark.d.ts +9 -9
- package/dist/GridBookmarkWidget/components/DownloadBookmarks.d.ts +7 -7
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.d.ts +7 -7
- package/dist/GridBookmarkWidget/components/ImportBookmarks.d.ts +8 -8
- package/dist/GridBookmarkWidget/index.d.ts +3 -3
- package/dist/GridBookmarkWidget/model.d.ts +35 -35
- package/dist/GridBookmarkWidget/types.d.ts +7 -8
- package/dist/GridBookmarkWidget/utils.d.ts +5 -5
- package/dist/index.d.ts +7 -7
- package/package.json +4 -3
- package/dist/GridBookmarkWidget/components/GridBookmarkWidget.test.d.ts +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-grid-bookmark.cjs.development.js +0 -1926
- package/dist/plugin-grid-bookmark.cjs.development.js.map +0 -1
- package/dist/plugin-grid-bookmark.cjs.production.min.js +0 -2
- package/dist/plugin-grid-bookmark.cjs.production.min.js.map +0 -1
- package/dist/plugin-grid-bookmark.esm.js +0 -1919
- package/dist/plugin-grid-bookmark.esm.js.map +0 -1
|
@@ -1,1919 +0,0 @@
|
|
|
1
|
-
import React, { useState, lazy } from 'react';
|
|
2
|
-
import BookmarkIcon from '@material-ui/icons/Bookmark';
|
|
3
|
-
import BookmarksIcon from '@material-ui/icons/Bookmarks';
|
|
4
|
-
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
5
|
-
import Plugin from '@jbrowse/core/Plugin';
|
|
6
|
-
import { assembleLocString, parseLocString, when, getSession, measureText, isSessionModelWithWidgets } from '@jbrowse/core/util';
|
|
7
|
-
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
8
|
-
import { observer } from 'mobx-react';
|
|
9
|
-
import { Typography, FormControl, Select, MenuItem, makeStyles, Dialog, DialogTitle, IconButton, DialogContent, DialogActions, Button, Link } from '@material-ui/core';
|
|
10
|
-
import { DataGrid } from '@mui/x-data-grid';
|
|
11
|
-
import DeleteIcon from '@material-ui/icons/Delete';
|
|
12
|
-
import ViewCompactIcon from '@material-ui/icons/ViewCompact';
|
|
13
|
-
import CloseIcon from '@material-ui/icons/Close';
|
|
14
|
-
import GetAppIcon from '@material-ui/icons/GetApp';
|
|
15
|
-
import { saveAs } from 'file-saver';
|
|
16
|
-
import AssemblySelector$2 from '@jbrowse/core/ui/AssemblySelector';
|
|
17
|
-
import { FileSelector } from '@jbrowse/core/ui';
|
|
18
|
-
import { openLocation } from '@jbrowse/core/util/io';
|
|
19
|
-
import ImportIcon from '@material-ui/icons/Publish';
|
|
20
|
-
import ClearAllIcon from '@material-ui/icons/ClearAll';
|
|
21
|
-
import { types, cast } from 'mobx-state-tree';
|
|
22
|
-
import { ElementId, Region } from '@jbrowse/core/util/types/mst';
|
|
23
|
-
|
|
24
|
-
function ownKeys(object, enumerableOnly) {
|
|
25
|
-
var keys = Object.keys(object);
|
|
26
|
-
|
|
27
|
-
if (Object.getOwnPropertySymbols) {
|
|
28
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
29
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
30
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
31
|
-
})), keys.push.apply(keys, symbols);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return keys;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function _objectSpread2(target) {
|
|
38
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
39
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
40
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
41
|
-
_defineProperty(target, key, source[key]);
|
|
42
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
43
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return target;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
51
|
-
try {
|
|
52
|
-
var info = gen[key](arg);
|
|
53
|
-
var value = info.value;
|
|
54
|
-
} catch (error) {
|
|
55
|
-
reject(error);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (info.done) {
|
|
60
|
-
resolve(value);
|
|
61
|
-
} else {
|
|
62
|
-
Promise.resolve(value).then(_next, _throw);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _asyncToGenerator(fn) {
|
|
67
|
-
return function () {
|
|
68
|
-
var self = this,
|
|
69
|
-
args = arguments;
|
|
70
|
-
return new Promise(function (resolve, reject) {
|
|
71
|
-
var gen = fn.apply(self, args);
|
|
72
|
-
|
|
73
|
-
function _next(value) {
|
|
74
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function _throw(err) {
|
|
78
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
_next(undefined);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function _classCallCheck(instance, Constructor) {
|
|
87
|
-
if (!(instance instanceof Constructor)) {
|
|
88
|
-
throw new TypeError("Cannot call a class as a function");
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function _defineProperties(target, props) {
|
|
93
|
-
for (var i = 0; i < props.length; i++) {
|
|
94
|
-
var descriptor = props[i];
|
|
95
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
96
|
-
descriptor.configurable = true;
|
|
97
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
98
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
103
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
104
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
105
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
106
|
-
writable: false
|
|
107
|
-
});
|
|
108
|
-
return Constructor;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function _defineProperty(obj, key, value) {
|
|
112
|
-
if (key in obj) {
|
|
113
|
-
Object.defineProperty(obj, key, {
|
|
114
|
-
value: value,
|
|
115
|
-
enumerable: true,
|
|
116
|
-
configurable: true,
|
|
117
|
-
writable: true
|
|
118
|
-
});
|
|
119
|
-
} else {
|
|
120
|
-
obj[key] = value;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return obj;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function _inherits(subClass, superClass) {
|
|
127
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
128
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
132
|
-
constructor: {
|
|
133
|
-
value: subClass,
|
|
134
|
-
writable: true,
|
|
135
|
-
configurable: true
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
Object.defineProperty(subClass, "prototype", {
|
|
139
|
-
writable: false
|
|
140
|
-
});
|
|
141
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function _getPrototypeOf(o) {
|
|
145
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
146
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
147
|
-
};
|
|
148
|
-
return _getPrototypeOf(o);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function _setPrototypeOf(o, p) {
|
|
152
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
153
|
-
o.__proto__ = p;
|
|
154
|
-
return o;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
return _setPrototypeOf(o, p);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function _isNativeReflectConstruct() {
|
|
161
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
162
|
-
if (Reflect.construct.sham) return false;
|
|
163
|
-
if (typeof Proxy === "function") return true;
|
|
164
|
-
|
|
165
|
-
try {
|
|
166
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
167
|
-
return true;
|
|
168
|
-
} catch (e) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
174
|
-
if (source == null) return {};
|
|
175
|
-
var target = {};
|
|
176
|
-
var sourceKeys = Object.keys(source);
|
|
177
|
-
var key, i;
|
|
178
|
-
|
|
179
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
180
|
-
key = sourceKeys[i];
|
|
181
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
182
|
-
target[key] = source[key];
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return target;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function _objectWithoutProperties(source, excluded) {
|
|
189
|
-
if (source == null) return {};
|
|
190
|
-
|
|
191
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
192
|
-
|
|
193
|
-
var key, i;
|
|
194
|
-
|
|
195
|
-
if (Object.getOwnPropertySymbols) {
|
|
196
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
197
|
-
|
|
198
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
199
|
-
key = sourceSymbolKeys[i];
|
|
200
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
201
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
202
|
-
target[key] = source[key];
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
return target;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function _assertThisInitialized(self) {
|
|
210
|
-
if (self === void 0) {
|
|
211
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return self;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function _possibleConstructorReturn(self, call) {
|
|
218
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
219
|
-
return call;
|
|
220
|
-
} else if (call !== void 0) {
|
|
221
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return _assertThisInitialized(self);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function _createSuper(Derived) {
|
|
228
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
229
|
-
|
|
230
|
-
return function _createSuperInternal() {
|
|
231
|
-
var Super = _getPrototypeOf(Derived),
|
|
232
|
-
result;
|
|
233
|
-
|
|
234
|
-
if (hasNativeReflectConstruct) {
|
|
235
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
236
|
-
|
|
237
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
238
|
-
} else {
|
|
239
|
-
result = Super.apply(this, arguments);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return _possibleConstructorReturn(this, result);
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
function _slicedToArray(arr, i) {
|
|
247
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function _toConsumableArray(arr) {
|
|
251
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function _arrayWithoutHoles(arr) {
|
|
255
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function _arrayWithHoles(arr) {
|
|
259
|
-
if (Array.isArray(arr)) return arr;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function _iterableToArray(iter) {
|
|
263
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function _iterableToArrayLimit(arr, i) {
|
|
267
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
268
|
-
|
|
269
|
-
if (_i == null) return;
|
|
270
|
-
var _arr = [];
|
|
271
|
-
var _n = true;
|
|
272
|
-
var _d = false;
|
|
273
|
-
|
|
274
|
-
var _s, _e;
|
|
275
|
-
|
|
276
|
-
try {
|
|
277
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
278
|
-
_arr.push(_s.value);
|
|
279
|
-
|
|
280
|
-
if (i && _arr.length === i) break;
|
|
281
|
-
}
|
|
282
|
-
} catch (err) {
|
|
283
|
-
_d = true;
|
|
284
|
-
_e = err;
|
|
285
|
-
} finally {
|
|
286
|
-
try {
|
|
287
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
288
|
-
} finally {
|
|
289
|
-
if (_d) throw _e;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return _arr;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
297
|
-
if (!o) return;
|
|
298
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
299
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
300
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
301
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
302
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function _arrayLikeToArray(arr, len) {
|
|
306
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
307
|
-
|
|
308
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
309
|
-
|
|
310
|
-
return arr2;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function _nonIterableSpread() {
|
|
314
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function _nonIterableRest() {
|
|
318
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
var useStyles = /*#__PURE__*/makeStyles(function () {
|
|
322
|
-
return {
|
|
323
|
-
container: {
|
|
324
|
-
display: 'flex',
|
|
325
|
-
flexDirection: 'row',
|
|
326
|
-
margin: 5
|
|
327
|
-
},
|
|
328
|
-
selectText: {
|
|
329
|
-
marginRight: 8,
|
|
330
|
-
marginTop: 10
|
|
331
|
-
},
|
|
332
|
-
flexItem: {
|
|
333
|
-
marginRight: 8
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
function AssemblySelector(_ref) {
|
|
339
|
-
var model = _ref.model;
|
|
340
|
-
var classes = useStyles();
|
|
341
|
-
var assemblies = model.assemblies,
|
|
342
|
-
selectedAssembly = model.selectedAssembly,
|
|
343
|
-
setSelectedAssembly = model.setSelectedAssembly;
|
|
344
|
-
var noAssemblies = assemblies.length === 0 ? true : false;
|
|
345
|
-
|
|
346
|
-
var determineCurrentValue = function determineCurrentValue(selectedAssembly) {
|
|
347
|
-
if (selectedAssembly === 'all') {
|
|
348
|
-
return 'all';
|
|
349
|
-
} else {
|
|
350
|
-
if (assemblies.includes(selectedAssembly)) {
|
|
351
|
-
return selectedAssembly;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
return 'none';
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
359
|
-
className: classes.container
|
|
360
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
361
|
-
className: classes.selectText
|
|
362
|
-
}, "Select assembly:"), /*#__PURE__*/React.createElement(FormControl, {
|
|
363
|
-
className: classes.flexItem,
|
|
364
|
-
disabled: noAssemblies
|
|
365
|
-
}, /*#__PURE__*/React.createElement(Select, {
|
|
366
|
-
value: determineCurrentValue(selectedAssembly),
|
|
367
|
-
onChange: function onChange(event) {
|
|
368
|
-
return setSelectedAssembly(event.target.value);
|
|
369
|
-
}
|
|
370
|
-
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
371
|
-
value: "none",
|
|
372
|
-
key: "no-assembly"
|
|
373
|
-
}, "none"), /*#__PURE__*/React.createElement(MenuItem, {
|
|
374
|
-
value: "all",
|
|
375
|
-
key: "all-assemblies"
|
|
376
|
-
}, "all"), assemblies.map(function (assembly) {
|
|
377
|
-
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
378
|
-
value: assembly,
|
|
379
|
-
key: assembly
|
|
380
|
-
}, assembly);
|
|
381
|
-
}))));
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
var AssemblySelector$1 = /*#__PURE__*/observer(AssemblySelector);
|
|
385
|
-
|
|
386
|
-
var useStyles$1 = /*#__PURE__*/makeStyles(function () {
|
|
387
|
-
return {
|
|
388
|
-
closeDialog: {
|
|
389
|
-
position: 'absolute',
|
|
390
|
-
right: 0,
|
|
391
|
-
top: 0
|
|
392
|
-
},
|
|
393
|
-
dialogContainer: {
|
|
394
|
-
margin: 15
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
function DeleteBookmarkDialog(_ref) {
|
|
400
|
-
var rowNumber = _ref.rowNumber,
|
|
401
|
-
model = _ref.model,
|
|
402
|
-
onClose = _ref.onClose;
|
|
403
|
-
var classes = useStyles$1();
|
|
404
|
-
var removeBookmark = model.removeBookmark;
|
|
405
|
-
return /*#__PURE__*/React.createElement(Dialog, {
|
|
406
|
-
open: rowNumber !== undefined,
|
|
407
|
-
onClose: onClose
|
|
408
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, null, "Delete bookmark", /*#__PURE__*/React.createElement(IconButton, {
|
|
409
|
-
className: classes.closeDialog,
|
|
410
|
-
"aria-label": "close-dialog",
|
|
411
|
-
onClick: onClose
|
|
412
|
-
}, /*#__PURE__*/React.createElement(CloseIcon, null))), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(Typography, null, "Remove", ' ', /*#__PURE__*/React.createElement("code", null, rowNumber !== undefined ? assembleLocString(model.bookmarkedRegions[rowNumber]) : ''), ' ', "?")), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
413
|
-
variant: "contained",
|
|
414
|
-
color: "secondary",
|
|
415
|
-
onClick: function onClick() {
|
|
416
|
-
onClose();
|
|
417
|
-
}
|
|
418
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
419
|
-
variant: "contained",
|
|
420
|
-
color: "primary",
|
|
421
|
-
onClick: function onClick() {
|
|
422
|
-
if (rowNumber !== undefined) {
|
|
423
|
-
removeBookmark(rowNumber);
|
|
424
|
-
onClose();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}, "Confirm")));
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
var DeleteBookmarkDialog$1 = /*#__PURE__*/observer(DeleteBookmarkDialog);
|
|
431
|
-
|
|
432
|
-
function createCommonjsModule(fn, module) {
|
|
433
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
437
|
-
/**
|
|
438
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
439
|
-
*
|
|
440
|
-
* This source code is licensed under the MIT license found in the
|
|
441
|
-
* LICENSE file in the root directory of this source tree.
|
|
442
|
-
*/
|
|
443
|
-
var runtime = function (exports) {
|
|
444
|
-
|
|
445
|
-
var Op = Object.prototype;
|
|
446
|
-
var hasOwn = Op.hasOwnProperty;
|
|
447
|
-
var undefined$1; // More compressible than void 0.
|
|
448
|
-
|
|
449
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
450
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
451
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
452
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
453
|
-
|
|
454
|
-
function define(obj, key, value) {
|
|
455
|
-
Object.defineProperty(obj, key, {
|
|
456
|
-
value: value,
|
|
457
|
-
enumerable: true,
|
|
458
|
-
configurable: true,
|
|
459
|
-
writable: true
|
|
460
|
-
});
|
|
461
|
-
return obj[key];
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
try {
|
|
465
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
466
|
-
define({}, "");
|
|
467
|
-
} catch (err) {
|
|
468
|
-
define = function define(obj, key, value) {
|
|
469
|
-
return obj[key] = value;
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
474
|
-
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
475
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
476
|
-
var generator = Object.create(protoGenerator.prototype);
|
|
477
|
-
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
478
|
-
// .throw, and .return methods.
|
|
479
|
-
|
|
480
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
481
|
-
return generator;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
485
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
486
|
-
// have been (and was previously) designed to take a closure to be
|
|
487
|
-
// invoked without arguments, but in all the cases we care about we
|
|
488
|
-
// already have an existing method we want to call, so there's no need
|
|
489
|
-
// to create a new function object. We can even get away with assuming
|
|
490
|
-
// the method takes exactly one argument, since that happens to be true
|
|
491
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
492
|
-
// only additional allocation required is the completion record, which
|
|
493
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
494
|
-
|
|
495
|
-
function tryCatch(fn, obj, arg) {
|
|
496
|
-
try {
|
|
497
|
-
return {
|
|
498
|
-
type: "normal",
|
|
499
|
-
arg: fn.call(obj, arg)
|
|
500
|
-
};
|
|
501
|
-
} catch (err) {
|
|
502
|
-
return {
|
|
503
|
-
type: "throw",
|
|
504
|
-
arg: err
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
510
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
511
|
-
var GenStateExecuting = "executing";
|
|
512
|
-
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
513
|
-
// breaking out of the dispatch switch statement.
|
|
514
|
-
|
|
515
|
-
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
516
|
-
// .constructor.prototype properties for functions that return Generator
|
|
517
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
518
|
-
// minifier not to mangle the names of these two functions.
|
|
519
|
-
|
|
520
|
-
function Generator() {}
|
|
521
|
-
|
|
522
|
-
function GeneratorFunction() {}
|
|
523
|
-
|
|
524
|
-
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
525
|
-
// don't natively support it.
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
var IteratorPrototype = {};
|
|
529
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
530
|
-
return this;
|
|
531
|
-
});
|
|
532
|
-
var getProto = Object.getPrototypeOf;
|
|
533
|
-
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
534
|
-
|
|
535
|
-
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
536
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
537
|
-
// of the polyfill.
|
|
538
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
542
|
-
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
543
|
-
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
544
|
-
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
545
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
546
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
547
|
-
|
|
548
|
-
function defineIteratorMethods(prototype) {
|
|
549
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
550
|
-
define(prototype, method, function (arg) {
|
|
551
|
-
return this._invoke(method, arg);
|
|
552
|
-
});
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
exports.isGeneratorFunction = function (genFun) {
|
|
557
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
558
|
-
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
559
|
-
// do is to check its .name property.
|
|
560
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
exports.mark = function (genFun) {
|
|
564
|
-
if (Object.setPrototypeOf) {
|
|
565
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
566
|
-
} else {
|
|
567
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
568
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
genFun.prototype = Object.create(Gp);
|
|
572
|
-
return genFun;
|
|
573
|
-
}; // Within the body of any async function, `await x` is transformed to
|
|
574
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
575
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
576
|
-
// meant to be awaited.
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
exports.awrap = function (arg) {
|
|
580
|
-
return {
|
|
581
|
-
__await: arg
|
|
582
|
-
};
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
586
|
-
function invoke(method, arg, resolve, reject) {
|
|
587
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
588
|
-
|
|
589
|
-
if (record.type === "throw") {
|
|
590
|
-
reject(record.arg);
|
|
591
|
-
} else {
|
|
592
|
-
var result = record.arg;
|
|
593
|
-
var value = result.value;
|
|
594
|
-
|
|
595
|
-
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
596
|
-
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
597
|
-
invoke("next", value, resolve, reject);
|
|
598
|
-
}, function (err) {
|
|
599
|
-
invoke("throw", err, resolve, reject);
|
|
600
|
-
});
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
604
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
605
|
-
// the .value of the Promise<{value,done}> result for the
|
|
606
|
-
// current iteration.
|
|
607
|
-
result.value = unwrapped;
|
|
608
|
-
resolve(result);
|
|
609
|
-
}, function (error) {
|
|
610
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
611
|
-
// into the async generator function so it can be handled there.
|
|
612
|
-
return invoke("throw", error, resolve, reject);
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
var previousPromise;
|
|
618
|
-
|
|
619
|
-
function enqueue(method, arg) {
|
|
620
|
-
function callInvokeWithMethodAndArg() {
|
|
621
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
622
|
-
invoke(method, arg, resolve, reject);
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
627
|
-
// all previous Promises have been resolved before calling invoke,
|
|
628
|
-
// so that results are always delivered in the correct order. If
|
|
629
|
-
// enqueue has not been called before, then it is important to
|
|
630
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
631
|
-
// so that the async generator function has the opportunity to do
|
|
632
|
-
// any necessary setup in a predictable way. This predictability
|
|
633
|
-
// is why the Promise constructor synchronously invokes its
|
|
634
|
-
// executor callback, and why async functions synchronously
|
|
635
|
-
// execute code before the first await. Since we implement simple
|
|
636
|
-
// async functions in terms of async generators, it is especially
|
|
637
|
-
// important to get this right, even though it requires care.
|
|
638
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
639
|
-
// invocations of the iterator.
|
|
640
|
-
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
641
|
-
} // Define the unified helper method that is used to implement .next,
|
|
642
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
this._invoke = enqueue;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
649
|
-
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
650
|
-
return this;
|
|
651
|
-
});
|
|
652
|
-
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
653
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
654
|
-
// the final result produced by the iterator.
|
|
655
|
-
|
|
656
|
-
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
657
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
658
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
659
|
-
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
660
|
-
: iter.next().then(function (result) {
|
|
661
|
-
return result.done ? result.value : iter.next();
|
|
662
|
-
});
|
|
663
|
-
};
|
|
664
|
-
|
|
665
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
666
|
-
var state = GenStateSuspendedStart;
|
|
667
|
-
return function invoke(method, arg) {
|
|
668
|
-
if (state === GenStateExecuting) {
|
|
669
|
-
throw new Error("Generator is already running");
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
if (state === GenStateCompleted) {
|
|
673
|
-
if (method === "throw") {
|
|
674
|
-
throw arg;
|
|
675
|
-
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
676
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
return doneResult();
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
context.method = method;
|
|
683
|
-
context.arg = arg;
|
|
684
|
-
|
|
685
|
-
while (true) {
|
|
686
|
-
var delegate = context.delegate;
|
|
687
|
-
|
|
688
|
-
if (delegate) {
|
|
689
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
690
|
-
|
|
691
|
-
if (delegateResult) {
|
|
692
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
693
|
-
return delegateResult;
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
if (context.method === "next") {
|
|
698
|
-
// Setting context._sent for legacy support of Babel's
|
|
699
|
-
// function.sent implementation.
|
|
700
|
-
context.sent = context._sent = context.arg;
|
|
701
|
-
} else if (context.method === "throw") {
|
|
702
|
-
if (state === GenStateSuspendedStart) {
|
|
703
|
-
state = GenStateCompleted;
|
|
704
|
-
throw context.arg;
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
context.dispatchException(context.arg);
|
|
708
|
-
} else if (context.method === "return") {
|
|
709
|
-
context.abrupt("return", context.arg);
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
state = GenStateExecuting;
|
|
713
|
-
var record = tryCatch(innerFn, self, context);
|
|
714
|
-
|
|
715
|
-
if (record.type === "normal") {
|
|
716
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
717
|
-
// GenStateExecuting and loop back for another invocation.
|
|
718
|
-
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
719
|
-
|
|
720
|
-
if (record.arg === ContinueSentinel) {
|
|
721
|
-
continue;
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
return {
|
|
725
|
-
value: record.arg,
|
|
726
|
-
done: context.done
|
|
727
|
-
};
|
|
728
|
-
} else if (record.type === "throw") {
|
|
729
|
-
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
730
|
-
// context.dispatchException(context.arg) call above.
|
|
731
|
-
|
|
732
|
-
context.method = "throw";
|
|
733
|
-
context.arg = record.arg;
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
738
|
-
// result, either by returning a { value, done } result from the
|
|
739
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
740
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
744
|
-
var method = delegate.iterator[context.method];
|
|
745
|
-
|
|
746
|
-
if (method === undefined$1) {
|
|
747
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
748
|
-
// method always terminates the yield* loop.
|
|
749
|
-
context.delegate = null;
|
|
750
|
-
|
|
751
|
-
if (context.method === "throw") {
|
|
752
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
753
|
-
if (delegate.iterator["return"]) {
|
|
754
|
-
// If the delegate iterator has a return method, give it a
|
|
755
|
-
// chance to clean up.
|
|
756
|
-
context.method = "return";
|
|
757
|
-
context.arg = undefined$1;
|
|
758
|
-
maybeInvokeDelegate(delegate, context);
|
|
759
|
-
|
|
760
|
-
if (context.method === "throw") {
|
|
761
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
762
|
-
// "return" to "throw", let that override the TypeError below.
|
|
763
|
-
return ContinueSentinel;
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
context.method = "throw";
|
|
768
|
-
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
return ContinueSentinel;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
775
|
-
|
|
776
|
-
if (record.type === "throw") {
|
|
777
|
-
context.method = "throw";
|
|
778
|
-
context.arg = record.arg;
|
|
779
|
-
context.delegate = null;
|
|
780
|
-
return ContinueSentinel;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
var info = record.arg;
|
|
784
|
-
|
|
785
|
-
if (!info) {
|
|
786
|
-
context.method = "throw";
|
|
787
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
788
|
-
context.delegate = null;
|
|
789
|
-
return ContinueSentinel;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
if (info.done) {
|
|
793
|
-
// Assign the result of the finished delegate to the temporary
|
|
794
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
795
|
-
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
796
|
-
|
|
797
|
-
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
798
|
-
// exception, let the outer generator proceed normally. If
|
|
799
|
-
// context.method was "next", forget context.arg since it has been
|
|
800
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
801
|
-
// "return", allow the original .return call to continue in the
|
|
802
|
-
// outer generator.
|
|
803
|
-
|
|
804
|
-
if (context.method !== "return") {
|
|
805
|
-
context.method = "next";
|
|
806
|
-
context.arg = undefined$1;
|
|
807
|
-
}
|
|
808
|
-
} else {
|
|
809
|
-
// Re-yield the result returned by the delegate method.
|
|
810
|
-
return info;
|
|
811
|
-
} // The delegate iterator is finished, so forget it and continue with
|
|
812
|
-
// the outer generator.
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
context.delegate = null;
|
|
816
|
-
return ContinueSentinel;
|
|
817
|
-
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
818
|
-
// unified ._invoke helper method.
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
defineIteratorMethods(Gp);
|
|
822
|
-
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
823
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
824
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
825
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
826
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
827
|
-
|
|
828
|
-
define(Gp, iteratorSymbol, function () {
|
|
829
|
-
return this;
|
|
830
|
-
});
|
|
831
|
-
define(Gp, "toString", function () {
|
|
832
|
-
return "[object Generator]";
|
|
833
|
-
});
|
|
834
|
-
|
|
835
|
-
function pushTryEntry(locs) {
|
|
836
|
-
var entry = {
|
|
837
|
-
tryLoc: locs[0]
|
|
838
|
-
};
|
|
839
|
-
|
|
840
|
-
if (1 in locs) {
|
|
841
|
-
entry.catchLoc = locs[1];
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
if (2 in locs) {
|
|
845
|
-
entry.finallyLoc = locs[2];
|
|
846
|
-
entry.afterLoc = locs[3];
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
this.tryEntries.push(entry);
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
function resetTryEntry(entry) {
|
|
853
|
-
var record = entry.completion || {};
|
|
854
|
-
record.type = "normal";
|
|
855
|
-
delete record.arg;
|
|
856
|
-
entry.completion = record;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
function Context(tryLocsList) {
|
|
860
|
-
// The root entry object (effectively a try statement without a catch
|
|
861
|
-
// or a finally block) gives us a place to store values thrown from
|
|
862
|
-
// locations where there is no enclosing try statement.
|
|
863
|
-
this.tryEntries = [{
|
|
864
|
-
tryLoc: "root"
|
|
865
|
-
}];
|
|
866
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
867
|
-
this.reset(true);
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
exports.keys = function (object) {
|
|
871
|
-
var keys = [];
|
|
872
|
-
|
|
873
|
-
for (var key in object) {
|
|
874
|
-
keys.push(key);
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
878
|
-
// things simple and return the next function itself.
|
|
879
|
-
|
|
880
|
-
return function next() {
|
|
881
|
-
while (keys.length) {
|
|
882
|
-
var key = keys.pop();
|
|
883
|
-
|
|
884
|
-
if (key in object) {
|
|
885
|
-
next.value = key;
|
|
886
|
-
next.done = false;
|
|
887
|
-
return next;
|
|
888
|
-
}
|
|
889
|
-
} // To avoid creating an additional object, we just hang the .value
|
|
890
|
-
// and .done properties off the next function object itself. This
|
|
891
|
-
// also ensures that the minifier will not anonymize the function.
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
next.done = true;
|
|
895
|
-
return next;
|
|
896
|
-
};
|
|
897
|
-
};
|
|
898
|
-
|
|
899
|
-
function values(iterable) {
|
|
900
|
-
if (iterable) {
|
|
901
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
902
|
-
|
|
903
|
-
if (iteratorMethod) {
|
|
904
|
-
return iteratorMethod.call(iterable);
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
if (typeof iterable.next === "function") {
|
|
908
|
-
return iterable;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
if (!isNaN(iterable.length)) {
|
|
912
|
-
var i = -1,
|
|
913
|
-
next = function next() {
|
|
914
|
-
while (++i < iterable.length) {
|
|
915
|
-
if (hasOwn.call(iterable, i)) {
|
|
916
|
-
next.value = iterable[i];
|
|
917
|
-
next.done = false;
|
|
918
|
-
return next;
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
next.value = undefined$1;
|
|
923
|
-
next.done = true;
|
|
924
|
-
return next;
|
|
925
|
-
};
|
|
926
|
-
|
|
927
|
-
return next.next = next;
|
|
928
|
-
}
|
|
929
|
-
} // Return an iterator with no values.
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
return {
|
|
933
|
-
next: doneResult
|
|
934
|
-
};
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
exports.values = values;
|
|
938
|
-
|
|
939
|
-
function doneResult() {
|
|
940
|
-
return {
|
|
941
|
-
value: undefined$1,
|
|
942
|
-
done: true
|
|
943
|
-
};
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
Context.prototype = {
|
|
947
|
-
constructor: Context,
|
|
948
|
-
reset: function reset(skipTempReset) {
|
|
949
|
-
this.prev = 0;
|
|
950
|
-
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
951
|
-
// function.sent implementation.
|
|
952
|
-
|
|
953
|
-
this.sent = this._sent = undefined$1;
|
|
954
|
-
this.done = false;
|
|
955
|
-
this.delegate = null;
|
|
956
|
-
this.method = "next";
|
|
957
|
-
this.arg = undefined$1;
|
|
958
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
959
|
-
|
|
960
|
-
if (!skipTempReset) {
|
|
961
|
-
for (var name in this) {
|
|
962
|
-
// Not sure about the optimal order of these conditions:
|
|
963
|
-
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
964
|
-
this[name] = undefined$1;
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
},
|
|
969
|
-
stop: function stop() {
|
|
970
|
-
this.done = true;
|
|
971
|
-
var rootEntry = this.tryEntries[0];
|
|
972
|
-
var rootRecord = rootEntry.completion;
|
|
973
|
-
|
|
974
|
-
if (rootRecord.type === "throw") {
|
|
975
|
-
throw rootRecord.arg;
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
return this.rval;
|
|
979
|
-
},
|
|
980
|
-
dispatchException: function dispatchException(exception) {
|
|
981
|
-
if (this.done) {
|
|
982
|
-
throw exception;
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
var context = this;
|
|
986
|
-
|
|
987
|
-
function handle(loc, caught) {
|
|
988
|
-
record.type = "throw";
|
|
989
|
-
record.arg = exception;
|
|
990
|
-
context.next = loc;
|
|
991
|
-
|
|
992
|
-
if (caught) {
|
|
993
|
-
// If the dispatched exception was caught by a catch block,
|
|
994
|
-
// then let that catch block handle the exception normally.
|
|
995
|
-
context.method = "next";
|
|
996
|
-
context.arg = undefined$1;
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
return !!caught;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1003
|
-
var entry = this.tryEntries[i];
|
|
1004
|
-
var record = entry.completion;
|
|
1005
|
-
|
|
1006
|
-
if (entry.tryLoc === "root") {
|
|
1007
|
-
// Exception thrown outside of any try block that could handle
|
|
1008
|
-
// it, so set the completion value of the entire function to
|
|
1009
|
-
// throw the exception.
|
|
1010
|
-
return handle("end");
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
if (entry.tryLoc <= this.prev) {
|
|
1014
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
1015
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1016
|
-
|
|
1017
|
-
if (hasCatch && hasFinally) {
|
|
1018
|
-
if (this.prev < entry.catchLoc) {
|
|
1019
|
-
return handle(entry.catchLoc, true);
|
|
1020
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
1021
|
-
return handle(entry.finallyLoc);
|
|
1022
|
-
}
|
|
1023
|
-
} else if (hasCatch) {
|
|
1024
|
-
if (this.prev < entry.catchLoc) {
|
|
1025
|
-
return handle(entry.catchLoc, true);
|
|
1026
|
-
}
|
|
1027
|
-
} else if (hasFinally) {
|
|
1028
|
-
if (this.prev < entry.finallyLoc) {
|
|
1029
|
-
return handle(entry.finallyLoc);
|
|
1030
|
-
}
|
|
1031
|
-
} else {
|
|
1032
|
-
throw new Error("try statement without catch or finally");
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
},
|
|
1037
|
-
abrupt: function abrupt(type, arg) {
|
|
1038
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1039
|
-
var entry = this.tryEntries[i];
|
|
1040
|
-
|
|
1041
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1042
|
-
var finallyEntry = entry;
|
|
1043
|
-
break;
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
1048
|
-
// Ignore the finally entry if control is not jumping to a
|
|
1049
|
-
// location outside the try/catch block.
|
|
1050
|
-
finallyEntry = null;
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1054
|
-
record.type = type;
|
|
1055
|
-
record.arg = arg;
|
|
1056
|
-
|
|
1057
|
-
if (finallyEntry) {
|
|
1058
|
-
this.method = "next";
|
|
1059
|
-
this.next = finallyEntry.finallyLoc;
|
|
1060
|
-
return ContinueSentinel;
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
return this.complete(record);
|
|
1064
|
-
},
|
|
1065
|
-
complete: function complete(record, afterLoc) {
|
|
1066
|
-
if (record.type === "throw") {
|
|
1067
|
-
throw record.arg;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
if (record.type === "break" || record.type === "continue") {
|
|
1071
|
-
this.next = record.arg;
|
|
1072
|
-
} else if (record.type === "return") {
|
|
1073
|
-
this.rval = this.arg = record.arg;
|
|
1074
|
-
this.method = "return";
|
|
1075
|
-
this.next = "end";
|
|
1076
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
1077
|
-
this.next = afterLoc;
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
return ContinueSentinel;
|
|
1081
|
-
},
|
|
1082
|
-
finish: function finish(finallyLoc) {
|
|
1083
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1084
|
-
var entry = this.tryEntries[i];
|
|
1085
|
-
|
|
1086
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
1087
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
1088
|
-
resetTryEntry(entry);
|
|
1089
|
-
return ContinueSentinel;
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
},
|
|
1093
|
-
"catch": function _catch(tryLoc) {
|
|
1094
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1095
|
-
var entry = this.tryEntries[i];
|
|
1096
|
-
|
|
1097
|
-
if (entry.tryLoc === tryLoc) {
|
|
1098
|
-
var record = entry.completion;
|
|
1099
|
-
|
|
1100
|
-
if (record.type === "throw") {
|
|
1101
|
-
var thrown = record.arg;
|
|
1102
|
-
resetTryEntry(entry);
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
return thrown;
|
|
1106
|
-
}
|
|
1107
|
-
} // The context.catch method must only be called with a location
|
|
1108
|
-
// argument that corresponds to a known catch block.
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
throw new Error("illegal catch attempt");
|
|
1112
|
-
},
|
|
1113
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1114
|
-
this.delegate = {
|
|
1115
|
-
iterator: values(iterable),
|
|
1116
|
-
resultName: resultName,
|
|
1117
|
-
nextLoc: nextLoc
|
|
1118
|
-
};
|
|
1119
|
-
|
|
1120
|
-
if (this.method === "next") {
|
|
1121
|
-
// Deliberately forget the last sent value so that we don't
|
|
1122
|
-
// accidentally pass it on to the delegate.
|
|
1123
|
-
this.arg = undefined$1;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
return ContinueSentinel;
|
|
1127
|
-
}
|
|
1128
|
-
}; // Regardless of whether this script is executing as a CommonJS module
|
|
1129
|
-
// or not, return the runtime object so that we can declare the variable
|
|
1130
|
-
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1131
|
-
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1132
|
-
|
|
1133
|
-
return exports;
|
|
1134
|
-
}( // If this script is executing as a CommonJS module, use module.exports
|
|
1135
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1136
|
-
// object. Either way, the resulting object will be used to initialize
|
|
1137
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
1138
|
-
module.exports );
|
|
1139
|
-
|
|
1140
|
-
try {
|
|
1141
|
-
regeneratorRuntime = runtime;
|
|
1142
|
-
} catch (accidentalStrictMode) {
|
|
1143
|
-
// This module should not be running in strict mode, so the above
|
|
1144
|
-
// assignment should always work unless something is misconfigured. Just
|
|
1145
|
-
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1146
|
-
// we can explicitly access globalThis. In older engines we can escape
|
|
1147
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
1148
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
1149
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
1150
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
1151
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1152
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
1153
|
-
if (typeof globalThis === "object") {
|
|
1154
|
-
globalThis.regeneratorRuntime = runtime;
|
|
1155
|
-
} else {
|
|
1156
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
1160
|
-
|
|
1161
|
-
function navToBookmark(_x, _x2, _x3) {
|
|
1162
|
-
return _navToBookmark.apply(this, arguments);
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
|
-
function _navToBookmark() {
|
|
1166
|
-
_navToBookmark = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(locString, views, model) {
|
|
1167
|
-
var selectedAssembly, lgv, session, assemblyManager, assembly, loc, refName, regions, canonicalRefName, newDisplayedRegion, view;
|
|
1168
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1169
|
-
while (1) {
|
|
1170
|
-
switch (_context.prev = _context.next) {
|
|
1171
|
-
case 0:
|
|
1172
|
-
selectedAssembly = model.selectedAssembly;
|
|
1173
|
-
lgv = views.find(function (view) {
|
|
1174
|
-
return view.type === 'LinearGenomeView' && // @ts-ignore
|
|
1175
|
-
view.assemblyNames[0] === selectedAssembly;
|
|
1176
|
-
});
|
|
1177
|
-
|
|
1178
|
-
if (!lgv) {
|
|
1179
|
-
_context.next = 6;
|
|
1180
|
-
break;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
lgv.navToLocString(locString);
|
|
1184
|
-
_context.next = 28;
|
|
1185
|
-
break;
|
|
1186
|
-
|
|
1187
|
-
case 6:
|
|
1188
|
-
session = getSession(model);
|
|
1189
|
-
assemblyManager = session.assemblyManager;
|
|
1190
|
-
_context.next = 10;
|
|
1191
|
-
return assemblyManager.waitForAssembly(selectedAssembly);
|
|
1192
|
-
|
|
1193
|
-
case 10:
|
|
1194
|
-
assembly = _context.sent;
|
|
1195
|
-
|
|
1196
|
-
if (!assembly) {
|
|
1197
|
-
_context.next = 28;
|
|
1198
|
-
break;
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
_context.prev = 12;
|
|
1202
|
-
loc = parseLocString(locString, function (refName) {
|
|
1203
|
-
return session.assemblyManager.isValidRefName(refName, selectedAssembly);
|
|
1204
|
-
});
|
|
1205
|
-
refName = loc.refName;
|
|
1206
|
-
regions = assembly.regions;
|
|
1207
|
-
canonicalRefName = assembly.getCanonicalRefName(refName);
|
|
1208
|
-
|
|
1209
|
-
if (regions) {
|
|
1210
|
-
newDisplayedRegion = regions.find(function (region) {
|
|
1211
|
-
return region.refName === canonicalRefName;
|
|
1212
|
-
});
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
view = session.addView('LinearGenomeView', {
|
|
1216
|
-
displayName: selectedAssembly
|
|
1217
|
-
});
|
|
1218
|
-
_context.next = 21;
|
|
1219
|
-
return when(function () {
|
|
1220
|
-
return view.initialized;
|
|
1221
|
-
});
|
|
1222
|
-
|
|
1223
|
-
case 21:
|
|
1224
|
-
view.setDisplayedRegions([JSON.parse(JSON.stringify(newDisplayedRegion))]);
|
|
1225
|
-
view.navToLocString(locString);
|
|
1226
|
-
_context.next = 28;
|
|
1227
|
-
break;
|
|
1228
|
-
|
|
1229
|
-
case 25:
|
|
1230
|
-
_context.prev = 25;
|
|
1231
|
-
_context.t0 = _context["catch"](12);
|
|
1232
|
-
session.notify("".concat(_context.t0), 'error');
|
|
1233
|
-
|
|
1234
|
-
case 28:
|
|
1235
|
-
case "end":
|
|
1236
|
-
return _context.stop();
|
|
1237
|
-
}
|
|
1238
|
-
}
|
|
1239
|
-
}, _callee, null, [[12, 25]]);
|
|
1240
|
-
}));
|
|
1241
|
-
return _navToBookmark.apply(this, arguments);
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
function downloadBookmarkFile(bookmarkedRegions, fileFormat, model) {
|
|
1245
|
-
var selectedAssembly = model.selectedAssembly;
|
|
1246
|
-
var fileHeader = fileFormat === 'TSV' ? 'chrom\tstart\tend\tlabel\tassembly_name\tcoord_range\n' : '';
|
|
1247
|
-
var fileContents = bookmarkedRegions.map(function (b) {
|
|
1248
|
-
var label = b.label;
|
|
1249
|
-
var labelVal = label === '' ? '.' : label;
|
|
1250
|
-
var locString = assembleLocString(b);
|
|
1251
|
-
|
|
1252
|
-
if (fileFormat === 'BED') {
|
|
1253
|
-
if (b.assemblyName === selectedAssembly || selectedAssembly === 'all') {
|
|
1254
|
-
// the "name" column (column 4) in a BED has a max of 255 characters
|
|
1255
|
-
// according to the new spec: https://github.com/samtools/hts-specs/pull/570
|
|
1256
|
-
return "".concat(b.refName, "\t").concat(b.start, "\t").concat(b.end, "\t").concat(labelVal.slice(0, 255), "\n");
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
return '';
|
|
1260
|
-
} else {
|
|
1261
|
-
return "".concat(b.refName, "\t").concat(b.start + 1, "\t").concat(b.end, "\t").concat(labelVal, "\t").concat(b.assemblyName, "\t").concat(locString, "\n");
|
|
1262
|
-
}
|
|
1263
|
-
}).reduce(function (a, b) {
|
|
1264
|
-
return a + b;
|
|
1265
|
-
}, fileHeader);
|
|
1266
|
-
var blob = new Blob([fileContents || ''], {
|
|
1267
|
-
type: fileFormat === 'BED' ? 'text/x-bed;charset=utf-8' : 'text/tab-separated-values;charset=utf-8'
|
|
1268
|
-
});
|
|
1269
|
-
var fileName;
|
|
1270
|
-
|
|
1271
|
-
if (fileFormat === 'BED') {
|
|
1272
|
-
fileName = "jbrowse_bookmarks_".concat(selectedAssembly, ".bed");
|
|
1273
|
-
} else {
|
|
1274
|
-
fileName = 'jbrowse_bookmarks.tsv';
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
saveAs(blob, fileName);
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
var useStyles$2 = /*#__PURE__*/makeStyles(function () {
|
|
1281
|
-
return {
|
|
1282
|
-
closeDialog: {
|
|
1283
|
-
position: 'absolute',
|
|
1284
|
-
right: 0,
|
|
1285
|
-
top: 0
|
|
1286
|
-
},
|
|
1287
|
-
dialogContainer: {
|
|
1288
|
-
margin: 15
|
|
1289
|
-
},
|
|
1290
|
-
flexItem: {
|
|
1291
|
-
margin: 5
|
|
1292
|
-
},
|
|
1293
|
-
flexContainer: {
|
|
1294
|
-
display: 'flex',
|
|
1295
|
-
justifyContent: 'space-evenly',
|
|
1296
|
-
width: 200
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
});
|
|
1300
|
-
|
|
1301
|
-
function DownloadBookmarks(_ref) {
|
|
1302
|
-
var model = _ref.model;
|
|
1303
|
-
var classes = useStyles$2();
|
|
1304
|
-
|
|
1305
|
-
var _useState = useState(false),
|
|
1306
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1307
|
-
dialogOpen = _useState2[0],
|
|
1308
|
-
setDialogOpen = _useState2[1];
|
|
1309
|
-
|
|
1310
|
-
var _useState3 = useState('BED'),
|
|
1311
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1312
|
-
fileType = _useState4[0],
|
|
1313
|
-
setFileType = _useState4[1];
|
|
1314
|
-
|
|
1315
|
-
var bookmarkedRegions = model.bookmarkedRegions;
|
|
1316
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1317
|
-
startIcon: /*#__PURE__*/React.createElement(GetAppIcon, null),
|
|
1318
|
-
onClick: function onClick() {
|
|
1319
|
-
return setDialogOpen(true);
|
|
1320
|
-
}
|
|
1321
|
-
}, "Download"), /*#__PURE__*/React.createElement(Dialog, {
|
|
1322
|
-
open: dialogOpen,
|
|
1323
|
-
onClose: function onClose() {
|
|
1324
|
-
return setDialogOpen(false);
|
|
1325
|
-
}
|
|
1326
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, null, /*#__PURE__*/React.createElement(IconButton, {
|
|
1327
|
-
className: classes.closeDialog,
|
|
1328
|
-
"aria-label": "close-dialog",
|
|
1329
|
-
onClick: function onClick() {
|
|
1330
|
-
return setDialogOpen(false);
|
|
1331
|
-
}
|
|
1332
|
-
}, /*#__PURE__*/React.createElement(CloseIcon, null))), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(Typography, null, "Format to download"), /*#__PURE__*/React.createElement(Select, {
|
|
1333
|
-
className: classes.flexItem,
|
|
1334
|
-
"data-testid": "selectFileType",
|
|
1335
|
-
value: fileType,
|
|
1336
|
-
onChange: function onChange(event) {
|
|
1337
|
-
return setFileType(event.target.value);
|
|
1338
|
-
}
|
|
1339
|
-
}, /*#__PURE__*/React.createElement(MenuItem, {
|
|
1340
|
-
value: "BED"
|
|
1341
|
-
}, "BED"), /*#__PURE__*/React.createElement(MenuItem, {
|
|
1342
|
-
value: "TSV"
|
|
1343
|
-
}, "TSV"))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
1344
|
-
variant: "contained",
|
|
1345
|
-
color: "secondary",
|
|
1346
|
-
onClick: function onClick() {
|
|
1347
|
-
return setDialogOpen(false);
|
|
1348
|
-
}
|
|
1349
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
1350
|
-
className: classes.flexItem,
|
|
1351
|
-
"data-testid": "dialogDownload",
|
|
1352
|
-
variant: "contained",
|
|
1353
|
-
color: "primary",
|
|
1354
|
-
startIcon: /*#__PURE__*/React.createElement(GetAppIcon, null),
|
|
1355
|
-
onClick: function onClick() {
|
|
1356
|
-
downloadBookmarkFile(bookmarkedRegions, fileType, model);
|
|
1357
|
-
setDialogOpen(false);
|
|
1358
|
-
}
|
|
1359
|
-
}, "Download"))));
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
var DownloadBookmarks$1 = /*#__PURE__*/observer(DownloadBookmarks);
|
|
1363
|
-
|
|
1364
|
-
var useStyles$3 = /*#__PURE__*/makeStyles(function () {
|
|
1365
|
-
return {
|
|
1366
|
-
closeDialog: {
|
|
1367
|
-
position: 'absolute',
|
|
1368
|
-
right: 0,
|
|
1369
|
-
top: 0
|
|
1370
|
-
},
|
|
1371
|
-
dialogContainer: {
|
|
1372
|
-
margin: 15
|
|
1373
|
-
},
|
|
1374
|
-
flexItem: {
|
|
1375
|
-
margin: 5
|
|
1376
|
-
}
|
|
1377
|
-
};
|
|
1378
|
-
});
|
|
1379
|
-
|
|
1380
|
-
function ImportBookmarks(_ref) {
|
|
1381
|
-
var model = _ref.model,
|
|
1382
|
-
assemblyName = _ref.assemblyName;
|
|
1383
|
-
var classes = useStyles$3();
|
|
1384
|
-
var session = getSession(model);
|
|
1385
|
-
var assemblyNames = session.assemblyNames;
|
|
1386
|
-
|
|
1387
|
-
var _useState = useState(false),
|
|
1388
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1389
|
-
dialogOpen = _useState2[0],
|
|
1390
|
-
setDialogOpen = _useState2[1];
|
|
1391
|
-
|
|
1392
|
-
var _useState3 = useState(),
|
|
1393
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1394
|
-
location = _useState4[0],
|
|
1395
|
-
setLocation = _useState4[1];
|
|
1396
|
-
|
|
1397
|
-
var _useState5 = useState(),
|
|
1398
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
1399
|
-
error = _useState6[0],
|
|
1400
|
-
setError = _useState6[1];
|
|
1401
|
-
|
|
1402
|
-
var _useState7 = useState(assemblyName || assemblyNames[0]),
|
|
1403
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
1404
|
-
selectedAsm = _useState8[0],
|
|
1405
|
-
setSelectedAsm = _useState8[1];
|
|
1406
|
-
|
|
1407
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1408
|
-
startIcon: /*#__PURE__*/React.createElement(ImportIcon, null),
|
|
1409
|
-
onClick: function onClick() {
|
|
1410
|
-
return setDialogOpen(true);
|
|
1411
|
-
}
|
|
1412
|
-
}, "Import"), /*#__PURE__*/React.createElement(Dialog, {
|
|
1413
|
-
open: dialogOpen,
|
|
1414
|
-
onClose: function onClose() {
|
|
1415
|
-
return setDialogOpen(false);
|
|
1416
|
-
},
|
|
1417
|
-
maxWidth: "xl"
|
|
1418
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, null, "Import bookmarks", /*#__PURE__*/React.createElement(IconButton, {
|
|
1419
|
-
className: classes.closeDialog,
|
|
1420
|
-
"aria-label": "close-dialog",
|
|
1421
|
-
onClick: function onClick() {
|
|
1422
|
-
return setDialogOpen(false);
|
|
1423
|
-
}
|
|
1424
|
-
}, /*#__PURE__*/React.createElement(CloseIcon, null))), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(Typography, null, "Choose a BED format file to import. The first 4 columns will be used"), /*#__PURE__*/React.createElement(FileSelector, {
|
|
1425
|
-
location: location,
|
|
1426
|
-
setLocation: setLocation,
|
|
1427
|
-
name: "File"
|
|
1428
|
-
}), /*#__PURE__*/React.createElement(Typography, null, "Select assembly that your data belongs to"), /*#__PURE__*/React.createElement(AssemblySelector$2, {
|
|
1429
|
-
onChange: function onChange(val) {
|
|
1430
|
-
return setSelectedAsm(val);
|
|
1431
|
-
},
|
|
1432
|
-
session: session,
|
|
1433
|
-
selected: selectedAsm
|
|
1434
|
-
}), error ? /*#__PURE__*/React.createElement(Typography, {
|
|
1435
|
-
color: "error",
|
|
1436
|
-
variant: "h6"
|
|
1437
|
-
}, "".concat(error)) : null), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
1438
|
-
variant: "contained",
|
|
1439
|
-
color: "secondary",
|
|
1440
|
-
onClick: function onClick() {
|
|
1441
|
-
return setDialogOpen(false);
|
|
1442
|
-
}
|
|
1443
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
1444
|
-
className: classes.flexItem,
|
|
1445
|
-
"data-testid": "dialogImport",
|
|
1446
|
-
variant: "contained",
|
|
1447
|
-
color: "primary",
|
|
1448
|
-
disabled: !location,
|
|
1449
|
-
startIcon: /*#__PURE__*/React.createElement(ImportIcon, null),
|
|
1450
|
-
onClick: function () {
|
|
1451
|
-
var _onClick = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1452
|
-
var data, regions;
|
|
1453
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1454
|
-
while (1) {
|
|
1455
|
-
switch (_context.prev = _context.next) {
|
|
1456
|
-
case 0:
|
|
1457
|
-
_context.prev = 0;
|
|
1458
|
-
|
|
1459
|
-
if (location) {
|
|
1460
|
-
_context.next = 3;
|
|
1461
|
-
break;
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
return _context.abrupt("return");
|
|
1465
|
-
|
|
1466
|
-
case 3:
|
|
1467
|
-
_context.next = 5;
|
|
1468
|
-
return openLocation(location).readFile('utf8');
|
|
1469
|
-
|
|
1470
|
-
case 5:
|
|
1471
|
-
data = _context.sent;
|
|
1472
|
-
regions = data.split('\n').filter(function (f) {
|
|
1473
|
-
return !!f.trim();
|
|
1474
|
-
}).filter(function (f) {
|
|
1475
|
-
return !f.startsWith('#') && !f.startsWith('track') && !f.startsWith('browser');
|
|
1476
|
-
}).map(function (line) {
|
|
1477
|
-
var _line$split = line.split('\t'),
|
|
1478
|
-
_line$split2 = _slicedToArray(_line$split, 4),
|
|
1479
|
-
refName = _line$split2[0],
|
|
1480
|
-
start = _line$split2[1],
|
|
1481
|
-
end = _line$split2[2],
|
|
1482
|
-
name = _line$split2[3];
|
|
1483
|
-
|
|
1484
|
-
return {
|
|
1485
|
-
assemblyName: selectedAsm,
|
|
1486
|
-
refName: refName,
|
|
1487
|
-
start: +start,
|
|
1488
|
-
end: +end,
|
|
1489
|
-
label: name === '.' ? undefined : name
|
|
1490
|
-
};
|
|
1491
|
-
});
|
|
1492
|
-
model.importBookmarks(regions);
|
|
1493
|
-
setDialogOpen(false);
|
|
1494
|
-
_context.next = 15;
|
|
1495
|
-
break;
|
|
1496
|
-
|
|
1497
|
-
case 11:
|
|
1498
|
-
_context.prev = 11;
|
|
1499
|
-
_context.t0 = _context["catch"](0);
|
|
1500
|
-
console.error(_context.t0);
|
|
1501
|
-
setError(_context.t0);
|
|
1502
|
-
|
|
1503
|
-
case 15:
|
|
1504
|
-
case "end":
|
|
1505
|
-
return _context.stop();
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
}, _callee, null, [[0, 11]]);
|
|
1509
|
-
}));
|
|
1510
|
-
|
|
1511
|
-
function onClick() {
|
|
1512
|
-
return _onClick.apply(this, arguments);
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
return onClick;
|
|
1516
|
-
}()
|
|
1517
|
-
}, "Import"))));
|
|
1518
|
-
}
|
|
1519
|
-
|
|
1520
|
-
var ImportBookmarks$1 = /*#__PURE__*/observer(ImportBookmarks);
|
|
1521
|
-
|
|
1522
|
-
var useStyles$4 = /*#__PURE__*/makeStyles(function () {
|
|
1523
|
-
return {
|
|
1524
|
-
closeDialog: {
|
|
1525
|
-
position: 'absolute',
|
|
1526
|
-
right: 0,
|
|
1527
|
-
top: 0
|
|
1528
|
-
},
|
|
1529
|
-
dialogContainer: {
|
|
1530
|
-
margin: 15
|
|
1531
|
-
}
|
|
1532
|
-
};
|
|
1533
|
-
});
|
|
1534
|
-
|
|
1535
|
-
function ClearBookmarks(_ref) {
|
|
1536
|
-
var model = _ref.model;
|
|
1537
|
-
var classes = useStyles$4();
|
|
1538
|
-
|
|
1539
|
-
var _useState = useState(false),
|
|
1540
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1541
|
-
dialogOpen = _useState2[0],
|
|
1542
|
-
setDialogOpen = _useState2[1];
|
|
1543
|
-
|
|
1544
|
-
var clearAllBookmarks = model.clearAllBookmarks;
|
|
1545
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
1546
|
-
startIcon: /*#__PURE__*/React.createElement(ClearAllIcon, null),
|
|
1547
|
-
"aria-label": "clear bookmarks",
|
|
1548
|
-
onClick: function onClick() {
|
|
1549
|
-
return setDialogOpen(true);
|
|
1550
|
-
}
|
|
1551
|
-
}, "Clear"), /*#__PURE__*/React.createElement(Dialog, {
|
|
1552
|
-
open: dialogOpen,
|
|
1553
|
-
onClose: function onClose() {
|
|
1554
|
-
return setDialogOpen(false);
|
|
1555
|
-
}
|
|
1556
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, null, "Clear bookmarks", /*#__PURE__*/React.createElement(IconButton, {
|
|
1557
|
-
className: classes.closeDialog,
|
|
1558
|
-
"aria-label": "close-dialog",
|
|
1559
|
-
onClick: function onClick() {
|
|
1560
|
-
return setDialogOpen(false);
|
|
1561
|
-
}
|
|
1562
|
-
}, /*#__PURE__*/React.createElement(CloseIcon, null))), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(Typography, null, "Clear all bookmarks? Note this will clear bookmarks for all assemblies")), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
1563
|
-
variant: "contained",
|
|
1564
|
-
color: "secondary",
|
|
1565
|
-
onClick: function onClick() {
|
|
1566
|
-
setDialogOpen(false);
|
|
1567
|
-
}
|
|
1568
|
-
}, "Cancel"), /*#__PURE__*/React.createElement(Button, {
|
|
1569
|
-
variant: "contained",
|
|
1570
|
-
color: "primary",
|
|
1571
|
-
onClick: function onClick() {
|
|
1572
|
-
clearAllBookmarks();
|
|
1573
|
-
setDialogOpen(false);
|
|
1574
|
-
}
|
|
1575
|
-
}, "Confirm"))));
|
|
1576
|
-
}
|
|
1577
|
-
|
|
1578
|
-
var ClearBookmarks$1 = /*#__PURE__*/observer(ClearBookmarks);
|
|
1579
|
-
|
|
1580
|
-
var _excluded = ["assemblyName"];
|
|
1581
|
-
var useStyles$5 = /*#__PURE__*/makeStyles(function () {
|
|
1582
|
-
return {
|
|
1583
|
-
link: {
|
|
1584
|
-
cursor: 'pointer'
|
|
1585
|
-
}
|
|
1586
|
-
};
|
|
1587
|
-
}); // creates a coarse measurement of column width, similar to code in
|
|
1588
|
-
// BaseFeatureDetails
|
|
1589
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1590
|
-
|
|
1591
|
-
var measure = function measure(row, col) {
|
|
1592
|
-
return Math.min(Math.max(measureText(String(row[col]), 14) + 20, 80), 1000);
|
|
1593
|
-
};
|
|
1594
|
-
|
|
1595
|
-
var BookmarkGrid = /*#__PURE__*/observer(function (_ref) {
|
|
1596
|
-
var compact = _ref.compact,
|
|
1597
|
-
model = _ref.model;
|
|
1598
|
-
var classes = useStyles$5();
|
|
1599
|
-
|
|
1600
|
-
var _useState = useState(),
|
|
1601
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
1602
|
-
dialogRowNumber = _useState2[0],
|
|
1603
|
-
setDialogRowNumber = _useState2[1];
|
|
1604
|
-
|
|
1605
|
-
var bookmarkedRegions = model.bookmarkedRegions,
|
|
1606
|
-
selectedAssembly = model.selectedAssembly;
|
|
1607
|
-
|
|
1608
|
-
var _getSession = getSession(model),
|
|
1609
|
-
views = _getSession.views;
|
|
1610
|
-
|
|
1611
|
-
var bookmarkRows = bookmarkedRegions.toJS().filter(function (region) {
|
|
1612
|
-
return selectedAssembly === 'all' || region.assemblyName === selectedAssembly;
|
|
1613
|
-
}).map(function (region, index) {
|
|
1614
|
-
var rest = _objectWithoutProperties(region, _excluded);
|
|
1615
|
-
|
|
1616
|
-
return _objectSpread2(_objectSpread2({}, region), {}, {
|
|
1617
|
-
id: index,
|
|
1618
|
-
"delete": index,
|
|
1619
|
-
locString: assembleLocString(selectedAssembly === 'all' ? region : rest)
|
|
1620
|
-
});
|
|
1621
|
-
});
|
|
1622
|
-
var columns = [{
|
|
1623
|
-
field: 'locString',
|
|
1624
|
-
headerName: 'bookmark link',
|
|
1625
|
-
width: Math.max.apply(Math, _toConsumableArray(bookmarkRows.map(function (row) {
|
|
1626
|
-
return measure(row, 'locString');
|
|
1627
|
-
}))),
|
|
1628
|
-
renderCell: function renderCell(params) {
|
|
1629
|
-
var value = params.value;
|
|
1630
|
-
return /*#__PURE__*/React.createElement(Link, {
|
|
1631
|
-
className: classes.link,
|
|
1632
|
-
onClick: function onClick(event) {
|
|
1633
|
-
navToBookmark(value, views, model);
|
|
1634
|
-
event.preventDefault();
|
|
1635
|
-
}
|
|
1636
|
-
}, value);
|
|
1637
|
-
}
|
|
1638
|
-
}, {
|
|
1639
|
-
field: 'label',
|
|
1640
|
-
width: Math.max(100, Math.max.apply(Math, _toConsumableArray(bookmarkRows.map(function (row) {
|
|
1641
|
-
return measure(row, 'label');
|
|
1642
|
-
})))),
|
|
1643
|
-
editable: true
|
|
1644
|
-
}, {
|
|
1645
|
-
field: 'delete',
|
|
1646
|
-
width: 30,
|
|
1647
|
-
renderCell: function renderCell(params) {
|
|
1648
|
-
var value = params.value;
|
|
1649
|
-
return /*#__PURE__*/React.createElement(IconButton, {
|
|
1650
|
-
"data-testid": "deleteBookmark",
|
|
1651
|
-
"aria-label": "delete",
|
|
1652
|
-
onClick: function onClick() {
|
|
1653
|
-
if (value !== null && value !== undefined) {
|
|
1654
|
-
setDialogRowNumber(+value);
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
}, /*#__PURE__*/React.createElement(DeleteIcon, null));
|
|
1658
|
-
}
|
|
1659
|
-
}];
|
|
1660
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DataGrid, {
|
|
1661
|
-
rows: bookmarkRows,
|
|
1662
|
-
rowHeight: compact ? 25 : undefined,
|
|
1663
|
-
headerHeight: compact ? 25 : undefined,
|
|
1664
|
-
columns: columns,
|
|
1665
|
-
onCellEditCommit: function onCellEditCommit(args) {
|
|
1666
|
-
var value = args.value,
|
|
1667
|
-
id = args.id;
|
|
1668
|
-
model.updateBookmarkLabel(id, value);
|
|
1669
|
-
},
|
|
1670
|
-
disableSelectionOnClick: true
|
|
1671
|
-
}), /*#__PURE__*/React.createElement(DeleteBookmarkDialog$1, {
|
|
1672
|
-
rowNumber: dialogRowNumber,
|
|
1673
|
-
model: model,
|
|
1674
|
-
onClose: function onClose() {
|
|
1675
|
-
return setDialogRowNumber(undefined);
|
|
1676
|
-
}
|
|
1677
|
-
}));
|
|
1678
|
-
});
|
|
1679
|
-
|
|
1680
|
-
function GridBookmarkWidget(_ref2) {
|
|
1681
|
-
var model = _ref2.model;
|
|
1682
|
-
var selectedAssembly = model.selectedAssembly;
|
|
1683
|
-
|
|
1684
|
-
var _useState3 = useState(false),
|
|
1685
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
1686
|
-
compact = _useState4[0],
|
|
1687
|
-
setCompact = _useState4[1];
|
|
1688
|
-
|
|
1689
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AssemblySelector$1, {
|
|
1690
|
-
model: model
|
|
1691
|
-
}), /*#__PURE__*/React.createElement(DownloadBookmarks$1, {
|
|
1692
|
-
model: model
|
|
1693
|
-
}), /*#__PURE__*/React.createElement(ImportBookmarks$1, {
|
|
1694
|
-
model: model,
|
|
1695
|
-
assemblyName: selectedAssembly
|
|
1696
|
-
}), /*#__PURE__*/React.createElement(ClearBookmarks$1, {
|
|
1697
|
-
model: model
|
|
1698
|
-
}), /*#__PURE__*/React.createElement(Button, {
|
|
1699
|
-
startIcon: /*#__PURE__*/React.createElement(ViewCompactIcon, null),
|
|
1700
|
-
onClick: function onClick() {
|
|
1701
|
-
return setCompact(!compact);
|
|
1702
|
-
}
|
|
1703
|
-
}, "Compact"), /*#__PURE__*/React.createElement("div", {
|
|
1704
|
-
style: {
|
|
1705
|
-
margin: 12
|
|
1706
|
-
}
|
|
1707
|
-
}, /*#__PURE__*/React.createElement(Typography, null, "Note: you can double click the ", /*#__PURE__*/React.createElement("code", null, "label"), " field to add your own custom notes")), /*#__PURE__*/React.createElement("div", {
|
|
1708
|
-
style: {
|
|
1709
|
-
height: 750,
|
|
1710
|
-
width: '100%'
|
|
1711
|
-
}
|
|
1712
|
-
}, /*#__PURE__*/React.createElement(BookmarkGrid, {
|
|
1713
|
-
model: model,
|
|
1714
|
-
compact: compact
|
|
1715
|
-
})));
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
var GridBookmarkWidget$1 = /*#__PURE__*/observer(GridBookmarkWidget);
|
|
1719
|
-
|
|
1720
|
-
var GridBookmarkWidget$2 = {
|
|
1721
|
-
__proto__: null,
|
|
1722
|
-
'default': GridBookmarkWidget$1
|
|
1723
|
-
};
|
|
1724
|
-
|
|
1725
|
-
var LabeledRegionModel = /*#__PURE__*/types.compose(Region, types.model('Label', {
|
|
1726
|
-
label: types.optional(types.string, '')
|
|
1727
|
-
})).actions(function (self) {
|
|
1728
|
-
return {
|
|
1729
|
-
setLabel: function setLabel(label) {
|
|
1730
|
-
self.label = label;
|
|
1731
|
-
}
|
|
1732
|
-
};
|
|
1733
|
-
});
|
|
1734
|
-
function f(pluginManager) {
|
|
1735
|
-
return types.model('GridBookmarkModel', {
|
|
1736
|
-
id: ElementId,
|
|
1737
|
-
type: types.literal('GridBookmarkWidget'),
|
|
1738
|
-
view: types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
|
|
1739
|
-
bookmarkedRegions: types.array(LabeledRegionModel),
|
|
1740
|
-
modelSelectedAssembly: ''
|
|
1741
|
-
}).actions(function (self) {
|
|
1742
|
-
return {
|
|
1743
|
-
importBookmarks: function importBookmarks(regions) {
|
|
1744
|
-
self.bookmarkedRegions = cast(self.bookmarkedRegions.concat(regions));
|
|
1745
|
-
},
|
|
1746
|
-
addBookmark: function addBookmark(region) {
|
|
1747
|
-
self.bookmarkedRegions.push(region);
|
|
1748
|
-
},
|
|
1749
|
-
removeBookmark: function removeBookmark(index) {
|
|
1750
|
-
self.bookmarkedRegions.splice(index, 1);
|
|
1751
|
-
},
|
|
1752
|
-
clearAllBookmarks: function clearAllBookmarks() {
|
|
1753
|
-
self.bookmarkedRegions.clear();
|
|
1754
|
-
},
|
|
1755
|
-
updateBookmarkLabel: function updateBookmarkLabel(index, label) {
|
|
1756
|
-
var _self$bookmarkedRegio;
|
|
1757
|
-
|
|
1758
|
-
(_self$bookmarkedRegio = self.bookmarkedRegions[index]) === null || _self$bookmarkedRegio === void 0 ? void 0 : _self$bookmarkedRegio.setLabel(label);
|
|
1759
|
-
},
|
|
1760
|
-
setSelectedAssembly: function setSelectedAssembly(assembly) {
|
|
1761
|
-
self.modelSelectedAssembly = assembly;
|
|
1762
|
-
}
|
|
1763
|
-
};
|
|
1764
|
-
}).views(function (self) {
|
|
1765
|
-
return {
|
|
1766
|
-
get selectedAssembly() {
|
|
1767
|
-
return self.modelSelectedAssembly || (self.bookmarkedRegions.length ? self.bookmarkedRegions[0].assemblyName : '');
|
|
1768
|
-
},
|
|
1769
|
-
|
|
1770
|
-
get assemblies() {
|
|
1771
|
-
return _toConsumableArray(new Set(self.bookmarkedRegions.map(function (region) {
|
|
1772
|
-
return region.assemblyName;
|
|
1773
|
-
})));
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
};
|
|
1777
|
-
});
|
|
1778
|
-
}
|
|
1779
|
-
|
|
1780
|
-
var configSchema = /*#__PURE__*/ConfigurationSchema('GridBookmarkWidget', {});
|
|
1781
|
-
|
|
1782
|
-
var _default = /*#__PURE__*/function (_Plugin) {
|
|
1783
|
-
_inherits(_default, _Plugin);
|
|
1784
|
-
|
|
1785
|
-
var _super = /*#__PURE__*/_createSuper(_default);
|
|
1786
|
-
|
|
1787
|
-
function _default() {
|
|
1788
|
-
var _this;
|
|
1789
|
-
|
|
1790
|
-
_classCallCheck(this, _default);
|
|
1791
|
-
|
|
1792
|
-
_this = _super.apply(this, arguments);
|
|
1793
|
-
_this.name = 'GridBookmarkPlugin';
|
|
1794
|
-
return _this;
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
_createClass(_default, [{
|
|
1798
|
-
key: "install",
|
|
1799
|
-
value: function install(pluginManager) {
|
|
1800
|
-
pluginManager.addWidgetType(function () {
|
|
1801
|
-
return new WidgetType({
|
|
1802
|
-
name: 'GridBookmarkWidget',
|
|
1803
|
-
heading: 'Bookmarked regions',
|
|
1804
|
-
configSchema: configSchema,
|
|
1805
|
-
stateModel: f(pluginManager),
|
|
1806
|
-
ReactComponent: /*#__PURE__*/lazy(function () {
|
|
1807
|
-
return Promise.resolve().then(function () { return GridBookmarkWidget$2; });
|
|
1808
|
-
})
|
|
1809
|
-
});
|
|
1810
|
-
});
|
|
1811
|
-
pluginManager.addToExtensionPoint('Core-extendPluggableElement', function (pluggableElement) {
|
|
1812
|
-
if (pluggableElement.name === 'LinearGenomeView') {
|
|
1813
|
-
var stateModel = pluggableElement.stateModel;
|
|
1814
|
-
var newStateModel = stateModel.extend(function (self) {
|
|
1815
|
-
var superMenuItems = self.menuItems;
|
|
1816
|
-
var superRubberBandMenuItems = self.rubberBandMenuItems;
|
|
1817
|
-
return {
|
|
1818
|
-
actions: {
|
|
1819
|
-
activateBookmarkWidget: function activateBookmarkWidget() {
|
|
1820
|
-
var session = getSession(self);
|
|
1821
|
-
|
|
1822
|
-
if (isSessionModelWithWidgets(session)) {
|
|
1823
|
-
var bookmarkWidget = session.widgets.get('GridBookmark');
|
|
1824
|
-
|
|
1825
|
-
if (!bookmarkWidget) {
|
|
1826
|
-
bookmarkWidget = session.addWidget('GridBookmarkWidget', 'GridBookmark', {
|
|
1827
|
-
view: self
|
|
1828
|
-
});
|
|
1829
|
-
}
|
|
1830
|
-
|
|
1831
|
-
session.showWidget(bookmarkWidget);
|
|
1832
|
-
return bookmarkWidget;
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
throw new Error('Could not open bookmark widget');
|
|
1836
|
-
},
|
|
1837
|
-
bookmarkCurrentRegion: function bookmarkCurrentRegion() {
|
|
1838
|
-
var selectedRegions = self.getSelectedRegions(self.leftOffset, self.rightOffset);
|
|
1839
|
-
var firstRegion = selectedRegions[0];
|
|
1840
|
-
var session = getSession(self);
|
|
1841
|
-
|
|
1842
|
-
if (isSessionModelWithWidgets(session)) {
|
|
1843
|
-
var widgets = session.widgets;
|
|
1844
|
-
var bookmarkWidget = widgets.get('GridBookmark');
|
|
1845
|
-
|
|
1846
|
-
if (!bookmarkWidget) {
|
|
1847
|
-
this.activateBookmarkWidget();
|
|
1848
|
-
bookmarkWidget = widgets.get('GridBookmark');
|
|
1849
|
-
} // @ts-ignore
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
bookmarkWidget.addBookmark(firstRegion);
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
},
|
|
1856
|
-
views: {
|
|
1857
|
-
menuItems: function menuItems() {
|
|
1858
|
-
var newMenuItems = [].concat(_toConsumableArray(superMenuItems()), [{
|
|
1859
|
-
type: 'divider'
|
|
1860
|
-
}, {
|
|
1861
|
-
label: 'Open bookmark widget',
|
|
1862
|
-
icon: BookmarksIcon,
|
|
1863
|
-
// @ts-ignore
|
|
1864
|
-
onClick: self.activateBookmarkWidget
|
|
1865
|
-
}, {
|
|
1866
|
-
label: 'Bookmark current region',
|
|
1867
|
-
icon: BookmarkIcon,
|
|
1868
|
-
// @ts-ignore
|
|
1869
|
-
onClick: self.bookmarkCurrentRegion
|
|
1870
|
-
}]);
|
|
1871
|
-
return newMenuItems;
|
|
1872
|
-
},
|
|
1873
|
-
rubberBandMenuItems: function rubberBandMenuItems() {
|
|
1874
|
-
var newRubberBandMenuItems = [].concat(_toConsumableArray(superRubberBandMenuItems()), [{
|
|
1875
|
-
label: 'Bookmark region',
|
|
1876
|
-
icon: BookmarkIcon,
|
|
1877
|
-
onClick: function onClick() {
|
|
1878
|
-
var leftOffset = self.leftOffset,
|
|
1879
|
-
rightOffset = self.rightOffset;
|
|
1880
|
-
var selectedRegions = self.getSelectedRegions(leftOffset, rightOffset);
|
|
1881
|
-
var firstRegion = selectedRegions[0];
|
|
1882
|
-
var session = getSession(self);
|
|
1883
|
-
|
|
1884
|
-
if (isSessionModelWithWidgets(session)) {
|
|
1885
|
-
var widgets = session.widgets;
|
|
1886
|
-
var bookmarkWidget = widgets.get('GridBookmark');
|
|
1887
|
-
|
|
1888
|
-
if (!bookmarkWidget) {
|
|
1889
|
-
// @ts-ignore
|
|
1890
|
-
self.activateBookmarkWidget();
|
|
1891
|
-
bookmarkWidget = widgets.get('GridBookmark');
|
|
1892
|
-
} // @ts-ignore
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
bookmarkWidget.addBookmark(firstRegion);
|
|
1896
|
-
}
|
|
1897
|
-
}
|
|
1898
|
-
}]);
|
|
1899
|
-
return newRubberBandMenuItems;
|
|
1900
|
-
}
|
|
1901
|
-
}
|
|
1902
|
-
};
|
|
1903
|
-
});
|
|
1904
|
-
pluggableElement.stateModel = newStateModel;
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1907
|
-
return pluggableElement;
|
|
1908
|
-
});
|
|
1909
|
-
}
|
|
1910
|
-
}, {
|
|
1911
|
-
key: "configure",
|
|
1912
|
-
value: function configure(_pluginManager) {}
|
|
1913
|
-
}]);
|
|
1914
|
-
|
|
1915
|
-
return _default;
|
|
1916
|
-
}(Plugin);
|
|
1917
|
-
|
|
1918
|
-
export default _default;
|
|
1919
|
-
//# sourceMappingURL=plugin-grid-bookmark.esm.js.map
|