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.
Files changed (51) hide show
  1. package/CHANGELOG.md +283 -0
  2. package/README.md +52 -11
  3. package/dist/chunks/index-CeTZbV_m.js +13673 -0
  4. package/dist/chunks/{index.es-D9BGYyEt.js → index.es-CNm6wZK8.js} +1 -1
  5. package/dist/chunks/{index.es-n6H_ncuE.js → index.es-DF0q70BO.js} +1 -1
  6. package/dist/chunks/{jspdf.es.min-B6-ocR7J.js → jspdf.es.min-65KuNx_3.js} +2 -2
  7. package/dist/chunks/{jspdf.es.min-Dbn0akWf.js → jspdf.es.min-Bo8KrqZO.js} +2 -2
  8. package/dist/chunks/plugin-overlay-C_fL02Qc.js +12128 -0
  9. package/dist/chunks/{toolbar-icons-fOm95ASq.js → toolbar-icons-BjwdJDiN.js} +60 -65
  10. package/dist/components/ExcelViewer.vue.d.ts +46 -1
  11. package/dist/components/FindBar.vue.d.ts +8 -0
  12. package/dist/core/edit/autofill.d.ts +10 -0
  13. package/dist/core/edit/clipboard-html.d.ts +12 -0
  14. package/dist/core/edit/clipboard-snapshot.d.ts +76 -0
  15. package/dist/core/edit/commands.d.ts +9 -1
  16. package/dist/core/edit/context-menu.d.ts +14 -1
  17. package/dist/core/edit/data-validation.d.ts +15 -0
  18. package/dist/core/edit/edit-controller.d.ts +33 -2
  19. package/dist/core/edit/editor-context.d.ts +5 -2
  20. package/dist/core/edit/paste-behavior.d.ts +33 -0
  21. package/dist/core/edit/types.d.ts +26 -0
  22. package/dist/core/export/exporter.d.ts +2 -0
  23. package/dist/core/export/pivot-tables.d.ts +17 -0
  24. package/dist/core/export/xlsx-writer.d.ts +6 -0
  25. package/dist/core/index.d.ts +4 -2
  26. package/dist/core/model/mutations.d.ts +4 -0
  27. package/dist/core/model/types.d.ts +113 -2
  28. package/dist/core/parser/pivot-parser.d.ts +3 -0
  29. package/dist/core/plugin.d.ts +69 -5
  30. package/dist/core/render/canvas-renderer.d.ts +28 -0
  31. package/dist/core/render/pivot-toggle.d.ts +13 -0
  32. package/dist/core/viewer/comment-dialog-host.d.ts +16 -0
  33. package/dist/core/viewer/conditional-format-dialog-host.d.ts +30 -0
  34. package/dist/core/viewer/controller.d.ts +140 -8
  35. package/dist/core/viewer/number-format-dialog-host.d.ts +25 -0
  36. package/dist/core/viewer/overlay-manager.d.ts +1 -0
  37. package/dist/core/viewer/paste-config-host.d.ts +12 -0
  38. package/dist/core/viewer/pivot-dialog-host.d.ts +48 -0
  39. package/dist/core/viewer/readonly-prompt-host.d.ts +23 -0
  40. package/dist/core/viewer/validation-prompt-host.d.ts +25 -0
  41. package/dist/core.js +67 -64
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.js +1110 -925
  44. package/dist/react/ExcelViewer.d.ts +41 -4
  45. package/dist/react.js +835 -628
  46. package/dist/style.css +1 -1
  47. package/dist/vue2.css +1 -1
  48. package/dist/vue2.js +1 -1
  49. package/package.json +1 -1
  50. package/dist/chunks/index-6q8kSGQg.js +0 -10575
  51. package/dist/chunks/plugin-overlay-BUrPrpT2.js +0 -9146
@@ -1,15 +1,18 @@
1
- import { CellModel, CellStyleOverride, ImageAnchor, MergeRange, SheetModel, WorkbookModel } from '../model/types';
1
+ import { CellModel, CellStyleOverride, ConditionalRule, ImageAnchor, MergeRange, SheetModel, WorkbookModel } from '../model/types';
2
2
  import { EditConfig } from '../edit/types';
3
3
  import { EditController, EditEventName } from '../edit/edit-controller';
4
4
  import { CellValue, SheetToJSONOptions } from '../model/data-access';
5
5
  import { CellSnapshot } from '../model/snapshot';
6
6
  import { CellInspection } from '../model/inspect';
7
7
  import { MenuItem } from '../edit/context-menu';
8
+ import { PivotOutputChoice } from './pivot-dialog-host';
9
+ import { PasteBehavior } from '../edit/paste-behavior';
8
10
  import { EditorCommitValue, EditorResolver } from '../edit/editor-context';
9
11
  import { CanvasRenderer, CellImageFit, RendererOptions, ViewState } from '../render/canvas-renderer';
10
12
  import { OverlayQuads } from './overlay-manager';
