choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
83 lines (82 loc) • 2.13 kB
TypeScript
import React, { ReactElement } from 'react';
import { ModalProps } from '../modal';
import { UploadFile, UploadProps } from '../upload/interface';
import AvatarUploader from './avatarUpload';
import { ShapeCroper } from './enum';
interface CompoundedComponent extends React.ForwardRefExoticComponent<ImgCropProps> {
AvatarUploader: typeof AvatarUploader;
}
export interface ImageCropLocale {
imageCrop?: string;
}
export { ShapeCroper, };
export declare type Area = {
width: number;
height: number;
x: number;
y: number;
zoom: number;
rotation: number;
};
export interface BalanceRate {
x: number;
y: number;
}
export interface EasyCropProps {
src?: string;
aspect?: number;
shape?: ShapeCroper;
grid?: boolean;
hasZoom?: boolean;
zoomVal?: number;
rotateVal?: number;
setZoomVal?: (value: number) => void;
setRotateVal?: (rotation: number) => void;
onComplete: (croppedAreaPixels: Area) => void;
prefixCls?: string;
}
export interface ImgCropProps {
aspect?: number;
shape?: ShapeCroper;
zoom?: boolean;
grid?: boolean;
src?: string;
rotate?: boolean;
beforeCrop?: (file: UploadFile, uploadFiles: UploadFile[]) => boolean;
/**
* @deprecated
*/
modalTitle?: string;
/**
* @deprecated
*/
modalWidth?: number | string;
/**
* @deprecated
*/
modalOk?: string;
/**
* @deprecated
*/
modalCancel?: string;
modalProps?: ModalProps;
onCancel?: () => void;
onOk?: ({ url: string, blob: Blob, area: Area }: {
url: any;
blob: any;
area: any;
}) => void;
modalVisible?: boolean;
children?: React.ReactElement<UploadProps> | React.ReactElement<any>;
cropContent?: (crop: ReactElement<EasyCropProps>) => React.ReactElement<any>;
onCropComplete?: ({ url: string, blob: Blob, area: Area }: {
url: any;
blob: any;
area: any;
}) => void;
prefixCls?: string;
serverCrop?: boolean;
rotateStep?: number;
}
declare const ImgCrop: CompoundedComponent;
export default ImgCrop;