@agile-team/mach-report 0.5.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.
- package/dist/ReportPreview-CrVeTKu1.cjs +6 -0
- package/dist/ReportPreview-DgsOdO4y.js +559 -0
- package/dist/_commonjsHelpers-DKOUU3wS.cjs +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/builder/template-builder.d.ts +53 -0
- package/dist/compat/jh4j-template.d.ts +12 -0
- package/dist/defaults.d.ts +27 -0
- package/dist/index.cjs +6 -1663
- package/dist/index.d.cts +13 -344
- package/dist/index.d.ts +13 -344
- package/dist/index.js +744 -1415
- package/dist/layout/paginate.d.ts +51 -0
- package/dist/layout/textwrap.d.ts +36 -0
- package/dist/manager/api.d.ts +45 -0
- package/dist/manager/index.d.ts +2 -0
- package/dist/manager/types.d.ts +50 -0
- package/dist/manager.cjs +1 -122
- package/dist/manager.d.cts +5 -97
- package/dist/manager.d.ts +5 -97
- package/dist/manager.js +66 -81
- package/dist/pdf/font-loader.d.ts +5 -0
- package/dist/pdf/index.d.ts +2 -0
- package/dist/pdf/render-pdf.d.ts +25 -0
- package/dist/pdf.cjs +84 -52530
- package/dist/pdf.d.cts +4 -31
- package/dist/pdf.d.ts +4 -31
- package/dist/pdf.js +22843 -39218
- package/dist/plugin-Cl-IqCqx.cjs +1 -0
- package/dist/plugin-Dp3kKWiQ.js +92 -0
- package/dist/render/canvas.d.ts +61 -0
- package/dist/render/dom.d.ts +10 -0
- package/dist/render/grid-geometry.d.ts +41 -0
- package/dist/render/style.d.ts +33 -0
- package/dist/render/window.d.ts +23 -0
- package/dist/schema/render-plan.d.ts +96 -0
- package/dist/schema/validate.d.ts +15 -0
- package/dist/sql/ast-check.d.ts +14 -0
- package/dist/sql/compile.d.ts +31 -0
- package/dist/sql/expr.d.ts +21 -0
- package/dist/sql/index.d.ts +4 -0
- package/dist/sql/tokenizer.d.ts +25 -0
- package/dist/sql.cjs +68 -45207
- package/dist/sql.d.cts +3 -93
- package/dist/sql.d.ts +3 -93
- package/dist/sql.js +37213 -41613
- package/dist/style-B3vxGDZd.cjs +3 -0
- package/dist/style-B7Xfo5I-.js +255 -0
- package/dist/style.css +1 -0
- package/dist/units.d.ts +11 -0
- package/dist/vue/ReportPreview.d.ts +165 -0
- package/dist/vue/ReportToolbar.d.ts +25 -0
- package/dist/vue/adapters.d.ts +40 -0
- package/dist/vue/async.d.cts +275 -0
- package/dist/vue/async.d.ts +275 -0
- package/dist/vue/composables/usePageWindow.d.ts +28 -0
- package/dist/vue/composables/usePrintExport.d.ts +19 -0
- package/dist/vue/composables/useZoom.d.ts +15 -0
- package/dist/vue/config.d.ts +79 -0
- package/dist/vue/controller.d.ts +24 -0
- package/dist/vue/errors.d.ts +16 -0
- package/dist/vue/index.d.cts +13 -0
- package/dist/vue/index.d.ts +13 -0
- package/dist/vue/injection-keys.d.ts +14 -0
- package/dist/vue/local-adapter.d.ts +12 -0
- package/dist/vue/pdf-exporter.d.ts +13 -0
- package/dist/vue/plugin.d.ts +294 -0
- package/dist/vue-async.cjs +1 -0
- package/dist/vue-async.js +17 -0
- package/dist/vue.cjs +1 -0
- package/dist/vue.js +53 -0
- package/package.json +44 -6
- package/dist/textwrap-DWzM7pt1.d.cts +0 -135
- package/dist/textwrap-DWzM7pt1.d.ts +0 -135
|
@@ -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;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as ReportPreview } from './ReportPreview';
|
|
2
|
+
export { default as ReportToolbar } from './ReportToolbar';
|
|
3
|
+
export * from './adapters';
|
|
4
|
+
export * from './local-adapter';
|
|
5
|
+
export * from './injection-keys';
|
|
6
|
+
export * from './plugin';
|
|
7
|
+
export * from './config';
|
|
8
|
+
export * from './pdf-exporter';
|
|
9
|
+
export * from './errors';
|
|
10
|
+
export * from './controller';
|
|
11
|
+
export * from './composables/usePageWindow';
|
|
12
|
+
export * from './composables/useZoom';
|
|
13
|
+
export * from './composables/usePrintExport';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as ReportPreview } from './ReportPreview';
|
|
2
|
+
export { default as ReportToolbar } from './ReportToolbar';
|
|
3
|
+
export * from './adapters';
|
|
4
|
+
export * from './local-adapter';
|
|
5
|
+
export * from './injection-keys';
|
|
6
|
+
export * from './plugin';
|
|
7
|
+
export * from './config';
|
|
8
|
+
export * from './pdf-exporter';
|
|
9
|
+
export * from './errors';
|
|
10
|
+
export * from './controller';
|
|
11
|
+
export * from './composables/usePageWindow';
|
|
12
|
+
export * from './composables/useZoom';
|
|
13
|
+
export * from './composables/usePrintExport';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
import { PlanFetcher } from './adapters';
|
|
3
|
+
import { PdfExporter } from './pdf-exporter';
|
|
4
|
+
import { MachReportConfig } from './config';
|
|
5
|
+
import { MachReportController } from './controller';
|
|
6
|
+
/**
|
|
7
|
+
* 注入 key 全部为字符串(而非裸 Symbol):跨模块联邦边界时宿主与远程
|
|
8
|
+
* 各自打包会生成不同的 Symbol 实例导致 inject 失效;字符串恒等。
|
|
9
|
+
* 保留 InjectionKey 类型以获得类型提示。
|
|
10
|
+
*/
|
|
11
|
+
export declare const MACH_REPORT_FETCHER_KEY: InjectionKey<PlanFetcher>;
|
|
12
|
+
export declare const MACH_REPORT_PDF_EXPORTER_KEY: InjectionKey<PdfExporter>;
|
|
13
|
+
export declare const MACH_REPORT_CONFIG_KEY: InjectionKey<ComputedRef<MachReportConfig | null>>;
|
|
14
|
+
export declare const MACH_REPORT_CONTROLLER_KEY: InjectionKey<MachReportController>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReportTemplate } from '@agile-team/mach-report';
|
|
2
|
+
import { PlanFetcher } from './adapters';
|
|
3
|
+
export interface LocalTemplateEntry {
|
|
4
|
+
tempId: string;
|
|
5
|
+
template: ReportTemplate;
|
|
6
|
+
datasets?: Record<string, Record<string, unknown>[]>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 本地渲染适配器:模板 + 数据 → core 分页引擎 → RenderPlan。
|
|
10
|
+
* 用于离线预览、单测与 jh4j 后端不可用场景(单真相源验证)。
|
|
11
|
+
*/
|
|
12
|
+
export declare function createLocalFetcher(entries: Record<string, LocalTemplateEntry>): PlanFetcher;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RenderPlan } from '@agile-team/mach-report';
|
|
2
|
+
/** PDF 导出器:RenderPlan → PDF 字节。宿主可注入自定义实现(自研后端/Worker 化等)。 */
|
|
3
|
+
export type PdfExporter = (plan: RenderPlan) => Promise<Uint8Array>;
|
|
4
|
+
export interface DefaultPdfExporterOptions {
|
|
5
|
+
/** 中文字体 URL(浏览器 fetch);空串跳过字体加载(西文报表) */
|
|
6
|
+
fontUrl: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 默认 PDF 导出器:
|
|
10
|
+
* - 懒加载 @agile-team/mach-report/pdf(含 pdf-lib,只在首次导出时进 bundle)
|
|
11
|
+
* - 字体走 IndexedDB 持久缓存(loadFontWithCache,二次导出零网络)
|
|
12
|
+
*/
|
|
13
|
+
export declare function createDefaultPdfExporter(options?: DefaultPdfExporterOptions): PdfExporter;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { PlanFetcher, HostRequest } from './adapters';
|
|
3
|
+
import { PdfExporter } from './pdf-exporter';
|
|
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
|
+
});
|
|
263
|
+
export interface MachReportPluginOptions {
|
|
264
|
+
/**
|
|
265
|
+
* 数据面(全部可选——零配置时用全局 fetch 同源直连):
|
|
266
|
+
* - request:宿主 http 客户端(axios 风格签名)
|
|
267
|
+
* - fetcher:完整 PlanFetcher(自定义数据面/本地模板,优先级最高)
|
|
268
|
+
*/
|
|
269
|
+
request?: HostRequest;
|
|
270
|
+
baseUrl?: string;
|
|
271
|
+
fetcher?: PlanFetcher;
|
|
272
|
+
/** 应用级配置中心(defaults/presets/文案/主题),见 defineMachReportConfig */
|
|
273
|
+
config?: MachReportConfig;
|
|
274
|
+
/** PDF 导出字体 URL(默认 /simhei.ttf;'' 跳过字体) */
|
|
275
|
+
pdfFontUrl?: string;
|
|
276
|
+
/** 自定义 PDF 导出器(缺省用懒加载引擎 /pdf 子路径的默认实现) */
|
|
277
|
+
pdfExporter?: PdfExporter;
|
|
278
|
+
/** 注册全局组件 <MachReportPreview>(默认 true;懒加载分片不影响首屏) */
|
|
279
|
+
globalComponent?: boolean;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Vue 插件(零配置可用,对齐 mach-table 的快速集成体验):
|
|
283
|
+
*
|
|
284
|
+
* ```ts
|
|
285
|
+
* app.use(machReportPlugin) // 同源 jh4j 部署,零胶水
|
|
286
|
+
* app.use(machReportPlugin, { baseUrl: "/sub/mach-report" })
|
|
287
|
+
* app.use(machReportPlugin, { request: axios, config: defineMachReportConfig({...}) })
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* 之后业务模板直接写 `<MachReportPreview temp-id="X" />`。
|
|
291
|
+
*/
|
|
292
|
+
export declare const machReportPlugin: {
|
|
293
|
+
install(app: App, options?: MachReportPluginOptions): void;
|
|
294
|
+
};
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,17 @@
|
|
|
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));
|
|
4
|
+
function m() {
|
|
5
|
+
return import("./ReportPreview-DgsOdO4y.js").then((t) => t.j);
|
|
6
|
+
}
|
|
7
|
+
const p = {
|
|
8
|
+
install(t, o = {}) {
|
|
9
|
+
n.install(t, o), t.component("MachReportPreview", r);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
r as MachReportPreview,
|
|
14
|
+
p as default,
|
|
15
|
+
p as machReportAsyncPlugin,
|
|
16
|
+
m as preloadMachReport
|
|
17
|
+
};
|
package/dist/vue.cjs
ADDED
|
@@ -0,0 +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;
|
package/dist/vue.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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";
|
|
4
|
+
import { paginateTemplate as p } from "@agile-team/mach-report";
|
|
5
|
+
import { inject as R } from "vue";
|
|
6
|
+
function h(n) {
|
|
7
|
+
return async ({ tempIds: a }) => {
|
|
8
|
+
if (a.length === 0) throw new s("缺少报表模板 ID");
|
|
9
|
+
const r = [];
|
|
10
|
+
for (const o of a) {
|
|
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);
|
|
15
|
+
}
|
|
16
|
+
return { schemaVersion: "mach-local", pages: r };
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function m() {
|
|
20
|
+
return R(c, null);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
g as DEFAULT_MESSAGES,
|
|
24
|
+
T as DEFAULT_THEME,
|
|
25
|
+
K as MACH_REPORT_CONFIG_KEY,
|
|
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,
|
|
32
|
+
M as ReportPreview,
|
|
33
|
+
d as ReportToolbar,
|
|
34
|
+
C as buildPrintDocument,
|
|
35
|
+
S as createDefaultPdfExporter,
|
|
36
|
+
y as createFetchRequest,
|
|
37
|
+
N as createJh4jGridPlanFetcher,
|
|
38
|
+
h as createLocalFetcher,
|
|
39
|
+
w as defineMachReportConfig,
|
|
40
|
+
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,
|
|
51
|
+
m as useReportPreview,
|
|
52
|
+
b as useZoom
|
|
53
|
+
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agile-team/mach-report",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MachReport 报表引擎单包:RenderPlan 模型 + 分页 + DOM/Canvas/PDF 渲染 + 动态 SQL + 管理端 API
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "MachReport 报表引擎单包:RenderPlan 模型 + 分页 + DOM/Canvas/PDF 渲染 + 动态 SQL + 管理端 API + Vue 3 契约组件(零运行时依赖;./vue 为框架子路径,vue 为可选 peer)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"sideEffects":
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css",
|
|
8
|
+
"**/*.vue"
|
|
9
|
+
],
|
|
7
10
|
"main": "./dist/index.cjs",
|
|
8
11
|
"types": "./dist/index.d.ts",
|
|
9
12
|
"exports": {
|
|
@@ -46,7 +49,28 @@
|
|
|
46
49
|
"types": "./dist/manager.d.cts",
|
|
47
50
|
"default": "./dist/manager.cjs"
|
|
48
51
|
}
|
|
49
|
-
}
|
|
52
|
+
},
|
|
53
|
+
"./vue": {
|
|
54
|
+
"import": {
|
|
55
|
+
"types": "./dist/vue/index.d.ts",
|
|
56
|
+
"default": "./dist/vue.js"
|
|
57
|
+
},
|
|
58
|
+
"require": {
|
|
59
|
+
"types": "./dist/vue/index.d.cts",
|
|
60
|
+
"default": "./dist/vue.cjs"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"./vue/async": {
|
|
64
|
+
"import": {
|
|
65
|
+
"types": "./dist/vue/async.d.ts",
|
|
66
|
+
"default": "./dist/vue-async.js"
|
|
67
|
+
},
|
|
68
|
+
"require": {
|
|
69
|
+
"types": "./dist/vue/async.d.cts",
|
|
70
|
+
"default": "./dist/vue-async.cjs"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"./vue/style.css": "./dist/style.css"
|
|
50
74
|
},
|
|
51
75
|
"publishConfig": {
|
|
52
76
|
"access": "public"
|
|
@@ -57,14 +81,28 @@
|
|
|
57
81
|
"files": [
|
|
58
82
|
"dist"
|
|
59
83
|
],
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"vue": "^3.2.0"
|
|
86
|
+
},
|
|
87
|
+
"peerDependenciesMeta": {
|
|
88
|
+
"vue": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
60
92
|
"devDependencies": {
|
|
61
93
|
"@pdf-lib/fontkit": "^1.1.1",
|
|
94
|
+
"@vitejs/plugin-vue": "^6.0.9",
|
|
95
|
+
"@vue/test-utils": "^2.4.0",
|
|
62
96
|
"node-sql-parser": "^5.4.0",
|
|
63
97
|
"pdf-lib": "^1.17.1",
|
|
64
|
-
"
|
|
98
|
+
"typescript": "^5.9.0",
|
|
99
|
+
"vite": "^7.3.6",
|
|
100
|
+
"vite-plugin-dts": "^4.5.0",
|
|
101
|
+
"vue": "^3.5.0",
|
|
102
|
+
"vue-tsc": "^3.0.0"
|
|
65
103
|
},
|
|
66
104
|
"scripts": {
|
|
67
|
-
"build": "
|
|
105
|
+
"build": "vite build && node scripts/copy-dcts.mjs",
|
|
68
106
|
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
|
|
69
107
|
},
|
|
70
108
|
"module": "./dist/index.js"
|