@nocobase/plugin-workflow 0.9.4-alpha.2 → 0.10.0-alpha.3

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.
Files changed (116) hide show
  1. package/lib/client/AddButton.d.ts +2 -2
  2. package/lib/client/AddButton.js +76 -65
  3. package/lib/client/Branch.d.ts +2 -2
  4. package/lib/client/CanvasContent.d.ts +2 -2
  5. package/lib/client/ExecutionCanvas.d.ts +2 -2
  6. package/lib/client/ExecutionCanvas.js +1 -1
  7. package/lib/client/ExecutionLink.d.ts +2 -1
  8. package/lib/client/ExecutionPage.d.ts +2 -1
  9. package/lib/client/ExecutionPage.js +14 -15
  10. package/lib/client/ExecutionResourceProvider.d.ts +2 -1
  11. package/lib/client/WorkflowCanvas.d.ts +2 -2
  12. package/lib/client/WorkflowCanvas.js +31 -31
  13. package/lib/client/WorkflowLink.d.ts +2 -1
  14. package/lib/client/WorkflowPage.d.ts +2 -1
  15. package/lib/client/WorkflowPage.js +11 -10
  16. package/lib/client/WorkflowProvider.d.ts +1 -1
  17. package/lib/client/WorkflowProvider.js +15 -15
  18. package/lib/client/components/CollectionBlockInitializer.d.ts +2 -7
  19. package/lib/client/components/CollectionBlockInitializer.js +49 -17
  20. package/lib/client/components/CollectionFieldset.d.ts +3 -2
  21. package/lib/client/components/CollectionFieldset.js +87 -74
  22. package/lib/client/components/Duration.d.ts +2 -2
  23. package/lib/client/components/DynamicExpression.d.ts +3 -1
  24. package/lib/client/components/DynamicExpression.js +2 -0
  25. package/lib/client/components/FieldsSelect.d.ts +1 -1
  26. package/lib/client/components/FieldsSelect.js +2 -0
  27. package/lib/client/components/FilterDynamicComponent.d.ts +2 -2
  28. package/lib/client/components/NodeDescription.d.ts +2 -2
  29. package/lib/client/components/OpenDrawer.d.ts +2 -2
  30. package/lib/client/components/OpenDrawer.js +1 -1
  31. package/lib/client/components/RadioWithTooltip.d.ts +2 -2
  32. package/lib/client/components/renderEngineReference.d.ts +2 -1
  33. package/lib/client/constants.d.ts +2 -1
  34. package/lib/client/locale/zh-CN.d.ts +8 -0
  35. package/lib/client/locale/zh-CN.js +8 -0
  36. package/lib/client/nodes/aggregate.d.ts +1 -1
  37. package/lib/client/nodes/calculation.d.ts +4 -3
  38. package/lib/client/nodes/condition.d.ts +6 -4
  39. package/lib/client/nodes/condition.js +3 -1
  40. package/lib/client/nodes/create.d.ts +3 -6
  41. package/lib/client/nodes/create.js +1 -4
  42. package/lib/client/nodes/index.d.ts +5 -5
  43. package/lib/client/nodes/index.js +9 -6
  44. package/lib/client/nodes/loop.d.ts +4 -1
  45. package/lib/client/nodes/loop.js +3 -1
  46. package/lib/client/nodes/manual/AssigneesSelect.d.ts +2 -2
  47. package/lib/client/nodes/manual/DetailsBlockProvider.d.ts +2 -0
  48. package/lib/client/nodes/manual/DetailsBlockProvider.js +106 -0
  49. package/lib/client/nodes/manual/FormBlockInitializer.d.ts +2 -0
  50. package/lib/client/nodes/manual/FormBlockInitializer.js +106 -0
  51. package/lib/client/nodes/manual/FormBlockProvider.d.ts +2 -0
  52. package/lib/client/nodes/manual/FormBlockProvider.js +113 -0
  53. package/lib/client/nodes/manual/ModeConfig.d.ts +2 -2
  54. package/lib/client/nodes/manual/SchemaConfig.d.ts +43 -3
  55. package/lib/client/nodes/manual/SchemaConfig.js +42 -79
  56. package/lib/client/nodes/manual/WorkflowTodo.d.ts +5 -8
  57. package/lib/client/nodes/manual/WorkflowTodo.js +111 -76
  58. package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +2 -2
  59. package/lib/client/nodes/manual/forms/create.d.ts +3 -0
  60. package/lib/client/nodes/manual/forms/create.js +104 -0
  61. package/lib/client/nodes/manual/forms/custom.d.ts +3 -0
  62. package/lib/client/nodes/manual/forms/{customForm.js → custom.js} +63 -45
  63. package/lib/client/nodes/manual/forms/update.d.ts +3 -0
  64. package/lib/client/nodes/manual/forms/update.js +161 -0
  65. package/lib/client/nodes/manual/index.d.ts +2 -5
  66. package/lib/client/nodes/manual/index.js +17 -16
  67. package/lib/client/nodes/manual/utils.d.ts +2 -0
  68. package/lib/client/nodes/manual/utils.js +31 -0
  69. package/lib/client/nodes/parallel.d.ts +4 -1
  70. package/lib/client/nodes/parallel.js +3 -1
  71. package/lib/client/nodes/query.d.ts +2 -5
  72. package/lib/client/nodes/query.js +2 -5
  73. package/lib/client/nodes/request.d.ts +1 -1
  74. package/lib/client/nodes/request.js +1 -11
  75. package/lib/client/nodes/update.d.ts +24 -1
  76. package/lib/client/nodes/update.js +76 -3
  77. package/lib/client/schemas/collection.js +1 -1
  78. package/lib/client/schemas/executions.d.ts +2 -0
  79. package/lib/client/style.js +4 -0
  80. package/lib/client/triggers/collection.d.ts +2 -5
  81. package/lib/client/triggers/collection.js +5 -8
  82. package/lib/client/triggers/index.d.ts +1 -2
  83. package/lib/client/triggers/index.js +10 -8
  84. package/lib/client/triggers/schedule/DateFieldsSelect.js +14 -12
  85. package/lib/client/triggers/schedule/EndsByField.d.ts +2 -2
  86. package/lib/client/triggers/schedule/OnField.d.ts +2 -2
  87. package/lib/client/triggers/schedule/RepeatField.d.ts +2 -2
  88. package/lib/client/triggers/schedule/ScheduleConfig.d.ts +2 -1
  89. package/lib/client/triggers/schedule/index.d.ts +3 -6
  90. package/lib/client/triggers/schedule/index.js +1 -4
  91. package/lib/server/Plugin.js +6 -3
  92. package/lib/server/Processor.d.ts +2 -2
  93. package/lib/server/Processor.js +22 -26
  94. package/lib/server/instructions/delay.js +1 -1
  95. package/lib/server/instructions/loop.d.ts +1 -1
  96. package/lib/server/instructions/loop.js +1 -1
  97. package/lib/server/instructions/manual/actions.js +42 -47
  98. package/lib/server/instructions/manual/forms/create.d.ts +5 -0
  99. package/lib/server/instructions/manual/forms/create.js +46 -0
  100. package/lib/server/instructions/manual/forms/index.d.ts +6 -0
  101. package/lib/server/instructions/manual/forms/index.js +15 -0
  102. package/lib/server/instructions/manual/forms/update.d.ts +6 -0
  103. package/lib/server/instructions/manual/forms/update.js +47 -0
  104. package/lib/server/instructions/manual/index.d.ts +3 -0
  105. package/lib/server/instructions/manual/index.js +16 -3
  106. package/lib/server/instructions/parallel.js +2 -2
  107. package/lib/server/instructions/request.js +3 -3
  108. package/lib/server/instructions/update.js +2 -3
  109. package/lib/server/migrations/20230612021134-manual-collection-block.d.ts +4 -0
  110. package/lib/server/migrations/20230612021134-manual-collection-block.js +155 -0
  111. package/package.json +16 -13
  112. package/lib/client/WorkflowShortcut.d.ts +0 -1
  113. package/lib/client/WorkflowShortcut.js +0 -48
  114. package/lib/client/components/CollectionFieldInitializers.d.ts +0 -2
  115. package/lib/client/components/CollectionFieldInitializers.js +0 -70
  116. package/lib/client/nodes/manual/forms/customForm.d.ts +0 -40
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  interface AddButtonProps {
3
3
  upstream: any;
4
4
  branchIndex?: number | null;
5
5
  }
