@agile-team/mach-report 2.16.0 → 2.17.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 (128) hide show
  1. package/README.md +10 -6
  2. package/dist/{ExcelBindingWizard-CP6h2x1f.cjs → ExcelBindingWizard-Bq6FYME6.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-HhB3hAJE.js → ExcelBindingWizard-Co1svTsw.js} +3 -3
  4. package/dist/{ParamEditor-CUQLgoxa.cjs → ParamEditor-B5UZRgxv.cjs} +1 -1
  5. package/dist/{ParamEditor-OKesP_nO.js → ParamEditor-DNNARyeB.js} +1 -1
  6. package/dist/{ReportBatchPanel-cZCAMAwH.cjs → ReportBatchPanel-Ctvs2t_9.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-ruxcbfY6.js → ReportBatchPanel-uQh06usx.js} +1 -1
  8. package/dist/ReportPreview-BdQawRh0.js +4879 -0
  9. package/dist/ReportPreview-CJC_-j2I.cjs +6 -0
  10. package/dist/{ReportTemplateLibrary-BDlNT8JN.cjs → ReportTemplateLibrary-CnP7_1pH.cjs} +1 -1
  11. package/dist/{ReportTemplateLibrary-DcwrH-63.js → ReportTemplateLibrary-TIL_Oj2l.js} +1 -1
  12. package/dist/RuleEditor-DkRjOLlr.js +2141 -0
  13. package/dist/RuleEditor-h5anGsDB.cjs +1 -0
  14. package/dist/{TemplateOutlinePanel-CGrT5DFN.cjs → TemplateOutlinePanel-BlLxRrfu.cjs} +1 -1
  15. package/dist/{TemplateOutlinePanel-SXCjaPKR.js → TemplateOutlinePanel-BouxsuqQ.js} +1 -1
  16. package/dist/{TemplateReusePanel-lHLOS9Wn.js → TemplateReusePanel-BEACLPaN.js} +2 -2
  17. package/dist/{TemplateReusePanel-6Z3wRFz8.cjs → TemplateReusePanel-yxsHSO40.cjs} +1 -1
  18. package/dist/{TemplateReviewPanel-CJ9PLc48.js → TemplateReviewPanel-B1OGRY2i.js} +1 -1
  19. package/dist/{TemplateReviewPanel-Dpk7sLcF.cjs → TemplateReviewPanel-D9Cx0m2N.cjs} +1 -1
  20. package/dist/analytics.cjs +1 -1
  21. package/dist/analytics.d.cts +63 -1
  22. package/dist/analytics.d.ts +63 -1
  23. package/dist/analytics.js +4 -4
  24. package/dist/artifact-integrity.json +86 -90
  25. package/dist/assets-BIMVwjQe.js +231 -0
  26. package/dist/assets-Dfs2ElxI.cjs +1 -0
  27. package/dist/{auto-YR7a4BtF.js → auto-BIOmtVhk.js} +14 -14
  28. package/dist/{auto-uVBjX1j5.cjs → auto-DDHflI9v.cjs} +1 -1
  29. package/dist/computed-BW5a8QFk.js +612 -0
  30. package/dist/computed-C2GD3XcE.cjs +1 -0
  31. package/dist/dataset-DL83majE.js +161 -0
  32. package/dist/dataset-IrlXbUvh.cjs +1 -0
  33. package/dist/{designer-BfQSahxq.js → designer-D9XAxqSc.js} +1194 -1179
  34. package/dist/designer-uCDo5XSK.cjs +2 -0
  35. package/dist/designer.cjs +1 -1
  36. package/dist/designer.d.cts +125 -3
  37. package/dist/designer.d.ts +125 -3
  38. package/dist/designer.js +1 -1
  39. package/dist/{drill-CsdjgkRM.cjs → drill-ByN8COs_.cjs} +1 -1
  40. package/dist/{drill-DIGsZfyB.js → drill-CKW3Xtfa.js} +11 -11
  41. package/dist/{encoding-BYF9ZTl9.cjs → encoding-BFMFIc4r.cjs} +1 -1
  42. package/dist/{encoding-BOGq4qYL.js → encoding-DP_Eaf0A.js} +2 -2
  43. package/dist/{font-loader-EKLzOJxf.cjs → font-loader-7FWVlykp.cjs} +1 -1
  44. package/dist/{font-loader-CzI1GuBc.js → font-loader-CQZowp0I.js} +1 -1
  45. package/dist/index.cjs +8 -8
  46. package/dist/index.d.cts +173 -1
  47. package/dist/index.d.ts +173 -1
  48. package/dist/index.js +1205 -808
  49. package/dist/json-snapshot-D7PE1NsU.cjs +2 -0
  50. package/dist/{json-snapshot-D6ioHth9.js → json-snapshot-DYmEe3sO.js} +769 -692
  51. package/dist/matrix-JLAXlux-.js +302 -0
  52. package/dist/matrix-gTHpDTGm.cjs +1 -0
  53. package/dist/{pdf-ByVCb1i6.cjs → pdf-B8JouyYv.cjs} +47 -47
  54. package/dist/{pdf-DJ5S6ukC.js → pdf-l3ea86di.js} +13 -15
  55. package/dist/pdf.cjs +1 -1
  56. package/dist/pdf.d.cts +12 -0
  57. package/dist/pdf.d.ts +12 -0
  58. package/dist/pdf.js +2 -2
  59. package/dist/{plugin-C2j5_mhx.js → plugin-BBp74CQZ.js} +1 -1
  60. package/dist/{plugin-Dr39GBRG.cjs → plugin-CtFX9PFG.cjs} +1 -1
  61. package/dist/{prepared-DqtpvRTn.js → prepared-CARicKYh.js} +1 -1
  62. package/dist/{prepared-DdrjLC7L.cjs → prepared-Ch1x_Gog.cjs} +1 -1
  63. package/dist/{protocol-BzwMP4Vw.cjs → protocol-B5A2uom4.cjs} +1 -1
  64. package/dist/{protocol-kt4Iy6-3.js → protocol-BaiWjq5w.js} +3 -3
  65. package/dist/{record-bindings-DUX1VMlR.cjs → record-bindings-B86Sur_y.cjs} +1 -1
  66. package/dist/{record-bindings-CZWBJ1fU.js → record-bindings-D4TuMzHs.js} +1 -1
  67. package/dist/{region-binding-workflow-CWNvIjkV.js → region-binding-workflow-BNasF5kz.js} +2 -2
  68. package/dist/{region-binding-workflow-CqSMxQ4p.cjs → region-binding-workflow-O2Cni3mF.cjs} +1 -1
  69. package/dist/report-encoding-worker.cjs +1 -1
  70. package/dist/report-encoding-worker.js +1 -1
  71. package/dist/runtime-DakRXui3.js +170 -0
  72. package/dist/runtime-dL5ygIfa.cjs +1 -0
  73. package/dist/sbom.cdx.json +1 -1
  74. package/dist/server/node.d.cts +46 -0
  75. package/dist/server/node.d.ts +46 -0
  76. package/dist/server-node.cjs +4 -4
  77. package/dist/server-node.js +2540 -1911
  78. package/dist/server.cjs +1 -1
  79. package/dist/server.d.cts +174 -1
  80. package/dist/server.d.ts +174 -1
  81. package/dist/server.js +787 -544
  82. package/dist/style.css +1 -1
  83. package/dist/template-catalog-Dua8h9ZA.cjs +1 -0
  84. package/dist/{template-catalog-BtR2JmCL.js → template-catalog-wT1fNeAP.js} +4 -4
  85. package/dist/{template-fragments-BVsbxs4a.cjs → template-fragments-BajTajb4.cjs} +1 -1
  86. package/dist/{template-fragments-By0aZC1D.js → template-fragments-DmX5XK4N.js} +1 -1
  87. package/dist/{template-registry-C62vpv4a.cjs → template-registry-CpysHAxy.cjs} +1 -1
  88. package/dist/{template-registry-Cw3vRTX2.js → template-registry-u11fPd8D.js} +5 -5
  89. package/dist/{tree-BX380Rr7.cjs → tree-CLpxYbKa.cjs} +1 -1
  90. package/dist/{tree-CjVZLRw7.js → tree-DNJorJUf.js} +1 -1
  91. package/dist/vue/async.d.cts +108 -2
  92. package/dist/vue/async.d.ts +108 -2
  93. package/dist/vue/index.d.cts +130 -3
  94. package/dist/vue/index.d.ts +130 -3
  95. package/dist/vue-async.cjs +1 -1
  96. package/dist/vue-async.js +3 -3
  97. package/dist/vue.cjs +1 -1
  98. package/dist/vue.js +4 -4
  99. package/dist/{workbook-session-BeSO8PFB.js → workbook-session-B8pNW24X.js} +1 -1
  100. package/dist/{workbook-session-Cbts-22R.cjs → workbook-session-DN5LSA5C.cjs} +1 -1
  101. package/dist/worker.cjs +1 -1
  102. package/dist/worker.js +4 -4
  103. package/dist/xlsx.cjs +4 -4
  104. package/dist/xlsx.d.cts +88 -2
  105. package/dist/xlsx.d.ts +88 -2
  106. package/dist/xlsx.js +232 -230
  107. package/package.json +1 -1
  108. package/dist/ReportPreview-BcDKCLiK.js +0 -4834
  109. package/dist/ReportPreview-Bk9nLfO9.cjs +0 -6
  110. package/dist/RuleEditor-BX5S8RSF.cjs +0 -1
  111. package/dist/RuleEditor-CGl9XY2s.js +0 -2037
  112. package/dist/assets-CqIbfbTr.js +0 -126
  113. package/dist/assets-e4YSke8n.cjs +0 -1
  114. package/dist/capabilities-DDwXr_cA.js +0 -103
  115. package/dist/capabilities-DNLyZdNw.cjs +0 -1
  116. package/dist/computed-C-4C2S5h.js +0 -521
  117. package/dist/computed-CGV2a809.cjs +0 -1
  118. package/dist/dataset-BkRmwgeJ.cjs +0 -1
  119. package/dist/dataset-H5pFuQGU.js +0 -121
  120. package/dist/designer-CPPdeM5_.cjs +0 -2
  121. package/dist/diagnostic-notification-B9K9We3h.cjs +0 -1
  122. package/dist/diagnostic-notification-qGAYZdkB.js +0 -7
  123. package/dist/json-snapshot-DknkjvxP.cjs +0 -2
  124. package/dist/matrix-CGRGkn5s.js +0 -112
  125. package/dist/matrix-gEO7ZM_u.cjs +0 -1
  126. package/dist/runtime-BjKBI530.js +0 -168
  127. package/dist/runtime-CBFEPKEs.cjs +0 -1
  128. package/dist/template-catalog-C2NLdrwB.cjs +0 -1
