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/index.js
CHANGED
|
@@ -27,7 +27,8 @@ import 'url-search-params-polyfill';
|
|
|
27
27
|
import 'whatwg-fetch';
|
|
28
28
|
import _classCallCheck$2 from '@babel/runtime/helpers/classCallCheck';
|
|
29
29
|
import _createClass$2 from '@babel/runtime/helpers/createClass';
|
|
30
|
-
import { KetSerializer, MolSerializer, KetcherLogger, ketcherProvider, defaultBondThickness, isClipboardAPIAvailable, notifyCopyCut, notifyRequestCompleted, isControlKey, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SettingsManager, SdfSerializer, KETCHER_SAVED_OPTIONS_KEY, SUPERATOM_CLASS, Bond as Bond$2, Elements, AtomList, getAtomType, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, MULTITAIL_ARROW_TOOL_NAME, CREATE_MONOMER_TOOL_NAME, SimpleObjectMode, IMAGE_KEY, SGroup as SGroup$1, identifyStructFormat, SupportedFormat, FormatterFactory, MULTITAIL_ARROW_KEY, ChemicalMimeType, RenderStruct, Struct, ZoomTool, shortcutStr, MonomerMicromolecule, UnresolvedMonomer, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, generateMenuShortcuts, Vec2, Scale, fromMultipleMove, FunctionalGroup, mergeMapOfItemsToSet, fromSgroupDeletion, fromFragmentDeletion, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, Pile, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, imageReferencePositionToCursor, multitailArrowReferenceLinesToCursor, multitailReferencePositionToCursor, CoordinateTransformation, MultitailArrowRefName, fromMultitailArrowHeadTailMove, fromMultitailArrowHeadTailsResize, fromMultitailArrowMove, fromArrowResizing, fromPaste, fromImageResize, fromSimpleObjectResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, fromTemplateOnCanvas, fromTemplateOnBondAction, fromTemplateOnAtom, BondAttr, AtomAttr, formatProperties, runAsyncAction, getStructStringFromClipboardData, getStructure, initHotKeys, keyNorm, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, removeInfoLabelFromAtoms, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, fromImageDeletion, fromMultitailArrowDeletion, notifyItemsToMergeInitializationComplete, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromMultitailArrowCreation, fromPlusAddition, getRelSGroupsBySelection, RotateMonomerOperation, fromRotate, fromFlip, fromSimpleObjectAddition, fromTextCreation, fromImageMove, fromImageCreation, fromHighlightCreate, fromHighlightClear, getOptionsWithConvertedUnits, provideEditorSettings, fromNewCanvas, Render, Coordinates, setMonomerTemplatePrefix, getHELMClassByKetMonomerClass, KetTemplateType,
|
|
30
|
+
import { KetSerializer, MolSerializer, KetcherLogger, ketcherProvider, defaultBondThickness, isClipboardAPIAvailable, notifyCopyCut, notifyRequestCompleted, isControlKey, StereLabelStyleType, StereoColoringType, ShowHydrogenLabels, ShowHydrogenLabelNames, SettingsManager, SdfSerializer, KETCHER_SAVED_OPTIONS_KEY, SUPERATOM_CLASS, Bond as Bond$2, Elements, AtomList, getAtomType, StereoLabel, isAttachmentBond, Atom as Atom$2, findStereoAtoms, RxnArrowMode, MULTITAIL_ARROW_TOOL_NAME, CREATE_MONOMER_TOOL_NAME, SimpleObjectMode, IMAGE_KEY, SGroup as SGroup$1, identifyStructFormat, SupportedFormat, FormatterFactory, MULTITAIL_ARROW_KEY, ChemicalMimeType, RenderStruct, Struct, ZoomTool, KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR, shortcutStr, MonomerMicromolecule, UnresolvedMonomer, FunctionalGroupsProvider, SaltsAndSolventsProvider, KetcherAsyncEvents, ElementColor, generateMenuShortcuts, Vec2, Scale, fromMultipleMove, FunctionalGroup, mergeMapOfItemsToSet, fromSgroupDeletion, fromFragmentDeletion, vectorUtils, fromBondAddition, Action, fromAtomAddition, fromAtomsAttrs, checkOverlapping, fromSeveralSgroupAddition, expandSGroupWithMultipleAttachmentPoint, SgContexts, Pile, fromSgroupAction, fromItemsFuse, ReBond, setExpandSGroup, fromBondsAttrs, OperationType, ReStruct, imageReferencePositionToCursor, multitailArrowReferenceLinesToCursor, multitailReferencePositionToCursor, CoordinateTransformation, MultitailArrowRefName, fromMultitailArrowHeadTailMove, fromMultitailArrowHeadTailsResize, fromMultitailArrowMove, fromArrowResizing, fromPaste, fromImageResize, fromSimpleObjectResizing, getItemsToFuse, getHoverToFuse, fromTextDeletion, fromTextUpdating, fromTemplateOnCanvas, fromTemplateOnBondAction, fromTemplateOnAtom, BondAttr, AtomAttr, formatProperties, runAsyncAction, getStructStringFromClipboardData, getStructure, initHotKeys, keyNorm, Fragment as Fragment$1, fromRGroupAttachmentPointUpdate, fromOneBondDeletion, bondChangingAction, fromChain, removeInfoLabelFromAtoms, fromStereoFlagUpdate, fromOneAtomDeletion, fromArrowDeletion, fromPlusDeletion, fromSimpleObjectDeletion, fromRGroupAttachmentPointDeletion, fromImageDeletion, fromMultitailArrowDeletion, notifyItemsToMergeInitializationComplete, RGroup as RGroup$2, fromRGroupFragment, fromUpdateIfThen, fromRGroupAttrs, fromArrowAddition, fromMultitailArrowCreation, fromPlusAddition, getRelSGroupsBySelection, RotateMonomerOperation, fromRotate, fromFlip, fromSimpleObjectAddition, fromTextCreation, fromImageMove, fromImageCreation, fromHighlightCreate, fromHighlightClear, getOptionsWithConvertedUnits, provideEditorSettings, fromNewCanvas, Render, Coordinates, genericsList, setMonomerTemplatePrefix, getHELMClassByKetMonomerClass, fillNaturalAnalogueForPhosphateAndSugar, KetTemplateType, normalizeMonomerAtomsPositions, monomerFactory, MacromoleculesConverter, fromSgroupAddition, fromDescriptorsAlign, Pool, fromSgroupAttachmentPointAddition, SGroupAttachmentPoint, atomGetAttr, fromBondFlipping, setExpandMonomerSGroup, fromMultitailArrowTailAdd, MultitailArrow, fromMultitailArrowTailRemove, AmbiguousMonomer, KetMonomerClass, CoreEditor, getAtomCustomQuery, getFormatMimeTypeByFileName, getPropertiesByFormat, StereoFlag, getPropertiesByImgFormat, legacyCopy as legacyCopy$1, b64toBlob, Generics, TextCommand, Ketcher, DefaultStructServiceOptions } from 'ketcher-core';
|
|
31
|
+
export { EditorClassName, KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR } from 'ketcher-core';
|
|
31
32
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
32
33
|
import _possibleConstructorReturn$2 from '@babel/runtime/helpers/possibleConstructorReturn';
|
|
33
34
|
import _getPrototypeOf$2 from '@babel/runtime/helpers/getPrototypeOf';
|
|
@@ -279,6 +280,16 @@ function _isNativeReflectConstruct$g() { try { var t = !Boolean.prototype.valueO
|
|
|
279
280
|
var ieCb = typeof window !== 'undefined' ? window.clipboardData : {};
|
|
280
281
|
var CLIP_AREA_BASE_CLASS = 'cliparea';
|
|
281
282
|
var needSkipCopyEvent = false;
|
|
283
|
+
var isUserEditing = function isUserEditing() {
|
|
284
|
+
var el = document.activeElement;
|
|
285
|
+
if (!el) {
|
|
286
|
+
return false;
|
|
287
|
+
}
|
|
288
|
+
if (el.hasAttribute && el.hasAttribute('data-cliparea')) {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
return Boolean(el.tagName === 'TEXTAREA' || el.tagName === 'INPUT' && el.type !== 'button' && el.type !== 'submit' && el.type !== 'reset' || el.contentEditable === 'true');
|
|
292
|
+
};
|
|
282
293
|
var ClipArea = function (_Component) {
|
|
283
294
|
_inherits$2(ClipArea, _Component);
|
|
284
295
|
function ClipArea(props) {
|
|
@@ -304,7 +315,7 @@ var ClipArea = function (_Component) {
|
|
|
304
315
|
if (event.shiftKey && !isActiveElement(event.target)) event.preventDefault();
|
|
305
316
|
},
|
|
306
317
|
copy: function copy(event) {
|
|
307
|
-
if (!_this2.props.focused()) {
|
|
318
|
+
if (!_this2.props.focused() || isUserEditing()) {
|
|
308
319
|
return;
|
|
309
320
|
}
|
|
310
321
|
if (isClipboardAPIAvailable()) {
|
|
@@ -341,7 +352,7 @@ var ClipArea = function (_Component) {
|
|
|
341
352
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
342
353
|
while (1) switch (_context.prev = _context.next) {
|
|
343
354
|
case 0:
|
|
344
|
-
if (_this2.props.focused()) {
|
|
355
|
+
if (!(!_this2.props.focused() || isUserEditing())) {
|
|
345
356
|
_context.next = 2;
|
|
346
357
|
break;
|
|
347
358
|
}
|
|
@@ -376,7 +387,7 @@ var ClipArea = function (_Component) {
|
|
|
376
387
|
return cut;
|
|
377
388
|
}(),
|
|
378
389
|
paste: function paste(event) {
|
|
379
|
-
if (!_this2.props.focused()) {
|
|
390
|
+
if (!_this2.props.focused() || isUserEditing()) {
|
|
380
391
|
return;
|
|
381
392
|
}
|
|
382
393
|
if (isClipboardAPIAvailable()) {
|
|
@@ -467,6 +478,7 @@ var ClipArea = function (_Component) {
|
|
|
467
478
|
return jsx("textarea", {
|
|
468
479
|
ref: this.textAreaRef,
|
|
469
480
|
className: clsx(CLIP_AREA_BASE_CLASS, classes$Q.cliparea),
|
|
481
|
+
"data-cliparea": true,
|
|
470
482
|
contentEditable: true,
|
|
471
483
|
autoFocus: true
|
|
472
484
|
,
|
|
@@ -3775,7 +3787,7 @@ var zoom = {
|
|
|
3775
3787
|
|
|
3776
3788
|
var openHelpLink = function openHelpLink() {
|
|
3777
3789
|
var _window$open;
|
|
3778
|
-
return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v3.7.0-rc.
|
|
3790
|
+
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();
|
|
3779
3791
|
};
|
|
3780
3792
|
var help = {
|
|
3781
3793
|
help: {
|
|
@@ -3802,8 +3814,6 @@ var STRUCT_TYPE = {
|
|
|
3802
3814
|
};
|
|
3803
3815
|
var KETCHER_ROOT_NODE_CLASS_NAME = 'Ketcher-root';
|
|
3804
3816
|
var KETCHER_ROOT_NODE_CSS_SELECTOR = ".".concat(KETCHER_ROOT_NODE_CLASS_NAME);
|
|
3805
|
-
var EditorClassName = 'Ketcher-polymer-editor-root';
|
|
3806
|
-
var KETCHER_MACROMOLECULES_ROOT_NODE_SELECTOR = ".".concat(EditorClassName);
|
|
3807
3817
|
var STRUCT_SERVICE_NO_RENDER_INITIALIZED_EVENT = 'struct-service-no-render-initialized';
|
|
3808
3818
|
var STRUCT_SERVICE_INITIALIZED_EVENT = 'struct-service-initialized';
|
|
3809
3819
|
var ACS_STYLE_DEFAULT_SETTINGS = {
|
|
@@ -3883,6 +3893,9 @@ var disableIfViewOnly = function disableIfViewOnly(editor) {
|
|
|
3883
3893
|
var disableIfMonomerCreationWizardActive = function disableIfMonomerCreationWizardActive(editor) {
|
|
3884
3894
|
return editor.isMonomerCreationWizardActive;
|
|
3885
3895
|
};
|
|
3896
|
+
var combinedDisable = function combinedDisable(editor) {
|
|
3897
|
+
return disableIfViewOnly(editor) || disableIfMonomerCreationWizardActive(editor);
|
|
3898
|
+
};
|
|
3886
3899
|
var updateConfigItem = function updateConfigItem(item) {
|
|
3887
3900
|
if (typeof item.disabled === 'boolean' || item.enabledInViewOnly === true) {
|
|
3888
3901
|
return item;
|
|
@@ -3895,7 +3908,7 @@ var updateConfigItem = function updateConfigItem(item) {
|
|
|
3895
3908
|
});
|
|
3896
3909
|
} else {
|
|
3897
3910
|
return _objectSpread$1p(_objectSpread$1p({}, item), {}, {
|
|
3898
|
-
disabled:
|
|
3911
|
+
disabled: combinedDisable
|
|
3899
3912
|
});
|
|
3900
3913
|
}
|
|
3901
3914
|
};
|
|
@@ -13706,9 +13719,11 @@ function usePortalOpening(_ref) {
|
|
|
13706
13719
|
}
|
|
13707
13720
|
|
|
13708
13721
|
function usePortalStyle(_ref) {
|
|
13709
|
-
var _ref2 = _slicedToArray$1(_ref,
|
|
13722
|
+
var _ref2 = _slicedToArray$1(_ref, 4),
|
|
13710
13723
|
ref = _ref2[0],
|
|
13711
|
-
isOpen = _ref2[1]
|
|
13724
|
+
isOpen = _ref2[1],
|
|
13725
|
+
isTop = _ref2[2],
|
|
13726
|
+
rootElementSelector = _ref2[3];
|
|
13712
13727
|
var _useState = useState({}),
|
|
13713
13728
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
13714
13729
|
portalStyle = _useState2[0],
|
|
@@ -13718,19 +13733,20 @@ function usePortalStyle(_ref) {
|
|
|
13718
13733
|
if (!ref.current) {
|
|
13719
13734
|
return;
|
|
13720
13735
|
}
|
|
13721
|
-
var editorRect = ((_document$querySelect = document.querySelector(KETCHER_ROOT_NODE_CSS_SELECTOR)) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.getBoundingClientRect()) || {
|
|
13736
|
+
var editorRect = ((_document$querySelect = document.querySelector(rootElementSelector || KETCHER_ROOT_NODE_CSS_SELECTOR)) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.getBoundingClientRect()) || {
|
|
13722
13737
|
top: 0,
|
|
13723
13738
|
left: 0
|
|
13724
13739
|
};
|
|
13725
13740
|
var menuItemRect = ref.current.getBoundingClientRect();
|
|
13726
|
-
var top = menuItemRect.top - editorRect.top;
|
|
13727
13741
|
var spaceBetween = 4;
|
|
13728
|
-
var
|
|
13742
|
+
var alignmentOffset = 2;
|
|
13743
|
+
var top = menuItemRect.top - editorRect.top + (isTop ? spaceBetween + menuItemRect.height : 0) - (isTop ? 0 : alignmentOffset);
|
|
13744
|
+
var left = menuItemRect.left - editorRect.left + (isTop ? 0 : spaceBetween + menuItemRect.width) - (isTop ? alignmentOffset : 0);
|
|
13729
13745
|
setPortalStyle({
|
|
13730
13746
|
top: "".concat(top, "px"),
|
|
13731
13747
|
left: "".concat(left, "px")
|
|
13732
13748
|
});
|
|
13733
|
-
}, [ref, isOpen]);
|
|
13749
|
+
}, [ref, isOpen, isTop, rootElementSelector]);
|
|
13734
13750
|
return [portalStyle];
|
|
13735
13751
|
}
|
|
13736
13752
|
|
|
@@ -15070,7 +15086,7 @@ var selectOptions$2 = makeItems(['select-rectangle', 'select-lasso', 'select-fra
|
|
|
15070
15086
|
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', MULTITAIL_ARROW_TOOL_NAME]);
|
|
15071
15087
|
var mappingOptions = makeItems(['reaction-map', 'reaction-unmap', 'reaction-automap']);
|
|
15072
15088
|
|
|
15073
|
-
var classes$L = {"scroll":"ArrowScroll-module_scroll__h9kCx","button":"ArrowScroll-module_button__ygMgL","down":"ArrowScroll-module_down__yDzZX","up":"ArrowScroll-module_up__Q1ubd"};
|
|
15089
|
+
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"};
|
|
15074
15090
|
|
|
15075
15091
|
function useSettingsContext() {
|
|
15076
15092
|
return React__default.useContext(settingsContext);
|
|
@@ -15165,8 +15181,9 @@ var useSubscriptionOnEvents = function useSubscriptionOnEvents() {
|
|
|
15165
15181
|
var ArrowScroll = function ArrowScroll(_ref) {
|
|
15166
15182
|
var startInView = _ref.startInView,
|
|
15167
15183
|
endInView = _ref.endInView,
|
|
15168
|
-
|
|
15169
|
-
|
|
15184
|
+
scrollForward = _ref.scrollForward,
|
|
15185
|
+
scrollBack = _ref.scrollBack,
|
|
15186
|
+
isLeftRight = _ref.isLeftRight;
|
|
15170
15187
|
var _useState = useState(false),
|
|
15171
15188
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
15172
15189
|
isScrollDown = _useState2[0],
|
|
@@ -15175,8 +15192,8 @@ var ArrowScroll = function ArrowScroll(_ref) {
|
|
|
15175
15192
|
_useState4 = _slicedToArray$1(_useState3, 2),
|
|
15176
15193
|
isScrollUp = _useState4[0],
|
|
15177
15194
|
setScrollUp = _useState4[1];
|
|
15178
|
-
useInterval(
|
|
15179
|
-
useInterval(
|
|
15195
|
+
useInterval(scrollBack, isScrollDown ? 100 : null);
|
|
15196
|
+
useInterval(scrollForward, isScrollUp ? 100 : null);
|
|
15180
15197
|
useEffect(function () {
|
|
15181
15198
|
return function () {
|
|
15182
15199
|
setScrollUp(false);
|
|
@@ -15188,31 +15205,27 @@ var ArrowScroll = function ArrowScroll(_ref) {
|
|
|
15188
15205
|
};
|
|
15189
15206
|
}, [endInView]);
|
|
15190
15207
|
return jsxs("div", {
|
|
15191
|
-
className: classes$L.scroll,
|
|
15208
|
+
className: [classes$L.scroll, isLeftRight ? classes$L.leftRight : classes$L.upDown].join(' '),
|
|
15192
15209
|
children: [endInView ? jsx(Fragment, {}) : jsx("button", {
|
|
15193
|
-
onClick:
|
|
15194
|
-
return scrollDown();
|
|
15195
|
-
},
|
|
15210
|
+
onClick: scrollForward,
|
|
15196
15211
|
onMouseUp: function onMouseUp() {
|
|
15197
15212
|
return setScrollDown(false);
|
|
15198
15213
|
},
|
|
15199
15214
|
onMouseDown: function onMouseDown() {
|
|
15200
15215
|
return setScrollDown(true);
|
|
15201
15216
|
},
|
|
15202
|
-
className: clsx(classes$L.button, classes$L.down),
|
|
15203
|
-
children:
|
|
15217
|
+
className: clsx(classes$L.button, isLeftRight ? classes$L.right : classes$L.down),
|
|
15218
|
+
children: isLeftRight ? '►' : '▼'
|
|
15204
15219
|
}), startInView ? jsx(Fragment, {}) : jsx("button", {
|
|
15205
|
-
onClick:
|
|
15206
|
-
return scrollUp();
|
|
15207
|
-
},
|
|
15220
|
+
onClick: scrollBack,
|
|
15208
15221
|
onMouseUp: function onMouseUp() {
|
|
15209
15222
|
return setScrollUp(false);
|
|
15210
15223
|
},
|
|
15211
15224
|
onMouseDown: function onMouseDown() {
|
|
15212
15225
|
return setScrollUp(true);
|
|
15213
15226
|
},
|
|
15214
|
-
className: clsx(classes$L.button, classes$L.up),
|
|
15215
|
-
children:
|
|
15227
|
+
className: clsx(classes$L.button, isLeftRight ? classes$L.left : classes$L.up),
|
|
15228
|
+
children: isLeftRight ? '◄' : '▲'
|
|
15216
15229
|
})]
|
|
15217
15230
|
});
|
|
15218
15231
|
};
|
|
@@ -15446,8 +15459,8 @@ var LeftToolbar = function LeftToolbar(props) {
|
|
|
15446
15459
|
}), height && (scrollRef === null || scrollRef === void 0 || (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollHeight) > height && jsx(ArrowScroll, {
|
|
15447
15460
|
startInView: startInView,
|
|
15448
15461
|
endInView: endInView,
|
|
15449
|
-
|
|
15450
|
-
|
|
15462
|
+
scrollForward: scrollDown,
|
|
15463
|
+
scrollBack: scrollUp
|
|
15451
15464
|
})]
|
|
15452
15465
|
});
|
|
15453
15466
|
};
|
|
@@ -15650,8 +15663,8 @@ var RightToolbar = function RightToolbar(props) {
|
|
|
15650
15663
|
}), height && (scrollRef === null || scrollRef === void 0 || (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollHeight) > height && jsx(ArrowScroll, {
|
|
15651
15664
|
startInView: startInView,
|
|
15652
15665
|
endInView: endInView,
|
|
15653
|
-
|
|
15654
|
-
|
|
15666
|
+
scrollForward: scrollDown,
|
|
15667
|
+
scrollBack: scrollUp
|
|
15655
15668
|
})]
|
|
15656
15669
|
});
|
|
15657
15670
|
};
|
|
@@ -24067,9 +24080,8 @@ var CreateMonomerTool = function () {
|
|
|
24067
24080
|
this.editor.openMonomerCreationWizard();
|
|
24068
24081
|
}
|
|
24069
24082
|
_createClass$2(CreateMonomerTool, [{
|
|
24070
|
-
key: "
|
|
24071
|
-
value: function
|
|
24072
|
-
this.editor.closeMonomerCreationWizard();
|
|
24083
|
+
key: "mousemove",
|
|
24084
|
+
value: function mousemove() {
|
|
24073
24085
|
}
|
|
24074
24086
|
}]);
|
|
24075
24087
|
return CreateMonomerTool;
|
|
@@ -24241,8 +24253,9 @@ var HoverIcon = function () {
|
|
|
24241
24253
|
}, {
|
|
24242
24254
|
key: "isOverLoader",
|
|
24243
24255
|
value: function isOverLoader(event) {
|
|
24256
|
+
var _target$classList;
|
|
24244
24257
|
var target = (event === null || event === void 0 ? void 0 : event.relatedTarget) || event.target;
|
|
24245
|
-
return target === null || target === void 0 ? void 0 :
|
|
24258
|
+
return target === null || target === void 0 || (_target$classList = target.classList) === null || _target$classList === void 0 ? void 0 : _target$classList.contains('loading-spinner');
|
|
24246
24259
|
}
|
|
24247
24260
|
}, {
|
|
24248
24261
|
key: "onMouseMove",
|
|
@@ -25300,13 +25313,27 @@ var Editor$3 = function () {
|
|
|
25300
25313
|
}, {
|
|
25301
25314
|
key: "isMonomerCreationWizardEnabled",
|
|
25302
25315
|
get: function get() {
|
|
25303
|
-
var _selection$atoms,
|
|
25316
|
+
var _selection$atoms,
|
|
25317
|
+
_selection$bonds,
|
|
25318
|
+
_this = this;
|
|
25304
25319
|
if (this._monomerCreationState) {
|
|
25305
25320
|
return true;
|
|
25306
25321
|
}
|
|
25307
|
-
var selection = this.
|
|
25322
|
+
var selection = this.selection();
|
|
25308
25323
|
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) {
|
|
25309
25324
|
var currentStruct = this.render.ctab.molecule;
|
|
25325
|
+
var selectionInvalid = selection.atoms.some(function (atomId) {
|
|
25326
|
+
var atom = _this.render.ctab.molecule.atoms.get(atomId);
|
|
25327
|
+
if (!atom) {
|
|
25328
|
+
return false;
|
|
25329
|
+
}
|
|
25330
|
+
return atom.sgs.size > 0 || atom.rglabel !== null || atom.attachmentPoints !== null || _this.render.ctab.molecule.rgroups.some(function (rgroup) {
|
|
25331
|
+
return rgroup.frags.has(atom.fragment);
|
|
25332
|
+
}) || genericsList.includes(atom.label);
|
|
25333
|
+
});
|
|
25334
|
+
if (selectionInvalid) {
|
|
25335
|
+
return false;
|
|
25336
|
+
}
|
|
25310
25337
|
var isSelectionContinuous = Editor.isSelectionContinuous(selection, currentStruct);
|
|
25311
25338
|
if (!isSelectionContinuous) {
|
|
25312
25339
|
return false;
|
|
@@ -25315,9 +25342,12 @@ var Editor$3 = function () {
|
|
|
25315
25342
|
var bondsToOutside = currentStruct.bonds.filter(function (_, bond) {
|
|
25316
25343
|
return selectionAtoms.has(bond.begin) && !selectionAtoms.has(bond.end) || selectionAtoms.has(bond.end) && !selectionAtoms.has(bond.begin);
|
|
25317
25344
|
});
|
|
25318
|
-
|
|
25319
|
-
return bond.type
|
|
25320
|
-
})
|
|
25345
|
+
if (bondsToOutside.some(function (bond) {
|
|
25346
|
+
return bond.type !== Bond$2.PATTERN.TYPE.SINGLE || bond.stereo !== Bond$2.PATTERN.STEREO.NONE;
|
|
25347
|
+
})) {
|
|
25348
|
+
return false;
|
|
25349
|
+
}
|
|
25350
|
+
this.singleBondsToOutsideOfSelection = bondsToOutside;
|
|
25321
25351
|
return this.singleBondsToOutsideOfSelection.size > 0 && this.singleBondsToOutsideOfSelection.size <= 8;
|
|
25322
25352
|
}
|
|
25323
25353
|
return false;
|
|
@@ -25326,19 +25356,20 @@ var Editor$3 = function () {
|
|
|
25326
25356
|
key: "openMonomerCreationWizard",
|
|
25327
25357
|
value: function openMonomerCreationWizard() {
|
|
25328
25358
|
var _selection$atoms2,
|
|
25329
|
-
|
|
25359
|
+
_this2 = this;
|
|
25330
25360
|
var currentStruct = this.render.ctab.molecule;
|
|
25331
|
-
var selection = this.
|
|
25361
|
+
var selection = this.selection();
|
|
25362
|
+
assert_1(selection);
|
|
25332
25363
|
this.originalSelection = selection;
|
|
25333
25364
|
var selectionAtoms = new Set(selection.atoms);
|
|
25334
|
-
var selectedStruct = this.structSelected();
|
|
25365
|
+
var selectedStruct = this.structSelected(selection);
|
|
25335
25366
|
this.selectionBBox = selectedStruct.getCoordBoundingBoxObj();
|
|
25336
25367
|
var atomIdsMap = new Map();
|
|
25337
25368
|
_toConsumableArray((_selection$atoms2 = selection.atoms) !== null && _selection$atoms2 !== void 0 ? _selection$atoms2 : []).sort(function (a, b) {
|
|
25338
25369
|
return a - b;
|
|
25339
25370
|
}).forEach(function (atomId, i) {
|
|
25340
25371
|
atomIdsMap.set(atomId, i);
|
|
25341
|
-
|
|
25372
|
+
_this2.atomIdsMap.set(i, atomId);
|
|
25342
25373
|
});
|
|
25343
25374
|
var attachmentPoints = new Map();
|
|
25344
25375
|
this.singleBondsToOutsideOfSelection.forEach(function (bond) {
|
|
@@ -25350,7 +25381,7 @@ var Editor$3 = function () {
|
|
|
25350
25381
|
pp: leavingAtom === null || leavingAtom === void 0 ? void 0 : leavingAtom.pp
|
|
25351
25382
|
});
|
|
25352
25383
|
var newLeavingAtomId = selectedStruct.atoms.add(newLeavingAtom);
|
|
25353
|
-
|
|
25384
|
+
_this2.atomIdsMap.set(newLeavingAtomId, leavingAtomId);
|
|
25354
25385
|
var bondEdgeForAttachmentAtom = bondEdgeForLeavingAtom === 'end' ? 'begin' : 'end';
|
|
25355
25386
|
var attachmentAtomId = bond[bondEdgeForAttachmentAtom];
|
|
25356
25387
|
var attachmentAtomIdInSelectedStruct = atomIdsMap.get(attachmentAtomId);
|
|
@@ -25364,10 +25395,10 @@ var Editor$3 = function () {
|
|
|
25364
25395
|
});
|
|
25365
25396
|
selectedStruct.bonds.add(newBond);
|
|
25366
25397
|
attachmentPoints.set(attachmentAtomIdInSelectedStruct, newLeavingAtomId);
|
|
25367
|
-
|
|
25398
|
+
_this2.atomIdsMap.set(attachmentAtomIdInSelectedStruct, attachmentAtomId);
|
|
25368
25399
|
});
|
|
25369
25400
|
this._monomerCreationState = {
|
|
25370
|
-
originalStruct: currentStruct
|
|
25401
|
+
originalStruct: currentStruct,
|
|
25371
25402
|
attachmentAtomIdToLeavingAtomId: attachmentPoints
|
|
25372
25403
|
};
|
|
25373
25404
|
this.render.monomerCreationRenderState = {
|
|
@@ -25389,6 +25420,8 @@ var Editor$3 = function () {
|
|
|
25389
25420
|
}, {
|
|
25390
25421
|
key: "saveNewMonomer",
|
|
25391
25422
|
value: function saveNewMonomer(data) {
|
|
25423
|
+
var _this$originalSelecti,
|
|
25424
|
+
_this3 = this;
|
|
25392
25425
|
if (!this._monomerCreationState) {
|
|
25393
25426
|
throw new Error('Monomer creation wizard is not active, cannot save new monomer');
|
|
25394
25427
|
}
|
|
@@ -25412,6 +25445,7 @@ var Editor$3 = function () {
|
|
|
25412
25445
|
var monomerId = "".concat(symbol, "___").concat(name);
|
|
25413
25446
|
var monomerRef = setMonomerTemplatePrefix(monomerId);
|
|
25414
25447
|
var monomerHELMClass = getHELMClassByKetMonomerClass(type);
|
|
25448
|
+
var naturalAnalogueToUse = fillNaturalAnalogueForPhosphateAndSugar(naturalAnalogue, type);
|
|
25415
25449
|
var monomerTemplate = {
|
|
25416
25450
|
type: KetTemplateType.MONOMER_TEMPLATE,
|
|
25417
25451
|
id: monomerId,
|
|
@@ -25419,8 +25453,8 @@ var Editor$3 = function () {
|
|
|
25419
25453
|
classHELM: monomerHELMClass,
|
|
25420
25454
|
alias: symbol,
|
|
25421
25455
|
fullName: name,
|
|
25422
|
-
naturalAnalogShort:
|
|
25423
|
-
atoms: ketMicromolecule.mol0.atoms,
|
|
25456
|
+
naturalAnalogShort: naturalAnalogueToUse,
|
|
25457
|
+
atoms: normalizeMonomerAtomsPositions(ketMicromolecule.mol0.atoms),
|
|
25424
25458
|
bonds: ketMicromolecule.mol0.bonds,
|
|
25425
25459
|
attachmentPoints: attachmentPoints,
|
|
25426
25460
|
root: {
|
|
@@ -25445,9 +25479,24 @@ var Editor$3 = function () {
|
|
|
25445
25479
|
var monomerPosition = new Vec2((this.selectionBBox.min.x + this.selectionBBox.max.x) / 2, (this.selectionBBox.min.y + this.selectionBBox.max.y) / 2);
|
|
25446
25480
|
var monomer = new Monomer(monomerItem, monomerPosition);
|
|
25447
25481
|
this.closeMonomerCreationWizard();
|
|
25482
|
+
var sGroupAttachmentPoints = MacromoleculesConverter.convertMonomerAttachmentPointsToSGroupAttachmentPoints(monomer, this.atomIdsMap);
|
|
25483
|
+
this.singleBondsToOutsideOfSelection.forEach(function (bond) {
|
|
25484
|
+
var attachmentPointToBond = sGroupAttachmentPoints.find(function (point) {
|
|
25485
|
+
return point.atomId === bond.begin || point.atomId === bond.end;
|
|
25486
|
+
});
|
|
25487
|
+
if (attachmentPointToBond) {
|
|
25488
|
+
bond.beginSuperatomAttachmentPointNumber = attachmentPointToBond.attachmentPointNumber;
|
|
25489
|
+
}
|
|
25490
|
+
});
|
|
25448
25491
|
var action = fromSgroupAddition(this.render.ctab, SGroup$1.TYPES.SUP, this.originalSelection.atoms, {
|
|
25449
25492
|
expanded: true
|
|
25450
|
-
}, this.render.ctab.molecule.sgroups.newId(),
|
|
25493
|
+
}, this.render.ctab.molecule.sgroups.newId(), sGroupAttachmentPoints, monomer.position, true, monomer.monomerItem.props.MonomerName, null, monomer);
|
|
25494
|
+
(_this$originalSelecti = this.originalSelection.atoms) === null || _this$originalSelecti === void 0 || _this$originalSelecti.forEach(function (atomId) {
|
|
25495
|
+
var atom = _this3.render.ctab.molecule.atoms.get(atomId);
|
|
25496
|
+
if (atom) {
|
|
25497
|
+
atom.fragment = -1;
|
|
25498
|
+
}
|
|
25499
|
+
});
|
|
25451
25500
|
this.update(action);
|
|
25452
25501
|
}
|
|
25453
25502
|
}, {
|
|
@@ -25635,6 +25684,11 @@ var Editor$3 = function () {
|
|
|
25635
25684
|
ketcherProvider.getKetcher(this.ketcherId).changeEvent.add(subscribeFuncWrapper);
|
|
25636
25685
|
break;
|
|
25637
25686
|
}
|
|
25687
|
+
case 'libraryUpdate':
|
|
25688
|
+
{
|
|
25689
|
+
ketcherProvider.getKetcher(this.ketcherId).libraryUpdateEvent.add(handler);
|
|
25690
|
+
break;
|
|
25691
|
+
}
|
|
25638
25692
|
default:
|
|
25639
25693
|
this.event[eventName].add(handler);
|
|
25640
25694
|
}
|
|
@@ -25660,6 +25714,7 @@ var Editor$3 = function () {
|
|
|
25660
25714
|
}, {
|
|
25661
25715
|
key: "explicitSelected",
|
|
25662
25716
|
value: function explicitSelected() {
|
|
25717
|
+
var autoSelectBonds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
25663
25718
|
var selection = this.selection() || {};
|
|
25664
25719
|
var res = structObjects.reduce(function (acc, key) {
|
|
25665
25720
|
acc[key] = selection[key] ? selection[key].slice() : [];
|
|
@@ -25680,7 +25735,7 @@ var Editor$3 = function () {
|
|
|
25680
25735
|
}
|
|
25681
25736
|
});
|
|
25682
25737
|
}
|
|
25683
|
-
if (res.atoms && res.bonds) {
|
|
25738
|
+
if (autoSelectBonds && res.atoms && res.bonds) {
|
|
25684
25739
|
struct.bonds.forEach(function (bond, bid) {
|
|
25685
25740
|
if (res.bonds.indexOf(bid) < 0 && res.atoms.indexOf(bond.begin) >= 0 && res.atoms.indexOf(bond.end) >= 0) {
|
|
25686
25741
|
res.bonds = res.bonds || [];
|
|
@@ -25692,9 +25747,9 @@ var Editor$3 = function () {
|
|
|
25692
25747
|
}
|
|
25693
25748
|
}, {
|
|
25694
25749
|
key: "structSelected",
|
|
25695
|
-
value: function structSelected() {
|
|
25750
|
+
value: function structSelected(existingSelection) {
|
|
25696
25751
|
var struct = this.render.ctab.molecule;
|
|
25697
|
-
var selection = this.explicitSelected();
|
|
25752
|
+
var selection = existingSelection !== null && existingSelection !== void 0 ? existingSelection : this.explicitSelected();
|
|
25698
25753
|
var dst = struct.clone(new Pile(selection.atoms), new Pile(selection.bonds), true, null, new Pile(selection.simpleObjects), new Pile(selection.texts), null, new Pile(selection.images), new Pile(selection[MULTITAIL_ARROW_KEY]));
|
|
25699
25754
|
struct.rxnArrows.forEach(function (item, id) {
|
|
25700
25755
|
if (selection.rxnArrows.indexOf(id) !== -1) dst.rxnArrows.add(item.clone());
|
|
@@ -27631,6 +27686,47 @@ function getMenuPropsForSelection(selection, selectedFunctionalGroups, ketcherId
|
|
|
27631
27686
|
}
|
|
27632
27687
|
}
|
|
27633
27688
|
|
|
27689
|
+
var MonomerTypeSelectConfig = [{
|
|
27690
|
+
value: KetMonomerClass.AminoAcid,
|
|
27691
|
+
label: 'Amino acid',
|
|
27692
|
+
iconName: 'peptide'
|
|
27693
|
+
}, {
|
|
27694
|
+
value: KetMonomerClass.Sugar,
|
|
27695
|
+
label: 'Sugar',
|
|
27696
|
+
iconName: 'sugar'
|
|
27697
|
+
}, {
|
|
27698
|
+
value: KetMonomerClass.Base,
|
|
27699
|
+
label: 'Base',
|
|
27700
|
+
iconName: 'base'
|
|
27701
|
+
}, {
|
|
27702
|
+
value: KetMonomerClass.Phosphate,
|
|
27703
|
+
label: 'Phosphate',
|
|
27704
|
+
iconName: 'phosphate'
|
|
27705
|
+
}, {
|
|
27706
|
+
value: KetMonomerClass.RNA,
|
|
27707
|
+
label: 'Nucleotide',
|
|
27708
|
+
iconName: 'nucleotide'
|
|
27709
|
+
}, {
|
|
27710
|
+
value: KetMonomerClass.CHEM,
|
|
27711
|
+
label: 'CHEM',
|
|
27712
|
+
iconName: 'chem'
|
|
27713
|
+
}];
|
|
27714
|
+
var NotificationMessages = {
|
|
27715
|
+
defaultAttachmentPoints: 'Attachment points are set by default with hydrogens as leaving groups.',
|
|
27716
|
+
emptyMandatoryFields: 'Mandatory fields must be filled.',
|
|
27717
|
+
invalidSymbol: 'The monomer symbol must consist only of uppercase and lowercase letters, numbers, hyphens (-), underscores (_), and asterisks (*).',
|
|
27718
|
+
symbolExists: 'The symbol must be unique amongst peptide, RNA, or CHEM monomers.',
|
|
27719
|
+
editingIsNotAllowed: 'Editing of the structure is not allowed.'
|
|
27720
|
+
};
|
|
27721
|
+
var NotificationTypes = {
|
|
27722
|
+
defaultAttachmentPoints: 'info',
|
|
27723
|
+
emptyMandatoryFields: 'error',
|
|
27724
|
+
invalidSymbol: 'error',
|
|
27725
|
+
symbolExists: 'error',
|
|
27726
|
+
editingIsNotAllowed: 'error'
|
|
27727
|
+
};
|
|
27728
|
+
var MonomerCreationExternalNotificationAction = 'MonomerCreationExternalNotification';
|
|
27729
|
+
|
|
27634
27730
|
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; }
|
|
27635
27731
|
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$1(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; }
|
|
27636
27732
|
var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
|
|
@@ -27663,6 +27759,12 @@ var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
|
|
|
27663
27759
|
event.preventDefault();
|
|
27664
27760
|
var ketcher = ketcherProvider.getKetcher(ketcherId);
|
|
27665
27761
|
var editor = ketcher.editor;
|
|
27762
|
+
if (editor.monomerCreationState !== null) {
|
|
27763
|
+
window.dispatchEvent(new CustomEvent(MonomerCreationExternalNotificationAction, {
|
|
27764
|
+
detail: 'editingIsNotAllowed'
|
|
27765
|
+
}));
|
|
27766
|
+
return;
|
|
27767
|
+
}
|
|
27666
27768
|
if (editor.render.options.viewOnlyMode) {
|
|
27667
27769
|
return;
|
|
27668
27770
|
}
|
|
@@ -28096,7 +28198,8 @@ var Select$1 = function Select(_ref2) {
|
|
|
28096
28198
|
formName = _ref2.formName,
|
|
28097
28199
|
name = _ref2.name,
|
|
28098
28200
|
placeholder = _ref2.placeholder,
|
|
28099
|
-
testId = _ref2['data-testid']
|
|
28201
|
+
testId = _ref2['data-testid'],
|
|
28202
|
+
error = _ref2.error;
|
|
28100
28203
|
var _useState = useState(),
|
|
28101
28204
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
28102
28205
|
currentValue = _useState2[0],
|
|
@@ -28125,6 +28228,7 @@ var Select$1 = function Select(_ref2) {
|
|
|
28125
28228
|
},
|
|
28126
28229
|
IconComponent: ChevronIcon$1,
|
|
28127
28230
|
"data-testid": testId,
|
|
28231
|
+
error: error,
|
|
28128
28232
|
children: options && options.map(function (option) {
|
|
28129
28233
|
var _option$children;
|
|
28130
28234
|
var isDivider = typeof (option === null || option === void 0 ? void 0 : option.value) === 'string' ? option.value.includes('Divider') : false;
|
|
@@ -28295,7 +28399,8 @@ var NaturalAnaloguePicker = function NaturalAnaloguePicker(_ref2) {
|
|
|
28295
28399
|
var monomerType = _ref2.monomerType,
|
|
28296
28400
|
value = _ref2.value,
|
|
28297
28401
|
onChange = _ref2.onChange,
|
|
28298
|
-
className = _ref2.className
|
|
28402
|
+
className = _ref2.className,
|
|
28403
|
+
error = _ref2.error;
|
|
28299
28404
|
var disabled = !isNaturalAnalogueRequired(monomerType);
|
|
28300
28405
|
var options = monomerType === KetMonomerClass.AminoAcid ? aminoAcidOptions : rnaOptions;
|
|
28301
28406
|
var renderValue = useCallback(function (selected) {
|
|
@@ -28339,6 +28444,7 @@ var NaturalAnaloguePicker = function NaturalAnaloguePicker(_ref2) {
|
|
|
28339
28444
|
IconComponent: ChevronIcon,
|
|
28340
28445
|
"data-testid": "natural-analogue-picker",
|
|
28341
28446
|
disabled: disabled,
|
|
28447
|
+
error: error,
|
|
28342
28448
|
children: options.map(function (option) {
|
|
28343
28449
|
return jsx(MenuItem, {
|
|
28344
28450
|
value: option.value,
|
|
@@ -28383,7 +28489,7 @@ var AttributeField = function AttributeField(_ref) {
|
|
|
28383
28489
|
});
|
|
28384
28490
|
};
|
|
28385
28491
|
|
|
28386
|
-
var styles$f = {"notification":"Notification-module_notification__yHqXk","notificationStrip":"Notification-module_notificationStrip__gSCg2","info":"Notification-module_info__M2qqL","
|
|
28492
|
+
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"};
|
|
28387
28493
|
|
|
28388
28494
|
var iconMap = {
|
|
28389
28495
|
info: 'checkFilled',
|
|
@@ -28420,37 +28526,6 @@ var Notification = function Notification(_ref) {
|
|
|
28420
28526
|
|
|
28421
28527
|
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; }
|
|
28422
28528
|
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$1(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; }
|
|
28423
|
-
var MonomerTypeSelectConfig = [{
|
|
28424
|
-
value: KetMonomerClass.AminoAcid,
|
|
28425
|
-
label: 'Amino acid',
|
|
28426
|
-
iconName: 'peptide'
|
|
28427
|
-
}, {
|
|
28428
|
-
value: KetMonomerClass.Sugar,
|
|
28429
|
-
label: 'Sugar',
|
|
28430
|
-
iconName: 'sugar'
|
|
28431
|
-
}, {
|
|
28432
|
-
value: KetMonomerClass.Base,
|
|
28433
|
-
label: 'Base',
|
|
28434
|
-
iconName: 'base'
|
|
28435
|
-
}, {
|
|
28436
|
-
value: KetMonomerClass.Phosphate,
|
|
28437
|
-
label: 'Phosphate',
|
|
28438
|
-
iconName: 'phosphate'
|
|
28439
|
-
}, {
|
|
28440
|
-
value: KetMonomerClass.RNA,
|
|
28441
|
-
label: 'Nucleotide',
|
|
28442
|
-
iconName: 'nucleotide'
|
|
28443
|
-
}, {
|
|
28444
|
-
value: KetMonomerClass.CHEM,
|
|
28445
|
-
label: 'CHEM',
|
|
28446
|
-
iconName: 'chem'
|
|
28447
|
-
}];
|
|
28448
|
-
var notificationMessages = {
|
|
28449
|
-
defaultAttachmentPoints: 'Attachment points are set by default with hydrogens as leaving groups.',
|
|
28450
|
-
emptyMandatoryFields: 'Mandatory fields must be filled.',
|
|
28451
|
-
invalidSymbol: 'The monomer symbol must consist only of uppercase and lowercase letters, numbers, hyphens (-), underscores (_), and asterisks (*).',
|
|
28452
|
-
symbolExists: 'The symbol must be unique amongst peptide, RNA, or CHEM monomers.'
|
|
28453
|
-
};
|
|
28454
28529
|
var initialWizardState = {
|
|
28455
28530
|
values: {
|
|
28456
28531
|
type: undefined,
|
|
@@ -28461,7 +28536,7 @@ var initialWizardState = {
|
|
|
28461
28536
|
errors: {},
|
|
28462
28537
|
notifications: new Map([['defaultAttachmentPoints', {
|
|
28463
28538
|
type: 'info',
|
|
28464
|
-
message:
|
|
28539
|
+
message: NotificationMessages.defaultAttachmentPoints
|
|
28465
28540
|
}]])
|
|
28466
28541
|
};
|
|
28467
28542
|
var wizardReducer = function wizardReducer(state, action) {
|
|
@@ -28470,8 +28545,12 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28470
28545
|
{
|
|
28471
28546
|
var fieldId = action.fieldId,
|
|
28472
28547
|
value = action.value;
|
|
28548
|
+
var values = _objectSpread$H(_objectSpread$H({}, state.values), {}, _defineProperty$1({}, fieldId, value));
|
|
28549
|
+
if (fieldId === 'type') {
|
|
28550
|
+
values.naturalAnalogue = '';
|
|
28551
|
+
}
|
|
28473
28552
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28474
|
-
values:
|
|
28553
|
+
values: values,
|
|
28475
28554
|
errors: _objectSpread$H(_objectSpread$H({}, state.errors), {}, _defineProperty$1({}, fieldId, undefined))
|
|
28476
28555
|
});
|
|
28477
28556
|
}
|
|
@@ -28487,6 +28566,20 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28487
28566
|
notifications: new Map([].concat(_toConsumableArray(state.notifications), _toConsumableArray(action.notifications)))
|
|
28488
28567
|
});
|
|
28489
28568
|
}
|
|
28569
|
+
case 'AddNotification':
|
|
28570
|
+
{
|
|
28571
|
+
var notifications = new Map(state.notifications);
|
|
28572
|
+
var id = action.id;
|
|
28573
|
+
if (!notifications.has(id)) {
|
|
28574
|
+
notifications.set(id, {
|
|
28575
|
+
type: NotificationTypes[id],
|
|
28576
|
+
message: NotificationMessages[id]
|
|
28577
|
+
});
|
|
28578
|
+
}
|
|
28579
|
+
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28580
|
+
notifications: notifications
|
|
28581
|
+
});
|
|
28582
|
+
}
|
|
28490
28583
|
case 'ResetErrors':
|
|
28491
28584
|
{
|
|
28492
28585
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
@@ -28499,10 +28592,10 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28499
28592
|
}
|
|
28500
28593
|
case 'RemoveNotification':
|
|
28501
28594
|
{
|
|
28502
|
-
var
|
|
28503
|
-
|
|
28595
|
+
var _notifications = new Map(state.notifications);
|
|
28596
|
+
_notifications["delete"](action.id);
|
|
28504
28597
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28505
|
-
notifications:
|
|
28598
|
+
notifications: _notifications
|
|
28506
28599
|
});
|
|
28507
28600
|
}
|
|
28508
28601
|
default:
|
|
@@ -28521,7 +28614,7 @@ var validateInputs = function validateInputs(values) {
|
|
|
28521
28614
|
errors[key] = true;
|
|
28522
28615
|
notifications.set('emptyMandatoryFields', {
|
|
28523
28616
|
type: 'error',
|
|
28524
|
-
message:
|
|
28617
|
+
message: NotificationMessages.emptyMandatoryFields
|
|
28525
28618
|
});
|
|
28526
28619
|
}
|
|
28527
28620
|
return;
|
|
@@ -28532,7 +28625,16 @@ var validateInputs = function validateInputs(values) {
|
|
|
28532
28625
|
errors[key] = true;
|
|
28533
28626
|
notifications.set('invalidSymbol', {
|
|
28534
28627
|
type: 'error',
|
|
28535
|
-
message:
|
|
28628
|
+
message: NotificationMessages.invalidSymbol
|
|
28629
|
+
});
|
|
28630
|
+
return;
|
|
28631
|
+
}
|
|
28632
|
+
var editor = CoreEditor.provideEditorInstance();
|
|
28633
|
+
if (editor.checkIfMonomerSymbolClassPairExists(value, values.type)) {
|
|
28634
|
+
errors[key] = true;
|
|
28635
|
+
notifications.set('symbolExists', {
|
|
28636
|
+
type: 'error',
|
|
28637
|
+
message: NotificationMessages.symbolExists
|
|
28536
28638
|
});
|
|
28537
28639
|
}
|
|
28538
28640
|
}
|
|
@@ -28555,6 +28657,21 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28555
28657
|
symbol = values.symbol,
|
|
28556
28658
|
name = values.name,
|
|
28557
28659
|
naturalAnalogue = values.naturalAnalogue;
|
|
28660
|
+
useEffect(function () {
|
|
28661
|
+
var externalNotificationEventListener = function externalNotificationEventListener(event) {
|
|
28662
|
+
var notificationId = event.detail;
|
|
28663
|
+
if (notificationId) {
|
|
28664
|
+
wizardStateDispatch({
|
|
28665
|
+
type: 'AddNotification',
|
|
28666
|
+
id: notificationId
|
|
28667
|
+
});
|
|
28668
|
+
}
|
|
28669
|
+
};
|
|
28670
|
+
window.addEventListener(MonomerCreationExternalNotificationAction, externalNotificationEventListener);
|
|
28671
|
+
return function () {
|
|
28672
|
+
window.removeEventListener(MonomerCreationExternalNotificationAction, externalNotificationEventListener);
|
|
28673
|
+
};
|
|
28674
|
+
}, []);
|
|
28558
28675
|
var handleFieldChange = function handleFieldChange(fieldId, value) {
|
|
28559
28676
|
if (fieldId === 'type') {
|
|
28560
28677
|
wizardStateDispatch({
|
|
@@ -28659,13 +28776,14 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28659
28776
|
children: [jsx(AttributeField, {
|
|
28660
28777
|
title: "Type",
|
|
28661
28778
|
control: jsx(Select$1, {
|
|
28662
|
-
className:
|
|
28779
|
+
className: styles$j.input,
|
|
28663
28780
|
options: monomerTypeSelectOptions,
|
|
28664
28781
|
placeholder: "Select monomer type",
|
|
28665
28782
|
value: type,
|
|
28666
28783
|
onChange: function onChange(value) {
|
|
28667
28784
|
return handleFieldChange('type', value);
|
|
28668
|
-
}
|
|
28785
|
+
},
|
|
28786
|
+
error: errors.type
|
|
28669
28787
|
}),
|
|
28670
28788
|
required: true
|
|
28671
28789
|
}), jsx(AttributeField, {
|
|
@@ -28673,7 +28791,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28673
28791
|
control: jsx("input", {
|
|
28674
28792
|
type: "text",
|
|
28675
28793
|
className: clsx(styles$j.input, errors.symbol && styles$j.error),
|
|
28676
|
-
placeholder: "
|
|
28794
|
+
placeholder: "e.g. PEG-2",
|
|
28677
28795
|
value: symbol,
|
|
28678
28796
|
onChange: function onChange(event) {
|
|
28679
28797
|
return handleFieldChange('symbol', event.target.value);
|
|
@@ -28685,7 +28803,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28685
28803
|
control: jsx("input", {
|
|
28686
28804
|
type: "text",
|
|
28687
28805
|
className: clsx(styles$j.input, errors.name && styles$j.error),
|
|
28688
|
-
placeholder: "
|
|
28806
|
+
placeholder: "e.g. Diethylene Glycol",
|
|
28689
28807
|
value: name,
|
|
28690
28808
|
onChange: function onChange(event) {
|
|
28691
28809
|
return handleFieldChange('name', event.target.value);
|
|
@@ -28695,12 +28813,12 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28695
28813
|
}), jsx(AttributeField, {
|
|
28696
28814
|
title: "Natural analogue",
|
|
28697
28815
|
control: jsx(NaturalAnaloguePicker, {
|
|
28698
|
-
className: clsx(errors.type && styles$j.error),
|
|
28699
28816
|
monomerType: type,
|
|
28700
28817
|
value: naturalAnalogue,
|
|
28701
28818
|
onChange: function onChange(value) {
|
|
28702
28819
|
return handleFieldChange('naturalAnalogue', value);
|
|
28703
|
-
}
|
|
28820
|
+
},
|
|
28821
|
+
error: errors.naturalAnalogue
|
|
28704
28822
|
}),
|
|
28705
28823
|
disabled: !isNaturalAnalogueRequired(type),
|
|
28706
28824
|
required: true
|
|
@@ -36730,8 +36848,8 @@ var KetcherBuilder = function () {
|
|
|
36730
36848
|
cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
|
|
36731
36849
|
buttons: buttons || {},
|
|
36732
36850
|
errorHandler: errorHandler || null,
|
|
36733
|
-
version: "3.7.0-rc.
|
|
36734
|
-
buildDate: "2025-
|
|
36851
|
+
version: "3.7.0-rc.3" ,
|
|
36852
|
+
buildDate: "2025-09-08T13:19:56" ,
|
|
36735
36853
|
buildNumber: '',
|
|
36736
36854
|
customButtons: customButtons || []
|
|
36737
36855
|
}, structService, resolve, togglerComponent);
|
|
@@ -37026,7 +37144,7 @@ var ModeControl = function ModeControl(_ref3) {
|
|
|
37026
37144
|
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; }
|
|
37027
37145
|
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$1(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; }
|
|
37028
37146
|
var MacromoleculesEditorComponent = lazy(function () {
|
|
37029
|
-
return import('./index.modern-
|
|
37147
|
+
return import('./index.modern-0fa484b9.js');
|
|
37030
37148
|
});
|
|
37031
37149
|
var Editor = function Editor(props) {
|
|
37032
37150
|
var _useState = useState(false),
|
|
@@ -37039,12 +37157,16 @@ var Editor = function Editor(props) {
|
|
|
37039
37157
|
setMoleculesEditor = _useState4[1];
|
|
37040
37158
|
var _useState5 = useState(),
|
|
37041
37159
|
_useState6 = _slicedToArray$1(_useState5, 2),
|
|
37042
|
-
|
|
37043
|
-
|
|
37044
|
-
var _useState7 = useState(
|
|
37160
|
+
ketcher = _useState6[0],
|
|
37161
|
+
setKetcher = _useState6[1];
|
|
37162
|
+
var _useState7 = useState(),
|
|
37045
37163
|
_useState8 = _slicedToArray$1(_useState7, 2),
|
|
37046
|
-
|
|
37047
|
-
|
|
37164
|
+
macromoleculesEditor = _useState8[0],
|
|
37165
|
+
setMacromoleculesEditor = _useState8[1];
|
|
37166
|
+
var _useState9 = useState(''),
|
|
37167
|
+
_useState10 = _slicedToArray$1(_useState9, 2),
|
|
37168
|
+
ketcherId = _useState10[0],
|
|
37169
|
+
setKetcherId = _useState10[1];
|
|
37048
37170
|
var togglePolymerEditor = function togglePolymerEditor(toggleValue) {
|
|
37049
37171
|
setShowPolymerEditor(toggleValue);
|
|
37050
37172
|
window.isPolymerEditorTurnedOn = toggleValue;
|
|
@@ -37053,6 +37175,24 @@ var Editor = function Editor(props) {
|
|
|
37053
37175
|
toggle: togglePolymerEditor,
|
|
37054
37176
|
isPolymerEditor: showPolymerEditor
|
|
37055
37177
|
}) : undefined;
|
|
37178
|
+
useEffect(function () {
|
|
37179
|
+
var switchToMacromoleculesModeHandler = function switchToMacromoleculesModeHandler() {
|
|
37180
|
+
togglePolymerEditor(true);
|
|
37181
|
+
};
|
|
37182
|
+
var switchToMoleculesModeHandler = function switchToMoleculesModeHandler() {
|
|
37183
|
+
togglePolymerEditor(false);
|
|
37184
|
+
};
|
|
37185
|
+
if (macromoleculesEditor) {
|
|
37186
|
+
macromoleculesEditor.events.switchToMacromoleculesMode.add(switchToMacromoleculesModeHandler);
|
|
37187
|
+
macromoleculesEditor.events.switchToMoleculesMode.add(switchToMoleculesModeHandler);
|
|
37188
|
+
}
|
|
37189
|
+
return function () {
|
|
37190
|
+
if (macromoleculesEditor) {
|
|
37191
|
+
macromoleculesEditor.events.switchToMacromoleculesMode.remove(switchToMacromoleculesModeHandler);
|
|
37192
|
+
macromoleculesEditor.events.switchToMoleculesMode.remove(switchToMoleculesModeHandler);
|
|
37193
|
+
}
|
|
37194
|
+
};
|
|
37195
|
+
}, [macromoleculesEditor]);
|
|
37056
37196
|
useEffect(function () {
|
|
37057
37197
|
return function () {
|
|
37058
37198
|
window.isPolymerEditorTurnedOn = false;
|
|
@@ -37068,9 +37208,14 @@ var Editor = function Editor(props) {
|
|
|
37068
37208
|
}
|
|
37069
37209
|
}
|
|
37070
37210
|
}, [showPolymerEditor]);
|
|
37211
|
+
useEffect(function () {
|
|
37212
|
+
if (ketcher && moleculesEditor && (macromoleculesEditor || props.disableMacromoleculesEditor)) {
|
|
37213
|
+
var _props$onInit;
|
|
37214
|
+
(_props$onInit = props.onInit) === null || _props$onInit === void 0 || _props$onInit.call(props, ketcher);
|
|
37215
|
+
}
|
|
37216
|
+
}, [moleculesEditor, macromoleculesEditor]);
|
|
37071
37217
|
var onInitMoleculesEditor = function onInitMoleculesEditor(ketcher) {
|
|
37072
|
-
|
|
37073
|
-
(_props$onInit = props.onInit) === null || _props$onInit === void 0 || _props$onInit.call(props, ketcher);
|
|
37218
|
+
setKetcher(ketcher);
|
|
37074
37219
|
setMoleculesEditor(ketcher.editor);
|
|
37075
37220
|
};
|
|
37076
37221
|
var onInitMacromoleculesEditor = function onInitMacromoleculesEditor(macromoleculesEditor) {
|
|
@@ -37109,5 +37254,5 @@ var Editor = function Editor(props) {
|
|
|
37109
37254
|
});
|
|
37110
37255
|
};
|
|
37111
37256
|
|
|
37112
|
-
export { ACS_STYLE_DEFAULT_SETTINGS, Accordion$1 as Accordion, AmbiguousMonomerPreview, appContext as AppContext, Button, Container, Content, ContentLine, Dialog, Editor,
|
|
37257
|
+
export { ACS_STYLE_DEFAULT_SETTINGS, Accordion$1 as Accordion, AmbiguousMonomerPreview, appContext as AppContext, ArrowScroll, Button, Container, Content, ContentLine, Dialog, Editor, Header$1 as Header, Icon, IconButton, IconButtonCustomIcon, IndigoProvider, InfoModal$1 as InfoModal, Input$2 as Input, KETCHER_ROOT_NODE_CLASS_NAME, KETCHER_ROOT_NODE_CSS_SELECTOR, MODES, MonomerName, PresetPosition, PreviewType, RatioBar, STRUCT_SERVICE_INITIALIZED_EVENT, STRUCT_SERVICE_NO_RENDER_INITIALIZED_EVENT, STRUCT_TYPE, StructRender, calculateAmbiguousMonomerPreviewLeft, calculateAmbiguousMonomerPreviewTop, calculateBondPreviewPosition, calculateMonomerPreviewTop, calculateNucleoElementPreviewTop, getIconName, ketcherInitEventName, preview, usePortalStyle };
|
|
37113
37258
|
//# sourceMappingURL=index.js.map
|