ng-jax-shared
Version:
Librería de objetos genéricos.
352 lines (340 loc) • 13.5 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/forms'), require('@angular/platform-browser/animations'), require('@angular/material/tooltip'), require('@angular/material/dialog'), require('@angular/material/form-field'), require('@angular/material/icon'), require('@angular/material/select'), require('@angular/material/progress-spinner'), require('@angular/material'), require('@angular/router'), require('rxjs'), require('@angular/core')) :
typeof define === 'function' && define.amd ? define('ng-jax-shared', ['exports', '@angular/forms', '@angular/platform-browser/animations', '@angular/material/tooltip', '@angular/material/dialog', '@angular/material/form-field', '@angular/material/icon', '@angular/material/select', '@angular/material/progress-spinner', '@angular/material', '@angular/router', 'rxjs', '@angular/core'], factory) :
(factory((global['ng-jax-shared'] = {}),global.ng.forms,global.ng.platformBrowser.animations,global.ng.material.tooltip,global.ng.material.dialog,global.ng.material['form-field'],global.ng.material.icon,global.ng.material.select,global.ng.material['progress-spinner'],global.ng.material,global.ng.router,global.rxjs,global.ng.core));
}(this, (function (exports,forms,animations,tooltip,dialog,formField,icon,select,progressSpinner,material,router,rxjs,i0) { 'use strict';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var AlertComponent = /** @class */ (function () {
function AlertComponent(dialog$$1) {
this.dialog = dialog$$1;
}
/**
* @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: i0.Component, args: [{
selector: 'jax-alert',
template: "<p>\n alert works!\n</p>\n",
styles: [""]
}] }
];
/** @nocollapse */
AlertComponent.ctorParameters = function () {
return [
{ type: material.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: i0.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: material.MatDialogRef },
{ type: undefined, decorators: [{ type: i0.Inject, args: [material.MAT_DIALOG_DATA,] }] }
];
};
return DialogContentComponent;
}());
var DialogSpinnerComponent = /** @class */ (function () {
function DialogSpinnerComponent() {
}
DialogSpinnerComponent.decorators = [
{ type: i0.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 = router.RouterModule.forRoot(appRoutes);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,uselessCode} checked by tsc
*/
var MessageService = /** @class */ (function () {
function MessageService() {
this.subject = new rxjs.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: i0.Injectable, args: [{ providedIn: 'root' },] }
];
/** @nocollapse */ MessageService.ngInjectableDef = i0.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$$1, messageService) {
this.router = router$$1;
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: i0.Component, args: [{
selector: 'jax-win-base',
template: "<p>\n win-base works!\n</p>\n",
styles: [""]
}] }
];
/** @nocollapse */
WinBaseComponent.ctorParameters = function () {
return [
{ type: router.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: i0.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: i0.NgModule, args: [{
imports: [
animations.BrowserAnimationsModule, forms.FormsModule,
routing,
material.MatButtonModule, material.MatCheckboxModule, tooltip.MatTooltipModule, dialog.MatDialogModule, formField.MatFormFieldModule, material.MatInputModule, icon.MatIconModule,
select.MatSelectModule, progressSpinner.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
*/
exports.AlertComponent = AlertComponent;
exports.NgJaxSharedModule = NgJaxSharedModule;
exports.WinBaseComponent = WinBaseComponent;
exports.MessageService = MessageService;
exports.ReverseStringPipe = ReverseStringPipe;
exports.ɵa = DialogContentComponent;
exports.ɵb = DialogSpinnerComponent;
exports.ɵc = appRoutingProviders;
exports.ɵd = routing;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=ng-jax-shared.umd.js.map