@stemy/ngx-utils 11.0.9 → 11.1.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.
@@ -412,6 +412,7 @@ class IConfiguration {
412
412
  const CONFIG_SERVICE = new InjectionToken("config-service");
413
413
  const BASE_CONFIG = new InjectionToken("base-config");
414
414
  const SCRIPT_PARAMS = new InjectionToken("script-params");
415
+ const ROOT_ELEMENT = new InjectionToken("app-root-element");
415
416
  const ERROR_HANDLER = new InjectionToken("error-handler-callback");
416
417
  // --- Valued promise ---
417
418
  class ValuedPromise extends Promise {
@@ -2390,9 +2391,10 @@ class StaticAuthService {
2390
2391
  }
2391
2392
 
2392
2393
  class ConfigService {
2393
- constructor(http, universal, baseConfig = null, scriptParams = null) {
2394
+ constructor(http, universal, rootElement, baseConfig = null, scriptParams = null) {
2394
2395
  this.http = http;
2395
2396
  this.universal = universal;
2397
+ this.rootElement = rootElement;
2396
2398
  for (const key in []) {
2397
2399
  Object.defineProperty(Array.prototype, key, {
2398
2400
  enumerable: false
@@ -2407,13 +2409,15 @@ class ConfigService {
2407
2409
  baseUrl = scriptSrc.substr(0, srcParts[0].lastIndexOf("/") + 1);
2408
2410
  }
2409
2411
  }
2410
- this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl }, baseConfig || {});
2412
+ this.baseConfig = baseConfig || {};
2413
+ this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl }, this.baseConfig);
2411
2414
  this.scriptParameters = scriptParams || {};
2412
2415
  this.loaderFunc = () => {
2413
2416
  this.loader = this.loader || new Promise((resolve, reject) => {
2414
2417
  this.loadJson().then(config => {
2415
2418
  this.loadedConfig = config = Object.assign(this.loadedConfig, config);
2416
2419
  this.prepareConfig(config).then(c => {
2420
+ this.loadedConfig = c;
2417
2421
  c.baseUrl = c.baseUrl || "/";
2418
2422
  resolve(c);
2419
2423
  });
@@ -2443,8 +2447,7 @@ class ConfigService {
2443
2447
  this.http.get(configUrl).toPromise().then(response => {
2444
2448
  resolve(response);
2445
2449
  }, () => {
2446
- console.error(`Config file not found at: ${configUrl}`);
2447
- resolve({});
2450
+ reject(`Config file not found at: ${configUrl}`);
2448
2451
  });
2449
2452
  });
2450
2453
  }
@@ -2477,6 +2480,7 @@ ConfigService.decorators = [
2477
2480
  ConfigService.ctorParameters = () => [
2478
2481
  { type: HttpClient },
2479
2482
  { type: UniversalService },
2483
+ { type: undefined, decorators: [{ type: Inject, args: [ROOT_ELEMENT,] }] },
2480
2484
  { type: IConfiguration, decorators: [{ type: Optional }, { type: Inject, args: [BASE_CONFIG,] }] },
2481
2485
  { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [SCRIPT_PARAMS,] }] }
2482
2486
  ];
@@ -2646,57 +2650,6 @@ IconService.decorators = [
2646
2650
  ];
2647
2651
  IconService.ctorParameters = () => [];
2648
2652
 
2649
- class PromiseService {
2650
- constructor(zone) {
2651
- this.zone = zone;
2652
- this.promiseCount = 0;
2653
- this.promiseChanged = new EventEmitter();
2654
- }
2655
- get count() {
2656
- return this.promiseCount;
2657
- }
2658
- get onChanged() {
2659
- return this.promiseChanged;
2660
- }
2661
- create(executor) {
2662
- return this.add(this.zone.runOutsideAngular(() => new Promise(executor)));
2663
- }
2664
- all(promises) {
2665
- return this.add(this.zone.runOutsideAngular(() => Promise.all(promises)));
2666
- }
2667
- resolve(value) {
2668
- return this.add(this.zone.runOutsideAngular(() => Promise.resolve(value)));
2669
- }
2670
- reject(value) {
2671
- return this.add(this.zone.runOutsideAngular(() => Promise.reject(value)));
2672
- }
2673
- promiseFinished() {
2674
- if (this.promiseCount == 0)
2675
- return;
2676
- this.promiseCount--;
2677
- this.promiseChanged.emit(this.promiseCount);
2678
- }
2679
- add(promise) {
2680
- this.promiseCount++;
2681
- this.promiseChanged.emit(this.promiseCount);
2682
- return new Promise((resolve, reject) => {
2683
- promise.then(v => {
2684
- resolve(v);
2685
- this.promiseFinished();
2686
- }, r => {
2687
- reject(r);
2688
- this.promiseFinished();
2689
- });
2690
- });
2691
- }
2692
- }
2693
- PromiseService.decorators = [
2694
- { type: Injectable }
2695
- ];
2696
- PromiseService.ctorParameters = () => [
2697
- { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] }
2698
- ];
2699
-
2700
2653
  class StaticLanguageService {
2701
2654
  constructor(events, storage, configs, promises, client) {
2702
2655
  this.events = events;
@@ -2839,7 +2792,7 @@ StaticLanguageService.ctorParameters = () => [
2839
2792
  { type: EventsService, decorators: [{ type: Inject, args: [EventsService,] }] },
2840
2793
  { type: StorageService, decorators: [{ type: Inject, args: [StorageService,] }] },
2841
2794
  { type: undefined, decorators: [{ type: Inject, args: [CONFIG_SERVICE,] }] },
2842
- { type: PromiseService, decorators: [{ type: Inject, args: [PromiseService,] }] },
2795
+ { type: undefined, decorators: [{ type: Inject, args: [PROMISE_SERVICE,] }] },
2843
2796
  { type: BaseHttpClient, decorators: [{ type: Inject, args: [BaseHttpClient,] }] }
2844
2797
  ];
2845
2798
 
@@ -3087,6 +3040,57 @@ TranslatedUrlSerializer.ctorParameters = () => [
3087
3040
  { type: undefined, decorators: [{ type: Inject, args: [LANGUAGE_SERVICE,] }] }
3088
3041
  ];
3089
3042
 
3043
+ class PromiseService {
3044
+ constructor(zone) {
3045
+ this.zone = zone;
3046
+ this.promiseCount = 0;
3047
+ this.promiseChanged = new EventEmitter();
3048
+ }
3049
+ get count() {
3050
+ return this.promiseCount;
3051
+ }
3052
+ get onChanged() {
3053
+ return this.promiseChanged;
3054
+ }
3055
+ create(executor) {
3056
+ return this.add(this.zone.runOutsideAngular(() => new Promise(executor)));
3057
+ }
3058
+ all(promises) {
3059
+ return this.add(this.zone.runOutsideAngular(() => Promise.all(promises)));
3060
+ }
3061
+ resolve(value) {
3062
+ return this.add(this.zone.runOutsideAngular(() => Promise.resolve(value)));
3063
+ }
3064
+ reject(value) {
3065
+ return this.add(this.zone.runOutsideAngular(() => Promise.reject(value)));
3066
+ }
3067
+ promiseFinished() {
3068
+ if (this.promiseCount == 0)
3069
+ return;
3070
+ this.promiseCount--;
3071
+ this.promiseChanged.emit(this.promiseCount);
3072
+ }
3073
+ add(promise) {
3074
+ this.promiseCount++;
3075
+ this.promiseChanged.emit(this.promiseCount);
3076
+ return new Promise((resolve, reject) => {
3077
+ promise.then(v => {
3078
+ resolve(v);
3079
+ this.promiseFinished();
3080
+ }, r => {
3081
+ reject(r);
3082
+ this.promiseFinished();
3083
+ });
3084
+ });
3085
+ }
3086
+ }
3087
+ PromiseService.decorators = [
3088
+ { type: Injectable }
3089
+ ];
3090
+ PromiseService.ctorParameters = () => [
3091
+ { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] }
3092
+ ];
3093
+
3090
3094
  function emptyRemove() {
3091
3095
  }
3092
3096
  class ResizeEventPlugin extends ɵangular_packages_platform_browser_platform_browser_g {
@@ -4738,6 +4742,10 @@ class NgxUtilsModule {
4738
4742
  provide: CONFIG_SERVICE,
4739
4743
  useExisting: (!config ? null : config.configService) || ConfigService
4740
4744
  },
4745
+ {
4746
+ provide: ROOT_ELEMENT,
4747
+ useValue: null
4748
+ },
4741
4749
  {
4742
4750
  provide: APP_INITIALIZER,
4743
4751
  useFactory: (!config ? null : config.initializeApp) || loadConfig,
@@ -4773,5 +4781,5 @@ NgxUtilsModule.decorators = [
4773
4781
  * Generated bundle index. Do not edit.
4774
4782
  */
4775
4783
 
4776
- export { API_SERVICE, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PromiseService, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, StateService, StaticAuthService, StaticLanguageService, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector, pipes as ɵa, directives as ɵb, components as ɵc, providers as ɵd, loadConfig as ɵe, StickyClassDirective as ɵf };
4784
+ export { API_SERVICE, AUTH_SERVICE, AclService, AjaxRequestHandler, ApiService, ArrayUtils, AsyncMethodDirective, AuthGuard, BASE_CONFIG, BackgroundDirective, BaseHttpClient, BaseHttpService, CONFIG_SERVICE, CanvasColor, CanvasUtils, ChunkPipe, Circle, ConfigService, ConsoleToasterService, DateUtils, DynamicTableComponent, DynamicTableTemplateDirective, ERROR_HANDLER, EXPRESS_REQUEST, EntriesPipe, ErrorHandlerService, EventsService, ExtraItemPropertiesPipe, FactoryDependencies, FileUtils, FilterPipe, FindPipe, FormatNumberPipe, FormatterService, GenericValue, GetOffsetPipe, GetTypePipe, GlobalTemplateDirective, GlobalTemplatePipe, GlobalTemplateService, GroupByPipe, HttpPromise, ICON_SERVICE, IConfiguration, IconDirective, IconService, Initializer, IsTypePipe, JoinPipe, KeysPipe, LANGUAGE_SERVICE, LanguageService, LoaderUtils, MapPipe, MathUtils, MaxPipe, MinPipe, NgxTemplateOutletDirective, NgxUtilsModule, ObjectUtils, ObservableUtils, OpenApiService, PROMISE_SERVICE, PaginationDirective, PaginationItemContext, PaginationItemDirective, PaginationMenuComponent, Point, PromiseService, ROOT_ELEMENT, Rect, ReducePipe, ReflectUtils, RemapPipe, ReplacePipe, ResizeEventPlugin, ResourceIfContext, ResourceIfDirective, ReversePipe, RoundPipe, SCRIPT_PARAMS, SafeHtmlPipe, ScrollEventPlugin, SetUtils, StateService, StaticAuthService, StaticLanguageService, StickyDirective, StorageMode, StorageService, StringUtils, TOASTER_SERVICE, TimerUtils, TranslatePipe, TranslatedUrlSerializer, UniqueUtils, UniversalService, UnorderedListComponent, UnorderedListItemDirective, UnorderedListTemplateDirective, UnorederedListTemplate, ValuedPromise, ValuesPipe, Vector, pipes as ɵa, directives as ɵb, components as ɵc, providers as ɵd, loadConfig as ɵe, StickyClassDirective as ɵf };
4777
4785
  //# sourceMappingURL=stemy-ngx-utils.js.map