@rosoftlab/core 1.0.0-alpha-4 → 1.0.0-alpha-6

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.
@@ -1,28 +1,27 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Input, Injectable, Directive, ContentChildren, Inject, Pipe, Optional, NgModule } from '@angular/core';
3
- import * as i6 from '@angular/common';
2
+ import { Component, Input, Injectable, InjectionToken, Inject, Pipe, Optional, NgModule } from '@angular/core';
3
+ import * as i5 from '@angular/common';
4
4
  import { DatePipe, DecimalPipe, PercentPipe, CommonModule } from '@angular/common';
5
5
  import * as i1$1 from '@angular/forms';
6
6
  import { UntypedFormGroup, UntypedFormControl, Validators, ReactiveFormsModule } from '@angular/forms';
7
7
  import * as i2 from '@angular/router';
8
8
  import * as i1$2 from '@ngx-translate/core';
9
9
  import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
10
- import { Observable, throwError, from, merge, BehaviorSubject, combineLatest, of } from 'rxjs';
10
+ import { Observable, throwError, of } from 'rxjs';
11
11
  import * as i1 from '@angular/common/http';
12
- import { HttpHeaders, HttpParams, HttpErrorResponse, HttpResponse, HttpClient, HttpClientModule } from '@angular/common/http';
12
+ import { HttpHeaders, HttpParams, HttpResponse, HttpClient, HttpClientModule } from '@angular/common/http';
13
13
  import { compare } from 'fast-json-patch';
14
14
  import * as qs from 'qs';
15
- import { map, catchError, switchMap, tap } from 'rxjs/operators';
16
- import Swal from 'sweetalert2';
15
+ import { map, catchError, tap } from 'rxjs/operators';
17
16
  import 'reflect-metadata';
18
17
  import { parseISO } from 'date-fns';
19
18
  import { __decorate, __metadata } from 'tslib';
20
19
 
21
20
  class FieldErrorDisplayComponent {
22
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FieldErrorDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
23
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: FieldErrorDisplayComponent, selector: "rsl-field-error-display", inputs: { errorMsg: "errorMsg", displayError: "displayError" }, ngImport: i0, template: "<div *ngIf=\"displayError\" >\n <!-- <span class=\"glyphicon glyphicon-remove form-control-feedback fix-error-icon\"></span> -->\n <span class=\"sr-only\">(error)</span>\n <div class=\"error-msg\">\n {{ errorMsg }}\n </div>\n</div>\n", styles: [".error-msg{color:red}.fix-error-icon{top:27px}\n"] }); }
21
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: FieldErrorDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
22
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.10", type: FieldErrorDisplayComponent, selector: "rsl-field-error-display", inputs: { errorMsg: "errorMsg", displayError: "displayError" }, ngImport: i0, template: "<div *ngIf=\"displayError\" >\n <!-- <span class=\"glyphicon glyphicon-remove form-control-feedback fix-error-icon\"></span> -->\n <span class=\"sr-only\">(error)</span>\n <div class=\"error-msg\">\n {{ errorMsg }}\n </div>\n</div>\n", styles: [".error-msg{color:red}.fix-error-icon{top:27px}\n"] }); }
24
23
  }
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: FieldErrorDisplayComponent, decorators: [{
24
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: FieldErrorDisplayComponent, decorators: [{
26
25
  type: Component,
27
26
  args: [{ selector: 'rsl-field-error-display', template: "<div *ngIf=\"displayError\" >\n <!-- <span class=\"glyphicon glyphicon-remove form-control-feedback fix-error-icon\"></span> -->\n <span class=\"sr-only\">(error)</span>\n <div class=\"error-msg\">\n {{ errorMsg }}\n </div>\n</div>\n", styles: [".error-msg{color:red}.fix-error-icon{top:27px}\n"] }]
28
27
  }], propDecorators: { errorMsg: [{
@@ -36,20 +35,20 @@ class PageNotFoundComponent {
36
35
  }
37
36
  ngOnInit() {
38
37
  }
39
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: PageNotFoundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
40
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: PageNotFoundComponent, selector: "rsl-page-not-found", ngImport: i0, template: "<div class=\"forms-view-container\">\n <div class=\"under-construction-view-container\">\n Page not found\n </div>\n</div>", styles: [".under-construction-view-container{height:calc(100vh - 250px);margin:60px 0 0;padding:0;display:flex;justify-content:center;align-items:center;box-sizing:border-box;font-size:1.8em;line-height:1.3em;font-weight:300;color:#58585b;text-align:center}\n"] }); }
38
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: PageNotFoundComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
39
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.10", type: PageNotFoundComponent, selector: "rsl-page-not-found", ngImport: i0, template: "<div class=\"forms-view-container\">\n <div class=\"under-construction-view-container\">\n Page not found\n </div>\n</div>", styles: [".under-construction-view-container{height:calc(100vh - 250px);margin:60px 0 0;padding:0;display:flex;justify-content:center;align-items:center;box-sizing:border-box;font-size:1.8em;line-height:1.3em;font-weight:300;color:#58585b;text-align:center}\n"] }); }
41
40
  }
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: PageNotFoundComponent, decorators: [{
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: PageNotFoundComponent, decorators: [{
43
42
  type: Component,
44
43
  args: [{ selector: 'rsl-page-not-found', template: "<div class=\"forms-view-container\">\n <div class=\"under-construction-view-container\">\n Page not found\n </div>\n</div>", styles: [".under-construction-view-container{height:calc(100vh - 250px);margin:60px 0 0;padding:0;display:flex;justify-content:center;align-items:center;box-sizing:border-box;font-size:1.8em;line-height:1.3em;font-weight:300;color:#58585b;text-align:center}\n"] }]
45
44
  }], ctorParameters: function () { return []; } });
