Skip to content

Commit

Permalink
fix: merge uform master
Browse files Browse the repository at this point in the history
  • Loading branch information
秋逢 committed Dec 9, 2019
2 parents 8d854f8 + f01988f commit 84d2bf1
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 70 deletions.
70 changes: 70 additions & 0 deletions packages/antd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ npm install --save @uform/antd
- [`connect`](#connect)
- [`registerFormField`](#registerFormField)
- [Interfaces](#Interfaces)
- [ISchema](#ischema)
- [`IFormActions`](#IFormActions)
- [`IFormAsyncActions`](#IFormAsyncActions)
- [`ButtonProps`](#ButtonProps)
Expand Down Expand Up @@ -2827,6 +2828,67 @@ ReactDOM.render(<App />, document.getElementById('root'))
> The Interfaces is fully inherited from @uform/react. The specific Interfaces of @uform/antd is listed below.
---

#### ISchema

> Schema protocol object, mainly used to constrain a json structure to satisfy the Schema protocol

```typescript
interface ISchema {
/** base json schema spec**/
title?: React.ReactNode
description?: React.ReactNode
default?: any
readOnly?: boolean
writeOnly?: boolean
type?: 'string' | 'object' | 'array' | 'number' | string
enum?: Array<string | number | { label: React.ReactNode; value: any }>
const?: any
multipleOf?: number
maximum?: number
exclusiveMaximum?: number
minimum?: number
exclusiveMinimum?: number
maxLength?: number
minLength?: number
pattern?: string | RegExp
maxItems?: number
minItems?: number
uniqueItems?: boolean
maxProperties?: number
minProperties?: number
required?: string[] | boolean
format?: string
/** nested json schema spec **/
properties?: {
[key: string]: ISchema
}
items?: ISchema | ISchema[]
additionalItems?: ISchema
patternProperties?: {
[key: string]: ISchema
}
additionalProperties?: ISchema
/** extend json schema specs */
visible?: boolean //Field initial visible status(Whether the data is visible)
display?: boolean //Field initial display status(Whether the style is visible)
editable?: boolean
['x-props']?: { [name: string]: any }
['x-index']?: number
['x-rules']?: ValidatePatternRules
['x-component']?: string
['x-component-props']?: { [name: string]: any }
['x-render']?: <T = ISchemaFieldComponentProps>(
props: T & {
renderComponent: () => React.ReactElement
}
) => React.ReactElement
['x-effect']?: (
dispatch: (type: string, payload: any) => void,
option?: object
) => { [key: string]: any }
}
```

#### IFormActions

```typescript
Expand All @@ -2842,6 +2904,10 @@ interface IFormActions {
Validated: IFormValidateResult
Payload: any //onSubmit callback function return value
}>
/** get Schema of form **/
getFormSchema(): Schema
/*
* Clear the error message, you can pass the FormPathPattern to batch or precise control of the field to be cleared.
* For example, clearErrors("*(aa,bb,cc)")
Expand Down Expand Up @@ -2955,6 +3021,10 @@ interface IFormAsyncActions {
submit(
onSubmit?: (values: IFormState['values']) => void | Promise<any>
): Promise<IFormSubmitResult>
/** get Schema of form **/
getFormSchema(): Promise<Schema>
/*
* Reset form
*/
Expand Down
71 changes: 71 additions & 0 deletions packages/antd/README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ npm install --save @uform/antd
- [`connect`](#connect)
- [`registerFormField`](#registerFormField)
- [Interfaces](#Interfaces)
- [ISchema](#ischema)
- [`IFormActions`](#IFormActions)
- [`IFormAsyncActions`](#IFormAsyncActions)
- [`ButtonProps`](#ButtonProps)
Expand Down Expand Up @@ -2806,6 +2807,69 @@ ReactDOM.render(<App />, document.getElementById('root'))

---

#### ISchema

> Schema 协议对象,主要用于约束一份 json 结构满足 Schema 协议

```typescript
interface ISchema {
/** base json schema spec**/
title?: React.ReactNode
description?: React.ReactNode
default?: any
readOnly?: boolean
writeOnly?: boolean
type?: 'string' | 'object' | 'array' | 'number' | string
enum?: Array<string | number | { label: React.ReactNode; value: any }>
const?: any
multipleOf?: number
maximum?: number
exclusiveMaximum?: number
minimum?: number
exclusiveMinimum?: number
maxLength?: number
minLength?: number
pattern?: string | RegExp
maxItems?: number
minItems?: number
uniqueItems?: boolean
maxProperties?: number
minProperties?: number
required?: string[] | boolean
format?: string
/** nested json schema spec **/
properties?: {
[key: string]: ISchema
}
items?: ISchema | ISchema[]
additionalItems?: ISchema
patternProperties?: {
[key: string]: ISchema
}
additionalProperties?: ISchema
/** extend json schema specs */
editable?: boolean
//数据与样式是否可见
visible?: boolean
//样式是否可见
display?: boolean
['x-props']?: { [name: string]: any }
['x-index']?: number
['x-rules']?: ValidatePatternRules
['x-component']?: string
['x-component-props']?: { [name: string]: any }
['x-render']?: <T = ISchemaFieldComponentProps>(
props: T & {
renderComponent: () => React.ReactElement
}
) => React.ReactElement
['x-effect']?: (
dispatch: (type: string, payload: any) => void,
option?: object
) => { [key: string]: any }
}
```

#### IFormActions

```typescript
Expand All @@ -2822,6 +2886,9 @@ interface IFormActions {
payload: any //onSubmit回调函数返回值
}>
/** 获取当前表单Schema **/
getFormSchema(): Schema
/*
* 清空错误消息,可以通过传FormPathPattern来批量或精确控制要清空的字段,
* 比如clearErrors("*(aa,bb,cc)")
Expand Down Expand Up @@ -3010,6 +3077,10 @@ interface IFormAsyncActions {
submit(
onSubmit?: (values: IFormState['values']) => void | Promise<any>
): Promise<IFormSubmitResult>
/** 获取当前表单Schema **/
getFormSchema(): Promise<Schema>
/*
* 重置表单
*/
Expand Down
70 changes: 70 additions & 0 deletions packages/next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ npm install --save @uform/next
- [`connect`](#connect)
- [`registerFormField`](#registerFormField)
- [Interfaces](#Interfaces)
- [ISchema](#ischema)
- [`IFormActions`](#IFormActions)
- [`IFormAsyncActions`](#IFormAsyncActions)
- [`ButtonProps`](#ButtonProps)
Expand Down Expand Up @@ -2816,6 +2817,67 @@ ReactDOM.render(<App />, document.getElementById('root'))
> The Interfaces is fully inherited from @uform/react. The specific Interfaces of @uform/next is listed below.
---

#### ISchema

> Schema protocol object, mainly used to constrain a json structure to satisfy the Schema protocol

```typescript
interface ISchema {
/** base json schema spec**/
title?: React.ReactNode
description?: React.ReactNode
default?: any
readOnly?: boolean
writeOnly?: boolean
type?: 'string' | 'object' | 'array' | 'number' | string
enum?: Array<string | number | { label: React.ReactNode; value: any }>
const?: any
multipleOf?: number
maximum?: number
exclusiveMaximum?: number
minimum?: number
exclusiveMinimum?: number
maxLength?: number
minLength?: number
pattern?: string | RegExp
maxItems?: number
minItems?: number
uniqueItems?: boolean
maxProperties?: number
minProperties?: number
required?: string[] | boolean
format?: string
/** nested json schema spec **/
properties?: {
[key: string]: ISchema
}
items?: ISchema | ISchema[]
additionalItems?: ISchema
patternProperties?: {
[key: string]: ISchema
}
additionalProperties?: ISchema
/** extend json schema specs */
visible?: boolean //Field initial visible status(Whether the data is visible)
display?: boolean //Field initial display status(Whether the style is visible)
editable?: boolean
['x-props']?: { [name: string]: any }
['x-index']?: number
['x-rules']?: ValidatePatternRules
['x-component']?: string
['x-component-props']?: { [name: string]: any }
['x-render']?: <T = ISchemaFieldComponentProps>(
props: T & {
renderComponent: () => React.ReactElement
}
) => React.ReactElement
['x-effect']?: (
dispatch: (type: string, payload: any) => void,
option?: object
) => { [key: string]: any }
}
```

#### IFormActions

```typescript
Expand All @@ -2831,6 +2893,10 @@ interface IFormActions {
Validated: IFormValidateResult
Payload: any //onSubmit callback function return value
}>
/** get Schema of form **/
getFormSchema(): Schema
/*
* Clear the error message, you can pass the FormPathPattern to batch or precise control of the field to be cleared.
* For example, clearErrors("*(aa,bb,cc)")
Expand Down Expand Up @@ -2944,6 +3010,10 @@ interface IFormAsyncActions {
submit(
onSubmit?: (values: IFormState['values']) => void | Promise<any>
): Promise<IFormSubmitResult>
/** get Schema of form **/
getFormSchema(): Promise<Schema>
/*
* Reset form
*/
Expand Down
71 changes: 69 additions & 2 deletions packages/next/README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ npm install --save @uform/next
- [`connect`](#connect)
- [`registerFormField`](#registerFormField)
- [Interfaces](#Interfaces)
- [ISchema](#ischema)
- [`IFormActions`](#IFormActions)
- [`IFormAsyncActions`](#IFormAsyncActions)
- [`ButtonProps`](#ButtonProps)
Expand Down Expand Up @@ -2804,9 +2805,68 @@ ReactDOM.render(<App />, document.getElementById('root'))

---

#### IForm
#### ISchema

> 通过 createForm 创建出来的 Form 实例对象 API
> Schema 协议对象,主要用于约束一份 json 结构满足 Schema 协议

```typescript
interface ISchema {
/** base json schema spec**/
title?: React.ReactNode
description?: React.ReactNode
default?: any
readOnly?: boolean
writeOnly?: boolean
type?: 'string' | 'object' | 'array' | 'number' | string
enum?: Array<string | number | { label: React.ReactNode; value: any }>
const?: any
multipleOf?: number
maximum?: number
exclusiveMaximum?: number
minimum?: number
exclusiveMinimum?: number
maxLength?: number
minLength?: number
pattern?: string | RegExp
maxItems?: number
minItems?: number
uniqueItems?: boolean
maxProperties?: number
minProperties?: number
required?: string[] | boolean
format?: string
/** nested json schema spec **/
properties?: {
[key: string]: ISchema
}
items?: ISchema | ISchema[]
additionalItems?: ISchema
patternProperties?: {
[key: string]: ISchema
}
additionalProperties?: ISchema
/** extend json schema specs */
editable?: boolean
//数据与样式是否可见
visible?: boolean
//样式是否可见
display?: boolean
['x-props']?: { [name: string]: any }
['x-index']?: number
['x-rules']?: ValidatePatternRules
['x-component']?: string
['x-component-props']?: { [name: string]: any }
['x-render']?: <T = ISchemaFieldComponentProps>(
props: T & {
renderComponent: () => React.ReactElement
}
) => React.ReactElement
['x-effect']?: (
dispatch: (type: string, payload: any) => void,
option?: object
) => { [key: string]: any }
}
```


#### IFormActions
Expand All @@ -2825,6 +2885,9 @@ interface IFormActions {
payload: any //onSubmit回调函数返回值
}>
/** 获取当前表单Schema **/
getFormSchema(): Schema
/*
* 清空错误消息,可以通过传FormPathPattern来批量或精确控制要清空的字段,
* 比如clearErrors("*(aa,bb,cc)")
Expand Down Expand Up @@ -2964,6 +3027,10 @@ interface IFormAsyncActions {
submit(
onSubmit?: (values: IFormState['values']) => void | Promise<any>
): Promise<IFormSubmitResult>
/** 获取当前表单Schema **/
getFormSchema(): Promise<Schema>
/*
* 重置表单
*/
Expand Down
Loading

0 comments on commit 84d2bf1

Please sign in to comment.