Skip to content

Commit

Permalink
Merge branch 'formily_next' of github.com:alibaba/formily into formil…
Browse files Browse the repository at this point in the history
…y_next
  • Loading branch information
ZirkleTsing committed Feb 20, 2021
2 parents 6da06db + 634d784 commit f5685fd
Show file tree
Hide file tree
Showing 14 changed files with 388 additions and 180 deletions.
45 changes: 33 additions & 12 deletions packages/antd/docs/components/FormButtonGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@

```tsx
import React from 'react'
import { FormButtonGroup, Submit, Reset, FormItem, Input } from '@formily/antd'
import {
FormButtonGroup,
Submit,
Reset,
FormItem,
Input,
FormLayout,
} from '@formily/antd'
import { createForm } from '@formily/core'
import { FormProvider, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand All @@ -23,7 +30,7 @@ const form = createForm()
export default () => {
return (
<FormProvider form={form}>
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 10 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField>
<SchemaField.String
title="输入框"
Expand Down Expand Up @@ -84,7 +91,7 @@ export default () => {
<Submit onSubmit={console.log}>提交</Submit>
<Reset>重置</Reset>
</FormButtonGroup.FormItem>
</Form>
</FormLayout>
</FormProvider>
)
}
Expand All @@ -94,10 +101,17 @@ export default () => {

```tsx
import React from 'react'
import { FormButtonGroup, Submit, Reset, FormItem, Input } from '@formily/antd'
import {
FormButtonGroup,
Submit,
Reset,
FormItem,
FormLayout,
Input,
} from '@formily/antd'
import { createForm } from '@formily/core'
import { FormProvider, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand All @@ -111,7 +125,7 @@ const form = createForm()
export default () => {
return (
<FormProvider form={form}>
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 10 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField>
<SchemaField.String
title="输入框"
Expand Down Expand Up @@ -174,7 +188,7 @@ export default () => {
<Reset>重置</Reset>
</FormButtonGroup.FormItem>
</FormButtonGroup.Sticky>
</Form>
</FormLayout>
</FormProvider>
)
}
Expand All @@ -184,10 +198,17 @@ export default () => {

```tsx
import React from 'react'
import { FormButtonGroup, Submit, Reset, FormItem, Input } from '@formily/antd'
import {
FormButtonGroup,
Submit,
Reset,
FormItem,
FormLayout,
Input,
} from '@formily/antd'
import { createForm } from '@formily/core'
import { FormProvider, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand All @@ -201,7 +222,7 @@ const form = createForm()
export default () => {
return (
<FormProvider form={form}>
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 10 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField>
<SchemaField.String
title="输入框"
Expand Down Expand Up @@ -264,7 +285,7 @@ export default () => {
<Reset>重置</Reset>
</FormButtonGroup>
</FormButtonGroup.Sticky>
</Form>
</FormLayout>
</FormProvider>
)
}
Expand Down
14 changes: 8 additions & 6 deletions packages/antd/docs/components/FormCollapse.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
import React from 'react'
import {
FormCollapse,
FormLayout,
FormItem,
Input,
FormButtonGroup,
Submit,
} from '@formily/antd'
import { createForm } from '@formily/core'
import { FormProvider, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand All @@ -32,7 +33,7 @@ const formCollapse = FormCollapse.createFormCollapse()
export default () => {
return (
<FormProvider form={form}>
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 10 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField>
<SchemaField.Void
title="折叠面板"
Expand Down Expand Up @@ -102,7 +103,7 @@ export default () => {
</Button>
<Submit onSubmit={console.log}>提交</Submit>
</FormButtonGroup.FormItem>
</Form>
</FormLayout>
</FormProvider>
)
}
Expand All @@ -115,13 +116,14 @@ import React from 'react'
import {
FormCollapse,
FormItem,
FormLayout,
Input,
FormButtonGroup,
Submit,
} from '@formily/antd'
import { createForm } from '@formily/core'
import { FormProvider, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand Down Expand Up @@ -201,7 +203,7 @@ const schema = {
export default () => {
return (
<FormProvider form={form}>
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 10 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField schema={schema} scope={{ formCollapse }} />
<FormButtonGroup.FormItem>
<Button
Expand All @@ -222,7 +224,7 @@ export default () => {
</Button>
<Submit onSubmit={console.log}>提交</Submit>
</FormButtonGroup.FormItem>
</Form>
</FormLayout>
</FormProvider>
)
}
Expand Down
30 changes: 18 additions & 12 deletions packages/antd/docs/components/FormDialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

```tsx
import React from 'react'
import { FormDialog, FormItem, Input } from '@formily/antd'
import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd'
import { Field, useForm, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand All @@ -23,7 +23,7 @@ export default () => {
onClick={() => {
FormDialog('弹窗表单', () => {
return (
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField>
<SchemaField.String
name="aaa"
Expand Down Expand Up @@ -57,7 +57,7 @@ export default () => {
<FormDialog.Footer>
<span style={{ marginLeft: 4 }}>扩展文案</span>
</FormDialog.Footer>
</Form>
</FormLayout>
)
})
.open({
Expand All @@ -78,9 +78,9 @@ export default () => {

```tsx
import React from 'react'
import { FormDialog, FormItem, Input } from '@formily/antd'
import { FormDialog, FormItem, FormLayout, Input } from '@formily/antd'
import { Field, useForm, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand Down Expand Up @@ -129,12 +129,12 @@ export default () => {
onClick={() => {
FormDialog('弹窗表单', () => {
return (
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField schema={schema} />
<FormDialog.Footer>
<span style={{ marginLeft: 4 }}>扩展文案</span>
</FormDialog.Footer>
</Form>
</FormLayout>
)
})
.open({
Expand All @@ -155,17 +155,23 @@ export default () => {

```tsx
import React from 'react'
import { FormDialog, FormItem, Input, DialogFooter } from '@formily/antd'
import {
FormDialog,
FormItem,
FormLayout,
Input,
DialogFooter,
} from '@formily/antd'
import { Field, useForm } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

export default () => {
return (
<Button
onClick={() => {
FormDialog('弹窗表单', () => {
return (
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<Field
name="aaa"
required
Expand Down Expand Up @@ -197,7 +203,7 @@ export default () => {
<FormDialog.Footer>
<span style={{ marginLeft: 4 }}>扩展文案</span>
</FormDialog.Footer>
</Form>
</FormLayout>
)
})
.open({
Expand Down
21 changes: 12 additions & 9 deletions packages/antd/docs/components/FormDrawer.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import React from 'react'
import {
FormDrawer,
FormItem,
FormLayout,
Input,
Submit,
Reset,
FormButtonGroup,
} from '@formily/antd'
import { Field, useForm, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand All @@ -30,7 +31,7 @@ export default () => {
onClick={() => {
FormDrawer('抽屉表单', (resolve) => {
return (
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField>
<SchemaField.String
name="aaa"
Expand Down Expand Up @@ -67,7 +68,7 @@ export default () => {
<Reset>重置</Reset>
</FormButtonGroup>
</FormDrawer.Footer>
</Form>
</FormLayout>
)
})
.open({
Expand All @@ -91,13 +92,14 @@ import React from 'react'
import {
FormDrawer,
FormItem,
FormLayout,
Input,
Submit,
Reset,
FormButtonGroup,
} from '@formily/antd'
import { Field, useForm, createSchemaField } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

const SchemaField = createSchemaField({
components: {
Expand Down Expand Up @@ -146,15 +148,15 @@ export default () => {
onClick={() => {
FormDrawer('弹窗表单', (resolve) => {
return (
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField schema={schema} />
<FormDrawer.Footer>
<FormButtonGroup align="right">
<Submit onClick={resolve}>提交</Submit>
<Reset>重置</Reset>
</FormButtonGroup>
</FormDrawer.Footer>
</Form>
</FormLayout>
)
})
.open({
Expand All @@ -178,21 +180,22 @@ import React from 'react'
import {
FormDrawer,
FormItem,
FormLayout,
Input,
Submit,
Reset,
FormButtonGroup,
} from '@formily/antd'
import { Field, useForm } from '@formily/react'
import { Button, Form } from 'antd'
import { Button } from 'antd'

export default () => {
return (
<Button
onClick={() => {
FormDrawer('弹窗表单', (resolve) => {
return (
<Form labelCol={{ span: 6 }} wrapperCol={{ span: 14 }}>
<FormLayout labelCol={6} wrapperCol={10}>
<Field
name="aaa"
required
Expand Down Expand Up @@ -227,7 +230,7 @@ export default () => {
<Reset>重置</Reset>
</FormButtonGroup>
</FormDrawer.Footer>
</Form>
</FormLayout>
)
})
.open({
Expand Down
Loading

0 comments on commit f5685fd

Please sign in to comment.