UNPKG

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

837 lines (814 loc) 35.3 kB
import { trigger, transition, style, animate } from '@angular/animations'; import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Injectable, EventEmitter, inject, booleanAttribute, HostListener, ContentChildren, ContentChild, ViewChild, Output, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core'; import { blockBodyScroll, focus, addClass, appendChild, unblockBodyScroll } from '@primeuix/utils'; import { SharedModule, PrimeTemplate } from 'primeng/api'; import { BaseComponent } from 'primeng/basecomponent'; import { FocusTrap } from 'primeng/focustrap'; import { RefreshIcon, EyeIcon, UndoIcon, SearchMinusIcon, SearchPlusIcon, TimesIcon } from 'primeng/icons'; import { ZIndexUtils } from 'primeng/utils'; import { BaseStyle } from 'primeng/base'; const theme = ({ dt }) => ` .p-image-mask { display: flex; align-items: center; justify-content: center; } .p-image-preview { position: relative; display: inline-flex; line-height: 0; } .p-image-preview-mask { position: absolute; inset-inline-start: 0; inset-block-start: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; border: 0 none; padding: 0; cursor: pointer; background: transparent; color: ${dt('image.preview.mask.color')}; transition: background ${dt('image.transition.duration')}; } .p-image-preview:hover > .p-image-preview-mask { opacity: 1; cursor: pointer; background: ${dt('image.preview.mask.background')}; } .p-image-preview-icon { font-size: ${dt('image.preview.icon.size')}; width: ${dt('image.preview.icon.size')}; height: ${dt('image.preview.icon.size')}; } .p-image-toolbar { position: absolute; inset-block-start: ${dt('image.toolbar.position.top')}; inset-inline-end: ${dt('image.toolbar.position.right')}; inset-inline-start: ${dt('image.toolbar.position.left')}; inset-block-end: ${dt('image.toolbar.position.bottom')}; display: flex; z-index: 1; padding: ${dt('image.toolbar.padding')}; background: ${dt('image.toolbar.background')}; backdrop-filter: blur(${dt('image.toolbar.blur')}); border-color: ${dt('image.toolbar.border.color')}; border-style: solid; border-width: ${dt('image.toolbar.border.width')}; border-radius: ${dt('image.toolbar.border.radius')}; gap: ${dt('image.toolbar.gap')}; } .p-image-action { display: inline-flex; justify-content: center; align-items: center; color: ${dt('image.action.color')}; background: transparent; width: ${dt('image.action.size')}; height: ${dt('image.action.size')}; margin: 0; padding: 0; border: 0 none; cursor: pointer; user-select: none; border-radius: ${dt('image.action.border.radius')}; outline-color: transparent; transition: background ${dt('image.transition.duration')}, color ${dt('image.transition.duration')}, outline-color ${dt('image.transition.duration')}, box-shadow ${dt('image.transition.duration')}; } .p-image-action:hover { color: ${dt('image.action.hover.color')}; background: ${dt('image.action.hover.background')}; } .p-image-action:focus-visible { box-shadow: ${dt('toolbar.action.focus.ring.shadow')}; outline: ${dt('toolbar.action.focus.ring.width')} ${dt('toolbar.action.focus.ring.style')} ${dt('toolbar.action.focus.ring.color')}; outline-offset: ${dt('toolbar.action.focus.ring.offset')}; } .p-image-action .p-icon { font-size: ${dt('image.action.icon.size')}; width: ${dt('image.action.icon.size')}; height: ${dt('image.action.icon.size')}; } .p-image-action.p-disabled { pointer-events: auto; } .p-image-original { transition: transform 0.15s; max-width: 100vw; max-height: 100vh; } .p-image-original-enter-active { transition: all 150ms cubic-bezier(0, 0, 0.2, 1); } .p-image-original-leave-active { transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1); } .p-image-original-enter-from, .p-image-original-leave-to { opacity: 0; transform: scale(0.7); } `; const classes = { root: ({ props }) => [ 'p-image p-component', { 'p-image-preview': props.preview } ], previewMask: 'p-image-preview-mask', previewIcon: 'p-image-preview-icon', mask: 'p-image-mask p-overlay-mask p-overlay-mask-enter', toolbar: 'p-image-toolbar', rotateRightButton: 'p-image-action p-image-rotate-right-button', rotateLeftButton: 'p-image-action p-image-rotate-left-button', zoomOutButton: ({ instance }) => [ 'p-image-action p-image-zoom-out-button', { 'p-disabled': instance.isZoomOutDisabled } ], zoomInButton: ({ instance }) => [ 'p-image-action p-image-zoom-in-button', { 'p-disabled': instance.isZoomInDisabled } ], closeButton: 'p-image-action p-image-close-button', original: 'p-image-original' }; class ImageStyle extends BaseStyle { name = 'image'; theme = theme; classes = classes; static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ImageStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ImageStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ImageStyle, decorators: [{ type: Injectable }] }); /** * * Displays an image with preview and tranformation options. For multiple image, see Galleria. * * [Live Demo](https://www.primeng.org/image/) * * @module imagestyle * */ var ImageClasses; (function (ImageClasses) { /** * Class name of the root element */ ImageClasses["root"] = "p-image"; /** * Class name of the preview mask element */ ImageClasses["previewMask"] = "p-image-preview-mask"; /** * Class name of the preview icon element */ ImageClasses["previewIcon"] = "p-image-preview-icon"; /** * Class name of the mask element */ ImageClasses["mask"] = "p-image-mask"; /** * Class name of the toolbar element */ ImageClasses["toolbar"] = "p-image-toolbar"; /** * Class name of the rotate right button element */ ImageClasses["rotateRightButton"] = "p-image-rotate-right-button"; /** * Class name of the rotate left button element */ ImageClasses["rotateLeftButton"] = "p-image-rotate-left-button"; /** * Class name of the zoom out button element */ ImageClasses["zoomOutButton"] = "p-image-zoom-out-button"; /** * Class name of the zoom in button element */ ImageClasses["zoomInButton"] = "p-image-zoom-in-button"; /** * Class name of the close button element */ ImageClasses["closeButton"] = "p-image-close-button"; /** * Class name of the original element */ ImageClasses["original"] = "p-image-original"; })(ImageClasses || (ImageClasses = {})); /** * Displays an image with preview and tranformation options. For multiple image, see Galleria. * @group Components */ class Image extends BaseComponent { /** * Style class of the image element. * @group Props */ imageClass; /** * Inline style of the image element. * @group Props */ imageStyle; /** * Class of the element. * @group Props */ styleClass; /** * Inline style of the element. * @group Props */ style; /** * The source path for the main image. * @group Props */ src; /** * The srcset definition for the main image. * @group Props */ srcSet; /** * The sizes definition for the main image. * @group Props */ sizes; /** * The source path for the preview image. * @group Props */ previewImageSrc; /** * The srcset definition for the preview image. * @group Props */ previewImageSrcSet; /** * The sizes definition for the preview image. * @group Props */ previewImageSizes; /** * Attribute of the preview image element. * @group Props */ alt; /** * Attribute of the image element. * @group Props */ width; /** * Attribute of the image element. * @group Props */ height; /** * Attribute of the image element. * @group Props */ loading; /** * Target element to attach the dialog, 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). * @group Props */ appendTo; /** * Controls the preview functionality. * @group Props */ preview = false; /** * Transition options of the show animation * @group Props */ showTransitionOptions = '150ms cubic-bezier(0, 0, 0.2, 1)'; /** * Transition options of the hide animation * @group Props */ hideTransitionOptions = '150ms cubic-bezier(0, 0, 0.2, 1)'; /** * Triggered when the preview overlay is shown. * @group Emits */ onShow = new EventEmitter(); /** * Triggered when the preview overlay is hidden. * @group Emits */ onHide = new EventEmitter(); /** * This event is triggered if an error occurs while loading an image file. * @param {Event} event - Browser event. * @group Emits */ onImageError = new EventEmitter(); mask; previewButton; closeButton; /** * Custom template of indicator. * @group Templates */ indicatorTemplate; /** * Custom template of rotaterighticon. * @group Templates */ rotateRightIconTemplate; /** * Custom template of rotatelefticon. * @group Templates */ rotateLeftIconTemplate; /** * Custom template of zoomouticon. * @group Templates */ zoomOutIconTemplate; /** * Custom template of zoominicon. * @group Templates */ zoomInIconTemplate; /** * Custom template of closeicon. * @group Templates */ closeIconTemplate; /** * Custom template of preview. * @group Templates */ previewTemplate; /** * Custom template of image. * @group Templates */ imageTemplate; maskVisible = false; previewVisible = false; rotate = 0; scale = 1; previewClick = false; container; wrapper; _componentStyle = inject(ImageStyle); get isZoomOutDisabled() { return this.scale - this.zoomSettings.step <= this.zoomSettings.min; } get isZoomInDisabled() { return this.scale + this.zoomSettings.step >= this.zoomSettings.max; } zoomSettings = { default: 1, step: 0.1, max: 1.5, min: 0.5 }; constructor() { super(); } templates; _indicatorTemplate; _rotateRightIconTemplate; _rotateLeftIconTemplate; _zoomOutIconTemplate; _zoomInIconTemplate; _closeIconTemplate; _imageTemplate; _previewTemplate; ngAfterContentInit() { this.templates?.forEach((item) => { switch (item.getType()) { case 'indicator': this._indicatorTemplate = item.template; break; case 'rotaterighticon': this._rotateRightIconTemplate = item.template; break; case 'rotatelefticon': this._rotateLeftIconTemplate = item.template; break; case 'zoomouticon': this._zoomOutIconTemplate = item.template; break; case 'zoominicon': this._zoomInIconTemplate = item.template; break; case 'closeicon': this._closeIconTemplate = item.template; break; case 'image': this._imageTemplate = item.template; break; case 'preview': this._previewTemplate = item.template; break; default: this._indicatorTemplate = item.template; break; } }); } onImageClick() { if (this.preview) { this.maskVisible = true; this.previewVisible = true; blockBodyScroll(); } } onMaskClick() { if (!this.previewClick) { this.closePreview(); } this.previewClick = false; } onMaskKeydown(event) { switch (event.code) { case 'Escape': this.onMaskClick(); setTimeout(() => { focus(this.previewButton.nativeElement); }, 25); event.preventDefault(); break; default: break; } } onPreviewImageClick() { this.previewClick = true; } rotateRight() { this.rotate += 90; this.previewClick = true; } rotateLeft() { this.rotate -= 90; this.previewClick = true; } zoomIn() { this.scale = this.scale + this.zoomSettings.step; this.previewClick = true; } zoomOut() { this.scale = this.scale - this.zoomSettings.step; this.previewClick = true; } onAnimationStart(event) { switch (event.toState) { case 'visible': this.container = event.element; this.wrapper = this.container?.parentElement; this.appendContainer(); this.moveOnTop(); setTimeout(() => { focus(this.closeButton.nativeElement); }, 25); break; case 'void': addClass(this.wrapper, 'p-overlay-mask-leave'); break; } } onAnimationEnd(event) { switch (event.toState) { case 'void': ZIndexUtils.clear(this.wrapper); this.maskVisible = false; this.container = null; this.wrapper = null; this.cd.markForCheck(); this.onHide.emit({}); break; case 'visible': this.onShow.emit({}); break; } } moveOnTop() { ZIndexUtils.set('modal', this.wrapper, this.config.zIndex.modal); } appendContainer() { if (this.appendTo) { if (this.appendTo === 'body') this.document.body.appendChild(this.wrapper); else appendChild(this.appendTo, this.wrapper); } } imagePreviewStyle() { return { transform: 'rotate(' + this.rotate + 'deg) scale(' + this.scale + ')' }; } get zoomImageAriaLabel() { return this.config.translation.aria ? this.config.translation.aria.zoomImage : undefined; } containerClass() { return { 'p-image p-component': true, 'p-image-preview': this.preview }; } handleToolbarClick(event) { event.stopPropagation(); } closePreview() { this.previewVisible = false; this.rotate = 0; this.scale = this.zoomSettings.default; unblockBodyScroll(); } imageError(event) { this.onImageError.emit(event); } rightAriaLabel() { return this.config.translation.aria ? this.config.translation.aria.rotateRight : undefined; } leftAriaLabel() { return this.config.translation.aria ? this.config.translation.aria.rotateLeft : undefined; } zoomInAriaLabel() { return this.config.translation.aria ? this.config.translation.aria.zoomIn : undefined; } zoomOutAriaLabel() { return this.config.translation.aria ? this.config.translation.aria.zoomOut : undefined; } closeAriaLabel() { return this.config.translation.aria ? this.config.translation.aria.close : undefined; } onKeydownHandler(event) { if (this.previewVisible) { this.closePreview(); } } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: Image, deps: [], target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.2", type: Image, isStandalone: true, selector: "p-image", inputs: { imageClass: "imageClass", imageStyle: "imageStyle", styleClass: "styleClass", style: "style", src: "src", srcSet: "srcSet", sizes: "sizes", previewImageSrc: "previewImageSrc", previewImageSrcSet: "previewImageSrcSet", previewImageSizes: "previewImageSizes", alt: "alt", width: "width", height: "height", loading: "loading", appendTo: "appendTo", preview: ["preview", "preview", booleanAttribute], showTransitionOptions: "showTransitionOptions", hideTransitionOptions: "hideTransitionOptions" }, outputs: { onShow: "onShow", onHide: "onHide", onImageError: "onImageError" }, host: { listeners: { "document:keydown.escape": "onKeydownHandler($event)" } }, providers: [ImageStyle], queries: [{ propertyName: "indicatorTemplate", first: true, predicate: ["indicator"] }, { propertyName: "rotateRightIconTemplate", first: true, predicate: ["rotaterighticon"] }, { propertyName: "rotateLeftIconTemplate", first: true, predicate: ["rotatelefticon"] }, { propertyName: "zoomOutIconTemplate", first: true, predicate: ["zoomouticon"] }, { propertyName: "zoomInIconTemplate", first: true, predicate: ["zoominicon"] }, { propertyName: "closeIconTemplate", first: true, predicate: ["closeicon"] }, { propertyName: "previewTemplate", first: true, predicate: ["preview"] }, { propertyName: "imageTemplate", first: true, predicate: ["image"] }, { propertyName: "templates", predicate: PrimeTemplate }], viewQueries: [{ propertyName: "mask", first: true, predicate: ["mask"], descendants: true }, { propertyName: "previewButton", first: true, predicate: ["previewButton"], descendants: true }, { propertyName: "closeButton", first: true, predicate: ["closeButton"], descendants: true }], usesInheritance: true, ngImport: i0, template: ` <span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style"> <ng-container *ngIf="!imageTemplate && !_imageTemplate"> <img [attr.src]="src" [attr.srcset]="srcSet" [attr.sizes]="sizes" [attr.alt]="alt" [attr.width]="width" [attr.height]="height" [attr.loading]="loading" [ngStyle]="imageStyle" [class]="imageClass" (error)="imageError($event)" /> </ng-container> <ng-container *ngTemplateOutlet="imageTemplate || _imageTemplate; context: { errorCallback: imageError.bind(this) }"></ng-container> <button *ngIf="preview" [attr.aria-label]="zoomImageAriaLabel" type="button" class="p-image-preview-mask" (click)="onImageClick()" #previewButton [ngStyle]="{ height: height + 'px', width: width + 'px' }"> <ng-container *ngIf="indicatorTemplate || !_indicatorTemplate; else defaultTemplate"> <ng-container *ngTemplateOutlet="indicatorTemplate || _indicatorTemplate"></ng-container> </ng-container> <ng-template #defaultTemplate> <EyeIcon [styleClass]="'p-image-preview-icon'" /> </ng-template> </button> <div #mask class="p-image-mask p-overlay-mask p-overlay-mask-enter" *ngIf="maskVisible" [attr.aria-modal]="maskVisible" role="dialog" (click)="onMaskClick()" (keydown)="onMaskKeydown($event)" pFocusTrap> <div class="p-image-toolbar" (click)="handleToolbarClick($event)"> <button class="p-image-action p-image-rotate-right-button" (click)="rotateRight()" type="button" [attr.aria-label]="rightAriaLabel()"> <RefreshIcon *ngIf="!rotateRightIconTemplate && !_rotateRightIconTemplate" /> <ng-template *ngTemplateOutlet="rotateRightIconTemplate || _rotateRightIconTemplate"></ng-template> </button> <button class="p-image-action p-image-rotate-left-button" (click)="rotateLeft()" type="button" [attr.aria-label]="leftAriaLabel()"> <UndoIcon *ngIf="!rotateLeftIconTemplate && !_rotateLeftIconTemplate" /> <ng-template *ngTemplateOutlet="rotateLeftIconTemplate || _rotateLeftIconTemplate"></ng-template> </button> <button [ngClass]="{ 'p-image-action p-image-zoom-out-button': true, 'p-disabled': isZoomOutDisabled }" (click)="zoomOut()" type="button" [disabled]="isZoomOutDisabled" [attr.aria-label]="zoomOutAriaLabel()"> <SearchMinusIcon *ngIf="!zoomOutIconTemplate && !_zoomOutIconTemplate" /> <ng-template *ngTemplateOutlet="zoomOutIconTemplate || _zoomOutIconTemplate"></ng-template> </button> <button [ngClass]="{ 'p-image-action p-image-zoom-in-button': true, 'p-disabled': isZoomOutDisabled }" (click)="zoomIn()" type="button" [disabled]="isZoomInDisabled" [attr.aria-label]="zoomInAriaLabel()"> <SearchPlusIcon *ngIf="!zoomInIconTemplate && !_zoomInIconTemplate" /> <ng-template *ngTemplateOutlet="zoomInIconTemplate || _zoomInIconTemplate"></ng-template> </button> <button class="p-image-action p-image-close-button" type="button" (click)="closePreview()" [attr.aria-label]="closeAriaLabel()" #closeButton> <TimesIcon *ngIf="!closeIconTemplate && !_closeIconTemplate" /> <ng-template *ngTemplateOutlet="closeIconTemplate || _closeIconTemplate"></ng-template> </button> </div> <div *ngIf="previewVisible" [@animation]="{ value: 'visible', params: { showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions } }" (@animation.start)="onAnimationStart($event)" (@animation.done)="onAnimationEnd($event)" > <ng-container *ngIf="!previewTemplate && !_previewTemplate"> <img [attr.src]="previewImageSrc ? previewImageSrc : src" [attr.srcset]="previewImageSrcSet" [attr.sizes]="previewImageSizes" class="p-image-original" [ngStyle]="imagePreviewStyle()" (click)="onPreviewImageClick()" /> </ng-container> <ng-container *ngTemplateOutlet=" previewTemplate || _previewTemplate; context: { class: 'p-image-original', style: imagePreviewStyle(), previewCallback: onPreviewImageClick.bind(this) } " > </ng-container> </div> </div> </span> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: RefreshIcon, selector: "RefreshIcon" }, { kind: "component", type: EyeIcon, selector: "EyeIcon" }, { kind: "component", type: UndoIcon, selector: "UndoIcon" }, { kind: "component", type: SearchMinusIcon, selector: "SearchMinusIcon" }, { kind: "component", type: SearchPlusIcon, selector: "SearchPlusIcon" }, { kind: "component", type: TimesIcon, selector: "TimesIcon" }, { kind: "directive", type: FocusTrap, selector: "[pFocusTrap]", inputs: ["pFocusTrapDisabled"] }, { kind: "ngmodule", type: SharedModule }], animations: [ trigger('animation', [ transition('void => visible', [style({ transform: 'scale(0.7)', opacity: 0 }), animate('{{showTransitionParams}}')]), transition('visible => void', [animate('{{hideTransitionParams}}', style({ transform: 'scale(0.7)', opacity: 0 }))]) ]) ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: Image, decorators: [{ type: Component, args: [{ selector: 'p-image', standalone: true, imports: [CommonModule, RefreshIcon, EyeIcon, UndoIcon, SearchMinusIcon, SearchPlusIcon, TimesIcon, FocusTrap, SharedModule], template: ` <span [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="style"> <ng-container *ngIf="!imageTemplate && !_imageTemplate"> <img [attr.src]="src" [attr.srcset]="srcSet" [attr.sizes]="sizes" [attr.alt]="alt" [attr.width]="width" [attr.height]="height" [attr.loading]="loading" [ngStyle]="imageStyle" [class]="imageClass" (error)="imageError($event)" /> </ng-container> <ng-container *ngTemplateOutlet="imageTemplate || _imageTemplate; context: { errorCallback: imageError.bind(this) }"></ng-container> <button *ngIf="preview" [attr.aria-label]="zoomImageAriaLabel" type="button" class="p-image-preview-mask" (click)="onImageClick()" #previewButton [ngStyle]="{ height: height + 'px', width: width + 'px' }"> <ng-container *ngIf="indicatorTemplate || !_indicatorTemplate; else defaultTemplate"> <ng-container *ngTemplateOutlet="indicatorTemplate || _indicatorTemplate"></ng-container> </ng-container> <ng-template #defaultTemplate> <EyeIcon [styleClass]="'p-image-preview-icon'" /> </ng-template> </button> <div #mask class="p-image-mask p-overlay-mask p-overlay-mask-enter" *ngIf="maskVisible" [attr.aria-modal]="maskVisible" role="dialog" (click)="onMaskClick()" (keydown)="onMaskKeydown($event)" pFocusTrap> <div class="p-image-toolbar" (click)="handleToolbarClick($event)"> <button class="p-image-action p-image-rotate-right-button" (click)="rotateRight()" type="button" [attr.aria-label]="rightAriaLabel()"> <RefreshIcon *ngIf="!rotateRightIconTemplate && !_rotateRightIconTemplate" /> <ng-template *ngTemplateOutlet="rotateRightIconTemplate || _rotateRightIconTemplate"></ng-template> </button> <button class="p-image-action p-image-rotate-left-button" (click)="rotateLeft()" type="button" [attr.aria-label]="leftAriaLabel()"> <UndoIcon *ngIf="!rotateLeftIconTemplate && !_rotateLeftIconTemplate" /> <ng-template *ngTemplateOutlet="rotateLeftIconTemplate || _rotateLeftIconTemplate"></ng-template> </button> <button [ngClass]="{ 'p-image-action p-image-zoom-out-button': true, 'p-disabled': isZoomOutDisabled }" (click)="zoomOut()" type="button" [disabled]="isZoomOutDisabled" [attr.aria-label]="zoomOutAriaLabel()"> <SearchMinusIcon *ngIf="!zoomOutIconTemplate && !_zoomOutIconTemplate" /> <ng-template *ngTemplateOutlet="zoomOutIconTemplate || _zoomOutIconTemplate"></ng-template> </button> <button [ngClass]="{ 'p-image-action p-image-zoom-in-button': true, 'p-disabled': isZoomOutDisabled }" (click)="zoomIn()" type="button" [disabled]="isZoomInDisabled" [attr.aria-label]="zoomInAriaLabel()"> <SearchPlusIcon *ngIf="!zoomInIconTemplate && !_zoomInIconTemplate" /> <ng-template *ngTemplateOutlet="zoomInIconTemplate || _zoomInIconTemplate"></ng-template> </button> <button class="p-image-action p-image-close-button" type="button" (click)="closePreview()" [attr.aria-label]="closeAriaLabel()" #closeButton> <TimesIcon *ngIf="!closeIconTemplate && !_closeIconTemplate" /> <ng-template *ngTemplateOutlet="closeIconTemplate || _closeIconTemplate"></ng-template> </button> </div> <div *ngIf="previewVisible" [@animation]="{ value: 'visible', params: { showTransitionParams: showTransitionOptions, hideTransitionParams: hideTransitionOptions } }" (@animation.start)="onAnimationStart($event)" (@animation.done)="onAnimationEnd($event)" > <ng-container *ngIf="!previewTemplate && !_previewTemplate"> <img [attr.src]="previewImageSrc ? previewImageSrc : src" [attr.srcset]="previewImageSrcSet" [attr.sizes]="previewImageSizes" class="p-image-original" [ngStyle]="imagePreviewStyle()" (click)="onPreviewImageClick()" /> </ng-container> <ng-container *ngTemplateOutlet=" previewTemplate || _previewTemplate; context: { class: 'p-image-original', style: imagePreviewStyle(), previewCallback: onPreviewImageClick.bind(this) } " > </ng-container> </div> </div> </span> `, animations: [ trigger('animation', [ transition('void => visible', [style({ transform: 'scale(0.7)', opacity: 0 }), animate('{{showTransitionParams}}')]), transition('visible => void', [animate('{{hideTransitionParams}}', style({ transform: 'scale(0.7)', opacity: 0 }))]) ]) ], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [ImageStyle] }] }], ctorParameters: () => [], propDecorators: { imageClass: [{ type: Input }], imageStyle: [{ type: Input }], styleClass: [{ type: Input }], style: [{ type: Input }], src: [{ type: Input }], srcSet: [{ type: Input }], sizes: [{ type: Input }], previewImageSrc: [{ type: Input }], previewImageSrcSet: [{ type: Input }], previewImageSizes: [{ type: Input }], alt: [{ type: Input }], width: [{ type: Input }], height: [{ type: Input }], loading: [{ type: Input }], appendTo: [{ type: Input }], preview: [{ type: Input, args: [{ transform: booleanAttribute }] }], showTransitionOptions: [{ type: Input }], hideTransitionOptions: [{ type: Input }], onShow: [{ type: Output }], onHide: [{ type: Output }], onImageError: [{ type: Output }], mask: [{ type: ViewChild, args: ['mask'] }], previewButton: [{ type: ViewChild, args: ['previewButton'] }], closeButton: [{ type: ViewChild, args: ['closeButton'] }], indicatorTemplate: [{ type: ContentChild, args: ['indicator', { descendants: false }] }], rotateRightIconTemplate: [{ type: ContentChild, args: ['rotaterighticon', { descendants: false }] }], rotateLeftIconTemplate: [{ type: ContentChild, args: ['rotatelefticon', { descendants: false }] }], zoomOutIconTemplate: [{ type: ContentChild, args: ['zoomouticon', { descendants: false }] }], zoomInIconTemplate: [{ type: ContentChild, args: ['zoominicon', { descendants: false }] }], closeIconTemplate: [{ type: ContentChild, args: ['closeicon', { descendants: false }] }], previewTemplate: [{ type: ContentChild, args: ['preview', { descendants: false }] }], imageTemplate: [{ type: ContentChild, args: ['image', { descendants: false }] }], templates: [{ type: ContentChildren, args: [PrimeTemplate] }], onKeydownHandler: [{ type: HostListener, args: ['document:keydown.escape', ['$event']] }] } }); class ImageModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ImageModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.2", ngImport: i0, type: ImageModule, imports: [Image, SharedModule], exports: [Image, SharedModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ImageModule, imports: [Image, SharedModule, SharedModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: ImageModule, decorators: [{ type: NgModule, args: [{ imports: [Image, SharedModule], exports: [Image, SharedModule] }] }] }); /** * Generated bundle index. Do not edit. */ export { Image, ImageClasses, ImageModule, ImageStyle }; //# sourceMappingURL=primeng-image.mjs.map