package/dist/index.d.cts CHANGED
@@ -42,6 +42,8 @@ export declare interface AssetRenderBudget {
42
42
 
43
43
  export declare interface AssetRenderOptions extends OutputDiagnosticOptions, ImageMediaOptions {
44
44
  assetRenderers?: Partial<Record<ImageComponentKind, ComponentImageRenderer>>;
45
+ /** Explicit id/version registry; unbound components continue using assetRenderers by kind. */
46
+ assetRegistry?: ComponentAssetRegistry;
45
47
  assetBudget?: AssetRenderBudget;
46
48
  /** Default throw prevents an incomplete export; placeholder retains the component and emits diagnostics. */
47
49
  assetFailure?: "throw" | "placeholder";
@@ -162,6 +164,11 @@ export declare type ColumnFormat = {
162
164
  /** 同一字段契约生成列语义和表头,业务侧无需复制另一份字段清单。 */
163
165
  export declare function columnsFromContract(contract: DatasetContract, overrides?: Record<string, Partial<TableTemplateColumn>>): TableTemplateColumn[];
164
166
 
167
+ export declare interface ComponentAssetRegistry {
168
+ rendererFor(component: Readonly<PlanComponent>): ComponentImageRenderer | undefined;
169
+ hasExtension(id: string, version: string, kind: string): boolean;
170
+ }
171
+
165
172
  /** A literal own field of the current label record; expressions and paths are not evaluated. */
166
173
  export declare interface ComponentBinding {
167
174
  field: string;
@@ -265,6 +272,16 @@ export declare function createLocalTemplateCatalog(input: LocalTemplateCatalogIt
265
272
  /** 单进程参考适配器;多实例服务请实现具备数据库事务/CAS 的持久化适配器。 */
266
273
  export declare function createMemoryTemplateStore(): ReportTemplateStore;
267
274
 
275
+ /** Owned preview controller; only mounted grids are windowed. Static renderPage and exports stay complete. */
276
+ export declare function createPageViewportRenderer(page: PlanPage, dpi: number, options: RenderOptions, doc: Document): {
277
+ element: HTMLElement;
278
+ update(viewport: ReportViewport, retained?: {
279
+ componentIndex: number;
280
+ rowIndex: number;
281
+ columnIndex: number;
282
+ }): boolean;
283
+ };
284
+
268
285
  export declare function createProviderReport(definition: Omit<ReportDefinition, "load" | "datasets"> & {
269
286
  provider: ReportProvider;
270
287
  }): ReportDefinition;
@@ -278,6 +295,9 @@ export declare function createReportCellEditBatch(plan: RenderPlan, inputs: read
278
295
  /** Operation-scoped index: avoids repeated geometry work without caching mutable plans globally. */
279
296
  export declare function createReportCellResolver(plan: RenderPlan): (address: ReportCellAddress) => ReportCellContext | null;
280
297
 
298
+ /** Explicit per-host registry. Templates contain bounded JSON bindings; loaders never come from a template. */
299
+ export declare function createReportComponentRegistry(definitions: readonly ReportComponentExtensionDefinition[]): ReportComponentRegistry;
300
+
281
301
  /** Revalidates the current cell on activation; returns only bounded scalar values and explicit return state. */
282
302
  export declare function createReportDrillRequest(plan: RenderPlan, address: ReportCellAddress, action: ReportDrillAction, params?: Readonly<Record<string, string>>): ReportDrillRequest;
283
303
 
@@ -310,6 +330,8 @@ export declare function createTemplate(): TemplateBuilder;
310
330
  /** 持久化和框架无关的发布流程;历史返回快照,回滚会产生新修订而不会覆盖旧历史。 */
311
331
  export declare function createTemplateManager(store: ReportTemplateStore, options?: {
312
332
  migrate?: (input: unknown) => unknown | Promise<unknown>;
333
+ /** Explicit schema chain, applied to saved drafts and loaded/rolled-back documents. Legacy migrate remains save-only. */
334
+ migrations?: readonly ReportTemplateMigration[];
313
335
  now?: () => Date;
314
336
  /** Optional publication gate; receives explicit draft snapshots and never replaces CAS. */
315
337
  beforePublish?: (context: {
@@ -319,6 +341,9 @@ export declare function createTemplateManager(store: ReportTemplateStore, option
319
341
  }) => ReportTemplateReview | Promise<ReportTemplateReview>;
320
342
  }): ReportTemplateManager;
321
343
 
344
+ /** Explicit, bounded migration chain. Unknown/future versions are never silently downgraded. */
345
+ export declare function createTemplateMigrator(steps?: readonly ReportTemplateMigration[]): (input: unknown) => Promise<ReportTemplateMigrationResult>;
346
+
322
347
  /** 存储无关的模板目录;后台 CRUD、权限、发布审批与持久化由宿主接入。 */
323
348
  export declare function createTemplateRegistry(documents?: readonly ReportTemplateDocument[]): ReportTemplateRegistry;
324
349
 
@@ -409,6 +434,9 @@ export declare function evalStyleRule(row: Record<string, unknown>, when: StyleR
409
434
  /** A tiny arithmetic parser: no functions, property access, globals, assignments or executable source. */
410
435
  export declare function evaluateReportAggregateExpression(expression: string, values: Readonly<Record<string, number>>): number;
411
436
 
437
+ /** Derives locatable explanations only from explicit business declarations; never evaluates formulas. */
438
+ export declare function explainDatasetField(contract: DatasetContract, target: ReportDataTarget): ReportDiagnostic[];
439
+
412
440
  declare interface ExpressionOptions {
413
441
  numeric?: "number" | "decimal";
414
442
  digits?: number;
@@ -779,6 +807,26 @@ export declare interface LocalTemplateCatalogItem {
779
807
  /** O(action count), no row scans or listeners per cell; invoke for the focused cell only. */
780
808
  export declare function matchReportDrillActions(plan: RenderPlan, address: ReportCellAddress, actions: readonly ReportDrillAction[]): ReportDrillAction[];
781
809
 
810
+ declare interface MatrixAxisOptions {
811
+ /** Display names in the same outer-to-inner order as the dimension fields. */
812
+ labels?: readonly string[];
813
+ /** Per-level sibling order; omitted levels retain first-seen order. */
814
+ sort?: readonly MatrixDimensionOrder[];
815
+ /** One-based prefix depths. Leaf depths are not subtotals. */
816
+ subtotals?: readonly number[];
817
+ }
818
+
819
+ declare type MatrixDimensionOrder = "source" | "asc" | "desc";
820
+
821
+ declare interface MatrixHierarchyOptions {
822
+ row?: MatrixAxisOptions;
823
+ column?: MatrixAxisOptions;
824
+ /** Only null/missing values use this label; empty strings and zero stay distinct. */
825
+ emptyLabel?: string;
826
+ subtotalLabel?: string;
827
+ totalLabel?: string;
828
+ }
829
+
782
830
  declare interface MatrixTableOptions {
783
831
  rowFields: readonly string[];
784
832
  columnFields: readonly string[];
@@ -793,6 +841,10 @@ declare interface MatrixTableOptions {
793
841
  maxColumns?: number;
794
842
  maxInputRows?: number;
795
843
  maxCells?: number;
844
+ /** Opt-in hierarchical dimensions, physical merged headers and prefix subtotals. */
845
+ hierarchy?: MatrixHierarchyOptions;
846
+ /** Hierarchical aggregate work, checked before measure reads; default 10 million updates. */
847
+ maxAggregateUpdates?: number;
796
848
  }
797
849
 
798
850
  export declare function measurePageSizePx(page: Pick<PlanPage, "pageWidthMm" | "pageHeightMm">, dpi?: number): {
@@ -827,6 +879,11 @@ export declare interface OutputDiagnostic {
827
879
  componentPath?: readonly number[];
828
880
  kind: string;
829
881
  nid?: string;
882
+ /** Declarative extension identity only; no property values or business binding data enter diagnostics. */
883
+ extension?: {
884
+ id: string;
885
+ version: string;
886
+ };
830
887
  message: string;
831
888
  }
832
889
 
@@ -1225,6 +1282,74 @@ export declare type ReportCellValue = string | number | boolean | null;
1225
1282
 
1226
1283
  export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
1227
1284
 
1285
+ export declare interface ReportComponentExtensionBinding {
1286
+ id: string;
1287
+ version: string;
1288
+ props: Readonly<Record<string, ReportComponentValue>>;
1289
+ /** Host-defined JSON only: core does not execute queries, scripts or property paths in this binding. */
1290
+ binding?: ReportComponentJson;
1291
+ }
1292
+
1293
+ export declare interface ReportComponentExtensionContext extends ComponentImageContext {
1294
+ readonly extension: Readonly<ReportComponentExtensionBinding>;
1295
+ }
1296
+
1297
+ export declare interface ReportComponentExtensionDefinition extends ReportComponentExtensionMetadata {
1298
+ /** Trusted runtime loader, never read from template JSON or a remote import URL. */
1299
+ load(signal: AbortSignal): ReportComponentExtensionRenderer | Promise<ReportComponentExtensionRenderer>;
1300
+ }
1301
+
1302
+ export declare class ReportComponentExtensionError extends Error {
1303
+ readonly code: "definition" | "binding" | "load" | "disposed";
1304
+ readonly path: string;
1305
+ readonly extensionId?: string | undefined;
1306
+ constructor(code: "definition" | "binding" | "load" | "disposed", message: string, path?: string, extensionId?: string | undefined);
1307
+ }
1308
+
1309
+ export declare interface ReportComponentExtensionMetadata {
1310
+ id: string;
1311
+ version: string;
1312
+ kind: ImageComponentKind;
1313
+ label: string;
1314
+ description?: string;
1315
+ properties?: Readonly<Record<string, ReportComponentProperty>>;
1316
+ }
1317
+
1318
+ export declare interface ReportComponentExtensionRenderer {
1319
+ render(context: ReportComponentExtensionContext): string | Promise<string>;
1320
+ dispose?(): void | Promise<void>;
1321
+ }
1322
+
1323
+ export declare type ReportComponentJson = ReportComponentValue | readonly ReportComponentJson[] | {
1324
+ readonly [key: string]: ReportComponentJson;
1325
+ };
1326
+
1327
+ export declare interface ReportComponentProperty {
1328
+ label: string;
1329
+ type: "string" | "number" | "boolean";
1330
+ required?: boolean;
1331
+ default?: ReportComponentValue;
1332
+ options?: readonly ReportComponentValue[];
1333
+ min?: number;
1334
+ max?: number;
1335
+ maxLength?: number;
1336
+ }
1337
+
1338
+ export declare interface ReportComponentRegistry extends ComponentAssetRegistry {
1339
+ /** Pass directly as Preview/Runtime assets; no component-specific adapter wiring is needed. */
1340
+ readonly assets: Readonly<Pick<AssetRenderOptions, "assetRegistry">>;
1341
+ describe(kind?: ImageComponentKind): readonly Readonly<ReportComponentExtensionMetadata>[];
1342
+ /** Add native geometry and insert into the existing template/canvas command path. */
1343
+ createComponent(id: string, values?: {
1344
+ props?: Readonly<Record<string, ReportComponentValue>>;
1345
+ binding?: ReportComponentJson;
1346
+ }): Pick<PlanComponent, "kind" | "meta">;
1347
+ /** Idempotent. Abort active consumers, release loaded renderers, and release a late loader when it finishes. */
1348
+ dispose(): Promise<void>;
1349
+ }
1350
+
1351
+ export declare type ReportComponentValue = string | number | boolean | null;
1352
+
1228
1353
  export declare interface ReportDataTarget {
1229
1354
  datasetId: string;
1230
1355
  field: string;
@@ -1393,7 +1518,15 @@ export declare interface ReportFetchInput extends ReportTaskMonitoring {
1393
1518
  onQueryResult?: (reportId: string, result: ReportQueryResult, reportIndex?: number) => void;
1394
1519
  }
1395
1520
 
1396
- export declare interface ReportFieldContract {
1521
+ export declare type ReportFieldAggregation = "sum" | "avg" | "min" | "max" | "count" | "none";
1522
+
1523
+ export declare interface ReportFieldCalculation {
1524
+ /** Business-owned explanation, never executable JavaScript or an inferred business formula. */
1525
+ description: string;
1526
+ dependsOn: readonly string[];
1527
+ }
1528
+
1529
+ export declare interface ReportFieldContract extends ReportFieldSemantics {
1397
1530
  field: string;
1398
1531
  label?: string;
1399
1532
  type: "text" | "number" | "boolean" | "date" | "decimal";
@@ -1408,6 +1541,17 @@ export declare interface ReportFieldContract {
1408
1541
  unit?: string;
1409
1542
  }
1410
1543
 
1544
+ export declare interface ReportFieldSemantics {
1545
+ description?: string;
1546
+ /** Explicit meaning of null/missing; does not convert blanks into zero. */
1547
+ missingMeaning?: string;
1548
+ /** Recommended aggregation; none marks non-additive measures such as ratios. No aggregation runs implicitly. */
1549
+ aggregation?: ReportFieldAggregation;
1550
+ /** Shared presentation only; raw values and calculation precision remain unchanged. */
1551
+ format?: ColumnFormat;
1552
+ calculation?: ReportFieldCalculation;
1553
+ }
1554
+
1411
1555
  export declare interface ReportFlowBand {
1412
1556
  /** Exact stable component IDs. Static components use nid, lists use id. */
1413
1557
  componentIds: string[];
@@ -1703,6 +1847,26 @@ export declare interface ReportTemplateManager {
1703
1847
  rollback(id: string, revision: string, options: TemplateMutationOptions): Promise<ReportTemplateRecord>;
1704
1848
  }
1705
1849
 
1850
+ export declare interface ReportTemplateMigration {
1851
+ from: string;
1852
+ to: string;
1853
+ /** Pure document transformation; business data, credentials and I/O belong to the host. */
1854
+ migrate(input: Readonly<Record<string, unknown>>): unknown | Promise<unknown>;
1855
+ }
1856
+
1857
+ export declare class ReportTemplateMigrationError extends Error {
1858
+ readonly code: "definition" | "unsupported" | "result";
1859
+ constructor(code: "definition" | "unsupported" | "result", message: string);
1860
+ }
1861
+
1862
+ export declare interface ReportTemplateMigrationResult {
1863
+ document: ReportTemplateDocument;
1864
+ steps: readonly {
1865
+ from: string;
1866
+ to: string;
1867
+ }[];
1868
+ }
1869
+
1706
1870
  export declare interface ReportTemplateProvider {
1707
1871
  list(context: {
1708
1872
  signal?: AbortSignal;
@@ -1821,6 +1985,14 @@ export declare interface ReportTemplateVersion {
1821
1985
  /** Optional business explanations never replace raw data or schema validation. */
1822
1986
  export declare type ReportValueState = "missing-source" | "not-applicable" | "not-calculable";
1823
1987
 
1988
+ /** Preview coordinates only. Output plans and their complete geometry remain unchanged. */
1989
+ export declare interface ReportViewport {
1990
+ leftMm: number;
1991
+ topMm: number;
1992
+ widthMm: number;
1993
+ heightMm: number;
1994
+ }
1995
+
1824
1996
  /**
1825
1997
  * 边框开关解析:
1826
1998
  * - 未声明(undefined)→ 四边全开(与既有 rect 总有边框的行为兼容)
package/dist/index.d.ts CHANGED
@@ -42,6 +42,8 @@ export declare interface AssetRenderBudget {
42
42
 
43
43
  export declare interface AssetRenderOptions extends OutputDiagnosticOptions, ImageMediaOptions {
44
44
  assetRenderers?: Partial<Record<ImageComponentKind, ComponentImageRenderer>>;
45
+ /** Explicit id/version registry; unbound components continue using assetRenderers by kind. */
46
+ assetRegistry?: ComponentAssetRegistry;
45
47
  assetBudget?: AssetRenderBudget;
46
48
  /** Default throw prevents an incomplete export; placeholder retains the component and emits diagnostics. */
47
49
  assetFailure?: "throw" | "placeholder";
@@ -162,6 +164,11 @@ export declare type ColumnFormat = {
162
164
  /** 同一字段契约生成列语义和表头,业务侧无需复制另一份字段清单。 */
163
165
  export declare function columnsFromContract(contract: DatasetContract, overrides?: Record<string, Partial<TableTemplateColumn>>): TableTemplateColumn[];
164
166
 
167
+ export declare interface ComponentAssetRegistry {
168
+ rendererFor(component: Readonly<PlanComponent>): ComponentImageRenderer | undefined;
169
+ hasExtension(id: string, version: string, kind: string): boolean;
170
+ }
171
+
165
172
  /** A literal own field of the current label record; expressions and paths are not evaluated. */
166
173
  export declare interface ComponentBinding {
167
174
  field: string;
@@ -265,6 +272,16 @@ export declare function createLocalTemplateCatalog(input: LocalTemplateCatalogIt
265
272
  /** 单进程参考适配器;多实例服务请实现具备数据库事务/CAS 的持久化适配器。 */
266
273
  export declare function createMemoryTemplateStore(): ReportTemplateStore;
267
274
 
275
+ /** Owned preview controller; only mounted grids are windowed. Static renderPage and exports stay complete. */
276
+ export declare function createPageViewportRenderer(page: PlanPage, dpi: number, options: RenderOptions, doc: Document): {
277
+ element: HTMLElement;
278
+ update(viewport: ReportViewport, retained?: {
279
+ componentIndex: number;
280
+ rowIndex: number;
281
+ columnIndex: number;
282
+ }): boolean;
283
+ };
284
+
268
285
  export declare function createProviderReport(definition: Omit<ReportDefinition, "load" | "datasets"> & {
269
286
  provider: ReportProvider;
270
287
  }): ReportDefinition;
@@ -278,6 +295,9 @@ export declare function createReportCellEditBatch(plan: RenderPlan, inputs: read
278
295
  /** Operation-scoped index: avoids repeated geometry work without caching mutable plans globally. */
279
296
  export declare function createReportCellResolver(plan: RenderPlan): (address: ReportCellAddress) => ReportCellContext | null;
280
297
 
298
+ /** Explicit per-host registry. Templates contain bounded JSON bindings; loaders never come from a template. */
299
+ export declare function createReportComponentRegistry(definitions: readonly ReportComponentExtensionDefinition[]): ReportComponentRegistry;
300
+
281
301
  /** Revalidates the current cell on activation; returns only bounded scalar values and explicit return state. */
282
302
  export declare function createReportDrillRequest(plan: RenderPlan, address: ReportCellAddress, action: ReportDrillAction, params?: Readonly<Record<string, string>>): ReportDrillRequest;
283
303
 
@@ -310,6 +330,8 @@ export declare function createTemplate(): TemplateBuilder;
310
330
  /** 持久化和框架无关的发布流程;历史返回快照,回滚会产生新修订而不会覆盖旧历史。 */
311
331
  export declare function createTemplateManager(store: ReportTemplateStore, options?: {
312
332
  migrate?: (input: unknown) => unknown | Promise<unknown>;
333
+ /** Explicit schema chain, applied to saved drafts and loaded/rolled-back documents. Legacy migrate remains save-only. */
334
+ migrations?: readonly ReportTemplateMigration[];
313
335
  now?: () => Date;
314
336
  /** Optional publication gate; receives explicit draft snapshots and never replaces CAS. */
315
337
  beforePublish?: (context: {
@@ -319,6 +341,9 @@ export declare function createTemplateManager(store: ReportTemplateStore, option
319
341
  }) => ReportTemplateReview | Promise<ReportTemplateReview>;
320
342
  }): ReportTemplateManager;
321
343
 
344
+ /** Explicit, bounded migration chain. Unknown/future versions are never silently downgraded. */
345
+ export declare function createTemplateMigrator(steps?: readonly ReportTemplateMigration[]): (input: unknown) => Promise<ReportTemplateMigrationResult>;
346
+
322
347
  /** 存储无关的模板目录;后台 CRUD、权限、发布审批与持久化由宿主接入。 */
323
348
  export declare function createTemplateRegistry(documents?: readonly ReportTemplateDocument[]): ReportTemplateRegistry;
324
349
 
@@ -409,6 +434,9 @@ export declare function evalStyleRule(row: Record<string, unknown>, when: StyleR
409
434
  /** A tiny arithmetic parser: no functions, property access, globals, assignments or executable source. */
410
435
  export declare function evaluateReportAggregateExpression(expression: string, values: Readonly<Record<string, number>>): number;
411
436
 
437
+ /** Derives locatable explanations only from explicit business declarations; never evaluates formulas. */
438
+ export declare function explainDatasetField(contract: DatasetContract, target: ReportDataTarget): ReportDiagnostic[];
439
+
412
440
  declare interface ExpressionOptions {
413
441
  numeric?: "number" | "decimal";
414
442
  digits?: number;
@@ -779,6 +807,26 @@ export declare interface LocalTemplateCatalogItem {
779
807
  /** O(action count), no row scans or listeners per cell; invoke for the focused cell only. */
780
808
  export declare function matchReportDrillActions(plan: RenderPlan, address: ReportCellAddress, actions: readonly ReportDrillAction[]): ReportDrillAction[];
781
809
 
810
+ declare interface MatrixAxisOptions {
811
+ /** Display names in the same outer-to-inner order as the dimension fields. */
812
+ labels?: readonly string[];
813
+ /** Per-level sibling order; omitted levels retain first-seen order. */
814
+ sort?: readonly MatrixDimensionOrder[];
815
+ /** One-based prefix depths. Leaf depths are not subtotals. */
816
+ subtotals?: readonly number[];
817
+ }
818
+
819
+ declare type MatrixDimensionOrder = "source" | "asc" | "desc";
820
+
821
+ declare interface MatrixHierarchyOptions {
822
+ row?: MatrixAxisOptions;
823
+ column?: MatrixAxisOptions;
824
+ /** Only null/missing values use this label; empty strings and zero stay distinct. */
825
+ emptyLabel?: string;
826
+ subtotalLabel?: string;
827
+ totalLabel?: string;
828
+ }
829
+
782
830
  declare interface MatrixTableOptions {
783
831
  rowFields: readonly string[];
784
832
  columnFields: readonly string[];
@@ -793,6 +841,10 @@ declare interface MatrixTableOptions {
793
841
  maxColumns?: number;
794
842
  maxInputRows?: number;
795
843
  maxCells?: number;
844
+ /** Opt-in hierarchical dimensions, physical merged headers and prefix subtotals. */
845
+ hierarchy?: MatrixHierarchyOptions;
846
+ /** Hierarchical aggregate work, checked before measure reads; default 10 million updates. */
847
+ maxAggregateUpdates?: number;
796
848
  }
797
849
 
798
850
  export declare function measurePageSizePx(page: Pick<PlanPage, "pageWidthMm" | "pageHeightMm">, dpi?: number): {
@@ -827,6 +879,11 @@ export declare interface OutputDiagnostic {
827
879
  componentPath?: readonly number[];
828
880
  kind: string;
829
881
  nid?: string;
882
+ /** Declarative extension identity only; no property values or business binding data enter diagnostics. */
883
+ extension?: {
884
+ id: string;
885
+ version: string;
886
+ };
830
887
  message: string;
831
888
  }
832
889
 
@@ -1225,6 +1282,74 @@ export declare type ReportCellValue = string | number | boolean | null;
1225
1282
 
1226
1283
  export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
1227
1284
 
1285
+ export declare interface ReportComponentExtensionBinding {
1286
+ id: string;
1287
+ version: string;
1288
+ props: Readonly<Record<string, ReportComponentValue>>;
1289
+ /** Host-defined JSON only: core does not execute queries, scripts or property paths in this binding. */
1290
+ binding?: ReportComponentJson;
1291
+ }
1292
+
1293
+ export declare interface ReportComponentExtensionContext extends ComponentImageContext {
1294
+ readonly extension: Readonly<ReportComponentExtensionBinding>;
1295
+ }
1296
+
1297
+ export declare interface ReportComponentExtensionDefinition extends ReportComponentExtensionMetadata {
1298
+ /** Trusted runtime loader, never read from template JSON or a remote import URL. */
1299
+ load(signal: AbortSignal): ReportComponentExtensionRenderer | Promise<ReportComponentExtensionRenderer>;
1300
+ }
1301
+
1302
+ export declare class ReportComponentExtensionError extends Error {
1303
+ readonly code: "definition" | "binding" | "load" | "disposed";
1304
+ readonly path: string;
1305
+ readonly extensionId?: string | undefined;
1306
+ constructor(code: "definition" | "binding" | "load" | "disposed", message: string, path?: string, extensionId?: string | undefined);
1307
+ }
1308
+
1309
+ export declare interface ReportComponentExtensionMetadata {
1310
+ id: string;
1311
+ version: string;
1312
+ kind: ImageComponentKind;
1313
+ label: string;
1314
+ description?: string;
1315
+ properties?: Readonly<Record<string, ReportComponentProperty>>;
1316
+ }
1317
+
1318
+ export declare interface ReportComponentExtensionRenderer {
1319
+ render(context: ReportComponentExtensionContext): string | Promise<string>;
1320
+ dispose?(): void | Promise<void>;
1321
+ }
1322
+
1323
+ export declare type ReportComponentJson = ReportComponentValue | readonly ReportComponentJson[] | {
1324
+ readonly [key: string]: ReportComponentJson;
1325
+ };
1326
+
1327
+ export declare interface ReportComponentProperty {
1328
+ label: string;
1329
+ type: "string" | "number" | "boolean";
1330
+ required?: boolean;
1331
+ default?: ReportComponentValue;
1332
+ options?: readonly ReportComponentValue[];
1333
+ min?: number;
1334
+ max?: number;
1335
+ maxLength?: number;
1336
+ }
1337
+
1338
+ export declare interface ReportComponentRegistry extends ComponentAssetRegistry {
1339
+ /** Pass directly as Preview/Runtime assets; no component-specific adapter wiring is needed. */
1340
+ readonly assets: Readonly<Pick<AssetRenderOptions, "assetRegistry">>;
1341
+ describe(kind?: ImageComponentKind): readonly Readonly<ReportComponentExtensionMetadata>[];
1342
+ /** Add native geometry and insert into the existing template/canvas command path. */
1343
+ createComponent(id: string, values?: {
1344
+ props?: Readonly<Record<string, ReportComponentValue>>;
1345
+ binding?: ReportComponentJson;
1346
+ }): Pick<PlanComponent, "kind" | "meta">;
1347
+ /** Idempotent. Abort active consumers, release loaded renderers, and release a late loader when it finishes. */
1348
+ dispose(): Promise<void>;
1349
+ }
1350
+
1351
+ export declare type ReportComponentValue = string | number | boolean | null;
1352
+
1228
1353
  export declare interface ReportDataTarget {
1229
1354
  datasetId: string;
1230
1355
  field: string;
@@ -1393,7 +1518,15 @@ export declare interface ReportFetchInput extends ReportTaskMonitoring {
1393
1518
  onQueryResult?: (reportId: string, result: ReportQueryResult, reportIndex?: number) => void;
1394
1519
  }
1395
1520
 
1396
- export declare interface ReportFieldContract {
1521
+ export declare type ReportFieldAggregation = "sum" | "avg" | "min" | "max" | "count" | "none";
1522
+
1523
+ export declare interface ReportFieldCalculation {
1524
+ /** Business-owned explanation, never executable JavaScript or an inferred business formula. */
1525
+ description: string;
1526
+ dependsOn: readonly string[];
1527
+ }
1528
+
1529
+ export declare interface ReportFieldContract extends ReportFieldSemantics {
1397
1530
  field: string;
1398
1531
  label?: string;
1399
1532
  type: "text" | "number" | "boolean" | "date" | "decimal";
@@ -1408,6 +1541,17 @@ export declare interface ReportFieldContract {
1408
1541
  unit?: string;
1409
1542
  }
1410
1543
 
1544
+ export declare interface ReportFieldSemantics {
1545
+ description?: string;
1546
+ /** Explicit meaning of null/missing; does not convert blanks into zero. */
1547
+ missingMeaning?: string;
1548
+ /** Recommended aggregation; none marks non-additive measures such as ratios. No aggregation runs implicitly. */
1549
+ aggregation?: ReportFieldAggregation;
1550
+ /** Shared presentation only; raw values and calculation precision remain unchanged. */
1551
+ format?: ColumnFormat;
1552
+ calculation?: ReportFieldCalculation;
1553
+ }
1554
+
1411
1555
  export declare interface ReportFlowBand {
1412
1556
  /** Exact stable component IDs. Static components use nid, lists use id. */
1413
1557
  componentIds: string[];
@@ -1703,6 +1847,26 @@ export declare interface ReportTemplateManager {
1703
1847
  rollback(id: string, revision: string, options: TemplateMutationOptions): Promise<ReportTemplateRecord>;
1704
1848
  }
1705
1849
 
1850
+ export declare interface ReportTemplateMigration {
1851
+ from: string;
1852
+ to: string;
1853
+ /** Pure document transformation; business data, credentials and I/O belong to the host. */
1854
+ migrate(input: Readonly<Record<string, unknown>>): unknown | Promise<unknown>;
1855
+ }
1856
+
1857
+ export declare class ReportTemplateMigrationError extends Error {
1858
+ readonly code: "definition" | "unsupported" | "result";
1859
+ constructor(code: "definition" | "unsupported" | "result", message: string);
1860
+ }
1861
+
1862
+ export declare interface ReportTemplateMigrationResult {
1863
+ document: ReportTemplateDocument;
1864
+ steps: readonly {
1865
+ from: string;
1866
+ to: string;
1867
+ }[];
1868
+ }
1869
+
1706
1870
  export declare interface ReportTemplateProvider {
1707
1871
  list(context: {
1708
1872
  signal?: AbortSignal;
@@ -1821,6 +1985,14 @@ export declare interface ReportTemplateVersion {
1821
1985
  /** Optional business explanations never replace raw data or schema validation. */
1822
1986
  export declare type ReportValueState = "missing-source" | "not-applicable" | "not-calculable";
1823
1987
 
1988
+ /** Preview coordinates only. Output plans and their complete geometry remain unchanged. */
1989
+ export declare interface ReportViewport {
1990
+ leftMm: number;
1991
+ topMm: number;
1992
+ widthMm: number;
1993
+ heightMm: number;
1994
+ }
1995
+
1824
1996
  /**
1825
1997
  * 边框开关解析:
1826
1998
  * - 未声明(undefined)→ 四边全开(与既有 rect 总有边框的行为兼容)