46
45
 
47
46
  class UnderConstructionComponent {
48
47
  constructor() { }
49
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: UnderConstructionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
50
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: UnderConstructionComponent, selector: "rsl-under-construction", ngImport: i0, template: "<div class=\"forms-view-container\">\n <div class=\"under-construction-view-container\">\n Page under construction\n </div>\n</div>", styles: [".under-construction-view-container{height:calc(100vh - 250px);margin:60px 0 0;padding:0;display:flex;justify-content:center;align-items:center;box-sizing:border-box;font-size:1.8em;line-height:1.3em;font-weight:300;color:#58585b;text-align:center}\n"] }); }
48
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: UnderConstructionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
49
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.10", type: UnderConstructionComponent, selector: "rsl-under-construction", ngImport: i0, template: "<div class=\"forms-view-container\">\n <div class=\"under-construction-view-container\">\n Page under construction\n </div>\n</div>", styles: [".under-construction-view-container{height:calc(100vh - 250px);margin:60px 0 0;padding:0;display:flex;justify-content:center;align-items:center;box-sizing:border-box;font-size:1.8em;line-height:1.3em;font-weight:300;color:#58585b;text-align:center}\n"] }); }
51
50
  }
52
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: UnderConstructionComponent, decorators: [{
51
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: UnderConstructionComponent, decorators: [{
53
52
  type: Component,
54
53
  args: [{ selector: 'rsl-under-construction', template: "<div class=\"forms-view-container\">\n <div class=\"under-construction-view-container\">\n Page under construction\n </div>\n</div>", styles: [".under-construction-view-container{height:calc(100vh - 250px);margin:60px 0 0;padding:0;display:flex;justify-content:center;align-items:center;box-sizing:border-box;font-size:1.8em;line-height:1.3em;font-weight:300;color:#58585b;text-align:center}\n"] }]
55
54
  }], ctorParameters: function () { return []; } });
@@ -90,10 +89,10 @@ class CacheService {
90
89
  const keysToDelete = Object.keys(this.cache).filter(key => key.includes(keyword));
91
90
  keysToDelete.forEach(key => this.delete(key));
92
91
  }
93
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CacheService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
94
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CacheService, providedIn: 'root' }); }
92
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: CacheService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
93
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: CacheService, providedIn: 'root' }); }
95
94
  }
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CacheService, decorators: [{
95
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: CacheService, decorators: [{
97
96
  type: Injectable,
98
97
  args: [{
99
98
  providedIn: 'root'
@@ -424,10 +423,10 @@ class BaseDatastore {
424
423
  _toQueryString(params) {
425
424
  return qs.stringify(params, { arrayFormat: 'brackets' });
426
425
  }
427
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseDatastore, deps: [{ token: i1.HttpClient }, { token: CacheService }], target: i0.ɵɵFactoryTarget.Injectable }); }
428
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseDatastore }); }
426
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseDatastore, deps: [{ token: i1.HttpClient }, { token: CacheService }], target: i0.ɵɵFactoryTarget.Injectable }); }
427
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseDatastore }); }
429
428
  }
