@agile-team/mach-report 0.7.0 → 0.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 (42) hide show
  1. package/LICENSE +107 -0
  2. package/dist/ReportPreview-BFTfls8h.js +923 -0
  3. package/dist/ReportPreview-D6VHDUvR.cjs +6 -0
  4. package/dist/format.d.ts +48 -0
  5. package/dist/grid-geometry-BXpOxznT.cjs +1 -0
  6. package/dist/grid-geometry-Bs8QXz1X.js +65 -0
  7. package/dist/index.cjs +6 -6
  8. package/dist/index.d.cts +1 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +858 -660
  11. package/dist/layout/paginate.d.ts +30 -2
  12. package/dist/pdf.cjs +46 -46
  13. package/dist/pdf.js +8 -7
  14. package/dist/{plugin-Cl-IqCqx.cjs → plugin-9eBK7khj.cjs} +1 -1
  15. package/dist/{plugin-Dp3kKWiQ.js → plugin-vi2GjP43.js} +3 -3
  16. package/dist/style-6ihHKVCM.js +192 -0
  17. package/dist/style-Xq08-IsV.cjs +3 -0
  18. package/dist/style.css +1 -1
  19. package/dist/vue/ReportPreview.d.ts +13 -0
  20. package/dist/vue/ReportToolbar.d.ts +20 -3
  21. package/dist/vue/async.d.cts +16 -0
  22. package/dist/vue/async.d.ts +16 -0
  23. package/dist/vue/composables/useHighlight.d.ts +8 -0
  24. package/dist/vue/composables/usePageWindow.d.ts +0 -3
  25. package/dist/vue/composables/usePrintExport.d.ts +8 -0
  26. package/dist/vue/composables/useReportSearch.d.ts +72 -0
  27. package/dist/vue/config.d.ts +17 -1
  28. package/dist/vue/plugin.d.ts +16 -0
  29. package/dist/vue-async.cjs +1 -1
  30. package/dist/vue-async.js +3 -3
  31. package/dist/vue.cjs +1 -1
  32. package/dist/vue.js +35 -33
  33. package/dist/xlsx/render-xlsx.d.ts +20 -0
  34. package/dist/xlsx.cjs +30 -0
  35. package/dist/xlsx.d.cts +5 -0
  36. package/dist/xlsx.d.ts +5 -0
  37. package/dist/xlsx.js +22648 -0
  38. package/package.json +15 -2
  39. package/dist/ReportPreview-CrVeTKu1.cjs +0 -6
  40. package/dist/ReportPreview-DgsOdO4y.js +0 -559
  41. package/dist/style-B3vxGDZd.cjs +0 -3
  42. package/dist/style-B7Xfo5I-.js +0 -255
@@ -19,8 +19,18 @@ export interface MachReportMessages {
19
19
  pdfWindow: string;
20
20
  loading: string;
21
21
  empty: string;
22
+ /** @deprecated 未被组件消费,将在下个大版本移除(保留仅为类型兼容) */
22
23
  errorPrefix: string;
23
24
  retry: string;
25
+ /** 搜索框占位文案 */
26
+ searchPlaceholder: string;
27
+ /** 搜索命中计数,{cur}/{total} 占位 */
28
+ matchInfo: string;
29
+ /** 上/下一个命中 */
30
+ prevMatch: string;
31
+ nextMatch: string;
32
+ /** 缩略图侧栏开关 */
33
+ thumbnails: string;
24
34
  }
25
35
  export declare const DEFAULT_MESSAGES: MachReportMessages;
26
36
  /** 主题变量(组件外壳注入的 --mrp-* CSS 自定义属性) */
@@ -37,6 +47,8 @@ export interface MachReportTheme {
37
47
  btnActiveBg: string;
38
48
  }
39
49
  export declare const DEFAULT_THEME: MachReportTheme;
50
+ /** 日志通道(默认 console;可注入 noop 静默或上报 collector) */
51
+ export type MachReportLogger = Pick<Console, "warn" | "info">;
40
52
  /** defaults 层可配置项(全部可选,均有内置缺省) */
