Skip to content

Commit 760a894

Browse files
chore: resolve conflict
2 parents a900663 + 2fee34a commit 760a894

File tree

60 files changed

+1521
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1521
-459
lines changed

db/TDesign.db

0 Bytes
Binary file not shown.

packages/products/tdesign-miniprogram/packages/components/config-provider/README.en-US.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ name | type | default | description | required
100100
confirm | String | - | confirm text | N
101101
reset | String | - | reset text | N
102102

103+
### FormConfig
104+
105+
name | type | default | description | required
106+
-- | -- | -- | -- | --
107+
colon-text | String | - | colon on the right of label ":" | N
108+
error-message | Object | - | Typescript: `FormErrorMessage`[Form API Documents](./form?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/config-provider/type.ts) | N
109+
required-mark | Boolean | true | \- | N
110+
required-mark-position | String | left | Display position of required symbols。options: left/right | N
111+
103112
### GuideConfig
104113

105114
name | type | default | description | required

packages/products/tdesign-miniprogram/packages/components/config-provider/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ year-label | String | - | 语言配置,“年” 描述文本 | N
100100
confirm | String | - | 语言配置,“确定” 按钮描述文本 | N
101101
reset | String | - | 语言配置,“重置” 按钮描述文本 | N
102102

103+
### FormConfig
104+
105+
名称 | 类型 | 默认值 | 描述 | 必传
106+
-- | -- | -- | -- | --
107+
colon-text | String | - | 字段旁边的冒号,中文为“:” | N
108+
error-message | Object | - | 表单错误信息配置,示例:`{ idcard: '请输入正确的身份证号码', max: '字符长度不能超过 ${max}' }`。TS 类型:`FormErrorMessage`[Form API Documents](./form?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/config-provider/type.ts) | N
109+
required-mark | Boolean | true | 是否显示必填符号(*),默认显示 | N
110+
required-mark-position | String | left | 表单必填符号(*)显示位置。可选项:left/right | N
111+
103112
### GuideConfig
104113

105114
名称 | 类型 | 默认值 | 描述 | 必传

packages/products/tdesign-miniprogram/packages/components/config-provider/type.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
55
* */
66

7+
import { FormErrorMessage } from '../form/index';
78
import { ImageProps } from '../image/index';
89

