listpage-next 0.0.252 → 0.0.254
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/dist/features/ReactApp/Layout.d.ts +1 -1
- package/dist/features/ReactApp/Layout.js +4 -3
- package/dist/ui/Menu/SiderItem.d.ts +3 -2
- package/dist/ui/Menu/SiderItem.js +18 -13
- package/dist/ui/Menu/index.d.ts +4 -3
- package/dist/ui/Menu/index.js +7 -7
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui.css +11 -6
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { Outlet, useNavigate } from "react-router-dom";
|
|
4
|
-
import {
|
|
4
|
+
import { PageLayout } from "../../components/index.js";
|
|
5
|
+
import { Menu } from "../../ui/Menu/index.js";
|
|
5
6
|
import { getDefaultActiveKey } from "./utils.js";
|
|
6
7
|
const Layout = (props)=>{
|
|
7
8
|
const { menus, basename = '', title, icon } = props;
|
|
@@ -15,12 +16,12 @@ const Layout = (props)=>{
|
|
|
15
16
|
icon,
|
|
16
17
|
title
|
|
17
18
|
},
|
|
19
|
+
content: /*#__PURE__*/ jsx(Outlet, {}),
|
|
18
20
|
sider: /*#__PURE__*/ jsx(Menu, {
|
|
19
21
|
items: menus,
|
|
20
22
|
defaultActiveKey: defaultActiveKey,
|
|
21
23
|
onSelect: navigate
|
|
22
|
-
})
|
|
23
|
-
content: /*#__PURE__*/ jsx(Outlet, {})
|
|
24
|
+
})
|
|
24
25
|
});
|
|
25
26
|
};
|
|
26
27
|
export { Layout };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface MenuItem {
|
|
3
|
-
|
|
3
|
+
key: string;
|
|
4
4
|
label: string;
|
|
5
5
|
icon?: React.ReactNode;
|
|
6
|
-
path?: string;
|
|
7
6
|
children?: MenuItem[];
|
|
8
7
|
badge?: number | string;
|
|
9
8
|
}
|
|
@@ -16,6 +15,8 @@ interface InternalSidebarItemProps {
|
|
|
16
15
|
onToggleExpand: (id: string) => void;
|
|
17
16
|
onNavigate?: (path: string) => void;
|
|
18
17
|
level?: number;
|
|
18
|
+
parentPath?: string;
|
|
19
19
|
}
|
|
20
|
+
export declare const resolvePath: (key: string, parentPath?: string) => string;
|
|
20
21
|
export declare const SidebarItem: React.FC<InternalSidebarItemProps>;
|
|
21
22
|
export {};
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { ChevronDown, Circle } from "lucide-react";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
4
|
+
const resolvePath = (key, parentPath)=>{
|
|
5
|
+
const path = `${parentPath || ''}/${key}`;
|
|
6
|
+
return path.replace(/\/+/g, '/');
|
|
7
|
+
};
|
|
8
|
+
const SidebarItem = ({ item, isCollapsed, isActive, activePath, expandedIds, onToggleExpand, onNavigate, level = 0, parentPath })=>{
|
|
9
|
+
const hasChildren = !isCollapsed && item.children && item.children.length > 0;
|
|
10
|
+
const isExpanded = expandedIds.includes(item.key);
|
|
11
|
+
const currentPath = resolvePath(item.key, parentPath);
|
|
7
12
|
const handleClick = (e)=>{
|
|
8
13
|
e.stopPropagation();
|
|
9
|
-
if (hasChildren) onToggleExpand(item.
|
|
10
|
-
else
|
|
14
|
+
if (hasChildren) onToggleExpand(item.key);
|
|
15
|
+
else onNavigate?.(currentPath);
|
|
11
16
|
};
|
|
12
17
|
const paddingLeft = isCollapsed ? '0' : `${12 * level + 12}px`;
|
|
13
18
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -15,8 +20,7 @@ const SidebarItem = ({ item, isCollapsed, isActive, activePath, expandedIds, onT
|
|
|
15
20
|
children: [
|
|
16
21
|
/*#__PURE__*/ jsxs("div", {
|
|
17
22
|
onClick: handleClick,
|
|
18
|
-
className: `
|
|
19
|
-
relative flex items-center justify-between py-1.5 px-2 mx-2 rounded-md cursor-pointer transition-all duration-200 group
|
|
23
|
+
className: `h-[40px] relative flex items-center justify-between py-1.5 px-2 mx-2 rounded-md cursor-pointer transition-all duration-200 group
|
|
20
24
|
${isActive ? 'bg-[#007AFF] text-white shadow-sm' : 'text-neutral-400 hover:bg-white/10 hover:text-neutral-200'}
|
|
21
25
|
${isCollapsed ? 'justify-center mx-2 px-0' : ''}
|
|
22
26
|
`,
|
|
@@ -40,7 +44,7 @@ const SidebarItem = ({ item, isCollapsed, isActive, activePath, expandedIds, onT
|
|
|
40
44
|
})
|
|
41
45
|
}),
|
|
42
46
|
!isCollapsed && /*#__PURE__*/ jsx("span", {
|
|
43
|
-
className: `truncate text-[
|
|
47
|
+
className: `truncate text-[14px] leading-none ${isActive ? 'font-medium' : 'font-normal'}`,
|
|
44
48
|
children: item.label
|
|
45
49
|
})
|
|
46
50
|
]
|
|
@@ -53,7 +57,7 @@ const SidebarItem = ({ item, isCollapsed, isActive, activePath, expandedIds, onT
|
|
|
53
57
|
children: item.badge
|
|
54
58
|
}),
|
|
55
59
|
hasChildren && /*#__PURE__*/ jsx("span", {
|
|
56
|
-
className: `transition-transform duration-200 ${isExpanded ? 'rotate-180' : ''}
|
|
60
|
+
className: `transition-transform duration-200 text-white/70 ${isExpanded ? 'rotate-180' : ''}`,
|
|
57
61
|
children: /*#__PURE__*/ jsx(ChevronDown, {
|
|
58
62
|
size: 12
|
|
59
63
|
})
|
|
@@ -67,15 +71,16 @@ const SidebarItem = ({ item, isCollapsed, isActive, activePath, expandedIds, onT
|
|
|
67
71
|
children: item.children?.map((child)=>/*#__PURE__*/ jsx(SidebarItem, {
|
|
68
72
|
item: child,
|
|
69
73
|
isCollapsed: isCollapsed,
|
|
70
|
-
isActive: child.
|
|
74
|
+
isActive: resolvePath(child.key, currentPath) === activePath,
|
|
71
75
|
activePath: activePath,
|
|
72
76
|
expandedIds: expandedIds,
|
|
73
77
|
onToggleExpand: onToggleExpand,
|
|
74
78
|
onNavigate: onNavigate,
|
|
75
|
-
level: level + 1
|
|
76
|
-
|
|
79
|
+
level: level + 1,
|
|
80
|
+
parentPath: currentPath
|
|
81
|
+
}, child.key))
|
|
77
82
|
})
|
|
78
83
|
]
|
|
79
84
|
});
|
|
80
85
|
};
|
|
81
|
-
export { SidebarItem };
|
|
86
|
+
export { SidebarItem, resolvePath };
|
package/dist/ui/Menu/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { MenuItem } from './SiderItem';
|
|
2
|
+
export { type MenuItem } from './SiderItem';
|
|
2
3
|
export interface MenuProps {
|
|
3
4
|
title?: string;
|
|
4
5
|
items: MenuItem[];
|
|
5
6
|
isCollapsed?: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
activeKey?: string;
|
|
8
|
+
defaultActiveKey?: string;
|
|
9
|
+
onSelect?: (path: string) => void;
|
|
9
10
|
}
|
|
10
11
|
export declare const Menu: (props: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/ui/Menu/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import { SidebarItem } from "./SiderItem.js";
|
|
3
|
+
import { SidebarItem, resolvePath } from "./SiderItem.js";
|
|
4
4
|
import { useControllableValue } from "ahooks";
|
|
5
5
|
const Menu = (props)=>{
|
|
6
6
|
const { items, isCollapsed, title } = props;
|
|
7
7
|
const [activePath, setActivePath] = useControllableValue(props, {
|
|
8
|
-
valuePropName: '
|
|
9
|
-
trigger: '
|
|
10
|
-
defaultValuePropName: '
|
|
8
|
+
valuePropName: 'activeKey',
|
|
9
|
+
trigger: 'onSelect',
|
|
10
|
+
defaultValuePropName: 'defaultActiveKey',
|
|
11
11
|
defaultValue: ''
|
|
12
12
|
});
|
|
13
13
|
const [expandedIds, setExpandedIds] = useState([]);
|
|
@@ -18,7 +18,7 @@ const Menu = (props)=>{
|
|
|
18
18
|
]);
|
|
19
19
|
};
|
|
20
20
|
return /*#__PURE__*/ jsxs("div", {
|
|
21
|
-
className:
|
|
21
|
+
className: `overflow-y-auto overflow-x-hidden py-2 px-2 scrollbar-hide bg-[#000c17] ${isCollapsed ? 'w-[80px]' : 'flex-1'}`,
|
|
22
22
|
children: [
|
|
23
23
|
!isCollapsed && title && /*#__PURE__*/ jsx("div", {
|
|
24
24
|
className: "px-3 mb-2 mt-2 text-[11px] font-medium text-neutral-500 uppercase tracking-widest",
|
|
@@ -29,12 +29,12 @@ const Menu = (props)=>{
|
|
|
29
29
|
children: items.map((item)=>/*#__PURE__*/ jsx(SidebarItem, {
|
|
30
30
|
item: item,
|
|
31
31
|
isCollapsed: isCollapsed ?? false,
|
|
32
|
-
isActive: item.
|
|
32
|
+
isActive: resolvePath(item.key) === activePath,
|
|
33
33
|
activePath: activePath,
|
|
34
34
|
expandedIds: expandedIds,
|
|
35
35
|
onToggleExpand: handleToggleExpand,
|
|
36
36
|
onNavigate: setActivePath
|
|
37
|
-
}, item.
|
|
37
|
+
}, item.key))
|
|
38
38
|
})
|
|
39
39
|
]
|
|
40
40
|
});
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export { Button, type ButtonProps } from './Button';
|
|
|
3
3
|
export { LogPreview, type LogPreviewProps, type LogEntry } from './LogPreview';
|
|
4
4
|
export { StatusTag, type StatusTagProps } from './StatusTag';
|
|
5
5
|
export { Tabs, type TabsProps } from './Tabs';
|
|
6
|
-
export { Menu, type MenuProps } from './Menu';
|
|
6
|
+
export { Menu, type MenuProps, type MenuItem } from './Menu';
|
|
7
7
|
export { FileManager, AssetSelectorModal } from './FileManager';
|
package/dist/ui.css
CHANGED
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
--color-neutral-200: oklch(92.2% 0 0);
|
|
72
72
|
--color-neutral-400: oklch(70.8% 0 0);
|
|
73
73
|
--color-neutral-500: oklch(55.6% 0 0);
|
|
74
|
-
--color-neutral-600: oklch(43.9% 0 0);
|
|
75
74
|
--color-stone-400: oklch(70.9% 0.01 56.259);
|
|
76
75
|
--color-stone-500: oklch(55.3% 0.013 58.071);
|
|
77
76
|
--color-black: #000;
|
|
@@ -427,6 +426,9 @@
|
|
|
427
426
|
.h-64 {
|
|
428
427
|
height: calc(var(--spacing) * 64);
|
|
429
428
|
}
|
|
429
|
+
.h-\[40px\] {
|
|
430
|
+
height: 40px;
|
|
431
|
+
}
|
|
430
432
|
.h-\[85vh\] {
|
|
431
433
|
height: 85vh;
|
|
432
434
|
}
|
|
@@ -490,6 +492,9 @@
|
|
|
490
492
|
.w-80 {
|
|
491
493
|
width: calc(var(--spacing) * 80);
|
|
492
494
|
}
|
|
495
|
+
.w-\[80px\] {
|
|
496
|
+
width: 80px;
|
|
497
|
+
}
|
|
493
498
|
.w-\[200px\] {
|
|
494
499
|
width: 200px;
|
|
495
500
|
}
|
|
@@ -882,6 +887,9 @@
|
|
|
882
887
|
.bg-\[\#0B1120\] {
|
|
883
888
|
background-color: #0B1120;
|
|
884
889
|
}
|
|
890
|
+
.bg-\[\#000c17\] {
|
|
891
|
+
background-color: #000c17;
|
|
892
|
+
}
|
|
885
893
|
.bg-\[\#007AFF\] {
|
|
886
894
|
background-color: #007AFF;
|
|
887
895
|
}
|
|
@@ -1312,8 +1320,8 @@
|
|
|
1312
1320
|
.text-\[11px\] {
|
|
1313
1321
|
font-size: 11px;
|
|
1314
1322
|
}
|
|
1315
|
-
.text-\[
|
|
1316
|
-
font-size:
|
|
1323
|
+
.text-\[14px\] {
|
|
1324
|
+
font-size: 14px;
|
|
1317
1325
|
}
|
|
1318
1326
|
.leading-none {
|
|
1319
1327
|
--tw-leading: 1;
|
|
@@ -1410,9 +1418,6 @@
|
|
|
1410
1418
|
.text-neutral-500 {
|
|
1411
1419
|
color: var(--color-neutral-500);
|
|
1412
1420
|
}
|
|
1413
|
-
.text-neutral-600 {
|
|
1414
|
-
color: var(--color-neutral-600);
|
|
1415
|
-
}
|
|
1416
1421
|
.text-orange-400 {
|
|
1417
1422
|
color: var(--color-orange-400);
|
|
1418
1423
|
}
|