0.0.2 • Published 1 year ago

ngx-super-dialog-gallery v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

ngx-super-dialog-gallery

Simple, easy and performance dialog gallery (image , video , content) for angular. (subport for angular v.15).

Demo

Usage

1. Install

npm install ngx-super-dialog-gallery --save

import NgxDialogGalleryModule

import { NgxDialogGalleryModule } form "ngx-super-dialog-gallery";

@NgModule({
  imports: [BorwserModule, NgxDialogGalleryModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})

export class AppModule {}

2. Template

<ng-template let-data #gallery>
  <ngx-dialog-gallery [isShowZoomIcon]="true" [tooltipCloseText]="'กดปุ่ม Esc เพื่อปิด'" [isShowFullscreenIcon]="true" [isShowFullscreen]="false" [tooltipFullscreenText]="'ออกจากโหมดเต็มจอ'" [tooltipMinimizeFullscreenText]="'เข้าสู่โหมดเต็มจอ'" [isAction]="isAction" [classOverlay]="[]" (eventClose)="clickClose($event)" (eventChange)="clickTurn($event)">
    <ng-container content></ng-container>
  </ngx-dialog-gallery>
</ng-template>

Method

NameDescription
clickClose()click to close dialog gallery.
clickZoom()click to zoom image, not zoom video.
clickNavigateBefore()click image or video before.
clickNavigateNext()click image or video next.
checkIsArray()check data value array or object.
checkType()check type data value image or video.

How call component methods

@ViewChild('gallery', { read: TemplateRef, static: false })
public gallery!: TemplateRef<any>;

public clickOpenDialogGallery(index: number, item: any) {
    this.dialogRef = this.dialog.open(this.gallery, {
        autoFocus: false,
        restoreFocus: false,
        data: {
            index: item ? index : null,
            gallery: this.galleryImages
        }
    });

    this.dialogRef.afterClosed().subscribe((result: any) => {
        if (result) {

        }
    });
}

API

Config

NameTypeDefaultSummary
isShowZoomIconbooleantrueFor showing the icon to zoom the image.
tooltipCloseTextstringกดปุ่ม Esc เพื่อปิดText to be displayed when closing.
isShowFullscreenIconbooleantrueFor showing the icon to fullscreen the image and video.
isShowFullscreenbooleanfalsefor full screen.
tooltipFullscreenTextstringออกจากโหมดเต็มจอText to be displayed when fullscreen.
tooltipMinimizeFullscreenTextstringเข้าสู่โหมดเต็มจอText to be displayed when minimized fullscreen.
classOverlaystring[]['']add class in overlay.
isActionbooleantrueActions that affect (clickClose, clickNavigateBefore, clickNavigateNext)
eventCloseEventEmitter<any>-Events
eventChangeEventEmitter<any>-Events