@nocobase/client 0.7.1-alpha.5 → 0.7.2-alpha.1

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 (235) hide show
  1. package/es/application/Application.js +0 -4
  2. package/es/block-provider/BlockSchemaComponentProvider.js +3 -0
  3. package/es/block-provider/FormBlockProvider.js +2 -1
  4. package/es/block-provider/FormFieldProvider.d.ts +8 -0
  5. package/es/block-provider/FormFieldProvider.js +89 -0
  6. package/es/block-provider/KanbanBlockProvider.js +117 -3
  7. package/es/block-provider/TableFieldProvider.js +17 -2
  8. package/es/block-provider/TableSelectorProvider.js +38 -6
  9. package/es/block-provider/hooks/index.js +10 -3
  10. package/es/block-provider/index.d.ts +1 -0
  11. package/es/block-provider/index.js +2 -1
  12. package/es/collection-manager/CollectionField.js +5 -1
  13. package/es/collection-manager/CollectionFieldProvider.js +7 -2
  14. package/es/collection-manager/Configuration/AddFieldAction.js +1 -1
  15. package/es/collection-manager/Configuration/EditFieldAction.js +1 -1
  16. package/es/collection-manager/hooks/useCollectionManager.js +20 -5
  17. package/es/collection-manager/interfaces/index.d.ts +2 -1
  18. package/es/collection-manager/interfaces/index.js +3 -2
  19. package/es/collection-manager/interfaces/integer.d.ts +2 -0
  20. package/es/{workflow/nodes/update.js → collection-manager/interfaces/integer.js} +24 -20
  21. package/es/collection-manager/interfaces/linkTo.js +14 -6
  22. package/es/collection-manager/interfaces/m2m.js +12 -5
  23. package/es/collection-manager/interfaces/m2o.js +59 -8
  24. package/es/collection-manager/interfaces/o2m.js +72 -46
  25. package/es/collection-manager/interfaces/o2o.js +100 -39
  26. package/es/collection-manager/interfaces/properties/operators.d.ts +13 -0
  27. package/es/collection-manager/interfaces/properties/operators.js +7 -0
  28. package/es/index.d.ts +0 -1
  29. package/es/index.js +1 -2
  30. package/es/locale/en_US.d.ts +7 -0
  31. package/es/locale/en_US.js +9 -2
  32. package/es/locale/zh_CN.d.ts +10 -1
  33. package/es/locale/zh_CN.js +10 -1
  34. package/es/schema-component/antd/filter/DynamicComponent.js +50 -3
  35. package/es/schema-component/antd/filter/FilterItem.js +6 -0
  36. package/es/schema-component/antd/filter/useFilterActionProps.js +2 -0
  37. package/es/schema-component/antd/form-item/FormItem.js +79 -16
  38. package/es/schema-component/antd/form-v2/FormField.d.ts +1 -0
  39. package/es/schema-component/antd/form-v2/FormField.js +29 -0
  40. package/es/schema-component/antd/form-v2/index.d.ts +1 -0
  41. package/es/schema-component/antd/form-v2/index.js +2 -1
  42. package/es/schema-component/antd/kanban/Kanban.Card.Designer.js +10 -1
  43. package/es/schema-component/antd/record-picker/InputRecordPicker.js +34 -14
  44. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +34 -11
  45. package/es/schema-component/antd/record-picker/useFieldNames.js +2 -2
  46. package/es/schema-component/antd/select/shared.js +4 -2
  47. package/es/schema-component/antd/table-v2/Table.Column.Decorator.d.ts +1 -1
  48. package/es/schema-component/antd/table-v2/Table.Column.Decorator.js +7 -3
  49. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +7 -2
  50. package/es/schema-component/antd/table-v2/Table.js +4 -2
  51. package/es/schema-component/antd/table-v2/TableField.js +7 -0
  52. package/es/schema-initializer/buttons/TableColumnInitializers.js +26 -12
  53. package/es/schema-initializer/components/assigned-field/AssignedField.js +34 -47
  54. package/es/schema-initializer/utils.d.ts +2 -0
  55. package/es/schema-initializer/utils.js +160 -30
  56. package/es/schema-settings/SchemaSettings.js +6 -3
  57. package/lib/application/Application.js +0 -5
  58. package/lib/block-provider/BlockSchemaComponentProvider.js +4 -0
  59. package/lib/block-provider/FormBlockProvider.js +2 -1
  60. package/lib/block-provider/FormFieldProvider.d.ts +8 -0
  61. package/lib/block-provider/FormFieldProvider.js +120 -0
  62. package/lib/block-provider/KanbanBlockProvider.js +118 -1
  63. package/lib/block-provider/TableFieldProvider.js +19 -2
  64. package/lib/block-provider/TableSelectorProvider.js +39 -5
  65. package/lib/block-provider/hooks/index.js +11 -3
  66. package/lib/block-provider/index.d.ts +1 -0
  67. package/lib/block-provider/index.js +13 -0
  68. package/lib/collection-manager/CollectionField.js +5 -1
  69. package/lib/collection-manager/CollectionFieldProvider.js +9 -3
  70. package/lib/collection-manager/Configuration/AddFieldAction.js +1 -1
  71. package/lib/collection-manager/Configuration/EditFieldAction.js +1 -1
  72. package/lib/collection-manager/hooks/useCollectionManager.js +20 -5
  73. package/lib/collection-manager/interfaces/index.d.ts +2 -1
  74. package/lib/collection-manager/interfaces/index.js +26 -13
  75. package/lib/collection-manager/interfaces/integer.d.ts +2 -0
  76. package/lib/{workflow/nodes/update.js → collection-manager/interfaces/integer.js} +26 -24
  77. package/lib/collection-manager/interfaces/linkTo.js +14 -6
  78. package/lib/collection-manager/interfaces/m2m.js +12 -5
  79. package/lib/collection-manager/interfaces/m2o.js +61 -10
  80. package/lib/collection-manager/interfaces/o2m.js +72 -45
  81. package/lib/collection-manager/interfaces/o2o.js +103 -43
  82. package/lib/collection-manager/interfaces/properties/operators.d.ts +13 -0
  83. package/lib/collection-manager/interfaces/properties/operators.js +7 -0
  84. package/lib/index.d.ts +0 -1
  85. package/lib/index.js +0 -13
  86. package/lib/locale/en_US.d.ts +7 -0
  87. package/lib/locale/en_US.js +9 -2
  88. package/lib/locale/zh_CN.d.ts +10 -1
  89. package/lib/locale/zh_CN.js +10 -1
  90. package/lib/schema-component/antd/filter/DynamicComponent.js +52 -1
  91. package/lib/schema-component/antd/filter/FilterItem.js +7 -0
  92. package/lib/schema-component/antd/filter/useFilterActionProps.js +2 -0
  93. package/lib/schema-component/antd/form-item/FormItem.js +80 -17
  94. package/lib/schema-component/antd/form-v2/FormField.d.ts +1 -0
  95. package/lib/schema-component/antd/form-v2/FormField.js +48 -0
  96. package/lib/schema-component/antd/form-v2/index.d.ts +1 -0
  97. package/lib/schema-component/antd/form-v2/index.js +17 -0
  98. package/lib/schema-component/antd/kanban/Kanban.Card.Designer.js +9 -0
  99. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +33 -13
  100. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +32 -9
  101. package/lib/schema-component/antd/record-picker/useFieldNames.js +2 -2
  102. package/lib/schema-component/antd/select/shared.js +4 -2
  103. package/lib/schema-component/antd/table-v2/Table.Column.Decorator.d.ts +1 -1
  104. package/lib/schema-component/antd/table-v2/Table.Column.Decorator.js +6 -2
  105. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +7 -2
  106. package/lib/schema-component/antd/table-v2/Table.js +4 -2
  107. package/lib/schema-component/antd/table-v2/TableField.js +8 -0
  108. package/lib/schema-initializer/buttons/TableColumnInitializers.js +25 -11
  109. package/lib/schema-initializer/components/assigned-field/AssignedField.js +29 -43
  110. package/lib/schema-initializer/utils.d.ts +2 -0
  111. package/lib/schema-initializer/utils.js +166 -30
  112. package/lib/schema-settings/SchemaSettings.js +5 -2
  113. package/package.json +4 -5
  114. package/es/workflow/ExecutionResourceProvider.d.ts +0 -4
  115. package/es/workflow/ExecutionResourceProvider.js +0 -35
  116. package/es/workflow/WorkflowCanvas.d.ts +0 -15
  117. package/es/workflow/WorkflowCanvas.js +0 -375
  118. package/es/workflow/WorkflowLink.d.ts +0 -1
  119. package/es/workflow/WorkflowLink.js +0 -21
  120. package/es/workflow/WorkflowPage.d.ts +0 -1
  121. package/es/workflow/WorkflowPage.js +0 -43
  122. package/es/workflow/WorkflowRouteProvider.d.ts +0 -1
  123. package/es/workflow/WorkflowRouteProvider.js +0 -30
  124. package/es/workflow/WorkflowShortcut.d.ts +0 -1
  125. package/es/workflow/WorkflowShortcut.js +0 -62
  126. package/es/workflow/calculators.d.ts +0 -101
  127. package/es/workflow/calculators.js +0 -647
  128. package/es/workflow/components/Duration.d.ts +0 -5
  129. package/es/workflow/components/Duration.js +0 -61
  130. package/es/workflow/index.d.ts +0 -5
  131. package/es/workflow/index.js +0 -5
  132. package/es/workflow/nodes/calculation.d.ts +0 -25
  133. package/es/workflow/nodes/calculation.js +0 -47
  134. package/es/workflow/nodes/condition.d.ts +0 -46
  135. package/es/workflow/nodes/condition.js +0 -255
  136. package/es/workflow/nodes/create.d.ts +0 -46
  137. package/es/workflow/nodes/create.js +0 -90
  138. package/es/workflow/nodes/delay.d.ts +0 -35
  139. package/es/workflow/nodes/delay.js +0 -37
  140. package/es/workflow/nodes/destroy.d.ts +0 -55
  141. package/es/workflow/nodes/destroy.js +0 -27
  142. package/es/workflow/nodes/index.d.ts +0 -33
  143. package/es/workflow/nodes/index.js +0 -312
  144. package/es/workflow/nodes/parallel.d.ts +0 -24
  145. package/es/workflow/nodes/parallel.js +0 -132
  146. package/es/workflow/nodes/query.d.ts +0 -70
  147. package/es/workflow/nodes/query.js +0 -98
  148. package/es/workflow/nodes/update.d.ts +0 -60
  149. package/es/workflow/schemas/collection.d.ts +0 -42
  150. package/es/workflow/schemas/collection.js +0 -57
  151. package/es/workflow/schemas/executions.d.ts +0 -209
  152. package/es/workflow/schemas/executions.js +0 -157
  153. package/es/workflow/schemas/workflows.d.ts +0 -2
  154. package/es/workflow/schemas/workflows.js +0 -334
  155. package/es/workflow/style.d.ts +0 -12
  156. package/es/workflow/style.js +0 -17
  157. package/es/workflow/triggers/collection.d.ts +0 -77
  158. package/es/workflow/triggers/collection.js +0 -144
  159. package/es/workflow/triggers/index.d.ts +0 -26
  160. package/es/workflow/triggers/index.js +0 -177
  161. package/es/workflow/triggers/schedule/DateFieldsSelect.d.ts +0 -2
  162. package/es/workflow/triggers/schedule/DateFieldsSelect.js +0 -39
  163. package/es/workflow/triggers/schedule/EndsByField.d.ts +0 -5
  164. package/es/workflow/triggers/schedule/EndsByField.js +0 -57
  165. package/es/workflow/triggers/schedule/OnField.d.ts +0 -5
  166. package/es/workflow/triggers/schedule/OnField.js +0 -87
  167. package/es/workflow/triggers/schedule/RepeatField.d.ts +0 -5
  168. package/es/workflow/triggers/schedule/RepeatField.js +0 -131
  169. package/es/workflow/triggers/schedule/ScheduleConfig.d.ts +0 -1
  170. package/es/workflow/triggers/schedule/ScheduleConfig.js +0 -225
  171. package/es/workflow/triggers/schedule/index.d.ts +0 -25
  172. package/es/workflow/triggers/schedule/index.js +0 -77
  173. package/es/workflow/triggers/schedule/locale/Cron.zh-CN.d.ts +0 -34
  174. package/es/workflow/triggers/schedule/locale/Cron.zh-CN.js +0 -37
  175. package/lib/workflow/ExecutionResourceProvider.d.ts +0 -4
  176. package/lib/workflow/ExecutionResourceProvider.js +0 -48
  177. package/lib/workflow/WorkflowCanvas.d.ts +0 -15
  178. package/lib/workflow/WorkflowCanvas.js +0 -408
  179. package/lib/workflow/WorkflowLink.d.ts +0 -1
  180. package/lib/workflow/WorkflowLink.js +0 -36
  181. package/lib/workflow/WorkflowPage.d.ts +0 -1
  182. package/lib/workflow/WorkflowPage.js +0 -60
  183. package/lib/workflow/WorkflowRouteProvider.d.ts +0 -1
  184. package/lib/workflow/WorkflowRouteProvider.js +0 -47
  185. package/lib/workflow/WorkflowShortcut.d.ts +0 -1
  186. package/lib/workflow/WorkflowShortcut.js +0 -87
  187. package/lib/workflow/calculators.d.ts +0 -101
  188. package/lib/workflow/calculators.js +0 -688
  189. package/lib/workflow/components/Duration.d.ts +0 -5
  190. package/lib/workflow/components/Duration.js +0 -74
  191. package/lib/workflow/index.d.ts +0 -5
  192. package/lib/workflow/index.js +0 -70
  193. package/lib/workflow/nodes/calculation.d.ts +0 -25
  194. package/lib/workflow/nodes/calculation.js +0 -61
  195. package/lib/workflow/nodes/condition.d.ts +0 -46
  196. package/lib/workflow/nodes/condition.js +0 -275
  197. package/lib/workflow/nodes/create.d.ts +0 -46
  198. package/lib/workflow/nodes/create.js +0 -107
  199. package/lib/workflow/nodes/delay.d.ts +0 -35
  200. package/lib/workflow/nodes/delay.js +0 -48
  201. package/lib/workflow/nodes/destroy.d.ts +0 -55
  202. package/lib/workflow/nodes/destroy.js +0 -38
  203. package/lib/workflow/nodes/index.d.ts +0 -33
  204. package/lib/workflow/nodes/index.js +0 -357
  205. package/lib/workflow/nodes/parallel.d.ts +0 -24
  206. package/lib/workflow/nodes/parallel.js +0 -155
  207. package/lib/workflow/nodes/query.d.ts +0 -70
  208. package/lib/workflow/nodes/query.js +0 -115
  209. package/lib/workflow/nodes/update.d.ts +0 -60
  210. package/lib/workflow/schemas/collection.d.ts +0 -42
  211. package/lib/workflow/schemas/collection.js +0 -70
  212. package/lib/workflow/schemas/executions.d.ts +0 -209
  213. package/lib/workflow/schemas/executions.js +0 -164
  214. package/lib/workflow/schemas/workflows.d.ts +0 -2
  215. package/lib/workflow/schemas/workflows.js +0 -344
  216. package/lib/workflow/style.d.ts +0 -12
  217. package/lib/workflow/style.js +0 -37
  218. package/lib/workflow/triggers/collection.d.ts +0 -77
  219. package/lib/workflow/triggers/collection.js +0 -164
  220. package/lib/workflow/triggers/index.d.ts +0 -26
  221. package/lib/workflow/triggers/index.js +0 -201
  222. package/lib/workflow/triggers/schedule/DateFieldsSelect.d.ts +0 -2
  223. package/lib/workflow/triggers/schedule/DateFieldsSelect.js +0 -54
  224. package/lib/workflow/triggers/schedule/EndsByField.d.ts +0 -5
  225. package/lib/workflow/triggers/schedule/EndsByField.js +0 -73
  226. package/lib/workflow/triggers/schedule/OnField.d.ts +0 -5
  227. package/lib/workflow/triggers/schedule/OnField.js +0 -105
  228. package/lib/workflow/triggers/schedule/RepeatField.d.ts +0 -5
  229. package/lib/workflow/triggers/schedule/RepeatField.js +0 -146
  230. package/lib/workflow/triggers/schedule/ScheduleConfig.d.ts +0 -1
  231. package/lib/workflow/triggers/schedule/ScheduleConfig.js +0 -250
  232. package/lib/workflow/triggers/schedule/index.d.ts +0 -25
  233. package/lib/workflow/triggers/schedule/index.js +0 -94
  234. package/lib/workflow/triggers/schedule/locale/Cron.zh-CN.d.ts +0 -34
  235. package/lib/workflow/triggers/schedule/locale/Cron.zh-CN.js +0 -44