910
export interface TdConfigProviderProps {
@@ -231,6 +232,28 @@ export interface DropdownMenuConfig {
231232
reset?: string;
232233
}
233234

235+
export interface FormConfig {
236+
/**
237+
* 字段旁边的冒号,中文为“:”
238+
* @default ''
239+
*/
240+
colonText?: string;
241+
/**
242+
* 表单错误信息配置,示例:`{ idcard: '请输入正确的身份证号码', max: '字符长度不能超过 ${max}' }`
243+
*/
244+
errorMessage?: FormErrorMessage;
245+
/**
246+
* 是否显示必填符号(*),默认显示
247+
* @default true
248+
*/
249+
requiredMark?: boolean;
250+
/**
251+
* 表单必填符号(*)显示位置
252+
* @default left
253+
*/
254+
requiredMarkPosition?: 'left' | 'right';
255+
}
256+
234257
export interface GuideConfig {
235258
/**
236259
* 语言配置, “返回” 描述文本
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5+
* */
6+
7+
import { TdFormItemProps } from './type';
8+
const props: TdFormItemProps = {
9+
/** 是否显示右侧箭头 */
10+
arrow: {
11+
type: Boolean,
12+
value: false,
13+
},
14+
/** 表单项说明内容 */
15+
help: {
16+
type: String,
17+
},
18+
/** 字段标签名称 */
19+
label: {
20+
type: String,
21+
value: '',
22+
},
23+
/** 表单字段标签对齐方式:左对齐、右对齐、顶部对齐。默认使用 Form 的对齐方式,优先级高于 Form.labelAlign */
24+
labelAlign: {
25+
type: String,
26+
},
27+
/** 可以整体设置标签宽度,优先级高于 Form.labelWidth */
28+
labelWidth: {
29+
type: null,
30+
},
31+
/** 表单字段名称 */
32+
name: {
33+
type: String,
34+
value: '',
35+
},
36+
/** 是否显示必填符号(*),优先级高于 Form.requiredMark */
37+
requiredMark: {
38+
type: null,
39+
value: undefined,
40+
},
41+
/** 表单字段校验规则 */
42+
rules: {
43+
type: Array,
44+
},
45+
/** 校验不通过时,是否显示错误提示信息,优先级高于 `Form.showErrorMessage` */
46+
showErrorMessage: {
47+
type: null,
48+
value: undefined,
49+
},
50+
};
51+
52+
export default props;
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5+
* */
6+
7+
import { FormRule } from '../form/index';
8+
9+
export interface TdFormItemProps {
10+
/**
11+
* 是否显示右侧箭头
12+
* @default false
13+
*/
14+
arrow?: {
15+
type: BooleanConstructor;
16+
value?: boolean;
17+
};
18+
/**
19+
* 表单项说明内容
20+
*/
21+
help?: {
22+
type: StringConstructor;
23+
value?: string;
24+
};
25+
/**
26+
* 字段标签名称
27+
* @default ''
28+
*/
29+
label?: {
30+
type: StringConstructor;
31+
value?: string;
32+
};
33+
/**
34+
* 表单字段标签对齐方式:左对齐、右对齐、顶部对齐。默认使用 Form 的对齐方式,优先级高于 Form.labelAlign
35+
*/
36+
labelAlign?: {
37+
type: StringConstructor;
38+
value?: 'left' | 'right' | 'top';
39+
};
40+
/**
41+
* 可以整体设置标签宽度,优先级高于 Form.labelWidth
42+
*/
43+
labelWidth?: {
44+
type: null;
45+
value?: string | number;
46+
};
47+
/**
48+
* 表单字段名称
49+
* @default ''
50+
*/
51+
name?: {
52+
type: StringConstructor;
53+
value?: string;
54+
};
55+
/**
56+
* 是否显示必填符号(*),优先级高于 Form.requiredMark
57+
*/
58+
requiredMark?: {
59+
type: BooleanConstructor;
60+
value?: boolean;
61+
};
62+
/**
63+
* 表单字段校验规则
64+
*/
65+
rules?: {
66+
type: ArrayConstructor;
67+
value?: Array<FormRule>;
68+
};
69+
/**
70+
* 校验不通过时,是否显示错误提示信息,优先级高于 `Form.showErrorMessage`
71+
*/
72+
showErrorMessage?: {
73+
type: BooleanConstructor;
74+
value?: boolean;
75+
};
76+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
:: BASE_DOC ::
2+
3+
## API
4+
5+
### Form Props
6+
7+
name | type | default | description | required
8+
-- | -- | -- | -- | --
9+
style | Object | - | CSS(Cascading Style Sheets) | N
10+
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
11+
colon | Boolean | false | \- | N
12+
data | Object | {} | Typescript: `FormData` | N
13+
error-message | Object | - | Typescript: `FormErrorMessage` | N
14+
label-align | String | right | options: left/right/top | N
15+
label-width | String / Number | '81px' | \- | N
16+
required-mark | Boolean | true | \- | N
17+
required-mark-position | String | left | Display position of required symbols。options: left/right | N
18+
reset-type | String | empty | options: empty/initial | N
19+
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+
scroll-to-first-error | String | - | options: ''/smooth/auto | N
21+
show-error-message | Boolean | true | \- | N
22+
submit-with-warning-message | Boolean | false | \- | N
23+
24+
### Form Events
25+
26+
name | params | description
27+
-- | -- | --
28+
reset | `(detail: { e?: FormResetEvent })` | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/common/common.ts)
29+
submit | `(context: 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/>
30+
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/>
31+
32+
### FormInstanceFunctions 组件实例方法
33+
34+
name | params | return | description
35+
-- | -- | -- | --
36+
clear-validate | `(fields?: Array<keyof FormData>)` | \- | required
37+
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/>
38+
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/>
39+
submit | `(params?: { showErrorMessage?: boolean })` | \- | required
40+
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+
42+
43+
### FormItem Props
44+
45+
name | type | default | description | required
46+
-- | -- | -- | -- | --
47+
style | Object | - | CSS(Cascading Style Sheets) | N
48+
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
49+
arrow | Boolean | false | \- | N
50+
help | String | - | \- | N
51+
label | String | '' | \- | N
52+
label-align | String | - | options: left/right/top | N
53+
label-width | String / Number | - | \- | N
54+
name | String | - | \- | N
55+
required-mark | Boolean | undefined | \- | N
56+
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
57+
show-error-message | Boolean | undefined | \- | N
58+
59+
### FormItem Slots
60+
61+
name | Description
62+
-- | --
63+
help | \-
64+
label | \-
65+
66+
### FormRule
67+
68+
name | type | default | description | required
69+
-- | -- | -- | -- | --
70+
boolean | Boolean | - | \- | N
71+
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
72+
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+
enum | Array | - | Typescript: `Array<string>` | N
74+
idcard | Boolean | - | \- | N
75+
len | Number / Boolean | - | \- | N
76+
max | Number / Boolean | - | \- | N
77+
message | String | - | \- | N
78+
min | Number / Boolean | - | \- | N
79+
number | Boolean | - | \- | N
80+
pattern | String / Object | - | Typescript: `RegExp \| string` | N
81+
required | Boolean | - | \- | N
82+
telnumber | Boolean | - | \- | N
83+
trigger | String | change | Typescript: `ValidateTriggerType` | N
84+
type | String | error | options: error/warning | N
85+
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
86+
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+
whitespace | Boolean | - | \- | N
88+
89+
### FormErrorMessage
90+
91+
name | type | default | description | required
92+
-- | -- | -- | -- | --
93+
boolean | String | - | \- | N
94+
date | String | - | \- | N
95+
enum | String | - | \- | N
96+
idcard | String | - | \- | N
97+
len | String | - | \- | N
98+
max | String | - | \- | N
99+
min | String | - | \- | N
100+
number | String | - | \- | N
101+
pattern | String | - | \- | N
102+
required | String | - | \- | N
103+
telnumber | String | - | \- | N
104+
url | String | - | \- | N
105+
validator | String | - | \- | N
106+
whitespace | String | - | \- | N

0 commit comments

Comments
 (0)