11
13
  import { ImageExportOptions, PdfExportOptions, PrintOptions } from '../export/types';
12
14
  import { XlsxExportOptions } from '../export/xlsx-writer';
15
+ import { CreatePivotTableOptions } from '../plugin';
13
16
  export type Cell = {
14
17
  row: number;
15
18
  col: number;
@@ -27,6 +30,8 @@ export interface FindState {
27
30
  wholeCell: boolean;
28
31
  count: number;
29
32
  index: number;
33
+ /** 替换文本(1.11.0;替换功能需 editable) */
34
+ replace: string;
30
35
  }
31
36
  /** 自动筛选下拉浮层(列去重值 + 已选 + 屏幕位置) */
32
37
  export interface FilterPopupState {
@@ -70,6 +75,8 @@ export interface ViewerControllerHooks {
70
75
  onFindChange: () => void;
71
76
  /** 筛选状态/浮层变化(壳据此 +1 让 FilterPopup / 工具栏重算) */
72
77
  onFilterChange: () => void;
78
+ /** core 里新增/切换工作表时通知壳同步 activeSheet。 */
79
+ onActiveSheetChange?: (index: number) => void;
73
80
  /** 编辑事件(cell-change/edit-start/edit-commit;壳转 emit + 插件派发) */
74
81
  onEditEvent: (event: EditEventName, payload: unknown) => void;
75
82
  /** 右键菜单触发前(Plan C):用户可调 `preventDefault()` 阻止内置菜单弹出(然后自渲染) */
@@ -123,6 +130,20 @@ export declare class ViewerController {
123
130
  /** 右键上下文菜单宿主(G3;body 级 DOM,框架无关) */
124
131
  private menuHost;
125
132
  private lightbox;
133
+ private pivotDialog;
134
+ private pivotPanel;
135
+ private pasteConfigDialog;
136
+ private readonlyPrompt;
137
+ private validationPrompt;
138
+ private cfDialog;
139
+ private numFmtDialog;
140
+ private commentDialog;
141
+ /** 当前输入提示气泡的签名(格+位置),变了才重建,避免每帧 render 抖动 */
142
+ private bubbleSig;
143
+ /** 用户新建条件格式规则的自增序号(派 id `cf-u<n>`,只增不减,session 内唯一) */
144
+ private cfSeq;
145
+ /** 透视表"活刷新"重入兜底:recompute 内部 setCellValue 不再触发 onModelChange,此旗保险。 */
146
+ private pivotRefreshing;
126
147
  private lightboxEnabled;
127
148
  /** 用户的右键菜单 transform 回调(Plan C):`(ctx, items) => MenuItem[] | undefined` */
128
149
  private ctxMenuTransform;
@@ -135,6 +156,10 @@ export declare class ViewerController {
135
156
  private selActive;
136
157
  private selMode;
137
158
  private dragMode;
159
+ /** 自动填充(1.10.0):拖拽起点的源选区 + 当前目标范围 + 方向 */
160
+ private fillBase;
161
+ private fillRange;
162
+ private fillDir;
138
163
  private resizeTarget;
139
164
  private imageDragIdx;
140
165
  private imageDragStartRect;
@@ -147,6 +172,7 @@ export declare class ViewerController {
147
172
  private dragMoved;
148
173
  private dragStartXY;
149
174
  private findQuery;
175
+ private findReplace;
150
176
  private findMatchCase;
151
177
  private findWholeCell;
152
178
  private findHits;
@@ -163,6 +189,8 @@ export declare class ViewerController {
163
189
  private editorHost;
164
190
  /** 按格解析编辑器(壳合并 plugin.editor + prop.editor 后注入;E2) */
165
191
  private editorResolver?;
192
+ /** paste 事件处理器(绑在 scroller 上;Ctrl+V 走它拿**原始**剪贴板 HTML,避开 clipboard.read() 的净化) */
193
+ private readonly onPasteHandler;
166
194
  constructor(els: ViewerControllerEls, hooks: ViewerControllerHooks);
167
195
  /** 切表/换簿/主题变化: 清状态,重建渲染器,重置滚动,量尺寸,建叠加层,绘制,按需重跑查找 */
168
196
  rebuild(sheet: SheetModel, workbook: WorkbookModel, zoom: number, opts: RendererOptions): void;
@@ -265,6 +293,10 @@ export declare class ViewerController {
265
293
  selectAll(): void;
266
294
  /** 选中单个单元格并滚动到视图(查找定位用);range 模式,anchor=active */
267
295
  selectCell(row: number, col: number): void;
296
+ /** 滚动到指定单元格;select=true 时同步选中目标格。 */
297
+ scrollToCell(row: number, col: number, opts?: {
298
+ select?: boolean;
299
+ }): boolean;
268
300
  /** 命令式设选区(anchor=左上, active=右下) */
269
301
  setSelectionRange(range: MergeRange): void;
270
302
  private setCell;
@@ -277,6 +309,10 @@ export declare class ViewerController {
277
309
  onMouseDown(e: MouseEvent): void;
278
310
  onMouseMove(e: MouseEvent): void;
279
311
  onMouseUp(e: MouseEvent): void;
312
+ /** 拖拽填充柄时:按鼠标位置算目标范围(主轴 = 偏移更大的方向),设预览。 */
313
+ private updateFillPreview;
314
+ /** 松手:用源选区接续序列填进新增格(整体单次撤销),并把选区扩到合并范围。ctrl 翻转复制↔序列。 */
315
+ private applyFill;
280
316
  /** 命中最上层浮动图(editable;p 为 render-area 坐标含表头);返回 index 或 -1。 */
281
317
  private imageHitAt;
282
318
  /** 拖拽起始:editable 时捕获 baseline + 起始维度信息(供 undo / dim-change)。 */
@@ -296,7 +332,8 @@ export declare class ViewerController {
296
332
  onContextMenu(e: MouseEvent): void;
297
333
  /** 算右键 ctx:命中格 + 选区调整;非内容区 / 无 renderer 返 null */
298
334
  private buildContextMenuCtx;
299
- /** 编辑模式下的内置菜单项(独立提取,便于 transform 回调拿到再二次加工) */
335
+ /** 内置右键菜单项(独立提取,便于 transform 回调拿到再二次加工)
336
+ * 只读模式:只返回**不改数据**的项(复制) —— 复制不修改数据源,只读也该能用;编辑模式给全套。 */
300
337
  buildBuiltinContextMenuItems(ctx: ContextMenuCtx): MenuItem[];
301
338
  /** 设置用户 transform 回调(`(ctx, items) => MenuItem[] | undefined`);壳侧调用 */
302
339
  setContextMenuTransform(fn: ContextMenuTransform | null | undefined): void;
@@ -309,13 +346,26 @@ export declare class ViewerController {
309
346
  private pageRows;
310
347
  onKeyDown(e: KeyboardEvent): void;
311
348
  private scrollActiveIntoView;
349
+ private scrollCellIntoView;
312
350
  copySelection(): Promise<void>;
313
351
  /**
314
- * 从系统剪贴板粘贴。优先 `clipboard.read()` **text/html**(Excel/WPS 复制 → 富粘贴:值+字体+颜色+
315
- * 填充+边框+合并),否则单张图片 落格,再否则回退 **text/plain** TSV(`pasteText`)。需读权限/安全上下文,
316
- * 受限时回退 readText;都失败返 false。
352
+ * paste 事件粘贴(Ctrl+V 主路径,绑在 scroller 上)。`e.clipboardData` 给的是**原始未净化** HTML/图片/文本 ——
353
+ * 关键:`navigator.clipboard.read()`(pasteFromClipboard 用)会净化 HTML、删掉 `<style>` 块和注释,而 WPS/Excel
354
+ * 的格式(CSS 类)、数字格式(mso-number-format)、内嵌图(VML o:gfxdata)全在那里面 → 走 read 必丢。paste 事件不净化。
355
+ * 我们自己复制的快照(data-ooxml-clip)也一并原样拿到,1:1 不受影响。
356
+ */
357
+ /**
358
+ * 统一出口(核心层唯一只读反馈点):**任何**改数据的操作撞只读 → EditController/控制器都经 `host.emit` 走到这里,
359
+ * 按 `readOnlyPrompt` 配置(dialog/toast/none)弹一次内置提醒,再转壳事件。新增输入方式只要照常走 EditController
360
+ * 的 API(其内 `isEditable` 中央闸门已逐格拦截 + emit permission-denied),无需各自重写只读检查/提醒。
361
+ */
362
+ private emitEditEvent;
363
+ onPaste(e: ClipboardEvent): void;
364
+ /**
365
+ * 从系统剪贴板粘贴(右键菜单"粘贴"等无 paste 事件的入口用)。`clipboard.read()` 拿 text/html —— 注意它会**净化**
366
+ * HTML(删 `<style>`/注释),所以从 WPS/Excel 粘的格式不如 Ctrl+V(走 onPaste 的原始 HTML)全。否则单图 / TSV 兜底。
317
367
  */
318
- pasteFromClipboard(): Promise<boolean>;
368
+ pasteFromClipboard(behaviorOverride?: Partial<PasteBehavior> | null): Promise<boolean>;
319
369
  /**
320
370
  * 解析 Excel/WPS 复制的剪贴板 HTML(text/html)→ 富粘贴:值 + 字体/颜色/填充/边框/对齐 + 合并 + data-uri 图,
321
371
  * **整体单次撤销**。无 `<table>` 返 false(调用方回退 TSV)。at 缺省用活动格。
@@ -323,7 +373,13 @@ export declare class ViewerController {
323
373
  pasteRichHtml(html: string, at?: {
324
374
  row: number;
325
375
  col: number;
326
- }): boolean;
376
+ }, behaviorOverride?: Partial<PasteBehavior> | null): boolean;
377
+ /** 读当前粘贴行为配置(完整)。 */
378
+ getPasteBehavior(): PasteBehavior;
379
+ /** 设粘贴行为默认(缺项回落默认);影响 Ctrl+V / 右键「粘贴」。右键「选择性粘贴」逐次预设走 pasteRichHtml 的第 3 参。 */
380
+ setPasteBehavior(cfg: Partial<PasteBehavior> | null): void;
381
+ /** 打开「粘贴行为配置」面板(框架无关 DOM,三壳共用);应用即 setPasteBehavior。需 editable。 */
382
+ openPasteConfigDialog(): boolean;
327
383
  /** 把一张图片 blob 落到活动格(转内嵌图);剪贴板单图粘贴 / 拖文件进网格用。 */
328
384
  pasteImageBlob(blob: Blob, at?: {
329
385
  row: number;
@@ -350,6 +406,13 @@ export declare class ViewerController {
350
406
  findPrev(): void;
351
407
  /** 关闭查找: 清 query + 命中(保留 matchCase/wholeCell 选项),清除高亮 */
352
408
  clearFind(): void;
409
+ setFindReplace(text: string): void;
410
+ /** 按当前查找选项把字符串里的命中换掉;无命中返 null。 */
411
+ private replaceInString;
412
+ /** 替换当前命中格(替换后重算命中并定位下一个);返回是否替换了。 */
413
+ replaceCurrent(): boolean;
414
+ /** 全部替换;返回替换的格数(整体单次撤销)。 */
415
+ replaceAll(): number;
353
416
  /** 当前是否有列处于筛选中(工具栏「清除筛选」启用判断) */
354
417
  hasFilters(): boolean;
355
418
  /** 当前筛选浮层(壳渲染 FilterPopup) */
@@ -361,6 +424,16 @@ export declare class ViewerController {
361
424
  /** 重算筛选导致的隐藏行并应用到模型(行隐藏机制 → 几何归零) */
362
425
  private applyFilters;
363
426
  /** 点中下拉按钮 / 命令式: 打开某列筛选浮层(算去重值 + 已选 + 屏幕位置) */
427
+ /** 列表型数据验证下拉:在箭头处弹可选值菜单(复用右键菜单宿主),点选 → editCell(undo 可回退)。 */
428
+ private openDataValidationPicker;
429
+ /**
430
+ * 数据验证拦截:提交某值前校验。返回 true=放行(可写入),false=拦截(stop,不写入)。
431
+ * stop → 弹模态拒绝;warning/information → 弹 toast 但放行;公式串(=开头)不拦(结果未知,交引擎)。
432
+ */
433
+ private passValidation;
434
+ /** 选中带"输入提示"的数据验证格时,在格旁弹黄色气泡;否则隐藏。render() 末尾调用(随滚动跟手)。 */
435
+ private updateValidationBubble;
436
+ private hideValidationBubble;
364
437
  openFilterPopup(col: number): void;
365
438
  closeFilterPopup(): void;
366
439
  /** 浮层「确定」: 勾选值落筛选态(全选=取消该列;子集=保留;空集=全隐藏)。 */
@@ -383,6 +456,55 @@ export declare class ViewerController {
383
456
  col: number;
384
457
  dir: 'asc' | 'desc' | null;
385
458
  };
459
+ /** 按活动单元格所在列排序;若当前表未开启自动筛选,先按选区/已用区建立筛选范围。 */
460
+ sortActiveColumn(dir: 'asc' | 'desc'): boolean;
461
+ /** 当前表的条件格式规则集(只读副本)。 */
462
+ getConditionalRules(): ConditionalRule[];
463
+ /** 新增一条规则;未给 id 自动派 `cf-u<n>`、origin 默认 'user'。返回新 id 或 false。 */
464
+ addConditionalRule(rule: Partial<ConditionalRule> & Pick<ConditionalRule, 'ranges' | 'type'>): string | false;
465
+ /** 按 id 改一条规则(浅合并 patch);编辑 parsed 规则会改其 raw 中的可视字段(色/名)以留住阈值。 */
466
+ updateConditionalRule(id: string, patch: Partial<ConditionalRule>): boolean;
467
+ /** 按 id 删一条规则。 */
468
+ removeConditionalRule(id: string): boolean;
469
+ /** 整表替换规则集(对话框"应用"用)。 */
470
+ setConditionalRules(rules: ConditionalRule[]): boolean;
471
+ /** 打开条件格式管理对话框(框架无关 DOM,三壳共用)。需 `conditionalFormat` + `editable`。 */
472
+ openConditionalFormatDialog(): boolean;
473
+ /** 打开 WPS 式透视表入口:确认选区字段后生成静态透视汇总表。需 `pivotTable` + `editable` 配置。 */
474
+ openPivotTableDialog(): boolean;
475
+ /** 兼容旧 API:基于当前选区创建静态透视汇总表。 */
476
+ createPivotTableFromSelection(opts?: {
477
+ rowFieldIndex?: number;
478
+ valueFieldIndex?: number;
479
+ output?: PivotOutputChoice;
480
+ }): boolean;
481
+ /** 通过 API 直接创建静态透视表,不依赖页面选区或对话框。需 `pivotTable` + `editable` 配置。 */
482
+ createPivotTable(opts: CreatePivotTableOptions): boolean;
483
+ private showPivotPanel;
484
+ /**
485
+ * 透视表的唯一重算入口:读 pivot.source/layout/collapsed → 重建静态结果 → 清旧区写新区 →
486
+ * 刷新 range/buttons/rowGroups。被面板改布局、源数据"活刷新"、折叠/展开三处共用,避免逻辑分叉。
487
+ */
488
+ private recomputePivot;
489
+ /**
490
+ * 源数据"活刷新":任何模型变更(编辑/粘贴/撤销/重做都经 onModelChange)后,把所有透视表按其源区域重算,
491
+ * 让结果跟着源数据走(WPS 透视表的"活"语义)。重算用 setCellValue 直接改模型(不经命令栈,不再触发
492
+ * onModelChange),pivotRefreshing 兜底防重入。功能开关关闭或无透视表时零开销。
493
+ */
494
+ private refreshPivotsAfterEdit;
495
+ /** 折叠/展开某个外层行分组(行字段 ≥2 时由折叠按钮触发),重算并重绘。 */
496
+ private togglePivotGroup;
497
+ /**
498
+ * 重建透视结果为二维单元格数组(框架无关纯计算)。
499
+ * 行字段第 1 个为外层分组,其余为内层明细 → 多行字段时产出可折叠的"大纲"(外层分组行带小计 +
500
+ * 内层缩进明细);单行字段退化为扁平(每个值一行,无折叠)。列字段横向展开,值字段可多个。
501
+ * groups 列出可折叠的分组表头行(相对 top 的偏移 + 外层 key),供渲染折叠按钮 + 命中测试。
502
+ */
503
+ private buildPivotRows;
504
+ private failPivot;
505
+ private pivotFieldOptions;
506
+ private pivotFieldOptionsForSheet;
507
+ private pivotCellText;
386
508
  /**
387
509
  * 按某列对自动筛选数据区排序(只读视图重排:移动行内容 + 行高,不改文件)。
388
510
  * 合并区与数据区相交则拒绝(与 Excel 一致)。排序前会清除该表筛选,避免行索引快照错位。
@@ -413,6 +535,16 @@ export declare class ViewerController {
413
535
  setSelectionFill(color: string | null): boolean;
414
536
  /** 给当前选区设字体色;editable 时入命令栈。 */
415
537
  setSelectionFontColor(color: string): boolean;
538
+ /** 给当前选区设数字格式代码(numFmt);editable 时入命令栈。1.11.0 */
539
+ setSelectionNumberFormat(code: string): boolean;
540
+ /** 打开数字格式编辑对话框(框架无关 DOM,三壳共用)。需 editable + 选区。1.11.0 */
541
+ openNumberFormatDialog(): boolean;
542
+ /** 读某格批注(无则 ''). */
543
+ getCellComment(row: number, col: number): string;
544
+ /** 设/清某格批注(空串 = 删除);单次撤销。 */
545
+ setCellComment(row: number, col: number, comment: string): boolean;
546
+ /** 打开批注编辑对话框(默认活动格);需 editable。 */
547
+ openCommentEditor(row?: number, col?: number): boolean;
416
548
  /** 当前选区里 wrapText 的整体态:'all' 全开 / 'none' 全关 / 'mixed' 混合。空选区→'none'。 */
417
549
  getSelectionWrapState(): 'all' | 'none' | 'mixed';
418
550
  /** 切换当前选区的"自动换行"(WPS 风格):全 wrap → 全关;否则 → 全开。
@@ -510,7 +642,7 @@ export declare class ViewerController {
510
642
  * 提交当前编辑(取值 → 命令栈 → 卸编辑器)。value 可为裸值或 {value,style}(样式 E5 起生效)。
511
643
  * move 指示提交后活动格移动(Enter→down / Tab→right)。
512
644
  */
513
- commitEdit(value: EditorCommitValue, move?: 'down' | 'right'): void;
645
+ commitEdit(value: EditorCommitValue, move?: 'down' | 'right'): boolean;
514
646
  /** 取消当前编辑(不改模型) */
515
647
  cancelEdit(): void;
516
648
  /** 当前是否有活动编辑器 */
@@ -0,0 +1,25 @@
1
+ export interface NumberFormatDialogOptions {
2
+ /** 当前活动格的值(预览用;无数值时用内置示例) */
3
+ sampleValue: number | string | boolean | Date | null;
4
+ /** 当前 numFmt(预选) */
5
+ currentCode: string;
6
+ date1904: boolean;
7
+ onApply: (code: string) => void;
8
+ }
9
+ export declare class NumberFormatDialogHost {
10
+ private el;
11
+ private cleanup;
12
+ private cat;
13
+ private opt;
14
+ private sample;
15
+ private date1904;
16
+ private onApply;
17
+ show(opts: NumberFormatDialogOptions): void;
18
+ private currentCode;
19
+ private render;
20
+ private renderOpts;
21
+ /** 预览取值:活动格有数值/日期就用它,否则按分类给个内置示例。 */
22
+ private previewValue;
23
+ close(): void;
24
+ dispose(): void;
25
+ }
@@ -13,6 +13,7 @@ export declare class OverlayManager {
13
13
  private imageEls;
14
14
  private chartPlaceholders;
15
15
  private shapeEls;
16
+ private pivotButtonEls;
16
17
  /** 防止异步加载 echarts 期间已切表/重建: build 自增,await 后 token 变了就放弃 */
17
18
  private buildToken;
18
19
  constructor(quads: OverlayQuads);
@@ -0,0 +1,12 @@
1
+ import { PasteBehavior } from '../edit/paste-behavior';
2
+ export interface PasteConfigDialogOptions {
3
+ current: PasteBehavior;
4
+ onSubmit: (cfg: PasteBehavior) => void;
5
+ }
6
+ export declare class PasteConfigDialogHost {
7
+ private el;
8
+ private cleanup;
9
+ show(opts: PasteConfigDialogOptions): void;
10
+ close(): void;
11
+ dispose(): void;
12
+ }
@@ -0,0 +1,48 @@
1
+ import { PivotTableLayout as PivotPanelLayout } from '../model/types';
2
+ export interface PivotFieldOption {
3
+ index: number;
4
+ label: string;
5
+ numeric: boolean;
6
+ }
7
+ export interface PivotDialogOptions {
8
+ rangeLabel: string;
9
+ defaultOutputCell: string;
10
+ onSubmit: (output: PivotOutputChoice) => void;
11
+ }
12
+ export type PivotOutputChoice = {
13
+ kind: 'current-sheet';
14
+ cell: string;
15
+ } | {
16
+ kind: 'new-sheet';
17
+ };
18
+ export interface PivotPanelOptions {
19
+ fields: PivotFieldOption[];
20
+ filterValues: Record<number, string[]>;
21
+ layout: PivotPanelLayout;
22
+ onChange: (layout: PivotPanelLayout) => void;
23
+ }
24
+ export declare class PivotDialogHost {
25
+ private el;
26
+ private cleanup;
27
+ show(opts: PivotDialogOptions): void;
28
+ close(): void;
29
+ dispose(): void;
30
+ }
31
+ export declare class PivotFieldPanelHost {
32
+ private el;
33
+ private opts;
34
+ /** 当前正在编辑筛选值的字段 index(null = 未展开筛选明细面板) */
35
+ private activeFilterField;
36
+ show(opts: PivotPanelOptions): void;
37
+ close(): void;
38
+ dispose(): void;
39
+ private render;
40
+ private fieldRow;
41
+ private area;
42
+ private updateLayout;
43
+ /** 筛选 chip 上的小按钮:显示当前筛选状态(全部/非空/N 项),点开底部明细面板编辑。 */
44
+ private filterSummaryBtn;
45
+ /** 底部筛选明细面板:全部/非空/多选 三模式 + 多选时的值复选框列表(WPS 风格勾选筛选)。 */
46
+ private filterDetail;
47
+ private summarySelect;
48
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 只读提醒 UI(框架无关 DOM,三壳共用)。粘贴撞只读格时,按配置:
3
+ * - 'dialog'(默认):弹窗列出**具体哪些格**只读(A1 引用),让用户明确知道哪部分没粘上;
4
+ * - 'toast':顶部气泡,简短提示 + 自动消失;
5
+ * - 'none':不弹内置 UI(只走 permission-denied 事件,消费方自处理)。
6
+ * 逐格精确:cells 是被跳过的只读格列表。
7
+ */
8
+ export type ReadOnlyPromptMode = 'dialog' | 'toast' | 'none';
9
+ export declare class ReadOnlyPromptHost {
10
+ private el;
11
+ private toastEl;
12
+ private toastTimer;
13
+ private cleanup;
14
+ show(mode: ReadOnlyPromptMode, message: string, cells: Array<{
15
+ row: number;
16
+ col: number;
17
+ }>): void;
18
+ private showToast;
19
+ private closeToast;
20
+ private showDialog;
21
+ close(): void;
22
+ dispose(): void;
23
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * 数据验证提示 UI(框架无关 DOM,三壳共用)。1.8.0 新增。
3
+ * - showError:非法输入提示。'stop' → 居中模态(标题 + 信息 + 知道了);'warning'/'information' → 顶部 toast 自动消失。
4
+ * - showInputBubble / hideInputBubble:选中带"输入提示"的格时,在格旁弹黄色气泡(WPS/Excel 同款)。
5
+ * 纯 DOM + 内联样式,不依赖任何框架;跟 readonly-prompt-host 风格保持一致。
6
+ */
7
+ export type ValidationErrorStyle = 'stop' | 'warning' | 'information';
8
+ export declare class ValidationPromptHost {
9
+ private el;
10
+ private toastEl;
11
+ private toastTimer;
12
+ private bubbleEl;
13
+ private cleanup;
14
+ private prevFocus;
15
+ /** 非法输入提示。stop → 模态;warning/information → toast。 */
16
+ showError(style: ValidationErrorStyle, message: string, title?: string): void;
17
+ private showToast;
18
+ private closeToast;
19
+ private showDialog;
20
+ close(): void;
21
+ /** 选中带输入提示的格时,在视口坐标 (x,y) 处弹黄色气泡(x,y = 该格右下角附近)。 */
22
+ showInputBubble(x: number, y: number, text: string, title?: string): void;
23
+ hideInputBubble(): void;
24
+ dispose(): void;
25
+ }
package/dist/core.js CHANGED
@@ -1,74 +1,77 @@
1
- import { C as r, w as t, D as l, E as n, G as i, O as d, P as m, V as g, W as c, x as u, y as C, A as k, j as b, k as y, B as f, F as v, m as S, i as E, H as I, I as T, J as p, K as R, h, L as W, M as w, N as x, Q as D, d as F, n as O, f as V, o as B, a as H, q as M, t as A, c as J, e as L, g as N, b as P, u as U, R as G, S as K, T as X, U as _, X as j, Y as q, l as z, Z as Q, v as Y, p as Z, _ as $, $ as aa, a0 as ea, a1 as sa, a2 as oa, a3 as ra, r as ta, a4 as la, a5 as na, a6 as ia, a7 as da, a8 as ma, a9 as ga, s as ca, aa as ua, ab as Ca, ac as ka, ad as ba } from "./chunks/plugin-overlay-BUrPrpT2.js";
1
+ import { C as r, y as t, D as l, j as n, E as i, G as d, O as g, A as m, P as c, V as u, W as C, B as k, F as E, H as S, k as b, n as T, I as v, J as f, o as y, i as I, K as R, L as h, M as p, N as A, h as D, Q as F, R as O, S as W, T as w, d as x, q as V, f as B, t as L, a as P, u as _, v as H, c as M, e as U, g as J, b as N, w as G, U as K, X, Y, Z as j, _ as q, $ as z, l as Q, a0 as Z, x as $, p as aa, a1 as ea, a2 as sa, a3 as oa, a4 as ra, a5 as ta, a6 as la, a7 as na, r as ia, a8 as da, a9 as ga, aa as ma, ab as ca, ac as ua, ad as Ca, s as ka, ae as Ea, af as Sa, ag as ba, ah as Ta } from "./chunks/plugin-overlay-C_fL02Qc.js";
2
2
  function e(a) {
3
3
  return a;
4
4
  }
5
5
  export {
6
6
  r as CanvasRenderer,
7
7
  t as CellEditorHost,
8
- l as DEFAULT_THEME,
9
- n as EditController,
10
- i as GridMetrics,
11
- d as OverlayManager,
12
- m as PluginOverlayHost,
13
- g as ViewerController,
14
- c as WorkbookExporter,
15
- u as addImage,
16
- C as applyStyleOverride,
17
- k as buildCellSnapshot,
8
+ l as DEFAULT_PASTE_BEHAVIOR,
9
+ n as DEFAULT_THEME,
10
+ i as EditController,
11
+ d as GridMetrics,
12
+ g as OverlayManager,
13
+ m as PASTE_PRESET_VALUES_ONLY,
14
+ c as PluginOverlayHost,
15
+ u as ViewerController,
16
+ C as WorkbookExporter,
17
+ k as addImage,
18
+ E as applyStyleOverride,
19
+ S as buildCellSnapshot,
18
20
  b as canvasToBlob,
19
- y as canvasToDataURL,
20
- f as captureStructure,
21
- v as cellContentForEngine,
22
- S as cellDisplayText,
23
- E as cellKey,
24
- I as clearCell,
25
- T as cloneCell,
21
+ T as canvasToDataURL,
22
+ v as captureStructure,
23
+ f as cellContentForEngine,
24
+ y as cellDisplayText,
25
+ I as cellKey,
26
+ R as clearCell,
27
+ h as cloneCell,
26
28
  p as cloneImageAnchor,
27
- R as cloneWorkbook,
28
- h as colIndexToLetters,
29
- W as defaultFormulaEngineFactory,
29
+ A as cloneWorkbook,
30
+ D as colIndexToLetters,
31
+ F as defaultFormulaEngineFactory,
30
32
  e as definePlugin,
31
- w as deleteCols,
32
- x as deleteIntersectsMerge,
33
- D as deleteRows,
34
- F as detectFormat,
35
- O as downloadBlob,
36
- V as finalizeImages,
37
- B as formatValue,
38
- H as friendlyError,
39
- M as getCell,
40
- A as getCellStyle,
41
- J as getCellText,
42
- L as getCellValue,
43
- N as getRangeData,
44
- P as getSheetData,
45
- U as getWorkbookJSON,
46
- G as insertCols,
47
- K as insertRows,
48
- X as internStyle,
49
- _ as isDimCommand,
50
- j as isImageCommand,
51
- q as isStructCommand,
52
- z as loadArrayBuffer,
53
- Q as mergeStyleOverride,
54
- Y as mergeTheme,
55
- Z as parseWorkbook,
56
- $ as removeImage,
57
- aa as resolveEditable,
58
- ea as restoreCell,
59
- sa as restoreDimension,
60
- oa as restoreStructure,
61
- ra as restoreWorkbookInto,
62
- ta as revokeImages,
63
- la as rewriteWorkbookFormulas,
64
- na as setCellValue,
65
- ia as setColumnWidth,
66
- da as setImageRect,
67
- ma as setRangeValues,
68
- ga as setRowHeight,
69
- ca as sheetToJSON,
70
- ua as shiftFormulaRefs,
71
- Ca as toCsv,
72
- ka as toWorkbookJson,
73
- ba as workbookToXlsxBlob
33
+ O as deleteCols,
34
+ W as deleteIntersectsMerge,
35
+ w as deleteRows,
36
+ x as detectFormat,
37
+ V as downloadBlob,
38
+ B as finalizeImages,
39
+ L as formatValue,
40
+ P as friendlyError,
41
+ _ as getCell,
42
+ H as getCellStyle,
43
+ M as getCellText,
44
+ U as getCellValue,
45
+ J as getRangeData,
46
+ N as getSheetData,
47
+ G as getWorkbookJSON,
48
+ K as insertCols,
49
+ X as insertRows,
50
+ Y as internStyle,
51
+ j as isDimCommand,
52
+ q as isImageCommand,
53
+ z as isStructCommand,
54
+ Q as loadArrayBuffer,
55
+ Z as mergeStyleOverride,
56
+ $ as mergeTheme,
57
+ aa as parseWorkbook,
58
+ ea as removeImage,
59
+ sa as resolveEditable,
60
+ oa as resolvePasteBehavior,
61
+ ra as restoreCell,
62
+ ta as restoreDimension,
63
+ la as restoreStructure,
64
+ na as restoreWorkbookInto,
65
+ ia as revokeImages,
66
+ da as rewriteWorkbookFormulas,
67
+ ga as setCellValue,
68
+ ma as setColumnWidth,
69
+ ca as setImageRect,
70
+ ua as setRangeValues,
71
+ Ca as setRowHeight,
72
+ ka as sheetToJSON,
73
+ Ea as shiftFormulaRefs,
74
+ Sa as toCsv,
75
+ ba as toWorkbookJson,
76
+ Ta as workbookToXlsxBlob
74
77
  };
package/dist/index.d.ts CHANGED
@@ -8,11 +8,11 @@ export { cellDisplayText, getCell, getCellValue, getCellStyle, getCellText, getS
8
8
  export type { CellValue, ReadOptions, SheetToJSONOptions } from './core/model/data-access';
9
9
  export { formatValue } from './core/format/number-format';
10
10
  export { cellKey } from './core/model/types';
11
- export type { WorkbookModel, SheetModel, CellModel, CellStyle, MergeRange, ConditionalRule, ChartSpec, ImageAnchor, ShapeSpec, Sparkline, CssColor, TransformModelFn, CellStyleFn, CellStyleOverride, } from './core/model/types';
11
+ export type { WorkbookModel, SheetModel, CellModel, CellStyle, MergeRange, ConditionalRule, ChartSpec, ImageAnchor, ShapeSpec, Sparkline, PivotTableModel, PivotButton, PivotTableLayout, PivotFilterRule, PivotValueRule, PivotSummary, PivotFilterMode, CssColor, TransformModelFn, CellStyleFn, CellStyleOverride, } from './core/model/types';
12
12
  export type { ViewerTheme } from './core/render/theme';
13
13
  export { DEFAULT_THEME, mergeTheme } from './core/render/theme';
14
14
  export { definePlugin } from './core/plugin';
15
- export type { ExcelPlugin, ExcelPluginContext, ViewerApi, OverlayContext, PluginEvent, Rect, ToolbarItem, } from './core/plugin';
15
+ export type { ExcelPlugin, ExcelPluginContext, ViewerApi, OverlayContext, PluginEvent, Rect, ToolbarItem, CreatePivotTableOptions, PivotOutput, } from './core/plugin';
16
16
  export type { ExportTarget, RenderExportOptions, ImageExportOptions, PdfExportOptions, PrintOptions, PageSetup, PageFormat, Orientation, Margins, PdfPageContext, BeforeRenderPage, } from './core/export/types';
17
17
  export { canvasToBlob, canvasToDataURL, downloadBlob } from './core/export/raster';
18
18
  declare const plugin: Plugin;