@luigi-project/core-modular 0.0.7-dev.202605190111 → 0.0.7-dev.202605260713
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 +19 -0
- package/core-api/navigation.d.ts +9 -0
- package/luigi.js +64 -24
- package/luigi.js.map +1 -1
- package/package.json +1 -1
- package/types/navigation.d.ts +9 -0
- package/utilities/helpers/navigation-helpers.d.ts +1 -2
- package/utilities/helpers/routing-helpers.d.ts +110 -2
package/package.json
CHANGED
package/types/navigation.d.ts
CHANGED
|
@@ -33,8 +33,13 @@ export interface ProfileSettings {
|
|
|
33
33
|
items?: ProfileItem[];
|
|
34
34
|
staticUserInfoFn?: () => Promise<UserInfo>;
|
|
35
35
|
onUserInfoUpdate: (fn: (uInfo: UserInfo) => void) => void;
|
|
36
|
+
settings: UserSettingsProfileMenuEntry;
|
|
36
37
|
itemClick: (item: ProfileItem) => void;
|
|
37
38
|
}
|
|
39
|
+
export interface UserSettingsProfileMenuEntry {
|
|
40
|
+
label?: string;
|
|
41
|
+
link?: string;
|
|
42
|
+
}
|
|
38
43
|
export interface ProfileLogout {
|
|
39
44
|
label?: string;
|
|
40
45
|
icon?: string;
|
|
@@ -102,6 +107,7 @@ export interface Node {
|
|
|
102
107
|
isRootNode?: boolean;
|
|
103
108
|
keepSelectedForChildren?: boolean;
|
|
104
109
|
label?: string;
|
|
110
|
+
link?: string;
|
|
105
111
|
loadingIndicator?: {
|
|
106
112
|
enabled: boolean;
|
|
107
113
|
};
|
|
@@ -129,6 +135,7 @@ export interface Node {
|
|
|
129
135
|
_virtualTree?: Node;
|
|
130
136
|
_virtualPathIndex?: number;
|
|
131
137
|
_virtualViewUrl?: string;
|
|
138
|
+
_rawContext?: Record<string, any>;
|
|
132
139
|
}
|
|
133
140
|
export interface PageErrorHandler {
|
|
134
141
|
timeout: number;
|
|
@@ -159,6 +166,7 @@ export interface BreadcrumbItem {
|
|
|
159
166
|
export interface NavItem {
|
|
160
167
|
altText?: string;
|
|
161
168
|
category?: Category;
|
|
169
|
+
href?: string;
|
|
162
170
|
icon?: string;
|
|
163
171
|
node?: Node;
|
|
164
172
|
label?: string;
|
|
@@ -230,6 +238,7 @@ export interface NavigationRequestBase {
|
|
|
230
238
|
}
|
|
231
239
|
export interface NavigationRequestParams extends NavigationRequestBase {
|
|
232
240
|
drawerSettings?: any;
|
|
241
|
+
intent?: boolean;
|
|
233
242
|
modalSettings?: any;
|
|
234
243
|
newTab?: boolean;
|
|
235
244
|
path: string;
|
|
@@ -8,10 +8,9 @@ export declare const NavigationHelpers: {
|
|
|
8
8
|
checkVisibleForFeatureToggles: (nodeToCheckPermission: any, featureToggles: FeatureToggles) => boolean;
|
|
9
9
|
generateTooltipText: (node: Node, translation: string, luigi: Luigi) => string;
|
|
10
10
|
isNodeAccessPermitted: (nodeToCheckPermissionFor: Node, parentNode: Node | undefined, currentContext: Record<string, any>, luigi: Luigi) => boolean;
|
|
11
|
-
applyContext: (context: Record<string, any>, addition: Record<string, any>, navigationContext: any) => Record<string, any>;
|
|
12
11
|
updateHeaderTitle: (appSwitcherData: AppSwitcher, pathData: PathData) => string | undefined;
|
|
13
12
|
buildPath(pathToLeftNavParent: Node[], pathData?: PathData): string;
|
|
14
|
-
mergeContext(
|
|
13
|
+
mergeContext(base: Record<string, any>, addition?: Record<string, any>, navigationContext?: string): Record<string, any>;
|
|
15
14
|
prepareForTests(...parts: string[]): string;
|
|
16
15
|
/**
|
|
17
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.
|
|
@@ -80,19 +80,100 @@ export declare const RoutingHelpers: {
|
|
|
80
80
|
* @returns An object containing only the permitted search parameters for the client.
|
|
81
81
|
*/
|
|
82
82
|
prepareSearchParamsForClient(currentNode: Node, luigi: Luigi): {};
|
|
83
|
+
/**
|
|
84
|
+
* Checks if given path contains intent navigation special syntax
|
|
85
|
+
* @param {string} path - path to be checked
|
|
86
|
+
*/
|
|
87
|
+
hasIntent(path: string): boolean;
|
|
88
|
+
/**
|
|
89
|
+
* This function takes an intentLink and parses it conforming certain limitations in characters usage.
|
|
90
|
+
* Limitations include:
|
|
91
|
+
* - `semanticObject` allows only alphanumeric characters
|
|
92
|
+
* - `action` allows alphanumeric characters and the '_' sign
|
|
93
|
+
*
|
|
94
|
+
* Example of resulting output:
|
|
95
|
+
* ```
|
|
96
|
+
* {
|
|
97
|
+
* semanticObject: "Sales",
|
|
98
|
+
* action: "order",
|
|
99
|
+
* params: {param1: "value1",param2: "value2"}
|
|
100
|
+
* };
|
|
101
|
+
* ```
|
|
102
|
+
* @param {string} intentLink - the intent link represents the semantic intent defined by the user, i.e.: #?intent=semanticObject-action?param=value
|
|
103
|
+
*/
|
|
104
|
+
getIntentObject(intentLink: string): Record<string, any> | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* This function compares the intentLink parameter with the configuration intentMapping
|
|
107
|
+
* and returns the path segment that is matched together with the parameters, if any
|
|
108
|
+
*
|
|
109
|
+
* Example:
|
|
110
|
+
*
|
|
111
|
+
* For intentLink = `#?intent=Sales-order?foo=bar`
|
|
112
|
+
* and Luigi configuration:
|
|
113
|
+
* ```
|
|
114
|
+
* intentMapping: [{
|
|
115
|
+
* semanticObject: 'Sales',
|
|
116
|
+
* action: 'order',
|
|
117
|
+
* pathSegment: '/projects/pr2/order'
|
|
118
|
+
* }]
|
|
119
|
+
*
|
|
120
|
+
* ```
|
|
121
|
+
* the given intentLink is matched with the configuration's same semanticObject and action,
|
|
122
|
+
* resulting in pathSegment `/projects/pr2/order` being returned. The parameter is also added in
|
|
123
|
+
* this case resulting in: `/projects/pr2/order?~foo=bar`
|
|
124
|
+
*
|
|
125
|
+
* Or for external intent links: intentLink = `#?intent=External-view`
|
|
126
|
+
* and Luigi configuration:
|
|
127
|
+
* ```
|
|
128
|
+
* intentMapping: [{
|
|
129
|
+
* semanticObject: 'External',
|
|
130
|
+
* action: 'view',
|
|
131
|
+
* externalLink: { url: 'https://www.sap.com', openInNewTab: true }
|
|
132
|
+
* }]
|
|
133
|
+
* ```
|
|
134
|
+
* The resulting will be returned from this function:
|
|
135
|
+
* ```
|
|
136
|
+
* {
|
|
137
|
+
* url: 'https://www.sap.com',
|
|
138
|
+
* openInNewTab: true,
|
|
139
|
+
* external: true
|
|
140
|
+
* }
|
|
141
|
+
* ```
|
|
142
|
+
* @param {string} intentLink - the intentLink represents the semantic intent defined by the user, i.e.: #?intent=semanticObject-action?param=value
|
|
143
|
+
* @param luigi - Luigi instance used to access configuration values
|
|
144
|
+
*/
|
|
145
|
+
getIntentPath(intentLink: string, luigi: Luigi): boolean | string | Record<string, any>;
|
|
146
|
+
/**
|
|
147
|
+
* This function takes a path which contains dynamic parameters and a list parameters and replaces the dynamic parameters
|
|
148
|
+
* with the given parameters if any. The input path remains unchanged if the parameters list
|
|
149
|
+
* does not contain the respective dynamic parameter name.
|
|
150
|
+
* e.g.:
|
|
151
|
+
* Assume either of these two calls are made:
|
|
152
|
+
* 1. `LuigiClient.linkManager().navigateToIntent('Sales-settings', {project: 'pr2', user: 'john'})`
|
|
153
|
+
* 2. `LuigiClient.linkManager().navigate('/#?intent=Sales-settings?project=pr2&user=john')`
|
|
154
|
+
* For both 1. and 2., the following dynamic input path: `/projects/:project/details/:user`
|
|
155
|
+
* is resolved through this method to `/projects/pr2/details/john`
|
|
156
|
+
*
|
|
157
|
+
* @param {string} path - the path containing the potential dynamic parameter
|
|
158
|
+
* @param {Object} parameters - a list of objects consisting of passed parameters
|
|
159
|
+
*/
|
|
160
|
+
resolveDynamicIntentPath(path: string, parameters: object): string;
|
|
83
161
|
/**
|
|
84
162
|
* Retrieves the current path and query string from the browser's location hash.
|
|
85
163
|
*
|
|
164
|
+
* @param hashRouting - true if hash routing is active, false if path routing is active
|
|
165
|
+
* @param luigi - Luigi instance used to access configuration values
|
|
86
166
|
* @returns An object containing the normalized path and the query string.
|
|
87
167
|
* @remarks
|
|
88
168
|
* - The path is normalized using `NavigationHelpers.normalizePath`.
|
|
89
169
|
* - The query string is extracted from the portion after the '?' in the hash.
|
|
90
170
|
* - If there is no query string, `query` will be `undefined`.
|
|
91
171
|
*/
|
|
92
|
-
getCurrentPath(hashRouting?: boolean): {
|
|
172
|
+
getCurrentPath(luigi: Luigi, hashRouting?: boolean, checkIntent?: boolean): {
|
|
93
173
|
path: string;
|
|
94
174
|
query: string;
|
|
95
175
|
};
|
|
176
|
+
handleExternalIntentPath(intentPath: Record<string, any>): void;
|
|
96
177
|
/**
|
|
97
178
|
* Retrieves the modal path from the current URL's query parameters based on the provided Luigi instance.
|
|
98
179
|
*
|
|
@@ -163,7 +244,7 @@ export declare const RoutingHelpers: {
|
|
|
163
244
|
getModalParamsFromPath(luigi: Luigi): any;
|
|
164
245
|
/**
|
|
165
246
|
* Get the query param separator which is used with hashRouting
|
|
166
|
-
* Default:
|
|
247
|
+
* Default:
|
|
167
248
|
* @example /home?modal=(urlencoded)/some-modal?modalParams=(urlencoded){...}&otherParam=hmhm
|
|
168
249
|
* @returns the first query param separator (like ? for path routing)
|
|
169
250
|
*/
|
|
@@ -367,4 +448,31 @@ export declare const RoutingHelpers: {
|
|
|
367
448
|
* @returns A string representing the concatenated path, with exactly one '/' character between the base and relative paths.
|
|
368
449
|
*/
|
|
369
450
|
concatenatePath(basePath: any, relativePath?: any): string;
|
|
451
|
+
/**
|
|
452
|
+
* Returns the resolved route link for a navigation node. If the node has an external link, its URL is returned directly.
|
|
453
|
+
* If the node has an internal link, the prefix is prepended. Otherwise, the full route is built from the node's path
|
|
454
|
+
* segments and path parameters are substituted.
|
|
455
|
+
* @param node - The navigation node to resolve the link for
|
|
456
|
+
* @param pathParams - Dynamic path parameters to substitute in the route
|
|
457
|
+
* @param relativePathPrefix - Prefix to prepend to relative paths (e.g. '#' for hash routing)
|
|
458
|
+
* @returns The resolved route link as a string
|
|
459
|
+
*/
|
|
460
|
+
getRouteLink(node: Node, pathParams: Record<string, any>, relativePathPrefix: string): string;
|
|
461
|
+
/**
|
|
462
|
+
* Calculates the full href for a navigation node, taking hash routing and i18n view URLs into account.
|
|
463
|
+
* @param node - The navigation node to calculate the href for
|
|
464
|
+
* @param pathParams - Dynamic path parameters to substitute in the route
|
|
465
|
+
* @param luigi - The Luigi instance used to read routing configuration
|
|
466
|
+
* @returns The fully resolved href string for the node
|
|
467
|
+
*/
|
|
468
|
+
calculateNodeHref(node: Node, pathParams: Record<string, any>, luigi: Luigi): string;
|
|
469
|
+
/**
|
|
470
|
+
* Returns the href for a navigation node if the `navigation.addNavHrefs` configuration is enabled.
|
|
471
|
+
* This is used to populate anchor `href` attributes for accessibility and native browser behavior.
|
|
472
|
+
* @param node - The navigation node to get the href for
|
|
473
|
+
* @param pathParams - Dynamic path parameters to substitute in the route
|
|
474
|
+
* @param luigi - The Luigi instance used to read configuration
|
|
475
|
+
* @returns The node href string if `addNavHrefs` is enabled, otherwise `undefined`
|
|
476
|
+
*/
|
|
477
|
+
getNodeHref(node: Node, pathParams: Record<string, any>, luigi: Luigi): string | undefined;
|
|
370
478
|
};
|