@coolon/angular-ui-powerups 16.1.0-alpha.290 → 16.1.0-alpha.292

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.
@@ -29,10 +29,11 @@ export declare class PlaceGuard {
29
29
  */
30
30
  private shouldRedirectToChild;
31
31
  /**
32
- * Chooses the child to redirect to when {@link PlaceDefinition.redirectToFirstChild} is set. When
33
- * `rememberLastChild` is enabled (the default) and we have a record of the last active child that is
34
- * still a valid, authorised child, we return to it. Otherwise we fall back to the first authorised
35
- * child (the legacy behaviour).
32
+ * Chooses the child to redirect to when {@link PlaceDefinition.redirectToFirstChild} is set, taking
33
+ * the first of these that is a valid, authorised child:
34
+ * 1. the place's own pick, when it declares {@link PlaceDefinition.redirectChild};
35
+ * 2. the last active child, when `rememberLastChild` is enabled (the default);
36
+ * 3. the first authorised child in declaration order (the legacy behaviour).
36
37
  *
37
38
  * Authorisation is read AFTER awaiting each candidate child's authorisation-readiness (its
38
39
  * `enablePlace` postpone conditions). Without this, a child whose enablement is still settling —
@@ -14,9 +14,10 @@ export declare class PlaceDefinition {
14
14
  readonly redirectToFirstChild: boolean;
15
15
  readonly rememberLastChild: boolean;
16
16
  readonly navDepth: PlaceDefinition.NavDepth;
17
+ readonly redirectChild?: PlaceDefinition.RedirectChild;
17
18
  private _parent;
18
19
  readonly name: string;
19
- constructor(component: Constructable<PlaceComponent>, path: string, authenticate: boolean, role: any, data: Record<string, any>, routeParameters: ParameterDefinition<any>[], children: PlaceDefinition[], redirectToFirstChild: boolean, rememberLastChild: boolean, navDepth?: PlaceDefinition.NavDepth);
20
+ constructor(component: Constructable<PlaceComponent>, path: string, authenticate: boolean, role: any, data: Record<string, any>, routeParameters: ParameterDefinition<any>[], children: PlaceDefinition[], redirectToFirstChild: boolean, rememberLastChild: boolean, navDepth?: PlaceDefinition.NavDepth, redirectChild?: PlaceDefinition.RedirectChild);
20
21
  ancestors(): PlaceDefinition[];
21
22
  ancestorsAndSelf(): PlaceDefinition[];
22
23
  get placeId(): string;
@@ -47,6 +48,8 @@ export declare class PlaceDefinition {
47
48
  export declare namespace PlaceDefinition {
48
49
  /** See {@link Place.Options.navDepth}. */
49
50
  type NavDepth = 1 | 2;
51
+ /** See {@link Place.Options.redirectChild}. */
52
+ type RedirectChild = () => Constructable<PlaceComponent> | undefined | Promise<Constructable<PlaceComponent> | undefined>;
50
53
  interface ParameterOptions {
51
54
  includeRouteId?: boolean;
52
55
  includeRouteParameters?: boolean;
@@ -38,5 +38,14 @@ export declare namespace Place {
38
38
  * own, so it is always a single entry.
39
39
  */
40
40
  navDepth?: PlaceDefinition.NavDepth;
41
+ /**
42
+ * Picks the child {@link redirectToFirstChild} lands on, ahead of {@link rememberLastChild} and
43
+ * declaration order — for a parent whose right landing depends on application state rather than
44
+ * on child order. Runs in the place guard's injection context, so it can `inject()`. Returning
45
+ * undefined, or a child the user can't reach, falls back to the default choice.
46
+ *
47
+ * Only meaningful alongside `redirectToFirstChild: true`.
48
+ */
49
+ redirectChild?: PlaceDefinition.RedirectChild;
41
50
  }
42
51
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "16.1.0-alpha.290",
3
+ "version": "16.1.0-alpha.292",
4
4
  "peerDependencies": {
5
5
  "@angular/animations": "^16.2.9",
6
6
  "@angular/common": "^16.2.9",