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.
- package/build/index.esm.js +33 -3
- package/build/index.esm.js.map +1 -1
- package/build/index.js +33 -3
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
@@ -53726,6 +53726,7 @@ var SendResults = function (_a) {
|
|
53726
53726
|
var sendMessage = useSendMessage().sendMessage;
|
53727
53727
|
var host = getHost();
|
53728
53728
|
React.useEffect(function () {
|
53729
|
+
setDataSets([]); // reset if results change
|
53729
53730
|
setCurrResults(results);
|
53730
53731
|
}, [results]);
|
53731
53732
|
var disabled = React.useMemo(function () {
|
@@ -53760,6 +53761,14 @@ var SendResults = function (_a) {
|
|
53760
53761
|
});
|
53761
53762
|
setDataSets(data);
|
53762
53763
|
}, [currResults]);
|
53764
|
+
var defaultIndices = React.useMemo(function () {
|
53765
|
+
var _a;
|
53766
|
+
var res = results;
|
53767
|
+
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'; });
|
53768
|
+
if (!analysisGeometry || (analysisGeometry === null || analysisGeometry === void 0 ? void 0 : analysisGeometry.length) === 0)
|
53769
|
+
return;
|
53770
|
+
return analysisGeometry.map(function (a) { return a === null || a === void 0 ? void 0 : a.active_data; });
|
53771
|
+
}, [results]);
|
53763
53772
|
var onSelect = function (o) { return setCurrOption(o); };
|
53764
53773
|
var onSelectDataSet = function (o) {
|
53765
53774
|
var _a;
|
@@ -53771,6 +53780,19 @@ var SendResults = function (_a) {
|
|
53771
53780
|
geo.active_data = Number(o.id);
|
53772
53781
|
}
|
53773
53782
|
});
|
53783
|
+
// Run if preview
|
53784
|
+
if ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview) {
|
53785
|
+
sendMessage(getAction(Action.clear), {
|
53786
|
+
data: clone,
|
53787
|
+
uniqueId: key,
|
53788
|
+
options: geometryOptions,
|
53789
|
+
});
|
53790
|
+
sendMessage(getAction(Action.preview), {
|
53791
|
+
data: clone,
|
53792
|
+
uniqueId: key,
|
53793
|
+
options: geometryOptions,
|
53794
|
+
});
|
53795
|
+
}
|
53774
53796
|
setCurrResults(clone);
|
53775
53797
|
};
|
53776
53798
|
var values = React.useMemo(function () {
|
@@ -53803,6 +53825,15 @@ var SendResults = function (_a) {
|
|
53803
53825
|
});
|
53804
53826
|
};
|
53805
53827
|
}, [disabled, geometryOptions, key, currResults, currOption, sendMessage]);
|
53828
|
+
React.useEffect(function () {
|
53829
|
+
return function () {
|
53830
|
+
sendMessage('ClearResults', {
|
53831
|
+
data: currResults,
|
53832
|
+
uniqueId: key,
|
53833
|
+
options: geometryOptions,
|
53834
|
+
});
|
53835
|
+
};
|
53836
|
+
}, [currOption]);
|
53806
53837
|
var helpTextButton = {
|
53807
53838
|
add: "Add results to the ".concat(host, " viewport"),
|
53808
53839
|
preview: "Preview results in the ".concat(host, " viewport"),
|
@@ -53839,8 +53870,7 @@ var SendResults = function (_a) {
|
|
53839
53870
|
!disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
|
53840
53871
|
disabled && React__default["default"].createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")),
|
53841
53872
|
currResults && (currOption === null || currOption === void 0 ? void 0 : currOption.id)
|
53842
|
-
&& (
|
53843
|
-
&& dataSets && dataSets.length >= 1 && (dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d) { return React__default["default"].createElement(BaseDropdown, { key: d.identifier, childOverlayStyle: {
|
53873
|
+
&& dataSets && dataSets.length >= 1 && (dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return React__default["default"].createElement(BaseDropdown, { key: d.identifier, childOverlayStyle: {
|
53844
53874
|
width: 'auto',
|
53845
53875
|
backgroundColor: 'white',
|
53846
53876
|
color: '#393e46',
|
@@ -53851,7 +53881,7 @@ var SendResults = function (_a) {
|
|
53851
53881
|
border: 'solid 1px #fff',
|
53852
53882
|
flexShrink: '0',
|
53853
53883
|
height: '42px'
|
53854
|
-
}, placement: 'bottomRight', activeId:
|
53884
|
+
}, placement: 'bottomRight', activeId: defaultIndices[index], action: 'click', disabled: disabled, onSelect: onSelectDataSet, options: d.options }); })));
|
53855
53885
|
};
|
53856
53886
|
|
53857
53887
|
var timezone = createCommonjsModule(function (module, exports) {
|