@lenne.tech/ng-base 12.1.0 → 13.0.0

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 (203) hide show
  1. package/{esm2015/lenne.tech-ng-base.js → esm2020/lenne.tech-ng-base.mjs} +0 -0
  2. package/{esm2015/src/lib/base/base.module.js → esm2020/lib/base/base.module.mjs} +39 -8
  3. package/{esm2015/lib/base/classes/basic-user.class.js → esm2020/lib/base/classes/basic-user.class.mjs} +0 -0
  4. package/{esm2015/lib/base/classes/graphql-enum.class.js → esm2020/lib/base/classes/graphql-enum.class.mjs} +0 -0
  5. package/esm2020/lib/base/classes/graphql-meta.class.mjs +171 -0
  6. package/{esm2015/lib/base/classes/graphql-type.class.js → esm2020/lib/base/classes/graphql-type.class.mjs} +0 -0
  7. package/esm2020/lib/base/classes/helper.class.mjs +295 -0
  8. package/{esm2015/lib/base/classes/standard.class.js → esm2020/lib/base/classes/standard.class.mjs} +0 -0
  9. package/esm2020/lib/base/directives/context-menu.directive.mjs +109 -0
  10. package/esm2020/lib/base/directives/lazy-load.directive.mjs +45 -0
  11. package/esm2020/lib/base/directives/match-height.directive.mjs +79 -0
  12. package/esm2020/lib/base/directives/resizable.directive.mjs +90 -0
  13. package/{esm2015/lib/base/enums/comparison-operator.enum.js → esm2020/lib/base/enums/comparison-operator.enum.mjs} +0 -0
  14. package/{esm2015/lib/base/enums/graphql-request-type.enum.js → esm2020/lib/base/enums/graphql-request-type.enum.mjs} +0 -0
  15. package/{esm2015/lib/base/enums/logical-operator.enum.js → esm2020/lib/base/enums/logical-operator.enum.mjs} +0 -0
  16. package/{esm2015/lib/base/enums/sort-order.enum.js → esm2020/lib/base/enums/sort-order.enum.mjs} +0 -0
  17. package/{esm2015/lib/base/factories/apollo-options.factory.js → esm2020/lib/base/factories/apollo-options.factory.mjs} +0 -0
  18. package/esm2020/lib/base/guards/auth.guard.mjs +61 -0
  19. package/esm2020/lib/base/guards/can-deactivate.guard.mjs +16 -0
  20. package/esm2020/lib/base/guards/logout.guard.mjs +32 -0
  21. package/{esm2015/lib/base/index.js → esm2020/lib/base/index.mjs} +0 -0
  22. package/{esm2015/lib/base/interfaces/base-module-config.interface.js → esm2020/lib/base/interfaces/base-module-config.interface.mjs} +0 -0
  23. package/{esm2015/lib/base/interfaces/can-component-deactivate.interface.js → esm2020/lib/base/interfaces/can-component-deactivate.interface.mjs} +0 -0
  24. package/{esm2015/lib/base/interfaces/combined-filter-input.interface.js → esm2020/lib/base/interfaces/combined-filter-input.interface.mjs} +0 -0
  25. package/{esm2015/lib/base/interfaces/field-object.interface.js → esm2020/lib/base/interfaces/field-object.interface.mjs} +0 -0
  26. package/{esm2015/lib/base/interfaces/field.interface.js → esm2020/lib/base/interfaces/field.interface.mjs} +0 -0
  27. package/{esm2015/lib/base/interfaces/filter-input.interface.js → esm2020/lib/base/interfaces/filter-input.interface.mjs} +0 -0
  28. package/{esm2015/lib/base/interfaces/find-args.interface.js → esm2020/lib/base/interfaces/find-args.interface.mjs} +0 -0
  29. package/{esm2015/lib/base/interfaces/graphql-options.interface.js → esm2020/lib/base/interfaces/graphql-options.interface.mjs} +0 -0
  30. package/{esm2015/lib/base/interfaces/graphql-plus-options.interfacen.js → esm2020/lib/base/interfaces/graphql-plus-options.interfacen.mjs} +0 -0
  31. package/{esm2015/lib/base/interfaces/graphql-type-collection.interface.js → esm2020/lib/base/interfaces/graphql-type-collection.interface.mjs} +0 -0
  32. package/{esm2015/lib/base/interfaces/single-filter-input.interface.js → esm2020/lib/base/interfaces/single-filter-input.interface.mjs} +0 -0
  33. package/{esm2015/lib/base/interfaces/sort-input.interface.js → esm2020/lib/base/interfaces/sort-input.interface.mjs} +0 -0
  34. package/esm2020/lib/base/pipes/ellipses.pipe.mjs +22 -0
  35. package/esm2020/lib/base/pipes/safe-html.pipe.mjs +21 -0
  36. package/{esm2015/lib/base/public-api.js → esm2020/lib/base/public-api.mjs} +0 -0
  37. package/{esm2015/lib/base/services/auth.service.js → esm2020/lib/base/services/auth.service.mjs} +14 -17
  38. package/{esm2015/lib/base/services/fullscreen.service.js → esm2020/lib/base/services/fullscreen.service.mjs} +9 -8
  39. package/esm2020/lib/base/services/graphql-meta.service.mjs +123 -0
  40. package/esm2020/lib/base/services/graphql-plus.service.mjs +84 -0
  41. package/esm2020/lib/base/services/graphql.service.mjs +441 -0
  42. package/esm2020/lib/base/services/image.service.mjs +102 -0
  43. package/esm2020/lib/base/services/loader.service.mjs +29 -0
  44. package/esm2020/lib/base/services/scroll.service.mjs +179 -0
  45. package/esm2020/lib/base/services/seo.service.mjs +97 -0
  46. package/esm2020/lib/base/services/storage.service.mjs +132 -0
  47. package/esm2020/lib/base/services/ws.service.mjs +17 -0
  48. package/{esm2015/lib/base/types/storage.type.js → esm2020/lib/base/types/storage.type.mjs} +0 -0
  49. package/{esm2015/lib/base/validators/must-match.validator.js → esm2020/lib/base/validators/must-match.validator.mjs} +0 -0
  50. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  51. package/esm2020/src/lib/base/base.module.mjs +97 -0
  52. package/{esm2015/src/lib/base/classes/basic-user.class.js → esm2020/src/lib/base/classes/basic-user.class.mjs} +0 -0
  53. package/{esm2015/src/lib/base/classes/graphql-enum.class.js → esm2020/src/lib/base/classes/graphql-enum.class.mjs} +0 -0
  54. package/esm2020/src/lib/base/classes/graphql-meta.class.mjs +171 -0
  55. package/{esm2015/src/lib/base/classes/graphql-type.class.js → esm2020/src/lib/base/classes/graphql-type.class.mjs} +0 -0
  56. package/esm2020/src/lib/base/classes/helper.class.mjs +295 -0
  57. package/{esm2015/src/lib/base/classes/standard.class.js → esm2020/src/lib/base/classes/standard.class.mjs} +0 -0
  58. package/esm2020/src/lib/base/directives/context-menu.directive.mjs +109 -0
  59. package/esm2020/src/lib/base/directives/lazy-load.directive.mjs +45 -0
  60. package/esm2020/src/lib/base/directives/match-height.directive.mjs +79 -0
  61. package/esm2020/src/lib/base/directives/resizable.directive.mjs +90 -0
  62. package/{esm2015/src/lib/base/enums/comparison-operator.enum.js → esm2020/src/lib/base/enums/comparison-operator.enum.mjs} +0 -0
  63. package/{esm2015/src/lib/base/enums/graphql-request-type.enum.js → esm2020/src/lib/base/enums/graphql-request-type.enum.mjs} +0 -0
  64. package/{esm2015/src/lib/base/enums/logical-operator.enum.js → esm2020/src/lib/base/enums/logical-operator.enum.mjs} +0 -0
  65. package/{esm2015/src/lib/base/enums/sort-order.enum.js → esm2020/src/lib/base/enums/sort-order.enum.mjs} +0 -0
  66. package/{esm2015/src/lib/base/factories/apollo-options.factory.js → esm2020/src/lib/base/factories/apollo-options.factory.mjs} +0 -0
  67. package/esm2020/src/lib/base/guards/auth.guard.mjs +61 -0
  68. package/esm2020/src/lib/base/guards/can-deactivate.guard.mjs +16 -0
  69. package/esm2020/src/lib/base/guards/logout.guard.mjs +32 -0
  70. package/{esm2015/src/lib/base/interfaces/base-module-config.interface.js → esm2020/src/lib/base/interfaces/base-module-config.interface.mjs} +0 -0
  71. package/{esm2015/src/lib/base/interfaces/can-component-deactivate.interface.js → esm2020/src/lib/base/interfaces/can-component-deactivate.interface.mjs} +0 -0
  72. package/{esm2015/src/lib/base/interfaces/combined-filter-input.interface.js → esm2020/src/lib/base/interfaces/combined-filter-input.interface.mjs} +0 -0
  73. package/{esm2015/src/lib/base/interfaces/field-object.interface.js → esm2020/src/lib/base/interfaces/field-object.interface.mjs} +0 -0
  74. package/{esm2015/src/lib/base/interfaces/field.interface.js → esm2020/src/lib/base/interfaces/field.interface.mjs} +0 -0
  75. package/{esm2015/src/lib/base/interfaces/filter-input.interface.js → esm2020/src/lib/base/interfaces/filter-input.interface.mjs} +0 -0
  76. package/{esm2015/src/lib/base/interfaces/find-args.interface.js → esm2020/src/lib/base/interfaces/find-args.interface.mjs} +0 -0
  77. package/{esm2015/src/lib/base/interfaces/graphql-options.interface.js → esm2020/src/lib/base/interfaces/graphql-options.interface.mjs} +0 -0
  78. package/{esm2015/src/lib/base/interfaces/graphql-plus-options.interfacen.js → esm2020/src/lib/base/interfaces/graphql-plus-options.interfacen.mjs} +0 -0
  79. package/{esm2015/src/lib/base/interfaces/graphql-type-collection.interface.js → esm2020/src/lib/base/interfaces/graphql-type-collection.interface.mjs} +0 -0
  80. package/{esm2015/src/lib/base/interfaces/single-filter-input.interface.js → esm2020/src/lib/base/interfaces/single-filter-input.interface.mjs} +0 -0
  81. package/{esm2015/src/lib/base/interfaces/sort-input.interface.js → esm2020/src/lib/base/interfaces/sort-input.interface.mjs} +0 -0
  82. package/{esm2015/src/lib/base/lenne.tech-ng-base-src-lib-base.js → esm2020/src/lib/base/lenne.tech-ng-base-src-lib-base.mjs} +0 -0
  83. package/esm2020/src/lib/base/pipes/ellipses.pipe.mjs +22 -0
  84. package/esm2020/src/lib/base/pipes/safe-html.pipe.mjs +21 -0
  85. package/{esm2015/src/lib/base/public-api.js → esm2020/src/lib/base/public-api.mjs} +0 -0
  86. package/{esm2015/src/lib/base/services/auth.service.js → esm2020/src/lib/base/services/auth.service.mjs} +14 -17
  87. package/{esm2015/src/lib/base/services/fullscreen.service.js → esm2020/src/lib/base/services/fullscreen.service.mjs} +9 -8
  88. package/esm2020/src/lib/base/services/graphql-meta.service.mjs +123 -0
  89. package/esm2020/src/lib/base/services/graphql-plus.service.mjs +84 -0
  90. package/esm2020/src/lib/base/services/graphql.service.mjs +441 -0
  91. package/esm2020/src/lib/base/services/image.service.mjs +102 -0
  92. package/esm2020/src/lib/base/services/loader.service.mjs +29 -0
  93. package/esm2020/src/lib/base/services/scroll.service.mjs +179 -0
  94. package/esm2020/src/lib/base/services/seo.service.mjs +97 -0
  95. package/esm2020/src/lib/base/services/storage.service.mjs +132 -0
  96. package/esm2020/src/lib/base/services/ws.service.mjs +17 -0
  97. package/{esm2015/src/lib/base/types/storage.type.js → esm2020/src/lib/base/types/storage.type.mjs} +0 -0
  98. package/{esm2015/src/lib/base/validators/must-match.validator.js → esm2020/src/lib/base/validators/must-match.validator.mjs} +0 -0
  99. package/fesm2015/{lenne.tech-ng-base-src-lib-base.js → lenne.tech-ng-base-src-lib-base.mjs} +238 -195
  100. package/fesm2015/lenne.tech-ng-base-src-lib-base.mjs.map +1 -0
  101. package/fesm2015/{lenne.tech-ng-base.js → lenne.tech-ng-base.mjs} +238 -195
  102. package/fesm2015/lenne.tech-ng-base.mjs.map +1 -0
  103. package/fesm2020/lenne.tech-ng-base-src-lib-base.mjs +2524 -0
  104. package/fesm2020/lenne.tech-ng-base-src-lib-base.mjs.map +1 -0
  105. package/fesm2020/lenne.tech-ng-base.mjs +2526 -0
  106. package/fesm2020/lenne.tech-ng-base.mjs.map +1 -0
  107. package/lenne.tech-ng-base.d.ts +1 -0
  108. package/lib/base/base.module.d.ts +10 -0
  109. package/lib/base/classes/graphql-meta.class.d.ts +2 -4
  110. package/lib/base/directives/context-menu.directive.d.ts +3 -0
  111. package/lib/base/directives/lazy-load.directive.d.ts +3 -0
  112. package/lib/base/directives/match-height.directive.d.ts +3 -0
  113. package/lib/base/directives/resizable.directive.d.ts +3 -0
  114. package/lib/base/guards/auth.guard.d.ts +3 -0
  115. package/lib/base/guards/can-deactivate.guard.d.ts +3 -0
  116. package/lib/base/guards/logout.guard.d.ts +3 -0
  117. package/lib/base/pipes/ellipses.pipe.d.ts +3 -0
  118. package/lib/base/pipes/safe-html.pipe.d.ts +3 -0
  119. package/lib/base/services/auth.service.d.ts +3 -0
  120. package/lib/base/services/fullscreen.service.d.ts +3 -0
  121. package/lib/base/services/graphql-meta.service.d.ts +3 -0
  122. package/lib/base/services/graphql-plus.service.d.ts +3 -0
  123. package/lib/base/services/graphql.service.d.ts +3 -0
  124. package/lib/base/services/image.service.d.ts +3 -0
  125. package/lib/base/services/loader.service.d.ts +3 -0
  126. package/lib/base/services/scroll.service.d.ts +3 -0
  127. package/lib/base/services/seo.service.d.ts +3 -0
  128. package/lib/base/services/storage.service.d.ts +3 -0
  129. package/lib/base/services/ws.service.d.ts +3 -0
  130. package/package.json +34 -14
  131. package/src/lib/base/base.module.d.ts +10 -0
  132. package/src/lib/base/classes/graphql-meta.class.d.ts +2 -4
  133. package/src/lib/base/directives/context-menu.directive.d.ts +3 -0
  134. package/src/lib/base/directives/lazy-load.directive.d.ts +3 -0
  135. package/src/lib/base/directives/match-height.directive.d.ts +3 -0
  136. package/src/lib/base/directives/resizable.directive.d.ts +3 -0
  137. package/src/lib/base/guards/auth.guard.d.ts +3 -0
  138. package/src/lib/base/guards/can-deactivate.guard.d.ts +3 -0
  139. package/src/lib/base/guards/logout.guard.d.ts +3 -0
  140. package/src/lib/base/lenne.tech-ng-base-src-lib-base.d.ts +1 -0
  141. package/src/lib/base/package.json +5 -6
  142. package/src/lib/base/pipes/ellipses.pipe.d.ts +3 -0
  143. package/src/lib/base/pipes/safe-html.pipe.d.ts +3 -0
  144. package/src/lib/base/services/auth.service.d.ts +3 -0
  145. package/src/lib/base/services/fullscreen.service.d.ts +3 -0
  146. package/src/lib/base/services/graphql-meta.service.d.ts +3 -0
  147. package/src/lib/base/services/graphql-plus.service.d.ts +3 -0
  148. package/src/lib/base/services/graphql.service.d.ts +3 -0
  149. package/src/lib/base/services/image.service.d.ts +3 -0
  150. package/src/lib/base/services/loader.service.d.ts +3 -0
  151. package/src/lib/base/services/scroll.service.d.ts +3 -0
  152. package/src/lib/base/services/seo.service.d.ts +3 -0
  153. package/src/lib/base/services/storage.service.d.ts +3 -0
  154. package/src/lib/base/services/ws.service.d.ts +3 -0
  155. package/bundles/lenne.tech-ng-base-src-lib-base.umd.js +0 -3152
  156. package/bundles/lenne.tech-ng-base-src-lib-base.umd.js.map +0 -1
  157. package/bundles/lenne.tech-ng-base.umd.js +0 -3154
  158. package/bundles/lenne.tech-ng-base.umd.js.map +0 -1
  159. package/esm2015/lib/base/base.module.js +0 -66
  160. package/esm2015/lib/base/classes/graphql-meta.class.js +0 -156
  161. package/esm2015/lib/base/classes/helper.class.js +0 -290
  162. package/esm2015/lib/base/directives/context-menu.directive.js +0 -104
  163. package/esm2015/lib/base/directives/lazy-load.directive.js +0 -43
  164. package/esm2015/lib/base/directives/match-height.directive.js +0 -78
  165. package/esm2015/lib/base/directives/resizable.directive.js +0 -89
  166. package/esm2015/lib/base/guards/auth.guard.js +0 -61
  167. package/esm2015/lib/base/guards/can-deactivate.guard.js +0 -13
  168. package/esm2015/lib/base/guards/logout.guard.js +0 -33
  169. package/esm2015/lib/base/pipes/ellipses.pipe.js +0 -18
  170. package/esm2015/lib/base/pipes/safe-html.pipe.js +0 -20
  171. package/esm2015/lib/base/services/graphql-meta.service.js +0 -116
  172. package/esm2015/lib/base/services/graphql-plus.service.js +0 -90
  173. package/esm2015/lib/base/services/graphql.service.js +0 -423
  174. package/esm2015/lib/base/services/image.service.js +0 -99
  175. package/esm2015/lib/base/services/loader.service.js +0 -27
  176. package/esm2015/lib/base/services/scroll.service.js +0 -172
  177. package/esm2015/lib/base/services/seo.service.js +0 -100
  178. package/esm2015/lib/base/services/storage.service.js +0 -131
  179. package/esm2015/lib/base/services/ws.service.js +0 -16
  180. package/esm2015/src/lib/base/classes/graphql-meta.class.js +0 -156
  181. package/esm2015/src/lib/base/classes/helper.class.js +0 -290
  182. package/esm2015/src/lib/base/directives/context-menu.directive.js +0 -104
  183. package/esm2015/src/lib/base/directives/lazy-load.directive.js +0 -43
  184. package/esm2015/src/lib/base/directives/match-height.directive.js +0 -78
  185. package/esm2015/src/lib/base/directives/resizable.directive.js +0 -89
  186. package/esm2015/src/lib/base/guards/auth.guard.js +0 -61
  187. package/esm2015/src/lib/base/guards/can-deactivate.guard.js +0 -13
  188. package/esm2015/src/lib/base/guards/logout.guard.js +0 -33
  189. package/esm2015/src/lib/base/pipes/ellipses.pipe.js +0 -18
  190. package/esm2015/src/lib/base/pipes/safe-html.pipe.js +0 -20
  191. package/esm2015/src/lib/base/services/graphql-meta.service.js +0 -116
  192. package/esm2015/src/lib/base/services/graphql-plus.service.js +0 -90
  193. package/esm2015/src/lib/base/services/graphql.service.js +0 -423
  194. package/esm2015/src/lib/base/services/image.service.js +0 -99
  195. package/esm2015/src/lib/base/services/loader.service.js +0 -27
  196. package/esm2015/src/lib/base/services/scroll.service.js +0 -172
  197. package/esm2015/src/lib/base/services/seo.service.js +0 -100
  198. package/esm2015/src/lib/base/services/storage.service.js +0 -131
  199. package/esm2015/src/lib/base/services/ws.service.js +0 -16
  200. package/fesm2015/lenne.tech-ng-base-src-lib-base.js.map +0 -1
  201. package/fesm2015/lenne.tech-ng-base.js.map +0 -1
  202. package/lenne.tech-ng-base.metadata.json +0 -1
  203. package/src/lib/base/lenne.tech-ng-base-src-lib-base.metadata.json +0 -1
