@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.
@@ -780,6 +780,7 @@
780
780
  var CONFIG_SERVICE = new core.InjectionToken("config-service");
781
781
  var BASE_CONFIG = new core.InjectionToken("base-config");
782
782
  var SCRIPT_PARAMS = new core.InjectionToken("script-params");
783
+ var ROOT_ELEMENT = new core.InjectionToken("app-root-element");
783
784
  var ERROR_HANDLER = new core.InjectionToken("error-handler-callback");
784
785
  // --- Valued promise ---
785
786
  var ValuedPromise = /** @class */ (function (_super) {
@@ -3130,12 +3131,13 @@
3130
3131
  }());
3131
3132
 
3132
3133
  var ConfigService = /** @class */ (function () {
3133
- function ConfigService(http, universal, baseConfig, scriptParams) {
3134
+ function ConfigService(http, universal, rootElement, baseConfig, scriptParams) {
3134
3135
  var _this = this;
3135
3136
  if (baseConfig === void 0) { baseConfig = null; }
3136
3137
  if (scriptParams === void 0) { scriptParams = null; }
3137
3138
  this.http = http;
3138
3139
  this.universal = universal;
3140
+ this.rootElement = rootElement;
3139
3141
  for (var key in []) {
3140
3142
  Object.defineProperty(Array.prototype, key, {
3141
3143
  enumerable: false
@@ -3150,13 +3152,15 @@
3150
3152
  baseUrl = scriptSrc.substr(0, srcParts[0].lastIndexOf("/") + 1);
3151
3153
  }
3152
3154
  }
3153
- this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl: baseUrl }, baseConfig || {});
3155
+ this.baseConfig = baseConfig || {};
3156
+ this.loadedConfig = Object.assign(!baseUrl ? {} : { baseUrl: baseUrl }, this.baseConfig);
3154
3157
  this.scriptParameters = scriptParams || {};
3155
3158
  this.loaderFunc = function () {
3156
3159
  _this.loader = _this.loader || new Promise(function (resolve, reject) {
3157
3160
  _this.loadJson().then(function (config) {
3158
3161
  _this.loadedConfig = config = Object.assign(_this.loadedConfig, config);
3159
3162
  _this.prepareConfig(config).then(function (c) {
3163
+ _this.loadedConfig = c;
3160
3164
  c.baseUrl = c.baseUrl || "/";
3161
3165
  resolve(c);
3162
3166
  });
@@ -3199,8 +3203,7 @@
3199
3203
  _this.http.get(configUrl).toPromise().then(function (response) {
3200
3204
  resolve(response);
3201
3205
  }, function () {
3202
- console.error("Config file not found at: " + configUrl);
3203
- resolve({});
3206
+ reject("Config file not found at: " + configUrl);
3204
3207
  });
3205
3208
  });
3206
3209
  };
@@ -3234,6 +3237,7 @@
3234
3237
  ConfigService.ctorParameters = function () { return [
3235
3238
  { type: http.HttpClient },
3236
3239
  { type: UniversalService },
3240
+ { type: undefined, decorators: [{ type: core.Inject, args: [ROOT_ELEMENT,] }] },
3237
3241
  { type: IConfiguration, decorators: [{ type: core.Optional }, { type: core.Inject, args: [BASE_CONFIG,] }] },
3238
3242
  { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [SCRIPT_PARAMS,] }] }
3239
3243
  ]; };
@@ -3430,67 +3434,6 @@
3430
3434
  ];
3431
3435
  IconService.ctorParameters = function () { return []; };
3432
3436
 
3433
- var PromiseService = /** @class */ (function () {
3434
- function PromiseService(zone) {
3435
- this.zone = zone;
3436
- this.promiseCount = 0;
3437
- this.promiseChanged = new core.EventEmitter();
3438
- }
3439
- Object.defineProperty(PromiseService.prototype, "count", {
3440
- get: function () {
3441
- return this.promiseCount;
3442
- },
3443
- enumerable: false,
3444
- configurable: true
3445
- });
3446
- Object.defineProperty(PromiseService.prototype, "onChanged", {
3447
- get: function () {
3448
- return this.promiseChanged;
3449
- },
3450
- enumerable: false,
3451
- configurable: true
3452
- });
3453
- PromiseService.prototype.create = function (executor) {
3454
- return this.add(this.zone.runOutsideAngular(function () { return new Promise(executor); }));
3455
- };
3456
- PromiseService.prototype.all = function (promises) {
3457
- return this.add(this.zone.runOutsideAngular(function () { return Promise.all(promises); }));
3458
- };
3459
- PromiseService.prototype.resolve = function (value) {
3460
- return this.add(this.zone.runOutsideAngular(function () { return Promise.resolve(value); }));
3461
- };
3462
- PromiseService.prototype.reject = function (value) {
3463
- return this.add(this.zone.runOutsideAngular(function () { return Promise.reject(value); }));
3464
- };
3465
- PromiseService.prototype.promiseFinished = function () {
3466
- if (this.promiseCount == 0)
3467
- return;
3468
- this.promiseCount--;
3469
- this.promiseChanged.emit(this.promiseCount);
3470
- };
3471
- PromiseService.prototype.add = function (promise) {
3472
- var _this = this;
3473
- this.promiseCount++;
3474
- this.promiseChanged.emit(this.promiseCount);
3475
- return new Promise(function (resolve, reject) {
3476
- promise.then(function (v) {
3477
- resolve(v);
3478
- _this.promiseFinished();
3479
- }, function (r) {
3480
- reject(r);
3481
- _this.promiseFinished();
3482
- });
3483
- });
3484
- };
3485
- return PromiseService;
3486
- }());
3487
- PromiseService.decorators = [
3488
- { type: core.Injectable }
3489
- ];
3490
- PromiseService.ctorParameters = function () { return [
3491
- { type: core.NgZone, decorators: [{ type: core.Inject, args: [core.NgZone,] }] }
3492
- ]; };
3493
-
3494
3437
  var StaticLanguageService = /** @class */ (function () {
3495
3438
  function StaticLanguageService(events, storage, configs, promises, client) {
3496
3439
  this.events = events;
@@ -3681,7 +3624,7 @@
3681
3624
  { type: EventsService, decorators: [{ type: core.Inject, args: [EventsService,] }] },
3682
3625
  { type: StorageService, decorators: [{ type: core.Inject, args: [StorageService,] }] },
3683
3626
  { type: undefined, decorators: [{ type: core.Inject, args: [CONFIG_SERVICE,] }] },
3684
- { type: PromiseService, decorators: [{ type: core.Inject, args: [PromiseService,] }] },
3627
+ { type: undefined, decorators: [{ type: core.Inject, args: [PROMISE_SERVICE,] }] },
3685
3628
  { type: BaseHttpClient, decorators: [{ type: core.Inject, args: [BaseHttpClient,] }] }
3686
3629
  ]; };
3687
3630
 
@@ -3995,6 +3938,67 @@
3995
3938
  { type: undefined, decorators: [{ type: core.Inject, args: [LANGUAGE_SERVICE,] }] }
3996
3939
  ]; };
3997
3940
 
3941
+ var PromiseService = /** @class */ (function () {
3942
+ function PromiseService(zone) {
3943
+ this.zone = zone;
3944
+ this.promiseCount = 0;
3945
+ this.promiseChanged = new core.EventEmitter();
3946
+ }
3947
+ Object.defineProperty(PromiseService.prototype, "count", {
3948
+ get: function () {
3949
+ return this.promiseCount;
3950
+ },
3951
+ enumerable: false,
3952
+ configurable: true
3953
+ });
3954
+ Object.defineProperty(PromiseService.prototype, "onChanged", {
3955
+ get: function () {
3956
+ return this.promiseChanged;
3957
+ },
3958
+ enumerable: false,
3959
+ configurable: true
3960
+ });
3961
+ PromiseService.prototype.create = function (executor) {
3962
+ return this.add(this.zone.runOutsideAngular(function () { return new Promise(executor); }));
3963
+ };
3964
+ PromiseService.prototype.all = function (promises) {
3965
+ return this.add(this.zone.runOutsideAngular(function () { return Promise.all(promises); }));
3966
+ };
3967
+ PromiseService.prototype.resolve = function (value) {
3968
+ return this.add(this.zone.runOutsideAngular(function () { return Promise.resolve(value); }));
3969
+ };
3970
+ PromiseService.prototype.reject = function (value) {
3971
+ return this.add(this.zone.runOutsideAngular(function () { return Promise.reject(value); }));
3972
+ };
3973
+ PromiseService.prototype.promiseFinished = function () {
3974
+ if (this.promiseCount == 0)
3975
+ return;
3976
+ this.promiseCount--;
3977
+ this.promiseChanged.emit(this.promiseCount);
3978
+ };
3979
+ PromiseService.prototype.add = function (promise) {
3980
+ var _this = this;
3981
+ this.promiseCount++;
3982
+ this.promiseChanged.emit(this.promiseCount);
3983
+ return new Promise(function (resolve, reject) {
3984
+ promise.then(function (v) {
3985
+ resolve(v);
3986
+ _this.promiseFinished();
3987
+ }, function (r) {
3988
+ reject(r);
3989
+ _this.promiseFinished();
3990
+ });
3991
+ });
3992
+ };
3993
+ return PromiseService;
3994
+ }());
3995
+ PromiseService.decorators = [
3996
+ { type: core.Injectable }
3997
+ ];
3998
+ PromiseService.ctorParameters = function () { return [
3999
+ { type: core.NgZone, decorators: [{ type: core.Inject, args: [core.NgZone,] }] }
4000
+ ]; };
4001
+
3998
4002
  function emptyRemove() {
3999
4003
  }
4000
4004
  var ResizeEventPlugin = /** @class */ (function (_super) {
@@ -5859,6 +5863,10 @@
5859
5863
  provide: CONFIG_SERVICE,
5860
5864
  useExisting: (!config ? null : config.configService) || ConfigService
5861
5865
  },
5866
+ {
5867
+ provide: ROOT_ELEMENT,
5868
+ useValue: null
5869
+ },
5862
5870
  {
5863
5871
  provide: core.APP_INITIALIZER,
5864
5872
  useFactory: (!config ? null : config.initializeApp) || loadConfig,
@@ -5957,6 +5965,7 @@
5957
5965
  exports.PaginationMenuComponent = PaginationMenuComponent;
5958
5966
  exports.Point = Point;
5959
5967
  exports.PromiseService = PromiseService;
5968
+ exports.ROOT_ELEMENT = ROOT_ELEMENT;
5960
5969
  exports.Rect = Rect;
5961
5970
  exports.ReducePipe = ReducePipe;
5962
5971
  exports.ReflectUtils = ReflectUtils;