@luigi-project/core-modular 0.0.10 → 0.0.11

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.
@@ -2,6 +2,32 @@ import { Luigi } from './luigi';
2
2
  export declare class CustomMessages {
3
3
  luigi: Luigi;
4
4
  constructor(luigi: Luigi);
5
+ /**
6
+ * Sends a custom message to all opened micro frontends.
7
+ * @param {Object} message - an object containing data to be sent to the micro frontend to process it further. This object is set as an input parameter of the custom message listener on the micro frontend side.
8
+ * @param {string} message.id - the id of the message
9
+ * @param {*} message.MY_DATA_FIELD - any other message data field
10
+ * @example
11
+ * Luigi.customMessages().sendToAll({
12
+ * id: 'myprefix.my-custom-message-for-client',
13
+ * dataField1: 'here goes some data',
14
+ * moreData: 'here goes some more'
15
+ * });
16
+ */
5
17
  sendToAll(message: Record<string, any>): void;
18
+ /**
19
+ * Sends a message to specific micro frontend identified with an id.
20
+ * Use Luigi.elements().getMicrofrontends() to get the iframe id.
21
+ * @param {string} microfrontendId - the id of the micro frontend
22
+ * @param {Object} message - an object containing data to be sent to the micro frontend to process it further. This object is set as an input parameter of the custom message listener on the micro frontend side
23
+ * @param {string} message.id - the id of the message
24
+ * @param {*} message.MY_DATA_FIELD - any other message data field
25
+ * @example
26
+ * Luigi.customMessages().send(microfrontend.id, {
27
+ * id: 'myprefix.my-custom-message-for-client',
28
+ * dataField1: 'here goes some data',
29
+ * moreData: 'here goes some more'
30
+ * });
31
+ */
6
32
  send(microfrontendId: string, message: Record<string, any>): void;
7
33
  }
@@ -0,0 +1,61 @@
1
+ import { GlobalSearchService } from '../services/global-search.service';
2
+ import { SearchResultItem } from '../types/global-search';
3
+ import { Luigi } from './luigi';
4
+ export declare class GlobalSearch {
5
+ luigi: Luigi;
6
+ globalSearchService: GlobalSearchService;
7
+ constructor(luigi: Luigi);
8
+ /**
9
+ * Opens the global search field.
10
+ * @example Luigi.globalSearch().openSearchField();
11
+ */
12
+ openSearchField(): void;
13
+ /**
14
+ * Closes the global search field.
15
+ * @example Luigi.globalSearch().closeSearchField();
16
+ */
17
+ closeSearchField(): void;
18
+ /**
19
+ * Clears the global search field.
20
+ * @example Luigi.globalSearch().clearSearchField();
21
+ */
22
+ clearSearchField(): void;
23
+ /**
24
+ * Opens the global search result. By standard it is a popover.
25
+ * @param {Array<SearchResultItem>} searchResultItems
26
+ * @example
27
+ * let searchResultItem = {
28
+ * pathObject: {
29
+ * link,
30
+ * params: {}
31
+ * },
32
+ * label,
33
+ * description
34
+ * }
35
+ *
36
+ * Luigi.globalSearch().showSearchResult([searchResultItem1, searchResultItem2]);
37
+ */
38
+ showSearchResult(searchResultItems: SearchResultItem[]): void;
39
+ /**
40
+ * Closes the global search result. By standard it is rendered as a popover.
41
+ * @example Luigi.globalSearch().closeSearchResult();
42
+ */
43
+ closeSearchResult(): void;
44
+ /**
45
+ * Gets the value of the search input field.
46
+ * @example Luigi.globalSearch().getSearchString();
47
+ */
48
+ getSearchString(): string;
49
+ /**
50
+ * Sets the value of the search input field.
51
+ * @param searchString search value
52
+ * @example Luigi.globalSearch().setSearchString('searchString');
53
+ */
54
+ setSearchString(searchString: string): void;
55
+ /**
56
+ * Sets the value of the Placeholder search input field.
57
+ * @param placeholder placeholder value
58
+ * @example Luigi.globalSearch().setSearchInputPlaceholder('HERE input Placeholder');
59
+ */
60
+ setSearchInputPlaceholder(placeholder: string): void;
61
+ }
@@ -3,6 +3,7 @@ import { i18nService } from '../services/i18n.service';
3
3
  import { Elements } from './dom-elements';
4
4
  import { LuigiAuthClass } from './auth';
5
5
  import { FeatureToggles } from './feature-toggles';
6
+ import { GlobalSearch } from './global-search';
6
7
  import { Navigation } from './navigation';
