@luigi-project/core-modular 0.0.7 → 0.0.8-dev.20260630124
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 +31 -0
- package/core-api/navigation.d.ts +9 -0
- package/core-api/ux.d.ts +2 -3
- package/luigi-engine.d.ts +1 -0
- package/luigi.js +69 -29
- package/luigi.js.map +1 -1
- package/modules/ui-module.d.ts +2 -1
- package/package.json +1 -1
- package/services/auth-layer.service.d.ts +1 -0
- package/services/dirty-status.service.d.ts +5 -1
- package/services/i18n.service.d.ts +1 -2
- package/services/modal.service.d.ts +1 -0
- package/services/navigation.service.d.ts +5 -3
- package/services/preloading.service.d.ts +58 -0
- package/services/routing.service.d.ts +12 -0
- package/types/connector.d.ts +5 -4
- package/types/navigation.d.ts +74 -5
- package/utilities/helpers/context-switcher-helpers.d.ts +17 -0
- package/utilities/helpers/generic-helpers.d.ts +13 -1
- package/utilities/helpers/i18n-helpers.d.ts +3 -0
- package/utilities/helpers/navigation-helpers.d.ts +21 -3
- package/utilities/helpers/routing-helpers.d.ts +135 -3
package/modules/ui-module.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
2
|
import { NavigationService } from '../services/navigation.service';
|
|
3
3
|
import { RoutingService } from '../services/routing.service';
|
|
4
|
-
import { DrawerSettings, ModalSettings, Node } from '../types/navigation';
|
|
4
|
+
import { DrawerSettings, ModalSettings, Node, UserSettingsDialogSettings } from '../types/navigation';
|
|
5
5
|
import { LuigiParams } from '../types/routing';
|
|
6
6
|
export declare const UIModule: {
|
|
7
7
|
navService: NavigationService;
|
|
@@ -15,4 +15,5 @@ export declare const UIModule: {
|
|
|
15
15
|
openModal: (luigi: Luigi, node: Node, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
|
|
16
16
|
updateModalSettings: (modalSettings: ModalSettings, addHistoryEntry: boolean, luigi: Luigi) => void;
|
|
17
17
|
openDrawer: (luigi: Luigi, node: Node, drawerSettings: DrawerSettings, onCloseCallback?: () => void) => Promise<void>;
|
|
18
|
+
openUserSettings: (userSettingsDialogSettings: UserSettingsDialogSettings, userSettingData: any, previousUserSettings: any, luigi: Luigi) => Promise<void>;
|
|
18
19
|
};
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ declare class AuthLayerSvcClass {
|
|
|
19
19
|
getIdpProviderInstance(idpProviderName: string, idpProviderSettings: any): Promise<any>;
|
|
20
20
|
unload(): void;
|
|
21
21
|
resetExpirationChecks(): void;
|
|
22
|
+
broadcastAuthData(authData: any): void;
|
|
22
23
|
}
|
|
23
24
|
export declare const AuthLayerSvc: AuthLayerSvcClass;
|
|
24
25
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Luigi } from '../core-api/luigi';
|
|
1
2
|
export declare class DirtyStatusService {
|
|
3
|
+
private luigi;
|
|
2
4
|
unsavedChanges: {
|
|
3
5
|
isDirty?: boolean;
|
|
4
6
|
persistUrl?: string | null;
|
|
@@ -8,7 +10,7 @@ export declare class DirtyStatusService {
|
|
|
8
10
|
* Initializes the `unsavedChanges` property with default values.
|
|
9
11
|
* Sets `isDirty` to `false` and `persistUrl` to `null`, indicating that there are no unsaved changes initially.
|
|
10
12
|
*/
|
|
11
|
-
constructor();
|
|
13
|
+
constructor(luigi: Luigi);
|
|
12
14
|
/**
|
|
13
15
|
* Updates the dirty status of a given source and manages the set of unsaved changes.
|
|
14
16
|
*
|
|
@@ -38,4 +40,6 @@ export declare class DirtyStatusService {
|
|
|
38
40
|
* @returns {boolean} `true` if there are unsaved changes, otherwise `false`.
|
|
39
41
|
*/
|
|
40
42
|
readDirtyStatus(): boolean;
|
|
43
|
+
getUnsavedChangesModalPromise(source?: any): Promise<void>;
|
|
44
|
+
shouldShowUnsavedChangesModal(source?: any): boolean;
|
|
41
45
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LuigiContainer, LuigiCompoundContainer } from '@luigi-project/container';
|
|
2
1
|
import { Luigi } from '../core-api/luigi';
|
|
3
2
|
/**
|
|
4
3
|
* Localization-related functions
|
|
@@ -21,7 +20,7 @@ export declare class i18nService {
|
|
|
21
20
|
* Sets current locale to the specified one.
|
|
22
21
|
* @param {string} locale locale to be set as the current locale
|
|
23
22
|
*/
|
|
24
|
-
setCurrentLocale(locale: string
|
|
23
|
+
setCurrentLocale(locale: string): void;
|
|
25
24
|
/**
|
|
26
25
|
* Registers a listener for locale changes.
|
|
27
26
|
* @param {Function} listener function called on every locale change with the new locale as argument
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Luigi } from '../core-api/luigi';
|
|
2
2
|
import { AppSwitcher, BreadcrumbData, LeftNavData, NavigationOptions, NavigationRequestParams, NavItem, Node, PathData, TabNavData, TopNavData } from '../types/navigation';
|
|
3
|
-
import { NodeDataManagementService } from './node-data-management.service';
|
|
4
3
|
import { ModalService } from './modal.service';
|
|
4
|
+
import { NodeDataManagementService } from './node-data-management.service';
|
|
5
5
|
export declare class NavigationService {
|
|
6
6
|
private luigi;
|
|
7
7
|
modalService?: ModalService;
|
|
@@ -26,12 +26,13 @@ export declare class NavigationService {
|
|
|
26
26
|
getTruncatedChildren(children: Node[]): Node[];
|
|
27
27
|
applyNavGroups(items: NavItem[]): NavItem[];
|
|
28
28
|
getLeftNavData(path: string, pData?: PathData): Promise<LeftNavData>;
|
|
29
|
-
navItemClick(node: Node, pathData?: PathData): void
|
|
29
|
+
navItemClick(node: Node, pathData?: PathData): Promise<void>;
|
|
30
30
|
getTopNavData(path: string, pData?: PathData): Promise<TopNavData>;
|
|
31
31
|
getParentNode(node: Node | undefined, pathData: PathData): Node | undefined;
|
|
32
32
|
getAppSwitcherData(appSwitcherData: AppSwitcher, headerSettings: any): AppSwitcher | undefined;
|
|
33
33
|
getTabNavData(path: string, pData?: PathData): Promise<TabNavData>;
|
|
34
|
-
getBreadcrumbData(path: string, pData?: PathData): Promise<BreadcrumbData>;
|
|
34
|
+
getBreadcrumbData(path: string, pData?: PathData, onResolve?: (data: BreadcrumbData) => void): Promise<BreadcrumbData>;
|
|
35
|
+
private resolveBreadcrumbTitles;
|
|
35
36
|
/**
|
|
36
37
|
* Handles changes between navigation nodes by invoking a configured hook function.
|
|
37
38
|
*
|
|
@@ -108,4 +109,5 @@ export declare class NavigationService {
|
|
|
108
109
|
* @returns The constructed path string.
|
|
109
110
|
*/
|
|
110
111
|
buildPath(incomingPath: string, options: NavigationOptions): Promise<string>;
|
|
112
|
+
private buildContextSwitcher;
|
|
111
113
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
import { ViewGroupSettings } from '../types/navigation';
|
|
3
|
+
/**
|
|
4
|
+
* Service responsible for preloading view group containers in the background.
|
|
5
|
+
*
|
|
6
|
+
* Preloading creates hidden luigi-container elements for configured view groups
|
|
7
|
+
* so that navigating to those groups later is near-instant (the MFE is already initialized).
|
|
8
|
+
* The service adapts its batch size dynamically based on observed MFE load times.
|
|
9
|
+
*/
|
|
10
|
+
export declare class PreloadingService {
|
|
11
|
+
private luigi;
|
|
12
|
+
private preloadBatchSize;
|
|
13
|
+
shouldPreload: boolean;
|
|
14
|
+
constructor(luigi: Luigi);
|
|
15
|
+
/**
|
|
16
|
+
* Preloads view group containers based on the `navigation.viewGroupSettings` configuration.
|
|
17
|
+
* Skips view groups that already have a container in the DOM or are currently being preloaded.
|
|
18
|
+
*
|
|
19
|
+
* @param batchSize - Maximum number of view groups to preload in this cycle (default: 3).
|
|
20
|
+
* @param backgroundMfeOnly - If true, only preloads view groups with `loadOnStartup: true`.
|
|
21
|
+
* Used during application init to load critical MFEs without competing with the main navigation.
|
|
22
|
+
*/
|
|
23
|
+
preloadViewGroups(batchSize?: number, backgroundMfeOnly?: boolean): void;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a hidden luigi-container for the given view group and appends it to the DOM.
|
|
26
|
+
* The container loads the `preloadUrl` MFE in the background with `display: none`.
|
|
27
|
+
*
|
|
28
|
+
* @param settings - The view group settings containing the preloadUrl.
|
|
29
|
+
* @param name - The view group name (used as identifier on the container).
|
|
30
|
+
* @param containerWrapper - The DOM element to append the hidden container to.
|
|
31
|
+
*/
|
|
32
|
+
preloadContainerOnBackground(settings: ViewGroupSettings, name: string, containerWrapper: HTMLElement): void;
|
|
33
|
+
/**
|
|
34
|
+
* Schedules a preload cycle. Uses a flag-based mechanism to skip the very first invocation
|
|
35
|
+
* and only trigger preloading from the second call onwards.
|
|
36
|
+
*
|
|
37
|
+
* @param backgroundMfeOnly - If true, only `loadOnStartup` view groups are preloaded.
|
|
38
|
+
* Passed through to `preloadViewGroups`.
|
|
39
|
+
*/
|
|
40
|
+
preload(backgroundMfeOnly?: boolean): void;
|
|
41
|
+
/**
|
|
42
|
+
* Called when a preloaded container has finished initializing (INITIALIZED event).
|
|
43
|
+
* Measures load time and adapts the batch size for subsequent preload cycles:
|
|
44
|
+
* - < 500ms → batchSize 3 (fast connection)
|
|
45
|
+
* - 500–1000ms → batchSize 2
|
|
46
|
+
* - > 1000ms → batchSize 1 (slow, be conservative)
|
|
47
|
+
*
|
|
48
|
+
* Also schedules clearing the `_luigiPreloading` flag after a short delay,
|
|
49
|
+
* freeing the container for the next preload cycle.
|
|
50
|
+
*
|
|
51
|
+
* @param container - The container element that finished loading.
|
|
52
|
+
*/
|
|
53
|
+
viewGroupLoaded(container: any): void;
|
|
54
|
+
/**
|
|
55
|
+
* Returns all containers in the wrapper that are currently in a preloading state.
|
|
56
|
+
*/
|
|
57
|
+
private getPreloadingContainers;
|
|
58
|
+
}
|
|
@@ -2,9 +2,11 @@ import { Luigi } from '../core-api/luigi';
|
|
|
2
2
|
import { Route } from '../types/routing';
|
|
3
3
|
import { ModalSettings, Node, PathData } from '../types/navigation';
|
|
4
4
|
import { NavigationService } from './navigation.service';
|
|
5
|
+
import { DirtyStatusService } from './dirty-status.service';
|
|
5
6
|
export declare class RoutingService {
|
|
6
7
|
private luigi;
|
|
7
8
|
navigationService?: NavigationService;
|
|
9
|
+
dirtyStatusService?: DirtyStatusService;
|
|
8
10
|
previousNode: Node | undefined;
|
|
9
11
|
currentRoute?: Route;
|
|
10
12
|
modalSettings?: ModalSettings;
|
|
@@ -123,4 +125,14 @@ export declare class RoutingService {
|
|
|
123
125
|
* @returns {Promise<void>} A promise that resolves when error handling is complete.
|
|
124
126
|
*/
|
|
125
127
|
showPageNotFoundError(pathToRedirect: string, notFoundPath: string, isAnyPathMatched?: boolean): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Handles viewUrl misconfiguration scenario. If a node has no viewUrl, no children,
|
|
130
|
+
* and is not a compound node, it redirects to the root default child node.
|
|
131
|
+
* @param node - active node data
|
|
132
|
+
* @param viewUrl - the url of the current mf view
|
|
133
|
+
* @param previousPathData - previous path data
|
|
134
|
+
* @param pathUrlRaw - path url without hash
|
|
135
|
+
* @returns true if misconfiguration was detected and handled
|
|
136
|
+
*/
|
|
137
|
+
handleViewUrlMisconfigured(node: Node, viewUrl: string, previousPathData: PathData, pathUrlRaw: string): Promise<boolean>;
|
|
126
138
|
}
|
package/types/connector.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { AlertHandler, AlertSettings, ConfirmationModalHandler, ConfirmationModalSettings
|
|
2
|
-
import { ModalSettings, LeftNavData, Node, TopNavData, TabNavData, BreadcrumbData, DrawerSettings } from './navigation';
|
|
1
|
+
import { AlertHandler, AlertSettings, ConfirmationModalHandler, ConfirmationModalSettings } from '../modules/ux-module';
|
|
2
|
+
import { ModalSettings, LeftNavData, Node, TopNavData, TabNavData, BreadcrumbData, DrawerSettings, UserSettingsDialogSettings } from './navigation';
|
|
3
3
|
export interface LuigiConnector {
|
|
4
4
|
renderMainLayout(): void;
|
|
5
5
|
renderTopNav(data: TopNavData): void;
|
|
6
6
|
renderLeftNav(data: LeftNavData): void;
|
|
7
7
|
getContainerWrapper(): HTMLElement;
|
|
8
8
|
renderModal(content: HTMLElement, modalSettings: ModalSettings, onCloseCallback?: () => void, onCloseRequest?: () => void): any;
|
|
9
|
-
renderDrawer(content: HTMLElement,
|
|
9
|
+
renderDrawer(content: HTMLElement, drawerSettings: DrawerSettings, onCloseCallback?: () => void, onCloseRequest?: () => void): any;
|
|
10
10
|
renderTabNav(data: TabNavData): void;
|
|
11
11
|
renderBreadcrumbs(data: BreadcrumbData): void;
|
|
12
12
|
renderAlert(alertSettings: AlertSettings, alertHandler: AlertHandler): void;
|
|
@@ -17,7 +17,7 @@ export interface LuigiConnector {
|
|
|
17
17
|
hideLoadingIndicator(container?: HTMLElement): void;
|
|
18
18
|
addBackdrop(): void;
|
|
19
19
|
removeBackdrop(): void;
|
|
20
|
-
openUserSettings(
|
|
20
|
+
openUserSettings(dialogSettings: UserSettingsDialogSettings, userSettingData: any[], previousUserSettings: any): void;
|
|
21
21
|
closeUserSettings(): void;
|
|
22
22
|
setCurrentLocale(locale: string): void;
|
|
23
23
|
getCurrentLocale(): string;
|
|
@@ -29,5 +29,6 @@ export interface LuigiConnector {
|
|
|
29
29
|
getLuigiContainer(): HTMLElement | null;
|
|
30
30
|
getNavFooterContainer(): HTMLElement | null;
|
|
31
31
|
};
|
|
32
|
+
unload(): void;
|
|
32
33
|
}
|
|
33
34
|
export type { Node };
|
package/types/navigation.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export interface TopNavData {
|
|
2
|
+
appSwitcher?: AppSwitcher;
|
|
2
3
|
appTitle: string;
|
|
4
|
+
contextSwitcher?: ContextSwitcher;
|
|
3
5
|
logo: string;
|
|
4
|
-
|
|
6
|
+
navClick?: (item: NavItem) => Promise<void>;
|
|
5
7
|
productSwitcher?: ProductSwitcher;
|
|
6
8
|
profile?: ProfileSettings;
|
|
7
|
-
|
|
8
|
-
navClick?: (item: NavItem) => void;
|
|
9
|
+
topNodes: NavItem[];
|
|
9
10
|
}
|
|
10
11
|
export interface AppSwitcher {
|
|
11
12
|
showMainAppEntry?: boolean;
|
|
@@ -18,6 +19,25 @@ export interface AppSwitcherItem {
|
|
|
18
19
|
link?: string;
|
|
19
20
|
selectionConditions?: selectionConditions;
|
|
20
21
|
}
|
|
22
|
+
export interface ContextSwitcher {
|
|
23
|
+
actions?: any[];
|
|
24
|
+
config?: any;
|
|
25
|
+
options?: ContextSwitcherItem[];
|
|
26
|
+
selectedLabel?: string;
|
|
27
|
+
selectedNodePath?: any;
|
|
28
|
+
selectedOption?: ContextSwitcherItem;
|
|
29
|
+
switcherChange?: (selectedValue: string, selectedType?: string | undefined) => void;
|
|
30
|
+
}
|
|
31
|
+
export interface ContextSwitcherItem {
|
|
32
|
+
clickHandler?: any;
|
|
33
|
+
customRendererCategory?: any;
|
|
34
|
+
id?: string;
|
|
35
|
+
label?: string;
|
|
36
|
+
link?: string;
|
|
37
|
+
linkFromPath?: null | string;
|
|
38
|
+
position?: 'bottom' | 'top';
|
|
39
|
+
testId?: string;
|
|
40
|
+
}
|
|
21
41
|
export interface selectionConditions {
|
|
22
42
|
route?: string;
|
|
23
43
|
contextCriteria?: ContextCriteria[];
|
|
@@ -33,8 +53,14 @@ export interface ProfileSettings {
|
|
|
33
53
|
items?: ProfileItem[];
|
|
34
54
|
staticUserInfoFn?: () => Promise<UserInfo>;
|
|
35
55
|
onUserInfoUpdate: (fn: (uInfo: UserInfo) => void) => void;
|
|
56
|
+
settings: UserSettingsProfileMenuEntry;
|
|
36
57
|
itemClick: (item: ProfileItem) => void;
|
|
37
58
|
}
|
|
59
|
+
export interface UserSettingsProfileMenuEntry {
|
|
60
|
+
label?: string;
|
|
61
|
+
link?: string;
|
|
62
|
+
openUserSettings?: () => void;
|
|
63
|
+
}
|
|
38
64
|
export interface ProfileLogout {
|
|
39
65
|
label?: string;
|
|
40
66
|
icon?: string;
|
|
@@ -51,6 +77,13 @@ export interface ProfileItem {
|
|
|
51
77
|
altText?: string;
|
|
52
78
|
openNodeInModal?: boolean | ModalSettings;
|
|
53
79
|
}
|
|
80
|
+
export interface UserSettingsDialogSettings {
|
|
81
|
+
dialogHeader?: string;
|
|
82
|
+
saveBtn?: string;
|
|
83
|
+
dismissBtn?: string;
|
|
84
|
+
renderMicroFrontendContainer?: (viewUrl: string, groupKey: string) => Promise<any>;
|
|
85
|
+
onCloseCallback?: (storedUserSettings: any, previousUserSettings: any) => void;
|
|
86
|
+
}
|
|
54
87
|
export interface UserInfo {
|
|
55
88
|
name?: string;
|
|
56
89
|
initials?: string;
|
|
@@ -63,7 +96,7 @@ export interface LeftNavData {
|
|
|
63
96
|
items: NavItem[];
|
|
64
97
|
basePath: string;
|
|
65
98
|
sideNavFooterText?: string;
|
|
66
|
-
navClick?: (item: NavItem) => void
|
|
99
|
+
navClick?: (item: NavItem) => Promise<void>;
|
|
67
100
|
}
|
|
68
101
|
export interface PathData {
|
|
69
102
|
context?: Record<string, any>;
|
|
@@ -98,9 +131,11 @@ export interface Node {
|
|
|
98
131
|
hideFromNav?: boolean;
|
|
99
132
|
hideSideNav?: boolean;
|
|
100
133
|
icon?: string;
|
|
134
|
+
intendToHaveEmptyViewUrl?: boolean;
|
|
101
135
|
isRootNode?: boolean;
|
|
102
136
|
keepSelectedForChildren?: boolean;
|
|
103
137
|
label?: string;
|
|
138
|
+
link?: string;
|
|
104
139
|
loadingIndicator?: {
|
|
105
140
|
enabled: boolean;
|
|
106
141
|
};
|
|
@@ -113,6 +148,7 @@ export interface Node {
|
|
|
113
148
|
runTimeErrorHandler?: RunTimeErrorHandler;
|
|
114
149
|
showBreadcrumbs?: boolean;
|
|
115
150
|
tabNav?: boolean;
|
|
151
|
+
titleResolver?: TitleResolver;
|
|
116
152
|
tooltipText?: string;
|
|
117
153
|
userSettingsGroup?: string;
|
|
118
154
|
viewUrl?: string;
|
|
@@ -127,6 +163,7 @@ export interface Node {
|
|
|
127
163
|
_virtualTree?: Node;
|
|
128
164
|
_virtualPathIndex?: number;
|
|
129
165
|
_virtualViewUrl?: string;
|
|
166
|
+
_rawContext?: Record<string, any>;
|
|
130
167
|
}
|
|
131
168
|
export interface PageErrorHandler {
|
|
132
169
|
timeout: number;
|
|
@@ -157,6 +194,8 @@ export interface BreadcrumbItem {
|
|
|
157
194
|
export interface NavItem {
|
|
158
195
|
altText?: string;
|
|
159
196
|
category?: Category;
|
|
197
|
+
externalLink?: ExternalLink;
|
|
198
|
+
href?: string;
|
|
160
199
|
icon?: string;
|
|
161
200
|
node?: Node;
|
|
162
201
|
label?: string;
|
|
@@ -167,7 +206,7 @@ export interface TabNavData {
|
|
|
167
206
|
selectedNode?: any;
|
|
168
207
|
items?: NavItem[];
|
|
169
208
|
basePath?: string;
|
|
170
|
-
navClick?: (item: NavItem) => void
|
|
209
|
+
navClick?: (item: NavItem) => Promise<void>;
|
|
171
210
|
}
|
|
172
211
|
export interface BreadcrumbData {
|
|
173
212
|
basePath?: string;
|
|
@@ -197,6 +236,7 @@ export interface ProductSwitcher {
|
|
|
197
236
|
items?: [ProductSwitcherItem];
|
|
198
237
|
label?: string;
|
|
199
238
|
testId?: string;
|
|
239
|
+
productSwitcherItemClick?: (item: ProductSwitcherItem) => void;
|
|
200
240
|
}
|
|
201
241
|
export interface ProductSwitcherItem {
|
|
202
242
|
altText?: string;
|
|
@@ -228,6 +268,7 @@ export interface NavigationRequestBase {
|
|
|
228
268
|
}
|
|
229
269
|
export interface NavigationRequestParams extends NavigationRequestBase {
|
|
230
270
|
drawerSettings?: any;
|
|
271
|
+
intent?: boolean;
|
|
231
272
|
modalSettings?: any;
|
|
232
273
|
newTab?: boolean;
|
|
233
274
|
path: string;
|
|
@@ -440,4 +481,32 @@ export interface RendererConfig {
|
|
|
440
481
|
maxWidth?: number;
|
|
441
482
|
}>;
|
|
442
483
|
}
|
|
484
|
+
export interface TitleResolverCache {
|
|
485
|
+
key: string;
|
|
486
|
+
value: {
|
|
487
|
+
label: string;
|
|
488
|
+
icon?: string;
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
export interface TitleResolver {
|
|
492
|
+
request: {
|
|
493
|
+
method: string;
|
|
494
|
+
url: string;
|
|
495
|
+
headers?: Record<string, string>;
|
|
496
|
+
body?: any;
|
|
497
|
+
};
|
|
498
|
+
titlePropertyChain: string;
|
|
499
|
+
titleDecorator?: string;
|
|
500
|
+
iconPropertyChain?: string;
|
|
501
|
+
prerenderFallback?: boolean;
|
|
502
|
+
responsePath?: string;
|
|
503
|
+
fallbackTitle?: string;
|
|
504
|
+
fallbackIcon?: string;
|
|
505
|
+
/** @internal runtime cache – not user-configured */
|
|
506
|
+
_cache?: TitleResolverCache;
|
|
507
|
+
}
|
|
508
|
+
export interface ViewGroupSettings {
|
|
509
|
+
preloadUrl?: string;
|
|
510
|
+
loadOnStartup?: boolean;
|
|
511
|
+
}
|
|
443
512
|
export type HistoryMethod = 'pushState' | 'replaceState';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Luigi } from '../../core-api/luigi';
|
|
2
|
+
export declare const ContextSwitcherHelpers: {
|
|
3
|
+
_fallbackLabels: Map<any, any>;
|
|
4
|
+
resetFallbackLabelCache(): void;
|
|
5
|
+
getPreparedParentNodePath(config: Record<string, any>): string;
|
|
6
|
+
generateSwitcherNav(config: Record<string, any>, rawOptions: any[]): any[];
|
|
7
|
+
getNodePathFromCurrentPath(option: Record<string, any>, selectedOption: Record<string, any>, luigi: Luigi): string;
|
|
8
|
+
getOptionById(options: any[], id: string): any;
|
|
9
|
+
getLabelFromOptions(options: any[], id: string): string;
|
|
10
|
+
isContextSwitcherDetailsView(currentPath: string, parentNodePath: string): boolean;
|
|
11
|
+
getFallbackLabel(fallbackLabelResolver: any, id: string, luigi: Luigi): Promise<string>;
|
|
12
|
+
getSelectedId(currentPath: string, options: any[], parentNodePath: string): string | undefined;
|
|
13
|
+
getSelectedOption(currentPath: string, options: any[], parentNodePath: string): any;
|
|
14
|
+
getSelectedLabel(currentPath: string, options: any[], parentNodePath: string, fallbackLabelResolver: any, luigi: Luigi): Promise<string | undefined>;
|
|
15
|
+
getSelectedNode(currentPath: string, options: any[], parentNodePath: string): string | undefined;
|
|
16
|
+
fetchOptions(luigi: Luigi, existingOptions?: never[]): Promise<any[]>;
|
|
17
|
+
};
|
|
@@ -65,12 +65,24 @@ export declare const GenericHelpers: {
|
|
|
65
65
|
* @returns {string} string without leading slash
|
|
66
66
|
*/
|
|
67
67
|
trimLeadingSlash: (str: string) => string;
|
|
68
|
+
/**
|
|
69
|
+
* Adds a trailing slash to a string if it has none
|
|
70
|
+
* @param {string} str string to be checked
|
|
71
|
+
* @returns {string} string with a trailing slash
|
|
72
|
+
*/
|
|
73
|
+
addTrailingSlash: (str: string) => string;
|
|
68
74
|
/**
|
|
69
75
|
* Prepend current url to redirect_uri, if it is a relative path
|
|
70
76
|
* @param {string} str string from which any number of trailing slashes should be removed
|
|
71
77
|
* @returns {string} string without any trailing slash
|
|
72
78
|
*/
|
|
73
79
|
trimTrailingSlash: (str: string) => string;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a path that starts and end with one (and only one) slash, regardless of the slashes being already present in the path given as input
|
|
82
|
+
* @param {string} str path to normalize
|
|
83
|
+
* @returns {string} path that starts and ends with a slash
|
|
84
|
+
*/
|
|
85
|
+
normalizePath: (str: string) => string;
|
|
74
86
|
/**
|
|
75
87
|
* Checks if HTML element is visible
|
|
76
88
|
* @param {Element} element to be checked in DOM
|
|
@@ -124,7 +136,7 @@ export declare const GenericHelpers: {
|
|
|
124
136
|
* @param parenthesis
|
|
125
137
|
* @returns
|
|
126
138
|
*/
|
|
127
|
-
replaceVars(inputString: string, params: Record<string, any>, prefix: string, parenthesis?: boolean): string;
|
|
139
|
+
replaceVars(inputString: string, params: Record<string, any>, prefix: string, parenthesis?: boolean, slashStop?: boolean): string;
|
|
128
140
|
/**
|
|
129
141
|
* Escapes special characters in a string for use in a regular expression.
|
|
130
142
|
* @param string
|
|
@@ -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 '../../types/navigation';
|
|
3
|
+
import { AppSwitcher, ExternalLink, Node, PathData, TitleResolver } 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;
|
|
@@ -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.
|
|
@@ -27,4 +26,23 @@ export declare const NavigationHelpers: {
|
|
|
27
26
|
* @returns The redirect path if valid, undefined otherwise
|
|
28
27
|
*/
|
|
29
28
|
validatePathAndGetRedirect: (path: string, luigi: Luigi) => Promise<string | undefined>;
|
|
29
|
+
fetchNodeTitleData(node: Node, context: any): Promise<{
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: string;
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a nested property value defined by a chain string
|
|
35
|
+
* @param {*} obj - the object
|
|
36
|
+
* @param {*} propChain - a string defining the property chain
|
|
37
|
+
* @param {*} fallback - fallback value if resolution fails
|
|
38
|
+
* @returns the value or fallback
|
|
39
|
+
*/
|
|
40
|
+
getPropertyChainValue(obj: Record<string, unknown>, propChain?: string, fallback?: any): any;
|
|
41
|
+
substituteVars(resolver: TitleResolver, context: Record<string, unknown>): TitleResolver;
|
|
42
|
+
_fetch(url: string, options: RequestInit): Promise<Response>;
|
|
43
|
+
processTitleData(data: Record<string, unknown>, resolver: TitleResolver): {
|
|
44
|
+
label: string;
|
|
45
|
+
icon?: string;
|
|
46
|
+
};
|
|
47
|
+
openExternalLink(externalLink: ExternalLink, pathParams?: Record<string, any>): void;
|
|
30
48
|
};
|