@nocobase/plugin-workflow 0.10.0-alpha.3 → 0.10.0-alpha.4

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.
@@ -129,8 +129,8 @@ function WorkflowCanvas() {
129
129
  title = _ref2.title;
130
130
  setTitle === null || setTitle === void 0 ? void 0 : setTitle(`${(0, _locale.lang)('Workflow')}${title ? `: ${title}` : ''}`);
131
131
  }, [data === null || data === void 0 ? void 0 : data.data]);
132
- if (!(data === null || data === void 0 ? void 0 : data.data) && !loading) {
133
- return _react().default.createElement("div", null, (0, _locale.lang)('Load failed'));
132
+ if (!(data === null || data === void 0 ? void 0 : data.data)) {
133
+ return _react().default.createElement("div", null, loading ? (0, _locale.lang)('Loading') : (0, _locale.lang)('Load failed'));
134
134
  }
135
135
  const _ref3 = (_data$data2 = data === null || data === void 0 ? void 0 : data.data) !== null && _data$data2 !== void 0 ? _data$data2 : {},
136
136
  _ref3$nodes = _ref3.nodes,
@@ -19,6 +19,13 @@ function _css() {
19
19
  };
20
20
  return data;
21
21
  }
22
+ function _core() {
23
+ const data = require("@formily/core");
24
+ _core = function _core() {
25
+ return data;
26
+ };
27
+ return data;
28
+ }
22
29
  function _react2() {
23
30
  const data = require("@formily/react");
24
31
  _react2 = function _react2() {
@@ -193,12 +200,15 @@ const TriggerConfig = () => {
193
200
  setEditingTitle((_workflow$title = workflow.title) !== null && _workflow$title !== void 0 ? _workflow$title : typeTitle);
194
201
  }
195
202
  }, [workflow]);
203
+ const form = (0, _react().useMemo)(() => (0, _core().createForm)({
204
+ values: workflow === null || workflow === void 0 ? void 0 : workflow.config,
205
+ disabled: workflow === null || workflow === void 0 ? void 0 : workflow.executed
206
+ }), [workflow]);
196
207
  if (!workflow || !workflow.type) {
197
208
  return null;
198
209
  }
199
210
  const title = workflow.title,
200
211
  type = workflow.type,
201
- config = workflow.config,
202
212
  executed = workflow.executed;
203
213
  const trigger = triggers.get(type);
204
214
  const fieldset = trigger.fieldset,
@@ -262,6 +272,7 @@ const TriggerConfig = () => {
262
272
  }
