interface.d.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import type { Ref } from 'vue';
  2. import type { VueNode } from '../_util/type';
  3. import type { GenerateConfig } from './generate';
  4. export declare type Locale = {
  5. locale: string;
  6. /** Display month before year in date panel header */
  7. monthBeforeYear?: boolean;
  8. yearFormat: string;
  9. monthFormat?: string;
  10. quarterFormat?: string;
  11. today: string;
  12. now: string;
  13. backToToday: string;
  14. ok: string;
  15. timeSelect: string;
  16. dateSelect: string;
  17. weekSelect?: string;
  18. clear: string;
  19. month: string;
  20. year: string;
  21. previousMonth: string;
  22. nextMonth: string;
  23. monthSelect: string;
  24. yearSelect: string;
  25. decadeSelect: string;
  26. dayFormat: string;
  27. dateFormat: string;
  28. dateTimeFormat: string;
  29. previousYear: string;
  30. nextYear: string;
  31. previousDecade: string;
  32. nextDecade: string;
  33. previousCentury: string;
  34. nextCentury: string;
  35. shortWeekDays?: string[];
  36. shortMonths?: string[];
  37. };
  38. export declare type PanelMode = 'time' | 'date' | 'week' | 'month' | 'quarter' | 'year' | 'decade';
  39. export declare type PickerMode = Exclude<PanelMode, 'datetime' | 'decade'>;
  40. export declare type PanelRefProps = {
  41. onKeydown?: (e: KeyboardEvent) => boolean;
  42. onBlur?: (e: FocusEvent) => void;
  43. onClose?: () => void;
  44. };
  45. export declare type NullableDateType<DateType> = DateType | null | undefined;
  46. export declare type OnSelect<DateType> = (value: DateType, type: 'key' | 'mouse' | 'submit') => void;
  47. export declare type PanelSharedProps<DateType> = {
  48. prefixCls: string;
  49. generateConfig: GenerateConfig<DateType>;
  50. value?: NullableDateType<DateType>;
  51. viewDate: DateType;
  52. /** [Legacy] Set default display picker view date */
  53. defaultPickerValue?: DateType;
  54. locale: Locale;
  55. disabledDate?: (date: DateType) => boolean;
  56. prevIcon?: VueNode;
  57. nextIcon?: VueNode;
  58. superPrevIcon?: VueNode;
  59. superNextIcon?: VueNode;
  60. operationRef: Ref<PanelRefProps>;
  61. onSelect: OnSelect<DateType>;
  62. onViewDateChange: (value: DateType) => void;
  63. onPanelChange: (mode: PanelMode | null, viewValue: DateType) => void;
  64. };
  65. export declare type DisabledTimes = {
  66. disabledHours?: () => number[];
  67. disabledMinutes?: (hour: number) => number[];
  68. disabledSeconds?: (hour: number, minute: number) => number[];
  69. };
  70. export declare type DisabledTime<DateType> = (date: DateType | null) => DisabledTimes;
  71. export declare type OnPanelChange<DateType> = (value: DateType, mode: PanelMode) => void;
  72. export declare type EventValue<DateType> = DateType | null;
  73. export declare type RangeValue<DateType> = [EventValue<DateType>, EventValue<DateType>] | null;
  74. export declare type Components = {
  75. button?: any;
  76. rangeItem?: any;
  77. };
  78. export declare type RangeList = {
  79. label: string;
  80. onClick: () => void;
  81. onMouseenter: () => void;
  82. onMouseleave: () => void;
  83. }[];
  84. export declare type CustomFormat<DateType> = (value: DateType) => string;