@stemy/ngx-utils 12.1.3 → 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 (115) hide show
  1. package/bundles/stemy-ngx-utils.umd.js +24 -0
  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/utils/file-system.js +20 -0
  5. package/esm2015/public_api.js +2 -1
  6. package/esm2020/ngx-utils/common-types.mjs +117 -0
  7. package/esm2020/ngx-utils/components/dynamic-table/dynamic-table.component.mjs +178 -0
  8. package/esm2020/ngx-utils/components/pagination-menu/pagination-menu.component.mjs +101 -0
  9. package/esm2020/ngx-utils/components/unordered-list/unordered-list.component.mjs +65 -0
  10. package/esm2020/ngx-utils/directives/async-method.base.mjs +78 -0
  11. package/esm2020/ngx-utils/directives/async-method.directive.mjs +21 -0
  12. package/esm2020/ngx-utils/directives/background.directive.mjs +51 -0
  13. package/esm2020/ngx-utils/directives/dynamic-table-template.directive.mjs +20 -0
  14. package/esm2020/ngx-utils/directives/global-template.directive.mjs +30 -0
  15. package/esm2020/ngx-utils/directives/icon.directive.mjs +67 -0
  16. package/esm2020/ngx-utils/directives/ngx-template-outlet.directive.mjs +90 -0
  17. package/esm2020/ngx-utils/directives/pagination-item.directive.mjs +33 -0
  18. package/esm2020/ngx-utils/directives/pagination.directive.mjs +83 -0
  19. package/esm2020/ngx-utils/directives/resource-if.directive.mjs +50 -0
  20. package/esm2020/ngx-utils/directives/sticky-class.directive.mjs +34 -0
  21. package/esm2020/ngx-utils/directives/sticky.directive.mjs +55 -0
  22. package/esm2020/ngx-utils/directives/unordered-list-item.directive.mjs +77 -0
  23. package/esm2020/ngx-utils/directives/unordered-list-template.directive.mjs +26 -0
  24. package/esm2020/ngx-utils/ngx-utils.imports.mjs +165 -0
  25. package/esm2020/ngx-utils/ngx-utils.module.mjs +178 -0
  26. package/esm2020/ngx-utils/pipes/chunk.pipe.mjs +25 -0
  27. package/esm2020/ngx-utils/pipes/entries.pipe.mjs +28 -0
  28. package/esm2020/ngx-utils/pipes/extra-item-properties.pipe.mjs +31 -0
  29. package/esm2020/ngx-utils/pipes/filter.pipe.mjs +42 -0
  30. package/esm2020/ngx-utils/pipes/find.pipe.mjs +29 -0
  31. package/esm2020/ngx-utils/pipes/format-number.pipe.mjs +21 -0
  32. package/esm2020/ngx-utils/pipes/get-offset.pipe.mjs +17 -0
  33. package/esm2020/ngx-utils/pipes/get-type.pipe.mjs +16 -0
  34. package/esm2020/ngx-utils/pipes/global-template.pipe.mjs +41 -0
  35. package/esm2020/ngx-utils/pipes/group-by.pipe.mjs +27 -0
  36. package/esm2020/ngx-utils/pipes/is-type.pipe.mjs +16 -0
  37. package/esm2020/ngx-utils/pipes/join.pipe.mjs +19 -0
  38. package/esm2020/ngx-utils/pipes/keys.pipe.mjs +22 -0
  39. package/esm2020/ngx-utils/pipes/map.pipe.mjs +29 -0
  40. package/esm2020/ngx-utils/pipes/max.pipe.mjs +26 -0
  41. package/esm2020/ngx-utils/pipes/min.pipe.mjs +26 -0
  42. package/esm2020/ngx-utils/pipes/reduce.pipe.mjs +30 -0
  43. package/esm2020/ngx-utils/pipes/remap.pipe.mjs +32 -0
  44. package/esm2020/ngx-utils/pipes/replace.pipe.mjs +16 -0
  45. package/esm2020/ngx-utils/pipes/reverse.pipe.mjs +24 -0
  46. package/esm2020/ngx-utils/pipes/round.pipe.mjs +21 -0
  47. package/esm2020/ngx-utils/pipes/safe-html.pipe.mjs +34 -0
  48. package/esm2020/ngx-utils/pipes/translate.pipe.mjs +86 -0
  49. package/esm2020/ngx-utils/pipes/values.pipe.mjs +22 -0
  50. package/esm2020/ngx-utils/plugins/resize-event.plugin.mjs +59 -0
  51. package/esm2020/ngx-utils/plugins/scroll-event.plugin.mjs +39 -0
  52. package/esm2020/ngx-utils/services/acl.service.mjs +81 -0
  53. package/esm2020/ngx-utils/services/api.service.mjs +38 -0
  54. package/esm2020/ngx-utils/services/auth.service.mjs +14 -0
  55. package/esm2020/ngx-utils/services/base-http.client.mjs +47 -0
  56. package/esm2020/ngx-utils/services/base-http.service.mjs +298 -0
  57. package/esm2020/ngx-utils/services/config.service.mjs +116 -0
  58. package/esm2020/ngx-utils/services/error-handler.service.mjs +49 -0
  59. package/esm2020/ngx-utils/services/events.service.mjs +26 -0
  60. package/esm2020/ngx-utils/services/formatter.service.mjs +47 -0
  61. package/esm2020/ngx-utils/services/global-template.service.mjs +37 -0
  62. package/esm2020/ngx-utils/services/icon.service.mjs +26 -0
  63. package/esm2020/ngx-utils/services/language.service.mjs +113 -0
  64. package/esm2020/ngx-utils/services/open-api.service.mjs +40 -0
  65. package/esm2020/ngx-utils/services/promise.service.mjs +55 -0
  66. package/esm2020/ngx-utils/services/state.service.mjs +173 -0
  67. package/esm2020/ngx-utils/services/static-language.service.mjs +166 -0
  68. package/esm2020/ngx-utils/services/storage.service.mjs +49 -0
  69. package/esm2020/ngx-utils/services/toaster.service.mjs +32 -0
  70. package/esm2020/ngx-utils/services/translated-url.serializer.mjs +73 -0
  71. package/esm2020/ngx-utils/services/universal.service.mjs +78 -0
  72. package/esm2020/ngx-utils/utils/ajax-request-handler.mjs +40 -0
  73. package/esm2020/ngx-utils/utils/array.utils.mjs +100 -0
  74. package/esm2020/ngx-utils/utils/auth.guard.mjs +181 -0
  75. package/esm2020/ngx-utils/utils/canvas.utils.mjs +388 -0
  76. package/esm2020/ngx-utils/utils/date.utils.mjs +28 -0
  77. package/esm2020/ngx-utils/utils/file.utils.mjs +90 -0
  78. package/esm2020/ngx-utils/utils/generic-value.mjs +20 -0
  79. package/esm2020/ngx-utils/utils/geometry.mjs +132 -0
  80. package/esm2020/ngx-utils/utils/initializer.mjs +20 -0
  81. package/esm2020/ngx-utils/utils/loader.utils.mjs +55 -0
  82. package/esm2020/ngx-utils/utils/math.utils.mjs +15 -0
  83. package/esm2020/ngx-utils/utils/object.utils.mjs +261 -0
  84. package/esm2020/ngx-utils/utils/observable.utils.mjs +63 -0
  85. package/esm2020/ngx-utils/utils/reflect.utils.mjs +33 -0
  86. package/esm2020/ngx-utils/utils/set.utils.mjs +20 -0
  87. package/esm2020/ngx-utils/utils/string.utils.mjs +41 -0
  88. package/esm2020/ngx-utils/utils/timer.utils.mjs +52 -0
  89. package/esm2020/ngx-utils/utils/unique.utils.mjs +24 -0
  90. package/esm2020/ngx-utils/utils/vector.mjs +77 -0
  91. package/esm2020/public_api.mjs +85 -0
  92. package/esm2020/stemy-ngx-utils.mjs +5 -0
  93. package/esm2020/tools/config.mjs +71 -0
  94. package/esm2020/tools/public_api.mjs +2 -0
  95. package/esm2020/tools/stemy-ngx-utils-tools.mjs +5 -0
  96. package/fesm2015/stemy-ngx-utils-tools.mjs +77 -0
  97. package/fesm2015/stemy-ngx-utils-tools.mjs.map +1 -0
  98. package/fesm2015/stemy-ngx-utils.js +23 -1
  99. package/fesm2015/stemy-ngx-utils.js.map +1 -1
  100. package/fesm2015/stemy-ngx-utils.mjs +5168 -0
  101. package/fesm2015/stemy-ngx-utils.mjs.map +1 -0
  102. package/fesm2020/stemy-ngx-utils-tools.mjs +77 -0
  103. package/fesm2020/stemy-ngx-utils-tools.mjs.map +1 -0
  104. package/fesm2020/stemy-ngx-utils.mjs +5099 -0
  105. package/fesm2020/stemy-ngx-utils.mjs.map +1 -0
  106. package/ngx-utils/utils/file-system.d.ts +16 -0
  107. package/package.json +1 -1
  108. package/public_api.d.ts +1 -0
  109. package/stemy-ngx-utils.metadata.json +1 -1
  110. package/tools/config.d.ts +7 -0
  111. package/tools/package.json +10 -0
  112. package/tools/public_api.d.ts +1 -0
  113. package/tools/stemy-ngx-utils-tools.d.ts +5 -0
  114. package/bundles/stemy-ngx-utils.umd.min.js +0 -16
  115. 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,CAAC;AAMD,SAAS,YAAY,CAAC,KAAU,EAAE,IAAY,EAAA;AAC1C,IAAA,QAAQ,IAAI;AACR,QAAA,KAAK,SAAS;AACV,YAAA,KAAK,GAAG,OAAO,KAAK,IAAI,QAAQ,GAAG,KAAK,CAAC,WAAW,EAAE,GAAG,KA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