import * as _tethys_pro_i18n from '@tethys/pro/i18n'; import * as _angular_core from '@angular/core'; import { OnInit, ElementRef, NgZone, PipeTransform } from '@angular/core'; import Cropper from 'cropperjs'; import * as i6 from 'ngx-tethys/dialog'; import { ThyDialog, ThyDialogContainer } from 'ngx-tethys/dialog'; import * as i7 from 'ngx-tethys/notify'; import { ThyNotifyService } from 'ngx-tethys/notify'; import * as i8 from 'ngx-tethys/slider'; import { ThySliderType } from 'ngx-tethys/slider'; import { Observable } from 'rxjs'; import * as i1 from '@angular/common'; import * as i2 from '@angular/forms'; import * as i3 from 'ngx-tethys/loading'; import * as i4 from 'ngx-tethys/upload'; import * as i5 from 'ngx-tethys/button'; import * as i9 from 'ngx-tethys/icon'; import * as i10 from 'ngx-tethys/tooltip'; interface ThyCropperImageSize { width: number | string; height: number | string; } interface thyCropDataChangeEvent { blob: Blob; } type ThyCropperDragMode = 'crop' | 'move' | 'none'; type ThyCropperViewMode = 0 | 1 | 2 | 3; type ThyCropperShape = 'rect' | 'round'; /** * viewMode 视图模式,选项为 0(移动没有限制)、 1(图片只能在图片内移动而不是整个容器) 、2(图片不全部铺满容器) 、3(图片填充整个容器),default:0, * aspectRatio 裁剪框宽高比 * dragMode 拖拽模式,选项为 'crop'(产生一个新的裁剪框) 'move'(移动) 'none'(不处理) * cropBoxResizable 是否通过拖动来调整剪裁框的大小 * zoomable 是否允许放大图片 * guides 是否显示裁剪框的虚线 * autoCrop 是否允许初始化自动裁剪 * zoomOnWheel 是否允许通过鼠标滚轮缩放图片 * checkCrossOrigin 检查当前图片是否跨域 * preview 预览的容器 设置了aspectRatio属性,确保将预览容器设置为相同的宽高比 * crop() 手动显示裁剪框 * getCroppedCanvas 画一张裁剪的图片 */ interface ThyCropperOptions { aspectRatio?: number; autoCrop?: boolean; checkCrossOrigin?: boolean; crop?(event: CustomEvent): void; cropBoxResizable?: boolean; dragMode?: ThyCropperDragMode; guides?: boolean; movable?: boolean; preview?: HTMLElement | HTMLElement[] | NodeListOf | string; ready?(event: CustomEvent): void; rotatable?: boolean; scalable?: boolean; viewMode?: ThyCropperViewMode; wheelZoomRatio?: number; zoom?(event: CustomEvent): void; zoomOnTouch?: boolean; zoomOnWheel?: boolean; zoomable?: boolean; center?: boolean; } declare class ThyImageCropperComponent implements OnInit { cropperClass: boolean; readonly image: _angular_core.Signal>; locale: _angular_core.Signal<_tethys_pro_i18n.ThyI18nTranslation>; /** * 图片资源 */ readonly thyImage: _angular_core.InputSignal; /** * 图片加载的错误提示 * @default 图片加载错误 */ readonly thyImageErrorMessage: _angular_core.InputSignal; /** * 图片裁剪模式 */ readonly thyViewMode: _angular_core.InputSignal; /** * 图片裁剪宽高比 */ readonly thyAspectRatio: _angular_core.InputSignalWithTransform; /** * 设置裁剪形状 */ readonly thyShape: _angular_core.InputSignal; /** * 设置放大缩小 */ readonly thyScale: _angular_core.InputSignalWithTransform; /** * 设置旋转角度 */ readonly thyRotate: _angular_core.InputSignalWithTransform; /** * 图片裁剪的数据更改(blob) */ readonly thyCropDataChanged: _angular_core.OutputEmitterRef; /** * 图片加载完毕事件 */ readonly thyImageReady: _angular_core.OutputEmitterRef; loadingDone: _angular_core.WritableSignal; cropper: Cropper | undefined; loadError: boolean; private imageFile; imageSrc: string; defaultCropperOptions: ThyCropperOptions; cropperOptions: ThyCropperOptions; constructor(); ngOnInit(): void; onLoad(event: Event): void; onError(event?: Event): void; crop: () => void; setImageSrc(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare class ThyImageCropperDialogComponent implements OnInit { dialog: ThyDialog; dialogContainer: ThyDialogContainer; private ngZone; locale: _angular_core.Signal<_tethys_pro_i18n.ThyI18nTranslation>; /** * 标题 * @default 图片 */ readonly title: _angular_core.InputSignal; /** * 预览大小(支持多个预览) */ readonly previewSizes: _angular_core.InputSignal; /** * 图片资源 */ readonly image: _angular_core.ModelSignal; /** * 上传提示文案 */ readonly uploadTips: _angular_core.InputSignal; /** * 上传指定文件后缀类型 */ readonly uploadAcceptType: _angular_core.InputSignal; /** * 上传,单位`kb`,`0`表示没有任何限制 */ readonly uploadSizeThreshold: _angular_core.InputSignalWithTransform; /** * 图片裁剪模式 */ readonly viewMode: _angular_core.InputSignal; /** * 图片裁剪宽高比 */ readonly aspectRatio: _angular_core.InputSignal; /** * 设置裁剪形状 */ readonly shape: _angular_core.InputSignal; /** * 确定按钮回调方法 */ readonly confirmAction: _angular_core.InputSignal<(file: File) => Observable>; /** * 确定事件 */ readonly thyConfirm: _angular_core.OutputEmitterRef; readonly cropperRef: _angular_core.Signal; saving: boolean; notifyService: ThyNotifyService; scale: number; rotate: number; scaleConfig: { maxScale: number; minScale: number; step: number; }; sliderType: ThySliderType; constructor(dialog: ThyDialog, dialogContainer: ThyDialogContainer, ngZone: NgZone); ngOnInit(): void; selectImage(image: { files: File[]; }): void; save(): void; close(): void; setRotate(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare class ThyCropperSizeTextPipe implements PipeTransform { transform(size: ThyCropperImageSize, previewSizes?: ThyCropperImageSize[]): string; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵpipe: _angular_core.ɵɵPipeDeclaration; } declare class ThyCropperSizeStylePipe implements PipeTransform { transform(size: ThyCropperImageSize): { width: string; height: string; }; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵpipe: _angular_core.ɵɵPipeDeclaration; } declare class ThyImageCropperModule { static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵmod: _angular_core.ɵɵNgModuleDeclaration; static ɵinj: _angular_core.ɵɵInjectorDeclaration; } export { ThyImageCropperComponent, ThyImageCropperDialogComponent, ThyImageCropperModule }; //# sourceMappingURL=tethys-pro-image-cropper.d.ts.map