Skip to content

Commit 83cfe13

Browse files
authored
docs(date-time-picker): filter props add ts type (#3237)
1 parent 4239dcb commit 83cfe13

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/date-time-picker/README.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ cancel-btn | String | 取消 | \- | N
1212
confirm-btn | String | - | \- | N
1313
custom-locale | String | zh | \- | N
1414
end | String / Number | - | \- | N
15-
filter | Function | - | \- | N
15+
filter | Function | - | Typescript:`(type: TimeModeValues, columns: DateTimePickerColumn) => DateTimePickerColumn` `type DateTimePickerColumn = DateTimePickerColumnItem[]` `interface DateTimePickerColumnItem { label: string,value: string}`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
1616
footer | Slot | - | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
1717
format | String | 'YYYY-MM-DD HH:mm:ss' | \- | N
1818
header | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N

src/date-time-picker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ cancel-btn | String | 取消 | 取消按钮文字 | N
6666
confirm-btn | String | - | 确定按钮文字 | N
6767
custom-locale | String | zh | 组件国际化语言,目前支持: 简体中文(zh)、(tc)、英文(en)、日语(ja)、韩语(ko)、俄语(ru)等六种语言 | N
6868
end | String / Number | - | 选择器的最大可选时间,默认为当前时间+10年 | N
69-
filter | Function | - | 列选项过滤函数,支持自定义列内容。(type 值可为: year, month, date, hour, minute, second) | N
69+
filter | Function | - | 列选项过滤函数,支持自定义列内容。(type 值可为: year, month, date, hour, minute, second)。TS 类型:`(type: TimeModeValues, columns: DateTimePickerColumn) => DateTimePickerColumn` `type DateTimePickerColumn = DateTimePickerColumnItem[]` `interface DateTimePickerColumnItem { label: string,value: string}`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/tree/develop/src/date-time-picker/type.ts) | N
7070
footer | Slot | - | 底部内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
7171
format | String | 'YYYY-MM-DD HH:mm:ss' | 用于格式化 pick、change、confirm 事件返回的值,[详细文档](https://day.js.org/docs/en/display/format) | N
7272
header | Boolean / Slot | true | 头部内容。值为 true 显示空白头部,值为 false 不显示任何内容。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N

src/date-time-picker/type.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export interface TdDateTimePickerProps {
5050
*/
5151
filter?: {
5252
type: undefined;
53-
value?: null;
53+
value?: (type: TimeModeValues, columns: DateTimePickerColumn) => DateTimePickerColumn;
5454
};
5555
/**
5656
* 用于格式化 pick、change、confirm 事件返回的值,[详细文档](https://day.js.org/docs/en/display/format)
@@ -146,6 +146,13 @@ export interface TdDateTimePickerProps {
146146
};
147147
}
148148

149+
export type DateTimePickerColumn = DateTimePickerColumnItem[];
150+
151+
export interface DateTimePickerColumnItem {
152+
label: string;
153+
value: string;
154+
}
155+
149156
export type DateTimePickerMode = TimeModeValues | Array<TimeModeValues>;
150157

151158
export type TimeModeValues = 'year' | 'month' | 'date' | 'hour' | 'minute' | 'second';

0 commit comments

Comments
 (0)