@taicode/common-web 3.4.1 → 3.6.0
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.
|
@@ -5,6 +5,19 @@ export interface DashboardLayoutProps {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export declare function DashboardLayout(props: DashboardLayoutProps): import("react").JSX.Element;
|
|
8
|
+
export interface DashboardShellProps {
|
|
9
|
+
sidebar: ReactNode;
|
|
10
|
+
header?: ReactNode;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
sidebarWidth?: number;
|
|
13
|
+
headerHeight?: number;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* DashboardShell — 带 SidebarProvider 的完整 Dashboard 布局壳
|
|
18
|
+
* 包含响应式侧边栏 + 内容区,开箱即用
|
|
19
|
+
*/
|
|
20
|
+
export declare function DashboardShell(props: DashboardShellProps): import("react").JSX.Element;
|
|
8
21
|
export interface DashboardContentProps {
|
|
9
22
|
title: ReactNode;
|
|
10
23
|
description?: ReactNode;
|
|
@@ -12,6 +25,11 @@ export interface DashboardContentProps {
|
|
|
12
25
|
toolbar?: ReactNode;
|
|
13
26
|
filters?: ReactNode;
|
|
14
27
|
children: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* 渲染隐藏的假输入框,防止浏览器自动填充
|
|
30
|
+
* 适用于包含表单的页面
|
|
31
|
+
*/
|
|
32
|
+
antiAutoFill?: boolean;
|
|
15
33
|
}
|
|
16
34
|
export declare function DashboardMain(props: ComponentProps<'div'>): import("react").JSX.Element;
|
|
17
35
|
export declare function DashboardContent(props: DashboardContentProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/layout/dashboard/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":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
|
|
@@ -12,18 +12,31 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
import { ArrowLeftIcon, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, RefreshCwIcon, RotateCcwIcon, SearchIcon } from 'lucide-react';
|
|
14
14
|
import { Button } from '../../components/button.js';
|
|
15
|
+
import { SidebarInset, SidebarProvider } from '../../components/sidebar.js';
|
|
15
16
|
import { mergeClassNames } from '../../utils/merge-class-names/index.js';
|
|
16
17
|
export function DashboardLayout(props) {
|
|
17
18
|
const { sidebar, header, children } = props;
|
|
18
19
|
return (_jsxs(_Fragment, { children: [sidebar, _jsxs("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: [header, _jsx("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: _jsx("div", { className: "@container/main flex min-w-0 flex-1 flex-col gap-2", children: children }) })] })] }));
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* DashboardShell — 带 SidebarProvider 的完整 Dashboard 布局壳
|
|
23
|
+
* 包含响应式侧边栏 + 内容区,开箱即用
|
|
24
|
+
*/
|
|
25
|
+
export function DashboardShell(props) {
|
|
26
|
+
const { sidebar, header, children, sidebarWidth = 60, headerHeight = 12, className } = props;
|
|
27
|
+
const style = {
|
|
28
|
+
'--sidebar-width': `calc(var(--spacing) * ${sidebarWidth})`,
|
|
29
|
+
'--header-height': `calc(var(--spacing) * ${headerHeight})`,
|
|
30
|
+
};
|
|
31
|
+
return (_jsxs(SidebarProvider, { style: style, children: [sidebar, _jsxs(SidebarInset, { className: mergeClassNames('min-w-0', className), children: [header, _jsx("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col", children: _jsx("div", { className: "@container/main flex min-w-0 flex-1 flex-col gap-2", children: children }) })] })] }));
|
|
32
|
+
}
|
|
20
33
|
export function DashboardMain(props) {
|
|
21
34
|
const { className } = props, rest = __rest(props, ["className"]);
|
|
22
35
|
return _jsx("div", Object.assign({ className: mergeClassNames('w-full min-w-0 px-4 lg:px-6', className) }, rest));
|
|
23
36
|
}
|
|
24
37
|
export function DashboardContent(props) {
|
|
25
|
-
const { title, description, back, toolbar, filters, children } = props;
|
|
26
|
-
return (_jsxs("div", { className: "flex min-w-0 flex-col gap-4 pb-4 pt-3 md:gap-6 md:py-6", children: [_jsxs("div", { className: "flex flex-col gap-3 border-b px-4 pb-4 lg:px-6", children: [back, _jsxs("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h1", { className: "text-xl font-semibold leading-7 md:text-2xl", children: title }), description && (_jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-5 text-muted-foreground sm:text-sm md:mt-1", children: description }))] }), toolbar && _jsx("div", { className: "flex min-h-9 shrink-0 items-center justify-end gap-2", children: toolbar })] }), filters && _jsx("div", { className: "flex flex-col gap-4", children: filters })] }), _jsx(DashboardMain, { className: "space-y-4 md:space-y-6", children: children })] }));
|
|
38
|
+
const { title, description, back, toolbar, filters, children, antiAutoFill = false } = props;
|
|
39
|
+
return (_jsxs("div", { className: "flex min-w-0 flex-col gap-4 pb-4 pt-3 md:gap-6 md:py-6", children: [_jsxs("div", { className: "flex flex-col gap-3 border-b px-4 pb-4 lg:px-6", children: [back, _jsxs("div", { className: "flex min-w-0 items-start justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("h1", { className: "text-xl font-semibold leading-7 md:text-2xl", children: title }), description && (_jsx("p", { className: "mt-0.5 line-clamp-2 text-xs leading-5 text-muted-foreground sm:text-sm md:mt-1", children: description }))] }), toolbar && _jsx("div", { className: "flex min-h-9 shrink-0 items-center justify-end gap-2", children: toolbar })] }), filters && _jsx("div", { className: "flex flex-col gap-4", children: filters })] }), _jsx(DashboardMain, { className: "space-y-4 md:space-y-6", children: children }), antiAutoFill && (_jsxs(_Fragment, { children: [_jsx("input", { type: "text", name: "fake-username", autoComplete: "off", tabIndex: -1, style: { position: 'absolute', top: -1000, left: -1000 } }), _jsx("input", { type: "password", name: "fake-password", autoComplete: "new-password", tabIndex: -1, style: { position: 'absolute', top: -1000, left: -1000 } })] }))] }));
|
|
27
40
|
}
|
|
28
41
|
export function DashboardBackButton(props) {
|
|
29
42
|
const { label = 'Back', context, onClick } = props;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@taicode/common-web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"author": "Alain",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"description": "",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"pack:local": "pnpm build && mkdir -p ../../.local-packages && pnpm pack --pack-destination ../../.local-packages"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@needle-di/core": ">=1.0.0",
|
|
61
60
|
"@heroicons/react": "^2.2.0",
|
|
61
|
+
"@needle-di/core": ">=1.0.0",
|
|
62
62
|
"@taicode/common-base": "^3.1.0",
|
|
63
63
|
"@types/react": ">=18",
|
|
64
64
|
"mobx": ">=6",
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"react-day-picker": "^9.14.0",
|
|
81
81
|
"react-hook-form": "^7.71.2",
|
|
82
82
|
"recharts": "^2.15.4",
|
|
83
|
+
"shadcn": "^4.16.2",
|
|
83
84
|
"sonner": "^1.7.4",
|
|
84
85
|
"tailwind-merge": "^3.5.0",
|
|
85
86
|
"vaul": "^1.1.2",
|
|
@@ -88,11 +89,11 @@
|
|
|
88
89
|
"devDependencies": {
|
|
89
90
|
"@babel/plugin-proposal-decorators": "^7.28.0",
|
|
90
91
|
"@needle-di/core": "^1.1.1",
|
|
92
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
91
93
|
"@testing-library/jest-dom": "^6.9.1",
|
|
92
94
|
"@testing-library/react": "^14.3.1",
|
|
93
|
-
"@types/react": "^18.3.28",
|
|
94
|
-
"@tailwindcss/vite": "^4.1.13",
|
|
95
95
|
"@types/jsoneditor": "^9.9.6",
|
|
96
|
+
"@types/react": "^18.3.28",
|
|
96
97
|
"@vitejs/plugin-react": "^4.7.0",
|
|
97
98
|
"@vitest/ui": "^3.2.7",
|
|
98
99
|
"execa": "^8.0.1",
|