Skip to content

Commit

Permalink
fix: originalNode typescript (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
linxianxi authored Aug 8, 2023
1 parent 2c4bd0d commit ac67587
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export default () => (
| maxScale | number | 50 | Max scale |
| forceRender | boolean | - | Force render preview |
| getContainer | string \| HTMLElement \| (() => HTMLElement) \| false | document.body | Return the mount node for preview |
| imageRender | (originalNode: React.ReactNode, info: { transform: [TransformType](#TransformType) }) => React.ReactNode | - | Customize image |
| toolbarRender | (originalNode: React.ReactNode, info: Omit<[ToolbarRenderInfoType](#ToolbarRenderInfoType), 'current' \| 'total'>) => React.ReactNode | - | Customize toolbar |
| imageRender | (originalNode: React.ReactElement, info: { transform: [TransformType](#TransformType) }) => React.ReactNode | - | Customize image |
| toolbarRender | (originalNode: React.ReactElement, info: Omit<[ToolbarRenderInfoType](#ToolbarRenderInfoType), 'current' \| 'total'>) => React.ReactNode | - | Customize toolbar |
| onVisibleChange | (visible: boolean, prevVisible: boolean) => void | - | Callback when visible is changed |
| onTransform | { transform: [TransformType](#TransformType), action: [TransformAction](#TransformAction) } | - | Callback when transform is changed |

Expand Down Expand Up @@ -130,8 +130,8 @@ export default () => (
| forceRender | boolean | - | Force render preview |
| getContainer | string \| HTMLElement \| (() => HTMLElement) \| false | document.body | Return the mount node for preview |
| countRender | (current: number, total: number) => ReactNode | - | Customize count |
| imageRender | (originalNode: React.ReactNode, info: { transform: [TransformType](#TransformType), current: number }) => React.ReactNode | - | Customize image |
| toolbarRender | (originalNode: React.ReactNode, info: [ToolbarRenderInfoType](#ToolbarRenderInfoType)) => React.ReactNode | - | Customize toolbar |
| imageRender | (originalNode: React.ReactElement, info: { transform: [TransformType](#TransformType), current: number }) => React.ReactNode | - | Customize image |
| toolbarRender | (originalNode: React.ReactElement, info: [ToolbarRenderInfoType](#ToolbarRenderInfoType)) => React.ReactNode | - | Customize toolbar |
| onVisibleChange | (visible: boolean, prevVisible: boolean, current: number) => void | - | Callback when visible is changed |
| onTransform | { transform: [TransformType](#TransformType), action: [TransformAction](#TransformAction) } | - | Callback when transform is changed |

Expand Down
4 changes: 2 additions & 2 deletions src/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export interface ImagePreviewType
scaleStep?: number;
movable?: boolean;
imageRender?: (
originalNode: React.ReactNode,
originalNode: React.ReactElement,
info: { transform: TransformType },
) => React.ReactNode;
onTransform?: PreviewProps['onTransform'];
toolbarRender?: (
originalNode: React.ReactNode,
originalNode: React.ReactElement,
info: Omit<ToolbarRenderInfoType, 'current' | 'total'>,
) => React.ReactNode;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Operations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ interface OperationsProps
onFlipX: () => void;
onFlipY: () => void;
toolbarRender: (
originalNode: React.ReactNode,
originalNode: React.ReactElement,
info: ToolbarRenderInfoType | Omit<ToolbarRenderInfoType, 'current' | 'total'>,
) => React.ReactNode;
}
Expand Down
7 changes: 5 additions & 2 deletions src/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,15 @@ export interface PreviewProps extends Omit<IDialogPropTypes, 'onClose'> {
minScale?: number;
maxScale?: number;
imageRender?: (
originalNode: React.ReactNode,
originalNode: React.ReactElement,
info: { transform: TransformType; current?: number },
) => React.ReactNode;
onClose?: () => void;
onTransform?: (info: { transform: TransformType; action: TransformAction }) => void;
toolbarRender?: (originalNode: React.ReactNode, info: ToolbarRenderInfoType) => React.ReactNode;
toolbarRender?: (
originalNode: React.ReactElement,
info: ToolbarRenderInfoType,
) => React.ReactNode;
onChange?: (current, prev) => void;
}

Expand Down
7 changes: 5 additions & 2 deletions src/PreviewGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ export interface PreviewGroupPreview
*/
current?: number;
countRender?: (current: number, total: number) => React.ReactNode;
toolbarRender?: (originalNode: React.ReactNode, info: ToolbarRenderInfoType) => React.ReactNode;
toolbarRender?: (
originalNode: React.ReactElement,
info: ToolbarRenderInfoType,
) => React.ReactNode;
imageRender?: (
originalNode: React.ReactNode,
originalNode: React.ReactElement,
info: { transform: TransformType; current: number },
) => React.ReactNode;
onVisibleChange?: (value: boolean, prevValue: boolean, current: number) => void;
Expand Down

1 comment on commit ac67587

@vercel
Copy link

@vercel vercel bot commented on ac67587 Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.