@neocomplexx/ngx-neo-modal
Version:
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.5.
1,059 lines • 50.3 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@ng-bootstrap/ng-bootstrap'), require('@angular/core'), require('@angular/common'), require('@angular/forms')) :
typeof define === 'function' && define.amd ? define('@neocomplexx/ngx-neo-modal', ['exports', '@ng-bootstrap/ng-bootstrap', '@angular/core', '@angular/common', '@angular/forms'], factory) :
(global = global || self, factory((global.neocomplexx = global.neocomplexx || {}, global.neocomplexx['ngx-neo-modal'] = {}), global.ngBootstrap, global.ng.core, global.ng.common, global.ng.forms));
}(this, (function (exports, ngBootstrap, core, common, forms) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
/**
* @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: core.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\">×</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: ngBootstrap.NgbActiveModal },
{ type: core.ChangeDetectorRef }
]; };
NgxNeoModalComponent.propDecorators = {
btn: [{ type: core.ViewChild, args: ['buttons', { static: true },] }],
input: [{ type: core.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: core.Injectable }
];
/** @nocollapse */
NgxNeoModalService.ctorParameters = function () { return [
{ type: ngBootstrap.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: core.NgModule, args: [{
imports: [
common.CommonModule,
forms.FormsModule
],
declarations: [
NgxNeoModalComponent,
],
exports: [
NgxNeoModalComponent,
],
entryComponents: [NgxNeoModalComponent],
},] }
];
return NgxNeoModalModule;
}());
exports.AlertButton = AlertButton;
exports.AlertResult = AlertResult;
exports.NgxNeoModalComponent = NgxNeoModalComponent;
exports.NgxNeoModalModule = NgxNeoModalModule;
exports.NgxNeoModalService = NgxNeoModalService;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=neocomplexx-ngx-neo-modal.umd.js.map