@stemy/ngx-utils 12.1.1 → 12.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/bundles/stemy-ngx-utils.umd.js +51 -30
  2. package/bundles/stemy-ngx-utils.umd.js.map +1 -1
  3. package/esm2015/ngx-utils/services/acl.service.js +3 -1
  4. package/esm2015/ngx-utils/services/config.service.js +4 -4
  5. package/esm2015/ngx-utils/services/error-handler.service.js +2 -2
  6. package/esm2015/ngx-utils/services/static-language.service.js +17 -17
  7. package/esm2015/ngx-utils/services/storage.service.js +4 -4
  8. package/esm2015/ngx-utils/utils/file-system.js +20 -0
  9. package/esm2015/public_api.js +2 -1
  10. package/esm2020/ngx-utils/common-types.mjs +117 -0
  11. package/esm2020/ngx-utils/components/dynamic-table/dynamic-table.component.mjs +178 -0
  12. package/esm2020/ngx-utils/components/pagination-menu/pagination-menu.component.mjs +101 -0
  13. package/esm2020/ngx-utils/components/unordered-list/unordered-list.component.mjs +65 -0
  14. package/esm2020/ngx-utils/directives/async-method.base.mjs +78 -0
  15. package/esm2020/ngx-utils/directives/async-method.directive.mjs +21 -0
  16. package/esm2020/ngx-utils/directives/background.directive.mjs +51 -0
  17. package/esm2020/ngx-utils/directives/dynamic-table-template.directive.mjs +20 -0
  18. package/esm2020/ngx-utils/directives/global-template.directive.mjs +30 -0
  19. package/esm2020/ngx-utils/directives/icon.directive.mjs +67 -0
  20. package/esm2020/ngx-utils/directives/ngx-template-outlet.directive.mjs +90 -0
  21. package/esm2020/ngx-utils/directives/pagination-item.directive.mjs +33 -0
  22. package/esm2020/ngx-utils/directives/pagination.directive.mjs +83 -0
  23. package/esm2020/ngx-utils/directives/resource-if.directive.mjs +50 -0
  24. package/esm2020/ngx-utils/directives/sticky-class.directive.mjs +34 -0
  25. package/esm2020/ngx-utils/directives/sticky.directive.mjs +55 -0
  26. package/esm2020/ngx-utils/directives/unordered-list-item.directive.mjs +77 -0
  27. package/esm2020/ngx-utils/directives/unordered-list-template.directive.mjs +26 -0
  28. package/esm2020/ngx-utils/ngx-utils.imports.mjs +165 -0
  29. package/esm2020/ngx-utils/ngx-utils.module.mjs +178 -0
  30. package/esm2020/ngx-utils/pipes/chunk.pipe.mjs +25 -0
  31. package/esm2020/ngx-utils/pipes/entries.pipe.mjs +28 -0
  32. package/esm2020/ngx-utils/pipes/extra-item-properties.pipe.mjs +31 -0
  33. package/esm2020/ngx-utils/pipes/filter.pipe.mjs +42 -0
  34. package/esm2020/ngx-utils/pipes/find.pipe.mjs +29 -0
  35. package/esm2020/ngx-utils/pipes/format-number.pipe.mjs +21 -0
  36. package/esm2020/ngx-utils/pipes/get-offset.pipe.mjs +17 -0
  37. package/esm2020/ngx-utils/pipes/get-type.pipe.mjs +16 -0
  38. package/esm2020/ngx-utils/pipes/global-template.pipe.mjs +41 -0
  39. package/esm2020/ngx-utils/pipes/group-by.pipe.mjs +27 -0
  40. package/esm2020/ngx-utils/pipes/is-type.pipe.mjs +16 -0
  41. package/esm2020/ngx-utils/pipes/join.pipe.mjs +19 -0
  42. package/esm2020/ngx-utils/pipes/keys.pipe.mjs +22 -0
  43. package/esm2020/ngx-utils/pipes/map.pipe.mjs +29 -0
  44. package/esm2020/ngx-utils/pipes/max.pipe.mjs +26 -0
  45. package/esm2020/ngx-utils/pipes/min.pipe.mjs +26 -0
  46. package/esm2020/ngx-utils/pipes/reduce.pipe.mjs +30 -0
  47. package/esm2020/ngx-utils/pipes/remap.pipe.mjs +32 -0
  48. package/esm2020/ngx-utils/pipes/replace.pipe.mjs +16 -0
  49. package/esm2020/ngx-utils/pipes/reverse.pipe.mjs +24 -0
  50. package/esm2020/ngx-utils/pipes/round.pipe.mjs +21 -0
  51. package/esm2020/ngx-utils/pipes/safe-html.pipe.mjs +34 -0
  52. package/esm2020/ngx-utils/pipes/translate.pipe.mjs +86 -0
  53. package/esm2020/ngx-utils/pipes/values.pipe.mjs +22 -0
  54. package/esm2020/ngx-utils/plugins/resize-event.plugin.mjs +59 -0
  55. package/esm2020/ngx-utils/plugins/scroll-event.plugin.mjs +39 -0
  56. package/esm2020/ngx-utils/services/acl.service.mjs +81 -0
  57. package/esm2020/ngx-utils/services/api.service.mjs +38 -0
  58. package/esm2020/ngx-utils/services/auth.service.mjs +14 -0
  59. package/esm2020/ngx-utils/services/base-http.client.mjs +47 -0
  60. package/esm2020/ngx-utils/services/base-http.service.mjs +298 -0
  61. package/esm2020/ngx-utils/services/config.service.mjs +116 -0
  62. package/esm2020/ngx-utils/services/error-handler.service.mjs +49 -0
  63. package/esm2020/ngx-utils/services/events.service.mjs +26 -0
  64. package/esm2020/ngx-utils/services/formatter.service.mjs +47 -0
  65. package/esm2020/ngx-utils/services/global-template.service.mjs +37 -0
  66. package/esm2020/ngx-utils/services/icon.service.mjs +26 -0
  67. package/esm2020/ngx-utils/services/language.service.mjs +113 -0
  68. package/esm2020/ngx-utils/services/open-api.service.mjs +40 -0
  69. package/esm2020/ngx-utils/services/promise.service.mjs +55 -0
  70. package/esm2020/ngx-utils/services/state.service.mjs +173 -0
  71. package/esm2020/ngx-utils/services/static-language.service.mjs +166 -0
  72. package/esm2020/ngx-utils/services/storage.service.mjs +49 -0
  73. package/esm2020/ngx-utils/services/toaster.service.mjs +32 -0
  74. package/esm2020/ngx-utils/services/translated-url.serializer.mjs +73 -0
  75. package/esm2020/ngx-utils/services/universal.service.mjs +78 -0
  76. package/esm2020/ngx-utils/utils/ajax-request-handler.mjs +40 -0
  77. package/esm2020/ngx-utils/utils/array.utils.mjs +100 -0
  78. package/esm2020/ngx-utils/utils/auth.guard.mjs +181 -0
  79. package/esm2020/ngx-utils/utils/canvas.utils.mjs +388 -0
  80. package/esm2020/ngx-utils/utils/date.utils.mjs +28 -0
  81. package/esm2020/ngx-utils/utils/file.utils.mjs +90 -0
  82. package/esm2020/ngx-utils/utils/generic-value.mjs +20 -0
  83. package/esm2020/ngx-utils/utils/geometry.mjs +132 -0
  84. package/esm2020/ngx-utils/utils/initializer.mjs +20 -0
  85. package/esm2020/ngx-utils/utils/loader.utils.mjs +55 -0
  86. package/esm2020/ngx-utils/utils/math.utils.mjs +15 -0
  87. package/esm2020/ngx-utils/utils/object.utils.mjs +261 -0
  88. package/esm2020/ngx-utils/utils/observable.utils.mjs +63 -0
  89. package/esm2020/ngx-utils/utils/reflect.utils.mjs +33 -0
  90. package/esm2020/ngx-utils/utils/set.utils.mjs +20 -0
  91. package/esm2020/ngx-utils/utils/string.utils.mjs +41 -0
  92. package/esm2020/ngx-utils/utils/timer.utils.mjs +52 -0
  93. package/esm2020/ngx-utils/utils/unique.utils.mjs +24 -0
  94. package/esm2020/ngx-utils/utils/vector.mjs +77 -0
  95. package/esm2020/public_api.mjs +85 -0
  96. package/esm2020/stemy-ngx-utils.mjs +5 -0
  97. package/esm2020/tools/config.mjs +71 -0
  98. package/esm2020/tools/public_api.mjs +2 -0
  99. package/esm2020/tools/stemy-ngx-utils-tools.mjs +5 -0
  100. package/fesm2015/stemy-ngx-utils-tools.mjs +77 -0
  101. package/fesm2015/stemy-ngx-utils-tools.mjs.map +1 -0
  102. package/fesm2015/stemy-ngx-utils.js +46 -24
  103. package/fesm2015/stemy-ngx-utils.js.map +1 -1
  104. package/fesm2015/stemy-ngx-utils.mjs +5168 -0
  105. package/fesm2015/stemy-ngx-utils.mjs.map +1 -0
  106. package/fesm2020/stemy-ngx-utils-tools.mjs +77 -0
  107. package/fesm2020/stemy-ngx-utils-tools.mjs.map +1 -0
  108. package/fesm2020/stemy-ngx-utils.mjs +5099 -0
  109. package/fesm2020/stemy-ngx-utils.mjs.map +1 -0
  110. package/ngx-utils/services/static-language.service.d.ts +1 -1
  111. package/ngx-utils/utils/file-system.d.ts +16 -0
  112. package/package.json +1 -1
  113. package/public_api.d.ts +1 -0
  114. package/stemy-ngx-utils.metadata.json +1 -1
  115. package/tools/config.d.ts +7 -0
  116. package/tools/package.json +10 -0
  117. package/tools/public_api.d.ts +1 -0
  118. package/tools/stemy-ngx-utils-tools.d.ts +5 -0
  119. package/bundles/stemy-ngx-utils.umd.min.js +0 -16
  120. package/bundles/stemy-ngx-utils.umd.min.js.map +0 -1
