@apform-ui/core 1.7.4 → 1.8.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.
Files changed (40) hide show
  1. package/README.md +36 -5
  2. package/dist/apform-ui.css +1 -1
  3. package/dist/apform-ui.js +4107 -3024
  4. package/dist/apform-ui.umd.cjs +138 -64
  5. package/dist/components/LogStream/LogStream.vue.d.ts +37 -0
  6. package/dist/components/LogStream/doc.d.ts +3 -0
  7. package/dist/components/LogStream/index.d.ts +2 -0
  8. package/dist/components/MetricChart/MetricChart.vue.d.ts +49 -0
  9. package/dist/components/MetricChart/doc.d.ts +3 -0
  10. package/dist/components/MetricChart/index.d.ts +2 -0
  11. package/dist/components/ServiceGrid/ServiceGrid.vue.d.ts +28 -0
  12. package/dist/components/ServiceGrid/doc.d.ts +3 -0
  13. package/dist/components/ServiceGrid/index.d.ts +2 -0
  14. package/dist/components/SeverityBadge/SeverityBadge.vue.d.ts +14 -0
  15. package/dist/components/SeverityBadge/doc.d.ts +3 -0
  16. package/dist/components/SeverityBadge/index.d.ts +2 -0
  17. package/dist/components/StatCard/StatCard.vue.d.ts +33 -0
  18. package/dist/components/StatCard/doc.d.ts +3 -0
  19. package/dist/components/StatCard/index.d.ts +2 -0
  20. package/dist/components/StatusTimeline/StatusTimeline.vue.d.ts +24 -0
  21. package/dist/components/StatusTimeline/doc.d.ts +3 -0
  22. package/dist/components/StatusTimeline/index.d.ts +2 -0
  23. package/dist/components/ThresholdSlider/ThresholdSlider.vue.d.ts +23 -0
  24. package/dist/components/ThresholdSlider/doc.d.ts +3 -0
  25. package/dist/components/ThresholdSlider/index.d.ts +2 -0
  26. package/dist/components/TimeRangePicker/TimeRangePicker.vue.d.ts +36 -0
  27. package/dist/components/TimeRangePicker/doc.d.ts +3 -0
  28. package/dist/components/TimeRangePicker/index.d.ts +2 -0
  29. package/dist/composables/index.d.ts +2 -0
  30. package/dist/composables/useRealtime.d.ts +32 -0
  31. package/dist/docs/index.d.ts +8 -0
  32. package/dist/index-v6HiJkED.js +44296 -0
  33. package/dist/index.d.ts +20 -2
  34. package/dist/tokens/index.d.ts +16 -0
  35. package/dist/utils/metricFormat.d.ts +21 -0
  36. package/dist/utils/optionalPeers.d.ts +16 -0
  37. package/package.json +6 -1
  38. package/src/docs/index.ts +24 -0
  39. package/src/tokens/index.ts +26 -0
  40. package/src/tokens/tokens.css +393 -193
package/dist/index.d.ts CHANGED
@@ -24,6 +24,22 @@ export { AppUserPanel } from './components/AppUserPanel';
24
24
  export type { AppUserPanelUser } from './components/AppUserPanel';
25
25
  export { SliderCaptcha } from './components/SliderCaptcha';
26
26
  export type { CaptchaPayload, SliderCaptchaValue } from './components/SliderCaptcha';
27
+ export { TimeRangePicker } from './components/TimeRangePicker';
28
+ export type { TimeRange, TimeRangePreset } from './components/TimeRangePicker';
29
+ export { MetricChart } from './components/MetricChart';
30
+ export type { MetricSeries, MetricThreshold, MetricUnit } from './components/MetricChart';
31
+ export { StatCard } from './components/StatCard';
32
+ export type { StatTrend } from './components/StatCard';
33
+ export { SeverityBadge } from './components/SeverityBadge';
34
+ export type { AlertSeverity } from './components/SeverityBadge';
35
+ export { ServiceGrid } from './components/ServiceGrid';
36
+ export type { ServiceItem } from './components/ServiceGrid';
37
+ export { StatusTimeline } from './components/StatusTimeline';
38
+ export type { TimelineSegment } from './components/StatusTimeline';
39
+ export { LogStream } from './components/LogStream';
40
+ export type { LogEntry } from './components/LogStream';
41
+ export { ThresholdSlider } from './components/ThresholdSlider';
42
+ export type { ThresholdType } from './components/ThresholdSlider';
27
43
  export { PageShell } from './components/PageShell';
