@agile-team/mach-report 0.6.0 → 0.7.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.
@@ -1,19 +1,188 @@
1
- import { Plugin } from 'vue';
1
+ import { MachReportPluginOptions } from './plugin';
2
2
  /**
3
- * 异步插件入口(@agile-team/mach-report-vue/async):
3
+ * 异步插件入口(@agile-team/mach-report/vue/async):
4
4
  *
5
5
  * 首屏敏感页面用异步全局组件代替静态 import——组件与其引擎依赖
6
6
  * 拆为独立 chunk,路由级按需加载:
7
7
  *
8
8
  * ```ts
9
- * import AsyncMachReportPlugin, { preloadMachReport } from "@agile-team/mach-report-vue/async";
9
+ * import AsyncMachReportPlugin, { preloadMachReport } from "@agile-team/mach-report/vue/async";
10
10
  * app.use(AsyncMachReportPlugin, { baseUrl: "/sub/mach-report" });
11
11
  * void preloadMachReport(); // 可选:路由 hover 时预取
12
12
  * // 模板:<MachReportPreview temp-id="X" />
13
13
  * ```
14
14
  */
15
- /** 全局异步组件(懒加载 ReportPreview 及其引擎分片) */
16
- export declare const MachReportPreview: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
15
+ /** 全局异步组件(懒加载 ReportPreview 及其引擎分片;与主插件同源共享) */
16
+ export declare const MachReportPreview: {
17
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<import('vue').ExtractPropTypes<{
18
+ tempId: {
19
+ type: import('vue').PropType<string | string[] | null>;
20
+ default: null;
21
+ };
22
+ furnitureTempId: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
26
+ params: {
27
+ type: import('vue').PropType<Record<string, string>>;
28
+ default: () => {};
29
+ };
30
+ height: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ autoLoad: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ showExport: {
39
+ type: BooleanConstructor;
40
+ default: undefined;
41
+ };
42
+ showPrint: {
43
+ type: BooleanConstructor;
44
+ default: undefined;
45
+ };
46
+ showPdfWindow: {
47
+ type: BooleanConstructor;
48
+ default: undefined;
49
+ };
50
+ gapPx: {
51
+ type: NumberConstructor;
52
+ default: undefined;
53
+ };
54
+ messages: {
55
+ type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
56
+ default: undefined;
57
+ };
58
+ preset: {
59
+ type: StringConstructor;
60
+ default: undefined;
61
+ };
62
+ fetcher: {
63
+ type: import('vue').PropType<import('./adapters').PlanFetcher | null>;
64
+ default: null;
65
+ };
66
+ }>> & Readonly<{
67
+ onError?: ((message: string, detail?: {
68
+ code: string;
69
+ cause?: unknown;
70
+ } | undefined) => any) | undefined;
71
+ onLoaded?: ((pageCount: number) => any) | undefined;
72
+ }>, {
73
+ reload: () => Promise<void>;
74
+ print: () => Promise<void>;
75
+ exportAs: (format: string) => void;
76
+ openPdfWindow: () => void;
77
+ gotoPage: (n: number) => void;
78
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
79
+ error: (message: string, detail?: {
80
+ code: string;
81
+ cause?: unknown;
82
+ } | undefined) => any;
83
+ loaded: (pageCount: number) => any;
84
+ }, import('vue').PublicProps, {
85
+ height: string;
86
+ gapPx: number;
87
+ params: Record<string, string>;
88
+ furnitureTempId: string;
89
+ tempId: string | string[] | null;
90
+ showExport: boolean;
91
+ showPrint: boolean;
92
+ showPdfWindow: boolean;
93
+ messages: Partial<import('./config').MachReportMessages>;
94
+ autoLoad: boolean;
95
+ preset: string;
96
+ fetcher: import('./adapters').PlanFetcher | null;
97
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
98
+ viewportRef: HTMLDivElement;
99
+ containerRef: HTMLDivElement;
100
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
101
+ P: {};
102
+ B: {};
103
+ D: {};
104
+ C: {};
105
+ M: {};
106
+ Defaults: {};
107
+ }, Readonly<import('vue').ExtractPropTypes<{
108
+ tempId: {
109
+ type: import('vue').PropType<string | string[] | null>;
110
+ default: null;
111
+ };
112
+ furnitureTempId: {
113
+ type: StringConstructor;
114
+ default: string;
115
+ };
116
+ params: {
117
+ type: import('vue').PropType<Record<string, string>>;
118
+ default: () => {};
119
+ };
120
+ height: {
121
+ type: StringConstructor;
122
+ default: string;
123
+ };
124
+ autoLoad: {
125
+ type: BooleanConstructor;
126
+ default: boolean;
127
+ };
128
+ showExport: {
129
+ type: BooleanConstructor;
130
+ default: undefined;
131
+ };
132
+ showPrint: {
133
+ type: BooleanConstructor;
134
+ default: undefined;
135
+ };
136
+ showPdfWindow: {
137
+ type: BooleanConstructor;
138
+ default: undefined;
139
+ };
140
+ gapPx: {
141
+ type: NumberConstructor;
142
+ default: undefined;
143
+ };
144
+ messages: {
145
+ type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
146
+ default: undefined;
147
+ };
148
+ preset: {
149
+ type: StringConstructor;
150
+ default: undefined;
151
+ };
152
+ fetcher: {
153
+ type: import('vue').PropType<import('./adapters').PlanFetcher | null>;
154
+ default: null;
155
+ };
156
+ }>> & Readonly<{
157
+ onError?: ((message: string, detail?: {
158
+ code: string;
159
+ cause?: unknown;
160
+ } | undefined) => any) | undefined;
161
+ onLoaded?: ((pageCount: number) => any) | undefined;
162
+ }>, {
163
+ reload: () => Promise<void>;
164
+ print: () => Promise<void>;
165
+ exportAs: (format: string) => void;
166
+ openPdfWindow: () => void;
167
+ gotoPage: (n: number) => void;
168
+ }, {}, {}, {}, {
169
+ height: string;
170
+ gapPx: number;
171
+ params: Record<string, string>;
172
+ furnitureTempId: string;
173
+ tempId: string | string[] | null;
174
+ showExport: boolean;
175
+ showPrint: boolean;
176
+ showPdfWindow: boolean;
177
+ messages: Partial<import('./config').MachReportMessages>;
178
+ autoLoad: boolean;
179
+ preset: string;
180
+ fetcher: import('./adapters').PlanFetcher | null;
181
+ }>;
182
+ __isFragment?: never;
183
+ __isTeleport?: never;
184
+ __isSuspense?: never;
185
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
17
186
  tempId: {
18
187
  type: import('vue').PropType<string | string[] | null>;
19
188
  default: null;
@@ -62,6 +231,12 @@ export declare const MachReportPreview: import('vue').DefineComponent<import('vu
62
231
  type: import('vue').PropType<import('./adapters').PlanFetcher | null>;
63
232
  default: null;
64
233
  };
234
+ }>> & Readonly<{
235
+ onError?: ((message: string, detail?: {
236
+ code: string;
237
+ cause?: unknown;
238
+ } | undefined) => any) | undefined;
239
+ onLoaded?: ((pageCount: number) => any) | undefined;
65
240
  }>, {
66
241
  reload: () => Promise<void>;
67
242
  print: () => Promise<void>;
@@ -69,61 +244,12 @@ export declare const MachReportPreview: import('vue').DefineComponent<import('vu
69
244
  openPdfWindow: () => void;
70
245
  gotoPage: (n: number) => void;
71
246
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
72
- error: (message: string) => any;
247
+ error: (message: string, detail?: {
248
+ code: string;
249
+ cause?: unknown;
250
+ } | undefined) => any;
73
251
  loaded: (pageCount: number) => any;
74
- }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
75
- tempId: {
76
- type: import('vue').PropType<string | string[] | null>;
77
- default: null;
78
- };
79
- furnitureTempId: {
80
- type: StringConstructor;
81
- default: string;
82
- };
83
- params: {
84
- type: import('vue').PropType<Record<string, string>>;
85
- default: () => {};
86
- };
87
- height: {
88
- type: StringConstructor;
89
- default: string;
90
- };
91
- autoLoad: {
92
- type: BooleanConstructor;
93
- default: boolean;
94
- };
95
- showExport: {
96
- type: BooleanConstructor;
97
- default: undefined;
98
- };
99
- showPrint: {
100
- type: BooleanConstructor;
101
- default: undefined;
102
- };
103
- showPdfWindow: {
104
- type: BooleanConstructor;
105
- default: undefined;
106
- };
107
- gapPx: {
108
- type: NumberConstructor;
109
- default: undefined;
110
- };
111
- messages: {
112
- type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
113
- default: undefined;
114
- };
115
- preset: {
116
- type: StringConstructor;
117
- default: undefined;
118
- };
119
- fetcher: {
120
- type: import('vue').PropType<import('./adapters').PlanFetcher | null>;
121
- default: null;
122
- };
123
- }>> & Readonly<{
124
- onError?: ((message: string) => any) | undefined;
125
- onLoaded?: ((pageCount: number) => any) | undefined;
126
- }>, {
252
+ }, string, {
127
253
  height: string;
128
254
  gapPx: number;
129
255
  params: Record<string, string>;
@@ -136,11 +262,14 @@ export declare const MachReportPreview: import('vue').DefineComponent<import('vu
136
262
  autoLoad: boolean;
137
263
  preset: string;
138
264
  fetcher: import('./adapters').PlanFetcher | null;
139
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
140
- viewportRef: HTMLDivElement;
141
- containerRef: HTMLDivElement;
142
- }, HTMLDivElement>;
265
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
266
+ $slots: {
267
+ default?(_: {}): any;
268
+ };
269
+ });
143
270
  /** 预取组件分片(路由 hover / 空闲时调用,正式渲染零等待) */
