Skip to content

Commit ef27927

Browse files
authored
Merge pull request #674 from Tencent/feature/fix_form
`TDForm`: 修改form文档
2 parents 1608829 + aced622 commit ef27927

Some content is hidden

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

49 files changed

+2168
-498
lines changed

tdesign-component/demo_tool/all_build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
./bin/api_tool_linux generate --folder ../lib/src/components/checkbox --name TDCheckbox,TDCheckboxGroup --folder-name checkbox --output ../example/assets/api/ --only-api
4343
# date_picker
4444
./bin/api_tool_linux generate --folder ../lib/src/components/picker --name TDPicker,TDDatePicker --folder-name date-time-picker --output ../example/assets/api/ --only-api
45+
# form
46+
./bin/api_tool_linux generate --folder ../lib/src/components/form --name TDForm,TDFormItem,TDFormItemType,TDFormValidation --folder-name form --output ../example/assets/api/ --only-api
4547
# input
4648
./bin/api_tool_linux generate --file ../lib/src/components/input/td_input.dart --name TDInput, TDInputSpacer --folder-name input --output ../example/assets/api/ --only-api
4749
# picker
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
## API
2-
### TDButton
2+
### TDButtonStyle
3+
#### 默认构造方法
4+
5+
| 参数 | 类型 | 默认值 | 说明 |
6+
| --- | --- | --- | --- |
7+
| backgroundColor | Color? | - | 背景颜色 |
8+
| frameColor | Color? | - | 边框颜色 |
9+
| textColor | Color? | - | 文字颜色 |
10+
| frameWidth | double? | - | 边框宽度 |
11+
| radius | BorderRadiusGeometry? | - | 自定义圆角 |
12+
13+
14+
#### 工厂构造方法
15+
16+
| 名称 | 说明 |
17+
| --- | --- |
18+
| TDButtonStyle.generateFillStyleByTheme | 生成不同主题的填充按钮样式 |
19+
| TDButtonStyle.generateOutlineStyleByTheme | 生成不同主题的描边按钮样式 |
20+
| TDButtonStyle.generateTextStyleByTheme | 生成不同主题的文本按钮样式 |
21+
| TDButtonStyle.generateGhostStyleByTheme | 生成不同主题的幽灵按钮样式 |
22+
23+
```
24+
```
25+
### TDButton
326
#### 默认构造方法
427

528
| 参数 | 类型 | 默认值 | 说明 |
@@ -28,26 +51,3 @@
2851
| margin | EdgeInsetsGeometry? | - | 自定义margin |
2952
| padding | EdgeInsetsGeometry? | - | 自定义padding |
3053
| iconPosition | TDButtonIconPosition? | TDButtonIconPosition.left | 图标位置 |
31-
32-
```
33-
```
34-
### TDButtonStyle
35-
#### 默认构造方法
36-
37-
| 参数 | 类型 | 默认值 | 说明 |
38-
| --- | --- | --- | --- |
39-
| backgroundColor | Color? | - | 背景颜色 |
40-
| frameColor | Color? | - | 边框颜色 |
41-
| textColor | Color? | - | 文字颜色 |
42-
| frameWidth | double? | - | 边框宽度 |
43-
| radius | BorderRadiusGeometry? | - | 自定义圆角 |
44-
45-
46-
#### 工厂构造方法
47-
48-
| 名称 | 说明 |
49-
| --- | --- |
50-
| TDButtonStyle.generateFillStyleByTheme | 生成不同主题的填充按钮样式 |
51-
| TDButtonStyle.generateOutlineStyleByTheme | 生成不同主题的描边按钮样式 |
52-
| TDButtonStyle.generateTextStyleByTheme | 生成不同主题的文本按钮样式 |
53-
| TDButtonStyle.generateGhostStyleByTheme | 生成不同主题的幽灵按钮样式 |

