@sumaris-net/ngx-components 1.19.21-rc2 → 1.19.23

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.
@@ -28233,6 +28233,13 @@
28233
28233
  this.onUpdateView.complete();
28234
28234
  this.onUpdateView.unsubscribe();
28235
28235
  };
28236
+ AppEntityEditor.prototype.waitIdle = function (opts) {
28237
+ var _this = this;
28238
+ // Wait end of saving
28239
+ if (this.saving)
28240
+ return waitFor(function () { return _this.saving !== true; });
28241
+ return _super.prototype.waitIdle.call(this, opts);
28242
+ };
28236
28243
  /**
28237
28244
  * Load data from the snapshot route
28238
28245
  *
@@ -28374,7 +28381,7 @@
28374
28381
  idChanged = isNotNil(data.id)
28375
28382
  && this.previousDataId !== undefined // Ignore if first loading (=undefined)
28376
28383
  && this.previousDataId !== data.id;
28377
- 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);
28378
28385
  this.data = data;
28379
28386
  this.previousDataId = data.id || null;
28380
28387
  return [4 /*yield*/, this.ready()];
@@ -28428,7 +28435,7 @@
28428
28435
  */
28429
28436
  AppEntityEditor.prototype.updateTabAndRoute = function (data, opts) {
28430
28437
  return __awaiter(this, void 0, void 0, function () {
28431
- var forcedQueryParams;
28438
+ var queryParams, queryParams;
28432
28439
  return __generator(this, function (_c) {
28433
28440
  switch (_c.label) {
28434
28441
  case 0:
@@ -28437,20 +28444,27 @@
28437
28444
  this.updateTabIndex(opts && opts.openTabIndex);
28438
28445
  // Save the opened tab into the queryParams
28439
28446
  this.queryParams.tab = this.selectedTabIndex;
28440
- forcedQueryParams = {};
28441
- forcedQueryParams[this._pathIdAttribute] = data && isNotNil(data.id) ? data.id : 'new';
28442
- 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);
28443
28452
  return [4 /*yield*/, this.router.navigate(['.'], {
28444
28453
  relativeTo: this.route,
28445
- queryParams: Object.assign(Object.assign({}, this.queryParams), forcedQueryParams)
28454
+ queryParams: queryParams
28446
28455
  })];
28447
28456
  case 1:
28448
28457
  _c.sent();
28449
28458
  return [3 /*break*/, 4];
28450
- case 2: return [4 /*yield*/, this.router.navigate(['..', 'new'], {
28451
- relativeTo: this.route,
28452
- queryParams: Object.assign(Object.assign({}, this.queryParams), forcedQueryParams)
28453
- })];
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
+ })];
28454
28468
  case 3:
28455
28469
  _c.sent();
28456
28470
  _c.label = 4;
@@ -28466,7 +28480,7 @@
28466
28480
  * Update the route location, and open the next tab
28467
28481
  */
28468
28482
  AppEntityEditor.prototype.updateTabIndex = function (tabIndex) {
28469
- if (isNotNil(tabIndex) && tabIndex > this.selectedTabIndex) {
28483
+ if (isNotNil(tabIndex) && tabIndex !== this.selectedTabIndex) {
28470
28484
  this.selectedTabIndex = tabIndex;
28471
28485
  this.markForCheck();
28472
28486
  }
@@ -28510,7 +28524,7 @@
28510
28524
  */
28511
28525
  AppEntityEditor.prototype.save = function (event, opts) {
28512
28526
  return __awaiter(this, void 0, void 0, function () {
28513
- var data, updatedData, err_3;
28527
+ var nextTabIndex, data, updatedData, err_3;
28514
28528
  return __generator(this, function (_c) {
28515
28529
  switch (_c.label) {
28516
28530
  case 0:
@@ -28542,6 +28556,7 @@
28542
28556
  _c.label = 2;
28543
28557
  case 2:
28544
28558
  _c.trys.push([2, 7, 8, 9]);
28559
+ nextTabIndex = this._autoOpenNextTab && isNil(this.previousDataId) && this.computeNextTabIndex();
28545
28560
  return [4 /*yield*/, this.getValue()];
28546
28561
  case 3:
28547
28562
  data = _c.sent();
@@ -28553,7 +28568,10 @@
28553
28568
  case 5:
28554
28569
  _c.sent();
28555
28570
  // Update the view (e.g metadata)
28556
- 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))];
28557
28575
  case 6:
28558
28576
  // Update the view (e.g metadata)
28559
28577
  _c.sent();
@@ -28863,6 +28881,8 @@
28863
28881
  AppEntityEditor.prototype.computePageHistory = function (title) {
28864
28882
  return __awaiter(this, void 0, void 0, function () {
28865
28883
  return __generator(this, function (_c) {
28884
+ if (this.debug)
28885
+ console.debug('[entity-editor] Computing page history, using url: ' + this.router.url);
28866
28886
  return [2 /*return*/, {
28867
28887
  title: title,
28868
28888
  path: this.router.url