@nocobase/plugin-workflow 0.12.0-alpha.4 → 0.12.0-alpha.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.
@@ -2228,13 +2228,22 @@
2228
2228
  uiSchema: {
2229
2229
  title: lang("Trigger data")
2230
2230
  }
2231
+ },
2232
+ {
2233
+ collectionName: "users",
2234
+ name: "user",
2235
+ type: "hasOne",
2236
+ target: "users",
2237
+ uiSchema: {
2238
+ title: lang("User submitted form")
2239
+ }
2231
2240
  }
2232
2241
  ];
2233
2242
  const result = getCollectionFieldOptions({
2234
2243
  // depth,
2235
2244
  ...options,
2236
2245
  fields: rootFields,
2237
- appends: ["data", ...((_a = config.appends) == null ? void 0 : _a.map((item) => `data.${item}`)) || []],
2246
+ appends: ["data", "user", ...((_a = config.appends) == null ? void 0 : _a.map((item) => `data.${item}`)) || []],
2238
2247
  compile,
2239
2248
  getCollectionFields
2240
2249
  });
@@ -2949,9 +2958,10 @@
2949
2958
  return opts.find((item) => !(v2 % item.value));
2950
2959
  }
2951
2960
  function getRepeatTypeValue(v2) {
2961
+ let option;
2952
2962
  switch (typeof v2) {
2953
2963
  case "number":
2954
- const option = getNumberOption$1(v2);
2964
+ option = getNumberOption$1(v2);
2955
2965
  return option ? option.value : "none";
2956
2966
  case "string":
2957
2967
  return "cron";
@@ -2968,7 +2978,8 @@
2968
2978
  onChange: (v2) => onChange(v2 * option.value),
2969
2979
  min: 1,
2970
2980
  addonBefore: t("Every"),
2971
- addonAfter: t(option.unitText)
2981
+ addonAfter: t(option.unitText),
2982
+ className: "auto-width"
2972
2983
  }
2973
2984
  );
2974
2985
  }
@@ -2997,6 +3008,7 @@
2997
3008
  gap: 0.5em;
2998
3009
 
2999
3010
  .react-js-cron {
3011
+ width: 100%;
3000
3012
  padding: 0.5em 0.5em 0 0.5em;
3001
3013
  border: 1px dashed #ccc;
3002
3014
 
@@ -3011,10 +3023,16 @@
3011
3023
  margin: 0 0.5em 0 0;
3012
3024
  }
3013
3025
  }
3026
+
3027
+ .react-js-cron-week-days {
3028
+ > span {
3029
+ min-width: 2em;
3030
+ }
3031
+ }
3014
3032
  }
3015
3033
  `,
3016
3034
  children: [
3017
- /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select, { value: typeValue, onChange: onTypeChange, children: RepeatOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { value: item.value, children: t(item.text) }, item.value)) }),
3035
+ /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select, { value: typeValue, onChange: onTypeChange, className: "auto-width", children: RepeatOptions.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx(antd.Select.Option, { value: item.value, children: t(item.text) }, item.value)) }),
3018
3036
  typeof typeValue === "number" ? /* @__PURE__ */ jsxRuntimeExports.jsx(CommonRepeatField, { value, onChange }) : null,
3019
3037
  typeValue === "cron" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
3020
3038
  J,
@@ -3223,7 +3241,8 @@
3223
3241
  "x-component-props": {
3224
3242
  className: client.css`
3225
3243
  .ant-input-number {
3226
- width: 4em;
3244
+ width: auto;
3245
+ min-width: 6em;
3227
3246
  }
3228
3247
 