430
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseDatastore, decorators: [{
429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseDatastore, decorators: [{
431
430
  type: Injectable
432
431
  }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: CacheService }]; } });
433
432
 
@@ -515,161 +514,17 @@ class BaseService {
515
514
  getSelectValues(property) {
516
515
  return null;
517
516
  }
518
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseService, deps: [{ token: BaseDatastore }], target: i0.ɵɵFactoryTarget.Injectable }); }
519
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseService, providedIn: 'root' }); }
517
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseService, deps: [{ token: BaseDatastore }], target: i0.ɵɵFactoryTarget.Injectable }); }
518
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseService, providedIn: 'root' }); }
520
519
  }
521
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseService, decorators: [{
520
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseService, decorators: [{
522
521
  type: Injectable,
523
522
  args: [{
524
523
  providedIn: 'root'
525
524
  }]
526
525
  }], ctorParameters: function () { return [{ type: BaseDatastore }]; } });
527
526
 
528
- /**
529
- * Async modal dialog service
530
- * DialogService makes this app easier to test by faking this service.
531
- * TODO: better modal implementation that doesn't use window.confirm
532
- */
533
- class DialogService {
534
- /**
535
- * Ask user to confirm an action. `message` explains the action and choices.
536
- * Returns observable resolving to `true`=confirm or `false`=cancel
537
- */
538
- constructor() { }
539
- confirm(message, text, confirmButtonText = 'Delete', cancelButtonText = 'Cancel') {
540
- const confirmation = Swal.fire({
541
- title: message || 'Are you sure?',
542
- icon: 'warning',
543
- text: text || '',
544
- showCancelButton: true,
545
- confirmButtonText: confirmButtonText,
546
- cancelButtonText: cancelButtonText,
547
- customClass: {
548
- confirmButton: 'btn btn-red btn-fill btn-wd',
549
- cancelButton: 'btn btn-grey btn-fill btn-wd',
550
- },
551
- buttonsStyling: false,
552
- reverseButtons: true
553
- })
554
- .then((result) => {
555
- if (result.value) {
556
- return true;
557
- }
558
- else {
559
- return false;
560
- }
561
- }).catch();
562
- return from(confirmation);
563
- }
564
- showSaveMessage(message, title) {
565
- const confirmation = Swal.fire({
566
- icon: 'success',
567
- title: message,
568
- timer: 2000,
569
- showConfirmButton: false,
570
- // customClass: 'overflow-hidden',
571
- buttonsStyling: false
572
- }).then(() => {
573
- return true;
574
- }, () => {
575
- return false;
576
- }).catch();
577
- return from(confirmation);
578
- }
579
- showRegisteredMessage(message, title) {
580
- const confirmation = Swal.fire({
581
- icon: 'success',
582
- title: message,
583
- showConfirmButton: true,
584
- customClass: {
585
- confirmButton: 'btn btn-success',
586
- },
587
- buttonsStyling: false
588
- }).then(() => {
589
- return true;
590
- }, () => {
591
- return false;
592
- }).catch();
593
- return from(confirmation);
594
- }
595
- // notification(message?: string, type?: NotificationType, fromPosition?: NotificationFrom, align?: NotificationAlign, timer?: number) {
596
- // if (!type) {
597
- // type = NotificationType.success;
598
- // }
599
- // if (!fromPosition) {
600
- // fromPosition = NotificationFrom.bottom;
601
- // }
602
- // if (!align) {
603
- // align = NotificationAlign.center;
604
- // }
605
- // if (!timer) {
606
- // timer = 3000;
607
- // }
608
- // $.notify({
609
- // icon: 'notifications',
610
- // message: message
611
- // }, {
612
- // type: type,
613
- // timer: 3000,
614
- // placement: {
615
- // from: from,
616
- // align: align
617
- // }
618
- // });
619
- // }
620
- showErrorMessage(e, message) {
621
- if (!message) {
622
- message = 'Validation errors';
623
- }
624
- if (e instanceof HttpErrorResponse) {
625
- // Validation errors
626
- if (e.status === 400) {
627
- const errors = e.error.errors;
628
- if (errors) {
629
- errors.forEach(error => {
630
- message += error.field + ' ' + error.detail + '\n';
631
- });
632
- // message = errors.detail;
633
- // if (detail.relationships) {
634
- // detail.relationships.forEach(relation => {
635
- // console.log(relation);
636
- // });
637
- // }
638
- }
639
- }
640
- }
641
- const confirmation = Swal.fire({
642
- icon: 'error',
643
- title: message,
644
- // timer: 2000,
645
- showConfirmButton: true,
646
- customClass: {
647
- confirmButton: 'btn btn-success',
648
- },
649
- buttonsStyling: false
650
- }).then(() => {
651
- return true;
652
- }, () => {
653
- return false;
654
- }).catch();
655
- return from(confirmation);
656
- }
657
- getTextTranslation(translationKey) {
658
- // // const result = await promise;
659
- // // return result;
660
- // const result = this.translate.instant(translationKey);
661
- // if (result === translationKey) {
662
- return translationKey;
663
- // }
664
- // return result;
665
- }
666
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
667
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DialogService }); }
668
- }
669
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DialogService, decorators: [{
670
- type: Injectable
671
- }], ctorParameters: function () { return []; } });
672
-
527
+ const DialogSERVICE = new InjectionToken('DialogService');
673
528
  class BaseFormEditComponent {
674
529
  constructor(fb, router, route, modelService, dialogService, translate, location) {
675
530
  this.fb = fb;
@@ -883,16 +738,19 @@ class BaseFormEditComponent {
883
738
  }
884
739
  return rvalue;
885
740
  }
886
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseFormEditComponent, deps: [{ token: i1$1.UntypedFormBuilder }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: BaseService }, { token: DialogService }, { token: i1$2.TranslateService }, { token: i6.Location }], target: i0.ɵɵFactoryTarget.Component }); }
887
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.1", type: BaseFormEditComponent, selector: "app-base.form.edit", ngImport: i0, template: '', isInline: true }); }
741
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseFormEditComponent, deps: [{ token: i1$1.UntypedFormBuilder }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: BaseService }, { token: DialogSERVICE }, { token: i1$2.TranslateService }, { token: i5.Location }], target: i0.ɵɵFactoryTarget.Component }); }
742
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.10", type: BaseFormEditComponent, selector: "app-base.form.edit", ngImport: i0, template: '', isInline: true }); }
888
743
  }
