@agile-team/mach-report 2.12.0 → 2.14.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 (97) hide show
  1. package/README.md +27 -3
  2. package/dist/ExcelBindingWizard-CLT2p7P3.cjs +1 -0
  3. package/dist/ExcelBindingWizard-CvsWR8Ga.js +1485 -0
  4. package/dist/{ParamEditor-BLaE5q5W.js → ParamEditor-CflQV3eQ.js} +191 -187
  5. package/dist/ParamEditor-vIDzvpPV.cjs +1 -0
  6. package/dist/ReportBatchPanel-DkxTzBkD.cjs +1 -0
  7. package/dist/{ReportBatchPanel-B5ClP9tm.js → ReportBatchPanel-LqVgiqp7.js} +3 -3
  8. package/dist/ReportPreview-CvbqLUzM.cjs +6 -0
  9. package/dist/ReportPreview-D_ywJ_-H.js +4533 -0
  10. package/dist/{ReportTemplateLibrary-BZB-XWjj.js → ReportTemplateLibrary-MjWEtc7X.js} +1 -1
  11. package/dist/ReportTemplateLibrary-cQ1sqNYo.cjs +1 -0
  12. package/dist/RuleEditor-BaR6xUiI.cjs +1 -0
  13. package/dist/RuleEditor-ChuXMlei.js +2037 -0
  14. package/dist/TemplateOutlinePanel-BHKP89Xz.cjs +1 -0
  15. package/dist/TemplateOutlinePanel-Dci6aRn1.js +96 -0
  16. package/dist/TemplateReusePanel-B7Gmyc1z.js +388 -0
  17. package/dist/TemplateReusePanel-CY5eO2Sh.cjs +1 -0
  18. package/dist/TemplateReviewPanel-DjlX3xpt.js +592 -0
  19. package/dist/TemplateReviewPanel-JvZe9_4G.cjs +1 -0
  20. package/dist/{batch-mRqhhhjt.js → batch-DzaTNLWI.js} +23 -16
  21. package/dist/batch-xMkqYiTr.cjs +1 -0
  22. package/dist/config-0UIohTS7.cjs +1 -0
  23. package/dist/{config-B612mw0x.js → config-Dt9NtCPl.js} +227 -186
  24. package/dist/data-explanation-BktvER5B.cjs +1 -0
  25. package/dist/data-explanation-C_J6jYNi.js +16 -0
  26. package/dist/designer-Ci1LizA9.js +5020 -0
  27. package/dist/designer-rtmVIIdN.cjs +2 -0
  28. package/dist/designer.cjs +1 -2
  29. package/dist/designer.d.cts +306 -3
  30. package/dist/designer.d.ts +306 -3
  31. package/dist/designer.js +21 -4266
  32. package/dist/font-loader-DHto6Lra.js +297 -0
  33. package/dist/font-loader-vhCT8znW.cjs +1 -0
  34. package/dist/index.cjs +8 -8
  35. package/dist/index.d.cts +182 -1
  36. package/dist/index.d.ts +182 -1
  37. package/dist/index.js +728 -628
  38. package/dist/{template-review-BzpcI-tR.js → json-snapshot-BeFT3Tso.js} +867 -637
  39. package/dist/json-snapshot-D1NTP2oI.cjs +2 -0
  40. package/dist/pdf-8UPQebOE.js +36288 -0
  41. package/dist/pdf-AyJGb22z.cjs +101 -0
  42. package/dist/pdf.cjs +1 -101
  43. package/dist/pdf.js +9 -36579
  44. package/dist/plugin-BGKf-Tqg.js +22 -0
  45. package/dist/{plugin-BDTU4D94.cjs → plugin-CktLH_Iy.cjs} +1 -1
  46. package/dist/{region-binding-workflow-CcUq8W2Q.js → region-binding-workflow-DEJbhpCv.js} +1 -1
  47. package/dist/server/node.d.cts +46 -11
  48. package/dist/server/node.d.ts +46 -11
  49. package/dist/server-node.cjs +1 -1
  50. package/dist/server-node.js +294 -280
  51. package/dist/server.cjs +1 -1
  52. package/dist/server.d.cts +107 -12
  53. package/dist/server.d.ts +107 -12
  54. package/dist/server.js +713 -453
  55. package/dist/style.css +1 -1
  56. package/dist/template-bindings-BJR4k7qZ.cjs +1 -0
  57. package/dist/template-bindings-Daui7hLF.js +252 -0
  58. package/dist/template-fragments-CLkGo6To.js +187 -0
  59. package/dist/template-fragments-DFUpq5QM.cjs +1 -0
  60. package/dist/template-outline-B3xVkzSv.cjs +1 -0
  61. package/dist/template-outline-CFenM1PV.js +88 -0
  62. package/dist/{template-registry-BjE1VS6g.js → template-registry-COXDEJEM.js} +1 -1
  63. package/dist/{useLocalDraft-C07SYRnC.js → useLocalDraft-BnhcxXk_.js} +1 -1
  64. package/dist/{useLocalDraft-Yiw1wFgI.cjs → useLocalDraft-CioIfDb6.cjs} +1 -1
  65. package/dist/{validate-DbgEM1Hh.js → validate-CkQBWCeg.js} +3 -3
  66. package/dist/vue/async.d.cts +72 -2
  67. package/dist/vue/async.d.ts +72 -2
  68. package/dist/vue/index.d.cts +124 -5
  69. package/dist/vue/index.d.ts +124 -5
  70. package/dist/vue-async.cjs +1 -1
  71. package/dist/vue-async.js +5 -5
  72. package/dist/vue.cjs +1 -1
  73. package/dist/vue.js +78 -71
  74. package/dist/{workbook-session-BPb3TMnT.js → workbook-session-BfK1yHOO.js} +1 -1
  75. package/dist/worker.cjs +1 -1
  76. package/dist/worker.d.cts +46 -11
  77. package/dist/worker.d.ts +46 -11
  78. package/dist/worker.js +59 -55
  79. package/dist/xlsx.js +3 -3
  80. package/package.json +1 -1
  81. package/dist/ExcelBindingWizard-CeAf4QSE.js +0 -1465
  82. package/dist/ExcelBindingWizard-y0mT-AHR.cjs +0 -1
  83. package/dist/ParamEditor-MBBC7lUE.cjs +0 -1
  84. package/dist/ReportBatchPanel-Dc-SDkYA.cjs +0 -1
  85. package/dist/ReportPreview-DWXROHBP.cjs +0 -6
  86. package/dist/ReportPreview-DiNXhQI0.js +0 -4138
  87. package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +0 -1
  88. package/dist/RuleEditor-ChRzNQuF.cjs +0 -1
  89. package/dist/RuleEditor-DzAmW5YH.js +0 -2024
  90. package/dist/TemplateReviewPanel-BKofGrV9.js +0 -222
  91. package/dist/TemplateReviewPanel-DwtOcLue.cjs +0 -1
  92. package/dist/batch-Bt3Fd27Z.cjs +0 -1
  93. package/dist/config-BRoLo2oj.cjs +0 -1
  94. package/dist/plugin-Cd5G2QQn.js +0 -22
  95. package/dist/record-bindings-By_UKZ2g.cjs +0 -1
  96. package/dist/record-bindings-D-5jQlTj.js +0 -196
  97. package/dist/template-review-BfCC8Ng9.cjs +0 -2
