pollination-react-io 1.88.1 → 1.89.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.
package/build/index.js CHANGED
@@ -47030,6 +47030,19 @@ var InputType;
47030
47030
  InputType["DAGArrayInput"] = "DAGArrayInput";
47031
47031
  InputType["DAGJSONObjectInput"] = "DAGJSONObjectInput";
47032
47032
  })(InputType || (InputType = {}));
47033
+ var InputTypeAlias;
47034
+ (function (InputTypeAlias) {
47035
+ InputTypeAlias["DAGGenericInputAlias"] = "DAGGenericInputAlias";
47036
+ InputTypeAlias["DAGStringInputAlias"] = "DAGStringInputAlias";
47037
+ InputTypeAlias["DAGIntegerInputAlias"] = "DAGIntegerInputAlias";
47038
+ InputTypeAlias["DAGNumberInputAlias"] = "DAGNumberInputAlias";
47039
+ InputTypeAlias["DAGBooleanInputAlias"] = "DAGBooleanInputAlias";
47040
+ InputTypeAlias["DAGFolderInputAlias"] = "DAGFolderInputAlias";
47041
+ InputTypeAlias["DAGFileInputAlias"] = "DAGFileInputAlias";
47042
+ InputTypeAlias["DAGPathInputAlias"] = "DAGPathInputAlias";
47043
+ InputTypeAlias["DAGArrayInputAlias"] = "DAGArrayInputAlias";
47044
+ InputTypeAlias["DAGJSONObjectInputAlias"] = "DAGJSONObjectInputAlias";
47045
+ })(InputTypeAlias || (InputTypeAlias = {}));
47033
47046
  var RecipeForm = function (_a) {
47034
47047
  var _b, _c;
47035
47048
  var recipe = _a.recipe, projectName = _a.projectName, projectOwner = _a.projectOwner, client = _a.client, onSubmit = _a.onSubmit, _d = _a.style, style = _d === void 0 ? {} : _d, _e = _a.initAsLocal, initAsLocal = _e === void 0 ? false : _e;
@@ -47040,6 +47053,11 @@ var RecipeForm = function (_a) {
47040
47053
  */
47041
47054
  var _h = React.useState(false), displaySettings = _h[0], setDisplaySettings = _h[1];
47042
47055
  var _j = React.useState(false), overSettings = _j[0], setOverSettings = _j[1];
47056
+ /**
47057
+ * Local study
47058
+ */
47059
+ var _k = React.useState(true), handlers = _k[0], setHandlers = _k[1];
47060
+ var _l = React.useState(__assign(__assign({}, _defaultConfig), { isLocalJob: initAsLocal, cloudProjectName: projectName, cloudProjectOwner: projectOwner, localRunFolder: simulationPath, useHandlers: handlers })), localConfig = _l[0], setLocalConfig = _l[1];
47043
47061
  /**
47044
47062
  * Input mapping
47045
47063
  */
@@ -47047,9 +47065,10 @@ var RecipeForm = function (_a) {
47047
47065
  if (!recipe)
47048
47066
  return;
47049
47067
  var data = recipe.inputs.map(function (i) {
47050
- var _a;
47068
+ var _a, _b;
47051
47069
  var customTab = (_a = i === null || i === void 0 ? void 0 : i.annotations['group_identifier']) !== null && _a !== void 0 ? _a : undefined;
47052
- return {
47070
+ var alias = handlers && ((_b = i === null || i === void 0 ? void 0 : i.alias) === null || _b === void 0 ? void 0 : _b.find(function (a) { return a.platform.includes(host); }));
47071
+ var inputInfo = {
47053
47072
  type: InputType[i.type],
47054
47073
  required: i.required,
47055
47074
  name: i.name,
@@ -47060,9 +47079,21 @@ var RecipeForm = function (_a) {
47060
47079
  i['extensions'] : [],
47061
47080
  customTab: customTab
47062
47081
  };
47082
+ alias && Object.keys(alias).forEach(function (key) {
47083
+ if (key in inputInfo) {
47084
+ // if the alias is DAGGenericInputAlias use the native input type
47085
+ if (key == 'type') {
47086
+ if (alias[key] == 'DAGGenericInputAlias') {
47087
+ return;
47088
+ }
47089
+ }
47090
+ inputInfo[key] = alias[key];
47091
+ }
47092
+ });
47093
+ return inputInfo;
47063
47094
  });
47064
47095
  return data;
47065
- }, [recipe]);
47096
+ }, [recipe, handlers]);
47066
47097
  var schema = generateSchema(inputs);
47067
47098
  var customTabs = React.useMemo(function () {
47068
47099
  if (!inputs)
@@ -47080,10 +47111,10 @@ var RecipeForm = function (_a) {
47080
47111
  /**
47081
47112
  * Hooks
47082
47113
  */
47083
- var _k = useForm({
47114
+ var _m = useForm({
47084
47115
  resolver: Oe(schema),
47085
47116
  mode: 'onChange'
47086
- }), control = _k.control, register = _k.register, handleSubmit = _k.handleSubmit, resetField = _k.resetField, watch = _k.watch, _l = _k.formState, errors = _l.errors, isValid = _l.isValid;
47117
+ }), control = _m.control, register = _m.register, handleSubmit = _m.handleSubmit, resetField = _m.resetField, watch = _m.watch, _o = _m.formState, errors = _o.errors, isValid = _o.isValid;
47087
47118
  var watchStudyName = watch('study-name');
47088
47119
  /**
47089
47120
  * Form actions
@@ -47129,12 +47160,15 @@ var RecipeForm = function (_a) {
47129
47160
  var _a, _b, _c, _d, _e;
47130
47161
  switch (i.type) {
47131
47162
  case InputType.DAGNumberInput:
47163
+ case InputTypeAlias.DAGNumberInputAlias:
47132
47164
  return React__default["default"].createElement(NumberInput, { inputProps: __assign(__assign({}, register(i.name, { valueAsNumber: true })), { required: i.required, defaultValue: i.default, min: (_a = i.spec) === null || _a === void 0 ? void 0 : _a.minimum, max: (_b = i.spec) === null || _b === void 0 ? void 0 : _b.maximum, step: 0.1 }), key: i.name, reset: function () { return handleReset(i); } });
47133
47165
  case InputType.DAGIntegerInput:
47166
+ case InputTypeAlias.DAGIntegerInputAlias:
47134
47167
  return React__default["default"].createElement(NumberInput, { key: i.name, icon: i.name.startsWith('cpu')
47135
47168
  ? React__default["default"].createElement(Cpu$1, null)
47136
47169
  : undefined, inputProps: __assign(__assign({}, register(i.name, { valueAsNumber: true })), { required: i.required, defaultValue: i.default, min: (_c = i.spec) === null || _c === void 0 ? void 0 : _c.minimum, max: (_d = i.spec) === null || _d === void 0 ? void 0 : _d.maximum, step: 1 }), reset: function () { return handleReset(i); } });
47137
47170
  case InputType.DAGStringInput:
47171
+ case InputTypeAlias.DAGStringInputAlias:
47138
47172
  return ((_e = i.spec) === null || _e === void 0 ? void 0 : _e.enum)
47139
47173
  ? React__default["default"].createElement(Controller, { name: i.name, control: control, defaultValue: i.default, render: function (_a) {
47140
47174
  var _b = _a.field, onChange = _b.onChange, value = _b.value; __rest(_b, ["onChange", "value"]);
@@ -47142,6 +47176,7 @@ var RecipeForm = function (_a) {
47142
47176
  } })
47143
47177
  : React__default["default"].createElement(TextInput, { key: i.name, inputProps: __assign(__assign({}, register(i.name)), { defaultValue: i.default }), reset: function () { return handleReset(i); } });
47144
47178
  case InputType.DAGFileInput:
47179
+ case InputTypeAlias.DAGFileInputAlias:
47145
47180
  return React__default["default"].createElement(Controller, { name: i.name, control: control, defaultValue: i.default, render: function (_a) {
47146
47181
  var _b, _c;
47147
47182
  var _d = _a.field, value = _d.value, onChange = _d.onChange, field = __rest(_d, ["value", "onChange"]);
@@ -47158,11 +47193,6 @@ var RecipeForm = function (_a) {
47158
47193
  return React__default["default"].createElement(TextInput, { key: i.name, inputProps: __assign(__assign({}, register(i.name)), { defaultValue: i.default }), reset: function () { return handleReset(i); } });
47159
47194
  }
47160
47195
  };
47161
- /**
47162
- * Local study
47163
- */
47164
- var _m = React.useState(true), handlers = _m[0], setHandlers = _m[1];
47165
- var _o = React.useState(__assign(__assign({}, _defaultConfig), { isLocalJob: initAsLocal, cloudProjectName: projectName, cloudProjectOwner: projectOwner, localRunFolder: simulationPath, useHandlers: handlers })), localConfig = _o[0], setLocalConfig = _o[1];
47166
47196
  /**
47167
47197
  * Warning for local study folder
47168
47198
  */
@@ -47206,7 +47236,7 @@ var RecipeForm = function (_a) {
47206
47236
  " ",
47207
47237
  recipe.metadata.name,
47208
47238
  " study"),
47209
- React__default["default"].createElement("span", { style: { display: 'inline', float: 'right' }, title: 'Show settings' },
47239
+ host != 'web' && React__default["default"].createElement("span", { style: { display: 'inline', float: 'right' }, title: 'Show settings' },
47210
47240
  React__default["default"].createElement(SettingOutlined$1, { onMouseOver: function () { return setOverSettings(true); }, onMouseLeave: function () { return setOverSettings(false); }, onClick: function () { return setDisplaySettings(function (prev) { return !prev; }); }, style: {
47211
47241
  fontSize: '18px',
47212
47242
  cursor: 'pointer',
@@ -55403,7 +55433,10 @@ var SendGeometry = function (_a) {
55403
55433
  options: geometryOptions
55404
55434
  });
55405
55435
  } },
55406
- !disabled && (currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55436
+ !disabled && React__default["default"].createElement("span", { style: {
55437
+ flexShrink: 0,
55438
+ display: 'flex'
55439
+ } }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55407
55440
  !disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
55408
55441
  disabled && React__default["default"].createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")));
55409
55442
  };
@@ -55537,7 +55570,10 @@ var SendModel = function (_a) {
55537
55570
  options: {},
55538
55571
  });
55539
55572
  } },
55540
- !disabled && (currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55573
+ !disabled && React__default["default"].createElement("span", { style: {
55574
+ flexShrink: 0,
55575
+ display: 'flex'
55576
+ } }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55541
55577
  !disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
55542
55578
  disabled && React__default["default"].createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")));
55543
55579
  };
@@ -55724,10 +55760,14 @@ var SendResults = function (_a) {
55724
55760
  border: 'solid 1px #fff',
55725
55761
  flexShrink: '0',
55726
55762
  }, placement: 'bottomRight', activeId: defaultAction, action: 'click', disabled: disabled, onSelect: onSelect, options: values },
55727
- React__default["default"].createElement(Button, { title: helpTextButton[currOption === null || currOption === void 0 ? void 0 : currOption.id], disabled: disabled, style: {
55763
+ React__default["default"].createElement(Button, { title: (((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview
55764
+ || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
55765
+ && (dataSets.length >= 1)
55766
+ ? dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return "".concat(d.labels[initialIds[index]]); }).join(' & ')
55767
+ : helpTextButton[currOption === null || currOption === void 0 ? void 0 : currOption.id]), disabled: disabled, style: {
55728
55768
  width: '100%',
55729
55769
  fontSize: '14px',
55730
- border: 'solid 1px #fff'
55770
+ border: 'solid 1px #fff',
55731
55771
  }, onClick: function (e) {
55732
55772
  e.stopPropagation();
55733
55773
  if (disabled)
@@ -55740,15 +55780,22 @@ var SendResults = function (_a) {
55740
55780
  options: geometryOptions,
55741
55781
  });
55742
55782
  } },
55743
- !disabled && (currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55783
+ !disabled && React__default["default"].createElement("span", { style: {
55784
+ flexShrink: 0,
55785
+ display: 'flex'
55786
+ } }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55744
55787
  !disabled &&
55745
55788
  ((currOption === null || currOption === void 0 ? void 0 : currOption.id) !== Action.preview && (currOption === null || currOption === void 0 ? void 0 : currOption.id) !== Action.subscribePreview)
55746
55789
  && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
55747
55790
  !disabled &&
55748
55791
  ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
55749
- && (dataSets.length >= 1
55792
+ && React__default["default"].createElement("span", { style: {
55793
+ textOverflow: 'ellipsis',
55794
+ whiteSpace: 'nowrap',
55795
+ overflow: 'hidden',
55796
+ } }, (dataSets.length >= 1
55750
55797
  ? dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return "".concat(d.labels[initialIds[index]]); }).join(' & ')
55751
- : ((_c = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _c !== void 0 ? _c : 'Pollination')),
55798
+ : ((_c = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _c !== void 0 ? _c : 'Pollination'))),
55752
55799
  disabled && React__default["default"].createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")),
55753
55800
  (currOption === null || currOption === void 0 ? void 0 : currOption.id)
55754
55801
  && ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)