@visma-swno/vsn-navigation 1.1.0-beta.2 → 1.1.0-beta.21
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/dist/assets/vsn-navigation.d.ts +126 -26
- package/dist/assets/vsn-navigation.js +2787 -21
- package/dist/custom-elements.json +1 -0
- package/package.json +13 -6
|
@@ -1,43 +1,122 @@
|
|
|
1
|
-
import { AppModules } from '../shared/types/index.ts';
|
|
2
1
|
import { CSSResult } from 'lit';
|
|
3
|
-
import { FeedbackConfig } from '../shared/types/index.ts';
|
|
4
|
-
import { isTreeLeaf } from '../shared/types/index.ts';
|
|
5
|
-
import { isTreeParent } from '../shared/types/index.ts';
|
|
6
|
-
import { LanguageCode } from '../shared/types/index.ts';
|
|
7
2
|
import { LitElement } from 'lit';
|
|
8
|
-
import { ModuleItem } from '../shared/types/index.ts';
|
|
9
|
-
import { NavigationMenu } from '../shared/types/index.ts';
|
|
10
|
-
import { SearchConfig } from '../shared/types/index.ts';
|
|
11
3
|
import { TemplateResult } from 'lit-html';
|
|
12
|
-
import { TreeItem } from '../shared/types/index.ts';
|
|
13
|
-
import { TreeLeaf } from '../shared/types/index.ts';
|
|
14
|
-
import { TreeParent } from '../shared/types/index.ts';
|
|
15
|
-
import { VsnAuth } from '../shared/types/index.ts';
|
|
16
|
-
import { VsnNavigation } from '../shared/types/index.ts';
|
|
17
4
|
|
|
18
|
-
export
|
|
5
|
+
export declare type AppModules = {
|
|
6
|
+
/** Current module id (to be ignored from the list of modules) */
|
|
7
|
+
activeModuleId: string;
|
|
8
|
+
/** Current module label — shown before the modules list is asynchronously loaded */
|
|
9
|
+
activeModuleLabel: string;
|
|
10
|
+
/** Modules, or a loader for the modules */
|
|
11
|
+
modules: ModuleItem[] | (() => Promise<ModuleItem[]>);
|
|
12
|
+
};
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
declare type BaseTreeItem = {
|
|
15
|
+
/** id of the item, unique */
|
|
16
|
+
id: string;
|
|
17
|
+
/** The label to show for that item, in the relevant language */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Optional QA identifier rendered as a data-qa-id attribute on the nav item element */
|
|
20
|
+
'data-qa-id'?: string;
|
|
21
|
+
};
|
|
21
22
|
|
|
22
|
-
export
|
|
23
|
+
export declare type ButtonClickedEvent = {
|
|
24
|
+
/** The clicked HTMLButtonElement. Can be used as an anchor to position popups. */
|
|
25
|
+
target: HTMLButtonElement;
|
|
26
|
+
};
|
|
23
27
|
|
|
24
|
-
export
|
|
28
|
+
export declare type FeedbackConfig = {
|
|
29
|
+
workspaceId: string;
|
|
30
|
+
surveyId: string;
|
|
31
|
+
};
|
|
25
32
|
|
|
26
|
-
export
|
|
33
|
+
export declare function isTreeLeaf(item: TreeItem): item is TreeLeaf;
|
|
27
34
|
|
|
28
|
-
export
|
|
35
|
+
export declare function isTreeParent(item: TreeItem): item is TreeParent;
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
/** Supported languages. Note: 'nb' and 'nn' are automatically mapped to 'no'. Non-supported languages will default to 'en' */
|
|
38
|
+
export declare type LanguageCode = 'en' | 'no' | 'nb' | 'nn' | 'sv' | 'nl' | 'fi' | 'da';
|
|
31
39
|
|
|
32
|
-
export
|
|
40
|
+
export declare type ModuleItem = {
|
|
41
|
+
id: string;
|
|
42
|
+
label: string;
|
|
43
|
+
url: string;
|
|
44
|
+
};
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
/** Configuration for the navigation menu (pages in current module) */
|
|
47
|
+
export declare type NavigationMenu = {
|
|
48
|
+
/** The list of items to show in the side menu and the breadcrumbs. Applications can
|
|
49
|
+
update it at any time, e.g. when the context changes, when the language changes */
|
|
50
|
+
items: TreeItem[];
|
|
51
|
+
/** the item id corresponding to the current page. When it's found in items,
|
|
52
|
+
the breadcrumbs will update to reflect the path to the item and side menu will
|
|
53
|
+
expand and select that item. When it's not found in items, breadcrumbs will show
|
|
54
|
+
nothing and the side menu will have no element selected */
|
|
55
|
+
currentItem: string;
|
|
56
|
+
/** Sidebar search config; default disabled when undefined */
|
|
57
|
+
search?: SearchConfig;
|
|
58
|
+
};
|
|
35
59
|
|
|
36
|
-
|
|
60
|
+
declare type NonEmptyArray<T> = [T, ...T[]];
|
|
37
61
|
|
|
38
|
-
export
|
|
62
|
+
export declare type SearchConfig = {
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
shortcut?: string;
|
|
65
|
+
extraDataSets?: SearchDataSetConfig[];
|
|
66
|
+
};
|
|
39
67
|
|
|
40
|
-
export
|
|
68
|
+
export declare type SearchDataSetConfig = {
|
|
69
|
+
/** Stable unique identifier for the dataset, used for selection and lookup */
|
|
70
|
+
id: string;
|
|
71
|
+
/** User-facing label for display purposes */
|
|
72
|
+
label: string;
|
|
73
|
+
searchFunction: (query: SearchQuery) => Promise<SearchResult>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export declare class SearchError extends Error {
|
|
77
|
+
constructor(message: string);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export declare type SearchQuery = {
|
|
81
|
+
abortController: AbortController;
|
|
82
|
+
query: string;
|
|
83
|
+
cursor?: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export declare type SearchResult = {
|
|
87
|
+
nextCursor?: string;
|
|
88
|
+
results: SearchResultItem[];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export declare type SearchResultItem = {
|
|
92
|
+
id: string;
|
|
93
|
+
label: string;
|
|
94
|
+
url: string;
|
|
95
|
+
lines?: [string] | [string, string];
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export declare type TreeItem = TreeParent | TreeLeaf;
|
|
99
|
+
|
|
100
|
+
export declare type TreeLeaf = BaseTreeItem & {
|
|
101
|
+
url: string;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export declare type TreeParent = BaseTreeItem & {
|
|
105
|
+
items: NonEmptyArray<TreeItem>;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
declare type User = {
|
|
109
|
+
userId: string;
|
|
110
|
+
clientId?: string;
|
|
111
|
+
userName: string;
|
|
112
|
+
userEmail: string;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export declare type VsnAuth = {
|
|
116
|
+
user: User;
|
|
117
|
+
profilePictureBaseUrl: string;
|
|
118
|
+
myProfileUrl: string;
|
|
119
|
+
};
|
|
41
120
|
|
|
42
121
|
export declare class VSNNavigation extends LitElement {
|
|
43
122
|
/** Language to use for the component's labels (Search, Log out, etc) */
|
|
@@ -78,6 +157,27 @@ export declare class VSNNavigation extends LitElement {
|
|
|
78
157
|
render(): TemplateResult<1>;
|
|
79
158
|
}
|
|
80
159
|
|
|
81
|
-
export
|
|
160
|
+
export declare type VsnNavigation = {
|
|
161
|
+
/** Language to use for the component's labels (Search, Log out, etc) */
|
|
162
|
+
lang?: LanguageCode;
|
|
163
|
+
/** Link to landing page */
|
|
164
|
+
landingPageUrl?: string;
|
|
165
|
+
/** Configuration for the navigation menu (pages in current module) */
|
|
166
|
+
tree?: NavigationMenu;
|
|
167
|
+
/** Configuration for the module switcher */
|
|
168
|
+
modules?: AppModules;
|
|
169
|
+
/** Show help icon */
|
|
170
|
+
showHelp?: boolean;
|
|
171
|
+
/** Use a fixed url for link to help */
|
|
172
|
+
helpUrl?: string;
|
|
173
|
+
/** Show notification icon */
|
|
174
|
+
showNotification?: boolean;
|
|
175
|
+
/** Notification icon shows active state */
|
|
176
|
+
notificationActive?: boolean;
|
|
177
|
+
/** Configuration related to authenticated user */
|
|
178
|
+
auth?: VsnAuth;
|
|
179
|
+
/** Configuration for the feedback component */
|
|
180
|
+
feedback?: FeedbackConfig | null;
|
|
181
|
+
};
|
|
82
182
|
|
|
83
183
|
export { }
|