tdesign-component/example/assets/api/calendar_api.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
## API
2-
### TDCalendar
2+
### TDCalendarStyle
3+
#### 默认构造方法
4+
5+
| 参数 | 类型 | 默认值 | 说明 |
6+
| --- | --- | --- | --- |
7+
| decoration | | - | |
8+
| titleStyle | TextStyle? | - | header区域 [TDCalendar.title]的样式 |
9+
| titleMaxLine | int? | - | header区域 [TDCalendar.title]的行数 |
10+
| titleCloseColor | Color? | - | header区域 关闭图标的颜色 |
11+
| weekdayStyle | TextStyle? | - | header区域 周 文字样式 |
12+
| monthTitleStyle | TextStyle? | - | body区域 年月文字样式 |
13+
| cellStyle | TextStyle? | - | 日期样式 |
14+
| centreColor | Color? | - | 日期范围内背景样式 |
15+
| cellDecoration | BoxDecoration? | - | 日期decoration |
16+
| cellPrefixStyle | TextStyle? | - | 日期前面的字符串的样式 |
17+
| cellSuffixStyle | TextStyle? | - | 日期后面的字符串的样式 |
18+
19+
20+
#### 工厂构造方法
21+
22+
| 名称 | 说明 |
23+
| --- | --- |
24+
| TDCalendarStyle.generateStyle | 生成默认样式 |
25+
| TDCalendarStyle.cellStyle | 日期样式 |
26+
27+
```
28+
```
29+
### TDCalendar
330
#### 默认构造方法
431

532
| 参数 | 类型 | 默认值 | 说明 |
@@ -30,33 +57,7 @@
3057
| pickerItemCount | int? | 3 | 选择器List视窗中item个数,pickerHeight / pickerItemCount即item高度 |
3158
| isTimeUnit | bool? | true | 是否显示时间单位 |
3259
| animateTo | bool? | false | 动画滚动到指定位置 |
33-
34-
```
35-
```
36-
### TDCalendarStyle
37-
#### 默认构造方法
38-
39-
| 参数 | 类型 | 默认值 | 说明 |
40-
| --- | --- | --- | --- |
41-
| decoration | | - | |
42-
| titleStyle | TextStyle? | - | header区域 [TDCalendar.title]的样式 |
43-
| titleMaxLine | int? | - | header区域 [TDCalendar.title]的行数 |
44-
| titleCloseColor | Color? | - | header区域 关闭图标的颜色 |
45-
| weekdayStyle | TextStyle? | - | header区域 周 文字样式 |
46-
| monthTitleStyle | TextStyle? | - | body区域 年月文字样式 |
47-
| cellStyle | TextStyle? | - | 日期样式 |
48-
| centreColor | Color? | - | 日期范围内背景样式 |
49-
| cellDecoration | BoxDecoration? | - | 日期decoration |
50-
| cellPrefixStyle | TextStyle? | - | 日期前面的字符串的样式 |
51-
| cellSuffixStyle | TextStyle? | - | 日期后面的字符串的样式 |
52-
53-
54-
#### 工厂构造方法
55-
56-
| 名称 | 说明 |
57-
| --- | --- |
58-
| TDCalendarStyle.generateStyle | 生成默认样式 |
59-
| TDCalendarStyle.cellStyle | 日期样式 |
60+
| cellWidget | Widget? Function(BuildContext context, TDate tdate, DateSelectType selectType)? | - | 自定义日期单元格组件 |
6061

6162
```
6263
```

tdesign-component/example/assets/api/checkbox_api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
| titleColor | Color? | - | 标题文字颜色 |
3131
| subTitleColor | Color? | - | 副标题文字颜色 |
3232
| checkBoxLeftSpace | double? | - | 选项框左侧间距 |
33+
| customSpace | EdgeInsetsGeometry? | - | 自定义组件间距 |
3334

3435
```
3536
```

