ketcher-react 3.7.0-rc.1 → 3.7.0-rc.2
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 +263 -108
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{index.modern-5eda67eb.js → index.modern-c52e0e6a.js} +636 -210
- package/dist/cjs/index.modern-c52e0e6a.js.map +1 -0
- package/dist/cjs/script/editor/Editor.d.ts +1 -1
- package/dist/cjs/script/editor/tool/create-monomer.d.ts +1 -0
- 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 +254 -106
- package/dist/index.js.map +1 -1
- package/dist/{index.modern-eab54238.js → index.modern-43985e95.js} +637 -211
- package/dist/index.modern-43985e95.js.map +1 -0
- package/dist/script/editor/Editor.d.ts +1 -1
- package/dist/script/editor/tool/create-monomer.d.ts +1 -0
- 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.2\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
|
};
|
|
@@ -24071,6 +24084,10 @@ var CreateMonomerTool = function () {
|
|
|
24071
24084
|
value: function cancel() {
|
|
24072
24085
|
this.editor.closeMonomerCreationWizard();
|
|
24073
24086
|
}
|
|
24087
|
+
}, {
|
|
24088
|
+
key: "mousemove",
|
|
24089
|
+
value: function mousemove() {
|
|
24090
|
+
}
|
|
24074
24091
|
}]);
|
|
24075
24092
|
return CreateMonomerTool;
|
|
24076
24093
|
}();
|
|
@@ -25300,13 +25317,27 @@ var Editor$3 = function () {
|
|
|
25300
25317
|
}, {
|
|
25301
25318
|
key: "isMonomerCreationWizardEnabled",
|
|
25302
25319
|
get: function get() {
|
|
25303
|
-
var _selection$atoms,
|
|
25320
|
+
var _selection$atoms,
|
|
25321
|
+
_selection$bonds,
|
|
25322
|
+
_this = this;
|
|
25304
25323
|
if (this._monomerCreationState) {
|
|
25305
25324
|
return true;
|
|
25306
25325
|
}
|
|
25307
|
-
var selection = this.explicitSelected();
|
|
25326
|
+
var selection = this.explicitSelected(false);
|
|
25308
25327
|
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
25328
|
var currentStruct = this.render.ctab.molecule;
|
|
25329
|
+
var selectionInvalid = selection.atoms.some(function (atomId) {
|
|
25330
|
+
var atom = _this.render.ctab.molecule.atoms.get(atomId);
|
|
25331
|
+
if (!atom) {
|
|
25332
|
+
return false;
|
|
25333
|
+
}
|
|
25334
|
+
return atom.sgs.size > 0 || genericsList.includes(atom.label) || _this.render.ctab.molecule.rgroups.some(function (rgroup) {
|
|
25335
|
+
return rgroup.frags.has(atom.fragment);
|
|
25336
|
+
});
|
|
25337
|
+
});
|
|
25338
|
+
if (selectionInvalid) {
|
|
25339
|
+
return false;
|
|
25340
|
+
}
|
|
25310
25341
|
var isSelectionContinuous = Editor.isSelectionContinuous(selection, currentStruct);
|
|
25311
25342
|
if (!isSelectionContinuous) {
|
|
25312
25343
|
return false;
|
|
@@ -25315,9 +25346,12 @@ var Editor$3 = function () {
|
|
|
25315
25346
|
var bondsToOutside = currentStruct.bonds.filter(function (_, bond) {
|
|
25316
25347
|
return selectionAtoms.has(bond.begin) && !selectionAtoms.has(bond.end) || selectionAtoms.has(bond.end) && !selectionAtoms.has(bond.begin);
|
|
25317
25348
|
});
|
|
25318
|
-
|
|
25319
|
-
return bond.type
|
|
25320
|
-
})
|
|
25349
|
+
if (bondsToOutside.some(function (bond) {
|
|
25350
|
+
return bond.type !== Bond$2.PATTERN.TYPE.SINGLE;
|
|
25351
|
+
})) {
|
|
25352
|
+
return false;
|
|
25353
|
+
}
|
|
25354
|
+
this.singleBondsToOutsideOfSelection = bondsToOutside;
|
|
25321
25355
|
return this.singleBondsToOutsideOfSelection.size > 0 && this.singleBondsToOutsideOfSelection.size <= 8;
|
|
25322
25356
|
}
|
|
25323
25357
|
return false;
|
|
@@ -25326,7 +25360,7 @@ var Editor$3 = function () {
|
|
|
25326
25360
|
key: "openMonomerCreationWizard",
|
|
25327
25361
|
value: function openMonomerCreationWizard() {
|
|
25328
25362
|
var _selection$atoms2,
|
|
25329
|
-
|
|
25363
|
+
_this2 = this;
|
|
25330
25364
|
var currentStruct = this.render.ctab.molecule;
|
|
25331
25365
|
var selection = this.explicitSelected();
|
|
25332
25366
|
this.originalSelection = selection;
|
|
@@ -25338,7 +25372,7 @@ var Editor$3 = function () {
|
|
|
25338
25372
|
return a - b;
|
|
25339
25373
|
}).forEach(function (atomId, i) {
|
|
25340
25374
|
atomIdsMap.set(atomId, i);
|
|
25341
|
-
|
|
25375
|
+
_this2.atomIdsMap.set(i, atomId);
|
|
25342
25376
|
});
|
|
25343
25377
|
var attachmentPoints = new Map();
|
|
25344
25378
|
this.singleBondsToOutsideOfSelection.forEach(function (bond) {
|
|
@@ -25350,7 +25384,7 @@ var Editor$3 = function () {
|
|
|
25350
25384
|
pp: leavingAtom === null || leavingAtom === void 0 ? void 0 : leavingAtom.pp
|
|
25351
25385
|
});
|
|
25352
25386
|
var newLeavingAtomId = selectedStruct.atoms.add(newLeavingAtom);
|
|
25353
|
-
|
|
25387
|
+
_this2.atomIdsMap.set(newLeavingAtomId, leavingAtomId);
|
|
25354
25388
|
var bondEdgeForAttachmentAtom = bondEdgeForLeavingAtom === 'end' ? 'begin' : 'end';
|
|
25355
25389
|
var attachmentAtomId = bond[bondEdgeForAttachmentAtom];
|
|
25356
25390
|
var attachmentAtomIdInSelectedStruct = atomIdsMap.get(attachmentAtomId);
|
|
@@ -25364,10 +25398,10 @@ var Editor$3 = function () {
|
|
|
25364
25398
|
});
|
|
25365
25399
|
selectedStruct.bonds.add(newBond);
|
|
25366
25400
|
attachmentPoints.set(attachmentAtomIdInSelectedStruct, newLeavingAtomId);
|
|
25367
|
-
|
|
25401
|
+
_this2.atomIdsMap.set(attachmentAtomIdInSelectedStruct, attachmentAtomId);
|
|
25368
25402
|
});
|
|
25369
25403
|
this._monomerCreationState = {
|
|
25370
|
-
originalStruct: currentStruct
|
|
25404
|
+
originalStruct: currentStruct,
|
|
25371
25405
|
attachmentAtomIdToLeavingAtomId: attachmentPoints
|
|
25372
25406
|
};
|
|
25373
25407
|
this.render.monomerCreationRenderState = {
|
|
@@ -25389,6 +25423,8 @@ var Editor$3 = function () {
|
|
|
25389
25423
|
}, {
|
|
25390
25424
|
key: "saveNewMonomer",
|
|
25391
25425
|
value: function saveNewMonomer(data) {
|
|
25426
|
+
var _this$originalSelecti,
|
|
25427
|
+
_this3 = this;
|
|
25392
25428
|
if (!this._monomerCreationState) {
|
|
25393
25429
|
throw new Error('Monomer creation wizard is not active, cannot save new monomer');
|
|
25394
25430
|
}
|
|
@@ -25412,6 +25448,7 @@ var Editor$3 = function () {
|
|
|
25412
25448
|
var monomerId = "".concat(symbol, "___").concat(name);
|
|
25413
25449
|
var monomerRef = setMonomerTemplatePrefix(monomerId);
|
|
25414
25450
|
var monomerHELMClass = getHELMClassByKetMonomerClass(type);
|
|
25451
|
+
var naturalAnalogueToUse = fillNaturalAnalogueForPhosphateAndSugar(naturalAnalogue, type);
|
|
25415
25452
|
var monomerTemplate = {
|
|
25416
25453
|
type: KetTemplateType.MONOMER_TEMPLATE,
|
|
25417
25454
|
id: monomerId,
|
|
@@ -25419,8 +25456,8 @@ var Editor$3 = function () {
|
|
|
25419
25456
|
classHELM: monomerHELMClass,
|
|
25420
25457
|
alias: symbol,
|
|
25421
25458
|
fullName: name,
|
|
25422
|
-
naturalAnalogShort:
|
|
25423
|
-
atoms: ketMicromolecule.mol0.atoms,
|
|
25459
|
+
naturalAnalogShort: naturalAnalogueToUse,
|
|
25460
|
+
atoms: normalizeMonomerAtomsPositions(ketMicromolecule.mol0.atoms),
|
|
25424
25461
|
bonds: ketMicromolecule.mol0.bonds,
|
|
25425
25462
|
attachmentPoints: attachmentPoints,
|
|
25426
25463
|
root: {
|
|
@@ -25445,9 +25482,24 @@ var Editor$3 = function () {
|
|
|
25445
25482
|
var monomerPosition = new Vec2((this.selectionBBox.min.x + this.selectionBBox.max.x) / 2, (this.selectionBBox.min.y + this.selectionBBox.max.y) / 2);
|
|
25446
25483
|
var monomer = new Monomer(monomerItem, monomerPosition);
|
|
25447
25484
|
this.closeMonomerCreationWizard();
|
|
25485
|
+
var sGroupAttachmentPoints = MacromoleculesConverter.convertMonomerAttachmentPointsToSGroupAttachmentPoints(monomer, this.atomIdsMap);
|
|
25486
|
+
this.singleBondsToOutsideOfSelection.forEach(function (bond) {
|
|
25487
|
+
var attachmentPointToBond = sGroupAttachmentPoints.find(function (point) {
|
|
25488
|
+
return point.atomId === bond.begin || point.atomId === bond.end;
|
|
25489
|
+
});
|
|
25490
|
+
if (attachmentPointToBond) {
|
|
25491
|
+
bond.beginSuperatomAttachmentPointNumber = attachmentPointToBond.attachmentPointNumber;
|
|
25492
|
+
}
|
|
25493
|
+
});
|
|
25448
25494
|
var action = fromSgroupAddition(this.render.ctab, SGroup$1.TYPES.SUP, this.originalSelection.atoms, {
|
|
25449
25495
|
expanded: true
|
|
25450
|
-
}, this.render.ctab.molecule.sgroups.newId(),
|
|
25496
|
+
}, this.render.ctab.molecule.sgroups.newId(), sGroupAttachmentPoints, monomer.position, true, monomer.monomerItem.props.MonomerName, null, monomer);
|
|
25497
|
+
(_this$originalSelecti = this.originalSelection.atoms) === null || _this$originalSelecti === void 0 || _this$originalSelecti.forEach(function (atomId) {
|
|
25498
|
+
var atom = _this3.render.ctab.molecule.atoms.get(atomId);
|
|
25499
|
+
if (atom) {
|
|
25500
|
+
atom.fragment = -1;
|
|
25501
|
+
}
|
|
25502
|
+
});
|
|
25451
25503
|
this.update(action);
|
|
25452
25504
|
}
|
|
25453
25505
|
}, {
|
|
@@ -25635,6 +25687,11 @@ var Editor$3 = function () {
|
|
|
25635
25687
|
ketcherProvider.getKetcher(this.ketcherId).changeEvent.add(subscribeFuncWrapper);
|
|
25636
25688
|
break;
|
|
25637
25689
|
}
|
|
25690
|
+
case 'libraryUpdate':
|
|
25691
|
+
{
|
|
25692
|
+
ketcherProvider.getKetcher(this.ketcherId).libraryUpdateEvent.add(handler);
|
|
25693
|
+
break;
|
|
25694
|
+
}
|
|
25638
25695
|
default:
|
|
25639
25696
|
this.event[eventName].add(handler);
|
|
25640
25697
|
}
|
|
@@ -25660,6 +25717,7 @@ var Editor$3 = function () {
|
|
|
25660
25717
|
}, {
|
|
25661
25718
|
key: "explicitSelected",
|
|
25662
25719
|
value: function explicitSelected() {
|
|
25720
|
+
var autoSelectBonds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
25663
25721
|
var selection = this.selection() || {};
|
|
25664
25722
|
var res = structObjects.reduce(function (acc, key) {
|
|
25665
25723
|
acc[key] = selection[key] ? selection[key].slice() : [];
|
|
@@ -25680,7 +25738,7 @@ var Editor$3 = function () {
|
|
|
25680
25738
|
}
|
|
25681
25739
|
});
|
|
25682
25740
|
}
|
|
25683
|
-
if (res.atoms && res.bonds) {
|
|
25741
|
+
if (autoSelectBonds && res.atoms && res.bonds) {
|
|
25684
25742
|
struct.bonds.forEach(function (bond, bid) {
|
|
25685
25743
|
if (res.bonds.indexOf(bid) < 0 && res.atoms.indexOf(bond.begin) >= 0 && res.atoms.indexOf(bond.end) >= 0) {
|
|
25686
25744
|
res.bonds = res.bonds || [];
|
|
@@ -27631,6 +27689,47 @@ function getMenuPropsForSelection(selection, selectedFunctionalGroups, ketcherId
|
|
|
27631
27689
|
}
|
|
27632
27690
|
}
|
|
27633
27691
|
|
|
27692
|
+
var MonomerTypeSelectConfig = [{
|
|
27693
|
+
value: KetMonomerClass.AminoAcid,
|
|
27694
|
+
label: 'Amino acid',
|
|
27695
|
+
iconName: 'peptide'
|
|
27696
|
+
}, {
|
|
27697
|
+
value: KetMonomerClass.Sugar,
|
|
27698
|
+
label: 'Sugar',
|
|
27699
|
+
iconName: 'sugar'
|
|
27700
|
+
}, {
|
|
27701
|
+
value: KetMonomerClass.Base,
|
|
27702
|
+
label: 'Base',
|
|
27703
|
+
iconName: 'base'
|
|
27704
|
+
}, {
|
|
27705
|
+
value: KetMonomerClass.Phosphate,
|
|
27706
|
+
label: 'Phosphate',
|
|
27707
|
+
iconName: 'phosphate'
|
|
27708
|
+
}, {
|
|
27709
|
+
value: KetMonomerClass.RNA,
|
|
27710
|
+
label: 'Nucleotide',
|
|
27711
|
+
iconName: 'nucleotide'
|
|
27712
|
+
}, {
|
|
27713
|
+
value: KetMonomerClass.CHEM,
|
|
27714
|
+
label: 'CHEM',
|
|
27715
|
+
iconName: 'chem'
|
|
27716
|
+
}];
|
|
27717
|
+
var NotificationMessages = {
|
|
27718
|
+
defaultAttachmentPoints: 'Attachment points are set by default with hydrogens as leaving groups.',
|
|
27719
|
+
emptyMandatoryFields: 'Mandatory fields must be filled.',
|
|
27720
|
+
invalidSymbol: 'The monomer symbol must consist only of uppercase and lowercase letters, numbers, hyphens (-), underscores (_), and asterisks (*).',
|
|
27721
|
+
symbolExists: 'The symbol must be unique amongst peptide, RNA, or CHEM monomers.',
|
|
27722
|
+
editingIsNotAllowed: 'Editing of the structure is not allowed.'
|
|
27723
|
+
};
|
|
27724
|
+
var NotificationTypes = {
|
|
27725
|
+
defaultAttachmentPoints: 'info',
|
|
27726
|
+
emptyMandatoryFields: 'error',
|
|
27727
|
+
invalidSymbol: 'error',
|
|
27728
|
+
symbolExists: 'error',
|
|
27729
|
+
editingIsNotAllowed: 'error'
|
|
27730
|
+
};
|
|
27731
|
+
var MonomerCreationExternalNotificationAction = 'MonomerCreationExternalNotification';
|
|
27732
|
+
|
|
27634
27733
|
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
27734
|
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
27735
|
var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
|
|
@@ -27663,6 +27762,12 @@ var ContextMenuTrigger = function ContextMenuTrigger(_ref) {
|
|
|
27663
27762
|
event.preventDefault();
|
|
27664
27763
|
var ketcher = ketcherProvider.getKetcher(ketcherId);
|
|
27665
27764
|
var editor = ketcher.editor;
|
|
27765
|
+
if (editor.monomerCreationState !== null) {
|
|
27766
|
+
window.dispatchEvent(new CustomEvent(MonomerCreationExternalNotificationAction, {
|
|
27767
|
+
detail: 'editingIsNotAllowed'
|
|
27768
|
+
}));
|
|
27769
|
+
return;
|
|
27770
|
+
}
|
|
27666
27771
|
if (editor.render.options.viewOnlyMode) {
|
|
27667
27772
|
return;
|
|
27668
27773
|
}
|
|
@@ -28096,7 +28201,8 @@ var Select$1 = function Select(_ref2) {
|
|
|
28096
28201
|
formName = _ref2.formName,
|
|
28097
28202
|
name = _ref2.name,
|
|
28098
28203
|
placeholder = _ref2.placeholder,
|
|
28099
|
-
testId = _ref2['data-testid']
|
|
28204
|
+
testId = _ref2['data-testid'],
|
|
28205
|
+
error = _ref2.error;
|
|
28100
28206
|
var _useState = useState(),
|
|
28101
28207
|
_useState2 = _slicedToArray$1(_useState, 2),
|
|
28102
28208
|
currentValue = _useState2[0],
|
|
@@ -28125,6 +28231,7 @@ var Select$1 = function Select(_ref2) {
|
|
|
28125
28231
|
},
|
|
28126
28232
|
IconComponent: ChevronIcon$1,
|
|
28127
28233
|
"data-testid": testId,
|
|
28234
|
+
error: error,
|
|
28128
28235
|
children: options && options.map(function (option) {
|
|
28129
28236
|
var _option$children;
|
|
28130
28237
|
var isDivider = typeof (option === null || option === void 0 ? void 0 : option.value) === 'string' ? option.value.includes('Divider') : false;
|
|
@@ -28295,7 +28402,8 @@ var NaturalAnaloguePicker = function NaturalAnaloguePicker(_ref2) {
|
|
|
28295
28402
|
var monomerType = _ref2.monomerType,
|
|
28296
28403
|
value = _ref2.value,
|
|
28297
28404
|
onChange = _ref2.onChange,
|
|
28298
|
-
className = _ref2.className
|
|
28405
|
+
className = _ref2.className,
|
|
28406
|
+
error = _ref2.error;
|
|
28299
28407
|
var disabled = !isNaturalAnalogueRequired(monomerType);
|
|
28300
28408
|
var options = monomerType === KetMonomerClass.AminoAcid ? aminoAcidOptions : rnaOptions;
|
|
28301
28409
|
var renderValue = useCallback(function (selected) {
|
|
@@ -28339,6 +28447,7 @@ var NaturalAnaloguePicker = function NaturalAnaloguePicker(_ref2) {
|
|
|
28339
28447
|
IconComponent: ChevronIcon,
|
|
28340
28448
|
"data-testid": "natural-analogue-picker",
|
|
28341
28449
|
disabled: disabled,
|
|
28450
|
+
error: error,
|
|
28342
28451
|
children: options.map(function (option) {
|
|
28343
28452
|
return jsx(MenuItem, {
|
|
28344
28453
|
value: option.value,
|
|
@@ -28383,7 +28492,7 @@ var AttributeField = function AttributeField(_ref) {
|
|
|
28383
28492
|
});
|
|
28384
28493
|
};
|
|
28385
28494
|
|
|
28386
|
-
var styles$f = {"notification":"Notification-module_notification__yHqXk","notificationStrip":"Notification-module_notificationStrip__gSCg2","info":"Notification-module_info__M2qqL","
|
|
28495
|
+
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
28496
|
|
|
28388
28497
|
var iconMap = {
|
|
28389
28498
|
info: 'checkFilled',
|
|
@@ -28420,37 +28529,6 @@ var Notification = function Notification(_ref) {
|
|
|
28420
28529
|
|
|
28421
28530
|
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
28531
|
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
28532
|
var initialWizardState = {
|
|
28455
28533
|
values: {
|
|
28456
28534
|
type: undefined,
|
|
@@ -28461,7 +28539,7 @@ var initialWizardState = {
|
|
|
28461
28539
|
errors: {},
|
|
28462
28540
|
notifications: new Map([['defaultAttachmentPoints', {
|
|
28463
28541
|
type: 'info',
|
|
28464
|
-
message:
|
|
28542
|
+
message: NotificationMessages.defaultAttachmentPoints
|
|
28465
28543
|
}]])
|
|
28466
28544
|
};
|
|
28467
28545
|
var wizardReducer = function wizardReducer(state, action) {
|
|
@@ -28470,8 +28548,12 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28470
28548
|
{
|
|
28471
28549
|
var fieldId = action.fieldId,
|
|
28472
28550
|
value = action.value;
|
|
28551
|
+
var values = _objectSpread$H(_objectSpread$H({}, state.values), {}, _defineProperty$1({}, fieldId, value));
|
|
28552
|
+
if (fieldId === 'type') {
|
|
28553
|
+
values.naturalAnalogue = '';
|
|
28554
|
+
}
|
|
28473
28555
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28474
|
-
values:
|
|
28556
|
+
values: values,
|
|
28475
28557
|
errors: _objectSpread$H(_objectSpread$H({}, state.errors), {}, _defineProperty$1({}, fieldId, undefined))
|
|
28476
28558
|
});
|
|
28477
28559
|
}
|
|
@@ -28487,6 +28569,20 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28487
28569
|
notifications: new Map([].concat(_toConsumableArray(state.notifications), _toConsumableArray(action.notifications)))
|
|
28488
28570
|
});
|
|
28489
28571
|
}
|
|
28572
|
+
case 'AddNotification':
|
|
28573
|
+
{
|
|
28574
|
+
var notifications = new Map(state.notifications);
|
|
28575
|
+
var id = action.id;
|
|
28576
|
+
if (!notifications.has(id)) {
|
|
28577
|
+
notifications.set(id, {
|
|
28578
|
+
type: NotificationTypes[id],
|
|
28579
|
+
message: NotificationMessages[id]
|
|
28580
|
+
});
|
|
28581
|
+
}
|
|
28582
|
+
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28583
|
+
notifications: notifications
|
|
28584
|
+
});
|
|
28585
|
+
}
|
|
28490
28586
|
case 'ResetErrors':
|
|
28491
28587
|
{
|
|
28492
28588
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
@@ -28499,10 +28595,10 @@ var wizardReducer = function wizardReducer(state, action) {
|
|
|
28499
28595
|
}
|
|
28500
28596
|
case 'RemoveNotification':
|
|
28501
28597
|
{
|
|
28502
|
-
var
|
|
28503
|
-
|
|
28598
|
+
var _notifications = new Map(state.notifications);
|
|
28599
|
+
_notifications["delete"](action.id);
|
|
28504
28600
|
return _objectSpread$H(_objectSpread$H({}, state), {}, {
|
|
28505
|
-
notifications:
|
|
28601
|
+
notifications: _notifications
|
|
28506
28602
|
});
|
|
28507
28603
|
}
|
|
28508
28604
|
default:
|
|
@@ -28521,7 +28617,7 @@ var validateInputs = function validateInputs(values) {
|
|
|
28521
28617
|
errors[key] = true;
|
|
28522
28618
|
notifications.set('emptyMandatoryFields', {
|
|
28523
28619
|
type: 'error',
|
|
28524
|
-
message:
|
|
28620
|
+
message: NotificationMessages.emptyMandatoryFields
|
|
28525
28621
|
});
|
|
28526
28622
|
}
|
|
28527
28623
|
return;
|
|
@@ -28532,7 +28628,16 @@ var validateInputs = function validateInputs(values) {
|
|
|
28532
28628
|
errors[key] = true;
|
|
28533
28629
|
notifications.set('invalidSymbol', {
|
|
28534
28630
|
type: 'error',
|
|
28535
|
-
message:
|
|
28631
|
+
message: NotificationMessages.invalidSymbol
|
|
28632
|
+
});
|
|
28633
|
+
return;
|
|
28634
|
+
}
|
|
28635
|
+
var editor = CoreEditor.provideEditorInstance();
|
|
28636
|
+
if (editor.checkIfMonomerSymbolClassPairExists(value, values.type)) {
|
|
28637
|
+
errors[key] = true;
|
|
28638
|
+
notifications.set('symbolExists', {
|
|
28639
|
+
type: 'error',
|
|
28640
|
+
message: NotificationMessages.symbolExists
|
|
28536
28641
|
});
|
|
28537
28642
|
}
|
|
28538
28643
|
}
|
|
@@ -28555,6 +28660,21 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28555
28660
|
symbol = values.symbol,
|
|
28556
28661
|
name = values.name,
|
|
28557
28662
|
naturalAnalogue = values.naturalAnalogue;
|
|
28663
|
+
useEffect(function () {
|
|
28664
|
+
var externalNotificationEventListener = function externalNotificationEventListener(event) {
|
|
28665
|
+
var notificationId = event.detail;
|
|
28666
|
+
if (notificationId) {
|
|
28667
|
+
wizardStateDispatch({
|
|
28668
|
+
type: 'AddNotification',
|
|
28669
|
+
id: notificationId
|
|
28670
|
+
});
|
|
28671
|
+
}
|
|
28672
|
+
};
|
|
28673
|
+
window.addEventListener(MonomerCreationExternalNotificationAction, externalNotificationEventListener);
|
|
28674
|
+
return function () {
|
|
28675
|
+
window.removeEventListener(MonomerCreationExternalNotificationAction, externalNotificationEventListener);
|
|
28676
|
+
};
|
|
28677
|
+
}, []);
|
|
28558
28678
|
var handleFieldChange = function handleFieldChange(fieldId, value) {
|
|
28559
28679
|
if (fieldId === 'type') {
|
|
28560
28680
|
wizardStateDispatch({
|
|
@@ -28659,13 +28779,14 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28659
28779
|
children: [jsx(AttributeField, {
|
|
28660
28780
|
title: "Type",
|
|
28661
28781
|
control: jsx(Select$1, {
|
|
28662
|
-
className:
|
|
28782
|
+
className: styles$j.input,
|
|
28663
28783
|
options: monomerTypeSelectOptions,
|
|
28664
28784
|
placeholder: "Select monomer type",
|
|
28665
28785
|
value: type,
|
|
28666
28786
|
onChange: function onChange(value) {
|
|
28667
28787
|
return handleFieldChange('type', value);
|
|
28668
|
-
}
|
|
28788
|
+
},
|
|
28789
|
+
error: errors.type
|
|
28669
28790
|
}),
|
|
28670
28791
|
required: true
|
|
28671
28792
|
}), jsx(AttributeField, {
|
|
@@ -28673,7 +28794,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28673
28794
|
control: jsx("input", {
|
|
28674
28795
|
type: "text",
|
|
28675
28796
|
className: clsx(styles$j.input, errors.symbol && styles$j.error),
|
|
28676
|
-
placeholder: "
|
|
28797
|
+
placeholder: "e.g. PEG-2",
|
|
28677
28798
|
value: symbol,
|
|
28678
28799
|
onChange: function onChange(event) {
|
|
28679
28800
|
return handleFieldChange('symbol', event.target.value);
|
|
@@ -28685,7 +28806,7 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28685
28806
|
control: jsx("input", {
|
|
28686
28807
|
type: "text",
|
|
28687
28808
|
className: clsx(styles$j.input, errors.name && styles$j.error),
|
|
28688
|
-
placeholder: "
|
|
28809
|
+
placeholder: "e.g. Diethylene Glycol",
|
|
28689
28810
|
value: name,
|
|
28690
28811
|
onChange: function onChange(event) {
|
|
28691
28812
|
return handleFieldChange('name', event.target.value);
|
|
@@ -28695,12 +28816,12 @@ var MonomerCreationWizard = function MonomerCreationWizard() {
|
|
|
28695
28816
|
}), jsx(AttributeField, {
|
|
28696
28817
|
title: "Natural analogue",
|
|
28697
28818
|
control: jsx(NaturalAnaloguePicker, {
|
|
28698
|
-
className: clsx(errors.type && styles$j.error),
|
|
28699
28819
|
monomerType: type,
|
|
28700
28820
|
value: naturalAnalogue,
|
|
28701
28821
|
onChange: function onChange(value) {
|
|
28702
28822
|
return handleFieldChange('naturalAnalogue', value);
|
|
28703
|
-
}
|
|
28823
|
+
},
|
|
28824
|
+
error: errors.naturalAnalogue
|
|
28704
28825
|
}),
|
|
28705
28826
|
disabled: !isNaturalAnalogueRequired(type),
|
|
28706
28827
|
required: true
|
|
@@ -36730,8 +36851,8 @@ var KetcherBuilder = function () {
|
|
|
36730
36851
|
cleanup = initApp(prevKetcherId, ketcherId, element, appRoot, staticResourcesUrl, {
|
|
36731
36852
|
buttons: buttons || {},
|
|
36732
36853
|
errorHandler: errorHandler || null,
|
|
36733
|
-
version: "3.7.0-rc.
|
|
36734
|
-
buildDate: "2025-08-
|
|
36854
|
+
version: "3.7.0-rc.2" ,
|
|
36855
|
+
buildDate: "2025-08-20T17:19:11" ,
|
|
36735
36856
|
buildNumber: '',
|
|
36736
36857
|
customButtons: customButtons || []
|
|
36737
36858
|
}, structService, resolve, togglerComponent);
|
|
@@ -37026,7 +37147,7 @@ var ModeControl = function ModeControl(_ref3) {
|
|
|
37026
37147
|
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
37148
|
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
37149
|
var MacromoleculesEditorComponent = lazy(function () {
|
|
37029
|
-
return import('./index.modern-
|
|
37150
|
+
return import('./index.modern-43985e95.js');
|
|
37030
37151
|
});
|
|
37031
37152
|
var Editor = function Editor(props) {
|
|
37032
37153
|
var _useState = useState(false),
|
|
@@ -37039,12 +37160,16 @@ var Editor = function Editor(props) {
|
|
|
37039
37160
|
setMoleculesEditor = _useState4[1];
|
|
37040
37161
|
var _useState5 = useState(),
|
|
37041
37162
|
_useState6 = _slicedToArray$1(_useState5, 2),
|
|
37042
|
-
|
|
37043
|
-
|
|
37044
|
-
var _useState7 = useState(
|
|
37163
|
+
ketcher = _useState6[0],
|
|
37164
|
+
setKetcher = _useState6[1];
|
|
37165
|
+
var _useState7 = useState(),
|
|
37045
37166
|
_useState8 = _slicedToArray$1(_useState7, 2),
|
|
37046
|
-
|
|
37047
|
-
|
|
37167
|
+
macromoleculesEditor = _useState8[0],
|
|
37168
|
+
setMacromoleculesEditor = _useState8[1];
|
|
37169
|
+
var _useState9 = useState(''),
|
|
37170
|
+
_useState10 = _slicedToArray$1(_useState9, 2),
|
|
37171
|
+
ketcherId = _useState10[0],
|
|
37172
|
+
setKetcherId = _useState10[1];
|
|
37048
37173
|
var togglePolymerEditor = function togglePolymerEditor(toggleValue) {
|
|
37049
37174
|
setShowPolymerEditor(toggleValue);
|
|
37050
37175
|
window.isPolymerEditorTurnedOn = toggleValue;
|
|
@@ -37053,6 +37178,24 @@ var Editor = function Editor(props) {
|
|
|
37053
37178
|
toggle: togglePolymerEditor,
|
|
37054
37179
|
isPolymerEditor: showPolymerEditor
|
|
37055
37180
|
}) : undefined;
|
|
37181
|
+
useEffect(function () {
|
|
37182
|
+
var switchToMacromoleculesModeHandler = function switchToMacromoleculesModeHandler() {
|
|
37183
|
+
togglePolymerEditor(true);
|
|
37184
|
+
};
|
|
37185
|
+
var switchToMoleculesModeHandler = function switchToMoleculesModeHandler() {
|
|
37186
|
+
togglePolymerEditor(false);
|
|
37187
|
+
};
|
|
37188
|
+
if (macromoleculesEditor) {
|
|
37189
|
+
macromoleculesEditor.events.switchToMacromoleculesMode.add(switchToMacromoleculesModeHandler);
|
|
37190
|
+
macromoleculesEditor.events.switchToMoleculesMode.add(switchToMoleculesModeHandler);
|
|
37191
|
+
}
|
|
37192
|
+
return function () {
|
|
37193
|
+
if (macromoleculesEditor) {
|
|
37194
|
+
macromoleculesEditor.events.switchToMacromoleculesMode.remove(switchToMacromoleculesModeHandler);
|
|
37195
|
+
macromoleculesEditor.events.switchToMoleculesMode.remove(switchToMoleculesModeHandler);
|
|
37196
|
+
}
|
|
37197
|
+
};
|
|
37198
|
+
}, [macromoleculesEditor]);
|
|
37056
37199
|
useEffect(function () {
|
|
37057
37200
|
return function () {
|
|
37058
37201
|
window.isPolymerEditorTurnedOn = false;
|
|
@@ -37068,9 +37211,14 @@ var Editor = function Editor(props) {
|
|
|
37068
37211
|
}
|
|
37069
37212
|
}
|
|
37070
37213
|
}, [showPolymerEditor]);
|
|
37214
|
+
useEffect(function () {
|
|
37215
|
+
if (ketcher && moleculesEditor && (macromoleculesEditor || props.disableMacromoleculesEditor)) {
|
|
37216
|
+
var _props$onInit;
|
|
37217
|
+
(_props$onInit = props.onInit) === null || _props$onInit === void 0 || _props$onInit.call(props, ketcher);
|
|
37218
|
+
}
|
|
37219
|
+
}, [moleculesEditor, macromoleculesEditor]);
|
|
37071
37220
|
var onInitMoleculesEditor = function onInitMoleculesEditor(ketcher) {
|
|
37072
|
-
|
|
37073
|
-
(_props$onInit = props.onInit) === null || _props$onInit === void 0 || _props$onInit.call(props, ketcher);
|
|
37221
|
+
setKetcher(ketcher);
|
|
37074
37222
|
setMoleculesEditor(ketcher.editor);
|
|
37075
37223
|
};
|
|
37076
37224
|
var onInitMacromoleculesEditor = function onInitMacromoleculesEditor(macromoleculesEditor) {
|
|
@@ -37109,5 +37257,5 @@ var Editor = function Editor(props) {
|
|
|
37109
37257
|
});
|
|
37110
37258
|
};
|
|
37111
37259
|
|
|
37112
|
-
export { ACS_STYLE_DEFAULT_SETTINGS, Accordion$1 as Accordion, AmbiguousMonomerPreview, appContext as AppContext, Button, Container, Content, ContentLine, Dialog, Editor,
|
|
37260
|
+
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
37261
|
//# sourceMappingURL=index.js.map
|