@@ -1,55 +0,0 @@
1
- import { useCollectionDataSource } from '../..';
2
- import { VariableComponent } from '../calculators';
3
- declare const _default: {
4
- title: string;
5
- type: string;
6
- group: string;
7
- fieldset: {
8
- 'config.collection': {
9
- type: string;
10
- title: string;
11
- name: string;
12
- required: boolean;
13
- 'x-reactions': string[];
14
- 'x-decorator': string;
15
- 'x-component': string;
16
- 'x-component-props': {
17
- placeholder: string;
18
- };
19
- };
20
- 'config.params': {
21
- type: string;
22
- name: string;
23
- title: string;
24
- 'x-decorator': string;
25
- properties: {
26
- filter: {
27
- type: string;
28
- title: string;
29
- name: string;
30
- 'x-decorator': string;
31
- 'x-decorator-props': {
32
- labelAlign: string;
33
- className: string;
34
- };
35
- 'x-component': string;
36
- 'x-component-props': {
37
- useProps(): {
38
- options: any[];
39
- className: string;
40
- };
41
- dynamicComponent: string;
42
- };
43
- };
44
- };
45
- };
46
- };
47
- view: {};
48
- scope: {
49
- useCollectionDataSource: typeof useCollectionDataSource;
50
- };
51
- components: {
52
- VariableComponent: typeof VariableComponent;
53
- };
54
- };
55
- export default _default;
@@ -1,27 +0,0 @@
1
- import { useCollectionDataSource } from '../..';
2
- import { VariableComponent } from '../calculators';
3
- import { collection, filter } from '../schemas/collection';
4
- export default {
5
- title: '{{t("Delete record")}}',
6
- type: 'destroy',
7
- group: 'collection',
8
- fieldset: {
9
- 'config.collection': collection,
10
- 'config.params': {
11
- type: 'object',
12
- name: 'config.params',
13
- title: '',
14
- 'x-decorator': 'FormItem',
15
- properties: {
16
- filter: filter
17
- }
18
- }
19
- },
20
- view: {},
21
- scope: {
22
- useCollectionDataSource: useCollectionDataSource
23
- },
24
- components: {
25
- VariableComponent: VariableComponent
26
- }
27
- };
@@ -1,33 +0,0 @@
1
- import { ISchema } from '@formily/react';
2
- import { Registry } from '@nocobase/utils/client';
3
- import React from 'react';
4
- export interface Instruction {
5
- title: string;
6
- type: string;
7
- group: string;
8
- options?: {
9
- label: string;
10
- value: any;
11
- key: string;
12
- }[];
13
- fieldset: {
14
- [key: string]: ISchema;
15
- };
16
- view?: ISchema;
17
- scope?: {
18
- [key: string]: any;
19
- };
20
- components?: {
21
- [key: string]: any;
22
- };
23
- render?(props: any): React.ReactElement;
24
- endding?: boolean;
25
- getter?(node: any): React.ReactElement;
26
- }
27
- export declare const instructions: Registry<Instruction>;
28
- export declare function useNodeContext(): any;
29
- export declare function Node({ data }: {
30
- data: any;
31
- }): JSX.Element;
32
- export declare function RemoveButton(): JSX.Element;
33
- export declare function NodeDefaultView(props: any): JSX.Element;
@@ -1,312 +0,0 @@
1
- var _templateObject, _templateObject2;
2
-
3
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
-
5
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
6
-
7
- 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); } }
8
-
9
- 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); }); }; }
10
-
11
- import { CloseOutlined, DeleteOutlined } from '@ant-design/icons';
12
- import { css, cx } from '@emotion/css';
13
- import { useForm } from '@formily/react';
14
- import { Registry } from '@nocobase/utils/client';
15
- import { Button, message, Modal, Tag } from 'antd';
16
- import React, { useContext } from 'react';
17
- import { useTranslation } from 'react-i18next';
18
- import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRequest, useResourceActionContext } from '../..';
19
- import { nodeBlockClass, nodeCardClass, nodeClass, nodeHeaderClass, nodeMetaClass, nodeTitleClass } from '../style';
20
- import { AddButton, useFlowContext } from '../WorkflowCanvas';
21
- import calculation from './calculation';
22
- import condition from './condition';
23
- import parallel from './parallel';
24
- import delay from './delay';
25
- import query from './query';
26
- import create from './create';
27
- import update from './update';
28
- import destroy from './destroy';
29
- ;
30
- export var instructions = new Registry();
31
- instructions.register('condition', condition);
32
- instructions.register('parallel', parallel);
33
- instructions.register('calculation', calculation);
34
- instructions.register('delay', delay);
35
- instructions.register('query', query);
36
- instructions.register('create', create);
37
- instructions.register('update', update);
38
- instructions.register('destroy', destroy);
39
-
40
- function useUpdateAction() {
41
- var _useTranslation = useTranslation(),
42
- t = _useTranslation.t;
43
-
44
- var form = useForm();
45
- var api = useAPIClient();
46
- var ctx = useActionContext();
47
-
48
- var _useResourceActionCon = useResourceActionContext(),
49
- refresh = _useResourceActionCon.refresh;
50
-
51
- var data = useNodeContext();
52
-
53
- var _useFlowContext = useFlowContext(),
54
- workflow = _useFlowContext.workflow;
55
-
56
- return {
57
- run: function run() {
58
- return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
59
- return regeneratorRuntime.wrap(function _callee$(_context) {
60
- while (1) {
61
- switch (_context.prev = _context.next) {
62
- case 0:
63
- if (!workflow.executed) {
64
- _context.next = 3;
65
- break;
66
- }
67
-
68
- message.error(t('Node in executed workflow cannot be modified'));
69
- return _context.abrupt("return");
70
-
71
- case 3:
72
- _context.next = 5;
73
- return form.submit();
74
-
75
- case 5:
76
- _context.next = 7;
77
- return api.resource('flow_nodes', data.id).update({
78
- filterByTk: data.id,
79
- values: {
80
- title: form.values.title,
81
- config: form.values.config
82
- }
83
- });
84
-
85
- case 7:
86
- ctx.setVisible(false);
87
- refresh();
88
-
89
- case 9:
90
- case "end":
91
- return _context.stop();
92
- }
93
- }
94
- }, _callee);
95
- }))();
96
- }
97
- };
98
- }
99
-
100
- ;
101
- var NodeContext = /*#__PURE__*/React.createContext(null);
102
- export function useNodeContext() {
103
- return useContext(NodeContext);
104
- }
105
- export function Node(_ref) {
106
- var data = _ref.data;
107
- var instruction = instructions.get(data.type);
108
- return /*#__PURE__*/React.createElement(NodeContext.Provider, {
109
- value: data
110
- }, /*#__PURE__*/React.createElement("div", {
111
- className: cx(nodeBlockClass)
112
- }, instruction.render ? instruction.render(data) : /*#__PURE__*/React.createElement(NodeDefaultView, {
113
- data: data
114
- }), !instruction.endding ? /*#__PURE__*/React.createElement(AddButton, {
115
- upstream: data
116
- }) : /*#__PURE__*/React.createElement("div", {
117
- className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 1px;\n height: 6em;\n padding: 2em 0;\n background-color: #f0f2f5;\n\n .anticon{\n font-size: 1.5em;\n line-height: 100%;\n }\n "])))
118
- }, /*#__PURE__*/React.createElement(CloseOutlined, null))));
119
- }
120
- export function RemoveButton() {
121
- var _useTranslation2 = useTranslation(),
122
- t = _useTranslation2.t;
123
-
124
- var api = useAPIClient();
125
-
126
- var _useFlowContext2 = useFlowContext(),
127
- workflow = _useFlowContext2.workflow;
128
-
129
- var resource = api.resource('workflows.nodes', workflow.id);
130
- var current = useNodeContext();
131
-
132
- var _useFlowContext3 = useFlowContext(),
133
- nodes = _useFlowContext3.nodes,
134
- onNodeRemoved = _useFlowContext3.onNodeRemoved;
135
-
136
- function onRemove() {
137
- return _onRemove.apply(this, arguments);
138
- }
139
-
140
- function _onRemove() {
141
- _onRemove = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
142
- var onOk, _onOk, hasBranches, message;
143
-
144
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
145
- while (1) {
146
- switch (_context3.prev = _context3.next) {
147
- case 0:
148
- _onOk = function _onOk3() {
149
- _onOk = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
150
- var _yield$resource$destr, node;
151
-
152
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
153
- while (1) {
154
- switch (_context2.prev = _context2.next) {
155
- case 0:
156
- _context2.next = 2;
157
- return resource.destroy({
158
- filterByTk: current.id
159
- });
160
-
161
- case 2:
162
- _yield$resource$destr = _context2.sent;
163
- node = _yield$resource$destr.data.data;
164
- onNodeRemoved(node);
165
-
166
- case 5:
167
- case "end":
168
- return _context2.stop();
169
- }
170
- }
171
- }, _callee2);
172
- }));
173
- return _onOk.apply(this, arguments);
174
- };
175
-
176
- onOk = function _onOk2() {
177
- return _onOk.apply(this, arguments);
178
- };
179
-
180
- hasBranches = !nodes.find(function (item) {
181
- return item.upstream === current && item.branchIndex != null;
182
- });
183
- message = hasBranches ? t('Are you sure you want to delete it?') : t('This node contains branches, deleting will also be preformed to them, are you sure?');
184
- Modal.confirm({
185
- title: t('Delete'),
186
- content: message,
187
- onOk: onOk
188
- });
189
-
190
- case 5:
191
- case "end":
192
- return _context3.stop();
193
- }
194
- }
195
- }, _callee3);
196
- }));
197
- return _onRemove.apply(this, arguments);
198
- }
199
-
200
- return workflow.executed ? null : /*#__PURE__*/React.createElement(Button, {
201
- type: "text",
202
- shape: "circle",
203
- icon: /*#__PURE__*/React.createElement(DeleteOutlined, null),
204
- onClick: onRemove,
205
- className: "workflow-node-remove-button"
206
- });
207
- }
208
- export function NodeDefaultView(props) {
209
- var compile = useCompile();
210
-
211
- var _useFlowContext4 = useFlowContext(),
212
- workflow = _useFlowContext4.workflow;
213
-
214
- var data = props.data,
215
- children = props.children;
216
- var instruction = instructions.get(data.type);
217
- var detailText = workflow.executed ? '{{t("View")}}' : '{{t("Configure")}}';
218
- return /*#__PURE__*/React.createElement("div", {
219
- className: cx(nodeClass, "workflow-node-type-".concat(data.type))
220
- }, /*#__PURE__*/React.createElement("div", {
221
- className: cx(nodeCardClass)
222
- }, /*#__PURE__*/React.createElement("div", {
223
- className: cx(nodeHeaderClass)
224
- }, /*#__PURE__*/React.createElement("div", {
225
- className: cx(nodeMetaClass)
226
- }, /*#__PURE__*/React.createElement(Tag, null, compile(instruction.title))), /*#__PURE__*/React.createElement("h4", {
227
- className: cx(nodeTitleClass)
228
- }, /*#__PURE__*/React.createElement("strong", null, data.title), /*#__PURE__*/React.createElement("span", {
229
- className: "workflow-node-id"
230
- }, "#", data.id)), /*#__PURE__*/React.createElement(RemoveButton, null)), /*#__PURE__*/React.createElement(SchemaComponent, {
231
- scope: instruction.scope,
232
- components: instruction.components,
233
- schema: {
234
- type: 'void',
235
- properties: {
236
- view: instruction.view,
237
- config: {
238
- type: 'void',
239
- title: detailText,
240
- 'x-component': 'Action.Link',
241
- 'x-component-props': {
242
- type: 'primary'
243
- },
244
- properties: _defineProperty({}, instruction.type, {
245
- type: 'void',
246
- title: instruction.title,
247
- 'x-component': 'Action.Drawer',
248
- 'x-decorator': 'Form',
249
- 'x-decorator-props': {
250
- useValues: function useValues(options) {
251
- var d = useNodeContext();
252
- return useRequest(function () {
253
- return Promise.resolve({
254
- data: d
255
- });
256
- }, options);
257
- }
258
- },
259
- properties: {
260
- title: {
261
- type: 'string',
262
- name: 'title',
263
- title: '{{t("Name")}}',
264
- 'x-decorator': 'FormItem',
265
- 'x-component': 'Input'
266
- },
267
- config: {
268
- type: 'void',
269
- name: 'config',
270
- 'x-component': 'fieldset',
271
- 'x-component-props': {
272
- disabled: workflow.executed,
273
- className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .ant-select,\n .ant-cascader-picker,\n .ant-picker,\n .ant-input-number,\n .ant-input-affix-wrapper{\n width: auto;\n }\n "])))
274
- },
275
- properties: instruction.fieldset
276
- },
277
- actions: {
278
- type: 'void',
279
- 'x-component': 'Action.Drawer.Footer',
280
- properties: workflow.executed ? {
281
- close: {
282
- title: '{{t("Close")}}',
283
- 'x-component': 'Action',
284
- 'x-component-props': {
285
- useAction: '{{ cm.useCancelAction }}'
286
- }
287
- }
288
- } : {
289
- cancel: {
290
- title: '{{t("Cancel")}}',
291
- 'x-component': 'Action',
292
- 'x-component-props': {
293
- useAction: '{{ cm.useCancelAction }}'
294
- }
295
- },
296
- submit: {
297
- title: '{{t("Submit")}}',
298
- 'x-component': 'Action',
299
- 'x-component-props': {
300
- type: 'primary',
301
- useAction: useUpdateAction
302
- }
303
- }
304
- }
305
- }
306
- }
307
- })
308
- }
309
- }
310
- }
311
- })), children);
312
- }
@@ -1,24 +0,0 @@
1
- /// <reference types="react" />
2
- declare const _default: {
3
- title: string;
4
- type: string;
5
- group: string;
6
- fieldset: {
7
- 'config.mode': {
8
- type: string;
9
- name: string;
10
- title: string;
11
- 'x-decorator': string;
12
- 'x-component': string;
13
- 'x-component-props': {};
14
- enum: {
15
- value: string;
16
- label: JSX.Element;
17
- }[];
18
- default: string;
19
- };
20
- };
21
- view: {};
22
- render(data: any): JSX.Element;
23
- };
24
- export default _default;
@@ -1,132 +0,0 @@
1
- var _templateObject, _templateObject2, _templateObject3;
2
-
3
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
4
-
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
-
7
- 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."); }
8
-
9
- 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); }
10
-
11
- 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; }
12
-
13
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- import React, { useState } from "react";
18
- import { css, cx } from "@emotion/css";
19
- import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
20
- import { NodeDefaultView } from ".";
21
- import { Branch, useFlowContext } from "../WorkflowCanvas";
22
- import { branchBlockClass, nodeSubtreeClass } from "../style";
23
- import { Button, Tooltip } from "antd";
24
- import { i18n } from "../../i18n";
25
- import { useTranslation } from "react-i18next"; // import { SchemaComponent } from "../../schema-component";
26
-
27
- export default {
28
- title: '{{t("Parallel branch")}}',
29
- type: 'parallel',
30
- group: 'control',
31
- fieldset: {
32
- 'config.mode': {
33
- type: 'string',
34
- name: 'config.mode',
35
- title: '{{t("Mode")}}',
36
- 'x-decorator': 'FormItem',
37
- 'x-component': 'Radio.Group',
38
- 'x-component-props': {},
39
- enum: [{
40
- value: 'all',
41
- label: /*#__PURE__*/React.createElement(Tooltip, {
42
- title: i18n.t('Continue after all branches succeeded'),
43
- placement: "bottom"
44
- }, i18n.t('All succeeded'), " ", /*#__PURE__*/React.createElement(QuestionCircleOutlined, {
45
- style: {
46
- color: '#999'
47
- }
48
- }))
49
- }, {
50
- value: 'any',
51
- label: /*#__PURE__*/React.createElement(Tooltip, {
52
- title: i18n.t('Continue after any branch succeeded'),
53
- placement: "bottom"
54
- }, i18n.t('Any succeeded'), " ", /*#__PURE__*/React.createElement(QuestionCircleOutlined, {
55
- style: {
56
- color: '#999'
57
- }
58
- }))
59
- } // { value: 'race', label: '任意退出' },
60
- ],
61
- default: 'all'
62
- }
63
- },
64
- view: {},
65
- render: function render(data) {
66
- var id = data.id,
67
- mode = data.config.mode;
68
-
69
- var _useTranslation = useTranslation(),
70
- t = _useTranslation.t;
71
-
72
- var _useFlowContext = useFlowContext(),
73
- nodes = _useFlowContext.nodes;
74
-
75
- var branches = nodes.reduce(function (result, node) {
76
- if (node.upstreamId === id && node.branchIndex != null) {
77
- return result.concat(node);
78
- }
79
-
80
- return result;
81
- }, []).sort(function (a, b) {
82
- return a.branchIndex - b.branchIndex;
83
- });
84
-
85
- var _useState = useState(Math.max(2, branches.length)),
86
- _useState2 = _slicedToArray(_useState, 2),
87
- branchCount = _useState2[0],
88
- setBranchCount = _useState2[1];
89
-
90
- var tempBranches = Array(Math.max(0, branchCount - branches.length)).fill(null);
91
- var lastBranchHead = branches[branches.length - 1];
92
- return /*#__PURE__*/React.createElement(NodeDefaultView, {
93
- data: data
94
- }, /*#__PURE__*/React.createElement("div", {
95
- className: cx(nodeSubtreeClass)
96
- }, /*#__PURE__*/React.createElement("div", {
97
- className: cx(branchBlockClass)
98
- }, branches.map(function (branch) {
99
- return /*#__PURE__*/React.createElement(Branch, {
100
- key: branch.id,
101
- from: data,
102
- entry: branch,
103
- branchIndex: branch.branchIndex
104
- });
105
- }), tempBranches.map(function (_, i) {
106
- return /*#__PURE__*/React.createElement(Branch, {
107
- key: "temp_".concat(branches.length + i),
108
- from: data,
109
- branchIndex: (lastBranchHead ? lastBranchHead.branchIndex : 0) + i + 1,
110
- controller: branches.length + i > 1 ? /*#__PURE__*/React.createElement("div", {
111
- className: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 2em;\n\n > button{\n .anticon{\n transform: rotate(45deg)\n }\n }\n "])))
112
- }, /*#__PURE__*/React.createElement(Button, {
113
- shape: "circle",
114
- icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
115
- onClick: function onClick() {
116
- return setBranchCount(branchCount - 1);
117
- }
118
- })) : null
119
- });
120
- })), /*#__PURE__*/React.createElement("div", {
121
- className: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n height: 2em;\n "])))
122
- }, /*#__PURE__*/React.createElement(Tooltip, {
123
- title: t('Add branch')
124
- }, /*#__PURE__*/React.createElement(Button, {
125
- icon: /*#__PURE__*/React.createElement(PlusOutlined, null),
126
- className: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: absolute;\n top: calc(50% - 1px);\n transform: translateX(-50%) rotate(45deg);\n\n .anticon{\n transform: rotate(-45deg);\n }\n "]))),
127
- onClick: function onClick() {
128
- return setBranchCount(branchCount + 1);
129
- }
130
- })))));
131
- }
132
- };
@@ -1,70 +0,0 @@
1
- import { useCollectionDataSource } from '../..';
2
- import { VariableComponent } from '../calculators';
3
- declare const _default: {
4
- title: string;
5
- type: string;
6
- group: string;
7
- fieldset: {
8
- 'config.collection': {
9
- type: string;
10
- title: string;
11
- name: string;
12
- required: boolean;
13
- 'x-reactions': string[];
14
- 'x-decorator': string;
15
- 'x-component': string;
16
- 'x-component-props': {
17
- placeholder: string;
18
- };
19
- };
20
- 'config.multiple': {
21
- type: string;
22
- title: string;
23
- name: string;
24
- 'x-decorator': string;
25
- 'x-component': string;
26
- 'x-component-props': {
27
- disabled: boolean;
28
- };
29
- };
30
- 'config.params': {
31
- type: string;
32
- name: string;
33
- title: string;
34
- 'x-decorator': string;
35
- properties: {
36
- filter: {
37
- type: string;
38
- title: string;
39
- name: string;
40
- 'x-decorator': string;
41
- 'x-decorator-props': {
42
- labelAlign: string;
43
- className: string;
44
- };
45
- 'x-component': string;
46
- 'x-component-props': {
47
- useProps(): {
48
- options: any[];
49
- className: string;
50
- };
51
- dynamicComponent: string;
52
- };
53
- };
54
- };
55
- };
56
- };
57
- view: {};
58
- scope: {
59
- useCollectionDataSource: typeof useCollectionDataSource;
60
- };
61
- components: {
62
- VariableComponent: typeof VariableComponent;
63
- };
64
- getter({ type, options, onChange }: {
65
- type: any;
66
- options: any;
67
- onChange: any;
68
- }): JSX.Element;
69
- };
70
- export default _default;