Make starter project delivery-ready

This commit is contained in:
zhougf committed 2026-05-31 00:55:04 +08:00
1 parent 5b300dee0d
commit d7bfde754b
22 files changed
+695 -71

No files matched your search

+41
View File
@@ -0,0 +1,41 @@
import type { EChartsOption } from 'echarts'
import type { ReactNode } from 'react'
import { EChart } from './EChart'
type ChartPanelProps = {
title: string
option?: EChartsOption | null
loading?: boolean
error?: string | null
empty?: boolean
emptyText?: string
className?: string
extra?: ReactNode
}
export function ChartPanel({
title,
option,
loading = false,
error,
empty,
emptyText = '暂无数据',
className = '',
extra
}: ChartPanelProps) {
const isEmpty = empty ?? !option
return (
<section className={`screen-panel chart-panel ${className}`}>
<header>
<span>{title}</span>
{extra ? <div className="chart-panel-extra">{extra}</div> : null}
</header>
<div className="screen-panel-body chart-panel-body">
{error ? <div className="chart-panel-state is-error">{error}</div> : null}
{!error && isEmpty ? <div className="chart-panel-state">{emptyText}</div> : null}
{!error && !isEmpty && option ? <EChart option={option} loading={loading} /> : null}
</div>
</section>
)
}
+1
View File
@@ -1,3 +1,4 @@
export * from './EChart'
export * from './ChartPanel'
export * from './chartTheme'
export * from './optionFactories'