@@ -1,3154 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('apollo-angular'), require('apollo-angular/http'), require('@angular/core'), require('rxjs'), require('@apollo/client/core'), require('@apollo/client/cache'), require('@apollo/client/link/ws'), require('@apollo/client/utilities'), require('@angular/common'), require('@angular/platform-browser'), require('@angular/router'), require('graphql'), require('rxjs/operators')) :
3
- typeof define === 'function' && define.amd ? define('@lenne.tech/ng-base', ['exports', 'apollo-angular', 'apollo-angular/http', '@angular/core', 'rxjs', '@apollo/client/core', '@apollo/client/cache', '@apollo/client/link/ws', '@apollo/client/utilities', '@angular/common', '@angular/platform-browser', '@angular/router', 'graphql', 'rxjs/operators'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.lenne = global.lenne || {}, global.lenne.tech = global.lenne.tech || {}, global.lenne.tech["ng-base"] = {}), global.i1$1, global.http, global.ng.core, global.rxjs, global.core, global.cache, global.ws, global.utilities, global.ng.common, global.ng.platformBrowser, global.ng.router, global.graphql, global.rxjs.operators));
5
- })(this, (function (exports, i1$1, http, i0, rxjs, core, cache, ws, utilities, common, i1, i1$2, graphql, operators) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1$1);
26
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
27
- var i1__namespace$2 = /*#__PURE__*/_interopNamespace(i1);
28
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$2);
29
-
30
- var BASE_MODULE_CONFIG = new i0.InjectionToken('BASE_MODULE_CONFIG');
31
-
32
- /*! *****************************************************************************
33
- Copyright (c) Microsoft Corporation.
34
-
35
- Permission to use, copy, modify, and/or distribute this software for any
36
- purpose with or without fee is hereby granted.
37
-
38
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
- PERFORMANCE OF THIS SOFTWARE.
45
- ***************************************************************************** */
46
- /* global Reflect, Promise */
47
- var extendStatics = function (d, b) {
48
- extendStatics = Object.setPrototypeOf ||
49
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
50
- function (d, b) { for (var p in b)
51
- if (Object.prototype.hasOwnProperty.call(b, p))
52
- d[p] = b[p]; };
53
- return extendStatics(d, b);
54
- };
55
- function __extends(d, b) {
56
- if (typeof b !== "function" && b !== null)
57
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
58
- extendStatics(d, b);
59
- function __() { this.constructor = d; }
60
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
61
- }
62
- var __assign = function () {
63
- __assign = Object.assign || function __assign(t) {
64
- for (var s, i = 1, n = arguments.length; i < n; i++) {
65
- s = arguments[i];
66
- for (var p in s)
67
- if (Object.prototype.hasOwnProperty.call(s, p))
68
- t[p] = s[p];
69
- }
70
- return t;
71
- };
72
- return __assign.apply(this, arguments);
73
- };
74
- function __rest(s, e) {
75
- var t = {};
76
- for (var p in s)
77
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
78
- t[p] = s[p];
79
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
80
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
81
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
82
- t[p[i]] = s[p[i]];
83
- }
84
- return t;
85
- }
86
- function __decorate(decorators, target, key, desc) {
87
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
88
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
89
- r = Reflect.decorate(decorators, target, key, desc);
90
- else
91
- for (var i = decorators.length - 1; i >= 0; i--)
92
- if (d = decorators[i])
93
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
94
- return c > 3 && r && Object.defineProperty(target, key, r), r;
95
- }
96
- function __param(paramIndex, decorator) {
97
- return function (target, key) { decorator(target, key, paramIndex); };
98
- }
99
- function __metadata(metadataKey, metadataValue) {
100
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
101
- return Reflect.metadata(metadataKey, metadataValue);
102
- }
103
- function __awaiter(thisArg, _arguments, P, generator) {
104
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
105
- return new (P || (P = Promise))(function (resolve, reject) {
106
- function fulfilled(value) { try {
107
- step(generator.next(value));
108
- }
109
- catch (e) {
110
- reject(e);
111
- } }
112
- function rejected(value) { try {
113
- step(generator["throw"](value));
114
- }
115
- catch (e) {
116
- reject(e);
117
- } }
118
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
119
- step((generator = generator.apply(thisArg, _arguments || [])).next());
120
- });
121
- }
122
- function __generator(thisArg, body) {
123
- var _ = { label: 0, sent: function () { if (t[0] & 1)
124
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
125
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
126
- function verb(n) { return function (v) { return step([n, v]); }; }
127
- function step(op) {
128
- if (f)
129
- throw new TypeError("Generator is already executing.");
130
- while (_)
131
- try {
132
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
133
- return t;
134
- if (y = 0, t)
135
- op = [op[0] & 2, t.value];
136
- switch (op[0]) {
137
- case 0:
138
- case 1:
139
- t = op;
140
- break;
141
- case 4:
142
- _.label++;
143
- return { value: op[1], done: false };
144
- case 5:
145
- _.label++;
146
- y = op[1];
147
- op = [0];
148
- continue;
149
- case 7:
150
- op = _.ops.pop();
151
- _.trys.pop();
152
- continue;
153
- default:
154
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
155
- _ = 0;
156
- continue;
157
- }
158
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
159
- _.label = op[1];
160
- break;
161
- }
162
- if (op[0] === 6 && _.label < t[1]) {
163
- _.label = t[1];
164
- t = op;
165
- break;
166
- }
167
- if (t && _.label < t[2]) {
168
- _.label = t[2];
169
- _.ops.push(op);
170
- break;
171
- }
172
- if (t[2])
173
- _.ops.pop();
174
- _.trys.pop();
175
- continue;
176
- }
177
- op = body.call(thisArg, _);
178
- }
179
- catch (e) {
180
- op = [6, e];
181
- y = 0;
182
- }
183
- finally {
184
- f = t = 0;
185
- }
186
- if (op[0] & 5)
187
- throw op[1];
188
- return { value: op[0] ? op[1] : void 0, done: true };
189
- }
190
- }
191
- var __createBinding = Object.create ? (function (o, m, k, k2) {
192
- if (k2 === undefined)
193
- k2 = k;
194
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
195
- }) : (function (o, m, k, k2) {
196
- if (k2 === undefined)
197
- k2 = k;
198
- o[k2] = m[k];
199
- });
200
- function __exportStar(m, o) {
201
- for (var p in m)
202
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
203
- __createBinding(o, m, p);
204
- }
205
- function __values(o) {
206
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
207
- if (m)
208
- return m.call(o);
209
- if (o && typeof o.length === "number")
210
- return {
211
- next: function () {
212
- if (o && i >= o.length)
213
- o = void 0;
214
- return { value: o && o[i++], done: !o };
215
- }
216
- };
217
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
218
- }
219
- function __read(o, n) {
220
- var m = typeof Symbol === "function" && o[Symbol.iterator];
221
- if (!m)
222
- return o;
223
- var i = m.call(o), r, ar = [], e;
224
- try {
225
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
226
- ar.push(r.value);
227
- }
228
- catch (error) {
229
- e = { error: error };
230
- }
231
- finally {
232
- try {
233
- if (r && !r.done && (m = i["return"]))
234
- m.call(i);
235
- }
236
- finally {
237
- if (e)
238
- throw e.error;
239
- }
240
- }
241
- return ar;
242
- }
243
- /** @deprecated */
244
- function __spread() {
245
- for (var ar = [], i = 0; i < arguments.length; i++)
246
- ar = ar.concat(__read(arguments[i]));
247
- return ar;
248
- }
249
- /** @deprecated */
250
- function __spreadArrays() {
251
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
252
- s += arguments[i].length;
253
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
254
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
255
- r[k] = a[j];
256
- return r;
257
- }
258
- function __spreadArray(to, from, pack) {
259
- if (pack || arguments.length === 2)
260
- for (var i = 0, l = from.length, ar; i < l; i++) {
261
- if (ar || !(i in from)) {
262
- if (!ar)
263
- ar = Array.prototype.slice.call(from, 0, i);
264
- ar[i] = from[i];
265
- }
266
- }
267
- return to.concat(ar || Array.prototype.slice.call(from));
268
- }
269
- function __await(v) {
270
- return this instanceof __await ? (this.v = v, this) : new __await(v);
271
- }
272
- function __asyncGenerator(thisArg, _arguments, generator) {
273
- if (!Symbol.asyncIterator)
274
- throw new TypeError("Symbol.asyncIterator is not defined.");
275
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
276
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
277
- function verb(n) { if (g[n])
278
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
279
- function resume(n, v) { try {
280
- step(g[n](v));
281
- }
282
- catch (e) {
283
- settle(q[0][3], e);
284
- } }
285
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
286
- function fulfill(value) { resume("next", value); }
287
- function reject(value) { resume("throw", value); }
288
- function settle(f, v) { if (f(v), q.shift(), q.length)
289
- resume(q[0][0], q[0][1]); }
290
- }
291
- function __asyncDelegator(o) {
292
- var i, p;
293
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
294
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
295
- }
296
- function __asyncValues(o) {
297
- if (!Symbol.asyncIterator)
298
- throw new TypeError("Symbol.asyncIterator is not defined.");
299
- var m = o[Symbol.asyncIterator], i;
300
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
301
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
302
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
303
- }
304
- function __makeTemplateObject(cooked, raw) {
305
- if (Object.defineProperty) {
306
- Object.defineProperty(cooked, "raw", { value: raw });
307
- }
308
- else {
309
- cooked.raw = raw;
310
- }
311
- return cooked;
312
- }
313
- ;
314
- var __setModuleDefault = Object.create ? (function (o, v) {
315
- Object.defineProperty(o, "default", { enumerable: true, value: v });
316
- }) : function (o, v) {
317
- o["default"] = v;
318
- };
319
- function __importStar(mod) {
320
- if (mod && mod.__esModule)
321
- return mod;
322
- var result = {};
323
- if (mod != null)
324
- for (var k in mod)
325
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
326
- __createBinding(result, mod, k);
327
- __setModuleDefault(result, mod);
328
- return result;
329
- }
330
- function __importDefault(mod) {
331
- return (mod && mod.__esModule) ? mod : { default: mod };
332
- }
333
- function __classPrivateFieldGet(receiver, state, kind, f) {
334
- if (kind === "a" && !f)
335
- throw new TypeError("Private accessor was defined without a getter");
336
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
337
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
338
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
339
- }
340
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
341
- if (kind === "m")
342
- throw new TypeError("Private method is not writable");
343
- if (kind === "a" && !f)
344
- throw new TypeError("Private accessor was defined without a setter");
345
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
346
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
347
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
348
- }
349
-
350
- /**
351
- * Storage service for local data storage
352
- */
353
- var StorageService = /** @class */ (function () {
354
- /**
355
- * Initializations
356
- */
357
- function StorageService(moduleConfig) {
358
- this.moduleConfig = moduleConfig;
359
- /**
360
- * Storage
361
- */
362
- this.storage = null;
363
- /**
364
- * Prefix for storage keys
365
- */
366
- this.prefix = '';
367
- // Set storage
368
- var type = moduleConfig.storageType ? moduleConfig.storageType : 'local';
369
- if (window[type + 'Storage']) {
370
- this.storage = window[type + 'Storage'];
371
- }
372
- // Set prefix
373
- this.prefix = '';
374
- if (moduleConfig.prefix) {
375
- this.prefix += moduleConfig.prefix + '_';
376
- }
377
- if (moduleConfig.version) {
378
- this.prefix += moduleConfig.version + '_';
379
- }
380
- }
381
- /**
382
- * Save itemKeys
383
- *
384
- * If you want to save one item, use itemKeys and value parameters like these:
385
- * save('KEY_OF_THE_ITEM', ITEM)
386
- *
387
- * If you want to save multiple items, use itemKeys only (value parameter will be ignored):
388
- * save({'KEY_OF_ITEM_1': ITEM_1, 'KEY_OF_ITEM_2': ITEM_2, ...})
389
- */
390
- StorageService.prototype.save = function (itemKeys, value) {
391
- var e_1, _a;
392
- // Check local storage
393
- if (!this.storage) {
394
- return false;
395
- }
396
- // Check item keys and value
397
- if (!itemKeys ||
398
- (typeof itemKeys === 'object' && !Object.keys(itemKeys).length) ||
399
- (typeof itemKeys === 'string' && value === undefined)) {
400
- return false;
401
- }
402
- if (typeof itemKeys === 'object') {
403
- try {
404
- for (var _b = __values(Object.entries(itemKeys)), _c = _b.next(); !_c.done; _c = _b.next()) {
405
- var _d = __read(_c.value, 2), itemKey = _d[0], itemValue = _d[1];
406
- this.storage.setItem(this.prefix + itemKey, JSON.stringify(itemValue));
407
- }
408
- }
409
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
410
- finally {
411
- try {
412
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
413
- }
414
- finally { if (e_1) throw e_1.error; }
415
- }
416
- return true;
417
- }
418
- this.storage.setItem(this.prefix + itemKeys, JSON.stringify(value));
419
- return true;
420
- };
421
- /**
422
- * Load items via key(s)
423
- */
424
- StorageService.prototype.load = function (itemKeys) {
425
- var _this = this;
426
- // Check local storage
427
- if (!this.storage) {
428
- return;
429
- }
430
- // Check item keys
431
- if (!itemKeys || (Array.isArray(itemKeys) && !itemKeys.length)) {
432
- return null;
433
- }
434
- if (Array.isArray(itemKeys)) {
435
- var back_1 = {};
436
- itemKeys.forEach(function (itemKey) {
437
- var loadedItem = _this.storage.getItem(_this.prefix + itemKey);
438
- if (loadedItem) {
439
- back_1[itemKey] = JSON.parse(loadedItem);
440
- }
441
- else {
442
- back_1[itemKey] = null;
443
- }
444
- });
445
- return back_1;
446
- }
447
- var value = this.storage.getItem(this.prefix + itemKeys);
448
- if (value) {
449
- value = JSON.parse(value);
450
- }
451
- return value;
452
- };
453
- /**
454
- * Remove item from storage
455
- *
456
- * @param itemKeys keys or key to remove
457
- */
458
- StorageService.prototype.remove = function (itemKeys) {
459
- var _this = this;
460
- // Check local storage
461
- if (!this.storage) {
462
- return false;
463
- }
464
- if (Array.isArray(itemKeys)) {
465
- itemKeys.forEach(function (key) {
466
- _this.storage.removeItem(_this.prefix + key);
467
- });
468
- return true;
469
- }
470
- this.storage.removeItem(this.prefix + itemKeys);
471
- return true;
472
- };
473
- /**
474
- * Clear local storage
475
- */
476
- StorageService.prototype.reset = function () {
477
- this.storage.clear();
478
- };
479
- return StorageService;
480
- }());
481
- StorageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function StorageService_Factory() { return new StorageService(i0__namespace.ɵɵinject(BASE_MODULE_CONFIG)); }, token: StorageService, providedIn: "root" });
482
- StorageService.decorators = [
483
- { type: i0.Injectable, args: [{
484
- providedIn: 'root',
485
- },] }
486
- ];
487
- StorageService.ctorParameters = function () { return [
488
- { type: undefined, decorators: [{ type: i0.Inject, args: [BASE_MODULE_CONFIG,] }] }
489
- ]; };
490
-
491
- var WsService = /** @class */ (function () {
492
- function WsService() {
493
- }
494
- WsService.prototype.reconnect = function () {
495
- var _a, _b;
496
- (_a = this.client) === null || _a === void 0 ? void 0 : _a.close();
497
- (_b = this.client) === null || _b === void 0 ? void 0 : _b.connect();
498
- };
499
- return WsService;
500
- }());
501
- WsService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function WsService_Factory() { return new WsService(); }, token: WsService, providedIn: "root" });
502
- WsService.decorators = [
503
- { type: i0.Injectable, args: [{
504
- providedIn: 'root',
505
- },] }
506
- ];
507
-
508
- /**
509
- * Authentication service
510
- */
511
- var AuthService = /** @class */ (function () {
512
- /**
513
- * Constructor
514
- */
515
- function AuthService(moduleConfig, storageService, wsService) {
516
- this.moduleConfig = moduleConfig;
517
- this.storageService = storageService;
518
- this.wsService = wsService;
519
- // Subjects
520
- this._currentUser = new rxjs.BehaviorSubject(null);
521
- this._token = new rxjs.BehaviorSubject(null);
522
- this.token = this.storageService.load('token');
523
- this.currentUser = this.storageService.load('currentUser');
524
- }
525
- /**
526
- * Logout
527
- */
528
- AuthService.prototype.logout = function () {
529
- this.storageService.remove(['token', 'currentUser']);
530
- this.currentUser = null;
531
- this.token = null;
532
- };
533
- Object.defineProperty(AuthService.prototype, "currentUser", {
534
- // #################################################################
535
- // Current User
536
- // #################################################################
537
- get: function () {
538
- return this._currentUser.value;
539
- },
540
- set: function (user) {
541
- this._currentUser.next(user);
542
- this.storageService.save('currentUser', user);
543
- },
544
- enumerable: false,
545
- configurable: true
546
- });
547
- Object.defineProperty(AuthService.prototype, "currentUserObservable", {
548
- get: function () {
549
- return this._currentUser.asObservable();
550
- },
551
- enumerable: false,
552
- configurable: true
553
- });
554
- Object.defineProperty(AuthService.prototype, "token", {
555
- // #################################################################
556
- // Token
557
- // #################################################################
558
- get: function () {
559
- return this._token.value;
560
- },
561
- set: function (token) {
562
- this._token.next(token);
563
- this.storageService.save('token', token);
564
- this.wsService.reconnect();
565
- },
566
- enumerable: false,
567
- configurable: true
568
- });
569
- Object.defineProperty(AuthService.prototype, "tokenObservable", {
570
- get: function () {
571
- return this._token.asObservable();
572
- },
573
- enumerable: false,
574
- configurable: true
575
- });
576
- return AuthService;
577
- }());
578
- AuthService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function AuthService_Factory() { return new AuthService(i0__namespace.ɵɵinject(BASE_MODULE_CONFIG), i0__namespace.ɵɵinject(StorageService), i0__namespace.ɵɵinject(WsService)); }, token: AuthService, providedIn: "root" });
579
- AuthService.decorators = [
580
- { type: i0.Injectable, args: [{
581
- providedIn: 'root',
582
- },] }
583
- ];
584
- AuthService.ctorParameters = function () { return [
585
- { type: undefined, decorators: [{ type: i0.Inject, args: [BASE_MODULE_CONFIG,] }] },
586
- { type: StorageService },
587
- { type: WsService }
588
- ]; };
589
-
590
- /**
591
- * Factory for apollo-angular options
592
- */
593
- function apolloOptionsFactory(baseModuleConfig, httpLink, authService, wsService) {
594
- var links = [];
595
- var defaultUrl = 'api.' + window.location.href + '/graphql';
596
- var http = httpLink.create({
597
- uri: baseModuleConfig.apiUrl ? baseModuleConfig.apiUrl : 'https://' + defaultUrl,
598
- });
599
- var authMiddleware = new core.ApolloLink(function (operation, forward) {
600
- var headers = {};
601
- if (localStorage) {
602
- var token = authService.token || null;
603
- if (token) {
604
- headers.Authorization = 'Bearer ' + token;
605
- }
606
- operation.setContext(function () { return ({ headers: headers }); });
607
- }
608
- return forward(operation);
609
- });
610
- if (baseModuleConfig.wsUrl) {
611
- var wsLink = new ws.WebSocketLink({
612
- uri: baseModuleConfig.wsUrl,
613
- options: {
614
- reconnect: true,
615
- connectionParams: function () { return ({
616
- Authorization: authService.token ? 'Bearer ' + authService.token : undefined,
617
- }); },
618
- },
619
- });
620
- // Set client for reconnection on logout/login
621
- wsService.client = wsLink.subscriptionClient;
622
- // using the ability to split links, you can send data to each link
623
- // depending on what kind of operation is being sent
624
- links.push(core.split(
625
- // split based on operation type
626
- function (_a) {
627
- var query = _a.query;
628
- // @ts-ignore
629
- var _b = utilities.getMainDefinition(query), kind = _b.kind, operation = _b.operation;
630
- return kind === 'OperationDefinition' && operation === 'subscription';
631
- }, wsLink, core.concat(authMiddleware, http)));
632
- }
633
- else {
634
- links.push(http);
635
- links.push(authMiddleware);
636
- }
637
- return {
638
- link: core.ApolloLink.from(links),
639
- cache: new cache.InMemoryCache(),
640
- defaultOptions: {
641
- query: {
642
- fetchPolicy: 'network-only',
643
- },
644
- },
645
- };
646
- }
647
-
648
- /**
649
- * Directive vor context menu
650
- * See https://stackblitz.com/edit/angular-custom-context-menu
651
- */
652
- var ContextMenuDirective = /** @class */ (function () {
653
- function ContextMenuDirective(el) {
654
- this.el = el;
655
- this.xGap = 0;
656
- this.yGap = 0;
657
- this.overflowSpace = 10;
658
- this.selectors = '*';
659
- this.clickedElement = null;
660
- this.previousDisplayStatus = null;
661
- }
662
- ContextMenuDirective.prototype.ngOnInit = function () {
663
- var _this = this;
664
- if (this.ltContextMenu) {
665
- this.previousDisplayStatus = this.ltContextMenu.style.display;
666
- }
667
- // Add a click listener to the window,
668
- // so that we can close the context menu on left click
669
- window.addEventListener('click', function () {
670
- _this.showContextMenu(null, false);
671
- });
672
- // Close context menu when escape is pressed
673
- window.addEventListener('keydown', function (e) {
674
- if (e.code === 'Escape') {
675
- _this.showContextMenu(null, false);
676
- }
677
- });
678
- // Add an event listener to listen to the 'contextmenu' event
679
- this.el.nativeElement.addEventListener('contextmenu', function (e) {
680
- // Prevent the default context menu to popup
681
- if (e.preventDefault) {
682
- e.preventDefault();
683
- }
684
- // Shows our own context menu
685
- _this.showContextMenu(e, true);
686
- });
687
- };
688
- // Shows or hides our custom context menu, which is specified as a input
689
- ContextMenuDirective.prototype.showContextMenu = function (event, show) {
690
- var _this = this;
691
- var _a;
692
- var cm = this.ltContextMenu;
693
- if (cm) {
694
- // Try to open context menu
695
- if (show && event && event instanceof MouseEvent) {
696
- // Get valid clicked structureElement
697
- var clickedElement = (_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.closest(this.selectors);
698
- if (clickedElement) {
699
- // Set clicked structureElement
700
- this.clickedElement = clickedElement;
701
- setTimeout(function () {
702
- // Set display status
703
- cm.style.display = 'block';
704
- // Calculate top position
705
- var top = event.y + _this.yGap;
706
- if (top + cm.offsetHeight + 10 > document.documentElement.clientHeight) {
707
- top = document.documentElement.clientHeight - cm.offsetHeight - _this.overflowSpace;
708
- }
709
- // Calculate left position
710
- var left = event.x + _this.xGap;
711
- if (left + cm.offsetWidth + 10 > document.documentElement.clientWidth) {
712
- left = document.documentElement.clientWidth - cm.offsetWidth - _this.overflowSpace;
713
- }
714
- // Set position
715
- cm.style.top = top + 'px';
716
- cm.style.left = left + 'px';
717
- // Show
718
- cm.style.opacity = '1.0';
719
- cm.style['pointer-events'] = 'auto';
720
- }, 1);
721
- return;
722
- }
723
- }
724
- // Close context menu
725
- this.clickedElement = null;
726
- if (this.previousDisplayStatus) {
727
- cm.style.display = this.previousDisplayStatus;
728
- }
729
- cm.style.opacity = '0.01';
730
- cm.style['pointer-events'] = 'none';
731
- }
732
- };
733
- return ContextMenuDirective;
734
- }());
735
- ContextMenuDirective.decorators = [
736
- { type: i0.Directive, args: [{
737
- selector: '[ltContextMenu]',
738
- exportAs: 'contextMenuData',
739
- },] }
740
- ];
741
- ContextMenuDirective.ctorParameters = function () { return [
742
- { type: i0.ElementRef }
743
- ]; };
744
- ContextMenuDirective.propDecorators = {
745
- contextMenuData: [{ type: i0.Input }],
746
- ltContextMenu: [{ type: i0.Input }],
747
- xGap: [{ type: i0.Input }],
748
- yGap: [{ type: i0.Input }],
749
- overflowSpace: [{ type: i0.Input }],
750
- selectors: [{ type: i0.Input }],
751
- clickedElement: [{ type: i0.Output }]
752
- };
753
-
754
- /**
755
- * Directive for lazy loading images
756
- */
757
- var LazyLoadDirective = /** @class */ (function () {
758
- function LazyLoadDirective(el) {
759
- this.el = el;
760
- this.srcAttr = null;
761
- }
762
- LazyLoadDirective.prototype.ngAfterViewInit = function () {
763
- this.canLazyLoad() ? this.lazyLoadImage() : this.loadImage();
764
- };
765
- LazyLoadDirective.prototype.canLazyLoad = function () {
766
- return window && 'IntersectionObserver' in window;
767
- };
768
- LazyLoadDirective.prototype.lazyLoadImage = function () {
769
- var _this = this;
770
- var obs = new IntersectionObserver(function (entries) {
771
- entries.forEach(function (_a) {
772
- var isIntersecting = _a.isIntersecting;
773
- if (isIntersecting) {
774
- _this.loadImage();
775
- obs.unobserve(_this.el.nativeElement);
776
- }
777
- });
778
- });
779
- obs.observe(this.el.nativeElement);
780
- };
781
- LazyLoadDirective.prototype.loadImage = function () {
782
- this.srcAttr = this.src;
783
- };
784
- return LazyLoadDirective;
785
- }());
786
- LazyLoadDirective.decorators = [
787
- { type: i0.Directive, args: [{
788
- selector: 'img[ltLazyLoad]',
789
- },] }
790
- ];
791
- LazyLoadDirective.ctorParameters = function () { return [
792
- { type: i0.ElementRef }
793
- ]; };
794
- LazyLoadDirective.propDecorators = {
795
- srcAttr: [{ type: i0.HostBinding, args: ['attr.src',] }],
796
- src: [{ type: i0.Input }]
797
- };
798
-
799
- /**
800
- * Helper class
801
- */
802
- var Helper = /** @class */ (function () {
803
- function Helper() {
804
- }
805
- /**
806
- * Simple filter function for plain objects
807
- */
808
- Helper.filter = function (objects, filter) {
809
- return ((objects === null || objects === void 0 ? void 0 : objects.filter(function (element) {
810
- var e_1, _d, e_2, _e;
811
- try {
812
- for (var _f = __values(Object.entries(filter)), _g = _f.next(); !_g.done; _g = _f.next()) {
813
- var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
814
- if (Array.isArray(element[key])) {
815
- try {
816
- for (var _j = (e_2 = void 0, __values(element[key])), _k = _j.next(); !_k.done; _k = _j.next()) {
817
- var item = _k.value;
818
- if (!element[key].includs(value)) {
819
- return false;
820
- }
821
- }
822
- }
823
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
824
- finally {
825
- try {
826
- if (_k && !_k.done && (_e = _j.return)) _e.call(_j);
827
- }
828
- finally { if (e_2) throw e_2.error; }
829
- }
830
- }
831
- else if (element[key] !== value) {
832
- return false;
833
- }
834
- }
835
- }
836
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
837
- finally {
838
- try {
839
- if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
840
- }
841
- finally { if (e_1) throw e_1.error; }
842
- }
843
- return true;
844
- })) || []);
845
- };
846
- /**
847
- * Convert to a url/uri conform string
848
- * Only:
849
- * - lower case
850
- * - chars, numbers and hyphens
851
- */
852
- Helper.urlString = function (str, options) {
853
- if (options === void 0) { options = {}; }
854
- // Config
855
- var config = Object.assign({ allowAll: false }, options);
856
- // To string
857
- str = str + '';
858
- // Trim
859
- str = str.trim();
860
- // Lower case
861
- str = str.toLowerCase();
862
- if (!config.allowAll) {
863
- // Replace spaces
864
- str = str.trim().replace(/\s+/g, '-');
865
- // Replace some special chars
866
- str = str.replace('ä', 'ae');
867
- str = str.replace('ö', 'oe');
868
- str = str.replace('ü', 'ue');
869
- str = str.replace('ß', 'ss');
870
- // Remove other special chars
871
- str = str.replace(/[^a-zA-Z0-9-]/g, '');
872
- }
873
- // Return url conform string
874
- return encodeURI(str);
875
- };
876
- /**
877
- * Simple map function
878
- */
879
- Helper.map = function (source, target, options) {
880
- var e_3, _d;
881
- if (options === void 0) { options = {}; }
882
- // Set config
883
- var config = Object.assign({ funcAllowed: false, dateStringToDate: true }, options);
884
- // Check source
885
- if (!source || typeof source !== 'object' || Array.isArray(source)) {
886
- return target;
887
- }
888
- try {
889
- // Update properties
890
- for (var _e = __values(Object.keys(target)), _f = _e.next(); !_f.done; _f = _e.next()) {
891
- var key = _f.value;
892
- if (source[key] !== undefined && (config.funcAllowed || typeof (source[key] !== 'function'))) {
893
- if (typeof source[key] === 'string' && config.dateStringToDate) {
894
- if (Array.isArray(config.dateStringToDate)) {
895
- if (config.dateStringToDate.includes(key)) {
896
- target[key] = Helper.parseDate(source[key]);
897
- }
898
- }
899
- else {
900
- target[key] = Helper.parseDate(source[key]);
901
- }
902
- }
903
- else {
904
- target[key] = source[key];
905
- }
906
- }
907
- }
908
- }
909
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
910
- finally {
911
- try {
912
- if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
913
- }
914
- finally { if (e_3) throw e_3.error; }
915
- }
916
- // Return target
917
- return target;
918
- };
919
- /**
920
- * Create Object or Objects of specified type with specified data
921
- */
922
- Helper.maps = function (data, targetClass) {
923
- // Check data
924
- if (!data || typeof data !== 'object') {
925
- return undefined;
926
- }
927
- // Check array
928
- if (!Array.isArray(data)) {
929
- data = [data];
930
- }
931
- // Map
932
- return data.map(function (item) {
933
- return targetClass.map(item);
934
- });
935
- };
936
- /**
937
- * Get plain parameter
938
- */
939
- Helper.getPlainParameter = function (parameter) {
940
- var _a, _b, _c;
941
- if (!parameter) {
942
- return parameter;
943
- }
944
- return (_c = (_b = (_a = parameter === null || parameter === void 0 ? void 0 : parameter.split('?')) === null || _a === void 0 ? void 0 : _a.shift()) === null || _b === void 0 ? void 0 : _b.split('#')) === null || _c === void 0 ? void 0 : _c.shift();
945
- };
946
- /**
947
- * Get ID of an url parameter
948
- */
949
- Helper.getParameterId = function (parameter) {
950
- var _a;
951
- if (!parameter) {
952
- return parameter;
953
- }
954
- return (_a = Helper.getPlainParameter(parameter)) === null || _a === void 0 ? void 0 : _a.split('-').pop();
955
- };
956
- /**
957
- * Delay
958
- */
959
- Helper.delay = function (ms) {
960
- var promise = new Promise(function (resolve) { return setTimeout(resolve, ms); });
961
- return promise;
962
- };
963
- /**
964
- * Deep freeze
965
- * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze#What_is_shallow_freeze
966
- */
967
- Helper.deepFreeze = function (object, preparedObjects) {
968
- var e_4, _d;
969
- if (preparedObjects === void 0) { preparedObjects = []; }
970
- // Prevent infinit regress
971
- if (preparedObjects.includes(object)) {
972
- return object;
973
- }
974
- preparedObjects.push(object);
975
- // Retrieve the property names defined on object
976
- var propNames = Object.getOwnPropertyNames(object);
977
- try {
978
- // Freeze properties before freezing self
979
- for (var propNames_1 = __values(propNames), propNames_1_1 = propNames_1.next(); !propNames_1_1.done; propNames_1_1 = propNames_1.next()) {
980
- var name = propNames_1_1.value;
981
- var value = object[name];
982
- if (value && typeof value === 'object') {
983
- Helper.deepFreeze(value, preparedObjects);
984
- }
985
- }
986
- }
987
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
988
- finally {
989
- try {
990
- if (propNames_1_1 && !propNames_1_1.done && (_d = propNames_1.return)) _d.call(propNames_1);
991
- }
992
- finally { if (e_4) throw e_4.error; }
993
- }
994
- return Object.freeze(object);
995
- };
996
- /**
997
- * Generates an unique identifier with 24 characters
998
- */
999
- Helper.getUID = function () {
1000
- var dt = new Date().getTime();
1001
- var uuid = 'xxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
1002
- // eslint-disable-next-line no-bitwise
1003
- var r = (dt + Math.random() * 16) % 16 | 0;
1004
- dt = Math.floor(dt / 16);
1005
- // eslint-disable-next-line no-bitwise
1006
- return (c === 'x' ? r : (r & 0x3) | 0x8).toString(16);
1007
- });
1008
- return uuid;
1009
- };
1010
- /**
1011
- * Parse date string to date object
1012
- */
1013
- Helper.parseDate = function (dateString) {
1014
- var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;
1015
- var reMsAjax = /^\/Date\((d|-|.*)\)[\/|\\]$/;
1016
- if (typeof dateString === 'string') {
1017
- var isoExec = reISO.exec(dateString);
1018
- if (isoExec) {
1019
- return new Date(dateString);
1020
- }
1021
- var msAjaxExec = reMsAjax.exec(dateString);
1022
- if (msAjaxExec) {
1023
- var cleaned = msAjaxExec[1].split(/[-+,.]/);
1024
- return new Date(cleaned[0] ? +cleaned[0] : 0 - +cleaned[1]);
1025
- }
1026
- }
1027
- return dateString;
1028
- };
1029
- /**
1030
- * Get browser name and version
1031
- */
1032
- Helper.getBrowser = function () {
1033
- var userAgent = navigator.userAgent;
1034
- var data = userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
1035
- var version;
1036
- if (/trident/i.test(data[1])) {
1037
- version = /\brv[ :]+(\d+)/g.exec(userAgent) || [];
1038
- return { name: 'IE', version: version[1] || '' };
1039
- }
1040
- if (data[1] === 'Chrome') {
1041
- version = userAgent.match(/\bOPR|Edge\/(\d+)/);
1042
- if (version != null) {
1043
- return { name: 'Opera', version: version[1] };
1044
- }
1045
- }
1046
- data = data[2] ? [data[1], data[2]] : [navigator.appName, navigator.appVersion, '-?'];
1047
- version = userAgent.match(/version\/(\d+)/i);
1048
- if (version !== null) {
1049
- data.splice(1, 1, version[1]);
1050
- }
1051
- return {
1052
- name: data[0],
1053
- version: data[1],
1054
- };
1055
- };
1056
- /**
1057
- * Whether first parameter is a deep subset of second parameter
1058
- * Hint: functions will be ignored
1059
- */
1060
- Helper.isSubset = function (a, b) {
1061
- var e_5, _d, e_6, _e;
1062
- // Equal
1063
- if (a === b) {
1064
- return true;
1065
- }
1066
- // Different type
1067
- if (typeof a !== typeof b) {
1068
- return false;
1069
- }
1070
- // Process array
1071
- if (Array.isArray(a)) {
1072
- try {
1073
- for (var _f = __values(Object.entries(a)), _g = _f.next(); !_g.done; _g = _f.next()) {
1074
- var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
1075
- if (Helper.isSubset(value, b[key])) {
1076
- return false;
1077
- }
1078
- }
1079
- }
1080
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1081
- finally {
1082
- try {
1083
- if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
1084
- }
1085
- finally { if (e_5) throw e_5.error; }
1086
- }
1087
- return true;
1088
- }
1089
- // Process object
1090
- if (typeof a === 'object') {
1091
- var plain = JSON.parse(JSON.stringify(a));
1092
- try {
1093
- for (var _j = __values(Object.entries(plain)), _k = _j.next(); !_k.done; _k = _j.next()) {
1094
- var _l = __read(_k.value, 2), key = _l[0], value = _l[1];
1095
- if (Helper.isSubset(value, b[key])) {
1096
- return false;
1097
- }
1098
- }
1099
- }
1100
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1101
- finally {
1102
- try {
1103
- if (_k && !_k.done && (_e = _j.return)) _e.call(_j);
1104
- }
1105
- finally { if (e_6) throw e_6.error; }
1106
- }
1107
- return true;
1108
- }
1109
- // Else
1110
- return true;
1111
- };
1112
- /**
1113
- * Whether parameters are equal (have equal properties)
1114
- * Hint: functions will be ignored
1115
- */
1116
- Helper.isEqual = function (a, b) {
1117
- return Helper.isSubset(a, b) && Helper.isSubset(b, a);
1118
- };
1119
- /**
1120
- * First level difference of two objects
1121
- * Hint: functions will be ignored and when an array or an object is different the hole array or object will used as property value
1122
- *
1123
- * @returns Record<string, any> Object with properties from first object
1124
- */
1125
- Helper.getDiff = function (a, b, clone) {
1126
- var e_7, _d;
1127
- if (clone === void 0) { clone = true; }
1128
- var result = {};
1129
- var firstObject = a;
1130
- if (clone) {
1131
- firstObject = JSON.parse(JSON.stringify(a));
1132
- }
1133
- try {
1134
- for (var _e = __values(Object.entries(firstObject)), _f = _e.next(); !_f.done; _f = _e.next()) {
1135
- var _g = __read(_f.value, 2), key = _g[0], value = _g[1];
1136
- if (!Helper.isSubset(value, b[key])) {
1137
- result[key] = value;
1138
- }
1139
- }
1140
- }
1141
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1142
- finally {
1143
- try {
1144
- if (_f && !_f.done && (_d = _e.return)) _d.call(_e);
1145
- }
1146
- finally { if (e_7) throw e_7.error; }
1147
- }
1148
- return result;
1149
- };
1150
- /**
1151
- * Check if propertie is type of HTMLCollection or NodeList
1152
- * See https://stackoverflow.com/a/7238344
1153
- *
1154
- * @param nodes
1155
- */
1156
- Helper.isNodeList = function (nodes) {
1157
- try {
1158
- var stringRepr = Object.prototype.toString.call(nodes);
1159
- return (typeof nodes === 'object' &&
1160
- /^\[object (HTMLCollection|NodeList|Object)\]$/.test(stringRepr) &&
1161
- typeof nodes.length === 'number' &&
1162
- (nodes.length === 0 || (typeof nodes[0] === 'object' && nodes[0].nodeType > 0)));
1163
- }
1164
- catch (e) {
1165
- return false;
1166
- }
1167
- };
1168
- return Helper;
1169
- }());
1170
-
1171
- /**
1172
- * Image service
1173
- */
1174
- var ImageService = /** @class */ (function () {
1175
- function ImageService() {
1176
- }
1177
- /**
1178
- * Preaload images (for lazy handling)
1179
- *
1180
- * @param options
1181
- * @protected
1182
- */
1183
- ImageService.prototype.preLoadImages = function (options) {
1184
- var _this = this;
1185
- // Init configuration
1186
- var config = Object.assign({ doneFunnction: undefined, elements: document, regExp: undefined }, options);
1187
- return new Promise(function (resolve) {
1188
- var e_1, _b;
1189
- var _a;
1190
- // Convert element(s) into array
1191
- if (!Array.isArray(config.elements)) {
1192
- // NodeList or HTMLCollection
1193
- if (Helper.isNodeList(config.elements)) {
1194
- config.elements = Array.from(config.elements);
1195
- }
1196
- // Single element
1197
- else {
1198
- config.elements = [config.elements];
1199
- }
1200
- }
1201
- // Init loading
1202
- var promises = [];
1203
- // Get all images
1204
- var images = [];
1205
- config.elements.forEach(function (element) {
1206
- images = images.concat(Array.from(element.getElementsByTagName('img')));
1207
- });
1208
- var _loop_1 = function (image) {
1209
- var src = image.getAttribute('src');
1210
- // Check if changes are necessary and possible
1211
- if ((image.complete && image.naturalHeight !== 0) || // already laoded
1212
- !src || // Image has no src
1213
- ((_a = config.regExp) === null || _a === void 0 ? void 0 : _a.test(src)) // Test if src matches regular expression
1214
- ) {
1215
- return "continue";
1216
- }
1217
- // Replace lazy loading image with immediately loading image
1218
- if (image.getAttribute('loading') === 'lazy') {
1219
- var newImage_1 = document.createElement('img');
1220
- Array.from(image.attributes).forEach(function (attr) {
1221
- if (attr.name !== 'loading' && attr.name !== 'src') {
1222
- newImage_1.setAttribute(attr.name, attr.value);
1223
- }
1224
- });
1225
- image.replaceWith(newImage_1);
1226
- image = newImage_1;
1227
- }
1228
- // Wait for laoding
1229
- promises.push(_this.loadImage(image, src));
1230
- };
1231
- try {
1232
- // Prepare images
1233
- for (var images_1 = __values(images), images_1_1 = images_1.next(); !images_1_1.done; images_1_1 = images_1.next()) {
1234
- var image = images_1_1.value;
1235
- _loop_1(image);
1236
- }
1237
- }
1238
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1239
- finally {
1240
- try {
1241
- if (images_1_1 && !images_1_1.done && (_b = images_1.return)) _b.call(images_1);
1242
- }
1243
- finally { if (e_1) throw e_1.error; }
1244
- }
1245
- // Wait until all images loaded
1246
- Promise.all(promises)
1247
- .catch(function (e) { return console.error('Error during image loading', e); })
1248
- .finally(function () { return __awaiter(_this, void 0, void 0, function () {
1249
- var result;
1250
- return __generator(this, function (_b) {
1251
- switch (_b.label) {
1252
- case 0:
1253
- if (!config.doneFunnction) return [3 /*break*/, 2];
1254
- return [4 /*yield*/, config.doneFunction()];
1255
- case 1:
1256
- result = _b.sent();
1257
- _b.label = 2;
1258
- case 2:
1259
- resolve(result);
1260
- return [2 /*return*/];
1261
- }
1262
- });
1263
- }); });
1264
- });
1265
- };
1266
- /**
1267
- * Load image for image element
1268
- *
1269
- * @param imageElement
1270
- * @param src
1271
- * @protected
1272
- */
1273
- ImageService.prototype.loadImage = function (imageElement, src) {
1274
- return __awaiter(this, void 0, void 0, function () {
1275
- return __generator(this, function (_b) {
1276
- src = src || imageElement.src;
1277
- return [2 /*return*/, new Promise(function (resolve, reject) {
1278
- imageElement.onload = function () { return resolve(imageElement); };
1279
- imageElement.onerror = reject;
1280
- imageElement.src = src;
1281
- })];
1282
- });
1283
- });
1284
- };
1285
- return ImageService;
1286
- }());
1287
- ImageService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ImageService_Factory() { return new ImageService(); }, token: ImageService, providedIn: "root" });
1288
- ImageService.decorators = [
1289
- { type: i0.Injectable, args: [{
1290
- providedIn: 'root',
1291
- },] }
1292
- ];
1293
-
1294
- /**
1295
- * Set same height (maximum) to different elements
1296
- */
1297
- var MatchHeightDirective = /** @class */ (function () {
1298
- function MatchHeightDirective(el, imageService, platformId) {
1299
- this.el = el;
1300
- this.imageService = imageService;
1301
- // Replace lazy loading images with immediate loading images
1302
- this.loadImages = true;
1303
- this.isBrowser = common.isPlatformBrowser(platformId);
1304
- }
1305
- MatchHeightDirective.prototype.onResize = function () {
1306
- this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
1307
- };
1308
- MatchHeightDirective.prototype.ngOnInit = function () {
1309
- this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
1310
- };
1311
- MatchHeightDirective.prototype.matchHeight = function (parent, target) {
1312
- return __awaiter(this, void 0, void 0, function () {
1313
- var classNames, _loop_1, this_1, classNames_1, classNames_1_1, className, e_1_1;
1314
- var e_1, _a;
1315
- return __generator(this, function (_b) {
1316
- switch (_b.label) {
1317
- case 0:
1318
- if (!parent) {
1319
- return [2 /*return*/];
1320
- }
1321
- if (!Array.isArray(target)) {
1322
- classNames = [target];
1323
- }
1324
- else {
1325
- classNames = target;
1326
- }
1327
- _loop_1 = function (className) {
1328
- var children, itemHeights, maxHeight;
1329
- return __generator(this, function (_c) {
1330
- switch (_c.label) {
1331
- case 0:
1332
- children = parent.getElementsByClassName(className);
1333
- if (!children || children.length < 2) {
1334
- return [2 /*return*/, "continue"];
1335
- }
1336
- if (!this_1.loadImages) return [3 /*break*/, 2];
1337
- return [4 /*yield*/, this_1.imageService.preLoadImages({ elements: children })];
1338
- case 1:
1339
- _c.sent();
1340
- _c.label = 2;
1341
- case 2:
1342
- // reset all children height
1343
- Array.from(children).forEach(function (element) {
1344
- element.style.height = 'initial';
1345
- });
1346
- itemHeights = Array.from(children).map(function (element) {
1347
- if (element.getBoundingClientRect) {
1348
- return element.getBoundingClientRect().height;
1349
- }
1350
- return 0;
1351
- });
1352
- maxHeight = itemHeights.reduce(function (prev, curr) { return (curr > prev ? curr : prev); }, 0);
1353
- // update the child structureElements height to the tallest one
1354
- Array.from(children).forEach(function (element) { return (element.style.height = maxHeight + "px"); });
1355
- return [2 /*return*/];
1356
- }
1357
- });
1358
- };
1359
- this_1 = this;
1360
- _b.label = 1;
1361
- case 1:
1362
- _b.trys.push([1, 6, 7, 8]);
1363
- classNames_1 = __values(classNames), classNames_1_1 = classNames_1.next();
1364
- _b.label = 2;
1365
- case 2:
1366
- if (!!classNames_1_1.done) return [3 /*break*/, 5];
1367
- className = classNames_1_1.value;
1368
- return [5 /*yield**/, _loop_1(className)];
1369
- case 3:
1370
- _b.sent();
1371
- _b.label = 4;
1372
- case 4:
1373
- classNames_1_1 = classNames_1.next();
1374
- return [3 /*break*/, 2];
1375
- case 5: return [3 /*break*/, 8];
1376
- case 6:
1377
- e_1_1 = _b.sent();
1378
- e_1 = { error: e_1_1 };
1379
- return [3 /*break*/, 8];
1380
- case 7:
1381
- try {
1382
- if (classNames_1_1 && !classNames_1_1.done && (_a = classNames_1.return)) _a.call(classNames_1);
1383
- }
1384
- finally { if (e_1) throw e_1.error; }
1385
- return [7 /*endfinally*/];
1386
- case 8: return [2 /*return*/];
1387
- }
1388
- });
1389
- });
1390
- };
1391
- return MatchHeightDirective;
1392
- }());
1393
- MatchHeightDirective.decorators = [
1394
- { type: i0.Directive, args: [{
1395
- selector: '[ltMatchHeight]',
1396
- },] }
1397
- ];
1398
- MatchHeightDirective.ctorParameters = function () { return [
1399
- { type: i0.ElementRef },
1400
- { type: ImageService },
1401
- { type: String, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] }
1402
- ]; };
1403
- MatchHeightDirective.propDecorators = {
1404
- ltMatchHeight: [{ type: i0.Input }],
1405
- loadImages: [{ type: i0.Input }],
1406
- onResize: [{ type: i0.HostListener, args: ['window:resize',] }]
1407
- };
1408
-
1409
- /**
1410
- * Reszise detection
1411
- * (inpsired by: https://stackblitz.com/edit/angular-resizable)
1412
- */
1413
- var ResizableDirective = /** @class */ (function () {
1414
- function ResizableDirective(el) {
1415
- this.el = el;
1416
- this.resizableGrabWidth = 8;
1417
- this.resizableMinWidth = 10;
1418
- this.dragging = false;
1419
- }
1420
- ResizableDirective.prototype.ngOnInit = function () {
1421
- this.addListenerToDocument();
1422
- this.addListenerToElement();
1423
- };
1424
- ResizableDirective.prototype.mouseMoveG = function (evt) {
1425
- if (!this.dragging) {
1426
- return;
1427
- }
1428
- this.newWidth(evt.clientX - this.el.nativeElement.offsetLeft);
1429
- evt.stopPropagation();
1430
- };
1431
- ResizableDirective.prototype.newWidth = function (wid) {
1432
- var result = Math.max(this.resizableMinWidth, wid);
1433
- this.el.nativeElement.style.width = result + 'px';
1434
- };
1435
- ResizableDirective.prototype.mouseDown = function (evt) {
1436
- if (this.inDragRegion(evt)) {
1437
- this.dragging = true;
1438
- this.preventGlobalMouseEvents();
1439
- evt.stopPropagation();
1440
- }
1441
- };
1442
- ResizableDirective.prototype.restoreGlobalMouseEvents = function () {
1443
- document.body.style['pointer-events'] = 'auto';
1444
- };
1445
- ResizableDirective.prototype.mouseUpG = function (evt) {
1446
- if (!this.dragging) {
1447
- return;
1448
- }
1449
- this.restoreGlobalMouseEvents();
1450
- this.dragging = false;
1451
- evt.stopPropagation();
1452
- };
1453
- ResizableDirective.prototype.mouseMove = function (evt) {
1454
- if (this.inDragRegion(evt) || this.dragging) {
1455
- this.el.nativeElement.style.cursor = 'col-resize';
1456
- }
1457
- else {
1458
- this.el.nativeElement.style.cursor = 'default';
1459
- }
1460
- };
1461
- ResizableDirective.prototype.preventGlobalMouseEvents = function () {
1462
- document.body.style['pointer-events'] = 'none';
1463
- };
1464
- ResizableDirective.prototype.inDragRegion = function (evt) {
1465
- return this.el.nativeElement.clientWidth - evt.clientX + this.el.nativeElement.offsetLeft < this.resizableGrabWidth;
1466
- };
1467
- ResizableDirective.prototype.addListenerToDocument = function () {
1468
- var _this = this;
1469
- document.addEventListener('mousemove', function (e) {
1470
- _this.mouseMoveG(e);
1471
- }, true);
1472
- document.addEventListener('mouseup', function (e) {
1473
- _this.mouseUpG(e);
1474
- }, true);
1475
- };
1476
- ResizableDirective.prototype.addListenerToElement = function () {
1477
- var _this = this;
1478
- this.el.nativeElement.addEventListener('mousedown', function (e) {
1479
- _this.mouseDown(e);
1480
- }, true);
1481
- this.el.nativeElement.addEventListener('mousemove', function (e) {
1482
- _this.mouseMove(e);
1483
- }, true);
1484
- };
1485
- return ResizableDirective;
1486
- }());
1487
- ResizableDirective.decorators = [
1488
- { type: i0.Directive, args: [{
1489
- selector: '[ltResizable]',
1490
- },] }
1491
- ];
1492
- ResizableDirective.ctorParameters = function () { return [
1493
- { type: i0.ElementRef }
1494
- ]; };
1495
- ResizableDirective.propDecorators = {
1496
- resizableGrabWidth: [{ type: i0.Input }],
1497
- resizableMinWidth: [{ type: i0.Input }]
1498
- };
1499
-
1500
- /**
1501
- * Truncate string with ellipses
1502
- */
1503
- var EllipsesPipe = /** @class */ (function () {
1504
- function EllipsesPipe() {
1505
- }
1506
- EllipsesPipe.prototype.transform = function (value, limit) {
1507
- if (!value) {
1508
- return null;
1509
- }
1510
- return value.length > limit ? value.substring(0, limit) + '...' : value;
1511
- };
1512
- return EllipsesPipe;
1513
- }());
1514
- EllipsesPipe.decorators = [
1515
- { type: i0.Pipe, args: [{
1516
- name: 'ltEllipses',
1517
- },] }
1518
- ];
1519
-
1520
- /**
1521
- * Declarate html as safe
1522
- */
1523
- var SafeHtmlPipe = /** @class */ (function () {
1524
- function SafeHtmlPipe(sanitized) {
1525
- this.sanitized = sanitized;
1526
- }
1527
- SafeHtmlPipe.prototype.transform = function (value) {
1528
- return this.sanitized.bypassSecurityTrustHtml(value);
1529
- };
1530
- return SafeHtmlPipe;
1531
- }());
1532
- SafeHtmlPipe.decorators = [
1533
- { type: i0.Pipe, args: [{ name: 'ltSafeHtml' },] }
1534
- ];
1535
- SafeHtmlPipe.ctorParameters = function () { return [
1536
- { type: i1.DomSanitizer }
1537
- ]; };
1538
-
1539
- // Imported and exported elements
1540
- var elements = [
1541
- // Directives
1542
- ContextMenuDirective,
1543
- LazyLoadDirective,
1544
- MatchHeightDirective,
1545
- ResizableDirective,
1546
- // Pipes
1547
- EllipsesPipe,
1548
- SafeHtmlPipe,
1549
- ];
1550
- /**
1551
- * Base module
1552
- */
1553
- var BaseModule = /** @class */ (function () {
1554
- function BaseModule() {
1555
- }
1556
- /**
1557
- * Set configuration of base module in root module of the app
1558
- */
1559
- BaseModule.forRoot = function (baseModuleConfig, AppAuthService) {
1560
- if (baseModuleConfig === void 0) { baseModuleConfig = {}; }
1561
- // Default config
1562
- var config = Object.assign({ apiUrl: 'localhost:3000', authGuardRedirectUrl: '/auth', logging: false, version: null, prefix: null, scrollDetectionOffset: 200, scrollOffset: 100, storageType: 'local' }, baseModuleConfig);
1563
- // Prepare providers
1564
- var providers = [
1565
- {
1566
- provide: BASE_MODULE_CONFIG,
1567
- useValue: baseModuleConfig,
1568
- },
1569
- ];
1570
- // Add apollo features if API URL is set
1571
- if (baseModuleConfig.apiUrl) {
1572
- providers.push({
1573
- provide: i1$1.APOLLO_OPTIONS,
1574
- useFactory: apolloOptionsFactory,
1575
- deps: [BASE_MODULE_CONFIG, http.HttpLink, AppAuthService ? AppAuthService : AuthService, WsService],
1576
- });
1577
- }
1578
- else if (config.logging) {
1579
- console.log('apiUrl is missing, ApolloLink is not initialized');
1580
- }
1581
- // Return root module
1582
- return {
1583
- ngModule: BaseModule,
1584
- providers: providers,
1585
- };
1586
- };
1587
- return BaseModule;
1588
- }());
1589
- BaseModule.decorators = [
1590
- { type: i0.NgModule, args: [{
1591
- declarations: elements,
1592
- exports: elements,
1593
- },] }
1594
- ];
1595
-
1596
- /**
1597
- * Standard class
1598
- * Other classes should extend the Standard class, if they offer own functions
1599
- * If the extended class uses object properties with own map functions, it should implement its own map function
1600
- */
1601
- var Standard = /** @class */ (function () {
1602
- function Standard() {
1603
- }
1604
- /**
1605
- * Static map method
1606
- */
1607
- Standard.map = function (data, item) {
1608
- if (item === void 0) { item = new this(); }
1609
- return item.map(data);
1610
- };
1611
- /**
1612
- * Map data into an object
1613
- */
1614
- Standard.prototype.map = function (data) {
1615
- return Helper.map(data, this);
1616
- };
1617
- /**
1618
- * Clone object (and map additional data)
1619
- */
1620
- Standard.prototype.clone = function (mapData) {
1621
- var current = JSON.parse(JSON.stringify(this));
1622
- if (mapData) {
1623
- Object.assign(current, mapData);
1624
- }
1625
- return new this.constructor().map(current);
1626
- };
1627
- /**
1628
- * Compare this with another object
1629
- * Hint: functions will be ignored and when an array or an object is different the hole array or object will used as property value
1630
- *
1631
- * @return Record<string, any> with properties of this object which are different
1632
- */
1633
- Standard.prototype.getDiff = function (compare, clone) {
1634
- if (clone === void 0) { clone = true; }
1635
- return Helper.getDiff(this, compare, clone);
1636
- };
1637
- return Standard;
1638
- }());
1639
-
1640
- /**
1641
- * User class
1642
- */
1643
- var BasicUser = /** @class */ (function (_super) {
1644
- __extends(BasicUser, _super);
1645
- function BasicUser() {
1646
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1647
- _this.id = undefined;
1648
- _this.email = undefined;
1649
- _this.firstName = undefined;
1650
- _this.lastName = undefined;
1651
- _this.roles = [];
1652
- _this.username = undefined;
1653
- return _this;
1654
- }
1655
- // ===================================================================================================================
1656
- // Methods
1657
- // ===================================================================================================================
1658
- /**
1659
- * Mapping
1660
- */
1661
- BasicUser.prototype.map = function (data) {
1662
- Helper.map(data, this);
1663
- return this;
1664
- };
1665
- /**
1666
- * Checks whether the user has at least one of the required roles
1667
- */
1668
- BasicUser.prototype.hasRole = function (roles) {
1669
- if (typeof roles === 'string') {
1670
- roles = [roles];
1671
- }
1672
- if (!this.roles || this.roles.length < 1) {
1673
- return false;
1674
- }
1675
- return !roles || roles.length < 1 ? true : this.roles.some(function (role) { return roles.includes(role); });
1676
- };
1677
- /**
1678
- * Checks whether the user has all required roles
1679
- */
1680
- BasicUser.prototype.hasAllRoles = function (roles) {
1681
- var _this = this;
1682
- if (typeof roles === 'string') {
1683
- roles = [roles];
1684
- }
1685
- if (!this.roles || this.roles.length < 1) {
1686
- return false;
1687
- }
1688
- return !roles ? true : roles.every(function (role) { return _this.roles.includes(role); });
1689
- };
1690
- return BasicUser;
1691
- }(Standard));
1692
-
1693
- /**
1694
- * GraphQL enum
1695
- */
1696
- var GraphQLEnum = /** @class */ (function () {
1697
- function GraphQLEnum(value) {
1698
- this.value = value;
1699
- }
1700
- return GraphQLEnum;
1701
- }());
1702
-
1703
- /**
1704
- * GraphQL type
1705
- */
1706
- var GraphQLType = /** @class */ (function (_super) {
1707
- __extends(GraphQLType, _super);
1708
- function GraphQLType() {
1709
- var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
1710
- _this.type = '';
1711
- _this.isEnum = false;
1712
- _this.validEnums = [];
1713
- return _this;
1714
- }
1715
- return GraphQLType;
1716
- }(Standard));
1717
-
1718
- /**
1719
- * GraphQL meta
1720
- */
1721
- var GraphQLMeta = /** @class */ (function () {
1722
- /**
1723
- * Integrate schema
1724
- */
1725
- function GraphQLMeta(schema) {
1726
- this.schema = schema;
1727
- // Frozen caches
1728
- this.args = {};
1729
- this.fields = {};
1730
- if (!schema) {
1731
- throw Error('Missing schema');
1732
- }
1733
- }
1734
- /**
1735
- * Get arguments of GraphQL function
1736
- */
1737
- GraphQLMeta.prototype.getArgs = function (functionName, options) {
1738
- var _this = this;
1739
- if (options === void 0) { options = {}; }
1740
- var _a = Object.assign({ cache: true, freeze: true, type: undefined }, options), cache = _a.cache, freeze = _a.freeze, type = _a.type;
1741
- // Get cache
1742
- if (cache && freeze) {
1743
- var args = this.args[functionName + type];
1744
- if (args) {
1745
- return args;
1746
- }
1747
- }
1748
- var func = this.getFunction(functionName, { type: type });
1749
- var result = {};
1750
- if (func === null || func === void 0 ? void 0 : func.args) {
1751
- func.args.forEach(function (item) {
1752
- result[item.name] = _this.getDeepType(item.type);
1753
- });
1754
- }
1755
- // Set cache
1756
- if (freeze) {
1757
- this.args[functionName + type] = Helper.deepFreeze(result);
1758
- }
1759
- return result;
1760
- };
1761
- /**
1762
- * Get fields of GraphQL function
1763
- */
1764
- GraphQLMeta.prototype.getFields = function (functionName, options) {
1765
- if (options === void 0) { options = {}; }
1766
- var _a = Object.assign({ cache: true, freeze: true, type: undefined }, options), cache = _a.cache, freeze = _a.freeze, type = _a.type;
1767
- // Get cache
1768
- if (cache && freeze) {
1769
- var args = this.fields[functionName + type];
1770
- if (args) {
1771
- return args;
1772
- }
1773
- }
1774
- var func = this.getFunction(functionName, options);
1775
- var result = this.getDeepType(func.type);
1776
- // Set cache
1777
- if (freeze) {
1778
- this.fields[functionName + type] = Helper.deepFreeze(result);
1779
- }
1780
- return result;
1781
- };
1782
- /**
1783
- * Get GraphQL function
1784
- */
1785
- GraphQLMeta.prototype.getFunction = function (name, options) {
1786
- var _this = this;
1787
- if (options === void 0) { options = {}; }
1788
- // Set config
1789
- var config = Object.assign({}, options);
1790
- // Init possible functions
1791
- var functions = {};
1792
- // If function type is set
1793
- if (config.type) {
1794
- var graphQLType = config.type.charAt(0).toUpperCase() + config.type.slice(1);
1795
- var type = this.schema.getType(graphQLType);
1796
- if (type) {
1797
- functions = type.getFields();
1798
- }
1799
- }
1800
- // If function type is not set
1801
- else {
1802
- ['Subscription', 'Mutation', 'Query'].forEach(function (item) {
1803
- var type = _this.schema.getType(item);
1804
- if (type) {
1805
- functions = Object.assign(Object.assign({}, functions), (type.getFields() || {}));
1806
- }
1807
- });
1808
- }
1809
- // Get function via name
1810
- return functions[name];
1811
- };
1812
- /**
1813
- * Get type
1814
- */
1815
- GraphQLMeta.prototype.getType = function (name) {
1816
- return this.schema.getType(name);
1817
- };
1818
- /**
1819
- * Get deep type data
1820
- */
1821
- GraphQLMeta.prototype.getDeepType = function (type, prepared) {
1822
- var e_1, _a, e_2, _b;
1823
- if (prepared === void 0) { prepared = new WeakMap(); }
1824
- // Check type
1825
- if (!type) {
1826
- return type;
1827
- }
1828
- // Infinite regress protection
1829
- var preparedObject = {};
1830
- // Check prepared
1831
- if (typeof type === 'object') {
1832
- var preparedType = prepared.get(type);
1833
- if (preparedType) {
1834
- return preparedType;
1835
- }
1836
- // Set prepared
1837
- prepared.set(type, preparedObject);
1838
- }
1839
- // Search deeper
1840
- if (type.ofType) {
1841
- var ofTypeResult = this.getDeepType(type.ofType, prepared);
1842
- Object.assign(preparedObject, ofTypeResult);
1843
- return ofTypeResult;
1844
- }
1845
- // Process fields
1846
- if (type._fields) {
1847
- var result = {};
1848
- try {
1849
- for (var _c = __values(Object.entries(type._fields)), _d = _c.next(); !_d.done; _d = _c.next()) {
1850
- var _e = __read(_d.value, 2), key = _e[0], value = _e[1];
1851
- result[key] = this.getDeepType(value, prepared);
1852
- }
1853
- }
1854
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1855
- finally {
1856
- try {
1857
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1858
- }
1859
- finally { if (e_1) throw e_1.error; }
1860
- }
1861
- Object.assign(preparedObject, result);
1862
- return result;
1863
- }
1864
- // Get type name
1865
- if (type.type) {
1866
- var typeResult = this.getDeepType(type.type, prepared);
1867
- Object.assign(preparedObject, typeResult);
1868
- return typeResult;
1869
- }
1870
- // Initialize GraphQLType
1871
- var graphqlType = GraphQLType.map({
1872
- type: type.name,
1873
- });
1874
- // Set enum values
1875
- if (!!type._values) {
1876
- graphqlType.isEnum = true;
1877
- try {
1878
- for (var _f = __values(Object.entries(type._nameLookup)), _g = _f.next(); !_g.done; _g = _f.next()) {
1879
- var _h = __read(_g.value, 2), key = _h[0], value = _h[1];
1880
- if (!value.isDeprecated) {
1881
- graphqlType.validEnums.push(key);
1882
- }
1883
- }
1884
- }
1885
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1886
- finally {
1887
- try {
1888
- if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
1889
- }
1890
- finally { if (e_2) throw e_2.error; }
1891
- }
1892
- }
1893
- // Finish
1894
- prepared.set(type, graphqlType);
1895
- return graphqlType;
1896
- };
1897
- return GraphQLMeta;
1898
- }());
1899
-
1900
- /**
1901
- * Authentication guard
1902
- */
1903
- var AuthGuard = /** @class */ (function () {
1904
- /**
1905
- * Imports
1906
- */
1907
- function AuthGuard(router, authService, moduleConfig) {
1908
- this.router = router;
1909
- this.authService = authService;
1910
- this.moduleConfig = moduleConfig;
1911
- }
1912
- /**
1913
- * Can activate main route
1914
- */
1915
- AuthGuard.prototype.canActivate = function (route, state) {
1916
- var _this = this;
1917
- return new rxjs.Observable(function (subscriber) {
1918
- var _a, _b, _c, _d;
1919
- var allowed = false;
1920
- var opposite = ((_a = route === null || route === void 0 ? void 0 : route.data) === null || _a === void 0 ? void 0 : _a.opposite) ? (_b = route === null || route === void 0 ? void 0 : route.data) === null || _b === void 0 ? void 0 : _b.opposite : false;
1921
- var redirectUrl = ((_c = route === null || route === void 0 ? void 0 : route.data) === null || _c === void 0 ? void 0 : _c.redirectUrl) ? route.data.redirectUrl : _this.moduleConfig.authGuardRedirectUrl;
1922
- if (_this.authService.token && !opposite) {
1923
- if (route.data.allowedRole) {
1924
- var user = _this.authService.currentUser;
1925
- allowed = (_d = user === null || user === void 0 ? void 0 : user.roles) === null || _d === void 0 ? void 0 : _d.includes(route.data.allowedRole);
1926
- }
1927
- else {
1928
- allowed = true;
1929
- }
1930
- }
1931
- else if (!_this.authService.token && opposite) {
1932
- allowed = true;
1933
- }
1934
- if (!allowed) {
1935
- _this.router.navigate([redirectUrl]);
1936
- }
1937
- subscriber.next(allowed);
1938
- subscriber.complete();
1939
- });
1940
- };
1941
- /**
1942
- * Can activate child route
1943
- */
1944
- AuthGuard.prototype.canActivateChild = function (route, state) {
1945
- return this.canActivate(route, state);
1946
- };
1947
- return AuthGuard;
1948
- }());
1949
- AuthGuard.decorators = [
1950
- { type: i0.Injectable }
1951
- ];
1952
- AuthGuard.ctorParameters = function () { return [
1953
- { type: i1$2.Router },
1954
- { type: AuthService },
1955
- { type: undefined, decorators: [{ type: i0.Inject, args: [BASE_MODULE_CONFIG,] }] }
1956
- ]; };
1957
-
1958
- /**
1959
- * Guard to check if a component can be deactivated
1960
- */
1961
- var CanDeactivateGuard = /** @class */ (function () {
1962
- function CanDeactivateGuard() {
1963
- }
1964
- CanDeactivateGuard.prototype.canDeactivate = function (component) {
1965
- return component.canDeactivate ? component.canDeactivate() : true;
1966
- };
1967
- return CanDeactivateGuard;
1968
- }());
1969
- CanDeactivateGuard.decorators = [
1970
- { type: i0.Injectable }
1971
- ];
1972
-
1973
- /**
1974
- * Logout guard
1975
- */
1976
- var LogoutGuard = /** @class */ (function () {
1977
- function LogoutGuard(router, authService) {
1978
- this.router = router;
1979
- this.authService = authService;
1980
- }
1981
- LogoutGuard.prototype.canActivate = function (route, state) {
1982
- var _this = this;
1983
- return new rxjs.Observable(function (subscriber) {
1984
- if (_this.authService.token) {
1985
- _this.authService.logout();
1986
- }
1987
- subscriber.next(true);
1988
- subscriber.complete();
1989
- });
1990
- };
1991
- LogoutGuard.prototype.canActivateChild = function (route, state) {
1992
- return this.canActivate(route, state);
1993
- };
1994
- return LogoutGuard;
1995
- }());
1996
- LogoutGuard.decorators = [
1997
- { type: i0.Injectable }
1998
- ];
1999
- LogoutGuard.ctorParameters = function () { return [
2000
- { type: i1$2.Router },
2001
- { type: AuthService }
2002
- ]; };
2003
-
2004
- /**
2005
- * Comparison operator enum
2006
- */
2007
- exports.ComparisonOperatorEnum = void 0;
2008
- (function (ComparisonOperatorEnum) {
2009
- ComparisonOperatorEnum["EQ"] = "EQ";
2010
- ComparisonOperatorEnum["GT"] = "GT";
2011
- ComparisonOperatorEnum["GTE"] = "GTE";
2012
- ComparisonOperatorEnum["IN"] = "IN";
2013
- ComparisonOperatorEnum["LT"] = "LT";
2014
- ComparisonOperatorEnum["LTE"] = "LTE";
2015
- ComparisonOperatorEnum["NE"] = "NE";
2016
- ComparisonOperatorEnum["NIN"] = "NIN";
2017
- ComparisonOperatorEnum["REGEX"] = "REGEX";
2018
- })(exports.ComparisonOperatorEnum || (exports.ComparisonOperatorEnum = {}));
2019
-
2020
- /**
2021
- * GraphQL request type enum
2022
- */
2023
- exports.GraphQLRequestType = void 0;
2024
- (function (GraphQLRequestType) {
2025
- GraphQLRequestType["QUERY"] = "query";
2026
- GraphQLRequestType["MUTATION"] = "mutation";
2027
- GraphQLRequestType["SUBSCRIPTION"] = "subscription";
2028
- })(exports.GraphQLRequestType || (exports.GraphQLRequestType = {}));
2029
-
2030
- /**
2031
- * Logical operator enum
2032
- */
2033
- exports.LogicalOperatorEnum = void 0;
2034
- (function (LogicalOperatorEnum) {
2035
- LogicalOperatorEnum["AND"] = "AND";
2036
- LogicalOperatorEnum["NOR"] = "NOR";
2037
- LogicalOperatorEnum["OR"] = "OR";
2038
- })(exports.LogicalOperatorEnum || (exports.LogicalOperatorEnum = {}));
2039
-
2040
- exports.SortOrderEnum = void 0;
2041
- (function (SortOrderEnum) {
2042
- SortOrderEnum["ASC"] = "ASC";
2043
- SortOrderEnum["DESC"] = "DESC";
2044
- })(exports.SortOrderEnum || (exports.SortOrderEnum = {}));
2045
-
2046
- /**
2047
- * Fullscreen service
2048
- */
2049
- var FullscreenService = /** @class */ (function () {
2050
- function FullscreenService() {
2051
- this._isFullscreenActive = new rxjs.BehaviorSubject(false);
2052
- this.listenToFullscreenEvent();
2053
- }
2054
- Object.defineProperty(FullscreenService.prototype, "fullscreenState", {
2055
- get: function () {
2056
- return this._isFullscreenActive.value;
2057
- },
2058
- enumerable: false,
2059
- configurable: true
2060
- });
2061
- Object.defineProperty(FullscreenService.prototype, "fullscreenStateAsObservable", {
2062
- get: function () {
2063
- return this._isFullscreenActive.asObservable();
2064
- },
2065
- enumerable: false,
2066
- configurable: true
2067
- });
2068
- FullscreenService.prototype.toggleFullscreen = function () {
2069
- var elem = document.documentElement;
2070
- if (!this._isFullscreenActive.value) {
2071
- elem.requestFullscreen();
2072
- this._isFullscreenActive.next(true);
2073
- }
2074
- else {
2075
- document.exitFullscreen();
2076
- this._isFullscreenActive.next(false);
2077
- }
2078
- };
2079
- /**
2080
- * Event Listener for fullscreen toggle
2081
- */
2082
- FullscreenService.prototype.listenToFullscreenEvent = function () {
2083
- var _this = this;
2084
- document.addEventListener('fullscreenchange', function () {
2085
- if (document.fullscreenElement) {
2086
- _this._isFullscreenActive.next(true);
2087
- }
2088
- else {
2089
- _this._isFullscreenActive.next(false);
2090
- }
2091
- });
2092
- };
2093
- return FullscreenService;
2094
- }());
2095
- FullscreenService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function FullscreenService_Factory() { return new FullscreenService(); }, token: FullscreenService, providedIn: "root" });
2096
- FullscreenService.decorators = [
2097
- { type: i0.Injectable, args: [{
2098
- providedIn: 'root',
2099
- },] }
2100
- ];
2101
- FullscreenService.ctorParameters = function () { return []; };
2102
-
2103
- /**
2104
- * GraphQL meta service
2105
- *
2106
- * For collecting meta information of the GraphQL API
2107
- */
2108
- var GraphQLMetaService = /** @class */ (function () {
2109
- /**
2110
- * Include services
2111
- */
2112
- function GraphQLMetaService(apollo) {
2113
- this.apollo = apollo;
2114
- }
2115
- Object.defineProperty(GraphQLMetaService.prototype, "introspectionQuery", {
2116
- /**
2117
- * Getter of introspectionQuery
2118
- */
2119
- get: function () {
2120
- return JSON.parse(JSON.stringify(this._introspectionQuery));
2121
- },
2122
- enumerable: false,
2123
- configurable: true
2124
- });
2125
- /**
2126
- * Get schema for API
2127
- * See https://www.apollographql.com/blog/three-ways-to-represent-your-graphql-schema-a41f4175100d
2128
- */
2129
- GraphQLMetaService.prototype.getSchema = function (options) {
2130
- var _this = this;
2131
- if (options === void 0) { options = {}; }
2132
- // Get configurations
2133
- var config = Object.assign({ cache: true, freeze: true }, options);
2134
- // Use caching
2135
- if (config.cache) {
2136
- if (config.freeze && this._frozenSchema) {
2137
- return rxjs.of(this._frozenSchema);
2138
- }
2139
- if (this._introspectionQuery) {
2140
- return rxjs.of(graphql.buildClientSchema(this.introspectionQuery));
2141
- }
2142
- if (config.freeze && this._frozenSchemaObservable) {
2143
- return this._frozenSchemaObservable;
2144
- }
2145
- else if (!config.freeze && this._schemaObservable) {
2146
- return this._schemaObservable;
2147
- }
2148
- }
2149
- // Request schema from server
2150
- var observable = this.apollo
2151
- .query({
2152
- query: i1$1.gql(graphql.getIntrospectionQuery({ descriptions: false })),
2153
- })
2154
- .pipe(operators.map(function (schema) {
2155
- // Cache introspectionQuery
2156
- _this._introspectionQuery = schema.data;
2157
- // Convert schema to GraphQLSchema
2158
- _this._frozenSchema = Helper.deepFreeze(graphql.buildClientSchema(_this.introspectionQuery));
2159
- // Return GraphQLSchema
2160
- if (config.freeze) {
2161
- return _this._frozenSchema;
2162
- }
2163
- return graphql.buildClientSchema(schema.data);
2164
- }));
2165
- // Set observables
2166
- if (config.freeze) {
2167
- this._frozenSchemaObservable = observable;
2168
- }
2169
- else {
2170
- this._schemaObservable = observable;
2171
- }
2172
- // Return result
2173
- return observable;
2174
- };
2175
- /**
2176
- * Get meta for API
2177
- * See https://www.apollographql.com/blog/three-ways-to-represent-your-graphql-schema-a41f4175100d
2178
- */
2179
- GraphQLMetaService.prototype.getMeta = function (options) {
2180
- var _this = this;
2181
- if (options === void 0) { options = {}; }
2182
- // Get configurations
2183
- var config = Object.assign({ cache: true, log: false }, options);
2184
- // Use caching
2185
- if (config.cache) {
2186
- if (this._meta) {
2187
- return rxjs.of(this._meta);
2188
- }
2189
- else if (this._metaObservable) {
2190
- return this._metaObservable;
2191
- }
2192
- }
2193
- // Request schema from server
2194
- var observable = this.getSchema(options).pipe(operators.map(function (schema) {
2195
- // Log
2196
- if (config.log) {
2197
- console.log({ schema: schema });
2198
- }
2199
- _this._meta = new GraphQLMeta(schema);
2200
- return _this._meta;
2201
- }));
2202
- // Set observables
2203
- this._metaObservable = observable;
2204
- // Return result
2205
- return observable;
2206
- };
2207
- return GraphQLMetaService;
2208
- }());
2209
- GraphQLMetaService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GraphQLMetaService_Factory() { return new GraphQLMetaService(i0__namespace.ɵɵinject(i1__namespace.Apollo)); }, token: GraphQLMetaService, providedIn: "root" });
2210
- GraphQLMetaService.decorators = [
2211
- { type: i0.Injectable, args: [{
2212
- providedIn: 'root',
2213
- },] }
2214
- ];
2215
- GraphQLMetaService.ctorParameters = function () { return [
2216
- { type: i1$1.Apollo }
2217
- ]; };
2218
-
2219
- /**
2220
- * GraphQL service
2221
- */
2222
- var GraphQLService = /** @class */ (function () {
2223
- /**
2224
- * Include services
2225
- */
2226
- function GraphQLService(apollo, graphQLMetaService) {
2227
- this.apollo = apollo;
2228
- this.graphQLMetaService = graphQLMetaService;
2229
- }
2230
- /**
2231
- * GraphQL request
2232
- */
2233
- GraphQLService.prototype.graphQl = function (graphql, options) {
2234
- var _this = this;
2235
- if (options === void 0) { options = {}; }
2236
- // Check arguments
2237
- if (!graphql) {
2238
- rxjs.throwError('Missing graphql argument');
2239
- }
2240
- // Get config
2241
- var config = Object.assign({ arguments: null, fields: null, log: false, model: null, type: exports.GraphQLRequestType.QUERY }, options);
2242
- // Convert class to Object for arguments
2243
- if (typeof config.arguments === 'function') {
2244
- config.arguments = new config.arguments();
2245
- }
2246
- // Convert class to Object for fields
2247
- if (typeof config.fields === 'function') {
2248
- config.fields = new config.fields();
2249
- }
2250
- // Log
2251
- if (config.log) {
2252
- console.log({ config: config });
2253
- }
2254
- // Send request
2255
- return new rxjs.Observable(function (subscriber) {
2256
- // Get meta
2257
- _this.graphQLMetaService.getMeta({ log: config.log }).subscribe(function (meta) {
2258
- // Prepare fields
2259
- var fields;
2260
- var allowedFields;
2261
- // Log meta
2262
- if (config.log) {
2263
- console.log({ meta: meta });
2264
- }
2265
- if (config.fields) {
2266
- allowedFields = meta.getFields(graphql, { type: config.type });
2267
- // Log meta
2268
- if (config.log) {
2269
- console.log({ allowedFields: allowedFields });
2270
- }
2271
- var fieldsData_1 = _this.prepareFields(config.fields, {
2272
- allowed: allowedFields,
2273
- });
2274
- // Log fields data
2275
- if (config.log) {
2276
- fieldsData_1.usedFields.sort();
2277
- fieldsData_1.schemaFields.sort();
2278
- var filtered = fieldsData_1.schemaFields.filter(function (field) { return !fieldsData_1.usedFields.includes(field); });
2279
- var unused = _this.graphQLTypeCollectionToStringArray(allowedFields).filter(function (field) { return !fieldsData_1.usedFields.includes(field); });
2280
- console.log({ fieldsData: fieldsData_1, filtered: filtered, unused: unused });
2281
- }
2282
- fields = fieldsData_1.fieldsString;
2283
- }
2284
- if (fields && !fields.startsWith('{')) {
2285
- fields = '{' + fields + '\n}';
2286
- }
2287
- // Log fields
2288
- if (config.log) {
2289
- console.log({ fields: fields });
2290
- }
2291
- // Get allowed args
2292
- var allowedArgs = meta.getArgs(graphql, { type: config.type });
2293
- // Log allowed args
2294
- if (config.log) {
2295
- console.log({ allowedArgs: allowedArgs });
2296
- }
2297
- var argsData = _this.prepareArguments(config.arguments, {
2298
- allowed: allowedArgs,
2299
- });
2300
- // Log args data
2301
- if (config.log) {
2302
- argsData.usedArgs.sort();
2303
- argsData.schemaArgs.sort();
2304
- var filtered = argsData.schemaArgs.filter(function (field) { return !argsData.usedArgs.includes(field); });
2305
- var unused = _this.graphQLTypeCollectionToStringArray(allowedArgs)
2306
- .sort()
2307
- .filter(function (field) { return !argsData.usedArgs.includes(field); });
2308
- console.log({ argsData: argsData, filtered: filtered, unused: unused });
2309
- }
2310
- var args = (argsData === null || argsData === void 0 ? void 0 : argsData.argsString) || '';
2311
- // Log
2312
- if (config.log) {
2313
- console.log({ graphQL: graphql, args: args, fields: fields, type: config.type });
2314
- }
2315
- // Prepare request
2316
- var documentNode = fields
2317
- ? i1$1.gql(config.type + '{\n' + graphql + args + fields + '\n}')
2318
- : i1$1.gql(config.type + '{\n' + graphql + args + '\n}');
2319
- // Log
2320
- if (config.log) {
2321
- console.log({ documentNode: documentNode });
2322
- }
2323
- var request = {};
2324
- request[config.type] = documentNode;
2325
- // Log
2326
- if (config.log) {
2327
- console.log({ request: request });
2328
- }
2329
- var func;
2330
- if (config.type === exports.GraphQLRequestType.MUTATION) {
2331
- func = 'mutate';
2332
- request[config.type] = documentNode;
2333
- }
2334
- else if (config.type === exports.GraphQLRequestType.SUBSCRIPTION) {
2335
- func = 'subscribe';
2336
- request.query = documentNode;
2337
- }
2338
- else {
2339
- func = config.type;
2340
- request[config.type] = documentNode;
2341
- }
2342
- _this.apollo[func](request).subscribe(function (result) {
2343
- var _a;
2344
- var data = ((_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a[graphql]) !== undefined ? result.data[graphql] : result;
2345
- // Direct data
2346
- if (!config.model) {
2347
- subscriber.next(data);
2348
- }
2349
- // Map data as array
2350
- else if (Array.isArray(data)) {
2351
- subscriber.next(data.map(function (item) {
2352
- return config.model.map(item);
2353
- }));
2354
- }
2355
- // Map data
2356
- else {
2357
- subscriber.next(config.model.map(data));
2358
- }
2359
- if (config.type !== exports.GraphQLRequestType.SUBSCRIPTION) {
2360
- // Done
2361
- subscriber.complete();
2362
- }
2363
- }, function (error) {
2364
- subscriber.error(error);
2365
- subscriber.complete();
2366
- });
2367
- });
2368
- });
2369
- };
2370
- /**
2371
- * Get fields / args from IGraphQLTypeCollection
2372
- */
2373
- GraphQLService.prototype.graphQLTypeCollectionToStringArray = function (collection, current, result, cacheNode) {
2374
- var e_1, _b;
2375
- if (current === void 0) { current = ''; }
2376
- if (result === void 0) { result = []; }
2377
- if (cacheNode === void 0) { cacheNode = []; }
2378
- if (collection) {
2379
- if (collection instanceof GraphQLType) {
2380
- result.push(current);
2381
- }
2382
- else {
2383
- if (current === null || current === void 0 ? void 0 : current.includes('.')) {
2384
- cacheNode.push(current.split('.')[1]);
2385
- }
2386
- else if (current) {
2387
- cacheNode.push(current);
2388
- }
2389
- try {
2390
- for (var _c = __values(Object.keys(collection)), _d = _c.next(); !_d.done; _d = _c.next()) {
2391
- var key = _d.value;
2392
- if (current === key || cacheNode.includes(key)) {
2393
- continue;
2394
- }
2395
- this.graphQLTypeCollectionToStringArray(collection[key], current ? current + '.' + key : key, result, cacheNode);
2396
- }
2397
- }
2398
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2399
- finally {
2400
- try {
2401
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
2402
- }
2403
- finally { if (e_1) throw e_1.error; }
2404
- }
2405
- }
2406
- }
2407
- return result;
2408
- };
2409
- /**
2410
- * Prepare arguments for GraphQL request
2411
- */
2412
- GraphQLService.prototype.prepareArguments = function (args, options) {
2413
- var e_2, _b, e_3, _c;
2414
- var _this = this;
2415
- if (options === void 0) { options = {}; }
2416
- // Init config variables
2417
- var _d = Object.assign({ allowed: null, level: 1, parent: '', schemaArgs: [], usedArgs: [] }, options), allowed = _d.allowed, level = _d.level, parent = _d.parent, schemaArgs = _d.schemaArgs, usedArgs = _d.usedArgs;
2418
- // Check args
2419
- if (args === undefined || args === null) {
2420
- return { argsString: '', schemaArgs: schemaArgs, usedArgs: usedArgs };
2421
- }
2422
- // Init args
2423
- var result = [];
2424
- // Process array
2425
- if (Array.isArray(args)) {
2426
- var allowedKeys = allowed ? Object.keys(allowed) : null;
2427
- try {
2428
- for (var args_1 = __values(args), args_1_1 = args_1.next(); !args_1_1.done; args_1_1 = args_1.next()) {
2429
- var item = args_1_1.value;
2430
- var key = null;
2431
- if (allowed) {
2432
- if (allowed.length < 1) {
2433
- break;
2434
- }
2435
- key = allowedKeys === null || allowedKeys === void 0 ? void 0 : allowedKeys.shift();
2436
- }
2437
- // Process value
2438
- result.push(this.prepareArguments(item, {
2439
- allowed: key ? allowed[key] : null,
2440
- level: level + 1,
2441
- parent: parent + key + '.',
2442
- schemaArgs: schemaArgs,
2443
- usedArgs: usedArgs,
2444
- }).argsString);
2445
- }
2446
- }
2447
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2448
- finally {
2449
- try {
2450
- if (args_1_1 && !args_1_1.done && (_b = args_1.return)) _b.call(args_1);
2451
- }
2452
- finally { if (e_2) throw e_2.error; }
2453
- }
2454
- // Encapsulation of the array result
2455
- if (result.length) {
2456
- // Complete result, encapsulated via round brackets
2457
- if (level === 1) {
2458
- return { argsString: '(' + result.join(', ') + ')', schemaArgs: schemaArgs, usedArgs: usedArgs };
2459
- }
2460
- // Deeper result part, encapsulated via square brackets
2461
- else {
2462
- return { argsString: '[' + result.join(', ') + ']', schemaArgs: schemaArgs, usedArgs: usedArgs };
2463
- }
2464
- }
2465
- }
2466
- // Process object
2467
- else if (typeof args === 'object') {
2468
- // Check object is empty
2469
- if (args && Object.keys(args).length === 0 && Object.getPrototypeOf(args) === Object.prototype) {
2470
- return { argsString: '{}', schemaArgs: schemaArgs, usedArgs: usedArgs };
2471
- }
2472
- var _loop_1 = function (key, value) {
2473
- // Init data for current entry
2474
- var currentKey = parent + key;
2475
- schemaArgs.push(currentKey);
2476
- // If the allowed key handling is enabled and the current key is not included in the list of allowed keys,
2477
- // the current key will be skipped
2478
- if (allowed && !allowed[key]) {
2479
- return "continue";
2480
- }
2481
- // Skip value if not exists
2482
- if (value === undefined || value === null) {
2483
- return "continue";
2484
- }
2485
- // Add current key to metadata
2486
- usedArgs.push(currentKey);
2487
- // Process GraphQLEnum
2488
- if (value instanceof GraphQLEnum) {
2489
- result.push(key + ':' + value.value);
2490
- return "continue";
2491
- }
2492
- // Process array
2493
- else if (Array.isArray(value)) {
2494
- result.push(key +
2495
- ': [' +
2496
- value.map(function (item) { return _this.prepareArguments(item, {
2497
- allowed: allowed[key],
2498
- level: level + 1,
2499
- parent: currentKey + '.',
2500
- schemaArgs: schemaArgs,
2501
- usedArgs: usedArgs,
2502
- }).argsString; }) +
2503
- ']');
2504
- return "continue";
2505
- }
2506
- // Prepare additional result string
2507
- var additionalResult = key + ': ';
2508
- // Value is a date object
2509
- if (typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]') {
2510
- additionalResult += "\"\"\"" + value.toString() + "\"\"\"";
2511
- }
2512
- // Value is a string
2513
- else if (typeof value === 'string') {
2514
- // Enum (doesn't need quotation marks)
2515
- if (allowed[key].isEnum) {
2516
- additionalResult += value;
2517
- }
2518
- // String
2519
- else {
2520
- additionalResult += "\"\"\"" + value.replace(/"/g, '\\"') + "\"\"\"";
2521
- }
2522
- }
2523
- // Value is a simple boolean or a number
2524
- else if (typeof value === 'boolean' || typeof value === 'number') {
2525
- additionalResult += value;
2526
- }
2527
- // Others
2528
- else {
2529
- additionalResult += this_1.prepareArguments(value, {
2530
- allowed: allowed[key],
2531
- level: level + 1,
2532
- parent: currentKey + '.',
2533
- schemaArgs: schemaArgs,
2534
- usedArgs: usedArgs,
2535
- }).argsString;
2536
- }
2537
- // Push deeper part into result array
2538
- result.push(additionalResult);
2539
- };
2540
- var this_1 = this;
2541
- try {
2542
- // Process all object entries
2543
- for (var _e = __values(Object.entries(args)), _f = _e.next(); !_f.done; _f = _e.next()) {
2544
- var _g = __read(_f.value, 2), key = _g[0], value = _g[1];
2545
- _loop_1(key, value);
2546
- }
2547
- }
2548
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2549
- finally {
2550
- try {
2551
- if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
2552
- }
2553
- finally { if (e_3) throw e_3.error; }
2554
- }
2555
- // Encapsulation of the object result
2556
- if (result.length) {
2557
- // Complete result, encapsulated via round brackets
2558
- if (level === 1) {
2559
- return { argsString: '(' + result.join(', ') + ')', schemaArgs: schemaArgs, usedArgs: usedArgs };
2560
- }
2561
- // Deeper result part, encapsulated via curly brackets
2562
- else {
2563
- return { argsString: '{' + result.join(', ') + '}', schemaArgs: schemaArgs, usedArgs: usedArgs };
2564
- }
2565
- }
2566
- }
2567
- // Prepare and process other / unknown values as JSON
2568
- else {
2569
- return { argsString: JSON.stringify(args), schemaArgs: schemaArgs, usedArgs: usedArgs };
2570
- }
2571
- };
2572
- /**
2573
- * Prepare fields for GraphQL request
2574
- */
2575
- GraphQLService.prototype.prepareFields = function (fields, options) {
2576
- var e_4, _b, e_5, _c;
2577
- if (options === void 0) { options = {}; }
2578
- // Config
2579
- var _d = Object.assign({ allowed: null, parent: '', schemaFields: [], spaces: 2, tab: 1, usedFields: [] }, options), allowed = _d.allowed, parent = _d.parent, schemaFields = _d.schemaFields, spaces = _d.spaces, tab = _d.tab, usedFields = _d.usedFields;
2580
- // Init fields string
2581
- var fieldsString = '';
2582
- // Check fields
2583
- if (!fields) {
2584
- return { fieldsString: fieldsString, schemaFields: schemaFields, usedFields: usedFields };
2585
- }
2586
- // Process string
2587
- if (typeof fields === 'string') {
2588
- if (allowed &&
2589
- ((typeof allowed === 'string' && allowed !== fields) || (typeof allowed === 'object' && !allowed[fields]))) {
2590
- return { fieldsString: fieldsString, schemaFields: schemaFields, usedFields: usedFields };
2591
- }
2592
- return { fieldsString: '\n' + ' '.repeat(spaces).repeat(tab) + fields, schemaFields: schemaFields, usedFields: usedFields };
2593
- }
2594
- // Process array
2595
- else if (Array.isArray(fields)) {
2596
- try {
2597
- for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
2598
- var item = fields_1_1.value;
2599
- if (typeof item === 'object') {
2600
- fieldsString =
2601
- fieldsString +
2602
- this.prepareFields(item, {
2603
- allowed: allowed,
2604
- parent: parent,
2605
- spaces: spaces,
2606
- schemaFields: schemaFields,
2607
- tab: tab + 1,
2608
- usedFields: usedFields,
2609
- }).fieldsString;
2610
- continue;
2611
- }
2612
- var currentPath = parent + item;
2613
- schemaFields.push(currentPath);
2614
- if (allowed && !(allowed === null || allowed === void 0 ? void 0 : allowed[item])) {
2615
- continue;
2616
- }
2617
- usedFields.push(currentPath);
2618
- fieldsString =
2619
- fieldsString +
2620
- this.prepareFields(item, {
2621
- allowed: typeof (allowed === null || allowed === void 0 ? void 0 : allowed[item]) === 'object' && !((allowed === null || allowed === void 0 ? void 0 : allowed[item]) instanceof GraphQLType) ? allowed === null || allowed === void 0 ? void 0 : allowed[item] : item,
2622
- parent: currentPath + '.',
2623
- spaces: spaces,
2624
- schemaFields: schemaFields,
2625
- tab: tab + 1,
2626
- usedFields: usedFields,
2627
- }).fieldsString;
2628
- }
2629
- }
2630
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
2631
- finally {
2632
- try {
2633
- if (fields_1_1 && !fields_1_1.done && (_b = fields_1.return)) _b.call(fields_1);
2634
- }
2635
- finally { if (e_4) throw e_4.error; }
2636
- }
2637
- }
2638
- // Process object
2639
- else if (typeof fields === 'object') {
2640
- try {
2641
- for (var _e = __values(Object.entries(fields)), _f = _e.next(); !_f.done; _f = _e.next()) {
2642
- var _g = __read(_f.value, 2), key = _g[0], val = _g[1];
2643
- var currentPath = parent + key;
2644
- schemaFields.push(currentPath);
2645
- if (allowed && !allowed[key]) {
2646
- continue;
2647
- }
2648
- usedFields.push(currentPath);
2649
- if (typeof val !== 'object' || !Object.keys(val).length) {
2650
- fieldsString = fieldsString + '\n' + ' '.repeat(spaces).repeat(tab) + key;
2651
- }
2652
- else {
2653
- fieldsString =
2654
- fieldsString +
2655
- '\n' +
2656
- ' '.repeat(spaces).repeat(tab) +
2657
- key +
2658
- ' ' +
2659
- '{' +
2660
- this.prepareFields(val, {
2661
- allowed: typeof (allowed === null || allowed === void 0 ? void 0 : allowed[key]) === 'object' && !((allowed === null || allowed === void 0 ? void 0 : allowed[key]) instanceof GraphQLType) ? allowed === null || allowed === void 0 ? void 0 : allowed[key] : key,
2662
- parent: currentPath + '.',
2663
- spaces: spaces,
2664
- schemaFields: schemaFields,
2665
- tab: tab + 1,
2666
- usedFields: usedFields,
2667
- }).fieldsString +
2668
- '\n' +
2669
- ' '.repeat(spaces).repeat(tab) +
2670
- '}';
2671
- }
2672
- }
2673
- }
2674
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2675
- finally {
2676
- try {
2677
- if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
2678
- }
2679
- finally { if (e_5) throw e_5.error; }
2680
- }
2681
- }
2682
- // Return result
2683
- return { fieldsString: fieldsString, schemaFields: schemaFields, usedFields: usedFields };
2684
- };
2685
- return GraphQLService;
2686
- }());
2687
- GraphQLService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GraphQLService_Factory() { return new GraphQLService(i0__namespace.ɵɵinject(i1__namespace.Apollo), i0__namespace.ɵɵinject(GraphQLMetaService)); }, token: GraphQLService, providedIn: "root" });
2688
- GraphQLService.decorators = [
2689
- { type: i0.Injectable, args: [{
2690
- providedIn: 'root',
2691
- },] }
2692
- ];
2693
- GraphQLService.ctorParameters = function () { return [
2694
- { type: i1$1.Apollo },
2695
- { type: GraphQLMetaService }
2696
- ]; };
2697
-
2698
- /**
2699
- * Loader service for loading indication
2700
- */
2701
- var LoaderService = /** @class */ (function () {
2702
- function LoaderService() {
2703
- this.isLoading = new rxjs.BehaviorSubject(false);
2704
- }
2705
- LoaderService.prototype.start = function () {
2706
- this.isLoading.next(true);
2707
- };
2708
- LoaderService.prototype.stop = function () {
2709
- this.isLoading.next(false);
2710
- };
2711
- LoaderService.prototype.getAsObservable = function () {
2712
- return this.isLoading.asObservable();
2713
- };
2714
- return LoaderService;
2715
- }());
2716
- LoaderService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function LoaderService_Factory() { return new LoaderService(); }, token: LoaderService, providedIn: "root" });
2717
- LoaderService.decorators = [
2718
- { type: i0.Injectable, args: [{
2719
- providedIn: 'root',
2720
- },] }
2721
- ];
2722
-
2723
- /**
2724
- * GraphQL plus service, for extra error handling and loading indication
2725
- */
2726
- var GraphQLPlusService = /** @class */ (function (_super) {
2727
- __extends(GraphQLPlusService, _super);
2728
- /**
2729
- * Include services
2730
- */
2731
- function GraphQLPlusService(apollo, graphqlMetaService, loaderService) {
2732
- var _this = _super.call(this, apollo, graphqlMetaService) || this;
2733
- _this.apollo = apollo;
2734
- _this.graphqlMetaService = graphqlMetaService;
2735
- _this.loaderService = loaderService;
2736
- return _this;
2737
- }
2738
- GraphQLPlusService.prototype.graphQl = function (graphql, options) {
2739
- var _this = this;
2740
- if (options === void 0) { options = {}; }
2741
- this.handleLoader('start', options);
2742
- return new rxjs.Observable(function (subscriber) {
2743
- _super.prototype.graphQl.call(_this, graphql, options).subscribe(function (response) {
2744
- if (response && response.errors) {
2745
- _this.handleError(response.errors, options.excludedErrors);
2746
- subscriber.error(response);
2747
- _this.handleLoader('stop', options);
2748
- subscriber.complete();
2749
- }
2750
- subscriber.next(response);
2751
- _this.handleLoader('stop', options);
2752
- if (options.type !== exports.GraphQLRequestType.SUBSCRIPTION) {
2753
- subscriber.complete();
2754
- }
2755
- }, function (error) {
2756
- if (!options.ignoreErrors) {
2757
- _this.handleError(error, options.excludedErrors);
2758
- }
2759
- subscriber.error(error);
2760
- _this.handleLoader('stop', options);
2761
- subscriber.complete();
2762
- });
2763
- });
2764
- };
2765
- GraphQLPlusService.prototype.handleLoader = function (state, options) {
2766
- if (options.loading) {
2767
- if (state === 'start') {
2768
- this.loaderService.start();
2769
- }
2770
- else if (state === 'stop') {
2771
- this.loaderService.stop();
2772
- }
2773
- }
2774
- };
2775
- GraphQLPlusService.prototype.handleError = function (error, excludedErrors) {
2776
- if (excludedErrors === void 0) { excludedErrors = null; }
2777
- if (excludedErrors) {
2778
- if (Array.isArray(excludedErrors)) {
2779
- excludedErrors.forEach(function (excludedError) {
2780
- if (error.message.includes(excludedError.toLowerCase())) {
2781
- return;
2782
- }
2783
- });
2784
- }
2785
- else if (error.message.toLowerCase().includes(excludedErrors === null || excludedErrors === void 0 ? void 0 : excludedErrors.toLowerCase())) {
2786
- return;
2787
- }
2788
- }
2789
- this.displayError(error);
2790
- };
2791
- GraphQLPlusService.prototype.displayError = function (error) {
2792
- console.error(error);
2793
- };
2794
- return GraphQLPlusService;
2795
- }(GraphQLService));
2796
- GraphQLPlusService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function GraphQLPlusService_Factory() { return new GraphQLPlusService(i0__namespace.ɵɵinject(i1__namespace.Apollo), i0__namespace.ɵɵinject(GraphQLMetaService), i0__namespace.ɵɵinject(LoaderService)); }, token: GraphQLPlusService, providedIn: "root" });
2797
- GraphQLPlusService.decorators = [
2798
- { type: i0.Injectable, args: [{
2799
- providedIn: 'root',
2800
- },] }
2801
- ];
2802
- GraphQLPlusService.ctorParameters = function () { return [
2803
- { type: i1$1.Apollo },
2804
- { type: GraphQLMetaService },
2805
- { type: LoaderService }
2806
- ]; };
2807
-
2808
- /**
2809
- * Scroll service for autoscroll to specific fragments
2810
- */
2811
- var ScrollService = /** @class */ (function () {
2812
- /**
2813
- * Initializer
2814
- */
2815
- function ScrollService(router, moduleConfig, imageService) {
2816
- this.router = router;
2817
- this.moduleConfig = moduleConfig;
2818
- this.imageService = imageService;
2819
- /**
2820
- * Is a scroll listener set
2821
- *
2822
- * @protected
2823
- */
2824
- this.scrollListener = false;
2825
- /**
2826
- * Current scroll timer;
2827
- *
2828
- * @protected
2829
- */
2830
- this.scrollTimer = -1;
2831
- var config = Object.assign({ scrollDetectionOffset: 200, scrollOffset: 100, scrollSamplingRate: 100 }, moduleConfig);
2832
- this.detectionOffset = config.scrollDetectionOffset;
2833
- this.scrollOffset = config.scrollOffset;
2834
- this.scrollSamplingRate = config.scrollSamplingRate;
2835
- }
2836
- /**
2837
- * Scroll to structureElement with specific ID
2838
- */
2839
- ScrollService.prototype.scrollTo = function (id, options) {
2840
- if (options === void 0) { options = {}; }
2841
- return __awaiter(this, void 0, void 0, function () {
2842
- var config, el, body, undoOverflowChanges, scrollBodyStyles, cords;
2843
- return __generator(this, function (_a) {
2844
- switch (_a.label) {
2845
- case 0:
2846
- config = Object.assign({ checkUrl: false, loadImagesBefore: true, resetStyles: false, setOverflow: true, stopPropagation: true }, options);
2847
- if (!(config.checkUrl && this.router.url !== '/' && !this.router.url.startsWith('/#'))) return [3 /*break*/, 2];
2848
- return [4 /*yield*/, this.router.navigate(['/'], { fragment: id })];
2849
- case 1:
2850
- _a.sent();
2851
- return [2 /*return*/, !config.stopPropagation];
2852
- case 2:
2853
- el = document.getElementById(id);
2854
- if (!el) {
2855
- console.error('Missing scroll element with ID:', id);
2856
- return [2 /*return*/, !config.stopPropagation];
2857
- }
2858
- body = document.querySelector('body');
2859
- undoOverflowChanges = false;
2860
- scrollBodyStyles = JSON.parse(JSON.stringify(window.getComputedStyle(body)));
2861
- if (config.setOverflow && (scrollBodyStyles.overflowX !== 'visible' || scrollBodyStyles.overflowY !== 'visible')) {
2862
- // Set body overflow to visible
2863
- console.warn('Style of body element for overflowX and overflowY will be set to "visible" for scrolling!');
2864
- body.style.overflowX = 'visible';
2865
- body.style.overflowY = 'visible';
2866
- undoOverflowChanges = true;
2867
- }
2868
- if (!config.loadImagesBefore) return [3 /*break*/, 4];
2869
- return [4 /*yield*/, this.imageService.preLoadImages()];
2870
- case 3:
2871
- _a.sent();
2872
- _a.label = 4;
2873
- case 4:
2874
- cords = el.getBoundingClientRect();
2875
- // Scroll to element
2876
- window.scrollBy({ top: cords.top - this.scrollOffset, behavior: 'smooth' });
2877
- return [4 /*yield*/, this.scrollDone({
2878
- doneFunction: function () {
2879
- // Undo changes
2880
- if (undoOverflowChanges && config.resetStyles) {
2881
- body.style.overflowX = scrollBodyStyles.overflowX;
2882
- body.style.overflowY = scrollBodyStyles.overflowY;
2883
- console.warn('Original style of body element for overflowX and overflowY is set.');
2884
- }
2885
- },
2886
- })];
2887
- case 5:
2888
- _a.sent();
2889
- // Return stop propagation configuration
2890
- return [2 /*return*/, !config.stopPropagation];
2891
- }
2892
- });
2893
- });
2894
- };
2895
- /**
2896
- * Get last active structureElement
2897
- */
2898
- ScrollService.prototype.getLastActiveElement = function (list) {
2899
- var _this = this;
2900
- var currentScrollPosition = window.scrollY;
2901
- var elementsWithId = document.querySelectorAll('[id]');
2902
- var lastId = null;
2903
- var lastPosition = 0 - this.detectionOffset - 1;
2904
- elementsWithId.forEach(function (element) {
2905
- var cords = element.getBoundingClientRect();
2906
- var top = cords.top + window.pageYOffset - _this.detectionOffset;
2907
- if ((!list || !list.length || list.includes(element.id)) && // In list
2908
- top < currentScrollPosition && // In active area
2909
- lastPosition < top // Higher than the last one
2910
- ) {
2911
- lastId = element.id;
2912
- lastPosition = top;
2913
- }
2914
- });
2915
- return lastId;
2916
- };
2917
- /**
2918
- * Check if ID is active
2919
- */
2920
- ScrollService.prototype.isActive = function (id, list, isFirst) {
2921
- var lastActiveElement = this.getLastActiveElement(list);
2922
- return id === lastActiveElement || (lastActiveElement === null && isFirst);
2923
- };
2924
- /**
2925
- * Scroll done promise
2926
- */
2927
- ScrollService.prototype.scrollDone = function (options) {
2928
- if (options === void 0) { options = {}; }
2929
- return __awaiter(this, void 0, void 0, function () {
2930
- var config;
2931
- return __generator(this, function (_a) {
2932
- switch (_a.label) {
2933
- case 0:
2934
- config = Object.assign({ doneFunction: undefined }, options);
2935
- // Wait for scroll done
2936
- return [4 /*yield*/, this.scrollDoneDetection()];
2937
- case 1:
2938
- // Wait for scroll done
2939
- _a.sent();
2940
- // Get result
2941
- if (config.doneFunction) {
2942
- return [2 /*return*/, config.doneFunction()];
2943
- }
2944
- return [2 /*return*/];
2945
- }
2946
- });
2947
- });
2948
- };
2949
- /**
2950
- * Scroll done detecton
2951
- *
2952
- * @protected
2953
- */
2954
- ScrollService.prototype.scrollDoneDetection = function () {
2955
- var _this = this;
2956
- // Return current scroll promise (Singelton)
2957
- if (this.scrollPromise) {
2958
- return this.scrollPromise;
2959
- }
2960
- // Create current scroll promise
2961
- this.scrollPromise = new Promise(function (resolve) {
2962
- _this.scrollPromiseResolve = resolve;
2963
- if (_this.scrollTimer !== -1) {
2964
- window.clearTimeout(_this.scrollTimer);
2965
- }
2966
- _this.scrollTimer = window.setTimeout(function () {
2967
- window.removeEventListener('scroll', _this.scrollDoneDetection.bind(_this));
2968
- _this.scrollPromise = undefined;
2969
- resolve();
2970
- }, _this.scrollSamplingRate);
2971
- });
2972
- // Lisitening to scroll event;
2973
- window.addEventListener('scroll', this.scrollDoneDetection.bind(this));
2974
- // Return promise
2975
- return this.scrollPromise;
2976
- };
2977
- return ScrollService;
2978
- }());
2979
- ScrollService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ScrollService_Factory() { return new ScrollService(i0__namespace.ɵɵinject(i1__namespace$1.Router), i0__namespace.ɵɵinject(BASE_MODULE_CONFIG), i0__namespace.ɵɵinject(ImageService)); }, token: ScrollService, providedIn: "root" });
2980
- ScrollService.decorators = [
2981
- { type: i0.Injectable, args: [{
2982
- providedIn: 'root',
2983
- },] }
2984
- ];
2985
- ScrollService.ctorParameters = function () { return [
2986
- { type: i1$2.Router },
2987
- { type: undefined, decorators: [{ type: i0.Inject, args: [BASE_MODULE_CONFIG,] }] },
2988
- { type: ImageService }
2989
- ]; };
2990
-
2991
- /**
2992
- * SEO service for setting HTML meta data
2993
- */
2994
- var SEOService = /** @class */ (function () {
2995
- function SEOService(titleService, metaTagService) {
2996
- this.titleService = titleService;
2997
- this.metaTagService = metaTagService;
2998
- }
2999
- SEOService.prototype.initPageForSEO = function (input) {
3000
- this.setGeneralData(input);
3001
- this.setTwitterData(input);
3002
- this.setTwitterData(input);
3003
- this.setFacebookData(input);
3004
- if (input.keywords) {
3005
- this.setPageKeywords(input.keywords);
3006
- }
3007
- };
3008
- /**
3009
- * Set general metadata
3010
- *
3011
- * @param data
3012
- * @private
3013
- */
3014
- SEOService.prototype.setGeneralData = function (data) {
3015
- this.titleService.setTitle(data.title);
3016
- this.metaTagService.updateTag({ name: 'description', content: data.description });
3017
- };
3018
- /**
3019
- * Set metadata for twitter
3020
- *
3021
- * @param data
3022
- * @private
3023
- */
3024
- SEOService.prototype.setTwitterData = function (data) {
3025
- this.metaTagService.updateTag({ name: 'twitter:title', content: data.title });
3026
- this.metaTagService.updateTag({ name: 'twitter:description', content: data.description });
3027
- this.metaTagService.updateTag({
3028
- property: 'twitter:url',
3029
- content: data.url ? data.url : window.location.href,
3030
- });
3031
- if (data.image) {
3032
- this.metaTagService.updateTag({
3033
- property: 'twitter:image',
3034
- content: data.image,
3035
- });
3036
- this.metaTagService.updateTag({
3037
- property: 'twitter:card',
3038
- content: 'summary_large_image',
3039
- });
3040
- }
3041
- };
3042
- /**
3043
- * Set metadata for facebook
3044
- *
3045
- * @param data
3046
- * @private
3047
- */
3048
- SEOService.prototype.setFacebookData = function (data) {
3049
- this.metaTagService.updateTag({ property: 'og:title', content: data.title });
3050
- this.metaTagService.updateTag({ property: 'og:description', content: data.description });
3051
- this.metaTagService.updateTag({
3052
- property: 'og:type',
3053
- content: 'website',
3054
- });
3055
- this.metaTagService.updateTag({
3056
- property: 'og:url',
3057
- content: data.url ? data.url : window.location.href,
3058
- });
3059
- if (data.image) {
3060
- this.metaTagService.updateTag({
3061
- property: 'og:image',
3062
- content: data.image,
3063
- });
3064
- }
3065
- };
3066
- /**
3067
- * Set page keywords
3068
- *
3069
- * @param keywords
3070
- * @private
3071
- */
3072
- SEOService.prototype.setPageKeywords = function (keywords) {
3073
- this.metaTagService.updateTag({ name: 'keywords', content: keywords });
3074
- };
3075
- return SEOService;
3076
- }());
3077
- SEOService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function SEOService_Factory() { return new SEOService(i0__namespace.ɵɵinject(i1__namespace$2.Title), i0__namespace.ɵɵinject(i1__namespace$2.Meta)); }, token: SEOService, providedIn: "root" });
3078
- SEOService.decorators = [
3079
- { type: i0.Injectable, args: [{
3080
- providedIn: 'root',
3081
- },] }
3082
- ];
3083
- SEOService.ctorParameters = function () { return [
3084
- { type: i1.Title },
3085
- { type: i1.Meta }
3086
- ]; };
3087
-
3088
- /**
3089
- * Custom validator to check that two fields match
3090
- * (inspirated by https://jasonwatmore.com/post/2018/11/07/angular-7-reactive-forms-validation-example)
3091
- */
3092
- function MustMatch(controlName, matchingControlName) {
3093
- return function (formGroup) {
3094
- var control = formGroup.controls[controlName];
3095
- var matchingControl = formGroup.controls[matchingControlName];
3096
- if (matchingControl.errors && !matchingControl.errors.mustMatch) {
3097
- // return if another validator has already found an error on the matchingControl
3098
- return;
3099
- }
3100
- // set error on matchingControl if validation fails
3101
- if (control.value !== matchingControl.value) {
3102
- matchingControl.setErrors({ mustMatch: true });
3103
- }
3104
- else {
3105
- matchingControl.setErrors(null);
3106
- }
3107
- };
3108
- }
3109
-
3110
- /**
3111
- * Exports for public API
3112
- */
3113
-
3114
- // Export libs
3115
-
3116
- /**
3117
- * Generated bundle index. Do not edit.
3118
- */
3119
-
3120
- exports.AuthGuard = AuthGuard;
3121
- exports.AuthService = AuthService;
3122
- exports.BASE_MODULE_CONFIG = BASE_MODULE_CONFIG;
3123
- exports.BaseModule = BaseModule;
3124
- exports.BasicUser = BasicUser;
3125
- exports.CanDeactivateGuard = CanDeactivateGuard;
3126
- exports.ContextMenuDirective = ContextMenuDirective;
3127
- exports.EllipsesPipe = EllipsesPipe;
3128
- exports.FullscreenService = FullscreenService;
3129
- exports.GraphQLEnum = GraphQLEnum;
3130
- exports.GraphQLMeta = GraphQLMeta;
3131
- exports.GraphQLMetaService = GraphQLMetaService;
3132
- exports.GraphQLPlusService = GraphQLPlusService;
3133
- exports.GraphQLService = GraphQLService;
3134
- exports.GraphQLType = GraphQLType;
3135
- exports.Helper = Helper;
3136
- exports.ImageService = ImageService;
3137
- exports.LazyLoadDirective = LazyLoadDirective;
3138
- exports.LoaderService = LoaderService;
3139
- exports.LogoutGuard = LogoutGuard;
3140
- exports.MatchHeightDirective = MatchHeightDirective;
3141
- exports.MustMatch = MustMatch;
3142
- exports.ResizableDirective = ResizableDirective;
3143
- exports.SEOService = SEOService;
3144
- exports.SafeHtmlPipe = SafeHtmlPipe;
3145
- exports.ScrollService = ScrollService;
3146
- exports.Standard = Standard;
3147
- exports.StorageService = StorageService;
3148
- exports.WsService = WsService;
3149
- exports.apolloOptionsFactory = apolloOptionsFactory;
3150
-
3151
- Object.defineProperty(exports, '__esModule', { value: true });
3152
-
3153
- }));
3154
- //# sourceMappingURL=lenne.tech-ng-base.umd.js.map