lamb-web-lib
Version:
LambWebLib. Es un proyecto angular de tipo Librería. que contiene una Suit de componentes reutilizables para el proyecto [Lamb Financial](https://lamb.upeu.edu.pe).
1,409 lines (1,377 loc) • 354 kB
JavaScript
import { Injectable, Component, Input, EventEmitter, Output, ViewChildren, ElementRef, HostBinding, ApplicationRef, Injector, Inject, ComponentFactoryResolver, TemplateRef, ReflectiveInjector, Renderer2, HostListener, Directive, ContentChild, ContentChildren, NgModule, InjectionToken, defineInjectable } from '@angular/core';
import { ActivatedRoute, Router, NavigationEnd, RouterModule } from '@angular/router';
import { Location, CommonModule, DOCUMENT } from '@angular/common';
import { filter, map, takeUntil, withLatestFrom, share, takeWhile } from 'rxjs/operators';
import { __spread, __values, __read, __assign } from 'tslib';
import { fromEvent, ReplaySubject, BehaviorSubject } from 'rxjs';
import { trigger, style, transition, animate, state } from '@angular/animations';
import { Title } from '@angular/platform-browser';
import { ReactiveFormsModule } from '@angular/forms';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambWebLibService = /** @class */ (function () {
function LambWebLibService() {
}
LambWebLibService.decorators = [
{ type: Injectable, args: [{
providedIn: 'root'
},] },
];
LambWebLibService.ctorParameters = function () { return []; };
/** @nocollapse */ LambWebLibService.ngInjectableDef = defineInjectable({ factory: function LambWebLibService_Factory() { return new LambWebLibService(); }, token: LambWebLibService, providedIn: "root" });
return LambWebLibService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambWebLibComponent = /** @class */ (function () {
function LambWebLibComponent() {
}
/**
* @return {?}
*/
LambWebLibComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
};
LambWebLibComponent.decorators = [
{ type: Component, args: [{
selector: 'lamb-lamb-web-lib',
template: "\n <p>\n lamb-web-lib works!\n </p>\n ",
styles: []
},] },
];
LambWebLibComponent.ctorParameters = function () { return []; };
return LambWebLibComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambWebLibModule = /** @class */ (function () {
function LambWebLibModule() {
}
LambWebLibModule.decorators = [
{ type: NgModule, args: [{
imports: [],
declarations: [LambWebLibComponent],
exports: [LambWebLibComponent]
},] },
];
return LambWebLibModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambButtonBackComponent = /** @class */ (function () {
// private pathBack: string;
function LambButtonBackComponent(route, router, location) {
this.route = route;
this.router = router;
this.location = location;
this.flag = true;
}
/**
* @return {?}
*/
LambButtonBackComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
/** Estos dos metodos son para el flag. */
this.initShowOrHideFlag();
this.eventFlagSubscribe();
};
/**
* @return {?}
*/
LambButtonBackComponent.prototype.initShowOrHideFlag = /**
* @return {?}
*/
function () {
/** @type {?} */
var pathEnd = this.pathEnd(this.location.path());
this.condition(pathEnd);
};
/**
* @return {?}
*/
LambButtonBackComponent.prototype.eventFlagSubscribe = /**
* @return {?}
*/
function () {
var _this = this;
this.router.events.pipe(filter(function (path) { return path instanceof NavigationEnd; }))
.subscribe(function (path) {
/** @type {?} */
var pathEnd = _this.pathEnd(path.url);
_this.condition(pathEnd);
});
};
/**
* @param {?} path
* @return {?}
*/
LambButtonBackComponent.prototype.pathEnd = /**
* @param {?} path
* @return {?}
*/
function (path) {
/** @type {?} */
var paths = path.split('/')
.filter(function (path2) { return path2 !== ''; });
return paths[paths.length - 1];
};
/**
* @param {?} pathEnd
* @return {?}
*/
LambButtonBackComponent.prototype.condition = /**
* @param {?} pathEnd
* @return {?}
*/
function (pathEnd) {
/** @type {?} */
var url = this.route.snapshot.url;
if (((url[0] && url[0].path) === pathEnd)) {
this.flag = true;
}
else if (url[0] == null) {
/** @type {?} */
var urlParent = this.route.parent.snapshot.url;
if (((urlParent[urlParent.length - 1] && urlParent[urlParent.length - 1].path) === pathEnd)) {
this.flag = true;
}
else {
this.flag = false;
}
}
else {
this.flag = false;
}
};
/**
* @return {?}
*/
LambButtonBackComponent.prototype.onBack = /**
* @return {?}
*/
function () {
/** @type {?} */
var url = this.route.snapshot.url;
/** @type {?} */
var link = (url[0] && url[0].path) || '';
/** @type {?} */
var relativeUrl = link ? "../" + link : "./" + link;
this.router.navigate([relativeUrl], { relativeTo: this.route });
};
LambButtonBackComponent.decorators = [
{ type: Component, args: [{
selector: 'lamb-button-back',
template: "\n <a class=\"btn btn-light lamb-button\" [ngClass]=\"{'lamb-flag': flag}\" (click)=\"onBack()\">\n <span class=\"fa fa-reply\" > </span>\n </a>\n ",
styles: [
"\n .lamb-flag {\n visibility: hidden;\n }\n .lamb-button {\n /* padding: 0.3rem 0.6rem; */\n padding: 0.1rem 0.3rem;\n cursor: pointer !important;\n border-radius: 50%;\n -webkit-transition: -webkit-transform .4s ease-in-out;\n transition: transform .4s ease-in-out;\n }\n .lamb-button:hover {\n -webkit-transform: rotate(-360deg);\n transform: rotate(-360deg)\n }\n ",
],
},] },
];
LambButtonBackComponent.ctorParameters = function () { return [
{ type: ActivatedRoute },
{ type: Router },
{ type: Location }
]; };
return LambButtonBackComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambButtonBackModule = /** @class */ (function () {
function LambButtonBackModule() {
}
LambButtonBackModule.decorators = [
{ type: NgModule, args: [{
imports: [
CommonModule,
],
exports: [
LambButtonBackComponent,
],
declarations: [
LambButtonBackComponent,
],
providers: [],
},] },
];
return LambButtonBackModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambButtonIconComponent = /** @class */ (function () {
function LambButtonIconComponent() {
this.colorClass = 'btn-light';
this.icon = 'fa fa-plus-circle';
this.label = 'New';
this.size = 'lg';
}
/**
* @return {?}
*/
LambButtonIconComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
};
LambButtonIconComponent.decorators = [
{ type: Component, args: [{
selector: 'lamb-button-icon',
template: "<!-- <button class=\"btn lamb-btn-block btn-sm\" [title]=\"title || ''\" [routerLink]=\"routerLink\" [disabled]=\"isDisabled\"> -->\n<button class=\"btn lamb-btn-block btn-{{ size }} {{ colorClass }}\" [title]=\"title || ''\" [disabled]=\"isDisabled\">\n <span class=\"{{ icon }}\" [ngClass]=\"{'lamb-icon': !onlyIcon, 'lamb-text-black': (colorClass === 'btn-light') }\"></span>\n <span *ngIf=\"!onlyIcon\" [ngClass]=\"{'lamb-text-black': (colorClass === 'btn-light')}\"> {{ label }}</span>\n</button>",
styles: [".lamb-icon{margin-right:3px}@media (max-width:550px){.lamb-btn-block{display:block;width:100%}}:host{display:flex;flex-direction:column;position:relative;height:100%}"]
},] },
];
LambButtonIconComponent.ctorParameters = function () { return []; };
LambButtonIconComponent.propDecorators = {
colorClass: [{ type: Input }],
label: [{ type: Input }],
isDisabled: [{ type: Input }],
onlyIcon: [{ type: Input }],
icon: [{ type: Input }],
title: [{ type: Input }],
size: [{ type: Input }]
};
return LambButtonIconComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambButtonIconModule = /** @class */ (function () {
function LambButtonIconModule() {
}
LambButtonIconModule.decorators = [
{ type: NgModule, args: [{
imports: [
CommonModule,
],
declarations: [LambButtonIconComponent],
exports: [LambButtonIconComponent],
},] },
];
return LambButtonIconModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambModalBackdropComponent = /** @class */ (function () {
function LambModalBackdropComponent() {
}
Object.defineProperty(LambModalBackdropComponent.prototype, "modalClass", {
get: /**
* @return {?}
*/
function () { return 'modal-backdrop fade show'; },
enumerable: true,
configurable: true
});
LambModalBackdropComponent.decorators = [
{ type: Component, args: [{
selector: 'lamb-modal-backdrop',
template: '',
// host: { 'class': 'modal-backdrop fade show' },
styles: [],
},] },
];
LambModalBackdropComponent.ctorParameters = function () { return []; };
LambModalBackdropComponent.propDecorators = {
modalClass: [{ type: HostBinding, args: ['class',] }]
};
return LambModalBackdropComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/** @enum {number} */
var ModalDismissReasons = {
BACKDROP_CLICK: 0,
ESC: 1,
};
ModalDismissReasons[ModalDismissReasons.BACKDROP_CLICK] = 'BACKDROP_CLICK';
ModalDismissReasons[ModalDismissReasons.ESC] = 'ESC';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/** @enum {number} */
var Key = {
Tab: 9,
Enter: 13,
Escape: 27,
Space: 32,
PageUp: 33,
PageDown: 34,
End: 35,
Home: 36,
ArrowLeft: 37,
ArrowUp: 38,
ArrowRight: 39,
ArrowDown: 40,
};
Key[Key.Tab] = 'Tab';
Key[Key.Enter] = 'Enter';
Key[Key.Escape] = 'Escape';
Key[Key.Space] = 'Space';
Key[Key.PageUp] = 'PageUp';
Key[Key.PageDown] = 'PageDown';
Key[Key.End] = 'End';
Key[Key.Home] = 'Home';
Key[Key.ArrowLeft] = 'ArrowLeft';
Key[Key.ArrowUp] = 'ArrowUp';
Key[Key.ArrowRight] = 'ArrowRight';
Key[Key.ArrowDown] = 'ArrowDown';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/** @type {?} */
var FOCUSABLE_ELEMENTS_SELECTOR = [
'a[href]', 'button:not([disabled])', 'input:not([disabled]):not([type="hidden"])', 'select:not([disabled])',
'textarea:not([disabled])', '[contenteditable]', '[tabindex]:not([tabindex="-1"])'
].join(', ');
/**
* Returns first and last focusable elements inside of a given element based on specific CSS selector
* @param {?} element
* @return {?}
*/
function getFocusableBoundaryElements(element) {
/** @type {?} */
var list = element.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR);
return [list[0], list[list.length - 1]];
}
/**
* Function that enforces browser focus to be trapped inside a DOM element.
*
* Works only for clicks inside the element and navigation with 'Tab', ignoring clicks outside of the element
*
* \@param element The element around which focus will be trapped inside
* \@param stopFocusTrap$ The observable stream. When completed the focus trap will clean up listeners
* and free internal resources
* @type {?}
*/
var lambFocusTrap = function (element, stopFocusTrap$) {
// last focused element
/** @type {?} */
var lastFocusedElement$ = fromEvent(element, 'focusin').pipe(takeUntil(stopFocusTrap$), map(function (e) { return e.target; }));
// 'tab' / 'shift+tab' stream
fromEvent(element, 'keydown')
.pipe(takeUntil(stopFocusTrap$), filter(function (e) { return e.which === Key.Tab; }), withLatestFrom(lastFocusedElement$))
.subscribe(function (_a) {
var _b = __read(_a, 2), tabEvent = _b[0], focusedElement = _b[1];
var _c = __read(getFocusableBoundaryElements(element), 2), first = _c[0], last = _c[1];
if (focusedElement === first && tabEvent.shiftKey) {
last.focus();
tabEvent.preventDefault();
}
if (focusedElement === last && !tabEvent.shiftKey) {
first.focus();
tabEvent.preventDefault();
}
});
// inside click
fromEvent(element, 'click')
.pipe(takeUntil(stopFocusTrap$), withLatestFrom(lastFocusedElement$), map(function (arr) { return (/** @type {?} */ (arr[1])); }))
.subscribe(function (lastFocusedElement) { return lastFocusedElement.focus(); });
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambModalWindowComponent = /** @class */ (function () {
// @HostBinding('attr.role')
// public role = 'dialog';
// @HostBinding('attr.tabindex')
// public tabindex = '-1';
// @HostBinding('attr.style')
// public style = 'display: block;';
function LambModalWindowComponent(document, _elRef, _renderer) {
this._elRef = _elRef;
this._renderer = _renderer;
this.backdrop = true;
this.keyboard = true;
this.dismissEvent = new EventEmitter();
this._document = document;
lambFocusTrap(this._elRef.nativeElement, this.dismissEvent);
}
Object.defineProperty(LambModalWindowComponent.prototype, "modalClass", {
get: /**
* @return {?}
*/
function () { return 'modal fade show d-block' + (this.windowClass ? ' ' + this.windowClass : ''); },
enumerable: true,
configurable: true
});
/**
* @param {?} $event
* @return {?}
*/
LambModalWindowComponent.prototype.backdropClick = /**
* @param {?} $event
* @return {?}
*/
function ($event) {
if (this.backdrop === true && this._elRef.nativeElement === $event.target) {
this.dismiss(ModalDismissReasons.BACKDROP_CLICK);
}
};
/**
* @param {?} $event
* @return {?}
*/
LambModalWindowComponent.prototype.escKey = /**
* @param {?} $event
* @return {?}
*/
function ($event) {
if (this.keyboard && !$event.defaultPrevented) {
this.dismiss(ModalDismissReasons.ESC);
}
};
/**
* @param {?} reason
* @return {?}
*/
LambModalWindowComponent.prototype.dismiss = /**
* @param {?} reason
* @return {?}
*/
function (reason) { this.dismissEvent.emit(reason); };
/**
* @return {?}
*/
LambModalWindowComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this._elWithFocus = this._document.activeElement;
this._renderer.addClass(this._document.body, 'modal-open');
};
/**
* @return {?}
*/
LambModalWindowComponent.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
if (!this._elRef.nativeElement.contains(document.activeElement)) {
this._elRef.nativeElement['focus'].apply(this._elRef.nativeElement, []);
}
};
/**
* @return {?}
*/
LambModalWindowComponent.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
/** @type {?} */
var body = this._document.body;
/** @type {?} */
var elWithFocus = this._elWithFocus;
/** @type {?} */
var elementToFocus;
if (elWithFocus && elWithFocus['focus'] && body.contains(elWithFocus)) {
elementToFocus = elWithFocus;
}
else {
elementToFocus = body;
}
elementToFocus['focus'].apply(elementToFocus, []);
this._elWithFocus = null;
this._renderer.removeClass(body, 'modal-open');
};
LambModalWindowComponent.decorators = [
{ type: Component, args: [{
selector: 'lamb-modal-window',
template: "\n <div\n [class]=\"'modal-dialog' + (size ? ' modal-' + size : '') + (centered ? ' modal-dialog-centered' : '')\"\n role=\"document\">\n <div class=\"modal-content\"><ng-content></ng-content></div>\n </div>\n ",
host: {
// '[class]': '"modal fade show" + (windowClass ? " " + windowClass : "")',
'role': 'dialog',
'tabindex': '-1',
'style': 'display: block;',
},
},] },
];
LambModalWindowComponent.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
{ type: ElementRef },
{ type: Renderer2 }
]; };
LambModalWindowComponent.propDecorators = {
backdrop: [{ type: Input }],
keyboard: [{ type: Input }],
size: [{ type: Input }],
centered: [{ type: Input }],
windowClass: [{ type: Input }],
dismissEvent: [{ type: Output }],
modalClass: [{ type: HostBinding, args: ['class',] }],
backdropClick: [{ type: HostListener, args: ['click', ['$event'],] }],
escKey: [{ type: HostListener, args: ['keyup.esc', ['$event'],] }]
};
return LambModalWindowComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* Una referencia a un modal activo (actualmente abierto). Instancias de esta clase
* puede ser inyectado en componentes pasados como contenido modal.
*/
var /**
* Una referencia a un modal activo (actualmente abierto). Instancias de esta clase
* puede ser inyectado en componentes pasados como contenido modal.
*/
LambActiveModal = /** @class */ (function () {
/**
* Una referencia a un modal activo (actualmente abierto). Instancias de esta clase
* puede ser inyectado en componentes pasados como contenido modal.
*/
function LambActiveModal() {
}
/**
* Se puede usar para cerrar un modal, pasando un resultado opcional.
* @param reason rasultado.
*/
/**
* Se puede usar para cerrar un modal, pasando un resultado opcional.
* @param {?=} result
* @return {?}
*/
LambActiveModal.prototype.close = /**
* Se puede usar para cerrar un modal, pasando un resultado opcional.
* @param {?=} result
* @return {?}
*/
function (result) { };
/**
* Se puede usar para descartar un modal, pasando un motivo opcional.
* @param reason razon por que se descarto.
*/
/**
* Se puede usar para descartar un modal, pasando un motivo opcional.
* @param {?=} reason razon por que se descarto.
* @return {?}
*/
LambActiveModal.prototype.dismiss = /**
* Se puede usar para descartar un modal, pasando un motivo opcional.
* @param {?=} reason razon por que se descarto.
* @return {?}
*/
function (reason) { };
return LambActiveModal;
}());
/**
* Una referencia a un modal recientemente abierto.
*/
var /**
* Una referencia a un modal recientemente abierto.
*/
LambModalRef = /** @class */ (function () {
function LambModalRef(windowComponentRef, contentRef, backdropComponentRef, beforeDismiss) {
var _this = this;
this.windowComponentRef = windowComponentRef;
this.contentRef = contentRef;
this.backdropComponentRef = backdropComponentRef;
this.beforeDismiss = beforeDismiss;
windowComponentRef.instance.dismissEvent.subscribe(function (reason) { _this.dismiss(reason); });
this.result = new Promise(function (resolve, reject) {
_this.resolve = resolve;
_this.reject = reject;
});
this.result.then(null, function () { });
}
Object.defineProperty(LambModalRef.prototype, "componentInstance", {
/**
* La instancia de componente utilizada como contenido modal.
* Indefinido cuando se utiliza un TemplateRef como contenido modal.
*/
get: /**
* La instancia de componente utilizada como contenido modal.
* Indefinido cuando se utiliza un TemplateRef como contenido modal.
* @return {?}
*/
function () {
if (this.contentRef.componentRef) {
return this.contentRef.componentRef.instance;
}
},
// solo es necesario para mantener la compatibilidad con TS1.8
set:
// solo es necesario para mantener la compatibilidad con TS1.8
/**
* @param {?} instance
* @return {?}
*/
function (instance) { },
enumerable: true,
configurable: true
});
/**
* Se puede usar para cerrar un modal, pasando un resultado opcional.
* @param result
*/
/**
* Se puede usar para cerrar un modal, pasando un resultado opcional.
* @param {?=} result
* @return {?}
*/
LambModalRef.prototype.close = /**
* Se puede usar para cerrar un modal, pasando un resultado opcional.
* @param {?=} result
* @return {?}
*/
function (result) {
if (this.windowComponentRef) {
this.resolve(result);
this.removeModalElements();
}
};
/**
* Se puede usar para descartar un modal, pasando un motivo opcional.
* @param reason
*/
/**
* Se puede usar para descartar un modal, pasando un motivo opcional.
* @param {?=} reason
* @return {?}
*/
LambModalRef.prototype.dismiss = /**
* Se puede usar para descartar un modal, pasando un motivo opcional.
* @param {?=} reason
* @return {?}
*/
function (reason) {
// console.log('reason');
// console.log(reason);
if (this.windowComponentRef) {
if (!this.beforeDismiss || this.beforeDismiss() !== false) {
this.reject(reason);
this.removeModalElements();
}
}
};
/**
* @return {?}
*/
LambModalRef.prototype.removeModalElements = /**
* @return {?}
*/
function () {
/** @type {?} */
var windowNativeEl = this.windowComponentRef.location.nativeElement;
windowNativeEl.parentNode.removeChild(windowNativeEl);
this.windowComponentRef.destroy();
if (this.backdropComponentRef) {
/** @type {?} */
var backdropNativeEl = this.backdropComponentRef.location.nativeElement;
backdropNativeEl.parentNode.removeChild(backdropNativeEl);
this.backdropComponentRef.destroy();
}
if (this.contentRef && this.contentRef.viewRef) {
this.contentRef.viewRef.destroy();
}
this.windowComponentRef = null;
this.backdropComponentRef = null;
this.contentRef = null;
};
return LambModalRef;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* @param {?} value
* @return {?}
*/
function isDefined(value) {
return value !== undefined && value !== null;
}
/**
* @param {?} value
* @return {?}
*/
function isString(value) {
return typeof value === 'string';
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var ContentRef = /** @class */ (function () {
function ContentRef(nodes, viewRef, componentRef) {
this.nodes = nodes;
this.viewRef = viewRef;
this.componentRef = componentRef;
}
return ContentRef;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambModalStackService = /** @class */ (function () {
function LambModalStackService(applicationRef, injector, componentFactoryResolver, document) {
this.applicationRef = applicationRef;
this.injector = injector;
this.componentFactoryResolver = componentFactoryResolver;
this._windowAttributes = ['backdrop', 'keyboard', 'centered', 'size', 'windowClass'];
this._document = document;
}
/**
* @param {?} moduleCFR
* @param {?} contentInjector
* @param {?} content
* @param {?} options
* @return {?}
*/
LambModalStackService.prototype.open = /**
* @param {?} moduleCFR
* @param {?} contentInjector
* @param {?} content
* @param {?} options
* @return {?}
*/
function (moduleCFR, contentInjector, content, options) {
/** @type {?} */
var containerEl = isDefined(options.container) ?
this._document.querySelector(options.container) : this._document.body;
if (!containerEl) {
throw new Error("El contenedor modal especificado \"" + (options.container || 'body') + "\" no fue encontrado en el DOM");
}
/** @type {?} */
var activeModal = new LambActiveModal();
/** @type {?} */
var contentRef = this.getContentRef(moduleCFR, options.injector || contentInjector, content, activeModal);
/** @type {?} */
var backdropCmptRef = options.backdrop !== false ? this.attachBackdrop(containerEl) : null;
/** @type {?} */
var windowCmptRef = this.attachWindowComponent(containerEl, contentRef);
/** @type {?} */
var lambModalRef = new LambModalRef(windowCmptRef, contentRef, backdropCmptRef, options.beforeDismiss);
activeModal.close = function (result) { lambModalRef.close(result); };
activeModal.dismiss = function (reason) { lambModalRef.dismiss(reason); };
this.applyWindowOptions(windowCmptRef.instance, options);
return lambModalRef;
};
/**
* @param {?} containerEl
* @return {?}
*/
LambModalStackService.prototype.attachBackdrop = /**
* @param {?} containerEl
* @return {?}
*/
function (containerEl) {
/** @type {?} */
var backdropFactory = this.componentFactoryResolver.resolveComponentFactory(LambModalBackdropComponent);
/** @type {?} */
var backdropCmptRef = backdropFactory.create(this.injector);
this.applicationRef.attachView(backdropCmptRef.hostView);
containerEl.appendChild(backdropCmptRef.location.nativeElement);
return backdropCmptRef;
};
/**
* @param {?} containerEl
* @param {?} contentRef
* @return {?}
*/
LambModalStackService.prototype.attachWindowComponent = /**
* @param {?} containerEl
* @param {?} contentRef
* @return {?}
*/
function (containerEl, contentRef) {
/** @type {?} */
var windowFactory = this.componentFactoryResolver.resolveComponentFactory(LambModalWindowComponent);
/** @type {?} */
var windowCmptRef = windowFactory.create(this.injector, contentRef.nodes);
this.applicationRef.attachView(windowCmptRef.hostView);
containerEl.appendChild(windowCmptRef.location.nativeElement);
return windowCmptRef;
};
/**
* @param {?} windowInstance
* @param {?} options
* @return {?}
*/
LambModalStackService.prototype.applyWindowOptions = /**
* @param {?} windowInstance
* @param {?} options
* @return {?}
*/
function (windowInstance, options) {
this._windowAttributes.forEach(function (optionName) {
if (isDefined(options[optionName])) {
windowInstance[optionName] = options[optionName];
}
});
};
/**
* @param {?} moduleCFR
* @param {?} contentInjector
* @param {?} content
* @param {?} context
* @return {?}
*/
LambModalStackService.prototype.getContentRef = /**
* @param {?} moduleCFR
* @param {?} contentInjector
* @param {?} content
* @param {?} context
* @return {?}
*/
function (moduleCFR, contentInjector, content, context) {
if (!content) {
return new ContentRef([]);
}
else if (content instanceof TemplateRef) {
return this.createFromTemplateRef(content, context);
}
else if (isString(content)) {
return this.createFromString(content);
}
else {
return this.createFromComponent(moduleCFR, contentInjector, content, context);
}
};
/**
* @param {?} content
* @param {?} context
* @return {?}
*/
LambModalStackService.prototype.createFromTemplateRef = /**
* @param {?} content
* @param {?} context
* @return {?}
*/
function (content, context) {
/** @type {?} */
var viewRef = content.createEmbeddedView(context);
this.applicationRef.attachView(viewRef);
return new ContentRef([viewRef.rootNodes], viewRef);
};
/**
* @param {?} content
* @return {?}
*/
LambModalStackService.prototype.createFromString = /**
* @param {?} content
* @return {?}
*/
function (content) {
/** @type {?} */
var component = this._document.createTextNode("" + content);
return new ContentRef([[component]]);
};
/**
* @param {?} moduleCFR
* @param {?} contentInjector
* @param {?} content
* @param {?} context
* @return {?}
*/
LambModalStackService.prototype.createFromComponent = /**
* @param {?} moduleCFR
* @param {?} contentInjector
* @param {?} content
* @param {?} context
* @return {?}
*/
function (moduleCFR, contentInjector, content, context) {
/** @type {?} */
var contentComponentFactory = moduleCFR.resolveComponentFactory(content);
/** @type {?} */
var modalContentInjector = ReflectiveInjector.resolveAndCreate([{ provide: LambActiveModal, useValue: context }], contentInjector);
/** @type {?} */
var componentRef = contentComponentFactory.create(modalContentInjector);
this.applicationRef.attachView(componentRef.hostView);
return new ContentRef([[componentRef.location.nativeElement]], componentRef.hostView, componentRef);
};
LambModalStackService.decorators = [
{ type: Injectable },
];
LambModalStackService.ctorParameters = function () { return [
{ type: ApplicationRef },
{ type: Injector },
{ type: ComponentFactoryResolver },
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
]; };
return LambModalStackService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* Un servicio para abrir ventanas modales
* Crear un modal es sencillo: crear una plantilla y pasarla como argumento para
* el método "abierto"!
*/
var LambModalService = /** @class */ (function () {
function LambModalService(moduleCFR, injector, lambModalStackService) {
this.moduleCFR = moduleCFR;
this.injector = injector;
this.lambModalStackService = lambModalStackService;
}
/**
* Abre una nueva ventana modal con el contenido especificado y usando las opciones provistas.
* El contenido puede ser proporcionado
* como un TemplateRef o un tipo de componente.
* Si pasa un tipo de componente como contenido que las instancias de aquellos
* los componentes se pueden inyectar con una instancia de la clase NgbActiveModal.
* Puedes usar métodos en
* Clase LambActiveModal para close / dismiss modales del "inside" de un componente.
* @param content
* @param options
*/
/**
* Abre una nueva ventana modal con el contenido especificado y usando las opciones provistas.
* El contenido puede ser proporcionado
* como un TemplateRef o un tipo de componente.
* Si pasa un tipo de componente como contenido que las instancias de aquellos
* los componentes se pueden inyectar con una instancia de la clase NgbActiveModal.
* Puedes usar métodos en
* Clase LambActiveModal para close / dismiss modales del "inside" de un componente.
* @param {?} content
* @param {?=} options
* @return {?}
*/
LambModalService.prototype.open = /**
* Abre una nueva ventana modal con el contenido especificado y usando las opciones provistas.
* El contenido puede ser proporcionado
* como un TemplateRef o un tipo de componente.
* Si pasa un tipo de componente como contenido que las instancias de aquellos
* los componentes se pueden inyectar con una instancia de la clase NgbActiveModal.
* Puedes usar métodos en
* Clase LambActiveModal para close / dismiss modales del "inside" de un componente.
* @param {?} content
* @param {?=} options
* @return {?}
*/
function (content, options) {
if (options === void 0) { options = {}; }
return this.lambModalStackService.open(this.moduleCFR, this.injector, content, options);
};
LambModalService.decorators = [
{ type: Injectable },
];
LambModalService.ctorParameters = function () { return [
{ type: ComponentFactoryResolver },
{ type: Injector },
{ type: LambModalStackService }
]; };
return LambModalService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambModalModule = /** @class */ (function () {
function LambModalModule() {
}
LambModalModule.decorators = [
{ type: NgModule, args: [{
imports: [],
declarations: [
LambModalBackdropComponent,
LambModalWindowComponent,
],
entryComponents: [
LambModalBackdropComponent,
LambModalWindowComponent,
],
providers: [
LambModalService,
LambModalStackService,
],
},] },
];
return LambModalModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambConfirmDialogComponent = /** @class */ (function () {
function LambConfirmDialogComponent(activeModal) {
this.activeModal = activeModal;
}
/**
* @return {?}
*/
LambConfirmDialogComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
};
/**
* @return {?}
*/
LambConfirmDialogComponent.prototype.cancel = /**
* @return {?}
*/
function () {
// this.activeModal.close(false);
this.activeModal.dismiss(false);
};
/**
* @return {?}
*/
LambConfirmDialogComponent.prototype.ok = /**
* @return {?}
*/
function () {
this.activeModal.close({ data: 'Hi' });
};
/**
* @return {?}
*/
LambConfirmDialogComponent.prototype.dismiss = /**
* @return {?}
*/
function () {
// this.activeModal.close(true);
this.activeModal.dismiss(false);
};
LambConfirmDialogComponent.decorators = [
{ type: Component, args: [{
selector: 'lamb-confirm-dialog',
template: "<div class=\"modal-header\">\n <h6 class=\"modal-title\">{{ title }}</h6>\n <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"dismiss()\">\n <span aria-hidden=\"true\">×</span>\n </button>\n</div>\n<div class=\"modal-body\">\n {{ message }}\n</div>\n<div class=\"modal-footer\">\n <button type=\"submit\" class=\"btn btn-light btn-sm\" (click)=\"cancel()\" autofocus>{{ btnCancelText }}</button>\n <button type=\"button\" class=\"btn btn-primary btn-sm\" (click)=\"ok()\" >{{ btnOkText }}</button>\n</div>",
styles: [".btn.btn-light,.btn.btn-light:active,.btn.btn-light:hover{color:#2a2a2a}"],
},] },
];
LambConfirmDialogComponent.ctorParameters = function () { return [
{ type: LambActiveModal }
]; };
LambConfirmDialogComponent.propDecorators = {
title: [{ type: Input }],
message: [{ type: Input }],
btnOkText: [{ type: Input }],
btnCancelText: [{ type: Input }]
};
return LambConfirmDialogComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/** @type {?} */
var message = {
confirmDelete: '¿Estas seguro de Eliminar este registro?',
confirmUpdate: '¿Estas seguro de Actualizar este registro?',
confirmSave: '¿Estas seguro de Guardar?',
confirmDefault: '¿Estas seguro de realizar la Acción?',
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambConfirmDialogService = /** @class */ (function () {
function LambConfirmDialogService(lambModalService) {
this.lambModalService = lambModalService;
}
/**
* Confirm
* @param options optional JSON Options
* @param action X = XXX; D = Delete; U = Update; S = Save
*/
/**
* Confirm
* @param {?=} options optional JSON Options
* @param {?=} action X = XXX; D = Delete; U = Update; S = Save
* @return {?}
*/
LambConfirmDialogService.prototype.confirm = /**
* Confirm
* @param {?=} options optional JSON Options
* @param {?=} action X = XXX; D = Delete; U = Update; S = Save
* @return {?}
*/
function (options, action) {
if (options === void 0) { options = {}; }
/** @type {?} */
var modalRef = this.lambModalService.open(LambConfirmDialogComponent, { centered: true });
// const modalRef = this.lambModalService.open(LambConfirmDialogComponent);
// const modalRef =
// this.lambModalService.open(ConfirmDialogComponent,
// { size: (options.dialogSize ? options.dialogSize : this.config.dialogSize) });
modalRef.componentInstance.title
= options.title ? options.title : this.config.title;
modalRef.componentInstance.message
= options.message ? options.message : this.getMessage(action);
modalRef.componentInstance.btnOkText
= options.btnOkText ? options.btnOkText : this.config.btnOkText;
modalRef.componentInstance.btnCancelText
= options.btnCancelText ? options.btnCancelText : this.config.btnCancelText;
return modalRef.result;
};
/**
* @param {?=} options
* @return {?}
*/
LambConfirmDialogService.prototype.confirmDelete = /**
* @param {?=} options
* @return {?}
*/
function (options) {
if (options === void 0) { options = {}; }
return this.confirm(options, 'D');
};
/**
* @param {?=} options
* @return {?}
*/
LambConfirmDialogService.prototype.confirmUpdate = /**
* @param {?=} options
* @return {?}
*/
function (options) {
if (options === void 0) { options = {}; }
return this.confirm(options, 'U');
};
/**
* @param {?=} options
* @return {?}
*/
LambConfirmDialogService.prototype.confirmSave = /**
* @param {?=} options
* @return {?}
*/
function (options) {
if (options === void 0) { options = {}; }
return this.confirm(options, 'S');
};
/**
* @param {?} action
* @return {?}
*/
LambConfirmDialogService.prototype.getMessage = /**
* @param {?} action
* @return {?}
*/
function (action) {
switch (action) {
case 'D': {
return message.confirmDelete;
}
case 'U': {
return message.confirmUpdate;
}
case 'S': {
return message.confirmSave;
}
default: {
return this.config.message;
}
}
};
Object.defineProperty(LambConfirmDialogService.prototype, "config", {
/**
* Config for default.
*/
get: /**
* Config for default.
* @return {?}
*/
function () {
return {
title: 'Confirmación',
message: message.confirmDefault,
btnOkText: 'OK',
btnCancelText: 'CANCELAR',
dialogSize: 'lg',
};
},
enumerable: true,
configurable: true
});
LambConfirmDialogService.decorators = [
{ type: Injectable },
];
LambConfirmDialogService.ctorParameters = function () { return [
{ type: LambModalService }
]; };
return LambConfirmDialogService;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambConfirmDialogModule = /** @class */ (function () {
function LambConfirmDialogModule() {
}
LambConfirmDialogModule.decorators = [
{ type: NgModule, args: [{
imports: [
LambModalModule,
],
declarations: [
LambConfirmDialogComponent,
],
providers: [
LambConfirmDialogService,
],
entryComponents: [
LambConfirmDialogComponent,
],
},] },
];
return LambConfirmDialogModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambInputIconComponent = /** @class */ (function () {
function LambInputIconComponent() {
this.justify = 'end';
}
/**
* @return {?}
*/
LambInputIconComponent.prototype.ngOnInit = /**
* @return {?}
*/
function () {
};
LambInputIconComponent.decorators = [
{ type: Component, args: [{
selector: 'lamb-input-icon',
template: "<div class=\"inner-addon {{ justify }}-addon\">\n <ng-content></ng-content>\n</div>",
styles: ["::ng-deep .inner-addon{position:relative}::ng-deep .inner-addon .fa{position:absolute;top:25%;padding-right:.5rem;padding-left:.5rem;pointer-events:none;font-size:initial}.start-addon /deep/ .fa{left:0}.start-addon /deep/ input{padding-left:30px}.end-addon /deep/ .fa{right:0}.end-addon /deep/ input{padding-right:30px}"]
},] },
];
LambInputIconComponent.ctorParameters = function () { return []; };
LambInputIconComponent.propDecorators = {
justify: [{ type: Input }]
};
return LambInputIconComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambInputIconModule = /** @class */ (function () {
function LambInputIconModule() {
}
LambInputIconModule.decorators = [
{ type: NgModule, args: [{
imports: [],
exports: [LambInputIconComponent],
declarations: [LambInputIconComponent],
providers: [],
},] },
];
return LambInputIconModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var ConfigNames = /** @class */ (function () {
function ConfigNames(buttonBack, buttonNext, buttonFinish) {
this.buttonBack = buttonBack;
this.buttonNext = buttonNext;
this.buttonFinish = buttonFinish;
}
return ConfigNames;
}());
var LambStepConfig = /** @class */ (function () {
function LambStepConfig() {
// justify: 'start' | 'center' | 'end' | 'fill' | 'justified';
// orientation: 'horizontal' | 'vertical';
// type: 'tabss' | 'pills';
this.justify = 'center';
this.orientation = 'horizontal';
// type: 'tabss' | 'pills' = 'tabss';
this.type = 'stepss';
this.configNames = new ConfigNames('Anterior', 'Siguiente', 'Finalizar');
}
LambStepConfig.decorators = [
{ type: Injectable },
];
return LambStepConfig;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
/** @type {?} */
var slideOfRight = trigger('slideOfRight', [
transition(':enter', [
style({ transform: 'translateX(100%)', opacity: 0 }),
animate('.35s', style({ transform: 'translateX(0)', 'opacity': 1 })),
]),
transition(':leave', [
style({ transform: 'translateX(0)', 'opacity': 1 }),
animate('.35s', style({ transform: 'translateX(100%)', 'opacity': 0 })),
]),
// state('next', style({ height: '0px', transform: 'scaleY(0)' /*opacity: 0*/ })),
state('next', style({ height: '*', transform: 'scaleY(1)' /*opacity: 1*/ })),
state('back', style({ height: '6px', transform: 'scaleY(0)' /*opacity: 1*/ })),
transition('* => back', [
style({ transform: 'translateX(100%)', display: 'block' }),
animate('.35s', style({ transform: 'translateX(0)', display: 'none' })),
]),
transition('* => next', [
style({ transform: 'translateX(0)', display: 'none' }),
animate('.35s', style({ transform: 'translateX(100%)', display: 'block' })),
]),
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,uselessCode} checked by tsc
*/
var LambStepTitleDirective = /** @class */ (function () {
function LambStepTitleDirective(templateRef) {
this.templateRef = templateRef;
}
LambStepTitleDirective.decorators = [
{ type: Directive, args: [{
selector: 'ng-template[lambStepTitle]',
},] },
];
LambStepTitleDirective.ctorParameters = function () { return [
{ type: TemplateRef }
]; };
return LambStepTitleDirective;
}());
var LambStepContentDirective = /** @class