Skip to content

Commit a900663

Browse files
committed
feat: api
1 parent 6e38ca2 commit a900663

File tree

14 files changed

+259
-115
lines changed

14 files changed

+259
-115
lines changed

db/TDesign.db

0 Bytes
Binary file not shown.

packages/products/tdesign-react/packages/components/time-picker/defaultProps.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,21 @@
22
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
33
* */
44

5-
import { TdTimeRangePickerProps } from './type';
5+
import { TdTimePickerProps, TdTimeRangePickerProps } from './type';
6+
7+
export const timePickerDefaultProps: TdTimePickerProps = {
8+
allowInput: false,
9+
borderless: false,
10+
clearable: false,
11+
disabled: undefined,
12+
format: 'HH:mm:ss',
13+
hideDisabledTime: true,
14+
placeholder: undefined,
15+
readonly: undefined,
16+
size: 'medium',
17+
status: 'default',
18+
steps: [1, 1, 1],
19+
};
620

721
export const timeRangePickerDefaultProps: TdTimeRangePickerProps = {
822
allowInput: false,

packages/products/tdesign-react/packages/components/time-picker/time-picker.en-US.md

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,69 @@
77
name | type | default | description | required
88
-- | -- | -- | -- | --
99
className | String | - | className of component | N
10-
style | Object | - | CSS(Cascading Style Sheets),Typescript`React.CSSProperties` | N
10+
style | Object | - | CSS(Cascading Style Sheets),Typescript: `React.CSSProperties` | N
1111
allowInput | Boolean | false | \- | N
1212
borderless | Boolean | false | \- | N
1313
clearable | Boolean | false | \- | N
14-
disableTime | Function | - | disable time config function。Typescript`(h: number, m: number, s: number, ms: number) => Partial<{ hour: Array<number>, minute: Array<number>, second: Array<number>, millisecond: Array<number> }>` | N
14+
disableTime | Function | - | disable time config function。Typescript: `(h: number, m: number, s: number, ms: number) => Partial<{ hour: Array<number>, minute: Array<number>, second: Array<number>, millisecond: Array<number> }>` | N
1515
disabled | Boolean | undefined | \- | N
1616
format | String | HH:mm:ss | \- | N
1717
hideDisabledTime | Boolean | true | \- | N
18-
inputProps | Object | - | Typescript`InputProps`[Input API Documents](./input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
19-
label | TNode | - | Typescript`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
18+
inputProps | Object | - | Typescript: `InputProps`[Input API Documents](./input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
19+
label | TNode | - | Typescript: `string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
2020
placeholder | String | undefined | \- | N
21-
popupProps | Object | - | Typescript:`PopupProps`[Popup API Documents](./popup?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
22-
presets | Object | - | Typescript:`PresetTime` `interface PresetTime { [presetName: string]: TimePickerValue \| (() => TimePickerValue) }`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
21+
popupProps | Object | - | Typescript: `PopupProps`[Popup API Documents](./popup?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
22+
prefixIcon | TElement | - | Typescript: `TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
23+
presets | Object | - | Typescript: `PresetTime` `interface PresetTime { [presetName: string]: TimePickerValue \| (() => TimePickerValue) }`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
2324
readonly | Boolean | undefined | Whether it is read only, the priority is greater than `allowInput` | N
24-
selectInputProps | Object | - | Typescript`SelectInputProps`[SelectInput API Documents](./select-input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
25+
selectInputProps | Object | - | Typescript: `SelectInputProps`[SelectInput API Documents](./select-input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
2526
size | String | medium | options: small/medium/large | N
2627
status | String | default | options: default/success/warning/error | N
27-
steps | Array | [1, 1, 1] | Typescript:`Array<string \| number>` | N
28-
tips | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
29-
value | String | - | Typescript:`TimePickerValue` `type TimePickerValue = string`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
30-
defaultValue | String | - | uncontrolled property。Typescript:`TimePickerValue` `type TimePickerValue = string`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
31-
valueDisplay | TNode | - | `MouseEvent<SVGElement>`。Typescript:`string \| TNode<{ value: TimePickerValue }>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
32-
onBlur | Function | | Typescript:`(context: { value: TimePickerValue } & SelectInputBlurContext) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`import { SelectInputBlurContext } from '@SelectInput'`<br/> | N
33-
onChange | Function | | Typescript:`(value: TimePickerValue) => void`<br/> | N
34-
onClear | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/>Triggered when the clear button is clicked | N
35-
onClose | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
36-
onConfirm | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
37-
onFocus | Function | | Typescript:`(context: { value: TimePickerValue; e: FocusEvent }) => void`<br/> | N
38-
onInput | Function | | Typescript:`(context: { value: TimePickerValue; e: InputEvent }) => void`<br/> | N
39-
onOpen | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
40-
onPick | Function | | Typescript:`(value: TimePickerValue, context: { e: MouseEvent }) => void`<br/> | N
28+
steps | Array | [1, 1, 1] | Typescript: `Array<string \| number>` | N
29+
suffixIcon | TElement | - | Typescript: `TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
30+
tips | TNode | - | Typescript: `string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
31+
value | String | - | Typescript: `TimePickerValue` `type TimePickerValue = string`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
32+
defaultValue | String | - | uncontrolled property。Typescript: `TimePickerValue` `type TimePickerValue = string`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
33+
valueDisplay | TNode | - | `MouseEvent<SVGElement>`。Typescript: `string \| TNode<{ value: TimePickerValue }>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
34+
onBlur | Function | | Typescript: `(context: { value: TimePickerValue } & SelectInputBlurContext) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`import { SelectInputBlurContext } from '@SelectInput'`<br/> | N
35+
onChange | Function | | Typescript: `(value: TimePickerValue) => void`<br/> | N
36+
onClear | Function | | Typescript: `(context: { e: MouseEvent }) => void`<br/>Triggered when the clear button is clicked | N
37+
onClose | Function | | Typescript: `(context: { e: MouseEvent }) => void`<br/> | N
38+
onConfirm | Function | | Typescript: `(context: { e: MouseEvent }) => void`<br/> | N
39+
onFocus | Function | | Typescript: `(context: { value: TimePickerValue; e: FocusEvent }) => void`<br/> | N
40+
onInput | Function | | Typescript: `(context: { value: TimePickerValue; e: InputEvent }) => void`<br/> | N
41+
onOpen | Function | | Typescript: `(context: { e: MouseEvent }) => void`<br/> | N
42+
onPick | Function | | Typescript: `(value: TimePickerValue, context: { e: MouseEvent }) => void`<br/> | N
4143

4244

4345
### TimeRangePicker Props
4446

4547
name | type | default | description | required
4648
-- | -- | -- | -- | --
4749
className | String | - | className of component | N
48-
style | Object | - | CSS(Cascading Style Sheets),Typescript`React.CSSProperties` | N
50+
style | Object | - | CSS(Cascading Style Sheets),Typescript: `React.CSSProperties` | N
4951
allowInput | Boolean | false | \- | N
5052
autoSwap | Boolean | true | \- | N
5153
borderless | Boolean | false | \- | N
5254
clearable | Boolean | false | \- | N
53-
disableTime | Function | - | Typescript`(h: number, m: number, s: number, ms: number, context: { partial: TimeRangePickerPartial }) =>Partial<{ hour: Array<number>, minute: Array<number>, second: Array<number> }>` `type TimeRangePickerPartial = 'start' \| 'end'`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
54-
disabled | Boolean / Array | undefined | Typescript`boolean \| Array<boolean>` | N
55+
disableTime | Function | - | Typescript: `(h: number, m: number, s: number, ms: number, context: { partial: TimeRangePickerPartial }) =>Partial<{ hour: Array<number>, minute: Array<number>, second: Array<number> }>` `type TimeRangePickerPartial = 'start' \| 'end'`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
56+
disabled | Boolean / Array | undefined | Typescript: `boolean \| Array<boolean>` | N
5557
format | String | HH:mm:ss | \- | N
5658
hideDisabledTime | Boolean | true | \- | N
57-
label | TNode | - | Typescript`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
58-
placeholder | String / Array | undefined | Typescript`string \| Array<string>` | N
59-
popupProps | Object | - | Typescript`PopupProps`[Popup API Documents](./popup?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
60-
presets | Object | - | Typescript`PresetTimeRange` `interface PresetTimeRange { [presetRageName: string]: TimeRangeValue \| (() => TimeRangeValue)}`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
61-
rangeInputProps | Object | - | Typescript`RangeInputProps`[RangeInput API Documents](./range-input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
59+
label | TNode | - | Typescript: `string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
60+
placeholder | String / Array | undefined | Typescript: `string \| Array<string>` | N
61+
popupProps | Object | - | Typescript: `PopupProps`[Popup API Documents](./popup?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
62+
presets | Object | - | Typescript: `PresetTimeRange` `interface PresetTimeRange { [presetRageName: string]: TimeRangeValue \| (() => TimeRangeValue)}`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
63+
rangeInputProps | Object | - | Typescript: `RangeInputProps`[RangeInput API Documents](./range-input?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
6264
readonly | Boolean | undefined | Whether it is read only, the priority is greater than `allowInput` | N
6365
size | String | medium | options: small/medium/large | N
6466
status | String | default | options: default/success/warning/error | N
65-
steps | Array | [1, 1, 1] | Typescript`Array<string \| number>` | N
66-
tips | TNode | - | Typescript`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
67-
value | Array | - | Typescript`TimeRangeValue` `type TimeRangeValue = Array<string>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
68-
defaultValue | Array | - | uncontrolled property。Typescript`TimeRangeValue` `type TimeRangeValue = Array<string>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
69-
onBlur | Function | | Typescript`(context: { value: TimeRangeValue; e?: FocusEvent; position?: TimeRangePickerPartial }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`type TimeRangePickerPartial = 'start' \| 'end'`<br/> | N
70-
onChange | Function | | Typescript`(value: TimeRangeValue) => void`<br/> | N
71-
onFocus | Function | | Typescript`(context?: { value: TimeRangeValue; e?: FocusEvent; position?: TimeRangePickerPartial }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`type TimeRangePickerPartial = 'start' \| 'end'`<br/> | N
72-
onInput | Function | | Typescript`(context: { value: TimeRangeValue; e?: InputEvent; position?: TimeRangePickerPartial }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`type TimeRangePickerPartial = 'start' \| 'end'`<br/> | N
73-
onPick | Function | | Typescript`(value: TimeRangeValue, context: { e: MouseEvent, position?: TimeRangePickerPartial }) => void`<br/> | N
67+
steps | Array | [1, 1, 1] | Typescript: `Array<string \| number>` | N
68+
tips | TNode | - | Typescript: `string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
69+
value | Array | - | Typescript: `TimeRangeValue` `type TimeRangeValue = Array<string>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
70+
defaultValue | Array | - | uncontrolled property。Typescript: `TimeRangeValue` `type TimeRangeValue = Array<string>`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
71+
onBlur | Function | | Typescript: `(context: { value: TimeRangeValue; e?: FocusEvent; position?: TimeRangePickerPartial }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`type TimeRangePickerPartial = 'start' \| 'end'`<br/> | N
72+
onChange | Function | | Typescript: `(value: TimeRangeValue) => void`<br/> | N
73+
onFocus | Function | | Typescript: `(context?: { value: TimeRangeValue; e?: FocusEvent; position?: TimeRangePickerPartial }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`type TimeRangePickerPartial = 'start' \| 'end'`<br/> | N
74+
onInput | Function | | Typescript: `(context: { value: TimeRangeValue; e?: InputEvent; position?: TimeRangePickerPartial }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts)。<br/>`type TimeRangePickerPartial = 'start' \| 'end'`<br/> | N
75+
onPick | Function | | Typescript: `(value: TimeRangeValue, context: { e: MouseEvent, position?: TimeRangePickerPartial }) => void`<br/> | N

packages/products/tdesign-react/packages/components/time-picker/time-picker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ inputProps | Object | - | 透传给输入框(Input)组件的参数。TS 类
1919
label | TNode | - | 左侧文本。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
2020
placeholder | String | undefined | 占位符 | N
2121
popupProps | Object | - | 透传 Popup 组件全部属性。TS 类型:`PopupProps`[Popup API Documents](./popup?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
22+
prefixIcon | TElement | - | 用于自定义组件前置图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
2223
presets | Object | - | 预设快捷时间选择,示例:`{ '前一小时': '11:00:00' }`。TS 类型:`PresetTime` `interface PresetTime { [presetName: string]: TimePickerValue \| (() => TimePickerValue) }`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
2324
readonly | Boolean | undefined | 只读状态,优先级大于 `allowInput` | N
2425
selectInputProps | Object | - | 透传 SelectInput 筛选器输入框组件的全部属性。TS 类型:`SelectInputProps`[SelectInput API Documents](./select-input?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
2526
size | String | medium | 尺寸。可选项:small/medium/large | N
2627
status | String | default | 输入框状态。可选项:default/success/warning/error | N
2728
steps | Array | [1, 1, 1] | 时间间隔步数,数组排列 [小时, 分钟, 秒],示例:[2, 1, 1] 或者 ['2', '1', '1']。TS 类型:`Array<string \| number>` | N
29+
suffixIcon | TElement | - | 用于自定义组件后置图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
2830
tips | TNode | - | 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/common.ts) | N
2931
value | String | - | 选中值。TS 类型:`TimePickerValue` `type TimePickerValue = string`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N
3032
defaultValue | String | - | 选中值。非受控属性。TS 类型:`TimePickerValue` `type TimePickerValue = string`[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/packages/components/time-picker/type.ts) | N

packages/products/tdesign-react/packages/components/time-picker/type.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { PopupProps } from '../popup';
99
import { SelectInputProps } from '../select-input';
1010
import { SelectInputBlurContext } from '../select-input';
1111
import { RangeInputProps } from '../range-input';
12-
import { TNode } from '../common';
13-
import { MouseEvent, FocusEvent, FormEvent } from 'react';
12+
import type { TNode, TElement } from '../common';
13+
import type { MouseEvent, FocusEvent, FormEvent } from 'react';
1414

1515
export interface TdTimePickerProps {
1616
/**
@@ -67,6 +67,10 @@ export interface TdTimePickerProps {
6767
* 透传 Popup 组件全部属性
6868
*/
6969
popupProps?: PopupProps;
70+
/**
71+
* 用于自定义组件前置图标
72+
*/
73+
prefixIcon?: TElement;
7074
/**
7175
* 预设快捷时间选择,示例:`{ '前一小时': '11:00:00' }`
7276
*/
@@ -94,6 +98,10 @@ export interface TdTimePickerProps {
9498
* @default [1, 1, 1]
9599
*/
96100
steps?: Array<string | number>;
101+
/**
102+
* 用于自定义组件后置图标
103+
*/
104+
suffixIcon?: TElement;
97105
/**
98106
* 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式
99107
*/

0 commit comments

Comments
 (0)