28
44
  export { PageHeader } from './components/PageHeader';
29
45
  export { BreadcrumbNav } from './components/BreadcrumbNav';
@@ -74,6 +90,8 @@ export { useChatScroll } from './composables';
74
90
  export type { UseChatScrollOptions, UseChatScrollReturn } from './composables';
75
91
  export { useClipboard } from './composables';
76
92
  export type { UseClipboardOptions } from './composables';
93
+ export { useRealtime } from './composables';
94
+ export type { RealtimeEventType, RealtimeMessage, UseRealtimeOptions, UseRealtimeReturn, } from './composables';
77
95
  export { ICON_MAP, APP_ICON_NAMES, isRegisteredAppIcon } from './utils';
78
96
  export type { AppIconName } from './utils';
79
97
  export { DEFAULT_PAGE_SIZE, PAGE_SIZE_OPTIONS, PAGINATION_LAYOUT } from './utils';
@@ -83,7 +101,7 @@ export type { ApiError } from './utils';
83
101
  export { renderMarkdown, splitTextAndCodeBlocks } from './utils/textParser';
84
102
  export type { TextPart } from './utils/textParser';
85
103
  export { isImage, isPdf, isOffice, isPreviewable, fileKind, formatSize } from './utils/attachmentKind';
86
- export { COLORS, TEXT_COLORS, SPACING, BORDER_RADIUS, SHADOWS, DURATION, Z_INDEX, FONT_SIZE, CONTROL_HEIGHT, LAYOUT_HEIGHT, ICON_SIZE, PAGE, FORM, AVATAR_SIZE, } from './tokens';
87
- export declare const SCHEMA_UI_VERSION = "1.7.0";
104
+ export { COLORS, CHART_COLORS, TEXT_COLORS, SPACING, BORDER_RADIUS, SHADOWS, DURATION, Z_INDEX, FONT_SIZE, CONTROL_HEIGHT, LAYOUT_HEIGHT, ICON_SIZE, PAGE, FORM, AVATAR_SIZE, } from './tokens';
105
+ export declare const SCHEMA_UI_VERSION = "1.8.0";
88
106
  export declare const EP_FORK_BASE = "2.14.2";
89
107
  export declare const EP_FORK_DATE = "2026-08-27";
@@ -16,6 +16,22 @@ export declare const COLORS: {
16
16
  readonly danger: "#E50113";
17
17
  readonly info: "#4581E9";
18
18
  };
19
+ /**
20
+ * 图表色板 — 基于 COLORS 派生,监控系统专用
21
+ * ECharts 无法读取 CSS 变量,故导出 hex 常量
22
+ */
23
+ export declare const CHART_COLORS: {
24
+ readonly primary: "#0060A2";
25
+ readonly success: "#26A036";
26
+ readonly warning: "#F09700";
27
+ readonly danger: "#E50113";
28
+ readonly info: "#4581E9";
29
+ readonly series: readonly ["#0060A2", "#26A036", "#F09700", "#E50113", "#8B5CF6", "#EC4899", "#14B8A6", "#F97316"];
30
+ readonly axisLine: "#D5DDE3";
31
+ readonly splitLine: "#EBEDF3";
32
+ readonly tooltipBg: "#FFFFFF";
33
+ readonly tooltipText: "#303133";
34
+ };
19
35
  /** 文字色 */
