@agile-team/mach-report 2.3.2 → 2.4.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.
Files changed (39) hide show
  1. package/README.md +40 -5
  2. package/dist/ReportPreview-BVTpw9Tb.cjs +6 -0
  3. package/dist/ReportPreview-XF8iSUG1.js +1910 -0
  4. package/dist/grid-geometry-BNIvw52m.cjs +1 -0
  5. package/dist/{grid-geometry-Dw7BlENr.js → grid-geometry-C8hGoe9o.js} +10 -10
  6. package/dist/index.cjs +5 -5
  7. package/dist/index.d.cts +74 -0
  8. package/dist/index.d.ts +74 -0
  9. package/dist/index.js +946 -782
  10. package/dist/number-format-BA_KwrZe.js +55 -0
  11. package/dist/number-format-CZ2T_5kF.cjs +1 -0
  12. package/dist/pdf.cjs +1 -1
  13. package/dist/pdf.d.cts +6 -0
  14. package/dist/pdf.d.ts +6 -0
  15. package/dist/pdf.js +2 -2
  16. package/dist/{plugin-5R00MJQs.js → plugin-CKnSVuVe.js} +1 -1
  17. package/dist/{plugin-2lqgTX26.cjs → plugin-DwKr8oF6.cjs} +1 -1
  18. package/dist/render-plan-CCTL4F9v.cjs +1 -0
  19. package/dist/{render-plan-I9AHvQv7.js → render-plan-CXBWRog4.js} +12 -7
  20. package/dist/style.css +1 -1
  21. package/dist/vue/async.d.cts +598 -1
  22. package/dist/vue/async.d.ts +598 -1
  23. package/dist/vue/index.d.cts +820 -10
  24. package/dist/vue/index.d.ts +820 -10
  25. package/dist/vue-async.cjs +1 -1
  26. package/dist/vue-async.js +3 -3
  27. package/dist/vue.cjs +1 -1
  28. package/dist/vue.js +96 -73
  29. package/dist/xlsx.cjs +24 -24
  30. package/dist/xlsx.d.cts +209 -0
  31. package/dist/xlsx.d.ts +209 -0
  32. package/dist/xlsx.js +9805 -9284
  33. package/package.json +1 -1
  34. package/dist/ReportPreview-B-mwUSk9.cjs +0 -6
  35. package/dist/ReportPreview-DKjr4cwO.js +0 -1688
  36. package/dist/defaults-D4o0NCLo.js +0 -9
  37. package/dist/defaults-DOO1yHwx.cjs +0 -1
  38. package/dist/grid-geometry-bkciiZ4Q.cjs +0 -1
  39. package/dist/render-plan-CfJ3wf1l.cjs +0 -1
package/dist/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ /** 复制发生变化的页/组件/行;原计划保持不变,并拒绝覆盖已改变的单元格。 */
2
+ export declare function applyReportCellEdit(plan: RenderPlan, edit: ReportCellEdit): RenderPlan;
3
+
1
4
  export declare function assertRenderPlan(input: unknown): PlanPage[];
2
5
 
3
6
  /** 盒子边框语义:四边开关 + 内部网格线(四边全关则内线不画) */
