@sumaris-net/ngx-components 1.0.10 → 1.1.0

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.
@@ -2489,6 +2489,14 @@
2489
2489
  DateUtils.max = function (date1, date2) {
2490
2490
  return !date1 ? date2 : (!date2 || date1.isSameOrAfter(date2) ? date1 : date2);
2491
2491
  };
2492
+ DateUtils.equals = function (date1, date2) {
2493
+ return DateUtils.isSame(date1, date2);
2494
+ };
2495
+ DateUtils.isSame = function (date1, date2, granularity) {
2496
+ var d1 = fromDateISOString(date1);
2497
+ var d2 = fromDateISOString(date2);
2498
+ return (!d1 && !d2) || d1.isSame(d2, granularity);
2499
+ };
2492
2500
  return DateUtils;
2493
2501
  }());
2494
2502
  function toDateISOString(value) {
@@ -3714,7 +3722,7 @@
3714
3722
  source = source.split('|');
3715
3723
  }
3716
3724
  // Skip if value is not an array
3717
- if (!(source instanceof Array) || control.length === 0) {
3725
+ if (!Array.isArray(source) || control.length === 0) {
3718
3726
  if (isNotEmptyArray(source))
3719
3727
  console.warn("WARN: please resize the FormArray '" + path + "' to the same length of the input array");
3720
3728
  return [];
@@ -8656,7 +8664,7 @@
8656
8664
  };
8657
8665
  AppFormField.prototype.computeValuesFromToken = function (token) {
8658
8666
  var values = this.injector.get(token);
8659
- return values instanceof Array ? values : [];
8667
+ return Array.isArray(values) ? values : [];
8660
8668
  };
8661
8669
  AppFormField.prototype.checkAndResolveFormControl = function () {
8662
8670
  var _this = this;
@@ -9874,7 +9882,7 @@
9874
9882
  }, {});
9875
9883
  };
9876
9884
  EntityUtils.getMapAsArray = function (source) {
9877
- if (source instanceof Array)
9885
+ if (Array.isArray(source))
9878
9886
  return source;
9879
9887
  return Object.getOwnPropertyNames(source || {})
9880
9888
  .map(function (key) { return ({
@@ -12380,8 +12388,8 @@
12380
12388
  ])];
12381
12389
  case 1:
12382
12390
  res = _a.sent();
12383
- values = res[0] && res[0] instanceof Array ? res[0] : null;
12384
- ids = res[1] && res[1] instanceof Array ? res[1] : null;
12391
+ values = res[0] && Array.isArray(res[0]) ? res[0] : null;
12392
+ ids = res[1] && Array.isArray(res[1]) ? res[1] : null;
12385
12393
  migration = false;
12386
12394
  if (!this.isByIdMode) return [3 /*break*/, 5];
12387
12395
  if (!isNotNil(ids)) return [3 /*break*/, 3];
@@ -13979,7 +13987,7 @@
13979
13987
  .pipe(operators.catchError(function (error) { return _this.onApolloError(error, opts.error); }), operators.first()).toPromise()];
13980
13988
  case 5:
13981
13989
  res = _b.sent();
13982
- if (res.errors instanceof Array) {
13990
+ if (Array.isArray(res.errors)) {
13983
13991
  throw res.errors[0];
13984
13992
  }
13985
13993
  return [2 /*return*/, res.data];
@@ -14653,7 +14661,7 @@
14653
14661
  if (!queries.length)
14654
14662
  return;
14655
14663
  queries.forEach(function (query) {
14656
- if (opts.data instanceof Array) {
14664
+ if (Array.isArray(opts.data)) {
14657
14665
  // Filter values, if a filter function exists
14658
14666
  var data = query.insertFilterFn ? opts.data.filter(function (i) { return query.insertFilterFn(i); }) : opts.data;
14659
14667
  if (isNotEmptyArray(data)) {
@@ -14691,7 +14699,7 @@
14691
14699
  return;
14692
14700
  console.debug("[base-data-service] Removing data from watching queries: ", queries);
14693
14701
  return queries.map(function (query) {
14694
- if (opts.ids instanceof Array) {
14702
+ if (Array.isArray(opts.ids)) {
14695
14703
  return _this.graphql.removeFromCachedQueryByIds(cache, {
14696
14704
  query: query.query,
14697
14705
  variables: query.variables,
@@ -16089,7 +16097,7 @@
16089
16097
  this.comments = source.comments;
16090
16098
  this.creationDate = fromDateISOString(source.creationDate);
16091
16099
  this.statusId = source.statusId;
16092
- if (source.properties && source.properties instanceof Array) {
16100
+ if (source.properties && Array.isArray(source.properties)) {
16093
16101
  this.properties = EntityUtils.getPropertyArrayAsObject(source.properties);
16094
16102
  }
16095
16103
  else {
@@ -22234,7 +22242,7 @@
22234
22242
  function DepartmentToStringPipe() {
22235
22243
  }
22236
22244
  DepartmentToStringPipe.prototype.transform = function (value, separator) {
22237
- if (value instanceof Array)
22245
+ if (Array.isArray(value))
22238
22246
  return departmentsToString(value, separator);
22239
22247
  return departmentToString(value);
22240
22248
  };