@lenne.tech/ng-base 15.0.0-beta-2 → 16.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 (241) hide show
  1. package/base-components/base-components.module.d.ts +1 -2
  2. package/base-components/components/checkbox/checkbox.component.d.ts +1 -1
  3. package/base-components/components/delete-account/delete-account.component.d.ts +1 -1
  4. package/base-components/components/fab-button/fab-button.component.d.ts +1 -1
  5. package/base-components/components/input/input.component.d.ts +1 -1
  6. package/base-components/components/loading-bar/loading-bar.component.d.ts +1 -1
  7. package/base-components/components/model-form/model-form-base.component.d.ts +1 -1
  8. package/base-components/components/model-form/model-form.component.d.ts +1 -1
  9. package/base-components/components/model-form-sub/model-form-sub.component.d.ts +1 -1
  10. package/base-components/components/model-table/model-table.component.d.ts +17 -5
  11. package/base-components/components/refence-input/refence-input.component.d.ts +1 -1
  12. package/base-components/components/select/select.component.d.ts +1 -1
  13. package/base-components/components/skeleton-loader/skeleton-loader.component.d.ts +1 -1
  14. package/base-components/components/tags/tags.component.d.ts +1 -1
  15. package/base-components/components/textarea/textarea.component.d.ts +1 -1
  16. package/base-components/components/toast/toast.component.d.ts +1 -1
  17. package/base-components/components/upload-image/upload-image.component.d.ts +1 -1
  18. package/base-components/directives/context-menu.directive.d.ts +1 -1
  19. package/base-components/directives/sort.directive.d.ts +3 -2
  20. package/base-prototype/pages/login/login.component.d.ts +1 -1
  21. package/base-prototype/pages/profile/profile.component.d.ts +1 -1
  22. package/base-prototype/pages/set-password/set-password.component.d.ts +1 -1
  23. package/esm2022/base-cms/base-cms-routing.module.mjs +33 -0
  24. package/esm2022/base-cms/base-cms.module.mjs +61 -0
  25. package/esm2022/base-cms/pages/base-cms/base-cms.component.mjs +233 -0
  26. package/esm2022/base-components/base-components.module.mjs +123 -0
  27. package/esm2022/base-components/components/breadcrumb/breadcrumb.component.mjs +21 -0
  28. package/esm2022/base-components/components/change-password/change-password.component.mjs +96 -0
  29. package/esm2022/base-components/components/checkbox/checkbox.component.mjs +35 -0
  30. package/esm2022/base-components/components/delete-account/delete-account.component.mjs +61 -0
  31. package/esm2022/base-components/components/fab-button/fab-button.component.mjs +21 -0
  32. package/esm2022/base-components/components/input/input.component.mjs +72 -0
  33. package/esm2022/base-components/components/loading-bar/loading-bar.component.mjs +39 -0
  34. package/esm2022/base-components/components/model-form/model-form-base.component.mjs +145 -0
  35. package/esm2022/base-components/components/model-form/model-form.component.mjs +585 -0
  36. package/esm2022/base-components/components/model-form-sub/model-form-sub.component.mjs +111 -0
  37. package/esm2022/base-components/components/model-table/model-table.component.mjs +470 -0
  38. package/esm2022/base-components/components/refence-input/refence-input.component.mjs +273 -0
  39. package/esm2022/base-components/components/select/select.component.mjs +59 -0
  40. package/esm2022/base-components/components/skeleton-loader/skeleton-loader.component.mjs +32 -0
  41. package/esm2022/base-components/components/tags/tags.component.mjs +224 -0
  42. package/esm2022/base-components/components/textarea/textarea.component.mjs +76 -0
  43. package/esm2022/base-components/components/toast/toast.component.mjs +70 -0
  44. package/esm2022/base-components/components/upload-image/upload-image.component.mjs +343 -0
  45. package/esm2022/base-components/directives/back-button.directive.mjs +25 -0
  46. package/esm2022/base-components/directives/context-menu.directive.mjs +112 -0
  47. package/esm2022/base-components/directives/sort.directive.mjs +61 -0
  48. package/esm2022/base-components/directives/stop-propagation.directive.mjs +24 -0
  49. package/esm2022/base-components/pipes/ellipses.pipe.mjs +23 -0
  50. package/esm2022/base-prototype/base-prototype.module.mjs +54 -0
  51. package/esm2022/base-prototype/pages/email-verification/email-verification.component.mjs +62 -0
  52. package/esm2022/base-prototype/pages/forgot-password/forgot-password.component.mjs +75 -0
  53. package/esm2022/base-prototype/pages/login/login.component.mjs +111 -0
  54. package/esm2022/base-prototype/pages/profile/profile.component.mjs +86 -0
  55. package/esm2022/base-prototype/pages/register/register.component.mjs +94 -0
  56. package/esm2022/base-prototype/pages/set-password/set-password.component.mjs +90 -0
  57. package/esm2022/shared/classes/auth.class.mjs +14 -0
  58. package/esm2022/shared/classes/basic-user.class.mjs +49 -0
  59. package/esm2022/shared/classes/graphql-enum.class.mjs +10 -0
  60. package/esm2022/shared/classes/graphql-meta.class.mjs +345 -0
  61. package/esm2022/shared/classes/graphql-type.class.mjs +14 -0
  62. package/esm2022/shared/classes/sort.class.mjs +38 -0
  63. package/esm2022/shared/services/auth.service.mjs +153 -0
  64. package/esm2022/shared/services/breadcrumb.service.mjs +70 -0
  65. package/{esm2020 → esm2022}/shared/services/cms.service.mjs +7 -5
  66. package/esm2022/shared/services/file.service.mjs +87 -0
  67. package/esm2022/shared/services/forms.service.mjs +62 -0
  68. package/esm2022/shared/services/graphql-meta.service.mjs +133 -0
  69. package/esm2022/shared/services/graphql-plus.service.mjs +94 -0
  70. package/esm2022/shared/services/graphql.service.mjs +511 -0
  71. package/esm2022/shared/services/image.service.mjs +103 -0
  72. package/esm2022/shared/services/loader.service.mjs +79 -0
  73. package/esm2022/shared/services/navigation.service.mjs +39 -0
  74. package/esm2022/shared/services/scroll.service.mjs +208 -0
  75. package/esm2022/shared/services/storage.service.mjs +142 -0
  76. package/esm2022/shared/services/toast.service.mjs +40 -0
  77. package/esm2022/shared/services/user.service.mjs +161 -0
  78. package/esm2022/shared/services/ws.service.mjs +18 -0
  79. package/esm2022/src/base.module.mjs +98 -0
  80. package/esm2022/src/directives/lazy-load.directive.mjs +48 -0
  81. package/esm2022/src/directives/match-height.directive.mjs +92 -0
  82. package/esm2022/src/directives/resizable.directive.mjs +92 -0
  83. package/esm2022/src/factories/apollo-options.factory.mjs +108 -0
  84. package/esm2022/src/functions/extract-files.function.mjs +87 -0
  85. package/esm2022/src/guards/auth.guard.mjs +84 -0
  86. package/esm2022/src/guards/can-deactivate.guard.mjs +17 -0
  87. package/esm2022/src/guards/logout.guard.mjs +35 -0
  88. package/esm2022/src/pipes/date-ago.pipe.mjs +64 -0
  89. package/esm2022/src/pipes/safe-html.pipe.mjs +23 -0
  90. package/esm2022/src/services/fullscreen.service.mjs +52 -0
  91. package/esm2022/src/services/seo.service.mjs +100 -0
  92. package/esm2022/src/services/theme.service.mjs +45 -0
  93. package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-cms.mjs +42 -30
  94. package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-cms.mjs.map +1 -1
  95. package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-components.mjs +467 -286
  96. package/fesm2022/lenne.tech-ng-base-base-components.mjs.map +1 -0
  97. package/{fesm2020 → fesm2022}/lenne.tech-ng-base-base-prototype.mjs +127 -87
  98. package/{fesm2015 → fesm2022}/lenne.tech-ng-base-base-prototype.mjs.map +1 -1
  99. package/{fesm2020 → fesm2022}/lenne.tech-ng-base-shared.mjs +165 -113
  100. package/{fesm2020 → fesm2022}/lenne.tech-ng-base-shared.mjs.map +1 -1
  101. package/{fesm2020 → fesm2022}/lenne.tech-ng-base.mjs +113 -90
  102. package/fesm2022/lenne.tech-ng-base.mjs.map +1 -0
  103. package/package.json +27 -42
  104. package/src/directives/lazy-load.directive.d.ts +1 -1
  105. package/src/directives/match-height.directive.d.ts +1 -1
  106. package/src/directives/resizable.directive.d.ts +1 -1
  107. package/src/guards/auth.guard.d.ts +2 -2
  108. package/src/guards/can-deactivate.guard.d.ts +1 -2
  109. package/src/guards/logout.guard.d.ts +2 -2
  110. package/esm2020/base-cms/base-cms-routing.module.mjs +0 -32
  111. package/esm2020/base-cms/base-cms.module.mjs +0 -59
  112. package/esm2020/base-cms/pages/base-cms/base-cms.component.mjs +0 -222
  113. package/esm2020/base-components/base-components.module.mjs +0 -123
  114. package/esm2020/base-components/components/breadcrumb/breadcrumb.component.mjs +0 -18
  115. package/esm2020/base-components/components/change-password/change-password.component.mjs +0 -90
  116. package/esm2020/base-components/components/checkbox/checkbox.component.mjs +0 -31
  117. package/esm2020/base-components/components/delete-account/delete-account.component.mjs +0 -56
  118. package/esm2020/base-components/components/fab-button/fab-button.component.mjs +0 -21
  119. package/esm2020/base-components/components/input/input.component.mjs +0 -67
  120. package/esm2020/base-components/components/loading-bar/loading-bar.component.mjs +0 -35
  121. package/esm2020/base-components/components/model-form/model-form-base.component.mjs +0 -136
  122. package/esm2020/base-components/components/model-form/model-form.component.mjs +0 -564
  123. package/esm2020/base-components/components/model-form-sub/model-form-sub.component.mjs +0 -102
  124. package/esm2020/base-components/components/model-table/model-table.component.mjs +0 -397
  125. package/esm2020/base-components/components/refence-input/refence-input.component.mjs +0 -261
  126. package/esm2020/base-components/components/select/select.component.mjs +0 -54
  127. package/esm2020/base-components/components/skeleton-loader/skeleton-loader.component.mjs +0 -32
  128. package/esm2020/base-components/components/tags/tags.component.mjs +0 -218
  129. package/esm2020/base-components/components/textarea/textarea.component.mjs +0 -72
  130. package/esm2020/base-components/components/toast/toast.component.mjs +0 -68
  131. package/esm2020/base-components/components/upload-image/upload-image.component.mjs +0 -324
  132. package/esm2020/base-components/directives/back-button.directive.mjs +0 -23
  133. package/esm2020/base-components/directives/context-menu.directive.mjs +0 -108
  134. package/esm2020/base-components/directives/sort.directive.mjs +0 -54
  135. package/esm2020/base-components/directives/stop-propagation.directive.mjs +0 -23
  136. package/esm2020/base-components/pipes/ellipses.pipe.mjs +0 -22
  137. package/esm2020/base-prototype/base-prototype.module.mjs +0 -53
  138. package/esm2020/base-prototype/pages/email-verification/email-verification.component.mjs +0 -55
  139. package/esm2020/base-prototype/pages/forgot-password/forgot-password.component.mjs +0 -67
  140. package/esm2020/base-prototype/pages/login/login.component.mjs +0 -102
  141. package/esm2020/base-prototype/pages/profile/profile.component.mjs +0 -81
  142. package/esm2020/base-prototype/pages/register/register.component.mjs +0 -86
  143. package/esm2020/base-prototype/pages/set-password/set-password.component.mjs +0 -82
  144. package/esm2020/shared/classes/auth.class.mjs +0 -17
  145. package/esm2020/shared/classes/basic-user.class.mjs +0 -52
  146. package/esm2020/shared/classes/graphql-enum.class.mjs +0 -9
  147. package/esm2020/shared/classes/graphql-meta.class.mjs +0 -344
  148. package/esm2020/shared/classes/graphql-type.class.mjs +0 -17
  149. package/esm2020/shared/classes/sort.class.mjs +0 -40
  150. package/esm2020/shared/services/auth.service.mjs +0 -148
  151. package/esm2020/shared/services/breadcrumb.service.mjs +0 -68
  152. package/esm2020/shared/services/file.service.mjs +0 -84
  153. package/esm2020/shared/services/forms.service.mjs +0 -59
  154. package/esm2020/shared/services/graphql-meta.service.mjs +0 -123
  155. package/esm2020/shared/services/graphql-plus.service.mjs +0 -89
  156. package/esm2020/shared/services/graphql.service.mjs +0 -507
  157. package/esm2020/shared/services/image.service.mjs +0 -102
  158. package/esm2020/shared/services/loader.service.mjs +0 -79
  159. package/esm2020/shared/services/navigation.service.mjs +0 -36
  160. package/esm2020/shared/services/scroll.service.mjs +0 -179
  161. package/esm2020/shared/services/storage.service.mjs +0 -140
  162. package/esm2020/shared/services/toast.service.mjs +0 -41
  163. package/esm2020/shared/services/user.service.mjs +0 -155
  164. package/esm2020/shared/services/ws.service.mjs +0 -16
  165. package/esm2020/src/base.module.mjs +0 -97
  166. package/esm2020/src/directives/lazy-load.directive.mjs +0 -45
  167. package/esm2020/src/directives/match-height.directive.mjs +0 -84
  168. package/esm2020/src/directives/resizable.directive.mjs +0 -90
  169. package/esm2020/src/factories/apollo-options.factory.mjs +0 -106
  170. package/esm2020/src/functions/extract-files.function.mjs +0 -84
  171. package/esm2020/src/guards/auth.guard.mjs +0 -80
  172. package/esm2020/src/guards/can-deactivate.guard.mjs +0 -16
  173. package/esm2020/src/guards/logout.guard.mjs +0 -32
  174. package/esm2020/src/pipes/date-ago.pipe.mjs +0 -65
  175. package/esm2020/src/pipes/safe-html.pipe.mjs +0 -21
  176. package/esm2020/src/services/fullscreen.service.mjs +0 -51
  177. package/esm2020/src/services/seo.service.mjs +0 -97
  178. package/esm2020/src/services/theme.service.mjs +0 -43
  179. package/fesm2015/lenne.tech-ng-base-base-cms.mjs +0 -322
  180. package/fesm2015/lenne.tech-ng-base-base-cms.mjs.map +0 -1
  181. package/fesm2015/lenne.tech-ng-base-base-components.mjs +0 -2806
  182. package/fesm2015/lenne.tech-ng-base-base-components.mjs.map +0 -1
  183. package/fesm2015/lenne.tech-ng-base-base-prototype.mjs +0 -495
  184. package/fesm2015/lenne.tech-ng-base-shared.mjs +0 -2749
  185. package/fesm2015/lenne.tech-ng-base-shared.mjs.map +0 -1
  186. package/fesm2015/lenne.tech-ng-base.mjs +0 -902
  187. package/fesm2015/lenne.tech-ng-base.mjs.map +0 -1
  188. package/fesm2020/lenne.tech-ng-base-base-components.mjs.map +0 -1
  189. package/fesm2020/lenne.tech-ng-base-base-prototype.mjs.map +0 -1
  190. package/fesm2020/lenne.tech-ng-base.mjs.map +0 -1
  191. /package/{esm2020 → esm2022}/base-cms/interfaces/base-cms-module-config.interface.mjs +0 -0
  192. /package/{esm2020 → esm2022}/base-cms/lenne.tech-ng-base-base-cms.mjs +0 -0
  193. /package/{esm2020 → esm2022}/base-cms/public-api.mjs +0 -0
  194. /package/{esm2020 → esm2022}/base-components/lenne.tech-ng-base-base-components.mjs +0 -0
  195. /package/{esm2020 → esm2022}/base-components/public-api.mjs +0 -0
  196. /package/{esm2020 → esm2022}/base-prototype/lenne.tech-ng-base-base-prototype.mjs +0 -0
  197. /package/{esm2020 → esm2022}/base-prototype/public-api.mjs +0 -0
  198. /package/{esm2020 → esm2022}/lenne.tech-ng-base.mjs +0 -0
  199. /package/{esm2020 → esm2022}/public-api.mjs +0 -0
  200. /package/{esm2020 → esm2022}/shared/classes/helper.class.mjs +0 -0
  201. /package/{esm2020 → esm2022}/shared/classes/standard.class.mjs +0 -0
  202. /package/{esm2020 → esm2022}/shared/decorators/debounce.decorator.mjs +0 -0
  203. /package/{esm2020 → esm2022}/shared/enums/comparison-operator.enum.mjs +0 -0
  204. /package/{esm2020 → esm2022}/shared/enums/graphql-request-type.enum.mjs +0 -0
  205. /package/{esm2020 → esm2022}/shared/enums/logical-operator.enum.mjs +0 -0
  206. /package/{esm2020 → esm2022}/shared/enums/skeleton-type.enum.mjs +0 -0
  207. /package/{esm2020 → esm2022}/shared/enums/sort-order.enum.mjs +0 -0
  208. /package/{esm2020 → esm2022}/shared/enums/toast-type.enum.mjs +0 -0
  209. /package/{esm2020 → esm2022}/shared/functions/ws-client.function.mjs +0 -0
  210. /package/{esm2020 → esm2022}/shared/interfaces/base-module-config.interface.mjs +0 -0
  211. /package/{esm2020 → esm2022}/shared/interfaces/breadcrumb.interface.mjs +0 -0
  212. /package/{esm2020 → esm2022}/shared/interfaces/can-component-deactivate.interface.mjs +0 -0
  213. /package/{esm2020 → esm2022}/shared/interfaces/cms-enum-values.interface.mjs +0 -0
  214. /package/{esm2020 → esm2022}/shared/interfaces/cms-field-config.interface.mjs +0 -0
  215. /package/{esm2020 → esm2022}/shared/interfaces/cms-model-config.interface.mjs +0 -0
  216. /package/{esm2020 → esm2022}/shared/interfaces/cms-table-field.interface.mjs +0 -0
  217. /package/{esm2020 → esm2022}/shared/interfaces/combined-filter-input.interface.mjs +0 -0
  218. /package/{esm2020 → esm2022}/shared/interfaces/compress-options.interface.mjs +0 -0
  219. /package/{esm2020 → esm2022}/shared/interfaces/cropping-options.interface.mjs +0 -0
  220. /package/{esm2020 → esm2022}/shared/interfaces/field-object.interface.mjs +0 -0
  221. /package/{esm2020 → esm2022}/shared/interfaces/field.interface.mjs +0 -0
  222. /package/{esm2020 → esm2022}/shared/interfaces/filter-input.interface.mjs +0 -0
  223. /package/{esm2020 → esm2022}/shared/interfaces/find-args.interface.mjs +0 -0
  224. /package/{esm2020 → esm2022}/shared/interfaces/graphql-crud-type.interface.mjs +0 -0
  225. /package/{esm2020 → esm2022}/shared/interfaces/graphql-fields-object.interface.mjs +0 -0
  226. /package/{esm2020 → esm2022}/shared/interfaces/graphql-options.interface.mjs +0 -0
  227. /package/{esm2020 → esm2022}/shared/interfaces/graphql-plus-options.interfacen.mjs +0 -0
  228. /package/{esm2020 → esm2022}/shared/interfaces/graphql-type-collection.interface.mjs +0 -0
  229. /package/{esm2020 → esm2022}/shared/interfaces/login-config.interface.mjs +0 -0
  230. /package/{esm2020 → esm2022}/shared/interfaces/single-filter-input.interface.mjs +0 -0
  231. /package/{esm2020 → esm2022}/shared/interfaces/sort-input.interface.mjs +0 -0
  232. /package/{esm2020 → esm2022}/shared/interfaces/time-components.interface.mjs +0 -0
  233. /package/{esm2020 → esm2022}/shared/interfaces/toast.interface.mjs +0 -0
  234. /package/{esm2020 → esm2022}/shared/lenne.tech-ng-base-shared.mjs +0 -0
  235. /package/{esm2020 → esm2022}/shared/public-api.mjs +0 -0
  236. /package/{esm2020 → esm2022}/shared/types/graphql-fields.type.mjs +0 -0
  237. /package/{esm2020 → esm2022}/shared/types/storage.type.mjs +0 -0
  238. /package/{esm2020 → esm2022}/shared/validators/email.validator.mjs +0 -0
  239. /package/{esm2020 → esm2022}/shared/validators/match.validator.mjs +0 -0
  240. /package/{esm2020 → esm2022}/shared/validators/secure-password.validator.mjs +0 -0
  241. /package/{esm2020 → esm2022}/src/decorators/auto-unsubscribe.decorator.mjs +0 -0