@@ -0,0 +1,77 @@
1
+ function isPrimitive(value) {
2
+ const type = typeof value;
3
+ return value == null || (type !== "object" && type !== "function");
4
+ }
5
+ function isDate(value) {
6
+ return null !== value && !isNaN(value) && "undefined" !== typeof value.getDate;
7
+ }
8
+ function convertValue(value, type) {
9
+ switch (type) {
10
+ case "boolean":
11
+ value = typeof value == "string" ? value.toLowerCase() : value;
12
+ return (value == "no" || value == "false" || value == "0") ? false : !!value;
13
+ case "number":
14
+ const val = parseFloat(value);
15
+ return isNaN(val) ? 0 : val;
16
+ }
17
+ return value;
18
+ }
19
+ function getFromEnv(path, alternatives, value) {
20
+ const name = path.replace(/\.?([A-Z|0-9]+)/g, function (x, y) {
21
+ return "_" + y.toLowerCase();
22
+ }).replace(/\./gi, "_").replace(/^_/, "").toUpperCase();
23
+ const alts = Array.from(alternatives[name] || []);
24
+ alts.unshift(name);
25
+ for (const envName of alts) {
26
+ const envValue = process.env[envName];
27
+ if (typeof envValue !== "undefined") {
28
+ const val = convertValue(envValue, typeof value);
29
+ console.log(name, envName, val);
30
+ return convertValue(envValue, typeof value);
31
+ }
32
+ }
33
+ console.log(name, value);
34
+ return value;
35
+ }
36
+ function createConfigRecursive(target, source, path, alternatives) {
37
+ if (isPrimitive(source) || isDate(source)) {
38
+ return getFromEnv(path, alternatives, source);
39
+ }
40
+ if (Array.isArray(source)) {
41
+ target = Array.isArray(target) ? Array.from(target) : [];
42
+ source.forEach((item, index) => {
43
+ if (target.length > index)
44
+ target[index] = createConfigRecursive(target[index], item, !path ? `${index}` : `${path}.${index}`, alternatives);
45
+ else
46
+ target.push(createConfigRecursive(null, item, !path ? `${index}` : `${path}.${index}`, alternatives));
47
+ });
48
+ return target;
49
+ }
50
+ return Object.keys(source).reduce((result, key) => {
51
+ result[key] = createConfigRecursive(result[key], source[key], !path ? `${key}` : `${path}.${key}`, alternatives);
52
+ return result;
53
+ }, Object.assign({}, target));
54
+ }
55
+ function parseConfig(config) {
56
+ if (typeof config == "string") {
57
+ try {
58
+ config = JSON.parse(config);
59
+ }
60
+ catch (e) {
61
+ return {};
62
+ }
63
+ }
64
+ return config;
65
+ }
66
+ function createConfig(config, alternatives) {
67
+ alternatives = alternatives || {};
68
+ console.log("Parsing config...");
69
+ return createConfigRecursive(null, parseConfig(config), "", alternatives);
70
+ }
71
+
72
+ /**
73
+ * Generated bundle index. Do not edit.
74
+ */
75
+
76
+ export { createConfig };
77
+ //# sourceMappingURL=stemy-ngx-utils-tools.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stemy-ngx-utils-tools.mjs","sources":["../../tools/config.ts","../../tools/stemy-ngx-utils-tools.ts"],"sourcesContent":["export function isPrimitive(value: any): boolean {\r\n const type = typeof value;\r\n return value == null || (type !== \"object\" && type !== \"function\");\r\n}\r\n\r\nexport function isDate(value: any): value is Date {\r\n return null !== value && !isNaN(value) && \"undefined\" !== typeof value.getDate;\r\n}\r\n\r\nexport interface IEnvironmentAlternatives {\r\n [name: string]: string[]\r\n}\r\n\r\nfunction convertValue(value: any, type: string): any {\r\n switch (type) {\r\n case \"boolean\":\r\n value = typeof value == \"string\" ? value.toLowerCase() : value;\r\n return (value == \"no\" || value == \"false\" || value == \"0\") ? false : !!value;\r\n case \"number\":\r\n const val = parseFloat(value);\r\n return isNaN(val) ? 0 : val;\r\n }\r\n return value;\r\n}\r\n\r\nfunction getFromEnv(path: string, alternatives: IEnvironmentAlternatives, value: any): any {\r\n const name = path.replace(/\\.?([A-Z|0-9]+)/g, function (x,y){\r\n return \"_\" + y.toLowerCase()\r\n }).replace(/\\./gi, \"_\").replace(/^_/, \"\").toUpperCase();\r\n const alts = Array.from(alternatives[name] || []);\r\n alts.unshift(name);\r\n for (const envName of alts) {\r\n const envValue = process.env[envName];\r\n if (typeof envValue !== \"undefined\") {\r\n const val = convertValue(envValue, typeof value);\r\n console.log(name, envName, val);\r\n return convertValue(envValue, typeof value);\r\n }\r\n }\r\n console.log(name, value);\r\n return value;\r\n}\r\n\r\nfunction createConfigRecursive(target: any, source: any, path: string, alternatives: IEnvironmentAlternatives): any {\r\n if (isPrimitive(source) || isDate(source)) {\r\n return getFromEnv(path, alternatives, source);\r\n }\r\n if (Array.isArray(source)) {\r\n target = Array.isArray(target) ? Array.from(target) : [];\r\n source.forEach((item, index) => {\r\n if (target.length > index)\r\n target[index] = createConfigRecursive(target[index], item, !path ? `${index}` : `${path}.${index}`, alternatives);\r\n else\r\n target.push(createConfigRecursive(null, item, !path ? `${index}` : `${path}.${index}`, alternatives));\r\n });\r\n return target;\r\n }\r\n return Object.keys(source).reduce((result, key) => {\r\n result[key] = createConfigRecursive(result[key], source[key], !path ? `${key}` : `${path}.${key}`, alternatives);\r\n return result;\r\n }, Object.assign({}, target));\r\n}\r\n\r\nexport function parseConfig(config: any): any {\r\n if (typeof config == \"string\") {\r\n try {\r\n config = JSON.parse(config);\r\n } catch (e) {\r\n return {};\r\n }\r\n }\r\n return config;\r\n}\r\n\r\nexport function createConfig(config: any, alternatives?: IEnvironmentAlternatives): any {\r\n alternatives = alternatives || {};\r\n console.log(\"Parsing config...\");\r\n return createConfigRecursive(null, parseConfig(config), \"\", alternatives);\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":"AAAM,SAAU,WAAW,CAAC,KAAU,EAAA;AAClC,IAAA,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC;AAC1B,IAAA,OAAO,KAAK,IAAI,IAAI,KAAK,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,UAAU,CAAC,CAAC;AACvE,CAAC;AAEK,SAAU,MAAM,CAAC,KAAU,EAAA;AAC7B,IAAA,OAAO,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,WAAW,KAAK,OAAO,KAAK,CAAC,OAAO,CAAC;AACnF,CA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, isPlatformServer, DOCUMENT, CommonModule } from '@angular/common';
10
10
  import { DeviceDetectorService } from 'ngx-device-detector';
