@nocobase/plugin-workflow 0.9.2-alpha.2 → 0.9.2-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 (66) hide show
  1. package/lib/client/AddButton.js +1 -3
  2. package/lib/client/Branch.d.ts +1 -1
  3. package/lib/client/ExecutionCanvas.js +1 -1
  4. package/lib/client/FlowContext.d.ts +1 -1
  5. package/lib/client/WorkflowProvider.js +0 -1
  6. package/lib/client/components/CollectionFieldset.d.ts +1 -1
  7. package/lib/client/components/CollectionFieldset.js +13 -13
  8. package/lib/client/components/Duration.js +3 -3
  9. package/lib/client/components/DynamicExpression.d.ts +1 -1
  10. package/lib/client/components/RadioWithTooltip.js +4 -4
  11. package/lib/client/components/renderEngineReference.js +3 -2
  12. package/lib/client/interfaces/expression.d.ts +1 -1
  13. package/lib/client/locale/en-US.d.ts +70 -70
  14. package/lib/client/locale/en-US.js +115 -115
  15. package/lib/client/locale/ja-JP.d.ts +57 -57
  16. package/lib/client/locale/ja-JP.js +85 -85
  17. package/lib/client/locale/pt-BR.d.ts +70 -70
  18. package/lib/client/locale/pt-BR.js +115 -115
  19. package/lib/client/locale/ru-RU.d.ts +57 -57
  20. package/lib/client/locale/ru-RU.js +85 -85
  21. package/lib/client/locale/tr-TR.d.ts +57 -57
  22. package/lib/client/locale/tr-TR.js +85 -85
  23. package/lib/client/locale/zh-CN.js +55 -55
  24. package/lib/client/nodes/calculation.js +6 -6
  25. package/lib/client/nodes/condition.d.ts +3 -3
  26. package/lib/client/nodes/condition.js +46 -42
  27. package/lib/client/nodes/delay.d.ts +1 -1
  28. package/lib/client/nodes/index.js +35 -37
  29. package/lib/client/nodes/manual/ModeConfig.js +5 -5
  30. package/lib/client/nodes/manual/SchemaConfig.js +2 -5
  31. package/lib/client/nodes/manual/WorkflowTodo.js +3 -3
  32. package/lib/client/nodes/manual/forms/customForm.js +1 -2
  33. package/lib/client/nodes/parallel.d.ts +1 -1
  34. package/lib/client/nodes/parallel.js +6 -6
  35. package/lib/client/nodes/request.d.ts +2 -0
  36. package/lib/client/nodes/request.js +7 -5
  37. package/lib/client/style.js +67 -63
  38. package/lib/client/triggers/index.d.ts +4 -4
  39. package/lib/client/triggers/index.js +5 -7
  40. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +1 -1
  41. package/lib/client/triggers/schedule/EndsByField.js +3 -3
  42. package/lib/client/triggers/schedule/OnField.js +3 -3
  43. package/lib/client/triggers/schedule/RepeatField.js +16 -16
  44. package/lib/client/triggers/schedule/ScheduleConfig.js +2 -2
  45. package/lib/client/utils.js +1 -1
  46. package/lib/client/variable.js +4 -4
  47. package/lib/server/Processor.js +1 -1
  48. package/lib/server/functions/index.d.ts +1 -1
  49. package/lib/server/functions/index.js +1 -2
  50. package/lib/server/instructions/calculation.d.ts +1 -1
  51. package/lib/server/instructions/condition.d.ts +2 -2
  52. package/lib/server/instructions/create.d.ts +1 -1
  53. package/lib/server/instructions/destroy.d.ts +1 -1
  54. package/lib/server/instructions/manual/index.js +1 -2
  55. package/lib/server/instructions/parallel.d.ts +3 -3
  56. package/lib/server/instructions/query.d.ts +2 -2
  57. package/lib/server/instructions/request.js +0 -1
  58. package/lib/server/instructions/update.d.ts +2 -2
  59. package/lib/server/migrations/20230221071831-calculation-expression.js +11 -11
  60. package/lib/server/migrations/20230221121203-condition-calculation.js +6 -6
  61. package/lib/server/migrations/20230221162902-jsonb-to-json.js +3 -5
  62. package/lib/server/migrations/20230411034722-manual-multi-form.js +3 -2
  63. package/lib/server/triggers/collection.d.ts +2 -2
  64. package/lib/server/triggers/collection.js +2 -2
  65. package/lib/server/triggers/schedule.js +26 -20
  66. package/package.json +12 -12
