@fluxo-dev/shell-workflow 25.1.3 → 25.1.5

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/index.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { forwardRef, createElement as createElement$1, useState, useEffect, useContext, useCallback, createContext, useMemo, Children } from 'react';
3
+ import React__default, { forwardRef, createElement as createElement$1, useState, useEffect, useContext, useCallback, createContext, useMemo, Children, useRef } from 'react';
4
4
  import { Group, Box, ScrollArea, NavLink, Badge, Menu, ActionIcon, Modal, Stack, Text, TextInput, Popover, Flex, Button } from '@mantine/core';
5
5
  import { showNotification } from '@mantine/notifications';
6
6
  import { FluxoClientSys, WorkflowActionInputType, EmbeddedModule } from '@fluxo-dev/api-client-base';
@@ -573,9 +573,6 @@ var createMethod$2 = function (IS_INCLUDES) {
573
573
  };
574
574
 
575
575
  var arrayIncludes = {
576
- // `Array.prototype.includes` method
577
- // https://tc39.es/ecma262/#sec-array.prototype.includes
578
- includes: createMethod$2(true),
579
576
  // `Array.prototype.indexOf` method
580
577
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
581
578
  indexOf: createMethod$2(false)
@@ -920,7 +917,6 @@ var PROPER = EXISTS && (function something() { /* empty */ }).name === 'somethin
920
917
  var CONFIGURABLE = EXISTS && (!DESCRIPTORS$7 || (DESCRIPTORS$7 && getDescriptor(FunctionPrototype$1, 'name').configurable));
921
918
 
922
919
  var functionName = {
923
- EXISTS: EXISTS,
924
920
  PROPER: PROPER,
925
921
  CONFIGURABLE: CONFIGURABLE
926
922
  };
@@ -1562,7 +1558,7 @@ var UNSUPPORTED_Y$1 = fails$a(function () {
1562
1558
 
1563
1559
  // UC Browser bug
1564
1560
  // https://github.com/zloirock/core-js/issues/1008
1565
- var MISSED_STICKY = UNSUPPORTED_Y$1 || fails$a(function () {
1561
+ UNSUPPORTED_Y$1 || fails$a(function () {
1566
1562
  return !$RegExp$2('a', 'y').sticky;
1567
1563
  });
1568
1564
 
@@ -1574,10 +1570,7 @@ var BROKEN_CARET = UNSUPPORTED_Y$1 || fails$a(function () {
1574
1570
  });
1575
1571
 
1576
1572
  var regexpStickyHelpers = {
1577
- BROKEN_CARET: BROKEN_CARET,
1578
- MISSED_STICKY: MISSED_STICKY,
1579
- UNSUPPORTED_Y: UNSUPPORTED_Y$1
1580
- };
1573
+ BROKEN_CARET: BROKEN_CARET};
1581
1574
 
1582
1575
  var fails$9 = fails$l;
1583
1576
  var global$6 = global$h;
@@ -1868,12 +1861,6 @@ var createMethod$1 = function (TYPE) {
1868
1861
  };
1869
1862
 
1870
1863
  var stringTrim = {
1871
- // `String.prototype.{ trimLeft, trimStart }` methods
1872
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
1873
- start: createMethod$1(1),
1874
- // `String.prototype.{ trimRight, trimEnd }` methods
1875
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
1876
- end: createMethod$1(2),
1877
1864
  // `String.prototype.trim` method
1878
1865
  // https://tc39.es/ecma262/#sec-string.prototype.trim
1879
1866
  trim: createMethod$1(3)
@@ -2027,9 +2014,6 @@ var createMethod = function (CONVERT_TO_STRING) {
2027
2014
  };
2028
2015
 
2029
2016
  var stringMultibyte = {
2030
- // `String.prototype.codePointAt` method
2031
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
2032
- codeAt: createMethod(false),
2033
2017
  // `String.prototype.at` method
2034
2018
  // https://github.com/mathiasbynens/String.prototype.at
2035
2019
  charAt: createMethod(true)
@@ -4843,6 +4827,13 @@ class WorkflowDesignerManager {
4843
4827
  value: value
4844
4828
  };
4845
4829
  }
4830
+ getActionInput(actionId, inputPropertyName) {
4831
+ const action = this.findActionById(actionId);
4832
+ if (!action) {
4833
+ return undefined;
4834
+ }
4835
+ return action.inputs[inputPropertyName];
4836
+ }
4846
4837
  // **************//
4847
4838
  // Private Area //
4848
4839
  // **************//
@@ -5080,6 +5071,9 @@ function WorkflowDesignerProvider(props) {
5080
5071
  //const wf = Object.assign({}, workflowManager.workflowDefinition);
5081
5072
  //setWorkflowDefinition(wf);
5082
5073
  };
5074
+ const getActionInput = (actionId, inputPropertyName) => {
5075
+ return workflowManager.getActionInput(actionId, inputPropertyName);
5076
+ };
5083
5077
  return jsx(WorkflowDesignerCtx.Provider, {
5084
5078
  value: {
5085
5079
  workflowDefinition,
@@ -5100,7 +5094,8 @@ function WorkflowDesignerProvider(props) {
5100
5094
  createEmptyWorkflow,
5101
5095
  findActionById,
5102
5096
  removeAction,
5103
- findParentAction
5097
+ findParentAction,
5098
+ getActionInput
5104
5099
  },
5105
5100
  children: props.children
5106
5101
  });
@@ -5195,7 +5190,7 @@ function ActionButton(props) {
5195
5190
  description: action.name,
5196
5191
  type: action.id,
5197
5192
  nextActions: {},
5198
- outcomes: ['done', ...action.outcomes] || ['done'],
5193
+ outcomes: action.outcomes ? ['done', ...action.outcomes] : ['done'],
5199
5194
  parallelActions: [],
5200
5195
  inputs: generateWorkflowActionInputsFromDefinition(action)
5201
5196
  };
@@ -5412,6 +5407,10 @@ function OutputsPicker(props) {
5412
5407
  if (!workflowContext) return [];
5413
5408
  return workflowContext === null || workflowContext === void 0 ? void 0 : workflowContext.findParentActions(action);
5414
5409
  };
5410
+ const pickValue = (actionId, outputName, displayValue) => {
5411
+ props.onValuePicked(`@{outputs('${actionId}.${outputName}')?('${displayValue}')}`);
5412
+ console.log(`@{outputs('${actionId}.${outputName}')?('${displayValue}')}`);
5413
+ };
5415
5414
  return jsxs(Stack, {
5416
5415
  gap: 0,
5417
5416
  children: [jsx(Box, {
@@ -5453,7 +5452,10 @@ function OutputsPicker(props) {
5453
5452
  }), action.outputs.map(output => {
5454
5453
  return jsx(NavLink, {
5455
5454
  label: output.name,
5456
- description: output.name
5455
+ description: output.name,
5456
+ onClick: () => {
5457
+ pickValue(action.actionId, output.name, output.name);
5458
+ }
5457
5459
  });
5458
5460
  })]
5459
5461
  });
@@ -5741,7 +5743,7 @@ function toPrimitive(t, r) {
5741
5743
  if ("object" != _typeof(t) || !t) return t;
5742
5744
  var e = t[Symbol.toPrimitive];
5743
5745
  if (void 0 !== e) {
5744
- var i = e.call(t, r || "default");
5746
+ var i = e.call(t, r);
5745
5747
  if ("object" != _typeof(i)) return i;
5746
5748
  throw new TypeError("@@toPrimitive must return a primitive value.");
5747
5749
  }
@@ -5756,9 +5758,9 @@ function toPropertyKey(t) {
5756
5758
  function _defineProperty(e, r, t) {
5757
5759
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
5758
5760
  value: t,
5759
- enumerable: !0,
5760
- configurable: !0,
5761
- writable: !0
5761
+ enumerable: true,
5762
+ configurable: true,
5763
+ writable: true
5762
5764
  }) : e[r] = t, e;
5763
5765
  }
5764
5766
 
@@ -6718,7 +6720,7 @@ var _excluded = ["style", "className", "classNames"];
6718
6720
 
6719
6721
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
6720
6722
 
6721
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6723
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6722
6724
 
6723
6725
  function createDefaultStyle(defaultStyle, getModifiers) {
6724
6726
  var enhance = function enhance(ComponentToWrap) {
@@ -7184,7 +7186,7 @@ var SuggestionsOverlay$1 = styled$2(SuggestionsOverlay);
7184
7186
 
7185
7187
  function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7186
7188
 
7187
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7189
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7188
7190
 
7189
7191
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7190
7192
 
@@ -7553,7 +7555,7 @@ var MentionsInput = /*#__PURE__*/function (_React$Component) {
7553
7555
 
7554
7556
  case KEY.DOWN:
7555
7557
  {
7556
- _this.shiftFocus(+1);
7558
+ _this.shiftFocus(1);
7557
7559
 
7558
7560
  return;
7559
7561
  }
@@ -8239,6 +8241,7 @@ function ActionInputs(props) {
8239
8241
  const workflowContext = useContext(WorkflowDesignerCtx);
8240
8242
  const InputWrapper = props => {
8241
8243
  const [opened, setOpened] = useState(false);
8244
+ const [changedValue, setChangedValue] = useState(undefined);
8242
8245
  return jsxs(Popover, {
8243
8246
  width: 388,
8244
8247
  closeOnClickOutside: true,
@@ -8262,6 +8265,7 @@ function ActionInputs(props) {
8262
8265
  width: 'calc(100% - 30px)',
8263
8266
  input: props.input,
8264
8267
  action: props.action,
8268
+ value: changedValue,
8265
8269
  onValueChanged: value => workflowContext === null || workflowContext === void 0 ? void 0 : workflowContext.setActionInput(props.action.id, props.input.name, WorkflowActionInputType.manual, value)
8266
8270
  }), jsx(ActionIcon, {
8267
8271
  onClick: () => setOpened(!opened),
@@ -8283,18 +8287,41 @@ function ActionInputs(props) {
8283
8287
  }), jsx(Popover.Dropdown, {
8284
8288
  p: 0,
8285
8289
  children: jsx(OutputsPicker, {
8286
- action: props.action
8290
+ action: props.action,
8291
+ onValuePicked: value => {
8292
+ var _a;
8293
+ workflowContext === null || workflowContext === void 0 ? void 0 : workflowContext.setActionInput(props.action.id, props.input.name, WorkflowActionInputType.manual, value);
8294
+ setChangedValue((_a = workflowContext === null || workflowContext === void 0 ? void 0 : workflowContext.getActionInput(props.action.id, props.input.name)) === null || _a === void 0 ? void 0 : _a.value);
8295
+ }
8287
8296
  })
8288
8297
  })]
8289
8298
  });
8290
8299
  };
8291
8300
  const ActionInputComponent = props => {
8292
8301
  var _a;
8293
- useContext(WorkflowDesignerCtx);
8302
+ const workflowCtx = useContext(WorkflowDesignerCtx);
8294
8303
  const [val, setVal] = useState((_a = props.action.inputs[props.input.name].value) !== null && _a !== void 0 ? _a : '');
8304
+ const inputRef = useRef(null);
8305
+ const [cursorPosition, setCursorPosition] = useState(0);
8306
+ const handleCursorChange = () => {
8307
+ if (inputRef.current) {
8308
+ setCursorPosition(inputRef.current.selectionStart || 0);
8309
+ }
8310
+ };
8295
8311
  useEffect(() => {
8296
8312
  props.onValueChanged(val);
8297
8313
  }, [val]);
8314
+ useEffect(() => {
8315
+ // newVal is val with props.value in cursor position
8316
+ const firstValPart = val.substring(0, cursorPosition);
8317
+ const secondPart = val.substring(cursorPosition);
8318
+ const newVal = firstValPart + props.value + secondPart;
8319
+ setVal(newVal !== null && newVal !== void 0 ? newVal : '');
8320
+ }, [props.value]);
8321
+ useEffect(() => {
8322
+ var _a, _b;
8323
+ setVal((_b = (_a = workflowCtx === null || workflowCtx === void 0 ? void 0 : workflowCtx.getActionInput(props.action.id, props.input.name)) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '');
8324
+ }, [props.action.id, props.input.name, workflowCtx, workflowCtx === null || workflowCtx === void 0 ? void 0 : workflowCtx.workflowDefinition]);
8298
8325
  const onChange = (event, newValue, newPlainTextValue, mentions) => {
8299
8326
  setVal(newValue);
8300
8327
  };
@@ -8313,6 +8340,10 @@ function ActionInputs(props) {
8313
8340
  };
8314
8341
  if (props.input.type !== 'string') {
8315
8342
  return jsx(MentionsInput$1, {
8343
+ inputRef: inputRef,
8344
+ onClick: handleCursorChange,
8345
+ onKeyUp: handleCursorChange,
8346
+ onSelect: handleCursorChange,
8316
8347
  style: {
8317
8348
  control: {
8318
8349
  backgroundColor: '#fff',
@@ -8376,9 +8407,15 @@ function ActionInputs(props) {
8376
8407
  style: {
8377
8408
  backgroundColor: "#cee4e5"
8378
8409
  },
8379
- renderSuggestion: (a, b, c, e, m) => {
8380
- return jsxs("div", {
8381
- children: [a.display, " - ", b, " - ", e, " - ", m]
8410
+ renderSuggestion: (suggestionDataItem, search, highlightedDisplay, index, focused) => {
8411
+ return jsx("div", {
8412
+ style: {
8413
+ padding: '4px 8px',
8414
+ fontSize: '14px',
8415
+ color: focused ? '#fff' : '#333',
8416
+ backgroundColor: focused ? '#06f' : 'transparent'
8417
+ },
8418
+ children: suggestionDataItem.display
8382
8419
  });
8383
8420
  }
8384
8421
  })
@@ -8936,7 +8973,7 @@ function WorkflowDesigner(props) {
8936
8973
  function WorkflowDesignerInner() {
8937
8974
  //const [workflowTree, setWorkflowTree] = React.useState<TreeNode>();
8938
8975
  //const workflowContext = useContext(WorkflowDesignerCtx);
8939
- React__default.useState(false);
8976
+ const [added, setAdded] = React__default.useState(false);
8940
8977
  //const [wfDefinition, setWfDefinition] = React.useState<Workflow | undefined>(undefined);
8941
8978
  const wfCtx = useContext(WorkflowDesignerCtx);
8942
8979
  const [lastAction, setLastAction] = React__default.useState(undefined);
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@fluxo-dev/shell-workflow",
3
- "version": "25.1.3",
3
+ "version": "25.1.5",
4
4
  "peerDependencies": {
5
5
  "react": "^18.3.1",
6
6
  "@mantine/core": "^7.12.2",
7
7
  "react-router-dom": "^6.11.2",
8
8
  "react-redux": "^8.0.5",
9
9
  "@reduxjs/toolkit": "^1.9.1",
10
- "@fluxo-dev/api-client-base": "^25.1.3",
11
- "@fluxo-dev/state": "^25.1.3",
12
- "@fluxo-dev/ui-components": "^25.1.3"
10
+ "@fluxo-dev/api-client-base": "^25.1.5",
11
+ "@fluxo-dev/state": "^25.1.5",
12
+ "@fluxo-dev/ui-components": "^25.1.5"
13
13
  },
14
14
  "module": "./index.esm.js",
15
15
  "type": "module",
@@ -1,5 +1,6 @@
1
1
  import { WorkflowAction } from "@fluxo-dev/api-client-base";
2
2
  export interface OutputsPickerProps {
3
3
  action: WorkflowAction;
4
+ onValuePicked: (value: string) => void;
4
5
  }
5
6
  export declare function OutputsPicker(props: OutputsPickerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { TriggerCategoryDefinition, TriggerDefinition, Workflow, WorkflowAction, WorkflowActionInputType } from "@fluxo-dev/api-client-base";
2
+ import { TriggerCategoryDefinition, TriggerDefinition, Workflow, WorkflowAction, WorkflowActionInput, WorkflowActionInputType } from '@fluxo-dev/api-client-base';
3
3
  import { IWorkflowDesignerManager } from "../services/workflow-manager-interface";
4
4
  import { ActionCategoryDefinition, ActionDefinition, ActionOutputDefinition } from "@fluxo-dev/api-client-base";
5
5
  export interface WorkflowDesignerContextState extends IWorkflowDesignerManager {
@@ -15,6 +15,7 @@ export interface WorkflowDesignerContextState extends IWorkflowDesignerManager {
15
15
  outputs: ActionOutputDefinition[];
16
16
  }[];
17
17
  setActionInput: (actionId: string, inputPropertyName: string, inputType: WorkflowActionInputType, value: string) => void;
18
+ getActionInput: (actionId: string, getActionInput: string) => WorkflowActionInput | undefined;
18
19
  getTriggerDefinition: () => TriggerDefinition | undefined;
19
20
  }
20
21
  interface WorkflowDesignerContextProps {
@@ -1,5 +1,5 @@
1
1
  import { IWorkflowDesignerManager } from "./workflow-manager-interface";
2
- import { Workflow, WorkflowAction, WorkflowActionInputType, WorkflowTrigger } from "@fluxo-dev/api-client-base";
2
+ import { Workflow, WorkflowAction, WorkflowActionInput, WorkflowActionInputType, WorkflowTrigger } from '@fluxo-dev/api-client-base';
3
3
  export declare class WorkflowDesignerManager implements IWorkflowDesignerManager {
4
4
  private _workflowDefinition;
5
5
  private _mode;
@@ -65,6 +65,7 @@ export declare class WorkflowDesignerManager implements IWorkflowDesignerManager
65
65
  */
66
66
  findParentAction(childActionId: string): WorkflowAction | undefined;
67
67
  setActionInput(actionId: string, inputPropertyName: string, inputType: WorkflowActionInputType, value: string): void;
68
+ getActionInput(actionId: string, inputPropertyName: string): WorkflowActionInput | undefined;
68
69
  private findActionRecursive;
69
70
  private removeSimpleAction;
70
71
  private removeCustomOutcomeAction;