@agile-team/mach-report 2.10.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +6 -2
  2. package/dist/ExcelBindingWizard-LWX6G1A2.js +1465 -0
  3. package/dist/ExcelBindingWizard-a4kslPHF.cjs +1 -0
  4. package/dist/ParamEditor-BLaE5q5W.js +522 -0
  5. package/dist/ParamEditor-MBBC7lUE.cjs +1 -0
  6. package/dist/ReportBatchPanel-B5ClP9tm.js +350 -0
  7. package/dist/ReportBatchPanel-Dc-SDkYA.cjs +1 -0
  8. package/dist/ReportPreview-DWXROHBP.cjs +6 -0
  9. package/dist/ReportPreview-DiNXhQI0.js +4138 -0
  10. package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +1 -0
  11. package/dist/ReportTemplateLibrary-BZB-XWjj.js +311 -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 +730 -9
  28. package/dist/designer.d.ts +730 -9
  29. package/dist/designer.js +2093 -1785
  30. package/dist/index.cjs +8 -8
  31. package/dist/index.d.cts +161 -3
  32. package/dist/index.d.ts +161 -3
  33. package/dist/index.js +486 -431
  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,9 @@ 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: LocalTemplateCatalogItem[]): ReportTemplateCatalogProvider;
224
+
208
225
  /** 单进程参考适配器;多实例服务请实现具备数据库事务/CAS 的持久化适配器。 */
209
226
  export declare function createMemoryTemplateStore(): ReportTemplateStore;
210
227
 
