@dvrd/dvr-controls 1.0.3 → 1.0.4
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/package.json
CHANGED
|
@@ -7,7 +7,7 @@ import React, {MouseEventHandler, ReactNode, useContext, useEffect, useRef, useS
|
|
|
7
7
|
import {useLocation} from 'react-router';
|
|
8
8
|
import {SidebarItem, SideMenuMode} from "../util/interfaces";
|
|
9
9
|
import classNames from 'classnames';
|
|
10
|
-
import {AwesomeIcon, generateComponentId} from "../../../index";
|
|
10
|
+
import {AwesomeIcon, generateComponentId, isAbsoluteLink} from "../../../index";
|
|
11
11
|
import {ControlContext} from "../util/controlContext";
|
|
12
12
|
import {defer} from 'lodash';
|
|
13
13
|
|
|
@@ -67,7 +67,14 @@ export default function SidebarMenu(props: Props) {
|
|
|
67
67
|
function _onClickItem(item: SidebarItem) {
|
|
68
68
|
return function (evt: React.MouseEvent) {
|
|
69
69
|
evt.stopPropagation();
|
|
70
|
-
|
|
70
|
+
const {route} = item;
|
|
71
|
+
let _route: string | null = null;
|
|
72
|
+
if (route) {
|
|
73
|
+
if (Array.isArray(route) && route.length) _route = route[0];
|
|
74
|
+
else _route = route as string;
|
|
75
|
+
}
|
|
76
|
+
if (_route && !isAbsoluteLink(_route))
|
|
77
|
+
setActiveItem(item.id);
|
|
71
78
|
onClickItem(item)(evt);
|
|
72
79
|
}
|
|
73
80
|
}
|