UNPKG

ngx-viewer

Version:

Angular 6+ directive for the Viewer.js library

191 lines (185 loc) 6.23 kB
import { __assign } from 'tslib'; import { EventEmitter, Directive, ElementRef, Input, Output, NgModule } from '@angular/core'; import Viewer from 'viewerjs'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgxViewerDirective = /** @class */ (function () { function NgxViewerDirective(elementRef) { this.elementRef = elementRef; this.viewerOptions = {}; this.viewerReady = new EventEmitter(); this.viewerShow = new EventEmitter(); this.viewerShown = new EventEmitter(); this.viewerHide = new EventEmitter(); this.viewerHidden = new EventEmitter(); this.viewerView = new EventEmitter(); this.viewerViewed = new EventEmitter(); this.viewerZoom = new EventEmitter(); this.viewerZoomed = new EventEmitter(); this.nativeElement = this.elementRef.nativeElement; } /** * @return {?} */ NgxViewerDirective.prototype.ngAfterViewInit = /** * @return {?} */ function () { this.initViewer(); }; /** * @private * @return {?} */ NgxViewerDirective.prototype.initViewer = /** * @private * @return {?} */ function () { var _this = this; if (this.instance) { this.instance.destroy(); } this.instance = new Viewer(this.nativeElement, __assign({ transition: false }, this.viewerOptions)); this.nativeElement.addEventListener('ready', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerReady.emit(event); }), false); this.nativeElement.addEventListener('show', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerShow.emit(event); }), false); this.nativeElement.addEventListener('shown', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerShown.emit(event); }), false); this.nativeElement.addEventListener('hide', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerHide.emit(event); }), false); this.nativeElement.addEventListener('hidden', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerHidden.emit(event); }), false); this.nativeElement.addEventListener('view', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerView.emit(event); }), false); this.nativeElement.addEventListener('viewed', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerViewed.emit(event); }), false); this.nativeElement.addEventListener('zoom', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerZoom.emit(event); }), false); this.nativeElement.addEventListener('zoomed', (/** * @param {?} event * @return {?} */ function (event) { return _this.viewerZoomed.emit(event); }), false); }; /** * @return {?} */ NgxViewerDirective.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this.instance) { this.instance.destroy(); } }; NgxViewerDirective.decorators = [ { type: Directive, args: [{ selector: '[ngxViewer]' },] } ]; /** @nocollapse */ NgxViewerDirective.ctorParameters = function () { return [ { type: ElementRef } ]; }; NgxViewerDirective.propDecorators = { viewerOptions: [{ type: Input }], viewerReady: [{ type: Output }], viewerShow: [{ type: Output }], viewerShown: [{ type: Output }], viewerHide: [{ type: Output }], viewerHidden: [{ type: Output }], viewerView: [{ type: Output }], viewerViewed: [{ type: Output }], viewerZoom: [{ type: Output }], viewerZoomed: [{ type: Output }] }; return NgxViewerDirective; }()); if (false) { /** @type {?} */ NgxViewerDirective.prototype.viewerOptions; /** @type {?} */ NgxViewerDirective.prototype.viewerReady; /** @type {?} */ NgxViewerDirective.prototype.viewerShow; /** @type {?} */ NgxViewerDirective.prototype.viewerShown; /** @type {?} */ NgxViewerDirective.prototype.viewerHide; /** @type {?} */ NgxViewerDirective.prototype.viewerHidden; /** @type {?} */ NgxViewerDirective.prototype.viewerView; /** @type {?} */ NgxViewerDirective.prototype.viewerViewed; /** @type {?} */ NgxViewerDirective.prototype.viewerZoom; /** @type {?} */ NgxViewerDirective.prototype.viewerZoomed; /** @type {?} */ NgxViewerDirective.prototype.instance; /** * @type {?} * @private */ NgxViewerDirective.prototype.nativeElement; /** * @type {?} * @private */ NgxViewerDirective.prototype.elementRef; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgxViewerModule = /** @class */ (function () { function NgxViewerModule() { } NgxViewerModule.decorators = [ { type: NgModule, args: [{ imports: [], declarations: [NgxViewerDirective], exports: [NgxViewerDirective] },] } ]; return NgxViewerModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { NgxViewerDirective, NgxViewerModule }; //# sourceMappingURL=ngx-viewer.js.map