UNPKG

@universis/common

Version:

Universis - common directives and services

1,184 lines (1,173 loc) 66.8 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('@angular/common'), require('@ngx-translate/core')) : typeof define === 'function' && define.amd ? define('@universis/common/routing', ['exports', '@angular/core', '@angular/router', '@angular/common', '@ngx-translate/core'], factory) : (factory((global.universis = global.universis || {}, global.universis.common = global.universis.common || {}, global.universis.common.routing = {}),global.ng.core,global.ng.router,global.ng.common,global.core$1)); }(this, (function (exports,core,router,common,core$1) { 'use strict'; var ButtonTypes = { ok: { buttonText: 'OK', buttonClass: 'btn btn-indigo', buttonDisabled: false }, cancel: { buttonText: 'Cancel', buttonClass: 'btn btn-gray-100', buttonDisabled: false }, yes: { buttonText: 'Yes', buttonClass: 'btn btn-primary', buttonDisabled: false }, no: { buttonText: 'No', buttonClass: 'btn btn-gray-100', buttonDisabled: false }, abort: { buttonText: 'Abort', buttonClass: 'btn btn-danger', buttonDisabled: false }, retry: { buttonText: 'Retry', buttonClass: 'btn btn-primary', buttonDisabled: false }, ignore: { buttonText: 'Ignore', buttonClass: 'btn btn-warning', buttonDisabled: false }, previous: { buttonText: 'Previous', buttonClass: 'btn btn-gray-100', buttonDisabled: false }, next: { buttonText: 'Next', buttonClass: 'btn btn-theme', buttonDisabled: false } }; var RouterModal = /** @class */ (function () { function RouterModal(router$$1, activatedRoute) { this.router = router$$1; this.activatedRoute = activatedRoute; this.modalChanges = new core.EventEmitter(); // } Object.defineProperty(RouterModal.prototype, "modalTitle", { /** * Gets or modal window title */ get: function () { return this._modalTitle; }, set: function (value) { this._modalTitle = value; this.modalChanges.emit({ modalTitle: this._modalTitle, modalClass: this._modalClass, }); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModal.prototype, "modalClass", { /** * Gets or sets modal window additional class */ get: function () { return this._modalClass; }, set: function (value) { this._modalClass = value; this.modalChanges.emit({ modalTitle: this._modalTitle, modalClass: this._modalClass, }); }, enumerable: true, configurable: true }); /** * Closes modal window */ RouterModal.prototype.close = function (navigationExtras) { var _this = this; return this.router.navigate([ { outlets: { modal: null } } ], { relativeTo: this.activatedRoute.parent, }).then(function (navigationEnd) { if (navigationEnd && navigationExtras) { if (_this.activatedRoute.parent && _this.activatedRoute.parent.component) { var finalNavigationExtras = Object.assign({ relativeTo: _this.activatedRoute.parent }, navigationExtras); return _this.router.navigate(['.'], finalNavigationExtras); } } return Promise.resolve(navigationEnd); }); }; RouterModal.propDecorators = { modalTitle: [{ type: core.Input }], modalClass: [{ type: core.Input }] }; return RouterModal; }()); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* 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 __()); } 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 }; } } var RouterModalYesNo = /** @class */ (function (_super) { __extends(RouterModalYesNo, _super); function RouterModalYesNo() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.buttonChanges = new core.EventEmitter(); _this._yesButtonText = ButtonTypes.yes.buttonText; _this._yesButtonClass = ButtonTypes.yes.buttonClass; _this._noButtonText = ButtonTypes.no.buttonText; _this._noButtonClass = ButtonTypes.no.buttonClass; _this._yesButtonDisabled = ButtonTypes.yes.buttonDisabled; _this._noButtonDisabled = ButtonTypes.no.buttonDisabled; return _this; } Object.defineProperty(RouterModalYesNo.prototype, "yesButtonState", { get: function () { return { yes: { buttonText: this._yesButtonText, buttonClass: this._yesButtonClass, buttonDisabled: this._yesButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNo.prototype, "noButtonState", { get: function () { return { no: { buttonText: this._noButtonText, buttonClass: this._noButtonClass, buttonDisabled: this._noButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNo.prototype, "yesButtonText", { get: function () { return this._yesButtonText; }, set: function (value) { this._yesButtonText = value; this.buttonChanges.emit(this.yesButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNo.prototype, "yesButtonClass", { get: function () { return this._yesButtonClass; }, set: function (value) { this._yesButtonClass = value; this.buttonChanges.emit(this.yesButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNo.prototype, "noButtonText", { get: function () { return this._noButtonText; }, set: function (value) { this._noButtonText = value; this.buttonChanges.emit(this.noButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNo.prototype, "noButtonClass", { get: function () { return this._noButtonClass; }, set: function (value) { this._noButtonClass = value; this.buttonChanges.emit(this.noButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNo.prototype, "yesButtonDisabled", { get: function () { return this._yesButtonDisabled; }, set: function (value) { this._yesButtonDisabled = value; this.buttonChanges.emit(this.yesButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNo.prototype, "noButtonDisabled", { get: function () { return this._noButtonDisabled; }, set: function (value) { this._noButtonDisabled = value; this.buttonChanges.emit(this.noButtonState); }, enumerable: true, configurable: true }); RouterModalYesNo.propDecorators = { yesButtonText: [{ type: core.Input }], yesButtonClass: [{ type: core.Input }], noButtonText: [{ type: core.Input }], noButtonClass: [{ type: core.Input }], yesButtonDisabled: [{ type: core.Input }], noButtonDisabled: [{ type: core.Input }] }; return RouterModalYesNo; }(RouterModal)); // noinspection JSUnusedGlobalSymbols var RouterModalYesNoCancel = /** @class */ (function (_super) { __extends(RouterModalYesNoCancel, _super); function RouterModalYesNoCancel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._cancelButtonText = ButtonTypes.cancel.buttonText; _this._cancelButtonClass = ButtonTypes.cancel.buttonClass; _this._cancelButtonDisabled = ButtonTypes.cancel.buttonDisabled; return _this; } Object.defineProperty(RouterModalYesNoCancel.prototype, "cancelButtonState", { get: function () { return { cancel: { buttonText: this._cancelButtonText, buttonClass: this._cancelButtonClass, buttonDisabled: this._cancelButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNoCancel.prototype, "cancelButtonText", { get: function () { return this._cancelButtonText; }, set: function (value) { this._cancelButtonText = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNoCancel.prototype, "cancelButtonClass", { get: function () { return this._cancelButtonClass; }, set: function (value) { this._cancelButtonClass = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalYesNoCancel.prototype, "cancelButtonDisabled", { get: function () { return this._cancelButtonDisabled; }, set: function (value) { this._cancelButtonDisabled = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); RouterModalYesNoCancel.propDecorators = { cancelButtonText: [{ type: core.Input }], cancelButtonClass: [{ type: core.Input }], cancelButtonDisabled: [{ type: core.Input }] }; return RouterModalYesNoCancel; }(RouterModalYesNo)); var RouterModalOkCancel = /** @class */ (function (_super) { __extends(RouterModalOkCancel, _super); function RouterModalOkCancel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.buttonChanges = new core.EventEmitter(); _this._okButtonText = ButtonTypes.ok.buttonText; _this._okButtonClass = ButtonTypes.ok.buttonClass; _this._cancelButtonText = ButtonTypes.cancel.buttonText; _this._cancelButtonClass = ButtonTypes.cancel.buttonClass; _this._okButtonDisabled = ButtonTypes.ok.buttonDisabled; _this._cancelButtonDisabled = ButtonTypes.cancel.buttonDisabled; return _this; } Object.defineProperty(RouterModalOkCancel.prototype, "okButtonState", { get: function () { return { ok: { buttonText: this._okButtonText, buttonClass: this._okButtonClass, buttonDisabled: this._okButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalOkCancel.prototype, "cancelButtonState", { get: function () { return { cancel: { buttonText: this._cancelButtonText, buttonClass: this._cancelButtonClass, buttonDisabled: this._cancelButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalOkCancel.prototype, "okButtonText", { get: function () { return this._okButtonText; }, set: function (value) { this._okButtonText = value; this.buttonChanges.emit(this.okButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalOkCancel.prototype, "okButtonClass", { get: function () { return this._okButtonClass; }, set: function (value) { this._okButtonClass = value; this.buttonChanges.emit(this.okButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalOkCancel.prototype, "cancelButtonText", { get: function () { return this._cancelButtonText; }, set: function (value) { this._cancelButtonText = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalOkCancel.prototype, "cancelButtonClass", { get: function () { return this._cancelButtonClass; }, set: function (value) { this._cancelButtonClass = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalOkCancel.prototype, "okButtonDisabled", { get: function () { return this._okButtonDisabled; }, set: function (value) { this._okButtonDisabled = value; this.buttonChanges.emit(this.okButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalOkCancel.prototype, "cancelButtonDisabled", { get: function () { return this._cancelButtonDisabled; }, set: function (value) { this._cancelButtonDisabled = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); RouterModalOkCancel.propDecorators = { okButtonText: [{ type: core.Input }], okButtonClass: [{ type: core.Input }], cancelButtonText: [{ type: core.Input }], cancelButtonClass: [{ type: core.Input }], okButtonDisabled: [{ type: core.Input }], cancelButtonDisabled: [{ type: core.Input }] }; return RouterModalOkCancel; }(RouterModal)); var RouterModalAbortRetryIgnore = /** @class */ (function (_super) { __extends(RouterModalAbortRetryIgnore, _super); function RouterModalAbortRetryIgnore() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.buttonChanges = new core.EventEmitter(); // abort button (start) _this._abortButtonText = ButtonTypes.abort.buttonText; _this._abortButtonClass = ButtonTypes.abort.buttonClass; _this._abortButtonDisabled = ButtonTypes.abort.buttonDisabled; // abort button (end) // retry button (start) _this._retryButtonText = ButtonTypes.retry.buttonText; _this._retryButtonClass = ButtonTypes.retry.buttonClass; _this._retryButtonDisabled = ButtonTypes.retry.buttonDisabled; // retry button (end) // ignore button (start) _this._ignoreButtonText = ButtonTypes.ignore.buttonText; _this._ignoreButtonClass = ButtonTypes.ignore.buttonClass; _this._ignoreButtonDisabled = ButtonTypes.ignore.buttonDisabled; return _this; } Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "abortButtonState", { get: function () { return { abort: { buttonText: this._abortButtonText, buttonClass: this._abortButtonClass, buttonDisabled: this._abortButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "retryButtonState", { get: function () { return { retry: { buttonText: this._retryButtonText, buttonClass: this._retryButtonClass, buttonDisabled: this._retryButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "ignoreButtonState", { get: function () { return { ignore: { buttonText: this._ignoreButtonText, buttonClass: this._ignoreButtonClass, buttonDisabled: this._ignoreButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "abortButtonText", { get: function () { return this._abortButtonText; }, set: function (value) { this._abortButtonText = value; this.buttonChanges.emit(this.abortButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "abortButtonClass", { get: function () { return this._abortButtonClass; }, set: function (value) { this._abortButtonClass = value; this.buttonChanges.emit(this.abortButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "abortButtonDisabled", { get: function () { return this._abortButtonDisabled; }, set: function (value) { this._abortButtonDisabled = value; this.buttonChanges.emit(this.abortButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "retryButtonText", { get: function () { return this._retryButtonText; }, set: function (value) { this._retryButtonText = value; this.buttonChanges.emit(this.retryButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "retryButtonClass", { get: function () { return this._retryButtonClass; }, set: function (value) { this._retryButtonClass = value; this.buttonChanges.emit(this.retryButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "retryButtonDisabled", { get: function () { return this._retryButtonDisabled; }, set: function (value) { this._retryButtonDisabled = value; this.buttonChanges.emit(this.retryButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "ignoreButtonText", { get: function () { return this._ignoreButtonText; }, set: function (value) { this._ignoreButtonText = value; this.buttonChanges.emit(this.ignoreButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "ignoreButtonClass", { get: function () { return this._ignoreButtonClass; }, set: function (value) { this._ignoreButtonClass = value; this.buttonChanges.emit(this.ignoreButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalAbortRetryIgnore.prototype, "ignoreButtonDisabled", { get: function () { return this._ignoreButtonDisabled; }, set: function (value) { this._ignoreButtonDisabled = value; this.buttonChanges.emit(this.ignoreButtonState); }, enumerable: true, configurable: true }); RouterModalAbortRetryIgnore.propDecorators = { abortButtonText: [{ type: core.Input }], abortButtonClass: [{ type: core.Input }], abortButtonDisabled: [{ type: core.Input }], retryButtonText: [{ type: core.Input }], retryButtonClass: [{ type: core.Input }], retryButtonDisabled: [{ type: core.Input }], ignoreButtonText: [{ type: core.Input }], ignoreButtonClass: [{ type: core.Input }], ignoreButtonDisabled: [{ type: core.Input }] }; return RouterModalAbortRetryIgnore; }(RouterModal)); // noinspection JSUnusedGlobalSymbols var RouterModalPreviousNextCancel = /** @class */ (function (_super) { __extends(RouterModalPreviousNextCancel, _super); function RouterModalPreviousNextCancel() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.buttonChanges = new core.EventEmitter(); _this._previousButtonText = ButtonTypes.previous.buttonText; _this._previousButtonClass = ButtonTypes.previous.buttonClass; _this._previousButtonDisabled = ButtonTypes.previous.buttonDisabled; _this._nextButtonText = ButtonTypes.next.buttonText; _this._nextButtonClass = ButtonTypes.next.buttonClass; _this._nextButtonDisabled = ButtonTypes.next.buttonDisabled; _this._cancelButtonText = ButtonTypes.cancel.buttonText; _this._cancelButtonClass = ButtonTypes.cancel.buttonClass; _this._cancelButtonDisabled = ButtonTypes.cancel.buttonDisabled; return _this; } Object.defineProperty(RouterModalPreviousNextCancel.prototype, "previousButtonState", { get: function () { return { previous: { buttonText: this._previousButtonText, buttonClass: this._previousButtonClass, buttonDisabled: this._previousButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "nextButtonState", { get: function () { return { next: { buttonText: this._nextButtonText, buttonClass: this._nextButtonClass, buttonDisabled: this._nextButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "cancelButtonState", { get: function () { return { cancel: { buttonText: this._cancelButtonText, buttonClass: this._cancelButtonClass, buttonDisabled: this._cancelButtonDisabled } }; }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "previousButtonText", { get: function () { return this._previousButtonText; }, set: function (value) { this._previousButtonText = value; this.buttonChanges.emit(this.previousButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "previousButtonClass", { get: function () { return this._previousButtonClass; }, set: function (value) { this._previousButtonClass = value; this.buttonChanges.emit(this.previousButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "previousButtonDisabled", { get: function () { return this._previousButtonDisabled; }, set: function (value) { this._previousButtonDisabled = value; this.buttonChanges.emit(this.previousButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "nextButtonText", { get: function () { return this._nextButtonText; }, set: function (value) { this._nextButtonText = value; this.buttonChanges.emit(this.nextButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "nextButtonClass", { get: function () { return this._nextButtonClass; }, set: function (value) { this._nextButtonClass = value; this.buttonChanges.emit(this.nextButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "nextButtonDisabled", { get: function () { return this._nextButtonDisabled; }, set: function (value) { this._nextButtonDisabled = value; this.buttonChanges.emit(this.nextButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "cancelButtonText", { get: function () { return this._cancelButtonText; }, set: function (value) { this._cancelButtonText = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "cancelButtonClass", { get: function () { return this._cancelButtonClass; }, set: function (value) { this._cancelButtonClass = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); Object.defineProperty(RouterModalPreviousNextCancel.prototype, "cancelButtonDisabled", { get: function () { return this._cancelButtonDisabled; }, set: function (value) { this._cancelButtonDisabled = value; this.buttonChanges.emit(this.cancelButtonState); }, enumerable: true, configurable: true }); RouterModalPreviousNextCancel.propDecorators = { previousButtonText: [{ type: core.Input }], previousButtonClass: [{ type: core.Input }], previousButtonDisabled: [{ type: core.Input }], nextButtonText: [{ type: core.Input }], nextButtonClass: [{ type: core.Input }], nextButtonDisabled: [{ type: core.Input }], cancelButtonText: [{ type: core.Input }], cancelButtonClass: [{ type: core.Input }], cancelButtonDisabled: [{ type: core.Input }] }; return RouterModalPreviousNextCancel; }(RouterModal)); var RouterModalComponent = /** @class */ (function () { function RouterModalComponent(_element, _activatedRoute, _router, _renderer) { this._element = _element; this._activatedRoute = _activatedRoute; this._router = _router; this._renderer = _renderer; this.waiting = false; this.modalTitle = ''; // this properties are here as inputs in order to have a way to customize text and class of each button this.okButtonText = ButtonTypes.ok.buttonText; this.okButtonClass = ButtonTypes.ok.buttonClass; this.cancelButtonText = ButtonTypes.cancel.buttonText; this.cancelButtonClass = ButtonTypes.cancel.buttonClass; this.yesButtonText = ButtonTypes.yes.buttonText; this.yesButtonClass = ButtonTypes.yes.buttonClass; this.noButtonText = ButtonTypes.no.buttonText; this.noButtonClass = ButtonTypes.no.buttonClass; this.abortButtonText = ButtonTypes.abort.buttonText; this.abortButtonClass = ButtonTypes.abort.buttonClass; this.retryButtonText = ButtonTypes.retry.buttonText; this.retryButtonClass = ButtonTypes.retry.buttonClass; this.ignoreButtonText = ButtonTypes.ignore.buttonText; this.ignoreButtonClass = ButtonTypes.ignore.buttonClass; this.previousButtonText = ButtonTypes.previous.buttonText; this.previousButtonClass = ButtonTypes.previous.buttonClass; this.nextButtonText = ButtonTypes.next.buttonText; this.nextButtonClass = ButtonTypes.next.buttonClass; // default instance buttons this.instanceButtons = { ok: null, cancel: null, yes: null, no: null, abort: null, retry: null, ignore: null, previous: null, next: null }; } RouterModalComponent.prototype.cancel = function () { return __awaiter(this, void 0, void 0, function () { var err_1; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!this.componentReference) return [3 /*break*/, 5]; // set waiting this.waiting = true; if (!(typeof this.componentReference.cancel === 'function')) return [3 /*break*/, 2]; // do cancel return [4 /*yield*/, this.componentReference.cancel()]; case 1: // do cancel _a.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this._router.navigate(['../'], { relativeTo: this._activatedRoute })]; case 3: _a.sent(); _a.label = 4; case 4: // unset waiting this.waiting = false; _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: err_1 = _a.sent(); this.waiting = false; return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }; RouterModalComponent.prototype.ok = function () { return __awaiter(this, void 0, void 0, function () { var err_2; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!this.componentReference) return [3 /*break*/, 5]; // set waiting this.waiting = true; if (!(typeof this.componentReference.ok === 'function')) return [3 /*break*/, 2]; // do submit return [4 /*yield*/, this.componentReference.ok()]; case 1: // do submit _a.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this._router.navigate(['../'], { relativeTo: this._activatedRoute })]; case 3: _a.sent(); _a.label = 4; case 4: // unset waiting this.waiting = false; _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: err_2 = _a.sent(); this.waiting = false; return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }; RouterModalComponent.prototype.abort = function () { return __awaiter(this, void 0, void 0, function () { var err_3; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!this.componentReference) return [3 /*break*/, 5]; // set waiting this.waiting = true; if (!(typeof this.componentReference.abort === 'function')) return [3 /*break*/, 2]; // do submit return [4 /*yield*/, this.componentReference.abort()]; case 1: // do submit _a.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this._router.navigate(['../'], { relativeTo: this._activatedRoute })]; case 3: _a.sent(); _a.label = 4; case 4: // unset waiting this.waiting = false; _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: err_3 = _a.sent(); this.waiting = false; return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }; RouterModalComponent.prototype.retry = function () { return __awaiter(this, void 0, void 0, function () { var err_4; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!this.componentReference) return [3 /*break*/, 5]; // set waiting this.waiting = true; if (!(typeof this.componentReference.retry === 'function')) return [3 /*break*/, 2]; // do submit return [4 /*yield*/, this.componentReference.retry()]; case 1: // do submit _a.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this._router.navigate(['../'], { relativeTo: this._activatedRoute })]; case 3: _a.sent(); _a.label = 4; case 4: // unset waiting this.waiting = false; _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: err_4 = _a.sent(); this.waiting = false; return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }; RouterModalComponent.prototype.ignore = function () { return __awaiter(this, void 0, void 0, function () { var err_5; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!this.componentReference) return [3 /*break*/, 5]; // set waiting this.waiting = true; if (!(typeof this.componentReference.ignore === 'function')) return [3 /*break*/, 2]; // do submit return [4 /*yield*/, this.componentReference.ignore()]; case 1: // do submit _a.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this._router.navigate(['../'], { relativeTo: this._activatedRoute })]; case 3: _a.sent(); _a.label = 4; case 4: // unset waiting this.waiting = false; _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: err_5 = _a.sent(); this.waiting = false; return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }; RouterModalComponent.prototype.previous = function () { return __awaiter(this, void 0, void 0, function () { var err_6; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!this.componentReference) return [3 /*break*/, 5]; // set waiting this.waiting = true; if (!(typeof this.componentReference.previous === 'function')) return [3 /*break*/, 2]; // do submit return [4 /*yield*/, this.componentReference.previous()]; case 1: // do submit _a.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this._router.navigate(['../'], { relativeTo: this._activatedRoute })]; case 3: _a.sent(); _a.label = 4; case 4: // unset waiting this.waiting = false; _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: err_6 = _a.sent(); this.waiting = false; return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }; RouterModalComponent.prototype.next = function () { return __awaiter(this, void 0, void 0, function () { var err_7; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 6, , 7]); if (!this.componentReference) return [3 /*break*/, 5]; // set waiting this.waiting = true; if (!(typeof this.componentReference.next === 'function')) return [3 /*break*/, 2]; // do submit return [4 /*yield*/, this.componentReference.next()]; case 1: // do submit _a.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this._router.navigate(['../'], { relativeTo: this._activatedRoute })]; case 3: _a.sent(); _a.label = 4; case 4: // unset waiting this.waiting = false; _a.label = 5; case 5: return [3 /*break*/, 7]; case 6: err_7 = _a.sent(); this.waiting = false; return [3 /*break*/, 7]; case 7: return [2 /*return*/]; } }); }); }; RouterModalComponent.prototype.yes = function () { return __awaiter(this, void 0, void 0, function () { v