UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

40 lines (39 loc) 1.52 kB
import { ForwardRefExoticComponent, ImgHTMLAttributes, MouseEventHandler, PropsWithoutRef, ReactNode, RefAttributes, SourceHTMLAttributes } from 'react'; import { ObjectFitProperty, ObjectPositionProperty } from 'csstype'; import PictureContext, { PictureProvider } from './PictureContext'; 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?: ObjectFitProperty; objectPosition?: ObjectPositionProperty<string | 0>; sources?: SourceHTMLAttributes<HTMLSourceElement>[]; status?: ImageStatus; onClick?: MouseEventHandler<HTMLPictureElement>; onPreview?: () => void; children?: ReactNode; } 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;