@@ -124,6 +127,9 @@ export declare function createCanvasPager(plan: RenderPlan, options?: CanvasPage
124
127
  /** 兼容旧 API:默认启发式测量 */
125
128
  export declare function createHeuristicMeasurer(): TextMeasurer;
126
129
 
130
+ /** 生成可供宿主持久化/审计的补丁;不修改 plan 或宿主业务对象。 */
131
+ export declare function createReportCellEdit(plan: RenderPlan, address: ReportCellAddress, input: ReportCellValue): ReportCellEdit;
132
+
127
133
  /**
128
134
  * 框架无关的报表数据源:注册一次模板与取数,包内完成分页、校验、按 ID 顺序合并。
129
135
  * 不缓存业务结果、不推断接口包装、不自动重试;鉴权与完整数据范围由宿主决定。
@@ -176,6 +182,9 @@ export declare function defineReportTemplate(document: Omit<ReportTemplateDocume
176
182
  */
177
183
  export declare function evalStyleRule(row: Record<string, unknown>, when: StyleRule["when"]): boolean;
178
184
 
185
+ /** 同步 text/raw value,所有输出后端读取同一份更新后的 RenderPlan。 */
186
+ export declare function formatReportCellEdit(context: ReportCellContext, value: ReportCellValue): string;
187
+
179
188
  /**
180
189
  * 应用格式化。非数值/无法解析时原样返回基础文本(降级不报错):
181
190
  * - number:digits 小数位 + 可选千分位(12,345.60;thousands 默认 false)
@@ -186,6 +195,9 @@ export declare function formatValue(value: unknown, format?: ColumnFormat): stri
186
195
 
187
196
  declare type Geometry = Partial<Pick<PlanComponent, "leftMm" | "topMm" | "widthMm" | "heightMm">>;
188
197
 
198
+ /** 缺失、被合并覆盖、显式 null 占位不生成编辑目标。 */
199
+ export declare function getReportCellContext(plan: RenderPlan, address: ReportCellAddress): ReportCellContext | null;
200
+
189
201
  export declare interface GridCell {
190
202
  text?: string;
191
203
  rawText?: string;
@@ -193,6 +205,12 @@ export declare interface GridCell {
193
205
  value?: string | number | boolean | null;
194
206
  /** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
195
207
  numberFormat?: string;
208
+ /** 编辑输入类型;省略时只按原始值推断,数字字符串不会被转换为数值。 */
209
+ valueType?: "text" | "number" | "boolean";
210
+ /** 单元格级编辑控制;预览仍需显式开启 editing。 */
211
+ editable?: boolean;
212
+ /** Excel 公式保留元数据;当前引擎不计算公式,公式格始终只读。 */
213
+ formula?: string;
196
214
  children?: PlanComponent[];
197
215
  colSpan?: number;
198
216
  rowSpan?: number;
@@ -271,6 +289,10 @@ export declare interface ListColumn {
271
289
  format?: ColumnFormat;
272
290
  /** 条件格式规则(声明式,命中合并进单元格样式;如负数红字) */
273
291
  rules?: StyleRule[];
292
+ /** 内容列编辑控制;仍需由预览显式开启 editing,不影响表头/小计只读规则。 */
293
+ editable?: boolean;
294
+ /** 空值列或特殊数据类型可显式声明编辑输入类型。 */
295
+ valueType?: GridCell["valueType"];
274
296
  }
275
297
 
276
298
  export declare interface ListComponent {
@@ -407,6 +429,9 @@ export declare type PaperName = keyof typeof PAPER_SIZES;
407
429
  /** 日历日字符串 → 本地 Date(不含时间的纯日期,杜绝 UTC 偏移) */
408
430
  export declare function parseDateLocal(input: string): Date | null;
409
431
 
432
+ /** 严格解析编辑输入;文本列不隐式推断数值,清空数值/布尔列得到 null。 */
433
+ export declare function parseReportCellInput(context: ReportCellContext, input: ReportCellValue): ReportCellValue;
434
+
410
435
  /** 校验文件 JSON 文本或接口返回的未知对象,返回独立模板快照。 */
411
436
  export declare function parseReportTemplate(input: unknown): ReportTemplateDocument;
412
437
 
@@ -513,6 +538,55 @@ export declare function renderPlanToImages(plan: RenderPlan, options?: ImageRend
513
538
  /** 模板存储文档版本;与渲染计划版本独立演进。 */
514
539
  export declare const REPORT_TEMPLATE_DOCUMENT_VERSION: "1.0";
515
540
 
541
+ /** 预览中的物理坐标;合并单元格使用左上角坐标。 */
542
+ export declare interface ReportCellAddress {
543
+ pageIndex: number;
544
+ componentIndex: number;
545
+ rowIndex: number;
546
+ columnIndex: number;
547
+ }
548
+
549
+ export declare interface ReportCellContext {
550
+ address: ReportCellAddress;
551
+ cell: Readonly<GridCell>;
552
+ component: Readonly<PlanComponent>;
553
+ value: ReportCellValue;
554
+ valueType: ReportCellValueType;
555
+ table?: ReportCellTableIdentity;
556
+ editable: boolean;
557
+ readOnlyReason?: ReportCellReadOnlyReason;
558
+ }
559
+
560
+ export declare interface ReportCellEdit {
561
+ address: ReportCellAddress;
562
+ table?: ReportCellTableIdentity;
563
+ previousValue: ReportCellValue;
564
+ previousText: string;
565
+ value: ReportCellValue;
566
+ text: string;
567
+ }
568
+
569
+ export declare class ReportCellEditError extends Error {
570
+ readonly code: ReportCellEditErrorCode;
571
+ constructor(code: ReportCellEditErrorCode);
572
+ }
573
+
574
+ export declare type ReportCellEditErrorCode = "missing" | "readonly" | "number" | "boolean" | "conflict";
575
+
576
+ export declare type ReportCellReadOnlyReason = "cell" | "formula" | "complex" | "structure";
577
+
578
+ export declare interface ReportCellTableIdentity {
579
+ id: string;
580
+ /** 逻辑表行索引;跨分页的同一行保持不变。 */
581
+ rowIndex: number;
582
+ role: PlanTableFragment["role"];
583
+ columnKey?: string;
584
+ }
585
+
586
+ export declare type ReportCellValue = string | number | boolean | null;
587
+
588
+ export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
589
+
516
590
  export declare interface ReportDefinition {
517
591
  /** 静态模板或宿主提供的异步模板加载器;动态模板默认每次重新读取,不缓存版本。 */
518
592
  template: ReportTemplate | ReportTemplateLoader;