primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
377 lines (372 loc) • 11.8 kB
TypeScript
import * as i0 from '@angular/core';
import { AfterContentInit, EventEmitter, ElementRef, TemplateRef, QueryList } from '@angular/core';
import { AnimationEvent } from '@angular/animations';
import { SafeUrl } from '@angular/platform-browser';
import * as i1 from 'primeng/api';
import { PrimeTemplate } from 'primeng/api';
import { BaseComponent } from 'primeng/basecomponent';
import { Nullable } from 'primeng/ts-helpers';
import * as _primeuix_styled from '@primeuix/styled';
import { BaseStyle } from 'primeng/base';
/**
*
* Displays an image with preview and tranformation options. For multiple image, see Galleria.
*
* [Live Demo](https://www.primeng.org/image/)
*
* @module imagestyle
*
*/
declare enum ImageClasses {
/**
* Class name of the root element
*/
root = "p-image",
/**
* Class name of the preview mask element
*/
previewMask = "p-image-preview-mask",
/**
* Class name of the preview icon element
*/
previewIcon = "p-image-preview-icon",
/**
* Class name of the mask element
*/
mask = "p-image-mask",
/**
* Class name of the toolbar element
*/
toolbar = "p-image-toolbar",
/**
* Class name of the rotate right button element
*/
rotateRightButton = "p-image-rotate-right-button",
/**
* Class name of the rotate left button element
*/
rotateLeftButton = "p-image-rotate-left-button",
/**
* Class name of the zoom out button element
*/
zoomOutButton = "p-image-zoom-out-button",
/**
* Class name of the zoom in button element
*/
zoomInButton = "p-image-zoom-in-button",
/**
* Class name of the close button element
*/
closeButton = "p-image-close-button",
/**
* Class name of the original element
*/
original = "p-image-original"
}
declare class ImageStyle extends BaseStyle {
name: string;
theme: _primeuix_styled.StyleType;
classes: {
root: ({ instance }: {
instance: any;
}) => (string | {
'p-image-preview': any;
})[];
previewMask: string;
previewIcon: string;
mask: string;
toolbar: string;
rotateRightButton: string;
rotateLeftButton: string;
zoomOutButton: ({ instance }: {
instance: any;
}) => (string | {
'p-disabled': any;
})[];
zoomInButton: ({ instance }: {
instance: any;
}) => (string | {
'p-disabled': any;
})[];
closeButton: string;
original: string;
};
static ɵfac: i0.ɵɵFactoryDeclaration<ImageStyle, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ImageStyle>;
}
interface ImageStyle extends BaseStyle {
}
/**
* Displays an image with preview and tranformation options. For multiple image, see Galleria.
* @group Components
*/
declare class Image extends BaseComponent implements AfterContentInit {
/**
* Style class of the image element.
* @group Props
*/
imageClass: string | undefined;
/**
* Inline style of the image element.
* @group Props
*/
imageStyle: {
[klass: string]: any;
} | null | undefined;
/**
* Class of the element.
* @deprecated since v20.0.0, use `class` instead.
* @group Props
*/
styleClass: string | undefined;
/**
* The source path for the main image.
* @group Props
*/
src: string | SafeUrl | undefined;
/**
* The srcset definition for the main image.
* @group Props
*/
srcSet: string | SafeUrl | undefined;
/**
* The sizes definition for the main image.
* @group Props
*/
sizes: string | undefined;
/**
* The source path for the preview image.
* @group Props
*/
previewImageSrc: string | SafeUrl | undefined;
/**
* The srcset definition for the preview image.
* @group Props
*/
previewImageSrcSet: string | SafeUrl | undefined;
/**
* The sizes definition for the preview image.
* @group Props
*/
previewImageSizes: string | undefined;
/**
* Attribute of the preview image element.
* @group Props
*/
alt: string | undefined;
/**
* Attribute of the image element.
* @group Props
*/
width: string | undefined;
/**
* Attribute of the image element.
* @group Props
*/
height: string | undefined;
/**
* Attribute of the image element.
* @group Props
*/
loading: 'lazy' | 'eager' | undefined;
/**
* Controls the preview functionality.
* @group Props
*/
preview: boolean;
/**
* Transition options of the show animation
* @group Props
*/
showTransitionOptions: string;
/**
* Transition options of the hide animation
* @group Props
*/
hideTransitionOptions: string;
/**
* Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name).
* @defaultValue 'self'
* @group Props
*/
appendTo: i0.InputSignal<any>;
/**
* Triggered when the preview overlay is shown.
* @group Emits
*/
onShow: EventEmitter<any>;
/**
* Triggered when the preview overlay is hidden.
* @group Emits
*/
onHide: EventEmitter<any>;
/**
* This event is triggered if an error occurs while loading an image file.
* @param {Event} event - Browser event.
* @group Emits
*/
onImageError: EventEmitter<Event>;
mask: ElementRef | undefined;
previewButton: ElementRef | undefined;
closeButton: ElementRef | undefined;
/**
* Custom template of indicator.
* @group Templates
*/
indicatorTemplate: TemplateRef<any> | undefined;
/**
* Custom template of rotaterighticon.
* @group Templates
*/
rotateRightIconTemplate: TemplateRef<any> | undefined;
/**
* Custom template of rotatelefticon.
* @group Templates
*/
rotateLeftIconTemplate: TemplateRef<any> | undefined;
/**
* Custom template of zoomouticon.
* @group Templates
*/
zoomOutIconTemplate: TemplateRef<any> | undefined;
/**
* Custom template of zoominicon.
* @group Templates
*/
zoomInIconTemplate: TemplateRef<any> | undefined;
/**
* Custom template of closeicon.
* @group Templates
*/
closeIconTemplate: TemplateRef<any> | undefined;
/**
* Custom template of preview.
* @group Templates
*/
previewTemplate: TemplateRef<any> | undefined;
/**
* Custom template of image.
* @group Templates
*/
imageTemplate: TemplateRef<any> | undefined;
maskVisible: boolean;
previewVisible: boolean;
rotate: number;
scale: number;
previewClick: boolean;
container: Nullable<HTMLElement>;
wrapper: Nullable<HTMLElement>;
_componentStyle: ImageStyle;
$appendTo: i0.Signal<any>;
get isZoomOutDisabled(): boolean;
get isZoomInDisabled(): boolean;
private zoomSettings;
constructor();
templates: QueryList<PrimeTemplate> | undefined;
_indicatorTemplate: TemplateRef<any> | undefined;
_rotateRightIconTemplate: TemplateRef<any> | undefined;
_rotateLeftIconTemplate: TemplateRef<any> | undefined;
_zoomOutIconTemplate: TemplateRef<any> | undefined;
_zoomInIconTemplate: TemplateRef<any> | undefined;
_closeIconTemplate: TemplateRef<any> | undefined;
_imageTemplate: TemplateRef<any> | undefined;
_previewTemplate: TemplateRef<any> | undefined;
ngAfterContentInit(): void;
onImageClick(): void;
onMaskClick(): void;
onMaskKeydown(event: any): void;
onPreviewImageClick(): void;
rotateRight(): void;
rotateLeft(): void;
zoomIn(): void;
zoomOut(): void;
onAnimationStart(event: AnimationEvent): void;
onAnimationEnd(event: AnimationEvent): void;
moveOnTop(): void;
appendContainer(): void;
imagePreviewStyle(): {
transform: string;
};
get zoomImageAriaLabel(): string;
handleToolbarClick(event: MouseEvent): void;
closePreview(): void;
imageError(event: Event): void;
rightAriaLabel(): string;
leftAriaLabel(): string;
zoomInAriaLabel(): string;
zoomOutAriaLabel(): string;
closeAriaLabel(): string;
onKeydownHandler(event: KeyboardEvent): void;
static ɵfac: i0.ɵɵFactoryDeclaration<Image, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<Image, "p-image", never, { "imageClass": { "alias": "imageClass"; "required": false; }; "imageStyle": { "alias": "imageStyle"; "required": false; }; "styleClass": { "alias": "styleClass"; "required": false; }; "src": { "alias": "src"; "required": false; }; "srcSet": { "alias": "srcSet"; "required": false; }; "sizes": { "alias": "sizes"; "required": false; }; "previewImageSrc": { "alias": "previewImageSrc"; "required": false; }; "previewImageSrcSet": { "alias": "previewImageSrcSet"; "required": false; }; "previewImageSizes": { "alias": "previewImageSizes"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "preview": { "alias": "preview"; "required": false; }; "showTransitionOptions": { "alias": "showTransitionOptions"; "required": false; }; "hideTransitionOptions": { "alias": "hideTransitionOptions"; "required": false; }; "appendTo": { "alias": "appendTo"; "required": false; "isSignal": true; }; }, { "onShow": "onShow"; "onHide": "onHide"; "onImageError": "onImageError"; }, ["indicatorTemplate", "rotateRightIconTemplate", "rotateLeftIconTemplate", "zoomOutIconTemplate", "zoomInIconTemplate", "closeIconTemplate", "previewTemplate", "imageTemplate", "templates"], never, true, never>;
static ngAcceptInputType_preview: unknown;
}
declare class ImageModule {
static ɵfac: i0.ɵɵFactoryDeclaration<ImageModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<ImageModule, never, [typeof Image, typeof i1.SharedModule], [typeof Image, typeof i1.SharedModule]>;
static ɵinj: i0.ɵɵInjectorDeclaration<ImageModule>;
}
/**
* Defines valid templates in Image.
* @group Templates
*/
interface ImageTemplates {
/**
* Custom template of indicator.
*/
indicator(): TemplateRef<any>;
/**
* Custom template of image.
*/
image(context: {
/**
* Style class of the image element.
*/
class: any;
/**
* Style of the image element.
*/
style: any;
/**
* Image click function.
*/
errorCallback: Function;
}): TemplateRef<{
class: any;
style: any;
errorCallback: Function;
}>;
/**
* Custom preview template.
*/
preview(context: {
/**
* Preview click function.
*/
errorCallback: Function;
}): TemplateRef<{
errorCallback: Function;
}>;
/**
* Custom template of rotaterighticon.
*/
rotaterighticon(): TemplateRef<any>;
/**
* Custom template of rotatelefticon.
*/
rotatelefticon(): TemplateRef<any>;
/**
* Custom template of zoomouticon.
*/
zoomouticon(): TemplateRef<any>;
/**
* Custom template of zoominicon.
*/
zoominicon(): TemplateRef<any>;
/**
* Custom template of closeicon.
*/
closeicon(): TemplateRef<any>;
}
export { Image, ImageClasses, ImageModule, ImageStyle };
export type { ImageTemplates };