@agile-team/mach-report 0.6.0 → 0.8.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 (47) hide show
  1. package/dist/ReportPreview-BQE0C_37.cjs +6 -0
  2. package/dist/ReportPreview-D8X75aLV.js +825 -0
  3. package/dist/format.d.ts +35 -0
  4. package/dist/grid-geometry-BXpOxznT.cjs +1 -0
  5. package/dist/grid-geometry-Bs8QXz1X.js +65 -0
  6. package/dist/index.cjs +6 -6
  7. package/dist/index.d.cts +1 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +811 -606
  10. package/dist/layout/paginate.d.ts +29 -0
  11. package/dist/pdf.cjs +46 -46
  12. package/dist/pdf.js +12 -11
  13. package/dist/plugin-7W2Zy3Xc.cjs +1 -0
  14. package/dist/plugin-Bc6Px9Lq.js +92 -0
  15. package/dist/style-6ihHKVCM.js +192 -0
  16. package/dist/style-Xq08-IsV.cjs +3 -0
  17. package/dist/style.css +1 -1
  18. package/dist/vue/ReportPreview.d.ts +40 -3
  19. package/dist/vue/ReportToolbar.d.ts +15 -0
  20. package/dist/vue/adapters.d.ts +3 -0
  21. package/dist/vue/async.d.cts +209 -64
  22. package/dist/vue/async.d.ts +209 -64
  23. package/dist/vue/composables/useHighlight.d.ts +8 -0
  24. package/dist/vue/composables/usePrintExport.d.ts +7 -0
  25. package/dist/vue/config.d.ts +9 -0
  26. package/dist/vue/controller.d.ts +24 -0
  27. package/dist/vue/errors.d.ts +16 -0
  28. package/dist/vue/index.d.cts +2 -0
  29. package/dist/vue/index.d.ts +2 -0
  30. package/dist/vue/injection-keys.d.ts +2 -0
  31. package/dist/vue/plugin.d.ts +278 -2
  32. package/dist/vue-async.cjs +1 -1
  33. package/dist/vue-async.js +3 -3
  34. package/dist/vue.cjs +1 -1
  35. package/dist/vue.js +39 -29
  36. package/dist/xlsx/render-xlsx.d.ts +20 -0
  37. package/dist/xlsx.cjs +30 -0
  38. package/dist/xlsx.d.cts +5 -0
  39. package/dist/xlsx.d.ts +5 -0
  40. package/dist/xlsx.js +22647 -0
  41. package/package.json +13 -2
  42. package/dist/ReportPreview-DWLjYi_p.js +0 -527
  43. package/dist/ReportPreview-rBtmbu3W.cjs +0 -6
  44. package/dist/plugin-BIJxGHZX.cjs +0 -1
  45. package/dist/plugin-DrV67_VW.js +0 -89
  46. package/dist/style-B3vxGDZd.cjs +0 -3
  47. package/dist/style-B7Xfo5I-.js +0 -255
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 结构化错误(code 分类,宿主可按码决定 UX:重试 / 提示 / 降级)。
3
+ * error 事件契约保持 `(message: string)` 不变,新增第二参数 detail(可选)。
4
+ */
5
+ export type MachReportErrorCode = "param" | "fetch" | "validate" | "render" | "pdf" | "print" | "config";
6
+ export declare class MachReportError extends Error {
7
+ readonly code: MachReportErrorCode;
8
+ readonly cause?: unknown;
9
+ constructor(code: MachReportErrorCode, message: string, cause?: unknown);
10
+ }
11
+ /** error 事件第二参数的形状(向后兼容:仅监听 message 的旧用法不受影响) */
12
+ export interface MachReportErrorDetail {
13
+ code: MachReportErrorCode;
14
+ cause?: unknown;
15
+ }
16
+ export declare function toErrorDetail(error: unknown): MachReportErrorDetail;
@@ -6,6 +6,8 @@ export * from './injection-keys';
6
6
  export * from './plugin';
7
7
  export * from './config';
8
8
  export * from './pdf-exporter';
9
+ export * from './errors';
10
+ export * from './controller';
9
11
  export * from './composables/usePageWindow';
10
12
  export * from './composables/useZoom';
11
13
  export * from './composables/usePrintExport';
@@ -6,6 +6,8 @@ export * from './injection-keys';
6
6
  export * from './plugin';
7
7
  export * from './config';
8
8
  export * from './pdf-exporter';
