@rosoftlab/core 1.0.5-alpha-1 → 1.0.21-alpha-1

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,18 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, InjectionToken, inject, Input, Component, Inject, Pipe, NgModule } from '@angular/core';
2
+ import { Injectable, InjectionToken, inject, Input, Component, Inject, NgModule } from '@angular/core';
3
3
  import * as i1 from 'oidc-client-ts';
4
4
  import { UserManager } from 'oidc-client-ts';
5
- import { BehaviorSubject, Observable, throwError, of, ReplaySubject } from 'rxjs';
5
+ import { BehaviorSubject, Observable, throwError, ReplaySubject } from 'rxjs';
6
6
  import * as i5 from '@angular/common';
7
7
  import { DatePipe, DecimalPipe, PercentPipe, CommonModule } from '@angular/common';
8
8
  import * as i1$2 from '@angular/forms';
9
- import { UntypedFormGroup, UntypedFormControl, Validators, ReactiveFormsModule } from '@angular/forms';
9
+ import { UntypedFormGroup, UntypedFormControl, ReactiveFormsModule, Validators } from '@angular/forms';
10
10
  import * as i2 from '@angular/router';
11
11
  import { NavigationEnd } from '@angular/router';
12
- import * as i1$3 from '@ngx-translate/core';
12
+ import * as i4 from '@ngx-translate/core';
13
13
  import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
14
14
  import * as i1$1 from '@angular/common/http';
15
- import { HttpHeaders, HttpParams, HttpResponse, HttpClient, HttpClientModule } from '@angular/common/http';
15
+ import { HttpHeaders, HttpParams, HttpClient } from '@angular/common/http';
16
16
  import { compare } from 'fast-json-patch';
17
17
  import queryString from 'query-string';
18
18
  import { map, catchError, tap, filter } from 'rxjs/operators';
@@ -122,11 +122,11 @@ function provideAuth(settings) {
122
122
 
123
123
  class FieldErrorDisplayComponent {
124
124
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FieldErrorDisplayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
125
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: FieldErrorDisplayComponent, isStandalone: false, selector: "rsl-field-error-display", inputs: { errorMsg: "errorMsg", displayError: "displayError" }, ngImport: i0, template: "@if (displayError) {\n <div >\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}\n", styles: [".error-msg{color:red}.fix-error-icon{top:27px}\n"] }); }
125
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: FieldErrorDisplayComponent, isStandalone: false, selector: "rsl-field-error-display", inputs: { errorMsg: "errorMsg", displayError: "displayError" }, ngImport: i0, template: "@if (displayError) {\r\n <div >\r\n <!-- <span class=\"glyphicon glyphicon-remove form-control-feedback fix-error-icon\"></span> -->\r\n <span class=\"sr-only\">(error)</span>\r\n <div class=\"error-msg\">\r\n {{ errorMsg }}\r\n </div>\r\n </div>\r\n}\r\n", styles: [".error-msg{color:red}.fix-error-icon{top:27px}\n"] }); }
126
126
  }
