ketcher-react 2.18.0-rc.5 → 2.18.0-rc.6

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.
@@ -3595,7 +3595,7 @@ var zoom = {
3595
3595
 
3596
3596
  var openHelpLink = function openHelpLink() {
3597
3597
  var _window$open;
3598
- return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.18.0-rc.5\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3598
+ return (_window$open = window.open("https://github.com/epam/ketcher/blob/".concat("v2.18.0-rc.6\n", "/documentation/help.md#ketcher-overview"))) === null || _window$open === void 0 ? void 0 : _window$open.focus();
3599
3599
  };
3600
3600
  var help = {
3601
3601
  help: {
@@ -9014,9 +9014,11 @@ function throughFileReader(file) {
9014
9014
  cfb.FullPaths.forEach(function (path) {
9015
9015
  if (path.endsWith('.bin')) {
9016
9016
  var ole = CFB.find(cfb, path);
9017
- var sdf = CFB.find(CFB.parse(ole.content), 'CONTENTS');
9018
- var base64String = arrayBufferToBase64(sdf.content);
9019
- structures.push(base64String);
9017
+ var sdf = CFB.find(CFB.parse(ole === null || ole === void 0 ? void 0 : ole.content), 'CONTENTS');
9018
+ var base64String = arrayBufferToBase64(sdf === null || sdf === void 0 ? void 0 : sdf.content);
9019
+ if (base64String.startsWith('VmpDRDAxMDAEAw')) {
9020
+ structures.push(base64String);
9021
+ }
9020
9022
  }
9021
9023
  });
9022
9024
  content = {
@@ -28608,7 +28610,7 @@ var mapStateToProps$6 = function mapStateToProps(state) {
28608
28610
  };
28609
28611
  var RgroupLogicContainer = connect(mapStateToProps$6)(RgroupLogic);
28610
28612
 
28611
- var classes$n = {"button-common-styles":"Open-module_button-common-styles__NBSQP","scrollbar":"Open-module_scrollbar__sRvYM","open":"Open-module_open__m8V9g","textareaEditor":"Open-module_textareaEditor__ZbEVj","footerContent":"Open-module_footerContent__Q0hTw","buttonsContainer":"Open-module_buttonsContainer__L1HqU","openButton":"Open-module_openButton__cj3oU","cancelButton":"Open-module_cancelButton__0TQzA","copyButton":"Open-module_copyButton__KlXKd"};
28613
+ var classes$n = {"button-common-styles":"Open-module_button-common-styles__NBSQP","scrollbar":"Open-module_scrollbar__sRvYM","open":"Open-module_open__m8V9g","textareaEditor":"Open-module_textareaEditor__ZbEVj","footerContent":"Open-module_footerContent__Q0hTw","buttonsContainer":"Open-module_buttonsContainer__L1HqU","openButton":"Open-module_openButton__cj3oU","cancelButton":"Open-module_cancelButton__0TQzA","copyButton":"Open-module_copyButton__KlXKd","loadingContainer":"Open-module_loadingContainer__Y354t"};
28612
28614
 
28613
28615
  var styles$b = {"analyzingFileWrapper":"AnalyzingFile-module_analyzingFileWrapper__j0Ltf","fileBox":"AnalyzingFile-module_fileBox__ywFIh"};
28614
28616
 
@@ -28794,37 +28796,40 @@ var CDXStructuresViewer = function CDXStructuresViewer(_ref) {
28794
28796
  inputHandler(itemsMap[selectedIndex].base64struct);
28795
28797
  }
28796
28798
  }, [inputHandler, itemsMap, selectedIndex]);
28797
- var getImages = useCallback(function () {
28798
- var itemsList = {};
28799
+ var getImage = function getImage(str, index) {
28799
28800
  setLoading(true);
28800
- var promises = structList.map(function (str) {
28801
- return parseStruct(str, server).then(function (struct) {
28802
- return {
28803
- base64struct: str,
28804
- struct: struct
28805
- };
28806
- })["catch"](function (error) {
28807
- return {
28808
- base64struct: str,
28809
- error: error.message || error
28810
- };
28801
+ parseStruct(str, server).then(function (struct) {
28802
+ var object = {
28803
+ base64struct: str,
28804
+ struct: struct
28805
+ };
28806
+ setItemsMap(function (state) {
28807
+ return _objectSpread$p(_objectSpread$p({}, state), {}, _defineProperty$1({}, index, object));
28811
28808
  });
28812
- });
28813
- Promise.allSettled(promises).then(function (values) {
28814
- values.forEach(function (el, index) {
28815
- if (el.status === 'fulfilled') {
28816
- itemsList[index] = el.value;
28817
- }
28809
+ })["catch"](function (error) {
28810
+ var object = {
28811
+ base64struct: str,
28812
+ error: error.message || error
28813
+ };
28814
+ setItemsMap(function (state) {
28815
+ return _objectSpread$p(_objectSpread$p({}, state), {}, _defineProperty$1({}, index, object));
28818
28816
  });
28819
- setItemsMap(itemsList);
28817
+ })["finally"](function () {
28820
28818
  setLoading(false);
28821
- setSelectedIndex(0);
28822
28819
  });
28823
- }, [server, structList]);
28820
+ };
28824
28821
  useEffect(function () {
28825
- getImages();
28826
- }, [getImages]);
28822
+ if (structList[selectedIndex] && !itemsMap[selectedIndex]) {
28823
+ getImage(structList[selectedIndex], selectedIndex);
28824
+ }
28825
+ }, [itemsMap, selectedIndex]);
28827
28826
  var renderStructure = function renderStructure(structure) {
28827
+ if (loading) {
28828
+ return jsx("div", {
28829
+ className: styles$8.centerWrapper,
28830
+ children: jsx(LoadingCircles, {})
28831
+ });
28832
+ }
28828
28833
  if (structure !== null && structure !== void 0 && structure.error) {
28829
28834
  var _itemsMap$selectedInd;
28830
28835
  return jsxs("div", {
@@ -28852,7 +28857,6 @@ var CDXStructuresViewer = function CDXStructuresViewer(_ref) {
28852
28857
  })
28853
28858
  });
28854
28859
  }
28855
- var menuList = Object.values(itemsMap) || [];
28856
28860
  return jsxs("div", {
28857
28861
  className: styles$8.structuresWrapper,
28858
28862
  children: [jsxs("div", {
@@ -28861,16 +28865,17 @@ var CDXStructuresViewer = function CDXStructuresViewer(_ref) {
28861
28865
  className: styles$8.header,
28862
28866
  children: "Select structure"
28863
28867
  }), jsx(MenuList, {
28864
- children: menuList.map(function (value, index) {
28868
+ children: structList.map(function (value, index) {
28869
+ var _itemsMap$index;
28865
28870
  return jsxs(MenuItem, {
28866
28871
  selected: index === selectedIndex,
28867
28872
  onClick: function onClick() {
28868
28873
  return setSelectedIndex(index);
28869
28874
  },
28870
- children: ["Structure ".concat(index + 1), value.error && jsx(Icon, {
28875
+ children: ["Structure ".concat(index + 1), ((_itemsMap$index = itemsMap[index]) === null || _itemsMap$index === void 0 ? void 0 : _itemsMap$index.error) && jsx(Icon, {
28871
28876
  name: "error"
28872
28877
  })]
28873
- }, value.base64struct + index);
28878
+ }, value + index);
28874
28879
  })
28875
28880
  })]
28876
28881
  }), jsx("div", {
@@ -28886,10 +28891,7 @@ var CDXStructuresViewer = function CDXStructuresViewer(_ref) {
28886
28891
  className: styles$8.fileName,
28887
28892
  children: fileName
28888
28893
  })]
28889
- }), loading ? jsx("div", {
28890
- className: styles$8.centerWrapper,
28891
- children: jsx(LoadingCircles, {})
28892
- }) : renderStructures()]
28894
+ }), renderStructures()]
28893
28895
  });
28894
28896
  };
28895
28897
 
@@ -28979,6 +28981,10 @@ var Open = function Open(props) {
28979
28981
  _useState10 = _slicedToArray$1(_useState9, 2),
28980
28982
  currentState = _useState10[0],
28981
28983
  setCurrentState = _useState10[1];
28984
+ var _useState11 = useState(false),
28985
+ _useState12 = _slicedToArray$1(_useState11, 2),
28986
+ isLoading = _useState12[0],
28987
+ setIsLoading = _useState12[1];
28982
28988
  useEffect(function () {
28983
28989
  if (server) {
28984
28990
  fileOpener(server).then(function (chosenOpener) {
@@ -28989,6 +28995,7 @@ var Open = function Open(props) {
28989
28995
  }
28990
28996
  }, [server]);
28991
28997
  var onFileLoad = function onFileLoad(files) {
28998
+ setIsLoading(true);
28992
28999
  var onLoad = function onLoad(fileContent) {
28993
29000
  if (fileContent.isPPTX) {
28994
29001
  setStructStr('');
@@ -28998,9 +29005,11 @@ var Open = function Open(props) {
28998
29005
  setStructStr(fileContent);
28999
29006
  setCurrentState(MODAL_STATES.textEditor);
29000
29007
  }
29008
+ setIsLoading(false);
29001
29009
  };
29002
29010
  var onError = function onError() {
29003
- return errorHandler('Error processing file');
29011
+ setIsLoading(false);
29012
+ errorHandler('Error processing file');
29004
29013
  };
29005
29014
  setFileName(files[0].name);
29006
29015
  opener.chosenOpener(files[0]).then(onLoad, onError);
@@ -29028,7 +29037,7 @@ var Open = function Open(props) {
29028
29037
  if (currentState === MODAL_STATES.imageRec) {
29029
29038
  return jsx(Recognize, _objectSpread$n({}, rest));
29030
29039
  }
29031
- return jsx(Dialog, {
29040
+ return jsxs(Dialog, {
29032
29041
  title: "Open structure",
29033
29042
  className: classes$n.open,
29034
29043
  params: rest,
@@ -29044,7 +29053,7 @@ var Open = function Open(props) {
29044
29053
  }) : undefined,
29045
29054
  buttons: [],
29046
29055
  withDivider: true,
29047
- children: jsx(ViewSwitcher, {
29056
+ children: [jsx(ViewSwitcher, {
29048
29057
  isAnalyzingFile: isAnalyzingFile,
29049
29058
  fileName: fileName,
29050
29059
  currentState: currentState,
@@ -29060,7 +29069,10 @@ var Open = function Open(props) {
29060
29069
  inputHandler: setStructStr,
29061
29070
  autoFocus: true,
29062
29071
  structList: structList
29063
- })
29072
+ }), isLoading && jsx("div", {
29073
+ className: classes$n.loadingContainer,
29074
+ children: jsx(LoadingCircles, {})
29075
+ })]
29064
29076
  });
29065
29077
  };
29066
29078
 
@@ -32766,8 +32778,8 @@ var KetcherBuilder = function () {
32766
32778
  initApp(element, appRoot, staticResourcesUrl, {
32767
32779
  buttons: buttons || {},
32768
32780
  errorHandler: errorHandler || null,
32769
- version: "2.18.0-rc.5" ,
32770
- buildDate: "2024-02-09T16:22:25" ,
32781
+ version: "2.18.0-rc.6" ,
32782
+ buildDate: "2024-02-13T18:53:18" ,
32771
32783
  buildNumber: ''
32772
32784
  }, structService, resolve, togglerComponent);
32773
32785
  });