@luigi-project/core-modular 0.0.3 → 0.0.4
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/core-api/navigation.d.ts +26 -1
- package/luigi-engine.d.ts +6 -6
- package/luigi.js +33 -12
- package/luigi.js.map +1 -1
- package/modules/routing-module.d.ts +1 -1
- package/modules/ui-module.d.ts +3 -2
- package/package.json +1 -1
- package/services/modal.service.d.ts +1 -1
- package/services/navigation.service.d.ts +45 -176
- package/services/node-data-management.service.d.ts +1 -1
- package/services/routing.service.d.ts +4 -2
- package/types/connector.d.ts +1 -1
- package/types/navigation.d.ts +201 -0
- package/utilities/helpers/generic-helpers.d.ts +38 -0
- package/utilities/helpers/navigation-helpers.d.ts +7 -1
- package/utilities/helpers/routing-helpers.d.ts +37 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExternalLink, Node, PageErrorHandler } from '../services/navigation.service';
|
|
2
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
import { ExternalLink, Node, PageErrorHandler } from '../types/navigation';
|
|
3
3
|
export declare const RoutingModule: {
|
|
4
4
|
init: (luigi: Luigi) => void;
|
|
5
5
|
handlePageErrorHandler: (pageErrorHandler: PageErrorHandler, node: Node, luigi: Luigi) => void;
|
package/modules/ui-module.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
|
-
import { NavigationService
|
|
2
|
+
import { NavigationService } from '../services/navigation.service';
|
|
3
3
|
import { RoutingService } from '../services/routing.service';
|
|
4
|
+
import { ModalSettings } from '../types/navigation';
|
|
4
5
|
export declare const UIModule: {
|
|
5
6
|
navService: NavigationService;
|
|
6
7
|
routingService: RoutingService;
|
|
7
8
|
luigi: Luigi;
|
|
8
9
|
init: (luigi: Luigi) => void;
|
|
9
10
|
update: (scopes?: string[]) => Promise<void>;
|
|
10
|
-
updateMainContent: (currentNode: any, luigi: Luigi) => Promise<void>;
|
|
11
|
+
updateMainContent: (currentNode: any, luigi: Luigi, withoutSync?: boolean, preventContextUpdate?: boolean) => Promise<void>;
|
|
11
12
|
openModal: (luigi: Luigi, node: any, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
|
|
12
13
|
updateModalSettings: (modalSettings: ModalSettings, addHistoryEntry: boolean, luigi: Luigi) => void;
|
|
13
14
|
openDrawer: (luigi: Luigi, node: any, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,183 +1,13 @@
|
|
|
1
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
import { AppSwitcher, LeftNavData, NavigationOptions, NavigationRequestParams, NavItem, Node, PathData, TabNavData, TopNavData } from '../types/navigation';
|
|
2
3
|
import { NodeDataManagementService } from './node-data-management.service';
|
|
3
|
-
|
|
4
|
-
appTitle: string;
|
|
5
|
-
logo: string;
|
|
6
|
-
topNodes: NavItem[];
|
|
7
|
-
productSwitcher?: ProductSwitcher;
|
|
8
|
-
profile?: ProfileSettings;
|
|
9
|
-
appSwitcher?: AppSwitcher;
|
|
10
|
-
navClick?: (item: NavItem) => void;
|
|
11
|
-
}
|
|
12
|
-
export interface AppSwitcher {
|
|
13
|
-
showMainAppEntry?: boolean;
|
|
14
|
-
items?: AppSwitcherItem[];
|
|
15
|
-
itemRenderer?: (item: AppSwitcherItem, slot: HTMLElement, appSwitcherApiObj?: any) => void;
|
|
16
|
-
}
|
|
17
|
-
export interface AppSwitcherItem {
|
|
18
|
-
title?: string;
|
|
19
|
-
subtitle?: string;
|
|
20
|
-
link?: string;
|
|
21
|
-
selectionConditions?: selectionConditions;
|
|
22
|
-
}
|
|
23
|
-
export interface selectionConditions {
|
|
24
|
-
route?: string;
|
|
25
|
-
contextCriteria?: ContextCriteria[];
|
|
26
|
-
}
|
|
27
|
-
export interface ContextCriteria {
|
|
28
|
-
key: string;
|
|
29
|
-
value: string;
|
|
30
|
-
}
|
|
31
|
-
export interface ProfileSettings {
|
|
32
|
-
authEnabled: boolean;
|
|
33
|
-
signedIn: boolean;
|
|
34
|
-
logout: ProfileLogout;
|
|
35
|
-
items?: ProfileItem[];
|
|
36
|
-
staticUserInfoFn?: () => Promise<UserInfo>;
|
|
37
|
-
onUserInfoUpdate: (fn: (uInfo: UserInfo) => void) => void;
|
|
38
|
-
itemClick: (item: ProfileItem) => void;
|
|
39
|
-
}
|
|
40
|
-
export interface ProfileLogout {
|
|
41
|
-
label?: string;
|
|
42
|
-
icon?: string;
|
|
43
|
-
testId?: string;
|
|
44
|
-
altText?: string;
|
|
45
|
-
doLogout: () => void;
|
|
46
|
-
}
|
|
47
|
-
export interface ProfileItem {
|
|
48
|
-
label?: string;
|
|
49
|
-
link?: string;
|
|
50
|
-
externalLink?: ExternalLink;
|
|
51
|
-
icon?: string;
|
|
52
|
-
testId?: string;
|
|
53
|
-
altText?: string;
|
|
54
|
-
openNodeInModal?: boolean | ModalSettings;
|
|
55
|
-
}
|
|
56
|
-
export interface UserInfo {
|
|
57
|
-
name?: string;
|
|
58
|
-
initials?: string;
|
|
59
|
-
email?: string;
|
|
60
|
-
picture?: string;
|
|
61
|
-
description?: string;
|
|
62
|
-
}
|
|
63
|
-
export interface LeftNavData {
|
|
64
|
-
selectedNode: any;
|
|
65
|
-
items: NavItem[];
|
|
66
|
-
basePath: string;
|
|
67
|
-
sideNavFooterText?: string;
|
|
68
|
-
navClick?: (item: NavItem) => void;
|
|
69
|
-
}
|
|
70
|
-
export interface PathData {
|
|
71
|
-
selectedNode?: Node;
|
|
72
|
-
selectedNodeChildren?: Node[];
|
|
73
|
-
nodesInPath?: Node[];
|
|
74
|
-
rootNodes: Node[];
|
|
75
|
-
pathParams: Record<string, any>;
|
|
76
|
-
}
|
|
77
|
-
export interface RootNode {
|
|
78
|
-
node: Node;
|
|
79
|
-
}
|
|
80
|
-
export interface Node {
|
|
81
|
-
altText?: string;
|
|
82
|
-
anonymousAccess?: any;
|
|
83
|
-
badgeCounter?: {
|
|
84
|
-
count?: () => number | Promise<number>;
|
|
85
|
-
label?: string;
|
|
86
|
-
};
|
|
87
|
-
category?: any;
|
|
88
|
-
children?: Node[];
|
|
89
|
-
clientPermissions?: {
|
|
90
|
-
changeCurrentLocale?: boolean;
|
|
91
|
-
urlParameters?: Record<string, any>;
|
|
92
|
-
};
|
|
93
|
-
context?: Record<string, any>;
|
|
94
|
-
drawer?: ModalSettings;
|
|
95
|
-
externalLink?: ExternalLink;
|
|
96
|
-
hideFromNav?: boolean;
|
|
97
|
-
hideSideNav?: boolean;
|
|
98
|
-
icon?: string;
|
|
99
|
-
isRootNode?: boolean;
|
|
100
|
-
keepSelectedForChildren?: boolean;
|
|
101
|
-
label?: string;
|
|
102
|
-
onNodeActivation?: (node: Node) => boolean | void;
|
|
103
|
-
openNodeInModal?: boolean;
|
|
104
|
-
pageErrorHandler?: PageErrorHandler;
|
|
105
|
-
parent?: Node;
|
|
106
|
-
pathSegment?: string;
|
|
107
|
-
runTimeErrorHandler?: RunTimeErrorHandler;
|
|
108
|
-
tabNav?: boolean;
|
|
109
|
-
tooltipText?: string;
|
|
110
|
-
viewUrl?: string;
|
|
111
|
-
visibleForFeatureToggles?: string[];
|
|
112
|
-
}
|
|
113
|
-
export interface PageErrorHandler {
|
|
114
|
-
timeout: number;
|
|
115
|
-
viewUrl?: string;
|
|
116
|
-
redirectPath?: string;
|
|
117
|
-
errorFn?: (node?: Node) => void;
|
|
118
|
-
}
|
|
119
|
-
export interface RunTimeErrorHandler {
|
|
120
|
-
errorFn?: (error: object, node?: Node) => void;
|
|
121
|
-
}
|
|
122
|
-
export interface Category {
|
|
123
|
-
altText?: string;
|
|
124
|
-
collapsible?: boolean;
|
|
125
|
-
icon?: string;
|
|
126
|
-
id: string;
|
|
127
|
-
isGroup?: boolean;
|
|
128
|
-
label?: string;
|
|
129
|
-
nodes?: NavItem[];
|
|
130
|
-
tooltip?: string;
|
|
131
|
-
}
|
|
132
|
-
export interface NavItem {
|
|
133
|
-
altText?: string;
|
|
134
|
-
category?: Category;
|
|
135
|
-
icon?: string;
|
|
136
|
-
node?: Node;
|
|
137
|
-
label?: string;
|
|
138
|
-
selected?: boolean;
|
|
139
|
-
tooltip?: string;
|
|
140
|
-
}
|
|
141
|
-
export interface TabNavData {
|
|
142
|
-
selectedNode?: any;
|
|
143
|
-
items?: NavItem[];
|
|
144
|
-
basePath?: string;
|
|
145
|
-
navClick?: (item: NavItem) => void;
|
|
146
|
-
}
|
|
147
|
-
export interface ModalSettings {
|
|
148
|
-
size?: 'fullscreen' | 'l' | 'm' | 's';
|
|
149
|
-
width?: string;
|
|
150
|
-
height?: string;
|
|
151
|
-
title?: string;
|
|
152
|
-
closebtn_data_testid?: string;
|
|
153
|
-
keepPrevious?: boolean;
|
|
154
|
-
}
|
|
155
|
-
export interface ProductSwitcher {
|
|
156
|
-
altText?: string;
|
|
157
|
-
columns?: number;
|
|
158
|
-
icon?: string;
|
|
159
|
-
items?: [ProductSwitcherItem];
|
|
160
|
-
label?: string;
|
|
161
|
-
testId?: string;
|
|
162
|
-
}
|
|
163
|
-
export interface ProductSwitcherItem {
|
|
164
|
-
altText?: string;
|
|
165
|
-
externalLink?: ExternalLink;
|
|
166
|
-
icon?: string;
|
|
167
|
-
label?: string;
|
|
168
|
-
link?: string;
|
|
169
|
-
selected?: boolean;
|
|
170
|
-
subTitle?: string;
|
|
171
|
-
testId?: string;
|
|
172
|
-
}
|
|
173
|
-
export interface ExternalLink {
|
|
174
|
-
url?: string;
|
|
175
|
-
sameWindow?: boolean;
|
|
176
|
-
}
|
|
4
|
+
import { ModalService } from './modal.service';
|
|
177
5
|
export declare class NavigationService {
|
|
178
6
|
private luigi;
|
|
7
|
+
modalService?: ModalService;
|
|
179
8
|
nodeDataManagementService?: NodeDataManagementService;
|
|
180
9
|
constructor(luigi: Luigi);
|
|
10
|
+
private getModalService;
|
|
181
11
|
private getNodeDataManagementService;
|
|
182
12
|
getPathData(path: string): Promise<PathData>;
|
|
183
13
|
findMatchingNode(urlPathElement: string, nodes: Node[]): Node | undefined;
|
|
@@ -196,7 +26,7 @@ export declare class NavigationService {
|
|
|
196
26
|
getTruncatedChildren(children: any): any[];
|
|
197
27
|
applyNavGroups(items: NavItem[]): NavItem[];
|
|
198
28
|
getLeftNavData(path: string, pData?: PathData): Promise<LeftNavData>;
|
|
199
|
-
navItemClick(
|
|
29
|
+
navItemClick(node: Node, pathData?: PathData): void;
|
|
200
30
|
getTopNavData(path: string, pData?: PathData): Promise<TopNavData>;
|
|
201
31
|
getParentNode(node: Node | undefined, pathData: PathData): Node | undefined;
|
|
202
32
|
getAppSwitcherData(appSwitcherData: AppSwitcher, headerSettings: any): AppSwitcher | undefined;
|
|
@@ -234,8 +64,47 @@ export declare class NavigationService {
|
|
|
234
64
|
private resolveTooltipText;
|
|
235
65
|
private prepareRootNodes;
|
|
236
66
|
private getAccessibleNodes;
|
|
237
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Deal with route changing scenario.
|
|
69
|
+
* @param {NavigationRequestParams} params - the params to configure navigation request
|
|
70
|
+
* @param {string} params.path - the path of the view to open
|
|
71
|
+
* @param {string} params.preserveView - preserve a view by setting it to specific value (optional)
|
|
72
|
+
* @param {any} params.modalSettings - settings to configure the modal's title and size (optional)
|
|
73
|
+
* @param {boolean} params.newTab - open a view in new tab by setting it to `true` (optional)
|
|
74
|
+
* @param {boolean} params.withoutSync - disables the navigation handling for a single navigation request (optional)
|
|
75
|
+
* @param {boolean} params.preventContextUpdate - make no context update being triggered; default is false (optional)
|
|
76
|
+
* @param {boolean} params.preventHistoryEntry - make no history update being triggered; default is false (optional)
|
|
77
|
+
* @param {any} callbackFn - callback to be triggered after opening view as modal (optional)
|
|
78
|
+
*/
|
|
79
|
+
handleNavigationRequest(params: NavigationRequestParams, callbackFn?: any): Promise<void>;
|
|
238
80
|
getChildren(node: Node | undefined, context?: Record<string, any>): Promise<Node[]>;
|
|
239
81
|
getExpandStructuralPathSegment(node: Node): Node;
|
|
240
82
|
bindChildToParent(child: Node, node: Node): Node;
|
|
83
|
+
/**
|
|
84
|
+
* Builds a virtual tree structure for the given node based on the provided path parameters.
|
|
85
|
+
*
|
|
86
|
+
* @param node - The node for which the virtual tree is being built.
|
|
87
|
+
* @param nodesInPath - An array of nodes representing the path in the virtual tree.
|
|
88
|
+
* @param pathParams - An object containing path parameters for the virtual tree.
|
|
89
|
+
*/
|
|
90
|
+
buildVirtualTree(node: Node, segment: any, pathParams: Record<string, any>): Node[] | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Requires str to include :virtualPath
|
|
93
|
+
* and pathParams consist of :virtualSegment_N
|
|
94
|
+
* for deep nested virtual tree building
|
|
95
|
+
*
|
|
96
|
+
* @param str - The base string for the virtual view URL.
|
|
97
|
+
* @param pathParams - An object containing path parameters for the virtual view URL.
|
|
98
|
+
* @param _virtualPathIndex - The index of the virtual path segment.
|
|
99
|
+
* @returns The constructed virtual view URL string.
|
|
100
|
+
*/
|
|
101
|
+
buildVirtualViewUrl(str: string, pathParams: any, _virtualPathIndex: number): string;
|
|
102
|
+
/**
|
|
103
|
+
* Builds a path string by concatenating path segments from the virtual tree root or the incoming path.
|
|
104
|
+
*
|
|
105
|
+
* @param incomingPath - The incoming path segment to be appended.
|
|
106
|
+
* @param fromVirtualTreeRoot - A boolean indicating whether to build the path from the virtual tree root.
|
|
107
|
+
* @returns The constructed path string.
|
|
108
|
+
*/
|
|
109
|
+
buildPath(incomingPath: string, options: NavigationOptions): Promise<string>;
|
|
241
110
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
|
-
import { ModalSettings, Node, PathData
|
|
2
|
+
import { ModalSettings, Node, PathData } from '../types/navigation';
|
|
3
|
+
import { NavigationService } from './navigation.service';
|
|
3
4
|
export interface Route {
|
|
4
5
|
raw: string;
|
|
5
6
|
node?: Node;
|
|
@@ -39,12 +40,13 @@ export declare class RoutingService {
|
|
|
39
40
|
* Deal with route changing scenario.
|
|
40
41
|
* @param {Object} routeInfo - the information about path and query
|
|
41
42
|
* @param {boolean} withoutSync - disables the navigation handling for a single navigation request
|
|
43
|
+
* @param {boolean} preventContextUpdate - make no context update being triggered
|
|
42
44
|
* @returns {Promise<void>} A promise that resolves when route change is complete.
|
|
43
45
|
*/
|
|
44
46
|
handleRouteChange(routeInfo: {
|
|
45
47
|
path: string;
|
|
46
48
|
query: string;
|
|
47
|
-
}, withoutSync?: boolean): Promise<void>;
|
|
49
|
+
}, withoutSync?: boolean, preventContextUpdate?: boolean): Promise<void>;
|
|
48
50
|
getCurrentRoute(): Route | undefined;
|
|
49
51
|
/**
|
|
50
52
|
* If `showModalPathInUrl` is provided, bookmarkable modal path will be triggered.
|
package/types/connector.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ModalSettings, LeftNavData, Node, TopNavData, TabNavData } from '../services/navigation.service';
|
|
2
1
|
import { AlertHandler, AlertSettings, ConfirmationModalHandler, ConfirmationModalSettings, UserSettings } from '../modules/ux-module';
|
|
2
|
+
import { ModalSettings, LeftNavData, Node, TopNavData, TabNavData } from './navigation';
|
|
3
3
|
export interface LuigiConnector {
|
|
4
4
|
renderMainLayout(): void;
|
|
5
5
|
renderTopNav(data: TopNavData): void;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
export interface TopNavData {
|
|
2
|
+
appTitle: string;
|
|
3
|
+
logo: string;
|
|
4
|
+
topNodes: NavItem[];
|
|
5
|
+
productSwitcher?: ProductSwitcher;
|
|
6
|
+
profile?: ProfileSettings;
|
|
7
|
+
appSwitcher?: AppSwitcher;
|
|
8
|
+
navClick?: (item: NavItem) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface AppSwitcher {
|
|
11
|
+
showMainAppEntry?: boolean;
|
|
12
|
+
items?: AppSwitcherItem[];
|
|
13
|
+
itemRenderer?: (item: AppSwitcherItem, slot: HTMLElement, appSwitcherApiObj?: any) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface AppSwitcherItem {
|
|
16
|
+
title?: string;
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
link?: string;
|
|
19
|
+
selectionConditions?: selectionConditions;
|
|
20
|
+
}
|
|
21
|
+
export interface selectionConditions {
|
|
22
|
+
route?: string;
|
|
23
|
+
contextCriteria?: ContextCriteria[];
|
|
24
|
+
}
|
|
25
|
+
export interface ContextCriteria {
|
|
26
|
+
key: string;
|
|
27
|
+
value: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ProfileSettings {
|
|
30
|
+
authEnabled: boolean;
|
|
31
|
+
signedIn: boolean;
|
|
32
|
+
logout: ProfileLogout;
|
|
33
|
+
items?: ProfileItem[];
|
|
34
|
+
staticUserInfoFn?: () => Promise<UserInfo>;
|
|
35
|
+
onUserInfoUpdate: (fn: (uInfo: UserInfo) => void) => void;
|
|
36
|
+
itemClick: (item: ProfileItem) => void;
|
|
37
|
+
}
|
|
38
|
+
export interface ProfileLogout {
|
|
39
|
+
label?: string;
|
|
40
|
+
icon?: string;
|
|
41
|
+
testId?: string;
|
|
42
|
+
altText?: string;
|
|
43
|
+
doLogout: () => void;
|
|
44
|
+
}
|
|
45
|
+
export interface ProfileItem {
|
|
46
|
+
label?: string;
|
|
47
|
+
link?: string;
|
|
48
|
+
externalLink?: ExternalLink;
|
|
49
|
+
icon?: string;
|
|
50
|
+
testId?: string;
|
|
51
|
+
altText?: string;
|
|
52
|
+
openNodeInModal?: boolean | ModalSettings;
|
|
53
|
+
}
|
|
54
|
+
export interface UserInfo {
|
|
55
|
+
name?: string;
|
|
56
|
+
initials?: string;
|
|
57
|
+
email?: string;
|
|
58
|
+
picture?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface LeftNavData {
|
|
62
|
+
selectedNode: any;
|
|
63
|
+
items: NavItem[];
|
|
64
|
+
basePath: string;
|
|
65
|
+
sideNavFooterText?: string;
|
|
66
|
+
navClick?: (item: NavItem) => void;
|
|
67
|
+
}
|
|
68
|
+
export interface PathData {
|
|
69
|
+
selectedNode?: Node;
|
|
70
|
+
selectedNodeChildren?: Node[];
|
|
71
|
+
nodesInPath?: Node[];
|
|
72
|
+
rootNodes: Node[];
|
|
73
|
+
pathParams: Record<string, any>;
|
|
74
|
+
}
|
|
75
|
+
export interface RootNode {
|
|
76
|
+
node: Node;
|
|
77
|
+
}
|
|
78
|
+
export interface Node {
|
|
79
|
+
altText?: string;
|
|
80
|
+
anonymousAccess?: any;
|
|
81
|
+
badgeCounter?: {
|
|
82
|
+
count?: () => number | Promise<number>;
|
|
83
|
+
label?: string;
|
|
84
|
+
};
|
|
85
|
+
category?: any;
|
|
86
|
+
children?: Node[];
|
|
87
|
+
clientPermissions?: {
|
|
88
|
+
changeCurrentLocale?: boolean;
|
|
89
|
+
urlParameters?: Record<string, any>;
|
|
90
|
+
};
|
|
91
|
+
context?: Record<string, any>;
|
|
92
|
+
drawer?: ModalSettings;
|
|
93
|
+
externalLink?: ExternalLink;
|
|
94
|
+
hideFromNav?: boolean;
|
|
95
|
+
hideSideNav?: boolean;
|
|
96
|
+
icon?: string;
|
|
97
|
+
isRootNode?: boolean;
|
|
98
|
+
keepSelectedForChildren?: boolean;
|
|
99
|
+
label?: string;
|
|
100
|
+
navigationContext?: string;
|
|
101
|
+
onNodeActivation?: (node: Node) => boolean | void;
|
|
102
|
+
openNodeInModal?: boolean;
|
|
103
|
+
pageErrorHandler?: PageErrorHandler;
|
|
104
|
+
parent?: Node;
|
|
105
|
+
pathSegment?: string;
|
|
106
|
+
runTimeErrorHandler?: RunTimeErrorHandler;
|
|
107
|
+
tabNav?: boolean;
|
|
108
|
+
tooltipText?: string;
|
|
109
|
+
viewUrl?: string;
|
|
110
|
+
visibleForFeatureToggles?: string[];
|
|
111
|
+
virtualTree?: boolean;
|
|
112
|
+
_virtualTree?: Node;
|
|
113
|
+
_virtualPathIndex?: number;
|
|
114
|
+
_virtualViewUrl?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface PageErrorHandler {
|
|
117
|
+
timeout: number;
|
|
118
|
+
viewUrl?: string;
|
|
119
|
+
redirectPath?: string;
|
|
120
|
+
errorFn?: (node?: Node) => void;
|
|
121
|
+
}
|
|
122
|
+
export interface RunTimeErrorHandler {
|
|
123
|
+
errorFn?: (error: object, node?: Node) => void;
|
|
124
|
+
}
|
|
125
|
+
export interface Category {
|
|
126
|
+
altText?: string;
|
|
127
|
+
collapsible?: boolean;
|
|
128
|
+
icon?: string;
|
|
129
|
+
id: string;
|
|
130
|
+
isGroup?: boolean;
|
|
131
|
+
label?: string;
|
|
132
|
+
nodes?: NavItem[];
|
|
133
|
+
tooltip?: string;
|
|
134
|
+
}
|
|
135
|
+
export interface NavItem {
|
|
136
|
+
altText?: string;
|
|
137
|
+
category?: Category;
|
|
138
|
+
icon?: string;
|
|
139
|
+
node?: Node;
|
|
140
|
+
label?: string;
|
|
141
|
+
selected?: boolean;
|
|
142
|
+
tooltip?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface TabNavData {
|
|
145
|
+
selectedNode?: any;
|
|
146
|
+
items?: NavItem[];
|
|
147
|
+
basePath?: string;
|
|
148
|
+
navClick?: (item: NavItem) => void;
|
|
149
|
+
}
|
|
150
|
+
export interface ModalSettings {
|
|
151
|
+
size?: 'fullscreen' | 'l' | 'm' | 's';
|
|
152
|
+
width?: string;
|
|
153
|
+
height?: string;
|
|
154
|
+
title?: string;
|
|
155
|
+
closebtn_data_testid?: string;
|
|
156
|
+
keepPrevious?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface ProductSwitcher {
|
|
159
|
+
altText?: string;
|
|
160
|
+
columns?: number;
|
|
161
|
+
icon?: string;
|
|
162
|
+
items?: [ProductSwitcherItem];
|
|
163
|
+
label?: string;
|
|
164
|
+
testId?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface ProductSwitcherItem {
|
|
167
|
+
altText?: string;
|
|
168
|
+
externalLink?: ExternalLink;
|
|
169
|
+
icon?: string;
|
|
170
|
+
label?: string;
|
|
171
|
+
link?: string;
|
|
172
|
+
selected?: boolean;
|
|
173
|
+
subTitle?: string;
|
|
174
|
+
testId?: string;
|
|
175
|
+
}
|
|
176
|
+
export interface ExternalLink {
|
|
177
|
+
url?: string;
|
|
178
|
+
sameWindow?: boolean;
|
|
179
|
+
}
|
|
180
|
+
export interface NavigationOptions {
|
|
181
|
+
fromContext?: any;
|
|
182
|
+
fromClosestContext?: boolean;
|
|
183
|
+
fromVirtualTreeRoot?: boolean;
|
|
184
|
+
fromParent?: boolean;
|
|
185
|
+
}
|
|
186
|
+
export interface NavigationRequestBase {
|
|
187
|
+
preventContextUpdate?: boolean;
|
|
188
|
+
preventHistoryEntry?: boolean;
|
|
189
|
+
withoutSync?: boolean;
|
|
190
|
+
options?: NavigationOptions;
|
|
191
|
+
}
|
|
192
|
+
export interface NavigationRequestParams extends NavigationRequestBase {
|
|
193
|
+
modalSettings?: any;
|
|
194
|
+
newTab?: boolean;
|
|
195
|
+
path: string;
|
|
196
|
+
preserveView?: string;
|
|
197
|
+
}
|
|
198
|
+
export interface NavigationRequestEvent {
|
|
199
|
+
detail: NavigationRequestBase;
|
|
200
|
+
}
|
|
201
|
+
export type HistoryMethod = 'pushState' | 'replaceState';
|
|
@@ -81,4 +81,42 @@ export declare const GenericHelpers: {
|
|
|
81
81
|
*/
|
|
82
82
|
getConfigBooleanValue: (object: Record<string, any>, property: string) => boolean;
|
|
83
83
|
getUrlParameter: (key: string) => string | null;
|
|
84
|
+
/**
|
|
85
|
+
* Returns a new Object with the same object,
|
|
86
|
+
* without the keys that were given.
|
|
87
|
+
* References still stay.
|
|
88
|
+
* Allows wildcard ending keys
|
|
89
|
+
*
|
|
90
|
+
* @param {Object} input - any given object
|
|
91
|
+
* @param {Array} keys - allows also wildcards at the end, like: _*
|
|
92
|
+
*/
|
|
93
|
+
removeProperties(input: Record<string, any>, keys: any[]): Record<string, any>;
|
|
94
|
+
/**
|
|
95
|
+
* Replaces variables in the input string with the values from the params object. Variables are defined with a prefix and wrapped in curly braces, e.g. {i18n.key} or {config.key}.
|
|
96
|
+
* If the variable is not found in the params object, it will be removed from the string.
|
|
97
|
+
* @param inputString
|
|
98
|
+
* @param params
|
|
99
|
+
* @param prefix
|
|
100
|
+
* @param parenthesis
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
replaceVars(inputString: string, params: Record<string, any>, prefix: string, parenthesis?: boolean): string;
|
|
104
|
+
/**
|
|
105
|
+
* Escapes special characters in a string for use in a regular expression.
|
|
106
|
+
* @param string
|
|
107
|
+
* @returns
|
|
108
|
+
*/
|
|
109
|
+
escapeRegExp(string: string): string;
|
|
110
|
+
/**
|
|
111
|
+
* Checks if a given input string begins with a hash or a slash
|
|
112
|
+
* @param {string} path
|
|
113
|
+
* @returns {boolean}
|
|
114
|
+
*/
|
|
115
|
+
hasHashOrSlash: (path: string) => boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Removes leading hash or slash of a string
|
|
118
|
+
* @param {string} path
|
|
119
|
+
* @returns {string}
|
|
120
|
+
*/
|
|
121
|
+
getPathWithoutHashOrSlash: (path: string) => string;
|
|
84
122
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FeatureToggles } from '../../core-api/feature-toggles';
|
|
2
2
|
import { Luigi } from '../../core-api/luigi';
|
|
3
|
-
import { AppSwitcher, Node, PathData } from '../../
|
|
3
|
+
import { AppSwitcher, Node, PathData } from '../../types/navigation';
|
|
4
4
|
export declare const NavigationHelpers: {
|
|
5
5
|
normalizePath: (raw: string) => string;
|
|
6
6
|
segmentMatches: (linkSegment: string, pathSegment: string, pathParams: Record<string, any>) => boolean;
|
|
@@ -12,4 +12,10 @@ export declare const NavigationHelpers: {
|
|
|
12
12
|
buildPath(pathToLeftNavParent: Node[], pathData?: PathData): string;
|
|
13
13
|
mergeContext(...objs: Record<string, any>[]): Record<string, any>;
|
|
14
14
|
prepareForTests(...parts: string[]): string;
|
|
15
|
+
/**
|
|
16
|
+
* Finds the virtual tree root node for a given node by traversing up the node hierarchy until it finds a node with the virtualTree property set to true. If no such node is found, it returns undefined.
|
|
17
|
+
* @param node The node for which to find the virtual tree root node.
|
|
18
|
+
* @returns The virtual tree root node if found, otherwise undefined.
|
|
19
|
+
*/
|
|
20
|
+
findVirtualTreeRootNode(node: Node): Node | undefined;
|
|
15
21
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FeatureToggles } from '../../core-api/feature-toggles';
|
|
2
2
|
import { Luigi } from '../../core-api/luigi';
|
|
3
|
-
import { Node, PathData } from '../../
|
|
3
|
+
import { Node, PathData } from '../../types/navigation';
|
|
4
4
|
export declare const RoutingHelpers: {
|
|
5
5
|
defaultContentViewParamPrefix: string;
|
|
6
6
|
defaultQueryParamSeparator: string;
|
|
@@ -262,4 +262,40 @@ export declare const RoutingHelpers: {
|
|
|
262
262
|
* @param {*} pathParams
|
|
263
263
|
*/
|
|
264
264
|
getDynamicNodeValue(node: Node, pathParams: Record<string, string>): string | undefined;
|
|
265
|
+
/**
|
|
266
|
+
* Recursively constructs the full path for a given node by concatenating its path segment with those of its ancestors.
|
|
267
|
+
* If `params` are provided, they are appended as query parameters to the final path.
|
|
268
|
+
* @param node - The node for which to construct the path. It is expected to have a `pathSegment` property and optionally a `parent` property pointing to its parent node.
|
|
269
|
+
* @param params - Optional query parameters to append to the path. If provided, it should be a string in the format of URL query parameters (e.g., "key=value&anotherKey=anotherValue").
|
|
270
|
+
* @returns The constructed path as a string, including any query parameters if provided.
|
|
271
|
+
*/
|
|
272
|
+
getNodePath(node: Node, params?: string): string;
|
|
273
|
+
/**
|
|
274
|
+
* Builds a route string by recursively traversing up the node hierarchy and concatenating path segments.
|
|
275
|
+
* @param node - The current node from which to start building the route.
|
|
276
|
+
* @param path - The accumulated path string (used internally for recursion).
|
|
277
|
+
* @param params - Optional query parameters to append to the final route.
|
|
278
|
+
* @returns a string representing the full route from the root to the given node, including query parameters if provided.
|
|
279
|
+
*/
|
|
280
|
+
buildRoute(node: Node, path: string, params?: string): string;
|
|
281
|
+
substituteViewUrl(viewUrl: string, pathParams: Record<string, string>, luigi: Luigi): string;
|
|
282
|
+
/**
|
|
283
|
+
* Generates a sub-path for a given node by replacing dynamic parameters in the node's path with actual values from pathParams.
|
|
284
|
+
* @param node - The node for which to generate the sub-path. It is expected to have a `pathSegment` property and optionally a `parent` property pointing to its parent node.
|
|
285
|
+
* @param nodePathParams - An object containing the values for dynamic parameters in the node's path. The keys should match the parameter names in the path segments.
|
|
286
|
+
* @returns A string representing the sub-path with dynamic parameters replaced by their corresponding values from pathParams.
|
|
287
|
+
*/
|
|
288
|
+
getSubPath(node: any, nodePathParams: any): string;
|
|
289
|
+
/**
|
|
290
|
+
* Concatenates a base path and a relative path
|
|
291
|
+
*
|
|
292
|
+
* The function performs the following steps:
|
|
293
|
+
* 1. Removes any trailing '/' from the base path.
|
|
294
|
+
* 2. If the relative path does not start with '/', it adds a '/' between the base and relative paths.
|
|
295
|
+
* 3. Concatenates the base path and the relative path.
|
|
296
|
+
* @param basePath The base path to which the relative path will be appended. It may or may not end with a '/' character.
|
|
297
|
+
* @param relativePath The relative path to append to the base path. It may or may not start with a '/' character.
|
|
298
|
+
* @returns A string representing the concatenated path, with exactly one '/' character between the base and relative paths.
|
|
299
|
+
*/
|
|
300
|
+
concatenatePath(basePath: any, relativePath?: any): string;
|
|
265
301
|
};
|