6
- export declare function AddButton({ upstream, branchIndex }: AddButtonProps): JSX.Element;
6
+ export declare function AddButton({ upstream, branchIndex }: AddButtonProps): React.JSX.Element;
7
7
  export {};
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.AddButton = AddButton;
7
- function _react() {
8
- const data = _interopRequireDefault(require("react"));
9
- _react = function _react() {
7
+ function _icons() {
8
+ const data = require("@ant-design/icons");
9
+ _icons = function _icons() {
10
10
  return data;
11
11
  };
12
12
  return data;
@@ -18,45 +18,46 @@ function _css() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _antd() {
22
- const data = require("antd");
23
- _antd = function _antd() {
21
+ function _client() {
22
+ const data = require("@nocobase/client");
23
+ _client = function _client() {
24
24
  return data;
25
25
  };
26
26
  return data;
27
27
  }
28
- function _icons() {
29
- const data = require("@ant-design/icons");
30
- _icons = function _icons() {
28
+ function _antd() {
29
+ const data = require("antd");
30
+ _antd = function _antd() {
31
31
  return data;
32
32
  };
33
33
  return data;
34
34
  }
35
- function _client() {
36
- const data = require("@nocobase/client");
37
- _client = function _client() {
35
+ function _react() {
36
+ const data = _interopRequireWildcard(require("react"));
37
+ _react = function _react() {
38
38
  return data;
39
39
  };
40
40
  return data;
41
41
  }
42
42
  var _FlowContext = require("./FlowContext");
43
+ var _locale = require("./locale");
43
44
  var _nodes = require("./nodes");
44
45
  var _style = require("./style");
45
- var _locale = require("./locale");
46
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
46
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
47
48
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
48
49
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
49
50
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
50
51
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
51
52
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
52
53
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
54
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
55
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
53
56
  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; }
54
57
  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(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; }
55
58
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
56
59
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
57
60
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
58
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
59
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
60
61
  function AddButton({
61
62
  upstream,
62
63
  branchIndex = null
@@ -67,18 +68,46 @@ function AddButton({
67
68
  const _ref = (_useFlowContext = (0, _FlowContext.useFlowContext)()) !== null && _useFlowContext !== void 0 ? _useFlowContext : {},
68
69
  workflow = _ref.workflow,
69
70
  refresh = _ref.refresh;
70
- if (!workflow) {
71
- return null;
72
- }
73
- const resource = api.resource('workflows.nodes', workflow.id);
74
- function onCreate(_x) {
75
- return _onCreate.apply(this, arguments);
76
- }
77
- function _onCreate() {
78
- _onCreate = _asyncToGenerator(function* ({
71
+ const instructionList = Array.from(_nodes.instructions.getValues());
72
+ const groups = (0, _react().useMemo)(() => {
73
+ return [{
74
+ key: 'control',
75
+ label: `{{t("Control", { ns: "${_locale.NAMESPACE}" })}}`
76
+ }, {
77
+ key: 'collection',
78
+ label: `{{t("Collection operations", { ns: "${_locale.NAMESPACE}" })}}`
79
+ }, {
80
+ key: 'manual',
81
+ label: `{{t("Manual", { ns: "${_locale.NAMESPACE}" })}}`
82
+ }, {
83
+ key: 'extended',
84
+ label: `{{t("Extended types", { ns: "${_locale.NAMESPACE}" })}}`
85
+ }].filter(group => instructionList.filter(item => item.group === group.key).length).map(group => {
86
+ const groupInstructions = instructionList.filter(item => item.group === group.key);
87
+ return _objectSpread(_objectSpread({}, group), {}, {
88
+ type: 'group',
89
+ children: groupInstructions.map(item => ({
90
+ key: item.type,
91
+ label: item.title,
92
+ type: item.options ? 'subMenu' : null,
93
+ children: item.options ? item.options.map(option => ({
94
+ key: option.key,
95
+ label: option.label
96
+ })) : null
97
+ }))
98
+ });
99
+ });
100
+ }, [instructionList]);
101
+ const resource = (0, _react().useMemo)(() => {
102
+ if (!workflow) {
103
+ return null;
104
+ }
105
+ return api.resource('workflows.nodes', workflow.id);
106
+ }, [workflow === null || workflow === void 0 ? void 0 : workflow.id]);
107
+ const onCreate = (0, _react().useCallback)( /*#__PURE__*/function () {
108
+ var _ref2 = _asyncToGenerator(function* ({
79
109
  keyPath
80
110
  }) {
81
- var _upstream$id;
82
111
  const type = keyPath.pop();
83
112
  const config = {};
84
113
  const _keyPath = _slicedToArray(keyPath, 1),
@@ -86,11 +115,13 @@ function AddButton({
86
115
  const instruction = _nodes.instructions.get(type);
87
116
  if (optionKey) {
88
117
  var _instruction$options$, _instruction$options;
89
- const _ref2 = (_instruction$options$ = (_instruction$options = instruction.options) === null || _instruction$options === void 0 ? void 0 : _instruction$options.find(item => item.key === optionKey)) !== null && _instruction$options$ !== void 0 ? _instruction$options$ : {},
90
- value = _ref2.value;
118
+ const _ref3 = (_instruction$options$ = (_instruction$options = instruction.options) === null || _instruction$options === void 0 ? void 0 : _instruction$options.find(item => item.key === optionKey)) !== null && _instruction$options$ !== void 0 ? _instruction$options$ : {},
119
+ value = _ref3.value;
91
120
  Object.assign(config, value);
92
121
  }
93
- const _yield$resource$creat = yield resource.create({
122
+ if (resource) {
123
+ var _upstream$id;
124
+ yield resource.create({
94
125
  values: {
95
126
  type,
96
127
  upstreamId: (_upstream$id = upstream === null || upstream === void 0 ? void 0 : upstream.id) !== null && _upstream$id !== void 0 ? _upstream$id : null,
@@ -98,48 +129,28 @@ function AddButton({
98
129
  title: compile(instruction.title),
99
130
  config
100
131
  }
101
- }),
102
- node = _yield$resource$creat.data.data;
103
- refresh();
132
+ });
133
+ refresh();
134
+ }
104
135
  });
105
- return _onCreate.apply(this, arguments);
136
+ return function (_x) {
137
+ return _ref2.apply(this, arguments);
138
+ };
139
+ }(), [branchIndex, resource === null || resource === void 0 ? void 0 : resource.create, upstream === null || upstream === void 0 ? void 0 : upstream.id]);
140
+ const menu = (0, _react().useMemo)(() => {
141
+ return {
142
+ onClick: ev => onCreate(ev),
143
+ items: compile(groups)
144
+ };
145
+ }, [groups, onCreate]);
146
+ if (!workflow) {
147
+ return null;
106
148
  }
107
- const instructionList = Array.from(_nodes.instructions.getValues());
108
- const groups = [{
109
- key: 'control',
110
- label: `{{t("Control", { ns: "${_locale.NAMESPACE}" })}}`
111
- }, {
112
- key: 'collection',
113
- label: `{{t("Collection operations", { ns: "${_locale.NAMESPACE}" })}}`
114
- }, {
115
- key: 'manual',
116
- label: `{{t("Manual", { ns: "${_locale.NAMESPACE}" })}}`
117
- }, {
118
- key: 'extended',
119
- label: `{{t("Extended types", { ns: "${_locale.NAMESPACE}" })}}`
120
- }].filter(group => instructionList.filter(item => item.group === group.key).length).map(group => {
121
- const groupInstructions = instructionList.filter(item => item.group === group.key);
122
- return _objectSpread(_objectSpread({}, group), {}, {
123
- type: 'group',
124
- children: groupInstructions.map(item => ({
125
- key: item.type,
126
- label: item.title,
127
- type: item.options ? 'subMenu' : null,
128
- children: item.options ? item.options.map(option => ({
129
- key: option.key,
130
- label: option.label
131
- })) : null
132
- }))
133
- });
134
- });
135
149
  return _react().default.createElement("div", {
136
150
  className: (0, _css().cx)(_style.addButtonClass)
137
151
  }, _react().default.createElement(_antd().Dropdown, {
138
152
  trigger: ['click'],
139
- overlay: _react().default.createElement(_antd().Menu, {
140
- onClick: ev => onCreate(ev),
141
- items: compile(groups)
142
- }),
153
+ menu: menu,
143
154
  disabled: workflow.executed
144
155
  }, _react().default.createElement(_antd().Button, {
145
156
  shape: "circle",
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export declare function Branch({ from, entry, branchIndex, controller, }: {
3
3
  from?: any;
4
4
  entry?: any;
5
5
  branchIndex?: number | null;
6
6
  controller?: any;
7
- }): JSX.Element;
7
+ }): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  export declare function CanvasContent({ entry }: {
3
3
  entry: any;
4
- }): JSX.Element;
4
+ }): React.JSX.Element;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function ExecutionCanvas(): JSX.Element;
1
+ import React from 'react';
2
+ export declare function ExecutionCanvas(): React.JSX.Element;
@@ -93,7 +93,7 @@ function JobModal() {
93
93
  _ref$node = _ref.node,
94
94
  node = _ref$node === void 0 ? {} : _ref$node;
95
95
  const instruction = _nodes.instructions.get(node.type);
96
- return _react().default.createElement(_client().ActionContext.Provider, {
96
+ return _react().default.createElement(_client().ActionContextProvider, {
97
97
  value: {
98
98
  visible: Boolean(job),
99
99
  setVisible: setViewJob
@@ -1 +1,2 @@
1
- export declare const ExecutionLink: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const ExecutionLink: () => React.JSX.Element;
@@ -1 +1,2 @@
1
- export declare const ExecutionPage: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const ExecutionPage: () => React.JSX.Element;
@@ -4,40 +4,39 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ExecutionPage = void 0;
7
- function _react() {
8
- const data = _interopRequireDefault(require("react"));
9
- _react = function _react() {
7
+ function _css() {
8
+ const data = require("@emotion/css");
9
+ _css = function _css() {
10
10
  return data;
11
11
  };
12
12
  return data;
13
13
  }
14
- function _css() {
15
- const data = require("@emotion/css");
16
- _css = function _css() {
14
+ function _client() {
15
+ const data = require("@nocobase/client");
16
+ _client = function _client() {
17
17
  return data;
18
18
  };
19
19
  return data;
20
20
  }
21
- function _reactRouterDom() {
22
- const data = require("react-router-dom");
23
- _reactRouterDom = function _reactRouterDom() {
21
+ function _react() {
22
+ const data = _interopRequireDefault(require("react"));
23
+ _react = function _react() {
24
24
  return data;
25
25
  };
26
26
  return data;
27
27
  }
28
- function _client() {
29
- const data = require("@nocobase/client");
30
- _client = function _client() {
28
+ function _reactRouterDom() {
29
+ const data = require("react-router-dom");
30
+ _reactRouterDom = function _reactRouterDom() {
31
31
  return data;
32
32
  };
33
33
  return data;
34
34
  }
35
- var _style = require("./style");
36
35
  var _ExecutionCanvas = require("./ExecutionCanvas");
36
+ var _style = require("./style");
37
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
38
  const ExecutionPage = () => {
39
- const _useRouteMatch = (0, _reactRouterDom().useRouteMatch)(),
40
- params = _useRouteMatch.params;
39
+ const params = (0, _reactRouterDom().useParams)();
41
40
  return _react().default.createElement("div", {
42
41
  className: (0, _css().cx)(_style.workflowPageClass)
43
42
  }, _react().default.createElement(_client().SchemaComponent, {
@@ -1,5 +1,6 @@
1
+ import React from 'react';
1
2
  export declare const ExecutionResourceProvider: ({ request, filter, ...others }: {
2
3
  [x: string]: any;
3
4
  request: any;
4
5
  filter?: {};
5
- }) => JSX.Element;
6
+ }) => React.JSX.Element;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function WorkflowCanvas(): JSX.Element;
1
+ import React from 'react';
2
+ export declare function WorkflowCanvas(): React.JSX.Element;
@@ -4,44 +4,44 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.WorkflowCanvas = WorkflowCanvas;
7
- function _react() {
8
- const data = _interopRequireWildcard(require("react"));
9
- _react = function _react() {
7
+ function _icons() {
8
+ const data = require("@ant-design/icons");
9
+ _icons = function _icons() {
10
10
  return data;
11
11
  };
12
12
  return data;
13
13
  }
14
- function _reactRouterDom() {
15
- const data = require("react-router-dom");
16
- _reactRouterDom = function _reactRouterDom() {
14
+ function _css() {
15
+ const data = require("@emotion/css");
16
+ _css = function _css() {
17
17
  return data;
18
18
  };
19
19
  return data;
20
20
  }
21
- function _antd() {
22
- const data = require("antd");
23
- _antd = function _antd() {
21
+ function _client() {
22
+ const data = require("@nocobase/client");
23
+ _client = function _client() {
24
24
  return data;
25
25
  };
26
26
  return data;
27
27
  }
28
- function _icons() {
29
- const data = require("@ant-design/icons");
30
- _icons = function _icons() {
28
+ function _antd() {
29
+ const data = require("antd");
30
+ _antd = function _antd() {
31
31
  return data;
32
32
  };
33
33
  return data;
34
34
  }
35
- function _css() {
36
- const data = require("@emotion/css");
37
- _css = function _css() {
35
+ function _classnames() {
36
+ const data = _interopRequireDefault(require("classnames"));
37
+ _classnames = function _classnames() {
38
38
  return data;
39
39
  };
40
40
  return data;
41
41
  }
42
- function _classnames() {
43
- const data = _interopRequireDefault(require("classnames"));
44
- _classnames = function _classnames() {
42
+ function _react() {
43
+ const data = _interopRequireWildcard(require("react"));
44
+ _react = function _react() {
45
45
  return data;
46
46
  };
47
47
  return data;
@@ -53,25 +53,25 @@ function _reactI18next() {
53
53
  };
54
54
  return data;
55
55
  }
56
- function _client() {
57
- const data = require("@nocobase/client");
58
- _client = function _client() {
56
+ function _reactRouterDom() {
57
+ const data = require("react-router-dom");
58
+ _reactRouterDom = function _reactRouterDom() {
59
59
  return data;
60
60
  };
61
61
  return data;
62
62
  }
63
- var _FlowContext = require("./FlowContext");
64
- var _style = require("./style");
65
- var _executions = require("./schemas/executions");
63
+ var _CanvasContent = require("./CanvasContent");
66
64
  var _ExecutionLink = require("./ExecutionLink");
65
+ var _FlowContext = require("./FlowContext");
67
66
  var _locale = require("./locale");
67
+ var _executions = require("./schemas/executions");
68
+ var _style = require("./style");
68
69
  var _utils = require("./utils");
69
- var _CanvasContent = require("./CanvasContent");
70
70
  const _excluded = ["request", "filter"],
71
71
  _excluded2 = ["nodes", "revisions"];
72
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
73
72
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
74
73
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
74
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
75
75
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
76
76
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
77
77
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -108,7 +108,7 @@ function ExecutionResourceProvider(_ref) {
108
108
  }
109
109
  function WorkflowCanvas() {
110
110
  var _data$data2;
111
- const history = (0, _reactRouterDom().useHistory)();
111
+ const navigate = (0, _reactRouterDom().useNavigate)();
112
112
  const _useTranslation = (0, _reactI18next().useTranslation)(),
113
113
  t = _useTranslation.t;
114
114
  const _useResourceActionCon = (0, _client().useResourceActionContext)(),
@@ -144,7 +144,7 @@ function WorkflowCanvas() {
144
144
  key
145
145
  }) {
146
146
  if (key != workflow.id) {
147
- history.push(key);
147
+ navigate(`/admin/settings/workflow/workflows/${key}`);
148
148
  }
149
149
  }
150
150
  function onToggle(_x2) {
@@ -175,7 +175,7 @@ function WorkflowCanvas() {
175
175
  }),
176
176
  revision = _yield$resource$revis.data.data;
177
177
  _antd().message.success(t('Operation succeeded'));
178
- history.push(`${revision.id}`);
178
+ navigate(`/admin/settings/workflow/workflows/${revision.id}`);
179
179
  });
180
180
  return _onRevision.apply(this, arguments);
181
181
  }
@@ -195,7 +195,7 @@ function WorkflowCanvas() {
195
195
  filterByTk: workflow.id
196
196
  });
197
197
  _antd().message.success(t('Operation succeeded'));
198
- history.push(workflow.current ? '..' : `${(_revisions$find = revisions.find(item => item.current)) === null || _revisions$find === void 0 ? void 0 : _revisions$find.id}`);
198
+ navigate(workflow.current ? '/admin/settings/workflow/workflows' : `/admin/settings/workflow/workflows/${(_revisions$find = revisions.find(item => item.current)) === null || _revisions$find === void 0 ? void 0 : _revisions$find.id}`);
199
199
  })();
200
200
  }
201
201
  });
@@ -280,7 +280,7 @@ function WorkflowCanvas() {
280
280
  }, _react().default.createElement(_antd().Button, {
281
281
  type: "text",
282
282
  icon: _react().default.createElement(_icons().EllipsisOutlined, null)
283
- })), _react().default.createElement(_client().ActionContext.Provider, {
283
+ })), _react().default.createElement(_client().ActionContextProvider, {
284
284
  value: {
285
285
  visible,
286
286
  setVisible
@@ -1 +1,2 @@
1
- export declare const WorkflowLink: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const WorkflowLink: () => React.JSX.Element;
@@ -1 +1,2 @@
1
- export declare const WorkflowPage: () => JSX.Element;
1
+ import React from 'react';
2
+ export declare const WorkflowPage: () => React.JSX.Element;
@@ -11,6 +11,13 @@ function _css() {
11
11
  };
12
12
  return data;
13
13
  }
14
+ function _client() {
15
+ const data = require("@nocobase/client");
16
+ _client = function _client() {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
14
21
  function _react() {
15
22
  const data = _interopRequireDefault(require("react"));
16
23
  _react = function _react() {
@@ -25,19 +32,11 @@ function _reactRouterDom() {
25
32
  };
26
33
  return data;
27
34
  }
28
- function _client() {
29
- const data = require("@nocobase/client");
30
- _client = function _client() {
31
- return data;
32
- };
33
- return data;
34
- }
35
35
  var _style = require("./style");
36
36
  var _WorkflowCanvas = require("./WorkflowCanvas");
37
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
38
  const WorkflowPage = () => {
39
- const _useRouteMatch = (0, _reactRouterDom().useRouteMatch)(),
40
- params = _useRouteMatch.params;
39
+ const params = (0, _reactRouterDom().useParams)();
41
40
  return _react().default.createElement("div", {
42
41
  className: (0, _css().cx)(_style.workflowPageClass)
43
42
  }, _react().default.createElement(_client().SchemaComponent, {
@@ -57,7 +56,9 @@ const WorkflowPage = () => {
57
56
  resource: 'workflows',
58
57
  action: 'get',
59
58
  params: {
60
- filter: params,
59
+ filter: {
60
+ id: params.id
61
+ },
61
62
  appends: ['nodes', 'revisions.id', 'revisions.createdAt', 'revisions.current', 'revisions.executed', 'revisions.enabled']
62
63
  }
63
64
  }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  export declare const WorkflowContext: React.Context<{}>;
3
3
  export declare function useWorkflowContext(): {};
4
- export declare const WorkflowProvider: (props: any) => JSX.Element;
4
+ export declare const WorkflowProvider: (props: any) => React.JSX.Element;
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.WorkflowProvider = exports.WorkflowContext = void 0;
7
7
  exports.useWorkflowContext = useWorkflowContext;
8
- function _react() {
9
- const data = _interopRequireWildcard(require("react"));
10
- _react = function _react() {
8
+ function _client() {
9
+ const data = require("@nocobase/client");
10
+ _client = function _client() {
11
11
  return data;
12
12
  };
13
13
  return data;
@@ -19,27 +19,27 @@ function _antd() {
19
19
  };
20
20
  return data;
21
21
  }
22
- function _client() {
23
- const data = require("@nocobase/client");
24
- _client = function _client() {
22
+ function _react() {
23
+ const data = _interopRequireWildcard(require("react"));
24
+ _react = function _react() {
25
25
  return data;
26
26
  };
27
27
  return data;
28
28
  }
29
- var _WorkflowPage = require("./WorkflowPage");
29
+ var _ExecutionLink = require("./ExecutionLink");
30
30
  var _ExecutionPage = require("./ExecutionPage");
31
- var _triggers = require("./triggers");
32
- var _nodes = require("./nodes");
33
- var _locale = require("./locale");
34
- var _workflows = require("./schemas/workflows");
35
- var _WorkflowLink = require("./WorkflowLink");
36
31
  var _ExecutionResourceProvider = require("./ExecutionResourceProvider");
37
- var _ExecutionLink = require("./ExecutionLink");
32
+ var _WorkflowLink = require("./WorkflowLink");
33
+ var _WorkflowPage = require("./WorkflowPage");
34
+ var _DynamicExpression = require("./components/DynamicExpression");
38
35
  var _OpenDrawer = _interopRequireDefault(require("./components/OpenDrawer"));
36
+ var _expression = _interopRequireDefault(require("./interfaces/expression"));
37
+ var _locale = require("./locale");
38
+ var _nodes = require("./nodes");
39
39
  var _WorkflowTodo = require("./nodes/manual/WorkflowTodo");
40
40
  var _WorkflowTodoBlockInitializer = require("./nodes/manual/WorkflowTodoBlockInitializer");
41
- var _DynamicExpression = require("./components/DynamicExpression");
42
- var _expression = _interopRequireDefault(require("./interfaces/expression"));
41
+ var _workflows = require("./schemas/workflows");
42
+ var _triggers = require("./triggers");
43
43
  const _excluded = ["routes", "components"];
44
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
45
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -1,7 +1,2 @@
1
- /// <reference types="react" />
2
- export declare function CollectionBlockInitializer({ insert, collection, dataSource, ...props }: {
3
- [x: string]: any;
4
- insert: any;
5
- collection: any;
6
- dataSource: any;
7
- }): JSX.Element;
1
+ import React from 'react';
2
+ export declare function CollectionBlockInitializer(props: any): React.JSX.Element;