@stemy/ngx-utils 10.3.0 → 10.3.4

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.
@@ -2193,7 +2193,7 @@
2193
2193
  };
2194
2194
  ArrayUtils.min = function (arr, cb) {
2195
2195
  if (!ObjectUtils.isArray(arr))
2196
- return 0;
2196
+ return null;
2197
2197
  var min = Number.MAX_SAFE_INTEGER;
2198
2198
  var result = null;
2199
2199
  for (var i = 0; i < arr.length; i++) {
@@ -2207,7 +2207,7 @@
2207
2207
  };
2208
2208
  ArrayUtils.max = function (arr, cb) {
2209
2209
  if (!ObjectUtils.isArray(arr))
2210
- return 0;
2210
+ return null;
2211
2211
  var max = Number.MIN_SAFE_INTEGER;
2212
2212
  var result = null;
2213
2213
  for (var i = 0; i < arr.length; i++) {
@@ -2219,6 +2219,16 @@
2219
2219
  }
2220
2220
  return result;
2221
2221
  };
2222
+ ArrayUtils.chunk = function (arr, size) {
2223
+ if (!ObjectUtils.isArray(arr))
2224
+ return [];
2225
+ size = Math.max(1, size);
2226
+ var result = [];
2227
+ for (var i = 0; i < arr.length; i += size) {
2228
+ result.push(arr.slice(i, i + size));
2229
+ }
2230
+ return result;
2231
+ };
2222
2232
  return ArrayUtils;
2223
2233
  }());
2224
2234
 
@@ -2788,12 +2798,12 @@
2788
2798
  }
2789
2799
  return params;
2790
2800
  };
2791
- BaseHttpService.prototype.getPromise = function (url, options) {
2792
- options = this.makeOptions(options, "GET");
2801
+ BaseHttpService.prototype.getPromise = function (url, options, body) {
2802
+ options = this.makeOptions(options, "GET", body);
2793
2803
  return this.toPromise(url, options);
2794
2804
  };
2795
- BaseHttpService.prototype.deletePromise = function (url, options) {
2796
- options = this.makeOptions(options, "DELETE");
2805
+ BaseHttpService.prototype.deletePromise = function (url, options, body) {
2806
+ options = this.makeOptions(options, "DELETE", body);
2797
2807
  return this.toPromise(url, options);
2798
2808
  };
2799
2809
  BaseHttpService.prototype.postPromise = function (url, body, options) {
@@ -2954,7 +2964,6 @@
2954
2964
  };
2955
2965
  BaseHttpService.prototype.makeOptions = function (options, method, body) {
2956
2966
  if (method === void 0) { method = "GET"; }
2957
- if (body === void 0) { body = {}; }
2958
2967
  // Set base options
2959
2968
  options = options ? Object.assign({}, options) : {};
2960
2969
  options.params = this.client.makeParams(options.params);
@@ -3030,11 +3039,11 @@
3030
3039
  ApiService.prototype.url = function (url) {
3031
3040
  return this.expressRequestUrl("/api/" + url);
3032
3041
  };
3033
- ApiService.prototype.get = function (url, options) {
3034
- return this.getPromise(url, options);
3042
+ ApiService.prototype.get = function (url, options, body) {
3043
+ return this.getPromise(url, options, body);
3035
3044
  };
3036
- ApiService.prototype.delete = function (url, options) {
3037
- return this.deletePromise(url, options);
3045
+ ApiService.prototype.delete = function (url, options, body) {
3046
+ return this.deletePromise(url, options, body);
3038
3047
  };
3039
3048
  ApiService.prototype.post = function (url, body, options) {
3040
3049
  return this.postPromise(url, body, options);
@@ -5032,17 +5041,19 @@
5032
5041
  configurable: true
5033
5042
  });
5034
5043
  PaginationDirective.prototype.ngOnChanges = function (changes) {
5035
- var _this = this;
5036
- if (!changes.loader && !changes.itemsPerPage)
5044
+ if (!changes.loader && !changes.itemsPerPage && !changes.page)
5037
5045
  return;
5038
5046
  this.page = isNaN(this.page) || this.page < 1 ? 1 : this.page;
5039
5047
  this.itemsPerPage = isNaN(this.itemsPerPage) || this.itemsPerPage < 1 ? 20 : this.itemsPerPage;
5040
5048
  this.updateTimer.time = isNaN(this.updateTime) || this.updateTime < 0 ? 100 : this.updateTime;
5041
5049
  this.waitFor = this.waitFor || Promise.resolve(true);
5042
- this.waitFor.then(function () { return _this.refresh(); });
5050
+ this.refresh();
5043
5051
  };
5044
5052
  PaginationDirective.prototype.refresh = function () {
5045
- this.updateTimer.run();
5053
+ var _this = this;
5054
+ this.waitFor.then(function () {
5055
+ _this.updateTimer.run();
5056
+ });
5046
5057
  };
5047
5058
  PaginationDirective.prototype.paginate = function (page) {
5048
5059
  this.page = page;