choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
42 lines (41 loc) • 1.56 kB
TypeScript
import { ForwardRefExoticComponent, ImgHTMLAttributes, MouseEventHandler, PropsWithoutRef, ReactNode, RefAttributes, SourceHTMLAttributes } from 'react';
import { Property } from 'csstype';
import PictureContext, { PictureProvider } from './PictureContext';
import { ModalProps } from '../modal/interface';
export declare type ImageStatus = 'loaded' | 'error' | 'empty';
export interface PictureProps extends ImgHTMLAttributes<HTMLImageElement> {
prefixCls?: string;
width?: number;
height?: number;
index?: number;
lazy?: boolean;
block?: boolean;
border?: boolean;
preview?: boolean;
previewUrl?: string;
downloadUrl?: string | Function;
previewTarget?: string;
objectFit?: Property.ObjectFit;
objectPosition?: Property.ObjectPosition;
sources?: SourceHTMLAttributes<HTMLSourceElement>[];
status?: ImageStatus;
onClick?: MouseEventHandler<HTMLPictureElement>;
onPreview?: () => void;
children?: ReactNode;
modalProps?: ModalProps;
}
export interface PictureRef {
src?: string | undefined;
downloadUrl?: string | Function | undefined;
}
export interface PictureForwardRef {
preview(): any;
getImage(): HTMLImageElement | null;
}
declare const ForwardPicture: ForwardRefExoticComponent<PropsWithoutRef<PictureProps> & RefAttributes<PictureForwardRef>>;
export declare type ForwardPictureType = typeof ForwardPicture & {
Provider: typeof PictureProvider;
Context: typeof PictureContext;
};
declare const _default: ForwardPictureType;
export default _default;