@@ -9,15 +9,15 @@ name | type | default | description | required
99style | Object | - | CSS(Cascading Style Sheets) | N
1010custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
1111colon | Boolean | false | \- | N
12- content-align | String | left | options: left/right | N
12+ content-align | String | left | options: left/center/ right | N
1313data | Object | {} | Typescript: ` FormData ` | N
1414error-message | Object | - | Typescript: ` FormErrorMessage ` | N
1515label-align | String | right | options: left/right/top | N
1616label-width | String / Number | '81px' | \- | N
1717required-mark | Boolean | true | \- | N
18- required-mark-position | String | left | Display position of required symbols。 options: left/right | N
18+ required-mark-position | String | left | Display position of required symbols. options: left/right | N
1919reset-type | String | empty | options: empty/initial | N
20- rules | Object | - | Typescript: ` FormRules<FormData> ` ` type FormRules<T extends Data = any> = { [field in keyof T]?: Array<FormRule> } ` 。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
20+ rules | Object | - | Typescript: ` FormRules<FormData> ` ` type FormRules<T extends Data = any> = { [field in keyof T]?: Array<FormRule> } ` . [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
2121scroll-to-first-error | String | - | options: ''/smooth/auto | N
2222show-error-message | Boolean | true | \- | N
2323submit-with-warning-message | Boolean | false | \- | N
@@ -27,18 +27,18 @@ submit-with-warning-message | Boolean | false | \- | N
2727name | params | description
2828-- | -- | --
2929reset | ` (detail: { e?: FormResetEvent }) ` | [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/common/common.ts )
30- submit | ` (detail: SubmitContext<FormData>) ` | [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) 。 <br />` interface SubmitContext<T extends Data = Data> { e?: FormSubmitEvent; validateResult: FormValidateResult<T>; firstError?: string; fields?: any } ` <br /><br />` type FormValidateResult<T> = boolean \| ValidateResultObj<T> ` <br /><br />` type ValidateResultObj<T> = { [key in keyof T]: boolean \| ValidateResultList } ` <br /><br />` type ValidateResultList = Array<AllValidateResult> ` <br /><br />` type AllValidateResult = CustomValidateObj \| ValidateResultType ` <br /><br />` interface ValidateResultType extends FormRule { result: boolean } ` <br /><br />` type ValidateResult<T> = { [key in keyof T]: boolean \| ErrorList } ` <br /><br />` type ErrorList = Array<FormRule> ` <br />
31- validate | ` (result: ValidateResultContext<FormData>) ` | [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) 。 <br />` type ValidateResultContext<T extends Data> = Omit<SubmitContext<T>, 'e'> ` <br />
30+ submit | ` (detail: SubmitContext<FormData>) ` | [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) . <br />` interface SubmitContext<T extends Data = Data> { e?: FormSubmitEvent; validateResult: FormValidateResult<T>; firstError?: string; fields?: any } ` <br /><br />` type FormValidateResult<T> = boolean \| ValidateResultObj<T> ` <br /><br />` type ValidateResultObj<T> = { [key in keyof T]: boolean \| ValidateResultList } ` <br /><br />` type ValidateResultList = Array<AllValidateResult> ` <br /><br />` type AllValidateResult = CustomValidateObj \| ValidateResultType ` <br /><br />` interface ValidateResultType extends FormRule { result: boolean } ` <br /><br />` type ValidateResult<T> = { [key in keyof T]: boolean \| ErrorList } ` <br /><br />` type ErrorList = Array<FormRule> ` <br />
31+ validate | ` (result: ValidateResultContext<FormData>) ` | [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) . <br />` type ValidateResultContext<T extends Data> = Omit<SubmitContext<T>, 'e'> ` <br />
3232
3333### FormInstanceFunctions 组件实例方法
3434
3535name | params | return | description
3636-- | -- | -- | --
3737clear-validate | ` (fields?: Array<keyof FormData>) ` | \- | required
38- reset | ` (params?: FormResetParams<FormData>) ` | \- | required。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) 。 <br />` interface FormResetParams<FormData> { type?: 'initial' \| 'empty'; fields?: Array<keyof FormData> } ` <br />
39- set-validate-message | ` (message: FormValidateMessage<FormData>) ` | \- | required。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) 。 <br />` type FormValidateMessage<FormData> = { [field in keyof FormData]: FormItemValidateMessage[] } ` <br /><br />` interface FormItemValidateMessage { type: 'warning' \| 'error'; message: string } ` <br />
38+ reset | ` (params?: FormResetParams<FormData>) ` | \- | required. [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) . <br />` interface FormResetParams<FormData> { type?: 'initial' \| 'empty'; fields?: Array<keyof FormData> } ` <br />
39+ set-validate-message | ` (message: FormValidateMessage<FormData>) ` | \- | required. [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) . <br />` type FormValidateMessage<FormData> = { [field in keyof FormData]: FormItemValidateMessage[] } ` <br /><br />` interface FormItemValidateMessage { type: 'warning' \| 'error'; message: string } ` <br />
4040submit | ` (params?: { showErrorMessage?: boolean }) ` | \- | required
41- validate | ` (params?: FormValidateParams) ` | ` Promise<FormValidateResult<FormData>> ` | required。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) 。 <br />` interface FormValidateParams { fields?: Array<string>; showErrorMessage?: boolean; trigger?: ValidateTriggerType } ` <br /><br />` type ValidateTriggerType = 'blur' \| 'change' \| 'submit' \| 'all' ` <br /><br />` type FormValidateResult<T> = boolean \| ValidateResultObj<T> ` <br /><br />` type ValidateResultObj<T> = { [key in keyof T]: boolean \| ValidateResultList } ` <br /><br />` type ValidateResultList = Array<AllValidateResult> ` <br /><br />` type AllValidateResult = CustomValidateObj \| ValidateResultType ` <br /><br />` interface ValidateResultType extends FormRule { result: boolean } ` <br />
41+ validate | ` (params?: FormValidateParams) ` | ` Promise<FormValidateResult<FormData>> ` | required. [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) . <br />` interface FormValidateParams { fields?: Array<string>; showErrorMessage?: boolean; trigger?: ValidateTriggerType } ` <br /><br />` type ValidateTriggerType = 'blur' \| 'change' \| 'submit' \| 'all' ` <br /><br />` type FormValidateResult<T> = boolean \| ValidateResultObj<T> ` <br /><br />` type ValidateResultObj<T> = { [key in keyof T]: boolean \| ValidateResultList } ` <br /><br />` type ValidateResultList = Array<AllValidateResult> ` <br /><br />` type AllValidateResult = CustomValidateObj \| ValidateResultType ` <br /><br />` interface ValidateResultType extends FormRule { result: boolean } ` <br />
4242
4343
4444### FormItem Props
@@ -48,14 +48,14 @@ name | type | default | description | required
4848style | Object | - | CSS(Cascading Style Sheets) | N
4949custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
5050arrow | Boolean | false | \- | N
51- content-align | String | - | options: left/right | N
51+ content-align | String | - | options: left/center/ right | N
5252help | String | - | \- | N
5353label | String | '' | \- | N
5454label-align | String | - | options: left/right/top | N
5555label-width | String / Number | - | \- | N
5656name | String | - | \- | N
5757required-mark | Boolean | undefined | \- | N
58- rules | Array | - | Typescript: ` Array<FormRule> ` ,[ Form API Documents] ( ./form?tab=api ) 。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form-item/type.ts ) | N
58+ rules | Array | - | Typescript: ` Array<FormRule> ` ,[ Form API Documents] ( ./form?tab=api ) . [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form-item/type.ts ) | N
5959show-error-message | Boolean | undefined | \- | N
6060
6161### FormItem Slots
@@ -70,8 +70,8 @@ label | \-
7070name | type | default | description | required
7171-- | -- | -- | -- | --
7272boolean | Boolean | - | \- | N
73- date | Boolean / Object | - | Typescript: ` boolean \| IsDateOptions ` ` interface IsDateOptions { format: string; strictMode: boolean; delimiters: string[] } ` 。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
74- email | Boolean / Object | - | Typescript: ` boolean \| IsEmailOptions ` ` import { IsEmailOptions } from 'validator/es/lib/isEmail' ` 。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
73+ date | Boolean / Object | - | Typescript: ` boolean \| IsDateOptions ` ` interface IsDateOptions { format: string; strictMode: boolean; delimiters: string[] } ` . [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
74+ email | Boolean / Object | - | Typescript: ` boolean \| IsEmailOptions ` ` import { IsEmailOptions } from 'validator/es/lib/isEmail' ` . [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
7575enum | Array | - | Typescript: ` Array<string> ` | N
7676idcard | Boolean | - | \- | N
7777len | Number / Boolean | - | \- | N
@@ -84,8 +84,8 @@ required | Boolean | - | \- | N
8484telnumber | Boolean | - | \- | N
8585trigger | String | change | Typescript: ` ValidateTriggerType ` | N
8686type | String | error | options: error/warning | N
87- url | Boolean / Object | - | Typescript: ` boolean \| IsURLOptions ` ` import { IsURLOptions } from 'validator/es/lib/isURL' ` 。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
88- validator | Function | - | Typescript: ` CustomValidator ` ` type CustomValidator = (val: ValueType, context?: { formData: Data , name: string }) => CustomValidateResolveType \| Promise<CustomValidateResolveType> ` ` type CustomValidateResolveType = boolean \| CustomValidateObj ` ` interface CustomValidateObj { result: boolean; message: string; type?: 'error' \| 'warning' \| 'success' } ` ` type ValueType = any ` 。 [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
87+ url | Boolean / Object | - | Typescript: ` boolean \| IsURLOptions ` ` import { IsURLOptions } from 'validator/es/lib/isURL' ` . [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
88+ validator | Function | - | Typescript: ` CustomValidator ` ` type CustomValidator = (val: ValueType, context?: { formData: Data , name: string }) => CustomValidateResolveType \| Promise<CustomValidateResolveType> ` ` type CustomValidateResolveType = boolean \| CustomValidateObj ` ` interface CustomValidateObj { result: boolean; message: string; type?: 'error' \| 'warning' \| 'success' } ` ` type ValueType = any ` . [ see more ts definition] ( https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/form/type.ts ) | N
8989whitespace | Boolean | - | \- | N
9090
9191### FormErrorMessage
0 commit comments