@easy-editor/materials-dashboard-radar-chart 0.0.3 → 0.0.5
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/.vite/echarts-external-plugin.ts +61 -0
- package/CHANGELOG.md +27 -13
- package/easypack.config.ts +19 -0
- package/package.json +4 -8
- package/src/component.tsx +69 -22
- package/src/configure.ts +135 -247
- package/src/index.tsx +7 -7
- package/src/meta.ts +3 -3
- package/src/snippets.ts +86 -57
- package/tsconfig.json +20 -9
- package/.vite/plugins/vite-plugin-external-deps.ts +0 -224
- package/.vite/plugins/vite-plugin-material-dev.ts +0 -218
- package/dist/component.esm.js +0 -31510
- package/dist/component.esm.js.map +0 -1
- package/dist/component.js +0 -31517
- package/dist/component.js.map +0 -1
- package/dist/component.min.js +0 -24
- package/dist/component.min.js.map +0 -1
- package/dist/index.cjs +0 -31811
- package/dist/index.cjs.map +0 -1
- package/dist/index.esm.js +0 -31808
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -31815
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -24
- package/dist/index.min.js.map +0 -1
- package/dist/meta.esm.js +0 -333
- package/dist/meta.esm.js.map +0 -1
- package/dist/meta.js +0 -343
- package/dist/meta.js.map +0 -1
- package/dist/meta.min.js +0 -2
- package/dist/meta.min.js.map +0 -1
- package/dist/src/component.d.ts +0 -21
- package/dist/src/configure.d.ts +0 -7
- package/dist/src/constants.d.ts +0 -39
- package/dist/src/index.d.ts +0 -6
- package/dist/src/meta.d.ts +0 -3
- package/dist/src/snippets.d.ts +0 -3
- package/rollup.config.js +0 -212
- package/tsconfig.build.json +0 -12
- package/tsconfig.test.json +0 -7
- package/vite.config.ts +0 -54
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// 自定义插件:处理 echarts 模块的命名导出
|
|
2
|
+
export const echartsExternalPlugin = () => {
|
|
3
|
+
const ECHARTS_MODULES = ['echarts', 'echarts/core', 'echarts/charts', 'echarts/components', 'echarts/renderers']
|
|
4
|
+
const VIRTUAL_PREFIX = '\0virtual:echarts-external:'
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
name: 'vite-plugin-echarts-external',
|
|
8
|
+
enforce: 'pre',
|
|
9
|
+
resolveId(id) {
|
|
10
|
+
if (ECHARTS_MODULES.includes(id)) {
|
|
11
|
+
return VIRTUAL_PREFIX + id
|
|
12
|
+
}
|
|
13
|
+
return null
|
|
14
|
+
},
|
|
15
|
+
load(id) {
|
|
16
|
+
if (!id.startsWith(VIRTUAL_PREFIX)) {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
const moduleName = id.slice(VIRTUAL_PREFIX.length)
|
|
20
|
+
const globalKey = moduleName.includes('/') ? `["${moduleName}"]` : `.${moduleName}`
|
|
21
|
+
|
|
22
|
+
return `
|
|
23
|
+
// External module: ${moduleName} -> window${globalKey}
|
|
24
|
+
const mod = window${globalKey} || window.echarts;
|
|
25
|
+
if (!mod) {
|
|
26
|
+
throw new Error('External dependency "${moduleName}" is not available on window.');
|
|
27
|
+
}
|
|
28
|
+
export default mod;
|
|
29
|
+
export const {
|
|
30
|
+
${getExportsForModule(moduleName)}
|
|
31
|
+
} = mod;
|
|
32
|
+
`
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// 根据模块名返回需要导出的属性
|
|
38
|
+
function getExportsForModule(moduleName) {
|
|
39
|
+
switch (moduleName) {
|
|
40
|
+
case 'echarts/core':
|
|
41
|
+
return 'use, init, graphic, registerMap, getMap'
|
|
42
|
+
case 'echarts/charts':
|
|
43
|
+
return 'MapChart, LinesChart, EffectScatterChart, BarChart, LineChart, PieChart, RadarChart, ScatterChart, GaugeChart'
|
|
44
|
+
case 'echarts/components':
|
|
45
|
+
return 'GeoComponent, TooltipComponent, LegendComponent, GridComponent, VisualMapComponent, TitleComponent'
|
|
46
|
+
case 'echarts/renderers':
|
|
47
|
+
return 'CanvasRenderer, SVGRenderer'
|
|
48
|
+
default:
|
|
49
|
+
return 'use, init, graphic, registerMap'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// echarts 模块列表
|
|
54
|
+
export const ECHARTS_EXTERNALS = ['echarts', 'echarts/core', 'echarts/charts', 'echarts/components', 'echarts/renderers']
|
|
55
|
+
export const ECHARTS_GLOBALS = {
|
|
56
|
+
echarts: 'echarts',
|
|
57
|
+
'echarts/core': 'echarts',
|
|
58
|
+
'echarts/charts': 'echarts',
|
|
59
|
+
'echarts/components': 'echarts',
|
|
60
|
+
'echarts/renderers': 'echarts',
|
|
61
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
# @easy-editor/materials-dashboard-radar-chart
|
|
2
|
-
|
|
3
|
-
## 0.0.
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- fix:
|
|
8
|
-
|
|
9
|
-
## 0.0.
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
-
|
|
1
|
+
# @easy-editor/materials-dashboard-radar-chart
|
|
2
|
+
|
|
3
|
+
## 0.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: component export error
|
|
8
|
+
|
|
9
|
+
## 0.0.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- perf: configure & datasource
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @easy-editor/materials-shared@0.0.1
|
|
16
|
+
|
|
17
|
+
## 0.0.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- fix: build error
|
|
22
|
+
|
|
23
|
+
## 0.0.2
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- feat: new setters
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @easy-editor/easypack configuration
|
|
3
|
+
* @type {import('@easy-editor/easypack').EasypackConfig}
|
|
4
|
+
*/
|
|
5
|
+
import { ECHARTS_EXTERNALS, ECHARTS_GLOBALS, echartsExternalPlugin } from './.vite/echarts-external-plugin'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
preset: 'material',
|
|
9
|
+
dev: {
|
|
10
|
+
port: 5001,
|
|
11
|
+
},
|
|
12
|
+
rollup: {
|
|
13
|
+
external: ECHARTS_EXTERNALS,
|
|
14
|
+
output: {
|
|
15
|
+
globals: ECHARTS_GLOBALS,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
vitePlugins: [echartsExternalPlugin()],
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-editor/materials-dashboard-radar-chart",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Radar Chart component for EasyEditor dashboard",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,20 +48,16 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"echarts": "^5.6.0",
|
|
51
|
-
"@easy-editor/materials-shared": "0.0.
|
|
51
|
+
"@easy-editor/materials-shared": "0.0.1"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
|
-
"dev": "
|
|
54
|
+
"dev": "easypack dev",
|
|
55
55
|
"dev:debug": "vite --port 5005",
|
|
56
56
|
"format": "biome format --write .",
|
|
57
57
|
"lint": "biome check .",
|
|
58
58
|
"build": "npm-run-all -nl build:*",
|
|
59
59
|
"build:clean": "rimraf dist/",
|
|
60
|
-
"build:js": "
|
|
61
|
-
"build:types": "pnpm types",
|
|
62
|
-
"types": "npm-run-all -nl types:*",
|
|
63
|
-
"types:src": "tsc --project tsconfig.build.json",
|
|
64
|
-
"test-types": "tsc --project tsconfig.test.json"
|
|
60
|
+
"build:js": "easypack build"
|
|
65
61
|
},
|
|
66
62
|
"module": "dist/index.esm.js",
|
|
67
63
|
"unpkg": "dist/index.min.js"
|
package/src/component.tsx
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Radar Chart Component
|
|
3
|
+
* 雷达图组件 - 支持数据源绑定和事件交互
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useEffect, useMemo, useRef, type CSSProperties } from 'react'
|
|
2
7
|
import * as echarts from 'echarts/core'
|
|
3
|
-
import { RadarChart } from 'echarts/charts'
|
|
8
|
+
import { RadarChart as EChartsRadarChart } from 'echarts/charts'
|
|
4
9
|
import { TooltipComponent, LegendComponent } from 'echarts/components'
|
|
5
10
|
import { CanvasRenderer } from 'echarts/renderers'
|
|
6
11
|
import type { EChartsOption } from 'echarts'
|
|
12
|
+
import { type MaterialComponet, useDataSource } from '@easy-editor/materials-shared'
|
|
7
13
|
import { DEFAULT_DATA, DEFAULT_SERIES, type RadarDataPoint } from './constants'
|
|
8
14
|
import styles from './component.module.css'
|
|
9
15
|
|
|
10
16
|
// 按需注册 ECharts 组件
|
|
11
|
-
echarts.use([
|
|
17
|
+
echarts.use([EChartsRadarChart, TooltipComponent, LegendComponent, CanvasRenderer])
|
|
12
18
|
|
|
13
19
|
interface RadarSeries {
|
|
14
20
|
name: string
|
|
@@ -16,17 +22,31 @@ interface RadarSeries {
|
|
|
16
22
|
color: string
|
|
17
23
|
}
|
|
18
24
|
|
|
19
|
-
interface RadarChartProps {
|
|
20
|
-
|
|
25
|
+
export interface RadarChartProps extends MaterialComponet {
|
|
26
|
+
/** 静态数据(兼容旧版) */
|
|
21
27
|
data?: RadarDataPoint[]
|
|
28
|
+
/** 维度字段 */
|
|
22
29
|
dimensionKey?: string
|
|
30
|
+
/** 系列配置 */
|
|
23
31
|
series?: RadarSeries[]
|
|
32
|
+
/** 显示网格 */
|
|
24
33
|
showGrid?: boolean
|
|
34
|
+
/** 填充透明度 */
|
|
25
35
|
fillOpacity?: number
|
|
36
|
+
/** 发光效果 */
|
|
26
37
|
glowEffect?: boolean
|
|
38
|
+
/** 显示图例 */
|
|
27
39
|
showLegend?: boolean
|
|
40
|
+
/** 显示提示 */
|
|
28
41
|
showTooltip?: boolean
|
|
29
|
-
|
|
42
|
+
/** 点击事件 */
|
|
43
|
+
onClick?: (e: React.MouseEvent) => void
|
|
44
|
+
/** 双击事件 */
|
|
45
|
+
onDoubleClick?: (e: React.MouseEvent) => void
|
|
46
|
+
/** 鼠标进入 */
|
|
47
|
+
onMouseEnter?: (e: React.MouseEvent) => void
|
|
48
|
+
/** 鼠标离开 */
|
|
49
|
+
onMouseLeave?: (e: React.MouseEvent) => void
|
|
30
50
|
}
|
|
31
51
|
|
|
32
52
|
// 构建图表配置
|
|
@@ -138,23 +158,39 @@ const buildOption = (
|
|
|
138
158
|
}
|
|
139
159
|
}
|
|
140
160
|
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
161
|
+
export const RadarChart: React.FC<RadarChartProps> = ({
|
|
162
|
+
ref,
|
|
163
|
+
$data,
|
|
164
|
+
__dataSource,
|
|
165
|
+
data: staticData,
|
|
166
|
+
dimensionKey = 'dimension',
|
|
167
|
+
series = DEFAULT_SERIES,
|
|
168
|
+
showGrid = true,
|
|
169
|
+
fillOpacity = 0.3,
|
|
170
|
+
glowEffect = true,
|
|
171
|
+
showLegend = true,
|
|
172
|
+
showTooltip = true,
|
|
173
|
+
rotation = 0,
|
|
174
|
+
opacity = 100,
|
|
175
|
+
background = 'transparent',
|
|
176
|
+
style: externalStyle,
|
|
177
|
+
onClick,
|
|
178
|
+
onDoubleClick,
|
|
179
|
+
onMouseEnter,
|
|
180
|
+
onMouseLeave,
|
|
181
|
+
}) => {
|
|
155
182
|
const chartRef = useRef<HTMLDivElement>(null)
|
|
156
183
|
const chartInstance = useRef<echarts.ECharts | null>(null)
|
|
157
184
|
|
|
185
|
+
// 解析数据源
|
|
186
|
+
const dataSource = useDataSource($data, __dataSource)
|
|
187
|
+
const data = useMemo<RadarDataPoint[]>(() => {
|
|
188
|
+
if (dataSource.length > 0) {
|
|
189
|
+
return dataSource as RadarDataPoint[]
|
|
190
|
+
}
|
|
191
|
+
return staticData ?? DEFAULT_DATA
|
|
192
|
+
}, [dataSource, staticData])
|
|
193
|
+
|
|
158
194
|
useEffect(() => {
|
|
159
195
|
if (!chartRef.current) {
|
|
160
196
|
return
|
|
@@ -186,14 +222,25 @@ const RadarChartComponent = (props: RadarChartProps) => {
|
|
|
186
222
|
const containerStyle: CSSProperties = {
|
|
187
223
|
width: '100%',
|
|
188
224
|
height: '100%',
|
|
225
|
+
transform: rotation !== 0 ? `rotate(${rotation}deg)` : undefined,
|
|
226
|
+
opacity: opacity / 100,
|
|
227
|
+
backgroundColor: background,
|
|
189
228
|
...externalStyle,
|
|
190
229
|
}
|
|
191
230
|
|
|
192
231
|
return (
|
|
193
|
-
<div
|
|
232
|
+
<div
|
|
233
|
+
className={styles.container}
|
|
234
|
+
onClick={onClick}
|
|
235
|
+
onDoubleClick={onDoubleClick}
|
|
236
|
+
onMouseEnter={onMouseEnter}
|
|
237
|
+
onMouseLeave={onMouseLeave}
|
|
238
|
+
ref={ref}
|
|
239
|
+
style={containerStyle}
|
|
240
|
+
>
|
|
194
241
|
<div className={styles.chart} ref={chartRef} />
|
|
195
242
|
</div>
|
|
196
243
|
)
|
|
197
244
|
}
|
|
198
245
|
|
|
199
|
-
export default
|
|
246
|
+
export default RadarChart
|
package/src/configure.ts
CHANGED
|
@@ -1,247 +1,135 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Radar Chart Configure
|
|
3
|
-
* 雷达图组件配置
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
type: 'group',
|
|
142
|
-
title: '样式',
|
|
143
|
-
setter: {
|
|
144
|
-
componentName: 'CollapseSetter',
|
|
145
|
-
props: {
|
|
146
|
-
icon: false,
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
items: [
|
|
150
|
-
{
|
|
151
|
-
name: 'showGrid',
|
|
152
|
-
title: '显示网格',
|
|
153
|
-
setter: 'SwitchSetter',
|
|
154
|
-
extraProps: {
|
|
155
|
-
defaultValue: true,
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: 'fillOpacity',
|
|
160
|
-
title: '填充透明度',
|
|
161
|
-
setter: {
|
|
162
|
-
componentName: 'SliderSetter',
|
|
163
|
-
props: {
|
|
164
|
-
min: 0,
|
|
165
|
-
max: 1,
|
|
166
|
-
step: 0.1,
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
extraProps: {
|
|
170
|
-
defaultValue: 0.3,
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
name: 'showLegend',
|
|
175
|
-
title: '显示图例',
|
|
176
|
-
setter: 'SwitchSetter',
|
|
177
|
-
extraProps: {
|
|
178
|
-
defaultValue: true,
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
name: 'legendPosition',
|
|
183
|
-
title: '图例位置',
|
|
184
|
-
setter: {
|
|
185
|
-
componentName: 'SelectSetter',
|
|
186
|
-
props: {
|
|
187
|
-
options: [
|
|
188
|
-
{ label: '顶部', value: 'top' },
|
|
189
|
-
{ label: '底部', value: 'bottom' },
|
|
190
|
-
{ label: '左侧', value: 'left' },
|
|
191
|
-
{ label: '右侧', value: 'right' },
|
|
192
|
-
],
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
extraProps: {
|
|
196
|
-
defaultValue: 'bottom',
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: 'glowEffect',
|
|
201
|
-
title: '发光效果',
|
|
202
|
-
setter: 'SwitchSetter',
|
|
203
|
-
extraProps: {
|
|
204
|
-
defaultValue: true,
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
],
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
type: 'group',
|
|
213
|
-
key: 'data',
|
|
214
|
-
title: '数据',
|
|
215
|
-
items: [
|
|
216
|
-
{
|
|
217
|
-
name: 'dataBinding',
|
|
218
|
-
title: '数据绑定',
|
|
219
|
-
setter: 'DataBindingSetter',
|
|
220
|
-
},
|
|
221
|
-
],
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
type: 'group',
|
|
225
|
-
key: 'advanced',
|
|
226
|
-
title: '高级',
|
|
227
|
-
items: [
|
|
228
|
-
{
|
|
229
|
-
name: 'condition',
|
|
230
|
-
title: '显隐控制',
|
|
231
|
-
setter: 'SwitchSetter',
|
|
232
|
-
extraProps: {
|
|
233
|
-
defaultValue: true,
|
|
234
|
-
supportVariable: true,
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
],
|
|
238
|
-
},
|
|
239
|
-
],
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
component: {},
|
|
243
|
-
supports: {},
|
|
244
|
-
advanced: {},
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export default configure
|
|
1
|
+
/**
|
|
2
|
+
* Radar Chart Configure
|
|
3
|
+
* 雷达图组件配置
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { FieldConfig } from '@easy-editor/core'
|
|
7
|
+
import { createCollapseGroup, createDataConfigGroup, createStandardConfigure } from '@easy-editor/materials-shared'
|
|
8
|
+
|
|
9
|
+
/** 组件配置 */
|
|
10
|
+
const componentConfigGroup: FieldConfig = createCollapseGroup(
|
|
11
|
+
'组件配置',
|
|
12
|
+
[
|
|
13
|
+
{
|
|
14
|
+
type: 'group',
|
|
15
|
+
title: '组件配置',
|
|
16
|
+
setter: 'SubTabSetter',
|
|
17
|
+
items: [
|
|
18
|
+
// 数据 Tab
|
|
19
|
+
{
|
|
20
|
+
type: 'group',
|
|
21
|
+
key: 'chartData',
|
|
22
|
+
title: '数据',
|
|
23
|
+
items: [
|
|
24
|
+
{
|
|
25
|
+
name: 'dimensionKey',
|
|
26
|
+
title: '维度字段',
|
|
27
|
+
setter: 'StringSetter',
|
|
28
|
+
extraProps: {
|
|
29
|
+
defaultValue: 'dimension',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'series',
|
|
34
|
+
title: '系列配置',
|
|
35
|
+
setter: 'JsonSetter',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
// 样式 Tab
|
|
40
|
+
{
|
|
41
|
+
type: 'group',
|
|
42
|
+
key: 'style',
|
|
43
|
+
title: '样式',
|
|
44
|
+
items: [
|
|
45
|
+
{
|
|
46
|
+
name: 'showGrid',
|
|
47
|
+
title: '显示网格',
|
|
48
|
+
setter: 'SwitchSetter',
|
|
49
|
+
extraProps: {
|
|
50
|
+
defaultValue: true,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'fillOpacity',
|
|
55
|
+
title: '填充透明度',
|
|
56
|
+
setter: {
|
|
57
|
+
componentName: 'SliderSetter',
|
|
58
|
+
props: {
|
|
59
|
+
min: 0,
|
|
60
|
+
max: 1,
|
|
61
|
+
step: 0.1,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
extraProps: {
|
|
65
|
+
defaultValue: 0.3,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'glowEffect',
|
|
70
|
+
title: '发光效果',
|
|
71
|
+
setter: 'SwitchSetter',
|
|
72
|
+
extraProps: {
|
|
73
|
+
defaultValue: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
// 图例 Tab
|
|
79
|
+
{
|
|
80
|
+
type: 'group',
|
|
81
|
+
key: 'legend',
|
|
82
|
+
title: '图例',
|
|
83
|
+
items: [
|
|
84
|
+
{
|
|
85
|
+
name: 'showLegend',
|
|
86
|
+
title: '显示图例',
|
|
87
|
+
setter: 'SwitchSetter',
|
|
88
|
+
extraProps: {
|
|
89
|
+
defaultValue: true,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'legendPosition',
|
|
94
|
+
title: '图例位置',
|
|
95
|
+
setter: {
|
|
96
|
+
componentName: 'SelectSetter',
|
|
97
|
+
props: {
|
|
98
|
+
options: [
|
|
99
|
+
{ label: '顶部', value: 'top' },
|
|
100
|
+
{ label: '底部', value: 'bottom' },
|
|
101
|
+
{ label: '左侧', value: 'left' },
|
|
102
|
+
{ label: '右侧', value: 'right' },
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
extraProps: {
|
|
107
|
+
defaultValue: 'bottom',
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'showTooltip',
|
|
112
|
+
title: '显示提示',
|
|
113
|
+
setter: 'SwitchSetter',
|
|
114
|
+
extraProps: {
|
|
115
|
+
defaultValue: true,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
{
|
|
124
|
+
padding: '6px 16px 12px',
|
|
125
|
+
},
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
/** 数据配置 */
|
|
129
|
+
const dataConfigGroup: FieldConfig = createDataConfigGroup([
|
|
130
|
+
{ name: 'dimension', label: 'dimension', type: 'string', required: true, description: '维度名称' },
|
|
131
|
+
{ name: 'value1', label: 'value1', type: 'number', required: true, description: '数值1' },
|
|
132
|
+
{ name: 'value2', label: 'value2', type: 'number', required: false, description: '数值2' },
|
|
133
|
+
])
|
|
134
|
+
|
|
135
|
+
export const configure = createStandardConfigure(componentConfigGroup, dataConfigGroup)
|