144
271
  export declare function preloadMachReport(): Promise<unknown>;
145
- export declare const machReportAsyncPlugin: Plugin;
272
+ export declare const machReportAsyncPlugin: {
273
+ install(app: import('vue').App, options?: MachReportPluginOptions): void;
274
+ };
146
275
  export default machReportAsyncPlugin;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * ReportPreview 的编程式控制器(与组件 ref 方法同面):
3
+ * reload / print / exportAs / openPdfWindow / gotoPage。
4
+ */
5
+ export interface MachReportController {
6
+ reload(): Promise<void>;
7
+ print(): Promise<void>;
8
+ exportAs(format: "html" | "pdf" | string): void;
9
+ openPdfWindow(): void;
10
+ gotoPage(page: number): void;
11
+ }
12
+ /**
13
+ * 在 ReportPreview 的任意后代组件中获取控制器(免模板 ref):
14
+ *
15
+ * ```vue
16
+ * <script setup>
17
+ * import { useReportPreview } from "@agile-team/mach-report/vue";
18
+ * const preview = useReportPreview();
19
+ * </script>
20
+ * <template><button @click="preview?.print()">打印本单</button></template>
21
+ *
22
+ * 不在预览组件内调用时返回 null(不抛错,便于条件渲染场景)。
23
+ */
24
+ export declare function useReportPreview(): MachReportController | null;
@@ -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,264 @@ 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
+ fetcher: {
56
+ type: import('vue').PropType<PlanFetcher | null>;
57
+ default: null;
58
+ };
59
+ }>> & Readonly<{
60
+ onError?: ((message: string, detail?: {
61
+ code: string;
62
+ cause?: unknown;
63
+ } | undefined) => any) | undefined;
64
+ onLoaded?: ((pageCount: number) => any) | undefined;
65
+ }>, {
66
+ reload: () => Promise<void>;
67
+ print: () => Promise<void>;
68
+ exportAs: (format: string) => void;
69
+ openPdfWindow: () => void;
70
+ gotoPage: (n: number) => void;
71
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
72
+ error: (message: string, detail?: {
73
+ code: string;
74
+ cause?: unknown;
75
+ } | undefined) => any;
76
+ loaded: (pageCount: number) => any;
77
+ }, import('vue').PublicProps, {
78
+ height: string;
79
+ gapPx: number;
80
+ params: Record<string, string>;
81
+ furnitureTempId: string;
82
+ tempId: string | string[] | null;
83
+ showExport: boolean;
84
+ showPrint: boolean;
85
+ showPdfWindow: boolean;
86
+ messages: Partial<import('./config').MachReportMessages>;
87
+ autoLoad: boolean;
88
+ preset: string;
89
+ fetcher: PlanFetcher | null;
90
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
91
+ viewportRef: HTMLDivElement;
92
+ containerRef: HTMLDivElement;
93
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
94
+ P: {};
95
+ B: {};
96
+ D: {};
97
+ C: {};
98
+ M: {};
99
+ Defaults: {};
100
+ }, Readonly<import('vue').ExtractPropTypes<{
101
+ tempId: {
102
+ type: import('vue').PropType<string | string[] | null>;
103
+ default: null;
104
+ };
105
+ furnitureTempId: {
106
+ type: StringConstructor;
107
+ default: string;
108
+ };
109
+ params: {
110
+ type: import('vue').PropType<Record<string, string>>;
111
+ default: () => {};
112
+ };
113
+ height: {
114
+ type: StringConstructor;
115
+ default: string;
116
+ };
117
+ autoLoad: {
118
+ type: BooleanConstructor;
119
+ default: boolean;
120
+ };
121
+ showExport: {
122
+ type: BooleanConstructor;
123
+ default: undefined;
124
+ };
125
+ showPrint: {
126
+ type: BooleanConstructor;
127
+ default: undefined;
128
+ };
129
+ showPdfWindow: {
130
+ type: BooleanConstructor;
131
+ default: undefined;
132
+ };
133
+ gapPx: {
134
+ type: NumberConstructor;
135
+ default: undefined;
136
+ };
137
+ messages: {
138
+ type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
139
+ default: undefined;
140
+ };
141
+ preset: {
142
+ type: StringConstructor;
143
+ default: undefined;
144
+ };
145
+ fetcher: {
146
+ type: import('vue').PropType<PlanFetcher | null>;
147
+ default: null;
148
+ };
149
+ }>> & Readonly<{
150
+ onError?: ((message: string, detail?: {
151
+ code: string;
152
+ cause?: unknown;
153
+ } | undefined) => any) | undefined;
154
+ onLoaded?: ((pageCount: number) => any) | undefined;
155
+ }>, {
156
+ reload: () => Promise<void>;
157
+ print: () => Promise<void>;
158
+ exportAs: (format: string) => void;
159
+ openPdfWindow: () => void;
160
+ gotoPage: (n: number) => void;
161
+ }, {}, {}, {}, {
162
+ height: string;
163
+ gapPx: number;
164
+ params: Record<string, string>;
165
+ furnitureTempId: string;
166
+ tempId: string | string[] | null;
167
+ showExport: boolean;
168
+ showPrint: boolean;
169
+ showPdfWindow: boolean;
170
+ messages: Partial<import('./config').MachReportMessages>;
171
+ autoLoad: boolean;
172
+ preset: string;
173
+ fetcher: PlanFetcher | null;
174
+ }>;
175
+ __isFragment?: never;
176
+ __isTeleport?: never;
177
+ __isSuspense?: never;
178
+ } & import('vue').ComponentOptionsBase<Readonly<import('vue').ExtractPropTypes<{
179
+ tempId: {
180
+ type: import('vue').PropType<string | string[] | null>;
181
+ default: null;
182
+ };
183
+ furnitureTempId: {
184
+ type: StringConstructor;
185
+ default: string;
186
+ };
187
+ params: {
188
+ type: import('vue').PropType<Record<string, string>>;
189
+ default: () => {};
190
+ };
191
+ height: {
192
+ type: StringConstructor;
193
+ default: string;
194
+ };
195
+ autoLoad: {
196
+ type: BooleanConstructor;
197
+ default: boolean;
198
+ };
199
+ showExport: {
200
+ type: BooleanConstructor;
201
+ default: undefined;
202
+ };
203
+ showPrint: {
204
+ type: BooleanConstructor;
205
+ default: undefined;
206
+ };
207
+ showPdfWindow: {
208
+ type: BooleanConstructor;
209
+ default: undefined;
210
+ };
211
+ gapPx: {
212
+ type: NumberConstructor;
213
+ default: undefined;
214
+ };
215
+ messages: {
216
+ type: import('vue').PropType<Partial<import('./config').MachReportMessages>>;
217
+ default: undefined;
218
+ };
219
+ preset: {
220
+ type: StringConstructor;
221
+ default: undefined;
222
+ };
223
+ fetcher: {
224
+ type: import('vue').PropType<PlanFetcher | null>;
225
+ default: null;
226
+ };
227
+ }>> & Readonly<{
228
+ onError?: ((message: string, detail?: {
229
+ code: string;
230
+ cause?: unknown;
231
+ } | undefined) => any) | undefined;
232
+ onLoaded?: ((pageCount: number) => any) | undefined;
233
+ }>, {
234
+ reload: () => Promise<void>;
235
+ print: () => Promise<void>;
236
+ exportAs: (format: string) => void;
237
+ openPdfWindow: () => void;
238
+ gotoPage: (n: number) => void;
239
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
240
+ error: (message: string, detail?: {
241
+ code: string;
242
+ cause?: unknown;
243
+ } | undefined) => any;
244
+ loaded: (pageCount: number) => any;
245
+ }, string, {
246
+ height: string;
247
+ gapPx: number;
248
+ params: Record<string, string>;
249
+ furnitureTempId: string;
250
+ tempId: string | string[] | null;
251
+ showExport: boolean;
252
+ showPrint: boolean;
253
+ showPdfWindow: boolean;
254
+ messages: Partial<import('./config').MachReportMessages>;
255
+ autoLoad: boolean;
256
+ preset: string;
257
+ fetcher: PlanFetcher | null;
258
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
259
+ $slots: {
260
+ default?(_: {}): any;
261
+ };
262
+ });
5
263
  export interface MachReportPluginOptions {
6
264
  /**
7
265
  * 数据面(全部可选——零配置时用全局 fetch 同源直连):
@@ -17,9 +275,11 @@ export interface MachReportPluginOptions {
17
275
  pdfFontUrl?: string;
18
276
  /** 自定义 PDF 导出器(缺省用懒加载引擎 /pdf 子路径的默认实现) */
19
277
  pdfExporter?: PdfExporter;
278
+ /** 注册全局组件 <MachReportPreview>(默认 true;懒加载分片不影响首屏) */
279
+ globalComponent?: boolean;
20
280
  }
21
281
  /**
22
- * Vue 插件(零配置可用):
282
+ * Vue 插件(零配置可用,对齐 mach-table 的快速集成体验):
23
283
  *
24
284
  * ```ts
25
285
  * app.use(machReportPlugin) // 同源 jh4j 部署,零胶水
@@ -27,7 +287,7 @@ export interface MachReportPluginOptions {
27
287
  * app.use(machReportPlugin, { request: axios, config: defineMachReportConfig({...}) })
28
288
  * ```
29
289
  *
30
- * 之后业务页面一行使用:`<ReportPreview temp-id="X" />`
290
+ * 之后业务模板直接写 `<MachReportPreview temp-id="X" />`。
31
291
  */
32
292
  export declare const machReportPlugin: {
33
293
  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-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;
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-Dp3kKWiQ.js";
3
+ const r = e(() => import("./ReportPreview-DgsOdO4y.js").then((t) => t.j));
4
4
  function m() {
5
- return import("./ReportPreview-DWLjYi_p.js").then((t) => t.i);
5
+ return import("./ReportPreview-DgsOdO4y.js").then((t) => t.j);
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-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;