index.d.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import * as React from 'react';
  2. import type { CellRender, Components, Locale, OnPanelChange, PanelMode, PickerMode, SharedPanelProps, SharedTimeProps } from '../interface';
  3. export interface PickerPanelRef {
  4. nativeElement: HTMLDivElement;
  5. }
  6. export interface BasePickerPanelProps<DateType extends object = any> extends Pick<SharedPanelProps<DateType>, 'locale' | 'generateConfig' | 'disabledDate' | 'minDate' | 'maxDate' | 'prevIcon' | 'nextIcon' | 'superPrevIcon' | 'superNextIcon'>, SharedTimeProps<DateType>, Pick<React.HTMLAttributes<HTMLDivElement>, 'tabIndex'> {
  7. prefixCls?: string;
  8. direction?: 'ltr' | 'rtl';
  9. onSelect?: (date: DateType) => void;
  10. defaultPickerValue?: DateType | null;
  11. pickerValue?: DateType | null;
  12. onPickerValueChange?: (date: DateType) => void;
  13. mode?: PanelMode;
  14. /**
  15. * Compatible with origin API.
  16. * Not mean the PickerPanel `onChange` event.
  17. */
  18. onPanelChange?: OnPanelChange<DateType>;
  19. picker?: PickerMode;
  20. showTime?: true | SharedTimeProps<DateType>;
  21. /**
  22. * Only worked in `date` mode. Show the current week
  23. */
  24. showWeek?: boolean;
  25. cellRender?: CellRender<DateType>;
  26. /** @deprecated use cellRender instead of dateRender */
  27. dateRender?: (currentDate: DateType, today: DateType) => React.ReactNode;
  28. /** @deprecated use cellRender instead of monthCellRender */
  29. monthCellRender?: (currentDate: DateType, locale: Locale) => React.ReactNode;
  30. /** @private Used for Picker passing */
  31. hoverValue?: DateType[];
  32. /** @private Used for Picker passing */
  33. hoverRangeValue?: [start: DateType, end: DateType];
  34. /** @private Used for Picker passing */
  35. onHover?: (date: DateType) => void;
  36. components?: Components;
  37. /** @private This is internal usage. Do not use in your production env */
  38. hideHeader?: boolean;
  39. }
  40. export interface SinglePickerPanelProps<DateType extends object = any> extends BasePickerPanelProps<DateType> {
  41. multiple?: false;
  42. defaultValue?: DateType | null;
  43. value?: DateType | null;
  44. onChange?: (date: DateType) => void;
  45. }
  46. export type PickerPanelProps<DateType extends object = any> = BasePickerPanelProps<DateType> & {
  47. /** multiple selection. Not support time or datetime picker */
  48. multiple?: boolean;
  49. defaultValue?: DateType | DateType[] | null;
  50. value?: DateType | DateType[] | null;
  51. onChange?: (date: DateType | DateType[]) => void;
  52. };
  53. declare const _default: <DateType extends object = any>(props: BasePickerPanelProps<DateType> & {
  54. /** multiple selection. Not support time or datetime picker */
  55. multiple?: boolean;
  56. defaultValue?: DateType | DateType[];
  57. value?: DateType | DateType[];
  58. onChange?: (date: DateType | DateType[]) => void;
  59. } & React.RefAttributes<PickerPanelRef>) => React.ReactElement;
  60. export default _default;