@ecodev/natural 63.3.3 → 63.5.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.
@@ -2497,10 +2497,16 @@ class NaturalAbstractDetail extends NaturalAbstractPanel {
2497
2497
  return EMPTY;
2498
2498
  }
2499
2499
  else {
2500
- const defaultRoute = ['../../' + kebabCase(this.key)];
2501
- return this.router.navigate(redirectionRoute ? redirectionRoute : defaultRoute, {
2502
- relativeTo: this.route,
2503
- });
2500
+ let commands = ['../../' + kebabCase(this.key)];
2501
+ let extras = { relativeTo: this.route };
2502
+ if (redirectionRoute && 'extras' in redirectionRoute) {
2503
+ commands = redirectionRoute.commands;
2504
+ extras = { ...extras, ...redirectionRoute.extras };
2505
+ }
2506
+ else if (redirectionRoute) {
2507
+ commands = redirectionRoute;
2508
+ }
2509
+ return this.router.navigate(commands, extras);
2504
2510
  }
2505
2511
  }));
2506
2512
  }), finalize(() => this.form.enable()))
@@ -3807,17 +3813,18 @@ class NaturalAbstractList extends NaturalAbstractPanel {
3807
3813
  this.variablesManager.defaults('sorting', { sorting: this.defaultSorting });
3808
3814
  this.dataSource = new NaturalDataSource(this.getDataObservable());
3809
3815
  this.selection.clear();
3816
+ this.handleHistoryNavigation();
3817
+ }
3818
+ handleHistoryNavigation() {
3810
3819
  // Update natural search when history changes (back/forward buttons)
3811
3820
  // History state is detectable only on NavigationStart (popstate trigger)
3812
3821
  // But we need parameters from url after NavigationEnd. So proceed in two steps with a flag.
3813
3822
  let isPopState = false;
3814
3823
  this.router.events
3815
3824
  .pipe(takeUntilDestroyed(this.destroyRef), filter(event => event instanceof NavigationStart && event.navigationTrigger === 'popstate'))
3816
- .subscribe(() => {
3817
- isPopState = true;
3818
- });
3825
+ .subscribe(() => (isPopState = true));
3819
3826
  this.router.events
3820
- .pipe(takeUntilDestroyed(this.destroyRef), filter(event => event instanceof NavigationEnd && isPopState))
3827
+ .pipe(takeUntilDestroyed(this.destroyRef), filter(event => event instanceof NavigationEnd && isPopState), filter(() => this.historyNavigationFilter()))
3821
3828
  .subscribe(() => {
3822
3829
  isPopState = false; // reset flag
3823
3830
  const selections = fromUrl(this.persistenceService.getFromUrl('ns', this.route));
@@ -3825,6 +3832,9 @@ class NaturalAbstractList extends NaturalAbstractPanel {
3825
3832
  this.search(selections);
3826
3833
  });
3827
3834
  }
3835
+ historyNavigationFilter() {
3836
+ return true;
3837
+ }
3828
3838
  /**
3829
3839
  * Persist search and then launch whatever is required to refresh the list
3830
3840
  */