Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add label prop API for date pickers and range input #3169

Merged
merged 4 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/_common
Submodule _common updated 66 files
+4 −0 docs/mobile/api_v2/count-down.en-US.md
+3 −0 docs/mobile/api_v2/count-down.md
+1 −1 docs/mobile/design/dialog.md
+73 −0 docs/mobile/flutter_design/action-sheet.md
+61 −0 docs/mobile/flutter_design/avatar.md
+33 −0 docs/mobile/flutter_design/back-top.md
+68 −0 docs/mobile/flutter_design/badge.md
+79 −0 docs/mobile/flutter_design/button.md
+51 −0 docs/mobile/flutter_design/calendar.md
+59 −0 docs/mobile/flutter_design/cascader.md
+55 −0 docs/mobile/flutter_design/cell.md
+50 −0 docs/mobile/flutter_design/checkbox.md
+63 −0 docs/mobile/flutter_design/collapse.md
+50 −0 docs/mobile/flutter_design/count-down.md
+36 −0 docs/mobile/flutter_design/date-time-picker.md
+71 −0 docs/mobile/flutter_design/dialog.md
+53 −0 docs/mobile/flutter_design/divider.md
+55 −0 docs/mobile/flutter_design/drawer.md
+40 −0 docs/mobile/flutter_design/dropdown-menu.md
+38 −0 docs/mobile/flutter_design/empty.md
+80 −0 docs/mobile/flutter_design/fab.md
+59 −0 docs/mobile/flutter_design/footer.md
+88 −0 docs/mobile/flutter_design/grid.md
+36 −0 docs/mobile/flutter_design/image-viewer.md
+45 −0 docs/mobile/flutter_design/image.md
+53 −0 docs/mobile/flutter_design/indexes.md
+71 −0 docs/mobile/flutter_design/input.md
+44 −0 docs/mobile/flutter_design/link.md
+57 −0 docs/mobile/flutter_design/loading.md
+50 −0 docs/mobile/flutter_design/message.md
+51 −0 docs/mobile/flutter_design/navbar.md
+81 −0 docs/mobile/flutter_design/notice-bar.md
+39 −0 docs/mobile/flutter_design/picker.md
+53 −0 docs/mobile/flutter_design/popup.md
+62 −0 docs/mobile/flutter_design/progress.md
+60 −0 docs/mobile/flutter_design/pull-down-refresh.md
+57 −0 docs/mobile/flutter_design/radio.md
+51 −0 docs/mobile/flutter_design/rate.md
+54 −0 docs/mobile/flutter_design/result.md
+51 −0 docs/mobile/flutter_design/search.md
+50 −0 docs/mobile/flutter_design/side-bar.md
+27 −0 docs/mobile/flutter_design/skeleton.md
+59 −0 docs/mobile/flutter_design/slider.md
+50 −0 docs/mobile/flutter_design/stepper.md
+74 −0 docs/mobile/flutter_design/steps.md
+75 −0 docs/mobile/flutter_design/swipe-cell.md
+40 −0 docs/mobile/flutter_design/swiper.md
+31 −0 docs/mobile/flutter_design/switch.md
+77 −0 docs/mobile/flutter_design/tab-bar.md
+106 −0 docs/mobile/flutter_design/tabs.md
+86 −0 docs/mobile/flutter_design/tag.md
+59 −0 docs/mobile/flutter_design/textarea.md
+43 −0 docs/mobile/flutter_design/toast.md
+27 −0 docs/mobile/flutter_design/tree-select.md
+43 −0 docs/mobile/flutter_design/upload.md
+1 −1 style/mobile/components/count-down/v2/_index.less
+17 −3 style/mobile/components/count-down/v2/_var.less
+17 −0 style/mobile/components/swiper-nav/v2/_index.less
+2 −0 style/mobile/components/swiper-nav/v2/_var.less
+8 −0 style/mobile/components/swiper/v2/_index.less
+5 −0 style/mobile/components/swiper/v2/_var.less
+0 −1 style/web/components/input/_mixin.less
+4 −1 style/web/components/menu/_index.less
+5 −0 style/web/components/range-input/_index.less
+1 −1 style/web/components/range-input/_var.less
+1 −1 style/web/components/select/_index.less
1 change: 1 addition & 0 deletions src/date-picker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ export default defineComponent({
disabled={isDisabled}
value={inputValue}
inputValue={inputValue}
label={this.label}
status={this.status}
tips={this.tips}
popupProps={datePickerPopupProps}
Expand Down
1 change: 1 addition & 0 deletions src/date-picker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ export default defineComponent({
<div class={COMPONENT_NAME}>
<TRangeInputPopup
disabled={this.isDisabled}
label={this.label}
status={this.status}
tips={this.tips || this.$scopedSlots.tips}
inputValue={inputValue as string[]}
Expand Down
2 changes: 2 additions & 0 deletions src/date-picker/date-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enableTimePicker | Boolean | false | 是否显示时间选择 | N
firstDayOfWeek | Number | 7 | 第一天从星期几开始。可选项:1/2/3/4/5/6/7 | N
format | String | 'YYYY-MM-DD' | 仅用于格式化日期显示的格式,不影响日期值。注意和 `valueType` 的区别,`valueType`会直接决定日期值 `value` 的格式。全局配置默认为:'YYYY-MM-DD',[详细文档](https://day.js.org/docs/en/display/format) | N
inputProps | Object | - | 透传给输入框(Input)组件的参数。TS 类型:`InputProps`,[Input API Documents](./input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/date-picker/type.ts) | N
label | String / Slot / Function | - | 左侧文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
mode | String | date | 选择器模式。可选项:year/quarter/month/week/date | N
placeholder | String / Array | undefined | 占位符。TS 类型:`string` | N
popupProps | Object | - | 透传给 popup 组件的参数。TS 类型:`PopupProps`,[Popup API Documents](./popup?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/date-picker/type.ts) | N
Expand Down Expand Up @@ -58,6 +59,7 @@ disabled | Boolean | - | 是否禁用组件 | N
enableTimePicker | Boolean | false | 是否显示时间选择 | N
firstDayOfWeek | Number | - | 第一天从星期几开始。可选项:1/2/3/4/5/6/7 | N
format | String | - | 用于格式化日期,[详细文档](https://day.js.org/docs/en/display/format) | N
label | String / Slot / Function | - | 左侧文本。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
mode | String | date | 选择器模式。可选项:year/quarter/month/week/date | N
panelPreselection | Boolean | true | 在开始日期选中之前,面板是否显示预选状态,即是否高亮预选日期 | N
placeholder | String / Array | - | 占位符,值为数组表示可分别为开始日期和结束日期设置占位符。TS 类型:`string \| Array<string>` | N
Expand Down
4 changes: 4 additions & 0 deletions src/date-picker/date-range-picker-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default {
type: String,
default: '',
},
/** 左侧文本 */
label: {
type: [String, Function] as PropType<TdDateRangePickerProps['label']>,
},
/** 选择器模式 */
mode: {
type: String as PropType<TdDateRangePickerProps['mode']>,
Expand Down
4 changes: 4 additions & 0 deletions src/date-picker/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default {
inputProps: {
type: Object as PropType<TdDatePickerProps['inputProps']>,
},
/** 左侧文本 */
label: {
type: [String, Function] as PropType<TdDatePickerProps['label']>,
},
/** 选择器模式 */
mode: {
type: String as PropType<TdDatePickerProps['mode']>,
Expand Down
8 changes: 8 additions & 0 deletions src/date-picker/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export interface TdDatePickerProps {
* 透传给输入框(Input)组件的参数
*/
inputProps?: InputProps;
/**
* 左侧内容
*/
label?: string | TNode;
/**
* 选择器模式
* @default date
Expand Down Expand Up @@ -179,6 +183,10 @@ export interface TdDateRangePickerProps {
* @default ''
*/
format?: string;
/**
* 左侧文本
*/
label?: string | TNode;
/**
* 选择器模式
* @default date
Expand Down
4 changes: 4 additions & 0 deletions src/range-input/range-input-popup-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export default {
},
/** 只读状态,值为真会隐藏输入框,且无法打开下拉框 */
readonly: Boolean,
/** 左侧文本 */
label: {
type: [String, Function] as PropType<TdRangeInputPopupProps['label']>,
},
/** 输入框状态 */
status: {
type: String as PropType<TdRangeInputPopupProps['status']>,
Expand Down
1 change: 1 addition & 0 deletions src/range-input/range-input-popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default defineComponent({
value: this.inputValue,
onChange: this.onInputChange,
disabled: this.disabled,
label: this.label,
status: this.status,
tips: this.tips,
...(this.rangeInputProps as Object),
Expand Down
4 changes: 4 additions & 0 deletions src/range-input/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ export interface TdRangeInputPopupProps {
* 输入框的值
*/
inputValue?: RangeInputValue;
/**
* 左侧文本
*/
label?: string | TNode;
/**
* 输入框的值,非受控属性
*/
Expand Down
Loading