();
+ console.log('DatabaseField', field.componentProps);
+ return (
+
+ {
+ field.setComponentProps({
+ activeKey: key,
+ });
+ }}
+ accordion
+ >
+ {field.value?.map((item, index) => {
+ const schema = interfaces.get(item.interface);
+ console.log({ schema });
+ return (
+ field.moveUp(index)}>Up,
+ ,
+ ]}
+ header={item.name}
+ key={item.id}
+ >
+
+
+ );
+ })}
+
+
+
+ );
+});
diff --git a/packages/client/src/blocks/form/index.md b/packages/client/src/blocks/form/index.md
index e86fbddb5..ec1bba30b 100644
--- a/packages/client/src/blocks/form/index.md
+++ b/packages/client/src/blocks/form/index.md
@@ -20,30 +20,26 @@ import React from 'react';
import { SchemaRenderer } from '../';
const schema = {
+ name: 'form',
type: 'object',
+ 'x-component': 'Form',
properties: {
- form: {
- type: 'object',
- 'x-component': 'Form',
- properties: {
- username: {
- type: 'string',
- title: '用户名',
- required: true,
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- password: {
- type: 'string',
- title: '密码',
- required: true,
- 'x-decorator': 'FormItem',
- 'x-component': 'Password',
- },
- }
- }
- },
-}
+ username: {
+ type: 'string',
+ title: '用户名',
+ required: true,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ },
+ password: {
+ type: 'string',
+ title: '密码',
+ required: true,
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Password',
+ },
+ }
+};
export default () => {
return (
diff --git a/packages/client/src/demos/api/blocks-getSchema/item1.ts b/packages/client/src/demos/api/blocks-getSchema/item1.ts
index d75ff7823..cfb8d780d 100644
--- a/packages/client/src/demos/api/blocks-getSchema/item1.ts
+++ b/packages/client/src/demos/api/blocks-getSchema/item1.ts
@@ -1,436 +1,147 @@
+import { ISchema } from '@formily/json-schema';
+import { uid } from '@formily/shared';
+
export default {
type: 'object',
properties: {
- grid: {
+ [uid()]: {
type: 'void',
'x-component': 'Grid',
properties: {
- row1: {
+ [uid()]: {
type: 'void',
'x-component': 'Grid.Row',
properties: {
- col1: {
+ [uid()]: {
type: 'void',
'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- },
properties: {
- block11: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block11',
- },
+ 'x-decorator': 'BlockItem',
+ 'x-component': 'Form',
properties: {
- form1: {
+ [uid()]: {
type: 'void',
- name: 'item3',
'x-decorator': 'Card',
- 'x-component': 'Form',
+ 'x-component': 'Grid',
properties: {
- grid: {
+ [uid()]: {
type: 'void',
- title: 'aa',
- 'x-component': 'Grid',
+ 'x-component': 'Grid.Row',
properties: {
- row1: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Row',
+ 'x-component': 'Grid.Col',
+
properties: {
- col1: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- },
- properties: {
- block11: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block11',
- },
- properties: {
- field1: {
- type: 'string',
- required: true,
- title: '字段1',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- col2: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- isLast: true,
- },
- properties: {
- block21: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block21',
- },
- properties: {
- field2: {
- type: 'string',
- required: true,
- title: '字段2',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
+ [uid()]: {
+ type: 'string',
+ required: true,
+ title: '字段1',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
},
},
},
- row2: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Row',
+ 'x-component': 'Grid.Col',
properties: {
- col21: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 3,
- },
- properties: {
- block211: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block211',
- },
- properties: {
- field3: {
- type: 'string',
- required: true,
- title: '字段3',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- col22: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 2 / 3,
- isLast: true,
- },
- properties: {
- block221: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block221',
- },
- properties: {
- field4: {
- type: 'string',
- required: true,
- title: '字段4',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- },
- },
- row3: {
- type: 'void',
- 'x-component': 'Grid.Row',
- "x-component-props": {
- isLast: true,
- },
- properties: {
- col31: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1,
- isLast: true,
- },
- properties: {
- block311: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block311',
- },
- properties: {
- field5: {
- type: 'string',
- required: true,
- title: '字段5',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
+ [uid()]: {
+ type: 'string',
+ required: true,
+ title: '字段2',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
},
},
},
},
},
- actions: {
+ [uid()]: {
type: 'void',
- // 'x-decorator': 'Div',
- 'x-component': 'Space',
+ 'x-component': 'Grid.Row',
properties: {
- submit: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- // block: true,
- type: 'primary',
- useAction: '{{ useLogin }}',
- style: {
- // width: '100%',
+ 'x-component': 'Grid.Col',
+ properties: {
+
+ [uid()]: {
+ type: 'string',
+ required: true,
+ title: '字段3',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
},
},
- title: '提交',
},
- reset: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- // block: true,
- useAction: '{{ useLogin }}',
- style: {
- // width: '100%',
+ 'x-component': 'Grid.Col',
+ properties: {
+ [uid()]: {
+ type: 'string',
+ required: true,
+ title: '字段4',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ },
+ },
+ },
+ },
+ },
+ [uid()]: {
+ type: 'void',
+ 'x-component': 'Grid.Row',
+ properties: {
+ [uid()]: {
+ type: 'void',
+ 'x-component': 'Grid.Col',
+ properties: {
+ [uid()]: {
+ type: 'string',
+ required: true,
+ title: '字段5',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
},
},
- title: '重置',
},
},
},
},
},
- },
- },
- },
- },
- col2: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- isLast: true,
- },
- properties: {
- block21: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block21',
- },
- properties: {
- form2: {
+ actions: {
type: 'void',
- name: 'item3',
- 'x-decorator': 'Card',
- 'x-component': 'Form',
+ // 'x-decorator': 'Div',
+ 'x-component': 'Space',
properties: {
- grid: {
+ submit: {
type: 'void',
- title: 'aa',
- 'x-component': 'Grid',
- properties: {
- row1: {
- type: 'void',
- 'x-component': 'Grid.Row',
- properties: {
- col1: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- },
- properties: {
- block11: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block11',
- },
- properties: {
- field1: {
- type: 'string',
- required: true,
- title: '字段1',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- col2: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- isLast: true,
- },
- properties: {
- block21: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block21',
- },
- properties: {
- field2: {
- type: 'string',
- required: true,
- title: '字段2',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- },
- },
- row2: {
- type: 'void',
- 'x-component': 'Grid.Row',
- properties: {
- col21: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 3,
- },
- properties: {
- block211: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block211',
- },
- properties: {
- field3: {
- type: 'string',
- required: true,
- title: '字段3',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- col22: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 2 / 3,
- isLast: true,
- },
- properties: {
- block221: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block221',
- },
- properties: {
- field4: {
- type: 'string',
- required: true,
- title: '字段4',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- },
- },
- row3: {
- type: 'void',
- 'x-component': 'Grid.Row',
- "x-component-props": {
- isLast: true,
- },
- properties: {
- col31: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1,
- isLast: true,
- },
- properties: {
- block311: {
- type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block311',
- },
- properties: {
- field5: {
- type: 'string',
- required: true,
- title: '字段5',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- },
- },
- },
- },
- },
- },
+ 'x-component': 'Action',
+ 'x-component-props': {
+ // block: true,
+ type: 'primary',
+ useAction: '{{ useLogin }}',
+ style: {
+ // width: '100%',
},
},
+ title: '提交',
},
- actions: {
+ reset: {
type: 'void',
- // 'x-decorator': 'Div',
- 'x-component': 'Space',
- properties: {
- submit: {
- type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- // block: true,
- type: 'primary',
- useAction: '{{ useLogin }}',
- style: {
- // width: '100%',
- },
- },
- title: '提交',
- },
- reset: {
- type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- // block: true,
- useAction: '{{ useLogin }}',
- style: {
- // width: '100%',
- },
- },
- title: '重置',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ // block: true,
+ useAction: '{{ useLogin }}',
+ style: {
+ // width: '100%',
},
},
+ title: '重置',
},
},
},
@@ -443,4 +154,4 @@ export default {
},
},
},
-}
\ No newline at end of file
+} as ISchema;
diff --git a/packages/client/src/demos/api/blocks-getSchema/item2.ts b/packages/client/src/demos/api/blocks-getSchema/item2.ts
index 8766c0eac..84218c353 100644
--- a/packages/client/src/demos/api/blocks-getSchema/item2.ts
+++ b/packages/client/src/demos/api/blocks-getSchema/item2.ts
@@ -4,31 +4,22 @@ import { uid } from '@formily/shared';
export default {
type: 'object',
properties: {
- [`g_${uid()}`]: {
+ [uid()]: {
type: 'void',
'x-decorator': 'Card',
'x-component': 'Grid',
properties: {
- [`gr_${uid()}`]: {
+ [uid()]: {
type: 'void',
'x-component': 'Grid.Row',
properties: {
- [`gc_${uid()}`]: {
+ [uid()]: {
type: 'void',
'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1,
- },
properties: {
- [`gb_${uid()}`]: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Block',
- properties: {
- [`gbn_${uid()}`]: {
- type: 'void',
- 'x-component': 'AddNew',
- },
- },
+ 'x-component': 'AddNew.BlockItem',
},
},
},
diff --git a/packages/client/src/demos/api/blocks-getSchema/item3.ts b/packages/client/src/demos/api/blocks-getSchema/item3.ts
index 4758eeb9a..dd2ca5683 100644
--- a/packages/client/src/demos/api/blocks-getSchema/item3.ts
+++ b/packages/client/src/demos/api/blocks-getSchema/item3.ts
@@ -1,35 +1,27 @@
import { uid } from '@formily/shared';
const schema = {
- type: 'void',
- name: `form_${uid()}`,
- 'x-decorator': 'Card',
- 'x-component': 'Form',
+ type: 'object',
properties: {
- grid: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid',
+ 'x-component': 'Form',
properties: {
- row1: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Row',
+ 'x-decorator': 'Card',
+ 'x-component': 'Grid',
properties: {
- col1: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- },
+ 'x-component': 'Grid.Row',
properties: {
- block11: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block11',
- },
- 'x-designable-bar': 'FormItem.DesignableBar',
+ 'x-component': 'Grid.Col',
+
properties: {
- field1: {
+ [uid()]: {
type: 'string',
required: true,
title: '字段1',
@@ -38,25 +30,11 @@ const schema = {
},
},
},
- },
- },
- col2: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 2,
- isLast: true,
- },
- properties: {
- block21: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block21',
- },
- 'x-designable-bar': 'FormItem.DesignableBar',
+ 'x-component': 'Grid.Col',
properties: {
- field2: {
+ [uid()]: {
type: 'string',
required: true,
title: '字段2',
@@ -67,28 +45,16 @@ const schema = {
},
},
},
- },
- },
- row2: {
- type: 'void',
- 'x-component': 'Grid.Row',
- properties: {
- col21: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1 / 3,
- },
+ 'x-component': 'Grid.Row',
properties: {
- block211: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block211',
- },
- 'x-designable-bar': 'FormItem.DesignableBar',
+ 'x-component': 'Grid.Col',
properties: {
- field3: {
+
+ [uid()]: {
type: 'string',
required: true,
title: '字段3',
@@ -97,25 +63,11 @@ const schema = {
},
},
},
- },
- },
- col22: {
- type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 2 / 3,
- isLast: true,
- },
- properties: {
- block221: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block221',
- },
- 'x-designable-bar': 'FormItem.DesignableBar',
+ 'x-component': 'Grid.Col',
properties: {
- field4: {
+ [uid()]: {
type: 'string',
required: true,
title: '字段4',
@@ -126,31 +78,15 @@ const schema = {
},
},
},
- },
- },
- row3: {
- type: 'void',
- 'x-component': 'Grid.Row',
- "x-component-props": {
- isLast: true,
- },
- properties: {
- col31: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Col',
- 'x-component-props': {
- size: 1,
- isLast: true,
- },
+ 'x-component': 'Grid.Row',
properties: {
- block311: {
+ [uid()]: {
type: 'void',
- 'x-component': 'Grid.Block',
- 'x-component-props': {
- title: 'block311',
- },
+ 'x-component': 'Grid.Col',
properties: {
- field5: {
+ [uid()]: {
type: 'string',
required: true,
title: '字段5',
@@ -163,65 +99,40 @@ const schema = {
},
},
},
- [`gr_${uid()}`]: {
+ actions: {
type: 'void',
- 'x-component': 'Grid.Row',
+ // 'x-decorator': 'Div',
+ 'x-component': 'Space',
properties: {
- [`gc_${uid()}`]: {
+ submit: {
type: 'void',
- 'x-component': 'Grid.Col',
+ 'x-component': 'Action',
'x-component-props': {
- size: 1,
- },
- properties: {
- [`gb_${uid()}`]: {
- type: 'void',
- 'x-component': 'Grid.Block',
- properties: {
- [`gbn_${uid()}`]: {
- type: 'void',
- 'x-component': 'AddNew.FormItem',
- },
- },
+ // block: true,
+ type: 'primary',
+ useAction: '{{ useLogin }}',
+ style: {
+ // width: '100%',
},
},
+ title: '提交',
+ },
+ reset: {
+ type: 'void',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ // block: true,
+ useAction: '{{ useLogin }}',
+ style: {
+ // width: '100%',
+ },
+ },
+ title: '重置',
},
},
},
},
},
- actions: {
- type: 'void',
- // 'x-decorator': 'Div',
- 'x-component': 'Space',
- properties: {
- submit: {
- type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- // block: true,
- type: 'primary',
- useAction: '{{ useLogin }}',
- style: {
- // width: '100%',
- },
- },
- title: '提交',
- },
- reset: {
- type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- // block: true,
- useAction: '{{ useLogin }}',
- style: {
- // width: '100%',
- },
- },
- title: '重置',
- },
- },
- },
},
};
diff --git a/packages/client/src/demos/api/blocks-getSchema/register.ts b/packages/client/src/demos/api/blocks-getSchema/register.ts
index 089e9fbd2..f7b427dd9 100644
--- a/packages/client/src/demos/api/blocks-getSchema/register.ts
+++ b/packages/client/src/demos/api/blocks-getSchema/register.ts
@@ -73,4 +73,4 @@ export default {
},
},
},
-}
\ No newline at end of file
+}
diff --git a/packages/client/src/index.md b/packages/client/src/index.md
index c7a0d674e..75384bf31 100644
--- a/packages/client/src/index.md
+++ b/packages/client/src/index.md
@@ -10,7 +10,5 @@ group:
path: /client
---
-
-
-
+