UNPKG

@stratio/egeo

Version:
1,279 lines (1,248 loc) 860 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('rxjs'), require('@angular/animations'), require('lodash'), require('rxjs/operators'), require('@angular/forms'), require('@angular/common/http'), require('prismjs'), require('prismjs/components/prism-typescript'), require('@angular/platform-browser'), require('@angular/router'), require('ngx-virtual-scroller')) : typeof define === 'function' && define.amd ? define('@stratio/egeo', ['exports', '@angular/common', '@angular/core', 'rxjs', '@angular/animations', 'lodash', 'rxjs/operators', '@angular/forms', '@angular/common/http', 'prismjs', 'prismjs/components/prism-typescript', '@angular/platform-browser', '@angular/router', 'ngx-virtual-scroller'], factory) : (global = global || self, factory((global.stratio = global.stratio || {}, global.stratio.egeo = {}), global.ng.common, global.ng.core, global.rxjs, global.ng.animations, global._, global.rxjs.operators, global.ng.forms, global.ng.common.http, global.prismjs, null, global.ng.platformBrowser, global.ng.router, global.vscroller)); }(this, (function (exports, common, core, rxjs, animations, lodash, operators, forms, http, prismjs, prismTypescript, platformBrowser, router, ngxVirtualScroller) { '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) { 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) : new P(function (resolve) { resolve(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 m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } 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 }; } /** * @fileoverview added by tsickle * Generated from: lib/st-alerts/st-alerts.model.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var STALERT_SEVERITY = { SUCCESS: 0, WARNING: 1, ERROR: 2, INFO: 3, }; STALERT_SEVERITY[STALERT_SEVERITY.SUCCESS] = 'SUCCESS'; STALERT_SEVERITY[STALERT_SEVERITY.WARNING] = 'WARNING'; STALERT_SEVERITY[STALERT_SEVERITY.ERROR] = 'ERROR'; STALERT_SEVERITY[STALERT_SEVERITY.INFO] = 'INFO'; var StAlertLink = /** @class */ (function () { function StAlertLink() { } return StAlertLink; }()); if (false) { /** @type {?} */ StAlertLink.prototype.title; /** @type {?} */ StAlertLink.prototype.link; } var StAlert = /** @class */ (function () { function StAlert(id, title, message, severity, timeout, extendedTimeout, link) { this.id = id; this.title = title; this.message = message; this.severity = severity; this.timeout = timeout; this.extendedTimeout = extendedTimeout; this.link = link; this._readed = false; this._opacity = 0; this._opacityState = new rxjs.Subject(); this._removeEvent = new rxjs.Subject(); } Object.defineProperty(StAlert.prototype, "opacity", { get: /** * @return {?} */ function () { return this._opacityState.asObservable(); }, enumerable: true, configurable: true }); Object.defineProperty(StAlert.prototype, "removeAlertEvent", { get: /** * @return {?} */ function () { return this._removeEvent.asObservable(); }, enumerable: true, configurable: true }); /** * @return {?} */ StAlert.prototype.notify = /** * @return {?} */ function () { this.setVisible(true); }; /** * @return {?} */ StAlert.prototype.pauseNotify = /** * @return {?} */ function () { this._opacity = 1; this._readed = true; this.clearAnimation(); this.stopLife(); this._opacityState.next(this._opacity); }; /** * @return {?} */ StAlert.prototype.continueNotify = /** * @return {?} */ function () { this.startLife(); }; /** * @return {?} */ StAlert.prototype.cancel = /** * @return {?} */ function () { this.setVisible(false); }; /** * @private * @param {?} increase * @return {?} */ StAlert.prototype.setVisible = /** * @private * @param {?} increase * @return {?} */ function (increase) { var _this = this; this.clearAnimation(); this._changeVisibilityInterval = window.setInterval((/** * @return {?} */ function () { return _this.modifyVisibility(increase); }), 50); }; /** * @private * @param {?} increase * @return {?} */ StAlert.prototype.modifyVisibility = /** * @private * @param {?} increase * @return {?} */ function (increase) { this._opacity += increase ? 0.1 : -0.1; if (this._opacity >= 1 || this._opacity <= 0) { this.clearAnimation(); if (increase) { this.startLife(); } else { this.notifyForRemove(); } } this._opacityState.next(this._opacity); }; /** * @private * @return {?} */ StAlert.prototype.notifyForRemove = /** * @private * @return {?} */ function () { this._opacityState.complete(); this._removeEvent.next(this); this._removeEvent.complete(); }; /** * @private * @return {?} */ StAlert.prototype.clearAnimation = /** * @private * @return {?} */ function () { window.clearInterval(this._changeVisibilityInterval); }; /** * @private * @return {?} */ StAlert.prototype.stopLife = /** * @private * @return {?} */ function () { window.clearTimeout(this._lifeTimeout); }; /** * @private * @return {?} */ StAlert.prototype.startLife = /** * @private * @return {?} */ function () { var _this = this; /** @type {?} */ var timeout = this._readed ? this.extendedTimeout : this.timeout; this._lifeTimeout = window.setTimeout((/** * @return {?} */ function () { return _this.setVisible(false); }), timeout); }; return StAlert; }()); if (false) { /** * @type {?} * @private */ StAlert.prototype._changeVisibilityInterval; /** * @type {?} * @private */ StAlert.prototype._lifeTimeout; /** * @type {?} * @private */ StAlert.prototype._readed; /** * @type {?} * @private */ StAlert.prototype._opacity; /** * @type {?} * @private */ StAlert.prototype._opacityState; /** * @type {?} * @private */ StAlert.prototype._removeEvent; /** @type {?} */ StAlert.prototype.id; /** @type {?} */ StAlert.prototype.title; /** @type {?} */ StAlert.prototype.message; /** @type {?} */ StAlert.prototype.severity; /** @type {?} */ StAlert.prototype.timeout; /** @type {?} */ StAlert.prototype.extendedTimeout; /** @type {?} */ StAlert.prototype.link; } /** * @fileoverview added by tsickle * Generated from: lib/st-alerts/st-alerts.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var StAlertsService = /** @class */ (function () { function StAlertsService() { this._alertsList = []; this._nextId = 0; this._alertsStream = new rxjs.BehaviorSubject([]); } Object.defineProperty(StAlertsService.prototype, "alertList", { get: /** * @return {?} */ function () { return this._alertsStream.asObservable(); }, enumerable: true, configurable: true }); /** * @param {?} title * @param {?} message * @param {?} severity * @param {?=} link * @param {?=} timeout * @param {?=} extendedTimeout * @return {?} */ StAlertsService.prototype.notifyAlert = /** * @param {?} title * @param {?} message * @param {?} severity * @param {?=} link * @param {?=} timeout * @param {?=} extendedTimeout * @return {?} */ function (title, message, severity, link, timeout, extendedTimeout) { var _this = this; timeout = timeout !== undefined ? timeout : 5000; extendedTimeout = extendedTimeout !== undefined ? extendedTimeout : 4000; /** @type {?} */ var alert = new StAlert(this._nextId, title, message, severity, timeout, extendedTimeout, link); alert.removeAlertEvent.subscribe((/** * @param {?} alertToRemove * @return {?} */ function (alertToRemove) { return _this.onNotifyRemove(alertToRemove); })); this.insertAlert(alert); this._nextId++; }; /** * @private * @param {?} alert * @return {?} */ StAlertsService.prototype.insertAlert = /** * @private * @param {?} alert * @return {?} */ function (alert) { this._alertsList.push(alert); this._alertsStream.next(this._alertsList); }; /** * @private * @param {?} alert * @return {?} */ StAlertsService.prototype.onNotifyRemove = /** * @private * @param {?} alert * @return {?} */ function (alert) { /** @type {?} */ var pos = this._alertsList.findIndex((/** * @param {?} internalAlert * @return {?} */ function (internalAlert) { return internalAlert.id === alert.id; })); this._alertsList.splice(pos, 1); this._alertsStream.next(this._alertsList); }; StAlertsService.decorators = [ { type: core.Injectable } ]; return StAlertsService; }()); if (false) { /** * @type {?} * @private */ StAlertsService.prototype._alertsList; /** * @type {?} * @private */ StAlertsService.prototype._nextId; /** * @type {?} * @private */ StAlertsService.prototype._alertsStream; } /** * @fileoverview added by tsickle * Generated from: lib/st-modal/st-modal.model.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var StModalResponse = { YES: 0, NO: 1, CLOSE: 2, }; StModalResponse[StModalResponse.YES] = 'YES'; StModalResponse[StModalResponse.NO] = 'NO'; StModalResponse[StModalResponse.CLOSE] = 'CLOSE'; /** @enum {number} */ var StModalBasicType = { DELETE: 0, CONFIRM: 1, INFO: 2, WARNING: 3, }; StModalBasicType[StModalBasicType.DELETE] = 'DELETE'; StModalBasicType[StModalBasicType.CONFIRM] = 'CONFIRM'; StModalBasicType[StModalBasicType.INFO] = 'INFO'; StModalBasicType[StModalBasicType.WARNING] = 'WARNING'; var StModalButton = /** @class */ (function () { function StModalButton() { } return StModalButton; }()); if (false) { /** @type {?} */ StModalButton.prototype.response; /** @type {?} */ StModalButton.prototype.responseValue; /** @type {?} */ StModalButton.prototype.leftIcon; /** @type {?} */ StModalButton.prototype.rightIcon; /** @type {?} */ StModalButton.prototype.classes; /** @type {?} */ StModalButton.prototype.closeOnClick; /** @type {?} */ StModalButton.prototype.label; } var StModalConfig = /** @class */ (function () { function StModalConfig() { } return StModalConfig; }()); if (false) { /** @type {?} */ StModalConfig.prototype.fullscreen; /** @type {?} */ StModalConfig.prototype.modalTitle; /** @type {?} */ StModalConfig.prototype.messageTitle; /** @type {?} */ StModalConfig.prototype.message; /** @type {?} */ StModalConfig.prototype.html; /** @type {?} */ StModalConfig.prototype.inputs; /** @type {?} */ StModalConfig.prototype.outputs; /** @type {?} */ StModalConfig.prototype.buttons; /** @type {?} */ StModalConfig.prototype.maxWidth; /** @type {?} */ StModalConfig.prototype.minWidth; /** @type {?} */ StModalConfig.prototype.empty; /** @type {?} */ StModalConfig.prototype.showCloseBtn; /** @type {?} */ StModalConfig.prototype.iconStatus; } var StModalButtonResponse = /** @class */ (function () { function StModalButtonResponse() { } return StModalButtonResponse; }()); if (false) { /** @type {?} */ StModalButtonResponse.prototype.response; /** @type {?} */ StModalButtonResponse.prototype.close; } /** * @fileoverview added by tsickle * Generated from: lib/utils/window-service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @return {?} */ function getWindow() { return window; } var StWindowRefService = /** @class */ (function () { function StWindowRefService() { } Object.defineProperty(StWindowRefService.prototype, "nativeWindow", { get: /** * @return {?} */ function () { return getWindow(); }, enumerable: true, configurable: true }); StWindowRefService.decorators = [ { type: core.Injectable } ]; return StWindowRefService; }()); /** * @fileoverview added by tsickle * Generated from: lib/st-modal/st-modal.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var StModalComponent = /** @class */ (function () { function StModalComponent(cfr, windowRef) { this.cfr = cfr; this.windowRef = windowRef; this.disabledAnimation = true; this.click = new core.EventEmitter(); this.endAnimation = new core.EventEmitter(); this.defaultMaxWidth = 600; this.defaultMinWidth = 400; this.visibility = 'visible'; this._subscriptions = []; } Object.defineProperty(StModalComponent.prototype, "hasIcon", { get: /** * @return {?} */ function () { return this.modalConfig.iconStatus; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "isFullscreen", { get: /** * @return {?} */ function () { return this.modalConfig.fullscreen; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "title", { get: /** * @return {?} */ function () { return this.modalConfig.modalTitle; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "buttons", { get: /** * @return {?} */ function () { return this.modalConfig.buttons || []; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "isMessageModal", { get: /** * @return {?} */ function () { return this.modalConfig.message && this.modalConfig.message.length > 0; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "isComplexMessageModal", { get: /** * @return {?} */ function () { return this.modalConfig.html && this.modalConfig.html.length > 0; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "html", { get: /** * @return {?} */ function () { return this.modalConfig.html; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "message", { get: /** * @return {?} */ function () { return this.modalConfig.message; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "messageTitle", { get: /** * @return {?} */ function () { return this.modalConfig.messageTitle; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "modalStyles", { get: /** * @return {?} */ function () { /** @type {?} */ var maxWidth = this.modalConfig.maxWidth || this.defaultMaxWidth; /** @type {?} */ var minWidth = this.modalConfig.minWidth || this.defaultMinWidth; /** @type {?} */ var width = this.getModalActualWidth(maxWidth, minWidth); return { 'max-width': maxWidth + "px", 'min-width': minWidth + "px", 'width': width + "px" }; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "emptyModal", { get: /** * @return {?} */ function () { return this.modalConfig && this.modalConfig.empty; }, enumerable: true, configurable: true }); Object.defineProperty(StModalComponent.prototype, "showCloseBtn", { get: /** * @return {?} */ function () { return this.modalConfig.showCloseBtn; }, enumerable: true, configurable: true }); /** * @param {?} event * @return {?} */ StModalComponent.prototype.animationDone = /** * @param {?} event * @return {?} */ function (event) { if (event.toState === 'hidden') { this.endAnimation.emit(true); } }; /** * @param {?} event * @return {?} */ StModalComponent.prototype.onClickButtons = /** * @param {?} event * @return {?} */ function (event) { var _this = this; this.visibility = 'hidden'; this._subscriptions.push(this.endAnimation.subscribe((/** * @param {?} data * @return {?} */ function (data) { if (data) { _this.click.emit(event); } }))); }; /** * @return {?} */ StModalComponent.prototype.onClose = /** * @return {?} */ function () { var _this = this; this.visibility = 'hidden'; this._subscriptions.push(this.endAnimation.subscribe((/** * @param {?} data * @return {?} */ function (data) { if (data) { _this.click.emit({ response: StModalResponse.CLOSE, close: true }); } }))); }; /** DYNAMIC MODAL BODY COMPONENT LOAD */ /** * DYNAMIC MODAL BODY COMPONENT LOAD * @return {?} */ StModalComponent.prototype.ngAfterViewInit = /** * DYNAMIC MODAL BODY COMPONENT LOAD * @return {?} */ function () { this.target = this.emptyModal ? this.targetEmpty : this.targetContent; if (this.component && !(this.modalConfig.html || this.modalConfig.message)) { this.loadBody(); } this.windowRef.nativeWindow.document.body.classList.add('st-modal-overlay'); }; /** * @return {?} */ StModalComponent.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this.componentRef) { this.componentRef.destroy(); } this.windowRef.nativeWindow.document.body.classList.remove('st-modal-overlay'); if (this._subscriptions.length > 0) { this._subscriptions.forEach((/** * @param {?} subscription * @return {?} */ function (subscription) { if (subscription) { subscription.unsubscribe(); } })); } }; /** * @private * @param {?} maxWidth * @param {?=} minWidth * @return {?} */ StModalComponent.prototype.getModalActualWidth = /** * @private * @param {?} maxWidth * @param {?=} minWidth * @return {?} */ function (maxWidth, minWidth) { /** @type {?} */ var screenWidth = this.windowRef.nativeWindow.screen.width; return screenWidth > maxWidth ? maxWidth : (screenWidth < minWidth ? minWidth : screenWidth); }; /** * @private * @return {?} */ StModalComponent.prototype.loadBody = /** * @private * @return {?} */ function () { if (!this.componentRef) { this.target.clear(); /** @type {?} */ var compFactory = this.cfr.resolveComponentFactory(this.component); this.componentRef = this.target.createComponent(compFactory); this.bindModalInputs(); } }; /** * @private * @return {?} */ StModalComponent.prototype.bindModalInputs = /** * @private * @return {?} */ function () { var _this = this; Object.keys(this.modalConfig.inputs).forEach((/** * @param {?} key * @return {?} */ function (key) { _this.componentRef.instance[key] = ((/** @type {?} */ (_this.modalConfig.inputs)))[key]; })); Object.keys(this.modalConfig.outputs).forEach((/** * @param {?} key * @return {?} */ function (key) { _this.componentRef.instance[key].subscribe(((/** @type {?} */ (_this.modalConfig.outputs)))[key]); })); this.componentRef.changeDetectorRef.detectChanges(); }; StModalComponent.decorators = [ { type: core.Component, args: [{ selector: 'st-modal', template: "<!--\n\n \u00A9 2017 Stratio Big Data Inc., Sucursal en Espa\u00F1a.\n\n This software is licensed under the Apache License, Version 2.0.\n This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n See the terms of the License for more details.\n\n SPDX-License-Identifier: Apache-2.0.\n\n-->\n<div class=\"st-modal-container\" [@state]=\"visibility\" (@state.done)=\"animationDone($event)\" [@.disabled]=\"disabledAnimation\">\n <section *ngIf=\"emptyModal\" class=\"st-modal\" [ngClass]=\"{'st-modal-fullscreen': isFullscreen}\" [ngStyle]=\"modalStyles\" [hidden]=\"emptyModal\">\n <div #stModalBodyEmpty></div>\n </section>\n <section *ngIf=\"!emptyModal\" class=\"st-modal\" [ngClass]=\"{'st-modal-fullscreen': isFullscreen}\" [ngStyle]=\"modalStyles\" [hidden]=\"!emptyModal\">\n <div class=\"st-modal-header\">\n <div class=\"container\">\n <span class=\"status-icon\" [ngClass]=\"hasIcon\" *ngIf=\"hasIcon\"></span>\n <p class=\"title\">{{title}}</p> <span class=\"close-button\" *ngIf=\"showCloseBtn\" (click)=\"onClose()\"></span>\n\n <st-modal-buttons *ngIf=\"isFullscreen\" [buttonConfig]=\"buttons\" [fullscreen]=\"isFullscreen\" (click)=\"onClickButtons($event)\"></st-modal-buttons>\n </div>\n </div>\n <div class=\"st-modal-body\">\n <div class=\"container\">\n\n <div *ngIf=\"isMessageModal\" class=\"message\">\n <h1 id=\"st-modal-message-plain-title\" class=\"st-modal-message-plain-title\">{{messageTitle}}</h1>\n <p id=\"st-modal-message-plain-message\" class=\"st-modal-message-plain-message\">{{message}}</p>\n </div>\n <div *ngIf=\"isComplexMessageModal\" [innerHTML]=\"html\" id=\"st-modal-message-html\"></div>\n <div #stModalBody id=\"st-modal-message-component\"></div>\n\n </div>\n </div>\n <footer class=\"st-modal-footer\" *ngIf=\"buttons && buttons.length > 0\">\n <div class=\"container\">\n <st-modal-buttons *ngIf=\"!isFullscreen\" [buttonConfig]=\"buttons\" (click)=\"onClickButtons($event)\"></st-modal-buttons>\n </div>\n </footer>\n </section>\n</div>\n", changeDetection: core.ChangeDetectionStrategy.OnPush, animations: [ animations.trigger('state', [ animations.state('void, hidden', animations.style({ opacity: 0 })), animations.state('visible', animations.style({ opacity: 1 })), animations.transition('* => visible', [ animations.style({ opacity: 0 }), animations.animate(300) ]), animations.transition('* => hidden', [ animations.style({ opacity: 1 }), animations.animate(300) ]) ]) ], styles: ["@charset \"UTF-8\";.st-modal-container{display:flex;height:100vh;left:0;position:fixed;top:0;width:100%}.st-modal-container .st-modal{-ms-grid-row-align:center;align-self:center;display:flex;flex-direction:column;margin:auto}.st-modal-container .st-modal.st-modal-fullscreen{min-height:100vh;max-height:100vh;min-width:100%;max-width:100%}.st-modal-container .st-modal .st-modal-header{display:flex;flex-direction:row;height:70px;width:100%}.st-modal-container .st-modal .st-modal-header .container{display:flex;margin-right:auto;margin-left:auto;width:100%;align-items:center;flex-wrap:nowrap}.st-modal-container .st-modal .st-modal-header .container .status-icon{padding-right:1.05rem}.st-modal-container .st-modal .st-modal-header .container .status-icon.delete:before{content:var(--egeo-st-modal__delete-icon--content, \"\uE043\")}.st-modal-container .st-modal .st-modal-header .container .status-icon.alert:before{content:var(--egeo-st-modal__warning-icon--content, \"\uE613\")}.st-modal-container .st-modal .st-modal-header .container .close-button{font-size:var(--egeo-st-modal__close-icon--font-size,inherit);color:var(--egeo-st-modal__close-icon--color,inherit)}.st-modal-container .st-modal .st-modal-header .container .close-button:before{content:var(--egeo-st-modal__close-icon--content, \"\uE117\")}.st-modal-container .st-modal st-modal-buttons{display:flex;justify-content:flex-end;margin-left:auto}.st-modal-container .st-modal .container{min-width:auto}"] }] } ]; /** @nocollapse */ StModalComponent.ctorParameters = function () { return [ { type: core.ComponentFactoryResolver }, { type: StWindowRefService } ]; }; StModalComponent.propDecorators = { modalConfig: [{ type: core.Input }], component: [{ type: core.Input }], disabledAnimation: [{ type: core.HostBinding, args: ['@.disabled',] }, { type: core.Input }], click: [{ type: core.Output }], endAnimation: [{ type: core.Output }], targetContent: [{ type: core.ViewChild, args: ['stModalBody', { read: core.ViewContainerRef, static: false },] }], targetEmpty: [{ type: core.ViewChild, args: ['stModalBodyEmpty', { read: core.ViewContainerRef, static: false },] }] }; return StModalComponent; }()); if (false) { /** @type {?} */ StModalComponent.prototype.modalConfig; /** @type {?} */ StModalComponent.prototype.component; /** @type {?} */ StModalComponent.prototype.disabledAnimation; /** @type {?} */ StModalComponent.prototype.click; /** @type {?} */ StModalComponent.prototype.endAnimation; /** @type {?} */ StModalComponent.prototype.targetContent; /** @type {?} */ StModalComponent.prototype.targetEmpty; /** @type {?} */ StModalComponent.prototype.defaultMaxWidth; /** @type {?} */ StModalComponent.prototype.defaultMinWidth; /** @type {?} */ StModalComponent.prototype.target; /** @type {?} */ StModalComponent.prototype.visibility; /** * @type {?} * @private */ StModalComponent.prototype.componentRef; /** * @type {?} * @private */ StModalComponent.prototype._subscriptions; /** * @type {?} * @private */ StModalComponent.prototype.cfr; /** * @type {?} * @private */ StModalComponent.prototype.windowRef; } /** * @fileoverview added by tsickle * Generated from: lib/st-modal/st-modal.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var StModalService = /** @class */ (function () { function StModalService(_cfr) { this._cfr = _cfr; this._containerRef = undefined; this.dynamicModal = undefined; } Object.defineProperty(StModalService.prototype, "container", { /* External API */ set: /* External API */ /** * @param {?} container * @return {?} */ function (container) { this._containerRef = container; }, enumerable: true, configurable: true }); // - Public methods // - Public methods /** * @param {?} config * @param {?=} component * @param {?=} disabledAnimation * @return {?} */ StModalService.prototype.show = // - Public methods /** * @param {?} config * @param {?=} component * @param {?=} disabledAnimation * @return {?} */ function (config, component, disabledAnimation) { /** @type {?} */ var errors = this.canCreateModal(config, component); if (errors && errors.length > 0) { throw new Error(errors.join(' ')); } this.notifyButtonInteraction = new rxjs.Subject(); this.createModal(this.createConfig(config), component, disabledAnimation); return this.notifyButtonInteraction.asObservable(); }; /** * @param {?} type * @param {?} modalTitle * @param {?} messageTitle * @param {?} message * @param {?} okButton * @param {?=} cancelButton * @param {?=} maxWidth * @param {?=} minWidth * @param {?=} icon * @param {?=} showCloseBtn * @return {?} */ StModalService.prototype.showBasicModal = /** * @param {?} type * @param {?} modalTitle * @param {?} messageTitle * @param {?} message * @param {?} okButton * @param {?=} cancelButton * @param {?=} maxWidth * @param {?=} minWidth * @param {?=} icon * @param {?=} showCloseBtn * @return {?} */ function (type, modalTitle, messageTitle, message, okButton, cancelButton, maxWidth, minWidth, icon, showCloseBtn) { if (cancelButton === void 0) { cancelButton = ''; } if (maxWidth === void 0) { maxWidth = 600; } if (minWidth === void 0) { minWidth = 400; } if (icon === void 0) { icon = ''; } if (showCloseBtn === void 0) { showCloseBtn = false; } /** @type {?} */ var iconStatus; /** @type {?} */ var buttons = [{ label: okButton, classes: (type === StModalBasicType.DELETE) ? 'button-critical' : 'button-primary', responseValue: StModalResponse.YES, closeOnClick: true }]; if (type !== StModalBasicType.INFO) { buttons.unshift({ label: cancelButton, classes: (type === StModalBasicType.DELETE) ? 'button-borderless' : 'button-secondary', responseValue: StModalResponse.NO, closeOnClick: true }); } switch (type) { case StModalBasicType.DELETE: iconStatus = 'delete'; break; case StModalBasicType.WARNING: iconStatus = 'alert'; break; default: iconStatus = icon; break; } return this.show({ fullscreen: false, message: message, messageTitle: messageTitle, modalTitle: modalTitle, buttons: buttons, maxWidth: maxWidth, minWidth: minWidth, showCloseBtn: showCloseBtn, iconStatus: iconStatus }); }; /** * @return {?} */ StModalService.prototype.close = /** * @return {?} */ function () { this.destroy(); }; /* INTERNAL METHODS FOR WORK WITH MODALS */ /* INTERNAL METHODS FOR WORK WITH MODALS */ /** * @private * @param {?} modalConfig * @param {?=} component * @param {?=} disabledAnimation * @return {?} */ StModalService.prototype.createModal = /* INTERNAL METHODS FOR WORK WITH MODALS */ /** * @private * @param {?} modalConfig * @param {?=} component * @param {?=} disabledAnimation * @return {?} */ function (modalConfig, component, disabledAnimation) { /** @type {?} */ var stModalFactory = this._cfr.resolveComponentFactory(StModalComponent); if (stModalFactory) { this._containerRef.clear(); this.dynamicModal = this._containerRef.createComponent(stModalFactory); this.bindVars(modalConfig, component, disabledAnimation); } }; /** * @private * @return {?} */ StModalService.prototype.destroy = /** * @private * @return {?} */ function () { if (this.dynamicModal) { this.dynamicModal.destroy(); this.dynamicModal = undefined; this.notifyButtonInteraction.next(StModalResponse.CLOSE); this.notifyButtonInteraction.complete(); } }; /** * @private * @param {?} modalConfig * @param {?} component * @param {?} disabledAnimation * @return {?} */ StModalService.prototype.bindVars = /** * @private * @param {?} modalConfig * @param {?} component * @param {?} disabledAnimation * @return {?} */ function (modalConfig, component, disabledAnimation) { this.dynamicModal.instance.component = component; this.dynamicModal.instance.click.subscribe(this.notify.bind(this)); this.dynamicModal.instance.modalConfig = modalConfig; this.dynamicModal.instance.disabledAnimation = (disabledAnimation !== null) ? disabledAnimation : true; this.dynamicModal.changeDetectorRef.detectChanges(); }; /** * @private * @param {?} buttonResponse * @return {?} */ StModalService.prototype.notify = /** * @private * @param {?} buttonResponse * @return {?} */ function (buttonResponse) { this.notifyButtonInteraction.next(buttonResponse.response); if (buttonResponse.close) { this.close(); } }; /** * @private * @param {?} config * @param {?=} component * @return {?} */ StModalService.prototype.canCreateModal = /** * @private * @param {?} config * @param {?=} component * @return {?} */ function (config, component) { /** @type {?} */ var errors = []; if (!this._containerRef) { errors.push("[ERROR]: StModalService => Cant find container, are you sure you declarate in MAIN APP component in html and typescript?"); }