@@ -192,11 +192,11 @@ function Calculation({
192
192
  const options = (0, _variable.useWorkflowVariableOptions)();
193
193
  return _react().default.createElement("fieldset", {
194
194
  className: (0, _css().css)`
195
- display: flex;
196
- gap: .5em;
197
- align-items: center;
198
- flex-wrap: wrap;
199
- `
195
+ display: flex;
196
+ gap: 0.5em;
197
+ align-items: center;
198
+ flex-wrap: wrap;
199
+ `
200
200
  }, _react().default.createElement(_client2().Variable.Input, {
201
201
  value: operands[0],
202
202
  onChange: v => _onChange({
@@ -243,10 +243,10 @@ function CalculationItem({
243
243
  operands = _value$operands === void 0 ? [] : _value$operands;
244
244
  return _react().default.createElement("div", {
245
245
  className: (0, _css().css)`
246
- display: flex;
247
- position: relative;
248
- margin: .5em 0;
249
- `
246
+ display: flex;
247
+ position: relative;
248
+ margin: 0.5em 0;
249
+ `
250
250
  }, value.group ? _react().default.createElement(CalculationGroup, {
251
251
  value: value.group,
252
252
  onChange: group => _onChange2(_objectSpread(_objectSpread({}, value), {}, {
@@ -305,27 +305,27 @@ function CalculationGroup({
305
305
  }
306
306
  return _react().default.createElement("div", {
307
307
  className: (0, _css().cx)('node-type-condition-group', (0, _css().css)`
308
- position: relative;
309
- width: 100%;
310
- .node-type-condition-group{
311
- padding: .5em 1em;
312
- border: 1px dashed #ddd;
313
- }
314
- + button{
315
- position: absolute;
316
- right: 0;
317
- }
318
- `)
308
+ position: relative;
309
+ width: 100%;
310
+ .node-type-condition-group {
311
+ padding: 0.5em 1em;
312
+ border: 1px dashed #ddd;
313
+ }
314
+ + button {
315
+ position: absolute;
316
+ right: 0;
317
+ }
318
+ `)
319
319
  }, _react().default.createElement("div", {
320
320
  className: (0, _css().css)`
321
- display: flex;
322
- align-items: center;
323
- gap: .5em;
324
- .ant-select{
325
- width: auto;
326
- min-width: 6em;
327
- }
328
- `
321
+ display: flex;
322
+ align-items: center;
323
+ gap: 0.5em;
324
+ .ant-select {
325
+ width: auto;
326
+ min-width: 6em;
327
+ }
328
+ `
329
329
  }, _react().default.createElement(_reactI18next().Trans, null, 'Meet ', _react().default.createElement(_antd().Select, {
330
330
  value: type,
331
331
  onChange: t => _onChange3(_objectSpread(_objectSpread({}, value), {}, {
@@ -344,13 +344,13 @@ function CalculationGroup({
344
344
  onRemove: () => _onRemove(i)
345
345
  }))), _react().default.createElement("div", {
346
346
  className: (0, _css().css)`
347
- button{
348
- padding: 0;
349
- &:not(:last-child){
350
- margin-right: 1em;
347
+ button {
348
+ padding: 0;
349
+ &:not(:last-child) {
350
+ margin-right: 1em;
351
+ }
351
352
  }
352
- }
353
- `
353
+ `
354
354
  }, _react().default.createElement(_antd().Button, {
355
355
  type: "link",
356
356
  onClick: onAddSingle
@@ -492,12 +492,12 @@ var _default = {
492
492
  className: (0, _css().cx)(_style.nodeSubtreeClass)
493
493
  }, _react().default.createElement("div", {
494
494
  className: (0, _css().cx)(_style.branchBlockClass, (0, _css().css)`
495
- > * > .workflow-branch-lines{
496
- > button{
497
- display: none;
495
+ > * > .workflow-branch-lines {
496
+ > button {
497
+ display: none;
498
+ }
498
499
  }
499
- }
500
- `)
500
+ `)
501
501
  }, _react().default.createElement(_Branch.Branch, {
502
502
  from: data,
503
503
  entry: falseEntry,
@@ -512,7 +512,7 @@ var _default = {
512
512
  height: 2em;
513
513
  overflow: visible;
514
514
 
515
- > span{
515
+ > span {
516
516
  position: absolute;
517
517
  top: calc(1.5em - 1px);
518
518
  line-height: 1em;
@@ -522,9 +522,13 @@ var _default = {
522
522
  }
523
523
  `
524
524
  }, _react().default.createElement("span", {
525
- className: (0, _css().css)`right: 4em;`
525
+ className: (0, _css().css)`
526
+ right: 4em;
527
+ `
526
528
  }, t('No')), _react().default.createElement("span", {
527
- className: (0, _css().css)`left: 4em;`
529
+ className: (0, _css().css)`
530
+ left: 4em;
531
+ `
528
532
  }, t('Yes')))));
529
533
  },
530
534
  scope: {
@@ -1,4 +1,4 @@
1
- import Duration from "../components/Duration";
1
+ import Duration from '../components/Duration';
2
2
  declare const _default: {
3
3
  title: string;
4
4
  type: string;
@@ -105,7 +105,6 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
105
105
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
106
106
  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); } }
107
107
  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); }); }; }
108
- ;
109
108
  const instructions = new (_client().Registry)();
110
109
  exports.instructions = instructions;
111
110
  instructions.register('condition', _condition.default);
@@ -148,7 +147,6 @@ function useUpdateAction() {
148
147
  }
149
148
  };
150
149
  }
151
- ;
152
150
  const NodeContext = _react().default.createContext({});
153
151
  exports.NodeContext = NodeContext;
154
152
  function useNodeContext() {
@@ -178,21 +176,21 @@ function Node({
178
176
  upstream: data
179
177
  }) : _react().default.createElement("div", {
180
178
  className: (0, _css().css)`
181
- flex-grow: 1;
182
- display: flex;
183
- flex-direction: column;
184
- align-items: center;
185
- justify-content: center;
186
- width: 1px;
187
- height: 6em;
188
- padding: 2em 0;
189
- background-color: #f0f2f5;
179
+ flex-grow: 1;
180
+ display: flex;
181
+ flex-direction: column;
182
+ align-items: center;
183
+ justify-content: center;
184
+ width: 1px;
185
+ height: 6em;
186
+ padding: 2em 0;
187
+ background-color: #f0f2f5;
190
188
 
191
- .anticon{
192
- font-size: 1.5em;
193
- line-height: 100%;
194
- }
195
- `
189
+ .anticon {
190
+ font-size: 1.5em;
191
+ line-height: 100%;
192
+ }
193
+ `
196
194
  }, _react().default.createElement(_icons().CloseOutlined, null))));
197
195
  }
198
196
  function RemoveButton() {
@@ -280,10 +278,10 @@ function JobButton() {
280
278
  if (!job) {
281
279
  return _react().default.createElement("span", {
282
280
  className: (0, _css().cx)('workflow-node-job-button', (0, _css().css)`
283
- border: 2px solid #d9d9d9;
284
- border-radius: 50%;
285
- cursor: not-allowed;
286
- `)
281
+ border: 2px solid #d9d9d9;
282
+ border-radius: 50%;
283
+ cursor: not-allowed;
284
+ `)
287
285
  });
288
286
  }
289
287
  const instruction = instructions.get(type);
@@ -304,14 +302,14 @@ function JobButton() {
304
302
  }, icon),
305
303
  shape: 'circle',
306
304
  className: ['workflow-node-job-button', (0, _css().css)`
307
- .ant-tag{
308
- padding: 0;
309
- width: 100%;
310
- line-height: 18px;
311
- margin-right: 0;
312
- border-radius: 50%;
313
- }
314
- `]
305
+ .ant-tag {
306
+ padding: 0;
307
+ width: 100%;
308
+ line-height: 18px;
309
+ margin-right: 0;
310
+ border-radius: 50%;
311
+ }
312
+ `]
315
313
  },
316
314
  properties: {
317
315
  [`${job.id}-modal`]: {
@@ -486,10 +484,10 @@ function NodeDefaultView(props) {
486
484
  showIcon: true,
487
485
  message: `{{t("Node in executed workflow cannot be modified", { ns: "${_locale.NAMESPACE}" })}}`,
488
486
  className: (0, _css().css)`
489
- width: 100%;
490
- font-size: 85%;
491
- margin-bottom: 2em;
492
- `
487
+ width: 100%;
488
+ font-size: 85%;
489
+ margin-bottom: 2em;
490
+ `
493
491
  }
494
492
  }
495
493
  } : {}), {}, {
@@ -502,16 +500,16 @@ function NodeDefaultView(props) {
502
500
  .ant-cascader-picker,
503
501
  .ant-picker,
504
502
  .ant-input-number,
505
- .ant-input-affix-wrapper{
506
- &:not(.full-width){
503
+ .ant-input-affix-wrapper {
504
+ &:not(.full-width) {
507
505
  width: auto;
508
506
  min-width: 6em;
509
507
  }
510
508
  }
511
509
 
512
- .ant-input-affix-wrapper{
513
- &:not(.full-width){
514
- .ant-input{
510
+ .ant-input-affix-wrapper {
511
+ &:not(.full-width) {
512
+ .ant-input {
515
513
  width: auto;
516
514
  min-width: 6em;
517
515
  }
@@ -70,12 +70,12 @@ function ModeConfig({
70
70
  const mode = parseMode(value);
71
71
  return _react().default.createElement("fieldset", {
72
72
  className: (0, _css().css)`
73
- .ant-radio-group{
74
- .anticon{
75
- margin-left: .5em;
73
+ .ant-radio-group {
74
+ .anticon {
75
+ margin-left: 0.5em;
76
+ }
76
77
  }
77
- }
78
- `
78
+ `
79
79
  }, _react().default.createElement(_antd2().Form.Item, null, _react().default.createElement(_antd2().Radio.Group, {
80
80
  value: Boolean(value),
81
81
  onChange: ({
@@ -62,10 +62,9 @@ function useTriggerInitializers() {
62
62
  const trigger = (0, _triggers.useTrigger)();
63
63
  return trigger.useInitializers ? trigger.useInitializers(workflow.config) : null;
64
64
  }
65
- ;
66
65
  const blockTypeNames = {
67
- 'customForm': _customForm.default.title,
68
- 'record': `{{t("Data record", { ns: "${_locale.NAMESPACE}" })}}`
66
+ customForm: _customForm.default.title,
67
+ record: `{{t("Data record", { ns: "${_locale.NAMESPACE}" })}}`
69
68
  };
70
69
  function SimpleDesigner() {
71
70
  var _blockTypeNames$schem, _schema$xDesignerPr;
@@ -132,7 +131,6 @@ function AddBlockButton(props) {
132
131
  title: "{{t('Add block')}}"
133
132
  }));
134
133
  }
135
- ;
136
134
  function findSchema(schema, filter, onlyLeaf = false) {
137
135
  const result = [];
138
136
  if (!schema) {
@@ -161,7 +159,6 @@ function SchemaComponentRefreshProvider(props) {
161
159
  })
162
160
  }, props.children);
163
161
  }
164
- ;
165
162
  function ActionInitializer(_ref) {
166
163
  let action = _ref.action,
167
164
  actionProps = _ref.actionProps,
@@ -468,7 +468,7 @@ function useFlowRecordFromBlock(opts) {
468
468
  dataSource = _useFieldSchema['x-context-datasource'];
469
469
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
470
470
  execution = _useFlowContext.execution;
471
- let result = (0, _jsonTemplates().default)(dataSource)({
471
+ const result = (0, _jsonTemplates().default)(dataSource)({
472
472
  $context: execution === null || execution === void 0 ? void 0 : execution.context,
473
473
  $jobsMapByNodeId: ((_execution$jobs = execution === null || execution === void 0 ? void 0 : execution.jobs) !== null && _execution$jobs !== void 0 ? _execution$jobs : []).reduce((map, job) => Object.assign(map, {
474
474
  [job.nodeId]: job.result
@@ -547,8 +547,8 @@ WorkflowTodo.Drawer = function () {
547
547
  'x-component': 'time',
548
548
  'x-component-props': {
549
549
  className: (0, _css().css)`
550
- margin-right: .5em;
551
- `
550
+ margin-right: 0.5em;
551
+ `
552
552
  },
553
553
  'x-content': (0, _moment().default)(updatedAt).format('YYYY-MM-DD HH:mm:ss')
554
554
  },
@@ -360,7 +360,6 @@ function CustomFormFieldInitializer(props) {
360
360
  }
361
361
  });
362
362
  }
363
- ;
364
363
  function useFormBlockProps() {
365
364
  var _user$data;
366
365
  const _useRecord = (0, _client().useRecord)(),
@@ -371,7 +370,7 @@ function useFormBlockProps() {
371
370
  user = _useCurrentUserContex.data;
372
371
  const _useFieldSchema = (0, _react2().useFieldSchema)(),
373
372
  name = _useFieldSchema.name;
374
- const pattern = Boolean(status) ? (result === null || result === void 0 ? void 0 : result[name]) ? 'readPretty' : 'disabled' : (user === null || user === void 0 ? void 0 : (_user$data = user.data) === null || _user$data === void 0 ? void 0 : _user$data.id) !== userId ? 'disabled' : 'editable';
373
+ const pattern = status ? (result === null || result === void 0 ? void 0 : result[name]) ? 'readPretty' : 'disabled' : (user === null || user === void 0 ? void 0 : (_user$data = user.data) === null || _user$data === void 0 ? void 0 : _user$data.id) !== userId ? 'disabled' : 'editable';
375
374
  const form = (0, _react().useMemo)(() => {
376
375
  var _result$name;
377
376
  return (0, _core().createForm)({
@@ -1,4 +1,4 @@
1
- import { RadioWithTooltip } from "../components/RadioWithTooltip";
1
+ import { RadioWithTooltip } from '../components/RadioWithTooltip';
2
2
  declare const _default: {
3
3
  title: string;
4
4
  type: string;
@@ -112,9 +112,9 @@ var _default = {
112
112
  className: (0, _css().css)`
113
113
  padding-top: 2em;
114
114
 
115
- > button{
116
- .anticon{
117
- transform: rotate(45deg)
115
+ > button {
116
+ .anticon {
117
+ transform: rotate(45deg);
118
118
  }
119
119
  }
120
120
  `
@@ -132,8 +132,8 @@ var _default = {
132
132
  }, _react().default.createElement(_antd().Tooltip, {
133
133
  title: (0, _locale.lang)('Add branch'),
134
134
  className: (0, _css().css)`
135
- visibility: ${workflow.executed ? 'hidden' : 'visible'}
136
- `
135
+ visibility: ${workflow.executed ? 'hidden' : 'visible'};
136
+ `
137
137
  }, _react().default.createElement(_antd().Button, {
138
138
  icon: _react().default.createElement(_icons().PlusOutlined, null),
139
139
  className: (0, _css().css)`
@@ -141,7 +141,7 @@ var _default = {
141
141
  top: calc(50% - 1px);
142
142
  transform: translateX(-50%) rotate(45deg);
143
143
 
144
- .anticon{
144
+ .anticon {
145
145
  transform: rotate(-45deg);
146
146
  }
147
147
  `,
@@ -59,6 +59,7 @@ declare const _default: {
59
59
  'x-component': string;
60
60
  'x-component-props': {
61
61
  scope: typeof useWorkflowVariableOptions;
62
+ useTypedConstant: boolean;
62
63
  };
63
64
  };
64
65
  remove: {
@@ -104,6 +105,7 @@ declare const _default: {
104
105
  'x-component': string;
105
106
  'x-component-props': {
106
107
  scope: typeof useWorkflowVariableOptions;
108
+ useTypedConstant: boolean;
107
109
  };
108
110
  };
109
111
  remove: {
@@ -91,7 +91,8 @@ var _default = {
91
91
  'x-decorator': 'FormItem',
92
92
  'x-component': 'Variable.Input',
93
93
  'x-component-props': {
94
- scope: _variable.useWorkflowVariableOptions
94
+ scope: _variable.useWorkflowVariableOptions,
95
+ useTypedConstant: true
95
96
  }
96
97
  },
97
98
  remove: {
@@ -136,7 +137,8 @@ var _default = {
136
137
  'x-decorator': 'FormItem',
137
138
  'x-component': 'Variable.Input',
138
139
  'x-component-props': {
139
- scope: _variable.useWorkflowVariableOptions
140
+ scope: _variable.useWorkflowVariableOptions,
141
+ useTypedConstant: true
140
142
  }
141
143
  },
142
144
  remove: {
@@ -169,9 +171,9 @@ var _default = {
169
171
  },
170
172
  placeholder: `{{t("Input request data", { ns: "${_locale.NAMESPACE}" })}}`,
171
173
  className: (0, _css().cx)('full-width', (0, _css().css)`
172
- font-size: 90%;
173
- font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
174
- `)
174
+ font-size: 90%;
175
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
176
+ `)
175
177
  },
176
178
  description: `{{t("Only support standard JSON data", { ns: "${_locale.NAMESPACE}" })}}`
177
179
  },