@agile-team/mach-report 2.10.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +6 -2
  2. package/dist/ExcelBindingWizard-CjIiVox-.cjs +1 -0
  3. package/dist/ExcelBindingWizard-Dxm-K5HL.js +1240 -0
  4. package/dist/ParamEditor-D-Hf5xfO.cjs +1 -0
  5. package/dist/ParamEditor-DRGxzxeO.js +381 -0
  6. package/dist/ReportBatchPanel-BYgg0EDB.cjs +1 -0
  7. package/dist/ReportBatchPanel-Bby5yLzU.js +287 -0
  8. package/dist/ReportPreview-DWXROHBP.cjs +6 -0
  9. package/dist/ReportPreview-DiNXhQI0.js +4138 -0
  10. package/dist/ReportTemplateLibrary-C6CO7YCT.cjs +1 -0
  11. package/dist/ReportTemplateLibrary-DfzDXRvr.js +260 -0
  12. package/dist/RuleEditor-C2QsOHOs.cjs +1 -0
  13. package/dist/RuleEditor-D9wQHrkf.js +2024 -0
  14. package/dist/TemplateReviewPanel-BKofGrV9.js +222 -0
  15. package/dist/TemplateReviewPanel-DwtOcLue.cjs +1 -0
  16. package/dist/analytics.cjs +1 -1
  17. package/dist/analytics.d.cts +2 -0
  18. package/dist/analytics.d.ts +2 -0
  19. package/dist/analytics.js +29 -29
  20. package/dist/batch-Bt3Fd27Z.cjs +1 -0
  21. package/dist/batch-mRqhhhjt.js +364 -0
  22. package/dist/computed-Bvk0W15F.js +521 -0
  23. package/dist/computed-CGV2a809.cjs +1 -0
  24. package/dist/config-B612mw0x.js +525 -0
  25. package/dist/config-BRoLo2oj.cjs +1 -0
  26. package/dist/designer.cjs +2 -2
  27. package/dist/designer.d.cts +659 -9
  28. package/dist/designer.d.ts +659 -9
  29. package/dist/designer.js +2030 -1824
  30. package/dist/index.cjs +8 -8
  31. package/dist/index.d.cts +147 -3
  32. package/dist/index.d.ts +147 -3
  33. package/dist/index.js +639 -592
  34. package/dist/injection-keys-Db_DyLkm.cjs +1 -0
  35. package/dist/injection-keys-e85udZCp.js +7 -0
  36. package/dist/list-cell-BuYn4tGF.cjs +1 -0
  37. package/dist/{list-cell-Dxyi7DOw.js → list-cell-ClFra1zS.js} +54 -40
  38. package/dist/matrix-DVyWiYsd.cjs +1 -0
  39. package/dist/matrix-yZsGnldA.js +227 -0
  40. package/dist/param-validation-BlHHXs6u.js +153 -0
  41. package/dist/param-validation-DCK039V1.cjs +1 -0
  42. package/dist/pdf.cjs +25 -25
  43. package/dist/pdf.d.cts +3 -0
  44. package/dist/pdf.d.ts +3 -0
  45. package/dist/pdf.js +677 -677
  46. package/dist/plugin-BDTU4D94.cjs +1 -0
  47. package/dist/plugin-Cd5G2QQn.js +22 -0
  48. package/dist/region-binding-workflow-CXDmt9Bs.js +977 -0
  49. package/dist/region-binding-workflow-DhQvu1co.cjs +3 -0
  50. package/dist/{report-params-B_VCihAh.js → report-params-B44imUd4.js} +1 -1
  51. package/dist/{report-params-CjWrjPl6.cjs → report-params-SJfhKgaX.cjs} +1 -1
  52. package/dist/server/node.d.cts +5 -2
  53. package/dist/server/node.d.ts +5 -2
  54. package/dist/server-node.cjs +1 -1
  55. package/dist/server-node.js +87 -87
  56. package/dist/server.cjs +1 -1
  57. package/dist/server.d.cts +201 -2
  58. package/dist/server.d.ts +201 -2
  59. package/dist/server.js +557 -658
  60. package/dist/style.css +1 -1
  61. package/dist/template-registry-WNXdkiET.js +506 -0
  62. package/dist/template-registry-ukBGlm8N.cjs +1 -0
  63. package/dist/template-review-BXp2oyqg.cjs +1 -0
  64. package/dist/template-review-BdcXSYbx.js +1616 -0
  65. package/dist/tree-BX380Rr7.cjs +1 -0
  66. package/dist/tree-CqcQ99NM.js +172 -0
  67. package/dist/{validate-UUy9yP4K.js → validate-7s0yn6ii.js} +44 -44
  68. package/dist/validate-DsRiNw8h.cjs +1 -0
  69. package/dist/vue/async.d.cts +93 -4
  70. package/dist/vue/async.d.ts +93 -4
  71. package/dist/vue/index.d.cts +145 -7
  72. package/dist/vue/index.d.ts +145 -7
  73. package/dist/vue-async.cjs +1 -1
  74. package/dist/vue-async.js +5 -5
  75. package/dist/vue.cjs +1 -1
  76. package/dist/vue.js +116 -113
  77. package/dist/{workbook-session-B-bW5_yR.js → workbook-session-BKOTwcoq.js} +1 -1
  78. package/dist/{workbook-session-D7RtdNo0.cjs → workbook-session-CLYLhZWu.cjs} +1 -1
  79. package/dist/worker.cjs +1 -1
  80. package/dist/worker.d.cts +5 -2
  81. package/dist/worker.d.ts +5 -2
  82. package/dist/worker.js +1 -1
  83. package/dist/xlsx.cjs +3 -3
  84. package/dist/xlsx.d.cts +129 -2
  85. package/dist/xlsx.d.ts +129 -2
  86. package/dist/xlsx.js +336 -242
  87. package/package.json +1 -1
  88. package/dist/ExcelBindingWizard-CF7RplWm.cjs +0 -1
  89. package/dist/ExcelBindingWizard-qhwEderR.js +0 -842
  90. package/dist/ReportPreview-BE1tCHqE.js +0 -4604
  91. package/dist/ReportPreview-QKRKQOe3.cjs +0 -6
  92. package/dist/RuleEditor-BA36yIV6.js +0 -1723
  93. package/dist/RuleEditor-CczJ6mJm.cjs +0 -1
  94. package/dist/TemplateReviewPanel-CHi4Alqa.cjs +0 -1
  95. package/dist/TemplateReviewPanel-Dz0G5o83.js +0 -217
  96. package/dist/binding-preview-BWsdf_z2.cjs +0 -2
  97. package/dist/binding-preview-DILq0-0f.js +0 -649
  98. package/dist/decimal-CI1OAczk.js +0 -87
  99. package/dist/decimal-CQA0xJex.cjs +0 -1
  100. package/dist/list-cell-CyM1ZlRN.cjs +0 -1
  101. package/dist/matrix-BbXarwyk.js +0 -661
  102. package/dist/matrix-Cm65WLLP.cjs +0 -1
  103. package/dist/param-validation-BWNjLcN0.js +0 -116
  104. package/dist/param-validation-CiTxFeZ8.cjs +0 -1
  105. package/dist/plugin-CThk42vJ.cjs +0 -1
  106. package/dist/plugin-tGn7-5oF.js +0 -25
  107. package/dist/template-registry-CGWTLtIA.cjs +0 -1
  108. package/dist/template-registry-DzlQs3OF.js +0 -434
  109. package/dist/template-review-D1RoNCPw.cjs +0 -1
  110. package/dist/template-review-fnteXRng.js +0 -1473
  111. package/dist/validate-Bf6ccFr2.cjs +0 -1
