pollination-react-io 1.80.7 → 1.80.8

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.
@@ -53699,6 +53699,7 @@ var SendResults = function (_a) {
53699
53699
  var sendMessage = useSendMessage().sendMessage;
53700
53700
  var host = getHost();
53701
53701
  useEffect(function () {
53702
+ setDataSets([]); // reset if results change
53702
53703
  setCurrResults(results);
53703
53704
  }, [results]);
53704
53705
  var disabled = useMemo(function () {
@@ -53733,6 +53734,14 @@ var SendResults = function (_a) {
53733
53734
  });
53734
53735
  setDataSets(data);
53735
53736
  }, [currResults]);
53737
+ var defaultIndices = useMemo(function () {
53738
+ var _a;
53739
+ var res = results;
53740
+ var analysisGeometry = (_a = res === null || res === void 0 ? void 0 : res.geometry) === null || _a === void 0 ? void 0 : _a.filter(function (g) { return g.type === 'AnalysisGeometry'; });
53741
+ if (!analysisGeometry || (analysisGeometry === null || analysisGeometry === void 0 ? void 0 : analysisGeometry.length) === 0)
53742
+ return;
53743
+ return analysisGeometry.map(function (a) { return a === null || a === void 0 ? void 0 : a.active_data; });
53744
+ }, [results]);
53736
53745
  var onSelect = function (o) { return setCurrOption(o); };
53737
53746
  var onSelectDataSet = function (o) {
53738
53747
  var _a;
@@ -53744,6 +53753,19 @@ var SendResults = function (_a) {
53744
53753
  geo.active_data = Number(o.id);
53745
53754
  }
53746
53755
  });
53756
+ // Run if preview
53757
+ if ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview) {
53758
+ sendMessage(getAction(Action.clear), {
53759
+ data: clone,
53760
+ uniqueId: key,
53761
+ options: geometryOptions,
53762
+ });
53763
+ sendMessage(getAction(Action.preview), {
53764
+ data: clone,
53765
+ uniqueId: key,
53766
+ options: geometryOptions,
53767
+ });
53768
+ }
53747
53769
  setCurrResults(clone);
53748
53770
  };
53749
53771
  var values = useMemo(function () {
@@ -53776,6 +53798,15 @@ var SendResults = function (_a) {
53776
53798
  });
53777
53799
  };
53778
53800
  }, [disabled, geometryOptions, key, currResults, currOption, sendMessage]);
53801
+ useEffect(function () {
53802
+ return function () {
53803
+ sendMessage('ClearResults', {
53804
+ data: currResults,
53805
+ uniqueId: key,
53806
+ options: geometryOptions,
53807
+ });
53808
+ };
53809
+ }, [currOption]);
53779
53810
  var helpTextButton = {
53780
53811
  add: "Add results to the ".concat(host, " viewport"),
53781
53812
  preview: "Preview results in the ".concat(host, " viewport"),
@@ -53812,8 +53843,7 @@ var SendResults = function (_a) {
53812
53843
  !disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
53813
53844
  disabled && React__default.createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")),
53814
53845
  currResults && (currOption === null || currOption === void 0 ? void 0 : currOption.id)
53815
- && ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
53816
- && dataSets && dataSets.length >= 1 && (dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d) { return React__default.createElement(BaseDropdown, { key: d.identifier, childOverlayStyle: {
53846
+ && dataSets && dataSets.length >= 1 && (dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return React__default.createElement(BaseDropdown, { key: d.identifier, childOverlayStyle: {
53817
53847
  width: 'auto',
53818
53848
  backgroundColor: 'white',
53819
53849
  color: '#393e46',
@@ -53824,7 +53854,7 @@ var SendResults = function (_a) {
53824
53854
  border: 'solid 1px #fff',
53825
53855
  flexShrink: '0',
53826
53856
  height: '42px'
53827
- }, placement: 'bottomRight', activeId: d.activeData.toString(), action: 'click', disabled: disabled, onSelect: onSelectDataSet, options: d.options }); })));
53857
+ }, placement: 'bottomRight', activeId: defaultIndices[index], action: 'click', disabled: disabled, onSelect: onSelectDataSet, options: d.options }); })));
53828
53858
  };
53829
53859
 
53830
53860
  var timezone = createCommonjsModule(function (module, exports) {