UNPKG

@neocomplexx/ngx-neo-modal

Version:

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.5.

849 lines (842 loc) 36 kB
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { Component, ChangeDetectorRef, ViewChild, Injectable, NgModule } from '@angular/core'; import { __awaiter, __generator, __spread } from 'tslib'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; /** * @fileoverview added by tsickle * Generated from: lib/ngx-neo-modal.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgxNeoModalComponent = /** @class */ (function () { function NgxNeoModalComponent(activeModal, changeRef) { this.activeModal = activeModal; this.changeRef = changeRef; // Default config this.config = { title: { visibility: true, text: 'This is a title' }, message: 'This is a message', type: null, input: { visibility: false, placeholder: 'Ingrese su texto aquí', value: null, autofocus: false, id: 'neoInput' }, button: { yes: { visibility: false, autofocus: false, text: 'Si', id: 'neoBtnYes' }, no: { visibility: false, autofocus: false, text: 'No', id: 'neoBtnNo' }, retry: { visibility: false, autofocus: false, text: 'Reintentar', id: 'neoBtnRetry' }, cancel: { visibility: true, autofocus: false, text: 'Cancelar', id: 'neoBtnCancel' }, accept: { visibility: true, autofocus: true, text: 'Aceptar', id: 'neoBtnAccept' }, } }; } /** * @return {?} */ NgxNeoModalComponent.prototype.ngAfterViewInit = /** * @return {?} */ function () { var _this = this; setTimeout((/** * @return {?} */ function () { return _this.activeFocus(); }), 0); }; /** * @private * @param {?=} inputModal * @return {?} */ NgxNeoModalComponent.prototype.activeFocus = /** * @private * @param {?=} inputModal * @return {?} */ function (inputModal) { if (inputModal === void 0) { inputModal = true; } /** @type {?} */ var foc = this.getButtonFocus(); /** @type {?} */ var inputFocus = this.getInputFocus(); // Find element in DOM and focus. if (inputFocus && inputModal && (!foc || foc === 'neoBtnAccept')) { this.input.nativeElement.focus(); } else if (foc) { /** @type {?} */ var button = this.btn.nativeElement.children.namedItem(foc); if (button) { button.focus(); } } }; /** * @private * @return {?} */ NgxNeoModalComponent.prototype.getButtonFocus = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var button = Object.keys(this.config.button) .find((/** * @param {?} key * @return {?} */ function (key) { return _this.config.button[key].visibility && _this.config.button[key].autofocus; })); if (button) { return this.config.button[button].id; } else { return null; } }; /** * @private * @return {?} */ NgxNeoModalComponent.prototype.getInputFocus = /** * @private * @return {?} */ function () { if (this.config.input.visibility && this.config.input.autofocus) { return this.config.input.id; } else { return null; } }; /** * @param {?} res * @return {?} */ NgxNeoModalComponent.prototype.informResult = /** * @param {?} res * @return {?} */ function (res) { /** @type {?} */ var button = AlertButton[res]; /** @type {?} */ var respuesta = new AlertResult(button, this.config.input.value); this.activeModal.close(respuesta); this.activeModal.dismiss(respuesta); }; /** * @return {?} */ NgxNeoModalComponent.prototype.setFocus = /** * @return {?} */ function () { this.activeFocus(false); }; NgxNeoModalComponent.decorators = [ { type: Component, args: [{ template: "<div id=\"myModal\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\" aria-label=\"Close\" data-dismiss=\"myModal\" (click)=\"informResult('None')\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body text-center\">\n <div class=\"icons\">\n <div *ngIf=\"config.type === 'success'\" class=\"swal2-icon swal2-success swal2-animate-success-icon\">\n <div class=\"swal2-success-circular-line-left\"></div>\n <span class=\"swal2-success-line-tip swal2-animate-success-line-tip\"></span>\n <span class=\"swal2-success-line-long swal2-animate-success-line-long\"></span>\n <div class=\"swal2-success-ring\"></div>\n <div class=\"swal2-success-fix\"></div>\n <div class=\"swal2-success-circular-line-right\"></div>\n </div>\n\n <div *ngIf=\"config.type === 'error'\" class=\"swal2-icon swal2-error swal2-animate-error-icon\">\n <span class=\"swal2-x-mark swal2-animate-x-mark\">\n <span class=\"swal2-x-mark-line-left\"></span>\n <span class=\"swal2-x-mark-line-right\"></span>\n </span>\n </div>\n\n <div *ngIf=\"config.type === 'warning'\" class=\"swal2-icon swal2-warning\">!</div>\n\n <div *ngIf=\"config.type === 'info'\" class=\"swal2-icon swal2-info\">i</div>\n\n <div *ngIf=\"config.type === 'question'\" class=\"swal2-icon swal2-question\">?</div>\n </div>\n\n <h4 *ngIf='config.title.visibility'>{{config.title.text}}</h4>\n <p>{{config.message}}</p>\n <div class=\"form-group\">\n <input id=\"neoInput\" #myInput *ngIf='config.input.visibility' class=\"form-control\" [(ngModel)]=\"config.input.value\" placeholder={{config.input.placeholder}}\n type='text' (keyup.enter)=\"setFocus()\">\n </div>\n </div>\n\n <div #buttons class=\"modal-footer\">\n <button id=\"neoBtnAccept\" *ngIf='config.button.accept.visibility' type=\"button\" class=\"btn btn-primary\" (click)=\"informResult('Accept')\">{{config.button.accept.text}}</button>\n <button id=\"neoBtnCancel\" *ngIf='config.button.cancel.visibility' type=\"button\" class=\"btn btn-primary\" (click)=\"informResult('Cancel')\">{{config.button.cancel.text}}</button>\n <button id=\"neoBtnYes\" *ngIf='config.button.yes.visibility' type=\"button\" class=\"btn btn-primary\" (click)=\"informResult('Yes')\">{{config.button.yes.text}}</button>\n <button id=\"neoBtnRetry\" *ngIf='config.button.retry.visibility' type=\"button\" class=\"btn btn-primary\" (click)=\"informResult('Retry')\">{{config.button.retry.text}}</button>\n <button id=\"neoBtnNo\" *ngIf='config.button.no.visibility' type=\"button\" class=\"btn btn-primary\" (click)=\"informResult('No')\">{{config.button.no.text}}</button>\n </div>\n\n</div>", styles: [".modal-footer,.modal-header{border:0}@-webkit-keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes showSweetAlert{0%{-webkit-transform:scale(.7);transform:scale(.7)}45%{-webkit-transform:scale(1.05);transform:scale(1.05)}80%{-webkit-transform:scale(.95);transform:scale(.95)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}@keyframes hideSweetAlert{0%{-webkit-transform:scale(1);transform:scale(1);opacity:1}100%{-webkit-transform:scale(.5);transform:scale(.5);opacity:0}}.swal2-show{-webkit-animation:.3s showSweetAlert;animation:.3s showSweetAlert}.swal2-show.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-hide{-webkit-animation:.15s forwards hideSweetAlert;animation:.15s forwards hideSweetAlert}.swal2-hide.swal2-noanimation{-webkit-animation:none;animation:none}@-webkit-keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animate-success-tip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animate-success-long{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}100%,12%{-webkit-transform:rotate(-405deg);transform:rotate(-405deg)}}.swal2-animate-success-line-tip{-webkit-animation:.75s animate-success-tip;animation:.75s animate-success-tip}.swal2-animate-success-line-long{-webkit-animation:.75s animate-success-long;animation:.75s animate-success-long}@-webkit-keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}@keyframes animate-error-icon{0%{-webkit-transform:rotateX(100deg);transform:rotateX(100deg);opacity:0}100%{-webkit-transform:rotateX(0);transform:rotateX(0);opacity:1}}.swal2-animate-error-icon{-webkit-animation:.5s animate-error-icon;animation:.5s animate-error-icon}@-webkit-keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}@keyframes animate-x-mark{0%,50%{-webkit-transform:scale(.4);transform:scale(.4);margin-top:26px;opacity:0}80%{-webkit-transform:scale(1.15);transform:scale(1.15);margin-top:-6px}100%{-webkit-transform:scale(1);transform:scale(1);margin-top:0;opacity:1}}.swal2-animate-x-mark{-webkit-animation:.5s animate-x-mark;animation:.5s animate-x-mark}@-webkit-keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes rotate-loading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.swal2-success.swal2-animate-success-icon .swal2-success-circular-line-right{-webkit-animation:4.25s ease-in rotatePlaceholder;animation:4.25s ease-in rotatePlaceholder}.swal2-icon{width:80px;height:80px;border:4px solid transparent;border-radius:50%;margin:20px auto 30px;padding:0;position:relative;box-sizing:content-box;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;display:block}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{position:absolute;height:5px;width:47px;background-color:#f27474;display:block;top:37px;border-radius:2px}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.swal2-icon.swal2-warning{font-family:\"Helvetica Neue\",Helvetica,Arial,sans-serif;color:#f8bb86;border-color:#facea8;font-size:60px;line-height:80px;text-align:center}.swal2-icon.swal2-info{font-family:\"Open Sans\",sans-serif;color:#3fc3ee;border-color:#9de0f6;font-size:60px;line-height:80px;text-align:center}.swal2-icon.swal2-question{font-family:\"Helvetica Neue\",Helvetica,Arial,sans-serif;color:#87adbd;border-color:#c9dae1;font-size:60px;line-height:80px;text-align:center}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{border-radius:50%;position:absolute;width:60px;height:120px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px}.swal2-icon.swal2-success .swal2-success-ring{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.swal2-icon.swal2-success .swal2-success-fix{width:7px;height:90px;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{height:5px;background-color:#a5dc86;display:block;border-radius:2px;position:absolute;z-index:2}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}"] }] } ]; /** @nocollapse */ NgxNeoModalComponent.ctorParameters = function () { return [ { type: NgbActiveModal }, { type: ChangeDetectorRef } ]; }; NgxNeoModalComponent.propDecorators = { btn: [{ type: ViewChild, args: ['buttons', { static: true },] }], input: [{ type: ViewChild, args: ['myInput', { static: false },] }] }; return NgxNeoModalComponent; }()); if (false) { /** @type {?} */ NgxNeoModalComponent.prototype.config; /** @type {?} */ NgxNeoModalComponent.prototype.btn; /** @type {?} */ NgxNeoModalComponent.prototype.input; /** @type {?} */ NgxNeoModalComponent.prototype.activeModal; /** @type {?} */ NgxNeoModalComponent.prototype.changeRef; } var AlertResult = /** @class */ (function () { function AlertResult(ButtonResponse, messageInput) { this.ButtonResponse = ButtonResponse; this.messageInput = messageInput; } return AlertResult; }()); if (false) { /** @type {?} */ AlertResult.prototype.ButtonResponse; /** @type {?} */ AlertResult.prototype.messageInput; } /** @enum {number} */ var AlertButton = { None: 0, Accept: 1, Cancel: 2, Yes: 4, No: 8, Retry: 16, }; AlertButton[AlertButton.None] = 'None'; AlertButton[AlertButton.Accept] = 'Accept'; AlertButton[AlertButton.Cancel] = 'Cancel'; AlertButton[AlertButton.Yes] = 'Yes'; AlertButton[AlertButton.No] = 'No'; AlertButton[AlertButton.Retry] = 'Retry'; /** * @fileoverview added by tsickle * Generated from: lib/ngx-neo-modal.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgxNeoModalService = /** @class */ (function () { function NgxNeoModalService(modalService) { var _this = this; this.modalService = modalService; this.originalAlert = window.alert; window.alert = (/** * @param {?} msg * @return {?} */ function (msg) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.alert(msg)]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }); } /** * @private * @param {?} config * @return {?} */ NgxNeoModalService.prototype.openModal = /** * @private * @param {?} config * @return {?} */ function (config) { return __awaiter(this, void 0, void 0, function () { var modalRef; return __generator(this, function (_a) { switch (_a.label) { case 0: modalRef = this.modalService.open(NgxNeoModalComponent, { backdrop: 'static', keyboard: false, centered: true, windowClass: 'neoWindow' }); modalRef.componentInstance.config = (this.mergeDeep(modalRef.componentInstance.config, config)); modalRef.componentInstance.changeRef.markForCheck(); return [4 /*yield*/, modalRef.result]; case 1: return [2 /*return*/, _a.sent()]; } }); }); }; /** * Show message. Can be use as window.alert */ /** * Show message. Can be use as window.alert * @param {?} msg * @param {?=} autofocus * @return {?} */ NgxNeoModalService.prototype.alert = /** * Show message. Can be use as window.alert * @param {?} msg * @param {?=} autofocus * @return {?} */ function (msg, autofocus) { if (autofocus === void 0) { autofocus = false; } return __awaiter(this, void 0, void 0, function () { var config; return __generator(this, function (_a) { switch (_a.label) { case 0: config = { title: { visibility: false }, message: msg, button: { cancel: { visibility: false }, accept: { autofocus: autofocus, } } }; return [4 /*yield*/, this.openModal(config)]; case 1: _a.sent(); return [2 /*return*/]; } }); }); }; /** * * Show succsessfull message */ /** * * Show succsessfull message * @param {?} msg * @param {?=} autofocus * @return {?} */ NgxNeoModalService.prototype.success = /** * * Show succsessfull message * @param {?} msg * @param {?=} autofocus * @return {?} */ function (msg, autofocus) { if (autofocus === void 0) { autofocus = true; } return __awaiter(this, void 0, void 0, function () { var config; return __generator(this, function (_a) { config = { title: { text: '¡Buen trabajo!' }, message: msg, type: 'success', button: { cancel: { visibility: false }, accept: { autofocus: autofocus, } } }; return [2 /*return*/, this.openModal(config)]; }); }); }; /** * * Warning message */ /** * * Warning message * @param {?} msg * @param {?=} autofocus * @return {?} */ NgxNeoModalService.prototype.warning = /** * * Warning message * @param {?} msg * @param {?=} autofocus * @return {?} */ function (msg, autofocus) { if (autofocus === void 0) { autofocus = false; } return __awaiter(this, void 0, void 0, function () { var config; return __generator(this, function (_a) { config = { title: { text: '¡Cuidado!' }, message: msg, type: 'warning', button: { cancel: { visibility: false }, accept: { autofocus: autofocus, } } }; return [2 /*return*/, this.openModal(config)]; }); }); }; /** * * Error message */ /** * * Error message * @param {?} msg * @param {?=} autofocus * @return {?} */ NgxNeoModalService.prototype.error = /** * * Error message * @param {?} msg * @param {?=} autofocus * @return {?} */ function (msg, autofocus) { if (autofocus === void 0) { autofocus = true; } return __awaiter(this, void 0, void 0, function () { var config; return __generator(this, function (_a) { config = { title: { text: '¡Error!' }, message: msg, type: 'error', button: { cancel: { visibility: false }, accept: { autofocus: autofocus, } } }; return [2 /*return*/, this.openModal(config)]; }); }); }; /** * * Information message */ /** * * Information message * @param {?} msg * @param {?=} autofocus * @return {?} */ NgxNeoModalService.prototype.info = /** * * Information message * @param {?} msg * @param {?=} autofocus * @return {?} */ function (msg, autofocus) { if (autofocus === void 0) { autofocus = true; } return __awaiter(this, void 0, void 0, function () { var config; return __generator(this, function (_a) { config = { title: { text: '¡Información importante!' }, message: msg, type: 'info', button: { cancel: { visibility: false }, accept: { autofocus: autofocus, } } }; return [2 /*return*/, this.openModal(config)]; }); }); }; /** * * Show decission modal with question and two options for accept or reject. */ // tslint:disable-next-line:max-line-length /** * * Show decission modal with question and two options for accept or reject. * @param {?} questionMsg * @param {?=} successMsg * @param {?=} cancelMsg * @param {?=} autofocus * @return {?} */ // tslint:disable-next-line:max-line-length NgxNeoModalService.prototype.decision = /** * * Show decission modal with question and two options for accept or reject. * @param {?} questionMsg * @param {?=} successMsg * @param {?=} cancelMsg * @param {?=} autofocus * @return {?} */ // tslint:disable-next-line:max-line-length function (questionMsg, successMsg, cancelMsg, autofocus) { if (autofocus === void 0) { autofocus = AlertButton.Cancel; } return __awaiter(this, void 0, void 0, function () { var buttonAcceptFocus, buttonCancelFocus, config; var _this = this; return __generator(this, function (_a) { buttonAcceptFocus = autofocus === AlertButton.Accept; buttonCancelFocus = autofocus === AlertButton.Cancel; config = { title: { text: '¿Está seguro?' }, message: questionMsg, type: 'question', button: { cancel: { autofocus: buttonCancelFocus }, accept: { autofocus: buttonAcceptFocus } } }; return [2 /*return*/, this.openModal(config) .then((/** * @param {?} value * @return {?} */ function (value) { if (value.ButtonResponse === AlertButton.Accept) { if (successMsg && successMsg !== '') { _this.success(successMsg); } } else { if (cancelMsg) { _this.info(cancelMsg); } } return Promise.resolve(value); }))]; }); }); }; /** * * Input text message */ // tslint:disable-next-line:max-line-length /** * * Input text message * @param {?} title * @param {?} placeholder * @param {?=} successMsg * @param {?=} autofocus * @param {?=} buttonAutofocus * @return {?} */ // tslint:disable-next-line:max-line-length NgxNeoModalService.prototype.input = /** * * Input text message * @param {?} title * @param {?} placeholder * @param {?=} successMsg * @param {?=} autofocus * @param {?=} buttonAutofocus * @return {?} */ // tslint:disable-next-line:max-line-length function (title, placeholder, successMsg, autofocus, buttonAutofocus) { if (autofocus === void 0) { autofocus = true; } if (buttonAutofocus === void 0) { buttonAutofocus = AlertButton.Accept; } return __awaiter(this, void 0, void 0, function () { var buttonAcceptFocus, buttonCancelFocus, config; var _this = this; return __generator(this, function (_a) { buttonAcceptFocus = buttonAutofocus === AlertButton.Accept; buttonCancelFocus = buttonAutofocus === AlertButton.Cancel; config = { title: { text: title }, message: '', input: { placeholder: placeholder, visibility: true, autofocus: autofocus }, button: { accepct: { autofocus: buttonAcceptFocus }, cancel: { autofocus: buttonCancelFocus } } }; return [2 /*return*/, this.openModal(config) .then((/** * @param {?} value * @return {?} */ function (value) { if (value.ButtonResponse === AlertButton.Accept) { if (successMsg) { _this.success(successMsg); } } return Promise.resolve(value); }))]; }); }); }; // tslint:disable:no-bitwise // tslint:disable:no-bitwise /** * @param {?} title * @param {?} message * @param {?} buttonFocus * @return {?} */ NgxNeoModalService.prototype.yesNoCancel = // tslint:disable:no-bitwise /** * @param {?} title * @param {?} message * @param {?} buttonFocus * @return {?} */ function (title, message, buttonFocus) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.custom(title, message, (AlertButton.Yes | AlertButton.No | AlertButton.Cancel), buttonFocus)]; }); }); }; /** * @private * @param {?} title * @param {?} message * @param {?} buttons * @param {?} buttonFocus * @return {?} */ NgxNeoModalService.prototype.custom = /** * @private * @param {?} title * @param {?} message * @param {?} buttons * @param {?} buttonFocus * @return {?} */ function (title, message, buttons, buttonFocus) { return __awaiter(this, void 0, void 0, function () { var buttonAccept, buttonYes, buttonCancel, buttonNo, buttonRetry, buttonAcceptFocus, buttonYesFocus, buttonCancelFocus, buttonNoFocus, buttonRetryFocus, config; return __generator(this, function (_a) { buttonAccept = (buttons & AlertButton.Accept) > 0; buttonYes = (buttons & AlertButton.Yes) > 0; buttonCancel = (buttons & AlertButton.Cancel) > 0; buttonNo = (buttons & AlertButton.No) > 0; buttonRetry = (buttons & AlertButton.Retry) > 0; buttonAcceptFocus = buttonFocus === AlertButton.Accept; buttonYesFocus = buttonFocus === AlertButton.Yes; buttonCancelFocus = buttonFocus === AlertButton.Cancel; buttonNoFocus = buttonFocus === AlertButton.No; buttonRetryFocus = buttonFocus === AlertButton.Retry; config = { title: { text: title }, message: message, button: { yes: { visibility: buttonYes, autofocus: buttonYesFocus }, no: { visibility: buttonNo, autofocus: buttonNoFocus }, retry: { visibility: buttonRetry, autofocus: buttonRetryFocus }, cancel: { visibility: buttonCancel, autofocus: buttonCancelFocus }, accept: { visibility: buttonAccept, autofocus: buttonAcceptFocus } } }; return [2 /*return*/, this.openModal(config)]; }); }); }; /** * @private * @param {?} item * @return {?} */ NgxNeoModalService.prototype.isObject = /** * @private * @param {?} item * @return {?} */ function (item) { return (item && typeof item === 'object' && !Array.isArray(item)); }; // this will lead to infinite recursion on circular references // this will lead to infinite recursion on circular references /** * @private * @param {?} target * @param {...?} sources * @return {?} */ NgxNeoModalService.prototype.mergeDeep = // this will lead to infinite recursion on circular references /** * @private * @param {?} target * @param {...?} sources * @return {?} */ function (target) { var _a, _b; var sources = []; for (var _i = 1; _i < arguments.length; _i++) { sources[_i - 1] = arguments[_i]; } if (!sources.length) { return target; } /** @type {?} */ var source = sources.shift(); if (this.isObject(target) && this.isObject(source)) { for (var key in source) { if (this.isObject(source[key])) { if (!target[key]) { Object.assign(target, (_a = {}, _a[key] = {}, _a)); } this.mergeDeep(target[key], source[key]); } else { Object.assign(target, (_b = {}, _b[key] = source[key], _b)); } } } return this.mergeDeep.apply(this, __spread([target], sources)); }; NgxNeoModalService.decorators = [ { type: Injectable } ]; /** @nocollapse */ NgxNeoModalService.ctorParameters = function () { return [ { type: NgbModal } ]; }; return NgxNeoModalService; }()); if (false) { /** @type {?} */ NgxNeoModalService.prototype.template; /** @type {?} */ NgxNeoModalService.prototype.originalAlert; /** * @type {?} * @private */ NgxNeoModalService.prototype.modalService; } /** * @fileoverview added by tsickle * Generated from: lib/ngx-neo-modal.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NgxNeoModalModule = /** @class */ (function () { function NgxNeoModalModule() { } /** * @return {?} */ NgxNeoModalModule.forRoot = /** * @return {?} */ function () { return { ngModule: NgxNeoModalModule, providers: [NgxNeoModalService] }; }; NgxNeoModalModule.decorators = [ { type: NgModule, args: [{ imports: [ CommonModule, FormsModule ], declarations: [ NgxNeoModalComponent, ], exports: [ NgxNeoModalComponent, ], entryComponents: [NgxNeoModalComponent], },] } ]; return NgxNeoModalModule; }()); /** * @fileoverview added by tsickle * Generated from: public_api.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * Generated from: neocomplexx-ngx-neo-modal.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { AlertButton, AlertResult, NgxNeoModalComponent, NgxNeoModalModule, NgxNeoModalService }; //# sourceMappingURL=neocomplexx-ngx-neo-modal.js.map