127
127
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: FieldErrorDisplayComponent, decorators: [{
128
128
  type: Component,
129
- args: [{ selector: 'rsl-field-error-display', standalone: false, template: "@if (displayError) {\n <div >\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}\n", styles: [".error-msg{color:red}.fix-error-icon{top:27px}\n"] }]
129
+ args: [{ selector: 'rsl-field-error-display', standalone: false, template: "@if (displayError) {\r\n <div >\r\n <!-- <span class=\"glyphicon glyphicon-remove form-control-feedback fix-error-icon\"></span> -->\r\n <span class=\"sr-only\">(error)</span>\r\n <div class=\"error-msg\">\r\n {{ errorMsg }}\r\n </div>\r\n </div>\r\n}\r\n", styles: [".error-msg{color:red}.fix-error-icon{top:27px}\n"] }]
130
130
  }], propDecorators: { errorMsg: [{
131
131
  type: Input
132
132
  }], displayError: [{
@@ -226,8 +226,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
226
226
  class BaseDatastore {
227
227
  // tslint:enable:max-line-length
228
228
  get getDirtyAttributes() {
229
- if (this.datastoreConfig.overrides
230
- && this.datastoreConfig.overrides.getDirtyAttributes) {
229
+ if (this.datastoreConfig.overrides && this.datastoreConfig.overrides.getDirtyAttributes) {
231
230
  return this.datastoreConfig.overrides.getDirtyAttributes;
232
231
  }
233
232
  else {
@@ -235,8 +234,7 @@ class BaseDatastore {
235
234
  }
236
235
  }
237
236
  get getAllAttributes() {
238
- if (this.datastoreConfig.overrides
239
- && this.datastoreConfig.overrides.getAllAttributes) {
237
+ if (this.datastoreConfig.overrides && this.datastoreConfig.overrides.getAllAttributes) {
240
238
  return this.datastoreConfig.overrides.getAllAttributes;
241
239
  }
242
240
  else {
@@ -275,16 +273,15 @@ class BaseDatastore {
275
273
  this._store = {};
276
274
  // tslint:enable:max-line-length
277
275
  // tslint:disable-next-line:ban-types
278
- this.toQueryString = this.datastoreConfig.overrides
279
- && this.datastoreConfig.overrides.toQueryString ?
280
- this.datastoreConfig.overrides.toQueryString : this._toQueryString;
276
+ this.toQueryString = this.datastoreConfig.overrides && this.datastoreConfig.overrides.toQueryString
277
+ ? this.datastoreConfig.overrides.toQueryString
278
+ : this._toQueryString;
281
279
  }
282
280
  findAll(modelType, params, headers, customUrl) {
283
281
  const customHeadhers = this.buildHeaders(headers);
284
282
  const htmlParams = this.buildParams(modelType, params);
285
283
  const url = this.buildUrl(modelType, customUrl);
286
- const response = this.httpClient.get(url, { headers: customHeadhers, params: htmlParams, withCredentials: true })
287
- .pipe(map(res => this.extractQueryData(res, modelType)), catchError(this.handleError));
284
+ const response = this.httpClient.get(url, { headers: customHeadhers, params: htmlParams, withCredentials: true }).pipe(map((res) => this.extractQueryData(res, modelType)), catchError(this.handleError));
288
285
  return response;
289
286
  }
290
287
  findRecord(modelType, id, params, headers, customUrl) {
@@ -294,8 +291,7 @@ class BaseDatastore {
294
291
  url += '/' + id;
295
292
  }
296
293
  const htmlParams = this.buildParams(modelType, params);
297
- const response = this.httpClient.get(url, { headers: customHeadhers, params: htmlParams, withCredentials: true })
298
- .pipe(map(res => this.entityToModel(res, modelType, undefined)), catchError(this.handleError));
294
+ const response = this.httpClient.get(url, { headers: customHeadhers, params: htmlParams, withCredentials: true }).pipe(map((res) => this.entityToModel(res, modelType, undefined)), catchError(this.handleError));
299
295
  return response;
300
296
  }
301
297
  getCustom(modelType, params, headers, customUrl, customResponseType) {
@@ -304,7 +300,12 @@ class BaseDatastore {
304
300
  const htmlParams = this.buildParams(modelType, params);
305
301
  if (!customResponseType)
306
302
  customResponseType = 'json';
307
- return this.httpClient.get(url, { headers: customHeadhers, params: htmlParams, withCredentials: true, responseType: customResponseType });
303
+ return this.httpClient.get(url, {
304
+ headers: customHeadhers,
305
+ params: htmlParams,
306
+ withCredentials: true,
307
+ responseType: customResponseType
308
+ });
308
309
  }
309
310
  postCustom(modelType, body, params, headers, customUrl) {
310
311
  const customHeadhers = this.buildHeaders(headers);
@@ -336,8 +337,7 @@ class BaseDatastore {
336
337
  else {
337
338
  httpCall = this.httpClient.post(url, body, { headers: customHeadhers, params: htmlParams, withCredentials: true });
338
339
  }
339
- return httpCall
340
- .pipe(map(res => {
340
+ return httpCall.pipe(map((res) => {
341
341
  this.cacheService.clearCacheContainingKeyword(url);
342
342
  const data = this.resetMetadataAttributes(res, attributesMetadata, modelType);
343
343
  return this.entityToModel(data, modelType);
@@ -358,8 +358,7 @@ class BaseDatastore {
358
358
  const patch = compare(origData, newData);
359
359
  if (patch.length > 0) {
360
360
  httpCall = this.httpClient.patch(url + '/' + model.id, patch, { headers: customHeadhers, params: htmlParams, withCredentials: true });
361
- return httpCall
362
- .pipe(map(res => {
361
+ return httpCall.pipe(map((res) => {
363
362
  this.cacheService.clearCacheContainingKeyword(url);
364
363
  const data = this.resetMetadataAttributes(res, attributesMetadata, modelType);
365
364
  return this.entityToModel(data, modelType);
@@ -390,8 +389,7 @@ class BaseDatastore {
390
389
  else {
391
390
  httpCall = this.httpClient.post(url, body, { headers: customHeadhers, params: htmlParams, withCredentials: true });
392
391
  }
393
- return httpCall
394
- .pipe(map(res => {
392
+ return httpCall.pipe(map((res) => {
395
393
  this.cacheService.clearCacheContainingKeyword(url);
396
394
  const data = this.resetMetadataAttributes(res, attributesMetadata, modelType);
397
395
  return this.entityToModel(data, modelType);
@@ -404,8 +402,7 @@ class BaseDatastore {
404
402
  url = url + '/' + id;
405
403
  }
406
404
  // const idParam = new HttpParams().set('id', id);
407
- return this.httpClient.delete(url, { headers: customHeadhers, withCredentials: true })
408
- .pipe(map(res => {
405
+ return this.httpClient.delete(url, { headers: customHeadhers, withCredentials: true }).pipe(map((res) => {
409
406
  this.cacheService.clearCacheContainingKeyword(url);
410
407
  return res;
411
408
  }), catchError(this.handleError));
@@ -495,7 +492,7 @@ class BaseDatastore {
495
492
  };
496
493
  if (customHeaders && customHeaders.keys().length) {
497
494
  // tslint:disable-next-line:variable-name
498
- Object.assign({}, headers, customHeaders.keys().map(header_name => {
495
+ Object.assign({}, headers, customHeaders.keys().map((header_name) => {
499
496
  headers['' + header_name] = customHeaders.get(header_name);
500
497
  }));
501
498
  }
@@ -505,13 +502,11 @@ class BaseDatastore {
505
502
  let httpParams = new HttpParams();
506
503
  if (params) {
507
504
  Object.keys(params)
508
- .filter(key => {
505
+ .filter((key) => {
509
506
  const v = params[key];
510
- return (Array.isArray(v) || typeof v === 'string') ?
511
- (v.length > 0) :
512
- (v !== null && v !== undefined);
507
+ return Array.isArray(v) || typeof v === 'string' ? v.length > 0 : v !== null && v !== undefined;
513
508
  })
514
- .forEach(key => {
509
+ .forEach((key) => {
515
510
  httpParams = httpParams.set(key, params[key]);
516
511
  });
517
512
  }
@@ -862,7 +857,7 @@ class BaseFormEditComponent {
862
857
  }
863
858
  return rvalue;
864
859
  }
865
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFormEditComponent, deps: [{ token: i1$2.UntypedFormBuilder }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: BaseService }, { token: DialogSERVICE }, { token: i1$3.TranslateService }, { token: i5.Location }], target: i0.ɵɵFactoryTarget.Component }); }
860
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFormEditComponent, deps: [{ token: i1$2.UntypedFormBuilder }, { token: i2.Router }, { token: i2.ActivatedRoute }, { token: BaseService }, { token: DialogSERVICE }, { token: i4.TranslateService }, { token: i5.Location }], target: i0.ɵɵFactoryTarget.Component }); }
866
861
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.6", type: BaseFormEditComponent, isStandalone: false, selector: "app-base.form.edit", ngImport: i0, template: '', isInline: true }); }
867
862
  }
868
863
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: BaseFormEditComponent, decorators: [{
@@ -875,15 +870,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
875
870
  }], ctorParameters: () => [{ type: i1$2.UntypedFormBuilder }, { type: i2.Router }, { type: i2.ActivatedRoute }, { type: BaseService }, { type: undefined, decorators: [{
876
871
  type: Inject,
877
872
  args: [DialogSERVICE]
878
- }] }, { type: i1$3.TranslateService }, { type: i5.Location }] });
879
-
880
- class Configurations {
881
- constructor() {
882
- this.baseUrl = '';
883
- this.authUrl = '';
884
- this.apiVersion = 'api/v1';
885
- }
886
- }
873
+ }] }, { type: i4.TranslateService }, { type: i5.Location }] });
887
874
 
888
875
  var GridLayoutFormat;
889
876
  (function (GridLayoutFormat) {
@@ -1012,6 +999,138 @@ function BaseDatastoreConfig(config = {}) {
1012
999
  };
1013
1000
  }
1014
1001
 
1002
+ class Configurations {
1003
+ constructor() {
1004
+ this.baseUrl = '';
1005
+ this.authUrl = '';
1006
+ this.apiVersion = 'api/v1';
1007
+ }
1008
+ }
1009
+
1010
+ let DatastoreCore = class DatastoreCore extends BaseDatastore {
1011
+ constructor(http, cacheService, configExt) {
1012
+ super(http, cacheService);
1013
+ this.configExt = configExt;
1014
+ this.customConfig = {
1015
+ apiVersion: this.configExt.apiVersion,
1016
+ baseUrl: this.configExt.baseUrl
1017
+ };
1018
+ this.config = this.customConfig;
1019
+ }
1020
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DatastoreCore, deps: [{ token: i1$1.HttpClient }, { token: CacheService }, { token: Configurations }], target: i0.ɵɵFactoryTarget.Injectable }); }
1021
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DatastoreCore }); }
1022
+ };
1023
+ DatastoreCore = __decorate([
1024
+ BaseDatastoreConfig({ apiVersion: '', baseUrl: '' }),
1025
+ __metadata("design:paramtypes", [HttpClient, CacheService, Configurations])
1026
+ ], DatastoreCore);
1027
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DatastoreCore, decorators: [{
1028
+ type: Injectable
1029
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: CacheService }, { type: Configurations }] });
1030
+
1031
+ class TranslateloaderService {
1032
+ constructor(httpClient, config) {
1033
+ this.httpClient = httpClient;
1034
+ this._apiUrl = '';
1035
+ this.headers = new HttpHeaders({
1036
+ Accept: 'application/json',
1037
+ 'Content-Type': 'application/json'
1038
+ });
1039
+ console.log(config);
1040
+ if (config) {
1041
+ this._apiUrl = config.baseUrl;
1042
+ }
1043
+ }
1044
+ getTranslation(lang) {
1045
+ const url = this._apiUrl + '/api/v1/language/' + lang + '/translationlist';
1046
+ return this.httpClient.get(url, { headers: this.headers });
1047
+ }
1048
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TranslateloaderService, deps: [{ token: i1$1.HttpClient }, { token: Configurations }], target: i0.ɵɵFactoryTarget.Injectable }); }
1049
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TranslateloaderService, providedIn: 'root' }); }
1050
+ }
1051
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TranslateloaderService, decorators: [{
1052
+ type: Injectable,
1053
+ args: [{
1054
+ providedIn: 'root'
1055
+ }]
1056
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: Configurations }] });
1057
+
1058
+ const PROVIDERS = [
1059
+ BaseDatastore,
1060
+ DatastoreCore,
1061
+ DatePipe,
1062
+ DecimalPipe,
1063
+ PercentPipe
1064
+ ];
1065
+ class RslBaseModule {
1066
+ static forRoot(config) {
1067
+ return {
1068
+ ngModule: RslBaseModule,
1069
+ providers: [PROVIDERS, { provide: Configurations, useValue: config }]
1070
+ };
1071
+ }
1072
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1073
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, imports: [CommonModule, i4.TranslateModule, ReactiveFormsModule], exports: [TranslateModule] }); }
1074
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, providers: [PROVIDERS], imports: [CommonModule,
1075
+ TranslateModule.forRoot({
1076
+ loader: {
1077
+ provide: TranslateLoader,
1078
+ useClass: TranslateloaderService,
1079
+ deps: [HttpClient]
1080
+ },
1081
+ // missingTranslationHandler: { provide: MissingTranslationHandler, useClass: MyMissingTranslationHandler },
1082
+ useDefaultLang: false
1083
+ }),
1084
+ ReactiveFormsModule, TranslateModule] }); }
1085
+ }
1086
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, decorators: [{
1087
+ type: NgModule,
1088
+ args: [{
1089
+ imports: [
1090
+ CommonModule,
1091
+ TranslateModule.forRoot({
1092
+ loader: {
1093
+ provide: TranslateLoader,
1094
+ useClass: TranslateloaderService,
1095
+ deps: [HttpClient]
1096
+ },
1097
+ // missingTranslationHandler: { provide: MissingTranslationHandler, useClass: MyMissingTranslationHandler },
1098
+ useDefaultLang: false
1099
+ }),
1100
+ ReactiveFormsModule
1101
+ ],
1102
+ providers: [PROVIDERS],
1103
+ exports: [TranslateModule]
1104
+ }]
1105
+ }] });
1106
+
1107
+ function readFileAsync(file) {
1108
+ return new Promise((resolve, reject) => {
1109
+ const reader = new FileReader();
1110
+ reader.onload = (event) => {
1111
+ resolve(event.target.result);
1112
+ };
1113
+ reader.onerror = (event) => {
1114
+ reject(event.target.error);
1115
+ };
1116
+ reader.readAsArrayBuffer(file);
1117
+ });
1118
+ }
1119
+ function getValueFromJsonData(jsonData, key) {
1120
+ // Convert the key and all JSON keys to lowercase
1121
+ const lowercaseKey = key.toLowerCase();
1122
+ const lowercaseKeys = Object.keys(jsonData).map(k => k.toLowerCase());
1123
+ // Find the lowercase key in the lowercase keys array
1124
+ const index = lowercaseKeys.indexOf(lowercaseKey);
1125
+ // If found, use the original (proper case) key to access the value
1126
+ if (index !== -1) {
1127
+ const originalKey = Object.keys(jsonData)[index];
1128
+ return jsonData[originalKey];
1129
+ }
1130
+ // Key not found
1131
+ return undefined;
1132
+ }
1133
+
1015
1134
  class BaseMetaModel {
1016
1135
  constructor(response) {
1017
1136
  this.links = response.links || [];
@@ -1028,62 +1147,6 @@ function BaseModelConfig(config = {}) {
1028
1147
  };
1029
1148
  }
1030
1149
 
1031
- function CustomType(config = {}) {
1032
- return (target, propertyName) => {
1033
- const annotations = MetadataStorage.getMetadata('CustomType', target) || [];
1034
- annotations.push({
1035
- propertyName,
1036
- relationship: config.key || propertyName
1037
- });
1038
- MetadataStorage.setMetadata('CustomType', annotations, target);
1039
- };
1040
- }
1041
-
1042
- class CacheInterceptor {
1043
- constructor(expirationTime, cacheService) {
1044
- this.expirationTime = expirationTime;
1045
- this.cacheService = cacheService;
1046
- this.cache = new Map();
1047
- }
1048
- intercept(request, next) {
1049
- const bypassCache = request.params.get('bypassCache') || false;
1050
- if (bypassCache || request.method !== 'GET') {
1051
- return next.handle(request);
1052
- }
1053
- if (!bypassCache) {
1054
- const cachedResponse = this.cacheService.get(request.urlWithParams);
1055
- if (cachedResponse) {
1056
- return of(cachedResponse.clone());
1057
- //return cachedResponse;
1058
- }
1059
- }
1060
- return next.handle(request).pipe(tap((event) => {
1061
- if (event instanceof HttpResponse) {
1062
- this.cacheService.set(request.urlWithParams, event.clone(), this.expirationTime);
1063
- }
1064
- }));
1065
- // const cachedItem = this.cache.get(request.url);
1066
- // if (cachedItem && cachedItem.expiration > Date.now()) {
1067
- // return of(cachedItem.response.clone());
1068
- // }
1069
- // return next.handle(request).pipe(
1070
- // tap(event => {
1071
- // if (event instanceof HttpResponse) {
1072
- // this.cache.set(request.url, { response: event.clone(), expiration: Date.now() + this.expirationTime });
1073
- // }
1074
- // })
1075
- // );
1076
- }
1077
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CacheInterceptor, deps: [{ token: 'CACHE_EXPIRATION_TIME' }, { token: CacheService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1078
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CacheInterceptor }); }
1079
- }
1080
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: CacheInterceptor, decorators: [{
1081
- type: Injectable
1082
- }], ctorParameters: () => [{ type: undefined, decorators: [{
1083
- type: Inject,
1084
- args: ['CACHE_EXPIRATION_TIME']
1085
- }] }, { type: CacheService }] });
1086
-
1087
1150
  class BaseModel {
1088
1151
  // tslint:disable-next-line:variable-name
1089
1152
  constructor(_datastore, data) {
@@ -1183,7 +1246,7 @@ class BaseModel {
1183
1246
  const controlsConfig = {};
1184
1247
  const that = this;
1185
1248
  if (props) {
1186
- props.forEach(property => {
1249
+ props.forEach((property) => {
1187
1250
  const value = that[property] !== undefined ? that[property] : defaultValues[property];
1188
1251
  const formSubGroup = formSubGroupsValues[property] ?? null;
1189
1252
  if (requiredProps[property]) {
@@ -1216,7 +1279,7 @@ class BaseModel {
1216
1279
  }
1217
1280
  const that = this;
1218
1281
  if (props) {
1219
- props.forEach(property => {
1282
+ props.forEach((property) => {
1220
1283
  const formSubGroup = formSubGroupsValues[property] ?? null;
1221
1284
  if (!formSubGroup)
1222
1285
  data[property] = formGroup.controls[property].value ?? null;
@@ -1240,97 +1303,6 @@ class BaseModel {
1240
1303
  }
1241
1304
  }
1242
1305
 
1243
- class ErrorResponse {
1244
- constructor(errors) {
1245
- this.errors = [];
1246
- if (errors) {
1247
- this.errors = errors;
1248
- }
1249
- }
1250
- }
1251
-
1252
- class Rule {
1253
- constructor() {
1254
- this.parameters = [];
1255
- }
1256
- }
1257
-
1258
- class InputErrorPipe {
1259
- constructor(translate) {
1260
- this.translate = translate;
1261
- }
1262
- transform(value, filedTranslationKey) {
1263
- let rvalue = '';
1264
- if (value !== null) {
1265
- if (value['invalid'] === true) {
1266
- rvalue = 'ERROR.INVALID';
1267
- }
1268
- if (value['mustMatch'] === true) {
1269
- rvalue = 'Account.Password.MustMach';
1270
- }
1271
- if (value['required'] === true) {
1272
- const field = this.translate.instant(filedTranslationKey.field);
1273
- rvalue = this.translate.instant('General.Field.Required', { field });
1274
- }
1275
- if (value['minlength']) {
1276
- const field = this.translate.instant(filedTranslationKey.field);
1277
- rvalue = this.translate.instant('General.Field.MinLength', { field, requiredLength: value.minlength.requiredLength });
1278
- }
1279
- }
1280
- return rvalue;
1281
- }
1282
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: InputErrorPipe, deps: [{ token: i1$3.TranslateService }], target: i0.ɵɵFactoryTarget.Pipe }); }
1283
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: InputErrorPipe, isStandalone: false, name: "inputError" }); }
1284
- }
1285
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: InputErrorPipe, decorators: [{
1286
- type: Pipe,
1287
- args: [{
1288
- name: 'inputError',
1289
- standalone: false
1290
- }]
1291
- }], ctorParameters: () => [{ type: i1$3.TranslateService }] });
1292
-
1293
- class Nl2brPipe {
1294
- transform(value, args) {
1295
- // return value.replace(/\n/g, '<br />');
1296
- if (value) {
1297
- value = value.replace(/(?:\r\n\r\n|\r\r|\n\n)/g, '</p><p>');
1298
- return '<p>' + value.replace(/(?:\r\n|\r|\n)/g, '<br>') + '</p>';
1299
- }
1300
- return value;
1301
- }
1302
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Nl2brPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
1303
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: Nl2brPipe, isStandalone: false, name: "nl2br" }); }
1304
- }
1305
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: Nl2brPipe, decorators: [{
1306
- type: Pipe,
1307
- args: [{
1308
- name: 'nl2br',
1309
- standalone: false
1310
- }]
1311
- }] });
1312
-
1313
- let DatastoreCore = class DatastoreCore extends BaseDatastore {
1314
- constructor(http, cacheService, configExt) {
1315
- super(http, cacheService);
1316
- this.configExt = configExt;
1317
- this.customConfig = {
1318
- apiVersion: this.configExt.apiVersion,
1319
- baseUrl: this.configExt.baseUrl
1320
- };
1321
- this.config = this.customConfig;
1322
- }
1323
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DatastoreCore, deps: [{ token: i1$1.HttpClient }, { token: CacheService }, { token: Configurations }], target: i0.ɵɵFactoryTarget.Injectable }); }
1324
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DatastoreCore }); }
1325
- };
1326
- DatastoreCore = __decorate([
1327
- BaseDatastoreConfig({ apiVersion: '', baseUrl: '' }),
1328
- __metadata("design:paramtypes", [HttpClient, CacheService, Configurations])
1329
- ], DatastoreCore);
1330
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: DatastoreCore, decorators: [{
1331
- type: Injectable
1332
- }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: CacheService }, { type: Configurations }] });
1333
-
1334
1306
  let Employee = class Employee extends BaseModel {
1335
1307
  };