9
+ export * from './errors';
10
+ export * from './controller';
9
11
  export * from './composables/usePageWindow';
10
12
  export * from './composables/useZoom';
11
13
  export * from './composables/usePrintExport';
@@ -2,6 +2,7 @@ import { ComputedRef, InjectionKey } from 'vue';
2
2
  import { PlanFetcher } from './adapters';
3
3
  import { PdfExporter } from './pdf-exporter';
4
4
  import { MachReportConfig } from './config';
5
+ import { MachReportController } from './controller';
5
6
  /**
6
7
  * 注入 key 全部为字符串(而非裸 Symbol):跨模块联邦边界时宿主与远程
7
8
  * 各自打包会生成不同的 Symbol 实例导致 inject 失效;字符串恒等。
@@ -10,3 +11,4 @@ import { MachReportConfig } from './config';
10
11
  export declare const MACH_REPORT_FETCHER_KEY: InjectionKey<PlanFetcher>;
11
12
  export declare const MACH_REPORT_PDF_EXPORTER_KEY: InjectionKey<PdfExporter>;
12
13
  export declare const MACH_REPORT_CONFIG_KEY: InjectionKey<ComputedRef<MachReportConfig | null>>;
14
+ export declare const MACH_REPORT_CONTROLLER_KEY: InjectionKey<MachReportController>;
@@ -2,6 +2,280 @@ import { App } from 'vue';
2
2
  import { PlanFetcher, HostRequest } from './adapters';
3
3
  import { PdfExporter } from './pdf-exporter';
4
4
  import { MachReportConfig } from './config';
5
+ /**
6
+ * 全局组件(懒加载分片:首次渲染才拉取组件与引擎依赖,
7
+ * 与局部 import 等价——首屏敏感页面零额外成本)
8
+ */
9
+ export declare const MachReportPreview: {
10
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
11
+ tempId: {
12
+ type: import('vue').PropType<string | string[] | null>;
13
+ default: null;
14
+ };
15
+ furnitureTempId: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ params: {
20
+ type: import('vue').PropType<Record<string, string>>;
21
+ default: () => {};
22
+ };
23
+ height: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ autoLoad: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ showExport: {
32
+ type: BooleanConstructor;
33
+ default: undefined;
34
+ };
35
+ showPrint: {
36
+ type: BooleanConstructor;
37
+ default: undefined;
38
+ };
39
+ showPdfWindow: {
40
+ type: BooleanConstructor;
41
+ default: undefined;
42
+ };
43
+ gapPx: {
44
+ type: NumberConstructor;
45
+ default: undefined;
46
+ };
47
+ messages: {
48
+ type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
49
+ default: undefined;
50
+ };
51
+ preset: {
52
+ type: StringConstructor;
53
+ default: undefined;
54
+ };
55
+ debug: {
56
+ type: BooleanConstructor;
57
+ default: boolean;
58
+ };
59
+ fetcher: {
60
+ type: import('vue').PropType<PlanFetcher | null>;
61
+ default: null;
62
+ };
63
+ }>> & Readonly<{
64
+ onError?: ((message: string, detail?: {
65
+ code: string;
66
+ cause?: unknown;
67
+ } | undefined) => any) | undefined;
68
+ onLoaded?: ((pageCount: number) => any) | undefined;
69
+ }>, {
70
+ reload: () => Promise<void>;
71
+ print: () => Promise<void>;
72
+ exportAs: (format: string) => void;
73
+ openPdfWindow: () => void;
74
+ gotoPage: (n: number) => void;
75
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
76
+ error: (message: string, detail?: {
77
+ code: string;
78
+ cause?: unknown;
79
+ } | undefined) => any;
80
+ loaded: (pageCount: number) => any;
81
+ }, import('vue').PublicProps, {
82
+ height: string;
83
+ gapPx: number;
84
+ params: Record<string, string>;
85
+ furnitureTempId: string;
86
+ tempId: string | string[] | null;
87
+ showExport: boolean;
88
+ showPrint: boolean;
89
+ showPdfWindow: boolean;
90
+ messages: Partial<import('./config').MachReportMessages>;
91
+ autoLoad: boolean;
92
+ preset: string;
93
+ debug: boolean;
94
+ fetcher: PlanFetcher | null;
95
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
96
+ viewportRef: HTMLDivElement;
97
+ containerRef: HTMLDivElement;
98
+ thumbsRef: HTMLElement;
99
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
100
+ P: {};
101
+ B: {};
102
+ D: {};
103
+ C: {};
104
+ M: {};
105
+ Defaults: {};
106
+ }, Readonly<import('vue').ExtractPropTypes<{
107
+ tempId: {
108
+ type: import('vue').PropType<string | string[] | null>;
109
+ default: null;
110
+ };
111
+ furnitureTempId: {
112
+ type: StringConstructor;
113
+ default: string;
114
+ };
115
+ params: {
116
+ type: import('vue').PropType<Record<string, string>>;
117
+ default: () => {};
118
+ };
119
+ height: {
120
+ type: StringConstructor;
121
+ default: string;
122
+ };
123
+ autoLoad: {
124
+ type: BooleanConstructor;
125
+ default: boolean;
126
+ };
127
+ showExport: {
128
+ type: BooleanConstructor;
129
+ default: undefined;
130
+ };
131
+ showPrint: {
132
+ type: BooleanConstructor;
133
+ default: undefined;
134
+ };
135
+ showPdfWindow: {
136
+ type: BooleanConstructor;
137
+ default: undefined;
138
+ };
139
+ gapPx: {
140
+ type: NumberConstructor;
141
+ default: undefined;
142
+ };
143
+ messages: {
144
+ type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
145
+ default: undefined;
146
+ };
147
+ preset: {
148
+ type: StringConstructor;
149
+ default: undefined;
150
+ };
151
+ debug: {
152
+ type: BooleanConstructor;
153
+ default: boolean;
154
+ };
155
+ fetcher: {
156
+ type: import('vue').PropType<PlanFetcher | null>;
157
+ default: null;
158
+ };
159
+ }>> & Readonly<{
160
+ onError?: ((message: string, detail?: {
161
+ code: string;
162
+ cause?: unknown;
163
+ } | undefined) => any) | undefined;
164
+ onLoaded?: ((pageCount: number) => any) | undefined;
165
+ }>, {
166
+ reload: () => Promise<void>;
167
+ print: () => Promise<void>;
168
+ exportAs: (format: string) => void;
169
+ openPdfWindow: () => void;
170
+ gotoPage: (n: number) => void;
171
+ }, {}, {}, {}, {
172
+ height: string;
173
+ gapPx: number;
174
+ params: Record<string, string>;
175
+ furnitureTempId: string;
176
+ tempId: string | string[] | null;
177
+ showExport: boolean;
178
+ showPrint: boolean;
179
+ showPdfWindow: boolean;
180
+ messages: Partial<import('./config').MachReportMessages>;
181
+ autoLoad: boolean;
182
+ preset: string;
183
+ debug: boolean;
184
+ fetcher: PlanFetcher | null;
185
+ }>;
186
+ __isFragment?: never;
187
+ __isTeleport?: never;
188
+ __isSuspense?: never;
189
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
190
+ tempId: {
191
+ type: import('vue').PropType<string | string[] | null>;
192
+ default: null;
193
+ };
194
+ furnitureTempId: {
195
+ type: StringConstructor;
196
+ default: string;
197
+ };
198
+ params: {
199
+ type: import('vue').PropType<Record<string, string>>;
200
+ default: () => {};
201
+ };
202
+ height: {
203
+ type: StringConstructor;
204
+ default: string;
205
+ };
206
+ autoLoad: {
207
+ type: BooleanConstructor;
208
+ default: boolean;
209
+ };
210
+ showExport: {
211
+ type: BooleanConstructor;
212
+ default: undefined;
213
+ };
214
+ showPrint: {
215
+ type: BooleanConstructor;
216
+ default: undefined;
217
+ };
218
+ showPdfWindow: {
219
+ type: BooleanConstructor;
220
+ default: undefined;
221
+ };
222
+ gapPx: {
223
+ type: NumberConstructor;
224
+ default: undefined;
225
+ };
226
+ messages: {
227
+ type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
228
+ default: undefined;
229
+ };
230
+ preset: {
231
+ type: StringConstructor;
232
+ default: undefined;
233
+ };
234
+ debug: {
235
+ type: BooleanConstructor;
236
+ default: boolean;
237
+ };
238
+ fetcher: {
239
+ type: import('vue').PropType<PlanFetcher | null>;
240
+ default: null;
241
+ };
242
+ }>> & Readonly<{
243
+ onError?: ((message: string, detail?: {
244
+ code: string;
245
+ cause?: unknown;
246
+ } | undefined) => any) | undefined;
247
+ onLoaded?: ((pageCount: number) => any) | undefined;
248
+ }>, {
249
+ reload: () => Promise<void>;
250
+ print: () => Promise<void>;
251
+ exportAs: (format: string) => void;
252
+ openPdfWindow: () => void;
253
+ gotoPage: (n: number) => void;
254
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
255
+ error: (message: string, detail?: {
256
+ code: string;
257
+ cause?: unknown;
258
+ } | undefined) => any;
259
+ loaded: (pageCount: number) => any;
260
+ }, string, {
261
+ height: string;
262
+ gapPx: number;
263
+ params: Record<string, string>;
264
+ furnitureTempId: string;
265
+ tempId: string | string[] | null;
266
+ showExport: boolean;
267
+ showPrint: boolean;
268
+ showPdfWindow: boolean;
269
+ messages: Partial<import('./config').MachReportMessages>;
270
+ autoLoad: boolean;
271
+ preset: string;
272
+ debug: boolean;
273
+ fetcher: PlanFetcher | null;
274
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
275
+ $slots: {
276
+ default?(_: {}): any;
277
+ };
278
+ });
5
279
  export interface MachReportPluginOptions {
6
280
  /**
7
281
  * 数据面(全部可选——零配置时用全局 fetch 同源直连):
@@ -17,9 +291,11 @@ export interface MachReportPluginOptions {
17
291
  pdfFontUrl?: string;
18
292
  /** 自定义 PDF 导出器(缺省用懒加载引擎 /pdf 子路径的默认实现) */
19
293
  pdfExporter?: PdfExporter;
294
+ /** 注册全局组件 <MachReportPreview>(默认 true;懒加载分片不影响首屏) */
295
+ globalComponent?: boolean;
20
296
  }
