Skip to content

feat(DatePicker): support readonly props #5293

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

Merged
merged 1 commit into from
Apr 11, 2025
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
1 change: 1 addition & 0 deletions packages/components/date-picker/date-picker.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ popupProps | Object | - | Typescript:`PopupProps`,[Popup API Documents](./po
prefixIcon | Slot / Function | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
presets | Object | - | Typescript:`PresetDate` `interface PresetDate { [name: string]: DateValue \| (() => DateValue) }`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/date-picker/type.ts) | N
presetsPlacement | String | bottom | options: left/top/right/bottom | N
readonly | Boolean | false | Whether it is read only, the priority is greater than allowInput | N
selectInputProps | Object | - | Typescript:`SelectInputProps`,[SelectInput API Documents](./select-input?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/date-picker/type.ts) | N
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
status | String | default | options: default/success/warning/error | N
Expand Down
1 change: 1 addition & 0 deletions packages/components/date-picker/date-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ popupProps | Object | - | 透传给 popup 组件的参数。TS 类型:`PopupPr
prefixIcon | Slot / Function | - | 用于自定义组件前置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
presets | Object | - | 预设快捷日期选择,示例:`{ '元旦': '2021-01-01', '昨天': dayjs().subtract(1, 'day').format('YYYY-MM-DD'), '特定日期': () => ['2021-02-01'] }`。TS 类型:`PresetDate` `interface PresetDate { [name: string]: DateValue \| (() => DateValue) }`。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/date-picker/type.ts) | N
presetsPlacement | String | bottom | 预设面板展示区域(包含确定按钮)。可选项:left/top/right/bottom | N
readonly | Boolean | false | 是否只读,优先级大于 allowInput | N
selectInputProps | Object | - | 透传 SelectInput 筛选器输入框组件的全部属性。TS 类型:`SelectInputProps`,[SelectInput API Documents](./select-input?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/date-picker/type.ts) | N
size | String | medium | 输入框尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/packages/components/common.ts) | N
status | String | default | 输入框状态。可选项:default/success/warning/error | N
Expand Down
2 changes: 2 additions & 0 deletions packages/components/date-picker/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export default {
return ['left', 'top', 'right', 'bottom'].includes(val);
},
},
/** 是否只读,优先级大于 allowInput */
readonly: Boolean,
/** 透传 SelectInput 筛选器输入框组件的全部属性 */
selectInputProps: {
type: Object as PropType<TdDatePickerProps['selectInputProps']>,
Expand Down
5 changes: 5 additions & 0 deletions packages/components/date-picker/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export interface TdDatePickerProps {
* @default bottom
*/
presetsPlacement?: 'left' | 'top' | 'right' | 'bottom';
/**
* 是否只读,优先级大于 allowInput
* @default false
*/
readonly?: boolean;
/**
* 透传 SelectInput 筛选器输入框组件的全部属性
*/
Expand Down