1336
1308
  __decorate([
@@ -1501,6 +1473,12 @@ Role = __decorate([
1501
1473
  })
1502
1474
  ], Role);
1503
1475
 
1476
+ class Rule {
1477
+ constructor() {
1478
+ this.parameters = [];
1479
+ }
1480
+ }
1481
+
1504
1482
  let User = class User extends BaseModel {
1505
1483
  get fullName() {
1506
1484
  return this.firstName + ' ' + this.lastName;
@@ -1618,33 +1596,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
1618
1596
  }]
1619
1597
  }], ctorParameters: () => [{ type: i2.Router }] });
1620
1598
 
1621
- class TranslateloaderService {
1622
- constructor(httpClient, config) {
1623
- this.httpClient = httpClient;
1624
- this._apiUrl = '';
1625
- this.headers = new HttpHeaders({
1626
- Accept: 'application/json',
1627
- 'Content-Type': 'application/json'
1628
- });
1629
- console.log(config);
1630
- if (config) {
1631
- this._apiUrl = config.baseUrl;
1632
- }
1633
- }
1634
- getTranslation(lang) {
1635
- const url = this._apiUrl + '/api/v1/language/' + lang + '/translationlist';
1636
- return this.httpClient.get(url, { headers: this.headers });
1637
- }
1638
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TranslateloaderService, deps: [{ token: i1$1.HttpClient }, { token: Configurations }], target: i0.ɵɵFactoryTarget.Injectable }); }
1639
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TranslateloaderService, providedIn: 'root' }); }
1640
- }
1641
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: TranslateloaderService, decorators: [{
1642
- type: Injectable,
1643
- args: [{
1644
- providedIn: 'root'
1645
- }]
1646
- }], ctorParameters: () => [{ type: i1$1.HttpClient }, { type: Configurations }] });
1647
-
1648
1599
  class UserService extends BaseService {
1649
1600
  constructor(datastore) {
1650
1601
  super(datastore);
@@ -1656,7 +1607,7 @@ class UserService extends BaseService {
1656
1607
  }
1657
1608
  hasRightForLink(link) {
1658
1609
  if (this.userRights && link) {
1659
- const right = this.userRights.find(f => link.indexOf(f.pagePath) >= 0);
1610
+ const right = this.userRights.find((f) => link.indexOf(f.pagePath) >= 0);
1660
1611
  return true;
1661
1612
  }
1662
1613
  return false;
@@ -1675,154 +1626,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
1675
1626
  }]
1676
1627
  }], ctorParameters: () => [{ type: DatastoreCore }] });