package/dist/index.d.cts CHANGED
@@ -16,6 +16,9 @@ export declare function applyReportCellEdit(plan: RenderPlan, edit: ReportCellEd
16
16
  /** Transactional from the caller's perspective: a later conflict never exposes earlier writes. */
17
17
  export declare function applyReportCellEditBatch(plan: RenderPlan, batch: Pick<ReportEditBatch, "edits">): RenderPlan;
18
18
 
19
+ /** Styles affect report content only, never the surrounding designer/preview theme. */
20
+ export declare function applyReportDocumentStyle(input: ReportTemplateDocument, pageIndex: number, indices: readonly number[], role: ReportDocumentStyle): ReportTemplateDocument;
21
+
19
22
  /** Refresh concurrency metadata without changing values, layout, or the host's source objects. */
20
23
  export declare function applyReportEditResult(plan: RenderPlan, batch: ReportEditBatch, result: void | ReportEditResult): RenderPlan;
21
24
 
@@ -102,6 +105,8 @@ export declare interface CanvasRenderResult {
102
105
  diagnostics: OutputDiagnostic[];
103
106
  }
104
107
 
108
+ export declare function captureTemplateFragment(document: ReportTemplateDocument, pageIndex: number, indices: readonly number[], identity: Pick<ReportTemplateFragment, "id" | "name" | "revision">): ReportTemplateFragment;
109
+
105
110
  export declare function charWidthEm(ch: string): number;
106
111
 
107
112
  export declare type ClassKey = "root" | "page" | "comp" | "text" | "lines" | "line" | "rich" | "paragraph" | "segment" | "image" | "shape" | "grid" | "row" | "cell" | "unknown";
@@ -125,6 +130,9 @@ export declare interface CodeOptions {
125
130
  showText?: boolean;
126
131
  }
127
132
 
133
+ /** A flat, indexed outline allows the UI to render a bounded search window. */
134
+ export declare function collectTemplateOutline(template: ReportTemplate): TemplateOutlineEntry[];
135
+
128
136
  /**
129
137
  * 列值格式化(声明式、JSON 可序列化)。
130
138
  * 在 paginate 的 cellText 出口统一消费:格式化发生在进 RenderPlan 之前,
@@ -361,6 +369,13 @@ export declare const DEFAULT_STROKE_COLOR = "#333333";
361
369
  /** 默认文本色 */
362
370
  export declare const DEFAULT_TEXT_COLOR = "#000000";
363
371
 
372
+ /**
373
+ * Flat label integration for the same Vue/Node source pipeline: template + rows/load.
374
+ * It maps the one dataset and optional contract without caching or converting business values.
375
+ * Dynamic templates and multiple datasets continue to use defineReport.
376
+ */
377
+ export declare function defineLabelReport(options: LabelReportDefinitionOptions): ReportDefinition;
378
+
364
379
  /** 类型推导业务接口的响应,包内完成字段映射后交给同一分页流程。 */
365
380
  export declare function defineReport<TData>(definition: ReportDefinitionOptions<TData>): ReportDefinition;
366
381
 
@@ -483,6 +498,11 @@ export declare interface GridLayout {
483
498
  edges: GridEdge[];
484
499
  }
485
500
 
501
+ export declare function hasValidDataExplanation(value: {
502
+ target?: unknown;
503
+ valueState?: unknown;
504
+ }): boolean;
505
+
486
506
  /** 启发式测量器:无 Canvas 时的默认宽度估算 */
487
507
  export declare const heuristicMeasurer: TextMeasurer;
488
508
 
@@ -500,18 +520,92 @@ export declare interface ImageRenderResult {
500
520
  diagnostics: OutputDiagnostic[];
501
521
  }
502
522
 
523
+ /** Row-major physical imposition. Record → copy → face order is preserved; no duplex reordering. */
524
+ export declare function imposeLabelSheets(plan: RenderPlan, options: LabelSheetOptions): RenderPlan;
525
+
526
+ /** Explicit replacement is atomic and preserves surrounding components and the document CAS revision. */
527
+ export declare function insertTemplateFragment(input: ReportTemplateDocument, fragment: ReportTemplateFragment, options: TemplateFragmentInsertOptions): TemplateFragmentResult;
528
+
503
529
  export declare function inspectOutputCapabilities(plan: RenderPlan, format: OutputFormat): OutputDiagnostic[];
504
530
 
531
+ /** Includes rule, aggregate, relation and formula references; never evaluates expressions. */
532
+ export declare function inspectTemplateFieldUsage(template: ReportTemplate, dataset: string, field: string): TemplateFieldUsage[];
533
+
534
+ export declare function inspectTemplateFragmentBindings(fragment: ReportTemplateFragment): {
535
+ dataset: string;
536
+ fields: string[];
537
+ }[];
538
+
505
539
  export declare function isImageBackedComponent(comp: PlanComponent): boolean;
506
540
 
541
+ export declare function isReportDataTarget(value: unknown): value is ReportDataTarget;
542
+
507
543
  export declare function isReportDate(value: string): boolean;
508
544
 
509
545
  export declare function isReportMonth(value: string): boolean;
510
546
 
547
+ export declare function isReportValueState(value: unknown): value is ReportValueState;
548
+
511
549
  export declare function isReportYear(value: string): boolean;
512
550
 
513
551
  export declare function isRichText(comp: PlanComponent): boolean;
514
552
 
553
+ declare interface LabelReportDefinitionBase extends Pick<ReportDefinition, "params" | "pagination" | "dataValidation"> {
554
+ /** An existing fixed label template. Its repeat.dataset supplies the dataset name. */
555
+ template: ReportTemplate;
556
+ /** The single label dataset's contract; no dataset-name wrapper is needed. */
557
+ dataSchema?: DatasetContract;
558
+ }
559
+
560
+ export declare type LabelReportDefinitionOptions = LabelReportDefinitionBase & ({
561
+ rows: LabelReportRows;
562
+ load?: never;
563
+ } | {
564
+ rows?: never;
565
+ load: (context: ReportLoadContext) => LabelReportRows | Promise<LabelReportRows>;
566
+ });
567
+
568
+ /** Named business row interfaces and readonly arrays need no index signature or conversion. */
569
+ export declare type LabelReportRows = readonly object[];
570
+
571
+ export declare class LabelSheetError extends Error {
572
+ readonly path: string;
573
+ readonly code = "label-sheet";
574
+ constructor(message: string, path: string);
575
+ }
576
+
577
+ export declare interface LabelSheetOptions {
578
+ /** A4 defaults to 210 × 297 mm; custom sizes are explicit physical millimetres. */
579
+ paper?: "a4" | {
580
+ widthMm: number;
581
+ heightMm: number;
582
+ };
583
+ columns: number;
584
+ rows: number;
585
+ marginMm?: number | {
586
+ top: number;
587
+ left: number;
588
+ bottom: number;
589
+ right: number;
590
+ };
591
+ gapMm?: number | {
592
+ horizontal: number;
593
+ vertical: number;
594
+ };
595
+ /** Empty slots on the first sheet only (zero based, row-major). */
596
+ startSlot?: number;
597
+ /** Printer calibration; geometry outside the physical sheet is rejected. */
598
+ offsetMm?: {
599
+ x: number;
600
+ y: number;
601
+ };
602
+ maxSheets?: number;
603
+ maxComponents?: number;
604
+ /** Independent plain JSON snapshot budget, default 64 MB. */
605
+ maxSnapshotBytes?: number;
606
+ signal?: AbortSignal;
607
+ }
608
+
515
609
  export declare interface LabelTemplateOptions extends ReportTemplateRepeat {
516
610
  widthMm?: number;
517
611
  heightMm?: number;
@@ -1105,6 +1199,14 @@ export declare type ReportCellValue = string | number | boolean | null;
1105
1199
 
1106
1200
  export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
1107
1201
 
1202
+ export declare interface ReportDataTarget {
1203
+ datasetId: string;
1204
+ field: string;
1205
+ rowKey?: string | number;
1206
+ /** Use table identity when the same dataset appears in several tables. */
1207
+ tableId?: string;
1208
+ }
1209
+
1108
1210
  /** Wire values deliberately remain strings in browsers, Workers and backend runtimes. */
1109
1211
  export declare interface ReportDateRange {
1110
1212
  start: string;
@@ -1137,6 +1239,16 @@ export declare interface ReportDiagnostic {
1137
1239
  message: string;
1138
1240
  path?: string;
1139
1241
  severity: "warning" | "error" | "info";
1242
+ /** Optional explanation supplied by the business source, not inferred from blank cells. */
1243
+ valueState?: ReportValueState;
1244
+ target?: ReportDataTarget;
1245
+ }
1246
+
1247
+ export declare interface ReportDocumentStyle {
1248
+ id: string;
1249
+ name: string;
1250
+ style: ComponentStyle;
1251
+ target?: "content" | "header";
1140
1252
  }
1141
1253
 
1142
1254
  export declare interface ReportEditBatch {
@@ -1206,7 +1318,8 @@ export declare interface ReportFetchInput extends ReportTaskMonitoring {
1206
1318
  signal?: AbortSignal;
1207
1319
  /** 本次分页与计划告警;未提供时使用数据源配置的告警通道。 */
1208
1320
  onWarning?: (message: string) => void;
1209
- onQueryResult?: (reportId: string, result: ReportQueryResult) => void;
1321
+ /** Index scopes diagnostics when reports share datasets or a report ID is repeated. */
1322
+ onQueryResult?: (reportId: string, result: ReportQueryResult, reportIndex?: number) => void;
1210
1323
  }
1211
1324
 
1212
1325
  export declare interface ReportFieldContract {
@@ -1492,6 +1605,15 @@ export declare interface ReportTemplateFixture {
1492
1605
  params?: Record<string, string>;
1493
1606
  }
1494
1607
 
1608
+ /** Plain JSON, versioned by the host; inserting never links mutable library objects. */
1609
+ export declare interface ReportTemplateFragment {
1610
+ id: string;
1611
+ name: string;
1612
+ revision: string;
1613
+ components: TemplateComponent[];
1614
+ repeatDataset?: string;
1615
+ }
1616
+
1495
1617
  export declare type ReportTemplateLoader = (context: ReportLoadContext) => ReportTemplate | Promise<ReportTemplate>;
1496
1618
 
1497
1619
  export declare interface ReportTemplateManager {
@@ -1556,6 +1678,11 @@ export declare interface ReportTemplateReview {
1556
1678
  }>;
1557
1679
  }
1558
1680
 
1681
+ export declare interface ReportTemplateReviewAsyncOptions extends ReportTemplateReviewOptions {
1682
+ signal?: AbortSignal;
1683
+ onProgress?: (progress: ReportTemplateReviewProgress) => void;
1684
+ }
1685
+
1559
1686
  export declare interface ReportTemplateReviewIssue {
1560
1687
  code: "template" | "compatibility" | "dataset" | "field" | "sample" | "layout" | "output" | "params";
1561
1688
  severity: "error" | "warning";
@@ -1581,6 +1708,13 @@ export declare interface ReportTemplateReviewOptions {
1581
1708
  strictOutputs?: boolean;
1582
1709
  }
1583
1710
 
1711
+ export declare interface ReportTemplateReviewProgress {
1712
+ completed: number;
1713
+ total: number;
1714
+ stage: "template" | "baseline" | "bindings" | "fixture";
1715
+ fixture?: string;
1716
+ }
1717
+
1584
1718
  /** compareAndSwap 必须由宿主数据库/文件适配器保证原子性,不能用先读再无条件写替代。 */
1585
1719
  export declare interface ReportTemplateStore {
1586
1720
  read(id: string, signal?: AbortSignal): Promise<ReportTemplateRecord | undefined>;
@@ -1609,6 +1743,9 @@ export declare interface ReportTemplateVersion {
1609
1743
  restoredFrom?: string;
1610
1744
  }
1611
1745
 
1746
+ /** Optional business explanations never replace raw data or schema validation. */
1747
+ export declare type ReportValueState = "missing-source" | "not-applicable" | "not-calculable";
1748
+
1612
1749
  /**
1613
1750
  * 边框开关解析:
1614
1751
  * - 未声明(undefined)→ 四边全开(与既有 rect 总有边框的行为兼容)
@@ -1677,6 +1814,9 @@ export declare function resolveTextColor(style: Pick<ComponentStyle, "color"> |
1677
1814
  /** Pure preflight uses explicit samples only; it never fetches business data or publishes a draft. */
1678
1815
  export declare function reviewReportTemplate(input: unknown, options?: ReportTemplateReviewOptions): ReportTemplateReview;
1679
1816
 
1817
+ /** Yields between structural/baseline checks and every bounded fixture; no fetching or persistence. */
1818
+ export declare function reviewReportTemplateAsync(input: unknown, options?: ReportTemplateReviewAsyncOptions): Promise<ReportTemplateReview>;
1819
+
1680
1820
  export declare interface RichParagraph {
1681
1821
  segments: RichSegment[];
1682
1822
  align?: ComponentStyle["align"];
@@ -1787,11 +1927,50 @@ export declare class TemplateBuilder {
1787
1927
 
1788
1928
  export declare type TemplateComponent = PlanComponent | ListComponent;
1789
1929
 
1930
+ export declare interface TemplateFieldUsage extends TemplateOutlineLocation {
1931
+ dataset: string;
1932
+ field: string;
1933
+ kind: "display" | "calculation" | "binding";
1934
+ }
1935
+
1936
+ export declare interface TemplateFragmentBindings {
1937
+ datasets?: Record<string, string>;
1938
+ fields?: Record<string, Record<string, string>>;
1939
+ }
1940
+
1941
+ export declare interface TemplateFragmentInsertOptions {
1942
+ pageIndex: number;
1943
+ leftMm?: number;
1944
+ topMm?: number;
1945
+ bindings?: TemplateFragmentBindings;
1946
+ replaceInstance?: string;
1947
+ }
1948
+
1949
+ export declare interface TemplateFragmentResult {
1950
+ document: ReportTemplateDocument;
1951
+ componentIndices: number[];
1952
+ instance: string;
1953
+ }
1954
+
1790
1955
  export declare interface TemplateMutationOptions {
1791
1956
  expectedRevision: string | null;
1792
1957
  signal?: AbortSignal;
1793
1958
  }
1794
1959
 
1960
+ export declare interface TemplateOutlineEntry extends TemplateOutlineLocation {
1961
+ kind: "page" | "component" | "field" | "calculation" | "binding";
1962
+ title: string;
1963
+ dataset?: string;
1964
+ depth: number;
1965
+ }
1966
+
1967
+ export declare interface TemplateOutlineLocation {
1968
+ path: string;
1969
+ pageIndex?: number;
1970
+ componentIndex?: number;
1971
+ field?: string;
1972
+ }
1973
+
1795
1974
  export declare interface TemplatePage {
1796
1975
  widthMm: number;
1797
1976
  heightMm: number;
@@ -1807,6 +1986,8 @@ export declare interface TemplatePage {
1807
1986
  meta?: Record<string, unknown>;
1808
1987
  }
1809
1988
 
1989
+ export declare function templatePathLocation(path: string): Pick<TemplateOutlineLocation, "pageIndex" | "componentIndex">;
1990
+
1810
1991
  export declare interface TemplateStoreWriteOptions {
1811
1992
  publication?: ReportTemplateVersion;
1812
1993
  signal?: AbortSignal;
package/dist/index.d.ts CHANGED
@@ -16,6 +16,9 @@ export declare function applyReportCellEdit(plan: RenderPlan, edit: ReportCellEd
16
16
  /** Transactional from the caller's perspective: a later conflict never exposes earlier writes. */
17
17
  export declare function applyReportCellEditBatch(plan: RenderPlan, batch: Pick<ReportEditBatch, "edits">): RenderPlan;
18
18
 
19
+ /** Styles affect report content only, never the surrounding designer/preview theme. */
20
+ export declare function applyReportDocumentStyle(input: ReportTemplateDocument, pageIndex: number, indices: readonly number[], role: ReportDocumentStyle): ReportTemplateDocument;
21
+
19
22
  /** Refresh concurrency metadata without changing values, layout, or the host's source objects. */
20
23
  export declare function applyReportEditResult(plan: RenderPlan, batch: ReportEditBatch, result: void | ReportEditResult): RenderPlan;
21
24
 
@@ -102,6 +105,8 @@ export declare interface CanvasRenderResult {
102
105
  diagnostics: OutputDiagnostic[];
103
106
  }
104
107
 
108
+ export declare function captureTemplateFragment(document: ReportTemplateDocument, pageIndex: number, indices: readonly number[], identity: Pick<ReportTemplateFragment, "id" | "name" | "revision">): ReportTemplateFragment;
109
+
105
110
  export declare function charWidthEm(ch: string): number;
106
111
 
107
112
  export declare type ClassKey = "root" | "page" | "comp" | "text" | "lines" | "line" | "rich" | "paragraph" | "segment" | "image" | "shape" | "grid" | "row" | "cell" | "unknown";
@@ -125,6 +130,9 @@ export declare interface CodeOptions {
125
130
  showText?: boolean;
126
131
  }
127
132
 
133
+ /** A flat, indexed outline allows the UI to render a bounded search window. */
134
+ export declare function collectTemplateOutline(template: ReportTemplate): TemplateOutlineEntry[];
135
+
128
136
  /**
129
137
  * 列值格式化(声明式、JSON 可序列化)。
130
138
  * 在 paginate 的 cellText 出口统一消费:格式化发生在进 RenderPlan 之前,
@@ -361,6 +369,13 @@ export declare const DEFAULT_STROKE_COLOR = "#333333";
361
369
  /** 默认文本色 */
362
370
  export declare const DEFAULT_TEXT_COLOR = "#000000";
363
371
 
372
+ /**
373
+ * Flat label integration for the same Vue/Node source pipeline: template + rows/load.
374
+ * It maps the one dataset and optional contract without caching or converting business values.
375
+ * Dynamic templates and multiple datasets continue to use defineReport.
376
+ */
377
+ export declare function defineLabelReport(options: LabelReportDefinitionOptions): ReportDefinition;
378
+
364
379
  /** 类型推导业务接口的响应,包内完成字段映射后交给同一分页流程。 */
365
380
  export declare function defineReport<TData>(definition: ReportDefinitionOptions<TData>): ReportDefinition;
366
381
 
@@ -483,6 +498,11 @@ export declare interface GridLayout {
483
498
  edges: GridEdge[];
484
499
  }
485
500
 
501
+ export declare function hasValidDataExplanation(value: {
502
+ target?: unknown;
503
+ valueState?: unknown;
504
+ }): boolean;
505
+
486
506
  /** 启发式测量器:无 Canvas 时的默认宽度估算 */
487
507
  export declare const heuristicMeasurer: TextMeasurer;
488
508
 
@@ -500,18 +520,92 @@ export declare interface ImageRenderResult {
500
520
  diagnostics: OutputDiagnostic[];
501
521
  }
502
522
 
523
+ /** Row-major physical imposition. Record → copy → face order is preserved; no duplex reordering. */
524
+ export declare function imposeLabelSheets(plan: RenderPlan, options: LabelSheetOptions): RenderPlan;
525
+
526
+ /** Explicit replacement is atomic and preserves surrounding components and the document CAS revision. */
527
+ export declare function insertTemplateFragment(input: ReportTemplateDocument, fragment: ReportTemplateFragment, options: TemplateFragmentInsertOptions): TemplateFragmentResult;
528
+
503
529
  export declare function inspectOutputCapabilities(plan: RenderPlan, format: OutputFormat): OutputDiagnostic[];
504
530
 
531
+ /** Includes rule, aggregate, relation and formula references; never evaluates expressions. */
532
+ export declare function inspectTemplateFieldUsage(template: ReportTemplate, dataset: string, field: string): TemplateFieldUsage[];
533
+
534
+ export declare function inspectTemplateFragmentBindings(fragment: ReportTemplateFragment): {
535
+ dataset: string;
536
+ fields: string[];
537
+ }[];
538
+
505
539
  export declare function isImageBackedComponent(comp: PlanComponent): boolean;
506
540
 
541
+ export declare function isReportDataTarget(value: unknown): value is ReportDataTarget;
542
+
507
543
  export declare function isReportDate(value: string): boolean;
508
544
 
509
545
  export declare function isReportMonth(value: string): boolean;
510
546
 
547
+ export declare function isReportValueState(value: unknown): value is ReportValueState;
548
+
511
549
  export declare function isReportYear(value: string): boolean;
512
550
 
513
551
  export declare function isRichText(comp: PlanComponent): boolean;
514
552
 
553
+ declare interface LabelReportDefinitionBase extends Pick<ReportDefinition, "params" | "pagination" | "dataValidation"> {
554
+ /** An existing fixed label template. Its repeat.dataset supplies the dataset name. */
555
+ template: ReportTemplate;
556
+ /** The single label dataset's contract; no dataset-name wrapper is needed. */
557
+ dataSchema?: DatasetContract;
558
+ }
559
+
560
+ export declare type LabelReportDefinitionOptions = LabelReportDefinitionBase & ({
561
+ rows: LabelReportRows;
562
+ load?: never;
563
+ } | {
564
+ rows?: never;
565
+ load: (context: ReportLoadContext) => LabelReportRows | Promise<LabelReportRows>;
566
+ });
567
+
568
+ /** Named business row interfaces and readonly arrays need no index signature or conversion. */
569
+ export declare type LabelReportRows = readonly object[];
570
+
571
+ export declare class LabelSheetError extends Error {
572
+ readonly path: string;
573
+ readonly code = "label-sheet";
574
+ constructor(message: string, path: string);
575
+ }
576
+
577
+ export declare interface LabelSheetOptions {
578
+ /** A4 defaults to 210 × 297 mm; custom sizes are explicit physical millimetres. */
579
+ paper?: "a4" | {
580
+ widthMm: number;
581
+ heightMm: number;
582
+ };
583
+ columns: number;
584
+ rows: number;
585
+ marginMm?: number | {
586
+ top: number;
587
+ left: number;
588
+ bottom: number;
589
+ right: number;
590
+ };
591
+ gapMm?: number | {
592
+ horizontal: number;
593
+ vertical: number;
594
+ };
595
+ /** Empty slots on the first sheet only (zero based, row-major). */
596
+ startSlot?: number;
597
+ /** Printer calibration; geometry outside the physical sheet is rejected. */
598
+ offsetMm?: {
599
+ x: number;
600
+ y: number;
601
+ };
602
+ maxSheets?: number;
603
+ maxComponents?: number;
604
+ /** Independent plain JSON snapshot budget, default 64 MB. */
605
+ maxSnapshotBytes?: number;
606
+ signal?: AbortSignal;
607
+ }
608
+
515
609
  export declare interface LabelTemplateOptions extends ReportTemplateRepeat {
516
610
  widthMm?: number;
517
611
  heightMm?: number;
@@ -1105,6 +1199,14 @@ export declare type ReportCellValue = string | number | boolean | null;
1105
1199
 
1106
1200
  export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
1107
1201
 
1202
+ export declare interface ReportDataTarget {
1203
+ datasetId: string;
1204
+ field: string;
1205
+ rowKey?: string | number;
1206
+ /** Use table identity when the same dataset appears in several tables. */
1207
+ tableId?: string;
1208
+ }
1209
+
1108
1210
  /** Wire values deliberately remain strings in browsers, Workers and backend runtimes. */
1109
1211
  export declare interface ReportDateRange {
1110
1212
  start: string;
@@ -1137,6 +1239,16 @@ export declare interface ReportDiagnostic {
1137
1239
  message: string;
1138
1240
  path?: string;
1139
1241
  severity: "warning" | "error" | "info";
1242
+ /** Optional explanation supplied by the business source, not inferred from blank cells. */
1243
+ valueState?: ReportValueState;
1244
+ target?: ReportDataTarget;
1245
+ }
1246
+
1247
+ export declare interface ReportDocumentStyle {
1248
+ id: string;
1249
+ name: string;
1250
+ style: ComponentStyle;
1251
+ target?: "content" | "header";
1140
1252
  }
1141
1253
 
1142
1254
  export declare interface ReportEditBatch {
@@ -1206,7 +1318,8 @@ export declare interface ReportFetchInput extends ReportTaskMonitoring {
1206
1318
  signal?: AbortSignal;
1207
1319
  /** 本次分页与计划告警;未提供时使用数据源配置的告警通道。 */
1208
1320
  onWarning?: (message: string) => void;
1209
- onQueryResult?: (reportId: string, result: ReportQueryResult) => void;
1321
+ /** Index scopes diagnostics when reports share datasets or a report ID is repeated. */
1322
+ onQueryResult?: (reportId: string, result: ReportQueryResult, reportIndex?: number) => void;
1210
1323
  }
1211
1324
 
1212
1325
  export declare interface ReportFieldContract {
@@ -1492,6 +1605,15 @@ export declare interface ReportTemplateFixture {
1492
1605
  params?: Record<string, string>;
1493
1606
  }
1494
1607
 
1608
+ /** Plain JSON, versioned by the host; inserting never links mutable library objects. */
1609
+ export declare interface ReportTemplateFragment {
1610
+ id: string;
1611
+ name: string;
1612
+ revision: string;
1613
+ components: TemplateComponent[];
1614
+ repeatDataset?: string;
1615
+ }
1616
+
1495
1617
  export declare type ReportTemplateLoader = (context: ReportLoadContext) => ReportTemplate | Promise<ReportTemplate>;
1496
1618
 
1497
1619
  export declare interface ReportTemplateManager {
@@ -1556,6 +1678,11 @@ export declare interface ReportTemplateReview {
1556
1678
  }>;
1557
1679
  }
1558
1680
 
1681
+ export declare interface ReportTemplateReviewAsyncOptions extends ReportTemplateReviewOptions {
1682
+ signal?: AbortSignal;
1683
+ onProgress?: (progress: ReportTemplateReviewProgress) => void;
1684
+ }
1685
+
1559
1686
  export declare interface ReportTemplateReviewIssue {
1560
1687
  code: "template" | "compatibility" | "dataset" | "field" | "sample" | "layout" | "output" | "params";
1561
1688
  severity: "error" | "warning";
@@ -1581,6 +1708,13 @@ export declare interface ReportTemplateReviewOptions {
1581
1708
  strictOutputs?: boolean;
1582
1709
  }
1583
1710
 
1711
+ export declare interface ReportTemplateReviewProgress {
1712
+ completed: number;
1713
+ total: number;
1714
+ stage: "template" | "baseline" | "bindings" | "fixture";
1715
+ fixture?: string;
1716
+ }
1717
+
1584
1718
  /** compareAndSwap 必须由宿主数据库/文件适配器保证原子性,不能用先读再无条件写替代。 */
1585
1719
  export declare interface ReportTemplateStore {
1586
1720
  read(id: string, signal?: AbortSignal): Promise<ReportTemplateRecord | undefined>;
@@ -1609,6 +1743,9 @@ export declare interface ReportTemplateVersion {
1609
1743
  restoredFrom?: string;
1610
1744
  }
1611
1745
 
1746
+ /** Optional business explanations never replace raw data or schema validation. */
1747
+ export declare type ReportValueState = "missing-source" | "not-applicable" | "not-calculable";
1748
+
1612
1749
  /**
1613
1750
  * 边框开关解析:
1614
1751
  * - 未声明(undefined)→ 四边全开(与既有 rect 总有边框的行为兼容)
@@ -1677,6 +1814,9 @@ export declare function resolveTextColor(style: Pick<ComponentStyle, "color"> |
1677
1814
  /** Pure preflight uses explicit samples only; it never fetches business data or publishes a draft. */
1678
1815
  export declare function reviewReportTemplate(input: unknown, options?: ReportTemplateReviewOptions): ReportTemplateReview;
1679
1816
 
1817
+ /** Yields between structural/baseline checks and every bounded fixture; no fetching or persistence. */
1818
+ export declare function reviewReportTemplateAsync(input: unknown, options?: ReportTemplateReviewAsyncOptions): Promise<ReportTemplateReview>;
1819
+
1680
1820
  export declare interface RichParagraph {
1681
1821
  segments: RichSegment[];
1682
1822
  align?: ComponentStyle["align"];
@@ -1787,11 +1927,50 @@ export declare class TemplateBuilder {
1787
1927
 
1788
1928
  export declare type TemplateComponent = PlanComponent | ListComponent;
1789
1929
 
1930
+ export declare interface TemplateFieldUsage extends TemplateOutlineLocation {
1931
+ dataset: string;
1932
+ field: string;
1933
+ kind: "display" | "calculation" | "binding";
1934
+ }
1935
+
1936
+ export declare interface TemplateFragmentBindings {
1937
+ datasets?: Record<string, string>;
1938
+ fields?: Record<string, Record<string, string>>;
1939
+ }
1940
+
1941
+ export declare interface TemplateFragmentInsertOptions {
1942
+ pageIndex: number;
1943
+ leftMm?: number;
1944
+ topMm?: number;
1945
+ bindings?: TemplateFragmentBindings;
1946
+ replaceInstance?: string;
1947
+ }
1948
+
1949
+ export declare interface TemplateFragmentResult {
1950
+ document: ReportTemplateDocument;
1951
+ componentIndices: number[];
1952
+ instance: string;
1953
+ }
1954
+
1790
1955
  export declare interface TemplateMutationOptions {
1791
1956
  expectedRevision: string | null;
1792
1957
  signal?: AbortSignal;
1793
1958
  }
1794
1959
 
1960
+ export declare interface TemplateOutlineEntry extends TemplateOutlineLocation {
1961
+ kind: "page" | "component" | "field" | "calculation" | "binding";
1962
+ title: string;
1963
+ dataset?: string;
1964
+ depth: number;
1965
+ }
1966
+
1967
+ export declare interface TemplateOutlineLocation {
1968
+ path: string;
1969
+ pageIndex?: number;
1970
+ componentIndex?: number;
1971
+ field?: string;
1972
+ }
1973
+
1795
1974
  export declare interface TemplatePage {
1796
1975
  widthMm: number;
1797
1976
  heightMm: number;
@@ -1807,6 +1986,8 @@ export declare interface TemplatePage {
1807
1986
  meta?: Record<string, unknown>;
1808
1987
  }
1809
1988
 
1989
+ export declare function templatePathLocation(path: string): Pick<TemplateOutlineLocation, "pageIndex" | "componentIndex">;
1990
+
1810
1991
  export declare interface TemplateStoreWriteOptions {
1811
1992
  publication?: ReportTemplateVersion;
1812
1993
  signal?: AbortSignal;