1 | import { UIRouter, StateOrName, StateDeclaration, PathNode, UIRouterPluginBase, HookMatchCriteria, TransitionStateHookFn, HookRegOptions } from '@uirouter/core';
|
2 | declare module '@uirouter/core/lib/state/interface' {
|
3 | interface StateDeclaration {
|
4 | sticky?: boolean;
|
5 | onInactivate?: TransitionStateHookFn;
|
6 | onReactivate?: TransitionStateHookFn;
|
7 | }
|
8 | }
|
9 | declare module '@uirouter/core/lib/state/stateObject' {
|
10 | interface StateObject {
|
11 | sticky?: boolean;
|
12 | onInactivate?: TransitionStateHookFn;
|
13 | onReactivate?: TransitionStateHookFn;
|
14 | }
|
15 | }
|
16 | declare module '@uirouter/core/lib/transition/transitionService' {
|
17 | interface TransitionService {
|
18 | onInactivate: (criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions) => Function;
|
19 | onReactivate: (criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions) => Function;
|
20 | }
|
21 | }
|
22 | declare module '@uirouter/core/lib/transition/interface' {
|
23 | interface TransitionOptions {
|
24 | exitSticky?: StateOrName[] | StateOrName;
|
25 | }
|
26 | interface TreeChanges {
|
27 | inactivating?: PathNode[];
|
28 | reactivating?: PathNode[];
|
29 | }
|
30 | interface IMatchingNodes {
|
31 | inactivating: PathNode[];
|
32 | reactivating: PathNode[];
|
33 | }
|
34 | interface PathTypes {
|
35 | inactivating: PathType;
|
36 | reactivating: PathType;
|
37 | }
|
38 | interface HookMatchCriteria {
|
39 |
|
40 | inactivating?: HookMatchCriterion;
|
41 |
|
42 | reactivating?: HookMatchCriterion;
|
43 | }
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 | export declare class StickyStatesPlugin extends UIRouterPluginBase {
|
51 | router: UIRouter;
|
52 | name: string;
|
53 | private _inactives;
|
54 | private pluginAPI;
|
55 | constructor(router: UIRouter);
|
56 | inactives(): StateDeclaration[];
|
57 | private _addCreateHook;
|
58 | private _defineStickyPaths;
|
59 | private _defineStickyEvents;
|
60 | private _addStateCallbacks;
|
61 | private _calculateExitSticky;
|
62 | private _calculateStickyTreeChanges;
|
63 | private _addDefaultTransitionOption;
|
64 | /**
|
65 | * Exits inactive sticky state(s)
|
66 | *
|
67 | * #### Example:
|
68 | * ```js
|
69 | * $stickyState.exitSticky('inactivestate');
|
70 | * ```
|
71 | *
|
72 | * ```js
|
73 | * $stickyState.exitSticky([ 'inactivestate1', 'inactivestate2' ]);
|
74 | * ```
|
75 | *
|
76 | * ```js
|
77 | * // exit all inactive stickies
|
78 | * $stickyState.exitSticky();
|
79 | * ```
|
80 | *
|
81 | * ```js
|
82 | * // exit all inactive stickies
|
83 | * $stickyState.exitSticky($stickyState.inactives());
|
84 | * ```
|
85 | * @param states The state name, or an array of state names
|
86 | */
|
87 | exitSticky(): any;
|
88 | exitSticky(states: StateOrName): any;
|
89 | exitSticky(states: StateOrName[]): any;
|
90 | }
|