@visma-swno/vsn-navigation 1.0.0-beta.4 → 1.1.0-beta.2
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.
|
@@ -62,8 +62,13 @@ export declare class VSNNavigation extends LitElement {
|
|
|
62
62
|
notificationActive: boolean;
|
|
63
63
|
private _currentItem;
|
|
64
64
|
private _sideBarOpen;
|
|
65
|
+
private _resolvedModules;
|
|
66
|
+
private _modulesLoading;
|
|
67
|
+
private _modulesLoadToken;
|
|
68
|
+
private _resolveModules;
|
|
65
69
|
static styles: CSSResult[];
|
|
66
70
|
willUpdate(changed: Map<string, unknown>): void;
|
|
71
|
+
private get _resolvedLang();
|
|
67
72
|
private _getFirstLeafId;
|
|
68
73
|
/** Project tree into the shape the side-bar expects: top-level items lifted from the active module. */
|
|
69
74
|
private get _sideBarMenu();
|
|
@@ -25,7 +25,24 @@ function u(e, t, n, r) {
|
|
|
25
25
|
//#region src/components/vsn-navigation.ts
|
|
26
26
|
var d = class extends e {
|
|
27
27
|
constructor(...e) {
|
|
28
|
-
super(...e), this.lang = "en", this.showHelp = !1, this.feedback = null, this.showNotification = !1, this.notificationActive = !1, this._currentItem = "", this._sideBarOpen = !1;
|
|
28
|
+
super(...e), this.lang = "en", this.showHelp = !1, this.feedback = null, this.showNotification = !1, this.notificationActive = !1, this._currentItem = "", this._sideBarOpen = !1, this._resolvedModules = [], this._modulesLoading = !1, this._modulesLoadToken = 0;
|
|
29
|
+
}
|
|
30
|
+
_resolveModules() {
|
|
31
|
+
let e = this.modules?.modules;
|
|
32
|
+
if (!e) {
|
|
33
|
+
this._resolvedModules = [], this._modulesLoading = !1;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (Array.isArray(e)) {
|
|
37
|
+
this._resolvedModules = e, this._modulesLoading = !1;
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
let t = ++this._modulesLoadToken;
|
|
41
|
+
this._resolvedModules = [], this._modulesLoading = !0, e().then((e) => {
|
|
42
|
+
t === this._modulesLoadToken && (this._resolvedModules = e, this._modulesLoading = !1);
|
|
43
|
+
}).catch(() => {
|
|
44
|
+
t === this._modulesLoadToken && (this._resolvedModules = [], this._modulesLoading = !1);
|
|
45
|
+
});
|
|
29
46
|
}
|
|
30
47
|
static {
|
|
31
48
|
this.styles = [s, t`
|
|
@@ -50,7 +67,10 @@ var d = class extends e {
|
|
|
50
67
|
`];
|
|
51
68
|
}
|
|
52
69
|
willUpdate(e) {
|
|
53
|
-
e.has("tree") && this.tree && (this.tree.currentItem ? this._currentItem = this.tree.currentItem : this.tree.items.length > 0 && (this._currentItem = this._getFirstLeafId(this.tree.items[0])));
|
|
70
|
+
e.has("tree") && this.tree && (this.tree.currentItem ? this._currentItem = this.tree.currentItem : this.tree.items.length > 0 && (this._currentItem = this._getFirstLeafId(this.tree.items[0]))), e.has("modules") && this._resolveModules();
|
|
71
|
+
}
|
|
72
|
+
get _resolvedLang() {
|
|
73
|
+
return this.lang === "nb" || this.lang === "nn" ? "no" : this.lang;
|
|
54
74
|
}
|
|
55
75
|
_getFirstLeafId(e) {
|
|
56
76
|
if (c(e)) return e.id;
|
|
@@ -78,7 +98,8 @@ var d = class extends e {
|
|
|
78
98
|
return n`
|
|
79
99
|
<vsn-top-bar
|
|
80
100
|
.tree=${this.tree}
|
|
81
|
-
.modules=${this.
|
|
101
|
+
.modules=${this._resolvedModules}
|
|
102
|
+
lang=${this._resolvedLang}
|
|
82
103
|
landing-page-url=${this.landingPageUrl ?? ""}
|
|
83
104
|
?show-help=${this.showHelp}
|
|
84
105
|
help-url=${this.helpUrl ?? ""}
|
|
@@ -92,8 +113,11 @@ var d = class extends e {
|
|
|
92
113
|
<div class="vsn-navigation__content">
|
|
93
114
|
<vsn-side-bar
|
|
94
115
|
.menu=${this._sideBarMenu}
|
|
95
|
-
.modules=${this.
|
|
116
|
+
.modules=${this._resolvedModules}
|
|
117
|
+
lang=${this._resolvedLang}
|
|
96
118
|
.activeModuleId=${this.modules?.activeModuleId}
|
|
119
|
+
.activeModuleLabel=${this.modules?.activeModuleLabel}
|
|
120
|
+
.modulesLoading=${this._modulesLoading}
|
|
97
121
|
.auth=${this.auth}
|
|
98
122
|
?open=${this._sideBarOpen}
|
|
99
123
|
@vsn-close=${this._onSideBarClose}
|
|
@@ -113,6 +137,6 @@ u([a()], d.prototype, "lang", void 0), u([a({ attribute: !1 })], d.prototype, "t
|
|
|
113
137
|
})], d.prototype, "showNotification", void 0), u([a({
|
|
114
138
|
type: Boolean,
|
|
115
139
|
attribute: "notification-active"
|
|
116
|
-
})], d.prototype, "notificationActive", void 0), u([o()], d.prototype, "_currentItem", void 0), u([o()], d.prototype, "_sideBarOpen", void 0), d = u([i("vsn-navigation")], d);
|
|
140
|
+
})], d.prototype, "notificationActive", void 0), u([o()], d.prototype, "_currentItem", void 0), u([o()], d.prototype, "_sideBarOpen", void 0), u([o()], d.prototype, "_resolvedModules", void 0), u([o()], d.prototype, "_modulesLoading", void 0), d = u([i("vsn-navigation")], d);
|
|
117
141
|
//#endregion
|
|
118
142
|
export { d as VSNNavigation, c as isTreeLeaf, l as isTreeParent };
|