889
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: BaseFormEditComponent, decorators: [{
744
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: BaseFormEditComponent, decorators: [{
890
745
  type: Component,
891
746
  args: [{
892
747
  selector: 'app-base.form.edit',
893
748
  template: ''
894
749
  }]
895
- }], ctorParameters: function () { return [{ type: i1$1.UntypedFormBuilder }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: BaseService }, { type: DialogService }, { type: i1$2.TranslateService }, { type: i6.Location }]; } });
750
+ }], ctorParameters: function () { return [{ type: i1$1.UntypedFormBuilder }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: BaseService }, { type: undefined, decorators: [{
751
+ type: Inject,
752
+ args: [DialogSERVICE]
753
+ }] }, { type: i1$2.TranslateService }, { type: i5.Location }]; } });
896
754
 
897
755
  var GridLayoutFormat;
898
756
  (function (GridLayoutFormat) {
@@ -1048,114 +906,6 @@ function CustomType(config = {}) {
1048
906
  };
1049
907
  }
1050
908
 
1051
- class TranslatedElementDirective {
1052
- constructor(viewRef, templateRef) {
1053
- this.viewRef = viewRef;
1054
- this.templateRef = templateRef;
1055
- }
1056
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TranslatedElementDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1057
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: TranslatedElementDirective, selector: "[translatedElement]", inputs: { elementKey: ["translatedElement", "elementKey"] }, ngImport: i0 }); }
1058
- }
1059
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TranslatedElementDirective, decorators: [{
1060
- type: Directive,
1061
- args: [{
1062
- selector: '[translatedElement]',
1063
- }]
1064
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.TemplateRef }]; }, propDecorators: { elementKey: [{
1065
- type: Input,
1066
- args: ['translatedElement']
1067
- }] } });
1068
-
1069
- const TOKEN_START_DEMARC = '{{';
1070
- const TOKEN_END_DEMARC = '}}';
1071
- // adapted from @kasperlauge's solution in https://github.com/ngx-translate/core/issues/223
1072
- class TranslatedContentDirective {
1073
- constructor(viewRef, renderer, translateService, changeDetectorRef) {
1074
- this.viewRef = viewRef;
1075
- this.renderer = renderer;
1076
- this.translateService = translateService;
1077
- this.changeDetectorRef = changeDetectorRef;
1078
- this.subs = [];
1079
- }
1080
- ngOnInit() {
1081
- this.rawTranslation = merge(this.translateService.get(this.translationKey), this.translateService.onLangChange.asObservable().pipe(switchMap(() => this.translateService.get(this.translationKey))));
1082
- }
1083
- ngAfterContentInit() {
1084
- // QueryList.changes doesn't re-emit after its initial value, which we have by now
1085
- // BehaviorSubjects re-emit their initial value on subscription, so we get what we need by merging
1086
- // the BehaviorSubject and the QueryList.changes observable
1087
- const elementsSubject = new BehaviorSubject(this.elements.toArray());
1088
- const elementsChanges = merge(elementsSubject, this.elements.changes);
1089
- this.translationData = combineLatest(this.rawTranslation, elementsChanges)
1090
- .pipe(map(([rawTranslation]) => {
1091
- return {
1092
- elements: this.elements.toArray(),
1093
- rawTranslation,
1094
- };
1095
- }));
1096
- this.subs.push(this.translationData.subscribe(this.render.bind(this)));
1097
- }
1098
- render(translationData) {
1099
- if (!translationData.rawTranslation || translationData.rawTranslation === this.translationKey) {
1100
- throw new Error(`No resource matching the key '${this.translationKey}'`);
1101
- }
1102
- while (this.viewRef.element.nativeElement.firstChild) {
1103
- this.renderer.removeChild(this.viewRef.element.nativeElement, this.viewRef.element.nativeElement.firstChild);
1104
- }
1105
- let lastTokenEnd = 0;
1106
- while (lastTokenEnd < translationData.rawTranslation.length) {
1107
- const tokenStartDemarc = translationData.rawTranslation.indexOf(TOKEN_START_DEMARC, lastTokenEnd);
1108
- if (tokenStartDemarc < 0) {
1109
- break;
1110
- }
1111
- const tokenStart = tokenStartDemarc + TOKEN_START_DEMARC.length;
1112
- const tokenEnd = translationData.rawTranslation.indexOf(TOKEN_END_DEMARC, tokenStart);
1113
- if (tokenEnd < 0) {
1114
- throw new Error(`Encountered unterminated token in translation string '${this.translationKey}'`);
1115
- }
1116
- const tokenEndDemarc = tokenEnd + TOKEN_END_DEMARC.length;
1117
- const precedingText = translationData.rawTranslation.substring(lastTokenEnd, tokenStartDemarc);
1118
- const precedingTextElement = this.renderer.createText(precedingText);
1119
- this.renderer.appendChild(this.viewRef.element.nativeElement, precedingTextElement);
1120
- const elementKey = translationData.rawTranslation.substring(tokenStart, tokenEnd);
1121
- const embeddedElementTemplate = translationData.elements.find(element => element.elementKey === elementKey);
1122
- if (embeddedElementTemplate) {
1123
- const embeddedElementView = embeddedElementTemplate.viewRef.createEmbeddedView(embeddedElementTemplate.templateRef);
1124
- this.renderer.appendChild(this.viewRef.element.nativeElement, embeddedElementView.rootNodes[0]);
1125
- }
1126
- else {
1127
- const missingTokenText = translationData.rawTranslation.substring(tokenStartDemarc, tokenEndDemarc);
1128
- const missingTokenElement = this.renderer.createText(missingTokenText);
1129
- this.renderer.appendChild(this.viewRef.element.nativeElement, missingTokenElement);
1130
- }
1131
- lastTokenEnd = tokenEndDemarc;
1132
- }
1133
- const trailingText = translationData.rawTranslation.substring(lastTokenEnd);
1134
- const trailingTextElement = this.renderer.createText(trailingText);
1135
- this.renderer.appendChild(this.viewRef.element.nativeElement, trailingTextElement);
1136
- // in case the rendering happens outside of a change detection event, this ensures that any translations in the
1137
- // embedded elements are rendered
1138
- this.changeDetectorRef.detectChanges();
1139
- }
1140
- ngOnDestroy() {
1141
- this.subs.forEach(sub => sub.unsubscribe());
1142
- }
1143
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TranslatedContentDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.Renderer2 }, { token: i1$2.TranslateService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive }); }
1144
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.1", type: TranslatedContentDirective, selector: "[appTranslatedContent]", inputs: { translationKey: ["appTranslatedContent", "translationKey"] }, queries: [{ propertyName: "elements", predicate: TranslatedElementDirective }], ngImport: i0 }); }
1145
- }
1146
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TranslatedContentDirective, decorators: [{
1147
- type: Directive,
1148
- args: [{
1149
- selector: '[appTranslatedContent]',
1150
- }]
1151
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.Renderer2 }, { type: i1$2.TranslateService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { translationKey: [{
1152
- type: Input,
1153
- args: ['appTranslatedContent']
1154
- }], elements: [{
1155
- type: ContentChildren,
1156
- args: [TranslatedElementDirective]
1157
- }] } });
1158
-
1159
909
  class CacheInterceptor {
1160
910
  constructor(expirationTime, cacheService) {
1161
911
  this.expirationTime = expirationTime;
@@ -1191,10 +941,10 @@ class CacheInterceptor {
1191
941
  // })
1192
942
  // );
1193
943
  }
1194
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CacheInterceptor, deps: [{ token: 'CACHE_EXPIRATION_TIME' }, { token: CacheService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1195
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CacheInterceptor }); }
944
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: CacheInterceptor, deps: [{ token: 'CACHE_EXPIRATION_TIME' }, { token: CacheService }], target: i0.ɵɵFactoryTarget.Injectable }); }
945
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: CacheInterceptor }); }
1196
946
  }
