UNPKG

ng-jax-shared

Version:
339 lines (329 loc) 10.8 kB
import { FormsModule } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatTooltipModule } from '@angular/material/tooltip'; import { MatDialogModule } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatIconModule } from '@angular/material/icon'; import { MatSelectModule } from '@angular/material/select'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA, MatButtonModule, MatCheckboxModule, MatInputModule } from '@angular/material'; import { RouterModule, Router } from '@angular/router'; import { Subject } from 'rxjs'; import { Component, Inject, Injectable, NgModule, Pipe, defineInjectable } from '@angular/core'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ var AlertComponent = /** @class */ (function () { function AlertComponent(dialog) { this.dialog = dialog; } /** * @return {?} */ AlertComponent.prototype.ngOnInit = /** * @return {?} */ function () { }; /** * @param {?} asMsg * @param {?=} asType * @return {?} */ AlertComponent.prototype.open = /** * @param {?} asMsg * @param {?=} asType * @return {?} */ function (asMsg, asType) { if (asType === void 0) { asType = 'info'; } /** @type {?} */ var lsT = asType; /** @type {?} */ var lsIcon = (lsT === 'info') ? 'info' : (lsT === 'ok') ? 'done' : (lsT === 'error') ? 'cancel' : (lsT === 'warning') ? 'warning' : ''; /** @type {?} */ var dialogRef = this.dialog.open(DialogContentComponent, { width: '300px', // panelClass: 'lllxxx', data: { msg: asMsg, type: asType, icon: lsIcon } }); return dialogRef; }; /** * @return {?} */ AlertComponent.prototype.openSpinner = /** * @return {?} */ function () { /** @type {?} */ var dialogRef = this.dialog.open(DialogSpinnerComponent, { disableClose: true, panelClass: 'jax-spinner' }); return dialogRef; }; /** * @return {?} */ AlertComponent.prototype.closeSpinner = /** * @return {?} */ function () { try { this.dialog.closeAll(); } catch (error) { } }; AlertComponent.decorators = [ { type: Component, args: [{ selector: 'jax-alert', template: "<p>\n alert works!\n</p>\n", styles: [""] }] } ]; /** @nocollapse */ AlertComponent.ctorParameters = function () { return [ { type: MatDialog } ]; }; return AlertComponent; }()); var DialogContentComponent = /** @class */ (function () { function DialogContentComponent(dialogRef, data) { this.dialogRef = dialogRef; this.data = data; if (!this.data) { this.data = { msg: '', type: '', icon: '' }; } } DialogContentComponent.decorators = [ { type: Component, args: [{ template: "<div class=\"jaxContainer\">\r\n <div *ngIf=\" data.icon !== '' \" [ngClass]=\"['jaxIcon', data.type]\">\r\n <mat-icon>{{ data.icon }}</mat-icon>\r\n </div>\r\n <div>{{ data.msg }}</div>\r\n</div>", styles: [".alertMsg{padding:24px}.jaxContainer{display:flex;align-items:center}.jaxContainer .jaxIcon{margin-right:12px}.jaxContainer .jaxIcon.info{color:#00f}.jaxContainer .jaxIcon.error{color:red}.jaxContainer .jaxIcon.ok{color:green}.jaxContainer .jaxIcon.warning{color:#f0b13c}"] }] } ]; /** @nocollapse */ DialogContentComponent.ctorParameters = function () { return [ { type: MatDialogRef }, { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] } ]; }; return DialogContentComponent; }()); var DialogSpinnerComponent = /** @class */ (function () { function DialogSpinnerComponent() { } DialogSpinnerComponent.decorators = [ { type: Component, args: [{ template: "<mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>", styles: [""] }] } ]; /** @nocollapse */ DialogSpinnerComponent.ctorParameters = function () { return []; }; return DialogSpinnerComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ /** @type {?} */ var appRoutes = [ { path: 'dialog-content', component: DialogContentComponent }, { path: 'dialog-spinner', component: DialogSpinnerComponent }, ]; /** @type {?} */ var appRoutingProviders = []; /** @type {?} */ var routing = RouterModule.forRoot(appRoutes); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ var MessageService = /** @class */ (function () { function MessageService() { this.subject = new Subject(); this.mbIsLogged = false; } /** * @param {?} asMsgName * @param {?} aoParams * @return {?} */ MessageService.prototype.sendMessage = /** * @param {?} asMsgName * @param {?} aoParams * @return {?} */ function (asMsgName, aoParams) { this.subject.next({ name: asMsgName, params: aoParams }); }; /** * @return {?} */ MessageService.prototype.clearMessage = /** * @return {?} */ function () { this.subject.next(); }; /** * @return {?} */ MessageService.prototype.getMessage = /** * @return {?} */ function () { return this.subject.asObservable(); }; /** * @return {?} */ MessageService.prototype.getIslogged = /** * @return {?} */ function () { return this.mbIsLogged; }; /** * @param {?} abLogged * @return {?} */ MessageService.prototype.setIslogged = /** * @param {?} abLogged * @return {?} */ function (abLogged) { this.mbIsLogged = abLogged; }; MessageService.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @nocollapse */ MessageService.ngInjectableDef = defineInjectable({ factory: function MessageService_Factory() { return new MessageService(); }, token: MessageService, providedIn: "root" }); return MessageService; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ var WinBaseComponent = /** @class */ (function () { function WinBaseComponent(router, messageService) { this.router = router; this.messageService = messageService; this.mbValidateUser = false; this.msUrlWelcome = ''; this.mbLog = false; } /** * @return {?} */ WinBaseComponent.prototype.ngOnInit = /** * @return {?} */ function () { this.fnValidateUser(); this.fnPostInit(); }; /** * @return {?} */ WinBaseComponent.prototype.fnValidateUser = /** * @return {?} */ function () { // Se requiere usuario activo. if (this.mbValidateUser && !this.messageService.getIslogged() && this.msUrlWelcome !== '') { console.log('Navega a:', this.msUrlWelcome); this.router.navigate([this.msUrlWelcome]); } }; /** * @return {?} */ WinBaseComponent.prototype.fnPostInit = /** * @return {?} */ function () { }; WinBaseComponent.decorators = [ { type: Component, args: [{ selector: 'jax-win-base', template: "<p>\n win-base works!\n</p>\n", styles: [""] }] } ]; /** @nocollapse */ WinBaseComponent.ctorParameters = function () { return [ { type: Router }, { type: MessageService } ]; }; return WinBaseComponent; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ var ReverseStringPipe = /** @class */ (function () { function ReverseStringPipe() { } /** * @param {?} value * @return {?} */ ReverseStringPipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var newStr = ''; for (var i = value.length - 1; i >= 0; i--) { newStr += value.charAt(i); } return newStr; }; ReverseStringPipe.decorators = [ { type: Pipe, args: [{ name: 'reverseString' },] } ]; return ReverseStringPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ var NgJaxSharedModule = /** @class */ (function () { function NgJaxSharedModule() { } NgJaxSharedModule.decorators = [ { type: NgModule, args: [{ imports: [ BrowserAnimationsModule, FormsModule, routing, MatButtonModule, MatCheckboxModule, MatTooltipModule, MatDialogModule, MatFormFieldModule, MatInputModule, MatIconModule, MatSelectModule, MatProgressSpinnerModule ], declarations: [ AlertComponent, DialogContentComponent, DialogSpinnerComponent, WinBaseComponent, ReverseStringPipe ], exports: [ AlertComponent, WinBaseComponent, ReverseStringPipe ], providers: [appRoutingProviders, MessageService] },] } ]; return NgJaxSharedModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ export { AlertComponent, NgJaxSharedModule, WinBaseComponent, MessageService, ReverseStringPipe, DialogContentComponent as ɵa, DialogSpinnerComponent as ɵb, appRoutingProviders as ɵc, routing as ɵd }; //# sourceMappingURL=ng-jax-shared.js.map