Skip to content

Commit

Permalink
fix: timeRangePicker ts type support string
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjinzhou committed Apr 11, 2022
1 parent d645ad6 commit 6f8c75c
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions components/time-picker/time-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,25 @@ export interface CommonTimePickerProps {
hideDisabledOptions?: boolean;
popupClassName?: string;
}

export type TimeRangePickerProps<T> = Omit<RangePickerTimeProps<T>, 'picker'> & {
export type TimeRangePickerProps<DateType> = Omit<
RangePickerTimeProps<DateType>,
'picker' | 'defaultPickerValue' | 'defaultValue' | 'value' | 'onChange' | 'onPanelChange' | 'onOk'
> & {
popupClassName?: string;
valueFormat?: string;
defaultPickerValue?: RangeValue<DateType> | RangeValue<string>;
defaultValue?: RangeValue<DateType> | RangeValue<string>;
value?: RangeValue<DateType> | RangeValue<string>;
onChange?: (
value: RangeValue<DateType> | RangeValue<string> | null,
dateString: [string, string],
) => void;
'onUpdate:value'?: (value: RangeValue<DateType> | RangeValue<string> | null) => void;
onPanelChange?: (
values: RangeValue<DateType> | RangeValue<string>,
modes: [PanelMode, PanelMode],
) => void;
onOk?: (dates: RangeValue<DateType> | RangeValue<string>) => void;
};

export type TimePickerProps<DateType> = CommonProps<DateType> &
Expand Down Expand Up @@ -151,9 +166,7 @@ function createTimePicker<
slot: ['renderExtraFooter', 'suffixIcon', 'clearIcon'],
setup(props, { slots, expose, emit, attrs }) {
const pickerRef = ref();

const formItemContext = useInjectFormItemContext();

expose({
focus: () => {
pickerRef.value?.focus();
Expand Down

0 comments on commit 6f8c75c

Please sign in to comment.