@tker-react/layout 0.2.5 → 0.2.6

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.
Files changed (2) hide show
  1. package/dist/index.mjs +4 -0
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -107,6 +107,8 @@ function LayoutProvider({ children }) {
107
107
  collapsedRef.current = collapsed;
108
108
  const menuDataRef = useRef(menuData);
109
109
  menuDataRef.current = menuData;
110
+ const layoutModeRef = useRef(layoutMode);
111
+ layoutModeRef.current = layoutMode;
110
112
  const toggleMenuOpen = useCallback((path, forceOpen) => {
111
113
  setOpenKeys((prev) => {
112
114
  const next = new Set(prev);
@@ -125,7 +127,9 @@ function LayoutProvider({ children }) {
125
127
  const menuItemClick = useCallback((path) => {
126
128
  const item = findMenuItemByPath(menuDataRef.current, path);
127
129
  const hasChildren = !!(item?.children && item.children.length > 0);
130
+ const isSide = layoutModeRef.current === "side-menu";
128
131
  if (hasChildren) {
132
+ if (!isSide) return;
129
133
  if (collapsedRef.current) {
130
134
  setCollapsedState(false);
131
135
  const restored = new Set(savedOpenKeysRef.current);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tker-react/layout",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",