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.
@@ -47003,6 +47003,19 @@ var InputType;
47003
47003
  InputType["DAGArrayInput"] = "DAGArrayInput";
47004
47004
  InputType["DAGJSONObjectInput"] = "DAGJSONObjectInput";
47005
47005
  })(InputType || (InputType = {}));
47006
+ var InputTypeAlias;
47007
+ (function (InputTypeAlias) {
47008
+ InputTypeAlias["DAGGenericInputAlias"] = "DAGGenericInputAlias";
47009
+ InputTypeAlias["DAGStringInputAlias"] = "DAGStringInputAlias";
47010
+ InputTypeAlias["DAGIntegerInputAlias"] = "DAGIntegerInputAlias";
47011
+ InputTypeAlias["DAGNumberInputAlias"] = "DAGNumberInputAlias";
47012
+ InputTypeAlias["DAGBooleanInputAlias"] = "DAGBooleanInputAlias";
47013
+ InputTypeAlias["DAGFolderInputAlias"] = "DAGFolderInputAlias";
47014
+ InputTypeAlias["DAGFileInputAlias"] = "DAGFileInputAlias";
47015
+ InputTypeAlias["DAGPathInputAlias"] = "DAGPathInputAlias";
47016
+ InputTypeAlias["DAGArrayInputAlias"] = "DAGArrayInputAlias";
47017
+ InputTypeAlias["DAGJSONObjectInputAlias"] = "DAGJSONObjectInputAlias";
47018
+ })(InputTypeAlias || (InputTypeAlias = {}));
47006
47019
  var RecipeForm = function (_a) {
47007
47020
  var _b, _c;
47008
47021
  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;
@@ -47013,6 +47026,11 @@ var RecipeForm = function (_a) {
47013
47026
  */
47014
47027
  var _h = useState(false), displaySettings = _h[0], setDisplaySettings = _h[1];
47015
47028
  var _j = useState(false), overSettings = _j[0], setOverSettings = _j[1];
47029
+ /**
47030
+ * Local study
47031
+ */
47032
+ var _k = useState(true), handlers = _k[0], setHandlers = _k[1];
47033
+ var _l = useState(__assign(__assign({}, _defaultConfig), { isLocalJob: initAsLocal, cloudProjectName: projectName, cloudProjectOwner: projectOwner, localRunFolder: simulationPath, useHandlers: handlers })), localConfig = _l[0], setLocalConfig = _l[1];
47016
47034
  /**
47017
47035
  * Input mapping
47018
47036
  */
@@ -47020,9 +47038,10 @@ var RecipeForm = function (_a) {
47020
47038
  if (!recipe)
47021
47039
  return;
47022
47040
  var data = recipe.inputs.map(function (i) {
47023
- var _a;
47041
+ var _a, _b;
47024
47042
  var customTab = (_a = i === null || i === void 0 ? void 0 : i.annotations['group_identifier']) !== null && _a !== void 0 ? _a : undefined;
47025
- return {
47043
+ 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); }));
47044
+ var inputInfo = {
47026
47045
  type: InputType[i.type],
47027
47046
  required: i.required,
47028
47047
  name: i.name,
@@ -47033,9 +47052,21 @@ var RecipeForm = function (_a) {
47033
47052
  i['extensions'] : [],
47034
47053
  customTab: customTab
47035
47054
  };
47055
+ alias && Object.keys(alias).forEach(function (key) {
47056
+ if (key in inputInfo) {
47057
+ // if the alias is DAGGenericInputAlias use the native input type
47058
+ if (key == 'type') {
47059
+ if (alias[key] == 'DAGGenericInputAlias') {
47060
+ return;
47061
+ }
47062
+ }
47063
+ inputInfo[key] = alias[key];
47064
+ }
47065
+ });
47066
+ return inputInfo;
47036
47067
  });
47037
47068
  return data;
47038
- }, [recipe]);
47069
+ }, [recipe, handlers]);
47039
47070
  var schema = generateSchema(inputs);