package/dist/index.d.ts CHANGED
@@ -108,6 +108,11 @@ export declare type ClassKey = "root" | "page" | "comp" | "text" | "lines" | "li
108
108
 
109
109
  export declare function classOf(key: ClassKey, options?: RenderOptions): string;
110
110
 
111
+ export declare function cloneReportTemplate(document: ReportTemplateDocument, identity: {
112
+ id: string;
113
+ name: string;
114
+ }): ReportTemplateDocument;
115
+
111
116
  /**
112
117
  * 列值格式化(声明式、JSON 可序列化)。
113
118
  * 在 paginate 的 cellText 出口统一消费:格式化发生在进 RenderPlan 之前,
@@ -170,6 +175,15 @@ export declare interface ComponentStyle {
170
175
  rotateDeg?: number;
171
176
  }
172
177
 
178
+ declare interface ComputedDatasetOptions {
179
+ fields: readonly ComputedField[];
180
+ formula?: FormulaAdapter;
181
+ maxRows?: number;
182
+ maxCells?: number;
183
+ signal?: AbortSignal;
184
+ onError?: "throw" | "null";
185
+ }
186
+
173
187
  declare interface ComputedField extends ExpressionOptions {
174
188
  field: string;
175
189
  expression: ReportExpression | string;
@@ -205,6 +219,13 @@ export declare function createCanvasPager(plan: RenderPlan, options?: CanvasPage
205
219
  /** 兼容旧 API:默认启发式测量 */