tdesign-component/example/assets/api/date-time-picker_api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@
4040
| --- | --- | --- | --- |
4141
| showDatePicker | | required null context, required String title, required DatePickerCallback? onConfirm, DatePickerCallback? onCancel, bool useYear, bool useMonth, bool useDay, bool useHour, bool useMinute, bool useSecond, bool useWeekDay, Color? barrierColor, List<int> dateStart, List<int>? dateEnd, List<int>? initialDate, String? rightText, String? leftText, TextStyle? leftTextStyle, TextStyle? centerTextStyle, TextStyle? rightTextStyle, Color? titleDividerColor, Widget? customSelectWidget, Duration duration, double pickerHeight, bool isTimeUnit, Function(int wheelIndex, int index)? onSelectedItemChanged, int pickerItemCount, List<int> Function(DateTypeKey key, List<int> nums)? filterItems, ItemBuilderType? itemBuilder, | 显示时间选择器 |
4242
| showMultiPicker | | required null context, String? title, required MultiPickerCallback? onConfirm, MultiPickerCallback? onCancel, required List<List<String>> data, List<int>? initialIndexes, Duration duration, Color? barrierColor, double pickerHeight, String? rightText, String? leftText, TextStyle? leftTextStyle, TextStyle? centerTextStyle, TextStyle? rightTextStyle, Color? titleDividerColor, double? topPadding, int pickerItemCount, Widget? customSelectWidget, ItemBuilderType? itemBuilder, | 显示多级选择器 |
43-
| showMultiLinkedPicker | | required null context, String? title, required MultiPickerCallback? onConfirm, MultiPickerCallback? onCancel, required Map data, required int columnNum, required List initialData, Duration duration, Color? barrierColor, String? rightText, String? leftText, TextStyle? leftTextStyle, TextStyle? centerTextStyle, TextStyle? rightTextStyle, double pickerHeight, Color? titleDividerColor, Widget? customSelectWidget, double? topPadding, int pickerItemCount, | 显示多级联动选择器 |
43+
| showMultiLinkedPicker | | required null context, String? title, required MultiPickerCallback? onConfirm, MultiPickerCallback? onCancel, required Map data, required int columnNum, required List initialData, Duration duration, Color? barrierColor, String? rightText, String? leftText, TextStyle? leftTextStyle, TextStyle? centerTextStyle, TextStyle? rightTextStyle, double pickerHeight, Color? titleDividerColor, Widget? customSelectWidget, double? topPadding, bool keepSameSelection, int pickerItemCount, | 显示多级联动选择器 |

tdesign-component/example/assets/api/dialog_api.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,42 @@
11
## API
2-
### TDDialogButtonOptions
3-
#### 默认构造方法
4-
5-
| 参数 | 类型 | 默认值 | 说明 |
6-
| --- | --- | --- | --- |
7-
| title | String | - | 标题内容 |
8-
| action | Function()? | - | 点击操作 |
9-
| titleColor | Color? | - | 标题颜色 |
10-
| titleSize | double? | - | 字体大小 |
11-
| style | TDButtonStyle? | - | 按钮样式 |
12-
| type | TDButtonType? | - | 按钮类型 |
13-
| theme | TDButtonTheme? | - | 按钮类型 |
14-
| height | double? | - | 按钮高度 |
15-
| fontWeight | FontWeight? | - | 字体粗细 |
16-
17-
```
18-
```
19-
### TDInputDialog
2+
### TDImageDialog
203
#### 默认构造方法
214