47040
47071
  var customTabs = useMemo(function () {
47041
47072
  if (!inputs)
@@ -47053,10 +47084,10 @@ var RecipeForm = function (_a) {
47053
47084
  /**
47054
47085
  * Hooks
47055
47086
  */
47056
- var _k = useForm({
47087
+ var _m = useForm({
47057
47088
  resolver: Oe(schema),
47058
47089
  mode: 'onChange'
47059
- }), control = _k.control, register = _k.register, handleSubmit = _k.handleSubmit, resetField = _k.resetField, watch = _k.watch, _l = _k.formState, errors = _l.errors, isValid = _l.isValid;
47090
+ }), control = _m.control, register = _m.register, handleSubmit = _m.handleSubmit, resetField = _m.resetField, watch = _m.watch, _o = _m.formState, errors = _o.errors, isValid = _o.isValid;
47060
47091
  var watchStudyName = watch('study-name');
47061
47092
  /**
47062
47093
  * Form actions
@@ -47102,12 +47133,15 @@ var RecipeForm = function (_a) {
47102
47133
  var _a, _b, _c, _d, _e;
47103
47134
  switch (i.type) {
47104
47135
  case InputType.DAGNumberInput:
47136
+ case InputTypeAlias.DAGNumberInputAlias:
47105
47137
  return React__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); } });
47106
47138
  case InputType.DAGIntegerInput:
47139
+ case InputTypeAlias.DAGIntegerInputAlias:
47107
47140
  return React__default.createElement(NumberInput, { key: i.name, icon: i.name.startsWith('cpu')
47108
47141
  ? React__default.createElement(Cpu$1, null)
47109
47142
  : 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); } });
47110
47143
  case InputType.DAGStringInput:
47144
+ case InputTypeAlias.DAGStringInputAlias:
47111
47145
  return ((_e = i.spec) === null || _e === void 0 ? void 0 : _e.enum)
47112
47146
  ? React__default.createElement(Controller, { name: i.name, control: control, defaultValue: i.default, render: function (_a) {
47113
47147
  var _b = _a.field, onChange = _b.onChange, value = _b.value; __rest(_b, ["onChange", "value"]);
@@ -47115,6 +47149,7 @@ var RecipeForm = function (_a) {
47115
47149
  } })
47116
47150
  : React__default.createElement(TextInput, { key: i.name, inputProps: __assign(__assign({}, register(i.name)), { defaultValue: i.default }), reset: function () { return handleReset(i); } });
47117
47151
  case InputType.DAGFileInput:
47152
+ case InputTypeAlias.DAGFileInputAlias:
47118
47153
  return React__default.createElement(Controller, { name: i.name, control: control, defaultValue: i.default, render: function (_a) {
47119
47154
  var _b, _c;
47120
47155
  var _d = _a.field, value = _d.value, onChange = _d.onChange, field = __rest(_d, ["value", "onChange"]);
@@ -47131,11 +47166,6 @@ var RecipeForm = function (_a) {
47131
47166
  return React__default.createElement(TextInput, { key: i.name, inputProps: __assign(__assign({}, register(i.name)), { defaultValue: i.default }), reset: function () { return handleReset(i); } });
47132
47167
  }
47133
47168
  };
47134
- /**
47135
- * Local study
47136
- */
47137
- var _m = useState(true), handlers = _m[0], setHandlers = _m[1];
47138
- var _o = useState(__assign(__assign({}, _defaultConfig), { isLocalJob: initAsLocal, cloudProjectName: projectName, cloudProjectOwner: projectOwner, localRunFolder: simulationPath, useHandlers: handlers })), localConfig = _o[0], setLocalConfig = _o[1];
47139
47169
  /**
47140
47170
  * Warning for local study folder
47141
47171
  */
@@ -47179,7 +47209,7 @@ var RecipeForm = function (_a) {
47179
47209
  " ",
47180
47210
  recipe.metadata.name,
47181
47211
  " study"),
47182
- React__default.createElement("span", { style: { display: 'inline', float: 'right' }, title: 'Show settings' },
47212
+ host != 'web' && React__default.createElement("span", { style: { display: 'inline', float: 'right' }, title: 'Show settings' },
47183
47213
  React__default.createElement(SettingOutlined$1, { onMouseOver: function () { return setOverSettings(true); }, onMouseLeave: function () { return setOverSettings(false); }, onClick: function () { return setDisplaySettings(function (prev) { return !prev; }); }, style: {
47184
47214
  fontSize: '18px',
47185
47215
  cursor: 'pointer',
@@ -55376,7 +55406,10 @@ var SendGeometry = function (_a) {
55376
55406
  options: geometryOptions
55377
55407
  });
55378
55408
  } },
55379
- !disabled && (currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55409
+ !disabled && React__default.createElement("span", { style: {
55410
+ flexShrink: 0,
55411
+ display: 'flex'
55412
+ } }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55380
55413
  !disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
55381
55414
  disabled && React__default.createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")));
55382
55415
  };
@@ -55510,7 +55543,10 @@ var SendModel = function (_a) {
55510
55543
  options: {},
55511
55544
  });
55512
55545
  } },
55513
- !disabled && (currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55546
+ !disabled && React__default.createElement("span", { style: {
55547
+ flexShrink: 0,
55548
+ display: 'flex'
55549
+ } }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55514
55550
  !disabled && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
55515
55551
  disabled && React__default.createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")));
55516
55552
  };
@@ -55697,10 +55733,14 @@ var SendResults = function (_a) {
55697
55733
  border: 'solid 1px #fff',
55698
55734
  flexShrink: '0',
55699
55735
  }, placement: 'bottomRight', activeId: defaultAction, action: 'click', disabled: disabled, onSelect: onSelect, options: values },
55700
- React__default.createElement(Button, { title: helpTextButton[currOption === null || currOption === void 0 ? void 0 : currOption.id], disabled: disabled, style: {
55736
+ React__default.createElement(Button, { title: (((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview
55737
+ || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
55738
+ && (dataSets.length >= 1)
55739
+ ? dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return "".concat(d.labels[initialIds[index]]); }).join(' & ')
55740
+ : helpTextButton[currOption === null || currOption === void 0 ? void 0 : currOption.id]), disabled: disabled, style: {
55701
55741
  width: '100%',
55702
55742
  fontSize: '14px',
55703
- border: 'solid 1px #fff'
55743
+ border: 'solid 1px #fff',
55704
55744
  }, onClick: function (e) {
55705
55745
  e.stopPropagation();
55706
55746
  if (disabled)
@@ -55713,15 +55753,22 @@ var SendResults = function (_a) {
55713
55753
  options: geometryOptions,
55714
55754
  });
55715
55755
  } },
55716
- !disabled && (currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55756
+ !disabled && React__default.createElement("span", { style: {
55757
+ flexShrink: 0,
55758
+ display: 'flex'
55759
+ } }, currOption === null || currOption === void 0 ? void 0 : currOption.icon),
55717
55760
  !disabled &&
55718
55761
  ((currOption === null || currOption === void 0 ? void 0 : currOption.id) !== Action.preview && (currOption === null || currOption === void 0 ? void 0 : currOption.id) !== Action.subscribePreview)
55719
55762
  && ((_b = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _b !== void 0 ? _b : 'Pollination'),
55720
55763
  !disabled &&
55721
55764
  ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)
55722
- && (dataSets.length >= 1
55765
+ && React__default.createElement("span", { style: {
55766
+ textOverflow: 'ellipsis',
55767
+ whiteSpace: 'nowrap',
55768
+ overflow: 'hidden',
55769
+ } }, (dataSets.length >= 1
55723
55770
  ? dataSets === null || dataSets === void 0 ? void 0 : dataSets.map(function (d, index) { return "".concat(d.labels[initialIds[index]]); }).join(' & ')
55724
- : ((_c = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _c !== void 0 ? _c : 'Pollination')),
55771
+ : ((_c = currOption === null || currOption === void 0 ? void 0 : currOption.label) !== null && _c !== void 0 ? _c : 'Pollination'))),
55725
55772
  disabled && React__default.createElement("span", { style: { color: 'red' } }, "Enabled in Pollination CAD plugins")),
55726
55773
  (currOption === null || currOption === void 0 ? void 0 : currOption.id)
55727
55774
  && ((currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.preview || (currOption === null || currOption === void 0 ? void 0 : currOption.id) === Action.subscribePreview)