206
220
  export declare function createHeuristicMeasurer(): TextMeasurer;
207
221
 
222
+ /** Local catalog reference; an enterprise host supplies the same search/get contract with server filtering. */
223
+ export declare function createLocalTemplateCatalog(input: Array<{
224
+ document: ReportTemplateDocument;
225
+ category?: string;
226
+ tags?: string[];
227
+ }>): ReportTemplateCatalogProvider;
228
+
208
229
  /** 单进程参考适配器;多实例服务请实现具备数据库事务/CAS 的持久化适配器。 */
209
230
  export declare function createMemoryTemplateStore(): ReportTemplateStore;
210
231
 
@@ -262,8 +283,16 @@ export declare function createTemplateManager(store: ReportTemplateStore, option
262
283
  /** 存储无关的模板目录;后台 CRUD、权限、发布审批与持久化由宿主接入。 */
263
284
  export declare function createTemplateRegistry(documents?: readonly ReportTemplateDocument[]): ReportTemplateRegistry;
264
285
 
286
+ /** O(n) identity index, iterative bounded traversal, no input mutation or recursive stack. */
287
+ export declare function createTreeTable(input: readonly DataRow[], options: TreeTableOptions, execution?: {
288
+ signal?: AbortSignal;
289
+ computed?: ComputedDatasetOptions;
290
+ }): TreeTable;
291
+
265
292
  export declare const CSS_DPI = 96;
266
293
 
294
+ declare type DataRow = Record<string, unknown>;
295
+
267
296
  export declare interface DatasetContract {
268
297
  fields: readonly ReportFieldContract[];
269
298
  rowKey?: string;
@@ -319,7 +348,6 @@ export declare function diffReportTemplates(previous: ReportTemplateDocument, ne
319
348
  maxChanges?: number;
320
349
  }): ReportTemplateDiff;
321
350
 
322
- /** Conservative cell allocation estimate; relation validation rejects duplicate master keys before rendering. */
323
351
  export declare function estimateListLayoutCells(list: ListComponent, datasets: DatasetRows, options?: Pick<PaginateOptions, "formula" | "signal">): number;
324
352
 
325
353
  /**
@@ -345,6 +373,8 @@ export declare function formatReportCellEdit(context: ReportCellContext, value:
345
373
  /** TSV with Excel-compatible quoting; quoted line breaks remain inside their cells. */
346
374
  export declare function formatReportClipboard(rows: readonly (readonly string[])[]): string;
347
375
 
376
+ export declare function formatReportDateRange(range: ReportDateRange): string;
377
+
348
378
  /**
349
379
  * 应用格式化。非数值/无法解析时原样返回基础文本(降级不报错):
350
380
  * - number:digits 小数位 + 可选千分位(12,345.60;thousands 默认 false)
@@ -375,6 +405,8 @@ export declare interface GridCell {
375
405
  value?: string | number | boolean | null;
376
406
  /** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
377
407
  numberFormat?: string;
408
+ /** Physical left inset for hierarchical labels; raw value stays unchanged. */
409
+ indentMm?: number;
378
410
  /** 编辑输入类型;省略时只按原始值推断,数字字符串不会被转换为数值。 */
379
411
  valueType?: "text" | "number" | "boolean";
380
412
  /** 单元格级编辑控制;预览仍需显式开启 editing。 */
@@ -446,6 +478,10 @@ export declare function isImageBackedComponent(comp: PlanComponent): boolean;
446
478
 
447
479
  export declare function isReportDate(value: string): boolean;
448
480
 
481
+ export declare function isReportMonth(value: string): boolean;
482
+
483
+ export declare function isReportYear(value: string): boolean;
484
+
449
485
  export declare function isRichText(comp: PlanComponent): boolean;
450
486
 
451
487
  /** 默认行高倍数(基线距 = 字号 × 该系数) */
@@ -482,6 +518,8 @@ export declare interface ListColumn {
482
518
 
483
519
  export declare interface ListComponent {
484
520
  kind: "list";
521
+ /** Opaque serializable layout annotations; interpreted only by explicit optional adapters. */
522
+ meta?: Record<string, unknown>;
485
523
  id?: string;
486
524
  /** 宽表标记用于连续 Excel;不改变低层列表的列宽和分页算法。 */
487
525
  layout?: "page" | "wide";
@@ -491,6 +529,10 @@ export declare interface ListComponent {
491
529
  topMm: number;
492
530
  widthMm: number;
493
531
  dataset: string;
532
+ /** Headerless record/region bindings do not allocate a synthetic list header. */
533
+ header?: boolean;
534
+ /** A fixed record region rejects multiple rows instead of dropping source data. */
535
+ cardinality?: "record";
494
536
  /** 数据集中稳定业务主键的字段名;省略时编辑仅有计划内坐标。 */
495
537
  rowKey?: string;
496
538
  revisionField?: string;
@@ -517,6 +559,8 @@ export declare interface ListComponent {
517
559
  computed?: ComputedField[];
518
560
  /** Dynamic pivot of the current source dataset, with read-only derived identities. */
519
561
  matrix?: MatrixTableOptions;
562
+ /** Full ordered hierarchy; source parent values and descendant-leaf rollups are explicit. */
563
+ tree?: TreeTableOptions;
520
564
  /** Explicit row visibility; hidden rows do not participate in summaries. */
521
565
  rowVisibleWhen?: StyleRule["when"];
522
566
  /** Master/detail relation is keyed by business identity, never by display row index. */
@@ -741,6 +785,9 @@ export declare function parseReportCellInput(context: ReportCellContext, input:
741
785
  /** Bounded parser for clipboard data; invalid quotes are rejected before edits are built. */
742
786
  export declare function parseReportClipboard(text: string, maxCells?: number): string[][];
743
787
 
788
+ /** Only complete, ordered, real calendar dates are accepted; there is no timezone conversion. */
789
+ export declare function parseReportDateRange(value: string): ReportDateRange | undefined;
790
+
744
791
  /** 校验文件 JSON 文本或接口返回的未知对象,返回独立模板快照。 */
745
792
  export declare function parseReportTemplate(input: unknown): ReportTemplateDocument;
746
793
 
@@ -786,6 +833,7 @@ export declare interface PlanGrid {
786
833
  }
787
834
 
788
835
  export declare interface PlanPage {
836
+ meta?: Record<string, unknown>;
789
837
  /** wide 表示完整自然列宽;页面仅为预览的垂直窗口分段。 */
790
838
  layout?: "page" | "wide";
791
839
  pageWidthMm: number;
@@ -995,6 +1043,12 @@ export declare type ReportCellValue = string | number | boolean | null;
995
1043
 
996
1044
  export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
997
1045
 
1046
+ /** Wire values deliberately remain strings in browsers, Workers and backend runtimes. */
1047
+ export declare interface ReportDateRange {
1048
+ start: string;
1049
+ end: string;
1050
+ }
1051
+
998
1052
  export declare interface ReportDefinition {
999
1053
  /** 静态模板或宿主提供的异步模板加载器;动态模板默认每次重新读取,不缓存版本。 */
1000
1054
  template: ReportTemplate | ReportTemplateLoader;
@@ -1108,6 +1162,14 @@ export declare interface ReportFieldContract {
1108
1162
  unit?: string;
1109
1163
  }
1110
1164
 
1165
+ export declare interface ReportFlowBand {
1166
+ /** Exact stable component IDs. Static components use nid, lists use id. */
1167
+ componentIds: string[];
1168
+ /** Source-template coordinates; following bands keep their original gap. */
1169
+ topMm: number;
1170
+ heightMm: number;
1171
+ }
1172
+
1111
1173
  export declare interface ReportHistoryPreparation {
1112
1174
  batch: ReportEditBatch;
1113
1175
  prepared: ReportPreparedEdit;
@@ -1123,13 +1185,17 @@ export declare interface ReportLoadContext {
1123
1185
 
1124
1186
  export declare function reportOutputDiagnostics(plan: RenderPlan, format: OutputFormat, options: OutputDiagnosticOptions): OutputDiagnostic[];
1125
1187
 
1188
+ export declare interface ReportPageFlow {
1189
+ bands: ReportFlowBand[];
1190
+ }
1191
+
1126
1192
  /** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
1127
1193
  export declare interface ReportParamDef {
1128
1194
  /** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
1129
1195
  field: string;
1130
1196
  /** 显示名(缺省用 field) */
1131
1197
  label?: string;
1132
- type?: "text" | "number" | "date" | "select";
1198
+ type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
1133
1199
  /** select 选项 */
1134
1200
  options?: Array<{
1135
1201
  label: string;
@@ -1138,7 +1204,7 @@ export declare interface ReportParamDef {
1138
1204
  defaultValue?: string;
1139
1205
  required?: boolean;
1140
1206
  placeholder?: string;
1141
- /** 数字上下界;date 参数使用 YYYY-MM-DD 字符串(含边界)。 */
1207
+ /** 数字上下界;日期/月/年使用对应规范字符串;dateRange 对两端使用 YYYY-MM-DD 边界(含边界)。 */
1142
1208
  min?: number | string;
1143
1209
  max?: number | string;
1144
1210
  minLength?: number;
@@ -1284,6 +1350,38 @@ export declare interface ReportTemplate {
1284
1350
  pages: TemplatePage[];
1285
1351
  }
1286
1352
 
1353
+ export declare interface ReportTemplateCatalogEntry extends ReportTemplateSummary {
1354
+ category?: string;
1355
+ tags?: string[];
1356
+ updatedAt?: string;
1357
+ }
1358
+
1359
+ export declare interface ReportTemplateCatalogPage {
1360
+ items: ReportTemplateCatalogEntry[];
1361
+ next?: string;
1362
+ categories?: Array<{
1363
+ id: string;
1364
+ label: string;
1365
+ count?: number;
1366
+ }>;
1367
+ }
1368
+
1369
+ /** Discovery metadata is separate from executable templates and from enterprise account authorization. */
1370
+ export declare interface ReportTemplateCatalogProvider {
1371
+ search(request: ReportTemplateCatalogQuery): Promise<ReportTemplateCatalogPage>;
1372
+ get(id: string, context: {
1373
+ signal?: AbortSignal;
1374
+ }): Promise<ReportTemplateDocument | undefined>;
1375
+ }
1376
+
1377
+ export declare interface ReportTemplateCatalogQuery {
1378
+ query?: string;
1379
+ category?: string;
1380
+ cursor?: string;
1381
+ limit?: number;
1382
+ signal?: AbortSignal;
1383
+ }
1384
+
1287
1385
  export declare interface ReportTemplateChange {
1288
1386
  kind: "added" | "removed" | "modified" | "moved";
1289
1387
  category: "metadata" | "structure" | "binding" | "calculation" | "format";
@@ -1614,6 +1712,9 @@ export declare interface TemplatePage {
1614
1712
  marginLeftMm?: number;
1615
1713
  marginRightMm?: number;
1616
1714
  components: TemplateComponent[];
1715
+ /** Explicit vertical bands preserve source gaps as dynamic regions expand. */
1716
+ flow?: ReportPageFlow;
1717
+ meta?: Record<string, unknown>;
1617
1718
  }
1618
1719
 
1619
1720
  export declare interface TemplateStoreWriteOptions {
@@ -1646,6 +1747,46 @@ export declare function toExcelNumberFormat(format?: ColumnFormat): string | und
1646
1747
 
1647
1748
  export declare function toNumber(value: unknown): number | null;
1648
1749
 
1750
+ export declare interface TreeRow {
1751
+ row: DataRow;
1752
+ original: DataRow;
1753
+ key: string | number;
1754
+ depth: number;
1755
+ hasChildren: boolean;
1756
+ }
1757
+
1758
+ export declare class TreeRowLimitError extends Error {
1759
+ readonly limit: number;
1760
+ readonly code = "tree-row-limit";
1761
+ constructor(limit: number);
1762
+ }
1763
+
1764
+ export declare interface TreeTable {
1765
+ rows: DataRow[];
1766
+ entries: TreeRow[];
1767
+ leaves: DataRow[];
1768
+ }
1769
+
1770
+ /** A serialized tree contract. Sibling and root order follow input order. */
1771
+ export declare interface TreeTableOptions {
1772
+ input: "flat" | "nested";
1773
+ idField: string;
1774
+ /** Flat roots have null/undefined parent values. */
1775
+ parentField?: string;
1776
+ /** Nested child arrays, defaults to children. Every node still needs an ID. */
1777
+ childrenField?: string;
1778
+ labelField: string;
1779
+ indentMm?: number;
1780
+ orphan?: "error" | "root";
1781
+ /** Source preserves parent values; leaf-aggregate derives only parents from descendant leaves. */
1782
+ parentValues?: "source" | "leaf-aggregate";
1783
+ aggregates?: AggregateDefinition[];
1784
+ maxRows?: number;
1785
+ maxDepth?: number;
1786
+ /** Bounded leaf-to-ancestor aggregate work; default one million. */
1787
+ maxAggregationVisits?: number;
1788
+ }
1789
+
1649
1790
  export declare function validateComponent(comp: unknown, path: string, errors: ValidationError[], warnings?: ValidationError[]): void;
1650
1791
 
1651
1792
  /** 浏览器/Node共用的只读值校验;返回精确路径,不以0或空数组掩盖接口结构错误。 */
@@ -1672,6 +1813,9 @@ export declare function validateReportTemplate(input: unknown): ValidationResult
1672
1813
 
1673
1814
  export declare function validateReportTemplateDocument(input: unknown): ValidationResult;
1674
1815
 
1816
+ /** Validates runtime inputs too, so direct core calls cannot bypass template checks. */
1817
+ export declare function validateTreeOptions(options: TreeTableOptions): void;
1818
+
1675
1819
  export declare interface ValidationError {
1676
1820
  path: string;
1677
1821
  message: string;