From 7fb0fb6c7f394c3867b6d836dc6a4ca7d8c41d48 Mon Sep 17 00:00:00 2001 From: AruSeito Date: Fri, 27 Oct 2023 22:06:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20timepicker=20readonly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/time-picker/src/interface.ts | 1 + packages/time-picker/src/range-picker.tsx | 5 +++-- packages/time-picker/src/single-picker.tsx | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/time-picker/src/interface.ts b/packages/time-picker/src/interface.ts index 247620c26..001055c1d 100644 --- a/packages/time-picker/src/interface.ts +++ b/packages/time-picker/src/interface.ts @@ -31,6 +31,7 @@ export interface PublicTimePickerProps extends BoxProps { utcOffset?: number timezone?: string disabled?: boolean + readonly?: boolean } type BaseTimePickerProps = { diff --git a/packages/time-picker/src/range-picker.tsx b/packages/time-picker/src/range-picker.tsx index 21e517420..a652a9f0a 100644 --- a/packages/time-picker/src/range-picker.tsx +++ b/packages/time-picker/src/range-picker.tsx @@ -47,6 +47,7 @@ export const RangePicker = forwardRef( format = "HH:mm:ss", scrollSticky = true, order = true, + readonly = false, } = props const suffixIcon = (icons && icons.inputSuffix) || @@ -213,7 +214,7 @@ export const RangePicker = forwardRef( ( onPressEnter={onPressEnter} onClear={onClear} suffixIcon={suffixIcon} - editable={editable} + editable={editable || !readonly} allowClear={allowClear} ref={refInput} placeholder={placeholder} diff --git a/packages/time-picker/src/single-picker.tsx b/packages/time-picker/src/single-picker.tsx index 8a4c7d288..7d870e9f1 100644 --- a/packages/time-picker/src/single-picker.tsx +++ b/packages/time-picker/src/single-picker.tsx @@ -46,6 +46,7 @@ export const TimePicker = forwardRef( timezone, format = "HH:mm:ss", scrollSticky = true, + readonly = false, } = props const suffixIcon = (icons && icons.inputSuffix) || @@ -187,7 +188,7 @@ export const TimePicker = forwardRef( ( onPressEnter={onPressEnter} onClear={onClear} suffixIcon={suffixIcon} - editable={editable} + editable={editable || !readonly} allowClear={allowClear} ref={refInput} placeholder={placeholder as string}