@coolon/angular-ui-powerups 16.1.0-alpha.273 → 16.1.0-alpha.274
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.
- package/esm2022/lib/place/components/abstract-place-navigation.component.mjs +31 -2
- package/esm2022/lib/place/components/tabbed-place-navigation/tabbed-place-navigation.component.mjs +4 -3
- package/esm2022/lib/place/guards/place.guard.mjs +31 -2
- package/esm2022/lib/place/navigation/session/pop-state-navigation.mjs +2 -2
- package/fesm2022/coolon-angular-ui-powerups.mjs +63 -5
- package/fesm2022/coolon-angular-ui-powerups.mjs.map +1 -1
- package/lib/place/components/abstract-place-navigation.component.d.ts +11 -2
- package/lib/place/guards/place.guard.d.ts +22 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TrackByFunction } from '@angular/core';
|
|
2
|
-
import { Command, Constructable, DelegatingValueModel, ListModel, ListModelChain, ValueModel } from '@coolon/pectin';
|
|
2
|
+
import { BooleanValueModelChain, Command, Constructable, DelegatingValueModel, ListModel, ListModelChain, ValueModel } from '@coolon/pectin';
|
|
3
3
|
import type { CommandFace } from '../../components/commands/command-face';
|
|
4
4
|
import { DisposableComponent } from '../../components/disposable-component';
|
|
5
5
|
import { PlaceComponent } from '../place-component';
|
|
@@ -17,8 +17,17 @@ export declare class AbstractPlaceNavigationComponent extends DisposableComponen
|
|
|
17
17
|
accessor places$: ListModel<Constructable<PlaceComponent>>;
|
|
18
18
|
accessor placeOutlet: PlaceOutletComponent;
|
|
19
19
|
accessor placeOutlet$: ValueModel<PlaceOutletComponent>;
|
|
20
|
+
accessor hideWhenSinglePlace$: ValueModel<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Hide the whole bar when it would render a single item: one tab is not a choice, so it reads as
|
|
23
|
+
* chrome rather than navigation. Off by default - a bar that has always shown one item keeps
|
|
24
|
+
* doing so until its consumer opts in.
|
|
25
|
+
*/
|
|
26
|
+
accessor hideWhenSinglePlace: boolean;
|
|
20
27
|
private readonly placeDefinitions;
|
|
21
28
|
readonly menuItems: ListModelChain<MenuItem>;
|
|
29
|
+
/** Whether the bar should render nothing at all - see {@link hideWhenSinglePlace}. */
|
|
30
|
+
readonly hidden$: BooleanValueModelChain;
|
|
22
31
|
readonly commandFactory: Command.Factory<PlaceDefinition, void>;
|
|
23
32
|
readonly _activePlaceComponent: DelegatingValueModel<PlaceComponent>;
|
|
24
33
|
private activePlaceDefinition;
|
|
@@ -30,6 +39,6 @@ export declare class AbstractPlaceNavigationComponent extends DisposableComponen
|
|
|
30
39
|
getNavigationFace(placeDef: PlaceDefinition): CommandFace;
|
|
31
40
|
private createCommandFaceFor;
|
|
32
41
|
static ɵfac: i0.ɵɵFactoryDeclaration<AbstractPlaceNavigationComponent, never>;
|
|
33
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<AbstractPlaceNavigationComponent, "ng-component", never, { "places": { "alias": "places"; "required": false; }; "places$": { "alias": "places$"; "required": false; }; "placeOutlet": { "alias": "placeOutlet"; "required": false; }; "placeOutlet$": { "alias": "placeOutlet$"; "required": false; }; }, {}, never, never, false, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AbstractPlaceNavigationComponent, "ng-component", never, { "places": { "alias": "places"; "required": false; }; "places$": { "alias": "places$"; "required": false; }; "placeOutlet": { "alias": "placeOutlet"; "required": false; }; "placeOutlet$": { "alias": "placeOutlet$"; "required": false; }; "hideWhenSinglePlace$": { "alias": "hideWhenSinglePlace$"; "required": false; }; "hideWhenSinglePlace": { "alias": "hideWhenSinglePlace"; "required": false; }; }, {}, never, never, false, never>;
|
|
34
43
|
}
|
|
35
44
|
export {};
|
|
@@ -42,6 +42,28 @@ export declare class PlaceGuard {
|
|
|
42
42
|
*/
|
|
43
43
|
private selectRedirectChild;
|
|
44
44
|
private findBestAuthenticatedAlternative;
|
|
45
|
+
/**
|
|
46
|
+
* A visit to the alternative place, carrying its ancestors' RESOLVED route parameters.
|
|
47
|
+
*
|
|
48
|
+
* `Visit.goto` builds a single, parameterless segment, and the url is then assembled from the
|
|
49
|
+
* destination's ancestorsAndSelf — so an ancestor holding a route id contributes an EMPTY id
|
|
50
|
+
* slot. That url is not merely wrong, it is unrepresentable: `groups//devices` collapses, and
|
|
51
|
+
* `groups/devices` binds the child's path into the id slot, navigating to a "group" called
|
|
52
|
+
* `devices` and eventually failing in `UrlSnapshot.appendSegment`. The user lands on `#/` with
|
|
53
|
+
* nothing explaining why. (`Visit.getRouterCommands` guards this case explicitly; the
|
|
54
|
+
* `createUrlSnapshot` path used for redirects does not, which is why it surfaced here.)
|
|
55
|
+
*
|
|
56
|
+
* The ancestors' ids are already resolved by the time we need them: guards run parent-first, so
|
|
57
|
+
* each ancestor's own pass has already sanitised its segment into the navigation session. Any
|
|
58
|
+
* ancestor without a stored segment falls back to a bare one, which is the pre-existing
|
|
59
|
+
* behaviour for a parameterless chain.
|
|
60
|
+
*
|
|
61
|
+
* Reached whenever a place is refused while a parameterised ancestor stays authorised — most
|
|
62
|
+
* often a DISABLED (`enablePlace`) child of a route-id parent, e.g. a feature-flagged tab
|
|
63
|
+
* reached by a stale deep link. Pure role gating rarely hits it, because a role usually gates a
|
|
64
|
+
* whole subtree rather than one child of a parameterised parent.
|
|
65
|
+
*/
|
|
66
|
+
private visitToAlternative;
|
|
45
67
|
canDeactivate(component: PlaceComponent, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Promise<boolean | UrlTree>;
|
|
46
68
|
private getPlaceDefinition;
|
|
47
69
|
private createUrlTree;
|