ooxml-excel-editor 1.3.0 → 1.3.1

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/CHANGELOG.md CHANGED
@@ -2,13 +2,42 @@
2
2
 
3
3
  本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 与 [语义化版本](https://semver.org/lang/zh-CN/)。
4
4
 
5
+ ## [1.3.1] - 2026-06-08
6
+
7
+ **Vue 2 子入口扩展兼容到 Vue 2.6.x** — 通过 `@vue/composition-api` package 让一份代码同时支持 Vue 2.6 + 2.7+. 1.3.0 只支持 2.7+ (内置 Composition API), 此版本不破坏 2.7 用户用法.
8
+
9
+ ### 新增
10
+
11
+ - **Vue 2.6.x 支持**: peerDeps `vue` 从 `^2.7.0 || ^3.4.0` 扩到 `^2.6.0 || ^2.7.0 || ^3.4.0`
12
+ - **`@vue/composition-api` 加入 peerDependencies** (optional peer): Vue 2.6 用户必装 + `Vue.use(VueCompositionAPI)`;Vue 2.7+ 用户也装 (它自检测内置 API,plugin 是 noop,无需 Vue.use)
13
+
14
+ ### 实现
15
+
16
+ - Vue 2 壳代码 (`src/vue2/ExcelViewer.ts` + `use-excel-document.ts`) 的 Composition API import 从 `'vue2'` 改成 `'@vue/composition-api'` (一份代码同时支持 2.6 plugin / 2.7 内置)
17
+ - `vite.config.ts` dev alias `@vue/composition-api` → `vue@2.7 dist`(dev 时拿 2.7 内置), build external (消费者自己解析)
18
+ - docs/Vue2.md 加 Vue 2.6 vs 2.7 安装步骤对比 + 解释为什么要装 `@vue/composition-api`
19
+
20
+ ### 升级提示 (从 1.3.0 升 1.3.1)
21
+
22
+ **Vue 2 用户**: 必须额外装 `@vue/composition-api`. 1.3.0 装的用户升级时 `npm install` 会提示缺失 peer, 跟着装即可:
23
+
24
+ ```bash
25
+ npm i @vue/composition-api
26
+ # Vue 2.6.x 还需 main.js: Vue.use(require('@vue/composition-api').default)
27
+ # Vue 2.7+ 不需要 Vue.use (plugin 自动 noop)
28
+ ```
29
+
30
+ Vue 3 / React 用户**无变化**.
31
+
32
+ ---
33
+
5
34
  ## [1.3.0] - 2026-06-08
6
35
 
7
- **Vue 2 兼容子入口 + 三壳 UI 1:1 复刻 + 独立 dev scripts** — Vue 2.7+ / Vue 3 / React 三个壳视觉与交互完全一致 (Vue 3 SFC 是参考实现 Standard, Vue 2 / React 1:1 复刻).
36
+ **Vue 2 兼容子入口 + 三壳 UI 1:1 复刻 + 独立 dev scripts** — Vue 2.6 / 2.7+ / Vue 3 / React 三个壳视觉与交互完全一致 (Vue 3 SFC 是参考实现 Standard, Vue 2 / React 1:1 复刻).
8
37
 
9
38
  ### 新增
10
39
 
11
- - **`ooxml-excel-editor/vue2` 子入口** (`src/vue2/ExcelViewer.ts`, ~1000 行 render function 版): Vue 2.7+ 兼容壳, 跟 Vue 3 壳 1:1 功能对齐
40
+ - **`ooxml-excel-editor/vue2` 子入口** (`src/vue2/ExcelViewer.ts`, ~1000 行 render function 版): **Vue 2.6.x + 2.7+** 兼容壳, 跟 Vue 3 壳 1:1 功能对齐. 通过 `@vue/composition-api` package 同时支持 2.6 (装 plugin + `Vue.use`) 和 2.7+ (plugin 自检测 + noop)
12
41
  - 全部 28 项 props (src / workbook / jsonOptions / templateFile / fileName / theme / cellStyle / cellImageFit / imageLightbox / openLinks / plugins / toolbar / editable / cellReadOnly / readOnlyRanges / editableTargets / strictDimensions / readOnlyCellStyle / editor / recalc / formulaEngine / contextMenu / exportProgress / transformModel / templateName)
13
42
  - 全部 15+ events 跟 Vue 3 同名 (rendered / error / progress / cell-click / cell-dblclick / selection-change / sheet-change / hyperlink-click / cell-change / edit-start / edit-commit / dim-change / dirty-change / image-change / struct-change / permission-denied / before-context-menu / context-menu)
14
43
  - 完整命令式 API (80+ 方法) 跟 Vue 3 `viewerApi` / React `ExcelViewerHandle` 对齐
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  ```bash
12
12
  npm i ooxml-excel-editor vue exceljs # Vue 3 (默认入口)
13
13
  npm i ooxml-excel-editor react react-dom exceljs # React 壳 (/react 子入口)
14
- npm i ooxml-excel-editor vue@2.7 exceljs # Vue 2.7+ (/vue2 子入口, 1.3.0+)
14
+ npm i ooxml-excel-editor vue@2.7 @vue/composition-api exceljs # Vue 2.6/2.7+ (/vue2 子入口, 1.3.0+)
15
15
  ```
16
16
 
17
17
  **用**(Vue,容器要给高度;`src` 可传 `File` / `Blob` / `ArrayBuffer` / `Uint8Array` / URL 字符串):
@@ -65,8 +65,9 @@ npm i ooxml-excel-editor vue exceljs
65
65
  # React 项目
66
66
  npm i ooxml-excel-editor react react-dom exceljs
67
67
 
68
- # Vue 2.7+ 项目 (1.3.0+)
69
- npm i ooxml-excel-editor vue@2.7 exceljs
68
+ # Vue 2.6.x 或 2.7+ 项目 (1.3.0+) — 必装 @vue/composition-api (兼容 2.6 + 2.7)
69
+ npm i ooxml-excel-editor vue@2.7 @vue/composition-api exceljs
70
+ # Vue 2.6.x 还需 main.js: Vue.use(require('@vue/composition-api').default)
70
71
 
71
72
  # 只解析 / 读数据 / 导出(不渲染 UI)
72
73
  npm i ooxml-excel-editor exceljs
@@ -83,7 +84,7 @@ npm i hyperformula
83
84
  |---|---|---|---|
84
85
  | `ooxml-excel-editor` | **Vue 3** 组件 `<ExcelViewer>` (参考实现 Standard) | `vue@3` + `exceljs` | ~19 KB + 共享 chunks |
85
86
  | `ooxml-excel-editor/react` | **React** 组件 `<ExcelViewer>` (1:1 复刻 Vue 3) | `react` + `react-dom` + `exceljs` | ~11 KB + 共享 chunks |
86
- | `ooxml-excel-editor/vue2` | **Vue 2.7+** 组件 `<ExcelViewer>` (1:1 复刻 Vue 3) | `vue@2.7` + `exceljs` | ~124 KB (内嵌 core) |
87
+ | `ooxml-excel-editor/vue2` | **Vue 2.6 / 2.7+** 组件 `<ExcelViewer>` (1:1 复刻 Vue 3) | `vue@2.6+` + `@vue/composition-api` + `exceljs` | ~124 KB (内嵌 core) |
87
88
  | `ooxml-excel-editor/core` | 框架无关引擎(解析/渲染/控制器/导出/读数据) | `exceljs` | ~1 KB + 共享 chunks |
88
89
 
89
90
  `exceljs` 必需;`vue` / `react` / `vue@2` 按框架三选一(均为可选 peer);`echarts` / `jspdf` / `hyperformula` 为**可选** peer —— 未装分别只影响"图表渲染""PDF 导出""公式重算",其余正常,且**绝不打包进你的产物**(运行时才动态加载)。
package/dist/vue2.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var hs = Object.defineProperty;
2
2
  var us = (n, e, t) => e in n ? hs(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var z = (n, e, t) => us(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { ref as Q, defineComponent as ds, reactive as gs, computed as ne, shallowRef as ms, onMounted as ps, watch as re, nextTick as Pt, onBeforeUnmount as ws, h as O } from "vue";
4
+ import { ref as Q, defineComponent as ds, reactive as gs, computed as ne, shallowRef as ms, onMounted as ps, watch as re, nextTick as Pt, onBeforeUnmount as ws, h as O } from "@vue/composition-api";
5
5
  const vs = {
6
6
  // 放大镜
7
7
  find: '<circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/>',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-excel-editor",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "High-fidelity OOXML (.xlsx) preview & editor — canvas renderer, framework-agnostic core with Vue 3, Vue 2 and React shells (1:1 UI across all shells). Read-only by default; opt-in editing with undo/redo, formula recalc, and export back to .xlsx/JSON/CSV.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -71,15 +71,19 @@
71
71
  "prepublishOnly": "npm run build"
72
72
  },
73
73
  "peerDependencies": {
74
+ "@vue/composition-api": "^1.7.0",
74
75
  "echarts": "^5.5.0",
75
76
  "exceljs": "^4.4.0",
76
77
  "hyperformula": "^3.0.0",
77
78
  "jspdf": "^2.5.0 || ^3.0.0 || ^4.0.0",
78
79
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
79
80
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
80
- "vue": "^2.7.0 || ^3.4.0"
81
+ "vue": "^2.6.0 || ^2.7.0 || ^3.4.0"
81
82
  },
82
83
  "peerDependenciesMeta": {
84
+ "@vue/composition-api": {
85
+ "optional": true
86
+ },
83
87
  "echarts": {
84
88
  "optional": true
85
89
  },
@@ -111,6 +115,7 @@
111
115
  "@vitejs/plugin-react": "^4.7.0",
112
116
  "@vitejs/plugin-vue": "^5.2.1",
113
117
  "@vitejs/plugin-vue2": "^2.3.4",
118
+ "@vue/composition-api": "^1.7.2",
114
119
  "echarts": "^5.5.1",
115
120
  "exceljs": "^4.4.0",
116
121
  "hyperformula": "^3.3.0",