ketcher-react 3.7.0-rc.1 → 3.7.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants.d.ts +2 -2
- package/dist/cjs/index.css +1 -1
- package/dist/cjs/index.css.map +1 -1
- package/dist/cjs/index.js +268 -116
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{index.modern-5eda67eb.js → index.modern-021f6994.js} +641 -210
- package/dist/cjs/index.modern-021f6994.js.map +1 -0
- package/dist/cjs/script/editor/Editor.d.ts +2 -2
- package/dist/cjs/script/editor/tool/create-monomer.d.ts +1 -1
- package/dist/cjs/script/index.d.ts +2 -0
- package/dist/cjs/script/ui/component/form/Select/Select.d.ts +2 -1
- package/dist/cjs/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.constants.d.ts +5 -0
- package/dist/cjs/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.types.d.ts +5 -1
- package/dist/cjs/script/ui/views/components/MonomerCreationWizard/components/NaturalAnaloguePicker/NaturalAnaloguePicker.d.ts +1 -0
- package/dist/cjs/script/ui/views/toolbars/ArrowScroll/ArrowScroll.d.ts +4 -3
- package/dist/cjs/script/ui/views/toolbars/ToolbarGroupItem/ToolbarMultiToolItem/usePortalStyle.d.ts +2 -2
- package/dist/constants.d.ts +2 -2
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +259 -114
- package/dist/index.js.map +1 -1
- package/dist/{index.modern-eab54238.js → index.modern-0fa484b9.js} +642 -211
- package/dist/index.modern-0fa484b9.js.map +1 -0
- package/dist/script/editor/Editor.d.ts +2 -2
- package/dist/script/editor/tool/create-monomer.d.ts +1 -1
- package/dist/script/index.d.ts +2 -0
- package/dist/script/ui/component/form/Select/Select.d.ts +2 -1
- package/dist/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.constants.d.ts +5 -0
- package/dist/script/ui/views/components/MonomerCreationWizard/MonomerCreationWizard.types.d.ts +5 -1
- package/dist/script/ui/views/components/MonomerCreationWizard/components/NaturalAnaloguePicker/NaturalAnaloguePicker.d.ts +1 -0
- package/dist/script/ui/views/toolbars/ArrowScroll/ArrowScroll.d.ts +4 -3
- package/dist/script/ui/views/toolbars/ToolbarGroupItem/ToolbarMultiToolItem/usePortalStyle.d.ts +2 -2
- package/package.json +1 -1
- package/dist/cjs/index.modern-5eda67eb.js.map +0 -1
- package/dist/index.modern-eab54238.js.map +0 -1
package/dist/cjs/index.js
CHANGED
|
@@ -344,6 +344,16 @@ function _isNativeReflectConstruct$g() { try { var t = !Boolean.prototype.valueO
|
|
|
344
344
|
var ieCb = typeof window !== 'undefined' ? window.clipboardData : {};
|
|
345
345
|
var CLIP_AREA_BASE_CLASS = 'cliparea';
|
|
346
346
|
var needSkipCopyEvent = false;
|
|
347
|
+
var isUserEditing = function isUserEditing() {
|
|
348
|
+
var el = document.activeElement;
|
|
349
|
+
if (!el) {
|
|
350
|
+
return false;
|
|
351
|
+
}
|
|
352
|
+
if (el.hasAttribute && el.hasAttribute('data-cliparea')) {
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
355
|
+
return Boolean(el.tagName === 'TEXTAREA' || el.tagName === 'INPUT' && el.type !== 'button' && el.type !== 'submit' && el.type !== 'reset' || el.contentEditable === 'true');
|
|
356
|
+
};
|
|
347
357
|
var ClipArea = function (_Component) {
|
|
348
358
|
_inherits__default["default"](ClipArea, _Component);
|
|
349
359
|
function ClipArea(props) {
|
|
@@ -369,7 +379,7 @@ var ClipArea = function (_Component) {
|
|
|
369
379
|
if (event.shiftKey && !isActiveElement(event.target)) event.preventDefault();
|
|
370
380
|
},
|
|
371
381
|
copy: function copy(event) {
|
|
372
|
-
if (!_this2.props.focused()) {
|
|
382
|
+
if (!_this2.props.focused() || isUserEditing()) {
|
|
373
383
|
return;
|
|
374
384
|
}
|
|
375
385
|
if (ketcherCore.isClipboardAPIAvailable()) {
|
|
@@ -406,7 +416,7 @@ var ClipArea = function (_Component) {
|
|
|
406
416
|
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
407
417
|
while (1) switch (_context.prev = _context.next) {
|
|
408
418
|
case 0:
|
|
409
|
-
if (_this2.props.focused()) {
|
|
419
|
+
if (!(!_this2.props.focused() || isUserEditing())) {
|
|
410
420
|
_context.next = 2;
|
|
411
421
|
break;
|
|
412
422
|
}
|
|
@@ -441,7 +451,7 @@ var ClipArea = function (_Component) {
|
|
|
441
451
|
return cut;
|
|
442
452
|
}(),
|
|
443
453
|
paste: function paste(event) {
|
|
444
|
-
if (!_this2.props.focused()) {
|
|
454
|
+
if (!_this2.props.focused() || isUserEditing()) {
|
|
445
455
|
return;
|
|
446
456
|
}
|
|
447
457
|
if (ketcherCore.isClipboardAPIAvailable()) {
|
|
@@ -532,6 +542,7 @@ var ClipArea = function (_Component) {
|
|
|
532
542
|
return jsxRuntime.jsx("textarea", {
|
|
533
543
|
ref: this.textAreaRef,
|
|
534
544
|
className: clsx__default["default"](CLIP_AREA_BASE_CLASS, classes$Q.cliparea),
|
|
545
|
+
"data-cliparea": true,
|
|
535
546
|
contentEditable: true,
|
|
536
547
|
autoFocus: true
|
|
537
548
|
,
|
|
@@ -3840,7 +3851,7 @@ var zoom = {
|
|
|
3840
3851
|
|
|
3841
3852
|
var openHelpLink = function openHelpLink() {
|
|
3842
3853
|
var _window$open;
|
|
3843
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.7.0-rc.
|
|
3854
|
+
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.7.0-rc.3\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
|
|
3844
3855
|
};
|
|
3845
3856
|
var help = {
|
|
3846
3857
|
help: {
|
|
@@ -3867,8 +3878,6 @@ var STRUCT_TYPE = {
|
|
|
3867
3878
|
};
|
|
3868
3879
|
var KETCHER_ROOT_NODE_CLASS_NAME = 'Ketcher-root';
|
|
3869
3880
|
var KETCHER_ROOT_NODE_CSS_SELECTOR = ".".concat(KETCHER_ROOT_NODE_CLASS_NAME);
|
|
3870
|
-
var EditorClassName = 'Ketcher-polymer-editor-root';
|
|
3871
|
-
var KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR = ".".concat(EditorClassName);
|
|
3872
3881
|
var STRUCT_SERVICE_NO_RENDER_INITIALIZED_EVENT = 'struct-service-no-render-initialized';
|
|
3873
3882
|
var STRUCT_SERVICE_INITIALIZED_EVENT = 'struct-service-initialized';
|
|
3874
3883
|
var ACS_STYLE_DEFAULT_SETTINGS = {
|
|
@@ -3948,6 +3957,9 @@ var disableIfViewOnly = function disableIfViewOnly(editor) {
|
|
|
3948
3957
|
var disableIfMonomerCreationWizardActive = function disableIfMonomerCreationWizardActive(editor) {
|
|
3949
3958
|
return editor.isMonomerCreationWizardActive;
|
|
3950
3959
|
};
|
|
3960
|
+
var combinedDisable = function combinedDisable(editor) {
|
|
3961
|
+
return disableIfViewOnly(editor) || disableIfMonomerCreationWizardActive(editor);
|
|
3962
|
+
};
|
|
3951
3963
|
var updateConfigItem = function updateConfigItem(item) {
|
|
3952
3964
|
if (typeof item.disabled === 'boolean' || item.enabledInViewOnly === true) {
|
|
3953
3965
|
return item;
|
|
@@ -3960,7 +3972,7 @@ var updateConfigItem = function updateConfigItem(item) {
|
|
|
3960
3972
|
});
|
|
3961
3973
|
} else {
|
|
3962
3974
|
return _objectSpread$1p(_objectSpread$1p({}, item), {}, {
|
|
3963
|
-
disabled:
|
|
3975
|
+
disabled: combinedDisable
|
|
3964
3976
|
});
|
|
3965
3977
|
}
|
|
3966
3978
|
};
|
|
@@ -13432,7 +13444,7 @@ assert.strict.strict = assert.strict;
|
|
|
13432
13444
|
var calculateMonomerPreviewTop = createCalculatePreviewTopFunction(preview.height);
|
|
13433
13445
|
var calculateNucleoElementPreviewTop = createCalculatePreviewTopFunction(preview.heightForNucleotide);
|
|
13434
13446
|
function calculateTop(target, height) {
|
|
13435
|
-
var ketcherEditorRoot = document.querySelector(KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR);
|
|
13447
|
+
var ketcherEditorRoot = document.querySelector(ketcherCore.KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR);
|
|
13436
13448
|
var ketcherEditorRootBoundingClientRect = ketcherEditorRoot === null || ketcherEditorRoot === void 0 ? void 0 : ketcherEditorRoot.getBoundingClientRect();
|
|
13437
13449
|
var relativeTargetTop = target.top - ((ketcherEditorRootBoundingClientRect === null || ketcherEditorRootBoundingClientRect === void 0 ? void 0 : ketcherEditorRootBoundingClientRect.top) || 0);
|
|
13438
13450
|
var relativeTargetBottom = target.bottom - ((ketcherEditorRootBoundingClientRect === null || ketcherEditorRootBoundingClientRect === void 0 ? void 0 : ketcherEditorRootBoundingClientRect.top) || 0);
|
|
@@ -13771,9 +13783,11 @@ function usePortalOpening(_ref) {
|
|
|
13771
13783
|
}
|
|
13772
13784
|
|
|
13773
13785
|
function usePortalStyle(_ref) {
|
|
13774
|
-
var _ref2 = _slicedToArray__default["default"](_ref,
|
|
13786
|
+
var _ref2 = _slicedToArray__default["default"](_ref, 4),
|
|
13775
13787
|
ref = _ref2[0],
|
|
13776
|
-
isOpen = _ref2[1]
|
|
13788
|
+
isOpen = _ref2[1],
|
|
13789
|
+
isTop = _ref2[2],
|
|
13790
|
+
rootElementSelector = _ref2[3];
|
|
13777
13791
|
var _useState = React.useState({}),
|
|
13778
13792
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
13779
13793
|
portalStyle = _useState2[0],
|
|
@@ -13783,19 +13797,20 @@ function usePortalStyle(_ref) {
|
|
|
13783
13797
|
if (!ref.current) {
|
|
13784
13798
|
return;
|
|
13785
13799
|
}
|
|
13786
|
-
var editorRect = ((_document$querySelect = document.querySelector(KETCHER_ROOT_NODE_CSS_SELECTOR)) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.getBoundingClientRect()) || {
|
|
13800
|
+
var editorRect = ((_document$querySelect = document.querySelector(rootElementSelector || KETCHER_ROOT_NODE_CSS_SELECTOR)) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.getBoundingClientRect()) || {
|
|
13787
13801
|
top: 0,
|
|
13788
13802
|
left: 0
|
|
13789
13803
|
};
|
|
13790
13804
|
var menuItemRect = ref.current.getBoundingClientRect();
|
|
13791
|
-
var top = menuItemRect.top - editorRect.top;
|
|
13792
13805
|
var spaceBetween = 4;
|
|
13793
|
-
var
|
|
13806
|
+
var alignmentOffset = 2;
|
|
13807
|
+
var top = menuItemRect.top - editorRect.top + (isTop ? spaceBetween + menuItemRect.height : 0) - (isTop ? 0 : alignmentOffset);
|
|
13808
|
+
var left = menuItemRect.left - editorRect.left + (isTop ? 0 : spaceBetween + menuItemRect.width) - (isTop ? alignmentOffset : 0);
|
|
13794
13809
|
setPortalStyle({
|
|
13795
13810
|
top: "".concat(top, "px"),
|
|
13796
13811
|
left: "".concat(left, "px")
|
|
13797
13812
|
});
|
|
13798
|
-
}, [ref, isOpen]);
|
|
13813
|
+
}, [ref, isOpen, isTop, rootElementSelector]);
|
|
13799
13814
|
return [portalStyle];
|
|
13800
13815
|
}
|
|
13801
13816
|
|
|
@@ -15135,7 +15150,7 @@ var selectOptions$2 = makeItems(['select-rectangle', 'select-lasso', 'select-fra
|
|
|
15135
15150
|
var arrowsOptions = makeItems(['reaction-arrow-open-angle', 'reaction-arrow-filled-triangle', 'reaction-arrow-filled-bow', 'reaction-arrow-dashed-open-angle', 'reaction-arrow-failed', 'reaction-arrow-retrosynthetic', 'reaction-arrow-both-ends-filled-triangle', 'reaction-arrow-equilibrium-filled-half-bow', 'reaction-arrow-equilibrium-filled-triangle', 'reaction-arrow-equilibrium-open-angle', 'reaction-arrow-unbalanced-equilibrium-filled-half-bow', 'reaction-arrow-unbalanced-equilibrium-open-half-angle', 'reaction-arrow-unbalanced-equilibrium-large-filled-half-bow', 'reaction-arrow-unbalanced-equilibrium-filled-half-triangle', 'reaction-arrow-elliptical-arc-arrow-filled-bow', 'reaction-arrow-elliptical-arc-arrow-filled-triangle', 'reaction-arrow-elliptical-arc-arrow-open-angle', 'reaction-arrow-elliptical-arc-arrow-open-half-angle', ketcherCore.MULTITAIL_ARROW_TOOL_NAME]);
|
|
15136
15151
|
var mappingOptions = makeItems(['reaction-map', 'reaction-unmap', 'reaction-automap']);
|
|
15137
15152
|
|
|
15138
|
-
var classes$L = {"scroll":"ArrowScroll-module_scroll__h9kCx","button":"ArrowScroll-module_button__ygMgL","down":"ArrowScroll-module_down__yDzZX","up":"ArrowScroll-module_up__Q1ubd"};
|
|
15153
|
+
var classes$L = {"scroll":"ArrowScroll-module_scroll__h9kCx","upDown":"ArrowScroll-module_upDown__zT-Uf","button":"ArrowScroll-module_button__ygMgL","down":"ArrowScroll-module_down__yDzZX","up":"ArrowScroll-module_up__Q1ubd","left":"ArrowScroll-module_left__ND2ZB","right":"ArrowScroll-module_right__A3fNm"};
|
|
15139
15154
|
|
|
15140
15155
|
function useSettingsContext() {
|
|
15141
15156
|
return React__default["default"].useContext(settingsContext);
|
|
@@ -15230,8 +15245,9 @@ var useSubscriptionOnEvents = function useSubscriptionOnEvents() {
|
|
|
15230
15245
|
var ArrowScroll = function ArrowScroll(_ref) {
|
|
15231
15246
|
var startInView = _ref.startInView,
|
|
15232
15247
|
endInView = _ref.endInView,
|
|
15233
|
-
|
|
15234
|
-
|
|
15248
|
+
scrollForward = _ref.scrollForward,
|
|
15249
|
+
scrollBack = _ref.scrollBack,
|
|
15250
|
+
isLeftRight = _ref.isLeftRight;
|
|
15235
15251
|
var _useState = React.useState(false),
|
|
15236
15252
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
15237
15253
|
isScrollDown = _useState2[0],
|
|
@@ -15240,8 +15256,8 @@ var ArrowScroll = function ArrowScroll(_ref) {
|
|
|
15240
15256
|
_useState4 = _slicedToArray__default["default"](_useState3, 2),
|
|
15241
15257
|
isScrollUp = _useState4[0],
|
|
15242
15258
|
setScrollUp = _useState4[1];
|
|
15243
|
-
useInterval(
|
|
15244
|
-
useInterval(
|
|
15259
|
+
useInterval(scrollBack, isScrollDown ? 100 : null);
|
|
15260
|
+
useInterval(scrollForward, isScrollUp ? 100 : null);
|
|
15245
15261
|
React.useEffect(function () {
|
|
15246
15262
|
return function () {
|
|
15247
15263
|
setScrollUp(false);
|
|
@@ -15253,31 +15269,27 @@ var ArrowScroll = function ArrowScroll(_ref) {
|
|
|
15253
15269
|
};
|
|
15254
15270
|
}, [endInView]);
|
|
15255
15271
|
return jsxRuntime.jsxs("div", {
|
|
15256
|
-
className: classes$L.scroll,
|
|
15272
|
+
className: [classes$L.scroll, isLeftRight ? classes$L.leftRight : classes$L.upDown].join(' '),
|
|
15257
15273
|
children: [endInView ? jsxRuntime.jsx(jsxRuntime.Fragment, {}) : jsxRuntime.jsx("button", {
|
|
15258
|
-
onClick:
|
|
15259
|
-
return scrollDown();
|
|
15260
|
-
},
|
|
15274
|
+
onClick: scrollForward,
|
|
15261
15275
|
onMouseUp: function onMouseUp() {
|
|
15262
15276
|
return setScrollDown(false);
|
|
15263
15277
|
},
|
|
15264
15278
|
onMouseDown: function onMouseDown() {
|
|
15265
15279
|
return setScrollDown(true);
|
|
15266
15280
|
},
|
|
15267
|
-
className: clsx__default["default"](classes$L.button, classes$L.down),
|
|
15268
|
-
children:
|
|
15281
|
+
className: clsx__default["default"](classes$L.button, isLeftRight ? classes$L.right : classes$L.down),
|
|
15282
|
+
children: isLeftRight ? '►' : '▼'
|
|
15269
15283
|
}), startInView ? jsxRuntime.jsx(jsxRuntime.Fragment, {}) : jsxRuntime.jsx("button", {
|
|
15270
|
-
onClick:
|
|
15271
|
-
return scrollUp();
|
|
15272
|
-
},
|
|
15284
|
+
onClick: scrollBack,
|
|
15273
15285
|
onMouseUp: function onMouseUp() {
|
|
15274
15286
|
return setScrollUp(false);
|
|
15275
15287
|
},
|
|
15276
15288
|
onMouseDown: function onMouseDown() {
|
|
15277
15289
|
return setScrollUp(true);
|
|
15278
15290
|
},
|
|
15279
|
-
className: clsx__default["default"](classes$L.button, classes$L.up),
|
|
15280
|
-
children:
|
|
15291
|
+
className: clsx__default["default"](classes$L.button, isLeftRight ? classes$L.left : classes$L.up),
|
|
15292
|
+
children: isLeftRight ? '◄' : '▲'
|
|
15281
15293
|
})]
|
|
15282
15294
|
});
|
|
15283
15295
|
};
|
|
@@ -15511,8 +15523,8 @@ var LeftToolbar = function LeftToolbar(props) {
|
|
|
15511
15523
|
}), height && (scrollRef === null || scrollRef === void 0 || (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollHeight) > height && jsxRuntime.jsx(ArrowScroll, {
|
|
15512
15524
|
startInView: startInView,
|
|
15513
15525
|
endInView: endInView,
|
|
15514
|
-
|
|
15515
|
-
|
|
15526
|
+
scrollForward: scrollDown,
|
|
15527
|
+
scrollBack: scrollUp
|
|
15516
15528
|
})]
|
|
15517
15529
|
});
|
|
15518
15530
|
};
|
|
@@ -15715,8 +15727,8 @@ var RightToolbar = function RightToolbar(props) {
|
|
|
15715
15727
|
}), height && (scrollRef === null || scrollRef === void 0 || (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollHeight) > height && jsxRuntime.jsx(ArrowScroll, {
|
|
15716
15728
|
startInView: startInView,
|
|
15717
15729
|
endInView: endInView,
|
|
15718
|
-
|
|
15719
|
-
|
|
15730
|
+
scrollForward: scrollDown,
|
|
15731
|
+
scrollBack: scrollUp
|
|
15720
15732
|
})]
|
|
15721
15733
|
});
|
|
15722
15734
|
};
|
|
@@ -16073,7 +16085,7 @@ var ZoomControls = function ZoomControls(_ref) {
|
|
|
16073
16085
|
open: isExpanded,
|
|
16074
16086
|
onClose: onClose,
|
|
16075
16087
|
anchorEl: containerRef.current,
|
|
16076
|
-
container: document.querySelector(KETCHER_ROOT_NODE_CSS_SELECTOR) || document.querySelector(KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR),
|
|
16088
|
+
container: document.querySelector(KETCHER_ROOT_NODE_CSS_SELECTOR) || document.querySelector(ketcherCore.KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR),
|
|
16077
16089
|
anchorOrigin: {
|
|
16078
16090
|
vertical: 'bottom',
|
|
16079
16091
|
horizontal: 'left'
|
|
@@ -24132,9 +24144,8 @@ var CreateMonomerTool = function () {
|
|
|
24132
24144
|
this.editor.openMonomerCreationWizard();
|
|
24133
24145
|
}
|
|
24134
24146
|
_createClass__default["default"](CreateMonomerTool, [{
|
|
24135
|
-
key: "
|
|
24136
|
-
value: function
|
|
24137
|
-
this.editor.closeMonomerCreationWizard();
|
|
24147
|
+
key: "mousemove",
|
|
24148
|
+
value: function mousemove() {
|
|
24138
24149
|
}
|
|
24139
24150
|
}]);
|
|
24140
24151
|
return CreateMonomerTool;
|
|
@@ -24306,8 +24317,9 @@ var HoverIcon = function () {
|
|
|
24306
24317
|
}, {
|
|
24307
24318
|
key: "isOverLoader",
|
|
24308
24319
|
value: function isOverLoader(event) {
|
|
24320
|
+
var _target$classList;
|
|
24309
24321
|
var target = (event === null || event === void 0 ? void 0 : event.relatedTarget) || event.target;
|
|
24310
|
-
return target === null || target === void 0 ? void 0 :
|
|
24322
|
+
return target === null || target === void 0 || (_target$classList = target.classList) === null || _target$classList === void 0 ? void 0 : _target$classList.contains('loading-spinner');
|
|
24311
24323
|
}
|
|
24312
24324
|
}, {
|
|
24313
24325
|
key: "onMouseMove",
|
|
@@ -25365,13 +25377,27 @@ var Editor$3 = function () {
|
|
|
25365
25377
|
}, {
|
|
25366
25378
|
key: "isMonomerCreationWizardEnabled",
|
|
25367
25379
|
get: function get() {
|
|
25368
|
-
var _selection$atoms,
|
|
25380
|
+
var _selection$atoms,
|
|
25381
|
+
_selection$bonds,
|
|
25382
|
+
_this = this;
|
|
25369
25383
|
if (this._monomerCreationState) {
|
|
25370
25384
|
return true;
|
|
25371
25385
|
}
|
|
25372
|
-
var selection = this.
|
|
25386
|
+
var selection = this.selection();
|
|
25373
25387
|
if (selection && (_selection$atoms = selection.atoms) !== null && _selection$atoms !== void 0 && _selection$atoms.length && (_selection$bonds = selection.bonds) !== null && _selection$bonds !== void 0 && _selection$bonds.length) {
|
|
25374
25388
|
var currentStruct = this.render.ctab.molecule;
|
|
25389
|
+
var selectionInvalid = selection.atoms.some(function (atomId) {
|
|
25390
|
+
var atom = _this.render.ctab.molecule.atoms.get(atomId);
|
|
25391
|
+
if (!atom) {
|
|
25392
|
+
return false;
|
|
25393
|
+
}
|
|
25394
|
+
return atom.sgs.size > 0 || atom.rglabel !== null || atom.attachmentPoints !== null || _this.render.ctab.molecule.rgroups.some(function (rgroup) {
|
|
25395
|
+
return rgroup.frags.has(atom.fragment);
|
|
25396
|
+
}) || ketcherCore.genericsList.includes(atom.label);
|
|
25397
|
+
});
|
|
25398
|
+
if (selectionInvalid) {
|
|
25399
|
+
return false;
|
|
25400
|
+
}
|
|
25375
25401
|
var isSelectionContinuous = Editor.isSelectionContinuous(selection, currentStruct);
|
|
25376
25402
|
if (!isSelectionContinuous) {
|
|
25377
25403
|
return false;
|
|
@@ -25380,9 +25406,12 @@ var Editor$3 = function () {
|
|
|
25380
25406
|
var bondsToOutside = currentStruct.bonds.filter(function (_, bond) {
|
|
25381
25407
|
return selectionAtoms.has(bond.begin) && !selectionAtoms.has(bond.end) || selectionAtoms.has(bond.end) && !selectionAtoms.has(bond.begin);
|
|
25382
25408
|
});
|
|
25383
|
-
|
|
25384
|
-
return bond.type
|
|
25385
|
-
})
|
|
25409
|
+
if (bondsToOutside.some(function (bond) {
|
|
25410
|
+
return bond.type !== ketcherCore.Bond.PATTERN.TYPE.SINGLE || bond.stereo !== ketcherCore.Bond.PATTERN.STEREO.NONE;
|
|
25411
|
+
})) {
|
|
25412
|
+
return false;
|
|
25413
|
+
}
|
|
25414
|
+
this.singleBondsToOutsideOfSelection = bondsToOutside;
|
|
25386
25415
|
return this.singleBondsToOutsideOfSelection.size > 0 && this.singleBondsToOutsideOfSelection.size <= 8;
|
|
25387
25416
|
}
|
|
25388
25417
|
return false;
|
|
@@ -25391,19 +25420,20 @@ var Editor$3 = function () {
|
|
|
25391
25420
|
key: "openMonomerCreationWizard",
|
|
25392
25421
|
value: function openMonomerCreationWizard() {
|
|
25393
25422
|
var _selection$atoms2,
|
|
25394
|
-
|
|
25423
|
+
_this2 = this;
|
|
25395
25424
|
var currentStruct = this.render.ctab.molecule;
|
|
25396
|
-
var selection = this.
|
|
25425
|
+
var selection = this.selection();
|
|
25426
|
+
assert_1(selection);
|
|
25397
25427
|
this.originalSelection = selection;
|
|
25398
25428
|
var selectionAtoms = new Set(selection.atoms);
|
|
25399
|
-
var selectedStruct = this.structSelected();
|
|
25429
|
+
var selectedStruct = this.structSelected(selection);
|
|
25400
25430
|
this.selectionBBox = selectedStruct.getCoordBoundingBoxObj();
|
|
25401
25431
|
var atomIdsMap = new Map();
|
|
25402
25432
|
_toConsumableArray__default["default"]((_selection$atoms2 = selection.atoms) !== null && _selection$atoms2 !== void 0 ? _selection$atoms2 : []).sort(function (a, b) {
|
|
25403
25433
|
return a - b;
|
|
25404
25434
|
}).forEach(function (atomId, i) {
|
|
25405
25435
|
atomIdsMap.set(atomId, i);
|
|
25406
|
-
|
|
25436
|
+
_this2.atomIdsMap.set(i, atomId);
|
|
25407
25437
|
});
|
|
25408
25438
|
var attachmentPoints = new Map();
|
|
25409
25439
|
this.singleBondsToOutsideOfSelection.forEach(function (bond) {
|
|
@@ -25415,7 +25445,7 @@ var Editor$3 = function () {
|
|
|
25415
25445
|
pp: leavingAtom === null || leavingAtom === void 0 ? void 0 : leavingAtom.pp
|
|
25416
25446
|
});
|
|
25417
25447
|
var newLeavingAtomId = selectedStruct.atoms.add(newLeavingAtom);
|
|
25418
|
-
|
|
25448
|
+
_this2.atomIdsMap.set(newLeavingAtomId, leavingAtomId);
|
|
25419
25449
|
var bondEdgeForAttachmentAtom = bondEdgeForLeavingAtom === 'end' ? 'begin' : 'end';
|
|
25420
25450
|
var attachmentAtomId = bond[bondEdgeForAttachmentAtom];
|
|
25421
25451
|
var attachmentAtomIdInSelectedStruct = atomIdsMap.get(attachmentAtomId);
|
|
@@ -25429,10 +25459,10 @@ var Editor$3 = function () {
|
|
|
25429
25459
|
});
|
|
25430
25460
|
selectedStruct.bonds.add(newBond);
|
|
25431
25461
|
attachmentPoints.set(attachmentAtomIdInSelectedStruct, newLeavingAtomId);
|
|
25432
|
-
|
|
25462
|
+
_this2.atomIdsMap.set(attachmentAtomIdInSelectedStruct, attachmentAtomId);
|
|
25433
25463
|
});
|
|
25434
25464
|
this._monomerCreationState = {
|
|
25435
|
-
originalStruct: currentStruct
|
|
25465
|
+
originalStruct: currentStruct,
|
|
25436
25466
|
attachmentAtomIdToLeavingAtomId: attachmentPoints
|
|
25437
25467
|
};
|
|
25438
25468
|
this.render.monomerCreationRenderState = {
|
|
@@ -25454,6 +25484,8 @@ var Editor$3 = function () {
|
|
|
25454
25484
|
}, {
|
|
25455
25485
|
key: "saveNewMonomer",
|
|
25456
25486
|
value: function saveNewMonomer(data) {
|
|
25487
|
+
var _this$originalSelecti,
|
|
25488
|
+
_this3 = this;
|
|
25457
25489
|
if (!this._monomerCreationState) {
|
|
25458
25490
|
throw new Error('Monomer creation wizard is not active, cannot save new monomer');
|
|
25459
25491
|
}
|
|
@@ -25477,6 +25509,7 @@ var Editor$3 = function () {
|
|
|
25477
25509
|
var monomerId = "".concat(symbol, "___").concat(name);
|
|
25478
25510
|
var monomerRef = ketcherCore.setMonomerTemplatePrefix(monomerId);
|
|
25479
25511
|
var monomerHELMClass = ketcherCore.getHELMClassByKetMonomerClass(type);
|
|
25512
|
+
var naturalAnalogueToUse = ketcherCore.fillNaturalAnalogueForPhosphateAndSugar(naturalAnalogue, type);
|
|
25480
25513
|
var monomerTemplate = {
|
|
25481
25514
|
type: ketcherCore.KetTemplateType.MONOMER_TEMPLATE,
|
|
25482
25515
|
id: monomerId,
|
|
@@ -25484,8 +25517,8 @@ var Editor$3 = function () {
|
|
|
25484
25517
|
classHELM: monomerHELMClass,
|
|
25485
25518
|
alias: symbol,
|
|
25486
25519
|
fullName: name,
|
|
25487
|
-
naturalAnalogShort:
|
|
25488
|
-
atoms: ketMicromolecule.mol0.atoms,
|
|
25520
|
+
naturalAnalogShort: naturalAnalogueToUse,
|
|
25521
|
+
atoms: ketcherCore.normalizeMonomerAtomsPositions(ketMicromolecule.mol0.atoms),
|
|
25489
25522
|
bonds: ketMicromolecule.mol0.bonds,
|
|
25490
25523
|
attachmentPoints: attachmentPoints,
|
|
25491
25524
|
root: {
|
|
@@ -25510,9 +25543,24 @@ var Editor$3 = function () {
|
|
|
25510
25543
|
var monomerPosition = new ketcherCore.Vec2((this.selectionBBox.min.x + this.selectionBBox.max.x) / 2, (this.selectionBBox.min.y + this.selectionBBox.max.y) / 2);
|
|
25511
25544
|
var monomer = new Monomer(monomerItem, monomerPosition);
|
|
25512
25545
|
this.closeMonomerCreationWizard();
|
|
25546
|
+
var sGroupAttachmentPoints = ketcherCore.MacromoleculesConverter.convertMonomerAttachmentPointsToSGroupAttachmentPoints(monomer, this.atomIdsMap);
|
|
25547
|
+
this.singleBondsToOutsideOfSelection.forEach(function (bond) {
|
|
25548
|
+
var attachmentPointToBond = sGroupAttachmentPoints.find(function (point) {
|
|
25549
|
+
return point.atomId === bond.begin || point.atomId === bond.end;
|
|
25550
|
+
});
|
|
25551
|
+
if (attachmentPointToBond) {
|
|
25552
|
+
bond.beginSuperatomAttachmentPointNumber = attachmentPointToBond.attachmentPointNumber;
|
|
25553
|
+
}
|
|
25554
|
+
});
|
|
25513
25555
|
var action = ketcherCore.fromSgroupAddition(this.render.ctab, ketcherCore.SGroup.TYPES.SUP, this.originalSelection.atoms, {
|
|
25514
25556
|
expanded: true
|
|
25515
|
-
}, this.render.ctab.molecule.sgroups.newId(),
|
|
25557
|
+
}, this.render.ctab.molecule.sgroups.newId(), sGroupAttachmentPoints, monomer.position, true, monomer.monomerItem.props.MonomerName, null, monomer);
|
|
25558
|
+
(_this$originalSelecti = this.originalSelection.atoms) === null || _this$originalSelecti === void 0 || _this$originalSelecti.forEach(function (atomId) {
|
|
25559
|
+
var atom = _this3.render.ctab.molecule.atoms.get(atomId);
|
|
25560
|
+
if (atom) {
|
|
25561
|
+
atom.fragment = -1;
|
|
25562
|
+
}
|
|
25563
|
+
});
|
|
25516
25564
|
this.update(action);
|
|
25517
25565
|
}
|
|
25518
25566
|
}, {
|
|
@@ -25700,6 +25748,11 @@ var Editor$3 = function () {
|
|
|
25700
25748
|
ketcherCore.ketcherProvider.getKetcher(this.ketcherId).changeEvent.add(subscribeFuncWrapper);
|
|
25701
25749
|
break;
|
|
25702
25750
|
}
|
|
25751
|
+
case 'libraryUpdate':
|
|
25752
|
+
{
|
|
25753
|
+
ketcherCore.ketcherProvider.getKetcher(this.ketcherId).libraryUpdateEvent.add(handler);
|
|
25754
|
+
break;
|
|
25755
|
+
}
|
|
25703
25756
|
default:
|
|
25704
25757
|
this.event[eventName].add(handler);
|
|
25705
25758
|
}
|
|
@@ -25725,6 +25778,7 @@ var Editor$3 = function () {
|
|
|
25725
25778
|
}, {
|
|
25726
25779
|
key: "explicitSelected",
|
|
25727
25780
|
value: function explicitSelected() {
|
|
25781
|
+
var autoSelectBonds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
25728
25782
|
var selection = this.selection() || {};
|
|
25729
25783
|
var res = structObjects.reduce(function (acc, key) {
|
|
25730
25784
|
acc[key] = selection[key] ? selection[key].slice() : [];
|
|
@@ -25745,7 +25799,7 @@ var Editor$3 = function () {
|
|
|
25745
25799
|
}
|
|
25746
25800
|
});
|
|
25747
25801
|
}
|
|
25748
|
-
if (res.atoms && res.bonds) {
|
|
25802
|
+
if (autoSelectBonds && res.atoms && res.bonds) {
|
|
25749
25803
|
struct.bonds.forEach(function (bond, bid) {
|
|
25750
25804
|
if (res.bonds.indexOf(bid) < 0 && res.atoms.indexOf(bond.begin) >= 0 && res.atoms.indexOf(bond.end) >= 0) {
|
|
25751
25805
|
res.bonds = res.bonds || [];
|
|
@@ -25757,9 +25811,9 @@ var Editor$3 = function () {
|
|
|
25757
25811
|
}
|
|
25758
25812
|
}, {
|
|
25759
25813
|
key: "structSelected",
|
|
25760
|
-
value: function structSelected() {
|
|
25814
|
+
value: function structSelected(existingSelection) {
|
|
25761
25815
|
var struct = this.render.ctab.molecule;
|
|
25762
|
-
var selection = this.explicitSelected();
|
|
25816
|
+
var selection = existingSelection !== null && existingSelection !== void 0 ? existingSelection : this.explicitSelected();
|
|
25763
25817
|
var dst = struct.clone(new ketcherCore.Pile(selection.atoms), new ketcherCore.Pile(selection.bonds), true, null, new ketcherCore.Pile(selection.simpleObjects), new ketcherCore.Pile(selection.texts), null, new ketcherCore.Pile(selection.images), new ketcherCore.Pile(selection[ketcherCore.MULTITAIL_ARROW_KEY]));
|
|
25764
25818
|
struct.rxnArrows.forEach(function (item, id) {
|
|
25765
25819
|
if (selection.rxnArrows.indexOf(id) !== -1) dst.rxnArrows.add(item.clone());
|
|
@@ -27696,6 +27750,47 @@ function getMenuPropsForSelection(selection, selectedFunctionalGroups, ketcherId
|
|
|
27696
27750
|
}
|
|
27697
27751
|
}
|
|
27698
27752
|
|
|
27753
|
+
var MonomerTypeSelectConfig = [{
|
|
27754
|
+
value: ketcherCore.KetMonomerClass.AminoAcid,
|
|
27755
|
+
label: 'Amino acid',
|
|
27756
|
+
iconName: 'peptide'
|
|
27757
|
+
}, {
|
|
27758
|
+
value: ketcherCore.KetMonomerClass.Sugar,
|
|
27759
|
+
label: 'Sugar',
|
|
27760
|
+
iconName: 'sugar'
|
|
27761
|
+
}, {
|
|
27762
|
+
value: ketcherCore.KetMonomerClass.Base,
|
|
27763
|
+
label: 'Base',
|
|
27764
|
+
iconName: 'base'
|
|
27765
|
+
}, {
|
|
27766
|
+
value: ketcherCore.KetMonomerClass.Phosphate,
|
|
27767
|
+
label: 'Phosphate',
|
|
27768
|
+
iconName: 'phosphate'
|
|
27769
|
+
}, {
|
|
27770
|
+
value: ketcherCore.KetMonomerClass.RNA,
|
|
27771
|
+
label: 'Nucleotide',
|
|
27772
|
+
iconName: 'nucleotide'
|
|
27773
|
+
}, {
|
|
27774
|
+
value: ketcherCore.KetMonomerClass.CHEM,
|
|
27775
|
+
label: 'CHEM',
|
|
27776
|
+
iconName: 'chem'
|
|
27777
|
+
}];
|
|
27778
|
+
var NotificationMessages = {
|
|
27779
|
+
defaultAttachmentPoints: 'Attachment points are set by default with hydrogens as leaving groups.',
|
|
27780
|
+
emptyMandatoryFields: 'Mandatory fields must be filled.',
|
|
27781
|
+
invalidSymbol: 'The monomer symbol must consist only of uppercase and lowercase letters, numbers, hyphens (-), underscores (_), and asterisks (*).',
|
|
27782
|
+
symbolExists: 'The symbol must be unique amongst peptide, RNA, or CHEM monomers.',
|
|
27783
|
+
editingIsNotAllowed: 'Editing of the structure is not allowed.'
|
|
27784
|
+
};
|
|
27785
|
+
var NotificationTypes = {
|
|
27786
|
+
defaultAttachmentPoints: 'info',
|
|
27787
|
+
emptyMandatoryFields: 'error',
|
|
27788
|
+
invalidSymbol: 'error',
|
|
27789
|
+
symbolExists: 'error',
|
|
27790
|
+
editingIsNotAllowed: 'error'
|
|
27791
|
+
};
|
|
27792
|
+
var MonomerCreationExternalNotificationAction = 'MonomerCreationExternalNotification';
|
|
27793
|
+
|
|
27699
27794
|
function ownKeys$J(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
27700
27795
|
function _objectSpread$J(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$J(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$J(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
27701
27796
|
var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
|
|
@@ -27728,6 +27823,12 @@ var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
|
|
|
27728
27823
|
event.preventDefault();
|
|
27729
27824
|
var ketcher = ketcherCore.ketcherProvider.getKetcher(ketcherId);
|
|
27730
27825
|
var editor = ketcher.editor;
|
|
27826
|
+
if (editor.monomerCreationState !== null) {
|
|
27827
|
+
window.dispatchEvent(new CustomEvent(MonomerCreationExternalNotificationAction, {
|
|
27828
|
+
detail: 'editingIsNotAllowed'
|
|
27829
|
+
}));
|
|
27830
|
+
return;
|
|
27831
|
+
}
|
|
27731
27832
|
if (editor.render.options.viewOnlyMode) {
|
|
27732
27833
|
return;
|
|
27733
27834
|
}
|
|
@@ -28161,7 +28262,8 @@ var Select$1 = function Select(_ref2) {
|
|
|
28161
28262
|
formName = _ref2.formName,
|
|
28162
28263
|
name = _ref2.name,
|
|
28163
28264
|
placeholder = _ref2.placeholder,
|
|
28164
|
-
testId = _ref2['data-testid']
|
|
28265
|
+
testId = _ref2['data-testid'],
|
|
28266
|
+
error = _ref2.error;
|
|
28165
28267
|
var _useState = React.useState(),
|
|
28166
28268
|
_useState2 = _slicedToArray__default["default"](_useState, 2),
|
|
28167
28269
|
currentValue = _useState2[0],
|
|
@@ -28190,6 +28292,7 @@ var Select$1 = function Select(_ref2) {
|
|
|
28190
28292
|
},
|
|
28191
28293
|
IconComponent: ChevronIcon$1,
|
|
28192
28294
|
"data-testid": testId,
|
|
28295
|
+
error: error,
|
|
28193
28296
|
children: options && options.map(function (option) {
|
|
28194
28297
|
var _option$children;
|
|
28195
28298
|
var isDivider = typeof (option === null || option === void 0 ? void 0 : option.value) === 'string' ? option.value.includes('Divider') : false;
|
|
@@ -28360,7 +28463,8 @@ var NaturalAnaloguePicker = function NaturalAnaloguePicker(_ref2) {
|
|
|
28360
28463
|
var monomerType = _ref2.monomerType,
|
|
28361
28464
|
value = _ref2.value,
|
|
28362
28465
|
onChange = _ref2.onChange,
|
|
28363
|
-
className = _ref2.className
|
|
28466
|
+
className = _ref2.className,
|
|
28467
|
+
error = _ref2.error;
|
|
28364
28468
|
var disabled = !isNaturalAnalogueRequired(monomerType);
|
|
28365
28469
|
var options = monomerType === ketcherCore.KetMonomerClass.AminoAcid ? aminoAcidOptions : rnaOptions;
|
|
28366
28470
|
var renderValue = React.useCallback(function (selected) {
|
|
@@ -28404,6 +28508,7 @@ var NaturalAnaloguePicker = function NaturalAnaloguePicker(_ref2) {
|
|
|
28404
28508
|
IconComponent: ChevronIcon,
|
|
28405
28509
|
"data-testid": "natural-analogue-picker",
|
|
28406
28510
|
disabled: disabled,
|
|
28511
|
+
error: error,
|
|
28407
28512
|
children: options.map(function (option) {
|
|
28408
28513
|
return jsxRuntime.jsx(MenuItem__default["default"], {
|
|
28409
28514
|
value: option.value,
|
|
@@ -28448,7 +28553,7 @@ var AttributeField = function AttributeField(_ref) {
|
|
|
28448
28553
|
});
|
|
28449
28554
|
};
|
|
28450
28555
|
|
|
28451
|
-
var styles$f = {"notification":"Notification-module_notification__yHqXk","notificationStrip":"Notification-module_notificationStrip__gSCg2","info":"Notification-module_info__M2qqL","
|
|
28556
|
+
var styles$f = {"notification":"Notification-module_notification__yHqXk","notificationStrip":"Notification-module_notificationStrip__gSCg2","info":"Notification-module_info__M2qqL","error":"Notification-module_error__I3OUR","notificationIcon":"Notification-module_notificationIcon__weZ-g","notificationText":"Notification-module_notificationText__4-qhV","notificationButton":"Notification-module_notificationButton__Bgw5u"};
|
|
28452
28557
|
|
|
28453
28558
|
var iconMap = {
|
|
28454
28559
|
info: 'checkFilled',
|
|
@@ -28485,37 +28590,6 @@ var Notification = function Notification(_ref) {
|
|
|
28485
28590
|
|
|
28486
28591
|
function ownKeys$H(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28487
28592
|
function _objectSpread$H(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$H(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$H(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
28488
|
-
var MonomerTypeSelectConfig = [{
|
|
28489
|
-
value: ketcherCore.KetMonomerClass.AminoAcid,
|
|
28490
|
-
label: 'Amino acid',
|
|
28491
|
-
iconName: 'peptide'
|
|
28492
|
-
}, {
|
|
28493
|
-
value: ketcherCore.KetMonomerClass.Sugar,
|
|
28494
|
-
label: 'Sugar',
|
|
28495
|
-
iconName: 'sugar'
|
|
28496
|
-
}, {
|
|
28497
|
-
value: ketcherCore.KetMonomerClass.Base,
|
|
28498
|
-
label: 'Base',
|
|
28499
|
-
iconName: 'base'
|
|
28500
|
-
}, {
|
|
28501
|
-
value: ketcherCore.KetMonomerClass.Phosphate,
|
|
28502
|
-
label: 'Phosphate',
|
|
28503
|
-
iconName: 'phosphate'
|
|
28504
|
-
}, {
|
|
28505
|
-
value: ketcherCore.KetMonomerClass.RNA,
|
|
28506
|
-
label: 'Nucleotide',
|
|
28507
|
-
iconName: 'nucleotide'
|
|
28508
|
-
}, {
|
|
28509
|
-
value: ketcherCore.KetMonomerClass.CHEM,
|
|
28510
|
-
label: 'CHEM',
|
|
28511
|
-
iconName: 'chem'
|
|
28512
|
-
}];
|
|
28513
|
-
var notificationMessages = {
|
|
28514
|
-
defaultAttachmentPoints: 'Attachment points are set by default with hydrogens as leaving groups.',
|
|
28515
|
-
emptyMandatoryFields: 'Mandatory fields must be filled.',
|
|
28516
|
-
invalidSymbol: 'The monomer symbol must consist only of uppercase and lowercase letters, numbers, hyphens (-), underscores (_), and asterisks (*).',
|
|
28517
|
-
symbolExists: 'The symbol must be unique amongst peptide, RNA, or CHEM monomers.'
|
|
28518
|
-
};
|
|
28519
28593
|
var initialWizardState = {
|
|
28520
28594
|
values: {
|
|
28521
28595
|
type: undefined,
|
|
@@ -28526,7 +28600,7 @@ var initialWizardState = {
|
|
|
28526
28600
|
errors: {},
|
|
28527
28601
|
notifications: new Map([['defaultAttachmentPoints', {
|
|
28528
28602
|
type: 'info',
|
|
28529
|
-
message:
|
|
28603
|
+
message: NotificationMessages.defaultAttachmentPoints
|
|
28530
28604
|
}]])
|
|
28531
28605
|
};
|
|
28532
28606
|
var wizardReducer = function wizardReducer(state, action) {
|
|
@@ -28535,8 +28609,12 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28535
28609
|
{
|
|
28536
28610
|
var fieldId = action.fieldId,
|
|
28537
28611
|
value = action.value;
|
|
28612
|
+
var values = _objectSpread$H(_objectSpread$H({}, state.values), {}, _defineProperty__default["default"]({}, fieldId, value));
|
|
28613
|
+
if (fieldId === 'type') {
|
|
28614
|
+
values.naturalAnalogue = '';
|
|
28615
|
+
}
|
|
28538
28616
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28539
|
-
values:
|
|
28617
|
+
values: values,
|
|
28540
28618
|
errors: _objectSpread$H(_objectSpread$H({}, state.errors), {}, _defineProperty__default["default"]({}, fieldId, undefined))
|
|
28541
28619
|
});
|
|
28542
28620
|
}
|
|
@@ -28552,6 +28630,20 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28552
28630
|
notifications: new Map([].concat(_toConsumableArray__default["default"](state.notifications), _toConsumableArray__default["default"](action.notifications)))
|
|
28553
28631
|
});
|
|
28554
28632
|
}
|
|
28633
|
+
case 'AddNotification':
|
|
28634
|
+
{
|
|
28635
|
+
var notifications = new Map(state.notifications);
|
|
28636
|
+
var id = action.id;
|
|
28637
|
+
if (!notifications.has(id)) {
|
|
28638
|
+
notifications.set(id, {
|
|
28639
|
+
type: NotificationTypes[id],
|
|
28640
|
+
message: NotificationMessages[id]
|
|
28641
|
+
});
|
|
28642
|
+
}
|
|
28643
|
+
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28644
|
+
notifications: notifications
|
|
28645
|
+
});
|
|
28646
|
+
}
|
|
28555
28647
|
case 'ResetErrors':
|
|
28556
28648
|
{
|
|
28557
28649
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
@@ -28564,10 +28656,10 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28564
28656
|
}
|
|
28565
28657
|
case 'RemoveNotification':
|
|
28566
28658
|
{
|
|
28567
|
-
var
|
|
28568
|
-
|
|
28659
|
+
var _notifications = new Map(state.notifications);
|
|
28660
|
+
_notifications["delete"](action.id);
|
|
28569
28661
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28570
|
-
notifications:
|
|
28662
|
+
notifications: _notifications
|
|
28571
28663
|
});
|
|
28572
28664
|
}
|
|
28573
28665
|
default:
|
|
@@ -28586,7 +28678,7 @@ var validateInputs = function validateInputs(values) {
|
|
|
28586
28678
|
errors[key] = true;
|
|
28587
28679
|
notifications.set('emptyMandatoryFields', {
|
|
28588
28680
|
type: 'error',
|
|
28589
|
-
message:
|
|
28681
|
+
message: NotificationMessages.emptyMandatoryFields
|
|
28590
28682
|
});
|
|
28591
28683
|
}
|
|
28592
28684
|
return;
|
|
@@ -28597,7 +28689,16 @@ var validateInputs = function validateInputs(values) {
|
|
|
28597
28689
|
errors[key] = true;
|
|
28598
28690
|
notifications.set('invalidSymbol', {
|
|
28599
28691
|
type: 'error',
|
|
28600
|
-
message:
|
|
28692
|
+
message: NotificationMessages.invalidSymbol
|
|
28693
|
+
});
|
|
28694
|
+
return;
|
|
28695
|
+
}
|
|
28696
|
+
var editor = ketcherCore.CoreEditor.provideEditorInstance();
|
|
28697
|
+
if (editor.checkIfMonomerSymbolClassPairExists(value, values.type)) {
|
|
28698
|
+
errors[key] = true;
|
|
28699
|
+
notifications.set('symbolExists', {
|
|
28700
|
+
type: 'error',
|
|
28701
|
+
message: NotificationMessages.symbolExists
|
|
28601
28702
|
});
|
|
28602
28703
|
}
|
|
28603
28704
|
}
|
|
@@ -28620,6 +28721,21 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28620
28721
|
symbol = values.symbol,
|
|
28621
28722
|
name = values.name,
|
|
28622
28723
|
naturalAnalogue = values.naturalAnalogue;
|
|
28724
|
+
React.useEffect(function () {
|
|
28725
|
+
var externalNotificationEventListener = function externalNotificationEventListener(event) {
|
|
28726
|
+
var notificationId = event.detail;
|
|
28727
|
+
if (notificationId) {
|
|
28728
|
+
wizardStateDispatch({
|
|
28729
|
+
type: 'AddNotification',
|
|
28730
|
+
id: notificationId
|
|
28731
|
+
});
|
|
28732
|
+
}
|
|
28733
|
+
};
|
|
28734
|
+
window.addEventListener(MonomerCreationExternalNotificationAction, externalNotificationEventListener);
|
|
28735
|
+
return function () {
|
|
28736
|
+
window.removeEventListener(MonomerCreationExternalNotificationAction, externalNotificationEventListener);
|
|
28737
|
+
};
|
|
28738
|
+
}, []);
|
|
28623
28739
|
var handleFieldChange = function handleFieldChange(fieldId, value) {
|
|
28624
28740
|
if (fieldId === 'type') {
|
|
28625
28741
|
wizardStateDispatch({
|
|
@@ -28724,13 +28840,14 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28724
28840
|
children: [jsxRuntime.jsx(AttributeField, {
|
|
28725
28841
|
title: "Type",
|
|
28726
28842
|
control: jsxRuntime.jsx(Select$1, {
|
|
28727
|
-
className:
|
|
28843
|
+
className: styles$j.input,
|
|
28728
28844
|
options: monomerTypeSelectOptions,
|
|
28729
28845
|
placeholder: "Select monomer type",
|
|
28730
28846
|
value: type,
|
|
28731
28847
|
onChange: function onChange(value) {
|
|
28732
28848
|
return handleFieldChange('type', value);
|
|
28733
|
-
}
|
|
28849
|
+
},
|
|
28850
|
+
error: errors.type
|
|
28734
28851
|
}),
|
|
28735
28852
|
required: true
|
|
28736
28853
|
}), jsxRuntime.jsx(AttributeField, {
|
|
@@ -28738,7 +28855,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28738
28855
|
control: jsxRuntime.jsx("input", {
|
|
28739
28856
|
type: "text",
|
|
28740
28857
|
className: clsx__default["default"](styles$j.input, errors.symbol && styles$j.error),
|
|
28741
|
-
placeholder: "
|
|
28858
|
+
placeholder: "e.g. PEG-2",
|
|
28742
28859
|
value: symbol,
|
|
28743
28860
|
onChange: function onChange(event) {
|
|
28744
28861
|
return handleFieldChange('symbol', event.target.value);
|
|
@@ -28750,7 +28867,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28750
28867
|
control: jsxRuntime.jsx("input", {
|
|
28751
28868
|
type: "text",
|
|
28752
28869
|
className: clsx__default["default"](styles$j.input, errors.name && styles$j.error),
|
|
28753
|
-
placeholder: "
|
|
28870
|
+
placeholder: "e.g. Diethylene Glycol",
|
|
28754
28871
|
value: name,
|
|
28755
28872
|
onChange: function onChange(event) {
|
|
28756
28873
|
return handleFieldChange('name', event.target.value);
|
|
@@ -28760,12 +28877,12 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28760
28877
|
}), jsxRuntime.jsx(AttributeField, {
|
|
28761
28878
|
title: "Natural analogue",
|
|
28762
28879
|
control: jsxRuntime.jsx(NaturalAnaloguePicker, {
|
|
28763
|
-
className: clsx__default["default"](errors.type && styles$j.error),
|
|
28764
28880
|
monomerType: type,
|
|
28765
28881
|
value: naturalAnalogue,
|
|
28766
28882
|
onChange: function onChange(value) {
|
|
28767
28883
|
return handleFieldChange('naturalAnalogue', value);
|
|
28768
|
-
}
|
|
28884
|
+
},
|
|
28885
|
+
error: errors.naturalAnalogue
|
|
28769
28886
|
}),
|
|
28770
28887
|
disabled: !isNaturalAnalogueRequired(type),
|
|
28771
28888
|
required: true
|
|
@@ -36795,8 +36912,8 @@ var KetcherBuilder = function () {
|
|
|
36795
36912
|
cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
|
|
36796
36913
|
buttons: buttons || {},
|
|
36797
36914
|
errorHandler: errorHandler || null,
|
|
36798
|
-
version: "3.7.0-rc.
|
|
36799
|
-
buildDate: "2025-
|
|
36915
|
+
version: "3.7.0-rc.3" ,
|
|
36916
|
+
buildDate: "2025-09-08T13:19:56" ,
|
|
36800
36917
|
buildNumber: '',
|
|
36801
36918
|
customButtons: customButtons || []
|
|
36802
36919
|
}, structService, resolve, togglerComponent);
|
|
@@ -37091,7 +37208,7 @@ var ModeControl = function ModeControl(_ref3) {
|
|
|
37091
37208
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
37092
37209
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
37093
37210
|
var MacromoleculesEditorComponent = React.lazy(function () {
|
|
37094
|
-
return Promise.resolve().then(function () { return require('./index.modern-
|
|
37211
|
+
return Promise.resolve().then(function () { return require('./index.modern-021f6994.js'); });
|
|
37095
37212
|
});
|
|
37096
37213
|
var Editor = function Editor(props) {
|
|
37097
37214
|
var _useState = React.useState(false),
|
|
@@ -37104,12 +37221,16 @@ var Editor = function Editor(props) {
|
|
|
37104
37221
|
setMoleculesEditor = _useState4[1];
|
|
37105
37222
|
var _useState5 = React.useState(),
|
|
37106
37223
|
_useState6 = _slicedToArray__default["default"](_useState5, 2),
|
|
37107
|
-
|
|
37108
|
-
|
|
37109
|
-
var _useState7 = React.useState(
|
|
37224
|
+
ketcher = _useState6[0],
|
|
37225
|
+
setKetcher = _useState6[1];
|
|
37226
|
+
var _useState7 = React.useState(),
|
|
37110
37227
|
_useState8 = _slicedToArray__default["default"](_useState7, 2),
|
|
37111
|
-
|
|
37112
|
-
|
|
37228
|
+
macromoleculesEditor = _useState8[0],
|
|
37229
|
+
setMacromoleculesEditor = _useState8[1];
|
|
37230
|
+
var _useState9 = React.useState(''),
|
|
37231
|
+
_useState10 = _slicedToArray__default["default"](_useState9, 2),
|
|
37232
|
+
ketcherId = _useState10[0],
|
|
37233
|
+
setKetcherId = _useState10[1];
|
|
37113
37234
|
var togglePolymerEditor = function togglePolymerEditor(toggleValue) {
|
|
37114
37235
|
setShowPolymerEditor(toggleValue);
|
|
37115
37236
|
window.isPolymerEditorTurnedOn = toggleValue;
|
|
@@ -37118,6 +37239,24 @@ var Editor = function Editor(props) {
|
|
|
37118
37239
|
toggle: togglePolymerEditor,
|
|
37119
37240
|
isPolymerEditor: showPolymerEditor
|
|
37120
37241
|
}) : undefined;
|
|
37242
|
+
React.useEffect(function () {
|
|
37243
|
+
var switchToMacromoleculesModeHandler = function switchToMacromoleculesModeHandler() {
|
|
37244
|
+
togglePolymerEditor(true);
|
|
37245
|
+
};
|
|
37246
|
+
var switchToMoleculesModeHandler = function switchToMoleculesModeHandler() {
|
|
37247
|
+
togglePolymerEditor(false);
|
|
37248
|
+
};
|
|
37249
|
+
if (macromoleculesEditor) {
|
|
37250
|
+
macromoleculesEditor.events.switchToMacromoleculesMode.add(switchToMacromoleculesModeHandler);
|
|
37251
|
+
macromoleculesEditor.events.switchToMoleculesMode.add(switchToMoleculesModeHandler);
|
|
37252
|
+
}
|
|
37253
|
+
return function () {
|
|
37254
|
+
if (macromoleculesEditor) {
|
|
37255
|
+
macromoleculesEditor.events.switchToMacromoleculesMode.remove(switchToMacromoleculesModeHandler);
|
|
37256
|
+
macromoleculesEditor.events.switchToMoleculesMode.remove(switchToMoleculesModeHandler);
|
|
37257
|
+
}
|
|
37258
|
+
};
|
|
37259
|
+
}, [macromoleculesEditor]);
|
|
37121
37260
|
React.useEffect(function () {
|
|
37122
37261
|
return function () {
|
|
37123
37262
|
window.isPolymerEditorTurnedOn = false;
|
|
@@ -37133,9 +37272,14 @@ var Editor = function Editor(props) {
|
|
|
37133
37272
|
}
|
|
37134
37273
|
}
|
|
37135
37274
|
}, [showPolymerEditor]);
|
|
37275
|
+
React.useEffect(function () {
|
|
37276
|
+
if (ketcher && moleculesEditor && (macromoleculesEditor || props.disableMacromoleculesEditor)) {
|
|
37277
|
+
var _props$onInit;
|
|
37278
|
+
(_props$onInit = props.onInit) === null || _props$onInit === void 0 || _props$onInit.call(props, ketcher);
|
|
37279
|
+
}
|
|
37280
|
+
}, [moleculesEditor, macromoleculesEditor]);
|
|
37136
37281
|
var onInitMoleculesEditor = function onInitMoleculesEditor(ketcher) {
|
|
37137
|
-
|
|
37138
|
-
(_props$onInit = props.onInit) === null || _props$onInit === void 0 || _props$onInit.call(props, ketcher);
|
|
37282
|
+
setKetcher(ketcher);
|
|
37139
37283
|
setMoleculesEditor(ketcher.editor);
|
|
37140
37284
|
};
|
|
37141
37285
|
var onInitMacromoleculesEditor = function onInitMacromoleculesEditor(macromoleculesEditor) {
|
|
@@ -37174,17 +37318,25 @@ var Editor = function Editor(props) {
|
|
|
37174
37318
|
});
|
|
37175
37319
|
};
|
|
37176
37320
|
|
|
37321
|
+
Object.defineProperty(exports, 'EditorClassName', {
|
|
37322
|
+
enumerable: true,
|
|
37323
|
+
get: function () { return ketcherCore.EditorClassName; }
|
|
37324
|
+
});
|
|
37325
|
+
Object.defineProperty(exports, 'KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR', {
|
|
37326
|
+
enumerable: true,
|
|
37327
|
+
get: function () { return ketcherCore.KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR; }
|
|
37328
|
+
});
|
|
37177
37329
|
exports.ACS_STYLE_DEFAULT_SETTINGS = ACS_STYLE_DEFAULT_SETTINGS;
|
|
37178
37330
|
exports.Accordion = Accordion$1;
|
|
37179
37331
|
exports.AmbiguousMonomerPreview = AmbiguousMonomerPreview;
|
|
37180
37332
|
exports.AppContext = appContext;
|
|
37333
|
+
exports.ArrowScroll = ArrowScroll;
|
|
37181
37334
|
exports.Button = Button;
|
|
37182
37335
|
exports.Container = Container;
|
|
37183
37336
|
exports.Content = Content;
|
|
37184
37337
|
exports.ContentLine = ContentLine;
|
|
37185
37338
|
exports.Dialog = Dialog;
|
|
37186
37339
|
exports.Editor = Editor;
|
|
37187
|
-
exports.EditorClassName = EditorClassName;
|
|
37188
37340
|
exports.Header = Header$1;
|
|
37189
37341
|
exports.Icon = Icon;
|
|
37190
37342
|
exports.IconButton = IconButton;
|
|
@@ -37192,7 +37344,6 @@ exports.IconButtonCustomIcon = IconButtonCustomIcon;
|
|
|
37192
37344
|
exports.IndigoProvider = IndigoProvider;
|
|
37193
37345
|
exports.InfoModal = InfoModal$1;
|
|
37194
37346
|
exports.Input = Input$2;
|
|
37195
|
-
exports.KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR = KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR;
|
|
37196
37347
|
exports.KETCHER_ROOT_NODE_CLASS_NAME = KETCHER_ROOT_NODE_CLASS_NAME;
|
|
37197
37348
|
exports.KETCHER_ROOT_NODE_CSS_SELECTOR = KETCHER_ROOT_NODE_CSS_SELECTOR;
|
|
37198
37349
|
exports.MODES = MODES;
|
|
@@ -37210,4 +37361,5 @@ exports.calculateNucleoElementPreviewTop = calculateNucleoElementPreviewTop;
|
|
|
37210
37361
|
exports.getIconName = getIconName;
|
|
37211
37362
|
exports.ketcherInitEventName = ketcherInitEventName;
|
|
37212
37363
|
exports.preview = preview;
|
|
37364
|
+
exports.usePortalStyle = usePortalStyle;
|
|
37213
37365
|
//# sourceMappingURL=index.js.map
|