@agile-team/mach-report 2.8.4 → 2.9.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 (94) hide show
  1. package/README.md +27 -9
  2. package/dist/ExcelBindingWizard-DiaxvWpQ.cjs +1 -0
  3. package/dist/ExcelBindingWizard-RLJIXKKG.js +816 -0
  4. package/dist/{ReportPreview-DTWiCH5a.js → ReportPreview-B5ZNEasW.js} +22 -21
  5. package/dist/ReportPreview-DRtVPUYo.cjs +6 -0
  6. package/dist/RuleEditor-N4qnMZ-Z.cjs +1 -0
  7. package/dist/RuleEditor-ynnUEK0s.js +1575 -0
  8. package/dist/TemplateReviewPanel-C_Lmzis6.cjs +1 -0
  9. package/dist/TemplateReviewPanel-Cn32OY4_.js +173 -0
  10. package/dist/analytics.cjs +1 -1
  11. package/dist/analytics.d.cts +188 -5
  12. package/dist/analytics.d.ts +188 -5
  13. package/dist/analytics.js +68 -202
  14. package/dist/{assets-B9qJku3V.js → assets-DDsfEi8R.js} +3 -3
  15. package/dist/{assets-RZan7EyL.cjs → assets-ahTRUXRk.cjs} +1 -1
  16. package/dist/binding-preview-B5834rml.cjs +2 -0
  17. package/dist/binding-preview-ChXjN5L5.js +649 -0
  18. package/dist/{capabilities-joSutDF8.js → capabilities-Cm9hZ3uV.js} +5 -5
  19. package/dist/{capabilities-xGTpnPjJ.cjs → capabilities-DYzWL7KS.cjs} +1 -1
  20. package/dist/dataset-BkRmwgeJ.cjs +1 -0
  21. package/dist/dataset-H5pFuQGU.js +121 -0
  22. package/dist/defaults-DXhiM1ZD.js +10 -0
  23. package/dist/defaults-xhmcLLrf.cjs +1 -0
  24. package/dist/designer.cjs +2 -1
  25. package/dist/designer.d.cts +1373 -6
  26. package/dist/designer.d.ts +1373 -6
  27. package/dist/designer.js +2495 -767
  28. package/dist/grid-geometry-BNptEcMm.js +65 -0
  29. package/dist/grid-geometry-CZ_cYB6O.cjs +1 -0
  30. package/dist/import-template-CNMLJSQw.js +23030 -0
  31. package/dist/import-template-CpxunKVp.cjs +29 -0
  32. package/dist/index.cjs +7 -7
  33. package/dist/index.d.cts +202 -3
  34. package/dist/index.d.ts +202 -3
  35. package/dist/index.js +554 -535
  36. package/dist/matrix-CNPDJxED.js +745 -0
  37. package/dist/matrix-Div9Ilh3.cjs +1 -0
  38. package/dist/pdf.cjs +46 -46
  39. package/dist/pdf.d.cts +2 -0
  40. package/dist/pdf.d.ts +2 -0
  41. package/dist/pdf.js +17 -16
  42. package/dist/{plugin-CQmJXNcA.js → plugin-BWwIgZXV.js} +1 -1
  43. package/dist/{plugin-DSFu51Ua.cjs → plugin-Dg-J1Rbm.cjs} +1 -1
  44. package/dist/progress-7OSZbFok.js +39 -0
  45. package/dist/progress-BnLiS5eH.cjs +1 -0
  46. package/dist/render-plan-7xpGrCEl.cjs +1 -0
  47. package/dist/render-plan-Ck6koX9L.js +13 -0
  48. package/dist/server/node.d.cts +62 -0
  49. package/dist/server/node.d.ts +62 -0
  50. package/dist/server-node.cjs +1 -1
  51. package/dist/server-node.js +373 -145
  52. package/dist/server.cjs +1 -1
  53. package/dist/server.d.cts +311 -0
  54. package/dist/server.d.ts +311 -0
  55. package/dist/server.js +590 -186
  56. package/dist/{style-Dv5o_x6b.js → style-CQ1PK8ZB.js} +5 -5
  57. package/dist/style-UgIJSA1F.cjs +1 -0
  58. package/dist/style.css +1 -1
  59. package/dist/template-registry-CHMYZ7SD.cjs +1 -0
  60. package/dist/template-registry-R61AMCr0.js +433 -0
  61. package/dist/template-review-hvWWQFsi.js +1027 -0
  62. package/dist/template-review-jEcOfmGr.cjs +1 -0
  63. package/dist/textwrap-CWHyzkBH.cjs +4 -0
  64. package/dist/{textwrap-DOl04hCQ.js → textwrap-DE1kgcJB.js} +1 -1
  65. package/dist/{validate-DfHPD8wX.cjs → validate-BDiMqkJC.cjs} +1 -1
  66. package/dist/{validate-S6CgIm5d.js → validate-DWPF7icl.js} +13 -13
  67. package/dist/vue/async.d.cts +186 -0
  68. package/dist/vue/async.d.ts +186 -0
  69. package/dist/vue/index.d.cts +271 -3
  70. package/dist/vue/index.d.ts +271 -3
  71. package/dist/vue-async.cjs +1 -1
  72. package/dist/vue-async.js +3 -3
  73. package/dist/vue.cjs +1 -1
  74. package/dist/vue.js +4 -4
  75. package/dist/worker.cjs +1 -1
  76. package/dist/worker.d.cts +2 -0
  77. package/dist/worker.d.ts +2 -0
  78. package/dist/worker.js +1 -1
  79. package/dist/xlsx.cjs +2 -30
  80. package/dist/xlsx.d.cts +268 -0
  81. package/dist/xlsx.d.ts +268 -0
  82. package/dist/xlsx.js +220 -23440
  83. package/package.json +1 -1
  84. package/dist/ReportPreview-DjGeWHY-.cjs +0 -6
  85. package/dist/progress-DD964VAB.js +0 -102
  86. package/dist/progress-KvhwXZ1Q.cjs +0 -1
  87. package/dist/render-plan-CckPEQyf.cjs +0 -1
  88. package/dist/render-plan-uzZYYSy1.js +0 -19
  89. package/dist/report-source-BXHNy_AD.js +0 -755
  90. package/dist/report-source-CCAvFE3t.cjs +0 -1
  91. package/dist/style-CpwiOPyB.cjs +0 -1
  92. package/dist/template-registry-DWExx0gU.cjs +0 -1
  93. package/dist/template-registry-NpOakidD.js +0 -354
  94. package/dist/textwrap-CnGsEum6.cjs +0 -4
