@nocobase/client 0.7.0-alpha.23 → 0.7.0-alpha.26

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 (113) hide show
  1. package/esm/collection-manager/interfaces/attachment.js +1 -1
  2. package/esm/collection-manager/interfaces/attachment.js.map +1 -1
  3. package/esm/locale/index.d.ts +48 -0
  4. package/esm/locale/zh_CN.d.ts +48 -0
  5. package/esm/locale/zh_CN.js +51 -2
  6. package/esm/locale/zh_CN.js.map +1 -1
  7. package/esm/schema-component/antd/kanban-v2/Kanban.Card.Designer.js +1 -2
  8. package/esm/schema-component/antd/kanban-v2/Kanban.Card.Designer.js.map +1 -1
  9. package/esm/schema-initializer/utils.js +2 -2
  10. package/esm/schema-initializer/utils.js.map +1 -1
  11. package/esm/workflow/WorkflowCanvas.js +11 -8
  12. package/esm/workflow/WorkflowCanvas.js.map +1 -1
  13. package/esm/workflow/WorkflowLink.js +3 -1
  14. package/esm/workflow/WorkflowLink.js.map +1 -1
  15. package/esm/workflow/WorkflowPage.js +3 -3
  16. package/esm/workflow/WorkflowPage.js.map +1 -1
  17. package/esm/workflow/WorkflowShortcut.js +4 -2
  18. package/esm/workflow/WorkflowShortcut.js.map +1 -1
  19. package/esm/workflow/calculators.js +82 -45
  20. package/esm/workflow/calculators.js.map +1 -1
  21. package/esm/workflow/nodes/calculation.js +5 -3
  22. package/esm/workflow/nodes/calculation.js.map +1 -1
  23. package/esm/workflow/nodes/create.d.ts +0 -5
  24. package/esm/workflow/nodes/create.js +5 -3
  25. package/esm/workflow/nodes/create.js.map +1 -1
  26. package/esm/workflow/nodes/destroy.js +2 -2
  27. package/esm/workflow/nodes/destroy.js.map +1 -1
  28. package/esm/workflow/nodes/index.js +11 -8
  29. package/esm/workflow/nodes/index.js.map +1 -1
  30. package/esm/workflow/nodes/query.js +5 -3
  31. package/esm/workflow/nodes/query.js.map +1 -1
  32. package/esm/workflow/nodes/update.d.ts +0 -5
  33. package/esm/workflow/nodes/update.js +2 -2
  34. package/esm/workflow/nodes/update.js.map +1 -1
  35. package/esm/workflow/schemas/collection.d.ts +0 -5
  36. package/esm/workflow/schemas/collection.js +4 -16
  37. package/esm/workflow/schemas/collection.js.map +1 -1
  38. package/esm/workflow/schemas/executions.d.ts +4 -25
  39. package/esm/workflow/schemas/executions.js +38 -34
  40. package/esm/workflow/schemas/executions.js.map +1 -1
  41. package/esm/workflow/schemas/workflows.js +51 -30
  42. package/esm/workflow/schemas/workflows.js.map +1 -1
  43. package/esm/workflow/triggers/index.js +6 -5
  44. package/esm/workflow/triggers/index.js.map +1 -1
  45. package/esm/workflow/triggers/model.js +12 -10
  46. package/esm/workflow/triggers/model.js.map +1 -1
  47. package/lib/collection-manager/interfaces/attachment.js +1 -1
  48. package/lib/collection-manager/interfaces/attachment.js.map +1 -1
  49. package/lib/locale/index.d.ts +48 -0
  50. package/lib/locale/zh_CN.d.ts +48 -0
  51. package/lib/locale/zh_CN.js +51 -2
  52. package/lib/locale/zh_CN.js.map +1 -1
  53. package/lib/schema-component/antd/kanban-v2/Kanban.Card.Designer.js +1 -2
  54. package/lib/schema-component/antd/kanban-v2/Kanban.Card.Designer.js.map +1 -1
  55. package/lib/schema-initializer/utils.js +2 -2
  56. package/lib/schema-initializer/utils.js.map +1 -1
  57. package/lib/workflow/WorkflowCanvas.js +10 -7
  58. package/lib/workflow/WorkflowCanvas.js.map +1 -1
  59. package/lib/workflow/WorkflowLink.js +3 -1
  60. package/lib/workflow/WorkflowLink.js.map +1 -1
  61. package/lib/workflow/WorkflowPage.js +3 -3
  62. package/lib/workflow/WorkflowPage.js.map +1 -1
  63. package/lib/workflow/WorkflowShortcut.js +4 -2
  64. package/lib/workflow/WorkflowShortcut.js.map +1 -1
  65. package/lib/workflow/calculators.js +79 -42
  66. package/lib/workflow/calculators.js.map +1 -1
  67. package/lib/workflow/nodes/calculation.js +5 -3
  68. package/lib/workflow/nodes/calculation.js.map +1 -1
  69. package/lib/workflow/nodes/create.d.ts +0 -5
  70. package/lib/workflow/nodes/create.js +5 -3
  71. package/lib/workflow/nodes/create.js.map +1 -1
  72. package/lib/workflow/nodes/destroy.js +2 -2
  73. package/lib/workflow/nodes/destroy.js.map +1 -1
  74. package/lib/workflow/nodes/index.js +10 -7
  75. package/lib/workflow/nodes/index.js.map +1 -1
  76. package/lib/workflow/nodes/query.js +5 -3
  77. package/lib/workflow/nodes/query.js.map +1 -1
  78. package/lib/workflow/nodes/update.d.ts +0 -5
  79. package/lib/workflow/nodes/update.js +2 -2
  80. package/lib/workflow/nodes/update.js.map +1 -1
  81. package/lib/workflow/schemas/collection.d.ts +0 -5
  82. package/lib/workflow/schemas/collection.js +4 -16
  83. package/lib/workflow/schemas/collection.js.map +1 -1
  84. package/lib/workflow/schemas/executions.d.ts +4 -25
  85. package/lib/workflow/schemas/executions.js +38 -34
  86. package/lib/workflow/schemas/executions.js.map +1 -1
  87. package/lib/workflow/schemas/workflows.js +51 -30
  88. package/lib/workflow/schemas/workflows.js.map +1 -1
  89. package/lib/workflow/triggers/index.js +5 -4
  90. package/lib/workflow/triggers/index.js.map +1 -1
  91. package/lib/workflow/triggers/model.js +12 -10
  92. package/lib/workflow/triggers/model.js.map +1 -1
  93. package/package.json +3 -3
  94. package/src/collection-manager/interfaces/attachment.ts +1 -1
  95. package/src/locale/zh_CN.ts +63 -2
  96. package/src/schema-component/antd/kanban-v2/Kanban.Card.Designer.tsx +1 -2
  97. package/src/schema-initializer/utils.ts +2 -2
  98. package/src/workflow/WorkflowCanvas.tsx +13 -8
  99. package/src/workflow/WorkflowLink.tsx +3 -1
  100. package/src/workflow/WorkflowPage.tsx +3 -3
  101. package/src/workflow/WorkflowShortcut.tsx +4 -2
  102. package/src/workflow/calculators.tsx +100 -54
  103. package/src/workflow/nodes/calculation.tsx +5 -3
  104. package/src/workflow/nodes/create.tsx +5 -3
  105. package/src/workflow/nodes/destroy.tsx +2 -2
  106. package/src/workflow/nodes/index.tsx +11 -8
  107. package/src/workflow/nodes/query.tsx +5 -3
  108. package/src/workflow/nodes/update.tsx +2 -2
  109. package/src/workflow/schemas/collection.ts +4 -16
  110. package/src/workflow/schemas/executions.ts +38 -34
  111. package/src/workflow/schemas/workflows.ts +31 -30
  112. package/src/workflow/triggers/index.tsx +6 -5
  113. package/src/workflow/triggers/model.tsx +12 -10
