@coolon/angular-ui-powerups 14.10.0 → 14.12.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.
@@ -6728,6 +6728,10 @@ class UrlSnapshot {
6728
6728
  newUrlTree.root.children.primary.segments = segments;
6729
6729
  return new UrlSnapshot(this.urlSerializer, newUrlTree.toString());
6730
6730
  }
6731
+ appendVisit(visit) {
6732
+ // TODO: make this work properly with visit parameters
6733
+ return new UrlSnapshot(this.urlSerializer, this.url + "/" + visit.placeDefinition.path);
6734
+ }
6731
6735
  getPrimarySegments() {
6732
6736
  return extractPrimarySegments(this.urlTree);
6733
6737
  }
@@ -10168,28 +10172,18 @@ class PlaceGuard {
10168
10172
  if (initialVisit.hasRoutingChangedFrom(sanitisedVisit)) {
10169
10173
  // Regenerate the url
10170
10174
  const urlSnapshot = destUrlSnapshot.updateVisitSegments(sanitisedVisit);
10171
- // console.log('##### Place Guard Redirect', urlSnapshot);
10175
+ console.log('##### Place Guard Redirect', urlSnapshot);
10172
10176
  return urlSnapshot;
10173
10177
  }
10174
10178
  else {
10175
10179
  // Our visit parameters are all sorted, now check if we should redirect to our child.
10176
- // debugger;
10177
- if (placeDefinition.redirectToFirstChild) {
10180
+ if (destUrlSnapshot.isLastPlaceInUrl(placeDefinition) && placeDefinition.redirectToFirstChild) {
10178
10181
  if (placeDefinition.children.length < 1) {
10179
10182
  lang.illegalState(`redirectToFirstChild set to true, but there were no children `);
10180
10183
  }
10181
10184
  for (let child of placeDefinition.children) {
10182
10185
  if (!child.authenticate || accessGuard.isAuthorised(child)) {
10183
- console.log(state.url);
10184
- if (destUrlSnapshot.isLastPlaceInUrl(placeDefinition)) {
10185
- return this.urlService.createUrlSnapshot(sanitisedVisit, new Visit(child));
10186
- }
10187
- return true;
10188
- // if (destUrlSnapshot.includesPathOf(child)) {
10189
- // return true; // continue with the current url
10190
- // } else {
10191
- //
10192
- // }
10186
+ return destUrlSnapshot.appendVisit(new Visit(child));
10193
10187
  }
10194
10188
  }
10195
10189
  // hmm, what should I do here, we didn't have an authorised child