@sumaris-net/ngx-components 1.0.9 → 1.0.10

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.
@@ -4236,8 +4236,8 @@
4236
4236
  this.value = this.adapter.translateErrors(form, opts);
4237
4237
  this._ref.markForCheck();
4238
4238
  }
4239
- else if (isNotNilOrBlank(this.value)) {
4240
- this.value = '';
4239
+ else if (this.value !== undefined) {
4240
+ this.value = undefined;
4241
4241
  this._ref.markForCheck();
4242
4242
  }
4243
4243
  };
@@ -17703,20 +17703,30 @@
17703
17703
  function CustomReuseStrategy() {
17704
17704
  return _super !== null && _super.apply(this, arguments) || this;
17705
17705
  }
17706
+ /**
17707
+ * Force to reuse the route when:
17708
+ * - path change from [/new] -> [/:id]
17709
+ * - or path change from [/new] -> [/new?id=:id]
17710
+ * @param future
17711
+ * @param curr
17712
+ */
17706
17713
  CustomReuseStrategy.prototype.shouldReuseRoute = function (future, curr) {
17707
17714
  var result = _super.prototype.shouldReuseRoute.call(this, future, curr);
17708
- // Force to reuse the route when:
17709
- // - path change from [/new] -> [/:id]
17710
- // - or path change from [/new] -> [/new?id=:id]
17715
+ // Is sam route config
17711
17716
  if (!result && future.routeConfig && future.routeConfig === curr.routeConfig) {
17717
+ // Read the parameter name, where id is stored
17712
17718
  var pathIdParam = future.routeConfig.data && future.routeConfig.data.pathIdParam || 'id';
17713
- var futureId = future.params[pathIdParam] === 'new' ?
17714
- (future.queryParams[pathIdParam] || future.queryParams['id']) : future.params[pathIdParam];
17715
- var currId = curr.params[pathIdParam] === 'new' ?
17716
- (curr.queryParams[pathIdParam] || curr.queryParams['id']) : curr.params[pathIdParam];
17717
- return futureId === currId &&
17718
- // Always reload 'new' page
17719
- currId !== 'new';
17719
+ // Read the current route id
17720
+ var currId = curr.params[pathIdParam] === 'new'
17721
+ ? (curr.queryParams[pathIdParam] || curr.queryParams['id'] || 'new') // e.g. path like '/new/?id=<ID>'
17722
+ : curr.params[pathIdParam]; // e.g. path like '/<ID>'
17723
+ // Read the future route id
17724
+ var futureId = future.params[pathIdParam] === 'new'
17725
+ ? (future.queryParams[pathIdParam] || future.queryParams['id'] || 'new') // e.g. path like '/new/?id=<ID>'
17726
+ : future.params[pathIdParam]; // e.g. path like '/<ID>'
17727
+ // Reuse if same ID, but never when 'new' expected
17728
+ return futureId !== 'new' && currId !== 'new'
17729
+ && futureId === currId;
17720
17730
  }
17721
17731
  return result;
17722
17732
  };