UNPKG

7.22 kBTypeScriptView Raw
1import { ElementRef, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
2import { DomSanitizer, SafeStyle, SafeUrl } from '@angular/platform-browser';
3import { CropperOptions, CropperPosition, Dimensions, ImageCroppedEvent, ImageTransform, LoadedImage } from '../interfaces';
4import { OutputFormat } from '../interfaces/cropper-options.interface';
5import { CropperState } from './cropper.state';
6import { MoveTypes, Position } from '../interfaces/move-start.interface';
7import { BasicEvent } from '../interfaces/basic-event.interface';
8import * as i0 from "@angular/core";
9export declare class ImageCropperComponent implements OnChanges, OnInit, OnDestroy {
10 private sanitizer;
11 private readonly pinchStart$;
12 private readonly cropService;
13 private readonly loadImageService;
14 private setImageMaxSizeRetries;
15 private moveStart?;
16 private resizedWhileHidden;
17 protected readonly moveTypes: typeof MoveTypes;
18 protected readonly state: CropperState;
19 readonly safeImgDataUrl: import("@angular/core").WritableSignal<string | SafeUrl | undefined>;
20 readonly safeTransformStyle: import("@angular/core").WritableSignal<string | SafeStyle | undefined>;
21 marginLeft: SafeStyle | string;
22 imageVisible: boolean;
23 wrapper: ElementRef<HTMLDivElement>;
24 sourceImage: ElementRef<HTMLDivElement>;
25 imageChangedEvent?: Event | null;
26 imageURL?: string;
27 imageBase64?: string;
28 imageFile?: File;
29 imageAltText?: string;
30 options?: Partial<CropperOptions>;
31 cropperFrameAriaLabel?: string;
32 output?: 'blob' | 'base64';
33 format?: OutputFormat;
34 autoCrop?: boolean;
35 cropper?: CropperPosition;
36 transform?: ImageTransform;
37 maintainAspectRatio?: boolean;
38 aspectRatio?: number;
39 resetCropOnAspectRatioChange?: boolean;
40 resizeToWidth?: number;
41 resizeToHeight?: number;
42 cropperMinWidth?: number;
43 cropperMinHeight?: number;
44 cropperMaxHeight?: number;
45 cropperMaxWidth?: number;
46 cropperStaticWidth?: number;
47 cropperStaticHeight?: number;
48 canvasRotation?: number;
49 initialStepSize?: number;
50 roundCropper?: boolean;
51 onlyScaleDown?: boolean;
52 imageQuality?: number;
53 backgroundColor?: string;
54 containWithinAspectRatio?: boolean;
55 hideResizeSquares?: boolean;
56 allowMoveImage: boolean;
57 checkImageType: boolean;
58 alignImage?: 'left' | 'center';
59 disabled: boolean;
60 hidden: boolean;
61 readonly imageCropped: import("@angular/core").OutputEmitterRef<ImageCroppedEvent>;
62 readonly startCropImage: import("@angular/core").OutputEmitterRef<void>;
63 readonly imageLoaded: import("@angular/core").OutputEmitterRef<LoadedImage>;
64 readonly cropperReady: import("@angular/core").OutputEmitterRef<Dimensions>;
65 readonly loadImageFailed: import("@angular/core").OutputEmitterRef<void>;
66 readonly transformChange: import("@angular/core").OutputEmitterRef<ImageTransform>;
67 readonly cropperChange: import("@angular/core").OutputEmitterRef<CropperPosition>;
68 get alignImageStyle(): "left" | "center";
69 constructor(sanitizer: DomSanitizer);
70 ngOnInit(): void;
71 ngOnChanges(changes: SimpleChanges): void;
72 private onChangesInputImage;
73 private isValidImageChangedEvent;
74 private reset;
75 private loadImageFile;
76 private loadBase64Image;
77 private loadImageFromURL;
78 private setLoadedImage;
79 loadImageError(error: unknown): void;
80 private setCssTransform;
81 imageLoadedInView(): void;
82 private checkImageMaxSizeRecursively;
83 private sourceImageLoaded;
84 onResize(): void;
85 keyboardAccess(event: KeyboardEvent): void;
86 private changeKeyboardStepSize;
87 private keyboardMoveCropper;
88 startMove(event: Event | BasicEvent, moveType: MoveTypes, position?: Position | null): void;
89 private initMouseMove;
90 private handleMouseMove;
91 private handleMouseUp;
92 startPinch(event: TouchEvent): void;
93 private initPinch;
94 private handlePinchMove;
95 private handlePinchStop;
96 private setMaxSize;
97 private emitCropperPositionChange;
98 private doAutoCrop;
99 crop(): ImageCroppedEvent | null;
100 crop(output: 'base64'): ImageCroppedEvent | null;
101 crop(output: 'blob'): Promise<ImageCroppedEvent> | null;
102 private cropToBlob;
103 private cropToBase64;
104 resetCropperPosition(): void;
105 ngOnDestroy(): void;
106 static ɵfac: i0.ɵɵFactoryDeclaration<ImageCropperComponent, never>;
107 static ɵcmp: i0.ɵɵComponentDeclaration<ImageCropperComponent, "image-cropper", never, { "imageChangedEvent": { "alias": "imageChangedEvent"; "required": false; }; "imageURL": { "alias": "imageURL"; "required": false; }; "imageBase64": { "alias": "imageBase64"; "required": false; }; "imageFile": { "alias": "imageFile"; "required": false; }; "imageAltText": { "alias": "imageAltText"; "required": false; }; "options": { "alias": "options"; "required": false; }; "cropperFrameAriaLabel": { "alias": "cropperFrameAriaLabel"; "required": false; }; "output": { "alias": "output"; "required": false; }; "format": { "alias": "format"; "required": false; }; "autoCrop": { "alias": "autoCrop"; "required": false; }; "cropper": { "alias": "cropper"; "required": false; }; "transform": { "alias": "transform"; "required": false; }; "maintainAspectRatio": { "alias": "maintainAspectRatio"; "required": false; }; "aspectRatio": { "alias": "aspectRatio"; "required": false; }; "resetCropOnAspectRatioChange": { "alias": "resetCropOnAspectRatioChange"; "required": false; }; "resizeToWidth": { "alias": "resizeToWidth"; "required": false; }; "resizeToHeight": { "alias": "resizeToHeight"; "required": false; }; "cropperMinWidth": { "alias": "cropperMinWidth"; "required": false; }; "cropperMinHeight": { "alias": "cropperMinHeight"; "required": false; }; "cropperMaxHeight": { "alias": "cropperMaxHeight"; "required": false; }; "cropperMaxWidth": { "alias": "cropperMaxWidth"; "required": false; }; "cropperStaticWidth": { "alias": "cropperStaticWidth"; "required": false; }; "cropperStaticHeight": { "alias": "cropperStaticHeight"; "required": false; }; "canvasRotation": { "alias": "canvasRotation"; "required": false; }; "initialStepSize": { "alias": "initialStepSize"; "required": false; }; "roundCropper": { "alias": "roundCropper"; "required": false; }; "onlyScaleDown": { "alias": "onlyScaleDown"; "required": false; }; "imageQuality": { "alias": "imageQuality"; "required": false; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; }; "containWithinAspectRatio": { "alias": "containWithinAspectRatio"; "required": false; }; "hideResizeSquares": { "alias": "hideResizeSquares"; "required": false; }; "allowMoveImage": { "alias": "allowMoveImage"; "required": false; }; "checkImageType": { "alias": "checkImageType"; "required": false; }; "alignImage": { "alias": "alignImage"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hidden": { "alias": "hidden"; "required": false; }; }, { "imageCropped": "imageCropped"; "startCropImage": "startCropImage"; "imageLoaded": "imageLoaded"; "cropperReady": "cropperReady"; "loadImageFailed": "loadImageFailed"; "transformChange": "transformChange"; "cropperChange": "cropperChange"; }, never, never, true, never>;
108}