Repository: element-plus/element-plus
File: packages/components/time-picker/src/common/props.ts (TypeScript)

Code before:
import type { Dayjs } from 'dayjs'
import type { Placement } from '@element-plus/components/popper'

export type SingleOrRange<T> = T | [T, T]
export type DateModelType = number | string | Date
export type ModelValueType = SingleOrRange<DateModelType> | string[]
export type DayOrDays = SingleOrRange<Dayjs>
export type DateOrDates = SingleOrRange<Date>
export type UserInput = SingleOrRange<string | null>
export type GetDisabledHours = (role: string, comparingDate?: Dayjs) => number[]
export type GetDisabledMinutes = (
  hour: number,
  role: string,
  comparingDate?: Dayjs
) => number[]
export type GetDisabledSeconds = (
  hour: number,
  minute: number,
  role: string,
  comparingDate?: Dayjs
) => number[]

export const timePickerDefaultProps = buildProps({
  /**
   * @description this prop decides if the date picker panel pops up when the input is focused
   */
  automaticDropdown: {
    type: Boolean,
    default: true,
  },
  /**
   * @description same as `id` in native input
   */
  id: {
    type: definePropType<SingleOrRange<string>>([Array, String]),
  },
  /**
   * @description same as `name` in native input
   */
  name: {
    type: definePropType<SingleOrRange<string>>([Array, String]),
  },
  /**
   * @description custom class name for TimePicker's dropdown
   */
  popperClass: {
    type: String,
    default: '',
  },
  /**
   * @description format of the displayed value in the input box

Review comment (suggestion):
We can add the prop to the doc.

Edit:
>I suggest adding the automatic-dropdown attribute, which defaults to true and changes to false in version 3.0.

Agreed with this statement. Maybe we can add a brief sentence in the prop description to prevent this breaking change :thinking: .

Code after:
import type { Options } from '@popperjs/core'
import type { Dayjs } from 'dayjs'
import type { Placement } from '@element-plus/components/popper'

export type SingleOrRange<T> = T | [T, T]
export type DateModelType = number | string | Date
export type ModelValueType = SingleOrRange<DateModelType> | string[]
export type DayOrDays = SingleOrRange<Dayjs>
export type DateOrDates = SingleOrRange<Date>
export type UserInput = SingleOrRange<string | null>
export type GetDisabledHours = (role: string, comparingDate?: Dayjs) => number[]
export type GetDisabledMinutes = (
  hour: number,
  role: string,
  comparingDate?: Dayjs
) => number[]
export type GetDisabledSeconds = (
  hour: number,
  minute: number,
  role: string,
  comparingDate?: Dayjs
) => number[]

export const timePickerDefaultProps = buildProps({
  /**
   * @description this prop decides if the date picker panel pops up when the input is focused
   */
  automaticDropdown: {
    type: Boolean,
    default: true,
  },
  /**
   * @description same as `id` in native input
   */
  id: {
    type: definePropType<SingleOrRange<string>>([Array, String]),
  },
  /**
   * @description same as `name` in native input
   */
  name: {
    type: definePropType<SingleOrRange<string>>([Array, String]),
  },
  /**
   * @description custom class name for TimePicker's dropdown
   */
  popperClass: useTooltipContentProps.popperClass,
  /**
   * @description custom style for TimePicker's dropdown
   */
  popperStyle: useTooltipContentProps.popperStyle,