@teselagen/ove 0.3.12 → 0.3.13

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import './style.css';
2
- import { Icon, Classes, Button, Intent, Keys, MenuItem, Tag, useHotkeys, Popover, Tooltip, Toaster, Position, Menu, MenuDivider, NumericInput, InputGroup, Spinner, FormGroup, TextArea, Checkbox, Switch, EditableText, RadioGroup, Callout, ContextMenu, Dialog, Card, Tabs, Tab, Colors, KeyCombo, Slider as Slider$1, ButtonGroup, AnchorButton, HTMLSelect, Label, ResizeSensor, FocusStyleManager } from '@blueprintjs/core';
2
+ import { Icon, Classes, Button, Intent, Keys, MenuItem, Tag, useHotkeys, Popover, Tooltip, Toaster, Position, Menu, MenuDivider, NumericInput, InputGroup, Spinner, FormGroup, TextArea, Checkbox, Switch, EditableText, RadioGroup, Callout, ContextMenu, Dialog, Card, Tabs, Tab, Colors, KeyCombo, AnchorButton, Slider as Slider$1, ButtonGroup, HTMLSelect, Label, ResizeSensor, FocusStyleManager } from '@blueprintjs/core';
3
3
  import * as React$3 from 'react';
4
4
  import React__default$1, { forwardRef, useImperativeHandle, Fragment, useMemo as useMemo$1, useRef, useReducer, useEffect, useCallback as useCallback$1, useState, memo, Component, PureComponent, createElement, isValidElement, useContext, useLayoutEffect as useLayoutEffect$1 } from 'react';
5
5
  import ReactDOM$1, { unstable_batchedUpdates, findDOMNode as findDOMNode$2, flushSync, unmountComponentAtNode, render as render$2 } from 'react-dom';
@@ -7404,7 +7404,7 @@ function getPlainObjectKeys(object) {
7404
7404
  var ownKeys$8 = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : hasGetOwnPropertySymbols ? function (obj) {
7405
7405
  return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj));
7406
7406
  } : /* istanbul ignore next */Object.getOwnPropertyNames;