package/dist/xlsx.d.ts CHANGED
@@ -23,6 +23,18 @@ declare interface AddWorksheetOptions {
23
23
  state: WorksheetState;
24
24
  }
25
25
 
26
+ declare interface AggregateDefinition {
27
+ /** Output column; valueField defaults to this field. */
28
+ field: string;
29
+ op: AggregateOperation;
30
+ valueField?: string;
31
+ weightField?: string;
32
+ numeric?: "number" | "decimal";
33
+ digits?: number;
34
+ }
35
+
36
+ declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
37
+
26
38
  declare interface Alignment {
27
39
  horizontal: 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
28
40
  vertical: 'top' | 'middle' | 'bottom' | 'distributed' | 'justify';
@@ -412,6 +424,16 @@ declare interface ComponentStyle {
412
424
  rotateDeg?: number;
413
425
  }
414
426
 
427
+ declare interface ComputedField extends ExpressionOptions {
428
+ field: string;
429
+ expression: ReportExpression | string;
430
+ /** Scope controls aggregate inputs; row expressions may reference the current row in any scope. */
431
+ scope?: "row" | "group" | "dataset";
432
+ groupBy?: readonly string[];
433
+ /** String adapter expressions cannot be inspected; declare dependencies explicitly. */
434
+ dependsOn?: readonly string[];
435
+ }
436
+
415
437
  declare interface ConditionalFormattingBaseRule {
416
438
  priority: number;
417
439
  style?: Partial<Style>;
@@ -437,6 +459,18 @@ declare interface ContainsTextRuleType extends ConditionalFormattingBaseRule {
437
459
  text?: string;
438
460
  }
439
461
 
462
+ /** Compile only the selected sheet to a new template; all sample detail values are removed. */
463
+ export declare function createExcelBindingDocument(imported: ExcelImportResult, recipe: ExcelBindingRecipe, datasets: readonly ExcelBindingDataset[], identity: {
464
+ id: string;
465
+ name: string;
466
+ }): ExcelBindingDocumentResult;
467
+
468
+ /** Persist this JSON beside the template to reopen exact regions/mappings without retaining File or runtime handles. */
469
+ export declare function createExcelBindingSession(imported: ExcelImportResult, recipe: ExcelBindingRecipe, identity: {
470
+ id: string;
471
+ name: string;
472
+ }): ExcelBindingSession;
473
+
440
474
  declare interface Csv {
441
475
  /**
442
476
  * read from a file
@@ -570,6 +604,72 @@ export declare type ExcelBindingColumn = string | (Omit<ListColumn, "widthMm" |
570
604
  header?: string;
571
605
  });
572
606
 
607
+ export declare interface ExcelBindingDataset {
608
+ id: string;
609
+ label?: string;
610
+ fields: readonly ExcelBindingField[];
611
+ rowKey?: string;
612
+ /** Optional representative API rows, used only for contract validation, never as live results. */
613
+ samples?: readonly Record<string, unknown>[];
614
+ }
615
+
616
+ export declare interface ExcelBindingDocumentResult {
617
+ document: ReportTemplateDocument;
618
+ recipe: ExcelBindingRecipe;
619
+ warnings: string[];
620
+ }
621
+
622
+ export declare interface ExcelBindingField extends ReportFieldContract {
623
+ /** Display precision is explicit business metadata; decimal text is never coerced to number. */
624
+ digits?: number;
625
+ sample?: string | number | boolean | null;
626
+ }
627
+
628
+ export declare interface ExcelBindingIssue {
629
+ path: string;
630
+ code: "schema" | "region" | "mapping" | "row-key" | "source";
631
+ message: string;
632
+ }
633
+
634
+ /** Explicit coordinates and mappings, independently persistable alongside the source asset. */
635
+ export declare interface ExcelBindingRecipe {
636
+ version: "1.0";
637
+ sheet: string;
638
+ dataset: string;
639
+ regions: {
640
+ title?: string;
641
+ header: string;
642
+ detail: string;
643
+ footer?: string;
644
+ };
645
+ /** One mapping for every physical Excel column. Empty strings remain invalid until confirmed. */
646
+ fields: string[];
647
+ rowKey: string;
648
+ }
649
+
650
+ export declare type ExcelBindingRegion = "title" | "header" | "detail" | "footer";
651
+
652
+ /** Row selection is graphical; this helper converts it to explicit full-width coordinates. */
653
+ export declare function excelBindingRowRange(imported: ExcelImportResult, sheetName: string, from: number, to: number): string;
654
+
655
+ export declare interface ExcelBindingSession {
656
+ version: "1.0";
657
+ /** Design source only. The compiled document never retains the sample detail rows. */
658
+ source: ExcelImportResult;
659
+ recipe: ExcelBindingRecipe;
660
+ identity: {
661
+ id: string;
662
+ name: string;
663
+ };
664
+ }
665
+
666
+ export declare interface ExcelBindingValidation {
667
+ ok: boolean;
668
+ issues: ExcelBindingIssue[];
669
+ mapped: number;
670
+ total: number;
671
+ }
672
+
573
673
  export declare interface ExcelImportedSheet {
574
674
  name: string;
575
675
  /** Original, one-based workbook position. */
@@ -745,6 +845,46 @@ declare namespace ExcelJS {
745
845
  }
746
846
  }
747
847
 
848
+ export declare interface ExcelSheetWindow {
849
+ top: number;
850
+ bottom: number;
851
+ left: number;
852
+ right: number;
853
+ source: {
854
+ top: number;
855
+ bottom: number;
856
+ left: number;
857
+ right: number;
858
+ };
859
+ columns: {
860
+ column: number;
861
+ name: string;
862
+ }[];
863
+ rows: {
864
+ row: number;
865
+ cells: ExcelSheetWindowCell[];
866
+ }[];
867
+ }
868
+
869
+ export declare interface ExcelSheetWindowCell {
870
+ address: string;
871
+ text: string;
872
+ row: number;
873
+ column: number;
874
+ rowSpan: number;
875
+ colSpan: number;
876
+ /** A merged master may be outside the current window; its visible fragment retains the label. */
877
+ continued: boolean;
878
+ style?: GridCell["style"];
879
+ }
880
+
881
+ export declare interface ExcelSheetWindowOptions {
882
+ row?: number;
883
+ column?: number;
884
+ rows?: number;
885
+ columns?: number;
886
+ }
887
+
748
888
  export declare interface ExcelTableBinding {
749
889
  sheet: string;
750
890
  dataset?: string;
@@ -753,6 +893,8 @@ export declare interface ExcelTableBinding {
753
893
  /** 将整个样例明细区域替换为动态数据;缺省为表头下方全部行。 */
754
894
  detail?: string;
755
895
  columns: readonly ExcelBindingColumn[];
896
+ /** Disable sample-cell number-format inference when a business schema is authoritative. */
897
+ inferSampleFormats?: boolean;
756
898
  rowKey?: string;
757
899
  revisionField?: string;
758
900
  sourceTokenField?: string;
@@ -765,6 +907,27 @@ export declare interface ExcelTemplateBindingResult {
765
907
  warnings: string[];
766
908
  }
767
909
 
910
+ export declare interface ExcelWorkbookInspection {
911
+ sheets: ExcelWorkbookSheet[];
912
+ warnings: string[];
913
+ }
914
+
915
+ export declare interface ExcelWorkbookSheet {
916
+ name: string;
917
+ index: number;
918
+ range: string;
919
+ rowCount: number;
920
+ columnCount: number;
921
+ visible: boolean;
922
+ }
923
+
924
+ declare interface ExpressionOptions {
925
+ numeric?: "number" | "decimal";
926
+ digits?: number;
927
+ nulls?: "propagate" | "error";
928
+ divisionByZero?: "null" | "error";
929
+ }
930
+
768
931
  declare interface ExpressionRuleType extends ConditionalFormattingBaseRule {
769
932
  type: 'expression';
770
933
  formulae?: any[];
@@ -877,6 +1040,9 @@ declare enum FormulaType {
877
1040
  Shared = 2
878
1041
  }
879
1042
 
1043
+ /** Bounded two-dimensional source preview. Only intersecting import segments are inspected, never a workbook-sized DOM. */
1044
+ export declare function getExcelSheetWindow(imported: ExcelImportResult, sheetName: string, options?: ExcelSheetWindowOptions): ExcelSheetWindow;
1045
+
880
1046
  declare interface GradientStop {
881
1047
  position: number;
882
1048
  color: Partial<Color>;
@@ -991,6 +1157,9 @@ declare interface ImageRange {
991
1157
  */
992
1158
  export declare function importExcelTemplate(input: ArrayBuffer | Uint8Array | Blob, options?: ExcelImportOptions): Promise<ExcelImportResult>;
993
1159
 
1160
+ /** Inspect sheet metadata before selecting a bounded import; does not construct any template grids. */
1161
+ export declare function inspectExcelWorkbook(input: ArrayBuffer | Uint8Array | Blob, options?: ExcelImportOptions): Promise<ExcelWorkbookInspection>;
1162
+
994
1163
  declare interface JSZipGeneratorOptions {
995
1164
  /**
996
1165
  * @default DEFLATE
@@ -1028,6 +1197,9 @@ declare interface ListColumn {
1028
1197
  valueType?: GridCell["valueType"];
1029
1198
  /** 字段语义用于 auto 对齐;明确声明编号,避免把数字编号当成度量。 */
1030
1199
  semanticRole?: "identifier" | "dimension" | "measure" | "date" | "text";
1200
+ hidden?: boolean;
1201
+ /** Condition hides cell content, preserving its physical layout in preview and exports. */
1202
+ visibleWhen?: StyleRule["when"];
1031
1203
  }
1032
1204
 
1033
1205
  declare interface ListComponent {
@@ -1062,15 +1234,38 @@ declare interface ListComponent {
1062
1234
  border?: boolean;
1063
1235
  /** 分组小计(组头/组尾小计/组头防孤行) */
1064
1236
  groupBy?: ListGroupBy;
1237
+ /** Ordered outer-to-inner grouping; groupBy remains the single-level shorthand. */
1238
+ groups?: ListGroupBy[];
1239
+ computed?: ComputedField[];
1240
+ /** Dynamic pivot of the current source dataset, with read-only derived identities. */
1241
+ matrix?: MatrixTableOptions;
1242
+ /** Explicit row visibility; hidden rows do not participate in summaries. */
1243
+ rowVisibleWhen?: StyleRule["when"];
1244
+ /** Master/detail relation is keyed by business identity, never by display row index. */
1245
+ detail?: ListDetail;
1065
1246
  /** 末尾总合计行(依赖 groupBy.subtotal 或显式 fields) */
1066
1247
  grandTotal?: ListGrandTotal;
1067
1248
  }
1068
1249
 
1250
+ declare interface ListDetail {
1251
+ dataset: string;
1252
+ parentKey: string;
1253
+ foreignKey: string;
1254
+ rowKey?: string;
1255
+ columns: ListColumn[];
1256
+ rowHeightMm?: number;
1257
+ header?: boolean;
1258
+ label?: string;
1259
+ /** Unmatched children fail by default; opt-in ignore is explicit. */
1260
+ unmatched?: "error" | "ignore";
1261
+ }
1262
+
1069
1263
  declare type ListGrandTotal = boolean | {
1070
1264
  label?: string;
1071
1265
  style?: ComponentStyle;
1072
1266
  /** 合计列(缺省沿用 groupBy.subtotal) */
1073
1267
  fields?: string[];
1268
+ aggregates?: AggregateDefinition[];
1074
1269
  };
1075
1270
 
1076
1271
  /** 分组小计配置(声明式,见 ListComponent.groupBy) */
@@ -1086,6 +1281,9 @@ declare interface ListGroupBy {
1086
1281
  subtotalLabel?: string;
1087
1282
  /** 组头防孤行(默认 true:页尾放不下"组头+首行"时整体换页) */
1088
1283
  keepWithNext?: boolean;
1284
+ aggregates?: AggregateDefinition[];
1285
+ /** Repeat this group heading after page breaks within the group. */
1286
+ repeatHeader?: boolean;
1089
1287
  }
1090
1288
 
1091
1289
  declare interface Location_2 {
@@ -1104,6 +1302,22 @@ declare interface Margins {
1104
1302
  footer: number;
1105
1303
  }
1106
1304
 
1305
+ declare interface MatrixTableOptions {
1306
+ rowFields: readonly string[];
1307
+ columnFields: readonly string[];
1308
+ measures: readonly (AggregateDefinition & {
1309
+ label?: string;
1310
+ })[];
1311
+ totals?: boolean;
1312
+ rowHeader?: string;
1313
+ columnWidthMm?: number;
1314
+ rowWidthMm?: number;
1315
+ maxRows?: number;
1316
+ maxColumns?: number;
1317
+ maxInputRows?: number;
1318
+ maxCells?: number;
1319
+ }
1320
+
1107
1321
  declare interface Media {
1108
1322
  type: string; // image,background
1109
1323
  name: string;
@@ -1303,7 +1517,11 @@ declare const enum PaperSize {
1303
1517
  K16_197x273_mm = 119,
1304
1518
  }
1305
1519
 
1520
+ export declare function parseExcelBindingSession(input: unknown): ExcelBindingSession;
1521
+
1306
1522
  declare interface PlanComponent {
1523
+ /** Template page furniture repeats per page and reserves its vertical band. */
1524
+ pageAnchor?: "header" | "footer";
1307
1525
  kind: ComponentKind;
1308
1526
  leftMm: number;
1309
1527
  topMm: number;
@@ -1455,6 +1673,34 @@ declare interface ReportCellSource {
1455
1673
  sourceToken?: string;
1456
1674
  }
1457
1675
 
1676
+ declare type ReportExpression = {
1677
+ field: string;
1678
+ } | {
1679
+ value: string | number | boolean | null;
1680
+ } | {
1681
+ aggregate: AggregateOperation;
1682
+ field?: string;
1683
+ weightField?: string;
1684
+ } | {
1685
+ op: "add" | "subtract" | "multiply" | "divide" | "coalesce";
1686
+ args: readonly ReportExpression[];
1687
+ };
1688
+
1689
+ declare interface ReportFieldContract {
1690
+ field: string;
1691
+ label?: string;
1692
+ type: "text" | "number" | "boolean" | "date" | "decimal";
1693
+ required?: boolean;
1694
+ nullable?: boolean;
1695
+ enum?: readonly (string | number | boolean)[];
1696
+ min?: number;
1697
+ max?: number;
1698
+ minLength?: number;
1699
+ maxLength?: number;
1700
+ semanticRole?: "identifier" | "dimension" | "measure" | "date" | "text";
1701
+ unit?: string;
1702
+ }
1703
+
1458
1704
  /** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
1459
1705
  declare interface ReportParamDef {
1460
1706
  /** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
@@ -1484,6 +1730,17 @@ declare interface ReportTemplate {
1484
1730
  pages: TemplatePage[];
1485
1731
  }
1486
1732
 
1733
+ /** 可存入数据库/文件的纯 JSON 模板;数据、接口与鉴权仍由宿主提供。 */
1734
+ declare interface ReportTemplateDocument {
1735
+ schemaVersion: "1.0";
1736
+ id: string;
1737
+ name: string;
1738
+ /** 宿主的发布版本/乐观锁标识,不由引擎自动递增。 */
1739
+ revision?: string;
1740
+ description?: string;
1741
+ template: ReportTemplate;
1742
+ }
1743
+
1487
1744
  declare interface RichParagraph {
1488
1745
  segments: RichSegment[];
1489
1746
  align?: ComponentStyle["align"];
@@ -1765,6 +2022,8 @@ declare interface StyleRule {
1765
2022
  field: string;
1766
2023
  op: ">" | ">=" | "<" | "<=" | "==" | "!=";
1767
2024
  value: number | string;
2025
+ /** Explicit decimal comparisons retain decimal thresholds as text. */
2026
+ numeric?: "number" | "decimal";
1768
2027
  };
1769
2028
  /** 命中时合并进单元格样式(color/bold/backgroundColor 等) */
1770
2029
  style: Record<string, unknown>;
@@ -1921,6 +2180,15 @@ declare interface Top10RuleType extends ConditionalFormattingBaseRule {
1921
2180
  bottom: boolean;
1922
2181
  }
1923
2182
 
2183
+ /** Contract and mapping validation does not traverse imported grids. */
2184
+ export declare function validateExcelBindingFields(imported: ExcelImportResult, recipe: ExcelBindingRecipe, datasets: readonly ExcelBindingDataset[]): ExcelBindingValidation;
2185
+
2186
+ /** Shared browser/Node validation. No header-name guessing, coercion, network or formula execution. */
2187
+ export declare function validateExcelBindingRecipe(imported: ExcelImportResult, recipe: ExcelBindingRecipe, datasets: readonly ExcelBindingDataset[]): ExcelBindingValidation;
2188
+
2189
+ /** Region-only validation lets reactive consumers reuse the result while only mappings change. */
2190
+ export declare function validateExcelBindingRegions(imported: ExcelImportResult, recipe: ExcelBindingRecipe): ExcelBindingIssue[];
2191
+
1924
2192
  declare enum ValueType {
1925
2193
  Null = 0,
1926
2194
  Merge = 1,