225
| 参数 | 类型 | 默认值 | 说明 |
236
| --- | --- | --- | --- |
247
| key | | - | |
25-
| textEditingController | TextEditingController | - | 输入controller |
8+
| image | Image | - | 图片 |
9+
| imagePosition | TDDialogImagePosition? | TDDialogImagePosition.top | 图片位置 |
2610
| backgroundColor | Color | Colors.white | 背景颜色 |
2711
| radius | double | 12.0 | 圆角 |
2812
| title | String? | - | 标题 |
2913
| titleColor | Color | const Color(0xE6000000) | 标题颜色 |
3014
| titleAlignment | AlignmentGeometry? | - | 标题对齐模式 |
3115
| contentWidget | Widget? | - | 内容Widget |
3216
| content | String? | - | 内容 |
33-
| hintText | String? | '' | 输入提示 |
3417
| contentColor | Color? | - | 内容颜色 |
3518
| leftBtn | TDDialogButtonOptions? | - | 左侧按钮配置 |
3619
| rightBtn | TDDialogButtonOptions? | - | 右侧按钮配置 |
3720
| showCloseButton | bool? | - | 显示右上角关闭按钮 |
38-
| padding | EdgeInsets? | const EdgeInsets.fromLTRB(24, 32, 24, 0) | 内容内边距 |
21+
| padding | EdgeInsets? | - | 内容内边距 |
3922
| buttonWidget | Widget? | - | 自定义按钮 |
40-
| customInputWidget | Widget? | - | 自定义输入框 |
23+
24+
```
25+
```
26+
### TDDialogButtonOptions
27+
#### 默认构造方法
28+
29+
| 参数 | 类型 | 默认值 | 说明 |
30+
| --- | --- | --- | --- |
31+
| title | String | - | 标题内容 |
32+
| action | Function()? | - | 点击操作 |
33+
| titleColor | Color? | - | 标题颜色 |
34+
| titleSize | double? | - | 字体大小 |
35+
| style | TDButtonStyle? | - | 按钮样式 |
36+
| type | TDButtonType? | - | 按钮类型 |
37+
| theme | TDButtonTheme? | - | 按钮类型 |
38+
| height | double? | - | 按钮高度 |
39+
| fontWeight | FontWeight? | - | 字体粗细 |
4140

4241
```
4342
```
@@ -66,27 +65,28 @@
6665

6766
```
6867
```
69-
### TDImageDialog
68+
### TDInputDialog
7069
#### 默认构造方法
7170

7271
| 参数 | 类型 | 默认值 | 说明 |
7372
| --- | --- | --- | --- |
7473
| key | | - | |
75-
| image | Image | - | 图片 |
76-
| imagePosition | TDDialogImagePosition? | TDDialogImagePosition.top | 图片位置 |
74+
| textEditingController | TextEditingController | - | 输入controller |
7775
| backgroundColor | Color | Colors.white | 背景颜色 |
7876
| radius | double | 12.0 | 圆角 |
7977
| title | String? | - | 标题 |
8078
| titleColor | Color | const Color(0xE6000000) | 标题颜色 |
8179
| titleAlignment | AlignmentGeometry? | - | 标题对齐模式 |
8280
| contentWidget | Widget? | - | 内容Widget |
8381
| content | String? | - | 内容 |
82+
| hintText | String? | '' | 输入提示 |
8483
| contentColor | Color? | - | 内容颜色 |
8584
| leftBtn | TDDialogButtonOptions? | - | 左侧按钮配置 |
8685
| rightBtn | TDDialogButtonOptions? | - | 右侧按钮配置 |
8786
| showCloseButton | bool? | - | 显示右上角关闭按钮 |
88-
| padding | EdgeInsets? | - | 内容内边距 |
87+
| padding | EdgeInsets? | const EdgeInsets.fromLTRB(24, 32, 24, 0) | 内容内边距 |
8988
| buttonWidget | Widget? | - | 自定义按钮 |
89+
| customInputWidget | Widget? | - | 自定义输入框 |
9090

9191
```
9292
```
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
## API
2-
### TDDrawerWidget
2+
### TDDrawer
33
#### 简介
4-
抽屉内容组件
5-
可用于Scaffold中的drawer属性
4+
抽屉组件
65
#### 默认构造方法
76

