@compill/admin 1.0.62 → 1.0.64
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/index.cjs.js +6 -3
- package/index.esm.js +7 -4
- package/package.json +1 -1
package/index.cjs.js
CHANGED
@@ -2893,8 +2893,10 @@ function MenuItem(_a) {
|
|
2893
2893
|
children
|
2894
2894
|
} = _a,
|
2895
2895
|
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2896
|
-
const
|
2897
|
-
const selected =
|
2896
|
+
const location = reactRouterDom.useLocation();
|
2897
|
+
const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
|
2898
|
+
// const match = useMatch("/" + path)// + "/*")
|
2899
|
+
// const selected = match != null
|
2898
2900
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
2899
2901
|
children: [jsxRuntime.jsxs(reactRouterDom.Link, {
|
2900
2902
|
to: path,
|
@@ -2970,7 +2972,8 @@ function Sidebar(_a) {
|
|
2970
2972
|
borderOpacity: "5",
|
2971
2973
|
children: [logo !== null && logo !== void 0 ? logo : jsxRuntime.jsx(Logo, {
|
2972
2974
|
width: 40,
|
2973
|
-
height: 40
|
2975
|
+
height: 40,
|
2976
|
+
darkMode: darkMode
|
2974
2977
|
}), jsxRuntime.jsx("h1", {
|
2975
2978
|
textSize: "md",
|
2976
2979
|
children: title !== null && title !== void 0 ? title : env.Env.appName()
|
package/index.esm.js
CHANGED
@@ -4,7 +4,7 @@ import Link from 'next/link';
|
|
4
4
|
import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
|
5
5
|
import { INVALIDATE_API } from '@compill/admin-api';
|
6
6
|
import { useApiMutation, useMutate, useInvalidateMutation, useApiQuery, useInvalidateQuery, useInvalidateParentMutation, useApiQueries } from '@compill/api';
|
7
|
-
import { useNavigate, useParams, Outlet,
|
7
|
+
import { useNavigate, useParams, Outlet, useLocation, Link as Link$1 } from 'react-router-dom';
|
8
8
|
import { toast } from 'react-toastify';
|
9
9
|
import { SubmitButton, FormProvider, TextArea, FormRenderer, mergeInitialFormValues, FieldLabel } from '@compill/form';
|
10
10
|
import { useFormikContext, Field, Formik, Form } from 'formik';
|
@@ -2883,8 +2883,10 @@ function MenuItem(_a) {
|
|
2883
2883
|
children
|
2884
2884
|
} = _a,
|
2885
2885
|
props = __rest$1(_a, ["icon", "path", "depth", "darkMode", "subMenu", "children"]);
|
2886
|
-
const
|
2887
|
-
const selected =
|
2886
|
+
const location = useLocation();
|
2887
|
+
const selected = path == "/" ? location.pathname == "/" : location.pathname.startsWith(path.startsWith("/") ? path : `/${path}`);
|
2888
|
+
// const match = useMatch("/" + path)// + "/*")
|
2889
|
+
// const selected = match != null
|
2888
2890
|
return jsxs(Fragment, {
|
2889
2891
|
children: [jsxs(Link$1, {
|
2890
2892
|
to: path,
|
@@ -2960,7 +2962,8 @@ function Sidebar(_a) {
|
|
2960
2962
|
borderOpacity: "5",
|
2961
2963
|
children: [logo !== null && logo !== void 0 ? logo : jsx(Logo, {
|
2962
2964
|
width: 40,
|
2963
|
-
height: 40
|
2965
|
+
height: 40,
|
2966
|
+
darkMode: darkMode
|
2964
2967
|
}), jsx("h1", {
|
2965
2968
|
textSize: "md",
|
2966
2969
|
children: title !== null && title !== void 0 ? title : Env.appName()
|