types.d.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import React from 'react';
  2. /**
  3. * 图片 item 类型
  4. */
  5. export declare type dataType = {
  6. key?: string;
  7. src: string;
  8. originRef?: HTMLElement | null;
  9. intro?: React.ReactNode;
  10. };
  11. /**
  12. * brokenElement函数使用参数
  13. */
  14. export declare type brokenElementDataType = Pick<dataType, 'src' | 'intro'>;
  15. export declare type overlayRenderProps = {
  16. images: dataType[];
  17. index: number;
  18. visible: boolean;
  19. onClose: (evt?: React.MouseEvent | React.TouchEvent) => void;
  20. onIndexChange: (photoIndex: number) => void;
  21. overlayVisible: boolean;
  22. rotate: number;
  23. onRotate: (rotate: number) => void;
  24. };
  25. export interface IPhotoProviderBase {
  26. maskClosable?: boolean;
  27. photoClosable?: boolean;
  28. bannerVisible?: boolean;
  29. introVisible?: boolean;
  30. overlayRender?: (overlayProps: overlayRenderProps) => React.ReactNode;
  31. toolbarRender?: (overlayProps: overlayRenderProps) => React.ReactNode;
  32. className?: string;
  33. maskClassName?: string;
  34. viewClassName?: string;
  35. imageClassName?: string;
  36. loadingElement?: JSX.Element;
  37. brokenElement?: JSX.Element | ((photoProps: brokenElementDataType) => JSX.Element);
  38. }
  39. export declare type ReachMoveFunction = (reachState: ReachTypeEnum, clientX: number, clientY: number, scale?: number) => void;
  40. export declare type ReachFunction = (clientX: number, clientY: number) => void;
  41. export declare type PhotoTapFunction = (clientX: number, clientY: number) => void;
  42. /**
  43. * 边缘超出状态
  44. */
  45. export declare enum CloseEdgeEnum {
  46. Normal = 0,
  47. Small = 1,
  48. Before = 2,
  49. After = 3
  50. }
  51. /**
  52. * 边缘触发状态
  53. */
  54. export declare enum ReachTypeEnum {
  55. Normal = 0,
  56. XReach = 1,
  57. YReach = 2
  58. }
  59. /**
  60. * 初始响应状态
  61. */
  62. export declare enum TouchStartEnum {
  63. Normal = 0,
  64. X = 1,
  65. YPush = 2,
  66. YPull = 3
  67. }
  68. /**
  69. * 动画类型
  70. */
  71. export declare enum ShowAnimateEnum {
  72. None = 0,
  73. In = 1,
  74. Out = 2
  75. }
  76. /**
  77. * 触发源位置
  78. */
  79. export declare type OriginRectType = {
  80. clientX: number;
  81. clientY: number;
  82. } | undefined;