PickerPanel.d.ts 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * Logic:
  3. * When `mode` === `picker`,
  4. * click will trigger `onSelect` (if value changed trigger `onChange` also).
  5. * Panel change will not trigger `onSelect` but trigger `onPanelChange`
  6. */
  7. import type { SharedTimeProps } from './panels/TimePanel';
  8. import type { GenerateConfig } from './generate';
  9. import type { Locale, PanelMode, PickerMode, DisabledTime, OnPanelChange, Components } from './interface';
  10. import type { DateRender } from './panels/DatePanel/DateBody';
  11. import type { MonthCellRender } from './panels/MonthPanel/MonthBody';
  12. import type { VueNode } from '../_util/type';
  13. export declare type PickerPanelSharedProps<DateType> = {
  14. prefixCls?: string;
  15. /** @deprecated Will be removed in next big version. Please use `mode` instead */
  16. mode?: PanelMode;
  17. tabindex?: number;
  18. locale: Locale;
  19. generateConfig: GenerateConfig<DateType>;
  20. value?: DateType | null;
  21. defaultValue?: DateType;
  22. /** [Legacy] Set default display picker view date */
  23. pickerValue?: DateType;
  24. /** [Legacy] Set default display picker view date */
  25. defaultPickerValue?: DateType;
  26. disabledDate?: (date: DateType) => boolean;
  27. dateRender?: DateRender<DateType>;
  28. monthCellRender?: MonthCellRender<DateType>;
  29. renderExtraFooter?: (mode: PanelMode) => VueNode;
  30. onSelect?: (value: DateType) => void;
  31. onChange?: (value: DateType) => void;
  32. onPanelChange?: OnPanelChange<DateType>;
  33. onMousedown?: (e: MouseEvent) => void;
  34. onOk?: (date: DateType) => void;
  35. direction?: 'ltr' | 'rtl';
  36. /** @private This is internal usage. Do not use in your production env */
  37. hideHeader?: boolean;
  38. /** @private This is internal usage. Do not use in your production env */
  39. onPickerValueChange?: (date: DateType) => void;
  40. /** @private Internal usage. Do not use in your production env */
  41. components?: Components;
  42. };
  43. export declare type PickerPanelBaseProps<DateType> = {
  44. picker: Exclude<PickerMode, 'date' | 'time'>;
  45. } & PickerPanelSharedProps<DateType>;
  46. export declare type PickerPanelDateProps<DateType> = {
  47. picker?: 'date';
  48. showToday?: boolean;
  49. showNow?: boolean;
  50. showTime?: boolean | SharedTimeProps<DateType>;
  51. disabledTime?: DisabledTime<DateType>;
  52. } & PickerPanelSharedProps<DateType>;
  53. export declare type PickerPanelTimeProps<DateType> = {
  54. picker: 'time';
  55. } & PickerPanelSharedProps<DateType> & SharedTimeProps<DateType>;
  56. export declare type PickerPanelProps<DateType> = PickerPanelBaseProps<DateType> | PickerPanelDateProps<DateType> | PickerPanelTimeProps<DateType>;
  57. declare type OmitType<DateType> = Omit<PickerPanelBaseProps<DateType>, 'picker'> & Omit<PickerPanelDateProps<DateType>, 'picker'> & Omit<PickerPanelTimeProps<DateType>, 'picker'>;
  58. declare type MergedPickerPanelProps<DateType> = {
  59. picker?: PickerMode;
  60. } & OmitType<DateType>;
  61. declare const _default: <DateType>(props: MergedPickerPanelProps<DateType>) => JSX.Element;
  62. export default _default;