87
| 参数 | 类型 | 默认值 | 说明 |
98
| --- | --- | --- | --- |
10-
| key | | - | |
9+
| context | BuildContext | context | 上下文 |
10+
| closeOnOverlayClick | bool? | true | 点击蒙层时是否关闭抽屉 |
1111
| footer | Widget? | - | 抽屉的底部 |
1212
| items | List<TDDrawerItem>? | - | 抽屉里的列表项 |
13-
| contentWidget | Widget? | - | 自定义内容,优先级高于[items]/[footer]/[title] |
13+
| placement | TDDrawerPlacement? | TDDrawerPlacement.right | 抽屉方向 |
14+
| showOverlay | bool? | true | 是否显示遮罩层 |
1415
| title | String? | - | 抽屉的标题 |
1516
| titleWidget | Widget? | - | 抽屉的标题组件 |
17+
| visible | bool? | - | 组件是否可见 |
18+
| onClose | VoidCallback? | - | 关闭时触发 |
1619
| onItemClick | TDDrawerItemClickCallback? | - | 点击抽屉里的列表项触发 |
1720
| width | double? | 280 | 宽度 |
21+
| drawerTop | double? | - | 距离顶部的距离 |
1822
| style | TDCellStyle? | - | 列表自定义样式 |
1923
| hover | bool? | true | 是否开启点击反馈 |
2024
| backgroundColor | Color? | - | 组件背景颜色 |
2125
| bordered | bool? | true | 是否显示边框 |
2226
| isShowLastBordered | bool? | true | 是否显示最后一行分割线 |
27+
| contentWidget | Widget? | - | 自定义内容,优先级高于[items]/[footer]/[title] |
2328

2429
```
2530
```
26-
### TDDrawerItem
27-
#### 简介
28-
抽屉里的列表项
29-
#### 默认构造方法
30-
31-
| 参数 | 类型 | 默认值 | 说明 |
32-
| --- | --- | --- | --- |
33-
| title | String? | - | 每列标题 |
34-
| icon | Widget? | - | 每列图标 |
35-
| content | Widget? | - | 完全自定义 |
36-
37-
```
38-
```
39-
### TDDrawer
31+
### TDDrawerWidget
4032
#### 简介
41-
抽屉组件
33+
抽屉内容组件
34+
可用于Scaffold中的drawer属性
4235
#### 默认构造方法
4336

4437
| 参数 | 类型 | 默认值 | 说明 |
4538
| --- | --- | --- | --- |
46-
| context | BuildContext | context | 上下文 |
47-
| closeOnOverlayClick | bool? | true | 点击蒙层时是否关闭抽屉 |
39+
| key | | - | |
4840
| footer | Widget? | - | 抽屉的底部 |
4941
| items | List<TDDrawerItem>? | - | 抽屉里的列表项 |
50-
| placement | TDDrawerPlacement? | TDDrawerPlacement.right | 抽屉方向 |
51-
| showOverlay | bool? | true | 是否显示遮罩层 |
42+
| contentWidget | Widget? | - | 自定义内容,优先级高于[items]/[footer]/[title] |
5243
| title | String? | - | 抽屉的标题 |
5344
| titleWidget | Widget? | - | 抽屉的标题组件 |
54-
| visible | bool? | - | 组件是否可见 |
55-
| onClose | VoidCallback? | - | 关闭时触发 |
5645
| onItemClick | TDDrawerItemClickCallback? | - | 点击抽屉里的列表项触发 |
5746
| width | double? | 280 | 宽度 |
58-
| drawerTop | double? | - | 距离顶部的距离 |
5947
| style | TDCellStyle? | - | 列表自定义样式 |
6048
| hover | bool? | true | 是否开启点击反馈 |
6149
| backgroundColor | Color? | - | 组件背景颜色 |
6250
| bordered | bool? | true | 是否显示边框 |
6351
| isShowLastBordered | bool? | true | 是否显示最后一行分割线 |
64-
| contentWidget | Widget? | - | 自定义内容,优先级高于[items]/[footer]/[title] |
52+
53+
```
54+
```
55+
### TDDrawerItem
56+
#### 简介
57+
抽屉里的列表项
58+
#### 默认构造方法
59+
60+
| 参数 | 类型 | 默认值 | 说明 |
61+
| --- | --- | --- | --- |
62+
| title | String? | - | 每列标题 |
63+
| icon | Widget? | - | 每列图标 |
64+
| content | Widget? | - | 完全自定义 |

0 commit comments

Comments
 (0)