wlpacks-ontimize-web-ngx
Version:
Ontimize Web framework using Angular 8
1,151 lines (1,137 loc) • 4.91 MB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/router'), require('@angular/material'), require('@angular/common/http'), require('rxjs/operators'), require('@angular/forms'), require('moment'), require('@ngx-translate/core'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/cdk/overlay'), require('@angular/cdk/scrolling'), require('@angular/material-moment-adapter'), require('@angular/flex-layout'), require('@angular/cdk/portal'), require('@angular/cdk/collections'), require('@angular/cdk/keycodes'), require('@angular/cdk/layout'), require('ngx-material-timepicker'), require('@angular/animations'), require('@angular/cdk/table'), require('@angular/cdk/drag-drop'), require('@angular/cdk/observers'), require('reflect-metadata'), require('@ngx-translate/http-loader'), require('@angular/platform-browser/animations')) :
typeof define === 'function' && define.amd ? define('wlpacks-ontimize-web-ngx', ['exports', '@angular/core', 'rxjs', '@angular/router', '@angular/material', '@angular/common/http', 'rxjs/operators', '@angular/forms', 'moment', '@ngx-translate/core', '@angular/common', '@angular/platform-browser', '@angular/cdk/overlay', '@angular/cdk/scrolling', '@angular/material-moment-adapter', '@angular/flex-layout', '@angular/cdk/portal', '@angular/cdk/collections', '@angular/cdk/keycodes', '@angular/cdk/layout', 'ngx-material-timepicker', '@angular/animations', '@angular/cdk/table', '@angular/cdk/drag-drop', '@angular/cdk/observers', 'reflect-metadata', '@ngx-translate/http-loader', '@angular/platform-browser/animations'], factory) :
(factory((global['wlpacks-ontimize-web-ngx'] = {}),global.ng.core,global.rxjs,global.ng.router,global.ng.material,global.ng.common.http,global.rxjs.operators,global.ng.forms,global.moment,global['@ngx-translate/core'],global.ng.common,global.ng.platformBrowser,global.ng.cdk.overlay,global.ng.cdk.scrolling,global.ng['material-moment-adapter'],global.ng['flex-layout'],global.ng.cdk.portal,global.ng.cdk.collections,global.ng.cdk.keycodes,global.ng.cdk.layout,global['ngx-material-timepicker'],global.ng.animations,global.ng.cdk.table,global.ng.cdk['drag-drop'],global.ng.cdk.observers,null,global['@ngx-translate/http-loader'],global.ng.platformBrowser.animations));
}(this, (function (exports,i0,rxjs,router,material,http,operators,forms,moment,core,common,platformBrowser,i1,scrolling,materialMomentAdapter,flexLayout,portal,collections,keycodes,layout,ngxMaterialTimepicker,animations,table,dragDrop,observers,reflectMetadata,httpLoader,animations$1) { 'use strict';
var moment__default = 'default' in moment ? moment['default'] : moment;
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b)
if (b.hasOwnProperty(p))
d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
return Reflect.metadata(metadataKey, metadataValue);
}
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m)
return m.call(o);
return {
next: function () {
if (o && i >= o.length)
o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m)
return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
ar.push(r.value);
}
catch (error) {
e = { error: error };
}
finally {
try {
if (r && !r.done && (m = i["return"]))
m.call(i);
}
finally {
if (e)
throw e.error;
}
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
var Base64 = (function () {
function Base64() {
}
Base64.decode = function (s) {
var pads = 0, i, b10, imax = s.length, x = [];
s = String(s);
if (imax === 0) {
return s;
}
if (s.charAt(imax - 1) === this.PADCHAR) {
pads = 1;
if (s.charAt(imax - 2) === this.PADCHAR) {
pads = 2;
}
imax -= 4;
}
for (i = 0; i < imax; i += 4) {
b10 = (this.getByte64(s, i) << 18) | (this.getByte64(s, i + 1) << 12) | (this.getByte64(s, i + 2) << 6) | this.getByte64(s, i + 3);
x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 255, b10 & 255));
}
switch (pads) {
case 1:
b10 = (this.getByte64(s, i) << 18) | (this.getByte64(s, i + 1) << 12) | (this.getByte64(s, i + 2) << 6);
x.push(String.fromCharCode(b10 >> 16, (b10 >> 8) & 255));
break;
case 2:
b10 = (this.getByte64(s, i) << 18) | (this.getByte64(s, i + 1) << 12);
x.push(String.fromCharCode(b10 >> 16));
break;
}
return x.join('');
};
Base64.encode = function (s) {
s = String(s);
var i, b10, x = [], imax = s.length - s.length % 3;
if (s.length === 0) {
return s;
}
for (i = 0; i < imax; i += 3) {
b10 = (this.getByte(s, i) << 16) | (this.getByte(s, i + 1) << 8) | this.getByte(s, i + 2);
x.push(this.ALPHA.charAt(b10 >> 18));
x.push(this.ALPHA.charAt((b10 >> 12) & 63));
x.push(this.ALPHA.charAt((b10 >> 6) & 63));
x.push(this.ALPHA.charAt(b10 & 63));
}
switch (s.length - imax) {
case 1:
b10 = this.getByte(s, i) << 16;
x.push(this.ALPHA.charAt(b10 >> 18) + this.ALPHA.charAt((b10 >> 12) & 63) + this.PADCHAR + this.PADCHAR);
break;
case 2:
b10 = (this.getByte(s, i) << 16) | (this.getByte(s, i + 1) << 8);
x.push(this.ALPHA.charAt(b10 >> 18) + this.ALPHA.charAt((b10 >> 12) & 63) + this.ALPHA.charAt((b10 >> 6) & 63) + this.PADCHAR);
break;
}
return x.join('');
};
Base64.getByte = function (s, i) {
var x = s.charCodeAt(i);
return x;
};
Base64.getByte64 = function (s, i) {
var idx = this.ALPHA.indexOf(s.charAt(i));
return idx;
};
Base64.PADCHAR = '=';
Base64.ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
return Base64;
}());
var Codes = (function () {
function Codes() {
}
Codes.isDoubleClickMode = function (value) {
return Codes.DETAIL_MODE_DBLCLICK_VALUES.indexOf(value) !== -1;
};
Codes.isValidRowHeight = function (value) {
return Codes.AVAILABLE_ROW_HEIGHTS_VALUES.indexOf(value) !== -1;
};
Codes.getIsDetailObject = function () {
var res = {};
res[Codes.IS_DETAIL] = 'true';
return res;
};
Codes.formatString = function (format) {
return (format === Codes.TWENTY_FOUR_HOUR_FORMAT ? Codes.HourFormat.TWENTY_FOUR : Codes.HourFormat.TWELVE);
};
Codes.isHourInputAllowed = function (e) {
if ([46, 8, 9, 27, 13].some(function (n) { return n === e.keyCode; }) ||
(e.key === ':') ||
(e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
(e.keyCode === 67 && (e.ctrlKey === true || e.metaKey === true)) ||
(e.keyCode === 88 && (e.ctrlKey === true || e.metaKey === true)) ||
(e.keyCode >= 35 && e.keyCode <= 40)) {
return true;
}
return !((e.keyCode < 48 || e.keyCode > 57) && (e.keyCode < 96 || e.keyCode > 105));
};
Codes.PAGINATED_QUERY_METHOD = 'advancedQuery';
Codes.DELETE_METHOD = 'delete';
Codes.INSERT_METHOD = 'insert';
Codes.UPDATE_METHOD = 'update';
Codes.QUERY_METHOD = 'query';
Codes.DEFAULT_QUERY_ROWS = 10;
Codes.DETAIL_ICON = 'chevron_right';
Codes.EDIT_ICON = 'mode_edit';
Codes.DEFAULT_ROW_HEIGHT = 'medium';
Codes.AVAILABLE_ROW_HEIGHTS_VALUES = ['small', 'medium', 'large'];
Codes.DETAIL_MODE_NONE = 'none';
Codes.DETAIL_MODE_CLICK = 'click';
Codes.DETAIL_MODE_DBLCLICK_VALUES = ['dblclick', 'doubleclick'];
Codes.EDITION_MODE_NONE = 'none';
Codes.EDITION_MODE_CLICK = 'click';
Codes.EDITION_MODE_DBLCLICK_VALUES = ['dblclick', 'doubleclick'];
Codes.SELECTION_MODE_NONE = 'none';
Codes.SELECTION_MODE_SINGLE = 'single';
Codes.SELECTION_MODE_MULTIPLE = 'multiple';
Codes.EXPORT_MODE_VISIBLE = 'visible';
Codes.EXPORT_MODE_LOCAL = 'local';
Codes.EXPORT_MODE_ALL = 'all';
Codes.HYPHEN_SEPARATOR = '-';
Codes.SPACE_SEPARATOR = ' ';
Codes.COLUMNS_ALIAS_SEPARATOR = ':';
Codes.ARRAY_INPUT_SEPARATOR = ';';
Codes.TYPE_SEPARATOR = ':';
Codes.VALUES_SEPARATOR = '=';
Codes.ASC_SORT = 'asc';
Codes.DESC_SORT = 'desc';
Codes.TYPE_INT = 'int';
Codes.ROUTE_SEPARATOR = '/';
Codes.ROUTE_VARIABLE_CHAR = ':';
Codes.PARENT_KEYS_KEY = 'pk';
Codes.QUERY_PARAMS = 'queryParams';
Codes.IS_DETAIL = 'isdetail';
Codes.LANGUAGE_KEY = 'lang';
Codes.SESSION_KEY = 'session';
Codes.SESSION_EXPIRED_KEY = 'session-expired';
Codes.LOGIN_ROUTE = '/login';
Codes.FORBIDDEN_ROUTE = '403';
Codes.DEFAULT_EDIT_ROUTE = 'edit';
Codes.DEFAULT_DETAIL_ROUTE = undefined;
Codes.DEFAULT_INSERT_ROUTE = 'new';
Codes.IGNORE_CAN_DEACTIVATE = 'ignore_can_deactivate';
Codes.ONTIMIZE_SUCCESSFUL_CODE = 0;
Codes.ONTIMIZE_FAILED_CODE = 1;
Codes.ONTIMIZE_UNAUTHORIZED_CODE = 3;
Codes.ICON_POSITION_LEFT = 'left';
Codes.ICON_POSITION_RIGHT = 'right';
Codes.COLUMN_TITLE_ALIGN_START = 'start';
Codes.COLUMN_TITLE_ALIGN_CENTER = 'center';
Codes.COLUMN_TITLE_ALIGN_END = 'end';
Codes.COLUMN_TITLE_ALIGN_AUTO = 'auto';
Codes.AVAILABLE_COLUMN_TITLE_ALIGNS = [Codes.COLUMN_TITLE_ALIGN_START, Codes.COLUMN_TITLE_ALIGN_CENTER, Codes.COLUMN_TITLE_ALIGN_END, Codes.COLUMN_TITLE_ALIGN_AUTO];
Codes.O_MAT_ERROR_STANDARD = 'standard';
Codes.O_MAT_ERROR_LITE = 'lite';
Codes.O_INPUTS_OPTIONS_COLOR_ACCENT = 'accent';
Codes.HourFormat = {
TWELVE: 'hh:mm a',
TWENTY_FOUR: 'HH:mm a',
};
Codes.CLOSE_DETAIL_ACTION = 'CLOSE';
Codes.BACK_ACTION = 'BACK';
Codes.RELOAD_ACTION = 'RELOAD';
Codes.GO_EDIT_ACTION = 'GO_EDIT';
Codes.EDIT_ACTION = 'EDIT';
Codes.INSERT_ACTION = 'INSERT';
Codes.GO_INSERT_ACTION = 'GO_INSERT';
Codes.DELETE_ACTION = 'DELETE';
Codes.UNDO_LAST_CHANGE_ACTION = 'UNDO_LAST_CHANGE';
Codes.DEFAULT_COLUMN_MIN_WIDTH = 80;
Codes.NAME_COLUMN_SELECT = 'select';
Codes.NAME_COLUMN_EXPANDABLE = 'expandable';
Codes.SUFFIX_COLUMN_INSERTABLE = '_insertable';
Codes.LIMIT_SCROLLVIRTUAL = 50;
Codes.TWENTY_FOUR_HOUR_FORMAT = 24;
Codes.TWELVE_FOUR_HOUR_FORMAT = 12;
Codes.OAppLayoutModes = ['mobile', 'desktop'];
Codes.OSidenavModes = ['over', 'push', 'side'];
Codes.OAppLayoutMode = ['mobile', 'desktop'];
Codes.OSidenavMode = ['over', 'push', 'side'];
Codes.APP_LAYOUT_MODE_DESKTOP = 'desktop';
Codes.APP_LAYOUT_MODE_MOBILE = 'mobile';
return Codes;
}());
var Util = (function () {
function Util() {
}
Util.isObject = function (val) {
var valType = typeof val;
return valType === 'object';
};
Util.isArray = function (val) {
return val instanceof Array;
};
Util.parseBoolean = function (value, defaultValue) {
if ((typeof value === 'string') && (value.toUpperCase() === 'TRUE' || value.toUpperCase() === 'YES')) {
return true;
}
else if ((typeof value === 'string') && (value.toUpperCase() === 'FALSE' || value.toUpperCase() === 'NO')) {
return false;
}
else if (Util.isDefined(defaultValue)) {
return defaultValue;
}
return false;
};
Util.parseArray = function (value, excludeRepeated) {
if (excludeRepeated === void 0) {
excludeRepeated = false;
}
var result = [];
if (value) {
result = value.split(Codes.ARRAY_INPUT_SEPARATOR);
}
if (excludeRepeated && result.length > 0) {
result = Array.from(new Set(result));
}
return result;
};
Util.parseParentKeysEquivalences = function (pKeysArray, separator) {
if (separator === void 0) {
separator = ':';
}
var equivalences = {};
if (pKeysArray && pKeysArray.length > 0) {
pKeysArray.forEach(function (item) {
var aux = item.split(separator);
if (aux && aux.length === 2) {
if (/.+\[.+\]/.test(aux[1])) {
var equivKey = aux[1].substring(0, aux[1].indexOf('['));
var equivValue = aux[1].substring(aux[1].indexOf('[') + 1, aux[1].indexOf(']'));
var equiv = {};
equiv[equivKey] = equivValue;
equivalences[aux[0]] = equiv;
}
else {
equivalences[aux[0]] = aux[1];
}
}
else if (aux && aux.length === 1) {
equivalences[item] = item;
}
});
}
return equivalences;
};
Util.encodeParentKeys = function (parentKeys) {
var encoded = '';
if (parentKeys) {
encoded = Base64.encode(JSON.stringify(parentKeys));
}
return encoded;
};
Util.decodeParentKeys = function (parentKeys) {
var decoded = {};
if (parentKeys && parentKeys.length > 0) {
var d = Base64.decode(parentKeys);
decoded = JSON.parse(d);
}
return decoded;
};
Util.isArrayEmpty = function (array) {
if (array && array.length === 0) {
return true;
}
return false;
};
Util.isDataService = function (arg) {
if (arg === undefined || arg === null) {
return false;
}
return (arg.getDefaultServiceConfiguration !== undefined &&
arg.configureService !== undefined);
};
Util.isPermissionsService = function (arg) {
if (arg === undefined || arg === null) {
return false;
}
return (arg.loadPermissions !== undefined);
};
Util.isFormDataComponent = function (arg) {
if (arg === undefined || arg === null) {
return false;
}
return (arg.isAutomaticBinding !== undefined);
};
Util.isEquivalent = function (a, b) {
var aProps = Object.getOwnPropertyNames(a);
var bProps = Object.getOwnPropertyNames(b);
if (aProps.length !== bProps.length) {
return false;
}
for (var i = 0; i < aProps.length; i++) {
var propName = aProps[i];
var bValue = b[propName];
if (typeof a[propName] === 'number') {
var intB = parseInt(bValue, 10);
bValue = isNaN(intB) ? bValue : intB;
}
if (a[propName] !== bValue) {
return false;
}
}
return true;
};
Util.equals = function (o1, o2) {
if (o1 === o2) {
return true;
}
if (o1 === null || o2 === null) {
return false;
}
if (o1 !== o1 && o2 !== o2) {
return true;
}
var t1 = typeof o1;
var t2 = typeof o2;
var length;
var key;
var keySet;
if (t1 === t2 && t1 === 'object') {
if (Array.isArray(o1)) {
if (!Array.isArray(o2)) {
return false;
}
length = o1.length;
if (length === o2.length) {
for (key = 0; key < length; key++) {
if (!Util.equals(o1[key], o2[key])) {
return false;
}
}
return true;
}
}
else {
if (Array.isArray(o2)) {
return false;
}
keySet = Object.create(null);
for (key in o1) {
if (!Util.equals(o1[key], o2[key])) {
return false;
}
keySet[key] = true;
}
for (key in o2) {
if (!(key in keySet) && typeof o2[key] !== 'undefined') {
return false;
}
}
return true;
}
}
return false;
};
Util.isDefined = function (value) {
return typeof value !== 'undefined' && value !== null;
};
Util.normalizeString = function (value, toLowerCase) {
if (toLowerCase === void 0) {
toLowerCase = true;
}
if (value && value.length) {
var result = value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
if (toLowerCase) {
result = result.toLowerCase();
}
return result;
}
return '';
};
Util.flatten = function (array) {
return [].concat.apply([], __spread(array));
};
Util.getValuesFromObject = function (obj) {
if (obj === void 0) {
obj = {};
}
var array = [];
Object.keys(obj).forEach(function (key) {
if (typeof obj[key] === 'object') {
array.push(Util.getValuesFromObject(obj[key]));
}
array.push(obj[key]);
});
return Util.flatten(array);
};
Util.parseIconPosition = function (value, defaultValue) {
var result = defaultValue || Codes.ICON_POSITION_LEFT;
var availablePositions = [Codes.ICON_POSITION_LEFT, Codes.ICON_POSITION_RIGHT];
if (value && value.length) {
result = value.toLowerCase();
}
if (availablePositions.indexOf(result) === -1) {
result = defaultValue || Codes.ICON_POSITION_LEFT;
}
return result;
};
Util.copyToClipboard = function (data) {
document.addEventListener('copy', function (e) {
e.clipboardData.setData('text/plain', data);
e.preventDefault();
document.removeEventListener('copy', null);
});
document.execCommand('copy');
};
Util.checkPixelsValueString = function (value) {
return typeof value === 'string' ? value.toLowerCase().endsWith('px') : false;
};
Util.extractPixelsValue = function (value, defaultValue) {
var result = typeof value === 'number' ? value : undefined;
if (Util.checkPixelsValueString(value)) {
var parsed = parseFloat(value.substr(0, value.length - 'px'.length));
result = isNaN(parsed) ? defaultValue : parsed;
}
return Util.isDefined(result) ? result : defaultValue;
};
Util.parseOInputsOptions = function (elRef, oInputsOptions) {
if (oInputsOptions.iconColor === Codes.O_INPUTS_OPTIONS_COLOR_ACCENT) {
var matFormFieldEL = elRef.nativeElement.getElementsByTagName('mat-form-field')[0];
if (Util.isDefined(matFormFieldEL)) {
matFormFieldEL.classList.add('accent');
}
}
};
Util.escapeSpecialCharacter = function (S) {
var e_1, _a;
var str = String(S);
var cpList = Array.from(str[Symbol.iterator]());
var cuList = [];
try {
for (var cpList_1 = __values(cpList), cpList_1_1 = cpList_1.next(); !cpList_1_1.done; cpList_1_1 = cpList_1.next()) {
var c = cpList_1_1.value;
if ('^$\\.*+?()[]{}|'.indexOf(c) !== -1) {
cuList.push('\\');
}
cuList.push(c);
}
}
catch (e_1_1) {
e_1 = { error: e_1_1 };
}
finally {
try {
if (cpList_1_1 && !cpList_1_1.done && (_a = cpList_1.return))
_a.call(cpList_1);
}
finally {
if (e_1)
throw e_1.error;
}
}
var L = cuList.join('');
return L;
};
Util.differenceArrays = function (array1, array2) {
var _this = this;
var difference = array1.filter(function (obj) {
return !array2.some(function (obj2) {
return _this.equals(obj, obj2);
});
});
return difference;
};
Util.convertToODateValueType = function (val) {
var result = 'timestamp';
var lowerVal = (val || '').toLowerCase();
if (lowerVal === 'string' || lowerVal === 'date' || lowerVal === 'timestamp' || lowerVal === 'iso-8601') {
result = lowerVal;
}
return result;
};
Util.uniqueBy = function (a, key) {
var seen = {};
return a.filter(function (item) {
var k = key(item);
return seen.hasOwnProperty(k) ? false : (seen[k] = true);
});
};
Util.compare = function (a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
};
return Util;
}());
var DEFAULT_LOCAL_STORAGE_KEY = undefined;
var DEFAULT_CONFIG = {
uuid: DEFAULT_LOCAL_STORAGE_KEY,
title: 'Ontimize Web App'
};
var O_INPUTS_OPTIONS = new i0.InjectionToken('o-inputs-options');
var APP_CONFIG = new i0.InjectionToken('app.config');
var AppConfig = (function () {
function AppConfig(config) {
this._config = (config && Util.isObject(config) && !Array.isArray(config)) ? config : {};
}
AppConfig.prototype.getConfiguration = function () {
return Object.assign(DEFAULT_CONFIG, this._config);
};
AppConfig.prototype.getServiceConfiguration = function () {
return this._config.servicesConfiguration || {};
};
AppConfig.prototype.getMenuConfiguration = function () {
return this._config.appMenuConfiguration || [];
};
AppConfig.prototype.useRemoteBundle = function () {
return Util.isDefined(this._config.bundle);
};
AppConfig.prototype.getBundleEndpoint = function () {
var result;
var existsBundleConf = this.useRemoteBundle();
if (existsBundleConf && Util.isDefined(this._config.bundle.endpoint)) {
result = this._config.bundle.endpoint;
}
else if (existsBundleConf && Util.isDefined(this._config.bundle.path)) {
result = this._config.apiEndpoint + '/' + this._config.bundle.path;
}
return result;
};
AppConfig.prototype.getI18nAssetsConfiguration = function () {
if (Util.isDefined(this._config.assets) && Util.isDefined(this._config.assets.i18n)) {
return this._config.assets.i18n;
}
return undefined;
};
AppConfig.prototype.getCssAssetsConfiguration = function () {
if (Util.isDefined(this._config.assets) && Util.isDefined(this._config.assets.css)) {
return this._config.assets.css;
}
return undefined;
};
AppConfig.prototype.getImagesAssetsConfiguration = function () {
if (Util.isDefined(this._config.assets) && Util.isDefined(this._config.assets.images)) {
return this._config.assets.images;
}
return undefined;
};
AppConfig.prototype.getJsAssetsConfiguration = function () {
if (Util.isDefined(this._config.assets) && Util.isDefined(this._config.assets.js)) {
return this._config.assets.js;
}
return undefined;
};
AppConfig.prototype.getRemoteConfigurationConfig = function () {
return this._config.remoteConfig;
};
AppConfig.prototype.useRemoteConfiguration = function () {
return Util.isDefined(this._config.remoteConfig);
};
AppConfig.prototype.getRemoteConfigurationEndpoint = function () {
var result;
var existsRemoteConf = this.useRemoteConfiguration();
if (existsRemoteConf && Util.isDefined(this._config.remoteConfig.endpoint)) {
result = this._config.remoteConfig.endpoint;
}
else if (existsRemoteConf && Util.isDefined(this._config.remoteConfig.path)) {
result = this._config.apiEndpoint + '/' + this._config.remoteConfig.path;
}
return result;
};
return AppConfig;
}());
function noop() {
}
var ObservableWrapper = (function () {
function ObservableWrapper() {
}
ObservableWrapper.subscribe = function (emitter, onNext, onError, onComplete) {
if (onComplete === void 0) {
onComplete = function () {
};
}
onError = (typeof onError === 'function') && onError || noop;
onComplete = (typeof onComplete === 'function') && onComplete || noop;
return emitter.subscribe({ next: onNext, error: onError, complete: onComplete });
};
ObservableWrapper.isObservable = function (obs) { return !!obs.subscribe; };
ObservableWrapper.hasSubscribers = function (obs) { return obs.observers.length > 0; };
ObservableWrapper.dispose = function (subscription) { subscription.unsubscribe(); };
ObservableWrapper.callNext = function (emitter, value) { emitter.emit(value); };
ObservableWrapper.callEmit = function (emitter, value) { emitter.emit(value); };
ObservableWrapper.callError = function (emitter, error) { emitter.error(error); };
ObservableWrapper.callComplete = function (emitter) { emitter.complete(); };
return ObservableWrapper;
}());
var OListItemDirective = (function () {
function OListItemDirective(_el, renderer, actRoute) {
this._el = _el;
this.renderer = renderer;
this.actRoute = actRoute;
this.mdClick = new i0.EventEmitter();
this.mdDoubleClick = new i0.EventEmitter();
this.selectable = false;
}
OListItemDirective.prototype.ngOnInit = function () {
var _this = this;
this.subcription = this.actRoute.params.subscribe(function (params) { return _this.updateActiveState(params); });
};
OListItemDirective.prototype.ngOnDestroy = function () {
if (this.subcription) {
this.subcription.unsubscribe();
}
};
OListItemDirective.prototype.onMouseEnter = function () {
if (!this.selectable && this._list.detailMode !== Codes.DETAIL_MODE_NONE) {
this.renderer.setStyle(this._el.nativeElement, 'cursor', 'pointer');
}
};
OListItemDirective.prototype.updateActiveState = function (params) {
if (this._list) {
var aKeys = this._list.getKeys();
if (this.modelData) {
var _act = false;
if (aKeys.length > 0) {
for (var k = 0; k < aKeys.length; ++k) {
var key = aKeys[k];
var id = params[key];
_act = (this.modelData[key] === id);
if (_act === false) {
break;
}
}
}
if (_act) {
this._el.nativeElement.classList.add('mat-active');
}
else {
this._el.nativeElement.classList.remove('mat-active');
}
}
else {
this._el.nativeElement.classList.remove('mat-active');
}
}
};
OListItemDirective.prototype.onItemClicked = function (e) {
if (!this.selectable) {
ObservableWrapper.callEmit(this.mdClick, this);
}
};
OListItemDirective.prototype.onClick = function (onNext) {
return ObservableWrapper.subscribe(this.mdClick, onNext);
};
OListItemDirective.prototype.onItemDoubleClicked = function (e) {
if (!this.selectable) {
ObservableWrapper.callEmit(this.mdDoubleClick, this);
}
};
OListItemDirective.prototype.onDoubleClick = function (onNext) {
return ObservableWrapper.subscribe(this.mdDoubleClick, onNext);
};
OListItemDirective.prototype.isSelected = function () {
return this._list.isItemSelected(this.modelData);
};
OListItemDirective.prototype.onSelect = function () {
this._list.setSelected(this.modelData);
};
OListItemDirective.prototype.setListComponent = function (list) {
this._list = list;
};
OListItemDirective.prototype.setItemData = function (data) {
if (!this.modelData) {
this.modelData = data;
}
};
OListItemDirective.prototype.getItemData = function () {
return this.modelData;
};
OListItemDirective.decorators = [
{ type: i0.Directive, args: [{
selector: 'o-list-item, mat-list-item[o-list-item], mat-card[o-list-item]',
exportAs: 'olistitem',
host: {
'[class.o-list-item]': 'true',
'(click)': 'onItemClicked($event)',
'(dblclick)': 'onItemDoubleClicked($event)'
}
},] }
];
OListItemDirective.ctorParameters = function () {
return [
{ type: i0.ElementRef },
{ type: i0.Renderer2 },
{ type: router.ActivatedRoute }
];
};
OListItemDirective.propDecorators = {
modelData: [{ type: i0.Input, args: ['o-list-item',] }],
selectable: [{ type: i0.Input }],
onMouseEnter: [{ type: i0.HostListener, args: ['mouseenter',] }]
};
return OListItemDirective;
}());
var OKeyboardListenerDirective = (function () {
function OKeyboardListenerDirective() {
this.onKeysPressed = new i0.EventEmitter();
this.keyboardNumberKeysArray = [];
this.activeKeys = {};
}
OKeyboardListenerDirective.prototype.keyDown = function (e) {
var pressedCode = e.keyCode;
if (this.keyboardNumberKeysArray.indexOf(pressedCode) !== -1) {
this.activeKeys[pressedCode] = true;
this.checkNeededKeys(e);
}
};
OKeyboardListenerDirective.prototype.keyUp = function (e) {
var pressedCode = e.keyCode;
if (this.keyboardNumberKeysArray.indexOf(pressedCode) !== -1) {
this.activeKeys[pressedCode] = false;
}
};
OKeyboardListenerDirective.prototype.ngOnInit = function () {
this.parseKeyboardKeys();
};
OKeyboardListenerDirective.prototype.parseKeyboardKeys = function () {
var _this = this;
var keysAsStringArray = Util.parseArray(this.keyboardKeys);
keysAsStringArray.forEach(function (key) {
try {
_this.keyboardNumberKeysArray.push(parseInt(key, 10));
}
catch (e) {
console.error(e);
}
});
};
OKeyboardListenerDirective.prototype.checkNeededKeys = function (e) {
var _this = this;
var trigger = true;
this.keyboardNumberKeysArray.forEach(function (key) {
trigger = trigger && _this.activeKeys[key];
});
if (trigger) {
e.preventDefault();
e.stopPropagation();
this.onKeysPressed.emit();
}
};
OKeyboardListenerDirective.decorators = [
{ type: i0.Directive, args: [{
selector: '[oKeyboardListener]'
},] }
];
OKeyboardListenerDirective.propDecorators = {
keyboardKeys: [{ type: i0.Input }],
onKeysPressed: [{ type: i0.Output }],
keyDown: [{ type: i0.HostListener, args: ['keydown', ['$event'],] }],
keyUp: [{ type: i0.HostListener, args: ['keyup', ['$event'],] }]
};
return OKeyboardListenerDirective;
}());
function StringConverter(value) {
if (value == null || typeof value === 'string') {
return value;
}
return value.toString();
}
function BooleanConverter(value) {
if (value == null || typeof value === 'boolean') {
return value;
}
return value.toString() === 'true' || value.toString() === 'yes';
}
function NumberConverter(value) {
if (value == null || typeof value === 'number') {
return value;
}
return parseFloat(value.toString());
}
function createConverterIfNeeded(metadata, converter) {
if (converter != null) {
return converter;
}
switch (metadata.name) {
case 'String':
converter = StringConverter;
break;
case 'Boolean':
converter = BooleanConverter;
break;
case 'Number':
converter = NumberConverter;
break;
}
return converter;
}
function InputConverter(converter) {
return function (target, key) {
var metadata = Reflect.getMetadata('design:type', target, key);
if (metadata == null) {
throw new Error('The reflection metadata could not be found.');
}
converter = createConverterIfNeeded(metadata, converter);
if (converter == null) {
throw new Error('There is no converter for the given property type "' + metadata.name + '".');
}
var stringKey = typeof key === 'string' ? key : key.toString();
var definition = Object.getOwnPropertyDescriptor(target, key);
Object.defineProperty(target, key, {
get: definition != null ? definition.get : function () {
return this['__' + stringKey];
},
set: definition != null ?
function (newValue) {
definition.set(converter(newValue));
} : function (newValue) {
this['__' + stringKey] = converter(newValue);
},
enumerable: true,
configurable: true
});
};
}
var ODialogComponent = (function () {
function ODialogComponent(dialogRef) {
this.dialogRef = dialogRef;
}
ODialogComponent.prototype.onOkClick = function () {
if (this.dialogRef) {
this.dialogRef.close(true);
}
};
ODialogComponent.prototype.alert = function (title, message, config) {
config = this.ensureConfig(config);
this.configureDefaultAlert(title, message, config);
};
ODialogComponent.prototype.info = function (title, message, config) {
config = this.ensureConfig(config);
config.alertType = 'info';
if (typeof (config.icon) === 'undefined') {
config.icon = 'info';
}
this.configureDefaultAlert(title, message, config);
};
ODialogComponent.prototype.warn = function (title, message, config) {
config = this.ensureConfig(config);
config.alertType = 'warn';
if (typeof (config.icon) === 'undefined') {
config.icon = 'warning';
}
this.configureDefaultAlert(title, message, config);
};
ODialogComponent.prototype.error = function (title, message, config) {
config = this.ensureConfig(config);
config.alertType = 'error';
if (typeof (config.icon) === 'undefined') {
config.icon = 'error';
}
this.configureDefaultAlert(title, message, config);
};
ODialogComponent.prototype.confirm = function (title, message, config) {
config = this.ensureConfig(config);
this.configureDefaultAlert(title, message, config);
this.twoOptions = true;
};
ODialogComponent.prototype.ensureConfig = function (config) {
if (!config) {
config = {};
}
return config;
};
ODialogComponent.prototype.configureDefaultAlert = function (title, message, config) {
this.twoOptions = false;
this.title = title;
this.message = message;
this.icon = (typeof (config.icon) !== 'undefined') ? config.icon : undefined;
if (this.icon !== undefined) {
this.useIcon = true;
}
this.alertType = config.alertType;
this.okButtonText = (typeof (config.okButtonText) !== 'undefined') ? config.okButtonText : ODialogComponent.DEFAULT_OK_BUTTON_TEXT;
this.cancelButtonText = (typeof (config.cancelButtonText) !== 'undefined') ? config.cancelButtonText : ODialogComponent.DEFAULT_CANCEL_BUTTON_TEXT;
};
Object.defineProperty(ODialogComponent.prototype, "isInfo", {
get: function () {
return this.alertType === 'info';
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "isWarn", {
get: function () {
return this.alertType === 'warn';
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "isError", {
get: function () {
return this.alertType === 'error';
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "title", {
get: function () {
return this._title;
},
set: function (val) {
this._title = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "message", {
get: function () {
return this._message;
},
set: function (val) {
this._message = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "okButtonText", {
get: function () {
return this._okButtonText;
},
set: function (val) {
this._okButtonText = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "cancelButtonText", {
get: function () {
return this._cancelButtonText;
},
set: function (val) {
this._cancelButtonText = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "icon", {
get: function () {
return this._icon;
},
set: function (val) {
this._icon = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "alertType", {
get: function () {
return this._alertType;
},
set: function (val) {
this._alertType = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "twoOptions", {
get: function () {
return this._twoOptions;
},
set: function (val) {
this._twoOptions = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODialogComponent.prototype, "useIcon", {
get: function () {
return this._useIcon;
},
set: function (val) {
this._useIcon = val;
},
enumerable: true,
configurable: true
});
ODialogComponent.DEFAULT_OK_BUTTON_TEXT = 'OK';
ODialogComponent.DEFAULT_CANCEL_BUTTON_TEXT = 'CANCEL';
ODialogComponent.decorators = [
{ type: i0.Component, args: [{
selector: 'o-dialog',
template: "<div *ngIf=\"title && title.length > 0\" mat-dialog-title>{{ title | oTranslate }}</div>\n<div mat-dialog-content>\n <div fxLayout=\"row\" class=\"alert-content\" [class.alert-content-icon]=\"useIcon\" fxLayoutAlign=\"space-between center\">\n <mat-icon *ngIf=\"useIcon\" class=\"alert-icon\" [class.info]=\"isInfo\" [class.warn]=\"isWarn\" [class.error]=\"isError\">\n {{ icon }}\n </mat-icon>\n <span [innerHTML]=\"message | oTranslate\"></span>\n </div>\n</div>\n<mat-dialog-actions align=\"end\">\n <span fxFlex></span>\n <button type=\"button\" *ngIf=\"twoOptions\" mat-stroked-button mat-dialog-close class=\"o-button-default\">\n {{ cancelButtonText | oTranslate | uppercase }}\n </button>\n <button type=\"button\" mat-stroked-button class=\"o-button-primary\" (click)=\"onOkClick()\">{{ okButtonText | oTranslate | uppercase }}</button>\n</mat-dialog-actions>\n",
encapsulation: i0.ViewEncapsulation.None,
host: {
'[class.o-dialog]': 'true'
},
styles: [".o-dialog{cursor:default}.o-dialog .alert-content{box-sizing:border-box;flex:1 1 100%;display:flex;flex-direction:row;place-content:center space-between;align-items:center;padding:12px 0}.o-dialog .alert-content-icon{min-height:70px}.o-dialog .alert-icon{font-size:50px;margin-right:16px;min-height:50px;min-width:50px}"]
}] }
];
ODialogComponent.ctorParameters = function () {
return [
{ type: material.MatDialogRef }
];
};
return ODialogComponent;
}());
var DialogService = (function () {
function DialogService(injector) {
this.injector = injector;
this.ng2Dialog = this.injector.get(material.MatDialog);
}
Object.defineProperty(DialogService.prototype, "dialog", {
get: function () {
if (this.dialogRef) {
return this.dialogRef.componentInstance;
}
return undefined;
},
enumerable: true,
configurable: true
});
DialogService.prototype.alert = function (title, message, config) {
var self = this;
var observable = new rxjs.Observable(function (observer) {
self.openDialog(observer);
self.dialogRef.componentInstance.alert(title, message, config);
});
return observable.toPromise();
};
DialogService.prototype.info = function (title, message, config) {
var self = this;
var observable = new rxjs.Observable(function (observer) {
self.openDialog(observer);
self.dialogRef.componentInstance.info(title, message, config);
});
return observable.toPromise();
};
DialogService.prototype.warn = function (title, message, config) {
var self = this;
var observable = new rxjs.Observable(function (observer) {
self.openDialog(observer);
self.dialogRef.componentInstance.warn(title, message, config);
});
return observable.toPromise();
};
DialogService.prototype.error = function (title, message, config) {
var self = this;
var observable = new rxjs.Observable(function (observer) {
self.openDialog(observer);
self.dialogRef.componentInstance.error(title, message, config);
});
return observable.toPromise();
};
DialogService.prototype.confirm = function (title, message, config) {
var self = this;
var observable = new