UNPKG

ngx-super-croppie

Version:

NgxSuperCroppie is a simple angular8+ wrapper for croppie

98 lines (97 loc) 3.24 kB
/** * wrapper for croppie * @packageDocumentation */ import { ElementRef, EventEmitter, OnInit } from '@angular/core'; import Croppie, { CroppieOptions, ResultOptions, CropData } from 'croppie'; import * as i0 from "@angular/core"; export declare class NgxSuperCroppieComponent implements OnInit { /** * reference to croppie div */ croppie: ElementRef; /** * croppie options. See: * https://foliotek.github.io/Croppie/ */ croppieOptions: CroppieOptions; /** * URL to image */ private _url; get url(): string; set url(url: string); /** * Array of points that translate into [topLeftX, topLeftY, bottomRightX, bottomRightY] */ points: number[]; /** * Custom orientation, applied after exif orientation (if enabled). * Only works with enableOrientation option enabled (see 'Options'). * * Valid options are: * 1 unchanged * 2 flipped horizontally * 3 rotated 180 degrees * 4 flipped vertically * 5 flipped horizontally, then rotated left by 90 degrees * 6 rotated clockwise by 90 degrees * 7 flipped horizontally, then rotated right by 90 degrees * 8 rotated counter-clockwise by 90 degrees */ orientation: number; /** * Apply zoom after image has been bound */ zoom: number; /** * Options for result. See: * https://foliotek.github.io/Croppie/ */ resultOptions: ResultOptions; /** * event emitted to parent */ result: EventEmitter<string | HTMLElement | Blob | HTMLCanvasElement>; /** * croppie object */ _croppie: Croppie; /** * init cropper */ ngOnInit(): void; /** * get crop data * @returns crop points, and the zoom of the image. */ get(): CropData; /** * Bind an image to the croppie. * Returns a promise to be resolved when the image has been loaded * and the croppie has been initialized. */ private bind; /** * Destroy a croppie instance and remove it from the DOM */ destroy(): void; /** * emits croppie result to parent */ croppieResult(): Promise<void>; /** * Rotate the image by a specified degree amount. * Only works with enableOrientation option enabled (see 'Options') * @param degrees degrees of rotation */ rotate(degrees: 90 | 180 | 270 | -90 | -180 | -270): void; /** * Set the zoom of a Croppie instance. The value passed in is * still restricted to the min/max set by Croppie. * @param zoom zoom value */ setZoom(zoom: number): void; static ɵfac: i0.ɵɵFactoryDeclaration<NgxSuperCroppieComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NgxSuperCroppieComponent, "ngx-super-croppie", never, { "croppieOptions": { "alias": "croppieOptions"; "required": false; }; "url": { "alias": "url"; "required": false; }; "points": { "alias": "points"; "required": false; }; "orientation": { "alias": "orientation"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "resultOptions": { "alias": "resultOptions"; "required": false; }; }, { "result": "result"; }, never, never, false, never>; }