21
297
  /**
22
- * Vue 插件(零配置可用):
298
+ * Vue 插件(零配置可用,对齐 mach-table 的快速集成体验):
23
299
  *
24
300
  * ```ts
25
301
  * app.use(machReportPlugin) // 同源 jh4j 部署,零胶水
@@ -27,7 +303,7 @@ export interface MachReportPluginOptions {
27
303
  * app.use(machReportPlugin, { request: axios, config: defineMachReportConfig({...}) })
28
304
  * ```
29
305
  *
30
- * 之后业务页面一行使用:`<ReportPreview temp-id="X" />`
306
+ * 之后业务模板直接写 `<MachReportPreview temp-id="X" />`。
31
307
  */
32
308
  export declare const machReportPlugin: {
33
309
  install(app: App, options?: MachReportPluginOptions): void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),i=require("./plugin-BIJxGHZX.cjs"),r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-rBtmbu3W.cjs")).then(e=>e.ReportPreview$1));function c(){return Promise.resolve().then(()=>require("./ReportPreview-rBtmbu3W.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-7W2Zy3Xc.cjs"),r=n.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ReportPreview-BQE0C_37.cjs")).then(e=>e.ReportPreview$1));function c(){return Promise.resolve().then(()=>require("./ReportPreview-BQE0C_37.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-DrV67_VW.js";
3
- const r = e(() => import("./ReportPreview-DWLjYi_p.js").then((t) => t.i));
2
+ import { m as n } from "./plugin-Bc6Px9Lq.js";
3
+ const r = e(() => import("./ReportPreview-D8X75aLV.js").then((t) => t.k));
4
4
  function m() {
5
- return import("./ReportPreview-DWLjYi_p.js").then((t) => t.i);
5
+ return import("./ReportPreview-D8X75aLV.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-rBtmbu3W.cjs"),r=require("./plugin-BIJxGHZX.cjs"),E=require("@agile-team/mach-report");function R(c){return async({tempIds:t})=>{if(t.length===0)throw new r.PlanLoadError("缺少报表模板 ID");const a=[];for(const n of t){const o=c[n];if(!o)throw new r.PlanLoadError(`本地模板 ${n} 不存在`);const{plan:s,warnings:i}=E.paginateTemplate(o.template,o.datasets??{});i.length>0&&console.warn("[mach-report] 分页告警:",i),a.push(...s.pages)}return{schemaVersion:"mach-local",pages:a}}}exports.DEFAULT_MESSAGES=e.DEFAULT_MESSAGES;exports.DEFAULT_THEME=e.DEFAULT_THEME;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.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_FETCHER_KEY=r.MACH_REPORT_FETCHER_KEY;exports.MACH_REPORT_PDF_EXPORTER_KEY=r.MACH_REPORT_PDF_EXPORTER_KEY;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=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ReportPreview-BQE0C_37.cjs"),r=require("./plugin-7W2Zy3Xc.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.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,7 +1,8 @@
1
- import { D as m, a as R, R as P, b as g, c as u, d, e as T, p as _, r as C, t as M, u as w, f as F, g as D, h as A } from "./ReportPreview-DWLjYi_p.js";
2
- import { P as t } from "./plugin-DrV67_VW.js";
3
- import { M as H, a as O, b, c as L, d as j, e as v, j as G, m as I, n as K } from "./plugin-DrV67_VW.js";
4
- import { paginateTemplate as i } from "@agile-team/mach-report";
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, f as O, r as A, t as H, g as L, u as j, h as v, i as x, j as b } from "./ReportPreview-D8X75aLV.js";
2
+ import { P as t, M as c } from "./plugin-Bc6Px9Lq.js";
3
+ import { a as Y, b as G, c as I, d as S, e as y, f as N, g as U, j as V, m as q, n as z } from "./plugin-Bc6Px9Lq.js";
4
+ import { paginateTemplate as p } from "@agile-team/mach-report";
5
+ import { inject as R } from "vue";
5
6
  function h(n) {
6
7
  return async ({ tempIds: a }) => {
7
8
  if (a.length === 0) throw new t("缺少报表模板 ID");
@@ -9,36 +10,45 @@ function h(n) {
9
10
  for (const o of a) {
10
11
  const e = n[o];
11
12
  if (!e) throw new t(`本地模板 ${o} 不存在`);
12
- const { plan: c, warnings: s } = i(e.template, e.datasets ?? {});
13
- s.length > 0 && console.warn("[mach-report] 分页告警:", s), r.push(...c.pages);
13
+ const { plan: i, warnings: s } = p(e.template, e.datasets ?? {});
14
+ s.length > 0 && console.warn("[mach-report] 分页告警:", s), r.push(...i.pages);
14
15
  }
15
16
  return { schemaVersion: "mach-local", pages: r };
16
17
  };
17
18
  }
19
+ function m() {
20
+ return R(c, null);
21
+ }
18
22
  export {
19
- m as DEFAULT_MESSAGES,
20
- R as DEFAULT_THEME,
21
- H as MACH_REPORT_CONFIG_KEY,
22
- O as MACH_REPORT_FETCHER_KEY,
23
- b as MACH_REPORT_PDF_EXPORTER_KEY,
23
+ g as DEFAULT_MESSAGES,
24
+ T as DEFAULT_THEME,
25
+ Y as MACH_REPORT_CONFIG_KEY,
26
+ c as MACH_REPORT_CONTROLLER_KEY,
27
+ G as MACH_REPORT_FETCHER_KEY,
28
+ I as MACH_REPORT_PDF_EXPORTER_KEY,
29
+ _ as MachReportError,
30
+ S as MachReportPreview,
24
31
  t as PlanLoadError,
25
- P as ReportPreview,
26
- g as ReportToolbar,
27
- u as buildPrintDocument,
28
- L as createDefaultPdfExporter,
29
- j as createFetchRequest,
30
- v as createJh4jGridPlanFetcher,
32
+ M as ReportPreview,
33
+ d as ReportToolbar,
34
+ C as buildPrintDocument,
35
+ y as createDefaultPdfExporter,
36
+ N as createFetchRequest,
37
+ U as createJh4jGridPlanFetcher,
31
38
  h as createLocalFetcher,
32
- d as defineMachReportConfig,
33
- T as defineMachReportPreset,
34
- G as joinTempIds,
35
- I as machReportPlugin,
36
- K as normalizeTempIds,
37
- _ as provideMachReportConfig,
38
- C as resolveConfig,
39
- M as themeToCssVars,
40
- w as useMachReportConfig,
41
- F as usePageWindow,
42
- D as usePrintExport,
43
- A as useZoom
39
+ w as defineMachReportConfig,
40
+ D as defineMachReportPreset,
41
+ V as joinTempIds,
42
+ q as machReportPlugin,
43
+ z as normalizeTempIds,
44
+ F as printPlans,
45
+ O as provideMachReportConfig,
46
+ A as resolveConfig,
47
+ H as themeToCssVars,
48
+ L as toErrorDetail,
49
+ j as useMachReportConfig,
50
+ v as usePageWindow,
51
+ x as usePrintExport,
52
+ m as useReportPreview,
53
+ b as useZoom
44
54
  };
@@ -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>;