@osovitny/anatoly 2.0.9 → 2.0.11

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 (67) hide show
  1. package/bundles/osovitny-anatoly.umd.js +669 -301
  2. package/bundles/osovitny-anatoly.umd.js.map +1 -1
  3. package/bundles/osovitny-anatoly.umd.min.js +2 -2
  4. package/bundles/osovitny-anatoly.umd.min.js.map +1 -1
  5. package/esm2015/lib/core/alerts.js +5 -1
  6. package/esm2015/lib/core/core.module.js +21 -5
  7. package/esm2015/lib/core/go/base-go.service.js +38 -0
  8. package/esm2015/lib/core/guards/once-import.guard.js +24 -0
  9. package/esm2015/lib/core/guid.js +25 -0
  10. package/esm2015/lib/core/index.js +27 -4
  11. package/esm2015/lib/core/logging/globalErrorHandler.js +42 -0
  12. package/esm2015/lib/core/logging/logging.service.js +38 -0
  13. package/esm2015/lib/core/services/appcontext.service.js +5 -1
  14. package/esm2015/lib/core/subs.js +34 -0
  15. package/esm2015/lib/core/utils.js +29 -5
  16. package/esm2015/lib/data/base/base-api.service.js +22 -16
  17. package/esm2015/lib/data/base/grid/base-grid-edit.service.js +15 -13
  18. package/esm2015/lib/data/base/grid/base-grid-read.service.js +16 -9
  19. package/esm2015/lib/data/data.module.js +10 -10
  20. package/esm2015/lib/data/index.js +24 -6
  21. package/esm2015/lib/data/services/billing-api.service.js +32 -17
  22. package/esm2015/lib/ui/components/base-edit.component.js +11 -7
  23. package/esm2015/lib/ui/components/base.component.js +12 -8
  24. package/esm2015/lib/ui/components/billing/buyaccess-button.component.js +12 -9
  25. package/esm2015/lib/ui/components/billing/subscribe-plan-button.component.js +10 -6
  26. package/esm2015/lib/ui/components/billing/upgrade-plan-button.component.js +11 -7
  27. package/esm2015/lib/ui/components/content-header/content-header.component.js +8 -4
  28. package/esm2015/lib/ui/components/html-editor/base-html-editor.component.js +13 -8
  29. package/esm2015/lib/ui/components/html-editor/forms-html-editor.component.js +9 -6
  30. package/esm2015/lib/ui/components/html-editor/html-editor.component.js +10 -7
  31. package/esm2015/lib/ui/components/html-editor/html-editor.defaultoptions.js +75 -18
  32. package/esm2015/lib/ui/components/identity/signin-button.component.js +8 -4
  33. package/esm2015/lib/ui/components/identity/signout-button.component.js +8 -4
  34. package/esm2015/lib/ui/components/identity/signup-button.component.js +6 -2
  35. package/esm2015/lib/ui/components/validation/form-validation-summary.component.js +5 -1
  36. package/esm2015/lib/ui/components/validation/item-validation-summary.component.js +5 -1
  37. package/esm2015/lib/ui/components/validation/validation-summary.component.js +5 -1
  38. package/esm2015/lib/ui/index.js +21 -3
  39. package/esm2015/lib/ui/ui.module.js +11 -6
  40. package/fesm2015/osovitny-anatoly.js +685 -280
  41. package/fesm2015/osovitny-anatoly.js.map +1 -1
  42. package/lib/core/core.module.d.ts +4 -0
  43. package/lib/core/guards/once-import.guard.d.ts +1 -0
  44. package/lib/core/guid.d.ts +3 -0
  45. package/lib/core/index.d.ts +5 -1
  46. package/lib/core/logging/globalErrorHandler.d.ts +6 -0
  47. package/lib/core/logging/logging.service.d.ts +5 -0
  48. package/lib/core/subs.d.ts +8 -0
  49. package/lib/core/utils.d.ts +4 -2
  50. package/lib/data/base/base-api.service.d.ts +2 -2
  51. package/lib/data/base/grid/base-grid-edit.service.d.ts +3 -3
  52. package/lib/data/base/grid/base-grid-read.service.d.ts +2 -2
  53. package/lib/data/index.d.ts +5 -5
  54. package/lib/data/services/billing-api.service.d.ts +2 -2
  55. package/lib/ui/components/base-edit.component.d.ts +2 -2
  56. package/lib/ui/components/billing/buyaccess-button.component.d.ts +3 -3
  57. package/lib/ui/components/billing/subscribe-plan-button.component.d.ts +2 -2
  58. package/lib/ui/components/billing/upgrade-plan-button.component.d.ts +1 -1
  59. package/lib/ui/components/content-header/content-header.component.d.ts +1 -1
  60. package/lib/ui/components/html-editor/base-html-editor.component.d.ts +2 -2
  61. package/lib/ui/components/html-editor/forms-html-editor.component.d.ts +1 -1
  62. package/lib/ui/components/html-editor/html-editor.component.d.ts +1 -1
  63. package/lib/ui/index.d.ts +1 -1
  64. package/lib/ui/ui.module.d.ts +1 -1
  65. package/package.json +1 -1
  66. package/esm2015/lib/core/services/base-go.service.js +0 -34
  67. /package/lib/core/{services → go}/base-go.service.d.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  import Swal from 'sweetalert2';
2
- import { Injectable, NgModule, Component, Input } from '@angular/core';
2
+ import { v4 } from 'uuid';
3
+ import { Injectable, ɵɵdefineInjectable, Injector, NgModule, Optional, SkipSelf, Component, Input } from '@angular/core';
3
4
  import { ActivatedRoute, Router } from '@angular/router';
4
5
  import { HttpClient } from '@angular/common/http';
5
6
  import { map } from 'rxjs/operators';
@@ -10,8 +11,12 @@ import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
10
11
 
11
12
  /*
12
13
  <file>
14
+ Project:
15
+ @osovitny/anatoly
16
+
13
17
  Authors:
14
18
  Vadim Osovitny
19
+ Anatoly Osovitny
15
20
 
16
21
  Created:
17
22
  4 Mar 2020
@@ -150,11 +155,15 @@ class Alerts {
150
155
 
151
156
  /*
152
157
  <file>
158
+ Project:
159
+ @osovitny/anatoly
160
+
153
161
  Authors:
154
162
  Vadim Osovitny
163
+ Anatoly Osovitny
155
164
 
156
165
  Created:
157
- 4 Mar 2020
166
+ 26 Jun 2020
158
167
 
159
168
  Version:
160
169
  1.0
@@ -163,22 +172,104 @@ class Alerts {
163
172
  </file>
164
173
  */
