@luigi-project/core-modular 0.0.1 → 0.0.2
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/luigi.d.ts +7 -3
- package/core-api/navigation.d.ts +3 -2
- package/luigi-engine.d.ts +2 -2
- package/luigi.js +4 -4
- package/luigi.js.map +1 -1
- package/modules/routing-module.d.ts +1 -1
- package/modules/ui-module.d.ts +1 -1
- package/package.json +1 -1
- package/services/navigation.service.d.ts +41 -13
- package/services/node-data-management.service.d.ts +3 -3
- package/services/routing.service.d.ts +10 -2
- package/utilities/helpers/config-helpers.d.ts +3 -1
- package/utilities/helpers/generic-helpers.d.ts +6 -0
- package/utilities/helpers/routing-helpers.d.ts +11 -0
- package/utilities/lifecycle-hooks.d.ts +4 -0
|
@@ -14,5 +14,5 @@ export declare const RoutingModule: {
|
|
|
14
14
|
* @param keepBrowserHistory - If `true`, the browser history will be preserved when updating the URL.
|
|
15
15
|
* @param luigi - The Luigi core instance used to interact with the routing API.
|
|
16
16
|
*/
|
|
17
|
-
addSearchParamsFromClient(searchParams: Record<string, any>, keepBrowserHistory: boolean, luigi: Luigi): void
|
|
17
|
+
addSearchParamsFromClient(searchParams: Record<string, any>, keepBrowserHistory: boolean, luigi: Luigi): Promise<void>;
|
|
18
18
|
};
|
package/modules/ui-module.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const UIModule: {
|
|
|
6
6
|
routingService: RoutingService;
|
|
7
7
|
luigi: Luigi;
|
|
8
8
|
init: (luigi: Luigi) => void;
|
|
9
|
-
update: (scopes?: string[]) => void
|
|
9
|
+
update: (scopes?: string[]) => Promise<void>;
|
|
10
10
|
updateMainContent: (currentNode: any, luigi: Luigi) => Promise<void>;
|
|
11
11
|
openModal: (luigi: Luigi, node: any, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
|
|
12
12
|
updateModalSettings: (modalSettings: ModalSettings, addHistoryEntry: boolean, luigi: Luigi) => void;
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
import { NodeDataManagementService } from './node-data-management.service';
|
|
2
3
|
export interface TopNavData {
|
|
3
4
|
appTitle: string;
|
|
4
5
|
logo: string;
|
|
@@ -50,7 +51,7 @@ export interface ProfileItem {
|
|
|
50
51
|
icon?: string;
|
|
51
52
|
testId?: string;
|
|
52
53
|
altText?: string;
|
|
53
|
-
|
|
54
|
+
openNodeInModal?: boolean | ModalSettings;
|
|
54
55
|
}
|
|
55
56
|
export interface UserInfo {
|
|
56
57
|
name?: string;
|
|
@@ -73,9 +74,16 @@ export interface PathData {
|
|
|
73
74
|
rootNodes: Node[];
|
|
74
75
|
pathParams: Record<string, any>;
|
|
75
76
|
}
|
|
77
|
+
export interface RootNode {
|
|
78
|
+
node: Node;
|
|
79
|
+
}
|
|
76
80
|
export interface Node {
|
|
77
|
-
|
|
81
|
+
altText?: string;
|
|
78
82
|
anonymousAccess?: any;
|
|
83
|
+
badgeCounter?: {
|
|
84
|
+
count?: () => number | Promise<number>;
|
|
85
|
+
label?: string;
|
|
86
|
+
};
|
|
79
87
|
category?: any;
|
|
80
88
|
children?: Node[];
|
|
81
89
|
clientPermissions?: {
|
|
@@ -88,16 +96,19 @@ export interface Node {
|
|
|
88
96
|
hideFromNav?: boolean;
|
|
89
97
|
hideSideNav?: boolean;
|
|
90
98
|
icon?: string;
|
|
99
|
+
isRootNode?: boolean;
|
|
91
100
|
keepSelectedForChildren?: boolean;
|
|
92
101
|
label?: string;
|
|
93
102
|
onNodeActivation?: (node: Node) => boolean | void;
|
|
94
103
|
openNodeInModal?: boolean;
|
|
95
104
|
pageErrorHandler?: PageErrorHandler;
|
|
105
|
+
parent?: Node;
|
|
96
106
|
pathSegment?: string;
|
|
107
|
+
runTimeErrorHandler?: RunTimeErrorHandler;
|
|
97
108
|
tabNav?: boolean;
|
|
98
|
-
|
|
109
|
+
tooltipText?: string;
|
|
99
110
|
viewUrl?: string;
|
|
100
|
-
|
|
111
|
+
visibleForFeatureToggles?: string[];
|
|
101
112
|
}
|
|
102
113
|
export interface PageErrorHandler {
|
|
103
114
|
timeout: number;
|
|
@@ -105,8 +116,12 @@ export interface PageErrorHandler {
|
|
|
105
116
|
redirectPath?: string;
|
|
106
117
|
errorFn?: (node?: Node) => void;
|
|
107
118
|
}
|
|
119
|
+
export interface RunTimeErrorHandler {
|
|
120
|
+
errorFn?: (error: object, node?: Node) => void;
|
|
121
|
+
}
|
|
108
122
|
export interface Category {
|
|
109
|
-
|
|
123
|
+
altText?: string;
|
|
124
|
+
collapsible?: boolean;
|
|
110
125
|
icon?: string;
|
|
111
126
|
id: string;
|
|
112
127
|
isGroup?: boolean;
|
|
@@ -115,9 +130,13 @@ export interface Category {
|
|
|
115
130
|
tooltip?: string;
|
|
116
131
|
}
|
|
117
132
|
export interface NavItem {
|
|
118
|
-
|
|
133
|
+
altText?: string;
|
|
119
134
|
category?: Category;
|
|
135
|
+
icon?: string;
|
|
136
|
+
node?: Node;
|
|
137
|
+
label?: string;
|
|
120
138
|
selected?: boolean;
|
|
139
|
+
tooltip?: string;
|
|
121
140
|
}
|
|
122
141
|
export interface TabNavData {
|
|
123
142
|
selectedNode?: any;
|
|
@@ -157,13 +176,15 @@ export interface ExternalLink {
|
|
|
157
176
|
}
|
|
158
177
|
export declare class NavigationService {
|
|
159
178
|
private luigi;
|
|
179
|
+
nodeDataManagementService?: NodeDataManagementService;
|
|
160
180
|
constructor(luigi: Luigi);
|
|
161
|
-
|
|
181
|
+
private getNodeDataManagementService;
|
|
182
|
+
getPathData(path: string): Promise<PathData>;
|
|
162
183
|
findMatchingNode(urlPathElement: string, nodes: Node[]): Node | undefined;
|
|
163
184
|
buildNavItems(nodes: Node[], selectedNode: Node | undefined, pathData: PathData): NavItem[];
|
|
164
|
-
shouldRedirect(path: string, pData?: PathData): string | undefined
|
|
165
|
-
getCurrentNode(path: string): any
|
|
166
|
-
getPathParams(path: string): Record<string, any
|
|
185
|
+
shouldRedirect(path: string, pData?: PathData): Promise<string | undefined>;
|
|
186
|
+
getCurrentNode(path: string): Promise<any>;
|
|
187
|
+
getPathParams(path: string): Promise<Record<string, any>>;
|
|
167
188
|
/**
|
|
168
189
|
* getTruncatedChildren
|
|
169
190
|
*
|
|
@@ -174,12 +195,12 @@ export declare class NavigationService {
|
|
|
174
195
|
*/
|
|
175
196
|
getTruncatedChildren(children: any): any[];
|
|
176
197
|
applyNavGroups(items: NavItem[]): NavItem[];
|
|
177
|
-
getLeftNavData(path: string, pData?: PathData): LeftNavData
|
|
198
|
+
getLeftNavData(path: string, pData?: PathData): Promise<LeftNavData>;
|
|
178
199
|
navItemClick(item: Node, parentPath: string): void;
|
|
179
|
-
getTopNavData(path: string, pData?: PathData): TopNavData
|
|
200
|
+
getTopNavData(path: string, pData?: PathData): Promise<TopNavData>;
|
|
180
201
|
getParentNode(node: Node | undefined, pathData: PathData): Node | undefined;
|
|
181
202
|
getAppSwitcherData(appSwitcherData: AppSwitcher, headerSettings: any): AppSwitcher | undefined;
|
|
182
|
-
getTabNavData(path: string, pData?: PathData): TabNavData
|
|
203
|
+
getTabNavData(path: string, pData?: PathData): Promise<TabNavData>;
|
|
183
204
|
/**
|
|
184
205
|
* Handles changes between navigation nodes by invoking a configured hook function.
|
|
185
206
|
*
|
|
@@ -207,7 +228,14 @@ export declare class NavigationService {
|
|
|
207
228
|
nodeObject: Node;
|
|
208
229
|
pathData: PathData;
|
|
209
230
|
}>;
|
|
231
|
+
shouldPreventNavigation(node: Node): Promise<boolean>;
|
|
232
|
+
shouldPreventNavigationForPath(nodepath: string): Promise<boolean>;
|
|
233
|
+
openViewInNewTab(nodepath: string): Promise<void>;
|
|
210
234
|
private resolveTooltipText;
|
|
211
235
|
private prepareRootNodes;
|
|
212
236
|
private getAccessibleNodes;
|
|
237
|
+
handleNavigationRequest(path: string, preserveView?: string, modalSettings?: any, newTab?: boolean, withoutSync?: boolean, callbackFn?: any): Promise<void>;
|
|
238
|
+
getChildren(node: Node | undefined, context?: Record<string, any>): Promise<Node[]>;
|
|
239
|
+
getExpandStructuralPathSegment(node: Node): Node;
|
|
240
|
+
bindChildToParent(child: Node, node: Node): Node;
|
|
213
241
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Node } from './navigation.service';
|
|
1
|
+
import { Node, RootNode } from './navigation.service';
|
|
2
2
|
export declare class NodeDataManagementService {
|
|
3
3
|
dataManagement: Map<any, any>;
|
|
4
4
|
navPath: string;
|
|
@@ -28,9 +28,9 @@ export declare class NodeDataManagementService {
|
|
|
28
28
|
setRootNode(node: Node): void;
|
|
29
29
|
/**
|
|
30
30
|
* Returns the root node
|
|
31
|
-
* @returns {
|
|
31
|
+
* @returns {RootNode} root node
|
|
32
32
|
*/
|
|
33
|
-
getRootNode():
|
|
33
|
+
getRootNode(): RootNode;
|
|
34
34
|
/**
|
|
35
35
|
* Checks if root node exists
|
|
36
36
|
* @returns {boolean} true or false
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
|
-
import { ModalSettings, Node, NavigationService } from './navigation.service';
|
|
2
|
+
import { ModalSettings, Node, PathData, NavigationService } from './navigation.service';
|
|
3
3
|
export interface Route {
|
|
4
4
|
raw: string;
|
|
5
5
|
node?: Node;
|
|
@@ -12,6 +12,7 @@ export declare class RoutingService {
|
|
|
12
12
|
previousNode: Node | undefined;
|
|
13
13
|
currentRoute?: Route;
|
|
14
14
|
modalSettings?: ModalSettings;
|
|
15
|
+
previousPathData?: PathData;
|
|
15
16
|
constructor(luigi: Luigi);
|
|
16
17
|
private getNavigationService;
|
|
17
18
|
/**
|
|
@@ -34,10 +35,16 @@ export declare class RoutingService {
|
|
|
34
35
|
*
|
|
35
36
|
*/
|
|
36
37
|
enableRouting(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Deal with route changing scenario.
|
|
40
|
+
* @param {Object} routeInfo - the information about path and query
|
|
41
|
+
* @param {boolean} withoutSync - disables the navigation handling for a single navigation request
|
|
42
|
+
* @returns {Promise<void>} A promise that resolves when route change is complete.
|
|
43
|
+
*/
|
|
37
44
|
handleRouteChange(routeInfo: {
|
|
38
45
|
path: string;
|
|
39
46
|
query: string;
|
|
40
|
-
}): Promise<void>;
|
|
47
|
+
}, withoutSync?: boolean): Promise<void>;
|
|
41
48
|
getCurrentRoute(): Route | undefined;
|
|
42
49
|
/**
|
|
43
50
|
* If `showModalPathInUrl` is provided, bookmarkable modal path will be triggered.
|
|
@@ -100,4 +107,5 @@ export declare class RoutingService {
|
|
|
100
107
|
|
|
101
108
|
*/
|
|
102
109
|
updateModalDataInUrl(modalPath: string, modalParams: ModalSettings, addHistoryEntry: boolean): void;
|
|
110
|
+
checkInvalidateCache(previousPathData: PathData | undefined, newPath: string): void;
|
|
103
111
|
}
|
|
@@ -11,7 +11,9 @@ declare class ConfigHelpersClass {
|
|
|
11
11
|
* If the value is a Function it is called (with the given parameters) and the result of that call is the value.
|
|
12
12
|
* If the value is not a Promise it is wrapped to a Promise so that the returned value is definitely a Promise.
|
|
13
13
|
* @private
|
|
14
|
-
* @
|
|
14
|
+
* @param {string} property the object traversal path
|
|
15
|
+
* @param {boolean} throwError to throw an error or not
|
|
16
|
+
* @param {*} parameters optional parameters that are used if the target is a function
|
|
15
17
|
*/
|
|
16
18
|
executeConfigFnAsync(property: string, throwError?: boolean, ...parameters: any): Promise<any>;
|
|
17
19
|
}
|
|
@@ -17,6 +17,12 @@ export declare const GenericHelpers: {
|
|
|
17
17
|
* @returns {boolean}
|
|
18
18
|
*/
|
|
19
19
|
isFunction: (functionToCheck: any) => boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Checks if input is an async function.
|
|
22
|
+
* @param functionToCheck mixed
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
isAsyncFunction: (functionToCheck: any) => boolean;
|
|
20
26
|
/**
|
|
21
27
|
* Checks if input is a string.
|
|
22
28
|
* @param stringToCheck mixed
|
|
@@ -251,4 +251,15 @@ export declare const RoutingHelpers: {
|
|
|
251
251
|
* constraining `paramMap` and `object` to more specific record types.
|
|
252
252
|
*/
|
|
253
253
|
substituteDynamicParamsInObject(object: Record<string, string>, paramMap: Record<any, any>, paramPrefix?: string, contains?: boolean): {};
|
|
254
|
+
/**
|
|
255
|
+
* Returns true or false whether the passed node is a dynamic node or not
|
|
256
|
+
* @param {*} node
|
|
257
|
+
*/
|
|
258
|
+
isDynamicNode(node: Node): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Returns the value from the passed node's pathSegment, e.g. :groupId -> yourGroupId
|
|
261
|
+
* @param {*} node
|
|
262
|
+
* @param {*} pathParams
|
|
263
|
+
*/
|
|
264
|
+
getDynamicNodeValue(node: Node, pathParams: Record<string, string>): string | undefined;
|
|
254
265
|
};
|