@stemy/ngx-utils 12.0.3 → 12.0.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.
@@ -3454,6 +3454,40 @@
3454
3454
  { type: undefined, decorators: [{ type: core.Inject, args: [LANGUAGE_SERVICE,] }] }
3455
3455
  ]; };
3456
3456
 
3457
+ var GlobalTemplateService = /** @class */ (function () {
3458
+ function GlobalTemplateService() {
3459
+ this.templatesUpdated = new core.EventEmitter();
3460
+ this.globalTemplates = {};
3461
+ this.componentModifiers = {};
3462
+ }
3463
+ GlobalTemplateService.prototype.get = function (id, component) {
3464
+ var template = this.globalTemplates[id];
3465
+ if (!template)
3466
+ return undefined;
3467
+ var modifier = this.componentModifiers[id];
3468
+ if (ObjectUtils.isFunction(modifier) && component) {
3469
+ modifier(component);
3470
+ }
3471
+ return template;
3472
+ };
3473
+ GlobalTemplateService.prototype.add = function (id, template) {
3474
+ this.globalTemplates[id] = template;
3475
+ this.templatesUpdated.emit();
3476
+ };
3477
+ GlobalTemplateService.prototype.remove = function (id) {
3478
+ delete this.globalTemplates[id];
3479
+ this.templatesUpdated.emit();
3480
+ };
3481
+ GlobalTemplateService.prototype.addComponentModifier = function (id, modifier) {
3482
+ this.componentModifiers[id] = modifier;
3483
+ };
3484
+ return GlobalTemplateService;
3485
+ }());
3486
+ GlobalTemplateService.decorators = [
3487
+ { type: core.Injectable }
3488
+ ];
3489
+ GlobalTemplateService.ctorParameters = function () { return []; };
3490
+
3457
3491
  var IconService = /** @class */ (function () {
3458
3492
  function IconService() {
3459
3493
  this.iconsLoaded = new core.EventEmitter();
@@ -4771,37 +4805,43 @@
4771
4805
  },] }
4772
4806
  ];
4773
4807
 
