@luigi-project/core-modular 0.0.1-dev.20260181313
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/App.svelte.d.ts +1 -0
- package/README.md +13 -0
- package/core-api/auth.d.ts +92 -0
- package/core-api/feature-toggles.d.ts +33 -0
- package/core-api/luigi.d.ts +79 -0
- package/core-api/navigation.d.ts +15 -0
- package/core-api/routing.d.ts +43 -0
- package/core-api/theming.d.ts +78 -0
- package/core-api/ux.d.ts +22 -0
- package/luigi-engine.d.ts +40 -0
- package/luigi.js +34 -0
- package/luigi.js.map +1 -0
- package/main.d.ts +1 -0
- package/modules/communicaton-module.d.ts +6 -0
- package/modules/routing-module.d.ts +18 -0
- package/modules/ui-module.d.ts +14 -0
- package/modules/ux-module.d.ts +49 -0
- package/package.json +22 -0
- package/services/auth-layer.service.d.ts +24 -0
- package/services/auth-store.service.d.ts +23 -0
- package/services/dirty-status.service.d.ts +41 -0
- package/services/i18n.service.d.ts +81 -0
- package/services/modal.service.d.ts +52 -0
- package/services/navigation.service.d.ts +213 -0
- package/services/node-data-management.service.d.ts +45 -0
- package/services/routing.service.d.ts +103 -0
- package/services/service-registry.d.ts +42 -0
- package/services/viewurl-decorator.d.ts +7 -0
- package/types/connector.d.ts +26 -0
- package/utilities/defaultLuigiTranslationTable.d.ts +1 -0
- package/utilities/helpers/async-helpers.d.ts +13 -0
- package/utilities/helpers/auth-helpers.d.ts +22 -0
- package/utilities/helpers/config-helpers.d.ts +19 -0
- package/utilities/helpers/escaping-helpers.d.ts +10 -0
- package/utilities/helpers/event-listener-helpers.d.ts +7 -0
- package/utilities/helpers/generic-helpers.d.ts +78 -0
- package/utilities/helpers/navigation-helpers.d.ts +15 -0
- package/utilities/helpers/routing-helpers.d.ts +254 -0
- package/utilities/helpers/storage-helpers.d.ts +25 -0
- package/utilities/helpers/usersetting-dialog-helpers.d.ts +8 -0
- package/utilities/luigi-config-defaults.d.ts +21 -0
- package/utilities/store.d.ts +11 -0
package/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ExternalLink, Node, PageErrorHandler } from '../services/navigation.service';
|
|
2
|
+
import { Luigi } from '../core-api/luigi';
|
|
3
|
+
export declare const RoutingModule: {
|
|
4
|
+
init: (luigi: Luigi) => void;
|
|
5
|
+
handlePageErrorHandler: (pageErrorHandler: PageErrorHandler, node: Node, luigi: Luigi) => void;
|
|
6
|
+
handleExternalLinkNavigation: (externalLink: ExternalLink) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Adds search parameters to the URL based on client permissions defined in the current navigation node.
|
|
9
|
+
*
|
|
10
|
+
* Only parameters explicitly allowed (with `write: true` permission) in the current node's `clientPermissions.urlParameters`
|
|
11
|
+
* are added to the URL. Parameters without permission will trigger a warning in the console and will not be added.
|
|
12
|
+
*
|
|
13
|
+
* @param searchParams - An object containing key-value pairs of search parameters to be added to the URL.
|
|
14
|
+
* @param keepBrowserHistory - If `true`, the browser history will be preserved when updating the URL.
|
|
15
|
+
* @param luigi - The Luigi core instance used to interact with the routing API.
|
|
16
|
+
*/
|
|
17
|
+
addSearchParamsFromClient(searchParams: Record<string, any>, keepBrowserHistory: boolean, luigi: Luigi): void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
import { NavigationService, ModalSettings } from '../services/navigation.service';
|
|
3
|
+
import { RoutingService } from '../services/routing.service';
|
|
4
|
+
export declare const UIModule: {
|
|
5
|
+
navService: NavigationService;
|
|
6
|
+
routingService: RoutingService;
|
|
7
|
+
luigi: Luigi;
|
|
8
|
+
init: (luigi: Luigi) => void;
|
|
9
|
+
update: (scopes?: string[]) => void;
|
|
10
|
+
updateMainContent: (currentNode: any, luigi: Luigi) => Promise<void>;
|
|
11
|
+
openModal: (luigi: Luigi, node: any, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
|
|
12
|
+
updateModalSettings: (modalSettings: ModalSettings, addHistoryEntry: boolean, luigi: Luigi) => void;
|
|
13
|
+
openDrawer: (luigi: Luigi, node: any, modalSettings: ModalSettings, onCloseCallback?: () => void) => Promise<void>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LuigiCompoundContainer, LuigiContainer } from '@luigi-project/container';
|
|
2
|
+
import { Luigi } from '../core-api/luigi';
|
|
3
|
+
export interface AlertSettings {
|
|
4
|
+
text?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
links?: Record<string, Link>;
|
|
7
|
+
closeAfter?: number;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AlertHandler {
|
|
11
|
+
openFromClient: boolean;
|
|
12
|
+
close(): void;
|
|
13
|
+
link(linkKey: string): boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface ProcessedAlertSettings {
|
|
16
|
+
settings: AlertSettings;
|
|
17
|
+
}
|
|
18
|
+
export interface Link {
|
|
19
|
+
elemId: string;
|
|
20
|
+
url?: string;
|
|
21
|
+
dismissKey?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ProcessedTextAndLinks {
|
|
24
|
+
sanitizedText: string;
|
|
25
|
+
links: Link[];
|
|
26
|
+
}
|
|
27
|
+
export interface ConfirmationModalSettings {
|
|
28
|
+
icon?: string;
|
|
29
|
+
type?: string;
|
|
30
|
+
header?: string;
|
|
31
|
+
body?: string;
|
|
32
|
+
buttonConfirm?: string;
|
|
33
|
+
buttonDismiss?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ConfirmationModalHandler {
|
|
36
|
+
confirm(): void;
|
|
37
|
+
dismiss(): void;
|
|
38
|
+
}
|
|
39
|
+
export interface UserSettings {
|
|
40
|
+
[key: string]: number | string | boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const UXModule: {
|
|
43
|
+
luigi: Luigi | undefined;
|
|
44
|
+
documentTitle: any;
|
|
45
|
+
init: (luigi: Luigi) => void;
|
|
46
|
+
processAlert: (alertSettings: AlertSettings, openFromClient: boolean, containerElement: LuigiContainer | LuigiCompoundContainer) => void;
|
|
47
|
+
handleConfirmationModalRequest: (confirmationModalSettings: ConfirmationModalSettings, containerElement: LuigiContainer | LuigiCompoundContainer) => void;
|
|
48
|
+
handleDirtyStatusRequest: (isDirty: boolean, source: any) => void;
|
|
49
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@luigi-project/core-modular",
|
|
3
|
+
"description": "Javascript library supporting consumers of the Luigi framework",
|
|
4
|
+
"license": "Apache-2.0",
|
|
5
|
+
"main": "luigi.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+ssh://git@github.com/SAP/luigi.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"tag": "luigi"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"luigi",
|
|
15
|
+
"core",
|
|
16
|
+
"UI",
|
|
17
|
+
"extensibility",
|
|
18
|
+
"micro-frontends",
|
|
19
|
+
"microfrontends"
|
|
20
|
+
],
|
|
21
|
+
"version": "0.0.1-dev.20260181313"
|
|
22
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LuigiStore } from '../utilities/store';
|
|
2
|
+
declare class AuthLayerSvcClass {
|
|
3
|
+
idpProviderInstance: any;
|
|
4
|
+
private _userInfoStore;
|
|
5
|
+
private _loggedInStore;
|
|
6
|
+
constructor();
|
|
7
|
+
setUserInfo(uInfo: any): void;
|
|
8
|
+
setLoggedIn(loggedIn: boolean): void;
|
|
9
|
+
getUserInfoStore(): LuigiStore;
|
|
10
|
+
getLoggedInStore(): LuigiStore;
|
|
11
|
+
init(): Promise<any>;
|
|
12
|
+
checkAuth(idpProviderSettings: any): Promise<any>;
|
|
13
|
+
startAuthorization(): Promise<any>;
|
|
14
|
+
logout(): void;
|
|
15
|
+
createIdpProviderException(message: string): {
|
|
16
|
+
message: string;
|
|
17
|
+
name: string;
|
|
18
|
+
};
|
|
19
|
+
getIdpProviderInstance(idpProviderName: string, idpProviderSettings: any): Promise<any>;
|
|
20
|
+
unload(): void;
|
|
21
|
+
resetExpirationChecks(): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const AuthLayerSvc: AuthLayerSvcClass;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare class AuthStoreSvcClass {
|
|
2
|
+
private _authKey;
|
|
3
|
+
private _storageType;
|
|
4
|
+
private _defaultStorage;
|
|
5
|
+
private _newlyAuthorizedKey;
|
|
6
|
+
private _invalidStorageMsg;
|
|
7
|
+
private _internalStorage;
|
|
8
|
+
constructor();
|
|
9
|
+
reset(): void;
|
|
10
|
+
getStorageKey(): any;
|
|
11
|
+
getStorageType(): string;
|
|
12
|
+
getAuthData(): any;
|
|
13
|
+
setAuthData(values: any): void;
|
|
14
|
+
removeAuthData(): void;
|
|
15
|
+
isNewlyAuthorized(): boolean;
|
|
16
|
+
setNewlyAuthorized(): void;
|
|
17
|
+
removeNewlyAuthorized(): void;
|
|
18
|
+
_getWebStorage(sType: string): Storage;
|
|
19
|
+
_setStore(key: string, data: any): void;
|
|
20
|
+
_getStore(key: string): any;
|
|
21
|
+
}
|
|
22
|
+
export declare const AuthStoreSvc: AuthStoreSvcClass;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare class DirtyStatusService {
|
|
2
|
+
unsavedChanges: {
|
|
3
|
+
isDirty?: boolean;
|
|
4
|
+
persistUrl?: string | null;
|
|
5
|
+
dirtySet?: Set<any>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Initializes the `unsavedChanges` property with default values.
|
|
9
|
+
* Sets `isDirty` to `false` and `persistUrl` to `null`, indicating that there are no unsaved changes initially.
|
|
10
|
+
*/
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Updates the dirty status of a given source and manages the set of unsaved changes.
|
|
14
|
+
*
|
|
15
|
+
* If the dirty set does not exist or is not a `Set`, it initializes a new `Set` and adds the source to it.
|
|
16
|
+
* The current URL is persisted in the `unsavedChanges` object.
|
|
17
|
+
* If `isDirty` is `true`, the source is added to the dirty set; otherwise, it is removed.
|
|
18
|
+
*
|
|
19
|
+
* @param isDirty - Indicates whether the source has unsaved changes.
|
|
20
|
+
* @param source - The source object to be marked as dirty or clean.
|
|
21
|
+
*/
|
|
22
|
+
updateDirtyStatus(isDirty: boolean, source: any): void;
|
|
23
|
+
/**
|
|
24
|
+
* Clears the dirty state for a given source or all sources.
|
|
25
|
+
*
|
|
26
|
+
* If a source is provided, removes it from the set of unsaved changes.
|
|
27
|
+
* If no source is provided, clears all unsaved changes.
|
|
28
|
+
*
|
|
29
|
+
* @param source - The source to clear from the dirty set. If omitted, all sources are cleared.
|
|
30
|
+
*/
|
|
31
|
+
clearDirtyState(source?: any): void;
|
|
32
|
+
/**
|
|
33
|
+
* Determines whether there are unsaved changes.
|
|
34
|
+
*
|
|
35
|
+
* Checks if the `dirtySet` exists and contains any items, indicating unsaved changes.
|
|
36
|
+
* If `dirtySet` is not present, falls back to the `isDirty` flag.
|
|
37
|
+
*
|
|
38
|
+
* @returns {boolean} `true` if there are unsaved changes, otherwise `false`.
|
|
39
|
+
*/
|
|
40
|
+
readDirtyStatus(): boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { LuigiContainer, LuigiCompoundContainer } from '@luigi-project/container';
|
|
2
|
+
import { Luigi } from '../core-api/luigi';
|
|
3
|
+
/**
|
|
4
|
+
* Localization-related functions
|
|
5
|
+
*/
|
|
6
|
+
export declare class i18nService {
|
|
7
|
+
private luigi;
|
|
8
|
+
currentLocaleStorageKey: string;
|
|
9
|
+
defaultLocale: string;
|
|
10
|
+
listeners: Record<number, (locale: string) => void>;
|
|
11
|
+
translationImpl: any;
|
|
12
|
+
translationTable: Record<string, any>;
|
|
13
|
+
constructor(luigi: Luigi);
|
|
14
|
+
_init(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the current locale.
|
|
17
|
+
* @returns {string} current locale
|
|
18
|
+
*/
|
|
19
|
+
getCurrentLocale(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Sets current locale to the specified one.
|
|
22
|
+
* @param {string} locale locale to be set as the current locale
|
|
23
|
+
*/
|
|
24
|
+
setCurrentLocale(locale: string, containerElement?: LuigiContainer | LuigiCompoundContainer): void;
|
|
25
|
+
/**
|
|
26
|
+
* Registers a listener for locale changes.
|
|
27
|
+
* @param {Function} listener function called on every locale change with the new locale as argument
|
|
28
|
+
* @returns {number | null} listener ID associated with the given listener; use it when removing the listener
|
|
29
|
+
*/
|
|
30
|
+
addCurrentLocaleChangeListener(listener: (locale: string) => void): number | null;
|
|
31
|
+
/**
|
|
32
|
+
* Unregisters a listener for locale changes.
|
|
33
|
+
* @param {number} listenerId listener ID associated with the listener to be removed, returned by addCurrentLocaleChangeListener
|
|
34
|
+
*/
|
|
35
|
+
removeCurrentLocaleChangeListener(listenerId: number): void;
|
|
36
|
+
/**
|
|
37
|
+
* Gets translated text for the specified key in the current locale or in the specified one.
|
|
38
|
+
* Property values for token replacement in the localization key will be taken from the specified interpolations object.
|
|
39
|
+
*
|
|
40
|
+
* <!-- add-attribute:class:success -->
|
|
41
|
+
* > **TIP**: Be aware that this function is not asynchronous and therefore the translation table must be existing already at initialization. Take a look at our [i18n](i18n.md) section for an implementation suggestion.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} key key to be translated
|
|
44
|
+
* @param {Object} interpolations object with properties that will be used for token replacements in the localization key
|
|
45
|
+
* @param {string} locale optional locale to get the translation for; default is the current locale
|
|
46
|
+
* @returns {string} translated text for the specified key
|
|
47
|
+
*/
|
|
48
|
+
getTranslation(key: string, interpolations?: undefined, locale?: undefined): string;
|
|
49
|
+
/**
|
|
50
|
+
* @private
|
|
51
|
+
*/
|
|
52
|
+
private _notifyLocaleChange;
|
|
53
|
+
/**
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
56
|
+
private _initCustomImplementation;
|
|
57
|
+
/**
|
|
58
|
+
* @private
|
|
59
|
+
* Sets locale to all Luigi containers
|
|
60
|
+
*/
|
|
61
|
+
private broadcastLocaleToAllContainers;
|
|
62
|
+
/**
|
|
63
|
+
* @private
|
|
64
|
+
* Finds the translated value based on given key.
|
|
65
|
+
* @param {string} key key to be translated
|
|
66
|
+
* @param {*} obj translation table
|
|
67
|
+
* @param {Object | undefined} interpolations object with properties that will be used for token replacements in the localization key
|
|
68
|
+
* @returns {string | undefined} current locale
|
|
69
|
+
*/
|
|
70
|
+
private findTranslation;
|
|
71
|
+
/**
|
|
72
|
+
* @private
|
|
73
|
+
* Replaces values that are defiend in translation strings
|
|
74
|
+
* @param {string} value string to be translated
|
|
75
|
+
* @param {Object} interpolations translation table
|
|
76
|
+
* @returns {string} current locale
|
|
77
|
+
* @example
|
|
78
|
+
* findInterpolations('Environment {num}', {num: 1})
|
|
79
|
+
*/
|
|
80
|
+
private findInterpolations;
|
|
81
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
import { ModalSettings } from './navigation.service';
|
|
3
|
+
export interface ModalPromiseObject {
|
|
4
|
+
closePromise?: Promise<void>;
|
|
5
|
+
resolveFn?: () => void;
|
|
6
|
+
onCloseRequestHandler?: () => void;
|
|
7
|
+
onInternalClose?: () => void;
|
|
8
|
+
modalsettings?: ModalSettings;
|
|
9
|
+
}
|
|
10
|
+
export declare class ModalService {
|
|
11
|
+
private luigi;
|
|
12
|
+
_modalStack: ModalPromiseObject[];
|
|
13
|
+
modalSettings: ModalSettings;
|
|
14
|
+
constructor(luigi: Luigi);
|
|
15
|
+
/**
|
|
16
|
+
* Closes the topmost modal in the stack.
|
|
17
|
+
*/
|
|
18
|
+
closeModals(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Adds a modal promise object to the internal modal stack.
|
|
21
|
+
*
|
|
22
|
+
* This method is used to track active modals in a last-in-first-out (LIFO) stack,
|
|
23
|
+
* enabling the service to manage and resolve/dismiss modals in the correct order.
|
|
24
|
+
*
|
|
25
|
+
* @param modalObj - The modal promise object to register on the stack.
|
|
26
|
+
* @returns {void}
|
|
27
|
+
*/
|
|
28
|
+
registerModal(modalObj: ModalPromiseObject): void;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the settings of the first modal in the stack.
|
|
31
|
+
* @returns The settings of the first modal in the stack, or an empty object if the stack is empty.
|
|
32
|
+
*/
|
|
33
|
+
getModalSettings(): ModalSettings | {};
|
|
34
|
+
/**
|
|
35
|
+
* Gets the current number of modals in the stack.
|
|
36
|
+
* @returns number The current number of modals in the stack.
|
|
37
|
+
*/
|
|
38
|
+
getModalStackLength(): number;
|
|
39
|
+
/**
|
|
40
|
+
* Updates the settings of the first modal in the stack.
|
|
41
|
+
* @param settings modal settings to update the first modal with
|
|
42
|
+
*/
|
|
43
|
+
updateFirstModalSettings(settings: ModalSettings): void;
|
|
44
|
+
/**
|
|
45
|
+
* Clears the entire modal stack.
|
|
46
|
+
*/
|
|
47
|
+
clearModalStack(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Removes the last modal from the stack.
|
|
50
|
+
*/
|
|
51
|
+
removeLastModalFromStack(): void;
|
|
52
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { Luigi } from '../core-api/luigi';
|
|
2
|
+
export interface TopNavData {
|
|
3
|
+
appTitle: string;
|
|
4
|
+
logo: string;
|
|
5
|
+
topNodes: NavItem[];
|
|
6
|
+
productSwitcher?: ProductSwitcher;
|
|
7
|
+
profile?: ProfileSettings;
|
|
8
|
+
appSwitcher?: AppSwitcher;
|
|
9
|
+
navClick?: (item: NavItem) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface AppSwitcher {
|
|
12
|
+
showMainAppEntry?: boolean;
|
|
13
|
+
items?: AppSwitcherItem[];
|
|
14
|
+
itemRenderer?: (item: AppSwitcherItem, slot: HTMLElement, appSwitcherApiObj?: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface AppSwitcherItem {
|
|
17
|
+
title?: string;
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
link?: string;
|
|
20
|
+
selectionConditions?: selectionConditions;
|
|
21
|
+
}
|
|
22
|
+
export interface selectionConditions {
|
|
23
|
+
route?: string;
|
|
24
|
+
contextCriteria?: ContextCriteria[];
|
|
25
|
+
}
|
|
26
|
+
export interface ContextCriteria {
|
|
27
|
+
key: string;
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
export interface ProfileSettings {
|
|
31
|
+
authEnabled: boolean;
|
|
32
|
+
signedIn: boolean;
|
|
33
|
+
logout: ProfileLogout;
|
|
34
|
+
items?: ProfileItem[];
|
|
35
|
+
staticUserInfoFn?: () => Promise<UserInfo>;
|
|
36
|
+
onUserInfoUpdate: (fn: (uInfo: UserInfo) => void) => void;
|
|
37
|
+
itemClick: (item: ProfileItem) => void;
|
|
38
|
+
}
|
|
39
|
+
export interface ProfileLogout {
|
|
40
|
+
label?: string;
|
|
41
|
+
icon?: string;
|
|
42
|
+
testId?: string;
|
|
43
|
+
altText?: string;
|
|
44
|
+
doLogout: () => void;
|
|
45
|
+
}
|
|
46
|
+
export interface ProfileItem {
|
|
47
|
+
label?: string;
|
|
48
|
+
link?: string;
|
|
49
|
+
externalLink?: ExternalLink;
|
|
50
|
+
icon?: string;
|
|
51
|
+
testId?: string;
|
|
52
|
+
altText?: string;
|
|
53
|
+
openNodeAsModal?: boolean | ModalSettings;
|
|
54
|
+
}
|
|
55
|
+
export interface UserInfo {
|
|
56
|
+
name?: string;
|
|
57
|
+
initials?: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
picture?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface LeftNavData {
|
|
63
|
+
selectedNode: any;
|
|
64
|
+
items: NavItem[];
|
|
65
|
+
basePath: string;
|
|
66
|
+
sideNavFooterText?: string;
|
|
67
|
+
navClick?: (item: NavItem) => void;
|
|
68
|
+
}
|
|
69
|
+
export interface PathData {
|
|
70
|
+
selectedNode?: Node;
|
|
71
|
+
selectedNodeChildren?: Node[];
|
|
72
|
+
nodesInPath?: Node[];
|
|
73
|
+
rootNodes: Node[];
|
|
74
|
+
pathParams: Record<string, any>;
|
|
75
|
+
}
|
|
76
|
+
export interface Node {
|
|
77
|
+
visibleForFeatureToggles?: string[];
|
|
78
|
+
anonymousAccess?: any;
|
|
79
|
+
category?: any;
|
|
80
|
+
children?: Node[];
|
|
81
|
+
clientPermissions?: {
|
|
82
|
+
changeCurrentLocale?: boolean;
|
|
83
|
+
urlParameters?: Record<string, any>;
|
|
84
|
+
};
|
|
85
|
+
context?: Record<string, any>;
|
|
86
|
+
drawer?: ModalSettings;
|
|
87
|
+
externalLink?: ExternalLink;
|
|
88
|
+
hideFromNav?: boolean;
|
|
89
|
+
hideSideNav?: boolean;
|
|
90
|
+
icon?: string;
|
|
91
|
+
keepSelectedForChildren?: boolean;
|
|
92
|
+
label?: string;
|
|
93
|
+
onNodeActivation?: (node: Node) => boolean | void;
|
|
94
|
+
openNodeInModal?: boolean;
|
|
95
|
+
pageErrorHandler?: PageErrorHandler;
|
|
96
|
+
pathSegment?: string;
|
|
97
|
+
tabNav?: boolean;
|
|
98
|
+
tooltip?: string;
|
|
99
|
+
viewUrl?: string;
|
|
100
|
+
isRootNode?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface PageErrorHandler {
|
|
103
|
+
timeout: number;
|
|
104
|
+
viewUrl?: string;
|
|
105
|
+
redirectPath?: string;
|
|
106
|
+
errorFn?: (node?: Node) => void;
|
|
107
|
+
}
|
|
108
|
+
export interface Category {
|
|
109
|
+
collabsible?: boolean;
|
|
110
|
+
icon?: string;
|
|
111
|
+
id: string;
|
|
112
|
+
isGroup?: boolean;
|
|
113
|
+
label?: string;
|
|
114
|
+
nodes?: NavItem[];
|
|
115
|
+
tooltip?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface NavItem {
|
|
118
|
+
node?: Node;
|
|
119
|
+
category?: Category;
|
|
120
|
+
selected?: boolean;
|
|
121
|
+
}
|
|
122
|
+
export interface TabNavData {
|
|
123
|
+
selectedNode?: any;
|
|
124
|
+
items?: NavItem[];
|
|
125
|
+
basePath?: string;
|
|
126
|
+
navClick?: (item: NavItem) => void;
|
|
127
|
+
}
|
|
128
|
+
export interface ModalSettings {
|
|
129
|
+
size?: 'fullscreen' | 'l' | 'm' | 's';
|
|
130
|
+
width?: string;
|
|
131
|
+
height?: string;
|
|
132
|
+
title?: string;
|
|
133
|
+
closebtn_data_testid?: string;
|
|
134
|
+
keepPrevious?: boolean;
|
|
135
|
+
}
|
|
136
|
+
export interface ProductSwitcher {
|
|
137
|
+
altText?: string;
|
|
138
|
+
columns?: number;
|
|
139
|
+
icon?: string;
|
|
140
|
+
items?: [ProductSwitcherItem];
|
|
141
|
+
label?: string;
|
|
142
|
+
testId?: string;
|
|
143
|
+
}
|
|
144
|
+
export interface ProductSwitcherItem {
|
|
145
|
+
altText?: string;
|
|
146
|
+
externalLink?: ExternalLink;
|
|
147
|
+
icon?: string;
|
|
148
|
+
label?: string;
|
|
149
|
+
link?: string;
|
|
150
|
+
selected?: boolean;
|
|
151
|
+
subTitle?: string;
|
|
152
|
+
testId?: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ExternalLink {
|
|
155
|
+
url?: string;
|
|
156
|
+
sameWindow?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export declare class NavigationService {
|
|
159
|
+
private luigi;
|
|
160
|
+
constructor(luigi: Luigi);
|
|
161
|
+
getPathData(path: string): PathData;
|
|
162
|
+
findMatchingNode(urlPathElement: string, nodes: Node[]): Node | undefined;
|
|
163
|
+
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>;
|
|
167
|
+
/**
|
|
168
|
+
* getTruncatedChildren
|
|
169
|
+
*
|
|
170
|
+
* Returns an array of children without the childs below
|
|
171
|
+
* last node that has keepSelectedForChildren or tabnav enabled
|
|
172
|
+
* @param array children
|
|
173
|
+
* @returns array children
|
|
174
|
+
*/
|
|
175
|
+
getTruncatedChildren(children: any): any[];
|
|
176
|
+
applyNavGroups(items: NavItem[]): NavItem[];
|
|
177
|
+
getLeftNavData(path: string, pData?: PathData): LeftNavData;
|
|
178
|
+
navItemClick(item: Node, parentPath: string): void;
|
|
179
|
+
getTopNavData(path: string, pData?: PathData): TopNavData;
|
|
180
|
+
getParentNode(node: Node | undefined, pathData: PathData): Node | undefined;
|
|
181
|
+
getAppSwitcherData(appSwitcherData: AppSwitcher, headerSettings: any): AppSwitcher | undefined;
|
|
182
|
+
getTabNavData(path: string, pData?: PathData): TabNavData;
|
|
183
|
+
/**
|
|
184
|
+
* Handles changes between navigation nodes by invoking a configured hook function.
|
|
185
|
+
*
|
|
186
|
+
* This method retrieves the `navigation.nodeChangeHook` function from the Luigi configuration.
|
|
187
|
+
* If the hook is defined and is a function, it is called with the previous and next node as arguments.
|
|
188
|
+
* If the hook is defined but not a function, a warning is logged to the console.
|
|
189
|
+
*
|
|
190
|
+
* @param prevNode - The previous navigation node, or `undefined` if there was no previous node.
|
|
191
|
+
* @param nextNode - The new navigation node that is being navigated to.
|
|
192
|
+
*/
|
|
193
|
+
onNodeChange(prevNode: Node | undefined, nextNode: Node): void;
|
|
194
|
+
/**
|
|
195
|
+
* Extracts navigation data from the provided path string.
|
|
196
|
+
*
|
|
197
|
+
* This method parses the given path to retrieve structured path data and the last node object
|
|
198
|
+
* in the navigation hierarchy. It utilizes internal helpers to process the path and extract
|
|
199
|
+
* relevant navigation information.
|
|
200
|
+
*
|
|
201
|
+
* @param path - The navigation path string to extract data from.
|
|
202
|
+
* @returns A promise that resolves to an object containing:
|
|
203
|
+
* - `nodeObject`: The last node object in the navigation path.
|
|
204
|
+
* - `pathData`: The structured data representation of the path.
|
|
205
|
+
*/
|
|
206
|
+
extractDataFromPath(path: string): Promise<{
|
|
207
|
+
nodeObject: Node;
|
|
208
|
+
pathData: PathData;
|
|
209
|
+
}>;
|
|
210
|
+
private resolveTooltipText;
|
|
211
|
+
private prepareRootNodes;
|
|
212
|
+
private getAccessibleNodes;
|
|
213
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Node } from './navigation.service';
|
|
2
|
+
export declare class NodeDataManagementService {
|
|
3
|
+
dataManagement: Map<any, any>;
|
|
4
|
+
navPath: string;
|
|
5
|
+
constructor();
|
|
6
|
+
/**
|
|
7
|
+
* Stores node as key and value as value
|
|
8
|
+
* @param {Node} node
|
|
9
|
+
* @param {any} value
|
|
10
|
+
*/
|
|
11
|
+
setChildren(node: Node, value: any): void;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the map entry which belongs to the node, stored as key
|
|
14
|
+
* @param {Node} node
|
|
15
|
+
* @returns {any} map entry
|
|
16
|
+
*/
|
|
17
|
+
getChildren(node: Node): any;
|
|
18
|
+
/**
|
|
19
|
+
* Checks if there is an entry of given node
|
|
20
|
+
* @param {Node} node
|
|
21
|
+
* @returns {boolean} true or false
|
|
22
|
+
*/
|
|
23
|
+
hasChildren(node: Node): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Stores root node as object with key '_luigiRootNode'
|
|
26
|
+
* @param {Node} node
|
|
27
|
+
*/
|
|
28
|
+
setRootNode(node: Node): void;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the root node
|
|
31
|
+
* @returns {Node} root node
|
|
32
|
+
*/
|
|
33
|
+
getRootNode(): Node;
|
|
34
|
+
/**
|
|
35
|
+
* Checks if root node exists
|
|
36
|
+
* @returns {boolean} true or false
|
|
37
|
+
*/
|
|
38
|
+
hasRootNode(): boolean;
|
|
39
|
+
deleteCache(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Deletes node from cache and its children recursively
|
|
42
|
+
* @param {Node} node
|
|
43
|
+
*/
|
|
44
|
+
deleteNodesRecursively(node: Node): void;
|
|
45
|
+
}
|