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

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 (200) hide show
  1. package/esm/block-provider/hooks/index.js +10 -2
  2. package/esm/block-provider/hooks/index.js.map +1 -1
  3. package/esm/collection-manager/hooks/useCollection.d.ts +1 -0
  4. package/esm/collection-manager/types.d.ts +1 -0
  5. package/esm/collection-manager/types.js.map +1 -1
  6. package/esm/locale/en_US.d.ts +2 -0
  7. package/esm/locale/en_US.js +4 -1
  8. package/esm/locale/en_US.js.map +1 -1
  9. package/esm/locale/index.d.ts +24 -7
  10. package/esm/locale/zh_CN.d.ts +22 -7
  11. package/esm/locale/zh_CN.js +22 -7
  12. package/esm/locale/zh_CN.js.map +1 -1
  13. package/esm/schema-component/antd/action/Action.Designer.js +6 -6
  14. package/esm/schema-component/antd/action/Action.Designer.js.map +1 -1
  15. package/esm/schema-component/antd/action/Action.js +24 -17
  16. package/esm/schema-component/antd/action/Action.js.map +1 -1
  17. package/esm/schema-component/antd/filter/Filter.Action.Designer.js +1 -1
  18. package/esm/schema-component/antd/filter/Filter.Action.Designer.js.map +1 -1
  19. package/esm/schema-component/antd/grid/Grid.d.ts +2 -0
  20. package/esm/schema-component/antd/grid/Grid.js +10 -3
  21. package/esm/schema-component/antd/grid/Grid.js.map +1 -1
  22. package/esm/schema-component/antd/menu/Menu.Designer.js +35 -23
  23. package/esm/schema-component/antd/menu/Menu.Designer.js.map +1 -1
  24. package/esm/schema-component/antd/menu/Menu.js +3 -3
  25. package/esm/schema-component/antd/menu/Menu.js.map +1 -1
  26. package/esm/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  27. package/esm/schema-component/antd/record-picker/ReadPrettyRecordPicker.js.map +1 -1
  28. package/esm/schema-component/antd/table/Table.Void.Designer.js +1 -1
  29. package/esm/schema-component/antd/table/Table.Void.Designer.js.map +1 -1
  30. package/esm/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  31. package/esm/schema-component/antd/table-v2/Table.Column.Designer.js.map +1 -1
  32. package/esm/schema-component/antd/table-v2/TableBlockDesigner.js +2 -2
  33. package/esm/schema-component/antd/table-v2/TableBlockDesigner.js.map +1 -1
  34. package/esm/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -1
  35. package/esm/schema-component/antd/table-v2/TableSelectorDesigner.js.map +1 -1
  36. package/esm/schema-component/antd/tabs/Tabs.Designer.js +13 -2
  37. package/esm/schema-component/antd/tabs/Tabs.Designer.js.map +1 -1
  38. package/esm/schema-initializer/buttons/BlockInitializers.js +1 -1
  39. package/esm/schema-initializer/buttons/BlockInitializers.js.map +1 -1
  40. package/esm/schema-initializer/buttons/CreateFormBlockInitializers.js +2 -1
  41. package/esm/schema-initializer/buttons/CreateFormBlockInitializers.js.map +1 -1
  42. package/esm/schema-initializer/buttons/FormItemInitializers.js +3 -13
  43. package/esm/schema-initializer/buttons/FormItemInitializers.js.map +1 -1
  44. package/esm/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +3 -13
  45. package/esm/schema-initializer/buttons/ReadPrettyFormItemInitializers.js.map +1 -1
  46. package/esm/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
  47. package/esm/schema-initializer/buttons/RecordBlockInitializers.js.map +1 -1
  48. package/esm/schema-settings/GeneralSchemaDesigner.js +17 -6
  49. package/esm/schema-settings/GeneralSchemaDesigner.js.map +1 -1
  50. package/esm/schema-templates/schemas/uiSchemaTemplates.js +67 -10
  51. package/esm/schema-templates/schemas/uiSchemaTemplates.js.map +1 -1
  52. package/esm/workflow/WorkflowLink.js +1 -1
  53. package/esm/workflow/WorkflowLink.js.map +1 -1
  54. package/esm/workflow/calculators.js +7 -5
  55. package/esm/workflow/calculators.js.map +1 -1
  56. package/esm/workflow/nodes/condition.d.ts +1 -1
  57. package/esm/workflow/nodes/condition.js +16 -13
  58. package/esm/workflow/nodes/condition.js.map +1 -1
  59. package/esm/workflow/nodes/create.d.ts +1 -0
  60. package/esm/workflow/nodes/index.js +4 -4
  61. package/esm/workflow/nodes/index.js.map +1 -1
  62. package/esm/workflow/nodes/parallel.js +8 -5
  63. package/esm/workflow/nodes/parallel.js.map +1 -1
  64. package/esm/workflow/nodes/query.js +1 -1
  65. package/esm/workflow/nodes/query.js.map +1 -1
  66. package/esm/workflow/nodes/update.d.ts +2 -1
  67. package/esm/workflow/nodes/update.js +12 -1
  68. package/esm/workflow/nodes/update.js.map +1 -1
  69. package/esm/workflow/schemas/collection.d.ts +1 -0
  70. package/esm/workflow/schemas/collection.js +3 -2
  71. package/esm/workflow/schemas/collection.js.map +1 -1
  72. package/esm/workflow/schemas/workflows.js +3 -2
  73. package/esm/workflow/schemas/workflows.js.map +1 -1
  74. package/esm/workflow/style.d.ts +1 -0
  75. package/esm/workflow/style.js +5 -4
  76. package/esm/workflow/style.js.map +1 -1
  77. package/esm/workflow/triggers/{model.d.ts → collection.d.ts} +1 -0
  78. package/esm/workflow/triggers/{model.js → collection.js} +7 -6
  79. package/esm/workflow/triggers/collection.js.map +1 -0
  80. package/esm/workflow/triggers/index.js +9 -6
  81. package/esm/workflow/triggers/index.js.map +1 -1
  82. package/lib/block-provider/hooks/index.js +9 -1
  83. package/lib/block-provider/hooks/index.js.map +1 -1
  84. package/lib/collection-manager/hooks/useCollection.d.ts +1 -0
  85. package/lib/collection-manager/types.d.ts +1 -0
  86. package/lib/collection-manager/types.js.map +1 -1
  87. package/lib/locale/en_US.d.ts +2 -0
  88. package/lib/locale/en_US.js +4 -1
  89. package/lib/locale/en_US.js.map +1 -1
  90. package/lib/locale/index.d.ts +24 -7
  91. package/lib/locale/zh_CN.d.ts +22 -7
  92. package/lib/locale/zh_CN.js +22 -7
  93. package/lib/locale/zh_CN.js.map +1 -1
  94. package/lib/schema-component/antd/action/Action.Designer.js +6 -6
  95. package/lib/schema-component/antd/action/Action.Designer.js.map +1 -1
  96. package/lib/schema-component/antd/action/Action.js +24 -17
  97. package/lib/schema-component/antd/action/Action.js.map +1 -1
  98. package/lib/schema-component/antd/filter/Filter.Action.Designer.js +1 -1
  99. package/lib/schema-component/antd/filter/Filter.Action.Designer.js.map +1 -1
  100. package/lib/schema-component/antd/grid/Grid.d.ts +2 -0
  101. package/lib/schema-component/antd/grid/Grid.js +13 -4
  102. package/lib/schema-component/antd/grid/Grid.js.map +1 -1
  103. package/lib/schema-component/antd/menu/Menu.Designer.js +35 -23
  104. package/lib/schema-component/antd/menu/Menu.Designer.js.map +1 -1
  105. package/lib/schema-component/antd/menu/Menu.js +2 -2
  106. package/lib/schema-component/antd/menu/Menu.js.map +1 -1
  107. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
  108. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js.map +1 -1
  109. package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -1
  110. package/lib/schema-component/antd/table/Table.Void.Designer.js.map +1 -1
  111. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
  112. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js.map +1 -1
  113. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -2
  114. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js.map +1 -1
  115. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -1
  116. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js.map +1 -1
  117. package/lib/schema-component/antd/tabs/Tabs.Designer.js +13 -2
  118. package/lib/schema-component/antd/tabs/Tabs.Designer.js.map +1 -1
  119. package/lib/schema-initializer/buttons/BlockInitializers.js +1 -1
  120. package/lib/schema-initializer/buttons/BlockInitializers.js.map +1 -1
  121. package/lib/schema-initializer/buttons/CreateFormBlockInitializers.js +2 -1
  122. package/lib/schema-initializer/buttons/CreateFormBlockInitializers.js.map +1 -1
  123. package/lib/schema-initializer/buttons/FormItemInitializers.js +3 -13
  124. package/lib/schema-initializer/buttons/FormItemInitializers.js.map +1 -1
  125. package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +3 -13
  126. package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js.map +1 -1
  127. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
  128. package/lib/schema-initializer/buttons/RecordBlockInitializers.js.map +1 -1
  129. package/lib/schema-settings/GeneralSchemaDesigner.js +15 -4
  130. package/lib/schema-settings/GeneralSchemaDesigner.js.map +1 -1
  131. package/lib/schema-templates/schemas/uiSchemaTemplates.js +67 -10
  132. package/lib/schema-templates/schemas/uiSchemaTemplates.js.map +1 -1
  133. package/lib/workflow/WorkflowLink.js +1 -1
  134. package/lib/workflow/WorkflowLink.js.map +1 -1
  135. package/lib/workflow/calculators.js +7 -5
  136. package/lib/workflow/calculators.js.map +1 -1
  137. package/lib/workflow/nodes/condition.d.ts +1 -1
  138. package/lib/workflow/nodes/condition.js +13 -10
  139. package/lib/workflow/nodes/condition.js.map +1 -1
  140. package/lib/workflow/nodes/create.d.ts +1 -0
  141. package/lib/workflow/nodes/index.js +3 -3
  142. package/lib/workflow/nodes/index.js.map +1 -1
  143. package/lib/workflow/nodes/parallel.js +8 -5
  144. package/lib/workflow/nodes/parallel.js.map +1 -1
  145. package/lib/workflow/nodes/query.js +1 -1
  146. package/lib/workflow/nodes/query.js.map +1 -1
  147. package/lib/workflow/nodes/update.d.ts +2 -1
  148. package/lib/workflow/nodes/update.js +12 -1
  149. package/lib/workflow/nodes/update.js.map +1 -1
  150. package/lib/workflow/schemas/collection.d.ts +1 -0
  151. package/lib/workflow/schemas/collection.js +3 -2
  152. package/lib/workflow/schemas/collection.js.map +1 -1
  153. package/lib/workflow/schemas/workflows.js +3 -2
  154. package/lib/workflow/schemas/workflows.js.map +1 -1
  155. package/lib/workflow/style.d.ts +1 -0
  156. package/lib/workflow/style.js +6 -5
  157. package/lib/workflow/style.js.map +1 -1
  158. package/lib/workflow/triggers/{model.d.ts → collection.d.ts} +1 -0
  159. package/lib/workflow/triggers/{model.js → collection.js} +7 -6
  160. package/lib/workflow/triggers/collection.js.map +1 -0
  161. package/lib/workflow/triggers/index.js +8 -5
  162. package/lib/workflow/triggers/index.js.map +1 -1
  163. package/package.json +3 -3
  164. package/src/block-provider/hooks/index.ts +10 -2
  165. package/src/collection-manager/types.ts +1 -0
  166. package/src/locale/en_US.ts +5 -1
  167. package/src/locale/zh_CN.ts +24 -7
  168. package/src/schema-component/antd/action/Action.Designer.tsx +2 -2
  169. package/src/schema-component/antd/action/Action.tsx +4 -2
  170. package/src/schema-component/antd/filter/Filter.Action.Designer.tsx +1 -1
  171. package/src/schema-component/antd/grid/Grid.tsx +31 -20
  172. package/src/schema-component/antd/menu/Menu.Designer.tsx +36 -26
  173. package/src/schema-component/antd/menu/Menu.tsx +12 -2
  174. package/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx +3 -1
  175. package/src/schema-component/antd/table/Table.Void.Designer.tsx +1 -1
  176. package/src/schema-component/antd/table-v2/Table.Column.Designer.tsx +1 -1
  177. package/src/schema-component/antd/table-v2/TableBlockDesigner.tsx +2 -2
  178. package/src/schema-component/antd/table-v2/TableSelectorDesigner.tsx +1 -1
  179. package/src/schema-component/antd/tabs/Tabs.Designer.tsx +1 -1
  180. package/src/schema-initializer/buttons/BlockInitializers.tsx +1 -1
  181. package/src/schema-initializer/buttons/CreateFormBlockInitializers.tsx +4 -1
  182. package/src/schema-initializer/buttons/FormItemInitializers.tsx +5 -3
  183. package/src/schema-initializer/buttons/ReadPrettyFormItemInitializers.tsx +5 -3
  184. package/src/schema-initializer/buttons/RecordBlockInitializers.tsx +4 -1
  185. package/src/schema-settings/GeneralSchemaDesigner.tsx +20 -5
  186. package/src/schema-templates/schemas/uiSchemaTemplates.ts +23 -10
  187. package/src/workflow/WorkflowLink.tsx +1 -1
  188. package/src/workflow/calculators.tsx +10 -8
  189. package/src/workflow/nodes/condition.tsx +21 -38
  190. package/src/workflow/nodes/index.tsx +6 -4
  191. package/src/workflow/nodes/parallel.tsx +10 -7
  192. package/src/workflow/nodes/query.tsx +1 -1
  193. package/src/workflow/nodes/update.tsx +4 -1
  194. package/src/workflow/schemas/collection.ts +3 -2
  195. package/src/workflow/schemas/workflows.ts +3 -2
  196. package/src/workflow/style.tsx +4 -0
  197. package/src/workflow/triggers/{model.tsx → collection.tsx} +6 -5
  198. package/src/workflow/triggers/index.tsx +11 -5
  199. package/esm/workflow/triggers/model.js.map +0 -1
  200. package/lib/workflow/triggers/model.js.map +0 -1
