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