@easy-editor/materials-dashboard-geo-map 0.0.3 → 0.0.4
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 +21 -15
- package/easypack.config.ts +9 -0
- package/package.json +1 -1
- package/src/component.tsx +323 -325
- package/src/meta.ts +23 -23
- package/dist/component.min.js +0 -23
- package/dist/index.min.js +0 -23
- package/dist/meta.min.js +0 -1
|
@@ -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,15 +1,21 @@
|
|
|
1
|
-
# @easy-editor/materials-dashboard-geo-map
|
|
2
|
-
|
|
3
|
-
## 0.0.
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
1
|
+
# @easy-editor/materials-dashboard-geo-map
|
|
2
|
+
|
|
3
|
+
## 0.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix: component export error
|
|
8
|
+
|
|
9
|
+
## 0.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- perf: configure & datasource
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @easy-editor/materials-shared@0.0.1
|
|
16
|
+
|
|
17
|
+
## 0.0.2
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- feat: new setters
|
package/easypack.config.ts
CHANGED
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
* @easy-editor/easypack configuration
|
|
3
3
|
* @type {import('@easy-editor/easypack').EasypackConfig}
|
|
4
4
|
*/
|
|
5
|
+
import { ECHARTS_EXTERNALS, ECHARTS_GLOBALS, echartsExternalPlugin } from './.vite/echarts-external-plugin'
|
|
6
|
+
|
|
5
7
|
export default {
|
|
6
8
|
preset: 'material',
|
|
7
9
|
dev: {
|
|
8
10
|
port: 5001,
|
|
9
11
|
},
|
|
12
|
+
rollup: {
|
|
13
|
+
external: ECHARTS_EXTERNALS,
|
|
14
|
+
output: {
|
|
15
|
+
globals: ECHARTS_GLOBALS,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
vitePlugins: [echartsExternalPlugin()],
|
|
10
19
|
}
|