41
53
  export interface MachReportDefaults {
42
54
  showExport?: boolean;
@@ -48,6 +60,8 @@ export interface MachReportDefaults {
48
60
  pdfFontUrl?: string;
49
61
  theme?: Partial<MachReportTheme>;
50
62
  messages?: Partial<MachReportMessages>;
63
+ /** 校验告警等内部日志通道(默认 console;静默传 { warn: () => {}, info: () => {} }) */
64
+ logger?: MachReportLogger;
51
65
  }
52
66
  export type MachReportPreset = MachReportDefaults;
53
67
  export interface MachReportConfig {
@@ -64,7 +78,10 @@ export type ResolvedConfig = Required<Pick<MachReportDefaults, "showExport" | "s
64
78
  pdfFontUrl: string;
65
79
  theme: MachReportTheme;
66
80
  messages: MachReportMessages;
81
+ logger: MachReportLogger;
67
82
  };
83
+ declare const SILENT_LOGGER: MachReportLogger;
84
+ export { SILENT_LOGGER };
68
85
  export declare function resolveConfig(config: MachReportConfig | null | undefined, presetName?: string): ResolvedConfig;
69
86
  /** theme 对象 → CSS 自定义属性 style 对象(注入组件外壳) */
70
87
  export declare function themeToCssVars(theme: Partial<MachReportTheme>): CSSProperties;
@@ -76,4 +93,3 @@ type ConfigRef = ComputedRef<MachReportConfig | null>;
76
93
  export declare function provideMachReportConfig(overlay: MachReportConfig | MachReportDefaults): void;
77
94
  /** 组件内部读取当前生效配置层(未提供时返回 null → 走内置缺省) */
78
95
  export declare function useMachReportConfig(): ConfigRef;
79
- export {};
@@ -52,6 +52,10 @@ export declare const MachReportPreview: {
52
52
  type: StringConstructor;
53
53
  default: undefined;
54
54
  };
55
+ debug: {
56
+ type: BooleanConstructor;
57
+ default: boolean;
58
+ };
55
59
  fetcher: {
56
60
  type: import('vue').PropType<PlanFetcher | null>;
57
61
  default: null;
@@ -80,6 +84,7 @@ export declare const MachReportPreview: {
80
84
  params: Record<string, string>;
81
85
  furnitureTempId: string;
82
86
  tempId: string | string[] | null;
87
+ debug: boolean;
83
88
  showExport: boolean;
84
89
  showPrint: boolean;
85
90
  showPdfWindow: boolean;
@@ -90,6 +95,7 @@ export declare const MachReportPreview: {
90
95
  }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
91
96
  viewportRef: HTMLDivElement;
92
97
  containerRef: HTMLDivElement;
98
+ thumbsRef: HTMLElement;
93
99
  }, HTMLDivElement, import('vue').ComponentProvideOptions, {
94
100
  P: {};
95
101
  B: {};
@@ -142,6 +148,10 @@ export declare const MachReportPreview: {
142
148
  type: StringConstructor;
143
149
  default: undefined;
144
150
  };
151
+ debug: {
152
+ type: BooleanConstructor;
153
+ default: boolean;
154
+ };
145
155
  fetcher: {
146
156
  type: import('vue').PropType<PlanFetcher | null>;
147
157
  default: null;
@@ -164,6 +174,7 @@ export declare const MachReportPreview: {
164
174
  params: Record<string, string>;
165
175
  furnitureTempId: string;
166
176
  tempId: string | string[] | null;
177
+ debug: boolean;
167
178
  showExport: boolean;
168
179
  showPrint: boolean;
169
180
  showPdfWindow: boolean;
@@ -220,6 +231,10 @@ export declare const MachReportPreview: {
220
231
  type: StringConstructor;
221
232
  default: undefined;
222
233
  };
234
+ debug: {
235
+ type: BooleanConstructor;
236
+ default: boolean;
237
+ };
223
238
  fetcher: {
224
239
  type: import('vue').PropType<PlanFetcher | null>;
225
240
  default: null;
@@ -248,6 +263,7 @@ export declare const MachReportPreview: {
248
263
  params: Record<string, string>;
249
264
  furnitureTempId: string;
250
265
  tempId: string | string[] | null;
266
+ debug: boolean;
251
267
  showExport: boolean;
252
268
  showPrint: boolean;
253
269
  showPdfWindow: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),i=require("./plugin-Cl-IqCqx.cjs"),r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-CrVeTKu1.cjs")).then(e=>e.ReportPreview$1));function c(){return Promise.resolve().then(()=>require("./ReportPreview-CrVeTKu1.cjs")).then(e=>e.ReportPreview$1)}const t={install(e,o={}){i.machReportPlugin.install(e,o),e.component("MachReportPreview",r)}};exports.MachReportPreview=r;exports.default=t;exports.machReportAsyncPlugin=t;exports.preloadMachReport=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),i=require("./plugin-9eBK7khj.cjs"),r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-D6VHDUvR.cjs")).then(e=>e.ReportPreview$1));function c(){return Promise.resolve().then(()=>require("./ReportPreview-D6VHDUvR.cjs")).then(e=>e.ReportPreview$1)}const t={install(e,o={}){i.machReportPlugin.install(e,o),e.component("MachReportPreview",r)}};exports.MachReportPreview=r;exports.default=t;exports.machReportAsyncPlugin=t;exports.preloadMachReport=c;
package/dist/vue-async.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { defineAsyncComponent as e } from "vue";
2
- import { m as n } from "./plugin-Dp3kKWiQ.js";
3
- const r = e(() => import("./ReportPreview-DgsOdO4y.js").then((t) => t.j));
2
+ import { m as n } from "./plugin-vi2GjP43.js";
3
+ const r = e(() => import("./ReportPreview-BFTfls8h.js").then((t) => t.k));
4
4
  function m() {
5
- return import("./ReportPreview-DgsOdO4y.js").then((t) => t.j);
5
+ return import("./ReportPreview-BFTfls8h.js").then((t) => t.k);
6
6
  }
7
7
  const p = {
8
8
  install(t, o = {}) {
package/dist/vue.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReportPreview-CrVeTKu1.cjs"),r=require("./plugin-Cl-IqCqx.cjs"),c=require("@agile-team/mach-report"),s=require("vue");function p(R){return async({tempIds:t})=>{if(t.length===0)throw new r.PlanLoadError("缺少报表模板 ID");const a=[];for(const n of t){const o=R[n];if(!o)throw new r.PlanLoadError(`本地模板 ${n} 不存在`);const{plan:E,warnings:i}=c.paginateTemplate(o.template,o.datasets??{});i.length>0&&console.warn("[mach-report] 分页告警:",i),a.push(...E.pages)}return{schemaVersion:"mach-local",pages:a}}}function P(){return s.inject(r.MACH_REPORT_CONTROLLER_KEY,null)}exports.DEFAULT_MESSAGES=e.DEFAULT_MESSAGES;exports.DEFAULT_THEME=e.DEFAULT_THEME;exports.MachReportError=e.MachReportError;exports.ReportPreview=e.ReportPreview;exports.ReportToolbar=e.ReportToolbar;exports.buildPrintDocument=e.buildPrintDocument;exports.defineMachReportConfig=e.defineMachReportConfig;exports.defineMachReportPreset=e.defineMachReportPreset;exports.provideMachReportConfig=e.provideMachReportConfig;exports.resolveConfig=e.resolveConfig;exports.themeToCssVars=e.themeToCssVars;exports.toErrorDetail=e.toErrorDetail;exports.useMachReportConfig=e.useMachReportConfig;exports.usePageWindow=e.usePageWindow;exports.usePrintExport=e.usePrintExport;exports.useZoom=e.useZoom;exports.MACH_REPORT_CONFIG_KEY=r.MACH_REPORT_CONFIG_KEY;exports.MACH_REPORT_CONTROLLER_KEY=r.MACH_REPORT_CONTROLLER_KEY;exports.MACH_REPORT_FETCHER_KEY=r.MACH_REPORT_FETCHER_KEY;exports.MACH_REPORT_PDF_EXPORTER_KEY=r.MACH_REPORT_PDF_EXPORTER_KEY;exports.MachReportPreview=r.MachReportPreview;exports.PlanLoadError=r.PlanLoadError;exports.createDefaultPdfExporter=r.createDefaultPdfExporter;exports.createFetchRequest=r.createFetchRequest;exports.createJh4jGridPlanFetcher=r.createJh4jGridPlanFetcher;exports.joinTempIds=r.joinTempIds;exports.machReportPlugin=r.machReportPlugin;exports.normalizeTempIds=r.normalizeTempIds;exports.createLocalFetcher=p;exports.useReportPreview=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReportPreview-D6VHDUvR.cjs"),r=require("./plugin-9eBK7khj.cjs"),c=require("@agile-team/mach-report"),s=require("vue");function p(E){return async({tempIds:t})=>{if(t.length===0)throw new r.PlanLoadError("缺少报表模板 ID");const a=[];for(const n of t){const o=E[n];if(!o)throw new r.PlanLoadError(`本地模板 ${n} 不存在`);const{plan:R,warnings:i}=c.paginateTemplate(o.template,o.datasets??{});i.length>0&&console.warn("[mach-report] 分页告警:",i),a.push(...R.pages)}return{schemaVersion:"mach-local",pages:a}}}function P(){return s.inject(r.MACH_REPORT_CONTROLLER_KEY,null)}exports.DEFAULT_MESSAGES=e.DEFAULT_MESSAGES;exports.DEFAULT_THEME=e.DEFAULT_THEME;exports.MachReportError=e.MachReportError;exports.ReportPreview=e.ReportPreview;exports.ReportToolbar=e.ReportToolbar;exports.SILENT_LOGGER=e.SILENT_LOGGER;exports.buildPrintDocument=e.buildPrintDocument;exports.defineMachReportConfig=e.defineMachReportConfig;exports.defineMachReportPreset=e.defineMachReportPreset;exports.printPlans=e.printPlans;exports.provideMachReportConfig=e.provideMachReportConfig;exports.resolveConfig=e.resolveConfig;exports.themeToCssVars=e.themeToCssVars;exports.toErrorDetail=e.toErrorDetail;exports.useMachReportConfig=e.useMachReportConfig;exports.usePageWindow=e.usePageWindow;exports.usePrintExport=e.usePrintExport;exports.useZoom=e.useZoom;exports.MACH_REPORT_CONFIG_KEY=r.MACH_REPORT_CONFIG_KEY;exports.MACH_REPORT_CONTROLLER_KEY=r.MACH_REPORT_CONTROLLER_KEY;exports.MACH_REPORT_FETCHER_KEY=r.MACH_REPORT_FETCHER_KEY;exports.MACH_REPORT_PDF_EXPORTER_KEY=r.MACH_REPORT_PDF_EXPORTER_KEY;exports.MachReportPreview=r.MachReportPreview;exports.PlanLoadError=r.PlanLoadError;exports.createDefaultPdfExporter=r.createDefaultPdfExporter;exports.createFetchRequest=r.createFetchRequest;exports.createJh4jGridPlanFetcher=r.createJh4jGridPlanFetcher;exports.joinTempIds=r.joinTempIds;exports.machReportPlugin=r.machReportPlugin;exports.normalizeTempIds=r.normalizeTempIds;exports.createLocalFetcher=p;exports.useReportPreview=P;
package/dist/vue.js CHANGED
@@ -1,53 +1,55 @@
1
- import { D as g, a as T, M as _, R as M, b as d, c as C, d as w, e as D, p as F, r as O, t as A, f as H, u as L, g as v, h as x, i as b } from "./ReportPreview-DgsOdO4y.js";
2
- import { P as s, M as c } from "./plugin-Dp3kKWiQ.js";
3
- import { a as K, b as Y, c as G, d as I, e as S, f as y, g as N, j as U, m as V, n as q } from "./plugin-Dp3kKWiQ.js";
1
+ import { D as T, a as _, M as g, R as M, b as d, S as C, c as w, d as O, e as D, p as F, f as L, r as A, t as H, g as j, u as v, h as x, i as G, j as S } from "./ReportPreview-BFTfls8h.js";
2
+ import { P as t, M as c } from "./plugin-vi2GjP43.js";
3
+ import { a as I, b as K, c as Y, d as N, e as y, f as U, g as V, j as q, m as z, n as J } from "./plugin-vi2GjP43.js";
4
4
  import { paginateTemplate as p } from "@agile-team/mach-report";
5
- import { inject as R } from "vue";
5
+ import { inject as E } from "vue";
6
6
  function h(n) {
7
7
  return async ({ tempIds: a }) => {
8
- if (a.length === 0) throw new s("缺少报表模板 ID");
8
+ if (a.length === 0) throw new t("缺少报表模板 ID");
9
9
  const r = [];
10
10
  for (const o of a) {
11
11
  const e = n[o];
12
- if (!e) throw new s(`本地模板 ${o} 不存在`);
13
- const { plan: i, warnings: t } = p(e.template, e.datasets ?? {});
14
- t.length > 0 && console.warn("[mach-report] 分页告警:", t), r.push(...i.pages);
12
+ if (!e) throw new t(`本地模板 ${o} 不存在`);
13
+ const { plan: i, warnings: s } = p(e.template, e.datasets ?? {});
14
+ s.length > 0 && console.warn("[mach-report] 分页告警:", s), r.push(...i.pages);
15
15
  }
16
16
  return { schemaVersion: "mach-local", pages: r };
17
17
  };
18
18
  }
19
19
  function m() {
20
- return R(c, null);
20
+ return E(c, null);
21
21
  }
22
22
  export {
23
- g as DEFAULT_MESSAGES,
24
- T as DEFAULT_THEME,
25
- K as MACH_REPORT_CONFIG_KEY,
23
+ T as DEFAULT_MESSAGES,
24
+ _ as DEFAULT_THEME,
25
+ I as MACH_REPORT_CONFIG_KEY,
26
26
  c as MACH_REPORT_CONTROLLER_KEY,
27
- Y as MACH_REPORT_FETCHER_KEY,
28
- G as MACH_REPORT_PDF_EXPORTER_KEY,
29
- _ as MachReportError,
30
- I as MachReportPreview,
31
- s as PlanLoadError,
27
+ K as MACH_REPORT_FETCHER_KEY,
28
+ Y as MACH_REPORT_PDF_EXPORTER_KEY,
29
+ g as MachReportError,
30
+ N as MachReportPreview,
31
+ t as PlanLoadError,
32
32
  M as ReportPreview,
33
33
  d as ReportToolbar,
34
- C as buildPrintDocument,
35
- S as createDefaultPdfExporter,
36
- y as createFetchRequest,
37
- N as createJh4jGridPlanFetcher,
34
+ C as SILENT_LOGGER,
35
+ w as buildPrintDocument,
36
+ y as createDefaultPdfExporter,
37
+ U as createFetchRequest,
38
+ V as createJh4jGridPlanFetcher,
38
39
  h as createLocalFetcher,
39
- w as defineMachReportConfig,
40
+ O as defineMachReportConfig,
40
41
  D as defineMachReportPreset,
41
- U as joinTempIds,
42
- V as machReportPlugin,
43
- q as normalizeTempIds,
44
- F as provideMachReportConfig,
45
- O as resolveConfig,
46
- A as themeToCssVars,
47
- H as toErrorDetail,
48
- L as useMachReportConfig,
49
- v as usePageWindow,
50
- x as usePrintExport,
42
+ q as joinTempIds,
43
+ z as machReportPlugin,
44
+ J as normalizeTempIds,
45
+ F as printPlans,
46
+ L as provideMachReportConfig,
47
+ A as resolveConfig,
48
+ H as themeToCssVars,
49
+ j as toErrorDetail,
50
+ v as useMachReportConfig,
51
+ x as usePageWindow,
52
+ G as usePrintExport,
51
53
  m as useReportPreview,
52
- b as useZoom
54
+ S as useZoom
53
55
  };
@@ -0,0 +1,20 @@
1
+ import { default as ExcelJS } from 'exceljs';
2
+ import { RenderPlan } from '../schema/render-plan';
3
+ /**
4
+ * RenderPlan → xlsx 导出(B 端第二出口,对齐家族 @agile-team/mach-table-xlsx 路线):
5
+ * - 网格组件 → 真表格:列宽(mm→Excel 宽度)、行高(mm→pt)、colSpan/rowSpan 合并、
6
+ * 加粗/对齐/底色/字号直译(resolveGridLayout 复用单真相源几何)
7
+ * - 文本组件 → 合并标题行(顺序流式输出,保字号/加粗/对齐;非像素级定位,
8
+ * 目标是"财务能直接用的对账表"而非复刻版面)
9
+ * - 图片/条码/图表跳过并计入 warnings(与 PDF 保真告警同口径)
10
+ */
11
+ export interface XlsxRenderOptions {
12
+ /** 工作表命名(默认 "Sheet1" 起序) */
13
+ sheetName?: (pageIndex: number) => string;
14
+ }
15
+ export interface XlsxRenderResult {
16
+ workbook: ExcelJS.Workbook;
17
+ buffer: ExcelJS.Buffer;
18
+ warnings: string[];
19
+ }
20
+ export declare function renderPlanToXlsx(plan: RenderPlan, options?: XlsxRenderOptions): Promise<XlsxRenderResult>;