7
8
  import { Routing } from './routing';
8
9
  import { Theming } from './theming';
@@ -14,6 +15,7 @@ export declare class Luigi {
14
15
  _customMessages?: CustomMessages;
15
16
  _store: any;
16
17
  _featureToggles?: FeatureToggles;
18
+ _globalSearch?: GlobalSearch;
17
19
  _i18n: i18nService;
18
20
  _theming?: Theming;
19
21
  _routing?: Routing;
@@ -111,6 +113,7 @@ export declare class Luigi {
111
113
  navigation: () => Navigation;
112
114
  ux: () => UX;
113
115
  featureToggles: () => FeatureToggles;
116
+ globalSearch: () => GlobalSearch;
114
117
  routing: () => Routing;
115
118
  theming: () => Theming;
116
119
  auth: () => LuigiAuthClass;
@@ -62,4 +62,10 @@ export declare class Navigation {
62
62
  */
63
63
  fromParent(): Navigation;
64
64
  withParams(nodeParams: Record<string, any>): Navigation;
65
+ /**
66
+ * Refreshes top navigation badge counters by rendering the navigation again.
67
+ * @example
68
+ * Luigi.navigation().updateTopNavigation();
69
+ */
70
+ updateTopNavigation(): Promise<void>;
65
71
  }
package/core-api/ux.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AlertSettings, ConfirmationModalSettings } from '../modules/ux-module';
1
+ import { AlertSettings, ConfirmationModalSettings } from '../types/ux';
2
2
  import { DirtyStatusService } from '../services/dirty-status.service';
3
3
  import { Luigi } from './luigi';
4
4
  export declare class UX {
@@ -6,16 +6,109 @@ export declare class UX {
6
6
  dirtyStatusService: DirtyStatusService;
7
7
  private appLoadingIndicatorSelector;
8
8
  constructor(luigi: Luigi);
9
+ /**
10
+ * Shows an alert.
11
+ * @param {Object} settings - the settings for the alert
12
+ * @param {string} settings.text - the content of the alert. To add a link to the content, you have to set up the link in the `links` object. The key(s) in the `links` object must be used in the text to reference the links, wrapped in curly brackets with no spaces. If you do not specify any text, the alert is not displayed
13
+ * @param {('info'|'success'|'warning'|'error')} settings.type - sets the type of alert
14
+ * @param {Object} settings.links - provides links data
15
+ * @param {Object} settings.links.LINK_KEY - object containing the data for a particular link. To properly render the link in the alert message refer to the description of the **settings.text** parameter
16
+ * @param {string} settings.links.LINK_KEY.text - text which replaces the link identifier in the alert content
17
+ * @param {string} settings.links.LINK_KEY.url - URL to navigate when you click the link. Currently, only internal links are supported in the form of relative or absolute paths
18
+ * @param {string} settings.links.LINK_KEY.dismissKey - dismissKey which represents the key of the link.
19
+ * @param {number} settings.closeAfter - (optional) time in milliseconds that tells Luigi when to close the Alert automatically. If not provided, the Alert will stay on until closed manually. It has to be greater than `100`
20
+ * @returns {promise} which is resolved when the alert is dismissed
21
+ * @example
22
+ * const settings = {
23
+ * text: "Ut enim ad minim veniam, {goToHome} quis nostrud exercitation ullamco {relativePath}. Duis aute irure dolor {goToOtherProject} or {neverShowItAgain}",
24
+ * type: 'info',
25
+ * links: {
26
+ * goToHome: { text: 'homepage', url: '/overview' },
27
+ * goToOtherProject: { text: 'other project', url: '/projects/pr2' },
28
+ * relativePath: { text: 'relative hide side nav', url: 'hideSideNav' },
29
+ * neverShowItAgain: { text: 'Never show it again', dismissKey: 'neverShowItAgain' }
30
+ * },
31
+ * closeAfter: 3000
32
+ * }
33
+ * Luigi
34
+ * .ux()
35
+ * .showAlert(settings)
36
+ * .then(() => {
37
+ * // Logic to execute when the alert is dismissed
38
+ * });
39
+ */
9
40
  showAlert: (alertSettings: AlertSettings) => Promise<unknown>;
41
+ /**
42
+ * Shows a confirmation modal.
43
+ * @param {Object} settings - the settings of the confirmation modal. If you do not provide any value for any of the fields, a default value is used
44
+ * @param {('confirmation'|'success'|'warning'|'error'|'information')} settings.type - the content of the modal type. (Optional)
45
+ * @param {string} [settings.header="Confirmation"] - the content of the modal header
46
+ * @param {string} [settings.body="Are you sure you want to do this?"] - the content of the modal body. It supports HTML formatting elements such as `<br>`, `<b>`, `<strong>`, `<i>`, `<em>`, `<mark>`, `<small>`, `<del>`, `<ins>`, `<sub>`, `<sup>`.
47
+ * @param {string|false} [settings.buttonConfirm="Yes"] - the label for the modal confirmation button. If set to `false`, the button will not be shown.
48
+ * @param {string} [settings.buttonDismiss="No"] - the label for the modal dismiss button
49
+ * @returns {promise} which is resolved when accepting the confirmation modal and rejected when dismissing it
50
+ * @example
51
+ * const settings = {
52
+ * header: "Confirmation",
53
+ * body: "Are you sure you want to do this?",
54
+ * buttonConfirm: "Yes",
55
+ * buttonDismiss: "No"
56
+ * }
57
+ * Luigi
58
+ * .ux()
59
+ * .showConfirmationModal(settings)
60
+ * .then(() => {
61
+ * // Logic to execute when the confirmation modal is dismissed
62
+ * });
63
+ */
10
64
  showConfirmationModal: (settings: ConfirmationModalSettings) => Promise<unknown>;
65
+ /**
66
+ * Open user settings dialog
67
+ */
11
68
  openUserSettings: () => Promise<void>;
69
+ /**
70
+ * Close user settings dialog
71
+ */
12
72
  closeUserSettings: () => void;
73
+ /**
74
+ * Set the document title
75
+ * @param {string} documentTitle
76
+ * @example Luigi.ux().setDocumentTitle('Luigi');
77
+ */
13
78
  setDocumentTitle: (documentTitle: string) => void;
79
+ /**
80
+ * Get the document title
81
+ * @returns {string} a string, which is displayed in the tab.
82
+ * @example Luigi.ux().getDocumentTitle();
83
+ */
14
84
  getDocumentTitle: () => string;
85
+ /**
86
+ * Hides the app loading indicator.
87
+ */
15
88
  hideAppLoadingIndicator: () => void;
89
+ /**
90
+ * Sends message to show loading indicator
91
+ * @ignore
92
+ */
16
93
  showLoadingIndicator: (containerWrapper: HTMLElement) => void | undefined;
94
+ /**
95
+ * Sends message to hide loading indicator
96
+ * @ignore
97
+ */
17
98
  hideLoadingIndicator: (containerWrapper: HTMLElement) => void | undefined;
99
+ /**
100
+ * Adds backdrop. Function only used internally
101
+ * @private
102
+ */
18
103
  addBackdrop: () => void | undefined;
104
+ /**
105
+ * Removes backdrop. Function only used internally
106
+ * @private
107
+ */
19
108
  removeBackdrop: () => void | undefined;
109
+ /**
110
+ * Returns the dirty status, which is set by the Client via [setDirtyStatus](luigi-client-api.md#setdirtystatus). By default, the dirty status is `false`.
111
+ * @returns {boolean}
112
+ */
20
113
  getDirtyStatus: () => boolean;
21
114
  }
package/luigi-engine.d.ts CHANGED
@@ -28,8 +28,8 @@ export declare class LuigiEngine {
28
28
  luigi: import('./core-api/luigi').Luigi | undefined;
29
29
  documentTitle: any;
30
30
  init: (luigi: import('./core-api/luigi').Luigi) => void;
31
- processAlert: (alertSettings: import('./modules/ux-module').AlertSettings, openFromClient: boolean, containerElement: import('@luigi-project/container').LuigiContainer | import('@luigi-project/container').LuigiCompoundContainer) => void;
32
- handleConfirmationModalRequest: (confirmationModalSettings: import('./modules/ux-module').ConfirmationModalSettings, containerElement: import('@luigi-project/container').LuigiContainer | import('@luigi-project/container').LuigiCompoundContainer) => void;
31
+ processAlert: (alertSettings: import('./types/ux').AlertSettings, openFromClient: boolean, containerElement: import('@luigi-project/container').LuigiContainer | import('@luigi-project/container').LuigiCompoundContainer) => void;
32
+ handleConfirmationModalRequest: (confirmationModalSettings: import('./types/ux').ConfirmationModalSettings, containerElement: import('@luigi-project/container').LuigiContainer | import('@luigi-project/container').LuigiCompoundContainer) => void;
33
33
  handleDirtyStatusRequest: (isDirty: boolean, source: any) => void;
34
34
  };
35
35
  _routing: {