@sumaris-net/ngx-components 2.4.22 → 2.4.23-rc1

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.
@@ -2748,6 +2748,12 @@ class DateUtils {
2748
2748
  value[MOMENT_NO_TIME_PROPERTY] = true;
2749
2749
  return value;
2750
2750
  }
2751
+ static markTime(value) {
2752
+ if (!value)
2753
+ return undefined;
2754
+ delete value[MOMENT_NO_TIME_PROPERTY];
2755
+ return value;
2756
+ }
2751
2757
  static isNoTime(value) {
2752
2758
  return value?.[MOMENT_NO_TIME_PROPERTY] === true;
2753
2759
  }
@@ -28304,34 +28310,14 @@ class AppEntityEditor extends AppTabEditor {
28304
28310
  * Update the route location, and open the next tab
28305
28311
  */
28306
28312
  async updateTabAndRoute(data, opts) {
28307
- this.queryParams = this.queryParams || {};
28313
+ const queryParams = { ...this.queryParams };
28308
28314
  // Open the next tab
28309
28315
  this.updateTabIndex(opts && opts.openTabIndex);
28310
- // Save the opened tab into the queryParams
28311
- this.queryParams.tab = this.selectedTabIndex;
28316
+ // Update queryParams
28317
+ queryParams.tab = this.selectedTabIndex;
28318
+ queryParams[this._pathIdAttribute] = isNotNil(data?.id) ? data.id : 'new';
28312
28319
  // Update route location
28313
- if (isNotNil(data?.id)) {
28314
- const queryParams = { ...this.queryParams };
28315
- queryParams[this._pathIdAttribute] = data.id;
28316
- if (this.debug)
28317
- console.debug('[entity-editor] Updating route using params: ', queryParams);
28318
- await this.router.navigate(['.'], {
28319
- relativeTo: this.route,
28320
- queryParams
28321
- });
28322
- }
28323
- // Move to ../new
28324
- else {
28325
- const queryParams = { ...this.queryParams };
28326
- queryParams[this._pathIdAttribute] = 'new';
28327
- if (this.debug)
28328
- console.debug('[entity-editor] Updating route to \'../new\' using params: ', queryParams);
28329
- await this.router.navigate(['..', 'new'], {
28330
- relativeTo: this.route,
28331
- queryParams
28332
- });
28333
- }
28334
- await this.updateRoute(data, this.queryParams);
28320
+ await this.updateRoute(data, queryParams);
28335
28321
  }
28336
28322
  /**
28337
28323
  * Update the route location, and open the next tab
@@ -28653,17 +28639,19 @@ class AppEntityEditor extends AppTabEditor {
28653
28639
  this.markForCheck();
28654
28640
  }
28655
28641
  }
28656
- async updateRoute(data, queryParams) {
28642
+ updateRoute(data, queryParams) {
28657
28643
  const path = this.computePageUrl(isNotNil(data.id) ? data.id : 'new');
28658
28644
  const commands = (path && typeof path === 'string') ? path.split('/') : path;
28659
28645
  if (isNotEmptyArray(commands)) {
28660
- return await this.router.navigate(commands, {
28646
+ this.queryParams = queryParams || this.queryParams;
28647
+ return this.router.navigate(commands, {
28661
28648
  replaceUrl: true,
28662
28649
  queryParams: this.queryParams
28663
28650
  });
28664
28651
  }
28665
28652
  else {
28666
28653
  console.warn('Skip page route update. Invalid page path: ', path);
28654
+ return Promise.resolve(false);
28667
28655
  }
28668
28656
  }
28669
28657
  }