-
Notifications
You must be signed in to change notification settings - Fork 157
/
types.ts
93 lines (85 loc) · 2 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import type { ModalProps, UploadProps } from 'antd';
import type { ForwardedRef, MutableRefObject } from 'react';
import type { default as Cropper, CropperProps } from 'react-easy-crop';
import type { Area } from 'react-easy-crop/types';
export type BeforeUpload = Exclude<UploadProps['beforeUpload'], undefined>;
export type BeforeUploadReturnType = ReturnType<BeforeUpload>;
export type ImgCropProps = {
quality?: number;
fillColor?: string;
zoomSlider?: boolean;
rotationSlider?: boolean;
aspectSlider?: boolean;
showReset?: boolean;
resetText?: string;
aspect?: number;
minZoom?: number;
maxZoom?: number;
cropShape?: 'rect' | 'round';
showGrid?: boolean;
cropperProps?: Omit<
CropperProps,
| 'image'
| 'crop'
| 'zoom'
| 'rotation'
| 'aspect'
| 'minZoom'
| 'maxZoom'
| 'zoomWithScroll'
| 'cropShape'
| 'showGrid'
| 'onCropChange'
| 'onZoomChange'
| 'onRotationChange'
| 'onCropComplete'
| 'classes'
>;
modalClassName?: string;
modalTitle?: string;
modalWidth?: number | string;
modalOk?: string;
modalCancel?: string;
onModalOk?: (value: BeforeUploadReturnType) => void;
onModalCancel?: (resolve: (value: BeforeUploadReturnType) => void) => void;
modalProps?: Omit<
ModalProps,
| 'className'
| 'title'
| 'width'
| 'okText'
| 'cancelText'
| 'onOk'
| 'onCancel'
| 'open'
| 'visible'
| 'wrapClassName'
| 'maskClosable'
| 'destroyOnClose'
>;
beforeCrop?: BeforeUpload;
children: JSX.Element;
};
export type EasyCropRef = {
rotation: number;
cropPixelsRef: MutableRefObject<Area>;
onReset: () => void;
};
export type EasyCropProps = {
cropperRef: ForwardedRef<Cropper>;
modalImage: string;
} & Required<
Pick<
ImgCropProps,
| 'zoomSlider'
| 'rotationSlider'
| 'aspectSlider'
| 'showReset'
| 'aspect'
| 'minZoom'
| 'maxZoom'
| 'cropShape'
| 'showGrid'
>
> &
Pick<ImgCropProps, 'cropperProps'> & { resetBtnText: string };