1197
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: CacheInterceptor, decorators: [{
947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: CacheInterceptor, decorators: [{
1198
948
  type: Injectable
1199
949
  }], ctorParameters: function () { return [{ type: undefined, decorators: [{
1200
950
  type: Inject,
@@ -1381,10 +1131,10 @@ class Nl2brPipe {
1381
1131
  }
1382
1132
  return value;
1383
1133
  }
1384
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: Nl2brPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1385
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: Nl2brPipe, name: "nl2br" }); }
1134
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: Nl2brPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1135
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.10", ngImport: i0, type: Nl2brPipe, name: "nl2br" }); }
1386
1136
  }
1387
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: Nl2brPipe, decorators: [{
1137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: Nl2brPipe, decorators: [{
1388
1138
  type: Pipe,
1389
1139
  args: [{
1390
1140
  name: 'nl2br'
@@ -1415,10 +1165,10 @@ class InputErrorPipe {
1415
1165
  }
1416
1166
  return rvalue;
1417
1167
  }
1418
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputErrorPipe, deps: [{ token: i1$2.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
1419
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: InputErrorPipe, name: "inputError" }); }
1168
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: InputErrorPipe, deps: [{ token: i1$2.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
1169
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.10", ngImport: i0, type: InputErrorPipe, name: "inputError" }); }
1420
1170
  }
1421
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: InputErrorPipe, decorators: [{
1171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: InputErrorPipe, decorators: [{
1422
1172
  type: Pipe,
1423
1173
  args: [{
1424
1174
  name: 'inputError'
@@ -1443,14 +1193,14 @@ let DatastoreCore = class DatastoreCore extends BaseDatastore {
1443
1193
  };
1444
1194
  this.config = this.customConfig;
1445
1195
  }
1446
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatastoreCore, deps: [{ token: i1.HttpClient }, { token: CacheService }, { token: Configurations }], target: i0.ɵɵFactoryTarget.Injectable }); }
1447
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatastoreCore }); }
1196
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: DatastoreCore, deps: [{ token: i1.HttpClient }, { token: CacheService }, { token: Configurations }], target: i0.ɵɵFactoryTarget.Injectable }); }
1197
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: DatastoreCore }); }
1448
1198
  };