1677
1628
 
1678
- const PROVIDERS = [
1679
- BaseDatastore,
1680
- DatastoreCore,
1681
- DatePipe,
1682
- DecimalPipe,
1683
- PercentPipe
1684
- ];
1685
-
1686
- function DynamicallyModelResolver(modelsImport, className = undefined) {
1687
- return (route, state) => {
1688
- if (className == undefined)
1689
- className = route.paramMap.get('className');
1690
- const instance = getInstance$1(className, modelsImport);
1691
- if (!instance) {
1692
- throw new Error(`Invalid className: ${className}`);
1693
- }
1694
- return instance;
1695
- };
1696
- }
1697
- function getInstance$1(className, modelsImport) {
1698
- return modelsImport.then((module) => module[toProperCase$1(className)]);
1699
- // return modelsImport.then((module) => ({ modelInstance: module[toProperCase(className)] })
1700
- // );
1701
- }
1702
- function toProperCase$1(str) {
1703
- return str.replace(/\w\S*/g, (txt) => {
1704
- return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
1705
- });
1706
- }
1707
-
1708
- function DynamicallyServiceResolver(serviceImport, serviceName) {
1709
- return (route, state) => {
1710
- const instance = getInstance(serviceName, serviceImport);
1711
- if (!instance) {
1712
- throw new Error(`Invalid className: ${serviceName}`);
1713
- }
1714
- return instance;
1715
- };
1716
- }
1717
- function getInstance(serviceName, serviceImport) {
1718
- return serviceImport.then((module) => module[toProperCase(serviceName)]); // return Promise.all([serviceImport]).then(
1719
- // (module) => ({
1720
- // serviceInstance: module[toProperCase(serviceName)],
1721
- // })
1722
- // );
1723
- }
1724
- function toProperCase(str) {
1725
- return str.replace(/\w\S*/g, (txt) => {
1726
- return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase();
1727
- });
1728
- }
1729
-
1730
- class RslBaseModule {
1731
- static forRoot(config) {
1732
- return {
1733
- ngModule: RslBaseModule,
1734
- providers: [
1735
- PROVIDERS,
1736
- { provide: Configurations, useValue: config }
1737
- ]
1738
- };
1739
- }
1740
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1741
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, imports: [CommonModule, i1$3.TranslateModule, ReactiveFormsModule], exports: [HttpClientModule,
1742
- TranslateModule] }); }
1743
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, providers: [
1744
- PROVIDERS
1745
- ], imports: [CommonModule,
1746
- TranslateModule.forRoot({
1747
- loader: {
1748
- provide: TranslateLoader,
1749
- useClass: TranslateloaderService,
1750
- deps: [HttpClient]
1751
- },
1752
- // missingTranslationHandler: { provide: MissingTranslationHandler, useClass: MyMissingTranslationHandler },
1753
- useDefaultLang: false,
1754
- }),
1755
- ReactiveFormsModule, HttpClientModule,
1756
- TranslateModule] }); }
1757
- }
1758
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: RslBaseModule, decorators: [{
1759
- type: NgModule,
1760
- args: [{
1761
- imports: [
1762
- CommonModule,
1763
- TranslateModule.forRoot({
1764
- loader: {
1765
- provide: TranslateLoader,
1766
- useClass: TranslateloaderService,
1767
- deps: [HttpClient]
1768
- },
1769
- // missingTranslationHandler: { provide: MissingTranslationHandler, useClass: MyMissingTranslationHandler },
1770
- useDefaultLang: false,
1771
- }),
1772
- ReactiveFormsModule
1773
- ],
1774
- providers: [
1775
- PROVIDERS
1776
- ],
1777
- exports: [
1778
- HttpClientModule,
1779
- TranslateModule,
1780
- ]
1781
- }]
1782
- }] });
1783
-
1784
- class CustomValidators {
1785
- static patternValidator(regex, error) {
1786
- return (control) => {
1787
- if (!control.value) {
1788
- // if control is empty return no error
1789
- return null;
1790
- }
1791
- // test the value of the control against the regexp supplied
1792
- const valid = regex.test(control.value);
1793
- // if true, return no error (no error), else return error passed in the second parameter
1794
- return valid ? null : error;
1795
- };
1796
- }
1797
- }
1798
-
1799
- function readFileAsync(file) {
1800
- return new Promise((resolve, reject) => {
1801
- const reader = new FileReader();
1802
- reader.onload = (event) => {
1803
- resolve(event.target.result);
1804
- };
1805
- reader.onerror = (event) => {
1806
- reject(event.target.error);
1807
- };
1808
- reader.readAsArrayBuffer(file);
1809
- });
1810
- }
1811
- function getValueFromJsonData(jsonData, key) {
1812
- // Convert the key and all JSON keys to lowercase
1813
- const lowercaseKey = key.toLowerCase();
1814
- const lowercaseKeys = Object.keys(jsonData).map(k => k.toLowerCase());
1815
- // Find the lowercase key in the lowercase keys array
1816
- const index = lowercaseKeys.indexOf(lowercaseKey);
1817
- // If found, use the original (proper case) key to access the value
1818
- if (index !== -1) {
1819
- const originalKey = Object.keys(jsonData)[index];
1820
- return jsonData[originalKey];
1821
- }
1822
- // Key not found
1823
- return undefined;
1824
- }
1825
-
1826
1629
  /*
1827
1630
  * Public API Surface of core
1828
1631
  */
