UNPKG

@enexus/dialog

Version:

@enexus/dialog - User Should call delete, confirm Method and also user can create they own component dialog.

292 lines (282 loc) 11.4 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/dialog'), require('rxjs/operators'), require('@angular/common'), require('@enexus/flipper-vendors')) : typeof define === 'function' && define.amd ? define('dialog', ['exports', '@angular/core', '@angular/material/dialog', 'rxjs/operators', '@angular/common', '@enexus/flipper-vendors'], factory) : (global = global || self, factory(global.dialog = {}, global.ng.core, global.ng.material.dialog, global.rxjs.operators, global.ng.common, global['@enexus/flipper-vendors'])); }(this, (function (exports, core, dialog, operators, common, flipperVendors) { 'use strict'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {string} */ var DialogSize = { SIZE_SM: 'dialog-sm', SIZE_MD: 'dialog-md', SIZE_LG: 'dialog-lg', SIZE_FULL: 'dialog-full', }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function DeleteDialogData() { } if (false) { /** @type {?} */ DeleteDialogData.prototype.name; /** @type {?} */ DeleteDialogData.prototype.items; /** @type {?|undefined} */ DeleteDialogData.prototype.helpPageId; } var DeleteDialogComponent = /** @class */ (function () { function DeleteDialogComponent(dialogRef, data) { this.dialogRef = dialogRef; this.data = data; } DeleteDialogComponent.decorators = [ { type: core.Component, args: [{ selector: 'lib-delete-dialog', template: "<h1 mat-dialog-title>Delete {{data.name}}</h1>\r\n<div mat-dialog-content>\r\n <!-- <lib-help-anchor [pageId]=\"data.helpPageId\"></lib-help-anchor> -->\r\n Please confirm that you want to delete the following {{data.name | lowercase}}(s):\r\n <ul>\r\n <li *ngFor=\"let item of data.items\">{{item}}</li>\r\n </ul>\r\n</div>\r\n<div mat-dialog-actions>\r\n <button mat-button (click)=\"dialogRef.close()\">Cancel</button>\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" cdkFocusInitial>Confirm\r\n </button>\r\n</div>\r\n", styles: [""] }] } ]; /** @nocollapse */ DeleteDialogComponent.ctorParameters = function () { return [ { type: dialog.MatDialogRef }, { type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] } ]; }; return DeleteDialogComponent; }()); if (false) { /** @type {?} */ DeleteDialogComponent.prototype.dialogRef; /** @type {?} */ DeleteDialogComponent.prototype.data; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function ConfirmDialogData() { } if (false) { /** @type {?} */ ConfirmDialogData.prototype.title; /** @type {?} */ ConfirmDialogData.prototype.message; } var ConfirmDialogComponent = /** @class */ (function () { function ConfirmDialogComponent(dialogRef, data) { this.dialogRef = dialogRef; this.data = data; } ConfirmDialogComponent.decorators = [ { type: core.Component, args: [{ selector: 'lib-confirm-dialog', template: "<h1 mat-dialog-title>{{data.title}}</h1>\r\n<div mat-dialog-content>\r\n {{data.message}}\r\n</div>\r\n<div mat-dialog-actions>\r\n <button mat-button (click)=\"dialogRef.close()\">Cancel</button>\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" cdkFocusInitial>Confirm\r\n </button>\r\n</div>\r\n", styles: [""] }] } ]; /** @nocollapse */ ConfirmDialogComponent.ctorParameters = function () { return [ { type: dialog.MatDialogRef }, { type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] } ]; }; return ConfirmDialogComponent; }()); if (false) { /** @type {?} */ ConfirmDialogComponent.prototype.dialogRef; /** @type {?} */ ConfirmDialogComponent.prototype.data; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var WaitDialogComponent = /** @class */ (function () { function WaitDialogComponent(progress) { this.progress = progress; } Object.defineProperty(WaitDialogComponent.prototype, "progress", { get: /** * @return {?} */ function () { return this._progress; }, set: /** * @param {?} progress * @return {?} */ function (progress) { this._progress = progress; }, enumerable: true, configurable: true }); WaitDialogComponent.decorators = [ { type: core.Component, args: [{ selector: 'lib-wait-dialog', template: "<h1 mat-dialog-title>{{progress.title}}</h1>\r\n<div mat-dialog-content>\r\n <mat-progress-bar mode=\"determinate\" [value]=\"progress.progress\">\r\n </mat-progress-bar>\r\n</div>\r\n", styles: [""] }] } ]; /** @nocollapse */ WaitDialogComponent.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] } ]; }; return WaitDialogComponent; }()); if (false) { /** * @type {?} * @private */ WaitDialogComponent.prototype._progress; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DialogService = /** @class */ (function () { function DialogService(dialog) { this.dialog = dialog; } /** * @template T, D, R * @param {?} componentOrTemplateRef * @param {?=} size * @param {?=} data * @return {?} */ DialogService.prototype.open = /** * @template T, D, R * @param {?} componentOrTemplateRef * @param {?=} size * @param {?=} data * @return {?} */ function (componentOrTemplateRef, size, data) { if (size === void 0) { size = DialogSize.SIZE_SM; } /** @type {?} */ var dialogRef = this.dialog.open(componentOrTemplateRef, { panelClass: size, data: data }); return dialogRef.afterClosed().pipe(operators.filter((/** * @param {?} result * @return {?} */ function (result) { return result !== undefined; }))); }; /** * @param {?} name * @param {?} items * @param {?=} helpPageId * @return {?} */ DialogService.prototype.delete = /** * @param {?} name * @param {?} items * @param {?=} helpPageId * @return {?} */ function (name, items, helpPageId) { return this.open(DeleteDialogComponent, DialogSize.SIZE_MD, { name: name, items: items, helpPageId: helpPageId, }); }; /** * @param {?} title * @param {?} message * @return {?} */ DialogService.prototype.confirm = /** * @param {?} title * @param {?} message * @return {?} */ function (title, message) { return this.open(ConfirmDialogComponent, DialogSize.SIZE_MD, { title: title, message: message, }); }; /** * @param {?} progress * @return {?} */ DialogService.prototype.wait = /** * @param {?} progress * @return {?} */ function (progress) { return this.dialog.open(WaitDialogComponent, { panelClass: DialogSize.SIZE_MD, data: progress, disableClose: true, }); }; DialogService.decorators = [ { type: core.Injectable } ]; /** @nocollapse */ DialogService.ctorParameters = function () { return [ { type: dialog.MatDialog } ]; }; return DialogService; }()); if (false) { /** @type {?} */ DialogService.prototype.dialog; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DialogModule = /** @class */ (function () { function DialogModule() { } DialogModule.decorators = [ { type: core.NgModule, args: [{ imports: [ common.CommonModule, flipperVendors.VendorsModule ], declarations: [ DeleteDialogComponent, WaitDialogComponent, ConfirmDialogComponent, ], exports: [ DeleteDialogComponent, WaitDialogComponent, ConfirmDialogComponent, ], entryComponents: [ DeleteDialogComponent, WaitDialogComponent, ConfirmDialogComponent, ], providers: [ DialogService, ] },] } ]; return DialogModule; }()); exports.DialogModule = DialogModule; exports.DialogService = DialogService; exports.ɵa = DeleteDialogComponent; exports.ɵb = WaitDialogComponent; exports.ɵd = ConfirmDialogComponent; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=dialog.umd.js.map