@easy-editor/materials-dashboard-radar-chart 0.0.2
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/plugins/vite-plugin-external-deps.ts +224 -0
- package/.vite/plugins/vite-plugin-material-dev.ts +218 -0
- package/CHANGELOG.md +7 -0
- package/LICENSE +9 -0
- package/dist/component.esm.js +31510 -0
- package/dist/component.esm.js.map +1 -0
- package/dist/component.js +31517 -0
- package/dist/component.js.map +1 -0
- package/dist/component.min.js +24 -0
- package/dist/component.min.js.map +1 -0
- package/dist/index.cjs +31811 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.esm.js +31808 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +31815 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +24 -0
- package/dist/index.min.js.map +1 -0
- package/dist/meta.esm.js +333 -0
- package/dist/meta.esm.js.map +1 -0
- package/dist/meta.js +343 -0
- package/dist/meta.js.map +1 -0
- package/dist/meta.min.js +2 -0
- package/dist/meta.min.js.map +1 -0
- package/dist/src/component.d.ts +21 -0
- package/dist/src/configure.d.ts +7 -0
- package/dist/src/constants.d.ts +39 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/meta.d.ts +3 -0
- package/dist/src/snippets.d.ts +3 -0
- package/package.json +68 -0
- package/rollup.config.js +212 -0
- package/src/component.module.css +16 -0
- package/src/component.tsx +199 -0
- package/src/configure.ts +247 -0
- package/src/constants.ts +51 -0
- package/src/index.tsx +7 -0
- package/src/meta.ts +23 -0
- package/src/snippets.ts +57 -0
- package/src/type.d.ts +8 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +9 -0
- package/tsconfig.test.json +7 -0
- package/vite.config.ts +54 -0
package/src/constants.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 物料常量配置
|
|
3
|
+
* 统一管理全局变量名等配置,确保 meta.ts 和 rollup.config.js 使用相同的值
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* UMD 全局变量基础名称
|
|
8
|
+
*/
|
|
9
|
+
export const COMPONENT_NAME = 'EasyEditorMaterialsTechRadarChart'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 包名
|
|
13
|
+
*/
|
|
14
|
+
export const PACKAGE_NAME = '@easy-editor/materials-dashboard-tech-radar-chart'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 默认颜色
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_COLORS = ['#00d4ff', '#00ff88', '#ff6b6b', '#ffd93d', '#6bcbff', '#c56bff']
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 默认维度
|
|
23
|
+
*/
|
|
24
|
+
export const DEFAULT_DIMENSIONS = ['Attack', 'Defense', 'Speed', 'Magic', 'HP']
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 雷达图数据点类型
|
|
28
|
+
*/
|
|
29
|
+
export interface RadarDataPoint {
|
|
30
|
+
dimension: string
|
|
31
|
+
[key: string]: number | string | undefined
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 默认数据
|
|
36
|
+
*/
|
|
37
|
+
export const DEFAULT_DATA: RadarDataPoint[] = [
|
|
38
|
+
{ dimension: 'Attack', player1: 85, player2: 70 },
|
|
39
|
+
{ dimension: 'Defense', player1: 70, player2: 90 },
|
|
40
|
+
{ dimension: 'Speed', player1: 95, player2: 60 },
|
|
41
|
+
{ dimension: 'Magic', player1: 60, player2: 85 },
|
|
42
|
+
{ dimension: 'HP', player1: 75, player2: 80 },
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 默认系列配置
|
|
47
|
+
*/
|
|
48
|
+
export const DEFAULT_SERIES = [
|
|
49
|
+
{ name: 'Player 1', dataKey: 'player1', color: '#00d4ff' },
|
|
50
|
+
{ name: 'Player 2', dataKey: 'player2', color: '#00ff88' },
|
|
51
|
+
]
|
package/src/index.tsx
ADDED
package/src/meta.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ComponentMetadata } from '@easy-editor/core'
|
|
2
|
+
import { MaterialGroup } from '@easy-editor/materials-shared'
|
|
3
|
+
import { COMPONENT_NAME, PACKAGE_NAME } from './constants'
|
|
4
|
+
import configure from './configure'
|
|
5
|
+
import snippets from './snippets'
|
|
6
|
+
import pkg from '../package.json'
|
|
7
|
+
|
|
8
|
+
const meta: ComponentMetadata = {
|
|
9
|
+
componentName: COMPONENT_NAME,
|
|
10
|
+
title: '雷达图',
|
|
11
|
+
group: MaterialGroup.CHART,
|
|
12
|
+
devMode: 'proCode',
|
|
13
|
+
npm: {
|
|
14
|
+
package: PACKAGE_NAME,
|
|
15
|
+
version: pkg.version,
|
|
16
|
+
globalName: COMPONENT_NAME,
|
|
17
|
+
componentName: COMPONENT_NAME,
|
|
18
|
+
},
|
|
19
|
+
snippets,
|
|
20
|
+
configure,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default meta
|
package/src/snippets.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Snippet } from '@easy-editor/core'
|
|
2
|
+
import { COMPONENT_NAME, DEFAULT_DATA, DEFAULT_SERIES } from './constants'
|
|
3
|
+
|
|
4
|
+
const snippets: Snippet[] = [
|
|
5
|
+
{
|
|
6
|
+
title: '雷达图',
|
|
7
|
+
screenshot: '',
|
|
8
|
+
schema: {
|
|
9
|
+
componentName: COMPONENT_NAME,
|
|
10
|
+
props: {
|
|
11
|
+
data: DEFAULT_DATA,
|
|
12
|
+
dimensionKey: 'dimension',
|
|
13
|
+
series: DEFAULT_SERIES,
|
|
14
|
+
showGrid: true,
|
|
15
|
+
fillOpacity: 0.3,
|
|
16
|
+
glowEffect: true,
|
|
17
|
+
showLegend: true,
|
|
18
|
+
},
|
|
19
|
+
$dashboard: {
|
|
20
|
+
rect: {
|
|
21
|
+
width: 400,
|
|
22
|
+
height: 300,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: '单系列雷达图',
|
|
29
|
+
screenshot: '',
|
|
30
|
+
schema: {
|
|
31
|
+
componentName: COMPONENT_NAME,
|
|
32
|
+
props: {
|
|
33
|
+
data: [
|
|
34
|
+
{ dimension: 'Attack', value: 85 },
|
|
35
|
+
{ dimension: 'Defense', value: 70 },
|
|
36
|
+
{ dimension: 'Speed', value: 95 },
|
|
37
|
+
{ dimension: 'Magic', value: 60 },
|
|
38
|
+
{ dimension: 'HP', value: 75 },
|
|
39
|
+
],
|
|
40
|
+
dimensionKey: 'dimension',
|
|
41
|
+
series: [{ name: 'Stats', dataKey: 'value', color: '#00d4ff' }],
|
|
42
|
+
showGrid: true,
|
|
43
|
+
fillOpacity: 0.4,
|
|
44
|
+
glowEffect: true,
|
|
45
|
+
showLegend: false,
|
|
46
|
+
},
|
|
47
|
+
$dashboard: {
|
|
48
|
+
rect: {
|
|
49
|
+
width: 400,
|
|
50
|
+
height: 300,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
export default snippets
|
package/src/type.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"jsx": "react-jsx",
|
|
5
|
+
"strictPropertyInitialization": false,
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true
|
|
10
|
+
},
|
|
11
|
+
"include": ["./src"]
|
|
12
|
+
}
|
package/tsconfig.json
ADDED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite Configuration for Material Development
|
|
3
|
+
* 物料开发 Vite 配置
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { defineConfig } from 'vite'
|
|
7
|
+
import react from '@vitejs/plugin-react'
|
|
8
|
+
import { materialDevPlugin } from './.vite/plugins/vite-plugin-material-dev'
|
|
9
|
+
import { externalDeps } from './.vite/plugins/vite-plugin-external-deps'
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
plugins: [
|
|
13
|
+
react(),
|
|
14
|
+
// 外部化 React/ReactDOM,使用父应用提供的实例
|
|
15
|
+
externalDeps({
|
|
16
|
+
externals: ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core'],
|
|
17
|
+
globals: {
|
|
18
|
+
react: 'React',
|
|
19
|
+
'react-dom': 'ReactDOM',
|
|
20
|
+
'react/jsx-runtime': 'jsxRuntime',
|
|
21
|
+
'@easy-editor/core': 'EasyEditorCore',
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
materialDevPlugin({
|
|
25
|
+
entry: '/src/index.tsx',
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
28
|
+
server: {
|
|
29
|
+
port: 5001,
|
|
30
|
+
host: 'localhost',
|
|
31
|
+
cors: true,
|
|
32
|
+
hmr: {
|
|
33
|
+
port: 5001,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
build: {
|
|
37
|
+
target: 'esnext',
|
|
38
|
+
rollupOptions: {
|
|
39
|
+
// 确保生产构建也外部化这些依赖
|
|
40
|
+
external: ['react', 'react-dom', 'react/jsx-runtime', '@easy-editor/core'],
|
|
41
|
+
output: {
|
|
42
|
+
globals: {
|
|
43
|
+
react: 'React',
|
|
44
|
+
'react-dom': 'ReactDOM',
|
|
45
|
+
'react/jsx-runtime': 'jsxRuntime',
|
|
46
|
+
'@easy-editor/core': 'EasyEditorCore',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
resolve: {
|
|
52
|
+
dedupe: ['react', 'react-dom'],
|
|
53
|
+
},
|
|
54
|
+
})
|