@fuentis/phoenix-ui 0.0.9-alpha.408 → 0.0.9-alpha.409
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.
|
@@ -145,14 +145,26 @@ class SidebarItemComponent {
|
|
|
145
145
|
this.active = false;
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
148
|
+
let url = this.router.url.split('?')[0];
|
|
149
|
+
const hashIdx = url.indexOf('#');
|
|
150
|
+
if (hashIdx >= 0) {
|
|
151
|
+
url = url.substring(hashIdx + 1) || '/';
|
|
152
|
+
}
|
|
153
|
+
if (url.length > 1 && url.endsWith('/')) {
|
|
154
|
+
url = url.slice(0, -1);
|
|
155
|
+
}
|
|
156
|
+
const basePath = (this.item.basePath || this.item.basepath);
|
|
157
|
+
const path = this.item.path;
|
|
158
|
+
const matchPath = (p) => {
|
|
159
|
+
if (p.length > 1 && p.endsWith('/'))
|
|
160
|
+
p = p.slice(0, -1);
|
|
161
|
+
return url === p || url.startsWith(p + '/');
|
|
162
|
+
};
|
|
151
163
|
if (basePath && typeof basePath === 'string') {
|
|
152
164
|
this.active = matchPath(basePath);
|
|
153
165
|
}
|
|
154
|
-
else if (
|
|
155
|
-
this.active = matchPath(
|
|
166
|
+
else if (path && typeof path === 'string') {
|
|
167
|
+
this.active = matchPath(path);
|
|
156
168
|
}
|
|
157
169
|
else {
|
|
158
170
|
this.active = false;
|