11
11
  import { HttpClient, HttpHeaders, HttpParams, HttpUrlEncodingCodec, HttpHandler, HttpEventType } from '@angular/common/http';
12
- import { parse } from 'json5';
13
12
  import { ɵangular_packages_platform_browser_platform_browser_g, DomSanitizer, EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
14
13
  import { addListener, removeListener } from 'resize-detector';
15
14
  import { FormsModule } from '@angular/forms';
@@ -980,6 +979,26 @@ class GenericValue extends Subject {
980
979
  }
981
980
  }
982
981
 
982
+ class FileSystemEntry {
983
+ constructor(label, meta, image, data, parent, openCb) {
984
+ this.label = label;
985
+ this.meta = meta;
986
+ this.image = image;
987
+ this.data = data;
988
+ this.parent = parent;
989
+ this.openCb = openCb;
990
+ this.path = !parent ? [this] : parent.path.concat([this]);
991
+ this.level = this.path.length - 1;
992
+ this.classes = this.path
993
+ .filter(t => typeof t.data === "string" && t.data.length > 0).map(t => t.data)
994
+ .concat([`level-${this.level}`]);
995
+ }
996
+ open() {
997
+ this.result = this.result || this.openCb(this.data, this);
998
+ return this.result;
999
+ }
1000
+ }
1001
+
983
1002
  class Rect {
984
1003
  constructor(x, y, width, height, rotation = 0) {
985
1004
  this.x = x;
@@ -1971,6 +1990,8 @@ class AclService {
1971
1990
  return;
1972
1991
  info.dirty = false;
1973
1992
  const component = info.component;
1993
+ if (!info.component)
1994
+ return;
1974
1995
  if (info.first) {
1975
1996
  if (ObjectUtils.isFunction(component.onUserInitialized)) {
1976
1997
  component.onUserInitialized();
@@ -2079,7 +2100,7 @@ class StorageService {
2079
2100
  this.universal = universal;
2080
2101
  }
2081
2102
  get(key, defaultValue, mode = StorageMode.Local) {
2082
- if (this.universal.isServer)
2103
+ if (!this.universal.isBrowser)
2083
2104
  return defaultValue;
2084
2105
  const storage = mode == StorageMode.Local ? localStorage : sessionStorage;
2085
2106
  const item = storage.getItem(key);
@@ -2093,7 +2114,7 @@ class StorageService {
2093
2114
  }
2094
2115
  }
2095
2116
  set(key, value, mode = StorageMode.Local) {
2096
- if (this.universal.isServer)
2117
+ if (!this.universal.isBrowser)
2097
2118
  return;
2098
2119
  const storage = mode == StorageMode.Local ? localStorage : sessionStorage;
2099
2120
  if (typeof value == "string") {
@@ -2103,7 +2124,7 @@ class StorageService {
2103
2124
  storage.setItem(key, JSON.stringify(value));
2104
2125
  }
2105
2126
  remove(key, mode = StorageMode.Local) {
2106
- if (this.universal.isServer)
2127
+ if (!this.universal.isBrowser)
2107
2128
  return;
2108
2129
  const storage = mode == StorageMode.Local ? localStorage : sessionStorage;
2109
2130
  storage.removeItem(key);
@@ -2437,6 +2458,7 @@ class StaticAuthService {
2437
2458
  }
2438
2459
  }
2439
2460
 
2461
+ const JSON5 = require("json5");
2440
2462
  class ConfigService {
2441
2463
  constructor(http, universal, rootElement, baseConfig = null, scriptParams = null) {
2442
2464
  this.http = http;
@@ -2503,7 +2525,7 @@ class ConfigService {
2503
2525
  const configUrl = this.configUrl;
2504
2526
  try {
2505
2527
  const config5 = yield this.http.get(isDevMode() ? `${configUrl}5` : configUrl, { responseType: "text" }).toPromise();
2506
- return parse(config5);
2528
+ return JSON5.parse(config5);
2507
2529
  }
2508
2530
  catch (e) {
2509
2531
  try {
@@ -2532,7 +2554,7 @@ class ConfigService {
2532
2554
  return this.loadedConfig[key];
2533
2555
  }
2534
2556
  getQueryParameter(name, url) {
2535
- url = url || (this.universal.isServer ? "" : window.location.href);
2557
+ url = url || (this.universal.isBrowser ? window.location.href : "");
2536
2558
  name = name.replace(/[\[\]]/g, "\\$&");
2537
2559
  const regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url);
2538
2560
  if (!results)
@@ -2579,7 +2601,7 @@ class ErrorHandlerService extends ErrorHandler {
2579
2601
  }
2580
2602
  if (this.universal.isServer)
2581
2603
  return;
2582
- const key = btoa(unescape(encodeURIComponent(`${error.message} ${error.stack}`)));
2604
+ const key = typeof btoa !== "undefined" ? btoa(unescape(encodeURIComponent(`${error.message} ${error.stack}`))) : error.message;
2583
2605
  if (this.errorMap[key] && this.errorMap[key].getTime() > date.getTime() - 5000)
2584
2606
  return;
2585
2607
  this.errorMap[key] = date;
@@ -2735,7 +2757,7 @@ class StaticLanguageService {
2735
2757
  this.initService();
2736
2758
  }
2737
2759
  get defaultLanguage() {
2738
- return this.configs.getQueryParameter("lang") || this.storage.get("language", this.browserLang);
2760
+ return this.configs.getQueryParameter("lang") || this.storage.get("language", this.getDefaultLanguage());
2739
2761
  }
2740
2762
  get dictionary() {
2741
2763
  return this.translations[this.currentLanguage] || {};
@@ -2772,21 +2794,6 @@ class StaticLanguageService {
2772
2794
  get config() {
2773
2795
  return this.configs.config;
2774
2796
  }
2775
- get browserLang() {
2776
- if (this.universal.isServer || typeof window.navigator === "undefined") {
2777
- return "de";
2778
- }
2779
- let browserLang = (window.navigator.languages ? window.navigator.languages[0] : null)
2780
- || window.navigator.language || window.navigator["browserLanguage"] || window.navigator["userLanguage"] || null;
2781
- if (!browserLang)
2782
- return browserLang;
2783
- ["-", "_"].forEach(splitter => {
2784
- if (browserLang.indexOf(splitter) >= 0) {
2785
- browserLang = browserLang.split(splitter)[0];
2786
- }
2787
- });
2788
- return browserLang;
2789
- }
2790
2797
  get universal() {
2791
2798
  return this.storage.universal;
2792
2799
  }
@@ -2852,6 +2859,21 @@ class StaticLanguageService {
2852
2859
  return ObjectUtils.isDefined(r) ? r : substring;
2853
2860
  });
2854
2861
  }
2862
+ getDefaultLanguage() {
2863
+ if (!this.universal.isBrowser || typeof window.navigator === "undefined") {
2864
+ return "de";
2865
+ }
2866
+ let browserLang = (window.navigator.languages ? window.navigator.languages[0] : null)
2867
+ || window.navigator.language || window.navigator["browserLanguage"] || window.navigator["userLanguage"] || null;
2868
+ if (!browserLang)
2869
+ return browserLang;
2870
+ ["-", "_"].forEach(splitter => {
2871
+ if (browserLang.indexOf(splitter) >= 0) {
2872
+ browserLang = browserLang.split(splitter)[0];
2873
+ }
2874
+ });
2875
+ return browserLang;
2876
+ }
2855
2877
  }
2856
2878
  StaticLanguageService.decorators = [
2857
2879
  { type: Injectable }
@@ -4856,5 +4878,5 @@ NgxUtilsModule.decorators = [
4856
4878
  * Generated bundle index. Do not edit.
4857
4879
  */
4858
4880
 
4859
- export { API_SERVICE, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PromiseService, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, StateService, StaticAuthService, StaticLanguageService, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector, pipes as ɵa, directives as ɵb, components as ɵc, providers as ɵd, loadConfig as ɵe, StickyClassDirective as ɵf };
4881
+ export { API_SERVICE, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodBase, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileSystemEntry, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GLOBAL_TEMPLATES, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PromiseService, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, StateService, StaticAuthService, StaticLanguageService, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector, pipes as ɵa, directives as ɵb, components as ɵc, providers as ɵd, loadConfig as ɵe, StickyClassDirective as ɵf };
4860
4882
  //# sourceMappingURL=stemy-ngx-utils.js.map