@ks89/angular-modal-gallery
Version:
Image gallery for Angular
101 lines (100 loc) • 3.72 kB
TypeScript
import { EventEmitter } from '@angular/core';
import { Overlay, OverlayRef } from '@angular/cdk/overlay';
import { ModalGalleryRef } from './modal-gallery-ref';
import { Image, ImageModalEvent } from '../../model/image.class';
import { ConfigService } from '../../services/config.service';
import { ButtonEvent } from '../../model/buttons-config.interface';
import { ModalGalleryConfig } from '../../model/modal-gallery-config.interface';
import * as i0 from "@angular/core";
/**
* Payload to be emitted via {@link triggerAttachToOverlay} to enable {@link AttachToOverlayService}
* to attach the {@link ModalGalleryComponent} to the overlay
*/
export interface AttachToOverlayPayload {
/**
* Overlay object created using Angular CDK APIs
*/
overlayRef: OverlayRef;
/**
* Dialog data to be injected into the {@link ModalGalleryComponent}
* contains: id, array of images, current image and optionally the configuration object
*/
config: ModalGalleryConfig;
/**
* Object to control the dialog instance
*/
dialogRef: ModalGalleryRef;
}
export declare class ModalGalleryService {
private overlay;
private configService;
private updateImages;
updateImages$: import("rxjs").Observable<Image[]>;
private dialogRef;
triggerAttachToOverlay: EventEmitter<AttachToOverlayPayload>;
constructor(overlay: Overlay, configService: ConfigService);
/**
* Method to open modal gallery passing the configuration
* @param config ModalGalleryConfig that contains: id, array of images, current image and optionally the configuration object
* @return ModalGalleryRef | undefined is the object used to listen for events.
*/
open(config: ModalGalleryConfig): ModalGalleryRef | undefined;
/**
* Method to close a modal gallery previously opened.
* @param id Unique identifier of the modal gallery
* @param clickOutside boolean is true if closed clicking on the modal backdrop, false otherwise.
*/
close(id: number, clickOutside: boolean): void;
/**
* Method to update images array.
* @param images Image[] updated array of images
*/
updateModalImages(images: Image[]): void;
/**
* Method to emit close event.
* @param event ImageModalEvent is the event payload
*/
emitClose(event: ImageModalEvent): void;
/**
* Method to emit show event.
* @param event ImageModalEvent is the event payload
*/
emitShow(event: ImageModalEvent): void;
/**
* Method to emit firstImage event.
* @param event ImageModalEvent is the event payload
*/
emitFirstImage(event: ImageModalEvent): void;
/**
* Method to emit lastImage event.
* @param event ImageModalEvent is the event payload
*/
emitLastImage(event: ImageModalEvent): void;
/**
* Method to emit hasData event.
* @param event ImageModalEvent is the event payload
*/
emitHasData(event: ImageModalEvent): void;
/**
* Method to emit buttonBeforeHook event.
* @param event ButtonEvent is the event payload
*/
emitButtonBeforeHook(event: ButtonEvent): void;
/**
* Method to emit buttonAfterHook event.
* @param event ButtonEvent is the event payload
*/
emitButtonAfterHook(event: ButtonEvent): void;
/**
* Private method to create an Overlay using Angular CDK APIs
* @private
*/
private createOverlay;
/**
* Private method to create an OverlayConfig instance
* @private
*/
private getOverlayConfig;
static ɵfac: i0.ɵɵFactoryDeclaration<ModalGalleryService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ModalGalleryService>;
}