20
36
  export declare const TEXT_COLORS: {
21
37
  readonly title: "#303133";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 监控指标数值格式化
3
+ */
4
+ /** 指标单位 */
5
+ export type MetricUnit = 'count' | 'ms' | 'percent' | 'currency' | 'tokens' | 'bytes';
6
+ /**
7
+ * 按单位格式化数值
8
+ * @param value - 原始数值
9
+ * @param unit - 单位类型
10
+ */
11
+ export declare function formatMetricValue(value: number, unit: MetricUnit): string;
12
+ /**
13
+ * 相对时间文案(用于 lastSeen 等)
14
+ * @param iso - ISO 8601 时间
15
+ */
16
+ export declare function formatRelativeTime(iso: string): string;
17
+ /**
18
+ * 时长文案
19
+ * @param ms - 毫秒
20
+ */
21
+ export declare function formatDuration(ms: number): string;
@@ -36,3 +36,19 @@ export declare function tryLoadPdfjs(): Promise<PdfjsModule | null>;
36
36
  * 尝试加载 xlsx
37
37
  */
38
38
  export declare function tryLoadXlsx(): Promise<XlsxModule | null>;
39
+ /** 宽松 echarts 模块(init + 实例方法) */
40
+ export type EchartsModule = {
41
+ init: (el: HTMLElement, theme?: string | object | null, opts?: object) => EchartsInstance;
42
+ };
43
+ /** ECharts 实例最小接口 */
44
+ export type EchartsInstance = {
45
+ setOption: (option: object, opts?: object) => void;
46
+ resize: () => void;
47
+ dispose: () => void;
48
+ on: (event: string, handler: (params: unknown) => void) => void;
49
+ off: (event: string, handler?: (params: unknown) => void) => void;
50
+ };
51
+ /**
52
+ * 尝试加载 echarts
53
+ */
54
+ export declare function tryLoadEcharts(): Promise<EchartsModule | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apform-ui/core",
3
- "version": "1.7.4",
3
+ "version": "1.8.0",
4
4
  "type": "module",
5
5
  "author": "yangdongnan",
6
6
  "license": "MIT",
@@ -61,12 +61,16 @@
61
61
  "prepublishOnly": "pnpm run build"
62
62
  },
63
63
  "peerDependencies": {
64
+ "echarts": ">=5.0.0",
64
65
  "element-plus": "2.14.2",
65
66
  "pdfjs-dist": ">=4.0.0",
66
67
  "vue": "^3.5.0",
67
68
  "xlsx": ">=0.18.0"
68
69
  },