@@ -1831,5 +1634,5 @@ function getValueFromJsonData(jsonData, key) {
1831
1634
  * Generated bundle index. Do not edit.
1832
1635
  */
1833
1636
 
1834
- export { Attribute, AuthService, BaseDatastore, BaseDatastoreConfig, BaseFormEditComponent, BaseMetaModel, BaseModel, BaseModelConfig, BaseQueryData, BaseService, CacheInterceptor, CacheService, CellTextAlign, Configurations, CustomType, CustomValidators, DatastoreCore, DynamicallyModelResolver, DynamicallyServiceResolver, Employee, EmployeeService, ErrorResponse, FieldErrorDisplayComponent, GridLayoutFormat, InputErrorPipe, LocalFileService, Menu, MetadataStorage, Nl2brPipe, OIDC_CLIENT_SETTINGS, PROVIDERS, PageNotFoundComponent, Right, Role, RoleService, RouteHistoryService, RslBaseModule, Rule, Tokens, TranslateloaderService, UnderConstructionComponent, User, UserService, getValueFromJsonData, provideAuth, provideOidcUserManager, readFileAsync };
1637
+ export { Attribute, AuthService, BaseDatastore, BaseDatastoreConfig, BaseFormEditComponent, BaseModel, BaseModelConfig, BaseQueryData, BaseService, CacheService, CellTextAlign, Configurations, DatastoreCore, Employee, EmployeeService, FieldErrorDisplayComponent, GridLayoutFormat, LocalFileService, Menu, MetadataStorage, OIDC_CLIENT_SETTINGS, PROVIDERS, PageNotFoundComponent, Right, Role, RoleService, RouteHistoryService, RslBaseModule, Rule, Tokens, TranslateloaderService, UnderConstructionComponent, User, UserService, getValueFromJsonData, provideAuth, provideOidcUserManager, readFileAsync };
1835
1638
  //# sourceMappingURL=rosoftlab-core.mjs.map