Skip to content

Commit

Permalink
featfix(@uform/react-schema-renderer/antd/next) doc and depreacate x-…
Browse files Browse the repository at this point in the history
…render (#557)
  • Loading branch information
JohnIsOnTheRoad authored and janryWang committed Dec 27, 2019
1 parent b6664b7 commit 2bd1503
Show file tree
Hide file tree
Showing 8 changed files with 357 additions and 8 deletions.
87 changes: 87 additions & 0 deletions packages/antd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ npm install --save @uform/antd
- [`ISchemaFieldComponent`](#ISchemaFieldComponent)
- [`ISchemaVirtualFieldComponent`](#ISchemaVirtualFieldComponent)
- [`ISchemaFormRegistry`](#ISchemaFormRegistry)
- [`InternalFormats`](#InternalFormats)
- [`CustomValidator`](#CustomValidator)
- [`ValidateDescription`](#ValidateDescription)
- [`ValidateArrayRules`](#ValidateArrayRules)
- [`ValidatePatternRules`](#ValidatePatternRules)
- [`INextSchemaFieldProps`](#INextSchemaFieldProps)
- [`IPreviewTextProps`](#IPreviewTextProps)
- [`IMutators`](#IMutators)
Expand Down Expand Up @@ -3394,6 +3399,88 @@ interface ISchemaFormRegistry {
}
```

#### InternalFormats

```typescript
type InternalFormats =
| 'url'
| 'email'
| 'ipv6'
| 'ipv4'
| 'idcard'
| 'taodomain'
| 'qq'
| 'phone'
| 'money'
| 'zh'
| 'date'
| 'zip'
| string
```

#### CustomValidator

```typescript
declare type CustomValidator = (
value: any,
rescription?: ValidateDescription
) => ValidateResponse
```

#### ValidateDescription

```typescript
interface ValidateDescription {
// built-in rules,ref: string rules
format?: InternalFormats
// custom validation
validator?: CustomValidator
// required
required?: boolean
// pattern
pattern?: RegExp | string
// max length
max?: number
// maximum
maximum?: number
// exclusiveMaximum
exclusiveMaximum?: number
// exclusiveMinimum
exclusiveMinimum?: number
// minimum
minimum?: number
// min
min?: number
// length
len?: number
// whitespace
whitespace?: boolean
// enum
enum?: any[]
// error message
message?: string
[key: string]: any
}
```

#### ValidateArrayRules

```typescript
declare type ValidateArrayRules = Array<
InternalFormats | CustomValidator | ValidateDescription
>
```

#### ValidatePatternRules

```typescript
declare type ValidatePatternRules =
| InternalFormats
| CustomValidator
| ValidateDescription
| ValidateArrayRules
```

#### INextSchemaFieldProps

```typescript
Expand Down
88 changes: 88 additions & 0 deletions packages/antd/README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ npm install --save @uform/antd
- [`ISchemaFieldComponent`](#ISchemaFieldComponent)
- [`ISchemaVirtualFieldComponent`](#ISchemaVirtualFieldComponent)
- [`ISchemaFormRegistry`](#ISchemaFormRegistry)
- [`InternalFormats`](#InternalFormats)
- [`CustomValidator`](#CustomValidator)
- [`ValidateDescription`](#ValidateDescription)
- [`ValidateArrayRules`](#ValidateArrayRules)
- [`ValidatePatternRules`](#ValidatePatternRules)
- [`INextSchemaFieldProps`](#INextSchemaFieldProps)
- [`IPreviewTextProps`](#IPreviewTextProps)
- [`IMutators`](#IMutators)
Expand Down Expand Up @@ -3509,6 +3514,89 @@ interface ISchemaFormRegistry {
}
```


#### InternalFormats

```typescript
type InternalFormats =
| 'url'
| 'email'
| 'ipv6'
| 'ipv4'
| 'idcard'
| 'taodomain'
| 'qq'
| 'phone'
| 'money'
| 'zh'
| 'date'
| 'zip'
| string
```

#### CustomValidator

```typescript
declare type CustomValidator = (
value: any,
rescription?: ValidateDescription
) => ValidateResponse
```

#### ValidateDescription

```typescript
interface ValidateDescription {
// 内置校验规则,参考string内置校验规则
format?: InternalFormats
// 自定义校验规则
validator?: CustomValidator
// 是否必填
required?: boolean
// 匹配规则
pattern?: RegExp | string
// 最大长度
max?: number
// 最大值(大于)
maximum?: number
// 最大值(大于等于)
exclusiveMaximum?: number
// 最小值(小于等于)
exclusiveMinimum?: number
// 最小值(小于)
minimum?: number
// 最小长度
min?: number
// 长度
len?: number
// 空格
whitespace?: boolean
// 是否包含在枚举列表中
enum?: any[]
// 错误信息
message?: string
[key: string]: any
}
```

#### ValidateArrayRules

```typescript
declare type ValidateArrayRules = Array<
InternalFormats | CustomValidator | ValidateDescription
>
```

#### ValidatePatternRules

```typescript
declare type ValidatePatternRules =
| InternalFormats
| CustomValidator
| ValidateDescription
| ValidateArrayRules
```

#### INextSchemaFieldProps

```typescript
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { StyledComponent } from 'styled-components'

type ColSpanType = number | string

export type IAntdSchemaFormProps = Omit<FormProps, 'onSubmit'> &
export type IAntdSchemaFormProps = Omit<FormProps, 'onSubmit'|'defaultValue'> &
IFormItemTopProps &
PreviewTextConfigProps &
ISchemaFormProps
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,7 @@ export function createForm<FieldProps, VirtualFieldProps>(
return arr
},
validate(opts?: IFormExtendedValidateFieldOptions) {
return validate(
field.getSourceState(state => state.path),
opts
)
return validate(field.getSourceState(state => state.path), opts)
}
}
}
Expand Down
87 changes: 87 additions & 0 deletions packages/next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ npm install --save @uform/next
- [`ISchemaFieldComponent`](#ISchemaFieldComponent)
- [`ISchemaVirtualFieldComponent`](#ISchemaVirtualFieldComponent)
- [`ISchemaFormRegistry`](#ISchemaFormRegistry)
- [`InternalFormats`](#InternalFormats)
- [`CustomValidator`](#CustomValidator)
- [`ValidateDescription`](#ValidateDescription)
- [`ValidateArrayRules`](#ValidateArrayRules)
- [`ValidatePatternRules`](#ValidatePatternRules)
- [`INextSchemaFieldProps`](#INextSchemaFieldProps)
- [`IPreviewTextProps`](#IPreviewTextProps)
- [`IMutators`](#IMutators)
Expand Down Expand Up @@ -3405,6 +3410,88 @@ interface ISchemaFormRegistry {
}
```

#### InternalFormats

```typescript
type InternalFormats =
| 'url'
| 'email'
| 'ipv6'
| 'ipv4'
| 'idcard'
| 'taodomain'
| 'qq'
| 'phone'
| 'money'
| 'zh'
| 'date'
| 'zip'
| string
```

#### CustomValidator

```typescript
declare type CustomValidator = (
value: any,
rescription?: ValidateDescription
) => ValidateResponse
```

#### ValidateDescription

```typescript
interface ValidateDescription {
// built-in rules,ref: string rules
format?: InternalFormats
// custom validation
validator?: CustomValidator
// required
required?: boolean
// pattern
pattern?: RegExp | string
// max length
max?: number
// maximum
maximum?: number
// exclusiveMaximum
exclusiveMaximum?: number
// exclusiveMinimum
exclusiveMinimum?: number
// minimum
minimum?: number
// min
min?: number
// length
len?: number
// whitespace
whitespace?: boolean
// enum
enum?: any[]
// error message
message?: string
[key: string]: any
}
```

#### ValidateArrayRules

```typescript
declare type ValidateArrayRules = Array<
InternalFormats | CustomValidator | ValidateDescription
>
```

#### ValidatePatternRules

```typescript
declare type ValidatePatternRules =
| InternalFormats
| CustomValidator
| ValidateDescription
| ValidateArrayRules
```

#### INextSchemaFieldProps

```typescript
Expand Down
Loading

0 comments on commit 2bd1503

Please sign in to comment.