@osovitny/anatoly 2.1.14 → 2.14.2

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 (168) hide show
  1. package/assets/styles/alerts.less +182 -0
  2. package/assets/styles/spinner.less +64 -0
  3. package/assets/styles/toastr.less +192 -0
  4. package/{esm2015/lib/core/consts/settings.js → esm2020/lib/core/consts/settings.mjs} +2 -2
  5. package/{esm2015/lib/core/convert.js → esm2020/lib/core/convert.mjs} +2 -2
  6. package/esm2020/lib/core/core.module.mjs +72 -0
  7. package/esm2020/lib/core/go/base-go.service.mjs +41 -0
  8. package/{esm2015/lib/core/guards/once-import.guard.js → esm2020/lib/core/guards/once-import.guard.mjs} +2 -2
  9. package/{esm2015/lib/core/guid.js → esm2020/lib/core/guid.mjs} +2 -2
  10. package/esm2020/lib/core/interceptors/httpInterceptor.mjs +108 -0
  11. package/esm2020/lib/core/localization/localization.module.mjs +47 -0
  12. package/esm2020/lib/core/localization/localization.service.mjs +185 -0
  13. package/esm2020/lib/core/localization/localizationSettings.module.mjs +88 -0
  14. package/esm2020/lib/core/localization/localize.pipe.mjs +78 -0
  15. package/{esm2015/lib/core/localization/utils.js → esm2020/lib/core/localization/utils.mjs} +2 -2
  16. package/esm2020/lib/core/logging/globalErrorHandler.mjs +44 -0
  17. package/esm2020/lib/core/logging/logging.service.mjs +39 -0
  18. package/{esm2015/lib/core/notifications/alerts.js → esm2020/lib/core/notifications/alerts.mjs} +2 -2
  19. package/{esm2015/lib/core/notifications/interfaces/notification.js → esm2020/lib/core/notifications/interfaces/notification.mjs} +2 -2
  20. package/esm2020/lib/core/notifications/services/notification-service.mjs +228 -0
  21. package/esm2020/lib/core/services/appcontext.service.mjs +118 -0
  22. package/esm2020/lib/core/services/dm.service.mjs +72 -0
  23. package/esm2020/lib/core/services/google-analytics.service.mjs +54 -0
  24. package/{esm2015/lib/core/services/idle.service.js → esm2020/lib/core/services/idle.service.mjs} +10 -8
  25. package/{esm2015/lib/core/services/loading.service.js → esm2020/lib/core/services/loading.service.mjs} +10 -9
  26. package/esm2020/lib/core/services/web-storage.service.mjs +69 -0
  27. package/{esm2015/lib/core/subs.js → esm2020/lib/core/subs.mjs} +2 -2
  28. package/esm2020/lib/core/utils.mjs +82 -0
  29. package/esm2020/lib/data/base/base-api.service.mjs +89 -0
  30. package/esm2020/lib/data/base/grid/base-grid-edit.service.mjs +77 -0
  31. package/esm2020/lib/data/base/grid/base-grid-read.service.mjs +62 -0
  32. package/{esm2015/lib/data/consts.js → esm2020/lib/data/consts.mjs} +2 -2
  33. package/esm2020/lib/data/data.module.mjs +51 -0
  34. package/esm2020/lib/data/services/billing-api.service.mjs +65 -0
  35. package/esm2020/lib/data/services/emails-api.service.mjs +42 -0
  36. package/esm2020/lib/data/services/notifications/notifications-api-service.mjs +43 -0
  37. package/esm2020/lib/ui/components/base-edit.component.mjs +143 -0
  38. package/esm2020/lib/ui/components/base.component.mjs +47 -0
  39. package/esm2020/lib/ui/components/base.dialog.mjs +49 -0
  40. package/esm2020/lib/ui/components/billing/buyaccess-button.component.mjs +69 -0
  41. package/esm2020/lib/ui/components/billing/subscribe-plan-button.component.mjs +63 -0
  42. package/esm2020/lib/ui/components/billing/upgrade-plan-button.component.mjs +52 -0
  43. package/esm2020/lib/ui/components/content-header/content-header.component.mjs +37 -0
  44. package/esm2020/lib/ui/components/html-editor/base-html-editor.component.mjs +111 -0
  45. package/esm2020/lib/ui/components/html-editor/forms-html-editor.component.mjs +48 -0
  46. package/esm2020/lib/ui/components/html-editor/html-editor.component.mjs +52 -0
  47. package/{esm2015/lib/ui/components/html-editor/html-editor.defaultoptions.js → esm2020/lib/ui/components/html-editor/html-editor.defaultoptions.mjs} +2 -2
  48. package/esm2020/lib/ui/components/identity/signin-button.component.mjs +32 -0
  49. package/esm2020/lib/ui/components/identity/signout-button.component.mjs +32 -0
  50. package/esm2020/lib/ui/components/identity/signup-button.component.mjs +31 -0
  51. package/esm2020/lib/ui/components/loading/loading.component.mjs +49 -0
  52. package/esm2020/lib/ui/components/spinner/spinner.component.mjs +74 -0
  53. package/esm2020/lib/ui/directives/native-element.directive.mjs +41 -0
  54. package/esm2020/lib/ui/forms/contact-us/contact-us.mjs +120 -0
  55. package/esm2020/lib/ui/pipes/filesize.pipe.mjs +45 -0
  56. package/esm2020/lib/ui/pipes/replace-text.pipe.mjs +40 -0
  57. package/esm2020/lib/ui/pipes/safeHtml.pipe.mjs +37 -0
  58. package/esm2020/lib/ui/ui.module.mjs +167 -0
  59. package/esm2020/lib/ui/validation/form-validation-summary.component.mjs +67 -0
  60. package/esm2020/lib/ui/validation/item-validation-summary.component.mjs +40 -0
  61. package/esm2020/lib/ui/validation/validation-summary.component.mjs +128 -0
  62. package/esm2020/public-api.mjs +68 -0
  63. package/fesm2015/osovitny-anatoly.mjs +3650 -0
  64. package/fesm2015/osovitny-anatoly.mjs.map +1 -0
  65. package/fesm2020/osovitny-anatoly.mjs +3658 -0
  66. package/fesm2020/osovitny-anatoly.mjs.map +1 -0
  67. package/{osovitny-anatoly.d.ts → index.d.ts} +1 -0
  68. package/lib/core/core.module.d.ts +5 -0
  69. package/lib/core/go/base-go.service.d.ts +3 -0
  70. package/lib/core/interceptors/httpInterceptor.d.ts +3 -0
  71. package/lib/core/localization/localization.module.d.ts +6 -0
  72. package/lib/core/localization/localization.service.d.ts +3 -0
  73. package/lib/core/localization/localizationSettings.module.d.ts +5 -0
  74. package/lib/core/localization/localize.pipe.d.ts +3 -0
  75. package/lib/core/logging/globalErrorHandler.d.ts +3 -0
  76. package/lib/core/logging/logging.service.d.ts +3 -0
  77. package/lib/core/notifications/services/notification-service.d.ts +3 -0
  78. package/lib/core/services/appcontext.service.d.ts +3 -0
  79. package/lib/core/services/dm.service.d.ts +3 -0
  80. package/lib/core/services/google-analytics.service.d.ts +3 -0
  81. package/lib/core/services/idle.service.d.ts +3 -0
  82. package/lib/core/services/loading.service.d.ts +3 -0
  83. package/lib/core/services/web-storage.service.d.ts +5 -0
  84. package/lib/data/base/base-api.service.d.ts +3 -0
  85. package/lib/data/base/grid/base-grid-edit.service.d.ts +3 -0
  86. package/lib/data/base/grid/base-grid-read.service.d.ts +3 -0
  87. package/lib/data/data.module.d.ts +5 -0
  88. package/lib/data/services/billing-api.service.d.ts +3 -0
  89. package/lib/data/services/emails-api.service.d.ts +10 -0
  90. package/lib/data/services/notifications/notifications-api-service.d.ts +3 -0
  91. package/lib/ui/components/base-edit.component.d.ts +5 -2
  92. package/lib/ui/components/base.component.d.ts +4 -1
  93. package/lib/ui/components/base.dialog.d.ts +3 -0
  94. package/lib/ui/components/billing/buyaccess-button.component.d.ts +5 -2
  95. package/lib/ui/components/billing/subscribe-plan-button.component.d.ts +4 -1
  96. package/lib/ui/components/billing/upgrade-plan-button.component.d.ts +4 -1
  97. package/lib/ui/components/content-header/content-header.component.d.ts +3 -0
  98. package/lib/ui/components/html-editor/base-html-editor.component.d.ts +3 -0
  99. package/lib/ui/components/html-editor/forms-html-editor.component.d.ts +3 -0
  100. package/lib/ui/components/html-editor/html-editor.component.d.ts +3 -0
  101. package/lib/ui/components/identity/signin-button.component.d.ts +3 -0
  102. package/lib/ui/components/identity/signout-button.component.d.ts +3 -0
  103. package/lib/ui/components/identity/signup-button.component.d.ts +3 -0
  104. package/lib/ui/components/loading/loading.component.d.ts +4 -1
  105. package/lib/ui/components/spinner/spinner.component.d.ts +3 -0
  106. package/lib/ui/directives/native-element.directive.d.ts +3 -0
  107. package/lib/ui/forms/contact-us/contact-us.d.ts +33 -0
  108. package/lib/ui/pipes/filesize.pipe.d.ts +3 -0
  109. package/lib/ui/pipes/replace-text.pipe.d.ts +3 -0
  110. package/lib/ui/pipes/safeHtml.pipe.d.ts +3 -0
  111. package/lib/ui/ui.module.d.ts +26 -0
  112. package/lib/ui/validation/form-validation-summary.component.d.ts +3 -0
  113. package/lib/ui/validation/item-validation-summary.component.d.ts +3 -0
  114. package/lib/ui/validation/validation-summary.component.d.ts +3 -0
  115. package/package.json +23 -11
  116. package/public-api.d.ts +3 -2
  117. package/bundles/osovitny-anatoly.umd.js +0 -3700
  118. package/bundles/osovitny-anatoly.umd.js.map +0 -1
  119. package/esm2015/lib/core/core.module.js +0 -58
  120. package/esm2015/lib/core/go/base-go.service.js +0 -42
  121. package/esm2015/lib/core/interceptors/httpInterceptor.js +0 -109
  122. package/esm2015/lib/core/localization/localization.module.js +0 -41
  123. package/esm2015/lib/core/localization/localization.service.js +0 -187
  124. package/esm2015/lib/core/localization/localizationSettings.module.js +0 -78
  125. package/esm2015/lib/core/localization/localize.pipe.js +0 -78
  126. package/esm2015/lib/core/logging/globalErrorHandler.js +0 -44
  127. package/esm2015/lib/core/logging/logging.service.js +0 -38
  128. package/esm2015/lib/core/notifications/services/notification-service.js +0 -230
  129. package/esm2015/lib/core/services/appcontext.service.js +0 -119
  130. package/esm2015/lib/core/services/dm.service.js +0 -74
  131. package/esm2015/lib/core/services/google-analytics.service.js +0 -53
  132. package/esm2015/lib/core/services/web-storage.service.js +0 -66
  133. package/esm2015/lib/core/utils.js +0 -81
  134. package/esm2015/lib/data/base/base-api.service.js +0 -89
  135. package/esm2015/lib/data/base/grid/base-grid-edit.service.js +0 -77
  136. package/esm2015/lib/data/base/grid/base-grid-read.service.js +0 -62
  137. package/esm2015/lib/data/data.module.js +0 -43
  138. package/esm2015/lib/data/services/billing-api.service.js +0 -65
  139. package/esm2015/lib/data/services/notifications/notifications-api-service.js +0 -45
  140. package/esm2015/lib/ui/components/base-edit.component.js +0 -142
  141. package/esm2015/lib/ui/components/base.component.js +0 -43
  142. package/esm2015/lib/ui/components/base.dialog.js +0 -47
  143. package/esm2015/lib/ui/components/billing/buyaccess-button.component.js +0 -71
  144. package/esm2015/lib/ui/components/billing/subscribe-plan-button.component.js +0 -63
  145. package/esm2015/lib/ui/components/billing/upgrade-plan-button.component.js +0 -54
  146. package/esm2015/lib/ui/components/content-header/content-header.component.js +0 -37
  147. package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +0 -108
  148. package/esm2015/lib/ui/components/html-editor/forms-html-editor.component.js +0 -44
  149. package/esm2015/lib/ui/components/html-editor/html-editor.component.js +0 -51
  150. package/esm2015/lib/ui/components/identity/signin-button.component.js +0 -33
  151. package/esm2015/lib/ui/components/identity/signout-button.component.js +0 -33
  152. package/esm2015/lib/ui/components/identity/signup-button.component.js +0 -31
  153. package/esm2015/lib/ui/components/loading/loading.component.js +0 -49
  154. package/esm2015/lib/ui/components/spinner/spinner.component.js +0 -73
  155. package/esm2015/lib/ui/directives/native-element.directive.js +0 -41
  156. package/esm2015/lib/ui/pipes/filesize.pipe.js +0 -41
  157. package/esm2015/lib/ui/pipes/replace-text.pipe.js +0 -36
  158. package/esm2015/lib/ui/pipes/safeHtml.pipe.js +0 -36
  159. package/esm2015/lib/ui/ui.module.js +0 -105
  160. package/esm2015/lib/ui/validation/form-validation-summary.component.js +0 -64
  161. package/esm2015/lib/ui/validation/item-validation-summary.component.js +0 -38
  162. package/esm2015/lib/ui/validation/validation-summary.component.js +0 -126
  163. package/esm2015/public-api.js +0 -62
  164. package/fesm2015/osovitny-anatoly.js +0 -3434
  165. package/fesm2015/osovitny-anatoly.js.map +0 -1
  166. package/osovitny-anatoly.metadata.json +0 -1
  167. /package/{esm2015/lib/core/consts/urls.js → esm2020/lib/core/consts/urls.mjs} +0 -0
  168. /package/{esm2015/osovitny-anatoly.js → esm2020/osovitny-anatoly.mjs} +0 -0
