@nocobase/plugin-workflow 0.11.0-alpha.1 → 0.11.1-alpha.2

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 (133) hide show
  1. package/lib/client/AddButton.js +13 -4
  2. package/lib/client/Branch.js +4 -2
  3. package/lib/client/CanvasContent.js +6 -4
  4. package/lib/client/ExecutionCanvas.js +18 -7
  5. package/lib/client/ExecutionPage.js +4 -2
  6. package/lib/client/WorkflowCanvas.js +16 -6
  7. package/lib/client/WorkflowPage.js +4 -2
  8. package/lib/client/WorkflowProvider.js +2 -2
  9. package/lib/client/components/CollectionBlockInitializer.js +3 -3
  10. package/lib/client/components/CollectionFieldset.js +7 -1
  11. package/lib/client/components/FieldsSelect.js +4 -1
  12. package/lib/client/components/NodeDescription.js +36 -22
  13. package/lib/client/index.js +3 -3
  14. package/lib/client/locale/zh-CN.d.ts +5 -1
  15. package/lib/client/locale/zh-CN.js +6 -2
  16. package/lib/client/nodes/aggregate.d.ts +6 -1
  17. package/lib/client/nodes/aggregate.js +4 -3
  18. package/lib/client/nodes/calculation.d.ts +5 -3
  19. package/lib/client/nodes/calculation.js +6 -5
  20. package/lib/client/nodes/condition.d.ts +1 -7
  21. package/lib/client/nodes/condition.js +12 -23
  22. package/lib/client/nodes/create.d.ts +2 -4
  23. package/lib/client/nodes/create.js +1 -3
  24. package/lib/client/nodes/index.d.ts +1 -2
  25. package/lib/client/nodes/index.js +24 -24
  26. package/lib/client/nodes/loop.js +19 -28
  27. package/lib/client/nodes/manual/FormBlockInitializer.js +6 -5
  28. package/lib/client/nodes/manual/SchemaConfig.d.ts +1 -2
  29. package/lib/client/nodes/manual/SchemaConfig.js +175 -21
  30. package/lib/client/nodes/manual/WorkflowTodo.js +39 -46
  31. package/lib/client/nodes/manual/forms/create.js +8 -1
  32. package/lib/client/nodes/manual/forms/custom.js +11 -4
  33. package/lib/client/nodes/manual/forms/update.js +8 -1
  34. package/lib/client/nodes/manual/index.d.ts +6 -1
  35. package/lib/client/nodes/manual/index.js +5 -4
  36. package/lib/client/nodes/parallel.js +7 -4
  37. package/lib/client/nodes/query.d.ts +2 -5
  38. package/lib/client/nodes/query.js +1 -3
  39. package/lib/client/nodes/sql.d.ts +26 -0
  40. package/lib/client/{triggers/schedule/DateFieldsSelect.js → nodes/sql.js} +37 -46
  41. package/lib/client/schemas/collection.d.ts +2 -3
  42. package/lib/client/schemas/collection.js +8 -7
  43. package/lib/client/style.d.ts +18 -13
  44. package/lib/client/style.js +312 -289
  45. package/lib/client/triggers/collection.d.ts +9 -10
  46. package/lib/client/triggers/collection.js +4 -0
  47. package/lib/client/triggers/index.d.ts +2 -3
  48. package/lib/client/triggers/index.js +10 -5
  49. package/lib/client/triggers/schedule/OnField.js +35 -23
  50. package/lib/client/triggers/schedule/ScheduleConfig.js +7 -7
  51. package/lib/client/triggers/schedule/index.d.ts +0 -1
  52. package/lib/client/triggers/schedule/index.js +31 -19
  53. package/lib/client/variable.d.ts +29 -11
  54. package/lib/client/variable.js +39 -24
  55. package/lib/server/Plugin.d.ts +1 -3
  56. package/lib/server/Plugin.js +10 -6
  57. package/lib/server/Processor.d.ts +1 -1
  58. package/lib/server/Processor.js +2 -2
  59. package/lib/server/instructions/create.d.ts +1 -1
  60. package/lib/server/instructions/create.js +13 -13
  61. package/lib/server/instructions/index.js +1 -1
  62. package/lib/server/instructions/manual/actions.js +19 -7
  63. package/lib/server/instructions/manual/forms/create.js +7 -1
  64. package/lib/server/instructions/manual/forms/update.js +7 -1
  65. package/lib/server/instructions/query.js +8 -1
  66. package/lib/server/instructions/request.d.ts +1 -1
  67. package/lib/server/instructions/request.js +4 -2
  68. package/lib/server/instructions/sql.d.ts +12 -0
  69. package/lib/server/instructions/sql.js +34 -0
  70. package/lib/server/migrations/20230710115902-manual-action-values.d.ts +4 -0
  71. package/lib/server/migrations/20230710115902-manual-action-values.js +97 -0
  72. package/lib/server/triggers/collection.js +13 -11
  73. package/lib/server/utils.d.ts +2 -0
  74. package/lib/server/utils.js +21 -0
  75. package/package.json +12 -11
  76. package/src/client/AddButton.tsx +17 -5
  77. package/src/client/Branch.tsx +4 -2
  78. package/src/client/CanvasContent.tsx +6 -4
  79. package/src/client/ExecutionCanvas.tsx +11 -13
  80. package/src/client/ExecutionPage.tsx +3 -2
  81. package/src/client/WorkflowCanvas.tsx +14 -13
  82. package/src/client/WorkflowPage.tsx +3 -2
  83. package/src/client/WorkflowProvider.tsx +2 -2
  84. package/src/client/components/CollectionBlockInitializer.tsx +3 -3
  85. package/src/client/components/CollectionFieldset.tsx +5 -3
  86. package/src/client/components/FieldsSelect.tsx +5 -1
  87. package/src/client/components/NodeDescription.tsx +30 -23
  88. package/src/client/index.tsx +3 -3
  89. package/src/client/locale/zh-CN.ts +8 -2
  90. package/src/client/nodes/aggregate.tsx +4 -4
  91. package/src/client/nodes/calculation.tsx +4 -5
  92. package/src/client/nodes/condition.tsx +7 -34
  93. package/src/client/nodes/create.tsx +0 -1
  94. package/src/client/nodes/index.tsx +21 -25
  95. package/src/client/nodes/loop.tsx +16 -31
  96. package/src/client/nodes/manual/FormBlockInitializer.tsx +6 -5
  97. package/src/client/nodes/manual/SchemaConfig.tsx +162 -18
  98. package/src/client/nodes/manual/WorkflowTodo.tsx +43 -47
  99. package/src/client/nodes/manual/forms/create.tsx +5 -1
  100. package/src/client/nodes/manual/forms/custom.tsx +7 -3
  101. package/src/client/nodes/manual/forms/update.tsx +5 -1
  102. package/src/client/nodes/manual/index.tsx +5 -5
  103. package/src/client/nodes/parallel.tsx +6 -5
  104. package/src/client/nodes/query.tsx +0 -1
  105. package/src/client/nodes/sql.tsx +37 -0
  106. package/src/client/schemas/collection.ts +6 -6
  107. package/src/client/style.tsx +324 -289
  108. package/src/client/triggers/collection.tsx +4 -0
  109. package/src/client/triggers/index.tsx +14 -10
  110. package/src/client/triggers/schedule/OnField.tsx +29 -15
  111. package/src/client/triggers/schedule/ScheduleConfig.tsx +21 -19
  112. package/src/client/triggers/schedule/index.tsx +25 -19
  113. package/src/client/variable.tsx +48 -26
  114. package/src/server/Plugin.ts +13 -9
  115. package/src/server/Processor.ts +2 -2
  116. package/src/server/__tests__/collections/categories.ts +4 -0
  117. package/src/server/__tests__/instructions/manual.test.ts +391 -72
  118. package/src/server/__tests__/instructions/request.test.ts +30 -0
  119. package/src/server/__tests__/instructions/sql.test.ts +162 -0
  120. package/src/server/__tests__/triggers/collection.test.ts +35 -0
  121. package/src/server/instructions/create.ts +13 -11
  122. package/src/server/instructions/index.ts +1 -0
  123. package/src/server/instructions/manual/actions.ts +16 -4
  124. package/src/server/instructions/manual/forms/create.ts +2 -1
  125. package/src/server/instructions/manual/forms/update.ts +3 -2
  126. package/src/server/instructions/query.ts +12 -1
  127. package/src/server/instructions/request.ts +2 -1
  128. package/src/server/instructions/sql.ts +25 -0
  129. package/src/server/migrations/20230710115902-manual-action-values.ts +78 -0
  130. package/src/server/triggers/collection.ts +15 -11
  131. package/src/server/utils.ts +17 -0
  132. package/lib/client/triggers/schedule/DateFieldsSelect.d.ts +0 -2
  133. package/src/client/triggers/schedule/DateFieldsSelect.tsx +0 -28