69
70
  "peerDependenciesMeta": {
71
+ "echarts": {
72
+ "optional": true
73
+ },
70
74
  "pdfjs-dist": {
71
75
  "optional": true
72
76
  },
@@ -85,6 +89,7 @@
85
89
  "@types/node": "^26.0.1",
86
90
  "@vitejs/plugin-vue": "^5.2.3",
87
91
  "@vue/test-utils": "^2.4.6",
92
+ "echarts": "^5.6.0",
88
93
  "element-plus": "2.14.2",
89
94
  "jsdom": "^26.0.0",
90
95
  "sass-embedded": "^1.100.0",
package/src/docs/index.ts CHANGED
@@ -51,6 +51,14 @@ export { TableRowActionsDoc } from '../components/TableRowActions/doc'
51
51
  export { ToastDoc } from '../components/Toast/doc'
52
52
  export { TruncatedTooltipTextDoc } from '../components/TruncatedTooltipText/doc'
53
53
  export { UserAvatarDoc } from '../components/UserAvatar/doc'
54
+ export { TimeRangePickerDoc } from '../components/TimeRangePicker/doc'
55
+ export { MetricChartDoc } from '../components/MetricChart/doc'
56
+ export { StatCardDoc } from '../components/StatCard/doc'
57
+ export { SeverityBadgeDoc } from '../components/SeverityBadge/doc'
58
+ export { ServiceGridDoc } from '../components/ServiceGrid/doc'
59
+ export { StatusTimelineDoc } from '../components/StatusTimeline/doc'
60
+ export { LogStreamDoc } from '../components/LogStream/doc'
61
+ export { ThresholdSliderDoc } from '../components/ThresholdSlider/doc'
54
62
 
55
63
  import type { ComponentDoc } from './types'
56
64
  import { AppDialogDoc } from '../components/AppDialog/doc'
@@ -100,6 +108,14 @@ import { TableRowActionsDoc } from '../components/TableRowActions/doc'
100
108
  import { ToastDoc } from '../components/Toast/doc'
101
109
  import { TruncatedTooltipTextDoc } from '../components/TruncatedTooltipText/doc'
102
110
  import { UserAvatarDoc } from '../components/UserAvatar/doc'
111
+ import { TimeRangePickerDoc } from '../components/TimeRangePicker/doc'
112
+ import { MetricChartDoc } from '../components/MetricChart/doc'
113
+ import { StatCardDoc } from '../components/StatCard/doc'
114
+ import { SeverityBadgeDoc } from '../components/SeverityBadge/doc'
115
+ import { ServiceGridDoc } from '../components/ServiceGrid/doc'
116
+ import { StatusTimelineDoc } from '../components/StatusTimeline/doc'
117
+ import { LogStreamDoc } from '../components/LogStream/doc'
118
+ import { ThresholdSliderDoc } from '../components/ThresholdSlider/doc'
103
119
 
104
120
  /** 按组件名索引的文档表 */
105
121
  export const componentDocs: Record<string, ComponentDoc> = {
@@ -138,15 +154,23 @@ export const componentDocs: Record<string, ComponentDoc> = {
138
154
  JsonCard: JsonCardDoc,
139
155
  JsonDetailDialog: JsonDetailDialogDoc,
140
156
  LoadingDots: LoadingDotsDoc,
157
+ LogStream: LogStreamDoc,
158
+ MetricChart: MetricChartDoc,
141
159
  PageHeader: PageHeaderDoc,
142
160
  PageShell: PageShellDoc,
143
161
  PdfPreviewCard: PdfPreviewCardDoc,
144
162
  SchemaLitePreview: SchemaLitePreviewDoc,
145
163
  SearchForm: SearchFormDoc,
146
164
  SectionToggle: SectionToggleDoc,
165
+ ServiceGrid: ServiceGridDoc,
166
+ SeverityBadge: SeverityBadgeDoc,
147
167
  Skeleton: SkeletonDoc,
168
+ StatCard: StatCardDoc,
148
169
  StatusTag: StatusTagDoc,
170
+ StatusTimeline: StatusTimelineDoc,
149
171
  TableRowActions: TableRowActionsDoc,
172
+ ThresholdSlider: ThresholdSliderDoc,
173
+ TimeRangePicker: TimeRangePickerDoc,
150
174
  Toast: ToastDoc,
151
175
  TruncatedTooltipText: TruncatedTooltipTextDoc,
152
176
  UserAvatar: UserAvatarDoc,
@@ -18,6 +18,32 @@ export const COLORS = {
18
18
  info: '#4581E9',
19
19
  } as const
20
20
 
21
+ /**
22
+ * 图表色板 — 基于 COLORS 派生,监控系统专用
23
+ * ECharts 无法读取 CSS 变量,故导出 hex 常量
24
+ */
25
+ export const CHART_COLORS = {
26
+ primary: COLORS.primary,
27
+ success: COLORS.success,
28
+ warning: COLORS.warning,
29
+ danger: COLORS.danger,
30
+ info: COLORS.info,
31
+ series: [
32
+ COLORS.primary,
33
+ COLORS.success,
34
+ COLORS.warning,
35
+ COLORS.danger,
36
+ '#8B5CF6',
37
+ '#EC4899',
38
+ '#14B8A6',
39
+ '#F97316',
40
+ ],
41
+ axisLine: '#D5DDE3',
42
+ splitLine: '#EBEDF3',
43
+ tooltipBg: '#FFFFFF',
44
+ tooltipText: '#303133',
45
+ } as const
46
+
21
47
  /** 文字色 */
22
48
  export const TEXT_COLORS = {
23
49
  title: '#303133',