1449
1199
  DatastoreCore = __decorate([
1450
1200
  BaseDatastoreConfig({ apiVersion: '', baseUrl: '' }),
1451
1201
  __metadata("design:paramtypes", [HttpClient, CacheService, Configurations])
1452
1202
  ], DatastoreCore);
1453
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: DatastoreCore, decorators: [{
1203
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: DatastoreCore, decorators: [{
1454
1204
  type: Injectable
1455
1205
  }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: CacheService }, { type: Configurations }]; } });
1456
1206
 
@@ -1459,7 +1209,7 @@ const PROVIDERS = [
1459
1209
  DatastoreCore,
1460
1210
  DatePipe,
1461
1211
  DecimalPipe,
1462
- PercentPipe,
1212
+ PercentPipe
1463
1213
  ];
1464
1214
 
1465
1215
  function DynamicallyModelResolver(modelsImport, className = undefined) {
@@ -1522,10 +1272,10 @@ class TranslateloaderService {
1522
1272
  const url = this._apiUrl + '/api/v1/language/' + lang + '/translationlist';
1523
1273
  return this.httpClient.get(url, { headers: this.headers });
1524
1274
  }
1525
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TranslateloaderService, deps: [{ token: i1.HttpClient }, { token: Configurations, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1526
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TranslateloaderService, providedIn: 'root' }); }
1275
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: TranslateloaderService, deps: [{ token: i1.HttpClient }, { token: Configurations, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1276
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: TranslateloaderService, providedIn: 'root' }); }
1527
1277
  }
