ketcher-react 2.8.0-rc.5 → 2.8.0

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.
@@ -2928,7 +2928,10 @@ var templateLib = {
2928
2928
  shortcut: 'Shift+t',
2929
2929
  title: 'Custom Templates',
2930
2930
  action: {
2931
- dialog: 'templates'
2931
+ dialog: 'templates',
2932
+ prop: {
2933
+ tab: null
2934
+ }
2932
2935
  },
2933
2936
  selected: function selected(editor) {
2934
2937
  return editor._tool.mode === 'classic';
@@ -3008,7 +3011,7 @@ var zoom = {
3008
3011
 
3009
3012
  var openHelpLink = function openHelpLink() {
3010
3013
  var _window$open;
3011
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.8.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3014
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.8.0\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3012
3015
  };
3013
3016
  var help = {
3014
3017
  help: {
@@ -14252,25 +14255,28 @@ var TemplateTool = function () {
14252
14255
  });
14253
14256
  return true;
14254
14257
  }
14255
- var action;
14258
+ var action, functionalGroupRemoveAction;
14256
14259
  var pasteItems = null;
14257
14260
  if (SGroup.isSaltOrSolvent(this.template.molecule.name)) {
14258
14261
  addSaltsAndSolventsOnCanvasWithoutMerge(restruct, this.template, dragCtx, this.editor);
14259
14262
  return true;
14260
14263
  } else if (((_ci = ci) === null || _ci === void 0 ? void 0 : _ci.map) === 'functionalGroups' && FunctionalGroup.isContractedFunctionalGroup(ci.id, functionalGroups) && this.mode === 'fg') {
14264
+ functionalGroupRemoveAction = new Action();
14261
14265
  var _struct = this.editor.struct();
14262
- var closestGroup = _struct.sgroups.get(ci.id);
14263
- var attachmentAtomId = closestGroup.getAttAtomId(_struct);
14266
+ var _restruct = this.editor.render.ctab;
14267
+ var functionalGroupToReplace = _struct.sgroups.get(ci.id);
14268
+ var attachmentAtomId = functionalGroupToReplace.getAttAtomId(_struct);
14269
+ var atomsWithoutAttachmentAtom = SGroup.getAtoms(_struct, functionalGroupToReplace).filter(function (id) {
14270
+ return id !== attachmentAtomId;
14271
+ });
14272
+ functionalGroupRemoveAction.mergeWith(fromSgroupDeletion(_restruct, ci.id));
14273
+ functionalGroupRemoveAction.mergeWith(fromFragmentDeletion(_restruct, {
14274
+ atoms: atomsWithoutAttachmentAtom
14275
+ }));
14264
14276
  ci = {
14265
14277
  map: 'atoms',
14266
14278
  id: attachmentAtomId
14267
14279
  };
14268
- this.editor.update(fromFragmentDeletion(this.editor.render.ctab, {
14269
- atoms: _toConsumableArray(SGroup.getAtoms(_struct, closestGroup)).filter(function (atomId) {
14270
- return atomId !== attachmentAtomId;
14271
- }),
14272
- bonds: _toConsumableArray(SGroup.getBonds(_struct, closestGroup))
14273
- }));
14274
14280
  }
14275
14281
  if (!dragCtx.action) {
14276
14282
  if (!ci) {
@@ -14302,6 +14308,9 @@ var TemplateTool = function () {
14302
14308
  var _fromTemplateOnAtom4 = _slicedToArray(_fromTemplateOnAtom3, 2);
14303
14309
  action = _fromTemplateOnAtom4[0];
14304
14310
  pasteItems = _fromTemplateOnAtom4[1];
14311
+ if (functionalGroupRemoveAction) {
14312
+ action = functionalGroupRemoveAction.mergeWith(action);
14313
+ }
14305
14314
  dragCtx.action = action;
14306
14315
  } else if (ci.map === 'bonds' && this.mode !== 'fg') {
14307
14316
  var _promise = fromTemplateOnBondAction(restruct, this.template, ci.id, this.editor.event, dragCtx.sign1 * dragCtx.sign2 > 0, true);
@@ -22700,19 +22709,15 @@ var TemplateDialog = function TemplateDialog(props) {
22700
22709
  onSelect = props.onSelect,
22701
22710
  rest = _objectWithoutProperties(props, _excluded2);
22702
22711
  var searchInputRef = useRef(null);
22703
- var _useState = useState(initialTab),
22712
+ var _useState = useState([props.group]),
22704
22713
  _useState2 = _slicedToArray(_useState, 2),
22705
- thisInitialTab = _useState2[0],
22706
- setThisInitialTab = _useState2[1];
22707
- var _useState3 = useState([props.group]),
22708
- _useState4 = _slicedToArray(_useState3, 2),
22709
- expandedAccordions = _useState4[0],
22710
- setExpandedAccordions = _useState4[1];
22714
+ expandedAccordions = _useState2[0],
22715
+ setExpandedAccordions = _useState2[1];
22711
22716
  var filteredSaltsAndSolvents = useSaltsAndSolvents(saltsAndSolvents, filter);
22712
- var _useState5 = useState(functionalGroups[FUNCTIONAL_GROUPS]),
22713
- _useState6 = _slicedToArray(_useState5, 2),
22714
- filteredFG = _useState6[0],
22715
- setFilteredFG = _useState6[1];
22717
+ var _useState3 = useState(functionalGroups[FUNCTIONAL_GROUPS]),
22718
+ _useState4 = _slicedToArray(_useState3, 2),
22719
+ filteredFG = _useState4[0],
22720
+ setFilteredFG = _useState4[1];
22716
22721
  var filteredTemplateLib = filterLibSelector(props);
22717
22722
  useEffect(function () {
22718
22723
  setFilteredFG(filterFGLib(functionalGroups, filter)[FUNCTIONAL_GROUPS]);
@@ -22722,6 +22727,11 @@ var TemplateDialog = function TemplateDialog(props) {
22722
22727
  (_searchInputRef$curre = searchInputRef.current) === null || _searchInputRef$curre === void 0 ? void 0 : _searchInputRef$curre.focus();
22723
22728
  onSelect(null);
22724
22729
  }, [tab, onSelect]);
22730
+ useEffect(function () {
22731
+ if (initialTab !== null) {
22732
+ onTabChange(initialTab);
22733
+ }
22734
+ }, [initialTab, onTabChange]);
22725
22735
  var handleAccordionChange = function handleAccordionChange(accordion) {
22726
22736
  return function (_, isExpanded) {
22727
22737
  setExpandedAccordions(isExpanded ? [].concat(_toConsumableArray(expandedAccordions), [accordion]) : _toConsumableArray(expandedAccordions).filter(function (expandedAccordion) {
@@ -22730,7 +22740,6 @@ var TemplateDialog = function TemplateDialog(props) {
22730
22740
  };
22731
22741
  };
22732
22742
  var handleTabChange = function handleTabChange(value) {
22733
- setThisInitialTab(null);
22734
22743
  onTabChange(value);
22735
22744
  };
22736
22745
  var sdfSerializer = new SdfSerializer();
@@ -22767,7 +22776,7 @@ var TemplateDialog = function TemplateDialog(props) {
22767
22776
  className: classes$8.searchIcon
22768
22777
  })]
22769
22778
  }), jsxs(Tabs$1, {
22770
- value: thisInitialTab !== null ? initialTab : tab,
22779
+ value: tab,
22771
22780
  onChange: function onChange(_, value) {
22772
22781
  return handleTabChange(value);
22773
22782
  },
@@ -22782,7 +22791,7 @@ var TemplateDialog = function TemplateDialog(props) {
22782
22791
  }), jsxs("div", {
22783
22792
  className: classes$8.tabsContent,
22784
22793
  children: [jsx(TabPanel, {
22785
- value: thisInitialTab !== null ? initialTab : tab,
22794
+ value: tab,
22786
22795
  index: TemplateTabs.TemplateLibrary,
22787
22796
  children: jsx("div", {
22788
22797
  children: Object.keys(filteredTemplateLib).length ? Object.keys(filteredTemplateLib).map(function (groupName) {
@@ -22883,7 +22892,7 @@ var onModalClose = function onModalClose(props, dispatch) {
22883
22892
  var TemplatesDialog = connect(function (store) {
22884
22893
  var _store$modal, _store$modal$prop, _store$editor, _store$editor$render;
22885
22894
  return _objectSpread$4(_objectSpread$4({}, omit(['attach'], store.templates)), {}, {
22886
- initialTab: ((_store$modal = store.modal) === null || _store$modal === void 0 ? void 0 : (_store$modal$prop = _store$modal.prop) === null || _store$modal$prop === void 0 ? void 0 : _store$modal$prop.tab) || TemplateTabs.TemplateLibrary,
22895
+ initialTab: (_store$modal = store.modal) === null || _store$modal === void 0 ? void 0 : (_store$modal$prop = _store$modal.prop) === null || _store$modal$prop === void 0 ? void 0 : _store$modal$prop.tab,
22887
22896
  renderOptions: (_store$editor = store.editor) === null || _store$editor === void 0 ? void 0 : (_store$editor$render = _store$editor.render) === null || _store$editor$render === void 0 ? void 0 : _store$editor$render.options,
22888
22897
  functionalGroups: functionalGroupsSelector(store),
22889
22898
  saltsAndSolvents: saltsAndSolventsSelector(store)
@@ -23649,8 +23658,8 @@ var KetcherBuilder = function () {
23649
23658
  initApp(element, staticResourcesUrl, {
23650
23659
  buttons: buttons || {},
23651
23660
  errorHandler: errorHandler || null,
23652
- version: "2.8.0-rc.5" ,
23653
- buildDate: "2023-03-02T12:40:56" ,
23661
+ version: "2.8.0" ,
23662
+ buildDate: "2023-03-22T10:08:24" ,
23654
23663
  buildNumber: ''
23655
23664
  }, structService, resolve);
23656
23665
  });