263
273
  }, _react().default.createElement(_client2().SchemaComponent, {
264
274
  schema: {
275
+ name: `workflow-trigger-${workflow.id}`,
265
276
  type: 'void',
266
277
  properties: {
267
278
  config: {
@@ -277,14 +288,9 @@ const TriggerConfig = () => {
277
288
  type: 'void',
278
289
  title: titleText,
279
290
  'x-component': 'Action.Drawer',
280
- 'x-decorator': 'Form',
291
+ 'x-decorator': 'FormV2',
281
292
  'x-decorator-props': {
282
- disabled: workflow.executed,
283
- useValues(options) {
284
- return (0, _client2().useRequest)(() => Promise.resolve({
285
- data: config
286
- }), options);
287
- }
293
+ form
288
294
  },
289
295
  properties: _objectSpread(_objectSpread({}, executed ? {
290
296
  alert: {
@@ -174,7 +174,17 @@ const ModeFieldsets = {
174
174
  placeholder: `{{t("No limit", { ns: "${_locale.NAMESPACE}" })}}`,
175
175
  min: 0
176
176
  }
177
- }
177
+ },
178
+ appends: _objectSpread(_objectSpread({}, _collection.appends), {}, {
179
+ 'x-reactions': [{
180
+ dependencies: ['mode', 'collection'],
181
+ fulfill: {
182
+ state: {
183
+ visible: `{{$deps[0] === ${_constants.SCHEDULE_MODE.COLLECTION_FIELD} && $deps[1]}}`
184
+ }
185
+ }
186
+ }]
187
+ })
178
188
  }
179
189
  };
180
190
  const scheduleModeOptions = [{
@@ -8,26 +8,6 @@ declare const _default: {
8
8
  'x-component': string;
9
9
  'x-component-props': {};
10
10
  };
11
- appends: {
12
- 'x-reactions': {
13
- dependencies: string[];
14
- fulfill: {
15
- state: {
16
- visible: string;
17
- };
18
- };
19
- }[];
20
- type: string;
21
- title: string;
22
- description: string;
23
- 'x-decorator': string;
24
- 'x-component': string;
25
- 'x-component-props': {
26
- mode: string;
27
- placeholder: string;
28
- filter(field: any): boolean;
29
- };
30
- };
31
11
  };
32
12
  scope: {
33
13
  useCollectionDataSource: typeof useCollectionDataSource;
@@ -16,13 +16,7 @@ var _constants = require("./constants");
16
16
  var _locale = require("../../locale");
17
17
  var _CollectionBlockInitializer = require("../../components/CollectionBlockInitializer");
18
18
  var _variable = require("../../variable");
19
- var _collection = require("../../schemas/collection");
20
19
  var _FieldsSelect = require("../../components/FieldsSelect");
21
- 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; }
22
- 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; }
23
- 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; }
24
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
25
- 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); }
26
20
  var _default = {
27
21
  title: `{{t("Schedule event", { ns: "${_locale.NAMESPACE}" })}}`,
28
22
  type: 'schedule',
@@ -31,17 +25,7 @@ var _default = {
31
25
  type: 'void',
32
26
  'x-component': 'ScheduleConfig',
33
27
  'x-component-props': {}
34
- },
35
- appends: _objectSpread(_objectSpread({}, _collection.appends), {}, {
36
- 'x-reactions': [{
37
- dependencies: ['mode', 'collection'],
38
- fulfill: {
39
- state: {
40
- visible: `{{$deps[0] === ${_constants.SCHEDULE_MODE.COLLECTION_FIELD} && $deps[1]}}`
41
- }
42
- }
43
- }]
44
- })
28
+ }
45
29
  },
46
30
  scope: {
47
31
  useCollectionDataSource: _client().useCollectionDataSource
package/package.json CHANGED
@@ -4,19 +4,19 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": " a powerful workflow plugin designed to support business process management and automation. .",
6
6
  "description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
7
- "version": "0.10.0-alpha.3",
7
+ "version": "0.10.0-alpha.4",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./lib/index.js",
10
10
  "types": "./lib/index.d.ts",
11
11
  "dependencies": {
12
- "@nocobase/actions": "0.10.0-alpha.3",
13
- "@nocobase/client": "0.10.0-alpha.3",
14
- "@nocobase/database": "0.10.0-alpha.3",
15
- "@nocobase/evaluators": "0.10.0-alpha.3",
16
- "@nocobase/logger": "0.10.0-alpha.3",
17
- "@nocobase/resourcer": "0.10.0-alpha.3",
18
- "@nocobase/server": "0.10.0-alpha.3",
19
- "@nocobase/utils": "0.10.0-alpha.3",
12
+ "@nocobase/actions": "0.10.0-alpha.4",
13
+ "@nocobase/client": "0.10.0-alpha.4",
14
+ "@nocobase/database": "0.10.0-alpha.4",
15
+ "@nocobase/evaluators": "0.10.0-alpha.4",
16
+ "@nocobase/logger": "0.10.0-alpha.4",
17
+ "@nocobase/resourcer": "0.10.0-alpha.4",
18
+ "@nocobase/server": "0.10.0-alpha.4",
19
+ "@nocobase/utils": "0.10.0-alpha.4",
20
20
  "antd": "^4.24.8",
21
21
  "axios": "^0.27.2",
22
22
  "classnames": "^2.3.1",
@@ -26,9 +26,9 @@
26
26
  "react-js-cron": "^3.1.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@nocobase/plugin-formula-field": "0.10.0-alpha.3",
30
- "@nocobase/test": "0.10.0-alpha.3",
29
+ "@nocobase/plugin-formula-field": "0.10.0-alpha.4",
30
+ "@nocobase/test": "0.10.0-alpha.4",
31
31
  "@types/ejs": "^3.1.1"
32
32
  },
33
- "gitHead": "1f0b27fc9ab2398cd41c308a6b01a986e025cd20"
33
+ "gitHead": "62dacadb2a83d30cb36dda9074f2f3a072a37484"
34
34
  }