@@ -210,8 +210,7 @@ const todoCollection = {
210
210
  'x-component': 'DatePicker',
211
211
  'x-component-props': {
212
212
  showTime: true
213
- },
214
- 'x-read-pretty': true
213
+ }
215
214
  }
216
215
  }]
217
216
  };
@@ -245,8 +244,6 @@ const WorkflowTodo = () => {
245
244
  },
246
245
  schema: {
247
246
  type: 'void',
248
- name: (0, _client().uid)(),
249
- 'x-component': 'div',
250
247
  properties: {
251
248
  actions: {
252
249
  type: 'void',
@@ -321,7 +318,7 @@ const WorkflowTodo = () => {
321
318
  'x-component': 'TableV2.Column',
322
319
  properties: {
323
320
  createdAt: {
324
- type: 'number',
321
+ type: 'string',
325
322
  'x-component': 'CollectionField',
326
323
  'x-read-pretty': true
327
324
  }
@@ -345,7 +342,6 @@ const WorkflowTodo = () => {
345
342
  'x-component': 'TableV2.Column',
346
343
  properties: {
347
344
  status: {
348
- type: 'number',
349
345
  'x-component': 'CollectionField',
350
346
  'x-read-pretty': true
351
347
  }
@@ -414,12 +410,13 @@ function ManualActionStatusProvider({
414
410
  const _useFlowContext2 = (0, _FlowContext.useFlowContext)(),
415
411
  userJob = _useFlowContext2.userJob;
416
412
  const button = (0, _react().useField)();
413
+ const buttonSchema = (0, _react().useFieldSchema)();
417
414
  (0, _react2().useEffect)(() => {
418
415
  if (userJob.status) {
419
416
  button.disabled = true;
420
- button.visible = userJob.status === value;
417
+ button.visible = userJob.status === value && userJob.result._ === buttonSchema.name;
421
418
  }
422
- }, [userJob.status, value, button]);
419
+ }, [userJob, value, button]);
423
420
  return _react2().default.createElement(ManualActionStatusContext.Provider, {
424
421
  value: value
425
422
  }, children);
@@ -432,28 +429,27 @@ function useSubmit() {
432
429
  values = _useForm.values,
433
430
  submit = _useForm.submit;
434
431
  const buttonSchema = (0, _react().useFieldSchema)();
435
- const nextStatus = (0, _react2().useContext)(ManualActionStatusContext);
436
432
  const _useTableBlockContext = (0, _client2().useTableBlockContext)(),
437
433
  service = _useTableBlockContext.service;
438
434
  const _useFlowContext3 = (0, _FlowContext.useFlowContext)(),
439
435
  userJob = _useFlowContext3.userJob;
440
- const _useContext = (0, _react2().useContext)(_client2().FormBlockContext),
441
- updateAssociationValues = _useContext.updateAssociationValues;
436
+ const actionKey = buttonSchema.name;
437
+ const formKey = buttonSchema.parent.parent.name;
442
438
  return {
443
439
  run() {
444
440
  return _asyncToGenerator(function* () {
441
+ if (userJob.status) {
442
+ return;
443
+ }
445
444
  yield submit();
446
- const _buttonSchema$parent$2 = buttonSchema.parent.parent.toJSON(),
447
- name = _buttonSchema$parent$2.name;
448
445
  yield api.resource('users_jobs').submit({
449
446
  filterByTk: userJob.id,
450
447
  values: {
451
- status: nextStatus,
452
448
  result: {
453
- [name]: values
449
+ [formKey]: values,
450
+ _: actionKey
454
451
  }
455
- },
456
- updateAssociationValues
452
+ }
457
453
  });
458
454
  setVisible(false);
459
455
  service.refresh();
@@ -556,37 +552,29 @@ function useDetailsBlockProps() {
556
552
  form
557
553
  };
558
554
  }
559
- function Drawer() {
560
- var _node$title;
561
- const ctx = (0, _react2().useContext)(_client2().SchemaComponentContext);
555
+ function FooterStatus() {
556
+ const compile = (0, _client2().useCompile)();
562
557
  const _useRecord2 = (0, _client2().useRecord)(),
563
- id = _useRecord2.id,
564
- node = _useRecord2.node,
565
- workflow = _useRecord2.workflow,
566
558
  status = _useRecord2.status,
567
559
  updatedAt = _useRecord2.updatedAt;
568
560
  const statusOption = _constants.JobStatusOptionsMap[status];
569
- const footerSchema = status ? {
570
- date: {
571
- type: 'void',
572
- 'x-component': 'time',
573
- 'x-component-props': {
574
- className: (0, _css().css)`
575
- margin-right: 0.5em;
576
- `
577
- },
578
- 'x-content': (0, _client().dayjs)(updatedAt).format('YYYY-MM-DD HH:mm:ss')
579
- },
580
- status: {
581
- type: 'void',
582
- 'x-component': 'Tag',
583
- 'x-component-props': {
584
- icon: statusOption.icon,
585
- color: statusOption.color
586
- },
587
- 'x-content': statusOption.label
588
- }
589
- } : null;
561
+ return status ? _react2().default.createElement(_antd().Space, null, _react2().default.createElement("time", {
562
+ className: (0, _css().css)`
563
+ margin-right: 0.5em;
564
+ `
565
+ }, (0, _client().dayjs)(updatedAt).format('YYYY-MM-DD HH:mm:ss')), _react2().default.createElement(_antd().Tag, {
566
+ icon: statusOption.icon,
567
+ color: statusOption.color
568
+ }, compile(statusOption.label))) : null;
569
+ }
570
+ function Drawer() {
571
+ var _node$title;
572
+ const ctx = (0, _react2().useContext)(_client2().SchemaComponentContext);
573
+ const _useRecord3 = (0, _client2().useRecord)(),
574
+ id = _useRecord3.id,
575
+ node = _useRecord3.node,
576
+ workflow = _useRecord3.workflow,
577
+ status = _useRecord3.status;
590
578
  return _react2().default.createElement(_client2().SchemaComponentContext.Provider, {
591
579
  value: _objectSpread(_objectSpread({}, ctx), {}, {
592
580
  reset() {},
@@ -594,7 +582,7 @@ function Drawer() {
594
582
  })
595
583
  }, _react2().default.createElement(_client2().SchemaComponent, {
596
584
  components: {
597
- Tag: _antd().Tag,
585
+ FooterStatus,
598
586
  FlowContextProvider
599
587
  },
600
588
  schema: {
@@ -613,7 +601,12 @@ function Drawer() {
613
601
  footer: {
614
602
  type: 'void',
615
603
  'x-component': 'Action.Drawer.Footer',
616
- properties: footerSchema
604
+ properties: {
605
+ content: {
606
+ type: 'void',
607
+ 'x-component': 'FooterStatus'
608
+ }
609
+ }
617
610
  }
618
611
  }
619
612
  }
@@ -87,7 +87,14 @@ var _default = {
87
87
  forms[formKey] = {
88
88
  type: 'create',
89
89
  title: ((_formBlock$xComponen = formBlock['x-component-props']) === null || _formBlock$xComponen === void 0 ? void 0 : _formBlock$xComponen.title) || formKey,
90
- actions: (0, _utils.findSchema)(formSchema.properties.actions, item => item['x-component'] === 'Action').map(item => item['x-decorator-props'].value),
90
+ actions: (0, _utils.findSchema)(formSchema.properties.actions, item => item['x-component'] === 'Action').map(item => {
91
+ var _item$xActionSettin, _item$xActionSettin$a;
92
+ return {
93
+ status: item['x-decorator-props'].value,
94
+ values: (_item$xActionSettin = item['x-action-settings']) === null || _item$xActionSettin === void 0 ? void 0 : (_item$xActionSettin$a = _item$xActionSettin.assignedValues) === null || _item$xActionSettin$a === void 0 ? void 0 : _item$xActionSettin$a.values,
95
+ key: item.name
96
+ };
97
+ }),
91
98
  collection: formBlock['x-decorator-props'].collection
92
99
  };
93
100
  });
@@ -143,7 +143,8 @@ function CustomFormBlockInitializer(_ref) {
143
143
  'x-component-props': {
144
144
  layout: 'one-column',
145
145
  style: {
146
- marginTop: '1.5em'
146
+ marginTop: '1.5em',
147
+ flexWrap: 'wrap'
147
148
  }
148
149
  },
149
150
  'x-initializer': 'AddActionButton',
@@ -160,8 +161,7 @@ function CustomFormBlockInitializer(_ref) {
160
161
  type: 'primary',
161
162
  useAction: '{{ useSubmit }}'
162
163
  },
163
- 'x-designer': 'Action.Designer',
164
- 'x-action': `${_constants.JOB_STATUS.RESOLVED}`
164
+ 'x-designer': 'ManualActionDesigner'
165
165
  }
166
166
  }
167
167
  }
@@ -404,7 +404,14 @@ var _default = {
404
404
  forms[formKey] = {
405
405
  type: 'custom',
406
406
  title: ((_formBlock$xComponen = formBlock['x-component-props']) === null || _formBlock$xComponen === void 0 ? void 0 : _formBlock$xComponen.title) || formKey,
407
- actions: (0, _utils.findSchema)(formSchema.properties.actions, item => item['x-component'] === 'Action').map(item => item['x-decorator-props'].value),
407
+ actions: (0, _utils.findSchema)(formSchema.properties.actions, item => item['x-component'] === 'Action').map(item => {
408
+ var _item$xActionSettin, _item$xActionSettin$a;
409
+ return {
410
+ status: item['x-decorator-props'].value,
411
+ values: (_item$xActionSettin = item['x-action-settings']) === null || _item$xActionSettin === void 0 ? void 0 : (_item$xActionSettin$a = _item$xActionSettin.assignedValues) === null || _item$xActionSettin$a === void 0 ? void 0 : _item$xActionSettin$a.values,
412
+ key: item.name
413
+ };
414
+ }),
408
415
  collection: formBlock['x-decorator-props'].collection
409
416
  };
410
417
  });
@@ -145,7 +145,14 @@ var _default = {
145
145
  forms[formKey] = _objectSpread(_objectSpread({}, formBlock['x-decorator-props']), {}, {
146
146
  type: 'update',
147
147
  title: ((_formBlock$xComponen = formBlock['x-component-props']) === null || _formBlock$xComponen === void 0 ? void 0 : _formBlock$xComponen.title) || formKey,
148
- actions: (0, _utils.findSchema)(formSchema.properties.actions, item => item['x-component'] === 'Action').map(item => item['x-decorator-props'].value)
148
+ actions: (0, _utils.findSchema)(formSchema.properties.actions, item => item['x-component'] === 'Action').map(item => {
149
+ var _item$xActionSettin, _item$xActionSettin$a;
150
+ return {
151
+ status: item['x-decorator-props'].value,
152
+ values: (_item$xActionSettin = item['x-action-settings']) === null || _item$xActionSettin === void 0 ? void 0 : (_item$xActionSettin$a = _item$xActionSettin.assignedValues) === null || _item$xActionSettin$a === void 0 ? void 0 : _item$xActionSettin$a.values,
153
+ key: item.name
154
+ };
155
+ })
149
156
  });
150
157
  });
151
158
  return forms;
@@ -62,8 +62,13 @@ declare const _default: {
62
62
  id: any;
63
63
  title: any;
64
64
  config: any;
65
- }, { types }: {
65
+ }, { types, fieldNames }: {
66
66
  types: any;
67
+ fieldNames?: {
68
+ readonly label: "label";
69
+ readonly value: "value";
70
+ readonly children: "children";
71
+ };
67
72
  }): {
68
73
  value: string;
69
74
  label: any;
@@ -98,7 +98,8 @@ var _default = {
98
98
  title,
99
99
  config
100
100
  }, {
101
- types
101
+ types,
102
+ fieldNames = _variable.defaultFieldNames
102
103
  }) {
103
104
  var _config$forms;
104
105
  const compile = (0, _client().useCompile)();
@@ -128,9 +129,9 @@ var _default = {
128
129
  } : null;
129
130
  }).filter(Boolean);
130
131
  return options.length ? {
131
- value: `${id}`,
132
- label: title,
133
- children: options
132
+ [fieldNames.value]: `${id}`,
133
+ [fieldNames.label]: title,
134
+ [fieldNames.children]: options
134
135
  } : null;
135
136
  },
136
137
  useInitializers(node) {
@@ -34,10 +34,11 @@ function _react() {
34
34
  }
35
35
  var _2 = require(".");
36
36
  var _Branch = require("../Branch");
37
- var _RadioWithTooltip = require("../components/RadioWithTooltip");
38
37
  var _FlowContext = require("../FlowContext");
38
+ var _RadioWithTooltip = require("../components/RadioWithTooltip");
39
39
  var _locale = require("../locale");
40
- var _style = require("../style");
40
+ var _style = _interopRequireDefault(require("../style"));
41
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
42
  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); }
42
43
  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; }
43
44
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -79,6 +80,8 @@ var _default = {
79
80
  component: function Component({
80
81
  data
81
82
  }) {
83
+ const _useStyles = (0, _style.default)(),
84
+ styles = _useStyles.styles;
82
85
  const id = data.id,
83
86
  mode = data.config.mode;
84
87
  const _useFlowContext = (0, _FlowContext.useFlowContext)(),
@@ -99,9 +102,9 @@ var _default = {
99
102
  return _react().default.createElement(_2.NodeDefaultView, {
100
103
  data: data
101
104
  }, _react().default.createElement("div", {
102
- className: (0, _client().cx)(_style.nodeSubtreeClass)
105
+ className: (0, _client().cx)(styles.nodeSubtreeClass)
103
106
  }, _react().default.createElement("div", {
104
- className: (0, _client().cx)(_style.branchBlockClass)
107
+ className: (0, _client().cx)(styles.branchBlockClass)
105
108
  }, branches.map(branch => _react().default.createElement(_Branch.Branch, {
106
109
  key: branch.id,
107
110
  from: data,
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { SchemaInitializerItemOptions, useCollectionDataSource } from '@nocobase/client';
3
2
  import { FilterDynamicComponent } from '../components/FilterDynamicComponent';
4
3
  declare const _default: {
@@ -48,9 +47,8 @@ declare const _default: {
48
47
  'x-decorator': string;
49
48
  'x-component': string;
50
49
  'x-component-props': {
51
- mode: string;
52
- placeholder: string;
53
- filter(field: any): boolean;
50
+ useCollection(): any;
51
+ className: string;
54
52
  };
55
53
  'x-reactions': {
56
54
  dependencies: string[];
@@ -76,7 +74,6 @@ declare const _default: {
76
74
  };
77
75
  components: {
78
76
  FilterDynamicComponent: typeof FilterDynamicComponent;
79
- FieldsSelect: import("react").MemoExoticComponent<import("@formily/reactive-react").ReactFC<Omit<any, "ref">>>;
80
77
  };
81
78
  useVariables({ id, title, config }: {
82
79
  id: any;
@@ -16,7 +16,6 @@ var _locale = require("../locale");
16
16
  var _CollectionBlockInitializer = require("../components/CollectionBlockInitializer");
17
17
  var _FilterDynamicComponent = require("../components/FilterDynamicComponent");
18
18
  var _variable = require("../variable");
19
- var _FieldsSelect = require("../components/FieldsSelect");
20
19
  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; }
21
20
  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; }
22
21
  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; }
@@ -61,8 +60,7 @@ var _default = {
61
60
  useCollectionDataSource: _client().useCollectionDataSource
62
61
  },
63
62
  components: {
64
- FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent,
65
- FieldsSelect: _FieldsSelect.FieldsSelect
63
+ FilterDynamicComponent: _FilterDynamicComponent.FilterDynamicComponent
66
64
  },
67
65
  useVariables({
68
66
  id,
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ declare const _default: {
3
+ title: string;
4
+ type: string;
5
+ group: string;
6
+ description: string;
7
+ fieldset: {
8
+ sql: {
9
+ type: string;
10
+ required: boolean;
11
+ title: string;
12
+ description: string;
13
+ 'x-decorator': string;
14
+ 'x-component': string;
15
+ 'x-component-props': {
16
+ rows: number;
17
+ className: string;
18
+ };
19
+ };
20
+ };
21
+ scope: {};
22
+ components: {
23
+ SQLInput(props: any): React.JSX.Element;
24
+ };
25
+ };
26
+ export default _default;
@@ -3,9 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DateFieldsSelect = void 0;
6
+ exports.default = void 0;
7
7
  function _react() {
8
- const data = require("@formily/react");
8
+ const data = _interopRequireDefault(require("react"));
9
9
  _react = function _react() {
10
10
  return data;
11
11
  };
@@ -18,53 +18,44 @@ function _client() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _antd() {
22
- const data = require("antd");
23
- _antd = function _antd() {
24
- return data;
25
- };
26
- return data;
27
- }
28
- function _react2() {
29
- const data = _interopRequireDefault(require("react"));
30
- _react2 = function _react2() {
31
- return data;
32
- };
33
- return data;
34
- }
35
- function _reactI18next() {
36
- const data = require("react-i18next");
37
- _reactI18next = function _reactI18next() {
38
- return data;
39
- };
40
- return data;
41
- }
21
+ var _locale = require("../locale");
22
+ var _variable = require("../variable");
42
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
24
  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; }
44
25
  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; }
45
26
  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; }
46
27
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
47
28
  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); }
48
- const DateFieldsSelect = (0, _react().observer)(props => {
49
- const _useTranslation = (0, _reactI18next().useTranslation)(),
50
- t = _useTranslation.t;
51
- const compile = (0, _client().useCompile)();
52
- const _useCollectionManager = (0, _client().useCollectionManager)(),
53
- getCollectionFields = _useCollectionManager.getCollectionFields;
54
- const _useForm = (0, _react().useForm)(),
55
- values = _useForm.values;
56
- const fields = getCollectionFields(values === null || values === void 0 ? void 0 : values.collection);
57
- return _react2().default.createElement(_antd().Select, _objectSpread({
58
- popupMatchSelectWidth: false,
59
- placeholder: t('Select field')
60
- }, props), fields.filter(field => !field.hidden && (field.uiSchema ? field.type === 'date' : false)).map(field => {
61
- var _field$uiSchema;
62
- return _react2().default.createElement(_antd().Select.Option, {
63
- key: field.name,
64
- value: field.name
65
- }, compile((_field$uiSchema = field.uiSchema) === null || _field$uiSchema === void 0 ? void 0 : _field$uiSchema.title));
66
- }));
67
- }, {
68
- displayName: 'DateFieldsSelect'
69
- });
70
- exports.DateFieldsSelect = DateFieldsSelect;
29
+ var _default = {
30
+ title: `{{t("SQL action", { ns: "${_locale.NAMESPACE}" })}}`,
31
+ type: 'sql',
32
+ group: 'extended',
33
+ description: `{{t("Execute a SQL statement in database.", { ns: "${_locale.NAMESPACE}" })}}`,
34
+ fieldset: {
35
+ sql: {
36
+ type: 'string',
37
+ required: true,
38
+ title: 'SQL',
39
+ description: `{{t("Usage of SQL query result is not supported yet.", { ns: "${_locale.NAMESPACE}" })}}`,
40
+ 'x-decorator': 'FormItem',
41
+ 'x-component': 'SQLInput',
42
+ 'x-component-props': {
43
+ rows: 20,
44
+ className: (0, _client().css)`
45
+ font-size: 80%;
46
+ font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
47
+ `
48
+ }
49
+ }
50
+ },
51
+ scope: {},
52
+ components: {
53
+ SQLInput(props) {
54
+ const scope = (0, _variable.useWorkflowVariableOptions)();
55
+ return _react().default.createElement(_client().Variable.RawTextArea, _objectSpread({
56
+ scope: scope
57
+ }, props));
58
+ }
59
+ }
60
+ };
61
+ exports.default = _default;
@@ -40,9 +40,8 @@ export declare const appends: {
40
40
  'x-decorator': string;
41
41
  'x-component': string;
42
42
  'x-component-props': {
43
- mode: string;
44
- placeholder: string;
45
- filter(field: any): boolean;
43
+ useCollection(): any;
44
+ className: string;
46
45
  };
47
46
  'x-reactions': {
48
47
  dependencies: string[];
@@ -70,15 +70,16 @@ exports.filter = filter;
70
70
  const appends = {
71
71
  type: 'array',
72
72
  title: `{{t("Preload associations", { ns: "${_locale.NAMESPACE}" })}}`,
73
- description: `{{t("Please select the associated fields that need to be accessed in subsequent nodes", { ns: "${_locale.NAMESPACE}" })}}`,
73
+ description: `{{t("Please select the associated fields that need to be accessed in subsequent nodes. With more than two levels of to-many associations may cause performance issue, please use with caution.", { ns: "${_locale.NAMESPACE}" })}}`,
74
74
  'x-decorator': 'FormItem',
75
- 'x-component': 'FieldsSelect',
75
+ 'x-component': 'AppendsTreeSelect',
76
76
  'x-component-props': {
77
- mode: 'multiple',
78
- placeholder: '{{t("Select field")}}',
79
- filter(field) {
80
- return ['linkTo', 'belongsTo', 'hasOne', 'hasMany', 'belongsToMany'].includes(field.type);
81
- }
77
+ useCollection() {
78
+ const _useForm2 = (0, _react().useForm)(),
79
+ values = _useForm2.values;
80
+ return values === null || values === void 0 ? void 0 : values.collection;
81
+ },
82
+ className: 'full-width'
82
83
  },
83
84
  'x-reactions': [{
84
85
  dependencies: ['collection'],
@@ -1,13 +1,18 @@
1
- export declare const workflowPageClass: string;
2
- export declare const workflowVersionDropdownClass: string;
3
- export declare const branchBlockClass: string;
4
- export declare const branchClass: string;
5
- export declare const nodeBlockClass: string;
6
- export declare const nodeClass: string;
7
- export declare const nodeCardClass: string;
8
- export declare const nodeJobButtonClass: string;
9
- export declare const nodeHeaderClass: string;
10
- export declare const nodeMetaClass: string;
11
- export declare const nodeTitleClass: string;
12
- export declare const nodeSubtreeClass: string;
13
- export declare const addButtonClass: string;
1
+ declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ workflowPageClass: import("antd-style").SerializedStyles;
3
+ workflowVersionDropdownClass: import("antd-style").SerializedStyles;
4
+ branchBlockClass: import("antd-style").SerializedStyles;
5
+ branchClass: import("antd-style").SerializedStyles;
6
+ nodeBlockClass: import("antd-style").SerializedStyles;
7
+ nodeClass: import("antd-style").SerializedStyles;
8
+ nodeCardClass: import("antd-style").SerializedStyles;
9
+ nodeJobButtonClass: import("antd-style").SerializedStyles;
10
+ nodeHeaderClass: import("antd-style").SerializedStyles;
11
+ nodeMetaClass: import("antd-style").SerializedStyles;
12
+ nodeTitleClass: import("antd-style").SerializedStyles;
13
+ nodeSubtreeClass: import("antd-style").SerializedStyles;
14
+ addButtonClass: import("antd-style").SerializedStyles;
15
+ conditionClass: import("antd-style").SerializedStyles;
16
+ loopLineClass: import("antd-style").SerializedStyles;
17
+ }>;
18
+ export default useStyles;