@lius1314/visual-dashboard-scaffold 1.0.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.
- package/README.md +261 -0
- package/dist/assets/.gitkeep +0 -0
- package/dist/assets/bg.jpeg +0 -0
- package/dist/css/all.min.css +9 -0
- package/dist/types/App.d.ts +3 -0
- package/dist/types/api/monitor.d.ts +18 -0
- package/dist/types/blocks/SampleBlock.d.ts +13 -0
- package/dist/types/blocks/index.d.ts +1 -0
- package/dist/types/blocks/registry.d.ts +26 -0
- package/dist/types/components/BackgroundPicker.d.ts +13 -0
- package/dist/types/components/ChartBlock.d.ts +12 -0
- package/dist/types/components/FooterSection.d.ts +11 -0
- package/dist/types/components/HeaderSection.d.ts +13 -0
- package/dist/types/components/MiddleSection.d.ts +17 -0
- package/dist/types/components/OuterContainer.d.ts +8 -0
- package/dist/types/components/SettingsPanel.d.ts +7 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/store/configStore.d.ts +28 -0
- package/dist/types/types/index.d.ts +88 -0
- package/dist/types/utils/background.d.ts +11 -0
- package/dist/types/utils/cn.d.ts +2 -0
- package/dist/types/utils/icons.d.ts +16 -0
- package/dist/visual-dashboard-scaffold.cjs.js +57 -0
- package/dist/visual-dashboard-scaffold.cjs.js.map +1 -0
- package/dist/visual-dashboard-scaffold.css +1 -0
- package/dist/visual-dashboard-scaffold.es.js +29549 -0
- package/dist/visual-dashboard-scaffold.es.js.map +1 -0
- package/dist/webfonts/fa-brands-400.woff2 +0 -0
- package/dist/webfonts/fa-regular-400.woff2 +0 -0
- package/dist/webfonts/fa-solid-900.woff2 +0 -0
- package/dist/webfonts/fa-v4compatibility.woff2 +0 -0
- package/package.json +68 -0
- package/public/assets/.gitkeep +0 -0
- package/public/assets/bg.jpeg +0 -0
- package/public/css/all.min.css +9 -0
- package/public/webfonts/fa-brands-400.woff2 +0 -0
- package/public/webfonts/fa-regular-400.woff2 +0 -0
- package/public/webfonts/fa-solid-900.woff2 +0 -0
- package/public/webfonts/fa-v4compatibility.woff2 +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* visual-dashboard-scaffold - 可视化大屏脚手架
|
|
3
|
+
*
|
|
4
|
+
* 导出所有公共组件、类型、工具函数,供外部使用。
|
|
5
|
+
*/
|
|
6
|
+
export { default as App } from './App';
|
|
7
|
+
export { OuterContainer } from './components/OuterContainer';
|
|
8
|
+
export { HeaderSection } from './components/HeaderSection';
|
|
9
|
+
export { MiddleSection } from './components/MiddleSection';
|
|
10
|
+
export { FooterSection } from './components/FooterSection';
|
|
11
|
+
export { SettingsPanel } from './components/SettingsPanel';
|
|
12
|
+
export { ChartBlock } from './components/ChartBlock';
|
|
13
|
+
export { BackgroundPicker } from './components/BackgroundPicker';
|
|
14
|
+
export { useConfigStore, defaultConfig } from './store/configStore';
|
|
15
|
+
export type { ConfigStore } from './store/configStore';
|
|
16
|
+
export { registerBlock, getBlockComponent, getRegisteredBlockIds } from './blocks/registry';
|
|
17
|
+
export type { BlockComponentProps } from './blocks/registry';
|
|
18
|
+
export { SampleMonitor } from './blocks/SampleBlock';
|
|
19
|
+
export type { CSSSize, ColorValue, AutofitConfig, OuterContainerConfig, SectionConfig, HeaderTitleConfig, HeaderPanel, HeaderSectionConfig, ChartBlockLayout, ChartBlockConfig, BottomBlockItem, BottomSectionConfig, GlobalConfig, } from './types';
|
|
20
|
+
export { resolveBackground } from './utils/background';
|
|
21
|
+
export { cn } from './utils/cn';
|
|
22
|
+
export { BUILTIN_ICONS, BUILTIN_EMOJIS } from './utils/icons';
|
|
23
|
+
export type { IconItem } from './utils/icons';
|
|
24
|
+
export { fetchRealtimeData } from './api/monitor';
|
|
25
|
+
export type { MonitorRealtimeData, VisitTrendSeries } from './api/monitor';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GlobalConfig, ChartBlockConfig, ChartBlockLayout, BottomBlockItem, SectionConfig, BottomSectionConfig, OuterContainerConfig, HeaderSectionConfig, HeaderTitleConfig, HeaderPanel } from '../types';
|
|
2
|
+
export declare const defaultConfig: GlobalConfig;
|
|
3
|
+
export declare function useConfigStore(): {
|
|
4
|
+
config: GlobalConfig;
|
|
5
|
+
setConfig: import("react").Dispatch<import("react").SetStateAction<GlobalConfig>>;
|
|
6
|
+
setEditMode: (enabled: boolean) => void;
|
|
7
|
+
setGlobalBackground: (bg: string) => void;
|
|
8
|
+
updateOuter: (patch: Partial<OuterContainerConfig>) => void;
|
|
9
|
+
updateHeader: (patch: Partial<HeaderSectionConfig>) => void;
|
|
10
|
+
updateHeaderTitle: (patch: Partial<HeaderTitleConfig>) => void;
|
|
11
|
+
addHeaderPanel: (side: "left" | "right") => void;
|
|
12
|
+
removeHeaderPanel: (side: "left" | "right", id: string) => void;
|
|
13
|
+
updateHeaderPanel: (side: "left" | "right", id: string, patch: Partial<HeaderPanel>) => void;
|
|
14
|
+
updateMiddle: (patch: Partial<SectionConfig>) => void;
|
|
15
|
+
updateFooter: (patch: Partial<BottomSectionConfig>) => void;
|
|
16
|
+
addChartBlock: () => void;
|
|
17
|
+
removeChartBlock: (id: string) => void;
|
|
18
|
+
updateChartBlock: (id: string, patch: Partial<ChartBlockConfig>) => void;
|
|
19
|
+
updateChartLayouts: (layouts: ChartBlockLayout[]) => void;
|
|
20
|
+
reorderChartBlocks: (orderedIds: string[]) => void;
|
|
21
|
+
addBottomItem: () => void;
|
|
22
|
+
removeBottomItem: (id: string) => void;
|
|
23
|
+
updateBottomItem: (id: string, patch: Partial<BottomBlockItem>) => void;
|
|
24
|
+
exportConfig: () => void;
|
|
25
|
+
importConfig: (jsonStr: string) => void;
|
|
26
|
+
resetConfig: () => void;
|
|
27
|
+
};
|
|
28
|
+
export type ConfigStore = ReturnType<typeof useConfigStore>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export interface CSSSize {
|
|
2
|
+
value: number | string;
|
|
3
|
+
unit?: 'px' | '%' | 'vh' | 'vw' | 'rem' | 'em';
|
|
4
|
+
}
|
|
5
|
+
export type ColorValue = string;
|
|
6
|
+
export interface AutofitConfig {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
designWidth?: number;
|
|
9
|
+
designHeight?: number;
|
|
10
|
+
renderDom?: string;
|
|
11
|
+
resize?: boolean;
|
|
12
|
+
transition?: number;
|
|
13
|
+
delay?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface OuterContainerConfig {
|
|
16
|
+
width: number | string;
|
|
17
|
+
height: number | string;
|
|
18
|
+
background: ColorValue;
|
|
19
|
+
autofit?: AutofitConfig;
|
|
20
|
+
}
|
|
21
|
+
export interface SectionConfig {
|
|
22
|
+
height: number | string;
|
|
23
|
+
background: ColorValue;
|
|
24
|
+
visible?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface HeaderTitleConfig {
|
|
27
|
+
text: string;
|
|
28
|
+
fontSize: number;
|
|
29
|
+
color: string;
|
|
30
|
+
fontWeight: number;
|
|
31
|
+
letterSpacing: number;
|
|
32
|
+
fontFamily: string;
|
|
33
|
+
useGradient: boolean;
|
|
34
|
+
gradientCss: string;
|
|
35
|
+
}
|
|
36
|
+
export interface HeaderPanel {
|
|
37
|
+
id: string;
|
|
38
|
+
width: number;
|
|
39
|
+
background: ColorValue;
|
|
40
|
+
title: string;
|
|
41
|
+
}
|
|
42
|
+
export interface HeaderSectionConfig extends SectionConfig {
|
|
43
|
+
title: HeaderTitleConfig;
|
|
44
|
+
leftPanels: HeaderPanel[];
|
|
45
|
+
rightPanels: HeaderPanel[];
|
|
46
|
+
}
|
|
47
|
+
export interface ChartBlockLayout {
|
|
48
|
+
i: string;
|
|
49
|
+
x: number;
|
|
50
|
+
y: number;
|
|
51
|
+
w: number;
|
|
52
|
+
h: number;
|
|
53
|
+
zIndex?: number;
|
|
54
|
+
minW?: number;
|
|
55
|
+
minH?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface ChartBlockConfig {
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
titleHeight: number;
|
|
61
|
+
titleBackground: ColorValue;
|
|
62
|
+
contentBackground: ColorValue;
|
|
63
|
+
blockBackground: ColorValue;
|
|
64
|
+
layout: ChartBlockLayout;
|
|
65
|
+
}
|
|
66
|
+
export interface BottomBlockItem {
|
|
67
|
+
id: string;
|
|
68
|
+
icon: string;
|
|
69
|
+
iconType?: 'emoji' | 'iconfont' | 'image';
|
|
70
|
+
label: string;
|
|
71
|
+
color?: ColorValue;
|
|
72
|
+
}
|
|
73
|
+
export interface BottomSectionConfig extends SectionConfig {
|
|
74
|
+
items: BottomBlockItem[];
|
|
75
|
+
itemWidth?: number;
|
|
76
|
+
itemGap?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface GlobalConfig {
|
|
79
|
+
editMode: boolean;
|
|
80
|
+
globalBackground: ColorValue;
|
|
81
|
+
outer: OuterContainerConfig;
|
|
82
|
+
header: HeaderSectionConfig;
|
|
83
|
+
middle: SectionConfig;
|
|
84
|
+
footer: BottomSectionConfig;
|
|
85
|
+
chartBlocks: ChartBlockConfig[];
|
|
86
|
+
cols?: number;
|
|
87
|
+
rowHeight?: number;
|
|
88
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 解析背景值,支持:
|
|
3
|
+
* - CSS 颜色: '#0f172a', 'rgba(0,0,0,0.5)'
|
|
4
|
+
* - CSS 渐变: 'linear-gradient(...)'
|
|
5
|
+
* - 图片路径: '/assets/bg.png' (自动包装为 url())
|
|
6
|
+
* - 已包装的: 'url(/assets/bg.png)'
|
|
7
|
+
* - 混合值: 'url(/assets/bg.png) center/cover no-repeat'
|
|
8
|
+
*
|
|
9
|
+
* 返回可直接用于 CSS background 属性的字符串。
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveBackground(value: string | undefined | null): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 内置图标列表
|
|
3
|
+
* Font Awesome 6 免费版 (2000+ 图标)
|
|
4
|
+
* CDN 已在 index.html 中引入
|
|
5
|
+
*
|
|
6
|
+
* 使用方式: <i className="fa-solid fa-chart-line" />
|
|
7
|
+
* 图标浏览: https://fontawesome.com/search?o=r&m=free
|
|
8
|
+
*/
|
|
9
|
+
export interface IconItem {
|
|
10
|
+
name: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
/** 内置大屏常用 Font Awesome 图标 */
|
|
14
|
+
export declare const BUILTIN_ICONS: IconItem[];
|
|
15
|
+
/** 内置 emoji 图标 */
|
|
16
|
+
export declare const BUILTIN_EMOJIS: string[];
|