@worm-print-platform/echarts 1.5.2 → 1.5.3
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/README.md +38 -92
- package/dist/bind.d.ts +1 -1
- package/dist/browser/executor.iife.d.ts +1 -1
- package/dist/browser-bundle.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/echarts.d.ts +1 -1
- package/dist/executor.iife.global.d.ts +1 -1
- package/dist/executor.iife.global.js +16 -16
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/kinds.d.ts +1 -1
- package/dist/kit.cjs +1 -1
- package/dist/kit.d.ts +1 -1
- package/dist/kit.js +1 -1
- package/dist/marketplace.d.ts +8 -0
- package/dist/marketplace.js +1064 -0
- package/dist/node.cjs +2 -2
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/normalize.d.ts +1 -1
- package/dist/option-utils.d.ts +1 -1
- package/dist/plugin-Bf6QDbHO.cjs +1 -1
- package/dist/plugin-CUoE2jMs.js +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/renderer.d.ts +1 -1
- package/dist/type-augmentation.d.ts +1 -1
- package/dist/ui.cjs +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +1 -1
- package/dist/units.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,119 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
<strong>@worm-print-platform/echarts</strong><br>
|
|
3
|
-
<em>打印模板 ECharts 图表元素可选包</em>
|
|
4
|
-
</p>
|
|
1
|
+
# 百度图表插件(@worm-print-platform/plugin-echarts)
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
<img src="https://img.shields.io/badge/npm-v1.5.2-384BFF" alt="npm">
|
|
8
|
-
<img src="https://img.shields.io/badge/license-MIT-9A9A9A" alt="license">
|
|
9
|
-
</p>
|
|
3
|
+
worm-print-platform 插件市场的百度图表插件:**十类 ECharts 图表元素 + 设计器 UI,import 即注册**。
|
|
10
4
|
|
|
11
|
-
|
|
5
|
+
本目录 `marketplace/plugins/echarts/` 是图表插件的**唯一源码真源**。同一份源码构建出两个 npm 包:
|
|
12
6
|
|
|
13
|
-
|
|
7
|
+
| 包名 | 定位 | 根入口行为 |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| `@worm-print-platform/plugin-echarts` | 插件市场主口径(推荐) | 注册插件描述符 + 设计器 UI |
|
|
10
|
+
| `@worm-print-platform/echarts` | 兼容镜像,供存量依赖方零改动使用 | 仅注册插件描述符(原行为) |
|
|
14
11
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## 安装
|
|
12
|
+
## 安装(插件市场口径,推荐)
|
|
18
13
|
|
|
19
14
|
```bash
|
|
20
|
-
|
|
15
|
+
npx @worm-print-platform/marketplace install echarts
|
|
21
16
|
```
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
## 十个元素
|
|
26
|
-
|
|
27
|
-
| type | 元素 | 默认尺寸 | 数据映射要点 |
|
|
28
|
-
| --- | --- | --- | --- |
|
|
29
|
-
| `barChart` | 柱状图 | 100×60mm | 类目 + 多数值字段(多值多系列) |
|
|
30
|
-
| `barHChart` | 条形图(横向) | 100×60mm | 类目写 yAxis,xAxis 为数值 |
|
|
31
|
-
| `lineChart` | 折线图 | 100×60mm | 同柱状图,series 为 line |
|
|
32
|
-
| `areaChart` | 面积图 | 100×60mm | 折线 + areaStyle |
|
|
33
|
-
| `pieChart` | 饼图 | 60×60mm | 类目 + 首数值 → `{ name, value }` |
|
|
34
|
-
| `doughnutChart` | 环形图 | 60×60mm | 饼图 + 可配内径 |
|
|
35
|
-
| `scatterChart` | 散点图 | 80×60mm | 类目作 x、首数值作 y;`chartBubble` 开启时第二数值作点大小 |
|
|
36
|
-
| `radarChart` | 雷达图 | 70×60mm | 数值字段 = 维度,每行一个系列 |
|
|
37
|
-
| `funnelChart` | 漏斗图 | 60×60mm | 类目 + 首数值,按数值降序 |
|
|
38
|
-
| `gaugeChart` | 仪表盘 | 60×60mm | 取首行首值;min/max 面板可配 |
|
|
39
|
-
|
|
40
|
-
所有元素共用同一份数据契约:`chartOption` + `chartDataSource` / `chartCategoryField` / `chartValueFields` / `chartSeriesField`。模板只存 option 模板与字段映射,真实数据由 core 绑定阶段注入。
|
|
41
|
-
|
|
42
|
-
## 用法
|
|
43
|
-
|
|
44
|
-
### 设计器 / 浏览器宿主
|
|
18
|
+
宿主按清单加载插件入口(import 即注册,无需额外调用):
|
|
45
19
|
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
import '@worm-print-platform/echarts'
|
|
20
|
+
```js
|
|
21
|
+
import '../.worm-print/plugins/echarts/dist/marketplace.js'
|
|
49
22
|
```
|
|
50
23
|
|
|
51
|
-
|
|
24
|
+
插件安装后,素材台出现「图表」分组的十张卡片:柱状图、条形图、折线图、面积图、饼图、环形图、
|
|
25
|
+
散点图、雷达图、漏斗图、仪表盘。
|
|
52
26
|
|
|
53
|
-
|
|
54
|
-
// ① 部署白名单:显式 import 才允许该插件进入注册表
|
|
55
|
-
import '@worm-print-platform/echarts/node'
|
|
27
|
+
## 作为 npm 包使用
|
|
56
28
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
createDomHostRuntime(factory, loadExecutorBundle(), collectExecutorBundles())
|
|
29
|
+
```bash
|
|
30
|
+
npm install @worm-print-platform/plugin-echarts
|
|
60
31
|
```
|
|
61
32
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
import {
|
|
68
|
-
CHART_KIND_DEFINITIONS, createDefaultChartOption, normalizeChartOption,
|
|
69
|
-
previewChartOption, renderChartToSvg,
|
|
70
|
-
} from '@worm-print-platform/echarts/kit'
|
|
71
|
-
```
|
|
33
|
+
```js
|
|
34
|
+
// 主入口:插件描述符 + 设计器 UI 一次注册完成
|
|
35
|
+
import '@worm-print-platform/plugin-echarts'
|
|
72
36
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
import { configureChartPlugin } from '@worm-print-platform/echarts'
|
|
77
|
-
|
|
78
|
-
configureChartPlugin({
|
|
79
|
-
defaultWidth: 120, // 新建图表元素的全局默认尺寸
|
|
80
|
-
defaultHeight: 70,
|
|
81
|
-
palettes: {
|
|
82
|
-
default: { label: '企业蓝', colors: ['#165DFF', '#36B37E'] },
|
|
83
|
-
brand: { label: '品牌色', colors: ['#F2704E', '#F7A35C'] },
|
|
84
|
-
},
|
|
85
|
-
sampleCategories: ['一季度', '二季度', '三季度'],
|
|
86
|
-
components: [GaugeChart], // 追加 echarts.use 的图表/组件构造器
|
|
87
|
-
})
|
|
37
|
+
// 按需子路径
|
|
38
|
+
import '@worm-print-platform/plugin-echarts/kit' // 仅框架无关插件描述符(无 UI)
|
|
39
|
+
import '@worm-print-platform/plugin-echarts/ui' // 仅设计器 UI
|
|
88
40
|
```
|
|
89
41
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
## 导出
|
|
42
|
+
服务端 PDF / Electron 静默打印使用 `@worm-print-platform/plugin-echarts/node` 与
|
|
43
|
+
`/browser/executor.iife`(页面执行器),浏览器直挂使用 `/browser` UMD 产物。
|
|
93
44
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
| `.` | `CHART_PLUGIN` / `CHART_KIND_DEFINITIONS` / `createDefaultChartOption` / `renderChartToSvg` / `configureChartPlugin` 等(注册副作用 + 纯 TS 能力) |
|
|
97
|
-
| `/kit` | 框架无关纯 TS 出口(无 Vue、无 `node:fs`) |
|
|
98
|
-
| `/node` | 注册副作用 + `render.executorBundle()`(惰性读取 IIFE 产物,服务端装配用) |
|
|
99
|
-
| `/ui` | plugin-kit 设计器 UI(静态 SVG 画布 + 原生 DOM 属性面板) |
|
|
100
|
-
| `/browser` | UMD bundle(`dist/echarts.js`) |
|
|
45
|
+
存量项目若仍依赖 `@worm-print-platform/echarts`,无需改动:兼容镜像保留全部原有子路径
|
|
46
|
+
(`.`、`/kit`、`/ui`、`/node`、`/browser`、`/browser/executor.iife`)与行为。
|
|
101
47
|
|
|
102
|
-
|
|
48
|
+
## 独立发布
|
|
103
49
|
|
|
104
|
-
|
|
50
|
+
两个包均可单独 `npm publish`,且从同一源码生成:
|
|
105
51
|
|
|
106
52
|
```bash
|
|
107
|
-
|
|
108
|
-
npm
|
|
53
|
+
cd marketplace/plugins/echarts
|
|
54
|
+
npm run build # vite + tsc + tsup + UMD + 兼容镜像同步
|
|
55
|
+
npm publish --registry=https://registry.npmjs.org --access public
|
|
56
|
+
# 根目录:npm publish -w @worm-print-platform/echarts(兼容镜像)
|
|
109
57
|
```
|
|
110
58
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
- [插件化自定义元素章节](https://github.com/worm-longliu/worm-print-platform/blob/main/README.md#插件化自定义元素)
|
|
115
|
-
- [plugin-kit 契约](../plugin-kit/README.md)
|
|
59
|
+
发版时同步 `marketplace.json`、`plugin.json`、本 `package.json` 的 `wormPrint.version`;市场 CLI
|
|
60
|
+
通过本仓 tag `plugins/echarts/vX.Y.Z` 解析稳定版本。完整收录与版本规则见
|
|
61
|
+
[docs/plugin-marketplace.md](../../../docs/plugin-marketplace.md)。
|
|
116
62
|
|
|
117
|
-
##
|
|
63
|
+
## 信任边界
|
|
118
64
|
|
|
119
|
-
|
|
65
|
+
市场不做沙箱。插件代码在宿主进程内运行,等同于普通 npm 依赖;信任来自 PR 审核与版本锁定。
|
package/dist/bind.d.ts
CHANGED
package/dist/browser-bundle.d.ts
CHANGED
package/dist/config.d.ts
CHANGED
package/dist/constants.d.ts
CHANGED
package/dist/defaults.d.ts
CHANGED
package/dist/echarts.d.ts
CHANGED