@@ -10,6 +10,7 @@ import { useFlowContext } from "./WorkflowCanvas";
10
10
  import { triggers } from "./triggers";
11
11
  import { SchemaComponent, useCollectionManager, useCompile } from "..";
12
12
  import { useTranslation } from "react-i18next";
13
+ import { t } from "i18next";
13
14
 
14
15
  function NullRender() {
15
16
  return null;
@@ -107,10 +108,11 @@ const ConstantTypes = {
107
108
  title: '{{t("Boolean")}}',
108
109
  value: 'boolean',
109
110
  component({ onChange, type, options, value }) {
111
+ const { t } = useTranslation();
110
112
  return (
111
113
  <Select value={value} onChange={v => onChange({ value: v, type, options })}>
112
- <Select.Option value={true}>真</Select.Option>
113
- <Select.Option value={false}>假</Select.Option>
114
+ <Select.Option value={true}>{t('True')}</Select.Option>
115
+ <Select.Option value={false}>{t('False')}</Select.Option>
114
116
  </Select>
115
117
  );
116
118
  },
@@ -260,7 +262,7 @@ export function Operand({
260
262
 
261
263
  const { component, appendTypeValue } = Types[type] || {};
262
264
  const VariableComponent = typeof component === 'function' ? component(operand) : NullRender;
263
-
265
+ console.log(Types);
264
266
  return (
265
267
  <div className={css`
266
268
  display: flex;
@@ -283,7 +285,7 @@ export function Operand({
283
285
  return {
284
286
  label: compile(item.title),
285
287
  value: item.value,
286
- children: options,
288
+ children: compile(options),
287
289
  disabled: options && !options.length,
288
290
  isLeaf: !options
289
291
  };
@@ -305,7 +307,7 @@ export function Operand({
305
307
  }
306
308
 
307
309
  export function Calculation({ calculator, operands = [], onChange }) {
308
- const { t } = useTranslation();
310
+ const compile = useCompile();
309
311
  return (
310
312
  <VariableTypesContext.Provider value={VariableTypes}>
311
313
  <div className={css`
@@ -324,9 +326,9 @@ export function Calculation({ calculator, operands = [], onChange }) {
324
326
  <>
325
327
  <Select value={calculator} onChange={v => onChange({ operands, calculator: v })}>
326
328
  {calculators.map(group => (
327
- <Select.OptGroup key={group.value} label={t(group.title)}>
329
+ <Select.OptGroup key={group.value} label={compile(group.title)}>
328
330
  {group.children.map(item => (
329
- <Select.Option key={item.value} value={t(item.value)}>{item.name}</Select.Option>
331
+ <Select.Option key={item.value} value={item.value}>{compile(item.name)}</Select.Option>
330
332
  ))}
331
333
  </Select.OptGroup>
332
334
  ))}
@@ -469,7 +471,7 @@ export const CollectionFieldset = observer(({ value, onChange }: any) => {
469
471
  }
470
472
  </>
471
473
  )
472
- : <p>{t('Select collection')}</p>
474
+ : <p>{t('Please select collection first')}</p>
473
475
  }
474
476
  </fieldset>
475
477
  );
@@ -1,13 +1,14 @@
1
1
  import React from "react";
2
2
  import { css, cx } from "@emotion/css";
3
- import { Button, Select, Tooltip } from "antd";
4
- import { CloseCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
5
- import { Trans } from "react-i18next";
3
+ import { Button, Select } from "antd";
4
+ import { CloseCircleOutlined } from '@ant-design/icons';
5
+ import { Trans, useTranslation } from "react-i18next";
6
6
 
7
7
  import { NodeDefaultView } from ".";
8
8
  import { Branch, useFlowContext } from "../WorkflowCanvas";
9
9
  import { branchBlockClass, nodeSubtreeClass } from "../style";
10
10
  import { Calculation } from "../calculators";
11
+ import { i18n } from "../../i18n";
11
12
  // import { SchemaComponent } from "../../schema-component";
12
13
 
13
14
  function CalculationItem({ value, onChange, onRemove }) {
@@ -38,6 +39,7 @@ function CalculationItem({ value, onChange, onRemove }) {
38
39
  }
39
40
 
40
41
  function CalculationGroup({ value, onChange }) {
42
+ const { t } = useTranslation();
41
43
  const { type = 'and', calculations = [] } = value;
42
44
 
43
45
  function onAddSingle() {
@@ -113,8 +115,8 @@ function CalculationGroup({ value, onChange }) {
113
115
  margin-right: 1em;
114
116
  }
115
117
  `} >
116
- <a onClick={onAddSingle}>添加条件</a>
117
- <a onClick={onAddGroup}>添加条件组</a>
118
+ <a onClick={onAddSingle}>{t('Add condition')}</a>
119
+ <a onClick={onAddGroup}>{t('Add condition group')}</a>
118
120
  </div>
119
121
  </div>
120
122
  );
@@ -129,15 +131,17 @@ function CalculationConfig({ value, onChange }) {
129
131
  );
130
132
  }
131
133
 
134
+ console.log(i18n.t('Collection name'));
135
+
132
136
  export default {
133
- title: '条件判断',
137
+ title: '{{t("Condition")}}',
134
138
  type: 'condition',
135
139
  group: 'control',
136
140
  fieldset: {
137
141
  'config.rejectOnFalse': {
138
142
  type: 'boolean',
139
143
  name: 'config.rejectOnFalse',
140
- title: '模式',
144
+ title: '{{t("Mode")}}',
141
145
  'x-decorator': 'FormItem',
142
146
  'x-component': 'Radio.Group',
143
147
  'x-component-props': {
@@ -146,32 +150,18 @@ export default {
146
150
  enum: [
147
151
  {
148
152
  value: true,
149
- label: (
150
- <Tooltip
151
- title="判断为“是”时继续"
152
- placement="bottom"
153
- >
154
- 通行模式 <QuestionCircleOutlined style={{ color: '#999' }} />
155
- </Tooltip>
156
- )
153
+ label: i18n.t('Continue when "Yes"')
157
154
  },
158
155
  {
159
156
  value: false,
160
- label: (
161
- <Tooltip
162
- title="判断结果分为“是”和“否”两个分支,分别继续"
163
- placement="bottom"
164
- >
165
- 分支模式 <QuestionCircleOutlined style={{ color: '#999' }} />
166
- </Tooltip>
167
- )
157
+ label: i18n.t('Branch results')
168
158
  }
169
159
  ],
170
160
  },
171
161
  'config.calculation': {
172
162
  type: 'string',
173
163
  name: 'config.calculation',
174
- title: '条件配置',
164
+ title: '{{t("Conditions")}}',
175
165
  'x-decorator': 'FormItem',
176
166
  'x-component': 'CalculationConfig',
177
167
  }
@@ -180,8 +170,8 @@ export default {
180
170
 
181
171
  },
182
172
  options: [
183
- { label: '通行模式', key: 'rejectOnFalse', value: { rejectOnFalse: true } },
184
- { label: '分支模式', key: 'branch', value: { rejectOnFalse: false } }
173
+ { label: i18n.t('Reject on false'), key: 'rejectOnFalse', value: { rejectOnFalse: true } },
174
+ { label: i18n.t('Branch results'), key: 'branch', value: { rejectOnFalse: false } }
185
175
  ],
186
176
  render(data) {
187
177
  const { id, config: { rejectOnFalse } } = data;
@@ -210,7 +200,7 @@ export default {
210
200
  height: 2em;
211
201
  overflow: visible;
212
202
 
213
- :before,:after{
203
+ > span{
214
204
  position: absolute;
215
205
  top: calc(1.5em - 1px);
216
206
  line-height: 1em;
@@ -218,18 +208,11 @@ export default {
218
208
  background-color: #f0f2f5;
219
209
  padding: 1px;
220
210
  }
221
-
222
- :before{
223
- content: "否";
224
- right: 4em;
225
- }
226
-
227
- :after{
228
- content: "是";
229
- left: 4em;
230
- }
231
211
  `}
232
- />
212
+ >
213
+ <span className={css`right: 4em;`}>{i18n.t('No')}</span>
214
+ <span className={css`left: 4em;`}>{i18n.t('Yes')}</span>
215
+ </div>
233
216
  </div>
234
217
  )}
235
218
  </NodeDefaultView>
@@ -6,7 +6,7 @@ import { Button, Modal, Tag } from 'antd';
6
6
  import React, { useContext } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { SchemaComponent, useActionContext, useAPIClient, useCollection, useCompile, useRequest, useResourceActionContext } from '../..';
9
- import { nodeBlockClass, nodeCardClass, nodeClass, nodeHeaderClass, nodeTitleClass } from '../style';
9
+ import { nodeBlockClass, nodeCardClass, nodeClass, nodeHeaderClass, nodeMetaClass, nodeTitleClass } from '../style';
10
10
  import { AddButton, useFlowContext } from '../WorkflowCanvas';
11
11
 
12
12
  import calculation from './calculation';
@@ -156,8 +156,10 @@ export function NodeDefaultView(props) {
156
156
  <div className={cx(nodeClass, `workflow-node-type-${data.type}`)}>
157
157
  <div className={cx(nodeCardClass)}>
158
158
  <div className={cx(nodeHeaderClass)}>
159
- <h4 className={cx(nodeTitleClass)}>
159
+ <div className={cx(nodeMetaClass)}>
160
160
  <Tag>{compile(instruction.title)}</Tag>
161
+ </div>
162
+ <h4 className={cx(nodeTitleClass)}>
161
163
  <strong>{data.title}</strong>
162
164
  <span className="workflow-node-id">#{data.id}</span>
163
165
  </h4>
@@ -172,7 +174,7 @@ export function NodeDefaultView(props) {
172
174
  view: instruction.view,
173
175
  config: {
174
176
  type: 'void',
175
- title: '{{t("Node configuration")}}',
177
+ title: '{{t("Configure")}}',
176
178
  'x-component': 'Action.Link',
177
179
  'x-component-props': {
178
180
  type: 'primary',
@@ -180,7 +182,7 @@ export function NodeDefaultView(props) {
180
182
  properties: {
181
183
  drawer: {
182
184
  type: 'void',
183
- title: '{{t("Node configuration")}}',
185
+ title: '{{t("Configure")}}',
184
186
  'x-component': 'Action.Drawer',
185
187
  'x-decorator': 'Form',
186
188
  'x-decorator-props': {
@@ -6,17 +6,19 @@ import { NodeDefaultView } from ".";
6
6
  import { Branch, useFlowContext } from "../WorkflowCanvas";
7
7
  import { branchBlockClass, nodeSubtreeClass } from "../style";
8
8
  import { Button, Tooltip } from "antd";
9
+ import { i18n } from "../../i18n";
10
+ import { useTranslation } from "react-i18next";
9
11
  // import { SchemaComponent } from "../../schema-component";
10
12
 
11
13
  export default {
12
- title: '并行',
14
+ title: '{{t("Parallel branch")}}',
13
15
  type: 'parallel',
14
16
  group: 'control',
15
17
  fieldset: {
16
18
  'config.mode': {
17
19
  type: 'string',
18
20
  name: 'config.mode',
19
- title: '模式',
21
+ title: '{{t("Mode")}}',
20
22
  'x-decorator': 'FormItem',
21
23
  'x-component': 'Radio.Group',
22
24
  'x-component-props': {
@@ -26,10 +28,10 @@ export default {
26
28
  value: 'all',
27
29
  label: (
28
30
  <Tooltip
29
- title="全部分支都成功后才能继续"
31
+ title={i18n.t('Continue after all branches succeeded')}
30
32
  placement="bottom"
31
33
  >
32
- 全部成功 <QuestionCircleOutlined style={{ color: '#999' }} />
34
+ {i18n.t('All succeeded')} <QuestionCircleOutlined style={{ color: '#999' }} />
33
35
  </Tooltip>
34
36
  )
35
37
  },
@@ -37,10 +39,10 @@ export default {
37
39
  value: 'any',
38
40
  label: (
39
41
  <Tooltip
40
- title="任意分支成功后就继续"
42
+ title={i18n.t('Continue after any branch succeeded')}
41
43
  placement="bottom"
42
44
  >
43
- 任意成功 <QuestionCircleOutlined style={{ color: '#999' }} />
45
+ {i18n.t('Any succeeded')} <QuestionCircleOutlined style={{ color: '#999' }} />
44
46
  </Tooltip>
45
47
  )
46
48
  },
@@ -54,6 +56,7 @@ export default {
54
56
  },
55
57
  render(data) {
56
58
  const { id, config: { mode } } = data;
59
+ const { t } = useTranslation();
57
60
  const { nodes } = useFlowContext();
58
61
  const branches = nodes.reduce((result, node) => {
59
62
  if (node.upstreamId === id && node.branchIndex != null) {
@@ -108,7 +111,7 @@ export default {
108
111
  height: 2em;
109
112
  `}
110
113
  >
111
- <Tooltip title="添加分支">
114
+ <Tooltip title={t('Add branch')}>
112
115
  <Button
113
116
  icon={<PlusOutlined />}
114
117
  className={css`
@@ -16,7 +16,7 @@ export default {
16
16
  'config.collection': collection,
17
17
  'config.multiple': {
18
18
  type: 'boolean',
19
- title: '多条数据',
19
+ title: '{{t("Multiple records")}}',
20
20
  name: 'config.multiple',
21
21
  'x-decorator': 'FormItem',
22
22
  'x-component': 'Checkbox',
@@ -14,7 +14,10 @@ export default {
14
14
  title: '',
15
15
  'x-decorator': 'FormItem',
16
16
  properties: {
17
- filter,
17
+ filter: {
18
+ ...filter,
19
+ title: '{{t("Only update records matching conditions")}}',
20
+ },
18
21
  values
19
22
  }
20
23
  }
@@ -15,7 +15,7 @@ export const collection = {
15
15
 
16
16
  export const values = {
17
17
  type: 'object',
18
- title: '{{t("Form values")}}',
18
+ title: '{{t("Fields values")}}',
19
19
  name: 'config.params.values',
20
20
  'x-decorator': 'FormItem',
21
21
  'x-decorator-props': {
@@ -24,7 +24,8 @@ export const values = {
24
24
  flex-direction: column;
25
25
  `
26
26
  },
27
- 'x-component': 'CollectionFieldset'
27
+ 'x-component': 'CollectionFieldset',
28
+ description: '{{t("Fields that are not assigned a value will be set to the default value, and those that do not have a default value are set to null.")}}',
28
29
  };
29
30
 
30
31
  export const filter = {
@@ -55,6 +55,7 @@ const collection = {
55
55
  ],
56
56
  'x-component': 'Radio.Group',
57
57
  'x-decorator': 'FormItem',
58
+ default: false
58
59
  } as ISchema
59
60
  }
60
61
  ],
@@ -225,7 +226,7 @@ export const workflowSchema: ISchema = {
225
226
  },
226
227
  executions: {
227
228
  type: 'void',
228
- title: '{{t("Executions")}}',
229
+ title: '{{t("Execution History")}}',
229
230
  'x-component': 'Action.Link',
230
231
  'x-component-props': {
231
232
  type: 'primary',
@@ -233,7 +234,7 @@ export const workflowSchema: ISchema = {
233
234
  properties: {
234
235
  drawer: {
235
236
  type: 'void',
236
- title: '{{t("Executions")}}',
237
+ title: '{{t("Execution History")}}',
237
238
  'x-component': 'Action.Drawer',
238
239
  properties: executionSchema
239
240
  }
@@ -133,6 +133,10 @@ export const nodeHeaderClass = css`
133
133
  position: relative;
134
134
  `;
135
135
 
136
+ export const nodeMetaClass = css`
137
+ margin-bottom: .5em;
138
+ `;
139
+
136
140
  export const nodeTitleClass = css`
137
141
  font-weight: normal;
138
142
 
@@ -33,8 +33,8 @@ function useCollectionFieldsDataSource() {
33
33
  }
34
34
 
35
35
  export default {
36
- title: '{{t("Model event")}}',
37
- type: 'model',
36
+ title: '{{t("Collection event")}}',
37
+ type: 'collection',
38
38
  fieldset: {
39
39
  'config.collection': collection,
40
40
  'config.mode': {
@@ -50,13 +50,14 @@ export default {
50
50
  { value: 3, label: '{{t("After record added or updated")}}' },
51
51
  { value: 4, label: '{{t("After record deleted")}}' }
52
52
  ]
53
- }
53
+ },
54
+ required: true
54
55
  },
55
56
  'config.changed': {
56
57
  type: 'array',
57
58
  name: 'changed',
58
59
  title: '{{t("Changed fields")}}',
59
- description: '{{t("Select the fields which changed will trigger the event only")}}',
60
+ description: '{{t("Triggered only if one of the selected fields changes. If unselected, it means that it will be triggered when any field changes. When record is added or deleted, any field is considered to have been changed.")}}',
60
61
  'x-decorator': 'FormItem',
61
62
  'x-component': 'Select',
62
63
  'x-component-props': {
@@ -69,7 +70,7 @@ export default {
69
70
  'config.condition': {
70
71
  ...filter,
71
72
  name: 'config.condition',
72
- title: '{{t("Match condition")}}',
73
+ title: '{{t("Only triggers when match conditions")}}'
73
74
  }
74
75
  },
75
76
  scope: {
@@ -4,8 +4,10 @@ import { cx } from "@emotion/css";
4
4
  import { Registry } from "@nocobase/utils";
5
5
 
6
6
  import { SchemaComponent, useActionContext, useAPIClient, useCompile, useRecord, useRequest, useResourceActionContext } from '../../';
7
- import model from './model';
8
- import { nodeCardClass } from "../style";
7
+ import collection from './collection';
8
+ import { nodeCardClass, nodeMetaClass } from "../style";
9
+ import { useTranslation } from "react-i18next";
10
+ import { Tag } from "antd";
9
11
 
10
12
 
11
13
  function useUpdateConfigAction() {
@@ -42,9 +44,10 @@ export interface Trigger {
42
44
 
43
45
  export const triggers = new Registry<Trigger>();
44
46
 
45
- triggers.register(model.type, model);
47
+ triggers.register(collection.type, collection);
46
48
 
47
49
  export const TriggerConfig = () => {
50
+ const { t } = useTranslation();
48
51
  const compile = useCompile();
49
52
  const { data } = useResourceActionContext();
50
53
  if (!data) {
@@ -54,17 +57,20 @@ export const TriggerConfig = () => {
54
57
  const { title, fieldset, scope } = triggers.get(type);
55
58
  return (
56
59
  <div className={cx(nodeCardClass)}>
60
+ <div className={cx(nodeMetaClass)}>
61
+ <Tag color="gold">{t('Trigger')}</Tag>
62
+ </div>
57
63
  <h4>{compile(title)}</h4>
58
64
  <SchemaComponent
59
65
  schema={{
60
66
  type: 'void',
61
- title: '{{t("Trigger configuration")}}',
67
+ title: '{{t("Configure")}}',
62
68
  'x-component': 'Action.Link',
63
69
  name: 'drawer',
64
70
  properties: {
65
71
  drawer: {
66
72
  type: 'void',
67
- title: '{{t("Trigger configuration")}}',
73
+ title: '{{t("Configure")}}',
68
74
  'x-component': 'Action.Drawer',
69
75
  'x-decorator': 'Form',
70
76
  'x-dec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CAAC,YACK,CACV,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import React from 'react';\nimport { Select } from 'antd';\nimport { action } from '@formily/reactive';\nimport { useForm } from '@formily/react';\n\nimport { useCollectionDataSource, useCollectionManager } from '../../collection-manager';\nimport { useCompile } from '../../schema-component';\n\nimport { useFlowContext } from '../WorkflowCanvas';\nimport { BaseTypeSet } from '../calculators';\nimport { collection, filter } from '../schemas/collection';\nimport { useTranslation } from 'react-i18next';\n\nfunction useCollectionFieldsDataSource() {\n const compile = useCompile();\n const { getCollectionFields } = useCollectionManager();\n const { values } = useForm();\n const fields = getCollectionFields(values?.config?.collection);\n\n return (field: any) => {\n action.bound((data: any) => {\n field.dataSource = data\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true)\n ))\n .map(field => ({\n label: compile(field.uiSchema?.title),\n value: field.name\n }));\n })(fields);\n };\n}\n\nexport default {\n title: '{{t(\"Model event\")}}',\n type: 'model',\n fieldset: {\n 'config.collection': collection,\n 'config.mode': {\n type: 'number',\n title: '{{t(\"Trigger on\")}}',\n name: 'config.mode',\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n 'x-component-props': {\n options: [\n { value: 1, label: '{{t(\"After record added\")}}' },\n { value: 2, label: '{{t(\"After record updated\")}}' },\n { value: 3, label: '{{t(\"After record added or updated\")}}' },\n { value: 4, label: '{{t(\"After record deleted\")}}' }\n ]\n }\n },\n 'config.changed': {\n type: 'array',\n name: 'changed',\n title: '{{t(\"Changed fields\")}}',\n description: '{{t(\"Select the fields which changed will trigger the event only\")}}',\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n 'x-component-props': {\n mode: 'multiple',\n },\n 'x-reactions': [\n '{{useCollectionFieldsDataSource()}}'\n ]\n },\n 'config.condition': {\n ...filter,\n name: 'config.condition',\n title: '{{t(\"Match condition\")}}',\n }\n },\n scope: {\n useCollectionDataSource,\n useCollectionFieldsDataSource\n },\n getter({ type, options, onChange }) {\n const { t } = useTranslation();\n const compile = useCompile();\n const { collections = [] } = useCollectionManager();\n const { workflow } = useFlowContext();\n const collection = collections.find(item => item.name === workflow.config.collection) ?? { fields: [] };\n\n return (\n <Select\n placeholder={t('Fields')}\n value={options?.path?.replace(/^data\\./, '')}\n onChange={(path) => {\n onChange({ type, options: { ...options, path: `data.${path}` } });\n }}\n >\n {collection.fields\n .filter(field => BaseTypeSet.has(field?.uiSchema?.type))\n .map(field => (\n <Select.Option key={field.name} value={field.name}>{compile(field.uiSchema.title)}</Select.Option>\n ))}\n </Select>\n );\n }\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/workflow/triggers/model.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,6BAA8B;AAC9B,8CAA2C;AAC3C,wCAAyC;AAEzC,+DAAyF;AACzF,2DAAoD;AAEpD,oDAAmD;AACnD,8CAA6C;AAC7C,oDAA2D;AAC3D,+CAA+C;AAE/C,SAAS,6BAA6B;;IACpC,IAAM,OAAO,GAAG,IAAA,6BAAU,GAAE,CAAC;IACrB,IAAA,mBAAmB,GAAK,IAAA,yCAAoB,GAAE,oBAA3B,CAA4B;IAC/C,IAAA,MAAM,GAAK,IAAA,eAAO,GAAE,OAAd,CAAe;IAC7B,IAAM,MAAM,GAAG,mBAAmB,CAAC,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,UAAU,CAAC,CAAC;IAE/D,OAAO,UAAC,KAAU;QAChB,iBAAM,CAAC,KAAK,CAAC,UAAC,IAAS;YACrB,KAAK,CAAC,UAAU,GAAG,IAAI;iBACpB,MAAM,CAAC,UAAA,KAAK,IAAI,OAAA,CACf,CAAC,KAAK,CAAC,MAAM;mBACV,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAC9D,EAHgB,CAGhB,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C,KAAK,CAAC,KAA7D,KAAK,CAAC,IAAI,CAAoE,CACnG,EAFe,CAEf,CAAC,YACK,CACV,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import React from 'react';\nimport { Select } from 'antd';\nimport { action } from '@formily/reactive';\nimport { useForm } from '@formily/react';\n\nimport { useCollectionDataSource, useCollectionManager } from '../../collection-manager';\nimport { useCompile } from '../../schema-component';\n\nimport { useFlowContext } from '../WorkflowCanvas';\nimport { BaseTypeSet } from '../calculators';\nimport { collection, filter } from '../schemas/collection';\nimport { useTranslation } from 'react-i18next';\n\nfunction useCollectionFieldsDataSource() {\n const compile = useCompile();\n const { getCollectionFields } = useCollectionManager();\n const { values } = useForm();\n const fields = getCollectionFields(values?.config?.collection);\n\n return (field: any) => {\n action.bound((data: any) => {\n field.dataSource = data\n .filter(field => (\n !field.hidden\n && (field.uiSchema ? !field.uiSchema['x-read-pretty'] : true)\n ))\n .map(field => ({\n label: compile(field.uiSchema?.title),\n value: field.name\n }));\n })(fields);\n };\n}\n\nexport default {\n title: '{{t(\"Model event\")}}',\n type: 'model',\n fieldset: {\n 'config.collection': collection,\n 'config.mode': {\n type: 'number',\n title: '{{t(\"Trigger on\")}}',\n name: 'config.mode',\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n 'x-component-props': {\n options: [\n { value: 1, label: '{{t(\"After record added\")}}' },\n { value: 2, label: '{{t(\"After record updated\")}}' },\n { value: 3, label: '{{t(\"After record added or updated\")}}' },\n { value: 4, label: '{{t(\"After record deleted\")}}' }\n ]\n }\n },\n 'config.changed': {\n type: 'array',\n name: 'changed',\n title: '{{t(\"Changed fields\")}}',\n description: '{{t(\"Select the fields which changed will trigger the event only\")}}',\n 'x-decorator': 'FormItem',\n 'x-component': 'Select',\n 'x-component-props': {\n mode: 'multiple',\n },\n 'x-reactions': [\n '{{useCollectionFieldsDataSource()}}'\n ]\n },\n 'config.condition': {\n ...filter,\n name: 'config.condition',\n title: '{{t(\"Match condition\")}}',\n }\n },\n scope: {\n useCollectionDataSource,\n useCollectionFieldsDataSource\n },\n getter({ type, options, onChange }) {\n const { t } = useTranslation();\n const compile = useCompile();\n const { collections = [] } = useCollectionManager();\n const { workflow } = useFlowContext();\n const collection = collections.find(item => item.name === workflow.config.collection) ?? { fields: [] };\n\n return (\n <Select\n placeholder={t('Fields')}\n value={options?.path?.replace(/^data\\./, '')}\n onChange={(path) => {\n onChange({ type, options: { ...options, path: `data.${path}` } });\n }}\n >\n {collection.fields\n .filter(field => BaseTypeSet.has(field?.uiSchema?.type))\n .map(field => (\n <Select.Option key={field.name} value={field.name}>{compile(field.uiSchema.title)}</Select.Option>\n ))}\n </Select>\n );\n }\n};\n"]}