UNPKG

1.77 kBTypeScriptView Raw
1/// <reference types="react" />
2import * as React from 'react';
3export declare type imageAttr = 'width' | 'height';
4export interface ImageState {
5 width: number;
6 height: number;
7 left: number;
8 top: number;
9 [x: string]: number;
10}
11export interface DialogProps {
12 title: any;
13 defaultProps: any;
14 footer: any;
15 visible: boolean;
16 width: number;
17 onCancel: (args?: any) => any;
18 onOk?: (args?: any) => any;
19}
20export interface CropperProps {
21 file: File;
22 size: Array<number>;
23 onChange: (args: any) => void;
24 prefixCls?: string;
25 circle?: boolean;
26 spin?: React.ComponentElement<any, any>;
27 renderModal?: (args?: any) => React.ComponentElement<DialogProps, any>;
28 locale?: String;
29}
30export default class Cropper extends React.Component<CropperProps, any> {
31 static defaultProps: {
32 prefixCls: string;
33 size: number[];
34 circle: boolean;
35 onChange: () => void;
36 locale: string;
37 };
38 refs: {
39 viewport: HTMLElement;
40 dragger: HTMLElement;
41 dragNotice: HTMLElement;
42 Canvas2x: HTMLCanvasElement;
43 Canvas1x: HTMLCanvasElement;
44 };
45 updateThumbnail: () => void;
46 constructor(props: any);
47 componentDidMount(): void;
48 componentWillUnmount(): void;
49 readFile: (file: File) => void;
50 loadImage: (reader: FileReader) => void;
51 scaleImage: (scale: any) => void;
52 applyImageState: (imageState: any) => void;
53 normalizeImage: (image: any) => void;
54 applyPositions: () => void;
55 onMouseDown: () => void;
56 dragStart: (ev: any) => void;
57 dragOver: (ev: any) => void;
58 dragEnd: () => void;
59 handleCancel: () => void;
60 handleOk: () => void;
61 hideModal: () => void;
62 render(): JSX.Element;
63}