@@ -262,8 +279,16 @@ export declare function createTemplateManager(store: ReportTemplateStore, option
262
279
  /** 存储无关的模板目录;后台 CRUD、权限、发布审批与持久化由宿主接入。 */
263
280
  export declare function createTemplateRegistry(documents?: readonly ReportTemplateDocument[]): ReportTemplateRegistry;
264
281
 
282
+ /** O(n) identity index, iterative bounded traversal, no input mutation or recursive stack. */
283
+ export declare function createTreeTable(input: readonly DataRow[], options: TreeTableOptions, execution?: {
284
+ signal?: AbortSignal;
285
+ computed?: ComputedDatasetOptions;
286
+ }): TreeTable;
287
+
265
288
  export declare const CSS_DPI = 96;
266
289
 
290
+ declare type DataRow = Record<string, unknown>;
291
+
267
292
  export declare interface DatasetContract {
268
293
  fields: readonly ReportFieldContract[];
269
294
  rowKey?: string;
@@ -319,7 +344,6 @@ export declare function diffReportTemplates(previous: ReportTemplateDocument, ne
319
344
  maxChanges?: number;
320
345
  }): ReportTemplateDiff;
321
346
 
322
- /** Conservative cell allocation estimate; relation validation rejects duplicate master keys before rendering. */
323
347
  export declare function estimateListLayoutCells(list: ListComponent, datasets: DatasetRows, options?: Pick<PaginateOptions, "formula" | "signal">): number;
324
348
 
325
349
  /**
@@ -345,6 +369,8 @@ export declare function formatReportCellEdit(context: ReportCellContext, value:
345
369
  /** TSV with Excel-compatible quoting; quoted line breaks remain inside their cells. */
346
370
  export declare function formatReportClipboard(rows: readonly (readonly string[])[]): string;
347
371
 
372
+ export declare function formatReportDateRange(range: ReportDateRange): string;
373
+
348
374
  /**
349
375
  * 应用格式化。非数值/无法解析时原样返回基础文本(降级不报错):
350
376
  * - number:digits 小数位 + 可选千分位(12,345.60;thousands 默认 false)
@@ -375,6 +401,8 @@ export declare interface GridCell {
375
401
  value?: string | number | boolean | null;
376
402
  /** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
377
403
  numberFormat?: string;
404
+ /** Physical left inset for hierarchical labels; raw value stays unchanged. */
405
+ indentMm?: number;
378
406
  /** 编辑输入类型;省略时只按原始值推断,数字字符串不会被转换为数值。 */
379
407
  valueType?: "text" | "number" | "boolean";
380
408
  /** 单元格级编辑控制;预览仍需显式开启 editing。 */
@@ -446,6 +474,10 @@ export declare function isImageBackedComponent(comp: PlanComponent): boolean;
446
474
 
447
475
  export declare function isReportDate(value: string): boolean;
448
476
 
477
+ export declare function isReportMonth(value: string): boolean;
478
+
479
+ export declare function isReportYear(value: string): boolean;
480
+
449
481
  export declare function isRichText(comp: PlanComponent): boolean;
450
482
 
451
483
  /** 默认行高倍数(基线距 = 字号 × 该系数) */
@@ -482,6 +514,8 @@ export declare interface ListColumn {
482
514
 
483
515
  export declare interface ListComponent {
484
516
  kind: "list";
517
+ /** Opaque serializable layout annotations; interpreted only by explicit optional adapters. */
518
+ meta?: Record<string, unknown>;
485
519
  id?: string;
486
520
  /** 宽表标记用于连续 Excel;不改变低层列表的列宽和分页算法。 */
487
521
  layout?: "page" | "wide";
@@ -491,6 +525,10 @@ export declare interface ListComponent {
491
525
  topMm: number;
492
526
  widthMm: number;
493
527
  dataset: string;
528
+ /** Headerless record/region bindings do not allocate a synthetic list header. */
529
+ header?: boolean;
530
+ /** A fixed record region rejects multiple rows instead of dropping source data. */
531
+ cardinality?: "record";
494
532
  /** 数据集中稳定业务主键的字段名;省略时编辑仅有计划内坐标。 */
495
533
  rowKey?: string;
496
534
  revisionField?: string;
@@ -517,6 +555,8 @@ export declare interface ListComponent {
517
555
  computed?: ComputedField[];
518
556
  /** Dynamic pivot of the current source dataset, with read-only derived identities. */
519
557
  matrix?: MatrixTableOptions;
558
+ /** Full ordered hierarchy; source parent values and descendant-leaf rollups are explicit. */
559
+ tree?: TreeTableOptions;
520
560
  /** Explicit row visibility; hidden rows do not participate in summaries. */
521
561
  rowVisibleWhen?: StyleRule["when"];
522
562
  /** Master/detail relation is keyed by business identity, never by display row index. */
@@ -567,6 +607,16 @@ export declare interface ListGroupBy {
567
607
  repeatHeader?: boolean;
568
608
  }
569
609
 
610
+ export declare interface LocalTemplateCatalogItem {
611
+ /** Editable document: prefer the latest draft; otherwise use the published document. */
612
+ document: ReportTemplateDocument;
613
+ published?: ReportTemplateDocument;
614
+ draftRevision?: string;
615
+ publishedRevision?: string;
616
+ category?: string;
617
+ tags?: string[];
618
+ }
619
+
570
620
  declare interface MatrixTableOptions {
571
621
  rowFields: readonly string[];
572
622
  columnFields: readonly string[];
@@ -741,6 +791,9 @@ export declare function parseReportCellInput(context: ReportCellContext, input:
741
791
  /** Bounded parser for clipboard data; invalid quotes are rejected before edits are built. */
742
792
  export declare function parseReportClipboard(text: string, maxCells?: number): string[][];
743
793
 
794
+ /** Only complete, ordered, real calendar dates are accepted; there is no timezone conversion. */
795
+ export declare function parseReportDateRange(value: string): ReportDateRange | undefined;
796
+
744
797
  /** 校验文件 JSON 文本或接口返回的未知对象,返回独立模板快照。 */
745
798
  export declare function parseReportTemplate(input: unknown): ReportTemplateDocument;
746
799
 
@@ -786,6 +839,7 @@ export declare interface PlanGrid {
786
839
  }
787
840
 
788
841
  export declare interface PlanPage {
842
+ meta?: Record<string, unknown>;
789
843
  /** wide 表示完整自然列宽;页面仅为预览的垂直窗口分段。 */
790
844
  layout?: "page" | "wide";
791
845
  pageWidthMm: number;
@@ -995,6 +1049,12 @@ export declare type ReportCellValue = string | number | boolean | null;
995
1049
 
996
1050
  export declare type ReportCellValueType = NonNullable<GridCell["valueType"]>;
997
1051
 
1052
+ /** Wire values deliberately remain strings in browsers, Workers and backend runtimes. */
1053
+ export declare interface ReportDateRange {
1054
+ start: string;
1055
+ end: string;
1056
+ }
1057
+
998
1058
  export declare interface ReportDefinition {
999
1059
  /** 静态模板或宿主提供的异步模板加载器;动态模板默认每次重新读取,不缓存版本。 */
1000
1060
  template: ReportTemplate | ReportTemplateLoader;
@@ -1108,6 +1168,14 @@ export declare interface ReportFieldContract {
1108
1168
  unit?: string;
1109
1169
  }
1110
1170
 
1171
+ export declare interface ReportFlowBand {
1172
+ /** Exact stable component IDs. Static components use nid, lists use id. */
1173
+ componentIds: string[];
1174
+ /** Source-template coordinates; following bands keep their original gap. */
1175
+ topMm: number;
1176
+ heightMm: number;
1177
+ }
1178
+
1111
1179
  export declare interface ReportHistoryPreparation {
1112
1180
  batch: ReportEditBatch;
1113
1181
  prepared: ReportPreparedEdit;
@@ -1123,13 +1191,17 @@ export declare interface ReportLoadContext {
1123
1191
 
1124
1192
  export declare function reportOutputDiagnostics(plan: RenderPlan, format: OutputFormat, options: OutputDiagnosticOptions): OutputDiagnostic[];
1125
1193
 
1194
+ export declare interface ReportPageFlow {
1195
+ bands: ReportFlowBand[];
1196
+ }
1197
+
1126
1198
  /** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
1127
1199
  export declare interface ReportParamDef {
1128
1200
  /** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
1129
1201
  field: string;
1130
1202
  /** 显示名(缺省用 field) */
1131
1203
  label?: string;
1132
- type?: "text" | "number" | "date" | "select";
1204
+ type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
1133
1205
  /** select 选项 */
1134
1206
  options?: Array<{
1135
1207
  label: string;
@@ -1138,7 +1210,7 @@ export declare interface ReportParamDef {
1138
1210
  defaultValue?: string;
1139
1211
  required?: boolean;
1140
1212
  placeholder?: string;
1141
- /** 数字上下界;date 参数使用 YYYY-MM-DD 字符串(含边界)。 */
1213
+ /** 数字上下界;日期/月/年使用对应规范字符串;dateRange 对两端使用 YYYY-MM-DD 边界(含边界)。 */
1142
1214
  min?: number | string;
1143
1215
  max?: number | string;
1144
1216
  minLength?: number;
@@ -1284,6 +1356,46 @@ export declare interface ReportTemplate {
1284
1356
  pages: TemplatePage[];
1285
1357
  }
1286
1358
 
1359
+ export declare interface ReportTemplateCatalogEntry extends ReportTemplateSummary {
1360
+ category?: string;
1361
+ tags?: string[];
1362
+ updatedAt?: string;
1363
+ /** Optional lifecycle metadata. revision continues to identify the editable document. */
1364
+ draftRevision?: string;
1365
+ publishedRevision?: string;
1366
+ }
1367
+
1368
+ export declare interface ReportTemplateCatalogOpenContext {
1369
+ mode: "edit" | "published";
1370
+ }
1371
+
1372
+ export declare interface ReportTemplateCatalogPage {
1373
+ items: ReportTemplateCatalogEntry[];
1374
+ next?: string;
1375
+ categories?: Array<{
1376
+ id: string;
1377
+ label: string;
1378
+ count?: number;
1379
+ }>;
1380
+ }
1381
+
1382
+ /** Discovery metadata is separate from executable templates and from enterprise account authorization. */
1383
+ export declare interface ReportTemplateCatalogProvider {
1384
+ search(request: ReportTemplateCatalogQuery): Promise<ReportTemplateCatalogPage>;
1385
+ get(id: string, context: {
1386
+ signal?: AbortSignal;
1387
+ mode?: ReportTemplateCatalogOpenContext["mode"];
1388
+ }): Promise<ReportTemplateDocument | undefined>;
1389
+ }
1390
+
1391
+ export declare interface ReportTemplateCatalogQuery {
1392
+ query?: string;
1393
+ category?: string;
1394
+ cursor?: string;
1395
+ limit?: number;
1396
+ signal?: AbortSignal;
1397
+ }
1398
+
1287
1399
  export declare interface ReportTemplateChange {
1288
1400
  kind: "added" | "removed" | "modified" | "moved";
1289
1401
  category: "metadata" | "structure" | "binding" | "calculation" | "format";
@@ -1614,6 +1726,9 @@ export declare interface TemplatePage {
1614
1726
  marginLeftMm?: number;
1615
1727
  marginRightMm?: number;
1616
1728
  components: TemplateComponent[];
1729
+ /** Explicit vertical bands preserve source gaps as dynamic regions expand. */
1730
+ flow?: ReportPageFlow;
1731
+ meta?: Record<string, unknown>;
1617
1732
  }
1618
1733
 
1619
1734
  export declare interface TemplateStoreWriteOptions {
@@ -1646,6 +1761,46 @@ export declare function toExcelNumberFormat(format?: ColumnFormat): string | und
1646
1761
 
1647
1762
  export declare function toNumber(value: unknown): number | null;
1648
1763
 
1764
+ export declare interface TreeRow {
1765
+ row: DataRow;
1766
+ original: DataRow;
1767
+ key: string | number;
1768
+ depth: number;
1769
+ hasChildren: boolean;
1770
+ }
1771
+
1772
+ export declare class TreeRowLimitError extends Error {
1773
+ readonly limit: number;
1774
+ readonly code = "tree-row-limit";
1775
+ constructor(limit: number);
1776
+ }
1777
+
1778
+ export declare interface TreeTable {
1779
+ rows: DataRow[];
1780
+ entries: TreeRow[];
1781
+ leaves: DataRow[];
1782
+ }
1783
+
1784
+ /** A serialized tree contract. Sibling and root order follow input order. */
1785
+ export declare interface TreeTableOptions {
1786
+ input: "flat" | "nested";
1787
+ idField: string;
1788
+ /** Flat roots have null/undefined parent values. */
1789
+ parentField?: string;
1790
+ /** Nested child arrays, defaults to children. Every node still needs an ID. */
1791
+ childrenField?: string;
1792
+ labelField: string;
1793
+ indentMm?: number;
1794
+ orphan?: "error" | "root";
1795
+ /** Source preserves parent values; leaf-aggregate derives only parents from descendant leaves. */
1796
+ parentValues?: "source" | "leaf-aggregate";
1797
+ aggregates?: AggregateDefinition[];
1798
+ maxRows?: number;
1799
+ maxDepth?: number;
1800
+ /** Bounded leaf-to-ancestor aggregate work; default one million. */
1801
+ maxAggregationVisits?: number;
1802
+ }
1803
+
1649
1804
  export declare function validateComponent(comp: unknown, path: string, errors: ValidationError[], warnings?: ValidationError[]): void;
1650
1805
 
1651
1806
  /** 浏览器/Node共用的只读值校验;返回精确路径,不以0或空数组掩盖接口结构错误。 */
@@ -1672,6 +1827,9 @@ export declare function validateReportTemplate(input: unknown): ValidationResult
1672
1827
 
1673
1828
  export declare function validateReportTemplateDocument(input: unknown): ValidationResult;
1674
1829
 
1830
+ /** Validates runtime inputs too, so direct core calls cannot bypass template checks. */
1831
+ export declare function validateTreeOptions(options: TreeTableOptions): void;
1832
+
1675
1833
  export declare interface ValidationError {
1676
1834
  path: string;
1677
1835
  message: string;