@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.
- package/esm/block-provider/hooks/index.js +10 -2
- package/esm/block-provider/hooks/index.js.map +1 -1
- package/esm/collection-manager/hooks/useCollection.d.ts +1 -0
- package/esm/collection-manager/types.d.ts +1 -0
- package/esm/collection-manager/types.js.map +1 -1
- package/esm/locale/en_US.d.ts +2 -0
- package/esm/locale/en_US.js +4 -1
- package/esm/locale/en_US.js.map +1 -1
- package/esm/locale/index.d.ts +24 -7
- package/esm/locale/zh_CN.d.ts +22 -7
- package/esm/locale/zh_CN.js +22 -7
- package/esm/locale/zh_CN.js.map +1 -1
- package/esm/schema-component/antd/action/Action.Designer.js +6 -6
- package/esm/schema-component/antd/action/Action.Designer.js.map +1 -1
- package/esm/schema-component/antd/action/Action.js +24 -17
- package/esm/schema-component/antd/action/Action.js.map +1 -1
- package/esm/schema-component/antd/filter/Filter.Action.Designer.js +1 -1
- package/esm/schema-component/antd/filter/Filter.Action.Designer.js.map +1 -1
- package/esm/schema-component/antd/grid/Grid.d.ts +2 -0
- package/esm/schema-component/antd/grid/Grid.js +10 -3
- package/esm/schema-component/antd/grid/Grid.js.map +1 -1
- package/esm/schema-component/antd/menu/Menu.Designer.js +35 -23
- package/esm/schema-component/antd/menu/Menu.Designer.js.map +1 -1
- package/esm/schema-component/antd/menu/Menu.js +3 -3
- package/esm/schema-component/antd/menu/Menu.js.map +1 -1
- package/esm/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
- package/esm/schema-component/antd/record-picker/ReadPrettyRecordPicker.js.map +1 -1
- package/esm/schema-component/antd/table/Table.Void.Designer.js +1 -1
- package/esm/schema-component/antd/table/Table.Void.Designer.js.map +1 -1
- package/esm/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
- package/esm/schema-component/antd/table-v2/Table.Column.Designer.js.map +1 -1
- package/esm/schema-component/antd/table-v2/TableBlockDesigner.js +2 -2
- package/esm/schema-component/antd/table-v2/TableBlockDesigner.js.map +1 -1
- package/esm/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -1
- package/esm/schema-component/antd/table-v2/TableSelectorDesigner.js.map +1 -1
- package/esm/schema-component/antd/tabs/Tabs.Designer.js +13 -2
- package/esm/schema-component/antd/tabs/Tabs.Designer.js.map +1 -1
- package/esm/schema-initializer/buttons/BlockInitializers.js +1 -1
- package/esm/schema-initializer/buttons/BlockInitializers.js.map +1 -1
- package/esm/schema-initializer/buttons/CreateFormBlockInitializers.js +2 -1
- package/esm/schema-initializer/buttons/CreateFormBlockInitializers.js.map +1 -1
- package/esm/schema-initializer/buttons/FormItemInitializers.js +3 -13
- package/esm/schema-initializer/buttons/FormItemInitializers.js.map +1 -1
- package/esm/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +3 -13
- package/esm/schema-initializer/buttons/ReadPrettyFormItemInitializers.js.map +1 -1
- package/esm/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
- package/esm/schema-initializer/buttons/RecordBlockInitializers.js.map +1 -1
- package/esm/schema-settings/GeneralSchemaDesigner.js +17 -6
- package/esm/schema-settings/GeneralSchemaDesigner.js.map +1 -1
- package/esm/schema-templates/schemas/uiSchemaTemplates.js +67 -10
- package/esm/schema-templates/schemas/uiSchemaTemplates.js.map +1 -1
- package/esm/workflow/WorkflowLink.js +1 -1
- package/esm/workflow/WorkflowLink.js.map +1 -1
- package/esm/workflow/calculators.js +7 -5
- package/esm/workflow/calculators.js.map +1 -1
- package/esm/workflow/nodes/condition.d.ts +1 -1
- package/esm/workflow/nodes/condition.js +16 -13
- package/esm/workflow/nodes/condition.js.map +1 -1
- package/esm/workflow/nodes/create.d.ts +1 -0
- package/esm/workflow/nodes/index.js +4 -4
- package/esm/workflow/nodes/index.js.map +1 -1
- package/esm/workflow/nodes/parallel.js +8 -5
- package/esm/workflow/nodes/parallel.js.map +1 -1
- package/esm/workflow/nodes/query.js +1 -1
- package/esm/workflow/nodes/query.js.map +1 -1
- package/esm/workflow/nodes/update.d.ts +2 -1
- package/esm/workflow/nodes/update.js +12 -1
- package/esm/workflow/nodes/update.js.map +1 -1
- package/esm/workflow/schemas/collection.d.ts +1 -0
- package/esm/workflow/schemas/collection.js +3 -2
- package/esm/workflow/schemas/collection.js.map +1 -1
- package/esm/workflow/schemas/workflows.js +3 -2
- package/esm/workflow/schemas/workflows.js.map +1 -1
- package/esm/workflow/style.d.ts +1 -0
- package/esm/workflow/style.js +5 -4
- package/esm/workflow/style.js.map +1 -1
- package/esm/workflow/triggers/{model.d.ts → collection.d.ts} +1 -0
- package/esm/workflow/triggers/{model.js → collection.js} +7 -6
- package/esm/workflow/triggers/collection.js.map +1 -0
- package/esm/workflow/triggers/index.js +9 -6
- package/esm/workflow/triggers/index.js.map +1 -1
- package/lib/block-provider/hooks/index.js +9 -1
- package/lib/block-provider/hooks/index.js.map +1 -1
- package/lib/collection-manager/hooks/useCollection.d.ts +1 -0
- package/lib/collection-manager/types.d.ts +1 -0
- package/lib/collection-manager/types.js.map +1 -1
- package/lib/locale/en_US.d.ts +2 -0
- package/lib/locale/en_US.js +4 -1
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/index.d.ts +24 -7
- package/lib/locale/zh_CN.d.ts +22 -7
- package/lib/locale/zh_CN.js +22 -7
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/schema-component/antd/action/Action.Designer.js +6 -6
- package/lib/schema-component/antd/action/Action.Designer.js.map +1 -1
- package/lib/schema-component/antd/action/Action.js +24 -17
- package/lib/schema-component/antd/action/Action.js.map +1 -1
- package/lib/schema-component/antd/filter/Filter.Action.Designer.js +1 -1
- package/lib/schema-component/antd/filter/Filter.Action.Designer.js.map +1 -1
- package/lib/schema-component/antd/grid/Grid.d.ts +2 -0
- package/lib/schema-component/antd/grid/Grid.js +13 -4
- package/lib/schema-component/antd/grid/Grid.js.map +1 -1
- package/lib/schema-component/antd/menu/Menu.Designer.js +35 -23
- package/lib/schema-component/antd/menu/Menu.Designer.js.map +1 -1
- package/lib/schema-component/antd/menu/Menu.js +2 -2
- package/lib/schema-component/antd/menu/Menu.js.map +1 -1
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js.map +1 -1
- package/lib/schema-component/antd/table/Table.Void.Designer.js +1 -1
- package/lib/schema-component/antd/table/Table.Void.Designer.js.map +1 -1
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +2 -2
- package/lib/schema-component/antd/table-v2/Table.Column.Designer.js.map +1 -1
- package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -2
- package/lib/schema-component/antd/table-v2/TableBlockDesigner.js.map +1 -1
- package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +1 -1
- package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js.map +1 -1
- package/lib/schema-component/antd/tabs/Tabs.Designer.js +13 -2
- package/lib/schema-component/antd/tabs/Tabs.Designer.js.map +1 -1
- package/lib/schema-initializer/buttons/BlockInitializers.js +1 -1
- package/lib/schema-initializer/buttons/BlockInitializers.js.map +1 -1
- package/lib/schema-initializer/buttons/CreateFormBlockInitializers.js +2 -1
- package/lib/schema-initializer/buttons/CreateFormBlockInitializers.js.map +1 -1
- package/lib/schema-initializer/buttons/FormItemInitializers.js +3 -13
- package/lib/schema-initializer/buttons/FormItemInitializers.js.map +1 -1
- package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +3 -13
- package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js.map +1 -1
- package/lib/schema-initializer/buttons/RecordBlockInitializers.js +2 -1
- package/lib/schema-initializer/buttons/RecordBlockInitializers.js.map +1 -1
- package/lib/schema-settings/GeneralSchemaDesigner.js +15 -4
- package/lib/schema-settings/GeneralSchemaDesigner.js.map +1 -1
- package/lib/schema-templates/schemas/uiSchemaTemplates.js +67 -10
- package/lib/schema-templates/schemas/uiSchemaTemplates.js.map +1 -1
- package/lib/workflow/WorkflowLink.js +1 -1
- package/lib/workflow/WorkflowLink.js.map +1 -1
- package/lib/workflow/calculators.js +7 -5
- package/lib/workflow/calculators.js.map +1 -1
- package/lib/workflow/nodes/condition.d.ts +1 -1
- package/lib/workflow/nodes/condition.js +13 -10
- package/lib/workflow/nodes/condition.js.map +1 -1
- package/lib/workflow/nodes/create.d.ts +1 -0
- package/lib/workflow/nodes/index.js +3 -3
- package/lib/workflow/nodes/index.js.map +1 -1
- package/lib/workflow/nodes/parallel.js +8 -5
- package/lib/workflow/nodes/parallel.js.map +1 -1
- package/lib/workflow/nodes/query.js +1 -1
- package/lib/workflow/nodes/query.js.map +1 -1
- package/lib/workflow/nodes/update.d.ts +2 -1
- package/lib/workflow/nodes/update.js +12 -1
- package/lib/workflow/nodes/update.js.map +1 -1
- package/lib/workflow/schemas/collection.d.ts +1 -0
- package/lib/workflow/schemas/collection.js +3 -2
- package/lib/workflow/schemas/collection.js.map +1 -1
- package/lib/workflow/schemas/workflows.js +3 -2
- package/lib/workflow/schemas/workflows.js.map +1 -1
- package/lib/workflow/style.d.ts +1 -0
- package/lib/workflow/style.js +6 -5
- package/lib/workflow/style.js.map +1 -1
- package/lib/workflow/triggers/{model.d.ts → collection.d.ts} +1 -0
- package/lib/workflow/triggers/{model.js → collection.js} +7 -6
- package/lib/workflow/triggers/collection.js.map +1 -0
- package/lib/workflow/triggers/index.js +8 -5
- package/lib/workflow/triggers/index.js.map +1 -1
- package/package.json +3 -3
- package/src/block-provider/hooks/index.ts +10 -2
- package/src/collection-manager/types.ts +1 -0
- package/src/locale/en_US.ts +5 -1
- package/src/locale/zh_CN.ts +24 -7
- package/src/schema-component/antd/action/Action.Designer.tsx +2 -2
- package/src/schema-component/antd/action/Action.tsx +4 -2
- package/src/schema-component/antd/filter/Filter.Action.Designer.tsx +1 -1
- package/src/schema-component/antd/grid/Grid.tsx +31 -20
- package/src/schema-component/antd/menu/Menu.Designer.tsx +36 -26
- package/src/schema-component/antd/menu/Menu.tsx +12 -2
- package/src/schema-component/antd/record-picker/ReadPrettyRecordPicker.tsx +3 -1
- package/src/schema-component/antd/table/Table.Void.Designer.tsx +1 -1
- package/src/schema-component/antd/table-v2/Table.Column.Designer.tsx +1 -1
- package/src/schema-component/antd/table-v2/TableBlockDesigner.tsx +2 -2
- package/src/schema-component/antd/table-v2/TableSelectorDesigner.tsx +1 -1
- package/src/schema-component/antd/tabs/Tabs.Designer.tsx +1 -1
- package/src/schema-initializer/buttons/BlockInitializers.tsx +1 -1
- package/src/schema-initializer/buttons/CreateFormBlockInitializers.tsx +4 -1
- package/src/schema-initializer/buttons/FormItemInitializers.tsx +5 -3
- package/src/schema-initializer/buttons/ReadPrettyFormItemInitializers.tsx +5 -3
- package/src/schema-initializer/buttons/RecordBlockInitializers.tsx +4 -1
- package/src/schema-settings/GeneralSchemaDesigner.tsx +20 -5
- package/src/schema-templates/schemas/uiSchemaTemplates.ts +23 -10
- package/src/workflow/WorkflowLink.tsx +1 -1
- package/src/workflow/calculators.tsx +10 -8
- package/src/workflow/nodes/condition.tsx +21 -38
- package/src/workflow/nodes/index.tsx +6 -4
- package/src/workflow/nodes/parallel.tsx +10 -7
- package/src/workflow/nodes/query.tsx +1 -1
- package/src/workflow/nodes/update.tsx +4 -1
- package/src/workflow/schemas/collection.ts +3 -2
- package/src/workflow/schemas/workflows.ts +3 -2
- package/src/workflow/style.tsx +4 -0
- package/src/workflow/triggers/{model.tsx → collection.tsx} +6 -5
- package/src/workflow/triggers/index.tsx +11 -5
- package/esm/workflow/triggers/model.js.map +0 -1
- package/lib/workflow/triggers/model.js.map +0 -1
package/src/locale/zh_CN.ts
CHANGED
|
@@ -318,6 +318,7 @@ export default {
|
|
|
318
318
|
|
|
319
319
|
'Skip required validation': '跳过必填校验',
|
|
320
320
|
'Form values': '表单值',
|
|
321
|
+
'Fields values': '字段值',
|
|
321
322
|
'When submitting the following fields, the saved values are': '提交以下字段时,保存的值为',
|
|
322
323
|
'After successful submission': '提交成功后',
|
|
323
324
|
'Then': '然后',
|
|
@@ -407,25 +408,24 @@ export default {
|
|
|
407
408
|
|
|
408
409
|
// plugins/workflow
|
|
409
410
|
'Workflow': '工作流',
|
|
410
|
-
'
|
|
411
|
-
'Executions': '执行历史',
|
|
411
|
+
'Execution History': '执行历史',
|
|
412
412
|
'Trigger type': '触发方式',
|
|
413
413
|
'Description': '描述',
|
|
414
414
|
'Status': '状态',
|
|
415
415
|
'Enabled': '启用',
|
|
416
416
|
'Disabled': '禁用',
|
|
417
|
-
'Trigger configuration': '触发器配置',
|
|
418
417
|
'Load failed': '加载失败',
|
|
419
418
|
|
|
420
|
-
'
|
|
419
|
+
'Trigger': '触发器',
|
|
420
|
+
'Collection event': '数据表事件',
|
|
421
421
|
'Trigger on': '触发时机',
|
|
422
422
|
'After record added': '新增数据后',
|
|
423
423
|
'After record updated': '更新数据后',
|
|
424
424
|
'After record added or updated': '新增或更新数据后',
|
|
425
425
|
'After record deleted': '删除数据后',
|
|
426
426
|
'Changed fields': '发生变动的字段',
|
|
427
|
-
'
|
|
428
|
-
'
|
|
427
|
+
'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.': '只有被选中的某个字段发生变动时才会触发。如果不选择,则表示任何字段变动时都会触发。新增或删除数据时,任意字段都被认为发生变动。',
|
|
428
|
+
'Only triggers when match conditions': '满足以下条件才触发',
|
|
429
429
|
|
|
430
430
|
'End': '结束',
|
|
431
431
|
|
|
@@ -445,7 +445,6 @@ export default {
|
|
|
445
445
|
'Failed': '失败',
|
|
446
446
|
'Canceled': '已取消',
|
|
447
447
|
|
|
448
|
-
'Node configuration': '配置节点',
|
|
449
448
|
'This node contains branches, deleting will also be preformed to them, are you sure?': '节点包含分支,将同时删除其所有分支下的子节点,确定继续?',
|
|
450
449
|
|
|
451
450
|
'Control': '流程控制',
|
|
@@ -456,8 +455,26 @@ export default {
|
|
|
456
455
|
'Calculation': '运算',
|
|
457
456
|
'Configure calculation': '配置运算',
|
|
458
457
|
'Calculation result': '运算结果',
|
|
458
|
+
'True': '真',
|
|
459
|
+
'False': '假',
|
|
460
|
+
|
|
461
|
+
'Condition': '条件判断',
|
|
462
|
+
'Mode': '模式',
|
|
463
|
+
'Continue when "Yes"': '“是”则继续',
|
|
464
|
+
'Branch into "Yes" and "No"': '“是”和“否”分别继续',
|
|
465
|
+
'Conditions': '条件配置',
|
|
466
|
+
|
|
467
|
+
'Parallel branch': '分支',
|
|
468
|
+
'All succeeded': '全部成功',
|
|
469
|
+
'Any succeeded': '任意成功',
|
|
470
|
+
'Continue after all branches succeeded': '全部分支都成功后才能继续',
|
|
471
|
+
'Continue after any branch succeeded': '任意分支成功后就继续',
|
|
459
472
|
|
|
460
473
|
'Create record': '新增数据',
|
|
461
474
|
'Update record': '更新数据',
|
|
462
475
|
'Query record': '查询数据',
|
|
476
|
+
'Multiple records': '多条数据',
|
|
477
|
+
'Please select collection first': '请先选择数据表',
|
|
478
|
+
'Only update records matching conditions': '只更新满足条件的数据',
|
|
479
|
+
'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.': '未被赋值的字段将被设置为默认值,没有默认值的设置为空值。'
|
|
463
480
|
}
|
|
@@ -11,7 +11,7 @@ export const ActionDesigner = (props) => {
|
|
|
11
11
|
const { t } = useTranslation();
|
|
12
12
|
const isPopupAction = ['create', 'update', 'view'].includes(fieldSchema['x-action'] || '');
|
|
13
13
|
return (
|
|
14
|
-
<GeneralSchemaDesigner {...props}>
|
|
14
|
+
<GeneralSchemaDesigner {...props} disableInitializer>
|
|
15
15
|
<SchemaSettings.ModalItem
|
|
16
16
|
title={t('Edit button')}
|
|
17
17
|
schema={
|
|
@@ -65,7 +65,7 @@ export const ActionDesigner = (props) => {
|
|
|
65
65
|
{ label: t('Drawer'), value: 'drawer' },
|
|
66
66
|
{ label: t('Dialog'), value: 'modal' },
|
|
67
67
|
]}
|
|
68
|
-
value={
|
|
68
|
+
value={fieldSchema?.['x-component-props']?.['openMode']}
|
|
69
69
|
onChange={(value) => {
|
|
70
70
|
field.componentProps.openMode = value;
|
|
71
71
|
fieldSchema['x-component-props']['openMode'] = value;
|
|
@@ -69,7 +69,7 @@ export const Action: ComposedAction = observer((props: any) => {
|
|
|
69
69
|
const {
|
|
70
70
|
popover,
|
|
71
71
|
confirm,
|
|
72
|
-
openMode,
|
|
72
|
+
// openMode,
|
|
73
73
|
containerRefKey,
|
|
74
74
|
component,
|
|
75
75
|
useAction = useA,
|
|
@@ -81,13 +81,15 @@ export const Action: ComposedAction = observer((props: any) => {
|
|
|
81
81
|
const { onClick } = useProps(props);
|
|
82
82
|
const [visible, setVisible] = useState(false);
|
|
83
83
|
const Designer = useDesigner();
|
|
84
|
-
const field = useField();
|
|
84
|
+
const field = useField<any>();
|
|
85
85
|
const { run } = useAction();
|
|
86
86
|
const fieldSchema = useFieldSchema();
|
|
87
87
|
const designerProps = fieldSchema['x-designer-props'];
|
|
88
|
+
const openMode = fieldSchema?.['x-component-props']?.['openMode'];
|
|
88
89
|
const renderButton = () => (
|
|
89
90
|
<SortableItem
|
|
90
91
|
{...others}
|
|
92
|
+
loading={field?.data?.loading}
|
|
91
93
|
icon={<Icon type={icon} />}
|
|
92
94
|
onClick={(e: React.MouseEvent) => {
|
|
93
95
|
e.preventDefault();
|
|
@@ -31,7 +31,7 @@ export const FilterActionDesigner = (props) => {
|
|
|
31
31
|
const { t } = useTranslation();
|
|
32
32
|
const nonfilterable = fieldSchema?.['x-component-props']?.nonfilterable || [];
|
|
33
33
|
return (
|
|
34
|
-
<GeneralSchemaDesigner {...props}>
|
|
34
|
+
<GeneralSchemaDesigner {...props} disableInitializer>
|
|
35
35
|
<SchemaSettings.ItemGroup title={t('Filterable fields')}>
|
|
36
36
|
{fields.map((field) => {
|
|
37
37
|
const checked = !nonfilterable.includes(field.name);
|
|
@@ -9,6 +9,7 @@ import { DndContext } from '../../common/dnd-context';
|
|
|
9
9
|
|
|
10
10
|
const GridRowContext = createContext(null);
|
|
11
11
|
const GridColContext = createContext(null);
|
|
12
|
+
const GridContext = createContext<any>({});
|
|
12
13
|
|
|
13
14
|
const ColDivider = (props) => {
|
|
14
15
|
const { isOver, setNodeRef } = useDroppable({
|
|
@@ -147,6 +148,14 @@ const DndWrapper = (props) => {
|
|
|
147
148
|
return <DndContext {...props.dndContext}>{props.children}</DndContext>;
|
|
148
149
|
};
|
|
149
150
|
|
|
151
|
+
export const useGridContext = () => {
|
|
152
|
+
return useContext(GridContext);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const useGridRowContext = () => {
|
|
156
|
+
return useContext(GridRowContext);
|
|
157
|
+
}
|
|
158
|
+
|
|
150
159
|
export const Grid: any = observer((props: any) => {
|
|
151
160
|
const field = useField();
|
|
152
161
|
const fieldSchema = useFieldSchema();
|
|
@@ -154,26 +163,28 @@ export const Grid: any = observer((props: any) => {
|
|
|
154
163
|
const addr = field.address.toString();
|
|
155
164
|
const rows = useRowProperties();
|
|
156
165
|
return (
|
|
157
|
-
<
|
|
158
|
-
<
|
|
159
|
-
<
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
<
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
166
|
+
<GridContext.Provider value={{ fieldSchema, renderSchemaInitializer: render }}>
|
|
167
|
+
<div className={'nb-grid'} style={{ position: 'relative' }}>
|
|
168
|
+
<DndWrapper dndContext={props.dndContext}>
|
|
169
|
+
<RowDivider
|
|
170
|
+
id={`${addr}_0`}
|
|
171
|
+
data={{ wrapSchema: wrapRowSchema, insertAdjacent: 'afterBegin', schema: fieldSchema }}
|
|
172
|
+
/>
|
|
173
|
+
{rows.map((schema, index) => {
|
|
174
|
+
return (
|
|
175
|
+
<React.Fragment key={schema.name}>
|
|
176
|
+
<RecursionField name={schema.name} schema={schema} />
|
|
177
|
+
<RowDivider
|
|
178
|
+
id={`${addr}_${index + 1}`}
|
|
179
|
+
data={{ wrapSchema: wrapRowSchema, insertAdjacent: 'afterEnd', schema }}
|
|
180
|
+
/>
|
|
181
|
+
</React.Fragment>
|
|
182
|
+
);
|
|
183
|
+
})}
|
|
184
|
+
</DndWrapper>
|
|
185
|
+
{render()}
|
|
186
|
+
</div>
|
|
187
|
+
</GridContext.Provider>
|
|
177
188
|
);
|
|
178
189
|
});
|
|
179
190
|
|
|
@@ -223,35 +223,43 @@ export const MenuDesigner = () => {
|
|
|
223
223
|
});
|
|
224
224
|
});
|
|
225
225
|
};
|
|
226
|
+
const schema = {
|
|
227
|
+
type: 'object',
|
|
228
|
+
title: t('Edit menu item'),
|
|
229
|
+
properties: {
|
|
230
|
+
title: {
|
|
231
|
+
title: t('Menu item title'),
|
|
232
|
+
required: true,
|
|
233
|
+
'x-decorator': 'FormItem',
|
|
234
|
+
'x-component': 'Input',
|
|
235
|
+
'x-component-props': {},
|
|
236
|
+
},
|
|
237
|
+
icon: {
|
|
238
|
+
title: t('Menu item icon'),
|
|
239
|
+
'x-component': 'IconPicker',
|
|
240
|
+
'x-decorator': 'FormItem',
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
};
|
|
244
|
+
const initialValues = {
|
|
245
|
+
title: field.title,
|
|
246
|
+
icon: field.componentProps.icon,
|
|
247
|
+
};
|
|
248
|
+
if (fieldSchema['x-component'] === 'Menu.URL') {
|
|
249
|
+
schema.properties['href'] = {
|
|
250
|
+
title: t('Link'),
|
|
251
|
+
'x-component': 'Input',
|
|
252
|
+
'x-decorator': 'FormItem',
|
|
253
|
+
};
|
|
254
|
+
initialValues['href'] = field.componentProps.href;
|
|
255
|
+
}
|
|
226
256
|
return (
|
|
227
257
|
<GeneralSchemaDesigner>
|
|
228
258
|
<SchemaSettings.ModalItem
|
|
229
259
|
title={t('Edit')}
|
|
230
|
-
schema={
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
title: t('Edit menu item'),
|
|
234
|
-
properties: {
|
|
235
|
-
title: {
|
|
236
|
-
title: t('Menu item title'),
|
|
237
|
-
required: true,
|
|
238
|
-
'x-decorator': 'FormItem',
|
|
239
|
-
'x-component': 'Input',
|
|
240
|
-
'x-component-props': {},
|
|
241
|
-
},
|
|
242
|
-
icon: {
|
|
243
|
-
title: t('Menu item icon'),
|
|
244
|
-
'x-component': 'IconPicker',
|
|
245
|
-
'x-decorator': 'FormItem',
|
|
246
|
-
},
|
|
247
|
-
},
|
|
248
|
-
} as ISchema
|
|
249
|
-
}
|
|
250
|
-
initialValues={{
|
|
251
|
-
title: field.title,
|
|
252
|
-
icon: field.componentProps.icon,
|
|
253
|
-
}}
|
|
254
|
-
onSubmit={({ title, icon }) => {
|
|
260
|
+
schema={schema as ISchema}
|
|
261
|
+
initialValues={initialValues}
|
|
262
|
+
onSubmit={({ title, icon, href }) => {
|
|
255
263
|
const schema = {
|
|
256
264
|
['x-uid']: fieldSchema['x-uid'],
|
|
257
265
|
};
|
|
@@ -262,9 +270,11 @@ export const MenuDesigner = () => {
|
|
|
262
270
|
refresh();
|
|
263
271
|
}
|
|
264
272
|
field.componentProps.icon = icon;
|
|
265
|
-
|
|
273
|
+
field.componentProps.href = href;
|
|
274
|
+
schema['x-component-props'] = { icon, href };
|
|
266
275
|
fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
|
|
267
276
|
fieldSchema['x-component-props']['icon'] = icon;
|
|
277
|
+
fieldSchema['x-component-props']['href'] = href;
|
|
268
278
|
dn.emit('patch', {
|
|
269
279
|
schema,
|
|
270
280
|
});
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Schema,
|
|
6
6
|
SchemaExpressionScopeContext,
|
|
7
7
|
useField,
|
|
8
|
-
useFieldSchema
|
|
8
|
+
useFieldSchema,
|
|
9
9
|
} from '@formily/react';
|
|
10
10
|
import { Menu as AntdMenu } from 'antd';
|
|
11
11
|
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
@@ -386,7 +386,17 @@ Menu.URL = observer((props) => {
|
|
|
386
386
|
>
|
|
387
387
|
<SortableItem className={designerCss}>
|
|
388
388
|
<Icon type={icon} />
|
|
389
|
-
|
|
389
|
+
<span
|
|
390
|
+
className={css`
|
|
391
|
+
overflow: hidden;
|
|
392
|
+
text-overflow: ellipsis;
|
|
393
|
+
display: inline-block;
|
|
394
|
+
width: 100%;
|
|
395
|
+
vertical-align: middle;
|
|
396
|
+
`}
|
|
397
|
+
>
|
|
398
|
+
{field.title}
|
|
399
|
+
</span>
|
|
390
400
|
<Designer />
|
|
391
401
|
</SortableItem>
|
|
392
402
|
</AntdMenu.Item>
|
|
@@ -7,6 +7,7 @@ import { BlockAssociationContext } from '../../../block-provider';
|
|
|
7
7
|
import { CollectionProvider, useCollection } from '../../../collection-manager';
|
|
8
8
|
import { RecordProvider } from '../../../record-provider';
|
|
9
9
|
import { FormProvider } from '../../core';
|
|
10
|
+
import { useCompile } from '../../hooks';
|
|
10
11
|
import { ActionContext } from '../action';
|
|
11
12
|
import { useFieldNames } from './useFieldNames';
|
|
12
13
|
|
|
@@ -18,6 +19,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|
|
18
19
|
const { getField } = useCollection();
|
|
19
20
|
const collectionField = getField(fieldSchema.name);
|
|
20
21
|
const [record, setRecord] = useState({});
|
|
22
|
+
const compile = useCompile();
|
|
21
23
|
return collectionField ? (
|
|
22
24
|
<div>
|
|
23
25
|
<BlockAssociationContext.Provider value={`${collectionField.collectionName}.${collectionField.name}`}>
|
|
@@ -34,7 +36,7 @@ export const ReadPrettyRecordPicker: React.FC = observer((props: any) => {
|
|
|
34
36
|
setRecord(record);
|
|
35
37
|
}}
|
|
36
38
|
>
|
|
37
|
-
{record?.[fieldNames?.label || 'label']}
|
|
39
|
+
{compile(record?.[fieldNames?.label || 'label'])}
|
|
38
40
|
</a>
|
|
39
41
|
</span>
|
|
40
42
|
);
|
|
@@ -39,7 +39,7 @@ export const TableVoidDesigner = () => {
|
|
|
39
39
|
onChange={(dragSort) => {
|
|
40
40
|
field.decoratorProps.dragSort = dragSort;
|
|
41
41
|
fieldSchema['x-decorator-props'].dragSort = dragSort;
|
|
42
|
-
ctx.run({ ...ctx.params?.[0], sort:
|
|
42
|
+
ctx.run({ ...ctx.params?.[0], sort: 'sort' });
|
|
43
43
|
dn.emit('patch', {
|
|
44
44
|
schema: {
|
|
45
45
|
['x-uid']: fieldSchema['x-uid'],
|
|
@@ -32,7 +32,7 @@ export const TableColumnDesigner = (props) => {
|
|
|
32
32
|
fieldSchema?.['x-component-props']?.['fieldNames'] || uiSchema?.['x-component-props']?.['fieldNames'];
|
|
33
33
|
const options = useLabelFields(collectionField?.target);
|
|
34
34
|
return (
|
|
35
|
-
<GeneralSchemaDesigner>
|
|
35
|
+
<GeneralSchemaDesigner disableInitializer>
|
|
36
36
|
<SchemaSettings.ModalItem
|
|
37
37
|
title={t('Custom column title')}
|
|
38
38
|
schema={
|
|
@@ -10,7 +10,7 @@ import { useSchemaTemplate } from '../../../schema-templates';
|
|
|
10
10
|
import { useDesignable } from '../../hooks';
|
|
11
11
|
|
|
12
12
|
export const TableBlockDesigner = () => {
|
|
13
|
-
const { name, title } = useCollection();
|
|
13
|
+
const { name, title, sortable } = useCollection();
|
|
14
14
|
const field = useField();
|
|
15
15
|
const fieldSchema = useFieldSchema();
|
|
16
16
|
const dataSource = useCollectionFilterOptions(name);
|
|
@@ -41,7 +41,7 @@ export const TableBlockDesigner = () => {
|
|
|
41
41
|
onChange={(dragSort) => {
|
|
42
42
|
field.decoratorProps.dragSort = dragSort;
|
|
43
43
|
fieldSchema['x-decorator-props'].dragSort = dragSort;
|
|
44
|
-
service.run({ ...service.params?.[0], sort:
|
|
44
|
+
service.run({ ...service.params?.[0], sort: 'sort' });
|
|
45
45
|
dn.emit('patch', {
|
|
46
46
|
schema: {
|
|
47
47
|
['x-uid']: fieldSchema['x-uid'],
|
|
@@ -34,7 +34,7 @@ export const TableSelectorDesigner = () => {
|
|
|
34
34
|
const template = useSchemaTemplate();
|
|
35
35
|
const { dragSort } = field.decoratorProps;
|
|
36
36
|
return (
|
|
37
|
-
<GeneralSchemaDesigner template={template} title={title || name}>
|
|
37
|
+
<GeneralSchemaDesigner template={template} title={title || name} disableInitializer>
|
|
38
38
|
<SchemaSettings.ModalItem
|
|
39
39
|
title={t('Set the data scope')}
|
|
40
40
|
schema={
|
|
@@ -5,11 +5,14 @@ import { gridRowColWrap } from '../utils';
|
|
|
5
5
|
|
|
6
6
|
export const CreateFormBlockInitializers = (props: any) => {
|
|
7
7
|
const { t } = useTranslation();
|
|
8
|
+
const { insertPosition, component } = props;
|
|
8
9
|
return (
|
|
9
10
|
<SchemaInitializer.Button
|
|
10
11
|
wrap={gridRowColWrap}
|
|
11
|
-
title={t('Add block')}
|
|
12
|
+
title={component ? null : t('Add block')}
|
|
12
13
|
icon={'PlusOutlined'}
|
|
14
|
+
insertPosition={insertPosition}
|
|
15
|
+
component={component}
|
|
13
16
|
items={[
|
|
14
17
|
{
|
|
15
18
|
type: 'itemGroup',
|
|
@@ -6,6 +6,7 @@ import { gridRowColWrap, useFormItemInitializerFields } from '../utils';
|
|
|
6
6
|
// 表单里配置字段
|
|
7
7
|
export const FormItemInitializers = (props: any) => {
|
|
8
8
|
const { t } = useTranslation();
|
|
9
|
+
const { insertPosition, component } = props;
|
|
9
10
|
return (
|
|
10
11
|
<SchemaInitializer.Button
|
|
11
12
|
wrap={gridRowColWrap}
|
|
@@ -35,8 +36,9 @@ export const FormItemInitializers = (props: any) => {
|
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
]}
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
39
|
+
insertPosition={insertPosition}
|
|
40
|
+
component={component}
|
|
41
|
+
title={component ? null : t('Configure fields')}
|
|
42
|
+
/>
|
|
41
43
|
);
|
|
42
44
|
};
|
|
@@ -5,6 +5,7 @@ import { gridRowColWrap, useFormItemInitializerFields } from '../utils';
|
|
|
5
5
|
|
|
6
6
|
export const ReadPrettyFormItemInitializers = (props: any) => {
|
|
7
7
|
const { t } = useTranslation();
|
|
8
|
+
const { insertPosition, component } = props;
|
|
8
9
|
return (
|
|
9
10
|
<SchemaInitializer.Button
|
|
10
11
|
wrap={gridRowColWrap}
|
|
@@ -34,8 +35,9 @@ export const ReadPrettyFormItemInitializers = (props: any) => {
|
|
|
34
35
|
},
|
|
35
36
|
},
|
|
36
37
|
]}
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
38
|
+
insertPosition={insertPosition}
|
|
39
|
+
component={component}
|
|
40
|
+
title={component ? null : t('Configure fields')}
|
|
41
|
+
/>
|
|
40
42
|
);
|
|
41
43
|
};
|
|
@@ -20,10 +20,13 @@ const useRelationFields = () => {
|
|
|
20
20
|
|
|
21
21
|
export const RecordBlockInitializers = (props: any) => {
|
|
22
22
|
const { t } = useTranslation();
|
|
23
|
+
const { insertPosition, component } = props;
|
|
23
24
|
return (
|
|
24
25
|
<SchemaInitializer.Button
|
|
25
26
|
wrap={gridRowColWrap}
|
|
26
|
-
|
|
27
|
+
insertPosition={insertPosition}
|
|
28
|
+
component={component}
|
|
29
|
+
title={component ? null : t('Add block')}
|
|
27
30
|
icon={'PlusOutlined'}
|
|
28
31
|
items={[
|
|
29
32
|
{
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { DragOutlined, MenuOutlined } from '@ant-design/icons';
|
|
1
|
+
import { DragOutlined, MenuOutlined, PlusOutlined } from '@ant-design/icons';
|
|
2
2
|
import { css } from '@emotion/css';
|
|
3
3
|
import { useField, useFieldSchema } from '@formily/react';
|
|
4
4
|
import { Space } from 'antd';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
|
-
import { DragHandler, useCompile, useDesignable } from '../schema-component';
|
|
8
|
+
import { DragHandler, useCompile, useDesignable, useGridContext, useGridRowContext } from '../schema-component';
|
|
9
|
+
import { gridRowColWrap } from '../schema-initializer/utils';
|
|
9
10
|
import { SchemaSettings } from './SchemaSettings';
|
|
10
11
|
|
|
11
12
|
const titleCss = css`
|
|
@@ -31,7 +32,7 @@ const titleCss = css`
|
|
|
31
32
|
`;
|
|
32
33
|
|
|
33
34
|
export const GeneralSchemaDesigner = (props: any) => {
|
|
34
|
-
const { title, template, draggable = true } = props;
|
|
35
|
+
const { disableInitializer, title, template, draggable = true } = props;
|
|
35
36
|
const { dn, designable } = useDesignable();
|
|
36
37
|
const field = useField();
|
|
37
38
|
const { t } = useTranslation();
|
|
@@ -45,14 +46,22 @@ export const GeneralSchemaDesigner = (props: any) => {
|
|
|
45
46
|
if (!designable) {
|
|
46
47
|
return null;
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
+
const rowCtx = useGridRowContext();
|
|
50
|
+
const ctx = useGridContext();
|
|
51
|
+
const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName)
|
|
52
|
+
? `${template?.name} ${t('(Fields only)')}`
|
|
53
|
+
: template?.name;
|
|
49
54
|
return (
|
|
50
55
|
<div className={'general-schema-designer'}>
|
|
51
56
|
{title && (
|
|
52
57
|
<div className={classNames('general-schema-designer-title', titleCss)}>
|
|
53
58
|
<Space size={2}>
|
|
54
59
|
<span className={'title-tag'}>{compile(title)}</span>
|
|
55
|
-
{template &&
|
|
60
|
+
{template && (
|
|
61
|
+
<span className={'title-tag'}>
|
|
62
|
+
{t('Reference template')}: {templateName || t('Untitled')}
|
|
63
|
+
</span>
|
|
64
|
+
)}
|
|
56
65
|
</Space>
|
|
57
66
|
</div>
|
|
58
67
|
)}
|
|
@@ -63,6 +72,12 @@ export const GeneralSchemaDesigner = (props: any) => {
|
|
|
63
72
|
<DragOutlined />
|
|
64
73
|
</DragHandler>
|
|
65
74
|
)}
|
|
75
|
+
{!disableInitializer &&
|
|
76
|
+
ctx?.renderSchemaInitializer?.({
|
|
77
|
+
insertPosition: 'afterEnd',
|
|
78
|
+
wrap: rowCtx?.cols?.length > 1 ? undefined : gridRowColWrap,
|
|
79
|
+
component: <PlusOutlined style={{ cursor: 'pointer', fontSize: 12 }} />,
|
|
80
|
+
})}
|
|
66
81
|
<SchemaSettings title={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />} {...schemaSettingsProps}>
|
|
67
82
|
{props.children}
|
|
68
83
|
</SchemaSettings>
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { ISchema } from '@formily/react';
|
|
2
2
|
import { uid } from '@formily/shared';
|
|
3
|
+
import { useUpdateActionProps } from '../../block-provider/hooks';
|
|
4
|
+
import { useSchemaTemplateManager } from '../SchemaTemplateManagerProvider';
|
|
5
|
+
|
|
6
|
+
const useUpdateSchemaTemplateActionProps = () => {
|
|
7
|
+
const props = useUpdateActionProps();
|
|
8
|
+
const { refresh } = useSchemaTemplateManager();
|
|
9
|
+
return {
|
|
10
|
+
async onClick() {
|
|
11
|
+
await props.onClick();
|
|
12
|
+
refresh();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
3
16
|
|
|
4
17
|
export const uiSchemaTemplatesSchema: ISchema = {
|
|
5
18
|
type: 'object',
|
|
@@ -70,14 +83,14 @@ export const uiSchemaTemplatesSchema: ISchema = {
|
|
|
70
83
|
split: '|',
|
|
71
84
|
},
|
|
72
85
|
properties: {
|
|
73
|
-
view: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
86
|
+
// view: {
|
|
87
|
+
// title: '{{ t("View") }}',
|
|
88
|
+
// 'x-action': 'view',
|
|
89
|
+
// 'x-component': 'RecordLink',
|
|
90
|
+
// 'x-component-props': {
|
|
91
|
+
// to: '/admin/plugins/block-templates/${record.key}',
|
|
92
|
+
// },
|
|
93
|
+
// },
|
|
81
94
|
edit: {
|
|
82
95
|
type: 'void',
|
|
83
96
|
title: '{{ t("Edit") }}',
|
|
@@ -132,13 +145,13 @@ export const uiSchemaTemplatesSchema: ISchema = {
|
|
|
132
145
|
},
|
|
133
146
|
properties: {
|
|
134
147
|
submit: {
|
|
135
|
-
title: 'Submit',
|
|
148
|
+
title: '{{t("Submit")}}',
|
|
136
149
|
'x-action': 'submit',
|
|
137
150
|
'x-component': 'Action',
|
|
138
151
|
'x-component-props': {
|
|
139
152
|
type: 'primary',
|
|
140
153
|
htmlType: 'submit',
|
|
141
|
-
useProps:
|
|
154
|
+
useProps: useUpdateSchemaTemplateActionProps,
|
|
142
155
|
},
|
|
143
156
|
type: 'void',
|
|
144
157
|
},
|
|
@@ -9,6 +9,6 @@ export const WorkflowLink = () => {
|
|
|
9
9
|
const { id } = useRecord();
|
|
10
10
|
const { setVisible } = useActionContext();
|
|
11
11
|
return (
|
|
12
|
-
<Link to={`/admin/plugins/workflows/${id}`} onClick={() => setVisible(false)}>{t('Configure
|
|
12
|
+
<Link to={`/admin/plugins/workflows/${id}`} onClick={() => setVisible(false)}>{t('Configure')}</Link>
|
|
13
13
|
);
|
|
14
14
|
}
|