1528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: TranslateloaderService, decorators: [{
1278
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: TranslateloaderService, decorators: [{
1529
1279
  type: Injectable,
1530
1280
  args: [{
1531
1281
  providedIn: 'root'
@@ -1544,10 +1294,10 @@ class RslBaseModule {
1544
1294
  ]
1545
1295
  };
1546
1296
  }
1547
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: RslBaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1548
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.1", ngImport: i0, type: RslBaseModule, imports: [CommonModule, i1$2.TranslateModule, ReactiveFormsModule], exports: [HttpClientModule,
1297
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: RslBaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1298
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.10", ngImport: i0, type: RslBaseModule, imports: [CommonModule, i1$2.TranslateModule, ReactiveFormsModule], exports: [HttpClientModule,
1549
1299
  TranslateModule] }); }
1550
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: RslBaseModule, providers: [
1300
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: RslBaseModule, providers: [
1551
1301
  PROVIDERS
1552
1302
  ], imports: [CommonModule,
1553
1303
  TranslateModule.forRoot({
@@ -1562,7 +1312,7 @@ class RslBaseModule {
1562
1312
  ReactiveFormsModule, HttpClientModule,
1563
1313
  TranslateModule] }); }
1564
1314
  }
1565
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.1", ngImport: i0, type: RslBaseModule, decorators: [{
1315
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.10", ngImport: i0, type: RslBaseModule, decorators: [{
1566
1316
  type: NgModule,
1567
1317
  args: [{
1568
1318
  imports: [
@@ -1638,5 +1388,5 @@ function getValueFromJsonData(jsonData, key) {
1638
1388
  * Generated bundle index. Do not edit.
1639
1389
  */
1640
1390
 
1641
- export { Attribute, BaseDatastore, BaseDatastoreConfig, BaseFormEditComponent, BaseMetaModel, BaseModel, BaseModelConfig, BaseQueryData, BaseService, CacheInterceptor, CacheService, CellTextAlign, CustomType, CustomValidators, DatastoreCore, DialogService, DynamicallyModelResolver, DynamicallyServiceResolver, ErrorResponse, FieldErrorDisplayComponent, GridLayoutFormat, InputErrorPipe, Nl2brPipe, PROVIDERS, PageNotFoundComponent, RslBaseModule, Rule, TranslatedContentDirective, TranslatedElementDirective, UnderConstructionComponent, getValueFromJsonData, readFileAsync };
1391
+ export { Attribute, BaseDatastore, BaseDatastoreConfig, BaseFormEditComponent, BaseMetaModel, BaseModel, BaseModelConfig, BaseQueryData, BaseService, CacheInterceptor, CacheService, CellTextAlign, CustomType, CustomValidators, DatastoreCore, DynamicallyModelResolver, DynamicallyServiceResolver, ErrorResponse, FieldErrorDisplayComponent, GridLayoutFormat, InputErrorPipe, Nl2brPipe, PROVIDERS, PageNotFoundComponent, RslBaseModule, Rule, UnderConstructionComponent, getValueFromJsonData, readFileAsync };
1642
1392
  //# sourceMappingURL=rosoftlab-core.mjs.map