Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@uform/printer): change getSchema to get FormSchema #482

Merged
merged 1 commit into from
Dec 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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