@sumaris-net/ngx-components 1.19.21 → 1.19.24

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.
@@ -28381,7 +28381,7 @@
28381
28381
  idChanged = isNotNil(data.id)
28382
28382
  && this.previousDataId !== undefined // Ignore if first loading (=undefined)
28383
28383
  && this.previousDataId !== data.id;
28384
- opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading, openTabIndex: this._autoOpenNextTab && idChanged && isNil(this.previousDataId) && this.computeNextTabIndex() }, opts);
28384
+ opts = Object.assign({ updateRoute: this._autoUpdateRoute && idChanged && !this.loading }, opts);
28385
28385
  this.data = data;
28386
28386
  this.previousDataId = data.id || null;
28387
28387
  return [4 /*yield*/, this.ready()];
@@ -28435,7 +28435,7 @@
28435
28435
  */
28436
28436
  AppEntityEditor.prototype.updateTabAndRoute = function (data, opts) {
28437
28437
  return __awaiter(this, void 0, void 0, function () {
28438
- var forcedQueryParams;
28438
+ var queryParams, queryParams;
28439
28439
  return __generator(this, function (_c) {
28440
28440
  switch (_c.label) {
28441
28441
  case 0:
@@ -28444,20 +28444,27 @@
28444
28444
  this.updateTabIndex(opts && opts.openTabIndex);
28445
28445
  // Save the opened tab into the queryParams
28446
28446
  this.queryParams.tab = this.selectedTabIndex;
28447
- forcedQueryParams = {};
28448
- forcedQueryParams[this._pathIdAttribute] = data && isNotNil(data.id) ? data.id : 'new';
28449
- if (!(data && isNotNil(data.id))) return [3 /*break*/, 2];
28447
+ if (!isNotNil(data === null || data === void 0 ? void 0 : data.id)) return [3 /*break*/, 2];
28448
+ queryParams = Object.assign({}, this.queryParams);
28449
+ queryParams[this._pathIdAttribute] = data.id;
28450
+ if (this.debug)
28451
+ console.debug('[entity-editor] Updating route using params: ', queryParams);
28450
28452
  return [4 /*yield*/, this.router.navigate(['.'], {
28451
28453
  relativeTo: this.route,
28452
- queryParams: Object.assign(Object.assign({}, this.queryParams), forcedQueryParams)
28454
+ queryParams: queryParams
28453
28455
  })];
28454
28456
  case 1:
28455
28457
  _c.sent();
28456
28458
  return [3 /*break*/, 4];
28457
- case 2: return [4 /*yield*/, this.router.navigate(['..', 'new'], {
28458
- relativeTo: this.route,
28459
- queryParams: Object.assign(Object.assign({}, this.queryParams), forcedQueryParams)
28460
- })];
28459
+ case 2:
28460
+ queryParams = Object.assign({}, this.queryParams);
28461
+ queryParams[this._pathIdAttribute] = 'new';
28462
+ if (this.debug)
28463
+ console.debug('[entity-editor] Updating route to \'../new\' using params: ', queryParams);
28464
+ return [4 /*yield*/, this.router.navigate(['..', 'new'], {
28465
+ relativeTo: this.route,
28466
+ queryParams: queryParams
28467
+ })];
28461
28468
  case 3:
28462
28469
  _c.sent();
28463
28470
  _c.label = 4;
@@ -28473,7 +28480,7 @@
28473
28480
  * Update the route location, and open the next tab
28474
28481
  */
28475
28482
  AppEntityEditor.prototype.updateTabIndex = function (tabIndex) {
28476
- if (isNotNil(tabIndex) && tabIndex > this.selectedTabIndex) {
28483
+ if (isNotNil(tabIndex) && tabIndex !== this.selectedTabIndex) {
28477
28484
  this.selectedTabIndex = tabIndex;
28478
28485
  this.markForCheck();
28479
28486
  }
@@ -28517,7 +28524,7 @@
28517
28524
  */
28518
28525
  AppEntityEditor.prototype.save = function (event, opts) {
28519
28526
  return __awaiter(this, void 0, void 0, function () {
28520
- var data, updatedData, err_3;
28527
+ var nextTabIndex, data, updatedData, err_3;
28521
28528
  return __generator(this, function (_c) {
28522
28529
  switch (_c.label) {
28523
28530
  case 0:
@@ -28549,6 +28556,7 @@
28549
28556
  _c.label = 2;
28550
28557
  case 2:
28551
28558
  _c.trys.push([2, 7, 8, 9]);
28559
+ nextTabIndex = this._autoOpenNextTab && isNil(this.previousDataId) && this.computeNextTabIndex();
28552
28560
  return [4 /*yield*/, this.getValue()];
28553
28561
  case 3:
28554
28562
  data = _c.sent();
@@ -28560,7 +28568,10 @@
28560
28568
  case 5:
28561
28569
  _c.sent();
28562
28570
  // Update the view (e.g metadata)
28563
- return [4 /*yield*/, this.updateView(updatedData, opts)];
28571
+ return [4 /*yield*/, this.updateView(updatedData, Object.assign({
28572
+ // Open next tab only if user has not changed it
28573
+ openTabIndex: nextTabIndex > this._selectedTabIndex ? nextTabIndex : undefined
28574
+ }, opts))];
28564
28575
  case 6:
28565
28576
  // Update the view (e.g metadata)
28566
28577
  _c.sent();
@@ -28852,7 +28863,9 @@
28852
28863
  return [4 /*yield*/, this.computePageHistory(title)];
28853
28864
  case 2:
28854
28865
  page = _c.sent();
28855
- return [2 /*return*/, this.addToPageHistory(page)];
28866
+ if (page)
28867
+ return [2 /*return*/, this.addToPageHistory(page)];
28868
+ _c.label = 3;
28856
28869
  case 3: return [2 /*return*/];
28857
28870
  }
28858
28871
  });
@@ -28870,6 +28883,8 @@
28870
28883
  AppEntityEditor.prototype.computePageHistory = function (title) {
28871
28884
  return __awaiter(this, void 0, void 0, function () {
28872
28885
  return __generator(this, function (_c) {
28886
+ if (this.debug)
28887
+ console.debug('[entity-editor] Computing page history, using url: ' + this.router.url);
28873
28888
  return [2 /*return*/, {
28874
28889
  title: title,
28875
28890
  path: this.router.url