3229
3248
  .ant-picker {
@@ -4891,7 +4910,7 @@
4891
4910
  const scope = useWorkflowVariableOptions();
4892
4911
  const { values: config } = form;
4893
4912
  const collectionName = config == null ? void 0 : config.collection;
4894
- const collectionFields = getCollectionFields(collectionName);
4913
+ const collectionFields = getCollectionFields(collectionName).filter((field) => field.uiSchema);
4895
4914
  const fields = filter2 ? collectionFields.filter(filter2.bind(config)) : collectionFields;
4896
4915
  const unassignedFields = React.useMemo(() => fields.filter((field) => !value || !(field.name in value)), [fields, value]);
4897
4916
  const mergedDisabled = disabled || form.disabled;
@@ -8671,13 +8690,14 @@
8671
8690
  type: "object",
8672
8691
  "x-component": "fieldset",
8673
8692
  properties: {
8674
- useTransaction: {
8675
- type: "boolean",
8676
- title: `{{ t("Use transaction", { ns: "${NAMESPACE}" }) }}`,
8677
- description: `{{ t("Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.", { ns: "${NAMESPACE}" }) }}`,
8678
- "x-decorator": "FormItem",
8679
- "x-component": "Checkbox"
8680
- },
8693
+ // NOTE: not to expose this option for now, because hard to track errors
8694
+ // useTransaction: {
8695
+ // type: 'boolean',
8696
+ // title: `{{ t("Use transaction", { ns: "${NAMESPACE}" }) }}`,
8697
+ // description: `{{ t("Data operation nodes in workflow will run in a same transaction until any interruption. Any failure will cause data rollback, and will also rollback the history of the execution.", { ns: "${NAMESPACE}" }) }}`,
8698
+ // 'x-decorator': 'FormItem',
8699
+ // 'x-component': 'Checkbox',
8700
+ // },
8681
8701
  deleteExecutionOnStatus: {
8682
8702
  type: "array",
8683
8703
  title: `{{ t("Auto delete history when execution is on end status", { ns: "${NAMESPACE}" }) }}`,
@@ -8745,7 +8765,10 @@
8745
8765
  },
8746
8766
  title: '{{t("Add new")}}',
8747
8767
  properties: {
8748
- ...workflowFieldset,
8768
+ title: workflowFieldset.title,
8769
+ type: workflowFieldset.type,
8770
+ description: workflowFieldset.description,
8771
+ options: workflowFieldset.options,
8749
8772
  footer: {
8750
8773
  type: "void",
8751
8774
  "x-component": "Action.Drawer.Footer",
@@ -8906,7 +8929,10 @@
8906
8929
  },
8907
8930
  title: '{{ t("Edit") }}',
8908
8931
  properties: {
8909
- ...workflowFieldset,
8932
+ title: workflowFieldset.title,
8933
+ enabled: workflowFieldset.enabled,
8934
+ description: workflowFieldset.description,
8935
+ options: workflowFieldset.options,
8910
8936
  footer: {
8911
8937
  type: "void",
8912
8938
  "x-component": "Action.Drawer.Footer",
@@ -30,6 +30,7 @@ declare const _default: {
30
30
  'Form data model': string;
31
31
  'Use a collection to match form data.': string;
32
32
  'Associations to use': string;
33
+ 'User submitted form': string;
33
34
  'Bind workflows': string;
34
35
  'Workflow will be triggered after submitting succeeded.': string;
35
36
  'Workflow will be triggered after saving succeeded.': string;
@@ -32,6 +32,7 @@ var zh_CN_default = {
32
32
  "Form data model": "\u8868\u5355\u6570\u636E\u6A21\u578B",
33
33
  "Use a collection to match form data.": "\u4F7F\u7528\u4E00\u4E2A\u6570\u636E\u8868\u6765\u5339\u914D\u8868\u5355\u6570\u636E\u3002",
34
34
  "Associations to use": "\u5F85\u4F7F\u7528\u7684\u5173\u7CFB\u6570\u636E",
35
+ "User submitted form": "\u63D0\u4EA4\u8868\u5355\u7684\u7528\u6237",
35
36
  "Bind workflows": "\u7ED1\u5B9A\u5DE5\u4F5C\u6D41",
36
37
  "Workflow will be triggered after submitting succeeded.": "\u63D0\u4EA4\u6210\u529F\u540E\u89E6\u53D1\u5DE5\u4F5C\u6D41\u3002",
37
38
  "Workflow will be triggered after saving succeeded.": "\u4FDD\u5B58\u6210\u529F\u540E\u89E6\u53D1\u5DE5\u4F5C\u6D41\u3002",
@@ -1 +1 @@
1
- {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2023-08-15T04:39:36.240Z"}
1
+ {"name":"cron-parser","version":"4.4.0","description":"Node.js library for parsing crontab instructions","main":"lib/parser.js","types":"index.d.ts","typesVersions":{"<4.1":{"*":["types/ts3/*"]}},"directories":{"test":"test"},"scripts":{"test:tsd":"tsd","test:unit":"TZ=UTC tap ./test/*.js","test:cover":"TZ=UTC tap --coverage-report=html ./test/*.js","lint":"eslint .","lint:fix":"eslint --fix .","test":"npm run lint && npm run test:unit && npm run test:tsd"},"repository":{"type":"git","url":"https://github.com/harrisiirak/cron-parser.git"},"keywords":["cron","crontab","parser"],"author":"Harri Siirak","contributors":["Nicholas Clawson","Daniel Prentis <daniel@salsitasoft.com>","Renault John Lecoultre","Richard Astbury <richard.astbury@gmail.com>","Meaglin Wasabi <Meaglin.wasabi@gmail.com>","Mike Kusold <hello@mikekusold.com>","Alex Kit <alex.kit@atmajs.com>","Santiago Gimeno <santiago.gimeno@gmail.com>","Daniel <darc.tec@gmail.com>","Christian Steininger <christian.steininger.cs@gmail.com>","Mykola Piskovyi <m.piskovyi@gmail.com>","Brian Vaughn <brian.david.vaughn@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Yasuhiroki <yasuhiroki.duck@gmail.com>","Nicholas Clawson <nickclaw@gmail.com>","Brendan Warkentin <faazshift@gmail.com>","Charlie Fish <fishcharlie.code@gmail.com>","Ian Graves <ian+diskimage@iangrav.es>","Andy Thompson <me@andytson.com>","Regev Brody <regevbr@gmail.com>"],"license":"MIT","dependencies":{"luxon":"^1.28.0"},"devDependencies":{"eslint":"^8.2.0","sinon":"^10.0.0","tap":"^16.0.1","tsd":"^0.19.0"},"engines":{"node":">=0.8"},"browser":{"fs":false},"tap":{"check-coverage":false},"tsd":{"directory":"test","compilerOptions":{"lib":["es2017","dom"]}},"_lastModified":"2023-08-18T08:41:04.503Z"}
@@ -1 +1 @@
1
- {"type":"commonjs","_lastModified":"2023-08-15T04:39:35.782Z"}
1
+ {"type":"commonjs","_lastModified":"2023-08-18T08:41:03.882Z"}
@@ -34,6 +34,7 @@ class FormTrigger extends _.Trigger {
34
34
  if (!triggerWorkflows) {
35
35
  return;
36
36
  }
37
+ const { currentUser } = context.state;
37
38
  const triggers = triggerWorkflows.split(",").map((trigger) => trigger.split("!"));
38
39
  const workflowRepo = this.plugin.db.getRepository("workflows");
39
40
  const workflows = await workflowRepo.find({
@@ -73,10 +74,14 @@ class FormTrigger extends _.Trigger {
73
74
  appends
74
75
  });
75
76
  }
76
- this.plugin.trigger(workflow, { data: payload });
77
+ this.plugin.trigger(workflow, { data: payload, user: currentUser });
77
78
  });
78
79
  } else {
79
- this.plugin.trigger(workflow, { data: trigger[1] ? lodash.get(values, trigger[1]) : values });
80
+ const data = trigger[1] ? lodash.get(values, trigger[1]) : values;
81
+ this.plugin.trigger(workflow, {
82
+ data,
83
+ user: currentUser
84
+ });
80
85
  }
81
86
  });
82
87
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
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.12.0-alpha.4",
7
+ "version": "0.12.0-alpha.5",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "devDependencies": {
@@ -40,5 +40,5 @@
40
40
  "@nocobase/test": "0.x",
41
41
  "@nocobase/utils": "0.x"
42
42
  },
43
- "gitHead": "215dc3b2437c501ca903b56cc378ab5e81c8a11c"
43
+ "gitHead": "689cc16e83361c4d0b91907e0deac30bdb907692"
44
44
  }