ooxml-excel-editor 1.3.3 → 1.11.0
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 +283 -0
- package/README.md +52 -11
- package/dist/chunks/index-CeTZbV_m.js +13673 -0
- package/dist/chunks/{index.es-D9BGYyEt.js → index.es-CNm6wZK8.js} +1 -1
- package/dist/chunks/{index.es-n6H_ncuE.js → index.es-DF0q70BO.js} +1 -1
- package/dist/chunks/{jspdf.es.min-B6-ocR7J.js → jspdf.es.min-65KuNx_3.js} +2 -2
- package/dist/chunks/{jspdf.es.min-Dbn0akWf.js → jspdf.es.min-Bo8KrqZO.js} +2 -2
- package/dist/chunks/plugin-overlay-C_fL02Qc.js +12128 -0
- package/dist/chunks/{toolbar-icons-fOm95ASq.js → toolbar-icons-BjwdJDiN.js} +60 -65
- package/dist/components/ExcelViewer.vue.d.ts +46 -1
- package/dist/components/FindBar.vue.d.ts +8 -0
- package/dist/core/edit/autofill.d.ts +10 -0
- package/dist/core/edit/clipboard-html.d.ts +12 -0
- package/dist/core/edit/clipboard-snapshot.d.ts +76 -0
- package/dist/core/edit/commands.d.ts +9 -1
- package/dist/core/edit/context-menu.d.ts +14 -1
- package/dist/core/edit/data-validation.d.ts +15 -0
- package/dist/core/edit/edit-controller.d.ts +33 -2
- package/dist/core/edit/editor-context.d.ts +5 -2
- package/dist/core/edit/paste-behavior.d.ts +33 -0
- package/dist/core/edit/types.d.ts +26 -0
- package/dist/core/export/exporter.d.ts +2 -0
- package/dist/core/export/pivot-tables.d.ts +17 -0
- package/dist/core/export/xlsx-writer.d.ts +6 -0
- package/dist/core/index.d.ts +4 -2
- package/dist/core/model/mutations.d.ts +4 -0
- package/dist/core/model/types.d.ts +113 -2
- package/dist/core/parser/pivot-parser.d.ts +3 -0
- package/dist/core/plugin.d.ts +69 -5
- package/dist/core/render/canvas-renderer.d.ts +28 -0
- package/dist/core/render/pivot-toggle.d.ts +13 -0
- package/dist/core/viewer/comment-dialog-host.d.ts +16 -0
- package/dist/core/viewer/conditional-format-dialog-host.d.ts +30 -0
- package/dist/core/viewer/controller.d.ts +140 -8
- package/dist/core/viewer/number-format-dialog-host.d.ts +25 -0
- package/dist/core/viewer/overlay-manager.d.ts +1 -0
- package/dist/core/viewer/paste-config-host.d.ts +12 -0
- package/dist/core/viewer/pivot-dialog-host.d.ts +48 -0
- package/dist/core/viewer/readonly-prompt-host.d.ts +23 -0
- package/dist/core/viewer/validation-prompt-host.d.ts +25 -0
- package/dist/core.js +67 -64
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1110 -925
- package/dist/react/ExcelViewer.d.ts +41 -4
- package/dist/react.js +835 -628
- package/dist/style.css +1 -1
- package/dist/vue2.css +1 -1
- package/dist/vue2.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/index-6q8kSGQg.js +0 -10575
- package/dist/chunks/plugin-overlay-BUrPrpT2.js +0 -9146
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { CellModel, CellStyleFn, CellStyleOverride, ImageAnchor, MergeRange, TransformModelFn, WorkbookModel } from '../core/model/types';
|
|
3
3
|
import { EditableTarget } from '../core/edit/types';
|
|
4
|
+
import { PasteBehavior } from '../core/edit/paste-behavior';
|
|
4
5
|
import { FormulaEngineFactory } from '../core/formula/engine';
|
|
5
6
|
import { CellChangePayload, DimChangePayload, DirtyChangePayload, ImageChangePayload, StructChangePayload } from '../core/edit/edit-controller';
|
|
6
7
|
import { CellSnapshot } from '../core/model/snapshot';
|
|
@@ -14,7 +15,7 @@ import { ExcelSource } from '../core/loader';
|
|
|
14
15
|
import { ImageExportOptions, PdfExportOptions, PrintOptions } from '../core/export';
|
|
15
16
|
import { XlsxExportOptions } from '../core/export/xlsx-writer';
|
|
16
17
|
import { Cell } from '../core/viewer/controller';
|
|
17
|
-
import { ContextMenuBeforePayload, ContextMenuShowPayload, ContextMenuTransform, ExcelPlugin, MenuItem, PermissionDeniedPayload } from '../core/plugin';
|
|
18
|
+
import { ContextMenuBeforePayload, ContextMenuShowPayload, ContextMenuTransform, ExcelPlugin, MenuItem, PermissionDeniedPayload, ViewerApi } from '../core/plugin';
|
|
18
19
|
export interface ExcelViewerProps {
|
|
19
20
|
src?: ExcelSource;
|
|
20
21
|
/**
|
|
@@ -72,6 +73,17 @@ export interface ExcelViewerProps {
|
|
|
72
73
|
plugins?: ExcelPlugin[];
|
|
73
74
|
/** 编辑总开关:默认 false = 只读(行为不变)。开启后才能进入编辑(E0:闸门) */
|
|
74
75
|
editable?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* 透视表功能开关:默认 false = 关闭。开启后(还需 `editable`)工具栏 `pivot-table` 入口可见、
|
|
78
|
+
* `createPivotTable`/`openPivotTableDialog` 等 API 生效、导出 .xlsx 回注真实 OOXML 透视表零件
|
|
79
|
+
* (overlay 模式同时保留原文件透视表)。
|
|
80
|
+
*/
|
|
81
|
+
pivotTable?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 条件格式编辑开关:默认 false = 关闭(只读渲染)。开启后(还需 `editable`)工具栏 `conditional-format`
|
|
84
|
+
* 入口可见、`openConditionalFormatDialog`/`addConditionalRule` 等 API 生效、导出 .xlsx 回写条件格式。
|
|
85
|
+
*/
|
|
86
|
+
conditionalFormat?: boolean;
|
|
75
87
|
/** 按格只读判定:返回 true = 只读(cell 为空格时传 null) */
|
|
76
88
|
cellReadOnly?: (cell: CellModel | null, pos: {
|
|
77
89
|
row: number;
|
|
@@ -102,12 +114,16 @@ export interface ExcelViewerProps {
|
|
|
102
114
|
recalc?: boolean;
|
|
103
115
|
/** 自定义/自研公式引擎工厂(可换引擎);不给则用默认 HyperFormula(需 npm i hyperformula) */
|
|
104
116
|
formulaEngine?: FormulaEngineFactory;
|
|
117
|
+
/** 粘贴行为(默认 = 覆盖式 1:1)。控制 Ctrl+V / 右键粘贴时源各方面如何落目标;也可 viewer.setPasteBehavior 运行时改 */
|
|
118
|
+
pasteBehavior?: Partial<PasteBehavior>;
|
|
119
|
+
/** 粘贴撞只读格的内置提醒:'dialog'(默认,弹窗列出哪些格只读)/ 'toast'(气泡)/ 'none'(只发事件) */
|
|
120
|
+
readOnlyPrompt?: 'dialog' | 'toast' | 'none';
|
|
105
121
|
/**
|
|
106
122
|
* 操作工具栏配置 (跟 Vue 3/Vue 2 同 API):
|
|
107
|
-
* - `true`/不传(默认):
|
|
123
|
+
* - `true`/不传(默认): 显示默认三项 ['find', 'filter', 'sort']
|
|
108
124
|
* - `false`: 隐藏整条工具栏
|
|
109
125
|
* - 数组: 显式控制项与顺序 (内置 id 或自定义 ToolbarItem)
|
|
110
|
-
* - 内置 id: find / filter / clear-filter / copy / wrap-text / template / image-tools /
|
|
126
|
+
* - 内置 id: find / filter / sort / clear-filter / copy / wrap-text / template / image-tools /
|
|
111
127
|
* freeze / export / zoom / 'separator' (或 '|')
|
|
112
128
|
*/
|
|
113
129
|
toolbar?: boolean | Array<string | import('../core/plugin').ToolbarItem>;
|
|
@@ -160,6 +176,9 @@ export interface ExcelViewerHandle {
|
|
|
160
176
|
setActiveSheet: (i: number) => void;
|
|
161
177
|
getSelection: () => MergeRange | null;
|
|
162
178
|
setSelection: (range: MergeRange) => void;
|
|
179
|
+
scrollToCell: (row: number, col: number, opts?: {
|
|
180
|
+
select?: boolean;
|
|
181
|
+
}) => boolean;
|
|
163
182
|
rectOf: (row: number, col: number) => {
|
|
164
183
|
x: number;
|
|
165
184
|
y: number;
|
|
@@ -176,6 +195,21 @@ export interface ExcelViewerHandle {
|
|
|
176
195
|
isCellEditable: (row: number, col: number) => boolean;
|
|
177
196
|
setEditableTargets: (targets: EditableTarget | EditableTarget[] | undefined) => void;
|
|
178
197
|
getEditableTargets: () => EditableTarget | EditableTarget[] | undefined;
|
|
198
|
+
sortActiveColumn: (dir: 'asc' | 'desc') => boolean;
|
|
199
|
+
createPivotTable: ViewerApi['createPivotTable'];
|
|
200
|
+
createPivotTableFromSelection: ViewerApi['createPivotTableFromSelection'];
|
|
201
|
+
openPivotTableDialog: ViewerApi['openPivotTableDialog'];
|
|
202
|
+
getConditionalRules: ViewerApi['getConditionalRules'];
|
|
203
|
+
addConditionalRule: ViewerApi['addConditionalRule'];
|
|
204
|
+
updateConditionalRule: ViewerApi['updateConditionalRule'];
|
|
205
|
+
removeConditionalRule: ViewerApi['removeConditionalRule'];
|
|
206
|
+
setConditionalRules: ViewerApi['setConditionalRules'];
|
|
207
|
+
openConditionalFormatDialog: ViewerApi['openConditionalFormatDialog'];
|
|
208
|
+
setSelectionNumberFormat: ViewerApi['setSelectionNumberFormat'];
|
|
209
|
+
openNumberFormatDialog: ViewerApi['openNumberFormatDialog'];
|
|
210
|
+
getCellComment: ViewerApi['getCellComment'];
|
|
211
|
+
setCellComment: ViewerApi['setCellComment'];
|
|
212
|
+
openCommentEditor: ViewerApi['openCommentEditor'];
|
|
179
213
|
editCell: (row: number, col: number, value: CellValue) => boolean;
|
|
180
214
|
editRange: (range: MergeRange, values: CellValue[][]) => boolean;
|
|
181
215
|
clearRange: (range: MergeRange) => boolean;
|
|
@@ -195,7 +229,10 @@ export interface ExcelViewerHandle {
|
|
|
195
229
|
pasteRichHtml: (html: string, at?: {
|
|
196
230
|
row: number;
|
|
197
231
|
col: number;
|
|
198
|
-
}) => boolean;
|
|
232
|
+
}, behaviorOverride?: Partial<PasteBehavior> | null) => boolean;
|
|
233
|
+
getPasteBehavior: () => PasteBehavior;
|
|
234
|
+
setPasteBehavior: (cfg: Partial<PasteBehavior> | null) => void;
|
|
235
|
+
openPasteConfigDialog: () => boolean;
|
|
199
236
|
pasteImageBlob: (blob: Blob, at?: {
|
|
200
237
|
row: number;
|
|
201
238
|
col: number;
|