165
174
  class Utils {
166
- static GetValueByNameInQS(name) {
167
- return Utils.GetValueByName(location.search, name);
175
+ static getValueByNameInQS(name) {
176
+ return Utils.getValueByName(location.search, name);
168
177
  }
169
- static GetValueByName(url, name) {
178
+ static getValueByName(url, name) {
170
179
  name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
171
180
  var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(url);
172
181
  return results === null
173
182
  ? ""
174
183
  : decodeURIComponent(results[1].replace(/\+/g, " "));
175
184
  }
185
+ static copyToClipBoard(event, val) {
186
+ event.preventDefault();
187
+ let selBox = document.createElement("textarea");
188
+ selBox.style.position = "fixed";
189
+ selBox.style.left = "0";
190
+ selBox.style.top = "0";
191
+ selBox.style.opacity = "0";
192
+ selBox.value = val;
193
+ document.body.appendChild(selBox);
194
+ selBox.focus();
195
+ selBox.select();
196
+ document.execCommand("copy");
197
+ document.body.removeChild(selBox);
198
+ }
199
+ static downloadFile(name, url) {
200
+ var link = document.createElement("a");
201
+ link.download = name;
202
+ link.href = url;
203
+ link.click();
204
+ }
205
+ }
206
+
207
+ /*
208
+ <file>
209
+ Project:
210
+ @osovitny/anatoly
211
+
212
+ Authors:
213
+ Vadim Osovitny
214
+ Anatoly Osovitny
215
+
216
+ Created:
217
+ 26 Jun 2020
218
+
219
+ Version:
220
+ 1.0
221
+
222
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
223
+ </file>
224
+ */
225
+ class Subs {
226
+ constructor() {
227
+ this.subs = [];
228
+ }
229
+ add(...subscriptions) {
230
+ this.subs = this.subs.concat(subscriptions);
231
+ }
232
+ set sink(subscription) {
233
+ this.subs.push(subscription);
234
+ }
235
+ unsubscribe() {
236
+ this.subs.forEach((sub) => sub && sub.unsubscribe());
237
+ this.subs = [];
238
+ }
239
+ }
240
+
241
+ /*
242
+ <file>
243
+ Project:
244
+ @osovitny/anatoly
245
+
246
+ Authors:
247
+ Vadim Osovitny
248
+ Anatoly Osovitny
249
+
250
+ Created:
251
+ 26 Jun 2020
252
+
253
+ Version:
254
+ 1.0
255
+
256
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
257
+ </file>
258
+ */
259
+ class Guid {
260
+ static newGuid() {
261
+ return v4();
262
+ }
176
263
  }
177
264
 
178
265
  /*
179
266
  <file>
267
+ Project:
268
+ @osovitny/anatoly
269
+
180
270
  Authors:
181
271
  Vadim Osovitny
272
+ Anatoly Osovitny
182
273
 
183
274
  Created:
184
275
  17 Jun 2018
@@ -209,11 +300,15 @@ BaseGoService.ctorParameters = () => [
209
300
 
210
301
  /*
211
302
  <file>
303
+ Project:
304
+ @osovitny/anatoly
305
+
212
306
  Authors:
213
307
  Vadim Osovitny
308
+ Anatoly Osovitny
214
309
 
215
310
  Created:
216
- 13 Nov 2017
311
+ 13 Nov 2017
217
312
 
218
313
  Version:
219
314
  1.0
@@ -227,43 +322,45 @@ class BaseApiService {
227
322
  this.baseUrl = "";
228
323
  }
229
324
  serializeParams(data) {
230
- return data ? ('?' + $.param(data)) : '';
325
+ return data ? "?" + $.param(data) : "";
231
326
  }
232
327
  //api
233
328
  get(action, data, responseType) {
234
329
  if (!responseType) {
235
- responseType = 'json';
330
+ responseType = "json";
236
331
  }
237
332
  var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
238
- return this.http.get(url, { responseType: responseType }).pipe(map(res => res));
333
+ return this.http
334
+ .get(url, { responseType: responseType })
335
+ .pipe(map((res) => res));
239
336
  }
240
337
  post(action, data, responseType) {
241
338
  if (!responseType) {
242
- responseType = 'text';
339
+ responseType = "text";
243
340
  }
244
341
  var url = `${this.baseUrl}/${action}`;
245
342
  return this.http.post(url, data, { responseType: responseType });
246
343
  }
247
344
  postQS(action, data, responseType) {
248
345
  if (!responseType) {
249
- responseType = 'text';
346
+ responseType = "text";
250
347
  }
251
348
  var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
252
349
  return this.http.post(url, null, { responseType: responseType });
253
350
  }
254
351
  delete(action, data, responseType) {
255
352
  if (!responseType) {
256
- responseType = 'text';
353
+ responseType = "text";
257
354
  }
258
355
  var url = `${this.baseUrl}/${action}${this.serializeParams(data)}`;
259
356
  return this.http.delete(url, { responseType: responseType });
260
357
  }
261
358
  //gets
262
359
  getById(id) {
263
- return this.get('getById', { id: id });
360
+ return this.get("getById", { id: id });
264
361
  }
265
362
  getAll(data) {
266
- return this.get('getall', data).pipe(map(res => res));
363
+ return this.get("getall", data).pipe(map((res) => res));
267
364
  }
268
365
  getJsonFile(fileName, jsonUrl, jsonVersion) {
269
366
  if (!jsonUrl) {
@@ -272,12 +369,12 @@ class BaseApiService {
272
369
  if (!jsonVersion) {
273
370
  jsonVersion = "1.0";
274
371
  }
275
- var url = jsonUrl + "/" + fileName + '?' + jsonVersion;
276
- return this.http.get(url).pipe(map(res => res));
372
+ var url = jsonUrl + "/" + fileName + "?" + jsonVersion;
373
+ return this.http.get(url).pipe(map((res) => res));
277
374
  }
278
375
  getNewGuid() {
279
376
  var url = `${this.baseUrl}/getNewGuid`;
280
- return this.http.get(url, { responseType: 'text' });
377
+ return this.http.get(url, { responseType: "text" });
281
378
  }
282
379
  }
283
380
  BaseApiService.decorators = [
@@ -289,8 +386,12 @@ BaseApiService.ctorParameters = () => [
289
386
 
290
387
  /*
291
388
  <file>
389
+ Project:
390
+ @osovitny/anatoly
391
+
292
392
  Authors:
293
393
  Vadim Osovitny
394
+ Anatoly Osovitny
294
395
 
295
396
  Created:
296
397
  13 Nov 2017
@@ -351,20 +452,151 @@ AppContextService.ctorParameters = () => [
351
452
  { type: HttpClient }
352
453
  ];
353
454
 
455
+ /*
456
+ <file>
457
+ Project:
458
+ @osovitny/anatoly
459
+
460
+ Authors:
461
+ Vadim Osovitny
462
+ Anatoly Osovitny
463
+
464
+ Created:
465
+ 26 Jun 2020
466
+
467
+ Version:
468
+ 1.0
469
+
470
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
471
+ </file>
472
+ */
473
+ class LoggingService {
474
+ constructor() { }
475
+ logError(error) {
476
+ console.error(error);
477
+ }
478
+ logInformation(info) {
479
+ console.info(info);
480
+ }
481
+ }
482
+ LoggingService.ɵprov = ɵɵdefineInjectable({ factory: function LoggingService_Factory() { return new LoggingService(); }, token: LoggingService, providedIn: "root" });
483
+ LoggingService.decorators = [
484
+ { type: Injectable, args: [{
485
+ providedIn: "root",
486
+ },] }
487
+ ];
488
+ LoggingService.ctorParameters = () => [];
489
+
490
+ /*
491
+ <file>
492
+ Project:
493
+ @osovitny/anatoly
494
+
495
+ Authors:
496
+ Vadim Osovitny
497
+ Anatoly Osovitny
498
+
499
+ Created:
500
+ 26 Jun 2020
501
+
502
+ Version:
503
+ 1.0
504
+
505
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
506
+ </file>
507
+ */
508
+ class GlobalErrorHandler {
509
+ constructor(injector) {
510
+ this.injector = injector;
511
+ }
512
+ handleError(error) {
513
+ const loggingService = this.injector.get(LoggingService);
514
+ loggingService.logError(error);
515
+ // IMPORTANT: Rethrow the error otherwise it gets swallowed
516
+ throw error;
517
+ }
518
+ }
519
+ GlobalErrorHandler.decorators = [
520
+ { type: Injectable }
521
+ ];
522
+ GlobalErrorHandler.ctorParameters = () => [
523
+ { type: Injector }
524
+ ];
525
+
526
+ /*
527
+ <file>
528
+ Project:
529
+ @osovitny/anatoly
530
+
531
+ Authors:
532
+ Vadim Osovitny
533
+ Anatoly Osovitny
534
+
535
+ Created:
536
+ 26 Jun 2020
537
+
538
+ Version:
539
+ 1.0
540
+
541
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
542
+ </file>
543
+ */
544
+ function throwIfAlreadyLoaded(parentModule, moduleName) {
545
+ if (parentModule) {
546
+ throw new Error(`${moduleName} has already been loaded. Import ${moduleName} modules in the AppModule only.`);
547
+ }
548
+ }
549
+
550
+ const providers = [
551
+ LoggingService,
552
+ AppContextService,
553
+ ];
554
+ let InjectorInstance;
354
555
  class AnatolyCoreModule {
556
+ constructor(injector, parentModule) {
557
+ this.injector = injector;
558
+ throwIfAlreadyLoaded(parentModule, "AnatolyCoreModule");
559
+ InjectorInstance = this.injector;
560
+ }
355
561
  }
356
562
  AnatolyCoreModule.decorators = [
357
563
  { type: NgModule, args: [{
358
- declarations: [],
359
564
  imports: [CommonModule],
360
- providers: [AppContextService],
565
+ providers: [...providers],
361
566
  },] }
567
+ ];
568
+ AnatolyCoreModule.ctorParameters = () => [
569
+ { type: Injector },
570
+ { type: AnatolyCoreModule, decorators: [{ type: Optional }, { type: SkipSelf }] }
362
571
  ];
363
572
 
364
573
  /*
365
574
  <file>
575
+ Project:
576
+ @osovitny/anatoly
577
+ ./go/base-go.service
578
+ Authors:
579
+ Vadim Osovitny
580
+ Anatoly Osovitny
581
+
582
+ Created:
583
+ 26 Jun 2020
584
+
585
+ Version:
586
+ 1.0
587
+
588
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
589
+ </file>
590
+ */
591
+
592
+ /*
593
+ <file>
594
+ Project:
595
+ @osovitny/anatoly
596
+
366
597
  Authors:
367
598
  Vadim Osovitny
599
+ Anatoly Osovitny
368
600
 
369
601
  Created:
370
602
  29 Apr 2018
@@ -383,25 +615,28 @@ class BaseGridReadService extends BehaviorSubject {
383
615
  this.data = [];
384
616
  }
385
617
  serializeParams(data) {
386
- return data ? ('?' + $.param(data)) : '';
618
+ return data ? "?" + $.param(data) : "";
387
619
  }
388
620
  read(params, success, error) {
389
621
  if (this.data.length) {
390
622
  return super.next(this.data);
391
623
  }
392
624
  var url = this.baseReadUrl;
393
- if (typeof params === 'undefined') {
625
+ if (typeof params === "undefined") {
394
626
  params = this.savedReadParams;
395
627
  }
396
628
  if (params) {
397
629
  url = this.baseReadUrl + `${this.serializeParams(params)}`;
398
630
  this.savedReadParams = params;
399
631
  }
400
- this.http.get(url).pipe(map(res => res)).subscribe(data => {
632
+ this.http
633
+ .get(url)
634
+ .pipe(map((res) => res))
635
+ .subscribe((data) => {
401
636
  super.next(data);
402
637
  if (success)
403
638
  success();
404
- }, e => {
639
+ }, (e) => {
405
640
  if (error)
406
641
  error(e);
407
642
  });
@@ -416,8 +651,12 @@ BaseGridReadService.ctorParameters = () => [
416
651
 
417
652
  /*
418
653
  <file>
654
+ Project:
655
+ @osovitny/anatoly
656
+
419
657
  Authors:
420
658
  Vadim Osovitny
659
+ Anatoly Osovitny
421
660
 
422
661
  Created:
423
662
  29 Apr 2018
@@ -442,16 +681,15 @@ class BaseGridEditService extends BaseGridReadService {
442
681
  return;
443
682
  }
444
683
  //find orignal data item
445
- const originalDataItem = this.data.find(item => item.Id === dataItem.Id);
684
+ const originalDataItem = this.data.find((item) => item.Id === dataItem.Id);
446
685
  //revert changes
447
686
  Object.assign(originalDataItem, dataItem);
448
687
  super.next(this.data);
449
688
  }
450
689
  save(data, isNew, sucess) {
451
- const action = isNew ? 'add' : 'update';
690
+ const action = isNew ? "add" : "update";
452
691
  this.reset();
453
- this.post(action, data).subscribe(() => {
454
- }, () => {
692
+ this.post(action, data).subscribe(() => { }, () => {
455
693
  this.read();
456
694
  }, () => {
457
695
  this.read();
@@ -461,8 +699,7 @@ class BaseGridEditService extends BaseGridReadService {
461
699
  }
462
700
  remove(data, sucess) {
463
701
  this.reset();
464
- this.post('remove', data).subscribe(() => {
465
- }, () => {
702
+ this.post("remove", data).subscribe(() => { }, () => {
466
703
  this.read();
467
704
  }, () => {
468
705
  this.read();
@@ -472,7 +709,7 @@ class BaseGridEditService extends BaseGridReadService {
472
709
  }
473
710
  post(action, data) {
474
711
  var url = this.baseUrl + `${action}${this.serializeParams(data)}`;
475
- return this.http.post(url, data).pipe(map(res => res));
712
+ return this.http.post(url, data).pipe(map((res) => res));
476
713
  }
477
714
  }
478
715
  BaseGridEditService.decorators = [
@@ -484,8 +721,12 @@ BaseGridEditService.ctorParameters = () => [
484
721
 
485
722
  /*
486
723
  <file>
724
+ Project:
725
+ @osovitny/anatoly
726
+
487
727
  Authors:
488
728
  Vadim Osovitny
729
+ Anatoly Osovitny
489
730
 
490
731
  Created:
491
732
  12 Nov 2017
@@ -500,25 +741,36 @@ class BillingApiService extends BaseApiService {
500
741
  constructor(http) {
501
742
  super(http);
502
743
  this.http = http;
503
- this.baseUrl += 'billing/';
744
+ this.baseUrl += "billing/";
504
745
  }
505
746
  requestNewSubscription(requestedPlan, success, error) {
506
- this.postQS('requestNewSubscription', { requestedPlan: requestedPlan })
507
- .subscribe(data => { }, e => { if (error)
508
- error(); }, () => { if (success)
509
- success(); });
747
+ this.postQS("requestNewSubscription", {
748
+ requestedPlan: requestedPlan,
749
+ }).subscribe((data) => { }, (e) => {
750
+ if (error)
751
+ error();
752
+ }, () => {
753
+ if (success)
754
+ success();
755
+ });
510
756
  }
511
757
  cancelRequestedSubscription(success, error) {
512
- this.postQS('cancelRequestedSubscription', null)
513
- .subscribe(data => { }, e => { if (error)
514
- error(); }, () => { if (success)
515
- success(); });
758
+ this.postQS("cancelRequestedSubscription", null).subscribe((data) => { }, (e) => {
759
+ if (error)
760
+ error();
761
+ }, () => {
762
+ if (success)
763
+ success();
764
+ });
516
765
  }
517
766
  buyAccess(requestedPlan, success, error) {
518
- this.postQS('buyAccess', { requestedPlan: requestedPlan })
519
- .subscribe(data => { }, e => { if (error)
520
- error(); }, () => { if (success)
521
- success(); });
767
+ this.postQS("buyAccess", { requestedPlan: requestedPlan }).subscribe((data) => { }, (e) => {
768
+ if (error)
769
+ error();
770
+ }, () => {
771
+ if (success)
772
+ success();
773
+ });
522
774
  }
523
775
  }
524
776
  BillingApiService.decorators = [
@@ -530,8 +782,12 @@ BillingApiService.ctorParameters = () => [
530
782
 
531
783
  /*
532
784
  <file>
785
+ Project:
786
+ @osovitny/anatoly
787
+
533
788
  Authors:
534
789
  Vadim Osovitny
790
+ Anatoly Osovitny
535
791
 
536
792
  Created:
537
793
  4 Mar 2020
@@ -546,21 +802,106 @@ class AnatolyDataModule {
546
802
  }
547
803
  AnatolyDataModule.decorators = [
548
804
  { type: NgModule, args: [{
549
- imports: [
550
- CommonModule,
551
- ],
552
- providers: [
553
- BillingApiService
554
- ]
805
+ imports: [CommonModule],
806
+ providers: [BillingApiService],
555
807
  },] }
556
808
  ];
557
809
 
558
- // Services
810
+ /*
811
+ <file>
812
+ Project:
813
+ @osovitny/anatoly
814
+
815
+ Authors:
816
+ Vadim Osovitny
817
+ Anatoly Osovitny
818
+
819
+ Created:
820
+ 4 Mar 2020
821
+
822
+ Version:
823
+ 1.0
824
+
825
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
826
+ </file>
827
+ */
828
+
829
+ /*
830
+ <file>
831
+ Project:
832
+ @osovitny/anatoly
833
+
834
+ Authors:
835
+ Vadim Osovitny
836
+ Anatoly Osovitny
837
+
838
+ Created:
839
+ 14 Aug 2018
840
+
841
+ Version:
842
+ 1.0
843
+
844
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
845
+ </file>
846
+ */
847
+ class BuyAccessButtonComponent {
848
+ constructor(appcontext, api) {
849
+ this.appcontext = appcontext;
850
+ this.api = api;
851
+ this.contextUpdated = false;
852
+ this.isUserSignedIn = false;
853
+ this.currentPlan = 0;
854
+ this.currentPlanTitle = "";
855
+ }
856
+ ngOnInit() {
857
+ if (!this.appcontext.isUserSignedIn()) {
858
+ this.contextUpdated = true;
859
+ return;
860
+ }
861
+ this.appcontext.getCurrent((current) => {
862
+ this.isUserSignedIn = current.isUserSignedIn;
863
+ if (this.isUserSignedIn) {
864
+ this.currentPlan = current.account.billingPlan;
865
+ this.currentPlanTitle = current.account.billingPlanAsString;
866
+ }
867
+ this.contextUpdated = true;
868
+ });
869
+ }
870
+ onBuyPlan() {
871
+ const text = `Requested plan: ${this.plantitle} `;
872
+ const that = this;
873
+ Alerts.AreYouSure(text, "Buying access", "Confirm change", "Cancel", () => {
874
+ that.api.buyAccess(that.plan, () => {
875
+ Alerts.Success("Access Granted", null, () => {
876
+ window.location.reload();
877
+ });
878
+ });
879
+ });
880
+ }
881
+ }
882
+ BuyAccessButtonComponent.decorators = [
883
+ { type: Component, args: [{
884
+ selector: "anatoly-buyaccess-button",
885
+ 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"
886
+ },] }
887
+ ];
888
+ BuyAccessButtonComponent.ctorParameters = () => [
889
+ { type: AppContextService },
890
+ { type: BillingApiService }
891
+ ];
892
+ BuyAccessButtonComponent.propDecorators = {
893
+ plan: [{ type: Input }],
894
+ plantitle: [{ type: Input }]
895
+ };
559
896
 
560
897
  /*
561
898
  <file>
899
+ Project:
900
+ @osovitny/anatoly
901
+
562
902
  Authors:
563
903
  Vadim Osovitny
904
+ Anatoly Osovitny
564
905
 
565
906
  Created:
566
907
  1 Jun 2018
@@ -577,9 +918,9 @@ class SubscribePlanButtonComponent {
577
918
  this.contextUpdated = false;
578
919
  this.isUserSignedIn = false;
579
920
  this.currentPlan = 0;
580
- this.currentPlanTitle = '';
921
+ this.currentPlanTitle = "";
581
922
  this.requestedPlan = 0;
582
- this.requestedPlanTitle = '';
923
+ this.requestedPlanTitle = "";
583
924
  }
584
925
  ngOnInit() {
585
926
  if (!this.appcontext.isUserSignedIn()) {
@@ -600,7 +941,7 @@ class SubscribePlanButtonComponent {
600
941
  }
601
942
  SubscribePlanButtonComponent.decorators = [
602
943
  { type: Component, args: [{
603
- selector: 'anatoly-subscribe-plan-button',
944
+ selector: "anatoly-subscribe-plan-button",
604
945
  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"
605
946
  },] }
606
947
  ];
@@ -614,8 +955,12 @@ SubscribePlanButtonComponent.propDecorators = {
614
955
 
615
956
  /*
616
957
  <file>
958
+ Project:
959
+ @osovitny/anatoly
960
+
617
961
  Authors:
618
962
  Vadim Osovitny
963
+ Anatoly Osovitny
619
964
 
620
965
  Created:
621
966
  12 Nov 2017
@@ -634,9 +979,9 @@ class UpgradePlanButtonComponent {
634
979
  onUpgradePlan() {
635
980
  const text = `Current plan: ${this.currentplantitle} New plan: ${this.requestedplantitle}`;
636
981
  const that = this;
637
- Alerts.AreYouSure(text, 'Change billing plan', 'Confirm change', 'Cancel', () => {
982
+ Alerts.AreYouSure(text, "Change billing plan", "Confirm change", "Cancel", () => {
638
983
  that.api.requestNewSubscription(that.requestedplan, () => {
639
- Alerts.Success('Your request for changing plan has been sent.', null, () => {
984
+ Alerts.Success("Your request for changing plan has been sent.", null, () => {
640
985
  window.location.reload();
641
986
  });
642
987
  });
@@ -645,7 +990,7 @@ class UpgradePlanButtonComponent {
645
990
  }
646
991
  UpgradePlanButtonComponent.decorators = [
647
992
  { type: Component, args: [{
648
- selector: 'anatoly-upgrade-plan-button',
993
+ selector: "anatoly-upgrade-plan-button",
649
994
  template: "<button class=\"btn btn-block btn-primary\" (click)=\"onUpgradePlan()\">\r\n Upgrade\r\n</button>\r\n"
650
995
  },] }
651
996
  ];
@@ -660,12 +1005,15 @@ UpgradePlanButtonComponent.propDecorators = {
660
1005
 
661
1006
  /*
662
1007
  <file>
1008
+ Project:
1009
+ @osovitny/anatoly
1010
+
663
1011
  Authors:
664
1012
  Vadim Osovitny
665
1013
  Anatoly Osovitny
666
1014
 
667
1015
  Created:
668
- 14 Aug 2018
1016
+ 4 Jul 2018
669
1017
 
670
1018
  Version:
671
1019
  1.0
@@ -673,60 +1021,28 @@ UpgradePlanButtonComponent.propDecorators = {
673
1021
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
674
1022
  </file>
675
1023
  */
676
- class BuyAccessButtonComponent {
677
- constructor(appcontext, api) {
678
- this.appcontext = appcontext;
679
- this.api = api;
680
- this.contextUpdated = false;
681
- this.isUserSignedIn = false;
682
- this.currentPlan = 0;
683
- this.currentPlanTitle = '';
684
- }
685
- ngOnInit() {
686
- if (!this.appcontext.isUserSignedIn()) {
687
- this.contextUpdated = true;
688
- return;
689
- }
690
- this.appcontext.getCurrent((current) => {
691
- this.isUserSignedIn = current.isUserSignedIn;
692
- if (this.isUserSignedIn) {
693
- this.currentPlan = current.account.billingPlan;
694
- this.currentPlanTitle = current.account.billingPlanAsString;
695
- }
696
- this.contextUpdated = true;
697
- });
698
- }
699
- onBuyPlan() {
700
- const text = `Requested plan: ${this.plantitle} `;
701
- const that = this;
702
- Alerts.AreYouSure(text, 'Buying access', 'Confirm change', 'Cancel', () => {
703
- that.api.buyAccess(that.plan, () => {
704
- Alerts.Success('Access Granted', null, () => {
705
- window.location.reload();
706
- });
707
- });
708
- });
709
- }
1024
+ class SignInButtonComponent {
1025
+ constructor() { }
710
1026
  }
711
- BuyAccessButtonComponent.decorators = [
1027
+ SignInButtonComponent.decorators = [
712
1028
  { type: Component, args: [{
713
- selector: 'anatoly-buyaccess-button',
714
- 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"
1029
+ selector: "anatoly-signin-button",
1030
+ template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
715
1031
  },] }
716
1032
  ];
717
- BuyAccessButtonComponent.ctorParameters = () => [
718
- { type: AppContextService },
719
- { type: BillingApiService }
720
- ];
721
- BuyAccessButtonComponent.propDecorators = {
722
- plan: [{ type: Input }],
723
- plantitle: [{ type: Input }]
1033
+ SignInButtonComponent.ctorParameters = () => [];
1034
+ SignInButtonComponent.propDecorators = {
1035
+ classbtn: [{ type: Input }]
724
1036
  };
725
1037
 
726
1038
  /*
727
1039
  <file>
1040
+ Project:
1041
+ @osovitny/anatoly
1042
+
728
1043
  Authors:
729
1044
  Vadim Osovitny
1045
+ Anatoly Osovitny
730
1046
 
731
1047
  Created:
732
1048
  4 Jul 2018
@@ -734,27 +1050,31 @@ BuyAccessButtonComponent.propDecorators = {
734
1050
  Version:
735
1051
  1.0
736
1052
 
737
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
1053
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
738
1054
  </file>
739
1055
  */
740
- class SignInButtonComponent {
1056
+ class SignOutButtonComponent {
741
1057
  constructor() { }
742
1058
  }
743
- SignInButtonComponent.decorators = [
1059
+ SignOutButtonComponent.decorators = [
744
1060
  { type: Component, args: [{
745
- selector: 'anatoly-signin-button',
746
- template: "<a href=\"identity/signIn\" class=\"{{classbtn}}\">Sign In</a>\r\n"
1061
+ selector: "anatoly-signout-button",
1062
+ template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
747
1063
  },] }
748
1064
  ];
749
- SignInButtonComponent.ctorParameters = () => [];
750
- SignInButtonComponent.propDecorators = {
1065
+ SignOutButtonComponent.ctorParameters = () => [];
1066
+ SignOutButtonComponent.propDecorators = {
751
1067
  classbtn: [{ type: Input }]
752
1068
  };
753
1069
 
754
1070
  /*
755
1071
  <file>
1072
+ Project:
1073
+ @osovitny/anatoly
1074
+
756
1075
  Authors:
757
1076
  Vadim Osovitny
1077
+ Anatoly Osovitny
758
1078
 
759
1079
  Created:
760
1080
  4 Jul 2018
@@ -762,7 +1082,7 @@ SignInButtonComponent.propDecorators = {
762
1082
  Version:
763
1083
  1.0
764
1084
 
765
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
1085
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
766
1086
  </file>
767
1087
  */
768
1088
  class SignUpButtonComponent {
@@ -779,36 +1099,47 @@ SignUpButtonComponent.propDecorators = {
779
1099
 
780
1100
  /*
781
1101
  <file>
1102
+ Project:
1103
+ @osovitny/anatoly
1104
+
782
1105
  Authors:
783
1106
  Vadim Osovitny
1107
+ Anatoly Osovitny
784
1108
 
785
1109
  Created:
786
- 4 Jul 2018
1110
+ 23 Apr 2018
787
1111
 
788
1112
  Version:
789
1113
  1.0
790
1114
 
791
- Copyright (c) 2018 Osovitny Inc. All rights reserved.
1115
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
792
1116
  </file>
793
1117
  */
794
- class SignOutButtonComponent {
795
- constructor() { }
1118
+ class ContentHeaderComponent {
1119
+ ngOnInit() {
1120
+ if (this.title == null) {
1121
+ this.title = "";
1122
+ }
1123
+ }
796
1124
  }
797
- SignOutButtonComponent.decorators = [
1125
+ ContentHeaderComponent.decorators = [
798
1126
  { type: Component, args: [{
799
- selector: 'anatoly-signout-button',
800
- template: "<a href=\"identity/signOut\" class=\"{{classbtn}}\">Sign Out</a>\r\n"
1127
+ selector: "anatoly-content-header",
1128
+ template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
801
1129
  },] }
802
1130
  ];
803
- SignOutButtonComponent.ctorParameters = () => [];
804
- SignOutButtonComponent.propDecorators = {
805
- classbtn: [{ type: Input }]
1131
+ ContentHeaderComponent.propDecorators = {
1132
+ title: [{ type: Input }]
806
1133
  };
807
1134
 
808
1135
  /*
809
1136
  <file>
1137
+ Project:
1138
+ @osovitny/anatoly
1139
+
810
1140
  Authors:
811
1141
  Vadim Osovitny
1142
+ Anatoly Osovitny
812
1143
 
813
1144
  Created:
814
1145
  28 Aug 2018
@@ -821,17 +1152,17 @@ SignOutButtonComponent.propDecorators = {
821
1152
  */
822
1153
  class BaseComponent {
823
1154
  getQSId() {
824
- const id = Utils.GetValueByNameInQS('id');
825
- if (typeof id === 'undefined' || id === '')
1155
+ let id = Utils.getValueByNameInQS("id");
1156
+ if (typeof id === "undefined" || id === "")
826
1157
  return null;
827
1158
  return id;
828
1159
  }
829
1160
  showLoading() {
830
- const panelLoading = $('#pnlLoading');
1161
+ let panelLoading = $("#pnlLoading");
831
1162
  panelLoading.show();
832
1163
  }
833
1164
  hideLoading() {
834
- const panelLoading = $('#pnlLoading');
1165
+ let panelLoading = $("#pnlLoading");
835
1166
  panelLoading.hide();
836
1167
  }
837
1168
  handleError(e) {
@@ -842,8 +1173,12 @@ class BaseComponent {
842
1173
 
843
1174
  /*
844
1175
  <file>
1176
+ Project:
1177
+ @osovitny/anatoly
1178
+
845
1179
  Authors:
846
1180
  Vadim Osovitny
1181
+ Anatoly Osovitny
847
1182
 
848
1183
  Created:
849
1184
  20 Nov 2017
@@ -860,8 +1195,8 @@ class BaseEditComponent extends BaseComponent {
860
1195
  this.formSubmitted = false;
861
1196
  }
862
1197
  isActionAdding() {
863
- const id = Utils.GetValueByNameInQS('id');
864
- if (typeof id === 'undefined' || id === '')
1198
+ let id = Utils.getValueByNameInQS("id");
1199
+ if (typeof id === "undefined" || id === "")
865
1200
  return true;
866
1201
  return false;
867
1202
  }
@@ -869,7 +1204,7 @@ class BaseEditComponent extends BaseComponent {
869
1204
  return this.getQSId();
870
1205
  }
871
1206
  isItemInvalid(name) {
872
- if (typeof name === 'undefined' || name === '') {
1207
+ if (typeof name === "undefined" || name === "") {
873
1208
  return false;
874
1209
  }
875
1210
  if (!this.formGroup) {
@@ -901,104 +1236,15 @@ BaseEditComponent.propDecorators = {
901
1236
 
902
1237
  /*
903
1238
  <file>
904
- Authors:
905
- Vadim Osovitny
906
-
907
- Created:
908
- 8 Dec 2017
909
-
910
- Version:
911
- 1.0
1239
+ Project:
1240
+ @osovitny/anatoly
912
1241
 
913
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
914
- </file>
915
- */
916
- class ValidationSummaryComponent extends BaseEditComponent {
917
- constructor() {
918
- super();
919
- }
920
- getFormValidationMessages() {
921
- let messages = [];
922
- Object.keys(this.formGroup.controls).forEach((k) => {
923
- var control = this.formGroup.controls[k];
924
- if (control.controls != null) {
925
- Object.keys(control.controls).forEach((k) => {
926
- var child = control.controls[k];
927
- this.getValidationMessages(child, k).forEach((m) => messages.push(m));
928
- });
929
- }
930
- else {
931
- this.getValidationMessages(control, k).forEach((m) => messages.push(m));
932
- }
933
- });
934
- return messages;
935
- }
936
- getValidationMessages(state, thingName) {
937
- let thing = state.path || thingName;
938
- let messages = [];
939
- if (state.errors) {
940
- for (let errorName in state.errors) {
941
- if (state.errors.hasOwnProperty(errorName)) {
942
- switch (errorName) {
943
- case "required":
944
- messages.push(`${thing} is required`);
945
- break;
946
- case "minlength":
947
- messages.push(`${thing} must be at least ${state.errors["minlength"].requiredLength} characters`);
948
- break;
949
- case "pattern":
950
- messages.push(`${thing} contains illegal characters`);
951
- break;
952
- }
953
- }
954
- }
955
- }
956
- return messages;
957
- }
958
- }
959
-
960
- /*
961
- <file>
962
- Authors:
963
- Vadim Osovitny
964
-
965
- Created:
966
- 7 Dec 2017
967
-
968
- Version:
969
- 1.0
970
-
971
- Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
972
- </file>
973
- */
974
- class FormValidationSummaryComponent extends ValidationSummaryComponent {
975
- constructor() {
976
- super();
977
- this.isVisible = false;
978
- }
979
- getErrors() {
980
- const messages = this.getFormValidationMessages();
981
- return messages;
982
- }
983
- }
984
- FormValidationSummaryComponent.decorators = [
985
- { type: Component, args: [{
986
- selector: "anatoly-form-validation-summary",
987
- template: "<div class=\"callout callout-danger\" *ngIf=\"isVisible\">\r\n <h4 class=\"box-title\">There are problems with the form</h4>\r\n <p *ngFor=\"let error of getErrors()\">\r\n <span class=\"help-block\" style=\"color: white;\">{{ error }}</span>\r\n </p>\r\n</div>\r\n"
988
- },] }
989
- ];
990
- FormValidationSummaryComponent.ctorParameters = () => [];
991
- FormValidationSummaryComponent.propDecorators = {
992
- isVisible: [{ type: Input }]
993
- };
994
-
995
- /*
996
- <file>
997
1242
  Authors:
998
1243
  Vadim Osovitny
1244
+ Anatoly Osovitny
999
1245
 
1000
1246
  Created:
1001
- 6 Dec 2017
1247
+ 12 Dec 2017
1002
1248
 
1003
1249
  Version:
1004
1250
  1.0
@@ -1006,60 +1252,85 @@ FormValidationSummaryComponent.propDecorators = {
1006
1252
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1007
1253
  </file>
1008
1254
  */
1009
- class ItemValidationSummaryComponent extends ValidationSummaryComponent {
1010
- constructor() {
1011
- super();
1012
- }
1013
- }
1014
- ItemValidationSummaryComponent.decorators = [
1015
- { type: Component, args: [{
1016
- selector: "anatoly-item-validation-summary",
1017
- template: "<ul class=\"list-unstyled\" *ngIf=\"isItemInvalid(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"
1018
- },] }
1019
- ];
1020
- ItemValidationSummaryComponent.ctorParameters = () => [];
1021
- ItemValidationSummaryComponent.propDecorators = {
1022
- controlName: [{ type: Input }],
1023
- controlTitle: [{ type: Input }]
1024
- };
1025
-
1026
1255
  const DefaultEditorOptions = {
1027
- placeholderText: 'Edit Your Content Here',
1256
+ placeholderText: "Edit Your Content Here",
1028
1257
  charCounterCount: true,
1029
1258
  heightMin: 100,
1030
1259
  toolbarInline: false,
1031
1260
  toolbarButtons: {
1032
- 'moreText': {
1033
- 'buttons': ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript',
1034
- 'fontFamily', 'fontSize', 'textColor', 'backgroundColor', 'inlineClass', 'inlineStyle']
1261
+ moreText: {
1262
+ buttons: [
1263
+ "bold",
1264
+ "italic",
1265
+ "underline",
1266
+ "strikeThrough",
1267
+ "subscript",
1268
+ "superscript",
1269
+ "fontFamily",
1270
+ "fontSize",
1271
+ "textColor",
1272
+ "backgroundColor",
1273
+ "inlineClass",
1274
+ "inlineStyle",
1275
+ ],
1035
1276
  },
1036
- 'moreParagraph': {
1037
- 'buttons': ['alignLeft', 'alignCenter', 'formatOLSimple', 'alignRight', 'alignJustify',
1038
- 'formatOL', 'formatUL', 'paragraphFormat', 'paragraphStyle', 'lineHeight', 'outdent', 'indent', 'quote']
1277
+ moreParagraph: {
1278
+ buttons: [
1279
+ "alignLeft",
1280
+ "alignCenter",
1281
+ "formatOLSimple",
1282
+ "alignRight",
1283
+ "alignJustify",
1284
+ "formatOL",
1285
+ "formatUL",
1286
+ "paragraphFormat",
1287
+ "paragraphStyle",
1288
+ "lineHeight",
1289
+ "outdent",
1290
+ "indent",
1291
+ "quote",
1292
+ ],
1039
1293
  },
1040
- 'moreRich': {
1041
- 'buttons': ['insertLink', 'insertImage', 'insertTable', 'emoticons', 'fontAwesome',
1042
- 'specialCharacters', 'embedly']
1294
+ moreRich: {
1295
+ buttons: [
1296
+ "insertLink",
1297
+ "insertImage",
1298
+ "insertTable",
1299
+ "emoticons",
1300
+ "fontAwesome",
1301
+ "specialCharacters",
1302
+ "embedly",
1303
+ ],
1304
+ },
1305
+ moreMisc: {
1306
+ buttons: [
1307
+ "selectAll",
1308
+ "clearFormatting",
1309
+ "html",
1310
+ "undo",
1311
+ "redo",
1312
+ "fullscreen",
1313
+ ],
1314
+ align: "right",
1043
1315
  },
1044
- 'moreMisc': {
1045
- 'buttons': ['selectAll', 'clearFormatting', 'html', 'undo', 'redo', 'fullscreen'],
1046
- 'align': 'right',
1047
- }
1048
1316
  },
1049
1317
  /*
1050
1318
  Upload:
1051
1319
  https://www.froala.com/wysiwyg-editor/docs/concepts/image/upload
1052
1320
  */
1053
- imageUploadURL: '/api/HtmlEditor/UploadImage',
1054
- imageAllowedTypes: ['jpeg', 'jpg', 'png'],
1055
- imageUploadParams: { uploadType: '', uploadParentId: '' }
1321
+ imageUploadURL: "/api/HtmlEditor/UploadImage",
1322
+ imageAllowedTypes: ["jpeg", "jpg", "png"],
1323
+ imageUploadParams: { uploadType: "", uploadParentId: "" },
1056
1324
  };
1057
1325
 
1058
1326
  /*
1059
1327
  <file>
1328
+ Project:
1329
+ @osovitny/anatoly
1330
+
1060
1331
  Authors:
1061
- Anatoly Osovitny
1062
1332
  Vadim Osovitny
1333
+ Anatoly Osovitny
1063
1334
 
1064
1335
  Created:
1065
1336
  12 Dec 2017
@@ -1076,7 +1347,7 @@ class BaseHtmlEditorComponent extends BaseEditComponent {
1076
1347
  this.froalaEditorInitialized = false;
1077
1348
  this.afterInitializedActions = [];
1078
1349
  //Inputs
1079
- this.editorLabelText = 'Html';
1350
+ this.editorLabelText = "Html";
1080
1351
  this.editorOptions = {};
1081
1352
  }
1082
1353
  ngOnInit() {
@@ -1120,7 +1391,9 @@ class BaseHtmlEditorComponent extends BaseEditComponent {
1120
1391
  doAfterInitialized(action) {
1121
1392
  let that = this;
1122
1393
  if (!this.froalaEditorInitialized) {
1123
- this.afterInitializedActions.push(() => { action(that); });
1394
+ this.afterInitializedActions.push(() => {
1395
+ action(that);
1396
+ });
1124
1397
  }
1125
1398
  else {
1126
1399
  action(that);
@@ -1133,7 +1406,7 @@ class BaseHtmlEditorComponent extends BaseEditComponent {
1133
1406
  setUploadParams(uploadType, uploadParentId) {
1134
1407
  this.doAfterInitialized(function (that) {
1135
1408
  var editor = that.getEditor();
1136
- if (typeof (editor) == "undefined" || editor == null) {
1409
+ if (typeof editor == "undefined" || editor == null) {
1137
1410
  return;
1138
1411
  }
1139
1412
  editor.opts.imageUploadParams.uploadType = uploadType;
@@ -1148,9 +1421,12 @@ BaseHtmlEditorComponent.propDecorators = {
1148
1421
 
1149
1422
  /*
1150
1423
  <file>
1424
+ Project:
1425
+ @osovitny/anatoly
1426
+
1151
1427
  Authors:
1152
- Anatoly Osovitny
1153
1428
  Vadim Osovitny
1429
+ Anatoly Osovitny
1154
1430
 
1155
1431
  Created:
1156
1432
  12 Dec 2017
@@ -1168,7 +1444,7 @@ class HtmlEditorComponent extends BaseHtmlEditorComponent {
1168
1444
  setHtml(content) {
1169
1445
  this.doAfterInitialized(function (that) {
1170
1446
  var editor = that.getEditor();
1171
- if (typeof (editor) == "undefined" || editor == null) {
1447
+ if (typeof editor == "undefined" || editor == null) {
1172
1448
  return;
1173
1449
  }
1174
1450
  editor.html.set(content);
@@ -1176,7 +1452,7 @@ class HtmlEditorComponent extends BaseHtmlEditorComponent {
1176
1452
  }
1177
1453
  getHtml() {
1178
1454
  var editor = this.getEditor();
1179
- if (typeof (editor) == "undefined" || editor == null) {
1455
+ if (typeof editor == "undefined" || editor == null) {
1180
1456
  return;
1181
1457
  }
1182
1458
  return editor.html.get(false);
@@ -1184,7 +1460,7 @@ class HtmlEditorComponent extends BaseHtmlEditorComponent {
1184
1460
  }
1185
1461
  HtmlEditorComponent.decorators = [
1186
1462
  { type: Component, args: [{
1187
- selector: 'anatoly-html-editor',
1463
+ selector: "anatoly-html-editor",
1188
1464
  template: "<div>\r\n <label>{{ editorLabelText }}</label>\r\n <textarea [froalaEditor]=\"options\" (froalaInit)=\"initializeControl($event)\">\r\n </textarea>\r\n</div>"
1189
1465
  },] }
1190
1466
  ];
@@ -1192,9 +1468,12 @@ HtmlEditorComponent.ctorParameters = () => [];
1192
1468
 
1193
1469
  /*
1194
1470
  <file>
1471
+ Project:
1472
+ @osovitny/anatoly
1473
+
1195
1474
  Authors:
1196
- Anatoly Osovitny
1197
1475
  Vadim Osovitny
1476
+ Anatoly Osovitny
1198
1477
 
1199
1478
  Created:
1200
1479
  12 Dec 2017
@@ -1208,7 +1487,7 @@ HtmlEditorComponent.ctorParameters = () => [];
1208
1487
  class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
1209
1488
  constructor() {
1210
1489
  super();
1211
- this.editorFormKey = 'html';
1490
+ this.editorFormKey = "html";
1212
1491
  }
1213
1492
  setFormValueAfterInitialized(name, value) {
1214
1493
  this.doAfterInitialized(function (that) {
@@ -1218,7 +1497,7 @@ class FormsHtmlEditorComponent extends BaseHtmlEditorComponent {
1218
1497
  }
1219
1498
  FormsHtmlEditorComponent.decorators = [
1220
1499
  { type: Component, args: [{
1221
- selector: 'anatoly-forms-html-editor',
1500
+ selector: "anatoly-forms-html-editor",
1222
1501
  template: "<div [formGroup]=\"formGroup\">\r\n <div class=\"form-group\" [ngClass]=\"{'has-error': isItemInvalid(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"
1223
1502
  },] }
1224
1503
  ];
@@ -1229,11 +1508,15 @@ FormsHtmlEditorComponent.propDecorators = {
1229
1508
 
1230
1509
  /*
1231
1510
  <file>
1511
+ Project:
1512
+ @osovitny/anatoly
1513
+
1232
1514
  Authors:
1515
+ Vadim Osovitny
1233
1516
  Anatoly Osovitny
1234
1517
 
1235
1518
  Created:
1236
- 23 Apr 2018
1519
+ 8 Dec 2017
1237
1520
 
1238
1521
  Version:
1239
1522
  1.0
@@ -1241,30 +1524,135 @@ FormsHtmlEditorComponent.propDecorators = {
1241
1524
  Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1242
1525
  </file>
1243
1526
  */
1244
- class ContentHeaderComponent {
1245
- ngOnInit() {
1246
- if (this.title == null) {
1247
- this.title = '';
1527
+ class ValidationSummaryComponent extends BaseEditComponent {
1528
+ constructor() {
1529
+ super();
1530
+ }
1531
+ getFormValidationMessages() {
1532
+ let messages = [];
1533
+ Object.keys(this.formGroup.controls).forEach((k) => {
1534
+ var control = this.formGroup.controls[k];
1535
+ if (control.controls != null) {
1536
+ Object.keys(control.controls).forEach((k) => {
1537
+ var child = control.controls[k];
1538
+ this.getValidationMessages(child, k).forEach((m) => messages.push(m));
1539
+ });
1540
+ }
1541
+ else {
1542
+ this.getValidationMessages(control, k).forEach((m) => messages.push(m));
1543
+ }
1544
+ });
1545
+ return messages;
1546
+ }
1547
+ getValidationMessages(state, thingName) {
1548
+ let thing = state.path || thingName;
1549
+ let messages = [];
1550
+ if (state.errors) {
1551
+ for (let errorName in state.errors) {
1552
+ if (state.errors.hasOwnProperty(errorName)) {
1553
+ switch (errorName) {
1554
+ case "required":
1555
+ messages.push(`${thing} is required`);
1556
+ break;
1557
+ case "minlength":
1558
+ messages.push(`${thing} must be at least ${state.errors["minlength"].requiredLength} characters`);
1559
+ break;
1560
+ case "pattern":
1561
+ messages.push(`${thing} contains illegal characters`);
1562
+ break;
1563
+ }
1564
+ }
1565
+ }
1248
1566
  }
1567
+ return messages;
1568
+ }
1569
+ }
1570
+
1571
+ /*
1572
+ <file>
1573
+ Project:
1574
+ @osovitny/anatoly
1575
+
1576
+ Authors:
1577
+ Vadim Osovitny
1578
+ Anatoly Osovitny
1579
+
1580
+ Created:
1581
+ 7 Dec 2017
1582
+
1583
+ Version:
1584
+ 1.0
1585
+
1586
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1587
+ </file>
1588
+ */
1589
+ class FormValidationSummaryComponent extends ValidationSummaryComponent {
1590
+ constructor() {
1591
+ super();
1592
+ this.isVisible = false;
1593
+ }
1594
+ getErrors() {
1595
+ const messages = this.getFormValidationMessages();
1596
+ return messages;
1249
1597
  }
1250
1598
  }
1251
- ContentHeaderComponent.decorators = [
1599
+ FormValidationSummaryComponent.decorators = [
1252
1600
  { type: Component, args: [{
1253
- selector: 'anatoly-content-header',
1254
- template: "<h2 class=\"page-header\">\r\n {{title}}\r\n <!--<small>Optional {{title}}</small>-->\r\n</h2>\r\n"
1601
+ selector: "anatoly-form-validation-summary",
1602
+ template: "<div class=\"callout callout-danger\" *ngIf=\"isVisible\">\r\n <h4 class=\"box-title\">There are problems with the form</h4>\r\n <p *ngFor=\"let error of getErrors()\">\r\n <span class=\"help-block\" style=\"color: white;\">{{ error }}</span>\r\n </p>\r\n</div>\r\n"
1255
1603
  },] }
1256
1604
  ];
1257
- ContentHeaderComponent.propDecorators = {
1258
- title: [{ type: Input }]
1605
+ FormValidationSummaryComponent.ctorParameters = () => [];
1606
+ FormValidationSummaryComponent.propDecorators = {
1607
+ isVisible: [{ type: Input }]
1259
1608
  };
1260
1609
 
1261
1610
  /*
1262
1611
  <file>
1612
+ Project:
1613
+ @osovitny/anatoly
1614
+
1263
1615
  Authors:
1264
1616
  Vadim Osovitny
1617
+ Anatoly Osovitny
1265
1618
 
1266
1619
  Created:
1267
- 10 Nov 2017
1620
+ 6 Dec 2017
1621
+
1622
+ Version:
1623
+ 1.0
1624
+
1625
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1626
+ </file>
1627
+ */
1628
+ class ItemValidationSummaryComponent extends ValidationSummaryComponent {
1629
+ constructor() {
1630
+ super();
1631
+ }
1632
+ }
1633
+ ItemValidationSummaryComponent.decorators = [
1634
+ { type: Component, args: [{
1635
+ selector: "anatoly-item-validation-summary",
1636
+ template: "<ul class=\"list-unstyled\" *ngIf=\"isItemInvalid(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"
1637
+ },] }
1638
+ ];
1639
+ ItemValidationSummaryComponent.ctorParameters = () => [];
1640
+ ItemValidationSummaryComponent.propDecorators = {
1641
+ controlName: [{ type: Input }],
1642
+ controlTitle: [{ type: Input }]
1643
+ };
1644
+
1645
+ /*
1646
+ <file>
1647
+ Project:
1648
+ @osovitny/anatoly
1649
+
1650
+ Authors:
1651
+ Vadim Osovitny
1652
+ Anatoly Osovitny
1653
+
1654
+ Created:
1655
+ 26 Jun 2020
1268
1656
 
1269
1657
  Version:
1270
1658
  1.0
@@ -1296,7 +1684,7 @@ AnatolyUIModule.decorators = [
1296
1684
  ItemValidationSummaryComponent,
1297
1685
  HtmlEditorComponent,
1298
1686
  FormsHtmlEditorComponent,
1299
- ContentHeaderComponent,
1687
+ ContentHeaderComponent
1300
1688
  ],
1301
1689
  exports: [
1302
1690
  SubscribePlanButtonComponent,
@@ -1309,12 +1697,29 @@ AnatolyUIModule.decorators = [
1309
1697
  ItemValidationSummaryComponent,
1310
1698
  HtmlEditorComponent,
1311
1699
  FormsHtmlEditorComponent,
1312
- ContentHeaderComponent,
1313
- ]
1700
+ ContentHeaderComponent
1701
+ ],
1314
1702
  },] }
1315
1703
  ];
1316
1704
 
1317
- // Module
1705
+ /*
1706
+ <file>
1707
+ Project:
1708
+ @osovitny/anatoly
1709
+
1710
+ Authors:
1711
+ Vadim Osovitny
1712
+ Anatoly Osovitny
1713
+
1714
+ Created:
1715
+ 26 Jun 2020
1716
+
1717
+ Version:
1718
+ 1.0
1719
+
1720
+ Copyright (c) 2016-2020 Osovitny Inc. All rights reserved.
1721
+ </file>
1722
+ */
1318
1723
 
1319
1724
  /*
1320
1725
  * Public API Surface of anatoly
@@ -1324,5 +1729,5 @@ AnatolyUIModule.decorators = [
1324
1729
  * Generated bundle index. Do not edit.
1325
1730
  */
1326
1731
 
1327
- export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyUIModule, AppContextService, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, FormValidationSummaryComponent, FormsHtmlEditorComponent, HtmlEditorComponent, ItemValidationSummaryComponent, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent };
1732
+ export { Alerts, AnatolyCoreModule, AnatolyDataModule, AnatolyUIModule, AppContextService, BaseApiService, BaseComponent, BaseEditComponent, BaseGoService, BaseGridEditService, BaseGridReadService, BillingApiService, BuyAccessButtonComponent, ContentHeaderComponent, FormValidationSummaryComponent, FormsHtmlEditorComponent, GlobalErrorHandler, Guid, HtmlEditorComponent, ItemValidationSummaryComponent, LoggingService, SignInButtonComponent, SignOutButtonComponent, SignUpButtonComponent, Subs, SubscribePlanButtonComponent, UpgradePlanButtonComponent, Utils, ValidationSummaryComponent };
1328
1733
  //# sourceMappingURL=osovitny-anatoly.js.map