@@ -1,3434 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { Injectable, Pipe, NgModule, APP_INITIALIZER, Injector, Inject, Optional, SkipSelf, Component, Input, ViewEncapsulation, Directive, ElementRef } from '@angular/core';
3
- import { ActivatedRoute, Router, NavigationEnd, NavigationStart, NavigationCancel, NavigationError } from '@angular/router';
4
- import * as i1$3 from '@angular/common/http';
5
- import { HttpResponse, HttpClient } from '@angular/common/http';
6
- import { tap, map } from 'rxjs/operators';
7
- import { BehaviorSubject, Subject, timer, merge, fromEvent } from 'rxjs';
8
- import * as i1 from '@ngx-translate/core';
9
- import { TranslateService, TranslateModule, TranslateLoader } from '@ngx-translate/core';
10
- import { isValid, format, formatDistance, formatDistanceToNow } from 'date-fns';
11
- import { utcToZonedTime } from 'date-fns-tz';
12
- import enUS from 'date-fns/locale/en-US';
13
- import * as i2 from '@angular/common';
14
- import { LOCATION_INITIALIZED, DOCUMENT, CommonModule } from '@angular/common';
15
- import { TranslateHttpLoader } from '@ngx-translate/http-loader';
16
- import Swal from 'sweetalert2';
17
- import * as i1$1 from 'ngx-toastr';
18
- import { ToastrService } from 'ngx-toastr';
19
- import { v4 } from 'uuid';
20
- import * as i1$2 from '@angular/platform-browser';
21
- import { Title, Meta, DomSanitizer } from '@angular/platform-browser';
22
- import { FormControl, NgControl, ReactiveFormsModule, FormsModule } from '@angular/forms';
23
- import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
24
-
25
- /*
26
- <file>
27
- Project:
28
- @osovitny/anatoly
29
-
30
- Authors:
31
- Vadim Osovitny
32
- Anatoly Osovitny
33
-
34
- Created:
35
- 26 Jun 2020
36
-
37
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
38
- </file>
39
- */
40
- const ContextInitState = JSON.parse((document.getElementById('contextInitState')).getAttribute('data-contextinitstate'));
41
- const AppCoreSettings = JSON.parse((document.getElementById('appCoreSettings')).getAttribute('data-appcoresettings'));
42
-
43
- /*
44
- <file>
45
- Project:
46
- MICE
47
-
48
- Authors:
49
- Vadim Osovitny vaosovitny@deloitte.com
50
-
51
- Created:
52
- 5 May 2020
53
-
54
- Copyright (c) 2020 Deloitte Tax. All rights reserved.
55
- </file>
56
- */
57
- const Urls = {
58
- // SignalR Notifications
59
- notificationsSocketUrl: '/hubs/notifications'
60
- };
61
-
62
- /*
63
- <file>
64
- Project:
65
- @osovitny/anatoly
66
-
67
- Authors:
68
- Vadim Osovitny
69
- Anatoly Osovitny
70
-
71
- Created:
72
- 17 Jun 2018
73
-
74
- Version:
75
- 1.0
76
-
77
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
78
- </file>
79
- */
80
- class BaseGoService {
81
- constructor(route, router) {
82
- this.route = route;
83
- this.router = router;
84
- this.route = route;
85
- this.router = router;
86
- }
87
- locationReload() {
88
- window.location.reload();
89
- }
90
- homeReload() {
91
- window.location.href = "/";
92
- }
93
- }
94
- BaseGoService.decorators = [
95
- { type: Injectable }
96
- ];
97
- BaseGoService.ctorParameters = () => [
98
- { type: ActivatedRoute },
99
- { type: Router }
100
- ];
101
-
102
- /*
103
- <file>
104
- Project:
105
- @osovitny/anatoly
106
-
107
- Authors:
108
- Vadim Osovitny
109
- Anatoly Osovitny
110
-
111
- Created:
112
- 26 Jun 2020
113
-
114
- Version:
115
- 1.0
116
-
117
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
118
- </file>
119
- */
120
- function throwIfAlreadyLoaded(parentModule, moduleName) {
121
- if (parentModule) {
122
- throw new Error(`${moduleName} has already been loaded. Import ${moduleName} modules in the AppModule only.`);
123
- }
124
- }
125
-
126
- /*
127
- <file>
128
- Project:
129
- @osovitny/anatoly
130
-
131
- Authors:
132
- Vadim Osovitny
133
- Anatoly Osovitny
134
-
135
- Created:
136
- 26 Jun 2020
137
-
138
- Version:
139
- 1.0
140
-
141
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
142
- </file>
143
- */
144
- class LoadingService extends BehaviorSubject {
145
- constructor() {
146
- super(false);
147
- this.counter = 0;
148
- //Public
149
- this.isFreezed = false;
150
- }
151
- show() {
152
- this.counter++;
153
- let that = this;
154
- setTimeout(() => {
155
- if (that.counter > 0) {
156
- that.next(true);
157
- }
158
- }, 500);
159
- }
160
- hide() {
161
- if (this.counter <= 0) {
162
- return;
163
- }
164
- this.counter--;
165
- if (this.counter == 0) {
166
- this.next(false);
167
- }
168
- }
169
- freeze(timeout = 1000) {
170
- this.isFreezed = true;
171
- let that = this;
172
- setTimeout(() => {
173
- this.isFreezed = false;
174
- }, timeout);
175
- }
176
- reset() {
177
- if (this.counter > 0) {
178
- this.next(false);
179
- }
180
- this.counter = 0;
181
- }
182
- }
183
- LoadingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoadingService_Factory() { return new LoadingService(); }, token: LoadingService, providedIn: "root" });
184
- LoadingService.decorators = [
185
- { type: Injectable, args: [{
186
- providedIn: "root",
187
- },] }
188
- ];
189
- LoadingService.ctorParameters = () => [];
190
-
191
- /*
192
- <file>
193
- Project:
194
- @osovitny/anatoly
195
-
196
- Authors:
197
- Vadim Osovitny
198
- Anatoly Osovitny
199
-
200
- Created:
201
- 26 Jun 2020
202
-
203
- Version:
204
- 1.0
205
-
206
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
207
- </file>
208
- */
209
- class LoggingService {
210
- constructor() { }
211
- logError(error) {
212
- console.error(error);
213
- }
214
- logInformation(info) {
215
- console.info(info);
216
- }
217
- }
218
- LoggingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoggingService_Factory() { return new LoggingService(); }, token: LoggingService, providedIn: "root" });
219
- LoggingService.decorators = [
220
- { type: Injectable, args: [{
221
- providedIn: "root",
222
- },] }
223
- ];
224
- LoggingService.ctorParameters = () => [];
225
-
226
- /*
227
- <file>
228
- Project:
229
- @osovitny/anatoly
230
-
231
- Authors:
232
- Vadim Osovitny
233
- Anatoly Osovitny
234
-
235
- Created:
236
- 25 March 2020
237
-
238
- Version:
239
- 1.0
240
-
241
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
242
- </file>
243
- */
244
- class AnatolyHttpInterceptor {
245
- constructor(loadingService, loggingService) {
246
- this.loadingService = loadingService;
247
- this.loggingService = loggingService;
248
- this.longRunningExceptionsList = [];
249
- this.autoCDNSASTokenUrls = ['chunks', 'resources'];
250
- this.externalSiteUrls = ['azurewebsites.net'];
251
- }
252
- intercept(req, next) {
253
- const isCDNEnabled = AppCoreSettings.IsCDNEnabled;
254
- const cdnSasToken = AppCoreSettings.CDNSASToken;
255
- const isLoadingFreezed = this.loadingService.isFreezed;
256
- const authorizationTokenRequired = true;
257
- const url = req.url.toLowerCase();
258
- const originalUrl = req.url;
259
- let isExternalSite = false;
260
- let loadingRequired = !isLoadingFreezed;
261
- if (!isLoadingFreezed) {
262
- for (const i of this.longRunningExceptionsList) {
263
- if (url.indexOf(this.longRunningExceptionsList[i]) >= 0) {
264
- loadingRequired = false;
265
- break;
266
- }
267
- }
268
- }
269
- if (isCDNEnabled) {
270
- for (const i of this.autoCDNSASTokenUrls) {
271
- if (url.indexOf(this.autoCDNSASTokenUrls[i]) >= 0) {
272
- req = req.clone({ url: originalUrl + cdnSasToken });
273
- break;
274
- }
275
- }
276
- }
277
- for (const i of this.externalSiteUrls) {
278
- if (url.indexOf(this.externalSiteUrls[i]) >= 0) {
279
- isExternalSite = true;
280
- break;
281
- }
282
- }
283
- // VadimOS: IE11-fix
284
- if (url.indexOf('/api/') > -1) {
285
- let newUrl = '';
286
- const t = new Date().getTime().toString();
287
- if (url.indexOf('?') > -1) {
288
- newUrl = originalUrl + '&t=' + t;
289
- }
290
- else {
291
- newUrl = originalUrl + '?t=' + t;
292
- }
293
- req = req.clone({ url: newUrl });
294
- }
295
- req = req.clone({ headers: req.headers.set('Accept', 'application/json') });
296
- req = req.clone({ headers: req.headers.set('Accept', 'application/text') });
297
- this.onRequestStart(loadingRequired);
298
- return next.handle(req).pipe(tap((event) => {
299
- if (event instanceof HttpResponse) {
300
- this.onRequestEnd(loadingRequired);
301
- }
302
- }, (err) => {
303
- this.onRequestEnd(loadingRequired);
304
- this.loggingService.logError(err);
305
- }));
306
- }
307
- onRequestStart(loadingRequired) {
308
- if (loadingRequired) {
309
- this.loadingService.show();
310
- }
311
- }
312
- onRequestEnd(loadingRequired) {
313
- if (loadingRequired) {
314
- this.loadingService.hide();
315
- }
316
- }
317
- }
318
- AnatolyHttpInterceptor.decorators = [
319
- { type: Injectable }
320
- ];
321
- AnatolyHttpInterceptor.ctorParameters = () => [
322
- { type: LoadingService },
323
- { type: LoggingService }
324
- ];
325
-
326
- /*
327
- <file>
328
- Project:
329
- @osovitny/anatoly
330
-
331
- Authors:
332
- Vadim Osovitny
333
- Anatoly Osovitny
334
-
335
- Created:
336
- 29 June 2020
337
-
338
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
339
- </file>
340
- */
341
- class Convert {
342
- static toLocalizedDateTime(value) {
343
- if (value) {
344
- return new Date(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate(), value.getHours(), value.getMinutes(), value.getSeconds(), value.getMilliseconds()));
345
- }
346
- return null;
347
- }
348
- static enumToString(enumeration, value) {
349
- for (var k in enumeration)
350
- if (enumeration[k] == value)
351
- return k;
352
- return null;
353
- }
354
- static enumToArray(enumeration, notIncludes) {
355
- const notIncludeFiler = (value) => {
356
- if (isNaN(Number(value))) {
357
- return false;
358
- }
359
- if (notIncludes) {
360
- for (var i in notIncludes) {
361
- if (notIncludes[i] == value)
362
- return false;
363
- }
364
- }
365
- return true;
366
- };
367
- return Object.keys(enumeration)
368
- .filter(notIncludeFiler)
369
- .map(key => ({
370
- value: key,
371
- text: enumeration[key]
372
- }));
373
- }
374
- static stringToArray(str, separator = ',') {
375
- if (str) {
376
- return str.split(separator).filter(element => element);
377
- }
378
- return [];
379
- }
380
- static stringToIntArray(str, separator = ',') {
381
- if (str) {
382
- return str.split(separator).filter(element => element).map(value => parseInt(value));
383
- }
384
- return [];
385
- }
386
- }
387
-
388
- /*
389
- <file>
390
- Project:
391
- @osovitny/anatoly
392
-
393
- Authors:
394
- Vadim Osovitny
395
- Anatoly Osovitny
396
-
397
- Created:
398
- 05 May 2020
399
-
400
- Version:
401
- 1.0
402
-
403
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
404
- </file>
405
- */
406
- class LocalizationService {
407
- constructor(translate) {
408
- this.translate = translate;
409
- this.setSupportedLanguages(['en']);
410
- }
411
- format(str, args) {
412
- return str.replace(/{(\d+)}/g, function (match, number) {
413
- return typeof args[number] != 'undefined'
414
- ? args[number]
415
- : match;
416
- });
417
- }
418
- ;
419
- configureTranslationSettings(translate) {
420
- const languageToSet = 'en';
421
- this.dateFnsLocale = { locale: enUS };
422
- translate.setDefaultLang(languageToSet);
423
- return languageToSet;
424
- }
425
- getBrowserLanguage() {
426
- return this.translate.getBrowserLang();
427
- }
428
- getDatefnsLocale() {
429
- let dfnLocale;
430
- switch (this.getBrowserLanguage()) {
431
- case 'en':
432
- dfnLocale = { locale: enUS };
433
- break;
434
- default:
435
- dfnLocale = { locale: enUS };
436
- }
437
- return dfnLocale;
438
- }
439
- setDefaultLanguage(lang) {
440
- this.translate.setDefaultLang(lang);
441
- }
442
- setSupportedLanguages(languages) {
443
- this.translate.addLangs(languages);
444
- }
445
- updateLanguage(language) {
446
- this.translate.use(language);
447
- }
448
- getLocalizedValue(key, params) {
449
- const value = this.translate.instant(key);
450
- if (!params || params.length === 0) {
451
- return value;
452
- }
453
- return this.format(value, params);
454
- }
455
- getLocalizedDate(key) {
456
- if (isValid(new Date(key))) {
457
- return format(new Date(key), 'dd.MM.yyyy', this.dateFnsLocale);
458
- }
459
- return "Invalid Date";
460
- }
461
- getLocalizedDateTime(key) {
462
- let dateValue = new Date(key);
463
- if (isValid(dateValue)) {
464
- let localDate = Convert.toLocalizedDateTime(dateValue);
465
- return format(localDate, 'dd.MM.yyyy HH:mm', this.dateFnsLocale);
466
- }
467
- return "Invalid Date";
468
- }
469
- getLocalizedDistanceInWords(endedDate, startedDate) {
470
- if (isValid(new Date(endedDate)) && isValid(new Date(startedDate))) {
471
- return formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
472
- }
473
- return "Invalid Date";
474
- }
475
- getLocalizedDistanceToNowInWords(date) {
476
- if (isValid(new Date(date))) {
477
- return formatDistanceToNow(new Date(date), this.dateFnsLocale);
478
- }
479
- return "Invalid Date";
480
- }
481
- //UTC Operations --------------------------------------------------------------
482
- getUTCToLocalizedDate(key) {
483
- let browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
484
- if (key) {
485
- if (key.indexOf("T") == -1) {
486
- key = key.replace(" ", "T");
487
- }
488
- if (key.indexOf("Z") == -1) {
489
- key = key + "Z";
490
- }
491
- }
492
- if (browserTimeZone) {
493
- let localDateTime = utcToZonedTime(key, browserTimeZone);
494
- return format(localDateTime, 'dd.MM.yyyy', this.dateFnsLocale);
495
- }
496
- else {
497
- return format(new Date(key), 'dd.MM.yyyy', this.dateFnsLocale);
498
- }
499
- }
500
- getUTCToLocalizedDateTime(key) {
501
- let browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
502
- if (key) {
503
- if (key.indexOf("T") == -1) {
504
- key = key.replace(" ", "T");
505
- }
506
- if (key.indexOf("Z") == -1) {
507
- key = key + "Z";
508
- }
509
- }
510
- if (browserTimeZone) {
511
- let localDateTime = utcToZonedTime(key, browserTimeZone);
512
- return format(localDateTime, 'dd.MM.yyyy HH:mm', this.dateFnsLocale);
513
- }
514
- else {
515
- return format(new Date(key), 'dd.MM.yyyy HH:mm', this.dateFnsLocale);
516
- }
517
- }
518
- //https://date-fns.org/v1.30.1/docs/distanceInWords
519
- getUTCToLocalizedDistanceToNowInWords(date) {
520
- date = this.safeUtcToZonedTime(date);
521
- if (isValid(new Date(date))) {
522
- return formatDistanceToNow(new Date(date), this.dateFnsLocale);
523
- }
524
- return "Invalid Date";
525
- }
526
- safeUtcToZonedTime(date) {
527
- let result = date;
528
- try {
529
- if (date) {
530
- if (date.indexOf("T") == -1) {
531
- date = date.replace(" ", "T");
532
- }
533
- if (date.indexOf("Z") == -1) {
534
- date = date + "Z";
535
- }
536
- }
537
- let browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
538
- if (browserTimeZone) {
539
- result = utcToZonedTime(date, browserTimeZone).toString();
540
- }
541
- else {
542
- result = new Date(date).toString();
543
- }
544
- }
545
- catch (_a) {
546
- if (date) {
547
- console.log("UTC to Local conversion failed for :" + date.toString());
548
- }
549
- }
550
- return result;
551
- }
552
- }
553
- LocalizationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LocalizationService_Factory() { return new LocalizationService(i0.ɵɵinject(i1.TranslateService)); }, token: LocalizationService, providedIn: "root" });
554
- LocalizationService.decorators = [
555
- { type: Injectable, args: [{
556
- providedIn: 'root'
557
- },] }
558
- ];
559
- LocalizationService.ctorParameters = () => [
560
- { type: TranslateService }
561
- ];
562
-
563
- /*
564
- <file>
565
- Project:
566
- @osovitny/anatoly
567
-
568
- Authors:
569
- Vadim Osovitny
570
- Anatoly Osovitny
571
-
572
- Created:
573
- 10 May 2020
574
-
575
- Version:
576
- 1.0
577
-
578
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
579
- </file>
580
- */
581
- class LocalizePipe {
582
- constructor(localizeService) {
583
- this.localizeService = localizeService;
584
- }
585
- transform(inputData, type, param2) {
586
- if (!inputData) {
587
- return;
588
- }
589
- if (!type) {
590
- type = 'tr';
591
- }
592
- //Translate
593
- if (type === 'tr') {
594
- return this.localizeService.getLocalizedValue(inputData);
595
- }
596
- //Date
597
- if (type === 'd') {
598
- return this.localizeService.getLocalizedDate(inputData);
599
- }
600
- //DateTime
601
- if (type === 'dt') {
602
- return this.localizeService.getLocalizedDateTime(inputData);
603
- }
604
- //DistanceInWords
605
- if (type === 'dis') {
606
- return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
607
- }
608
- //DistanceToNowInWords
609
- if (type === 'dis2now') {
610
- return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
611
- }
612
- //UTC Operations --------------------------------------------------------------
613
- //UTC Date
614
- if (type === 'u2d') {
615
- return this.localizeService.getUTCToLocalizedDate(inputData);
616
- }
617
- //UTC DateTime
618
- if (type === 'u2dt') {
619
- return this.localizeService.getUTCToLocalizedDateTime(inputData);
620
- }
621
- //UTC DistanceToNowInWords
622
- if (type === 'u2dis2now') {
623
- return this.localizeService.getUTCToLocalizedDistanceToNowInWords(inputData);
624
- }
625
- return inputData;
626
- }
627
- }
628
- LocalizePipe.decorators = [
629
- { type: Pipe, args: [{
630
- name: 'localize'
631
- },] }
632
- ];
633
- LocalizePipe.ctorParameters = () => [
634
- { type: LocalizationService }
635
- ];
636
-
637
- /*
638
- <file>
639
- Project:
640
- @osovitny/anatoly
641
-
642
- Authors:
643
- Vadim Osovitny
644
- Anatoly Osovitny
645
-
646
- Created:
647
- 05 May 2020
648
-
649
- Version:
650
- 1.0
651
-
652
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
653
- </file>
654
- */
655
- function customTranslateLoaderFactory(http) {
656
- return new TranslateHttpLoader(http, AppCoreSettings.resourcesUrl + "/", '.json');
657
- }
658
- function localizationInitializerFactory(translate, localizationService, injector) {
659
- return () => new Promise((resolve) => {
660
- let locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
661
- locationInitialized.then(() => {
662
- let languageToSet = localizationService.configureTranslationSettings(translate);
663
- translate.use(languageToSet).subscribe(() => {
664
- }, () => {
665
- resolve(null);
666
- }, () => {
667
- resolve(null);
668
- });
669
- });
670
- });
671
- }
672
- const TranslateModuleAtRoot = TranslateModule.forRoot({
673
- loader: {
674
- provide: TranslateLoader,
675
- useFactory: customTranslateLoaderFactory,
676
- deps: [HttpClient]
677
- }
678
- });
679
- let LocalizationInjectorInstance;
680
- class LocalizationSettingsModule {
681
- constructor(injector) {
682
- this.injector = injector;
683
- LocalizationInjectorInstance = this.injector;
684
- }
685
- }
686
- LocalizationSettingsModule.decorators = [
687
- { type: NgModule, args: [{
688
- imports: [
689
- TranslateModuleAtRoot
690
- ],
691
- providers: [
692
- {
693
- provide: APP_INITIALIZER,
694
- useFactory: localizationInitializerFactory,
695
- deps: [TranslateService, LocalizationService, Injector],
696
- multi: true
697
- }
698
- ],
699
- exports: []
700
- },] }
701
- ];
702
- LocalizationSettingsModule.ctorParameters = () => [
703
- { type: Injector }
704
- ];
705
-
706
- /*
707
- <file>
708
- Project:
709
- @osovitny/anatoly
710
-
711
- Authors:
712
- Vadim Osovitny
713
- Anatoly Osovitny
714
-
715
- Created:
716
- 12 May 2020
717
-
718
- Version:
719
- 1.0
720
-
721
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
722
- </file>
723
- */
724
- class LocalizationModule {
725
- }
726
- LocalizationModule.decorators = [
727
- { type: NgModule, args: [{
728
- imports: [
729
- TranslateModule
730
- ],
731
- exports: [
732
- TranslateModule,
733
- LocalizePipe
734
- ],
735
- declarations: [
736
- LocalizePipe
737
- ],
738
- providers: []
739
- },] }
740
- ];
741
-
742
- /*
743
- <file>
744
- Project:
745
- @osovitny/anatoly
746
-
747
- Authors:
748
- Vadim Osovitny
749
- Anatoly Osovitny
750
-
751
- Created:
752
- 26 Jun 2020
753
-
754
- Version:
755
- 1.0
756
-
757
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
758
- </file>
759
- */
760
- class GlobalErrorHandler {
761
- constructor(injector) {
762
- this.injector = injector;
763
- }
764
- handleError(error) {
765
- const loggingService = this.injector.get(LoggingService);
766
- loggingService.logError(error);
767
- // IMPORTANT: Rethrow the error otherwise it gets swallowed
768
- throw error;
769
- }
770
- }
771
- GlobalErrorHandler.decorators = [
772
- { type: Injectable }
773
- ];
774
- GlobalErrorHandler.ctorParameters = () => [
775
- { type: Injector }
776
- ];
777
-
778
- /*
779
- <file>
780
- Project:
781
- @osovitny/anatoly
782
-
783
- Authors:
784
- Vadim Osovitny
785
- Anatoly Osovitny
786
-
787
- Created:
788
- 2 July 2020
789
-
790
- Version:
791
- 1.0
792
-
793
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
794
- </file>
795
- */
796
- class L10nUtils {
797
- // @dynamic
798
- static get localizationService() {
799
- const ns = LocalizationInjectorInstance.get(LocalizationService);
800
- return ns;
801
- }
802
- static getLocalizedValue(key, params, defaultKey) {
803
- // VadimOS: DON'T CHANGE THIS CODE. NEED TO BE REVIEWED AND APPROVED BY VADIMOS
804
- // defaultKey definition:
805
- // if key is empty and defaultKey is defined => get localization for defaultKey
806
- // Example: cancel()
807
- if (!key && defaultKey) {
808
- return this.localizationService.getLocalizedValue(defaultKey);
809
- }
810
- // VadimOS:
811
- // if key is not empty value MUST be in localization table, othewise we will return key
812
- if (key) {
813
- const value = this.localizationService.getLocalizedValue(key, params);
814
- return value;
815
- }
816
- return key;
817
- }
818
- }
819
-
820
- /*
821
- <file>
822
- Project:
823
- @osovitny/anatoly
824
-
825
- Authors:
826
- Vadim Osovitny
827
- Anatoly Osovitny
828
-
829
- Created:
830
- 3 March 2020
831
-
832
- Version:
833
- 1.0
834
-
835
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
836
- </file>
837
- */
838
- class Alerts {
839
- static success(text, params, title, successAction) {
840
- text = L10nUtils.getLocalizedValue(text, params, 'OperationSuccessFull');
841
- title = L10nUtils.getLocalizedValue(title, null, 'Success');
842
- Swal.fire({
843
- text,
844
- title,
845
- icon: 'success',
846
- confirmButtonText: L10nUtils.getLocalizedValue('Ok')
847
- })
848
- .then(() => {
849
- if (successAction) {
850
- successAction();
851
- }
852
- });
853
- }
854
- static info(text, params, title) {
855
- text = L10nUtils.getLocalizedValue(text, params);
856
- title = L10nUtils.getLocalizedValue(title, null, 'Info');
857
- Swal.fire({
858
- text,
859
- title,
860
- icon: 'info',
861
- confirmButtonText: L10nUtils.getLocalizedValue('Ok')
862
- });
863
- }
864
- static warning(text, params, title) {
865
- text = L10nUtils.getLocalizedValue(text, params);
866
- title = L10nUtils.getLocalizedValue(title, null, 'Warning');
867
- Swal.fire({
868
- text,
869
- title,
870
- icon: 'warning',
871
- confirmButtonText: L10nUtils.getLocalizedValue('Ok')
872
- });
873
- }
874
- static error(text, params, title) {
875
- text = L10nUtils.getLocalizedValue(text, params, 'ErrorOccured');
876
- title = L10nUtils.getLocalizedValue(title, null, 'Error');
877
- Swal.fire({
878
- text,
879
- title,
880
- icon: 'error',
881
- confirmButtonText: L10nUtils.getLocalizedValue('Ok')
882
- });
883
- }
884
- static cancel(text, params, title) {
885
- text = L10nUtils.getLocalizedValue(text, params, 'OperationCancelled');
886
- title = L10nUtils.getLocalizedValue(title, null, 'Cancelled');
887
- Swal.fire({
888
- text,
889
- title,
890
- icon: 'info'
891
- });
892
- }
893
- static notImplemented() {
894
- this.warning('Not Implemented Yet');
895
- }
896
- ;
897
- static areYouSure(text, title, confirmButtonText, cancelButtonText, successAction, cancelAction) {
898
- text = L10nUtils.getLocalizedValue(text);
899
- title = L10nUtils.getLocalizedValue(title, null, 'AreYouSure');
900
- confirmButtonText = L10nUtils.getLocalizedValue(confirmButtonText, null, 'AreYouSure-ConfirmButtonText');
901
- cancelButtonText = L10nUtils.getLocalizedValue(cancelButtonText, null, 'AreYouSure-CancelButtonText');
902
- Swal.fire({
903
- text,
904
- title,
905
- icon: 'warning',
906
- confirmButtonText,
907
- cancelButtonText,
908
- showCancelButton: true
909
- })
910
- .then((result) => {
911
- if (result.value) {
912
- if (successAction) {
913
- successAction();
914
- }
915
- }
916
- // result.dismiss can be 'cancel', 'overlay', 'close', and 'timer'
917
- else if (result.dismiss == Swal.DismissReason.cancel || result.dismiss == Swal.DismissReason.close) {
918
- if (cancelAction) {
919
- cancelAction();
920
- }
921
- }
922
- });
923
- }
924
- ;
925
- }
926
-
927
- /*
928
- <file>
929
- Project:
930
- @osovitny/anatoly
931
-
932
- Authors:
933
- Vadim Osovitny
934
- Anatoly Osovitny
935
-
936
- Created:
937
- 2 Jun 2020
938
-
939
- Version:
940
- 1.0
941
-
942
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
943
- </file>
944
- */
945
-
946
- /*
947
- <file>
948
- Project:
949
- @osovitny/anatoly
950
-
951
- Authors:
952
- Vadim Osovitny
953
- Anatoly Osovitny
954
-
955
- Created:
956
- 26 Jun 2020
957
-
958
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
959
- </file>
960
- */
961
- class Guid {
962
- static newGuid() {
963
- return v4();
964
- }
965
- }
966
-
967
- /*
968
- <file>
969
- Project:
970
- @osovitny/anatoly
971
-
972
- Authors:
973
- Vadim Osovitny
974
- Anatoly Osovitny
975
-
976
- Created:
977
- 2 Jun 2020
978
-
979
- Version:
980
- 1.0
981
-
982
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
983
- </file>
984
- */
985
- // SignalR
986
- // import * as signalR from '@microsoft/signalr';
987
- // import { NotificationsApiService } from '../../../data/services/notifications/notifications-api-service';
988
- class NotificationService {
989
- constructor(toastrService) {
990
- this.toastrService = toastrService;
991
- // SignalR
992
- // private hubConnection: signalR.HubConnection;
993
- // private socketUrl: string;
994
- // Notifications
995
- this._sessionNotifications = new BehaviorSubject([]);
996
- this._serverNotifications = new BehaviorSubject([]);
997
- // Public
998
- this.sessionNotifications$ = this._sessionNotifications.asObservable();
999
- this.serverNotifications$ = this._serverNotifications.asObservable();
1000
- // this.onInit();
1001
- }
1002
- /*
1003
- onInit() {
1004
- if (AppCoreSettings.AzureAD) {
1005
- this.authService.getAuthToken().subscribe((token: string) => {
1006
- this.startSignalRConnection(token);
1007
- });
1008
-
1009
- return;
1010
- }
1011
-
1012
- this.startSignalRConnection();
1013
- }
1014
-
1015
- ngOnDestroy() {
1016
- this.stopSignalRConnection();
1017
- }
1018
-
1019
- // SignalR
1020
- private startSignalRConnection(accessToken?) {
1021
- const cskii = AppCoreSettings.selectedClientID;
1022
- // tslint:disable-next-line:variable-name
1023
- const cskii_upn = AppCoreSettings.CSKII_UPN;
1024
- // tslint:disable-next-line:variable-name
1025
- const cli_sessionguid = AppCoreSettings.CLI_SessionGUID;
1026
-
1027
- const url = this.socketUrl + '?cskii=' + cskii + '&cskii_upn=' + cskii_upn + '&cli_sessionguid=' + cli_sessionguid;
1028
-
1029
- if (accessToken) {
1030
- this.hubConnection = new signalR.HubConnectionBuilder()
1031
- .withUrl(url, {
1032
- skipNegotiation: false,
1033
- transport: signalR.HttpTransportType.WebSockets,
1034
- accessTokenFactory: () => accessToken
1035
- })
1036
- .withAutomaticReconnect()
1037
- .configureLogging(signalR.LogLevel.Debug)
1038
- .build();
1039
- }
1040
- else {
1041
- this.hubConnection = new signalR.HubConnectionBuilder()
1042
- .withUrl(this.socketUrl, {
1043
- skipNegotiation: true,
1044
- transport: signalR.HttpTransportType.WebSockets
1045
- })
1046
- .withAutomaticReconnect()
1047
- .configureLogging(signalR.LogLevel.Debug)
1048
- .build();
1049
- }
1050
-
1051
- this.hubConnection
1052
- .start()
1053
- .then(() => this.signalRConnection_onSuccess())
1054
- .catch(err => {
1055
- console.error('Connection failed to SignalR Notification Hub')
1056
- })
1057
- }
1058
-
1059
- private signalRConnection_onSuccess() {
1060
- this.addReceiveMessageDataListener();
1061
-
1062
- this.notificationsApiService.retrieveNotifications().subscribe(data => {
1063
- this.serverNotifications = data;
1064
- });
1065
- }
1066
-
1067
- stopSignalRConnection() {
1068
- if (this.hubConnection) {
1069
- this.hubConnection.stop();
1070
- this.hubConnection = null;
1071
- }
1072
- }
1073
-
1074
- private addReceiveMessageDataListener = () => {
1075
- this.hubConnection.on('ReceiveMessage', (message) => {
1076
- if (message) {
1077
- if (message.type === 'error') {
1078
- this.error(message.text, null, null, false);
1079
- }
1080
- else {
1081
- this.success(message.text, null, null, false);
1082
- }
1083
-
1084
- const notification = {
1085
- id: message.id,
1086
- isNew: message.isNew,
1087
- isSession: true,
1088
- text: message.text,
1089
- type: message.type,
1090
- createdDate: message.createdDate
1091
- };
1092
-
1093
- this.addSessionNotificationToList(notification);
1094
- }
1095
- });
1096
- }
1097
- */
1098
- addSessionNotification(text, type) {
1099
- const id = Guid.newGuid();
1100
- const notification = { id, isNew: true, isSession: true, text, type, createdDate: new Date(Date.now()).toISOString() };
1101
- this.addSessionNotificationToList(notification);
1102
- }
1103
- addSessionNotificationToList(notification) {
1104
- this.sessionNotifications = [
1105
- notification,
1106
- ...this.sessionNotifications,
1107
- ];
1108
- }
1109
- // Public API
1110
- removeNotification(id, isSession) {
1111
- if (isSession) {
1112
- this.sessionNotifications = this.sessionNotifications.filter(notifications => notifications.id !== id);
1113
- }
1114
- else {
1115
- this.serverNotifications = this.serverNotifications.filter(notifications => notifications.id !== id);
1116
- }
1117
- }
1118
- success(text, params, title, createSessionNotification = true) {
1119
- text = L10nUtils.getLocalizedValue(text, params, 'OperationSuccessFull');
1120
- title = L10nUtils.getLocalizedValue(title);
1121
- this.toastrService.success(text, title, {
1122
- timeOut: 3000,
1123
- progressBar: true
1124
- });
1125
- if (createSessionNotification) {
1126
- this.addSessionNotification(text, 'success');
1127
- }
1128
- }
1129
- info(text, params, title) {
1130
- text = L10nUtils.getLocalizedValue(text, params);
1131
- title = L10nUtils.getLocalizedValue(title);
1132
- this.toastrService.info(text, title, {
1133
- timeOut: 3000,
1134
- progressBar: true
1135
- });
1136
- }
1137
- warning(text, params, title) {
1138
- text = L10nUtils.getLocalizedValue(text, params);
1139
- title = L10nUtils.getLocalizedValue(title);
1140
- this.toastrService.warning(text, title, {
1141
- timeOut: 3000,
1142
- progressBar: true
1143
- });
1144
- }
1145
- error(text, params, title, createSessionNotification = true) {
1146
- text = L10nUtils.getLocalizedValue(text, params, 'ErrorOccured');
1147
- title = L10nUtils.getLocalizedValue(title);
1148
- this.toastrService.error(text, title, {
1149
- timeOut: 3000,
1150
- progressBar: true
1151
- });
1152
- if (createSessionNotification) {
1153
- this.addSessionNotification(text, 'error');
1154
- }
1155
- }
1156
- cancel(text, params, title) {
1157
- text = L10nUtils.getLocalizedValue(text, params, 'OperationCancelled');
1158
- title = L10nUtils.getLocalizedValue(title);
1159
- this.toastrService.info(text, title, {
1160
- timeOut: 3000,
1161
- progressBar: true
1162
- });
1163
- }
1164
- // SessionNotifications
1165
- get sessionNotifications() {
1166
- return this._sessionNotifications.getValue();
1167
- }
1168
- set sessionNotifications(val) {
1169
- this._sessionNotifications.next(val);
1170
- }
1171
- // ServerNotifications
1172
- get serverNotifications() {
1173
- return this._serverNotifications.getValue();
1174
- }
1175
- set serverNotifications(val) {
1176
- this._serverNotifications.next(val);
1177
- }
1178
- }
1179
- NotificationService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NotificationService_Factory() { return new NotificationService(i0.ɵɵinject(i1$1.ToastrService)); }, token: NotificationService, providedIn: "root" });
1180
- NotificationService.decorators = [
1181
- { type: Injectable, args: [{ providedIn: 'root' },] }
1182
- ];
1183
- NotificationService.ctorParameters = () => [
1184
- { type: ToastrService }
1185
- ];
1186
-
1187
- /*
1188
- <file>
1189
- Project:
1190
- @osovitny/anatoly
1191
-
1192
- Authors:
1193
- Vadim Osovitny
1194
- Anatoly Osovitny
1195
-
1196
- Created:
1197
- 13 Nov 2017
1198
-
1199
- Version:
1200
- 1.0
1201
-
1202
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1203
- </file>
1204
- */
1205
- class BaseApiService {
1206
- constructor(http) {
1207
- this.http = http;
1208
- }
1209
- serializeParams(data) {
1210
- return data ? ('?' + $.param(data)) : '';
1211
- }
1212
- //api
1213
- get(action, data, responseType) {
1214
- if (!responseType) {
1215
- responseType = 'json';
1216
- }
1217
- var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1218
- return this.http.get(url, { responseType: responseType }).pipe(map(res => res));
1219
- }
1220
- post(action, data, responseType) {
1221
- if (!responseType) {
1222
- responseType = 'text';
1223
- }
1224
- var url = `${this.baseUrl}/${action}`;
1225
- return this.http.post(url, data, { responseType: responseType });
1226
- }
1227
- postQS(action, data, responseType) {
1228
- if (!responseType) {
1229
- responseType = 'text';
1230
- }
1231
- var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1232
- return this.http.post(url, null, { responseType: responseType });
1233
- }
1234
- delete(action, data, responseType) {
1235
- if (!responseType) {
1236
- responseType = 'text';
1237
- }
1238
- var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1239
- return this.http.delete(url, { responseType: responseType });
1240
- }
1241
- //gets
1242
- getExternalTextFile(url) {
1243
- return this.http.get(url);
1244
- }
1245
- getExternalJsonFile(url) {
1246
- return this.http.get(url);
1247
- }
1248
- getJsonFile(fileName) {
1249
- const jsonsUrl = AppCoreSettings.jsonsUrl;
1250
- const jsonVersion = AppCoreSettings.jsonVersion;
1251
- const isCDNEnabled = AppCoreSettings.isCDNEnabled;
1252
- const cdnSasToken = AppCoreSettings.cdnSasToken;
1253
- let url = "";
1254
- if (isCDNEnabled) {
1255
- url = jsonsUrl + "/" + fileName + cdnSasToken;
1256
- }
1257
- else {
1258
- url = jsonsUrl + "/" + fileName + '?' + jsonVersion;
1259
- }
1260
- return this.http.get(url).pipe(map(res => res));
1261
- }
1262
- }
1263
- BaseApiService.decorators = [
1264
- { type: Injectable }
1265
- ];
1266
- BaseApiService.ctorParameters = () => [
1267
- { type: HttpClient }
1268
- ];
1269
-
1270
- /*
1271
- <file>
1272
- Project:
1273
- @osovitny/anatoly
1274
-
1275
- Authors:
1276
- Vadim Osovitny
1277
- Anatoly Osovitny
1278
-
1279
- Created:
1280
- 26 Jun 2020
1281
-
1282
- Version:
1283
- 1.0
1284
-
1285
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1286
- </file>
1287
- */
1288
- class WebStorageService {
1289
- constructor(storage) {
1290
- this.storage =
1291
- storage === 'local' || storage === 'localStorage'
1292
- ? localStorage
1293
- : sessionStorage;
1294
- }
1295
- setItem(key, value) {
1296
- this.storage.setItem(key, value);
1297
- }
1298
- setObject(key, value) {
1299
- this.storage.setItem(key, JSON.stringify(value));
1300
- }
1301
- getItem(key) {
1302
- return this.storage.getItem(key);
1303
- }
1304
- getObject(key) {
1305
- let value = this.storage.getItem(key);
1306
- if (!value) {
1307
- return null;
1308
- }
1309
- return JSON.parse(value);
1310
- }
1311
- remove(key) {
1312
- this.storage.removeItem(key);
1313
- }
1314
- }
1315
- class LocalStorageService extends WebStorageService {
1316
- constructor() {
1317
- super('localStorage');
1318
- }
1319
- }
1320
- LocalStorageService.decorators = [
1321
- { type: Injectable }
1322
- ];
1323
- LocalStorageService.ctorParameters = () => [];
1324
- class SessionStorageService extends WebStorageService {
1325
- constructor() {
1326
- super('sessionStorage');
1327
- }
1328
- }
1329
- SessionStorageService.decorators = [
1330
- { type: Injectable }
1331
- ];
1332
- SessionStorageService.ctorParameters = () => [];
1333
-
1334
- /*
1335
- <file>
1336
- Project:
1337
- @osovitny/anatoly
1338
-
1339
- Authors:
1340
- Vadim Osovitny
1341
- Anatoly Osovitny
1342
-
1343
- Created:
1344
- 13 Nov 2017
1345
-
1346
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1347
- </file>
1348
- */
1349
- class AppContextService extends BaseApiService {
1350
- constructor(http, sessionStorage) {
1351
- super(http);
1352
- this.http = http;
1353
- this.sessionStorage = sessionStorage;
1354
- //Consts
1355
- this.storageKeyName = 'appContext';
1356
- this.subscription = null;
1357
- this.successes = [];
1358
- this.baseUrl = '/api/appContext';
1359
- }
1360
- //Session
1361
- getCurrentFromSession() {
1362
- return this.sessionStorage.getObject(this.storageKeyName);
1363
- }
1364
- setCurrentFromSession(value) {
1365
- this.sessionStorage.setObject(this.storageKeyName, value);
1366
- }
1367
- updateCurrentIfExpired() {
1368
- let context = this.getCurrentFromSession();
1369
- if (!context) {
1370
- return;
1371
- }
1372
- let lu = context.lastRequested;
1373
- if (lu) {
1374
- let now = new Date();
1375
- let lastRequested = new Date(context.lastRequested);
1376
- let in2Mins = new Date(lastRequested.getFullYear(), lastRequested.getMonth(), lastRequested.getDate(), lastRequested.getHours(), lastRequested.getMinutes() + 2, 0, 0);
1377
- if (in2Mins.getTime() < now.getTime()) {
1378
- this.updateCurrent();
1379
- }
1380
- }
1381
- }
1382
- dataReceived(data) {
1383
- this.current = data;
1384
- for (let i = 0; i < this.successes.length; i++) {
1385
- let success = this.successes[i];
1386
- if (success) {
1387
- success(data);
1388
- }
1389
- }
1390
- this.successes = [];
1391
- this.subscription.unsubscribe();
1392
- this.subscription = null;
1393
- }
1394
- //Public
1395
- getCurrent(success = null, getCachedIfExist = true) {
1396
- let context = this.getCurrentFromSession();
1397
- if (getCachedIfExist && context != null) {
1398
- if (success) {
1399
- success(context);
1400
- }
1401
- return;
1402
- }
1403
- if (success) {
1404
- this.successes.push(success);
1405
- }
1406
- if (this.subscription != null) {
1407
- return;
1408
- }
1409
- let now = new Date();
1410
- console.log('Requesting a new AppContext at ' + now);
1411
- this.subscription = this.get('getCurrentContext', null).subscribe((data) => {
1412
- this.dataReceived(data);
1413
- }, (e) => {
1414
- });
1415
- }
1416
- updateCurrent(success = null) {
1417
- this.getCurrent(success, false);
1418
- }
1419
- clearCurrent() {
1420
- this.sessionStorage.remove(this.storageKeyName);
1421
- }
1422
- isUserSignedIn() {
1423
- return ContextInitState.isUserSignedIn;
1424
- }
1425
- isUserAdmin() {
1426
- return ContextInitState.isUserAdmin;
1427
- }
1428
- //Properties
1429
- //current
1430
- get current() {
1431
- this.updateCurrentIfExpired();
1432
- return this.getCurrentFromSession();
1433
- }
1434
- set current(value) {
1435
- this.setCurrentFromSession(value);
1436
- }
1437
- }
1438
- AppContextService.decorators = [
1439
- { type: Injectable }
1440
- ];
1441
- AppContextService.ctorParameters = () => [
1442
- { type: HttpClient },
1443
- { type: SessionStorageService }
1444
- ];
1445
-
1446
- /*
1447
- <file>
1448
- Project:
1449
- @osovitny/anatoly
1450
-
1451
- Authors:
1452
- Vadim Osovitny
1453
- Anatoly Osovitny
1454
-
1455
- Created:
1456
- 26 Jun 2020
1457
-
1458
- Version:
1459
- 1.0
1460
-
1461
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1462
- </file>
1463
- */
1464
- class IdleService {
1465
- constructor() {
1466
- this.expired$ = new Subject();
1467
- }
1468
- //Private
1469
- resetTimeCounters(timeOutSeconds) {
1470
- this.timeOutSeconds = timeOutSeconds;
1471
- this.timeOutMilliSeconds = timeOutSeconds * 1000;
1472
- this.startDate = new Date();
1473
- }
1474
- startTimer() {
1475
- this.timer$ = timer(this.timeOutMilliSeconds, 1 * 1000).subscribe((res) => {
1476
- let nowDate = new Date();
1477
- let exiredDate = new Date(this.startDate.getTime() + this.timeOutMilliSeconds);
1478
- if (nowDate.getTime() >= exiredDate.getTime()) {
1479
- //console.log("nowDate: " + nowDate);
1480
- //console.log("exiredDate: " + exiredDate);
1481
- this.expired$.next(true);
1482
- }
1483
- });
1484
- }
1485
- resetTimer() {
1486
- this.startDate = new Date();
1487
- }
1488
- //Public
1489
- startWatching(timeOutSeconds) {
1490
- this.idle$ = merge(fromEvent(document, 'mousemove'), fromEvent(document, 'click'), fromEvent(document, 'mousedown'), fromEvent(document, 'keypress'), fromEvent(document, 'DOMMouseScroll'), fromEvent(document, 'mousewheel'), fromEvent(document, 'touchmove'), fromEvent(document, 'MSPointerMove'), fromEvent(window, 'mousemove'), fromEvent(window, 'resize'));
1491
- this.resetTimeCounters(timeOutSeconds);
1492
- this.idleSubscription = this.idle$.subscribe((res) => {
1493
- this.resetTimer();
1494
- });
1495
- this.startTimer();
1496
- return this.expired$;
1497
- }
1498
- stopWatching() {
1499
- this.timer$.unsubscribe();
1500
- this.idleSubscription.unsubscribe();
1501
- }
1502
- restartIdleTimer(timeOutSeconds) {
1503
- this.timer$.unsubscribe();
1504
- this.resetTimeCounters(timeOutSeconds);
1505
- this.startTimer();
1506
- }
1507
- }
1508
- IdleService.ɵprov = i0.ɵɵdefineInjectable({ factory: function IdleService_Factory() { return new IdleService(); }, token: IdleService, providedIn: "root" });
1509
- IdleService.decorators = [
1510
- { type: Injectable, args: [{
1511
- providedIn: 'root'
1512
- },] }
1513
- ];
1514
-
1515
- /*
1516
- <file>
1517
- Project:
1518
- @osovitny/anatoly
1519
-
1520
- Authors:
1521
- Vadim Osovitny
1522
- Anatoly Osovitny
1523
-
1524
- Created:
1525
- 29 Щсе 2020
1526
-
1527
- Version:
1528
- 1.0
1529
-
1530
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1531
- </file>
1532
- */
1533
- class DigitalMarketingService {
1534
- constructor(title, meta, dom) {
1535
- this.title = title;
1536
- this.meta = meta;
1537
- this.dom = dom;
1538
- }
1539
- updateTitle(title) {
1540
- this.title.setTitle(title);
1541
- }
1542
- updateDescription(desc) {
1543
- this.meta.updateTag({ name: 'description', content: desc });
1544
- }
1545
- updateKeywords(keywords) {
1546
- this.meta.updateTag({ name: 'keywords', content: keywords });
1547
- }
1548
- updateMetaTags(meta) {
1549
- meta.forEach(m => this.meta.updateTag(m));
1550
- }
1551
- setCanonicalUrl(url) {
1552
- const canUrl = url === undefined ? this.dom.URL : url;
1553
- const link = this.dom.createElement('link');
1554
- link.setAttribute('rel', 'canonical');
1555
- this.dom.head.appendChild(link);
1556
- link.setAttribute('href', canUrl);
1557
- }
1558
- updateCanonicalUrl(url) {
1559
- const canUrl = url === undefined ? this.dom.URL : url;
1560
- const head = this.dom.getElementsByTagName('head')[0];
1561
- let link = this.dom.querySelector(`link[rel='canonical']`) || null;
1562
- if (link == null) {
1563
- link = this.dom.createElement('link');
1564
- head.appendChild(link);
1565
- }
1566
- link.setAttribute('rel', 'canonical');
1567
- link.setAttribute('href', canUrl);
1568
- }
1569
- }
1570
- DigitalMarketingService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DigitalMarketingService_Factory() { return new DigitalMarketingService(i0.ɵɵinject(i1$2.Title), i0.ɵɵinject(i1$2.Meta), i0.ɵɵinject(i2.DOCUMENT)); }, token: DigitalMarketingService, providedIn: "root" });
1571
- DigitalMarketingService.decorators = [
1572
- { type: Injectable, args: [{
1573
- providedIn: 'root'
1574
- },] }
1575
- ];
1576
- DigitalMarketingService.ctorParameters = () => [
1577
- { type: Title },
1578
- { type: Meta },
1579
- { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
1580
- ];
1581
-
1582
- /*
1583
- <file>
1584
- Project:
1585
- @osovitny/anatoly
1586
-
1587
- Authors:
1588
- Vadim Osovitny
1589
- Anatoly Osovitny
1590
-
1591
- Created:
1592
- 29 Nov 2020
1593
-
1594
- Version:
1595
- 1.0
1596
-
1597
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1598
- </file>
1599
- */
1600
- class GoogleAnalyticsService {
1601
- constructor(router) {
1602
- this.router = router;
1603
- /*
1604
- https://yashints.dev/blog/2019/02/12/angular-ga-tagmanager
1605
- https://developers.google.com/analytics/devguides/collection/gtagjs/pages
1606
- https://developers.google.com/analytics/devguides/collection/upgrade/analyticsjs
1607
- */
1608
- }
1609
- subscribe() {
1610
- this.subscription = this.router.events.subscribe(event => {
1611
- if (event instanceof NavigationEnd) {
1612
- if (window.ga) {
1613
- window.ga('set', 'page', event.urlAfterRedirects);
1614
- window.ga('send', 'pageview');
1615
- }
1616
- }
1617
- });
1618
- }
1619
- unsubscribe() {
1620
- if (this.subscription) {
1621
- this.subscription.unsubscribe();
1622
- }
1623
- }
1624
- }
1625
- GoogleAnalyticsService.decorators = [
1626
- { type: Injectable }
1627
- ];
1628
- GoogleAnalyticsService.ctorParameters = () => [
1629
- { type: Router }
1630
- ];
1631
-
1632
- /*
1633
- <file>
1634
- Project:
1635
- @osovitny/anatoly
1636
-
1637
- Authors:
1638
- Vadim Osovitny
1639
- Anatoly Osovitny
1640
-
1641
- Created:
1642
- 29 June 2020
1643
-
1644
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1645
- </file>
1646
- */
1647
- let InjectorInstance;
1648
- class AnatolyCoreModule {
1649
- constructor(injector, parentModule) {
1650
- this.injector = injector;
1651
- throwIfAlreadyLoaded(parentModule, 'AnatolyCoreModule');
1652
- InjectorInstance = this.injector;
1653
- }
1654
- }
1655
- AnatolyCoreModule.decorators = [
1656
- { type: NgModule, args: [{
1657
- imports: [CommonModule],
1658
- exports: [],
1659
- providers: [
1660
- LoggingService,
1661
- NotificationService,
1662
- AppContextService,
1663
- LoadingService,
1664
- DigitalMarketingService,
1665
- GoogleAnalyticsService,
1666
- LocalStorageService,
1667
- SessionStorageService
1668
- ],
1669
- },] }
1670
- ];
1671
- AnatolyCoreModule.ctorParameters = () => [
1672
- { type: Injector },
1673
- { type: AnatolyCoreModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
1674
- ];
1675
-
1676
- /*
1677
- <file>
1678
- Project:
1679
- @osovitny/anatoly
1680
-
1681
- Authors:
1682
- Vadim Osovitny
1683
- Anatoly Osovitny
1684
-
1685
- Created:
1686
- 26 Jun 2020
1687
-
1688
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1689
- </file>
1690
- */
1691
- class Subs {
1692
- constructor() {
1693
- this.subs = [];
1694
- }
1695
- add(...subscriptions) {
1696
- this.subs = this.subs.concat(subscriptions);
1697
- }
1698
- set sink(subscription) {
1699
- this.subs.push(subscription);
1700
- }
1701
- unsubscribe() {
1702
- this.subs.forEach((sub) => sub && sub.unsubscribe());
1703
- this.subs = [];
1704
- }
1705
- }
1706
-
1707
- /*
1708
- <file>
1709
- Project:
1710
- @osovitny/anatoly
1711
-
1712
- Authors:
1713
- Vadim Osovitny
1714
- Anatoly Osovitny
1715
-
1716
- Created:
1717
- 19 March 2020
1718
-
1719
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1720
- </file>
1721
- */
1722
- class Utils {
1723
- static getValueByNameInQS(name) {
1724
- return Utils.getValueByName(location.search, name);
1725
- }
1726
- static getValueByName(url, name) {
1727
- name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1728
- // tslint:disable-next-line:one-variable-per-declaration
1729
- const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), results = regex.exec(url);
1730
- return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1731
- }
1732
- static copyToClipBoard(event, val) {
1733
- event.preventDefault();
1734
- const selBox = document.createElement('textarea');
1735
- selBox.style.position = 'fixed';
1736
- selBox.style.left = '0';
1737
- selBox.style.top = '0';
1738
- selBox.style.opacity = '0';
1739
- selBox.value = val;
1740
- document.body.appendChild(selBox);
1741
- selBox.focus();
1742
- selBox.select();
1743
- document.execCommand('copy');
1744
- document.body.removeChild(selBox);
1745
- }
1746
- static downloadFile(name, url) {
1747
- const link = document.createElement('a');
1748
- link.download = name;
1749
- link.href = url;
1750
- link.click();
1751
- }
1752
- static downloadBlobFile(value, fileName) {
1753
- if (window.navigator.msSaveOrOpenBlob) {
1754
- window.navigator.msSaveOrOpenBlob(value, fileName);
1755
- }
1756
- else {
1757
- const downloadURL = window.URL.createObjectURL(value);
1758
- Utils.downloadFile(fileName, downloadURL);
1759
- }
1760
- }
1761
- /*
1762
- Author:
1763
- https://medium.com/@mhagemann/the-ultimate-way-to-slugify-a-url-string-in-javascript-b8e4a0d849e1
1764
- */
1765
- static slugify(text, prefix = '', postfix = '') {
1766
- const a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;';
1767
- const b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------';
1768
- const p = new RegExp(a.split('').join('|'), 'g');
1769
- /*
1770
- https://css-tricks.com/snippets/javascript/strip-html-tags-in-javascript/
1771
- https://stackoverflow.com/questions/822452/strip-html-from-text-javascript
1772
- */
1773
- text = text.replace(/(<([^>]+)>)/gi, '');
1774
- let result = text
1775
- .toString()
1776
- .toLowerCase()
1777
- .replace(/\s+/g, '-') // Replace spaces with -
1778
- .replace(p, c => b.charAt(a.indexOf(c))) // Replace special characters
1779
- .replace(/&/g, '-and-') // Replace & with 'and'
1780
- .replace(/[^\w\-]+/g, '') // Remove all non-word characters
1781
- .replace(/\-\-+/g, '-') // Replace multiple - with single -
1782
- .replace(/^-+/, '') // Trim - from start of text
1783
- .replace(/-+$/, ''); // Trim - from end of text
1784
- return prefix + result + postfix;
1785
- }
1786
- }
1787
-
1788
- /*
1789
- <file>
1790
- Project:
1791
- @osovitny/anatoly
1792
-
1793
- Authors:
1794
- Vadim Osovitny
1795
- Anatoly Osovitny
1796
-
1797
- Created:
1798
- 29 Apr 2018
1799
-
1800
- Version:
1801
- 1.0
1802
-
1803
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1804
- </file>
1805
- */
1806
- class BaseGridReadService extends BehaviorSubject {
1807
- constructor(http) {
1808
- super([]);
1809
- this.http = http;
1810
- this.data = [];
1811
- }
1812
- serializeParams(data) {
1813
- return data ? ('?' + $.param(data)) : '';
1814
- }
1815
- read(params, success, error) {
1816
- if (this.data.length) {
1817
- return super.next(this.data);
1818
- }
1819
- var url = this.baseReadUrl;
1820
- if (typeof params === 'undefined') {
1821
- params = this.savedReadParams;
1822
- }
1823
- if (params) {
1824
- url = this.baseReadUrl + `${this.serializeParams(params)}`;
1825
- this.savedReadParams = params;
1826
- }
1827
- this.http.get(url).pipe(map(res => res)).subscribe(data => {
1828
- super.next(data);
1829
- if (success)
1830
- success();
1831
- }, e => {
1832
- if (error)
1833
- error(e);
1834
- });
1835
- }
1836
- }
1837
- BaseGridReadService.decorators = [
1838
- { type: Injectable }
1839
- ];
1840
- BaseGridReadService.ctorParameters = () => [
1841
- { type: HttpClient }
1842
- ];
1843
-
1844
- /*
1845
- <file>
1846
- Project:
1847
- @osovitny/anatoly
1848
-
1849
- Authors:
1850
- Vadim Osovitny
1851
- Anatoly Osovitny
1852
-
1853
- Created:
1854
- 29 Apr 2018
1855
-
1856
- Version:
1857
- 1.0
1858
-
1859
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1860
- </file>
1861
- */
1862
- class BaseGridEditService extends BaseGridReadService {
1863
- constructor(http) {
1864
- super(http);
1865
- this.http = http;
1866
- }
1867
- reset() {
1868
- this.data = [];
1869
- }
1870
- resetItem(dataItem) {
1871
- if (!dataItem) {
1872
- return;
1873
- }
1874
- //find orignal data item
1875
- const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
1876
- //revert changes
1877
- Object.assign(originalDataItem, dataItem);
1878
- super.next(this.data);
1879
- }
1880
- save(data, isNew, sucess) {
1881
- const action = isNew ? 'add' : 'update';
1882
- this.reset();
1883
- this.post(action, data).subscribe(() => {
1884
- }, () => {
1885
- this.read();
1886
- }, () => {
1887
- this.read();
1888
- if (sucess)
1889
- sucess();
1890
- });
1891
- }
1892
- delete(data, sucess) {
1893
- this.reset();
1894
- const url = `${this.baseUrl}/delete${this.serializeParams(data)}`;
1895
- return this.http.delete(url).subscribe(() => {
1896
- this.read();
1897
- if (sucess)
1898
- sucess();
1899
- }, () => {
1900
- this.read();
1901
- });
1902
- }
1903
- post(action, data) {
1904
- const url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
1905
- return this.http.post(url, data).pipe(map(res => res));
1906
- }
1907
- }
1908
- BaseGridEditService.decorators = [
1909
- { type: Injectable }
1910
- ];
1911
- BaseGridEditService.ctorParameters = () => [
1912
- { type: HttpClient }
1913
- ];
1914
-
1915
- /*
1916
- <file>
1917
- Project:
1918
- @osovitny/anatoly
1919
-
1920
- Authors:
1921
- Vadim Osovitny
1922
- Anatoly Osovitny
1923
-
1924
- Created:
1925
- 30 April 2020
1926
-
1927
- Version:
1928
- 1.0
1929
-
1930
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1931
- </file>
1932
- */
1933
- const consts = {
1934
- billingApiPath: 'api/billing',
1935
- // Notifications API
1936
- notificationsApiPath: 'api/notifications',
1937
- };
1938
-
1939
- /*
1940
- <file>
1941
- Project:
1942
- @osovitny/anatoly
1943
-
1944
- Authors:
1945
- Vadim Osovitny
1946
- Anatoly Osovitny
1947
-
1948
- Created:
1949
- 30 April 2020
1950
-
1951
- Version:
1952
- 1.0
1953
-
1954
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1955
- </file>
1956
- */
1957
- class NotificationsApiService extends BaseApiService {
1958
- constructor(http) {
1959
- super(http);
1960
- this.http = http;
1961
- this.baseUrl = consts.notificationsApiPath;
1962
- }
1963
- retrieveNotifications() {
1964
- return this.get('retrieveNotifications');
1965
- }
1966
- }
1967
- NotificationsApiService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NotificationsApiService_Factory() { return new NotificationsApiService(i0.ɵɵinject(i1$3.HttpClient)); }, token: NotificationsApiService, providedIn: "root" });
1968
- NotificationsApiService.decorators = [
1969
- { type: Injectable, args: [{
1970
- providedIn: 'root'
1971
- },] }
1972
- ];
1973
- NotificationsApiService.ctorParameters = () => [
1974
- { type: HttpClient }
1975
- ];
1976
-
1977
- /*
1978
- <file>
1979
- Project:
1980
- @osovitny/anatoly
1981
-
1982
- Authors:
1983
- Vadim Osovitny
1984
- Anatoly Osovitny
1985
-
1986
- Created:
1987
- 12 Nov 2017
1988
-
1989
- Version:
1990
- 1.0
1991
-
1992
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
1993
- </file>
1994
- */
1995
- class BillingApiService extends BaseApiService {
1996
- constructor(http) {
1997
- super(http);
1998
- this.http = http;
1999
- this.baseUrl = consts.billingApiPath;
2000
- }
2001
- requestNewSubscription(requestedPlan, success, error) {
2002
- this.postQS("requestNewSubscription", { requestedPlan: requestedPlan }).subscribe((data) => {
2003
- if (success)
2004
- success();
2005
- }, (e) => {
2006
- if (error)
2007
- error();
2008
- });
2009
- }
2010
- cancelRequestedSubscription(success, error) {
2011
- this.postQS("cancelRequestedSubscription", null).subscribe((data) => {
2012
- if (success)
2013
- success();
2014
- }, (e) => {
2015
- if (error)
2016
- error();
2017
- });
2018
- }
2019
- buyAccess(requestedPlan, success, error) {
2020
- this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe((data) => {
2021
- if (success)
2022
- success();
2023
- }, (e) => {
2024
- if (error)
2025
- error();
2026
- });
2027
- }
2028
- }
2029
- BillingApiService.decorators = [
2030
- { type: Injectable }
2031
- ];
2032
- BillingApiService.ctorParameters = () => [
2033
- { type: HttpClient }
2034
- ];
2035
-
2036
- /*
2037
- <file>
2038
- Project:
2039
- @osovitny/anatoly
2040
-
2041
- Authors:
2042
- Vadim Osovitny
2043
- Anatoly Osovitny
2044
-
2045
- Created:
2046
- 4 Mar 2020
2047
-
2048
- Version:
2049
- 1.0
2050
-
2051
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2052
- </file>
2053
- */
2054
- class AnatolyDataModule {
2055
- constructor(parentModule) {
2056
- throwIfAlreadyLoaded(parentModule, 'AnatolyDataModule');
2057
- }
2058
- }
2059
- AnatolyDataModule.decorators = [
2060
- { type: NgModule, args: [{
2061
- imports: [
2062
- CommonModule
2063
- ],
2064
- providers: [
2065
- BillingApiService
2066
- ],
2067
- },] }
2068
- ];
2069
- AnatolyDataModule.ctorParameters = () => [
2070
- { type: AnatolyDataModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
2071
- ];
2072
-
2073
- /*
2074
- <file>
2075
- Project:
2076
- @osovitny/anatoly
2077
-
2078
- Authors:
2079
- Vadim Osovitny
2080
- Anatoly Osovitny
2081
-
2082
- Created:
2083
- 28 Aug 2018
2084
-
2085
- Version:
2086
- 1.0
2087
-
2088
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2089
- </file>
2090
- */
2091
- class BaseComponent {
2092
- constructor() {
2093
- this.subs = new Subs();
2094
- }
2095
- getQSId() {
2096
- var id = Utils.getValueByNameInQS("id");
2097
- if (typeof id === "undefined" || id == "")
2098
- return null;
2099
- return id;
2100
- }
2101
- ngOnDestroy() {
2102
- this.subs.unsubscribe();
2103
- }
2104
- }
2105
- BaseComponent.decorators = [
2106
- { type: Component, args: [{
2107
- template: ''
2108
- },] }
2109
- ];
2110
-
2111
- /*
2112
- <file>
2113
- Project:
2114
- @osovitny/anatoly
2115
-
2116
- Authors:
2117
- Vadim Osovitny
2118
- Anatoly Osovitny
2119
-
2120
- Created:
2121
- 20 Nov 2017
2122
-
2123
- Version:
2124
- 1.0
2125
-
2126
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2127
- </file>
2128
- */
2129
- class BaseEditComponent extends BaseComponent {
2130
- constructor() {
2131
- super();
2132
- this.formSubmitted = false;
2133
- }
2134
- isActionAdding() {
2135
- var id = Utils.getValueByNameInQS("id");
2136
- if (typeof id === "undefined" || id == "")
2137
- return true;
2138
- return false;
2139
- }
2140
- getEntityId() {
2141
- return this.getQSId();
2142
- }
2143
- isControlValid(name, frmGroup = null) {
2144
- return !this.isControlInvalid(name, frmGroup);
2145
- }
2146
- isControlInvalid(name, frmGroup = null) {
2147
- if (typeof name === "undefined" || name == "") {
2148
- return false;
2149
- }
2150
- let fg = frmGroup ? frmGroup : this.formGroup;
2151
- if (!fg) {
2152
- return false;
2153
- }
2154
- if (fg.get(name)) {
2155
- return ((this.formSubmitted && fg.get(name).invalid) ||
2156
- (fg.get(name).touched && fg.get(name).invalid));
2157
- }
2158
- return false;
2159
- }
2160
- //FormGroup functions
2161
- getFormValue(name, frmGroup = null) {
2162
- let fg = frmGroup ? frmGroup : this.formGroup;
2163
- return fg.controls[name].value;
2164
- }
2165
- setFormValue(name, value, frmGroup = null) {
2166
- let fg = frmGroup ? frmGroup : this.formGroup;
2167
- fg.controls[name].setValue(value);
2168
- }
2169
- getFormGroupValue(groupName, name, frmGroup = null) {
2170
- let fg = frmGroup ? frmGroup : this.formGroup;
2171
- return fg.controls[groupName].get(name).value;
2172
- }
2173
- setFormGroupValue(groupName, name, value, frmGroup = null) {
2174
- let fg = frmGroup ? frmGroup : this.formGroup;
2175
- fg.controls[groupName].get(name).setValue(value);
2176
- }
2177
- /**
2178
- * Add control to form group
2179
- * @param name
2180
- * @param formControl
2181
- * @param formGroup
2182
- */
2183
- addControl(name, formControl, frmGroup = null) {
2184
- let fg = frmGroup ? frmGroup : this.formGroup;
2185
- fg.addControl(name, formControl);
2186
- }
2187
- /**
2188
- * Removes control from form group
2189
- * @param name
2190
- * @param formGroup
2191
- */
2192
- removeControl(name, frmGroup = null) {
2193
- let fg = frmGroup ? frmGroup : this.formGroup;
2194
- if (fg.get(name)) {
2195
- fg.removeControl(name);
2196
- }
2197
- }
2198
- /**
2199
- * return new form control
2200
- * @param formState
2201
- * @param validatorOrOpts
2202
- * @param asyncValidator
2203
- */
2204
- createFormControl(formState, validatorOrOpts, asyncValidator) {
2205
- return new FormControl(formState, validatorOrOpts, asyncValidator);
2206
- }
2207
- /**
2208
- * Set error to control
2209
- * @param controlName formControl name
2210
- * @param err error expect {erroname: boolean} format
2211
- * @param formGroup Specific form group. default it will apply on this.formGroup property
2212
- */
2213
- setControlError(controlName, err, frmGroup = null) {
2214
- var _a;
2215
- let fg = frmGroup ? frmGroup : this.formGroup;
2216
- (_a = fg.get(controlName)) === null || _a === void 0 ? void 0 : _a.setErrors(err);
2217
- }
2218
- /**
2219
- * Set {invalid: true} for the specified form
2220
- * @param controlName form control name
2221
- * @param formGroup
2222
- */
2223
- setInValidError(controlName, frmGroup = null) {
2224
- var _a;
2225
- let fg = frmGroup ? frmGroup : this.formGroup;
2226
- (_a = fg.get(controlName)) === null || _a === void 0 ? void 0 : _a.setErrors({ invalid: true });
2227
- }
2228
- /**
2229
- * returns formgroup controls.
2230
- * main use case is used in html pages
2231
- */
2232
- get fc() {
2233
- return this.formGroup.controls;
2234
- }
2235
- }
2236
- BaseEditComponent.decorators = [
2237
- { type: Component, args: [{
2238
- template: ''
2239
- },] }
2240
- ];
2241
- BaseEditComponent.ctorParameters = () => [];
2242
- BaseEditComponent.propDecorators = {
2243
- formGroup: [{ type: Input }],
2244
- formSubmitted: [{ type: Input }]
2245
- };
2246
-
2247
- /*
2248
- <file>
2249
- Project:
2250
- @osovitny/anatoly
2251
-
2252
- Authors:
2253
- Vadim Osovitny
2254
- Anatoly Osovitny
2255
-
2256
- Created:
2257
- 24 Jan 2022
2258
-
2259
- Version:
2260
- 1.0
2261
-
2262
- Copyright (c) 2016-2022 Osovitny Inc. All rights reserved.
2263
- </file>
2264
- */
2265
- class BaseDialog extends BaseEditComponent {
2266
- constructor() {
2267
- super();
2268
- this._opened = false;
2269
- }
2270
- get opened() {
2271
- return this._opened;
2272
- }
2273
- open() {
2274
- this._opened = true;
2275
- }
2276
- close() {
2277
- this._opened = false;
2278
- }
2279
- }
2280
- BaseDialog.decorators = [
2281
- { type: Component, args: [{
2282
- template: ''
2283
- },] }
2284
- ];
2285
- BaseDialog.ctorParameters = () => [];
2286
- BaseDialog.propDecorators = {
2287
- opened: [{ type: Input }]
2288
- };
2289
-
2290
- /*
2291
- <file>
2292
- Project:
2293
- @osovitny/anatoly
2294
-
2295
- Authors:
2296
- Vadim Osovitny
2297
- Anatoly Osovitny
2298
-
2299
- Created:
2300
- 14 Aug 2018
2301
-
2302
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2303
- </file>
2304
- */
2305
- class BuyAccessButtonComponent {
2306
- constructor(appContext, api) {
2307
- this.appContext = appContext;
2308
- this.api = api;
2309
- this.contextUpdated = false;
2310
- this.isUserSignedIn = false;
2311
- this.currentPlan = 0;
2312
- this.currentPlanTitle = '';
2313
- }
2314
- ngOnInit() {
2315
- if (!this.appContext.isUserSignedIn()) {
2316
- this.contextUpdated = true;
2317
- return;
2318
- }
2319
- this.appContext.getCurrent((current) => {
2320
- this.isUserSignedIn = current.isUserSignedIn;
2321
- if (this.isUserSignedIn) {
2322
- this.currentPlan = current.account.billingPlan;
2323
- this.currentPlanTitle = current.account.billingPlanAsString;
2324
- }
2325
- this.contextUpdated = true;
2326
- });
2327
- }
2328
- onBuyPlan() {
2329
- const text = `Requested plan: ${this.plantitle} `;
2330
- const that = this;
2331
- Alerts.areYouSure(text, 'Buying access', 'Confirm change', 'Cancel', () => {
2332
- that.api.buyAccess(that.plan, () => {
2333
- Alerts.success('Access Granted', null, null, () => {
2334
- window.location.reload();
2335
- });
2336
- });
2337
- });
2338
- }
2339
- }
2340
- BuyAccessButtonComponent.decorators = [
2341
- { type: Component, args: [{
2342
- selector: 'anatoly-buyaccess-button',
2343
- template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"plan != currentPlan && currentPlan == 1\" (click)=\"onBuyPlan()\">\r\n Buy Now\r\n </button>\r\n </div>\r\n</div>\r\n"
2344
- },] }
2345
- ];
2346
- BuyAccessButtonComponent.ctorParameters = () => [
2347
- { type: AppContextService },
2348
- { type: BillingApiService }
2349
- ];
2350
- BuyAccessButtonComponent.propDecorators = {
2351
- plan: [{ type: Input }],
2352
- plantitle: [{ type: Input }]
2353
- };
2354
-
2355
- /*
2356
- <file>
2357
- Project:
2358
- @osovitny/anatoly
2359
-
2360
- Authors:
2361
- Vadim Osovitny
2362
- Anatoly Osovitny
2363
-
2364
- Created:
2365
- 1 Jun 2018
2366
-
2367
- Version:
2368
- 1.0
2369
-
2370
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2371
- </file>
2372
- */
2373
- class SubscribePlanButtonComponent {
2374
- constructor(appcontext) {
2375
- this.appcontext = appcontext;
2376
- this.contextUpdated = false;
2377
- this.isUserSignedIn = false;
2378
- this.currentPlan = 0;
2379
- this.currentPlanTitle = "";
2380
- this.requestedPlan = 0;
2381
- this.requestedPlanTitle = "";
2382
- }
2383
- ngOnInit() {
2384
- if (!this.appcontext.isUserSignedIn()) {
2385
- this.contextUpdated = true;
2386
- return;
2387
- }
2388
- this.appcontext.getCurrent((current) => {
2389
- this.isUserSignedIn = current.isUserSignedIn;
2390
- if (this.isUserSignedIn) {
2391
- this.currentPlan = current.account.billingPlan;
2392
- this.currentPlanTitle = current.account.billingPlanAsString;
2393
- this.requestedPlan = current.account.requestedBillingPlan;
2394
- this.requestedPlanTitle = current.account.requestedBillingPlanAsString;
2395
- }
2396
- this.contextUpdated = true;
2397
- });
2398
- }
2399
- }
2400
- SubscribePlanButtonComponent.decorators = [
2401
- { type: Component, args: [{
2402
- selector: "anatoly-subscribe-plan-button",
2403
- template: "<div *ngIf=\"contextUpdated\">\r\n <div *ngIf=\"!isUserSignedIn\">\r\n <anatoly-signup-button classbtn=\"btn btn-block btn-primary\"></anatoly-signup-button>\r\n </div>\r\n\r\n <div *ngIf=\"isUserSignedIn\">\r\n <button class=\"btn btn-block btn-success selectPlan\" *ngIf=\"plan == currentPlan\">\r\n Your Plan\r\n </button>\r\n\r\n <button class=\"btn btn-block btn-warning selectPlan\" *ngIf=\"requestedPlan != null && requestedPlan != 0 && plan == requestedPlan\">\r\n Requested\r\n </button>\r\n\r\n <anatoly-upgrade-plan-button *ngIf=\"plan != currentPlan && plan != requestedPlan\"\r\n [currentplantitle]=\"currentPlanTitle\"\r\n [requestedplan]=plan\r\n [requestedplantitle]=\"plantitle\">\r\n </anatoly-upgrade-plan-button>\r\n </div>\r\n</div>\r\n"
2404
- },] }
2405
- ];
2406
- SubscribePlanButtonComponent.ctorParameters = () => [
2407
- { type: AppContextService }
2408
- ];
2409
- SubscribePlanButtonComponent.propDecorators = {
2410
- plan: [{ type: Input }],
2411
- plantitle: [{ type: Input }]
2412
- };
2413
-
2414
- /*
2415
- <file>
2416
- Project:
2417
- @osovitny/anatoly
2418
-
2419
- Authors:
2420
- Vadim Osovitny
2421
- Anatoly Osovitny
2422
-
2423
- Created:
2424
- 12 Nov 2017
2425
-
2426
- Version:
2427
- 1.0
2428
-
2429
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2430
- </file>
2431
- */
2432
- // Services
2433
- class UpgradePlanButtonComponent {
2434
- constructor(api) {
2435
- this.api = api;
2436
- }
2437
- onUpgradePlan() {
2438
- const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
2439
- const that = this;
2440
- Alerts.areYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
2441
- that.api.requestNewSubscription(that.requestedplan, () => {
2442
- Alerts.success('Your request for changing plan has been sent.', null, null, () => {
2443
- window.location.reload();
2444
- });
2445
- });
2446
- });
2447
- }
2448
- }
2449
- UpgradePlanButtonComponent.decorators = [
2450
- { type: Component, args: [{
2451
- selector: 'anatoly-upgrade-plan-button',
2452
- template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
2453
- },] }
2454
- ];
2455
- UpgradePlanButtonComponent.ctorParameters = () => [
2456
- { type: BillingApiService }
2457
- ];
2458
- UpgradePlanButtonComponent.propDecorators = {
2459
- currentplantitle: [{ type: Input }],
2460
- requestedplan: [{ type: Input }],
2461
- requestedplantitle: [{ type: Input }]
2462
- };
2463
-
2464
- /*
2465
- <file>
2466
- Project:
2467
- @osovitny/anatoly
2468
-
2469
- Authors:
2470
- Vadim Osovitny
2471
- Anatoly Osovitny
2472
-
2473
- Created:
2474
- 23 Apr 2018
2475
-
2476
- Version:
2477
- 1.0
2478
-
2479
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2480
- </file>
2481
- */
2482
- class ContentHeaderComponent {
2483
- ngOnInit() {
2484
- if (this.title == null) {
2485
- this.title = "";
2486
- }
2487
- }
2488
- }
2489
- ContentHeaderComponent.decorators = [
2490
- { type: Component, args: [{
2491
- selector: "anatoly-content-header",
2492
- template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
2493
- },] }
2494
- ];
2495
- ContentHeaderComponent.propDecorators = {
2496
- title: [{ type: Input }]
2497
- };
2498
-
2499
- /*
2500
- <file>
2501
- Project:
2502
- @osovitny/anatoly
2503
-
2504
- Authors:
2505
- Vadim Osovitny
2506
- Anatoly Osovitny
2507
-
2508
- Created:
2509
- 12 Dec 2017
2510
-
2511
- Version:
2512
- 1.0
2513
-
2514
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2515
- </file>
2516
- */
2517
- const DefaultEditorOptions = {
2518
- placeholderText: "Edit Your Content Here",
2519
- charCounterCount: true,
2520
- heightMin: 100,
2521
- toolbarInline: false,
2522
- toolbarButtons: {
2523
- moreText: {
2524
- buttons: [
2525
- "bold",
2526
- "italic",
2527
- "underline",
2528
- "strikeThrough",
2529
- "subscript",
2530
- "superscript",
2531
- "fontFamily",
2532
- "fontSize",
2533
- "textColor",
2534
- "backgroundColor",
2535
- "inlineClass",
2536
- "inlineStyle",
2537
- ],
2538
- },
2539
- moreParagraph: {
2540
- buttons: [
2541
- "alignLeft",
2542
- "alignCenter",
2543
- "formatOLSimple",
2544
- "alignRight",
2545
- "alignJustify",
2546
- "formatOL",
2547
- "formatUL",
2548
- "paragraphFormat",
2549
- "paragraphStyle",
2550
- "lineHeight",
2551
- "outdent",
2552
- "indent",
2553
- "quote",
2554
- ],
2555
- },
2556
- moreRich: {
2557
- buttons: [
2558
- "insertLink",
2559
- "insertImage",
2560
- "insertTable",
2561
- "emoticons",
2562
- "fontAwesome",
2563
- "specialCharacters",
2564
- "embedly",
2565
- ],
2566
- },
2567
- moreMisc: {
2568
- buttons: [
2569
- "selectAll",
2570
- "clearFormatting",
2571
- "html",
2572
- "undo",
2573
- "redo",
2574
- "fullscreen",
2575
- ],
2576
- align: "right",
2577
- },
2578
- },
2579
- /*
2580
- Upload:
2581
- https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
2582
- */
2583
- imageUploadURL: "/api/htmlEditor/uploadImage",
2584
- imageAllowedTypes: ["jpeg", "jpg", "png"],
2585
- imageUploadParams: { uploadType: "", uploadParentId: "" },
2586
- };
2587
-
2588
- /*
2589
- <file>
2590
- Project:
2591
- @osovitny/anatoly
2592
-
2593
- Authors:
2594
- Vadim Osovitny
2595
- Anatoly Osovitny
2596
-
2597
- Created:
2598
- 12 Dec 2017
2599
-
2600
- Version:
2601
- 1.0
2602
-
2603
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2604
- </file>
2605
- */
2606
- class BaseHtmlEditorComponent extends BaseEditComponent {
2607
- constructor() {
2608
- super();
2609
- this.froalaEditorInitialized = false;
2610
- this.afterInitializedActions = [];
2611
- // Inputs
2612
- this.editorLabelText = "Html";
2613
- this.editorOptions = {};
2614
- }
2615
- ngOnInit() {
2616
- let opt = this.editorOptions;
2617
- if (typeof this.editorOptions == "string") {
2618
- opt = JSON.parse(this.editorOptions);
2619
- }
2620
- let newOptions = $.extend({}, DefaultEditorOptions, opt);
2621
- const key = AppCoreSettings.froalaEditorKey;
2622
- if (key) {
2623
- newOptions = $.extend({}, newOptions, JSON.parse('{ "key": "' + key + '" }'));
2624
- }
2625
- if (newOptions.events && newOptions.events.initialized) {
2626
- newOptions.events.initialized.overridden = false;
2627
- }
2628
- this.options = newOptions;
2629
- }
2630
- ngAfterViewInit() {
2631
- const that = this;
2632
- setTimeout(function () {
2633
- that.froalaEditorInitialized = true;
2634
- that.onInitialized();
2635
- }, 300);
2636
- }
2637
- onInitialized() {
2638
- let actions = this.afterInitializedActions;
2639
- // Clear actions
2640
- this.afterInitializedActions = [];
2641
- if (actions) {
2642
- for (let i = 0; i < actions.length; i++) {
2643
- actions[i]();
2644
- }
2645
- }
2646
- }
2647
- getEditor() {
2648
- if (this.froalaEditor)
2649
- return this.froalaEditor.getEditor();
2650
- return null;
2651
- }
2652
- // Public Funcs
2653
- doAfterInitialized(action) {
2654
- const that = this;
2655
- if (!this.froalaEditorInitialized) {
2656
- this.afterInitializedActions.push(() => {
2657
- action(that);
2658
- });
2659
- }
2660
- else {
2661
- action(that);
2662
- }
2663
- }
2664
- initializeControl(control) {
2665
- this.froalaEditor = control;
2666
- this.froalaEditor.initialize();
2667
- }
2668
- setUploadParams(uploadType, uploadParentId) {
2669
- this.doAfterInitialized(function (that) {
2670
- const editor = that.getEditor();
2671
- if (typeof editor == "undefined" || editor == null) {
2672
- return;
2673
- }
2674
- editor.opts.imageUploadParams.uploadType = uploadType;
2675
- editor.opts.imageUploadParams.uploadParentId = uploadParentId;
2676
- });
2677
- }
2678
- }
2679
- BaseHtmlEditorComponent.decorators = [
2680
- { type: Component, args: [{
2681
- template: ""
2682
- },] }
2683
- ];
2684
- BaseHtmlEditorComponent.ctorParameters = () => [];
2685
- BaseHtmlEditorComponent.propDecorators = {
2686
- editorLabelText: [{ type: Input }],
2687
- editorOptions: [{ type: Input }]
2688
- };
2689
-
2690
- /*
2691
- <file>
2692
- Project:
2693
- @osovitny/anatoly
2694
-
2695
- Authors:
2696
- Vadim Osovitny
2697
- Anatoly Osovitny
2698
-
2699
- Created:
2700
- 12 Dec 2017
2701
-
2702
- Version:
2703
- 1.0
2704
-
2705
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2706
- </file>
2707
- */
2708
- class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
2709
- constructor() {
2710
- super();
2711
- this.editorFormKey = "html";
2712
- }
2713
- setFormValueAfterInitialized(name, value) {
2714
- this.doAfterInitialized(function (that) {
2715
- that.setFormValue(name, value);
2716
- });
2717
- }
2718
- }
2719
- FormsHtmlEditorComponent.decorators = [
2720
- { type: Component, args: [{
2721
- selector: "anatoly-forms-html-editor",
2722
- template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isControlInvalid(editorFormKey) }\">\r\n <label class=\"control-label\">{{ editorLabelText }}</label>\r\n <textarea [formControlName]=\"editorFormKey\"\r\n [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n <anatoly-item-validation-summary [formGroup]=\"formGroup\"\r\n [formSubmitted]=\"formSubmitted\"\r\n [controlName]=\"editorFormKey\"\r\n [controlTitle]=\"editorLabelText\">\r\n </anatoly-item-validation-summary>\r\n </div>\r\n</div>\r\n"
2723
- },] }
2724
- ];
2725
- FormsHtmlEditorComponent.ctorParameters = () => [];
2726
- FormsHtmlEditorComponent.propDecorators = {
2727
- editorFormKey: [{ type: Input }]
2728
- };
2729
-
2730
- /*
2731
- <file>
2732
- Project:
2733
- @osovitny/anatoly
2734
-
2735
- Authors:
2736
- Vadim Osovitny
2737
- Anatoly Osovitny
2738
-
2739
- Created:
2740
- 12 Dec 2017
2741
-
2742
- Version:
2743
- 1.0
2744
-
2745
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2746
- </file>
2747
- */
2748
- class HtmlEditorComponent extends BaseHtmlEditorComponent {
2749
- constructor() {
2750
- super();
2751
- }
2752
- setHtml(content) {
2753
- this.doAfterInitialized(function (that) {
2754
- var editor = that.getEditor();
2755
- if (typeof editor == "undefined" || editor == null) {
2756
- return;
2757
- }
2758
- editor.html.set(content);
2759
- });
2760
- }
2761
- getHtml() {
2762
- var editor = this.getEditor();
2763
- if (typeof editor == "undefined" || editor == null) {
2764
- return;
2765
- }
2766
- return editor.html.get(false);
2767
- }
2768
- }
2769
- HtmlEditorComponent.decorators = [
2770
- { type: Component, args: [{
2771
- selector: "anatoly-html-editor",
2772
- template: "<div>\r\n <label>{{ editorLabelText }}</label>\r\n <textarea [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n</div>"
2773
- },] }
2774
- ];
2775
- HtmlEditorComponent.ctorParameters = () => [];
2776
-
2777
- /*
2778
- <file>
2779
- Project:
2780
- @osovitny/anatoly
2781
-
2782
- Authors:
2783
- Vadim Osovitny
2784
- Anatoly Osovitny
2785
-
2786
- Created:
2787
- 4 Jul 2018
2788
-
2789
- Version:
2790
- 1.0
2791
-
2792
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2793
- </file>
2794
- */
2795
- class SignInButtonComponent {
2796
- constructor() { }
2797
- }
2798
- SignInButtonComponent.decorators = [
2799
- { type: Component, args: [{
2800
- selector: "anatoly-signin-button",
2801
- template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
2802
- },] }
2803
- ];
2804
- SignInButtonComponent.ctorParameters = () => [];
2805
- SignInButtonComponent.propDecorators = {
2806
- classbtn: [{ type: Input }]
2807
- };
2808
-
2809
- /*
2810
- <file>
2811
- Project:
2812
- @osovitny/anatoly
2813
-
2814
- Authors:
2815
- Vadim Osovitny
2816
- Anatoly Osovitny
2817
-
2818
- Created:
2819
- 4 Jul 2018
2820
-
2821
- Version:
2822
- 1.0
2823
-
2824
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2825
- </file>
2826
- */
2827
- class SignOutButtonComponent {
2828
- constructor() { }
2829
- }
2830
- SignOutButtonComponent.decorators = [
2831
- { type: Component, args: [{
2832
- selector: "anatoly-signout-button",
2833
- template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
2834
- },] }
2835
- ];
2836
- SignOutButtonComponent.ctorParameters = () => [];
2837
- SignOutButtonComponent.propDecorators = {
2838
- classbtn: [{ type: Input }]
2839
- };
2840
-
2841
- /*
2842
- <file>
2843
- Project:
2844
- @osovitny/anatoly
2845
-
2846
- Authors:
2847
- Vadim Osovitny
2848
- Anatoly Osovitny
2849
-
2850
- Created:
2851
- 4 Jul 2018
2852
-
2853
- Version:
2854
- 1.0
2855
-
2856
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2857
- </file>
2858
- */
2859
- class SignUpButtonComponent {
2860
- }
2861
- SignUpButtonComponent.decorators = [
2862
- { type: Component, args: [{
2863
- selector: "anatoly-signup-button",
2864
- template: "<a href=\"identity/signup\" class=\"{{classbtn}}\">Sign Up</a>\r\n"
2865
- },] }
2866
- ];
2867
- SignUpButtonComponent.propDecorators = {
2868
- classbtn: [{ type: Input }]
2869
- };
2870
-
2871
- /*
2872
- <file>
2873
- Project:
2874
- @osovitny/anatoly
2875
-
2876
- Authors:
2877
- Vadim Osovitny
2878
- Anatoly Osovitny
2879
-
2880
- Created:
2881
- 9 May 2020
2882
-
2883
- Version:
2884
- 1.0
2885
-
2886
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2887
- </file>
2888
- */
2889
- class LoadingComponent {
2890
- constructor(loadingService) {
2891
- this.loadingService = loadingService;
2892
- // Private
2893
- this.subs = new Subs();
2894
- // Public
2895
- this.show = false;
2896
- }
2897
- ngOnInit() {
2898
- this.subs.sink = this.loadingService.subscribe((state) => {
2899
- this.show = state;
2900
- });
2901
- }
2902
- ngOnDestroy() {
2903
- this.subs.unsubscribe();
2904
- }
2905
- }
2906
- LoadingComponent.decorators = [
2907
- { type: Component, args: [{
2908
- selector: 'anatoly-loading',
2909
- template: "<div *ngIf=\"show\">\r\n <span id=\"pnlLoading\" class=\"k-icon k-i-loading\"></span>\r\n</div>\r\n"
2910
- },] }
2911
- ];
2912
- LoadingComponent.ctorParameters = () => [
2913
- { type: LoadingService }
2914
- ];
2915
-
2916
- /*
2917
- <file>
2918
- Project:
2919
- @osovitny/anatoly
2920
-
2921
- Authors:
2922
- Vadim Osovitny
2923
- Anatoly Osovitny
2924
-
2925
- Created:
2926
- 16 May 2020
2927
-
2928
- Version:
2929
- 1.0
2930
-
2931
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
2932
- </file>
2933
- */
2934
- const SpinnerSpinKit = {
2935
- spinnerLine: 'spinner-line-material',
2936
- // ToDo
2937
- ChasingDots: 'spinner-chasing-dots',
2938
- CubeGrid: 'spinner-cube-grid',
2939
- DoubleBounce: 'spinner-double-bounce',
2940
- RotatingPlane: 'spinner-rotationg-plane',
2941
- SpinnerPulse: 'spinner-spinner-pulse',
2942
- ThreeBounce: 'spinner-three-bounce',
2943
- WanderingCubes: 'spinner-wandering-cubes',
2944
- Wave: 'spinner-wave'
2945
- };
2946
- class SpinnerComponent {
2947
- constructor(router, document) {
2948
- this.router = router;
2949
- this.document = document;
2950
- this.isSpinnerVisible = true;
2951
- this.spinnerSpinKit = SpinnerSpinKit;
2952
- this.backgroundColor = '#007CB0';
2953
- this.spinner = SpinnerSpinKit.spinnerLine;
2954
- this.router.events.subscribe(event => {
2955
- if (event instanceof NavigationStart) {
2956
- this.isSpinnerVisible = true;
2957
- }
2958
- else if (event instanceof NavigationEnd || event instanceof NavigationCancel || event instanceof NavigationError) {
2959
- this.isSpinnerVisible = false;
2960
- }
2961
- }, () => {
2962
- this.isSpinnerVisible = false;
2963
- });
2964
- }
2965
- ngOnDestroy() {
2966
- this.isSpinnerVisible = false;
2967
- }
2968
- }
2969
- SpinnerComponent.decorators = [
2970
- { type: Component, args: [{
2971
- selector: 'spinner',
2972
- template: "<div id=\"spinner-loader\" *ngIf=\"isSpinnerVisible\">\r\n <div class=\"loader-bg\">\r\n <div class=\"spinner-line-material\" [class.colored]=\"!backgroundColor\" *ngIf=\"spinner === spinnerSpinKit.spinnerLine\">\r\n <div class=\"spinner-child spinner-bounce1\" [style.background-color]='backgroundColor'></div>\r\n </div>\r\n </div>\r\n</div>\r\n",
2973
- encapsulation: ViewEncapsulation.None
2974
- },] }
2975
- ];
2976
- SpinnerComponent.ctorParameters = () => [
2977
- { type: Router },
2978
- { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
2979
- ];
2980
- SpinnerComponent.propDecorators = {
2981
- backgroundColor: [{ type: Input }],
2982
- spinner: [{ type: Input }]
2983
- };
2984
-
2985
- /*
2986
- <file>
2987
- Project:
2988
- @osovitny/anatoly
2989
-
2990
- Authors:
2991
- Vadim Osovitny
2992
- Anatoly Osovitny
2993
-
2994
- Created:
2995
- 28 Jun 2020
2996
-
2997
- Version:
2998
- 1.0
2999
-
3000
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3001
- </file>
3002
- */
3003
- class NativeElementDirective {
3004
- constructor(el, control) {
3005
- this.el = el;
3006
- this.control = control;
3007
- }
3008
- ngOnInit() {
3009
- // sets the localization key to the control
3010
- this.control.control.nativeElement = this.el.nativeElement;
3011
- }
3012
- }
3013
- NativeElementDirective.decorators = [
3014
- { type: Directive, args: [{
3015
- selector: '[formControl], [formControlName]'
3016
- },] }
3017
- ];
3018
- NativeElementDirective.ctorParameters = () => [
3019
- { type: ElementRef },
3020
- { type: NgControl }
3021
- ];
3022
-
3023
- /*
3024
- <file>
3025
- Project:
3026
- @osovitny/anatoly
3027
-
3028
- Authors:
3029
- Vadim Osovitny
3030
- Anatoly Osovitny
3031
-
3032
- Created:
3033
- 26 Jun 2020
3034
-
3035
- Version:
3036
- 1.0
3037
-
3038
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3039
- </file>
3040
- */
3041
- class ReplaceTextPipe {
3042
- transform(inputData, search, replacement) {
3043
- if (inputData) {
3044
- return inputData.replace(new RegExp(search, "g"), replacement);
3045
- }
3046
- else {
3047
- return inputData;
3048
- }
3049
- }
3050
- }
3051
- ReplaceTextPipe.decorators = [
3052
- { type: Pipe, args: [{
3053
- name: "replaceText",
3054
- },] }
3055
- ];
3056
-
3057
- /*
3058
- <file>
3059
- Project:
3060
- @osovitny/anatoly
3061
-
3062
- Authors:
3063
- Vadim Osovitny
3064
- Anatoly Osovitny
3065
-
3066
- Created:
3067
- 26 Jun 2020
3068
-
3069
- Version:
3070
- 1.0
3071
-
3072
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3073
- </file>
3074
- */
3075
- class FileSizePipe {
3076
- constructor() {
3077
- this.units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
3078
- }
3079
- transform(bytes = 0, precision = 0) {
3080
- if (isNaN(parseFloat(String(bytes))) || !isFinite(bytes))
3081
- return '';
3082
- let unit = 0;
3083
- while (bytes >= 1024) {
3084
- bytes /= 1024;
3085
- unit++;
3086
- }
3087
- return bytes.toFixed(+precision) + ' ' + this.units[unit];
3088
- }
3089
- }
3090
- FileSizePipe.decorators = [
3091
- { type: Pipe, args: [{
3092
- name: 'filesize',
3093
- },] }
3094
- ];
3095
-
3096
- /*
3097
- <file>
3098
- Project:
3099
- @osovitny/anatoly
3100
-
3101
- Authors:
3102
- Vadim Osovitny
3103
- Anatoly Osovitny
3104
-
3105
- Created:
3106
- 27 Oct 2019
3107
-
3108
- Version:
3109
- 1.0
3110
-
3111
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3112
- </file>
3113
- */
3114
- class SafeHtmlPipe {
3115
- constructor(sanitized) {
3116
- this.sanitized = sanitized;
3117
- }
3118
- transform(value) {
3119
- return this.sanitized.bypassSecurityTrustHtml(value);
3120
- }
3121
- }
3122
- SafeHtmlPipe.decorators = [
3123
- { type: Pipe, args: [{ name: 'safeHtml' },] }
3124
- ];
3125
- SafeHtmlPipe.ctorParameters = () => [
3126
- { type: DomSanitizer }
3127
- ];
3128
-
3129
- /*
3130
- <file>
3131
- Project:
3132
- @osovitny/anatoly
3133
-
3134
- Authors:
3135
- Vadim Osovitny
3136
- Anatoly Osovitny
3137
-
3138
- Created:
3139
- 8 Dec 2017
3140
-
3141
- Version:
3142
- 1.0
3143
-
3144
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3145
- </file>
3146
- */
3147
- class ValidationSummaryComponent extends BaseEditComponent {
3148
- constructor() {
3149
- super();
3150
- }
3151
- getFormValidationMessages() {
3152
- let messages = [];
3153
- Object.keys(this.formGroup.controls).forEach((k) => {
3154
- var control = this.formGroup.controls[k];
3155
- if (control.controls != null) {
3156
- Object.keys(control.controls).forEach((k) => {
3157
- var child = control.controls[k];
3158
- this.getValidationMessages(child, this.getControlName(child, k)).forEach((m) => messages.push(m));
3159
- });
3160
- }
3161
- else {
3162
- this.getValidationMessages(control, this.getControlName(control, k)).forEach((m) => messages.push(m));
3163
- }
3164
- });
3165
- return messages;
3166
- }
3167
- getValidationMessages(state, thingName) {
3168
- let thing = state.path || thingName;
3169
- let messages = [];
3170
- if (state.errors) {
3171
- for (let errorName in state.errors) {
3172
- if (state.errors.hasOwnProperty(errorName)) {
3173
- switch (errorName) {
3174
- case "required":
3175
- messages.push(`${thing} is required`);
3176
- break;
3177
- case "minlength":
3178
- messages.push(`${thing} must be at least ${state.errors["minlength"].requiredLength} characters`);
3179
- break;
3180
- case "pattern":
3181
- messages.push(`${thing} contains illegal characters`);
3182
- break;
3183
- case "format":
3184
- messages.push(`${thing} format mismatch`);
3185
- break;
3186
- case "maxlength":
3187
- messages.push(`${thing} must have maximum ${state.errors["maxlength"].requiredLength} characters`);
3188
- break;
3189
- case "specialcharacters":
3190
- messages.push(`${thing} contains special characters`);
3191
- break;
3192
- }
3193
- }
3194
- }
3195
- }
3196
- return messages;
3197
- }
3198
- /**
3199
- * Get Control Name
3200
- * @param control
3201
- * @param thingName
3202
- */
3203
- getControlName(control, thingName) {
3204
- let value = this.getControlTitle(control);
3205
- return value ? value : thingName;
3206
- }
3207
- /**
3208
- * Retrieve tilte of control
3209
- * @param control
3210
- */
3211
- getControlTitle(control) {
3212
- if (control === null || control === void 0 ? void 0 : control.nativeElement) {
3213
- let controlTitle = this.getTitleAttribute(control.nativeElement);
3214
- if (controlTitle) {
3215
- return controlTitle;
3216
- }
3217
- }
3218
- return undefined;
3219
- }
3220
- /**
3221
- * Return title attribute of form control
3222
- */
3223
- getTitleAttribute(nativeElement) {
3224
- var _a, _b, _c, _d, _e, _f;
3225
- let title;
3226
- switch (nativeElement.tagName) {
3227
- // For Kendo time and date picker element title is assigned to the 4th child control.
3228
- case "KENDO-TIMEPICKER":
3229
- case "KENDO-DATEPICKER":
3230
- title =
3231
- (_d = (_c = (_b = (_a = nativeElement.children[0]) === null || _a === void 0 ? void 0 : _a.children[0]) === null || _b === void 0 ? void 0 : _b.children[0]) === null || _c === void 0 ? void 0 : _c.children[0]) === null || _d === void 0 ? void 0 : _d.getAttribute("title");
3232
- break;
3233
- // For Kendo numaric element title is assigned to the 2nd child control.
3234
- case "KENDO-NUMERICTEXTBOX":
3235
- title = (_f = (_e = nativeElement.children[0]) === null || _e === void 0 ? void 0 : _e.children[0]) === null || _f === void 0 ? void 0 : _f.getAttribute("title");
3236
- break;
3237
- default:
3238
- title = nativeElement.getAttribute("title");
3239
- break;
3240
- }
3241
- return title;
3242
- }
3243
- }
3244
- ValidationSummaryComponent.decorators = [
3245
- { type: Component, args: [{
3246
- template: ""
3247
- },] }
3248
- ];
3249
- ValidationSummaryComponent.ctorParameters = () => [];
3250
-
3251
- /*
3252
- <file>
3253
- Project:
3254
- @osovitny/anatoly
3255
-
3256
- Authors:
3257
- Vadim Osovitny
3258
- Anatoly Osovitny
3259
-
3260
- Created:
3261
- 7 Dec 2017
3262
-
3263
- Version:
3264
- 1.0
3265
-
3266
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3267
- </file>
3268
- */
3269
- class FormValidationSummaryComponent extends ValidationSummaryComponent {
3270
- constructor() {
3271
- super();
3272
- this.visible = false;
3273
- this.customerrors = [];
3274
- /*
3275
- 0 - only FormValidation messages
3276
- 1 - only Custom messages
3277
- 2 - all
3278
- */
3279
- this.viewtype = 0;
3280
- }
3281
- getErrors() {
3282
- if (this.viewtype == 1) {
3283
- return this.customerrors;
3284
- }
3285
- let formValidationMessages = this.getFormValidationMessages();
3286
- if (this.viewtype == 0) {
3287
- return formValidationMessages;
3288
- }
3289
- var messages = [];
3290
- if (formValidationMessages.length > 0) {
3291
- messages.push(...formValidationMessages);
3292
- }
3293
- if (this.customerrors.length > 0) {
3294
- messages.push(...this.customerrors);
3295
- }
3296
- return messages;
3297
- }
3298
- }
3299
- FormValidationSummaryComponent.decorators = [
3300
- { type: Component, args: [{
3301
- selector: "anatoly-form-validation-summary",
3302
- template: "<div class=\"callout callout-danger\" *ngIf=\"visible\">\r\n <h6 class=\"box-title\">There are problems with the form</h6>\r\n <ul>\r\n <li *ngFor=\"let error of getErrors()\"><span>{{error}}</span></li>\r\n </ul>\r\n</div>\r\n\r\n"
3303
- },] }
3304
- ];
3305
- FormValidationSummaryComponent.ctorParameters = () => [];
3306
- FormValidationSummaryComponent.propDecorators = {
3307
- visible: [{ type: Input }],
3308
- customerrors: [{ type: Input }],
3309
- viewtype: [{ type: Input }]
3310
- };
3311
-
3312
- /*
3313
- <file>
3314
- Project:
3315
- @osovitny/anatoly
3316
-
3317
- Authors:
3318
- Vadim Osovitny
3319
- Anatoly Osovitny
3320
-
3321
- Created:
3322
- 6 Dec 2017
3323
-
3324
- Version:
3325
- 1.0
3326
-
3327
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3328
- </file>
3329
- */
3330
- class ItemValidationSummaryComponent extends ValidationSummaryComponent {
3331
- constructor() {
3332
- super();
3333
- }
3334
- }
3335
- ItemValidationSummaryComponent.decorators = [
3336
- { type: Component, args: [{
3337
- selector: "anatoly-item-validation-summary",
3338
- template: "<ul class=\"list-unstyled\" *ngIf=\"isControlInvalid(controlName)\">\r\n <li *ngFor=\"let error of getValidationMessages(formGroup.get(controlName), controlTitle)\">\r\n <span class=\"help-block\">{{ error }}</span>\r\n </li>\r\n</ul>\r\n\r\n"
3339
- },] }
3340
- ];
3341
- ItemValidationSummaryComponent.ctorParameters = () => [];
3342
- ItemValidationSummaryComponent.propDecorators = {
3343
- controlName: [{ type: Input }],
3344
- controlTitle: [{ type: Input }]
3345
- };
3346
-
3347
- /*
3348
- <file>
3349
- Project:
3350
- @osovitny/anatoly
3351
-
3352
- Authors:
3353
- Vadim Osovitny
3354
- Anatoly Osovitny
3355
-
3356
- Created:
3357
- 26 Jun 2020
3358
-
3359
- Version:
3360
- 1.0
3361
-
3362
- Copyright (c) 2016-2021 Osovitny Inc. All rights reserved.
3363
- </file>
3364
- */
3365
- const FroalaEditorModuleWithProviders = FroalaEditorModule.forRoot();
3366
- const FroalaViewModuleWithProviders = FroalaViewModule.forRoot();
3367
- class AnatolyUIModule {
3368
- }
3369
- AnatolyUIModule.decorators = [
3370
- { type: NgModule, args: [{
3371
- imports: [
3372
- CommonModule,
3373
- ReactiveFormsModule,
3374
- FormsModule,
3375
- FroalaEditorModuleWithProviders,
3376
- FroalaViewModuleWithProviders,
3377
- ],
3378
- exports: [
3379
- SubscribePlanButtonComponent,
3380
- UpgradePlanButtonComponent,
3381
- BuyAccessButtonComponent,
3382
- SignInButtonComponent,
3383
- SignUpButtonComponent,
3384
- SignOutButtonComponent,
3385
- ContentHeaderComponent,
3386
- SpinnerComponent,
3387
- LoadingComponent,
3388
- NativeElementDirective,
3389
- //Editor
3390
- HtmlEditorComponent,
3391
- FormsHtmlEditorComponent,
3392
- //Validation
3393
- FormValidationSummaryComponent,
3394
- ItemValidationSummaryComponent,
3395
- //Pipe
3396
- SafeHtmlPipe,
3397
- ReplaceTextPipe,
3398
- FileSizePipe,
3399
- ],
3400
- declarations: [
3401
- SubscribePlanButtonComponent,
3402
- UpgradePlanButtonComponent,
3403
- BuyAccessButtonComponent,
3404
- SignInButtonComponent,
3405
- SignUpButtonComponent,
3406
- SignOutButtonComponent,
3407
- ContentHeaderComponent,
3408
- SpinnerComponent,
3409
- LoadingComponent,
3410
- NativeElementDirective,
3411
- //Editor
3412
- HtmlEditorComponent,
3413
- FormsHtmlEditorComponent,
3414
- //Validation
3415
- FormValidationSummaryComponent,
3416
- ItemValidationSummaryComponent,
3417
- //Pipe
3418
- SafeHtmlPipe,
3419
- ReplaceTextPipe,
3420
- FileSizePipe,
3421
- ]
3422
- },] }
3423
- ];
3424
-
3425
- /*
3426
- * Public API Surface of anatoly-lib
3427
- */
3428
-
3429
- /**
3430
- * Generated bundle index. Do not edit.
3431
- */
3432
-
3433
- export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyHttpInterceptor, AnatolyUIModule, AppContextService, AppCoreSettings, BaseApiService, BaseComponent, BaseDialog, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BaseHtmlEditorComponent, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, ContextInitState, Convert, DefaultEditorOptions, DigitalMarketingService, FileSizePipe, FormValidationSummaryComponent, FormsHtmlEditorComponent, FroalaEditorModuleWithProviders, FroalaViewModuleWithProviders, GlobalErrorHandler, GoogleAnalyticsService, Guid, HtmlEditorComponent, IdleService, InjectorInstance, ItemValidationSummaryComponent, LoadingComponent, LoadingService, LocalStorageService, LocalizationInjectorInstance, LocalizationModule, LocalizationService, LocalizationSettingsModule, LocalizePipe, LoggingService, NativeElementDirective, NotificationService, NotificationsApiService, ReplaceTextPipe, SafeHtmlPipe, SessionStorageService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SpinnerComponent, Subs, SubscribePlanButtonComponent, TranslateModuleAtRoot, UpgradePlanButtonComponent, Urls, Utils, ValidationSummaryComponent, customTranslateLoaderFactory, localizationInitializerFactory, throwIfAlreadyLoaded };
3434
- //# sourceMappingURL=osovitny-anatoly.js.map