7407
- function toPrimitive$2(value) {
7407
+ function toPrimitive$3(value) {
7408
7408
  return value === null ? null : typeof value === "object" ? "" + value : value;
7409
7409
  }
7410
7410
  function hasProp(target, prop) {
@@ -8333,7 +8333,7 @@ var ObservableValue = /*#__PURE__*/function (_Atom) {
8333
8333
  return this.name_ + "[" + this.value_ + "]";
8334
8334
  };
8335
8335
  _proto.valueOf = function valueOf() {
8336
- return toPrimitive$2(this.get());
8336
+ return toPrimitive$3(this.get());
8337
8337
  };
8338
8338
  _proto[_Symbol$toPrimitive] = function () {
8339
8339
  return this.valueOf();
@@ -8561,7 +8561,7 @@ var ComputedValue = /*#__PURE__*/function () {
8561
8561
  return this.name_ + "[" + this.derivation.toString() + "]";
8562
8562
  };
8563
8563
  _proto.valueOf = function valueOf() {
8564
- return toPrimitive$2(this.get());
8564
+ return toPrimitive$3(this.get());
8565
8565
  };
8566
8566
  _proto[_Symbol$toPrimitive$1] = function () {
8567
8567
  return this.valueOf();
@@ -30258,18 +30258,10 @@ var _fails = function (exec) {
30258
30258
  }
30259
30259
  };
30260
30260
 
30261
- var _descriptors;
30262
- var hasRequired_descriptors;
30263
-
30264
- function require_descriptors () {
30265
- if (hasRequired_descriptors) return _descriptors;
30266
- hasRequired_descriptors = 1;
30267
- // Thank's IE8 for his funny defineProperty
30268
- _descriptors = !_fails(function () {
30269
- return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
30270
- });
30271
- return _descriptors;
30272
- }
30261
+ // Thank's IE8 for his funny defineProperty
30262
+ var _descriptors = !_fails(function () {
30263
+ return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
30264
+ });
30273
30265
 
30274
30266
  var _domCreate;
30275
30267
  var hasRequired_domCreate;
@@ -30287,17 +30279,9 @@ function require_domCreate () {
30287
30279
  return _domCreate;
30288
30280
  }
30289
30281
 
30290
- var _ie8DomDefine;
30291
- var hasRequired_ie8DomDefine;
30292
-
30293
- function require_ie8DomDefine () {
30294
- if (hasRequired_ie8DomDefine) return _ie8DomDefine;
30295
- hasRequired_ie8DomDefine = 1;
30296
- _ie8DomDefine = !require_descriptors() && !_fails(function () {
30297
- return Object.defineProperty(require_domCreate()('div'), 'a', { get: function () { return 7; } }).a != 7;
30298
- });
30299
- return _ie8DomDefine;
30300
- }
30282
+ var _ie8DomDefine = !_descriptors && !_fails(function () {
30283
+ return Object.defineProperty(require_domCreate()('div'), 'a', { get: function () { return 7; } }).a != 7;
30284
+ });
30301
30285
 
30302
30286
  // 7.1.1 ToPrimitive(input [, PreferredType])
30303
30287
  var isObject$d = _isObject;
@@ -30312,29 +30296,22 @@ var _toPrimitive$1 = function (it, S) {
30312
30296
  throw TypeError("Can't convert object to primitive value");
30313
30297
  };
30314
30298
 
30315
- var hasRequired_objectDp;
30316
-
30317
- function require_objectDp () {
30318
- if (hasRequired_objectDp) return _objectDp;
30319
- hasRequired_objectDp = 1;
30320
- var anObject = _anObject;
30321
- var IE8_DOM_DEFINE = require_ie8DomDefine();
30322
- var toPrimitive = _toPrimitive$1;
30323
- var dP = Object.defineProperty;
30299
+ var anObject$5 = _anObject;
30300
+ var IE8_DOM_DEFINE$1 = _ie8DomDefine;
30301
+ var toPrimitive$2 = _toPrimitive$1;
30302
+ var dP$3 = Object.defineProperty;
30324
30303
 
30325
- _objectDp.f = require_descriptors() ? Object.defineProperty : function defineProperty(O, P, Attributes) {
30326
- anObject(O);
30327
- P = toPrimitive(P, true);
30328
- anObject(Attributes);
30329
- if (IE8_DOM_DEFINE) try {
30330
- return dP(O, P, Attributes);
30331
- } catch (e) { /* empty */ }
30332
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
30333
- if ('value' in Attributes) O[P] = Attributes.value;
30334
- return O;
30335
- };
30336
- return _objectDp;
30337
- }
30304
+ _objectDp.f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
30305
+ anObject$5(O);
30306
+ P = toPrimitive$2(P, true);
30307
+ anObject$5(Attributes);
30308
+ if (IE8_DOM_DEFINE$1) try {
30309
+ return dP$3(O, P, Attributes);
30310
+ } catch (e) { /* empty */ }
30311
+ if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
30312
+ if ('value' in Attributes) O[P] = Attributes.value;
30313
+ return O;
30314
+ };
30338
30315
 
30339
30316
  var _propertyDesc = function (bitmap, value) {
30340
30317
  return {
@@ -30345,9 +30322,9 @@ var _propertyDesc = function (bitmap, value) {
30345
30322
  };
30346
30323
  };
30347
30324
 
30348
- var dP$2 = require_objectDp();
30325
+ var dP$2 = _objectDp;
30349
30326
  var createDesc$3 = _propertyDesc;
30350
- var _hide = require_descriptors() ? function (object, key, value) {
30327
+ var _hide = _descriptors ? function (object, key, value) {
30351
30328
  return dP$2.f(object, key, createDesc$3(1, value));
30352
30329
  } : function (object, key, value) {
30353
30330
  object[key] = value;
@@ -30428,20 +30405,12 @@ var _cof = function (it) {
30428
30405
  return toString$6.call(it).slice(8, -1);
30429
30406
  };
30430
30407
 
30431
- var _iobject;
30432
- var hasRequired_iobject;
30433
-
30434
- function require_iobject () {
30435
- if (hasRequired_iobject) return _iobject;
30436
- hasRequired_iobject = 1;
30437
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
30438
- var cof = _cof;
30439
- // eslint-disable-next-line no-prototype-builtins
30440
- _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30441
- return cof(it) == 'String' ? it.split('') : Object(it);
30442
- };
30443
- return _iobject;
30444
- }
30408
+ // fallback for non-array-like ES3 and non-enumerable old V8 strings
30409
+ var cof$2 = _cof;
30410
+ // eslint-disable-next-line no-prototype-builtins
30411
+ var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
30412
+ return cof$2(it) == 'String' ? it.split('') : Object(it);
30413
+ };
30445
30414
 
30446
30415
  // 7.2.1 RequireObjectCoercible(argument)
30447
30416
  var _defined = function (it) {
@@ -30450,7 +30419,7 @@ var _defined = function (it) {
30450
30419
  };
30451
30420
 
30452
30421
  // to indexed object, toObject with fallback for non-array-like ES3 strings
30453
- var IObject = require_iobject();
30422
+ var IObject = _iobject;
30454
30423
  var defined$2 = _defined;
30455
30424
  var _toIobject = function (it) {
30456
30425
  return IObject(defined$2(it));
@@ -30570,14 +30539,7 @@ _objectGops.f = Object.getOwnPropertySymbols;
30570
30539
 
30571
30540
  var _objectPie = {};
30572
30541
 
30573
- var hasRequired_objectPie;
30574
-
30575
- function require_objectPie () {
30576
- if (hasRequired_objectPie) return _objectPie;
30577
- hasRequired_objectPie = 1;
30578
- _objectPie.f = {}.propertyIsEnumerable;
30579
- return _objectPie;
30580
- }
30542
+ _objectPie.f = {}.propertyIsEnumerable;
30581
30543
 
30582
30544
  // 7.1.13 ToObject(argument)
30583
30545
  var defined$1 = _defined;
@@ -30592,12 +30554,12 @@ function require_objectAssign () {
30592
30554
  if (hasRequired_objectAssign) return _objectAssign;
30593
30555
  hasRequired_objectAssign = 1;
30594
30556
  // 19.1.2.1 Object.assign(target, source, ...)
30595
- var DESCRIPTORS = require_descriptors();
30557
+ var DESCRIPTORS = _descriptors;
30596
30558
  var getKeys = _objectKeys;
30597
30559
  var gOPS = _objectGops;
30598
- var pIE = require_objectPie();
30560
+ var pIE = _objectPie;
30599
30561
  var toObject = _toObject;
30600
- var IObject = require_iobject();
30562
+ var IObject = _iobject;
30601
30563
  var $assign = Object.assign;
30602
30564
 
30603
30565
  // should work with symbols and should have deterministic property order (V8 bug)
@@ -30668,11 +30630,11 @@ var _iterators = {};
30668
30630
 
30669
30631
  var _redefine = _hide;
30670
30632
 
30671
- var dP$1 = require_objectDp();
30633
+ var dP$1 = _objectDp;
30672
30634
  var anObject$4 = _anObject;
30673
30635
  var getKeys$1 = _objectKeys;
30674
30636
 
30675
- var _objectDps = require_descriptors() ? Object.defineProperties : function defineProperties(O, Properties) {
30637
+ var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
30676
30638
  anObject$4(O);
30677
30639
  var keys = getKeys$1(Properties);
30678
30640
  var length = keys.length;
@@ -30751,7 +30713,7 @@ $exports.store = store$2;
30751
30713
 
30752
30714
  var _wksExports = _wks.exports;
30753
30715
 
30754
- var def = require_objectDp().f;
30716
+ var def = _objectDp.f;
30755
30717
  var has$c = _has;
30756
30718
  var TAG$1 = _wksExports('toStringTag');
30757
30719
 
@@ -31065,7 +31027,7 @@ var _isArrayIter = function (it) {
31065
31027
  return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
31066
31028
  };
31067
31029
 
31068
- var $defineProperty$2 = require_objectDp();
31030
+ var $defineProperty$2 = _objectDp;
31069
31031
  var createDesc$2 = _propertyDesc;
31070
31032
 
31071
31033
  var _createProperty = function (object, index, value) {
@@ -31198,7 +31160,7 @@ var _default$9 = function (instance, Constructor) {
31198
31160
 
31199
31161
  var $export$3 = _export;
31200
31162
  // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
31201
- $export$3($export$3.S + $export$3.F * !require_descriptors(), 'Object', { defineProperty: require_objectDp().f });
31163
+ $export$3($export$3.S + $export$3.F * !_descriptors, 'Object', { defineProperty: _objectDp.f });
31202
31164
 
31203
31165
  var $Object$2 = _coreExports.Object;
31204
31166
  var defineProperty$c = function defineProperty(it, key, desc) {
@@ -31246,7 +31208,7 @@ var _meta = {exports: {}};
31246
31208
  var META$1 = _uid('meta');
31247
31209
  var isObject$c = _isObject;
31248
31210
  var has$a = _has;
31249
- var setDesc = require_objectDp().f;
31211
+ var setDesc = _objectDp.f;
31250
31212
  var id$1 = 0;
31251
31213
  var isExtensible = Object.isExtensible || function () {
31252
31214
  return true;
@@ -31301,7 +31263,7 @@ var _metaExports = _meta.exports;
31301
31263
 
31302
31264
  var core = _coreExports;
31303
31265
  var wksExt$1 = _wksExt;
31304
- var defineProperty$a = require_objectDp().f;
31266
+ var defineProperty$a = _objectDp.f;
31305
31267
  var _wksDefine = function (name) {
31306
31268
  var $Symbol = core.Symbol || (core.Symbol = {} );
31307
31269
  if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty$a($Symbol, name, { value: wksExt$1.f(name) });
@@ -31310,7 +31272,7 @@ var _wksDefine = function (name) {
31310
31272
  // all enumerable object keys, includes symbols
31311
31273
  var getKeys = _objectKeys;
31312
31274
  var gOPS$1 = _objectGops;
31313
- var pIE$1 = require_objectPie();
31275
+ var pIE$1 = _objectPie;
31314
31276
  var _enumKeys = function (it) {
31315
31277
  var result = getKeys(it);
31316
31278
  var getSymbols = gOPS$1.f;
@@ -31363,15 +31325,15 @@ _objectGopnExt.f = function getOwnPropertyNames(it) {
31363
31325
 
31364
31326
  var _objectGopd = {};
31365
31327
 
31366
- var pIE = require_objectPie();
31328
+ var pIE = _objectPie;
31367
31329
  var createDesc$1 = _propertyDesc;
31368
31330
  var toIObject$1 = _toIobject;
31369
31331
  var toPrimitive$1 = _toPrimitive$1;
31370
31332
  var has$9 = _has;
31371
- var IE8_DOM_DEFINE = require_ie8DomDefine();
31333
+ var IE8_DOM_DEFINE = _ie8DomDefine;
31372
31334
  var gOPD$5 = Object.getOwnPropertyDescriptor;
31373
31335
 
31374
- _objectGopd.f = require_descriptors() ? gOPD$5 : function getOwnPropertyDescriptor(O, P) {
31336
+ _objectGopd.f = _descriptors ? gOPD$5 : function getOwnPropertyDescriptor(O, P) {
31375
31337
  O = toIObject$1(O);
31376
31338
  P = toPrimitive$1(P, true);
31377
31339
  if (IE8_DOM_DEFINE) try {
@@ -31383,7 +31345,7 @@ _objectGopd.f = require_descriptors() ? gOPD$5 : function getOwnPropertyDescript
31383
31345
  // ECMAScript 6 symbols shim
31384
31346
  var global$2 = _globalExports;
31385
31347
  var has$8 = _has;
31386
- var DESCRIPTORS = require_descriptors();
31348
+ var DESCRIPTORS = _descriptors;
31387
31349
  var $export$2 = _export;
31388
31350
  var redefine = _redefine;
31389
31351
  var META = _metaExports.KEY;
@@ -31406,7 +31368,7 @@ var _create$1 = _objectCreate;
31406
31368
  var gOPNExt = _objectGopnExt;
31407
31369
  var $GOPD = _objectGopd;
31408
31370
  var $GOPS = _objectGops;
31409
- var $DP = require_objectDp();
31371
+ var $DP = _objectDp;
31410
31372
  var $keys$1 = _objectKeys;
31411
31373
  var gOPD$4 = $GOPD.f;
31412
31374
  var dP = $DP.f;
@@ -31531,7 +31493,7 @@ if (!USE_NATIVE) {
31531
31493
  $GOPD.f = $getOwnPropertyDescriptor;
31532
31494
  $DP.f = $defineProperty$1;
31533
31495
  _objectGopn.f = gOPNExt.f = $getOwnPropertyNames;
31534
- require_objectPie().f = $propertyIsEnumerable;
31496
+ _objectPie.f = $propertyIsEnumerable;
31535
31497
  $GOPS.f = $getOwnPropertySymbols;
31536
31498
 
31537
31499
  if (DESCRIPTORS && !_library) {
@@ -92017,6 +91979,8 @@ const PreviewCsvData = observer(function(props) {
92017
91979
  userSchema = exampleData,
92018
91980
  initialEntities
92019
91981
  } = props;
91982
+ const rerenderKey = useRef(0);
91983
+ rerenderKey.current = rerenderKey.current + 1;
92020
91984
  const data = userSchema.userData && userSchema.userData.length && userSchema.userData.map((row) => {
92021
91985
  const toRet = {
92022
91986
  _isClean: row._isClean
@@ -92063,6 +92027,7 @@ const PreviewCsvData = observer(function(props) {
92063
92027
  {
92064
92028
  maxWidth: 800,
92065
92029
  maxHeight: 500,
92030
+ rerenderKey: rerenderKey.current,
92066
92031
  destroyOnUnmount: false,
92067
92032
  doNotValidateUntouchedRows: true,
92068
92033
  formName: datatableFormName || "editableCellTable",
@@ -113805,9 +113770,9 @@ function coerceLocation({
113805
113770
  function filterAminoAcidSequenceString(sequenceString, options) {
113806
113771
  options = options || {};
113807
113772
  if (options.includeStopCodon) {
113808
- return sequenceString.replace(/[^xtgalmfwkqespvicyhrndu.*]/gi, "");
113773
+ return sequenceString?.replace(/[^xtgalmfwkqespvicyhrndu.*]/gi, "");
113809
113774
  }
113810
- return sequenceString.replace(/[^xtgalmfwkqespvicyhrndu]/gi, "");
113775
+ return sequenceString?.replace(/[^xtgalmfwkqespvicyhrndu]/gi, "");
113811
113776
  }
113812
113777
 
113813
113778
  function getDegenerateDnaStringFromAAString(aaString) {
@@ -161153,7 +161118,7 @@ function showFileDialog({ multiple = false, onSelect }) {
161153
161118
  }
161154
161119
 
161155
161120
  const name = "@teselagen/ove";
161156
- const version = "0.3.11";
161121
+ const version = "0.3.12";
161157
161122
  const main = "./src/index.js";
161158
161123
  const exports$1 = {
161159
161124
  ".": {
@@ -161695,6 +161660,184 @@ function ToggleShowMeltingTemp(props) {
161695
161660
  );
161696
161661
  }
161697
161662
 
161663
+ const style$i = '';
161664
+
161665
+ class ToolbarItem extends React__default$1.Component {
161666
+ toggleDropdown = ({ forceClose } = {}) => {
161667
+ const { toolName, isOpen } = this.props;
161668
+ this.props.openToolbarItemUpdate(isOpen || forceClose ? "" : toolName);
161669
+ };
161670
+ render() {
161671
+ const { overrides = {} } = this.props;
161672
+ const {
161673
+ isOpen,
161674
+ index,
161675
+ Icon: Icon$1,
161676
+ // dynamicIcon,
161677
+ onIconClick = lodashExports.noop,
161678
+ tooltip = "",
161679
+ tooltipToggled,
161680
+ dropdowntooltip = "",
161681
+ Dropdown,
161682
+ disabled,
161683
+ isHidden,
161684
+ renderIconAbove,
161685
+ noDropdownIcon,
161686
+ IconWrapper,
161687
+ editorName,
161688
+ popoverDisabled,
161689
+ IconWrapperProps,
161690
+ toolName,
161691
+ dropdownicon,
161692
+ tooltipDisabled,
161693
+ toggled = false,
161694
+ ...rest
161695
+ } = { ...this.props, ...overrides };
161696
+ if (!toolName)
161697
+ console.warn("toolName is required!");
161698
+ if (isHidden)
161699
+ return null;
161700
+ let tooltipToDisplay = tooltip;
161701
+ if (toggled && tooltipToggled) {
161702
+ tooltipToDisplay = tooltipToggled;
161703
+ }
161704
+ const buttonTarget = /* @__PURE__ */ React__default$1.createElement(
161705
+ "div",
161706
+ {
161707
+ className: `veToolbarItemOuter ve-tool-container-${toolName}` + (disabled ? " disabled " : "")
161708
+ },
161709
+ renderIconAbove && /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarItem" }, Icon$1)),
161710
+ Icon$1 && !renderIconAbove && /* @__PURE__ */ React__default$1.createElement(
161711
+ Tooltip,
161712
+ {
161713
+ disabled: tooltipDisabled,
161714
+ portalClassName: "ve-toolbar-item-popover",
161715
+ content: tooltipToDisplay
161716
+ },
161717
+ /* @__PURE__ */ React__default$1.createElement(
161718
+ AnchorButton,
161719
+ {
161720
+ intent: Intent.PRIMARY,
161721
+ onClick: onIconClick === "toggleDropdown" ? this.toggleDropdown : onIconClick,
161722
+ active: toggled,
161723
+ disabled,
161724
+ minimal: true,
161725
+ icon: React__default$1.isValidElement(Icon$1) ? Icon$1 : /* @__PURE__ */ React__default$1.createElement(Icon$1, { toggleDropdown: this.toggleDropdown })
161726
+ }
161727
+ )
161728
+ ),
161729
+ Dropdown && !noDropdownIcon ? /* @__PURE__ */ React__default$1.createElement(Tooltip, { disabled: tooltipDisabled, content: dropdowntooltip }, /* @__PURE__ */ React__default$1.createElement(
161730
+ "div",
161731
+ {
161732
+ className: (isOpen ? " isOpen " : "") + (dropdownicon ? "" : " veToolbarDropdown"),
161733
+ onClick: this.toggleDropdown
161734
+ },
161735
+ dropdownicon ? /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarIcon" }, /* @__PURE__ */ React__default$1.createElement("div", null, dropdownicon)) : isOpen ? /* @__PURE__ */ React__default$1.createElement(
161736
+ Icon,
161737
+ {
161738
+ "data-test": toolName + "Dropdown",
161739
+ iconSize: 13,
161740
+ icon: "caret-up"
161741
+ }
161742
+ ) : /* @__PURE__ */ React__default$1.createElement(
161743
+ Icon,
161744
+ {
161745
+ "data-test": toolName + "Dropdown",
161746
+ iconSize: 13,
161747
+ icon: "caret-down"
161748
+ }
161749
+ )
161750
+ )) : null
161751
+ );
161752
+ const content = /* @__PURE__ */ React__default$1.createElement(
161753
+ "div",
161754
+ {
161755
+ ref: (n) => {
161756
+ if (n)
161757
+ this.dropdownNode = n;
161758
+ },
161759
+ style: { padding: 10, minWidth: 250, maxWidth: 350 },
161760
+ className: "ve-toolbar-dropdown content"
161761
+ },
161762
+ Dropdown && /* @__PURE__ */ React__default$1.createElement(
161763
+ Dropdown,
161764
+ {
161765
+ ...rest,
161766
+ editorName,
161767
+ toggleDropdown: this.toggleDropdown
161768
+ }
161769
+ )
161770
+ );
161771
+ const target = IconWrapper ? /* @__PURE__ */ React__default$1.createElement(IconWrapper, { ...IconWrapperProps }, ({ getRootProps, getInputProps }) => /* @__PURE__ */ React__default$1.createElement("div", { ...getRootProps() }, /* @__PURE__ */ React__default$1.createElement("input", { ...getInputProps() }), buttonTarget)) : buttonTarget;
161772
+ return /* @__PURE__ */ React__default$1.createElement("div", { style: { display: "flex", alignItems: "center" } }, index !== 0 && /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarSpacer" }), /* @__PURE__ */ React__default$1.createElement(
161773
+ Popover,
161774
+ {
161775
+ disabled: popoverDisabled,
161776
+ isOpen: !!Dropdown && isOpen,
161777
+ onClose: (e) => {
161778
+ let srcElement;
161779
+ if (e) {
161780
+ srcElement = e.srcElement || e.target;
161781
+ }
161782
+ if (e && srcElement && this.dropdownNode && (this.dropdownNode.contains(srcElement) || !document.body.contains(srcElement))) {
161783
+ return;
161784
+ }
161785
+ this.toggleDropdown({ forceClose: true });
161786
+ },
161787
+ canEscapeKeyClose: true,
161788
+ minimal: true,
161789
+ position: Position.BOTTOM,
161790
+ target,
161791
+ content
161792
+ }
161793
+ ));
161794
+ }
161795
+ }
161796
+ const ToolbarItem$1 = connectToEditor(({ toolBar = {} }, { toolName }) => ({
161797
+ isOpen: toolBar.openItem === toolName
161798
+ }))(ToolbarItem);
161799
+
161800
+ const editTool = connectToEditor((editorState) => {
161801
+ return {
161802
+ readOnly: editorState.readOnly
161803
+ };
161804
+ })((props) => {
161805
+ const { toolbarItemProps, readOnly, disableSetReadOnly } = props;
161806
+ const [isLoading, setIsLoading] = useState(false);
161807
+ const readOnlyTooltip = ({ readOnly: readOnly2, disableSetReadOnly: disableSetReadOnly2 }) => {
161808
+ if (isLoading) {
161809
+ return "Loading...";
161810
+ } else if (disableSetReadOnly2) {
161811
+ return "You do not have permission to edit locks on this sequence";
161812
+ }
161813
+ return readOnly2 ? "Click to enable editing" : "Click to disable editing";
161814
+ };
161815
+ return /* @__PURE__ */ React__default$1.createElement(
161816
+ ToolbarItem$1,
161817
+ {
161818
+ ...{
161819
+ disabled: isLoading || disableSetReadOnly,
161820
+ Icon: /* @__PURE__ */ React__default$1.createElement(Icon, { icon: readOnly ? "lock" : "unlock" }),
161821
+ onIconClick: () => handleReadOnlyChange(!readOnly, { ...props, setIsLoading }),
161822
+ tooltip: readOnlyTooltip({ readOnly, disableSetReadOnly }),
161823
+ ...toolbarItemProps
161824
+ }
161825
+ }
161826
+ );
161827
+ });
161828
+ async function handleReadOnlyChange(newVal, { beforeReadOnlyChange, updateReadOnlyMode, setIsLoading = () => {
161829
+ } }) {
161830
+ if (beforeReadOnlyChange) {
161831
+ setIsLoading(true);
161832
+ const shouldChange = await beforeReadOnlyChange(newVal);
161833
+ setIsLoading(false);
161834
+ if (shouldChange === false) {
161835
+ return;
161836
+ }
161837
+ }
161838
+ updateReadOnlyMode(newVal);
161839
+ }
161840
+
161698
161841
  const isProtein = (props) => props.sequenceData && props.sequenceData.isProtein;
161699
161842
  const isOligo = (props) => props.sequenceData && props.sequenceData.isOligo;
161700
161843
  const isRna = (props) => props.sequenceData && props.sequenceData.isRna;
@@ -161778,7 +161921,7 @@ const fileCommandDefs = {
161778
161921
  isDisabled: (props) => props.disableSetReadOnly || !props.onSave,
161779
161922
  isHidden: (props) => !props.toggleReadOnlyMode,
161780
161923
  isActive: (props) => props.readOnly,
161781
- handler: (props) => props.toggleReadOnlyMode()
161924
+ handler: (props) => handleReadOnlyChange(!props.readOnly, props)
161782
161925
  },
161783
161926
  importSequence: {
161784
161927
  isHidden: (props) => props.hideSingleImport,
@@ -167663,7 +167806,7 @@ function getEditDeleteHandlers(type, annotation) {
167663
167806
  ];
167664
167807
  }
167665
167808
 
167666
- const style$i = '';
167809
+ const style$h = '';
167667
167810
 
167668
167811
  function SequenceName({ sequenceName, sequenceLength, isProtein }) {
167669
167812
  return /* @__PURE__ */ React__default$1.createElement("div", { key: "circViewSvgCenterText", style: { textAlign: "center" } }, /* @__PURE__ */ React__default$1.createElement("span", null, sequenceName, " "), /* @__PURE__ */ React__default$1.createElement("br", null), /* @__PURE__ */ React__default$1.createElement("span", null, isProtein ? `${Math.floor(sequenceLength / 3)} AAs` : `${sequenceLength} bps`));
@@ -170049,7 +170192,7 @@ function VisibilityOptions$2({
170049
170192
  );
170050
170193
  }
170051
170194
 
170052
- const style$h = '';
170195
+ const style$g = '';
170053
170196
 
170054
170197
  const simpleDialog = '';
170055
170198
 
@@ -170326,7 +170469,7 @@ function combineLabels(labels, numberOfBuckets) {
170326
170469
  return combinedLabels;
170327
170470
  }
170328
170471
 
170329
- const style$g = '';
170472
+ const style$f = '';
170330
170473
 
170331
170474
  const fontWidthToFontSize = 1.75;
170332
170475
  const getTextLength = (text) => {
@@ -172529,7 +172672,7 @@ function DrawAnnotationInner({
172529
172672
  }
172530
172673
  const DrawAnnotation = withHover(DrawAnnotationInner);
172531
172674
 
172532
- const style$f = '';
172675
+ const style$e = '';
172533
172676
 
172534
172677
  function c(u,e,c){var i=this,a=useRef(null),o=useRef(0),f=useRef(null),l=useRef([]),m=useRef(),v=useRef(),d=useRef(u),p=useRef(!0);useEffect(function(){d.current=u;},[u]);var g=!e&&0!==e&&"undefined"!=typeof window;if("function"!=typeof u)throw new TypeError("Expected a function");e=+e||0;var w=!!(c=c||{}).leading,s=!("trailing"in c)||!!c.trailing,x="maxWait"in c,y=x?Math.max(+c.maxWait||0,e):null;useEffect(function(){return p.current=!0,function(){p.current=!1;}},[]);var h=useMemo$1(function(){var r=function(r){var n=l.current,t=m.current;return l.current=m.current=null,o.current=r,v.current=d.current.apply(t,n)},n=function(r,n){g&&cancelAnimationFrame(f.current),f.current=g?requestAnimationFrame(r):setTimeout(r,n);},t=function(r){if(!p.current)return !1;var n=r-a.current;return !a.current||n>=e||n<0||x&&r-o.current>=y},u=function(n){return f.current=null,s&&l.current?r(n):(l.current=m.current=null,v.current)},c=function r(){var c=Date.now();if(t(c))return u(c);if(p.current){var i=e-(c-a.current),f=x?Math.min(i,y-(c-o.current)):i;n(r,f);}},h=function(){var u=Date.now(),d=t(u);if(l.current=[].slice.call(arguments),m.current=i,a.current=u,d){if(!f.current&&p.current)return o.current=a.current,n(c,e),w?r(a.current):v.current;if(x)return n(c,e),r(a.current)}return f.current||n(c,e),v.current};return h.cancel=function(){f.current&&(g?cancelAnimationFrame(f.current):clearTimeout(f.current)),o.current=0,l.current=a.current=m.current=f.current=null;},h.isPending=function(){return !!f.current},h.flush=function(){return f.current?u(Date.now()):v.current},h},[w,x,e,y,s,g]);return h}
172535
172678
 
@@ -173462,7 +173605,7 @@ function CircularView(props) {
173462
173605
  }
173463
173606
  const CircularView$1 = withEditorInteractions(CircularView);
173464
173607
 
173465
- const style$e = '';
173608
+ const style$d = '';
173466
173609
 
173467
173610
  class PrintDialog extends React__default$1.Component {
173468
173611
  state = {
@@ -173943,7 +174086,7 @@ const RemoveDuplicates = compose$1(
173943
174086
  tgFormValues("ignoreName", "ignoreStrand", "ignoreStartAndEnd")
173944
174087
  )(RemoveDuplicatesDialog);
173945
174088
 
173946
- const style$d = '';
174089
+ const style$c = '';
173947
174090
 
173948
174091
  var isMobile$2 = {exports: {}};
173949
174092
 
@@ -174965,7 +175108,7 @@ const normalizeToInt = (val) => {
174965
175108
  return normalizedVal;
174966
175109
  };
174967
175110
 
174968
- const style$c = '';
175111
+ const style$b = '';
174969
175112
 
174970
175113
  const EnzymeViewer = ({
174971
175114
  extraClasses = "",
@@ -175040,7 +175183,7 @@ const EnzymeViewer = ({
175040
175183
  );
175041
175184
  };
175042
175185
 
175043
- const style$b = '';
175186
+ const style$a = '';
175044
175187
 
175045
175188
  const upsertLocalEnzymeGroups = (newGroups) => {
175046
175189
  const existingGroups = window.getExistingEnzymeGroups();
@@ -175736,7 +175879,7 @@ const HoverView = view(({ allEnzymesByName }) => {
175736
175879
  );
175737
175880
  });
175738
175881
 
175739
- const style$a = '';
175882
+ const style$9 = '';
175740
175883
 
175741
175884
  const CreateCustomEnzyme = function(props) {
175742
175885
  const paddingStart = "-------";
@@ -176561,143 +176704,6 @@ function getIsEnzymeHidden({ name, allRestrictionEnzymes }) {
176561
176704
  return isHidden;
176562
176705
  }
176563
176706
 
176564
- const style$9 = '';
176565
-
176566
- class ToolbarItem extends React__default$1.Component {
176567
- toggleDropdown = ({ forceClose } = {}) => {
176568
- const { toolName, isOpen } = this.props;
176569
- this.props.openToolbarItemUpdate(isOpen || forceClose ? "" : toolName);
176570
- };
176571
- render() {
176572
- const { overrides = {} } = this.props;
176573
- const {
176574
- isOpen,
176575
- index,
176576
- Icon: Icon$1,
176577
- // dynamicIcon,
176578
- onIconClick = lodashExports.noop,
176579
- tooltip = "",
176580
- tooltipToggled,
176581
- dropdowntooltip = "",
176582
- Dropdown,
176583
- disabled,
176584
- isHidden,
176585
- renderIconAbove,
176586
- noDropdownIcon,
176587
- IconWrapper,
176588
- editorName,
176589
- popoverDisabled,
176590
- IconWrapperProps,
176591
- toolName,
176592
- dropdownicon,
176593
- tooltipDisabled,
176594
- toggled = false,
176595
- ...rest
176596
- } = { ...this.props, ...overrides };
176597
- if (!toolName)
176598
- console.warn("toolName is required!");
176599
- if (isHidden)
176600
- return null;
176601
- let tooltipToDisplay = tooltip;
176602
- if (toggled && tooltipToggled) {
176603
- tooltipToDisplay = tooltipToggled;
176604
- }
176605
- const buttonTarget = /* @__PURE__ */ React__default$1.createElement(
176606
- "div",
176607
- {
176608
- className: `veToolbarItemOuter ve-tool-container-${toolName}` + (disabled ? " disabled " : "")
176609
- },
176610
- renderIconAbove && /* @__PURE__ */ React__default$1.createElement("div", null, /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarItem" }, Icon$1)),
176611
- Icon$1 && !renderIconAbove && /* @__PURE__ */ React__default$1.createElement(
176612
- Tooltip,
176613
- {
176614
- disabled: tooltipDisabled,
176615
- portalClassName: "ve-toolbar-item-popover",
176616
- content: tooltipToDisplay
176617
- },
176618
- /* @__PURE__ */ React__default$1.createElement(
176619
- AnchorButton,
176620
- {
176621
- intent: Intent.PRIMARY,
176622
- onClick: onIconClick === "toggleDropdown" ? this.toggleDropdown : onIconClick,
176623
- active: toggled,
176624
- disabled,
176625
- minimal: true,
176626
- icon: React__default$1.isValidElement(Icon$1) ? Icon$1 : /* @__PURE__ */ React__default$1.createElement(Icon$1, { toggleDropdown: this.toggleDropdown })
176627
- }
176628
- )
176629
- ),
176630
- Dropdown && !noDropdownIcon ? /* @__PURE__ */ React__default$1.createElement(Tooltip, { disabled: tooltipDisabled, content: dropdowntooltip }, /* @__PURE__ */ React__default$1.createElement(
176631
- "div",
176632
- {
176633
- className: (isOpen ? " isOpen " : "") + (dropdownicon ? "" : " veToolbarDropdown"),
176634
- onClick: this.toggleDropdown
176635
- },
176636
- dropdownicon ? /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarIcon" }, /* @__PURE__ */ React__default$1.createElement("div", null, dropdownicon)) : isOpen ? /* @__PURE__ */ React__default$1.createElement(
176637
- Icon,
176638
- {
176639
- "data-test": toolName + "Dropdown",
176640
- iconSize: 13,
176641
- icon: "caret-up"
176642
- }
176643
- ) : /* @__PURE__ */ React__default$1.createElement(
176644
- Icon,
176645
- {
176646
- "data-test": toolName + "Dropdown",
176647
- iconSize: 13,
176648
- icon: "caret-down"
176649
- }
176650
- )
176651
- )) : null
176652
- );
176653
- const content = /* @__PURE__ */ React__default$1.createElement(
176654
- "div",
176655
- {
176656
- ref: (n) => {
176657
- if (n)
176658
- this.dropdownNode = n;
176659
- },
176660
- style: { padding: 10, minWidth: 250, maxWidth: 350 },
176661
- className: "ve-toolbar-dropdown content"
176662
- },
176663
- Dropdown && /* @__PURE__ */ React__default$1.createElement(
176664
- Dropdown,
176665
- {
176666
- ...rest,
176667
- editorName,
176668
- toggleDropdown: this.toggleDropdown
176669
- }
176670
- )
176671
- );
176672
- const target = IconWrapper ? /* @__PURE__ */ React__default$1.createElement(IconWrapper, { ...IconWrapperProps }, ({ getRootProps, getInputProps }) => /* @__PURE__ */ React__default$1.createElement("div", { ...getRootProps() }, /* @__PURE__ */ React__default$1.createElement("input", { ...getInputProps() }), buttonTarget)) : buttonTarget;
176673
- return /* @__PURE__ */ React__default$1.createElement("div", { style: { display: "flex", alignItems: "center" } }, index !== 0 && /* @__PURE__ */ React__default$1.createElement("div", { className: "veToolbarSpacer" }), /* @__PURE__ */ React__default$1.createElement(
176674
- Popover,
176675
- {
176676
- disabled: popoverDisabled,
176677
- isOpen: !!Dropdown && isOpen,
176678
- onClose: (e) => {
176679
- let srcElement;
176680
- if (e) {
176681
- srcElement = e.srcElement || e.target;
176682
- }
176683
- if (e && srcElement && this.dropdownNode && (this.dropdownNode.contains(srcElement) || !document.body.contains(srcElement))) {
176684
- return;
176685
- }
176686
- this.toggleDropdown({ forceClose: true });
176687
- },
176688
- canEscapeKeyClose: true,
176689
- minimal: true,
176690
- position: Position.BOTTOM,
176691
- target,
176692
- content
176693
- }
176694
- ));
176695
- }
176696
- }
176697
- const ToolbarItem$1 = connectToEditor(({ toolBar = {} }, { toolName }) => ({
176698
- isOpen: toolBar.openItem === toolName
176699
- }))(ToolbarItem);
176700
-
176701
176707
  function array_move(arr, old_index, new_index) {
176702
176708
  if (new_index >= arr.length) {
176703
176709
  let k = new_index - arr.length + 1;
@@ -183100,7 +183106,7 @@ function addClickableLabel(toRet, { closeDropDown }) {
183100
183106
  }
183101
183107
 
183102
183108
  const userDefinedHandlersAndOpts = [
183103
- "onChangeEditLock",
183109
+ "beforeReadOnlyChange",
183104
183110
  "defaultLinkedOligoMessage",
183105
183111
  "allowMultipleFeatureDirections",
183106
183112
  "getAdditionalEditAnnotationComps",
@@ -183363,49 +183369,6 @@ const OrfToolDropdown = withEditorProps(
183363
183369
  }
183364
183370
  );
183365
183371
 
183366
- const editTool = connectToEditor((editorState) => {
183367
- return {
183368
- readOnly: editorState.readOnly
183369
- };
183370
- })(
183371
- ({
183372
- toolbarItemProps,
183373
- readOnly,
183374
- toggleReadOnlyMode,
183375
- disableSetReadOnly,
183376
- onChangeEditLock
183377
- }) => {
183378
- const [isLoading, setIsLoading] = useState(false);
183379
- const readOnlyTooltip = ({ readOnly: readOnly2, disableSetReadOnly: disableSetReadOnly2 }) => {
183380
- if (isLoading) {
183381
- return "Loading...";
183382
- } else if (disableSetReadOnly2) {
183383
- return "You do not have permission to edit locks on this sequence";
183384
- }
183385
- return readOnly2 ? "Click to enable editing" : "Click to disable editing";
183386
- };
183387
- return /* @__PURE__ */ React__default$1.createElement(
183388
- ToolbarItem$1,
183389
- {
183390
- ...{
183391
- disabled: isLoading || disableSetReadOnly,
183392
- Icon: /* @__PURE__ */ React__default$1.createElement(Icon, { icon: readOnly ? "lock" : "unlock" }),
183393
- onIconClick: async () => {
183394
- if (onChangeEditLock) {
183395
- setIsLoading(true);
183396
- await onChangeEditLock(!readOnly);
183397
- setIsLoading(false);
183398
- }
183399
- toggleReadOnlyMode();
183400
- },
183401
- tooltip: readOnlyTooltip({ readOnly, disableSetReadOnly }),
183402
- ...toolbarItemProps
183403
- }
183404
- }
183405
- );
183406
- }
183407
- );
183408
-
183409
183372
  const style$4 = '';
183410
183373
 
183411
183374
  const opts = [
@@ -184026,31 +183989,22 @@ const style$3 = '';
184026
183989
 
184027
183990
  const EditReadOnlyItem = connectToEditor(({ readOnly }) => ({
184028
183991
  readOnly
184029
- }))(
184030
- ({
184031
- onSave,
184032
- readOnly,
184033
- showReadOnly,
184034
- disableSetReadOnly,
184035
- updateReadOnlyMode
184036
- }) => {
184037
- return showReadOnly ? /* @__PURE__ */ React__default$1.createElement(StatusBarItem, { dataTest: "veStatusBar-readOnly" }, onSave ? /* @__PURE__ */ React__default$1.createElement(
184038
- HTMLSelect,
184039
- {
184040
- options: [
184041
- { label: "Read Only", value: "readOnly" },
184042
- { label: "Editable", value: "editable" }
184043
- ],
184044
- disabled: disableSetReadOnly || !onSave,
184045
- className: Classes.MINIMAL,
184046
- value: readOnly ? "readOnly" : "editable",
184047
- onChange: ({ target: { value } }) => {
184048
- updateReadOnlyMode(value === "readOnly");
184049
- }
184050
- }
184051
- ) : readOnly ? "Read Only" : "Editable") : null;
184052
- }
184053
- );
183992
+ }))((props) => {
183993
+ const { onSave, readOnly, showReadOnly, disableSetReadOnly } = props;
183994
+ return showReadOnly ? /* @__PURE__ */ React__default$1.createElement(StatusBarItem, { dataTest: "veStatusBar-readOnly" }, onSave ? /* @__PURE__ */ React__default$1.createElement(
183995
+ HTMLSelect,
183996
+ {
183997
+ options: [
183998
+ { label: "Read Only", value: "readOnly" },
183999
+ { label: "Editable", value: "editable" }
184000
+ ],
184001
+ disabled: disableSetReadOnly || !onSave,
184002
+ className: Classes.MINIMAL,
184003
+ value: readOnly ? "readOnly" : "editable",
184004
+ onChange: ({ target: { value } }) => handleReadOnlyChange(value === "readOnly", props)
184005
+ }
184006
+ ) : readOnly ? "Read Only" : "Editable") : null;
184007
+ });
184054
184008
  const ShowSelectionItem = compose(
184055
184009
  connectToEditor(
184056
184010
  ({ selectionLayer, caretPosition, sequenceData = { sequence: "" } }, ownProps, ...rest) => {
@@ -184197,11 +184151,13 @@ function StatusBar({
184197
184151
  showGCContentByDefault,
184198
184152
  onSelectionOrCaretChanged,
184199
184153
  GCDecimalDigits = 1,
184200
- isProtein
184154
+ isProtein,
184155
+ beforeReadOnlyChange
184201
184156
  }) {
184202
184157
  return /* @__PURE__ */ React__default$1.createElement("div", { className: "veStatusBar" }, showMoleculeType && /* @__PURE__ */ React__default$1.createElement(ShowTypeItem, { editorName }), /* @__PURE__ */ React__default$1.createElement(
184203
184158
  EditReadOnlyItem,
184204
184159
  {
184160
+ beforeReadOnlyChange,
184205
184161
  editorName,
184206
184162
  onSave,
184207
184163
  disableSetReadOnly,
@@ -184640,7 +184596,6 @@ class GeneralProperties extends React__default$1.Component {
184640
184596
  disableSetReadOnly,
184641
184597
  updateAvailability,
184642
184598
  sequenceData,
184643
- updateReadOnlyMode,
184644
184599
  onSave,
184645
184600
  showAvailability,
184646
184601
  sequenceNameUpdate
@@ -184695,10 +184650,9 @@ class GeneralProperties extends React__default$1.Component {
184695
184650
  ))), /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-flex-row" }, /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-left bp3-label" }, "Length"), " ", /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-right" }, " ", isProtein ? proteinSequence.length : sequence.length)), showReadOnly && /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-flex-row" }, /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-left bp3-label" }, "Is Editable"), " ", /* @__PURE__ */ React__default$1.createElement("div", { className: "ve-column-right" }, " ", /* @__PURE__ */ React__default$1.createElement(
184696
184651
  BPSelect,
184697
184652
  {
184653
+ className: "veReadOnlySelect",
184698
184654
  disabled: !onSave || disableSetReadOnly,
184699
- onChange: (val) => {
184700
- updateReadOnlyMode(val === "readOnly");
184701
- },
184655
+ onChange: (val) => console.log(`val:`, val) || handleReadOnlyChange(val === "readOnly", this.props),
184702
184656
  value: readOnly ? "readOnly" : "editable",
184703
184657
  options: [
184704
184658
  { label: "Read Only", value: "readOnly" },
@@ -194771,7 +194725,7 @@ class Editor extends React__default$1.Component {
194771
194725
  contentLeft: this.props.contentLeft,
194772
194726
  editorName,
194773
194727
  withDigestTool: true,
194774
- onChangeEditLock: this.props.onChangeEditLock,
194728
+ beforeReadOnlyChange: this.props.beforeReadOnlyChange,
194775
194729
  ...ToolBarProps
194776
194730
  }
194777
194731
  ),