@agile-team/mach-report 2.17.0 → 2.19.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 (170) hide show
  1. package/README.md +19 -9
  2. package/dist/{ExcelBindingWizard-Bq6FYME6.cjs → ExcelBindingWizard-UHSApSG9.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-Co1svTsw.js → ExcelBindingWizard-xJIYmnZ_.js} +3 -3
  4. package/dist/ParamEditor-BZb-okUd.cjs +1 -0
  5. package/dist/ParamEditor-D1wWemaf.js +732 -0
  6. package/dist/{ReportBatchPanel-uQh06usx.js → ReportBatchPanel-B88R-fME.js} +39 -39
  7. package/dist/ReportBatchPanel-BkJFqeEW.cjs +1 -0
  8. package/dist/ReportLabelStudio-B4WZ2XNN.js +239 -0
  9. package/dist/ReportLabelStudio-BN-fYNCr.cjs +1 -0
  10. package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
  11. package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
  12. package/dist/ReportPreview-BUr8GQUW.js +5618 -0
  13. package/dist/ReportPreview-D7PvKzs3.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-TIL_Oj2l.js → ReportTemplateLibrary-BGELmgd3.js} +1 -1
  15. package/dist/{ReportTemplateLibrary-CnP7_1pH.cjs → ReportTemplateLibrary-BOh2MgjQ.cjs} +1 -1
  16. package/dist/RuleEditor-CoLqgehG.js +2337 -0
  17. package/dist/RuleEditor-XaLcCdTb.cjs +1 -0
  18. package/dist/{TemplateOutlinePanel-BouxsuqQ.js → TemplateOutlinePanel-DU95loB-.js} +2 -2
  19. package/dist/{TemplateOutlinePanel-BlLxRrfu.cjs → TemplateOutlinePanel-DiG8tRRe.cjs} +1 -1
  20. package/dist/{TemplateReusePanel-BEACLPaN.js → TemplateReusePanel-DE1KSD6c.js} +2 -2
  21. package/dist/{TemplateReusePanel-yxsHSO40.cjs → TemplateReusePanel-G-Y299wc.cjs} +1 -1
  22. package/dist/{TemplateReviewPanel-D9Cx0m2N.cjs → TemplateReviewPanel-KQx9ts0D.cjs} +1 -1
  23. package/dist/{TemplateReviewPanel-B1OGRY2i.js → TemplateReviewPanel-vqFJ_Y9o.js} +2 -2
  24. package/dist/analytics.cjs +1 -1
  25. package/dist/analytics.d.cts +100 -41
  26. package/dist/analytics.d.ts +100 -41
  27. package/dist/analytics.js +76 -141
  28. package/dist/artifact-integrity.json +110 -102
  29. package/dist/assets-2eC3mOcV.js +232 -0
  30. package/dist/assets-B0Hxn4l6.cjs +1 -0
  31. package/dist/{auto-DDHflI9v.cjs → auto-B0EZFIK1.cjs} +1 -1
  32. package/dist/{auto-BIOmtVhk.js → auto-BlchZ1b8.js} +19 -19
  33. package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
  34. package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
  35. package/dist/charts-Dlv8j2AG.js +141 -0
  36. package/dist/charts-aCtoswXq.cjs +1 -0
  37. package/dist/codes.cjs +9 -9
  38. package/dist/codes.d.cts +54 -0
  39. package/dist/codes.d.ts +54 -0
  40. package/dist/codes.js +12097 -13668
  41. package/dist/column-visual-BpgQVWwT.js +238 -0
  42. package/dist/column-visual-CtYxnBCP.cjs +1 -0
  43. package/dist/component-tree-6TV7W6Yj.cjs +1 -0
  44. package/dist/component-tree-CvW4lzpv.js +67 -0
  45. package/dist/computed-4TnxzgIh.cjs +1 -0
  46. package/dist/computed-C8NRZQss.js +739 -0
  47. package/dist/data-bar-Ce38juRZ.cjs +1 -0
  48. package/dist/data-bar-PtjXhMgN.js +9 -0
  49. package/dist/designer-CyKXBhQg.cjs +2 -0
  50. package/dist/designer-fVvpYg8H.js +5824 -0
  51. package/dist/designer.cjs +1 -1
  52. package/dist/designer.d.cts +803 -43
  53. package/dist/designer.d.ts +803 -43
  54. package/dist/designer.js +26 -20
  55. package/dist/{encoding-BFMFIc4r.cjs → encoding-B--eZpp1.cjs} +1 -1
  56. package/dist/{encoding-DP_Eaf0A.js → encoding-mctOLocI.js} +2 -2
  57. package/dist/{font-loader-7FWVlykp.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
  58. package/dist/{font-loader-CQZowp0I.js → font-loader-DW8tIaNp.js} +1 -1
  59. package/dist/index-CPh6tqge.js +1575 -0
  60. package/dist/index-CUNw7dL9.cjs +1 -0
  61. package/dist/index.cjs +7 -7
  62. package/dist/index.d.cts +361 -15
  63. package/dist/index.d.ts +361 -15
  64. package/dist/index.js +876 -835
  65. package/dist/json-snapshot-By4ZVVUt.js +1967 -0
  66. package/dist/json-snapshot-jiXff4lc.cjs +2 -0
  67. package/dist/matrix-0hywp0-F.cjs +1 -0
  68. package/dist/matrix-Dy-tyY7E.js +381 -0
  69. package/dist/param-validation-C-8sRJLq.cjs +1 -0
  70. package/dist/param-validation-CnDEd2l-.js +333 -0
  71. package/dist/{pdf-l3ea86di.js → pdf-CKROKygt.js} +1851 -1849
  72. package/dist/{pdf-B8JouyYv.cjs → pdf-DqyxJ96U.cjs} +46 -46
  73. package/dist/pdf.cjs +1 -1
  74. package/dist/pdf.d.cts +54 -0
  75. package/dist/pdf.d.ts +54 -0
  76. package/dist/pdf.js +2 -2
  77. package/dist/{plugin-CtFX9PFG.cjs → plugin-4VuL38Nc.cjs} +1 -1
  78. package/dist/{plugin-BBp74CQZ.js → plugin-YWHcI3t4.js} +5 -5
  79. package/dist/prefill-B8H9qwE4.js +371 -0
  80. package/dist/prefill-D7EswyTI.cjs +1 -0
  81. package/dist/{prepared-CARicKYh.js → prepared-BE-4jfX5.js} +2 -2
  82. package/dist/{prepared-Ch1x_Gog.cjs → prepared-CGVphji3.cjs} +1 -1
  83. package/dist/{protocol-B5A2uom4.cjs → protocol-ByRVzzQG.cjs} +1 -1
  84. package/dist/{protocol-BaiWjq5w.js → protocol-Cr81vFSQ.js} +3 -3
  85. package/dist/{record-bindings-D4TuMzHs.js → record-bindings-DEJtmo3p.js} +67 -107
  86. package/dist/record-bindings-ehjnCDHt.cjs +1 -0
  87. package/dist/{region-binding-workflow-BNasF5kz.js → region-binding-workflow-CBg0l_tj.js} +1 -1
  88. package/dist/{region-binding-workflow-O2Cni3mF.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
  89. package/dist/report-encoding-worker.cjs +1 -1
  90. package/dist/report-encoding-worker.js +1 -1
  91. package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
  92. package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
  93. package/dist/runtime-CDA6d263.cjs +1 -0
  94. package/dist/runtime-CEMvybO7.js +170 -0
  95. package/dist/sbom.cdx.json +1 -1
  96. package/dist/server/node.d.cts +75 -7
  97. package/dist/server/node.d.ts +75 -7
  98. package/dist/server-node.cjs +4 -4
  99. package/dist/server-node.js +2692 -1990
  100. package/dist/server.cjs +1 -1
  101. package/dist/server.d.cts +243 -28
  102. package/dist/server.d.ts +243 -28
  103. package/dist/server.js +28 -28
  104. package/dist/sha256-BDQ1Qk7A.js +158 -0
  105. package/dist/sha256-DgZAKXqI.cjs +1 -0
  106. package/dist/style.css +1 -1
  107. package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
  108. package/dist/template-bindings-TKnXM7ll.js +62 -0
  109. package/dist/{template-catalog-wT1fNeAP.js → template-catalog-CmbWOJqy.js} +16 -16
  110. package/dist/{template-catalog-Dua8h9ZA.cjs → template-catalog-Utu4GP09.cjs} +1 -1
  111. package/dist/{template-fragments-BajTajb4.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
  112. package/dist/{template-fragments-DmX5XK4N.js → template-fragments-DWgo9tlZ.js} +2 -2
  113. package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
  114. package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
  115. package/dist/{template-registry-u11fPd8D.js → template-registry-BIhIHOab.js} +319 -314
  116. package/dist/template-registry-DzWswQI5.cjs +1 -0
  117. package/dist/vue/async.d.cts +528 -33
  118. package/dist/vue/async.d.ts +528 -33
  119. package/dist/vue/index.d.cts +616 -64
  120. package/dist/vue/index.d.ts +616 -64
  121. package/dist/vue-async.cjs +1 -1
  122. package/dist/vue-async.js +3 -3
  123. package/dist/vue.cjs +1 -1
  124. package/dist/vue.js +94 -89
  125. package/dist/{workbook-session-DN5LSA5C.cjs → workbook-session-B94EwVa_.cjs} +1 -1
  126. package/dist/{workbook-session-B8pNW24X.js → workbook-session-BoScoOg-.js} +2 -2
  127. package/dist/worker.cjs +1 -1
  128. package/dist/worker.d.cts +75 -7
  129. package/dist/worker.d.ts +75 -7
  130. package/dist/worker.js +4 -4
  131. package/dist/xlsx.cjs +4 -4
  132. package/dist/xlsx.d.cts +120 -13
  133. package/dist/xlsx.d.ts +120 -13
  134. package/dist/xlsx.js +313 -279
  135. package/package.json +1 -1
  136. package/dist/ParamEditor-B5UZRgxv.cjs +0 -1
  137. package/dist/ParamEditor-DNNARyeB.js +0 -594
  138. package/dist/ReportBatchPanel-Ctvs2t_9.cjs +0 -1
  139. package/dist/ReportPreview-BdQawRh0.js +0 -4879
  140. package/dist/ReportPreview-CJC_-j2I.cjs +0 -6
  141. package/dist/RuleEditor-DkRjOLlr.js +0 -2141
  142. package/dist/RuleEditor-h5anGsDB.cjs +0 -1
  143. package/dist/assets-BIMVwjQe.js +0 -231
  144. package/dist/assets-Dfs2ElxI.cjs +0 -1
  145. package/dist/component-tree-Ca6YYfHq.js +0 -61
  146. package/dist/component-tree-DkGLEfZC.cjs +0 -1
  147. package/dist/computed-BW5a8QFk.js +0 -612
  148. package/dist/computed-C2GD3XcE.cjs +0 -1
  149. package/dist/config-Dg_o8e7m.cjs +0 -1
  150. package/dist/config-XQ4qrQ7Q.js +0 -844
  151. package/dist/designer-D9XAxqSc.js +0 -5178
  152. package/dist/designer-uCDo5XSK.cjs +0 -2
  153. package/dist/drill-ByN8COs_.cjs +0 -1
  154. package/dist/drill-CKW3Xtfa.js +0 -145
  155. package/dist/json-snapshot-D7PE1NsU.cjs +0 -2
  156. package/dist/json-snapshot-DYmEe3sO.js +0 -1779
  157. package/dist/matrix-JLAXlux-.js +0 -302
  158. package/dist/matrix-gTHpDTGm.cjs +0 -1
  159. package/dist/param-validation-C3HlcLLO.cjs +0 -1
  160. package/dist/param-validation-Do7Eg8Zv.js +0 -181
  161. package/dist/record-bindings-B86Sur_y.cjs +0 -1
  162. package/dist/runtime-DakRXui3.js +0 -170
  163. package/dist/runtime-dL5ygIfa.cjs +0 -1
  164. package/dist/sha256-BshdOkCC.cjs +0 -1
  165. package/dist/sha256-DTG-Gq8i.js +0 -157
  166. package/dist/template-bindings-C2SpvsMU.js +0 -58
  167. package/dist/template-bindings-CEtWyiLX.cjs +0 -1
  168. package/dist/template-registry-CpysHAxy.cjs +0 -1
  169. package/dist/tree-CLpxYbKa.cjs +0 -1
  170. package/dist/tree-DNJorJUf.js +0 -172
package/dist/index.d.cts CHANGED
@@ -10,6 +10,14 @@ declare interface AggregateDefinition {
10
10
 
11
11
  declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
12
12
 
13
+ declare interface AggregateRequest {
14
+ op: AggregateOperation;
15
+ field?: string;
16
+ weightField?: string;
17
+ numeric?: "number" | "decimal";
18
+ digits?: number;
19
+ }
20
+
13
21
  /** 复制发生变化的页/组件/行;原计划保持不变,并拒绝覆盖已改变的单元格。 */
14
22
  export declare function applyReportCellEdit(plan: RenderPlan, edit: ReportCellEdit): RenderPlan;
15
23
 
@@ -29,6 +37,8 @@ export declare function assertRenderPlan(input: unknown): PlanPage[];
29
37
 
30
38
  export declare function assertReportParams(defs: readonly ReportParamDef[], input?: Record<string, unknown>): Record<string, string>;
31
39
 
40
+ export declare function assertReportValidation(issues: readonly ReportValidationIssue[], warningPolicy?: "allow" | "block"): void;
41
+
32
42
  export declare interface AssetRenderBudget {
33
43
  /** Maximum newly rendered assets, default 1000. Existing imageData is kept unchanged. */
34
44
  maxAssets?: number;
@@ -164,6 +174,31 @@ export declare type ColumnFormat = {
164
174
  /** 同一字段契约生成列语义和表头,业务侧无需复制另一份字段清单。 */
165
175
  export declare function columnsFromContract(contract: DatasetContract, overrides?: Record<string, Partial<TableTemplateColumn>>): TableTemplateColumn[];
166
176
 
177
+ export declare type ColumnVisual = {
178
+ /** Defaults to the column field; never changes the cell's raw value or business identity. */
179
+ field?: string;
180
+ /** Numeric text requires explicit opt-in; formatting an identifier does not turn it into a measure. */
181
+ numeric?: "number" | "decimal";
182
+ min?: number;
183
+ max?: number;
184
+ } & ({
185
+ kind: "colorScale";
186
+ lowColor?: string;
187
+ highColor?: string;
188
+ } | {
189
+ kind: "dataBar";
190
+ color?: string;
191
+ negativeColor?: string;
192
+ });
193
+
194
+ /** Stable-key comparison of business data or instance snapshots. Never compares report coordinates. */
195
+ export declare function compareReportData(before: ReportDataSnapshot, after: ReportDataSnapshot, options: ReportDataComparisonOptions): ReportDataComparison;
196
+
197
+ /** Bounded declarative conditions shared by visibility, styles, IF and candidate validation. */
198
+ export declare function compileReportPredicate(predicate: ReportPredicate, budget?: {
199
+ nodes: number;
200
+ }, depth?: number): ReportPredicateReader;
201
+
167
202
  export declare interface ComponentAssetRegistry {
168
203
  rendererFor(component: Readonly<PlanComponent>): ComponentImageRenderer | undefined;
169
204
  hasExtension(id: string, version: string, kind: string): boolean;
@@ -295,6 +330,9 @@ export declare function createReportCellEditBatch(plan: RenderPlan, inputs: read
295
330
  /** Operation-scoped index: avoids repeated geometry work without caching mutable plans globally. */
296
331
  export declare function createReportCellResolver(plan: RenderPlan): (address: ReportCellAddress) => ReportCellContext | null;
297
332
 
333
+ /** One bounded scan, shared aggregate semantics; labels never coerce identifier source values. */
334
+ export declare function createReportChartData(rows: readonly Record<string, unknown>[], binding: ReportChartBinding, signal?: AbortSignal): ReportChartData;
335
+
298
336
  /** Explicit per-host registry. Templates contain bounded JSON bindings; loaders never come from a template. */
299
337
  export declare function createReportComponentRegistry(definitions: readonly ReportComponentExtensionDefinition[]): ReportComponentRegistry;
300
338
 
@@ -308,6 +346,9 @@ export declare function createReportEditSession(options: {
308
346
  pagination?: PaginateOptions;
309
347
  }): ReportEditSession;
310
348
 
349
+ /** Explicit field allowlist + stable business keys. Does not mutate, persist or replace a workbook. */
350
+ export declare function createReportPrefill(plan: RenderPlan, options: ReportPrefillOptions): ReportPrefillPreview;
351
+
311
352
  /**
312
353
  * 框架无关的报表数据源:注册一次模板与取数,包内完成分页、校验、按 ID 顺序合并。
313
354
  * 不缓存业务结果、不推断接口包装、不自动重试;鉴权与完整数据范围由宿主决定。
@@ -317,6 +358,7 @@ export declare function createReportSource(reports: ReportRegistry, options?: {
317
358
  onDatasets?: (reportId: string, datasets: DatasetRows, template: ReportTemplate) => void;
318
359
  maxPages?: number;
319
360
  maxCells?: number;
361
+ maxChartComponents?: number;
320
362
  }): ReportSource;
321
363
 
322
364
  /**
@@ -434,6 +476,8 @@ export declare function evalStyleRule(row: Record<string, unknown>, when: StyleR
434
476
  /** A tiny arithmetic parser: no functions, property access, globals, assignments or executable source. */
435
477
  export declare function evaluateReportAggregateExpression(expression: string, values: Readonly<Record<string, number>>): number;
436
478
 
479
+ export declare function evaluateReportPredicate(row: Readonly<Record<string, unknown>>, predicate: ReportPredicate): boolean;
480
+
437
481
  /** Derives locatable explanations only from explicit business declarations; never evaluates formulas. */
438
482
  export declare function explainDatasetField(contract: DatasetContract, target: ReportDataTarget): ReportDiagnostic[];
439
483
 
@@ -444,6 +488,8 @@ declare interface ExpressionOptions {
444
488
  divisionByZero?: "null" | "error";
445
489
  }
446
490
 
491
+ export declare function formatReportCascaderPath(value: readonly string[]): string;
492
+
447
493
  /** 同步 text/raw value,所有输出后端读取同一份更新后的 RenderPlan。 */
448
494
  export declare function formatReportCellEdit(context: ReportCellContext, value: ReportCellValue): string;
449
495
 
@@ -452,6 +498,10 @@ export declare function formatReportClipboard(rows: readonly (readonly string[])
452
498
 
453
499
  export declare function formatReportDateRange(range: ReportDateRange): string;
454
500
 
501
+ export declare function formatReportNumberRange(value: ReportNumberRange): string;
502
+
503
+ export declare function formatReportParamSelection(value: readonly string[]): string;
504
+
455
505
  /**
456
506
  * 应用格式化。非数值/无法解析时原样返回基础文本(降级不报错):
457
507
  * - number:digits 小数位 + 可选千分位(12,345.60;thousands 默认 false)
@@ -476,6 +526,12 @@ export declare function getReportCellContext(plan: RenderPlan, address: ReportCe
476
526
  export declare function getReportEditSession(plan: RenderPlan): ReportEditSession | undefined;
477
527
 
478
528
  export declare interface GridCell {
529
+ /** Resolved visual only. Original value, text, editability and source are unchanged. */
530
+ dataBar?: {
531
+ start: number;
532
+ end: number;
533
+ color: string;
534
+ };
479
535
  /** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
480
536
  richParagraphs?: RichParagraph[];
481
537
  text?: string;
@@ -688,6 +744,8 @@ export declare interface ListColumn {
688
744
  format?: ColumnFormat;
689
745
  /** 条件格式规则(声明式,命中合并进单元格样式;如负数红字) */
690
746
  rules?: StyleRule[];
747
+ /** Optional resolved color scale or value-preserving data bar. */
748
+ visual?: ColumnVisual;
691
749
  /** 内容列编辑控制;仍需由预览显式开启 editing,不影响表头/小计只读规则。 */
692
750
  editable?: boolean;
693
751
  /** 空值列或特殊数据类型可显式声明编辑输入类型。 */
@@ -955,6 +1013,13 @@ export declare class PaginateCellLimitError extends Error {
955
1013
  constructor(limit: number, actual: number);
956
1014
  }
957
1015
 
1016
+ export declare class PaginateChartComponentLimitError extends Error {
1017
+ readonly limit: number;
1018
+ readonly estimated: number;
1019
+ readonly code = "chart-component-limit";
1020
+ constructor(limit: number, estimated: number);
1021
+ }
1022
+
958
1023
  export declare interface PaginateOptions {
959
1024
  /** 每行额外占高(mm),压测专用钩子 */
960
1025
  mmPerRow?: number;
@@ -964,6 +1029,8 @@ export declare interface PaginateOptions {
964
1029
  maxPages?: number;
965
1030
  /** Actual grid cells, including repeated furniture and nested children; checked before each page is appended. */
966
1031
  maxCells?: number;
1032
+ /** Shared bound-chart primitive budget, checked before expansion; default 50000, range 1..1000000. */
1033
+ maxChartComponents?: number;
967
1034
  signal?: AbortSignal;
968
1035
  /** Streaming total-page anchors can skip the bounded counting pass when known. */
969
1036
  knownTotalPages?: number;
@@ -982,6 +1049,8 @@ export declare class PaginatePageLimitError extends Error {
982
1049
  export declare interface PaginateResult {
983
1050
  plan: RenderPlan;
984
1051
  warnings: string[];
1052
+ /** Actual resolved bound-chart primitives, including empty placeholders. */
1053
+ chartComponents: number;
985
1054
  }
986
1055
 
987
1056
  /** Compatibility collector: the pagination engine is shared with the bounded page iterator. */
@@ -1001,6 +1070,8 @@ export declare type PaperName = keyof typeof PAPER_SIZES;
1001
1070
  /** 日历日字符串 → 本地 Date(不含时间的纯日期,杜绝 UTC 偏移) */
1002
1071
  export declare function parseDateLocal(input: string): Date | null;
1003
1072
 
1073
+ export declare function parseReportCascaderPath(value: unknown): string[] | undefined;
1074
+
1004
1075
  /** Core type parsing is authoritative; field controls add restrictions, never coerce IDs or bypass readonly. */
1005
1076
  export declare function parseReportCellFieldInput(context: ReportCellContext, input: ReportCellValue, field?: ReportCellFieldOptions): ReportCellValue;
1006
1077
 
@@ -1013,10 +1084,16 @@ export declare function parseReportClipboard(text: string, maxCells?: number): s
1013
1084
  /** Only complete, ordered, real calendar dates are accepted; there is no timezone conversion. */
1014
1085
  export declare function parseReportDateRange(value: string): ReportDateRange | undefined;
1015
1086
 
1087
+ export declare function parseReportNumberRange(value: unknown): ReportNumberRange | undefined;
1088
+
1089
+ export declare function parseReportParamSelection(value: unknown): string[] | undefined;
1090
+
1016
1091
  /** 校验文件 JSON 文本或接口返回的未知对象,返回独立模板快照。 */
1017
1092
  export declare function parseReportTemplate(input: unknown): ReportTemplateDocument;
1018
1093
 
1019
1094
  export declare interface PlanComponent {
1095
+ /** Template-only aggregate binding, expanded into shared primitives during layout. */
1096
+ chartBinding?: ReportChartBinding;
1020
1097
  /** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
1021
1098
  code?: CodeOptions;
1022
1099
  /** Template-only binding; resolved and removed before constructing the output plan. */
@@ -1168,6 +1245,11 @@ export declare interface ReportCalculationSelection {
1168
1245
  focus: ReportCellAddress;
1169
1246
  }
1170
1247
 
1248
+ export declare interface ReportCandidateValidationOptions extends Pick<ReportDatasetValidationOptions, "rules" | "maxChecks" | "maxIssues"> {
1249
+ /** Warnings are visible and allowed by default; block explicitly when required by business policy. */
1250
+ warningPolicy?: "allow" | "block";
1251
+ }
1252
+
1171
1253
  /** 预览中的物理坐标;合并单元格使用左上角坐标。 */
1172
1254
  export declare interface ReportCellAddress {
1173
1255
  pageIndex: number;
@@ -1282,6 +1364,58 @@ export declare type ReportCellValue = string | number | boolean | null;
1282
1364
 
1283
1365
  export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
1284
1366
 
1367
+ /** Serializable binding; data and authorization continue to come from the existing report source. */
1368
+ export declare interface ReportChartBinding {
1369
+ dataset: string;
1370
+ categoryField: string;
1371
+ measures: readonly ReportChartMeasure[];
1372
+ type: ReportChartOptions["type"];
1373
+ sort?: "asc" | "desc";
1374
+ title?: string;
1375
+ showValues?: boolean;
1376
+ maxRows?: number;
1377
+ maxCategories?: number;
1378
+ }
1379
+
1380
+ export declare interface ReportChartData {
1381
+ categories: string[];
1382
+ series: ReportChartSeries[];
1383
+ }
1384
+
1385
+ export declare interface ReportChartMeasure extends AggregateRequest {
1386
+ label?: string;
1387
+ color?: string;
1388
+ }
1389
+
1390
+ declare interface ReportChartOptions {
1391
+ type: "bar" | "line" | "stackedBar" | "percentBar";
1392
+ categories: readonly string[];
1393
+ series: readonly ReportChartSeries[];
1394
+ leftMm: number;
1395
+ topMm: number;
1396
+ widthMm: number;
1397
+ heightMm: number;
1398
+ title?: string;
1399
+ showValues?: boolean;
1400
+ }
1401
+
1402
+ declare interface ReportChartSeries {
1403
+ name: string;
1404
+ values: readonly (number | null)[];
1405
+ color?: string;
1406
+ }
1407
+
1408
+ export declare interface ReportComparison {
1409
+ field: string;
1410
+ op: ">" | ">=" | "<" | "<=" | "==" | "!=" | "between" | "contains" | "isNull" | "isNotNull";
1411
+ /** Legacy scalar thresholds remain supported. Use right for field-to-field comparisons. */
1412
+ value?: ReportPredicateScalar;
1413
+ right?: ReportPredicateOperand;
1414
+ values?: readonly [ReportPredicateScalar, ReportPredicateScalar];
1415
+ numeric?: "number" | "decimal";
1416
+ valueType?: "number" | "decimal" | "text" | "date" | "boolean";
1417
+ }
1418
+
1285
1419
  export declare interface ReportComponentExtensionBinding {
1286
1420
  id: string;
1287
1421
  version: string;
@@ -1350,6 +1484,89 @@ export declare interface ReportComponentRegistry extends ComponentAssetRegistry
1350
1484
 
1351
1485
  export declare type ReportComponentValue = string | number | boolean | null;
1352
1486
 
1487
+ export declare interface ReportDataComparison {
1488
+ sourceScope?: string;
1489
+ datasetId: string;
1490
+ differences: readonly ReportDataDifference[];
1491
+ counts: {
1492
+ added: number;
1493
+ removed: number;
1494
+ changed: number;
1495
+ unchanged: number;
1496
+ cells: number;
1497
+ };
1498
+ }
1499
+
1500
+ export declare interface ReportDataComparisonField {
1501
+ field: string;
1502
+ label?: string;
1503
+ /** Numeric comparison is explicit; identifiers containing digits stay text. */
1504
+ type?: "value" | "decimal";
1505
+ /** Absolute decimal tolerance, inclusive. No binary floating-point subtraction. */
1506
+ tolerance?: string;
1507
+ /** Fractional ratio digits. changeRatio is (after - before) / before, not a percent. */
1508
+ ratioDigits?: number;
1509
+ zeroDenominator?: "omit" | "zero-if-equal";
1510
+ missing?: "distinct" | "empty-equivalent" | "zero";
1511
+ }
1512
+
1513
+ export declare interface ReportDataComparisonOptions extends ReportDataLimits {
1514
+ fields: readonly ReportDataComparisonField[];
1515
+ maxDifferences?: number;
1516
+ }
1517
+
1518
+ export declare interface ReportDataDifference {
1519
+ rowKey: string | number;
1520
+ kind: "added" | "removed" | "changed";
1521
+ field: string;
1522
+ label: string;
1523
+ before: ReportCellValue | undefined;
1524
+ after: ReportCellValue | undefined;
1525
+ /** Exact base-ten difference. Undefined when either input is missing/non-numeric. */
1526
+ delta?: string;
1527
+ changeRatio?: string;
1528
+ ratioUnavailable?: "zero-denominator" | "missing";
1529
+ }
1530
+
1531
+ export declare class ReportDataError extends Error {
1532
+ readonly code: "identity" | "duplicate" | "limit" | "value" | "conflict";
1533
+ constructor(code: "identity" | "duplicate" | "limit" | "value" | "conflict", message: string);
1534
+ }
1535
+
1536
+ export declare interface ReportDataLimits {
1537
+ maxRows?: number;
1538
+ maxFields?: number;
1539
+ maxCells?: number;
1540
+ }
1541
+
1542
+ /** A business record, never a physical report row index. */
1543
+ export declare interface ReportDataRecord {
1544
+ rowKey: string | number;
1545
+ values: Readonly<Record<string, ReportCellValue>>;
1546
+ }
1547
+
1548
+ export declare interface ReportDatasetValidationOptions {
1549
+ rules: readonly ReportValidationRule[];
1550
+ rowKey?: string;
1551
+ computed?: readonly ComputedField[];
1552
+ /** Explicit trusted engine, shared with pagination; never read from a serialized template. */
1553
+ formula?: FormulaAdapter;
1554
+ /** Uses the same bounded tree preparation and descendant-leaf summaries as pagination. */
1555
+ tree?: TreeTableOptions;
1556
+ maxChecks?: number;
1557
+ maxIssues?: number;
1558
+ signal?: AbortSignal;
1559
+ }
1560
+
1561
+ export declare interface ReportDataSnapshot {
1562
+ sourceScope?: string;
1563
+ datasetId: string;
1564
+ rows: readonly ReportDataRecord[];
1565
+ }
1566
+
1567
+ /** Extracts explicit fields from the same rendered query; never makes a second business request. */
1568
+ export declare function reportDataSnapshotFromPlan(plan: RenderPlan, options: ReportPlanDataOptions): ReportDataSnapshot;
1569
+
1353
1570
  export declare interface ReportDataTarget {
1354
1571
  datasetId: string;
1355
1572
  field: string;
@@ -1360,6 +1577,17 @@ export declare interface ReportDataTarget {
1360
1577
  reportScope?: string;
1361
1578
  }
1362
1579
 
1580
+ /** Resolve a business calendar default once per request; returns only a portable date value. */
1581
+ export declare function reportDateDefault(options: ReportDateDefaultOptions): string;
1582
+
1583
+ export declare interface ReportDateDefaultOptions {
1584
+ preset: "today" | "yesterday" | "month-start" | "month-end";
1585
+ /** Explicit business clock in milliseconds or Date; no hidden browser/server clock. */
1586
+ now: number | Date;
1587
+ timeZone: string;
1588
+ offsetDays?: number;
1589
+ }
1590
+
1363
1591
  /** Wire values deliberately remain strings in browsers, Workers and backend runtimes. */
1364
1592
  export declare interface ReportDateRange {
1365
1593
  start: string;
@@ -1462,6 +1690,7 @@ export declare interface ReportEditConflict {
1462
1690
 
1463
1691
  export declare interface ReportEditPreparationOptions {
1464
1692
  signal?: AbortSignal;
1693
+ validation?: ReportCandidateValidationOptions;
1465
1694
  }
1466
1695
 
1467
1696
  export declare interface ReportEditResult {
@@ -1486,6 +1715,8 @@ declare interface ReportEditSessionPart {
1486
1715
 
1487
1716
  export declare interface ReportEditSessionRegistration {
1488
1717
  parts: readonly ReportEditSessionPart[];
1718
+ /** Trusted runtime adapters stay outside the serializable guarded source snapshot. */
1719
+ validationFormulas?: readonly (FormulaAdapter | undefined)[];
1489
1720
  rebuild(parts: readonly ReportEditSessionPart[], signal?: AbortSignal): Promise<RenderPlan>;
1490
1721
  }
1491
1722
 
@@ -1498,10 +1729,14 @@ declare type ReportExpression = {
1498
1729
  field?: string;
1499
1730
  weightField?: string;
1500
1731
  } | {
1501
- op: "add" | "subtract" | "multiply" | "divide" | "coalesce";
1732
+ op: ReportExpressionOperation;
1733
+ /** Required for if; args are [then, else], and only the selected branch is evaluated. */
1734
+ condition?: ReportPredicate;
1502
1735
  args: readonly ReportExpression[];
1503
1736
  };
1504
1737
 
1738
+ declare type ReportExpressionOperation = "add" | "subtract" | "multiply" | "divide" | "coalesce" | "if" | "round" | "abs" | "concat" | "trim" | "upper" | "lower" | "dateYear" | "dateMonth" | "dateDay";
1739
+
1505
1740
  /** 保持 Promise<RenderPlan> 契约;元数据为可选,旧业务 fetcher 无需改造。 */
1506
1741
  export declare interface ReportFetcher {
1507
1742
  (input: ReportFetchInput): Promise<RenderPlan>;
@@ -1573,6 +1808,8 @@ export declare interface ReportLoadContext {
1573
1808
  signal?: AbortSignal;
1574
1809
  }
1575
1810
 
1811
+ export declare type ReportNumberRange = readonly [number, number];
1812
+
1576
1813
  export declare function reportOutputDiagnostics(plan: RenderPlan, format: OutputFormat, options: OutputDiagnosticOptions): OutputDiagnostic[];
1577
1814
 
1578
1815
  export declare interface ReportPageFlow {
@@ -1585,12 +1822,9 @@ export declare interface ReportParamDef {
1585
1822
  field: string;
1586
1823
  /** 显示名(缺省用 field) */
1587
1824
  label?: string;
1588
- type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
1825
+ type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select" | "multiSelect" | "cascader" | "numberRange";
1589
1826
  /** select 选项 */
1590
- options?: Array<{
1591
- label: string;
1592
- value: string;
1593
- }>;
1827
+ options?: ReportParamTreeOption[];
1594
1828
  /** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
1595
1829
  optionsSource?: string;
1596
1830
  /** Select dependencies must be declared parameters; changing a parent clears descendants. */
@@ -1603,6 +1837,9 @@ export declare interface ReportParamDef {
1603
1837
  max?: number | string;
1604
1838
  minLength?: number;
1605
1839
  maxLength?: number;
1840
+ /** multiSelect item count (maximum 100). Cascader paths are bounded to 16 levels. */
1841
+ minItems?: number;
1842
+ maxItems?: number;
1606
1843
  }
1607
1844
 
1608
1845
  export declare interface ReportParamIssue {
@@ -1612,17 +1849,26 @@ export declare interface ReportParamIssue {
1612
1849
  message: string;
1613
1850
  }
1614
1851
 
1615
- export declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
1852
+ export declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength" | "minItems" | "maxItems";
1616
1853
 
1617
1854
  /** 描述 typedValues 的 Draft 2020-12 Schema;日期区间额外保留 x-report-* 扩展。 */
1618
1855
  export declare function reportParamsJsonSchema(defs: readonly ReportParamDef[]): Record<string, unknown>;
1619
1856
 
1857
+ /** Cascader values are unique within each sibling list. */
1858
+ export declare interface ReportParamTreeOption {
1859
+ label: string;
1860
+ value: string;
1861
+ children?: ReportParamTreeOption[];
1862
+ }
1863
+
1864
+ export declare type ReportParamTypedValue = string | number | string[] | ReportNumberRange;
1865
+
1620
1866
  export declare interface ReportParamValidation {
1621
1867
  ok: boolean;
1622
1868
  /** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
1623
1869
  values: Record<string, string>;
1624
1870
  /** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
1625
- typedValues: Record<string, string | number>;
1871
+ typedValues: Record<string, ReportParamTypedValue>;
1626
1872
  issues: ReportParamIssue[];
1627
1873
  }
1628
1874
 
@@ -1632,9 +1878,80 @@ export declare class ReportParamValidationError extends Error {
1632
1878
  constructor(issues: readonly ReportParamIssue[]);
1633
1879
  }
1634
1880
 
1881
+ export declare interface ReportPlanDataOptions extends ReportDataLimits {
1882
+ sourceScope?: string;
1883
+ datasetId: string;
1884
+ fields: readonly string[];
1885
+ }
1886
+
1887
+ export declare type ReportPredicate = ReportComparison | {
1888
+ all: readonly ReportPredicate[];
1889
+ } | {
1890
+ any: readonly ReportPredicate[];
1891
+ } | {
1892
+ not: ReportPredicate;
1893
+ };
1894
+
1895
+ export declare function reportPredicateFields(predicate: ReportPredicate): string[];
1896
+
1897
+ export declare type ReportPredicateOperand = {
1898
+ field: string;
1899
+ } | {
1900
+ value: ReportPredicateScalar;
1901
+ };
1902
+
1903
+ export declare type ReportPredicateReader = (row: Readonly<Record<string, unknown>>) => boolean;
1904
+
1905
+ export declare type ReportPredicateScalar = string | number | boolean | null;
1906
+
1907
+ export declare interface ReportPrefillField {
1908
+ field: string;
1909
+ sourceField?: string;
1910
+ label?: string;
1911
+ }
1912
+
1913
+ /** Re-resolve coordinates after reflow; any changed value/token rejects the complete application. */
1914
+ export declare function reportPrefillInputs(plan: RenderPlan, preview: ReportPrefillPreview, canEdit?: (context: ReportCellContext) => boolean): ReportCellInput[];
1915
+
1916
+ export declare interface ReportPrefillItem {
1917
+ source: Readonly<ReportCellSource>;
1918
+ label: string;
1919
+ status: ReportPrefillStatus;
1920
+ reason?: ReportPrefillReason;
1921
+ before?: ReportCellValue;
1922
+ after?: ReportCellValue;
1923
+ }
1924
+
1925
+ export declare interface ReportPrefillOptions extends ReportDataLimits {
1926
+ sourceScope?: string;
1927
+ datasetId: string;
1928
+ fields: readonly ReportPrefillField[];
1929
+ rows: readonly ReportDataRecord[];
1930
+ /** Default: fill only null/empty string. Existing zero, false and whitespace are data. */
1931
+ mode?: "empty" | "replace";
1932
+ maxChanges?: number;
1933
+ canEdit?(context: ReportCellContext): boolean;
1934
+ }
1935
+
1936
+ export declare interface ReportPrefillPreview {
1937
+ sourceScope?: string;
1938
+ datasetId: string;
1939
+ items: readonly ReportPrefillItem[];
1940
+ counts: Readonly<Record<ReportPrefillStatus, number>>;
1941
+ /** Optimistic source tokens and previous values are retained for an atomic edit. */
1942
+ edits: readonly ReportCellEdit[];
1943
+ }
1944
+
1945
+ export declare type ReportPrefillReason = "unchanged" | "readonly" | "occupied" | "missing-source" | "missing-target" | "ambiguous" | "invalid";
1946
+
1947
+ export declare type ReportPrefillStatus = "matched" | "changed" | "skipped" | "conflict";
1948
+
1635
1949
  export declare interface ReportPreparedEdit {
1636
1950
  /** Calculated preview; no source/session state changes until commit succeeds. */
1637
1951
  readonly plan: RenderPlan;
1952
+ readonly validationIssues: readonly ReportValidationIssue[];
1953
+ /** Validate complete candidate source rows and derived fields before invoking persistence. */
1954
+ validate(options: ReportCandidateValidationOptions): readonly ReportValidationIssue[];
1638
1955
  /** Call after persistence. A stale or repeated commit fails instead of publishing mixed state. */
1639
1956
  commit(result?: void | ReportEditResult): RenderPlan;
1640
1957
  }
@@ -1982,6 +2299,36 @@ export declare interface ReportTemplateVersion {
1982
2299
  restoredFrom?: string;
1983
2300
  }
1984
2301
 
2302
+ export declare class ReportValidationError extends Error {
2303
+ readonly issues: readonly ReportValidationIssue[];
2304
+ constructor(issues: readonly ReportValidationIssue[]);
2305
+ }
2306
+
2307
+ export declare interface ReportValidationIssue {
2308
+ ruleId: string;
2309
+ rowKey?: string | number;
2310
+ rowIndex?: number;
2311
+ field?: string;
2312
+ dataset?: string;
2313
+ sourceScope?: string;
2314
+ severity: "error" | "warning";
2315
+ message: string;
2316
+ }
2317
+
2318
+ export declare interface ReportValidationRule {
2319
+ id: string;
2320
+ /** Optional target; omitted applies to each candidate dataset. */
2321
+ dataset?: string;
2322
+ assert: ReportPredicate;
2323
+ when?: ReportPredicate;
2324
+ field?: string;
2325
+ severity?: "error" | "warning";
2326
+ message: string;
2327
+ scope?: "row" | "dataset";
2328
+ /** Dataset-scope assertions read this explicit summary row, never an arbitrary detail row. */
2329
+ aggregates?: readonly AggregateDefinition[];
2330
+ }
2331
+
1985
2332
  /** Optional business explanations never replace raw data or schema validation. */
1986
2333
  export declare type ReportValueState = "missing-source" | "not-applicable" | "not-calculable";
1987
2334
 
@@ -2093,13 +2440,7 @@ export declare function serializeReportTemplate(document: ReportTemplateDocument
2093
2440
 
2094
2441
  /** 条件格式规则求值(声明式,见 ListColumn.rules) */
2095
2442
  export declare interface StyleRule {
2096
- when: {
2097
- field: string;
2098
- op: ">" | ">=" | "<" | "<=" | "==" | "!=";
2099
- value: number | string;
2100
- /** Explicit decimal comparisons retain decimal thresholds as text. */
2101
- numeric?: "number" | "decimal";
2102
- };
2443
+ when: ReportPredicate;
2103
2444
  /** 命中时合并进单元格样式(color/bold/backgroundColor 等) */
2104
2445
  style: Record<string, unknown>;
2105
2446
  }
@@ -2323,6 +2664,11 @@ export declare function validateRenderPlan(input: unknown): ValidationResult;
2323
2664
  /** Check configuration before opening an input, including JSON/JavaScript callers. */
2324
2665
  export declare function validateReportCellFieldDefinition(context: ReportCellContext, field: ReportCellFieldOptions): void;
2325
2666
 
2667
+ export declare function validateReportChartBinding(binding: ReportChartBinding): void;
2668
+
2669
+ /** Pure candidate validation shared by browsers and Node; checks the complete proposed dataset before persistence. */
2670
+ export declare function validateReportDataset(input: readonly Record<string, unknown>[], options: ReportDatasetValidationOptions): ReportValidationIssue[];
2671
+
2326
2672
  export declare function validateReportDrillActions(actions: readonly ReportDrillAction[]): void;
2327
2673
 
2328
2674
  /** 模板参数配置错误也统一返回结构化问题,不让无效默认值或边界静默进入后端。 */