UNPKG

@stratio/egeo

Version:
1,577 lines (1,560 loc) 586 kB
import { CommonModule } from '@angular/common'; import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, ComponentFactoryResolver, Input, Output, ViewChild, ViewContainerRef, Pipe, NgModule, ChangeDetectorRef, ElementRef, HostListener, forwardRef, HostBinding, ViewEncapsulation, Renderer2, Directive, ViewChildren, Injector, ANALYZE_FOR_ENTRY_COMPONENTS, ContentChildren, Optional } from '@angular/core'; import { Subject, BehaviorSubject, Observable, of } from 'rxjs'; import { takeRight, set, cloneDeep, keys, forEach, values, omit, has, range, flatten, isEqual, throttle, differenceBy, includes, xorBy, clone, sortBy } from 'lodash'; import { map, catchError, zip, debounceTime } from 'rxjs/operators'; import { NG_VALUE_ACCESSOR, Validators, NG_VALIDATORS, FormControl, FormsModule, ReactiveFormsModule, NgControl, FormArray, FormGroup, NgModel } from '@angular/forms'; import { HttpClient, HttpClientModule } from '@angular/common/http'; import { __decorate, __metadata, __rest } from 'tslib'; import 'prismjs'; import 'prismjs/components/prism-typescript'; import { DomSanitizer } from '@angular/platform-browser'; import { Router, RouterModule, NavigationEnd } from '@angular/router'; import { VirtualScrollerModule } from 'ngx-virtual-scroller'; /** * @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} */ const STALERT_SEVERITY = { SUCCESS: 0, WARNING: 1, ERROR: 2, }; STALERT_SEVERITY[STALERT_SEVERITY.SUCCESS] = 'SUCCESS'; STALERT_SEVERITY[STALERT_SEVERITY.WARNING] = 'WARNING'; STALERT_SEVERITY[STALERT_SEVERITY.ERROR] = 'ERROR'; class StAlertLink { } if (false) { /** @type {?} */ StAlertLink.prototype.title; /** @type {?} */ StAlertLink.prototype.link; } class StAlert { /** * @param {?} id * @param {?} title * @param {?} message * @param {?} severity * @param {?} timeout * @param {?} extendedTimeout * @param {?} link */ constructor(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 Subject(); this._removeEvent = new Subject(); } /** * @return {?} */ get opacity() { return this._opacityState.asObservable(); } /** * @return {?} */ get removeAlertEvent() { return this._removeEvent.asObservable(); } /** * @return {?} */ notify() { this.setVisible(true); } /** * @return {?} */ pauseNotify() { this._opacity = 1; this._readed = true; this.clearAnimation(); this.stopLife(); this._opacityState.next(this._opacity); } /** * @return {?} */ continueNotify() { this.startLife(); } /** * @return {?} */ cancel() { this.setVisible(false); } /** * @private * @param {?} increase * @return {?} */ setVisible(increase) { this.clearAnimation(); this._changeVisibilityInterval = window.setInterval((/** * @return {?} */ () => this.modifyVisibility(increase)), 50); } /** * @private * @param {?} increase * @return {?} */ modifyVisibility(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 {?} */ notifyForRemove() { this._opacityState.complete(); this._removeEvent.next(this); this._removeEvent.complete(); } /** * @private * @return {?} */ clearAnimation() { window.clearInterval(this._changeVisibilityInterval); } /** * @private * @return {?} */ stopLife() { window.clearTimeout(this._lifeTimeout); } /** * @private * @return {?} */ startLife() { /** @type {?} */ let timeout = this._readed ? this.extendedTimeout : this.timeout; this._lifeTimeout = window.setTimeout((/** * @return {?} */ () => this.setVisible(false)), timeout); } } 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 */ class StAlertsService { constructor() { this._alertsList = []; this._nextId = 0; this._alertsStream = new BehaviorSubject([]); } /** * @return {?} */ get alertList() { return this._alertsStream.asObservable(); } /** * @param {?} title * @param {?} message * @param {?} severity * @param {?=} link * @param {?=} timeout * @param {?=} extendedTimeout * @return {?} */ notifyAlert(title, message, severity, link, timeout, extendedTimeout) { timeout = timeout !== undefined ? timeout : 5000; extendedTimeout = extendedTimeout !== undefined ? extendedTimeout : 4000; /** @type {?} */ let alert = new StAlert(this._nextId, title, message, severity, timeout, extendedTimeout, link); alert.removeAlertEvent.subscribe((/** * @param {?} alertToRemove * @return {?} */ alertToRemove => this.onNotifyRemove(alertToRemove))); this.insertAlert(alert); this._nextId++; } /** * @private * @param {?} alert * @return {?} */ insertAlert(alert) { this._alertsList.push(alert); this._alertsStream.next(this._alertsList); } /** * @private * @param {?} alert * @return {?} */ onNotifyRemove(alert) { /** @type {?} */ let pos = this._alertsList.findIndex((/** * @param {?} internalAlert * @return {?} */ internalAlert => internalAlert.id === alert.id)); this._alertsList.splice(pos, 1); this._alertsStream.next(this._alertsList); } } StAlertsService.decorators = [ { type: Injectable } ]; 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} */ const StModalResponse = { YES: 0, NO: 1, CLOSE: 2, }; StModalResponse[StModalResponse.YES] = 'YES'; StModalResponse[StModalResponse.NO] = 'NO'; StModalResponse[StModalResponse.CLOSE] = 'CLOSE'; /** @enum {number} */ const 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'; class 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; } class 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; } class 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; } class StWindowRefService { /** * @return {?} */ get nativeWindow() { return getWindow(); } } StWindowRefService.decorators = [ { type: Injectable } ]; /** * @fileoverview added by tsickle * Generated from: lib/st-modal/st-modal.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class StModalComponent { /** * @param {?} cfr * @param {?} windowRef */ constructor(cfr, windowRef) { this.cfr = cfr; this.windowRef = windowRef; this.click = new EventEmitter(); this.defaultMaxWidth = 600; this.defaultMinWidth = 400; } /** * @return {?} */ get hasIcon() { return this.modalConfig.iconStatus; } /** * @return {?} */ get isFullscreen() { return this.modalConfig.fullscreen; } /** * @return {?} */ get title() { return this.modalConfig.modalTitle; } /** * @return {?} */ get buttons() { return this.modalConfig.buttons || []; } /** * @return {?} */ get isMessageModal() { return this.modalConfig.message && this.modalConfig.message.length > 0; } /** * @return {?} */ get isComplexMessageModal() { return this.modalConfig.html && this.modalConfig.html.length > 0; } /** * @return {?} */ get html() { return this.modalConfig.html; } /** * @return {?} */ get message() { return this.modalConfig.message; } /** * @return {?} */ get messageTitle() { return this.modalConfig.messageTitle; } /** * @return {?} */ get modalStyles() { /** @type {?} */ const maxWidth = this.modalConfig.maxWidth || this.defaultMaxWidth; /** @type {?} */ const minWidth = this.modalConfig.minWidth || this.defaultMinWidth; /** @type {?} */ const width = this.getModalActualWidth(maxWidth, minWidth); return { 'max-width': `${maxWidth}px`, 'min-width': `${minWidth}px`, 'width': `${width}px` }; } /** * @return {?} */ get emptyModal() { return this.modalConfig && this.modalConfig.empty; } /** * @return {?} */ get showCloseBtn() { return this.modalConfig.showCloseBtn; } /** * @return {?} */ onClose() { this.click.emit({ response: StModalResponse.CLOSE, close: true }); } /** * DYNAMIC MODAL BODY COMPONENT LOAD * @return {?} */ ngAfterViewInit() { 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 {?} */ ngOnDestroy() { if (this.componentRef) { this.componentRef.destroy(); } this.windowRef.nativeWindow.document.body.classList.remove('st-modal-overlay'); } /** * @private * @param {?} maxWidth * @param {?=} minWidth * @return {?} */ getModalActualWidth(maxWidth, minWidth) { /** @type {?} */ const screenWidth = this.windowRef.nativeWindow.screen.width; return screenWidth > maxWidth ? maxWidth : (screenWidth < minWidth ? minWidth : screenWidth); } /** * @private * @return {?} */ loadBody() { if (!this.componentRef) { this.target.clear(); /** @type {?} */ const compFactory = this.cfr.resolveComponentFactory(this.component); this.componentRef = this.target.createComponent(compFactory); this.bindModalInputs(); } } /** * @private * @return {?} */ bindModalInputs() { Object.keys(this.modalConfig.inputs).forEach((/** * @param {?} key * @return {?} */ (key) => { this.componentRef.instance[key] = ((/** @type {?} */ (this.modalConfig.inputs)))[key]; })); Object.keys(this.modalConfig.outputs).forEach((/** * @param {?} key * @return {?} */ (key) => { this.componentRef.instance[key].subscribe(((/** @type {?} */ (this.modalConfig.outputs)))[key]); })); this.componentRef.changeDetectorRef.detectChanges(); } } StModalComponent.decorators = [ { type: 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\">\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=\"icon-cross close-button\" *ngIf=\"showCloseBtn\" (click)=\"onClose()\"></span>\n\n <st-modal-buttons *ngIf=\"isFullscreen\" [buttonConfig]=\"buttons\" [fullscreen]=\"isFullscreen\" (click)=\"click.emit($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)=\"click.emit($event)\"></st-modal-buttons>\n </div>\n </footer>\n </section>\n</div>\n\n", changeDetection: ChangeDetectionStrategy.OnPush, styles: ["@charset \"UTF-8\";.st-modal-container{display:flex;height:100vh;left:0;position:fixed;top:0;width:100%}.st-modal-container .st-modal{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{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-buttons{display:flex;justify-content:flex-end;margin-left:auto}.st-modal-container .st-modal .container{min-width:auto}"] }] } ]; /** @nocollapse */ StModalComponent.ctorParameters = () => [ { type: ComponentFactoryResolver }, { type: StWindowRefService } ]; StModalComponent.propDecorators = { modalConfig: [{ type: Input }], component: [{ type: Input }], click: [{ type: Output }], targetContent: [{ type: ViewChild, args: ['stModalBody', { read: ViewContainerRef, static: false },] }], targetEmpty: [{ type: ViewChild, args: ['stModalBodyEmpty', { read: ViewContainerRef, static: false },] }] }; if (false) { /** @type {?} */ StModalComponent.prototype.modalConfig; /** @type {?} */ StModalComponent.prototype.component; /** @type {?} */ StModalComponent.prototype.click; /** @type {?} */ StModalComponent.prototype.targetContent; /** @type {?} */ StModalComponent.prototype.targetEmpty; /** @type {?} */ StModalComponent.prototype.defaultMaxWidth; /** @type {?} */ StModalComponent.prototype.defaultMinWidth; /** @type {?} */ StModalComponent.prototype.target; /** * @type {?} * @private */ StModalComponent.prototype.componentRef; /** * @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 */ class StModalService { /** * @param {?} _cfr */ constructor(_cfr) { this._cfr = _cfr; this._containerRef = undefined; this.dynamicModal = undefined; } /* External API */ /** * @param {?} container * @return {?} */ set container(container) { this._containerRef = container; } // - Public methods /** * @param {?} config * @param {?=} component * @return {?} */ show(config, component) { /** @type {?} */ let errors = this.canCreateModal(config, component); if (errors && errors.length > 0) { throw new Error(errors.join(' ')); } this.notifyButtonInteraction = new Subject(); this.createModal(this.createConfig(config), component); return this.notifyButtonInteraction.asObservable(); } /** * @param {?} type * @param {?} modalTitle * @param {?} messageTitle * @param {?} message * @param {?} okButton * @param {?=} cancelButton * @param {?=} maxWidth * @param {?=} minWidth * @param {?=} icon * @return {?} */ showBasicModal(type, modalTitle, messageTitle, message, okButton, cancelButton = '', maxWidth = 600, minWidth = 400, icon = '') { /** @type {?} */ let iconStatus; /** @type {?} */ const 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 = 'icon-circle-cross'; break; case StModalBasicType.WARNING: iconStatus = 'icon-alert'; break; default: iconStatus = icon; break; } return this.show({ fullscreen: false, message, messageTitle, modalTitle, buttons, maxWidth, minWidth, iconStatus }); } /** * @return {?} */ close() { this.destroy(); } /* INTERNAL METHODS FOR WORK WITH MODALS */ /** * @private * @param {?} modalConfig * @param {?=} component * @return {?} */ createModal(modalConfig, component) { /** @type {?} */ let stModalFactory = this._cfr.resolveComponentFactory(StModalComponent); if (stModalFactory) { this._containerRef.clear(); this.dynamicModal = this._containerRef.createComponent(stModalFactory); this.bindVars(modalConfig, component); } } /** * @private * @return {?} */ destroy() { if (this.dynamicModal) { this.dynamicModal.destroy(); this.dynamicModal = undefined; this.notifyButtonInteraction.next(StModalResponse.CLOSE); this.notifyButtonInteraction.complete(); } } /** * @private * @param {?} modalConfig * @param {?} component * @return {?} */ bindVars(modalConfig, component) { this.dynamicModal.instance.component = component; this.dynamicModal.instance.click.subscribe(this.notify.bind(this)); this.dynamicModal.instance.modalConfig = modalConfig; this.dynamicModal.changeDetectorRef.detectChanges(); } /** * @private * @param {?} buttonResponse * @return {?} */ notify(buttonResponse) { this.notifyButtonInteraction.next(buttonResponse.response); if (buttonResponse.close) { this.close(); } } /** * @private * @param {?} config * @param {?=} component * @return {?} */ canCreateModal(config, component) { /** @type {?} */ let errors = []; if (!this._containerRef) { errors.push(`[ERROR]: StModalService => Cant find container, are you sure you declarate in MAIN APP component in html and typescript?`); } if (this.dynamicModal !== undefined) { errors.push(`[ERROR]: StModalService => Can't create modal beacause already exists one. Are you sure that you call close method?)`); } if (!component && !config.message && !config.html) { errors.push(`[ERROR]: StModalService => Can't find message, html or component to show in modal`); } return errors; } /** * @private * @param {?} config * @return {?} */ createConfig(config) { /** @type {?} */ const defaultConfig = { fullscreen: false, inputs: {}, outputs: {}, modalTitle: 'Default title', messageTitle: 'Default subtitle', buttons: [], message: undefined, html: undefined, maxWidth: undefined, minWidth: undefined, empty: false }; /** @type {?} */ const checkedConfig = Object.assign({}, defaultConfig, config); checkedConfig.buttons = this.checkButtons(checkedConfig.buttons); return checkedConfig; } /** * @private * @param {?} buttons * @return {?} */ checkButtons(buttons) { return buttons.map((/** * @param {?} button * @return {?} */ button => Object.assign({}, { label: 'Button', closeOnClick: false }, button))); } } StModalService.decorators = [ { type: Injectable } ]; /** @nocollapse */ StModalService.ctorParameters = () => [ { type: ComponentFactoryResolver } ]; if (false) { /** * @type {?} * @private */ StModalService.prototype._containerRef; /** * @type {?} * @private */ StModalService.prototype.dynamicModal; /** * @type {?} * @private */ StModalService.prototype.notifyButtonInteraction; /** * @type {?} * @private */ StModalService.prototype._cfr; } /** * @fileoverview added by tsickle * Generated from: lib/st-pagination/st-pagination.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class StPaginationService { constructor() { } /** * @param {?} items * @param {?} currentPage * @param {?} perPage * @return {?} */ newPage(items, currentPage, perPage) { if (currentPage === 1) { this.initItem = 0; } else { this.initItem = perPage * (currentPage - 1); } if (perPage >= items.length) { return Object.assign([], items); } if (this.initItem >= items.length) { this.initItem = items.length - (perPage + 1); return Object.assign([], takeRight(items, perPage)); } this.lastItem = (this.initItem + perPage); return Object.assign([], items.slice(this.initItem, this.lastItem)); } } StPaginationService.decorators = [ { type: Injectable } ]; /** @nocollapse */ StPaginationService.ctorParameters = () => []; if (false) { /** * @type {?} * @private */ StPaginationService.prototype.initItem; /** * @type {?} * @private */ StPaginationService.prototype.lastItem; } /** * @fileoverview added by tsickle * Generated from: lib/utils/egeo-resolver/egeo-resolve.service.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class EgeoResolveService { /** * @param {?} object * @param {?} key * @param {?=} searchedValue * @return {?} */ getKeys(object, key, searchedValue) { return this.searchInDeep(object, key, searchedValue); } /** * @param {?} object * @param {?} resolved * @return {?} */ setKeys(object, resolved) { resolved.forEach((/** * @param {?} element * @return {?} */ (element) => set(object, element.path, element.resolved))); } /** * @param {?} object * @param {?} translateService * @return {?} */ translate(object, translateService) { /** @type {?} */ let keys = this.getKeys(object, 'translate'); // If not found translateable elements, return the same because if not, translate service broke on try to translate an empty array. if (keys && keys.length > 0) { /** @type {?} */ let toTranslate = this.extractTranslationKeys(keys); return translateService.get(toTranslate).pipe(// return object translation map((/** * @param {?} translation * @return {?} */ (translation) => this.remapObjectWithTranslations(translation, keys, object)))); } else { return Observable.create((/** * @param {?} observer * @return {?} */ (observer) => { observer.next(object); observer.complete(); })); } } /** * @param {?} keys * @param {?} translateService * @return {?} */ translateArrayOfKeys(keys, translateService) { return translateService.get(keys).pipe(map((/** * @param {?} translation * @return {?} */ (translation) => this.remapArrayWithTranslations(translation, keys)))); } /** * @private * @param {?} translations * @param {?} originalArray * @return {?} */ remapArrayWithTranslations(translations, originalArray) { return originalArray.map((/** * @param {?} key * @return {?} */ (key) => translations[key] ? translations[key] : key)); } /** * @private * @param {?} translations * @param {?} resolverKeys * @param {?} object * @return {?} */ remapObjectWithTranslations(translations, resolverKeys, object) { /** @type {?} */ let newObj = cloneDeep(object); if (translations || keys(translations).length > 0) { forEach(resolverKeys, (/** * @param {?} resolvKey * @return {?} */ (resolvKey) => { set(newObj, resolvKey.path, this.getTranslationFromTranslatedKey(translations, resolvKey)); })); } return newObj; } /** * @private * @param {?} translations * @param {?} resolverKey * @return {?} */ getTranslationFromTranslatedKey(translations, resolverKey) { /** @type {?} */ let translationElementKey = resolverKey && resolverKey.toResolve && resolverKey.toResolve.key ? resolverKey.toResolve.key : ''; return translations[translationElementKey] ? translations[translationElementKey] : translationElementKey; } /** * @private * @param {?} list * @return {?} */ extractTranslationKeys(list) { return list.map((/** * @param {?} element * @return {?} */ (element) => (/** @type {?} */ (values(omit(element.toResolve, 'translate'))[0])))); } /** * @private * @param {?} object * @param {?} key * @param {?} searchedValue * @param {?=} path * @return {?} */ searchInDeep(object, key, searchedValue, path = '') { /** @type {?} */ let result = []; if (has(object, key)) { // If we found key, return object. if (searchedValue !== undefined) { if (object[key] === searchedValue) { result.push({ path, toResolve: object }); } } else { result.push({ path, toResolve: object }); } } /** @type {?} */ let i = 0; forEach(object, (/** * @param {?} value * @param {?} objKey * @return {?} */ (value, objKey) => { if (typeof value === 'object') { result = [...result, ...this.searchInDeep(value, key, searchedValue, this.getPath(path, object, i, objKey))]; } i++; })); return result; } // Build path for future replace /** * @private * @param {?} actualPath * @param {?} obj * @param {?} pos * @param {?} key * @return {?} */ getPath(actualPath, obj, pos, key) { if (this.isArray(obj)) { actualPath = `${actualPath}[${pos}]`; } else { actualPath = actualPath === '' ? key : `${actualPath}.${key}`; } return actualPath; } /** * @private * @param {?} value * @return {?} */ isArray(value) { return Object.prototype.toString.call(value) === '[object Array]'; } } EgeoResolveService.decorators = [ { type: Injectable } ]; /** * @fileoverview added by tsickle * Generated from: lib/utils/unique-dispatcher.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class SelectOneDispatcher { constructor() { this.listeners = []; } /** * @param {?} id * @param {?} name * @return {?} */ notify(id, name) { for (let listener of this.listeners) { listener(id, name); } } /** * @param {?} listener * @return {?} */ listen(listener) { this.listeners.push(listener); } } SelectOneDispatcher.decorators = [ { type: Injectable } ]; if (false) { /** * @type {?} * @private */ SelectOneDispatcher.prototype.listeners; } /** * @fileoverview added by tsickle * Generated from: lib/pipes/search-filter/search-filter.pipe.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class StFilterList { /** * @param {?} list * @param {?} field * @param {?} search * @return {?} */ transform(list, field, search) { this.checkParams(field); if (!search) { return list; } if (list && list.length > 0 && field) { return list.filter((/** * @param {?} element * @return {?} */ (element) => this.contains(element, field, search))); } else { return []; } } /** * @private * @param {?} element * @param {?} field * @param {?} search * @return {?} */ contains(element, field, search) { if (this.isDefined(element) && this.isString(field) && this.isString(search) && this.isString(element[field])) { return element[field].toUpperCase().search(search.toUpperCase()) > -1; } return false; } /** * @private * @param {?} value * @return {?} */ isDefined(value) { return value !== undefined && value !== null; } /** * @private * @param {?} value * @return {?} */ isString(value) { return this.isDefined(value) && typeof value === 'string'; } /** * @private * @param {?} field * @return {?} */ checkParams(field) { if (!this.isString(field)) { throw new Error('PIPE: stFilterList: "field" is a required and string parameter'); } } } StFilterList.decorators = [ { type: Pipe, args: [{ name: 'stFilterList' },] } ]; /** * @fileoverview added by tsickle * Generated from: lib/pipes/st-object-to-array/st-object-to-array.pipe.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class StObjectToArrayPipe { /** * @param {?} obj * @return {?} */ transform(obj) { return obj ? Object.keys(obj).map((/** * @param {?} key * @return {?} */ key => ({ key, value: obj[key] }))) : []; } } StObjectToArrayPipe.decorators = [ { type: Pipe, args: [{ 'name': 'stObjectToArray' },] } ]; /** * @fileoverview added by tsickle * Generated from: lib/pipes/pipes.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class PipesModule { } PipesModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule], declarations: [StFilterList, StObjectToArrayPipe], exports: [StFilterList, StObjectToArrayPipe] },] } ]; /** * @fileoverview added by tsickle * Generated from: lib/st-alerts/alert-box/st-alert-box.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class StAlertBoxComponent { /** * @param {?} _cd */ constructor(_cd) { this._cd = _cd; this.showInConsole = false; this.opacity = 0; } /** * @return {?} */ ngOnInit() { this.alert.opacity.subscribe((/** * @param {?} opacity * @return {?} */ opacity => this.changeOpacity(opacity))); this.alert.notify(); if (this.showInConsole) { this.notifyConsole(); } this.severityColorValue = this.getSeverityColor(); this.iconValue = this.getIcon(); } /** * @return {?} */ enter() { this.alert.pauseNotify(); } /** * @return {?} */ leave() { this.alert.continueNotify(); } /** * @return {?} */ closeAlert() { this.alert.cancel(); } /** * @return {?} */ getIcon() { switch (this.alert.severity) { case STALERT_SEVERITY.ERROR: return 'icon-ban'; case STALERT_SEVERITY.WARNING: return 'icon-alert'; case STALERT_SEVERITY.SUCCESS: return 'icon-circle-check'; default: return ''; } } /** * @return {?} */ getSeverityColor() { switch (this.alert.severity) { case STALERT_SEVERITY.ERROR: return 'sth-alert-box-error'; case STALERT_SEVERITY.WARNING: return 'sth-alert-box-warning'; case STALERT_SEVERITY.SUCCESS: return 'sth-alert-box-success'; default: return ''; } } /** * @return {?} */ goTo() { window.open(this.alert.link.link); } /** * @param {?} opacity * @return {?} */ changeOpacity(opacity) { this.opacity = opacity; this._cd.markForCheck(); } /** * @private * @return {?} */ notifyConsole() { switch (this.alert.severity) { case STALERT_SEVERITY.ERROR: console.error(`ERROR-${this.alert.title}: ${this.alert.message}`); break; case STALERT_SEVERITY.WARNING: console.warn(`WARNING-${this.alert.title}: ${this.alert.message}`); break; case STALERT_SEVERITY.SUCCESS: console.log(`SUCCESS-${this.alert.title}: ${this.alert.message}`); break; default: console.error(`ERROR: severity not found for ${this.alert.title}: ${this.alert.message}`); break; } } } StAlertBoxComponent.decorators = [ { type: Component, args: [{ selector: 'st-alert-box', 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=\"sth-alert-box\" [ngClass]=\"severityColorValue\" (mouseenter)=\"enter()\" (mouseleave)=\"leave()\" [ngStyle]=\"{opacity: opacity}\">\n <span class=\"sth-alert-box-close-button\" (click)=\"closeAlert()\">\n <i class=\"icon-circle-cross\"></i>\n </span>\n <div class=\"sth-alert-box-ico-type\">\n <i [ngClass]=\"iconValue\"></i>\n </div>\n <div class=\"sth-alert-box-message\">\n <header class=\"sth-alert-box-message-header\">\n <p class=\"sth-alert-box-message-header-title\">{{alert.title}}</p>\n </header>\n <div class=\"sth-alert-box-message-body\">\n <p>{{alert.message}}</p>\n <footer *ngIf=\"alert.link\" class=\"sth-alert-box-message-footer\">\n <a (click)=\"goTo()\">{{alert.link.title}}</a>\n </footer>\n </div>\n </div>\n</div>\n", changeDetection: ChangeDetectionStrategy.OnPush }] } ]; /** @nocollapse */ StAlertBoxComponent.ctorParameters = () => [ { type: ChangeDetectorRef } ]; StAlertBoxComponent.propDecorators = { alert: [{ type: Input }], showInConsole: [{ type: Input }] }; if (false) { /** @type {?} */ StAlertBoxComponent.prototype.alert; /** @type {?} */ StAlertBoxComponent.prototype.showInConsole; /** @type {?} */ StAlertBoxComponent.prototype.iconValue; /** @type {?} */ StAlertBoxComponent.prototype.opacity; /** @type {?} */ StAlertBoxComponent.prototype.severityColorValue; /** * @type {?} * @private */ StAlertBoxComponent.prototype._cd; } /** * @fileoverview added by tsickle * Generated from: lib/st-alerts/st-alerts.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class StAlertsComponent { /** * @param {?} _cd * @param {?} alertService */ constructor(_cd, alertService) { this._cd = _cd; this.alertService = alertService; this.showInConsole = false; this.qaTag = 'st-alert-manager'; } } StAlertsComponent.decorators = [ { type: Component, args: [{ selector: 'st-alerts', 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 [attr.id]='qaTag' class=\"st-alerts sth-alerts\">\n <st-alert-box class=\"st-alert-box\" *ngFor=\"let alert of (alertService.alertList | async)\" [alert]=\"alert\" [showInConsole]=\"showInConsole\"></st-alert-box>\n</div>\n", changeDetection: ChangeDetectionStrategy.OnPush, styles: ["@charset \"UTF-8\";.st-alert-box{margin-top:15px;display:block}.st-alerts{width:288px;position:fixed;right:15px;top:0}"] }] } ]; /** @nocollapse */ StAlertsComponent.ctorParameters = () => [ { type: ChangeDetectorRef }, { type: StAlertsService } ]; StAlertsComponent.propDecorators = { showInConsole: [{ type: Input }], qaTag: [{ type: Input }] }; if (false) { /** @type {?} */ StAlertsComponent.prototype.showInConsole; /** @type {?} */ StAlertsComponent.prototype.qaTag; /** * @type {?} * @private */ StAlertsComponent.prototype._cd; /** @type {?} */ StAlertsComponent.prototype.alertService; } /** * @fileoverview added by tsickle * Generated from: lib/st-alerts/st-alerts.module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class StAlertsModule { } StAlertsModule.decorators = [ { type: NgModule, args: [{ imports: [CommonModule], declarations: [StAlertsComponent, StAlertBoxComponent], exports: [StAlertsComponent] },] } ]; /** * @fileoverview added by tsickle * Generated from: lib/st-pop/st-pop.model.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ const StPopPlacement = { TOP: 0, TOP_START: 1, TOP_END: 2, BOTTOM: 3, BOTTOM_START: 4, BOTTOM_END: 5, }; StPopPlacement[StPopPlacement.TOP] = 'TOP'; StPopPlacement[StPopPlacement.TOP_START] = 'TOP_START'; StPopPlacement[StPopPlacement.TOP_END] = 'TOP_END'; StPopPlacement[StPopPlacement.BOTTOM] = 'BOTTOM'; StPopPlacement[StPopPlacement.BOTTOM_START] = 'BOTTOM_START'; StPopPlacement[StPopPlacement.BOTTOM_END] = 'BOTTOM_END'; class StPopOffset { constructor() { this.x = 0; this.y = 0; } } if (false) { /** @type {?} */ StPopOffset.prototype.x; /** @type {?} */ StPopOffset.prototype.y; } /** * @fileoverview added by tsickle * Generated from: lib/st-bubble/st-bubble.component.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description {Component} [Bubble] * * This component displays a text inside a floating box * * \@example * * {html} * * ``` * <st-bubble [qaTag]="qaTag" [text]="text" [hidden]="hidden"> * </st-bubble> * ``` */ class StBubbleComponent { constructor() { /** * \@input {boolean} [hidden=false] Show or hide the bubble */ this.hidden = false; /** * \@Input {StPopOffset} [offset={x: 0 , y: 17}] For position with offset in x o y axis */ this.offset = { x: 0, y: 17 }; /** * \@Input {boolean} [showArrow=true] when true, arrow icon is displayed */ this.showArrow = true; /** * \@Input {boolean} [animation=true] when true, bubble is displayed with an animation */ this.animation = true; /** * \@Input {boolean} [openToLeft=true] when true, bubble is displayed with the arrow to the right */ this.openToLeft = true; /** * \@Input {boolean} [animation=false] when true, bubble is displayed with theme small */ this.small = false; this.placement = StPopPlacement.BOTTOM; } } StBubbleComponent.decorators = [ { type: Component, args: [{ selector: 'st-bubble', 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\n\n<st-pop [hidden]=\"hidden\" [placement]=\"placement\" [offset]=\"offset\" class=\"st-bubble\" [openToLeft]=\"openToLeft\">\n <div pop-button>\n <ng-content select=[bubble-button]></ng-content>\n </div>\n <div pop-content [style.z-index]=\"9\" class=\"st-bubble__content\"\n [ngClass]=\"{\n 'st-bubble__content--animated': animation,\n 'st-bubble__content--small': small,\n 'st-bubble__content--with-arrow': showArrow,\n 'st-bubble__content--to-left': openToLeft,\n 'st-bubble__content--to-right': !openToLeft,\n 'st-bubble__content--show': !hidden}\">\n <span class=\"text\"> {{text}} </span>\n </div>\n</st-pop>\n", styles: ["@charset \"UTF-8\";.content{display:inline-block}.arrow{position:relative;width:13px;height:13px;bottom:47px;transform:rotate(-45deg);float:right;margin-right:15px;border-radius:2px}.text{display:block;text-align:center;white-space:nowrap}"] }] } ]; StBubbleComponent.propDecorators = { text: [{ type: Input }], hidden: [{ type: Input }], offset: [{ type: Input }], showArrow: [{ type: Input }], animation: [{ type: Input }], openToLeft: [{ type: Input }], small: [{ type: Input }] }; if (false) { /** * \@input {string} Text of the bubble * @type {?} */ StBubbleComponent.prototype.text; /** * \@input {boolean} [hidden=false] Show or hide the bubble * @type {?} */ StBubbleComponent.prototype.hidden; /** * \@Input {StPopOffset} [offset={x: 0 , y: 17}] For position with offset in x o y axis * @type {?} */ StBubbleComponent.prototype.offset; /** * \@Input {boolean} [showArrow=true] when true, arrow icon is displayed * @type {?} */ StBubbleComponent.prototype.showArrow; /** * \@Input {boolean} [animation=true] when true, bubble is displayed with an animation * @type {?} */ StBubbleComponent.prototype.animation; /** * \@Input {boolean} [openToLeft=true] when true, bubble is displayed with the arrow to the right * @type {?} */ StBubbleComponent.prototype.openToLeft; /** * \@Input {boolean} [animation=false] when true, bubble is displayed with theme small * @type {?} */ StBubbleComponent.prototype.small; /** @type {?} */ StBubbleComponent.prototype.plac