UNPKG

ng-jax-shared

Version:
293 lines (283 loc) 8.89 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 */ class AlertComponent { /** * @param {?} dialog */ constructor(dialog) { this.dialog = dialog; } /** * @return {?} */ ngOnInit() { } /** * @param {?} asMsg * @param {?=} asType * @return {?} */ open(asMsg, asType = 'info') { /** @type {?} */ const lsT = asType; /** @type {?} */ const lsIcon = (lsT === 'info') ? 'info' : (lsT === 'ok') ? 'done' : (lsT === 'error') ? 'cancel' : (lsT === 'warning') ? 'warning' : ''; /** @type {?} */ const dialogRef = this.dialog.open(DialogContentComponent, { width: '300px', // panelClass: 'lllxxx', data: { msg: asMsg, type: asType, icon: lsIcon } }); return dialogRef; } /** * @return {?} */ openSpinner() { /** @type {?} */ const dialogRef = this.dialog.open(DialogSpinnerComponent, { disableClose: true, panelClass: 'jax-spinner' }); return dialogRef; } /** * @return {?} */ closeSpinner() { 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 = () => [ { type: MatDialog } ]; class DialogContentComponent { /** * @param {?} dialogRef * @param {?} data */ constructor(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 = () => [ { type: MatDialogRef }, { type: undefined, decorators: [{ type: Inject, args: [MAT_DIALOG_DATA,] }] } ]; class DialogSpinnerComponent { constructor() { } } DialogSpinnerComponent.decorators = [ { type: Component, args: [{ template: "<mat-progress-spinner color=\"primary\" mode=\"indeterminate\"></mat-progress-spinner>", styles: [""] }] } ]; /** @nocollapse */ DialogSpinnerComponent.ctorParameters = () => []; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ /** @type {?} */ const appRoutes = [ { path: 'dialog-content', component: DialogContentComponent }, { path: 'dialog-spinner', component: DialogSpinnerComponent }, ]; /** @type {?} */ const appRoutingProviders = []; /** @type {?} */ const routing = RouterModule.forRoot(appRoutes); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ class MessageService { constructor() { this.subject = new Subject(); this.mbIsLogged = false; } /** * @param {?} asMsgName * @param {?} aoParams * @return {?} */ sendMessage(asMsgName, aoParams) { this.subject.next({ name: asMsgName, params: aoParams }); } /** * @return {?} */ clearMessage() { this.subject.next(); } /** * @return {?} */ getMessage() { return this.subject.asObservable(); } /** * @return {?} */ getIslogged() { return this.mbIsLogged; } /** * @param {?} abLogged * @return {?} */ setIslogged(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" }); /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ class WinBaseComponent { /** * @param {?} router * @param {?} messageService */ constructor(router, messageService) { this.router = router; this.messageService = messageService; this.mbValidateUser = false; this.msUrlWelcome = ''; this.mbLog = false; } /** * @return {?} */ ngOnInit() { this.fnValidateUser(); this.fnPostInit(); } /** * @return {?} */ fnValidateUser() { // Se requiere usuario activo. if (this.mbValidateUser && !this.messageService.getIslogged() && this.msUrlWelcome !== '') { console.log('Navega a:', this.msUrlWelcome); this.router.navigate([this.msUrlWelcome]); } } /** * @return {?} */ fnPostInit() { } } WinBaseComponent.decorators = [ { type: Component, args: [{ selector: 'jax-win-base', template: "<p>\n win-base works!\n</p>\n", styles: [""] }] } ]; /** @nocollapse */ WinBaseComponent.ctorParameters = () => [ { type: Router }, { type: MessageService } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ class ReverseStringPipe { /** * @param {?} value * @return {?} */ transform(value) { /** @type {?} */ let newStr = ''; for (let i = value.length - 1; i >= 0; i--) { newStr += value.charAt(i); } return newStr; } } ReverseStringPipe.decorators = [ { type: Pipe, args: [{ name: 'reverseString' },] } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,uselessCode} checked by tsc */ class 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] },] } ]; /** * @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