@@ -1,902 +0,0 @@
1
- import { APOLLO_OPTIONS, ApolloModule } from 'apollo-angular';
2
- import { HttpLink } from 'apollo-angular/http';
3
- import * as i0 from '@angular/core';
4
- import { Directive, HostBinding, Input, PLATFORM_ID, Inject, HostListener, Pipe, NgModule, Injectable } from '@angular/core';
5
- import { ApolloLink, fromPromise, split, concat } from '@apollo/client/core';
6
- import { InMemoryCache } from '@apollo/client/cache';
7
- import { getMainDefinition } from '@apollo/client/utilities';
8
- import * as i2 from '@lenne.tech/ng-base/shared';
9
- import { createRestartableClient, BASE_MODULE_CONFIG, AuthService, WsService } from '@lenne.tech/ng-base/shared';
10
- import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
11
- import { firstValueFrom, Observable, BehaviorSubject } from 'rxjs';
12
- import { onError } from '@apollo/client/link/error';
13
- import { __awaiter } from 'tslib';
14
- import { isPlatformBrowser } from '@angular/common';
15
- import * as i1 from '@angular/platform-browser';
16
- import { HttpClientModule } from '@angular/common/http';
17
- import * as i1$1 from '@angular/router';
18
-
19
- /**
20
- * Inspired by Inpspired by https://github.com/jaydenseric/extract-files/releases/tag/v11.0.0
21
- */
22
- /**
23
- * Reactive native file
24
- */
25
- class ReactNativeFile {
26
- constructor(uri, name, type) {
27
- this.uri = uri;
28
- this.name = name;
29
- this.type = type;
30
- }
31
- }
32
- /**
33
- * Check whether value is an extractable file
34
- */
35
- function isExtractableFile(value) {
36
- return ((typeof File !== 'undefined' && value instanceof File) ||
37
- (typeof Blob !== 'undefined' && value instanceof Blob) ||
38
- value instanceof ReactNativeFile);
39
- }
40
- /**
41
- * Clones a value, recursively extracting
42
- */
43
- function extractFiles(value, path = '', isExtractableFileFunc = isExtractableFile) {
44
- // Map of extracted files and their object paths within the input value.
45
- const files = new Map();
46
- // Map of arrays and objects recursed within the input value and their clones,
47
- // for reusing clones of values that are referenced multiple times within the
48
- // input value.
49
- const clones = new Map();
50
- /**
51
- * Recursively clones the value, extracting files.
52
- */
53
- function recurse(recurseValue, recursePath, recursed) {
54
- let clone = recurseValue;
55
- if (isExtractableFileFunc(recurseValue)) {
56
- clone = null;
57
- const filePaths = files.get(recurseValue);
58
- filePaths ? filePaths.push(recursePath) : files.set(recurseValue, [recursePath]);
59
- }
60
- else {
61
- const isList = Array.isArray(recurseValue) || (typeof FileList !== 'undefined' && recurseValue instanceof FileList);
62
- const isObject = recurseValue && recurseValue.constructor === Object;
63
- if (isList || isObject) {
64
- const hasClone = clones.has(recurseValue);
65
- if (hasClone) {
66
- clone = clones.get(recurseValue);
67
- }
68
- else {
69
- clone = isList ? [] : {};
70
- clones.set(recurseValue, clone);
71
- }
72
- if (!recursed.has(recurseValue)) {
73
- const pathPrefix = recursePath ? `${recursePath}.` : '';
74
- const recursedDeeper = new Set(recursed).add(recurseValue);
75
- if (isList) {
76
- let index = 0;
77
- for (const item of recurseValue) {
78
- const itemClone = recurse(item, pathPrefix + index++, recursedDeeper);
79
- if (!hasClone) {
80
- clone.push(itemClone);
81
- }
82
- }
83
- }
84
- else {
85
- for (const key of Object.keys(recurseValue)) {
86
- const propertyClone = recurse(recurseValue[key], pathPrefix + key, recursedDeeper);
87
- if (!hasClone) {
88
- clone[key] = propertyClone;
89
- }
90
- }
91
- }
92
- }
93
- }
94
- }
95
- return clone;
96
- }
97
- return {
98
- clone: recurse(value, path, new Set()),
99
- files,
100
- };
101
- }
102
-
103
- /**
104
- * Factory for apollo-angular options
105
- */
106
- function apolloOptionsFactory(baseModuleConfig, httpLink, authService, wsService) {
107
- const links = [];
108
- const http = httpLink.create({
109
- uri: baseModuleConfig.apiUrl,
110
- extractFiles,
111
- });
112
- const authMiddleware = new ApolloLink((operation, forward) => {
113
- var _a, _b, _c, _d;
114
- const headers = {};
115
- const operationName = (_d = (_c = (_b = (_a = operation.query.definitions[0]) === null || _a === void 0 ? void 0 : _a.selectionSet) === null || _b === void 0 ? void 0 : _b.selections[0]) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.value;
116
- if (localStorage) {
117
- let token;
118
- if (operationName === 'refreshToken') {
119
- token = authService.refreshToken || null;
120
- }
121
- else {
122
- token = authService.token || null;
123
- }
124
- if (token) {
125
- headers.Authorization = 'Bearer ' + token;
126
- }
127
- operation.setContext(() => ({ headers }));
128
- }
129
- return forward(operation);
130
- });
131
- const errorLink = onError(({ graphQLErrors, networkError, operation, forward }) => {
132
- if (graphQLErrors) {
133
- for (const err of graphQLErrors) {
134
- switch (err.extensions.code) {
135
- case 'UNAUTHENTICATED': {
136
- if (err.message !== 'Expired refresh token' && err.message !== 'Expired token') {
137
- return;
138
- }
139
- if (err.message === 'Expired refresh token') {
140
- authService.clearSession();
141
- return;
142
- }
143
- return fromPromise(firstValueFrom(authService.requestNewToken()))
144
- .filter((value) => Boolean(value))
145
- .flatMap((response) => {
146
- const oldHeaders = operation.getContext().headers;
147
- // modify the operation context with a new token
148
- operation.setContext({
149
- headers: Object.assign(Object.assign({}, oldHeaders), { Authorization: `Bearer ${response.token}` }),
150
- });
151
- // retry the request, returning the new observable
152
- return forward(operation);
153
- });
154
- }
155
- }
156
- }
157
- }
158
- });
159
- if (baseModuleConfig.logging) {
160
- console.log(baseModuleConfig);
161
- }
162
- if (baseModuleConfig.wsUrl) {
163
- const wsLink = new GraphQLWsLink(createRestartableClient({
164
- url: baseModuleConfig.wsUrl,
165
- connectionParams: () => {
166
- return {
167
- Authorization: authService.token ? 'Bearer ' + authService.token : undefined,
168
- };
169
- },
170
- }));
171
- // Set client for reconnection on logout/login
172
- wsService.client = wsLink.client;
173
- // using the ability to split links, you can send data to each link
174
- // depending on what kind of operation is being sent
175
- links.push(split(
176
- // split based on operation type
177
- ({ query }) => {
178
- // @ts-ignore
179
- const { kind, operation } = getMainDefinition(query);
180
- return kind === 'OperationDefinition' && operation === 'subscription';
181
- }, wsLink, concat(concat(authMiddleware, errorLink), http)));
182
- }
183
- else {
184
- links.push(authMiddleware);
185
- links.push(errorLink);
186
- links.push(http);
187
- }
188
- return {
189
- link: ApolloLink.from(links),
190
- cache: new InMemoryCache(),
191
- defaultOptions: {
192
- query: {
193
- fetchPolicy: 'network-only',
194
- },
195
- },
196
- };
197
- }
198
-
199
- /**
200
- * Directive for lazy loading images
201
- */
202
- class LazyLoadDirective {
203
- constructor(el) {
204
- this.el = el;
205
- this.srcAttr = null;
206
- }
207
- ngAfterViewInit() {
208
- this.canLazyLoad() ? this.lazyLoadImage() : this.loadImage();
209
- }
210
- canLazyLoad() {
211
- return window && 'IntersectionObserver' in window;
212
- }
213
- lazyLoadImage() {
214
- const obs = new IntersectionObserver((entries) => {
215
- entries.forEach(({ isIntersecting }) => {
216
- if (isIntersecting) {
217
- this.loadImage();
218
- obs.unobserve(this.el.nativeElement);
219
- }
220
- });
221
- });
222
- obs.observe(this.el.nativeElement);
223
- }
224
- loadImage() {
225
- this.srcAttr = this.src;
226
- }
227
- }
228
- LazyLoadDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LazyLoadDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
229
- LazyLoadDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.5", type: LazyLoadDirective, selector: "img[ltLazyLoad]", inputs: { src: "src" }, host: { properties: { "attr.src": "this.srcAttr" } }, ngImport: i0 });
230
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LazyLoadDirective, decorators: [{
231
- type: Directive,
232
- args: [{
233
- selector: 'img[ltLazyLoad]',
234
- }]
235
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { srcAttr: [{
236
- type: HostBinding,
237
- args: ['attr.src']
238
- }], src: [{
239
- type: Input
240
- }] } });
241
-
242
- /**
243
- * Set same height (maximum) to different elements
244
- */
245
- class MatchHeightDirective {
246
- constructor(el, imageService, platformId) {
247
- this.el = el;
248
- this.imageService = imageService;
249
- // Replace lazy loading images with immediate loading images
250
- this.loadImages = true;
251
- this.isBrowser = isPlatformBrowser(platformId);
252
- }
253
- onResize() {
254
- this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
255
- }
256
- ngAfterViewInit() {
257
- this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
258
- this.observer = new MutationObserver(() => {
259
- this.matchHeight(this.el.nativeElement, this.ltMatchHeight);
260
- });
261
- //Observes if one or more elements get added to or removed from the childlist and applies matching heights
262
- this.observer.observe(this.el.nativeElement, { childList: true });
263
- }
264
- matchHeight(parent, target) {
265
- return __awaiter(this, void 0, void 0, function* () {
266
- if (!parent) {
267
- return;
268
- }
269
- let classNames;
270
- if (!Array.isArray(target)) {
271
- classNames = [target];
272
- }
273
- else {
274
- classNames = target;
275
- }
276
- for (const className of classNames) {
277
- // find all child structureElements with the selected class name
278
- const children = parent.getElementsByClassName(className);
279
- if (!children || children.length < 2) {
280
- continue;
281
- }
282
- // Load images of children
283
- if (this.loadImages) {
284
- yield this.imageService.preLoadImages({ elements: children });
285
- }
286
- // reset all children height
287
- Array.from(children).forEach((element) => {
288
- element.style.height = 'initial';
289
- });
290
- // get all the child structureElements heights
291
- const itemHeights = Array.from(children).map((element) => {
292
- if (element.getBoundingClientRect) {
293
- return element.getBoundingClientRect().height;
294
- }
295
- return 0;
296
- });
297
- // find out the tallest one
298
- const maxHeight = itemHeights.reduce((prev, curr) => (curr > prev ? curr : prev), 0);
299
- // update the child structureElements height to the tallest one
300
- Array.from(children).forEach((element) => (element.style.height = `${maxHeight}px`));
301
- }
302
- });
303
- }
304
- }
305
- MatchHeightDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MatchHeightDirective, deps: [{ token: i0.ElementRef }, { token: i2.ImageService }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive });
306
- MatchHeightDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.5", type: MatchHeightDirective, selector: "[ltMatchHeight]", inputs: { ltMatchHeight: "ltMatchHeight", loadImages: "loadImages" }, host: { listeners: { "window:resize": "onResize()" } }, ngImport: i0 });
307
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: MatchHeightDirective, decorators: [{
308
- type: Directive,
309
- args: [{
310
- selector: '[ltMatchHeight]',
311
- }]
312
- }], ctorParameters: function () {
313
- return [{ type: i0.ElementRef }, { type: i2.ImageService }, { type: undefined, decorators: [{
314
- type: Inject,
315
- args: [PLATFORM_ID]
316
- }] }];
317
- }, propDecorators: { ltMatchHeight: [{
318
- type: Input
319
- }], loadImages: [{
320
- type: Input
321
- }], onResize: [{
322
- type: HostListener,
323
- args: ['window:resize']
324
- }] } });
325
-
326
- /**
327
- * Reszise detection
328
- * (inpsired by: https://stackblitz.com/edit/angular-resizable)
329
- */
330
- class ResizableDirective {
331
- constructor(el) {
332
- this.el = el;
333
- this.resizableGrabWidth = 8;
334
- this.resizableMinWidth = 10;
335
- this.dragging = false;
336
- }
337
- ngOnInit() {
338
- this.addListenerToDocument();
339
- this.addListenerToElement();
340
- }
341
- mouseMoveG(evt) {
342
- if (!this.dragging) {
343
- return;
344
- }
345
- this.newWidth(evt.clientX - this.el.nativeElement.offsetLeft);
346
- evt.stopPropagation();
347
- }
348
- newWidth(wid) {
349
- const result = Math.max(this.resizableMinWidth, wid);
350
- this.el.nativeElement.style.width = result + 'px';
351
- }
352
- mouseDown(evt) {
353
- if (this.inDragRegion(evt)) {
354
- this.dragging = true;
355
- this.preventGlobalMouseEvents();
356
- evt.stopPropagation();
357
- }
358
- }
359
- restoreGlobalMouseEvents() {
360
- document.body.style['pointer-events'] = 'auto';
361
- }
362
- mouseUpG(evt) {
363
- if (!this.dragging) {
364
- return;
365
- }
366
- this.restoreGlobalMouseEvents();
367
- this.dragging = false;
368
- evt.stopPropagation();
369
- }
370
- mouseMove(evt) {
371
- if (this.inDragRegion(evt) || this.dragging) {
372
- this.el.nativeElement.style.cursor = 'col-resize';
373
- }
374
- else {
375
- this.el.nativeElement.style.cursor = 'default';
376
- }
377
- }
378
- preventGlobalMouseEvents() {
379
- document.body.style['pointer-events'] = 'none';
380
- }
381
- inDragRegion(evt) {
382
- return this.el.nativeElement.clientWidth - evt.clientX + this.el.nativeElement.offsetLeft < this.resizableGrabWidth;
383
- }
384
- addListenerToDocument() {
385
- document.addEventListener('mousemove', (e) => {
386
- this.mouseMoveG(e);
387
- }, true);
388
- document.addEventListener('mouseup', (e) => {
389
- this.mouseUpG(e);
390
- }, true);
391
- }
392
- addListenerToElement() {
393
- this.el.nativeElement.addEventListener('mousedown', (e) => {
394
- this.mouseDown(e);
395
- }, true);
396
- this.el.nativeElement.addEventListener('mousemove', (e) => {
397
- this.mouseMove(e);
398
- }, true);
399
- }
400
- }
401
- ResizableDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ResizableDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
402
- ResizableDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.5", type: ResizableDirective, selector: "[ltResizable]", inputs: { resizableGrabWidth: "resizableGrabWidth", resizableMinWidth: "resizableMinWidth" }, ngImport: i0 });
403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ResizableDirective, decorators: [{
404
- type: Directive,
405
- args: [{
406
- selector: '[ltResizable]',
407
- }]
408
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { resizableGrabWidth: [{
409
- type: Input
410
- }], resizableMinWidth: [{
411
- type: Input
412
- }] } });
413
-
414
- /**
415
- * Declarate html as safe
416
- */
417
- class SafeHtmlPipe {
418
- constructor(sanitized) {
419
- this.sanitized = sanitized;
420
- }
421
- transform(value) {
422
- return this.sanitized.bypassSecurityTrustHtml(value);
423
- }
424
- }
425
- SafeHtmlPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: SafeHtmlPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
426
- SafeHtmlPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: SafeHtmlPipe, name: "ltSafeHtml" });
427
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: SafeHtmlPipe, decorators: [{
428
- type: Pipe,
429
- args: [{ name: 'ltSafeHtml' }]
430
- }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });
431
-
432
- class DateAgoPipe {
433
- constructor() {
434
- this.intervals = {
435
- year: 31536000,
436
- month: 2592000,
437
- week: 604800,
438
- day: 86400,
439
- hour: 3600,
440
- minute: 60,
441
- second: 1,
442
- };
443
- this.singular = {
444
- year: 'Jahr',
445
- month: 'Monat',
446
- week: 'Woche',
447
- day: 'Tag',
448
- hour: 'Stunde',
449
- minute: 'Minute',
450
- second: 'Sekunde',
451
- };
452
- this.plural = {
453
- year: 'Jahren',
454
- month: 'Monaten',
455
- week: 'Wochen',
456
- day: 'Tagen',
457
- hour: 'Stunden',
458
- minute: 'Minuten',
459
- second: 'Sekunden',
460
- };
461
- }
462
- transform(value, currentDate) {
463
- const now = currentDate !== null && currentDate !== void 0 ? currentDate : new Date();
464
- if (value) {
465
- const seconds = Math.floor((+now - +new Date(value)) / 1000);
466
- if (seconds < 29) {
467
- return 'gerade eben'; // less than 30 seconds ago will show as 'Just now'
468
- }
469
- let counter;
470
- for (const i of Object.keys(this.intervals)) {
471
- counter = Math.floor(seconds / this.intervals[i]);
472
- if (counter > 0) {
473
- if (counter === 1) {
474
- return 'vor ' + counter + ' ' + this.singular[i]; // singular (1 day ago)
475
- }
476
- else {
477
- return 'vor ' + counter + ' ' + this.plural[i]; // plural (2 days ago)
478
- }
479
- }
480
- }
481
- }
482
- return value;
483
- }
484
- }
485
- DateAgoPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DateAgoPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
486
- DateAgoPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: DateAgoPipe, name: "dateAgo" });
487
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: DateAgoPipe, decorators: [{
488
- type: Pipe,
489
- args: [{
490
- name: 'dateAgo',
491
- pure: true,
492
- }]
493
- }] });
494
-
495
- // Imported and exported elements
496
- const elements = [
497
- // Directives
498
- LazyLoadDirective,
499
- MatchHeightDirective,
500
- ResizableDirective,
501
- // Pipes
502
- SafeHtmlPipe,
503
- DateAgoPipe,
504
- ];
505
- /**
506
- * Base module
507
- */
508
- class BaseModule {
509
- /**
510
- * Set configuration of base module in root module of the app
511
- */
512
- static forRoot(baseModuleConfig = {}, AppAuthService) {
513
- // Default config
514
- const config = Object.assign({ apiUrl: '', authGuardRedirectUrl: '/auth', logging: false, version: null, prefix: null, scrollDetectionOffset: 200, scrollOffset: 100, storageType: 'local', securePasswordTransfer: true }, baseModuleConfig);
515
- if (config.logging) {
516
- console.log('Config:', config);
517
- }
518
- // Prepare providers
519
- const providers = [
520
- {
521
- provide: BASE_MODULE_CONFIG,
522
- useValue: config,
523
- },
524
- ];
525
- // Add apollo features if API URL is set
526
- if (baseModuleConfig.apiUrl) {
527
- providers.push({
528
- provide: APOLLO_OPTIONS,
529
- useFactory: apolloOptionsFactory,
530
- deps: [BASE_MODULE_CONFIG, HttpLink, AppAuthService ? AppAuthService : AuthService, WsService],
531
- });
532
- }
533
- else if (config.logging) {
534
- console.log('apiUrl is missing, ApolloLink is not initialized');
535
- }
536
- // Return root module
537
- return {
538
- ngModule: BaseModule,
539
- providers,
540
- };
541
- }
542
- }
543
- BaseModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: BaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
544
- BaseModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.5", ngImport: i0, type: BaseModule, declarations: [
545
- // Directives
546
- LazyLoadDirective,
547
- MatchHeightDirective,
548
- ResizableDirective,
549
- // Pipes
550
- SafeHtmlPipe,
551
- DateAgoPipe
552
- ], imports: [ApolloModule, HttpClientModule], exports: [
553
- // Directives
554
- LazyLoadDirective,
555
- MatchHeightDirective,
556
- ResizableDirective,
557
- // Pipes
558
- SafeHtmlPipe,
559
- DateAgoPipe, ApolloModule, HttpClientModule
560
- ] });
561
- BaseModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: BaseModule, imports: [ApolloModule, HttpClientModule, ApolloModule, HttpClientModule] });
562
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: BaseModule, decorators: [{
563
- type: NgModule,
564
- args: [{
565
- imports: [ApolloModule, HttpClientModule],
566
- declarations: elements,
567
- exports: [...elements, ApolloModule, HttpClientModule],
568
- }]
569
- }] });
570
-
571
- /**
572
- * Decorator for automatically unsubscribe subscriptions
573
- * Inspired by https://codereacter.medium.com/angular-advanced-features-and-tips-you-may-not-know-about-cae3b8527184#9bd6
574
- */
575
- function AutoUnsubscribe(blackList = []) {
576
- return function (constructor) {
577
- const original = constructor.prototype.ngOnDestroy;
578
- constructor.prototype.ngOnDestroy = function () {
579
- for (const prop of Object.keys(this)) {
580
- if (!blackList.includes(prop)) {
581
- const property = this[prop];
582
- if (property && typeof property.unsubscribe === 'function') {
583
- property.unsubscribe();
584
- }
585
- }
586
- }
587
- if (original && typeof original === 'function') {
588
- original.apply(this, arguments);
589
- }
590
- };
591
- };
592
- }
593
-
594
- /**
595
- * Authentication guard
596
- */
597
- class AuthGuard {
598
- /**
599
- * Imports
600
- */
601
- constructor(router, authService, moduleConfig) {
602
- this.router = router;
603
- this.authService = authService;
604
- this.moduleConfig = moduleConfig;
605
- }
606
- /**
607
- * Can activate main route
608
- */
609
- canActivate(route, state) {
610
- return new Observable((subscriber) => {
611
- var _a, _b, _c, _d, _e, _f, _g;
612
- let allowed = false;
613
- let redirected = false;
614
- /* If the user is logged in and the route is not marked as opposite, then the user is allowed to access the route. */
615
- const 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;
616
- const redirectAuthUrl = ((_c = route === null || route === void 0 ? void 0 : route.data) === null || _c === void 0 ? void 0 : _c.redirectAuthUrl)
617
- ? route.data.redirectAuthUrl
618
- : this.moduleConfig.authGuardRedirectUrl;
619
- const redirectRoleUrl = ((_d = route === null || route === void 0 ? void 0 : route.data) === null || _d === void 0 ? void 0 : _d.redirectRoleUrl)
620
- ? route.data.redirectRoleUrl
621
- : this.moduleConfig.authGuardRedirectUrl;
622
- const disableQueryParams = (_f = (_e = route === null || route === void 0 ? void 0 : route.data) === null || _e === void 0 ? void 0 : _e.disableQueryParams) !== null && _f !== void 0 ? _f : false;
623
- const queryParams = disableQueryParams
624
- ? {}
625
- : {
626
- queryParams: {
627
- redirectUrl: route['_routerState'].url,
628
- },
629
- };
630
- if (this.authService.token && !opposite) {
631
- if ((_g = route.data) === null || _g === void 0 ? void 0 : _g.roles) {
632
- const user = this.authService.currentUser;
633
- allowed = !!route.data.roles.find((role) => { var _a; return (_a = user.roles) === null || _a === void 0 ? void 0 : _a.includes(role); });
634
- if (!allowed && redirectRoleUrl) {
635
- this.router.navigate([redirectRoleUrl], queryParams);
636
- redirected = true;
637
- }
638
- }
639
- else {
640
- allowed = true;
641
- }
642
- }
643
- else if (!this.authService.token && opposite) {
644
- allowed = true;
645
- }
646
- if (!allowed && redirectAuthUrl && !redirected) {
647
- this.router.navigate([redirectAuthUrl], queryParams);
648
- }
649
- subscriber.next(allowed);
650
- subscriber.complete();
651
- });
652
- }
653
- /**
654
- * Can activate child route
655
- */
656
- canActivateChild(route, state) {
657
- return this.canActivate(route, state);
658
- }
659
- }
660
- AuthGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthGuard, deps: [{ token: i1$1.Router }, { token: i2.AuthService }, { token: BASE_MODULE_CONFIG }], target: i0.ɵɵFactoryTarget.Injectable });
661
- AuthGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthGuard });
662
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: AuthGuard, decorators: [{
663
- type: Injectable
664
- }], ctorParameters: function () {
665
- return [{ type: i1$1.Router }, { type: i2.AuthService }, { type: undefined, decorators: [{
666
- type: Inject,
667
- args: [BASE_MODULE_CONFIG]
668
- }] }];
669
- } });
670
-
671
- /**
672
- * Guard to check if a component can be deactivated
673
- */
674
- class CanDeactivateGuard {
675
- canDeactivate(component) {
676
- return component.canDeactivate ? component.canDeactivate() : true;
677
- }
678
- }
679
- CanDeactivateGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: CanDeactivateGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
680
- CanDeactivateGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: CanDeactivateGuard });
681
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: CanDeactivateGuard, decorators: [{
682
- type: Injectable
683
- }] });
684
-
685
- /**
686
- * Logout guard
687
- */
688
- class LogoutGuard {
689
- constructor(router, authService) {
690
- this.router = router;
691
- this.authService = authService;
692
- }
693
- canActivate(route, state) {
694
- return new Observable((subscriber) => {
695
- if (this.authService.token) {
696
- this.authService.logout();
697
- }
698
- subscriber.next(true);
699
- subscriber.complete();
700
- });
701
- }
702
- canActivateChild(route, state) {
703
- return this.canActivate(route, state);
704
- }
705
- }
706
- LogoutGuard.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LogoutGuard, deps: [{ token: i1$1.Router }, { token: i2.AuthService }], target: i0.ɵɵFactoryTarget.Injectable });
707
- LogoutGuard.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LogoutGuard });
708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: LogoutGuard, decorators: [{
709
- type: Injectable
710
- }], ctorParameters: function () { return [{ type: i1$1.Router }, { type: i2.AuthService }]; } });
711
-
712
- /**
713
- * Fullscreen service
714
- */
715
- class FullscreenService {
716
- constructor() {
717
- this._isFullscreenActive = new BehaviorSubject(false);
718
- this.listenToFullscreenEvent();
719
- }
720
- get fullscreenState() {
721
- return this._isFullscreenActive.value;
722
- }
723
- get fullscreenStateAsObservable() {
724
- return this._isFullscreenActive.asObservable();
725
- }
726
- toggleFullscreen() {
727
- const elem = document.documentElement;
728
- if (!this._isFullscreenActive.value) {
729
- elem.requestFullscreen();
730
- this._isFullscreenActive.next(true);
731
- }
732
- else {
733
- document.exitFullscreen();
734
- this._isFullscreenActive.next(false);
735
- }
736
- }
737
- /**
738
- * Event Listener for fullscreen toggle
739
- */
740
- listenToFullscreenEvent() {
741
- document.addEventListener('fullscreenchange', () => {
742
- if (document.fullscreenElement) {
743
- this._isFullscreenActive.next(true);
744
- }
745
- else {
746
- this._isFullscreenActive.next(false);
747
- }
748
- });
749
- }
750
- }
751
- FullscreenService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FullscreenService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
752
- FullscreenService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FullscreenService, providedIn: 'root' });
753
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: FullscreenService, decorators: [{
754
- type: Injectable,
755
- args: [{
756
- providedIn: 'root',
757
- }]
758
- }], ctorParameters: function () { return []; } });
759
-
760
- /**
761
- * SEO service for setting HTML meta data
762
- */
763
- class SEOService {
764
- constructor(titleService, metaTagService) {
765
- this.titleService = titleService;
766
- this.metaTagService = metaTagService;
767
- }
768
- initPageForSEO(input) {
769
- this.setGeneralData(input);
770
- this.setTwitterData(input);
771
- this.setTwitterData(input);
772
- this.setFacebookData(input);
773
- if (input.keywords) {
774
- this.setPageKeywords(input.keywords);
775
- }
776
- }
777
- /**
778
- * Set general metadata
779
- *
780
- * @param data
781
- * @private
782
- */
783
- setGeneralData(data) {
784
- this.titleService.setTitle(data.title);
785
- this.metaTagService.updateTag({ name: 'description', content: data.description });
786
- }
787
- /**
788
- * Set metadata for twitter
789
- *
790
- * @param data
791
- * @private
792
- */
793
- setTwitterData(data) {
794
- this.metaTagService.updateTag({ name: 'twitter:title', content: data.title });
795
- this.metaTagService.updateTag({ name: 'twitter:description', content: data.description });
796
- this.metaTagService.updateTag({
797
- property: 'twitter:url',
798
- content: data.url ? data.url : window === null || window === void 0 ? void 0 : window.location.href,
799
- });
800
- if (data.image) {
801
- this.metaTagService.updateTag({
802
- property: 'twitter:image',
803
- content: data.image,
804
- });
805
- this.metaTagService.updateTag({
806
- property: 'twitter:card',
807
- content: 'summary_large_image',
808
- });
809
- }
810
- }
811
- /**
812
- * Set metadata for facebook
813
- *
814
- * @param data
815
- * @private
816
- */
817
- setFacebookData(data) {
818
- this.metaTagService.updateTag({ property: 'og:title', content: data.title });
819
- this.metaTagService.updateTag({ property: 'og:description', content: data.description });
820
- this.metaTagService.updateTag({
821
- property: 'og:type',
822
- content: 'website',
823
- });
824
- this.metaTagService.updateTag({
825
- property: 'og:url',
826
- content: data.url ? data.url : window === null || window === void 0 ? void 0 : window.location.href,
827
- });
828
- if (data.image) {
829
- this.metaTagService.updateTag({
830
- property: 'og:image',
831
- content: data.image,
832
- });
833
- }
834
- }
835
- /**
836
- * Set page keywords
837
- *
838
- * @param keywords
839
- * @private
840
- */
841
- setPageKeywords(keywords) {
842
- this.metaTagService.updateTag({ name: 'keywords', content: keywords });
843
- }
844
- }
845
- SEOService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: SEOService, deps: [{ token: i1.Title }, { token: i1.Meta }], target: i0.ɵɵFactoryTarget.Injectable });
846
- SEOService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: SEOService, providedIn: 'root' });
847
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: SEOService, decorators: [{
848
- type: Injectable,
849
- args: [{
850
- providedIn: 'root',
851
- }]
852
- }], ctorParameters: function () { return [{ type: i1.Title }, { type: i1.Meta }]; } });
853
-
854
- class ThemeService {
855
- get theme() {
856
- return this._theme.value;
857
- }
858
- set theme(theme) {
859
- this._theme.next(theme);
860
- this.storageService.save('theme', theme);
861
- }
862
- get themeObservable() {
863
- return this._theme.asObservable();
864
- }
865
- constructor(storageService) {
866
- this.storageService = storageService;
867
- this._theme = new BehaviorSubject('light');
868
- // Load from storage
869
- this.theme = this.storageService.load('theme');
870
- // Use system theme if no theme is set
871
- if (!this.theme) {
872
- this.checkSystemTheme();
873
- }
874
- }
875
- /**
876
- * Check theme from system
877
- */
878
- checkSystemTheme() {
879
- if (window === null || window === void 0 ? void 0 : window.matchMedia) {
880
- this.theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
881
- }
882
- }
883
- }
884
- ThemeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ThemeService, deps: [{ token: i2.StorageService }], target: i0.ɵɵFactoryTarget.Injectable });
885
- ThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ThemeService, providedIn: 'root' });
886
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: ThemeService, decorators: [{
887
- type: Injectable,
888
- args: [{
889
- providedIn: 'root',
890
- }]
891
- }], ctorParameters: function () { return [{ type: i2.StorageService }]; } });
892
-
893
- /**
894
- * Exports for public API
895
- */
896
-
897
- /**
898
- * Generated bundle index. Do not edit.
899
- */
900
-
901
- export { AuthGuard, AutoUnsubscribe, BaseModule, CanDeactivateGuard, DateAgoPipe, FullscreenService, LazyLoadDirective, LogoutGuard, MatchHeightDirective, ResizableDirective, SEOService, SafeHtmlPipe, ThemeService, apolloOptionsFactory };
902
- //# sourceMappingURL=lenne.tech-ng-base.mjs.map