4774
- var AsyncMethodDirective = /** @class */ (function () {
4775
- function AsyncMethodDirective(toaster) {
4808
+ var AsyncMethodBase = /** @class */ (function () {
4809
+ function AsyncMethodBase(toaster) {
4776
4810
  this.toaster = toaster;
4777
4811
  this.onSuccess = new core.EventEmitter();
4778
4812
  this.onError = new core.EventEmitter();
4779
4813
  }
4780
- Object.defineProperty(AsyncMethodDirective.prototype, "isDisabled", {
4814
+ Object.defineProperty(AsyncMethodBase.prototype, "isDisabled", {
4781
4815
  get: function () {
4782
4816
  return this.disabled;
4783
4817
  },
4784
4818
  enumerable: false,
4785
4819
  configurable: true
4786
4820
  });
4787
- Object.defineProperty(AsyncMethodDirective.prototype, "isLoading", {
4821
+ Object.defineProperty(AsyncMethodBase.prototype, "isLoading", {
4788
4822
  get: function () {
4789
4823
  return this.loading;
4790
4824
  },
4791
4825
  enumerable: false,
4792
4826
  configurable: true
4793
4827
  });
4794
- AsyncMethodDirective.prototype.click = function () {
4828
+ AsyncMethodBase.prototype.click = function () {
4795
4829
  if (this.disabled)
4796
4830
  return;
4797
4831
  this.callMethod();
4798
4832
  };
4799
- AsyncMethodDirective.prototype.callMethod = function () {
4833
+ AsyncMethodBase.prototype.callMethod = function () {
4800
4834
  var _this = this;
4801
4835
  if (this.loading)
4802
- return;
4836
+ return true;
4803
4837
  this.loading = true;
4804
- this.method(this.context).then(function (result) {
4838
+ var method = this.getMethod();
4839
+ var result = !method ? null : method(this.context);
4840
+ if (!(result instanceof Promise)) {
4841
+ this.loading = false;
4842
+ return false;
4843
+ }
4844
+ result.then(function (result) {
4805
4845
  _this.loading = false;
4806
4846
  if (result) {
4807
4847
  _this.onSuccess.emit(result);
@@ -4814,9 +4854,30 @@
4814
4854
  _this.onError.emit(reason);
4815
4855
  _this.toaster.error(reason.message, reason.context);
4816
4856
  });
4857
+ return true;
4817
4858
  };
4818
- return AsyncMethodDirective;
4859
+ return AsyncMethodBase;
4819
4860
  }());
4861
+ AsyncMethodBase.propDecorators = {
4862
+ disabled: [{ type: core.Input }],
4863
+ context: [{ type: core.Input }],
4864
+ onSuccess: [{ type: core.Output }],
4865
+ onError: [{ type: core.Output }],
4866
+ isDisabled: [{ type: core.HostBinding, args: ["class.disabled",] }],
4867
+ isLoading: [{ type: core.HostBinding, args: ["class.loading",] }],
4868
+ click: [{ type: core.HostListener, args: ["click",] }]
4869
+ };
4870
+
4871
+ var AsyncMethodDirective = /** @class */ (function (_super) {
4872
+ __extends(AsyncMethodDirective, _super);
4873
+ function AsyncMethodDirective(toaster) {
4874
+ return _super.call(this, toaster) || this;
4875
+ }
4876
+ AsyncMethodDirective.prototype.getMethod = function () {
4877
+ return this.method;
4878
+ };
4879
+ return AsyncMethodDirective;
4880
+ }(AsyncMethodBase));
4820
4881
  AsyncMethodDirective.decorators = [
4821
4882
  { type: core.Directive, args: [{
4822
4883
  selector: "[async-method]",
@@ -4827,14 +4888,7 @@
4827
4888
  { type: undefined, decorators: [{ type: core.Inject, args: [TOASTER_SERVICE,] }] }
4828
4889
  ]; };
4829
4890
  AsyncMethodDirective.propDecorators = {
4830
- method: [{ type: core.Input, args: ["async-method",] }],
4831
- disabled: [{ type: core.Input }],
4832
- context: [{ type: core.Input }],
4833
- onSuccess: [{ type: core.Output }],
4834
- onError: [{ type: core.Output }],
4835
- isDisabled: [{ type: core.HostBinding, args: ["class.disabled",] }],
4836
- isLoading: [{ type: core.HostBinding, args: ["class.loading",] }],
4837
- click: [{ type: core.HostListener, args: ["click",] }]
4891
+ method: [{ type: core.Input, args: ["async-method",] }]
4838
4892
  };
4839
4893
 
4840
4894
  var defaultClass = "default-image";
@@ -5730,40 +5784,6 @@
5730
5784
  boundaryLinks: [{ type: core.Input }]
5731
5785
  };
5732
5786
 
5733
- var GlobalTemplateService = /** @class */ (function () {
5734
- function GlobalTemplateService() {
5735
- this.templatesUpdated = new core.EventEmitter();
5736
- this.globalTemplates = {};
5737
- this.componentModifiers = {};
5738
- }
5739
- GlobalTemplateService.prototype.get = function (id, component) {
5740
- var template = this.globalTemplates[id];
5741
- if (!template)
5742
- return undefined;
5743
- var modifier = this.componentModifiers[id];
5744
- if (ObjectUtils.isFunction(modifier) && component) {
5745
- modifier(component);
5746
- }
5747
- return template;
5748
- };
5749
- GlobalTemplateService.prototype.add = function (id, template) {
5750
- this.globalTemplates[id] = template;
5751
- this.templatesUpdated.emit();
5752
- };
5753
- GlobalTemplateService.prototype.remove = function (id) {
5754
- delete this.globalTemplates[id];
5755
- this.templatesUpdated.emit();
5756
- };
5757
- GlobalTemplateService.prototype.addComponentModifier = function (id, modifier) {
5758
- this.componentModifiers[id] = modifier;
5759
- };
5760
- return GlobalTemplateService;
5761
- }());
5762
- GlobalTemplateService.decorators = [
5763
- { type: core.Injectable }
5764
- ];
5765
- GlobalTemplateService.ctorParameters = function () { return []; };
5766
-
5767
5787
  var StickyClassDirective = /** @class */ (function () {
5768
5788
  function StickyClassDirective(events, element, renderer) {
5769
5789
  this.events = events;
@@ -5971,6 +5991,7 @@
5971
5991
  exports.AjaxRequestHandler = AjaxRequestHandler;
5972
5992
  exports.ApiService = ApiService;
5973
5993
  exports.ArrayUtils = ArrayUtils;
5994
+ exports.AsyncMethodBase = AsyncMethodBase;
5974
5995
  exports.AsyncMethodDirective = AsyncMethodDirective;
5975
5996
  exports.AuthGuard = AuthGuard;
5976
5997
  exports.BASE_CONFIG = BASE_CONFIG;
@@ -6005,6 +6026,7 @@
6005
6026
  exports.GetTypePipe = GetTypePipe;
6006
6027
  exports.GlobalTemplateDirective = GlobalTemplateDirective;
6007
6028
  exports.GlobalTemplatePipe = GlobalTemplatePipe;
6029
+ exports.GlobalTemplateService = GlobalTemplateService;
6008
6030
  exports.GroupByPipe = GroupByPipe;
6009
6031
  exports.HttpPromise = HttpPromise;
6010
6032
  exports.ICON_SERVICE = ICON_SERVICE;
@@ -6074,7 +6096,6 @@
6074
6096
  exports["ɵd"] = providers;
6075
6097
  exports["ɵe"] = loadConfig;
6076
6098
  exports["ɵf"] = StickyClassDirective;
6077
- exports["ɵg"] = GlobalTemplateService;
6078
6099
 
6079
6100
  Object.defineProperty(exports, '__esModule', { value: true });
6080
6101