@@ -5,7 +5,7 @@ import { useCollectionFilterOptions } from "../../collection-manager/action-hook
5
5
 
6
6
  export const collection = {
7
7
  type: 'string',
8
- title: '数据表',
8
+ title: '{{t("Collection")}}',
9
9
  name: 'config.collection',
10
10
  required: true,
11
11
  'x-reactions': ['{{useCollectionDataSource()}}'],
@@ -15,7 +15,7 @@ export const collection = {
15
15
 
16
16
  export const values = {
17
17
  type: 'object',
18
- title: '数据内容',
18
+ title: '{{t("Form values")}}',
19
19
  name: 'config.params.values',
20
20
  'x-decorator': 'FormItem',
21
21
  'x-decorator-props': {
@@ -24,24 +24,12 @@ export const values = {
24
24
  flex-direction: column;
25
25
  `
26
26
  },
27
- 'x-component': 'CollectionFieldset',
28
- 'x-component-props': {
29
- useProps() {
30
- const { getCollectionFields } = useCollectionManager();
31
- const { values: form } = useForm();
32
- const fields = getCollectionFields(form?.config?.collection)
33
- .filter(field => (
34
- !field.hidden
35
- && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : false)
36
- ));
37
- return { fields };
38
- }
39
- }
27
+ 'x-component': 'CollectionFieldset'
40
28
  };
41
29
 
42
30
  export const filter = {
43
31
  type: 'object',
44
- title: '筛选条件',
32
+ title: '{{t("Filter")}}',
45
33
  name: 'config.params.filter',
46
34
  'x-decorator': 'FormItem',
47
35
  'x-decorator-props': {
@@ -4,12 +4,16 @@ const collection = {
4
4
  name: 'executions',
5
5
  fields: [
6
6
  {
7
- type: 'number',
8
- name: 'workflow',
9
- interface: 'linkTo',
7
+ interface: 'createdAt',
8
+ type: 'datetime',
9
+ // field: 'createdAt',
10
+ name: 'createdAt',
10
11
  uiSchema: {
11
- title: '所属工作流',
12
- type: 'string',
12
+ type: 'datetime',
13
+ title: '{{t("Created at")}}',
14
+ 'x-component': 'DatePicker',
15
+ 'x-component-props': {},
16
+ 'x-read-pretty': true,
13
17
  } as ISchema,
14
18
  },
15
19
  {
@@ -17,15 +21,15 @@ const collection = {
17
21
  name: 'status',
18
22
  interface: 'select',
19
23
  uiSchema: {
20
- title: '执行状态',
24
+ title: '{{t("Status")}}',
21
25
  type: 'string',
22
26
  'x-component': 'Select',
23
27
  'x-decorator': 'FormItem',
24
28
  enum: [
25
- { value: 0, label: '进行中' },
26
- { value: 1, label: '已完成' },
27
- { value: -1, label: '已失败' },
28
- { value: -2, label: '已取消' },
29
+ { value: 0, label: '{{t("On going")}}' },
30
+ { value: 1, label: '{{t("Success")}}' },
31
+ { value: -1, label: '{{t("Failed")}}' },
32
+ { value: -2, label: '{{t("Canceled")}}' },
29
33
  ],
30
34
  } as ISchema,
31
35
  }
@@ -76,13 +80,13 @@ export const executionSchema = {
76
80
  useDataSource: '{{ cm.useDataSourceFromRAC }}',
77
81
  },
78
82
  properties: {
79
- workflow: {
83
+ createdAt: {
80
84
  type: 'void',
81
85
  'x-decorator': 'Table.Column.Decorator',
82
86
  'x-component': 'Table.Column',
83
87
  properties: {
84
- workflow: {
85
- type: 'string',
88
+ createdAt: {
89
+ type: 'datetime',
86
90
  'x-component': 'CollectionField',
87
91
  'x-read-pretty': true,
88
92
  },
@@ -100,27 +104,27 @@ export const executionSchema = {
100
104
  },
101
105
  }
102
106
  },
103
- actions: {
104
- type: 'void',
105
- title: '{{ t("Actions") }}',
106
- 'x-component': 'Table.Column',
107
- properties: {
108
- actions: {
109
- type: 'void',
110
- 'x-component': 'Space',
111
- 'x-component-props': {
112
- split: '|',
113
- },
114
- properties: {
115
- config: {
116
- type: 'void',
117
- title: '查看',
118
- 'x-component': 'ExecutionLink'
119
- },
120
- }
121
- }
122
- }
123
- }
107
+ // actions: {
108
+ // type: 'void',
109
+ // title: '{{ t("Actions") }}',
110
+ // 'x-component': 'Table.Column',
111
+ // properties: {
112
+ // actions: {
113
+ // type: 'void',
114
+ // 'x-component': 'Space',
115
+ // 'x-component-props': {
116
+ // split: '|',
117
+ // },
118
+ // properties: {
119
+ // config: {
120
+ // type: 'void',
121
+ // title: '查看',
122
+ // 'x-component': 'ExecutionLink'
123
+ // },
124
+ // }
125
+ // }
126
+ // }
127
+ // }
124
128
  }
125
129
  }
126
130
  }
@@ -1,4 +1,5 @@
1
1
  import { ISchema } from '@formily/react';
2
+ import { triggers } from '../triggers';
2
3
  import { executionSchema } from './executions';
3
4
 
4
5
  const collection = {
@@ -9,7 +10,7 @@ const collection = {
9
10
  name: 'title',
10
11
  interface: 'input',
11
12
  uiSchema: {
12
- title: '流程名称',
13
+ title: '{{t("Name")}}',
13
14
  type: 'string',
14
15
  'x-component': 'Input',
15
16
  required: true,
@@ -20,13 +21,14 @@ const collection = {
20
21
  name: 'type',
21
22
  interface: 'select',
22
23
  uiSchema: {
23
- title: '触发方式',
24
+ title: '{{t("Trigger type")}}',
24
25
  type: 'string',
25
26
  'x-component': 'Select',
26
27
  'x-decorator': 'FormItem',
27
- enum: [
28
- { value: 'model', label: '数据变动' }
29
- ],
28
+ enum: Array.from(triggers.getEntities()).map(([value, { title }]) => ({
29
+ value,
30
+ label: title,
31
+ })),
30
32
  required: true,
31
33
  } as ISchema,
32
34
  },
@@ -35,7 +37,7 @@ const collection = {
35
37
  name: 'description',
36
38
  interface: 'textarea',
37
39
  uiSchema: {
38
- title: '描述',
40
+ title: '{{t("Description")}}',
39
41
  type: 'string',
40
42
  'x-component': 'Input.TextArea',
41
43
  } as ISchema,
@@ -45,11 +47,11 @@ const collection = {
45
47
  name: 'enabled',
46
48
  interface: 'radio',
47
49
  uiSchema: {
48
- title: '状态',
50
+ title: '{{t("Status")}}',
49
51
  type: 'string',
50
52
  enum: [
51
- { label: '启用', value: true },
52
- { label: '禁用', value: false },
53
+ { label: '{{t("Enabled")}}', value: true },
54
+ { label: '{{t("Disabled")}}', value: false },
53
55
  ],
54
56
  'x-component': 'Radio.Group',
55
57
  'x-decorator': 'FormItem',
@@ -94,7 +96,7 @@ export const workflowSchema: ISchema = {
94
96
  properties: {
95
97
  delete: {
96
98
  type: 'void',
97
- title: '删除',
99
+ title: '{{t("Delete")}}',
98
100
  'x-component': 'Action',
99
101
  'x-component-props': {
100
102
  useAction: '{{ cm.useBulkDestroyAction }}',
@@ -106,7 +108,7 @@ export const workflowSchema: ISchema = {
106
108
  },
107
109
  create: {
108
110
  type: 'void',
109
- title: '添加工作流',
111
+ title: '{{t("Add new")}}',
110
112
  'x-component': 'Action',
111
113
  'x-component-props': {
112
114
  type: 'primary',
@@ -116,7 +118,7 @@ export const workflowSchema: ISchema = {
116
118
  type: 'void',
117
119
  'x-component': 'Action.Drawer',
118
120
  'x-decorator': 'Form',
119
- title: '添加工作流',
121
+ title: '{{t("Add new")}}',
120
122
  properties: {
121
123
  title: {
122
124
  'x-component': 'CollectionField',
@@ -219,25 +221,24 @@ export const workflowSchema: ISchema = {
219
221
  properties: {
220
222
  config: {
221
223
  type: 'void',
222
- title: '配置流程',
223
224
  'x-component': 'WorkflowLink'
224
225
  },
225
- // executions: {
226
- // type: 'void',
227
- // title: '执行历史',
228
- // 'x-component': 'Action.Link',
229
- // 'x-component-props': {
230
- // type: 'primary',
231
- // },
232
- // properties: {
233
- // drawer: {
234
- // type: 'void',
235
- // title: '执行历史',
236
- // 'x-component': 'Action.Drawer',
237
- // properties: executionSchema
238
- // }
239
- // }
240
- // },
226
+ executions: {
227
+ type: 'void',
228
+ title: '{{t("Executions")}}',
229
+ 'x-component': 'Action.Link',
230
+ 'x-component-props': {
231
+ type: 'primary',
232
+ },
233
+ properties: {
234
+ drawer: {
235
+ type: 'void',
236
+ title: '{{t("Executions")}}',
237
+ 'x-component': 'Action.Drawer',
238
+ properties: executionSchema
239
+ }
240
+ }
241
+ },
241
242
  update: {
242
243
  type: 'void',
243
244
  title: '{{ t("Edit") }}',
@@ -253,7 +254,7 @@ export const workflowSchema: ISchema = {
253
254
  'x-decorator-props': {
254
255
  useValues: '{{ cm.useValuesFromRecord }}',
255
256
  },
256
- title: '编辑工作流',
257
+ title: '{{ t("Edit") }}',
257
258
  properties: {
258
259
  title: {
259
260
  'x-component': 'CollectionField',
@@ -3,7 +3,7 @@ import { ISchema, useForm } from "@formily/react";
3
3
  import { cx } from "@emotion/css";
4
4
  import { Registry } from "@nocobase/utils";
5
5
 
6
- import { SchemaComponent, useActionContext, useAPIClient, useRecord, useRequest, useResourceActionContext } from '../../';
6
+ import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRecord, useRequest, useResourceActionContext } from '../../';
7
7
  import model from './model';
8
8
  import { nodeCardClass } from "../style";
9
9
 
@@ -42,9 +42,10 @@ export interface Trigger {
42
42
 
43
43
  export const triggers = new Registry<Trigger>();
44
44
 
45
- triggers.register('model', model);
45
+ triggers.register(model.type, model);
46
46
 
47
47
  export const TriggerConfig = () => {
48
+ const compile = useCompile();
48
49
  const { data } = useResourceActionContext();
49
50
  if (!data) {
50
51
  return null;
@@ -53,17 +54,17 @@ export const TriggerConfig = () => {
53
54
  const { title, fieldset, scope } = triggers.get(type);
54
55
  return (
55
56
  <div className={cx(nodeCardClass)}>
56
- <h4>{title}</h4>
57
+ <h4>{compile(title)}</h4>
57
58
  <SchemaComponent
58
59
  schema={{
59
60
  type: 'void',
60
- title: '触发器配置',
61
+ title: '{{t("Trigger configuration")}}',
61
62
  'x-component': 'Action.Link',
62
63
  name: 'drawer',
63
64
  properties: {
64
65
  drawer: {
65
66
  type: 'void',
66
- title: '触发器配置',
67
+ title: '{{t("Trigger configuration")}}',
67
68
  'x-component': 'Action.Drawer',
68
69
  'x-decorator': 'Form',
69
70
  'x-decorator-props': {
@@ -9,6 +9,7 @@ import { useCompile } from '../../schema-component';
9
9
  import { useFlowContext } from '../WorkflowCanvas';
10
10
  import { BaseTypeSet } from '../calculators';
11
11
  import { collection, filter } from '../schemas/collection';
12
+ import { useTranslation } from 'react-i18next';
12
13
 
13
14
  function useCollectionFieldsDataSource() {
14
15
  const compile = useCompile();
@@ -32,30 +33,30 @@ function useCollectionFieldsDataSource() {
32
33
  }
33
34
 
34
35
  export default {
35
- title: '数据表事件',
36
+ title: '{{t("Model event")}}',
36
37
  type: 'model',
37
38
  fieldset: {
38
39
  'config.collection': collection,
39
40
  'config.mode': {
40
41
  type: 'number',
41
- title: '触发时机',
42
+ title: '{{t("Trigger on")}}',
42
43
  name: 'config.mode',
43
44
  'x-decorator': 'FormItem',
44
45
  'x-component': 'Select',
45
46
  'x-component-props': {
46
47
  options: [
47
- { value: 1, label: '新增数据后' },
48
- { value: 2, label: '更新数据后' },
49
- { value: 3, label: '新增或更新数据后' },
50
- { value: 4, label: '删除数据后' }
48
+ { value: 1, label: '{{t("After record added")}}' },
49
+ { value: 2, label: '{{t("After record updated")}}' },
50
+ { value: 3, label: '{{t("After record added or updated")}}' },
51
+ { value: 4, label: '{{t("After record deleted")}}' }
51
52
  ]
52
53
  }
53
54
  },
54
55
  'config.changed': {
55
56
  type: 'array',
56
57
  name: 'changed',
57
- title: '发生变动的字段',
58
- description: '只有被选中的某个字段发生变动时才会触发。如果不选择,则表示任何字段变动时都会触发。新增或删除数据时,任意字段都被认为发生变动。',
58
+ title: '{{t("Changed fields")}}',
59
+ description: '{{t("Select the fields which changed will trigger the event only")}}',
59
60
  'x-decorator': 'FormItem',
60
61
  'x-component': 'Select',
61
62
  'x-component-props': {
@@ -68,7 +69,7 @@ export default {
68
69
  'config.condition': {
69
70
  ...filter,
70
71
  name: 'config.condition',
71
- title: '满足条件'
72
+ title: '{{t("Match condition")}}',
72
73
  }
73
74
  },
74
75
  scope: {
@@ -76,6 +77,7 @@ export default {
76
77
  useCollectionFieldsDataSource
77
78
  },
78
79
  getter({ type, options, onChange }) {
80
+ const { t } = useTranslation();
79
81
  const compile = useCompile();
80
82
  const { collections = [] } = useCollectionManager();
81
83
  const { workflow } = useFlowContext();
@@ -83,7 +85,7 @@ export default {
83
85
 
84
86
  return (
85
87
  <Select
86
- placeholder="选择字段"
88
+ placeholder={t('Fields')}
87
89
  value={options?.path?.replace(/^data\./, '')}
88
90
  onChange={(path) => {
89
91
  onChange({ type, options: { ...options, path: `data.${path}` } });