@agile-team/mach-report 2.0.0 → 2.2.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/LICENSE +2 -4
- package/LICENSING.md +15 -0
- package/README.md +317 -76
- package/dist/ReportPreview-BWrQCj9M.js +1643 -0
- package/dist/ReportPreview-DY0PGGqF.cjs +6 -0
- package/dist/grid-geometry-DBH9ExuY.cjs +1 -0
- package/dist/grid-geometry-DONcjshk.js +130 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +806 -13
- package/dist/index.d.ts +806 -13
- package/dist/index.js +1170 -653
- package/dist/page-window-index-CIuT4BAv.js +43 -0
- package/dist/page-window-index-DEjnM6IB.cjs +1 -0
- package/dist/pdf.cjs +48 -48
- package/dist/pdf.d.cts +159 -6
- package/dist/pdf.d.ts +159 -6
- package/dist/pdf.js +3542 -3466
- package/dist/plugin-BMoMUxrw.cjs +1 -0
- package/dist/plugin-CAcNe0FT.js +25 -0
- package/dist/report-params-B3Fia6JO.js +10 -0
- package/dist/report-params-D1gZ1DME.cjs +1 -0
- package/dist/sql.cjs +65 -64
- package/dist/sql.d.cts +109 -5
- package/dist/sql.d.ts +109 -5
- package/dist/sql.js +7947 -7922
- package/dist/style.css +1 -1
- package/dist/textwrap-DdaewxAd.js +117 -0
- package/dist/textwrap-DqiFwAV3.cjs +3 -0
- package/dist/vue/async.d.cts +820 -320
- package/dist/vue/async.d.ts +820 -320
- package/dist/vue/index.d.cts +1374 -14
- package/dist/vue/index.d.ts +1374 -14
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +11 -12
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +129 -49
- package/dist/xlsx.cjs +21 -21
- package/dist/xlsx.d.cts +2300 -5
- package/dist/xlsx.d.ts +2300 -5
- package/dist/xlsx.js +6390 -6347
- package/package.json +8 -3
- package/dist/ReportPreview-Cr0IH1Rz.cjs +0 -6
- package/dist/ReportPreview-DwknBgsJ.js +0 -1266
- package/dist/builder/template-builder.d.ts +0 -69
- package/dist/defaults.d.ts +0 -23
- package/dist/format.d.ts +0 -48
- package/dist/grid-geometry-BXpOxznT.cjs +0 -1
- package/dist/grid-geometry-Bs8QXz1X.js +0 -65
- package/dist/layout/paginate.d.ts +0 -97
- package/dist/layout/textwrap.d.ts +0 -36
- package/dist/pdf/font-loader.d.ts +0 -6
- package/dist/pdf/index.d.ts +0 -2
- package/dist/pdf/render-pdf.d.ts +0 -25
- package/dist/plugin-Cj3c2wJc.cjs +0 -1
- package/dist/plugin-DJf_6_fl.js +0 -18
- package/dist/render/canvas.d.ts +0 -76
- package/dist/render/dom.d.ts +0 -10
- package/dist/render/grid-geometry.d.ts +0 -41
- package/dist/render/style.d.ts +0 -33
- package/dist/render/window.d.ts +0 -23
- package/dist/schema/render-plan.d.ts +0 -88
- package/dist/schema/validate.d.ts +0 -15
- package/dist/sql/ast-check.d.ts +0 -14
- package/dist/sql/compile.d.ts +0 -31
- package/dist/sql/expr.d.ts +0 -21
- package/dist/sql/index.d.ts +0 -4
- package/dist/sql/tokenizer.d.ts +0 -25
- package/dist/style-CFZ-HE2s.cjs +0 -3
- package/dist/style-DnmtG7Gl.js +0 -180
- package/dist/units.d.ts +0 -11
- package/dist/vue/ReportParamPanel.d.ts +0 -19
- package/dist/vue/ReportPreview.d.ts +0 -200
- package/dist/vue/ReportToolbar.d.ts +0 -42
- package/dist/vue/adapters.d.ts +0 -34
- package/dist/vue/composables/useHighlight.d.ts +0 -8
- package/dist/vue/composables/usePageWindow.d.ts +0 -25
- package/dist/vue/composables/usePrintExport.d.ts +0 -40
- package/dist/vue/composables/useReportSearch.d.ts +0 -73
- package/dist/vue/composables/useZoom.d.ts +0 -15
- package/dist/vue/config.d.ts +0 -108
- package/dist/vue/controller.d.ts +0 -29
- package/dist/vue/errors.d.ts +0 -16
- package/dist/vue/injection-keys.d.ts +0 -14
- package/dist/vue/local-adapter.d.ts +0 -11
- package/dist/vue/pdf-exporter.d.ts +0 -13
- package/dist/vue/plugin.d.ts +0 -332
- package/dist/xlsx/render-xlsx.d.ts +0 -20
package/dist/vue/index.d.cts
CHANGED
|
@@ -1,14 +1,1374 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
export * from "@agile-team/mach-report";
|
|
2
|
+
import { AllowedComponentProps } from 'vue';
|
|
3
|
+
import { App } from 'vue';
|
|
4
|
+
import { ComponentCustomProps } from 'vue';
|
|
5
|
+
import { ComponentOptionsBase } from 'vue';
|
|
6
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
7
|
+
import { ComponentProvideOptions } from 'vue';
|
|
8
|
+
import { ComputedRef } from 'vue';
|
|
9
|
+
import { CreateComponentPublicInstanceWithMixins } from 'vue';
|
|
10
|
+
import { CSSProperties } from 'vue';
|
|
11
|
+
import { DefineComponent } from 'vue';
|
|
12
|
+
import { ExtractPropTypes } from 'vue';
|
|
13
|
+
import { GlobalComponents } from 'vue';
|
|
14
|
+
import { GlobalDirectives } from 'vue';
|
|
15
|
+
import { InjectionKey } from 'vue';
|
|
16
|
+
import { PropType } from 'vue';
|
|
17
|
+
import { PublicProps } from 'vue';
|
|
18
|
+
import { Ref } from 'vue';
|
|
19
|
+
import { VNodeProps } from 'vue';
|
|
20
|
+
|
|
21
|
+
declare const __VLS_component: DefineComponent<ExtractPropTypes< {
|
|
22
|
+
reportId: {
|
|
23
|
+
type: PropType<string | string[] | null>;
|
|
24
|
+
default: null;
|
|
25
|
+
};
|
|
26
|
+
params: {
|
|
27
|
+
type: 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
|
+
/** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
|
|
39
|
+
showExport: {
|
|
40
|
+
type: BooleanConstructor;
|
|
41
|
+
default: undefined;
|
|
42
|
+
};
|
|
43
|
+
showPrint: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
showPdfWindow: {
|
|
48
|
+
type: BooleanConstructor;
|
|
49
|
+
default: undefined;
|
|
50
|
+
};
|
|
51
|
+
/** 页间距(px);不传走配置中心 */
|
|
52
|
+
gapPx: {
|
|
53
|
+
type: NumberConstructor;
|
|
54
|
+
default: undefined;
|
|
55
|
+
};
|
|
56
|
+
/** 工具栏/状态文案覆写(不传走配置中心 messages) */
|
|
57
|
+
messages: {
|
|
58
|
+
type: PropType<Partial<MachReportMessages>>;
|
|
59
|
+
default: undefined;
|
|
60
|
+
};
|
|
61
|
+
/** 启用的 preset 名(不传用配置中心 defaultPreset) */
|
|
62
|
+
preset: {
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
66
|
+
/** 调试面板(也可用 URL ?mrp-debug=1 开启) */
|
|
67
|
+
debug: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
/** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
|
|
72
|
+
paramDefs: {
|
|
73
|
+
type: PropType<ReportParamDef[] | undefined>;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
/** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
|
|
77
|
+
showParams: {
|
|
78
|
+
type: BooleanConstructor;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
fetcher: {
|
|
82
|
+
type: PropType<PlanFetcher | null>;
|
|
83
|
+
default: null;
|
|
84
|
+
};
|
|
85
|
+
}>, {
|
|
86
|
+
reload: typeof reload;
|
|
87
|
+
print: typeof print_2;
|
|
88
|
+
exportAs: typeof exportAs;
|
|
89
|
+
openPdfWindow: typeof openPdfWindow;
|
|
90
|
+
gotoPage: typeof gotoPage;
|
|
91
|
+
setParams: typeof setParams;
|
|
92
|
+
checkPdfFont: typeof checkPdfFont;
|
|
93
|
+
state: ComputedRef<MachReportState>;
|
|
94
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
95
|
+
error: (message: string, detail?: {
|
|
96
|
+
code: string;
|
|
97
|
+
cause?: unknown;
|
|
98
|
+
} | undefined) => any;
|
|
99
|
+
loaded: (pageCount: number) => any;
|
|
100
|
+
warning: (message: string) => any;
|
|
101
|
+
}, string, PublicProps, Readonly<ExtractPropTypes< {
|
|
102
|
+
reportId: {
|
|
103
|
+
type: PropType<string | string[] | null>;
|
|
104
|
+
default: null;
|
|
105
|
+
};
|
|
106
|
+
params: {
|
|
107
|
+
type: PropType<Record<string, string>>;
|
|
108
|
+
default: () => {};
|
|
109
|
+
};
|
|
110
|
+
height: {
|
|
111
|
+
type: StringConstructor;
|
|
112
|
+
default: string;
|
|
113
|
+
};
|
|
114
|
+
autoLoad: {
|
|
115
|
+
type: BooleanConstructor;
|
|
116
|
+
default: boolean;
|
|
117
|
+
};
|
|
118
|
+
/** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
|
|
119
|
+
showExport: {
|
|
120
|
+
type: BooleanConstructor;
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
showPrint: {
|
|
124
|
+
type: BooleanConstructor;
|
|
125
|
+
default: undefined;
|
|
126
|
+
};
|
|
127
|
+
showPdfWindow: {
|
|
128
|
+
type: BooleanConstructor;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
131
|
+
/** 页间距(px);不传走配置中心 */
|
|
132
|
+
gapPx: {
|
|
133
|
+
type: NumberConstructor;
|
|
134
|
+
default: undefined;
|
|
135
|
+
};
|
|
136
|
+
/** 工具栏/状态文案覆写(不传走配置中心 messages) */
|
|
137
|
+
messages: {
|
|
138
|
+
type: PropType<Partial<MachReportMessages>>;
|
|
139
|
+
default: undefined;
|
|
140
|
+
};
|
|
141
|
+
/** 启用的 preset 名(不传用配置中心 defaultPreset) */
|
|
142
|
+
preset: {
|
|
143
|
+
type: StringConstructor;
|
|
144
|
+
default: undefined;
|
|
145
|
+
};
|
|
146
|
+
/** 调试面板(也可用 URL ?mrp-debug=1 开启) */
|
|
147
|
+
debug: {
|
|
148
|
+
type: BooleanConstructor;
|
|
149
|
+
default: boolean;
|
|
150
|
+
};
|
|
151
|
+
/** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
|
|
152
|
+
paramDefs: {
|
|
153
|
+
type: PropType<ReportParamDef[] | undefined>;
|
|
154
|
+
default: undefined;
|
|
155
|
+
};
|
|
156
|
+
/** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
|
|
157
|
+
showParams: {
|
|
158
|
+
type: BooleanConstructor;
|
|
159
|
+
default: undefined;
|
|
160
|
+
};
|
|
161
|
+
fetcher: {
|
|
162
|
+
type: PropType<PlanFetcher | null>;
|
|
163
|
+
default: null;
|
|
164
|
+
};
|
|
165
|
+
}>> & Readonly<{
|
|
166
|
+
onError?: ((message: string, detail?: {
|
|
167
|
+
code: string;
|
|
168
|
+
cause?: unknown;
|
|
169
|
+
} | undefined) => any) | undefined;
|
|
170
|
+
onLoaded?: ((pageCount: number) => any) | undefined;
|
|
171
|
+
onWarning?: ((message: string) => any) | undefined;
|
|
172
|
+
}>, {
|
|
173
|
+
height: string;
|
|
174
|
+
gapPx: number;
|
|
175
|
+
params: Record<string, string>;
|
|
176
|
+
debug: boolean;
|
|
177
|
+
showExport: boolean;
|
|
178
|
+
showPrint: boolean;
|
|
179
|
+
showPdfWindow: boolean;
|
|
180
|
+
showParams: boolean;
|
|
181
|
+
messages: Partial<MachReportMessages>;
|
|
182
|
+
reportId: string | string[] | null;
|
|
183
|
+
autoLoad: boolean;
|
|
184
|
+
preset: string;
|
|
185
|
+
paramDefs: ReportParamDef[] | undefined;
|
|
186
|
+
fetcher: PlanFetcher | null;
|
|
187
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {
|
|
188
|
+
viewportRef: HTMLDivElement;
|
|
189
|
+
containerRef: HTMLDivElement;
|
|
190
|
+
thumbsRef: HTMLElement;
|
|
191
|
+
}, HTMLDivElement>;
|
|
192
|
+
|
|
193
|
+
declare type __VLS_Props = {
|
|
194
|
+
pageCount: number;
|
|
195
|
+
currentPage: number;
|
|
196
|
+
zoomMode: "fit" | "raw";
|
|
197
|
+
zoom: number;
|
|
198
|
+
showExport: boolean;
|
|
199
|
+
showPrint: boolean;
|
|
200
|
+
showPdfWindow: boolean;
|
|
201
|
+
messages: MachReportMessages;
|
|
202
|
+
search: {
|
|
203
|
+
visible: boolean;
|
|
204
|
+
query: string;
|
|
205
|
+
matchIndex: number;
|
|
206
|
+
matchCount: number;
|
|
207
|
+
searching?: boolean;
|
|
208
|
+
};
|
|
209
|
+
thumbsVisible: boolean;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
declare type __VLS_Props_2 = {
|
|
213
|
+
defs: ReportParamDef[];
|
|
214
|
+
modelValue: Record<string, string>;
|
|
215
|
+
messages: MachReportMessages;
|
|
216
|
+
/** 触发过查询后才开始必填提示(避免首屏一片红) */
|
|
217
|
+
attempted: boolean;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
declare function __VLS_template(): {
|
|
221
|
+
attrs: Partial<{}>;
|
|
222
|
+
slots: {
|
|
223
|
+
default?(_: {}): any;
|
|
224
|
+
};
|
|
225
|
+
refs: {
|
|
226
|
+
viewportRef: HTMLDivElement;
|
|
227
|
+
containerRef: HTMLDivElement;
|
|
228
|
+
thumbsRef: HTMLElement;
|
|
229
|
+
};
|
|
230
|
+
rootEl: HTMLDivElement;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
234
|
+
|
|
235
|
+
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
236
|
+
new (): {
|
|
237
|
+
$slots: S;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/** 供 HTML/Word 导出的完整文档;打印路径逐页渲染,避免预先生成所有页。 */
|
|
242
|
+
export declare function buildPrintDocument(p: RenderPlan): PrintHtmlResult;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Word 导出(Word 兼容 HTML,.doc MIME):
|
|
246
|
+
* 复用打印文档构建(同一样式与 named pages 分页规则),套 Word 命名空间头。
|
|
247
|
+
* Word 2003+ 可直接打开编辑——覆盖"导出可编辑单据"场景,零后端。
|
|
248
|
+
*/
|
|
249
|
+
export declare function buildWordHtml(p: RenderPlan): {
|
|
250
|
+
html: string;
|
|
251
|
+
filename: string;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/** 检查失败只影响 PDF 诊断,不阻塞预览或其它输出。 */
|
|
255
|
+
declare function checkPdfFont(): Promise<PdfFontCheckResult>;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 列值格式化(声明式、JSON 可序列化)。
|
|
259
|
+
* 在 paginate 的 cellText 出口统一消费:格式化发生在进 RenderPlan 之前,
|
|
260
|
+
* 三后端(DOM/Canvas/PDF)零改动。
|
|
261
|
+
*
|
|
262
|
+
* 语义约定(v0.9 固化):
|
|
263
|
+
* - number.digits 显式给出 → 精确保留(12.5 + digits:2 → "12.50")
|
|
264
|
+
* - number.thousands 默认 false(千分位显式开启)
|
|
265
|
+
* - date 字符串按"本地时区的日历日"解析(YYYY-MM-DD / YYYY/MM/DD 直取年月日,
|
|
266
|
+
* 不经 Date 字符串构造——后者按 UTC 零点,负时区环境会少一天)
|
|
267
|
+
*/
|
|
268
|
+
|
|
269
|
+
declare type ColumnFormat =
|
|
270
|
+
| { kind: "number"; thousands?: boolean; digits?: number }
|
|
271
|
+
| { kind: "percent"; digits?: number }
|
|
272
|
+
| { kind: "date"; pattern?: string };
|
|
273
|
+
|
|
274
|
+
declare type ComponentKind =
|
|
275
|
+
| "text"
|
|
276
|
+
| "image"
|
|
277
|
+
| "barcode"
|
|
278
|
+
| "qrcode"
|
|
279
|
+
| "chart"
|
|
280
|
+
| "line"
|
|
281
|
+
| "rect"
|
|
282
|
+
| "ellipse";
|
|
283
|
+
|
|
284
|
+
declare interface ComponentStyle {
|
|
285
|
+
fontSizePx?: number;
|
|
286
|
+
fontSize?: number;
|
|
287
|
+
fontFamily?: string;
|
|
288
|
+
bold?: boolean;
|
|
289
|
+
italic?: boolean;
|
|
290
|
+
underline?: boolean;
|
|
291
|
+
color?: string;
|
|
292
|
+
backgroundColor?: string;
|
|
293
|
+
align?: "left" | "center" | "right" | "justify";
|
|
294
|
+
verticalAlign?: "top" | "middle" | "bottom";
|
|
295
|
+
lineColor?: string;
|
|
296
|
+
borderColor?: string;
|
|
297
|
+
lineWidthPt?: number;
|
|
298
|
+
borderTop?: boolean;
|
|
299
|
+
borderRight?: boolean;
|
|
300
|
+
borderBottom?: boolean;
|
|
301
|
+
borderLeft?: boolean;
|
|
302
|
+
lineHeight?: number;
|
|
303
|
+
letterSpacing?: number;
|
|
304
|
+
opacity?: number;
|
|
305
|
+
rotateDeg?: number;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
declare type ConfigRef = ComputedRef<MachReportConfig | null>;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* 默认 PDF 导出器:
|
|
312
|
+
* - 懒加载 @agile-team/mach-report/pdf(含 pdf-lib,只在首次导出时进 bundle)
|
|
313
|
+
* - 字体走 IndexedDB 持久缓存(loadFontWithCache,二次导出零网络)
|
|
314
|
+
*/
|
|
315
|
+
export declare function createDefaultPdfExporter(options?: DefaultPdfExporterOptions): PdfExporter;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* 零依赖请求适配器:用全局 fetch 实现 HostRequest 签名,
|
|
319
|
+
* 供自定义 PlanFetcher 按需调用,不预设任何报表接口路径或响应包装。
|
|
320
|
+
* 内置超时(AbortController)与网络/HTTP 错误语义。
|
|
321
|
+
*/
|
|
322
|
+
export declare function createFetchRequest(options?: FetchRequestOptions): HostRequest;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* 本地渲染适配器:模板 + 数据 → core 分页引擎 → RenderPlan。
|
|
326
|
+
* 用于本地预览、离线场景和单测。
|
|
327
|
+
*/
|
|
328
|
+
export declare function createLocalFetcher(entries: Record<string, LocalTemplateEntry> | ReportRegistry): PlanFetcher;
|
|
329
|
+
|
|
330
|
+
declare type DatasetRows = Record<string, Record<string, unknown>[]>;
|
|
331
|
+
|
|
332
|
+
export declare const DEFAULT_MESSAGES: MachReportMessages;
|
|
333
|
+
|
|
334
|
+
export declare const DEFAULT_THEME: MachReportTheme;
|
|
335
|
+
|
|
336
|
+
export declare interface DefaultPdfExporterOptions {
|
|
337
|
+
/** 中文字体 URL(浏览器 fetch);空串跳过字体加载(西文报表) */
|
|
338
|
+
fontUrl: string;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/** 类型化配置声明,归一化为完整配置,便于直接传给插件或路由层。 */
|
|
342
|
+
export declare function defineMachReportConfig(config?: MachReportConfigInput): MachReportConfig;
|
|
343
|
+
|
|
344
|
+
/** 类型化 preset 声明 */
|
|
345
|
+
export declare function defineMachReportPreset(preset: MachReportPreset): MachReportPreset;
|
|
346
|
+
|
|
347
|
+
declare function exportAs(format: string): Promise<void>;
|
|
348
|
+
|
|
349
|
+
export declare interface FetchRequestOptions {
|
|
350
|
+
/** 网关前缀(默认空 = 同源) */
|
|
351
|
+
baseUrl?: string;
|
|
352
|
+
/** 附加请求头(如鉴权 token) */
|
|
353
|
+
headers?: Record<string, string>;
|
|
354
|
+
credentials?: RequestCredentials;
|
|
355
|
+
/** 完整请求(含 JSON 响应体)的超时毫秒(默认 30000;超时抛 PlanLoadError) */
|
|
356
|
+
timeoutMs?: number;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
declare function gotoPage(n: number): void;
|
|
360
|
+
|
|
361
|
+
declare interface GridCell {
|
|
362
|
+
text?: string;
|
|
363
|
+
rawText?: string;
|
|
364
|
+
/** 原始值,仅供 Excel raw 模式消费;不参与预览、分页与 PDF 绘制。 */
|
|
365
|
+
value?: string | number | boolean | null;
|
|
366
|
+
/** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
|
|
367
|
+
numberFormat?: string;
|
|
368
|
+
children?: PlanComponent[];
|
|
369
|
+
colSpan?: number;
|
|
370
|
+
rowSpan?: number;
|
|
371
|
+
style?: ComponentStyle;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** 通用请求函数签名(可适配 Axios 风格客户端) */
|
|
375
|
+
export declare type HostRequest = (config: {
|
|
376
|
+
url: string;
|
|
377
|
+
method: string;
|
|
378
|
+
params?: Record<string, string>;
|
|
379
|
+
/** 取消单次请求;可与内置超时一起使用 */
|
|
380
|
+
signal?: AbortSignal;
|
|
381
|
+
}) => Promise<unknown>;
|
|
382
|
+
|
|
383
|
+
export declare function joinReportIds(reportId: ReportIdInput): string;
|
|
384
|
+
|
|
385
|
+
/** auto:真实数字/显式数值格式居右,日期与布尔居中,其他内容居左。 */
|
|
386
|
+
declare type ListAlignment = NonNullable<ComponentStyle["align"]> | "auto";
|
|
387
|
+
|
|
388
|
+
declare interface ListColumn {
|
|
389
|
+
header: string;
|
|
390
|
+
field: string;
|
|
391
|
+
widthMm: number;
|
|
392
|
+
style?: ComponentStyle;
|
|
393
|
+
/** 内容对齐,优先于 style.align;数值字符串不会自动判为数字。 */
|
|
394
|
+
align?: ListAlignment;
|
|
395
|
+
/** 独立的表头对齐,不改变内容对齐。 */
|
|
396
|
+
headerAlign?: ComponentStyle["align"];
|
|
397
|
+
/** 独立的表头样式,优先于列表级表头样式。 */
|
|
398
|
+
headerStyle?: ComponentStyle;
|
|
399
|
+
/** 值格式化(声明式):千分位/小数位、百分比、日期 pattern */
|
|
400
|
+
format?: ColumnFormat;
|
|
401
|
+
/** 条件格式规则(声明式,命中合并进单元格样式;如负数红字) */
|
|
402
|
+
rules?: StyleRule[];
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare interface ListComponent {
|
|
406
|
+
kind: "list";
|
|
407
|
+
id?: string;
|
|
408
|
+
leftMm: number;
|
|
409
|
+
topMm: number;
|
|
410
|
+
widthMm: number;
|
|
411
|
+
dataset: string;
|
|
412
|
+
columns: ListColumn[];
|
|
413
|
+
fontSizePt?: number;
|
|
414
|
+
headerBold?: boolean;
|
|
415
|
+
rowHeightMm?: number;
|
|
416
|
+
paddingMm?: number;
|
|
417
|
+
headerEveryPage?: boolean;
|
|
418
|
+
headerBackgroundColor?: string;
|
|
419
|
+
/** 内容默认对齐,列配置可覆盖;低层模板缺省仍为 left。 */
|
|
420
|
+
align?: ListAlignment;
|
|
421
|
+
/** 表头默认对齐,列配置可覆盖。 */
|
|
422
|
+
headerAlign?: ComponentStyle["align"];
|
|
423
|
+
headerStyle?: ComponentStyle;
|
|
424
|
+
border?: boolean;
|
|
425
|
+
/** 分组小计(组头/组尾小计/组头防孤行) */
|
|
426
|
+
groupBy?: ListGroupBy;
|
|
427
|
+
/** 末尾总合计行(依赖 groupBy.subtotal 或显式 fields) */
|
|
428
|
+
grandTotal?: ListGrandTotal;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
declare type ListGrandTotal =
|
|
432
|
+
| boolean
|
|
433
|
+
| {
|
|
434
|
+
label?: string;
|
|
435
|
+
style?: ComponentStyle;
|
|
436
|
+
/** 合计列(缺省沿用 groupBy.subtotal) */
|
|
437
|
+
fields?: string[];
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/** 分组小计配置(声明式,见 ListComponent.groupBy) */
|
|
441
|
+
declare interface ListGroupBy {
|
|
442
|
+
/** 分组字段(值变化即切组) */
|
|
443
|
+
field: string;
|
|
444
|
+
/** 组头文案模板,{value} 占位(默认 "{value}") */
|
|
445
|
+
headerTemplate?: string;
|
|
446
|
+
headerStyle?: ComponentStyle;
|
|
447
|
+
/** 需要小计的列字段(组尾输出合计行;数值列求和,其余输出首值/留空) */
|
|
448
|
+
subtotal?: string[];
|
|
449
|
+
subtotalStyle?: ComponentStyle;
|
|
450
|
+
subtotalLabel?: string;
|
|
451
|
+
/** 组头防孤行(默认 true:页尾放不下"组头+首行"时整体换页) */
|
|
452
|
+
keepWithNext?: boolean;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export declare interface LocalTemplateEntry {
|
|
456
|
+
template: ReportTemplate;
|
|
457
|
+
datasets?: Record<string, Record<string, unknown>[]>;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export declare const MACH_REPORT_CONFIG_KEY: InjectionKey<ComputedRef<MachReportConfig | null>>;
|
|
461
|
+
|
|
462
|
+
export declare const MACH_REPORT_CONTROLLER_KEY: InjectionKey<MachReportController>;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* 注入 key 全部为字符串(而非裸 Symbol):跨模块联邦边界时宿主与远程
|
|
466
|
+
* 各自打包会生成不同的 Symbol 实例导致 inject 失效;字符串恒等。
|
|
467
|
+
* 保留 InjectionKey 类型以获得类型提示。
|
|
468
|
+
*/
|
|
469
|
+
export declare const MACH_REPORT_FETCHER_KEY: InjectionKey<PlanFetcher>;
|
|
470
|
+
|
|
471
|
+
export declare const MACH_REPORT_PDF_EXPORTER_KEY: InjectionKey<PdfExporter>;
|
|
472
|
+
|
|
473
|
+
export declare interface MachReportConfig {
|
|
474
|
+
defaults: MachReportDefaults;
|
|
475
|
+
presets: Record<string, MachReportPreset>;
|
|
476
|
+
/** 默认启用的 preset 名 */
|
|
477
|
+
defaultPreset?: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** 应用配置输入:只声明需要的 defaults 或 presets,省略层由包内补齐。 */
|
|
481
|
+
export declare type MachReportConfigInput = Partial<MachReportConfig>;
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* ReportPreview 的编程式控制器(与组件 ref 方法同面):
|
|
485
|
+
* reload / print / exportAs / openPdfWindow / gotoPage / setParams。
|
|
486
|
+
*/
|
|
487
|
+
export declare interface MachReportController {
|
|
488
|
+
/** 新组件提供;可选以兼容旧自定义控制器。 */
|
|
489
|
+
readonly state?: MachReportState;
|
|
490
|
+
checkPdfFont?(): Promise<PdfFontCheckResult>;
|
|
491
|
+
reload(): Promise<void>;
|
|
492
|
+
print(): Promise<void>;
|
|
493
|
+
/** 支持 html/pdf/xlsx/png/word(excel/image/doc 为兼容别名);未知格式报 export 错误。 */
|
|
494
|
+
exportAs(format: string): Promise<void> | void;
|
|
495
|
+
openPdfWindow(): void;
|
|
496
|
+
gotoPage(page: number): void;
|
|
497
|
+
/** 编程式设置参数并查询(合并进面板值;opts.reload=false 仅设值不重载) */
|
|
498
|
+
setParams(values: Record<string, string>, opts?: {
|
|
499
|
+
reload?: boolean;
|
|
500
|
+
}): Promise<void> | void;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** defaults 层可配置项(全部可选,均有内置缺省) */
|
|
504
|
+
export declare interface MachReportDefaults {
|
|
505
|
+
showExport?: boolean;
|
|
506
|
+
showPrint?: boolean;
|
|
507
|
+
showPdfWindow?: boolean;
|
|
508
|
+
/** 参数面板显隐(有参数定义且未显式关闭时显示;缺省 true) */
|
|
509
|
+
showParams?: boolean;
|
|
510
|
+
/** 页间距 px */
|
|
511
|
+
gapPx?: number;
|
|
512
|
+
/** PDF 导出中文字体 URL */
|
|
513
|
+
pdfFontUrl?: string;
|
|
514
|
+
theme?: Partial<MachReportTheme>;
|
|
515
|
+
messages?: Partial<MachReportMessages>;
|
|
516
|
+
/** 校验告警等内部日志通道(默认 console;静默传 { warn: () => {}, info: () => {} }) */
|
|
517
|
+
logger?: MachReportLogger;
|
|
518
|
+
preview?: MachReportPreviewOptions;
|
|
519
|
+
/** Excel 出口配置,按字段继承;不配置使用导出器默认值。 */
|
|
520
|
+
xlsx?: XlsxRenderOptions;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export declare class MachReportError extends Error {
|
|
524
|
+
readonly code: MachReportErrorCode;
|
|
525
|
+
readonly cause?: unknown;
|
|
526
|
+
constructor(code: MachReportErrorCode, message: string, cause?: unknown);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* 结构化错误(code 分类,宿主可按码决定 UX:重试 / 提示 / 降级)。
|
|
531
|
+
* error 事件契约保持 `(message: string)` 不变,新增第二参数 detail(可选)。
|
|
532
|
+
*/
|
|
533
|
+
export declare type MachReportErrorCode = "param" | "fetch" | "validate" | "render" | "pdf" | "print" | "export" | "config";
|
|
534
|
+
|
|
535
|
+
/** error 事件第二参数的形状(向后兼容:仅监听 message 的旧用法不受影响) */
|
|
536
|
+
export declare interface MachReportErrorDetail {
|
|
537
|
+
code: MachReportErrorCode;
|
|
538
|
+
cause?: unknown;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/** 父组件使用的稳定句柄;ref 回调直接绑定到预览组件。 */
|
|
542
|
+
export declare interface MachReportHandle extends MachReportController {
|
|
543
|
+
ref(instance: unknown): void;
|
|
544
|
+
readonly ready: ComputedRef<boolean>;
|
|
545
|
+
readonly state: MachReportState;
|
|
546
|
+
checkPdfFont(): Promise<PdfFontCheckResult>;
|
|
547
|
+
exportAs(format: string): Promise<void>;
|
|
548
|
+
setParams(values: Record<string, string>, opts?: {
|
|
549
|
+
reload?: boolean;
|
|
550
|
+
}): Promise<void>;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** 日志通道(默认 console;可注入 noop 静默或上报 collector) */
|
|
554
|
+
export declare type MachReportLogger = Pick<Console, "warn" | "info">;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* 配置中心(对齐 mach-table 的 defineMachTableConfig 体验):
|
|
558
|
+
* - 应用级:app.use(machReportPlugin, { config: defineMachReportConfig({...}) })
|
|
559
|
+
* - 路由级叠加:provideMachReportConfig(overlay)(响应式,就近覆盖)
|
|
560
|
+
* - 优先级:组件 props > 路由级叠加 > preset > defaults(props 永远最高)
|
|
561
|
+
*/
|
|
562
|
+
/** 工具栏与状态文案(默认简体中文;出海场景覆写) */
|
|
563
|
+
export declare interface MachReportMessages {
|
|
564
|
+
title: string;
|
|
565
|
+
prevPage: string;
|
|
566
|
+
nextPage: string;
|
|
567
|
+
/** 页码显示模板,{cur}/{total} 占位 */
|
|
568
|
+
pageInfo: string;
|
|
569
|
+
fitWidth: string;
|
|
570
|
+
exportHtml: string;
|
|
571
|
+
exportPdf: string;
|
|
572
|
+
exportExcel: string;
|
|
573
|
+
exportImage: string;
|
|
574
|
+
exportWord: string;
|
|
575
|
+
/** 导出进行中提示,{format} 占位 */
|
|
576
|
+
exporting: string;
|
|
577
|
+
print: string;
|
|
578
|
+
pdfWindow: string;
|
|
579
|
+
loading: string;
|
|
580
|
+
empty: string;
|
|
581
|
+
/** @deprecated 未被组件消费,将在下个大版本移除(保留仅为类型兼容) */
|
|
582
|
+
errorPrefix: string;
|
|
583
|
+
retry: string;
|
|
584
|
+
/** 可选新增文案,保留旧完整文案对象兼容。 */
|
|
585
|
+
pdfFontUnavailable?: string;
|
|
586
|
+
/** 搜索框占位文案 */
|
|
587
|
+
searchPlaceholder: string;
|
|
588
|
+
/** 搜索命中计数,{cur}/{total} 占位 */
|
|
589
|
+
matchInfo: string;
|
|
590
|
+
/** 上/下一个命中 */
|
|
591
|
+
prevMatch: string;
|
|
592
|
+
nextMatch: string;
|
|
593
|
+
/** 缩略图侧栏开关 */
|
|
594
|
+
thumbnails: string;
|
|
595
|
+
/** 参数面板 */
|
|
596
|
+
paramsTitle: string;
|
|
597
|
+
query: string;
|
|
598
|
+
reset: string;
|
|
599
|
+
/** 必填缺失提示({label} 占位) */
|
|
600
|
+
paramRequired: string;
|
|
601
|
+
/** 可选搜索进度文案,旧完整 messages 对象无需新增字段。 */
|
|
602
|
+
searching?: string;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Vue 插件:注册组件、配置和可选的数据源,不绑定任何后端接口。
|
|
607
|
+
*
|
|
608
|
+
* ```ts
|
|
609
|
+
* app.use(machReportPlugin, { fetcher })
|
|
610
|
+
* app.use(machReportPlugin, { config: defineMachReportConfig({...}) })
|
|
611
|
+
* ```
|
|
612
|
+
*
|
|
613
|
+
* 之后业务模板直接写 `<MachReportPreview report-id="X" />`。
|
|
614
|
+
*/
|
|
615
|
+
export declare const machReportPlugin: {
|
|
616
|
+
install(app: App, options?: MachReportPluginOptions): void;
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
export declare interface MachReportPluginOptions {
|
|
620
|
+
/** 报表数据源;也可直接传给 ReportPreview 的 fetcher prop */
|
|
621
|
+
fetcher?: PlanFetcher;
|
|
622
|
+
/** 常规业务接入:注册模板与取数,包内完成分页与参数面板;显式 fetcher 优先。 */
|
|
623
|
+
reports?: ReportRegistry;
|
|
624
|
+
/** 应用级配置中心(defaults/presets/文案/主题),见 defineMachReportConfig */
|
|
625
|
+
config?: MachReportConfig;
|
|
626
|
+
/** PDF 导出字体 URL(默认 /simhei.ttf;'' 跳过字体) */
|
|
627
|
+
pdfFontUrl?: string;
|
|
628
|
+
/** 自定义 PDF 导出器(缺省用懒加载引擎 /pdf 子路径的默认实现) */
|
|
629
|
+
pdfExporter?: PdfExporter;
|
|
630
|
+
/** 注册全局组件 <MachReportPreview>(默认 true;懒加载分片不影响首屏) */
|
|
631
|
+
globalComponent?: boolean;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
export declare type MachReportPreset = MachReportDefaults;
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* 全局组件(懒加载分片:首次渲染才拉取组件与引擎依赖,
|
|
638
|
+
* 与局部 import 等价——首屏敏感页面零额外成本)
|
|
639
|
+
*/
|
|
640
|
+
export declare const MachReportPreview: {
|
|
641
|
+
new (...args: any[]): CreateComponentPublicInstanceWithMixins<Readonly<ExtractPropTypes< {
|
|
642
|
+
reportId: {
|
|
643
|
+
type: PropType<string | string[] | null>;
|
|
644
|
+
default: null;
|
|
645
|
+
};
|
|
646
|
+
params: {
|
|
647
|
+
type: PropType<Record<string, string>>;
|
|
648
|
+
default: () => {};
|
|
649
|
+
};
|
|
650
|
+
height: {
|
|
651
|
+
type: StringConstructor;
|
|
652
|
+
default: string;
|
|
653
|
+
};
|
|
654
|
+
autoLoad: {
|
|
655
|
+
type: BooleanConstructor;
|
|
656
|
+
default: boolean;
|
|
657
|
+
};
|
|
658
|
+
showExport: {
|
|
659
|
+
type: BooleanConstructor;
|
|
660
|
+
default: undefined;
|
|
661
|
+
};
|
|
662
|
+
showPrint: {
|
|
663
|
+
type: BooleanConstructor;
|
|
664
|
+
default: undefined;
|
|
665
|
+
};
|
|
666
|
+
showPdfWindow: {
|
|
667
|
+
type: BooleanConstructor;
|
|
668
|
+
default: undefined;
|
|
669
|
+
};
|
|
670
|
+
gapPx: {
|
|
671
|
+
type: NumberConstructor;
|
|
672
|
+
default: undefined;
|
|
673
|
+
};
|
|
674
|
+
messages: {
|
|
675
|
+
type: PropType<Partial<MachReportMessages>>;
|
|
676
|
+
default: undefined;
|
|
677
|
+
};
|
|
678
|
+
preset: {
|
|
679
|
+
type: StringConstructor;
|
|
680
|
+
default: undefined;
|
|
681
|
+
};
|
|
682
|
+
debug: {
|
|
683
|
+
type: BooleanConstructor;
|
|
684
|
+
default: boolean;
|
|
685
|
+
};
|
|
686
|
+
paramDefs: {
|
|
687
|
+
type: PropType<ReportParamDef[] | undefined>;
|
|
688
|
+
default: undefined;
|
|
689
|
+
};
|
|
690
|
+
showParams: {
|
|
691
|
+
type: BooleanConstructor;
|
|
692
|
+
default: undefined;
|
|
693
|
+
};
|
|
694
|
+
fetcher: {
|
|
695
|
+
type: PropType<PlanFetcher | null>;
|
|
696
|
+
default: null;
|
|
697
|
+
};
|
|
698
|
+
}>> & Readonly<{
|
|
699
|
+
onError?: ((message: string, detail?: {
|
|
700
|
+
code: string;
|
|
701
|
+
cause?: unknown;
|
|
702
|
+
} | undefined) => any) | undefined;
|
|
703
|
+
onLoaded?: ((pageCount: number) => any) | undefined;
|
|
704
|
+
onWarning?: ((message: string) => any) | undefined;
|
|
705
|
+
}>, {
|
|
706
|
+
reload: () => Promise<void>;
|
|
707
|
+
print: () => Promise<void>;
|
|
708
|
+
exportAs: (format: string) => Promise<void>;
|
|
709
|
+
openPdfWindow: () => void;
|
|
710
|
+
gotoPage: (n: number) => void;
|
|
711
|
+
setParams: (values: Record<string, string>, opts?: {
|
|
712
|
+
reload?: boolean;
|
|
713
|
+
}) => Promise<void>;
|
|
714
|
+
checkPdfFont: () => Promise<PdfFontCheckResult>;
|
|
715
|
+
state: ComputedRef<MachReportState>;
|
|
716
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
717
|
+
error: (message: string, detail?: {
|
|
718
|
+
code: string;
|
|
719
|
+
cause?: unknown;
|
|
720
|
+
} | undefined) => any;
|
|
721
|
+
loaded: (pageCount: number) => any;
|
|
722
|
+
warning: (message: string) => any;
|
|
723
|
+
}, PublicProps, {
|
|
724
|
+
height: string;
|
|
725
|
+
gapPx: number;
|
|
726
|
+
params: Record<string, string>;
|
|
727
|
+
debug: boolean;
|
|
728
|
+
showExport: boolean;
|
|
729
|
+
showPrint: boolean;
|
|
730
|
+
showPdfWindow: boolean;
|
|
731
|
+
showParams: boolean;
|
|
732
|
+
messages: Partial<MachReportMessages>;
|
|
733
|
+
reportId: string | string[] | null;
|
|
734
|
+
autoLoad: boolean;
|
|
735
|
+
preset: string;
|
|
736
|
+
paramDefs: ReportParamDef[] | undefined;
|
|
737
|
+
fetcher: PlanFetcher | null;
|
|
738
|
+
}, true, {}, {}, { [K in keyof GlobalComponents]: GlobalComponents[K] }, { [K in keyof GlobalDirectives]: GlobalDirectives[K] }, string, {
|
|
739
|
+
viewportRef: HTMLDivElement;
|
|
740
|
+
containerRef: HTMLDivElement;
|
|
741
|
+
thumbsRef: HTMLElement;
|
|
742
|
+
}, HTMLDivElement, ComponentProvideOptions, {
|
|
743
|
+
P: {};
|
|
744
|
+
B: {};
|
|
745
|
+
D: {};
|
|
746
|
+
C: {};
|
|
747
|
+
M: {};
|
|
748
|
+
Defaults: {};
|
|
749
|
+
}, Readonly<ExtractPropTypes< {
|
|
750
|
+
reportId: {
|
|
751
|
+
type: PropType<string | string[] | null>;
|
|
752
|
+
default: null;
|
|
753
|
+
};
|
|
754
|
+
params: {
|
|
755
|
+
type: PropType<Record<string, string>>;
|
|
756
|
+
default: () => {};
|
|
757
|
+
};
|
|
758
|
+
height: {
|
|
759
|
+
type: StringConstructor;
|
|
760
|
+
default: string;
|
|
761
|
+
};
|
|
762
|
+
autoLoad: {
|
|
763
|
+
type: BooleanConstructor;
|
|
764
|
+
default: boolean;
|
|
765
|
+
};
|
|
766
|
+
showExport: {
|
|
767
|
+
type: BooleanConstructor;
|
|
768
|
+
default: undefined;
|
|
769
|
+
};
|
|
770
|
+
showPrint: {
|
|
771
|
+
type: BooleanConstructor;
|
|
772
|
+
default: undefined;
|
|
773
|
+
};
|
|
774
|
+
showPdfWindow: {
|
|
775
|
+
type: BooleanConstructor;
|
|
776
|
+
default: undefined;
|
|
777
|
+
};
|
|
778
|
+
gapPx: {
|
|
779
|
+
type: NumberConstructor;
|
|
780
|
+
default: undefined;
|
|
781
|
+
};
|
|
782
|
+
messages: {
|
|
783
|
+
type: PropType<Partial<MachReportMessages>>;
|
|
784
|
+
default: undefined;
|
|
785
|
+
};
|
|
786
|
+
preset: {
|
|
787
|
+
type: StringConstructor;
|
|
788
|
+
default: undefined;
|
|
789
|
+
};
|
|
790
|
+
debug: {
|
|
791
|
+
type: BooleanConstructor;
|
|
792
|
+
default: boolean;
|
|
793
|
+
};
|
|
794
|
+
paramDefs: {
|
|
795
|
+
type: PropType<ReportParamDef[] | undefined>;
|
|
796
|
+
default: undefined;
|
|
797
|
+
};
|
|
798
|
+
showParams: {
|
|
799
|
+
type: BooleanConstructor;
|
|
800
|
+
default: undefined;
|
|
801
|
+
};
|
|
802
|
+
fetcher: {
|
|
803
|
+
type: PropType<PlanFetcher | null>;
|
|
804
|
+
default: null;
|
|
805
|
+
};
|
|
806
|
+
}>> & Readonly<{
|
|
807
|
+
onError?: ((message: string, detail?: {
|
|
808
|
+
code: string;
|
|
809
|
+
cause?: unknown;
|
|
810
|
+
} | undefined) => any) | undefined;
|
|
811
|
+
onLoaded?: ((pageCount: number) => any) | undefined;
|
|
812
|
+
onWarning?: ((message: string) => any) | undefined;
|
|
813
|
+
}>, {
|
|
814
|
+
reload: () => Promise<void>;
|
|
815
|
+
print: () => Promise<void>;
|
|
816
|
+
exportAs: (format: string) => Promise<void>;
|
|
817
|
+
openPdfWindow: () => void;
|
|
818
|
+
gotoPage: (n: number) => void;
|
|
819
|
+
setParams: (values: Record<string, string>, opts?: {
|
|
820
|
+
reload?: boolean;
|
|
821
|
+
}) => Promise<void>;
|
|
822
|
+
checkPdfFont: () => Promise<PdfFontCheckResult>;
|
|
823
|
+
state: ComputedRef<MachReportState>;
|
|
824
|
+
}, {}, {}, {}, {
|
|
825
|
+
height: string;
|
|
826
|
+
gapPx: number;
|
|
827
|
+
params: Record<string, string>;
|
|
828
|
+
debug: boolean;
|
|
829
|
+
showExport: boolean;
|
|
830
|
+
showPrint: boolean;
|
|
831
|
+
showPdfWindow: boolean;
|
|
832
|
+
showParams: boolean;
|
|
833
|
+
messages: Partial<MachReportMessages>;
|
|
834
|
+
reportId: string | string[] | null;
|
|
835
|
+
autoLoad: boolean;
|
|
836
|
+
preset: string;
|
|
837
|
+
paramDefs: ReportParamDef[] | undefined;
|
|
838
|
+
fetcher: PlanFetcher | null;
|
|
839
|
+
}>;
|
|
840
|
+
__isFragment?: never;
|
|
841
|
+
__isTeleport?: never;
|
|
842
|
+
__isSuspense?: never;
|
|
843
|
+
} & ComponentOptionsBase<Readonly<ExtractPropTypes< {
|
|
844
|
+
reportId: {
|
|
845
|
+
type: PropType<string | string[] | null>;
|
|
846
|
+
default: null;
|
|
847
|
+
};
|
|
848
|
+
params: {
|
|
849
|
+
type: PropType<Record<string, string>>;
|
|
850
|
+
default: () => {};
|
|
851
|
+
};
|
|
852
|
+
height: {
|
|
853
|
+
type: StringConstructor;
|
|
854
|
+
default: string;
|
|
855
|
+
};
|
|
856
|
+
autoLoad: {
|
|
857
|
+
type: BooleanConstructor;
|
|
858
|
+
default: boolean;
|
|
859
|
+
};
|
|
860
|
+
showExport: {
|
|
861
|
+
type: BooleanConstructor;
|
|
862
|
+
default: undefined;
|
|
863
|
+
};
|
|
864
|
+
showPrint: {
|
|
865
|
+
type: BooleanConstructor;
|
|
866
|
+
default: undefined;
|
|
867
|
+
};
|
|
868
|
+
showPdfWindow: {
|
|
869
|
+
type: BooleanConstructor;
|
|
870
|
+
default: undefined;
|
|
871
|
+
};
|
|
872
|
+
gapPx: {
|
|
873
|
+
type: NumberConstructor;
|
|
874
|
+
default: undefined;
|
|
875
|
+
};
|
|
876
|
+
messages: {
|
|
877
|
+
type: PropType<Partial<MachReportMessages>>;
|
|
878
|
+
default: undefined;
|
|
879
|
+
};
|
|
880
|
+
preset: {
|
|
881
|
+
type: StringConstructor;
|
|
882
|
+
default: undefined;
|
|
883
|
+
};
|
|
884
|
+
debug: {
|
|
885
|
+
type: BooleanConstructor;
|
|
886
|
+
default: boolean;
|
|
887
|
+
};
|
|
888
|
+
paramDefs: {
|
|
889
|
+
type: PropType<ReportParamDef[] | undefined>;
|
|
890
|
+
default: undefined;
|
|
891
|
+
};
|
|
892
|
+
showParams: {
|
|
893
|
+
type: BooleanConstructor;
|
|
894
|
+
default: undefined;
|
|
895
|
+
};
|
|
896
|
+
fetcher: {
|
|
897
|
+
type: PropType<PlanFetcher | null>;
|
|
898
|
+
default: null;
|
|
899
|
+
};
|
|
900
|
+
}>> & Readonly<{
|
|
901
|
+
onError?: ((message: string, detail?: {
|
|
902
|
+
code: string;
|
|
903
|
+
cause?: unknown;
|
|
904
|
+
} | undefined) => any) | undefined;
|
|
905
|
+
onLoaded?: ((pageCount: number) => any) | undefined;
|
|
906
|
+
onWarning?: ((message: string) => any) | undefined;
|
|
907
|
+
}>, {
|
|
908
|
+
reload: () => Promise<void>;
|
|
909
|
+
print: () => Promise<void>;
|
|
910
|
+
exportAs: (format: string) => Promise<void>;
|
|
911
|
+
openPdfWindow: () => void;
|
|
912
|
+
gotoPage: (n: number) => void;
|
|
913
|
+
setParams: (values: Record<string, string>, opts?: {
|
|
914
|
+
reload?: boolean;
|
|
915
|
+
}) => Promise<void>;
|
|
916
|
+
checkPdfFont: () => Promise<PdfFontCheckResult>;
|
|
917
|
+
state: ComputedRef<MachReportState>;
|
|
918
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
919
|
+
error: (message: string, detail?: {
|
|
920
|
+
code: string;
|
|
921
|
+
cause?: unknown;
|
|
922
|
+
} | undefined) => any;
|
|
923
|
+
loaded: (pageCount: number) => any;
|
|
924
|
+
warning: (message: string) => any;
|
|
925
|
+
}, string, {
|
|
926
|
+
height: string;
|
|
927
|
+
gapPx: number;
|
|
928
|
+
params: Record<string, string>;
|
|
929
|
+
debug: boolean;
|
|
930
|
+
showExport: boolean;
|
|
931
|
+
showPrint: boolean;
|
|
932
|
+
showPdfWindow: boolean;
|
|
933
|
+
showParams: boolean;
|
|
934
|
+
messages: Partial<MachReportMessages>;
|
|
935
|
+
reportId: string | string[] | null;
|
|
936
|
+
autoLoad: boolean;
|
|
937
|
+
preset: string;
|
|
938
|
+
paramDefs: ReportParamDef[] | undefined;
|
|
939
|
+
fetcher: PlanFetcher | null;
|
|
940
|
+
}, {}, string, {}, { [K in keyof GlobalComponents]: GlobalComponents[K] }, { [K in keyof GlobalDirectives]: GlobalDirectives[K] }, string, ComponentProvideOptions> & VNodeProps & AllowedComponentProps & ComponentCustomProps & (new () => {
|
|
941
|
+
$slots: {
|
|
942
|
+
default?(_: {}): any;
|
|
943
|
+
};
|
|
944
|
+
});
|
|
945
|
+
|
|
946
|
+
/** 预览按需调优;默认已经启用正文/缩略图虚拟化及可取消的分片搜索。 */
|
|
947
|
+
export declare interface MachReportPreviewOptions {
|
|
948
|
+
/** 视口前后额外保留的正文页数,默认 1,归一化到 0~10 的整数。 */
|
|
949
|
+
overscanPages?: number;
|
|
950
|
+
/** 搜索输入防抖毫秒,默认 200,归一化到 0~2000。 */
|
|
951
|
+
searchDebounceMs?: number;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/** 只读快照,由组件的同一套状态驱动;无需通过事件另建状态。 */
|
|
955
|
+
export declare interface MachReportState {
|
|
956
|
+
readonly loading: boolean;
|
|
957
|
+
readonly hasPlan: boolean;
|
|
958
|
+
readonly pageCount: number;
|
|
959
|
+
readonly currentPage: number;
|
|
960
|
+
/** 当前导出显示名称,空闲时为 null。 */
|
|
961
|
+
readonly exporting: string | null;
|
|
962
|
+
readonly printing: boolean;
|
|
963
|
+
readonly canExport: boolean;
|
|
964
|
+
readonly canPrint: boolean;
|
|
965
|
+
readonly error: Readonly<MachReportStateError> | null;
|
|
966
|
+
readonly pdfFont: Readonly<PdfFontCheckResult>;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
export declare interface MachReportStateError {
|
|
970
|
+
message: string;
|
|
971
|
+
code: MachReportErrorCode;
|
|
972
|
+
cause?: unknown;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/** 主题变量(组件外壳注入的 --mrp-* CSS 自定义属性) */
|
|
976
|
+
export declare interface MachReportTheme {
|
|
977
|
+
shellBg: string;
|
|
978
|
+
shellFg: string;
|
|
979
|
+
toolbarBg: string;
|
|
980
|
+
toolbarBorder: string;
|
|
981
|
+
toolbarFg: string;
|
|
982
|
+
btnFg: string;
|
|
983
|
+
btnBorder: string;
|
|
984
|
+
btnHoverBg: string;
|
|
985
|
+
btnHoverFg: string;
|
|
986
|
+
btnActiveBg: string;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
export declare function normalizeReportIds(reportId: ReportIdInput): string[];
|
|
990
|
+
|
|
991
|
+
declare function openPdfWindow(): void;
|
|
992
|
+
|
|
993
|
+
declare interface PageWindow {
|
|
994
|
+
start: number;
|
|
995
|
+
end: number;
|
|
996
|
+
padTopPx: number;
|
|
997
|
+
padBottomPx: number;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
declare interface PaginateOptions {
|
|
1001
|
+
/** 每行额外占高(mm),压测专用钩子 */
|
|
1002
|
+
mmPerRow?: number;
|
|
1003
|
+
/** 文本测量器(默认启发式;浏览器端可注入 canvas 测量校准) */
|
|
1004
|
+
measurer?: TextMeasurer;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/** PDF 导出器:RenderPlan → PDF 字节;第二参数可上报非致命保真告警。 */
|
|
1008
|
+
export declare interface PdfExporter {
|
|
1009
|
+
(plan: RenderPlan, onWarning?: (message: string) => void): Promise<Uint8Array>;
|
|
1010
|
+
/** 可选轻量字体检查;旧版自定义导出函数无需实现。取消时拒绝 AbortError。 */
|
|
1011
|
+
checkFont?: (signal?: AbortSignal) => Promise<PdfFontCheckResult>;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
export declare interface PdfFontCheckResult {
|
|
1015
|
+
status: PdfFontStatus;
|
|
1016
|
+
fontUrl: string;
|
|
1017
|
+
message?: string;
|
|
1018
|
+
cause?: unknown;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/** available 仅表示字体资源可达;实际导出仍会校验文字能否编码。 */
|
|
1022
|
+
export declare type PdfFontStatus = "unchecked" | "checking" | "available" | "disabled" | "unverified" | "error";
|
|
1023
|
+
|
|
1024
|
+
declare interface PlanComponent {
|
|
1025
|
+
kind: ComponentKind;
|
|
1026
|
+
leftMm: number;
|
|
1027
|
+
topMm: number;
|
|
1028
|
+
widthMm: number;
|
|
1029
|
+
heightMm: number;
|
|
1030
|
+
nid?: string;
|
|
1031
|
+
rkey?: string;
|
|
1032
|
+
text?: string;
|
|
1033
|
+
rawText?: string;
|
|
1034
|
+
lines?: string[];
|
|
1035
|
+
richParagraphs?: RichParagraph[];
|
|
1036
|
+
imageData?: string;
|
|
1037
|
+
grid?: PlanGrid;
|
|
1038
|
+
style?: ComponentStyle;
|
|
1039
|
+
meta?: Record<string, unknown>;
|
|
1040
|
+
/** MachReport 扩展字段:未知 kind 的兜底渲染标记 */
|
|
1041
|
+
fallbackText?: string;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
export declare interface PlanFetcher {
|
|
1045
|
+
(input: ReportFetchInput): Promise<RenderPlan>;
|
|
1046
|
+
getParamDefs?: ReportFetcher["getParamDefs"];
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
declare interface PlanGrid {
|
|
1050
|
+
/** 行内允许 null 空位;渲染器按空单元格处理 */
|
|
1051
|
+
cells: (GridCell | null)[][];
|
|
1052
|
+
colWidthsMm?: number[];
|
|
1053
|
+
rowHeightsMm?: number[];
|
|
1054
|
+
gapMm?: number;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
export declare class PlanLoadError extends Error {
|
|
1058
|
+
constructor(message: string);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
declare interface PlanPage {
|
|
1062
|
+
pageWidthMm: number;
|
|
1063
|
+
pageHeightMm: number;
|
|
1064
|
+
marginTopMm?: number;
|
|
1065
|
+
marginBottomMm?: number;
|
|
1066
|
+
marginLeftMm?: number;
|
|
1067
|
+
marginRightMm?: number;
|
|
1068
|
+
components: PlanComponent[];
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
declare function print_2(): Promise<void>;
|
|
1072
|
+
|
|
1073
|
+
declare interface PrintHtmlResult {
|
|
1074
|
+
head: string;
|
|
1075
|
+
pageChunks: string[];
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* 批量打印(多单连打):把多份计划合并为一个打印文档——
|
|
1080
|
+
* named pages 保证混合纸张正确分页,浏览器只弹一次打印对话框。
|
|
1081
|
+
*/
|
|
1082
|
+
export declare function printPlans(plans: RenderPlan[], options?: {
|
|
1083
|
+
onProgress?: (done: number, total: number) => void;
|
|
1084
|
+
onError?: (message: string) => void;
|
|
1085
|
+
}): Promise<void>;
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* 路由/布局级响应式叠加:就近提供配置层(如某路由关闭导出按钮)。
|
|
1089
|
+
* 本层 defaults 优先于上层 defaults/preset,本层 preset 再覆盖本层 defaults。
|
|
1090
|
+
* 同名 preset 与 messages/theme 均按字段继承;组件 props 仍拥有最高优先级。
|
|
1091
|
+
*/
|
|
1092
|
+
export declare function provideMachReportConfig(overlay: MachReportConfigInput | MachReportDefaults): void;
|
|
1093
|
+
|
|
1094
|
+
declare function reload(): Promise<void>;
|
|
1095
|
+
|
|
1096
|
+
declare interface RenderPlan {
|
|
1097
|
+
schemaVersion: string;
|
|
1098
|
+
pages: PlanPage[];
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
declare interface ReportDefinition {
|
|
1102
|
+
/** 静态模板或宿主提供的异步模板加载器;动态模板默认每次重新读取,不缓存版本。 */
|
|
1103
|
+
template: ReportTemplate | ReportTemplateLoader;
|
|
1104
|
+
/** 静态数据;load 存在时优先使用 load 的结果。 */
|
|
1105
|
+
datasets?: DatasetRows;
|
|
1106
|
+
load?: (context: ReportLoadContext) => DatasetRows | Promise<DatasetRows>;
|
|
1107
|
+
/** 覆盖模板参数定义;动态模板应在此声明查询面板元数据,避免查询前先请求模板。 */
|
|
1108
|
+
params?: ReportParamDef[];
|
|
1109
|
+
pagination?: PaginateOptions;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
/** 保持 Promise<RenderPlan> 契约;元数据为可选,旧业务 fetcher 无需改造。 */
|
|
1113
|
+
declare interface ReportFetcher {
|
|
1114
|
+
(input: ReportFetchInput): Promise<RenderPlan>;
|
|
1115
|
+
getParamDefs?: (reportIds: string[]) => ReportParamDef[];
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
declare interface ReportFetchInput {
|
|
1119
|
+
reportIds: string[];
|
|
1120
|
+
params: Record<string, string>;
|
|
1121
|
+
signal?: AbortSignal;
|
|
1122
|
+
/** 本次分页与计划告警;未提供时使用数据源配置的告警通道。 */
|
|
1123
|
+
onWarning?: (message: string) => void;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
export declare type ReportIdInput = string | string[] | null | undefined;
|
|
1127
|
+
|
|
1128
|
+
/** 取数与排版共同使用的请求上下文;取消只影响本次调用。 */
|
|
1129
|
+
declare interface ReportLoadContext {
|
|
1130
|
+
reportId: string;
|
|
1131
|
+
params: Record<string, string>;
|
|
1132
|
+
signal?: AbortSignal;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
1136
|
+
declare interface ReportParamDef {
|
|
1137
|
+
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
1138
|
+
field: string;
|
|
1139
|
+
/** 显示名(缺省用 field) */
|
|
1140
|
+
label?: string;
|
|
1141
|
+
type?: "text" | "number" | "date" | "select";
|
|
1142
|
+
/** select 选项 */
|
|
1143
|
+
options?: Array<{ label: string; value: string }>;
|
|
1144
|
+
defaultValue?: string;
|
|
1145
|
+
required?: boolean;
|
|
1146
|
+
placeholder?: string;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
export declare const ReportParamPanel: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
1150
|
+
reset: () => any;
|
|
1151
|
+
query: () => any;
|
|
1152
|
+
"update:modelValue": (value: Record<string, string>) => any;
|
|
1153
|
+
}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
|
|
1154
|
+
onReset?: (() => any) | undefined;
|
|
1155
|
+
onQuery?: (() => any) | undefined;
|
|
1156
|
+
"onUpdate:modelValue"?: ((value: Record<string, string>) => any) | undefined;
|
|
1157
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
1158
|
+
|
|
1159
|
+
export declare const ReportPreview: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
1160
|
+
|
|
1161
|
+
declare type ReportRegistry = Record<string, ReportDefinition>;
|
|
1162
|
+
|
|
1163
|
+
declare interface ReportTemplate {
|
|
1164
|
+
schemaVersion?: string;
|
|
1165
|
+
/** 参数定义(可选;宿主也可经 ReportPreview 的 paramDefs prop 提供,prop 优先) */
|
|
1166
|
+
params?: ReportParamDef[];
|
|
1167
|
+
pages: TemplatePage[];
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
declare type ReportTemplateLoader = (context: ReportLoadContext) => ReportTemplate | Promise<ReportTemplate>;
|
|
1171
|
+
|
|
1172
|
+
export declare const ReportToolbar: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
1173
|
+
print: () => any;
|
|
1174
|
+
export: (format: "html" | "png" | "pdf" | "xlsx" | "word") => any;
|
|
1175
|
+
zoom: (mode: number | "fit") => any;
|
|
1176
|
+
goto: (page: number) => any;
|
|
1177
|
+
"pdf-window": () => any;
|
|
1178
|
+
"search-input": (query: string) => any;
|
|
1179
|
+
"search-nav": (dir: 1 | -1) => any;
|
|
1180
|
+
"search-toggle": () => any;
|
|
1181
|
+
"thumbs-toggle": () => any;
|
|
1182
|
+
}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
1183
|
+
onPrint?: (() => any) | undefined;
|
|
1184
|
+
onExport?: ((format: "html" | "png" | "pdf" | "xlsx" | "word") => any) | undefined;
|
|
1185
|
+
onZoom?: ((mode: number | "fit") => any) | undefined;
|
|
1186
|
+
onGoto?: ((page: number) => any) | undefined;
|
|
1187
|
+
"onPdf-window"?: (() => any) | undefined;
|
|
1188
|
+
"onSearch-input"?: ((query: string) => any) | undefined;
|
|
1189
|
+
"onSearch-nav"?: ((dir: 1 | -1) => any) | undefined;
|
|
1190
|
+
"onSearch-toggle"?: (() => any) | undefined;
|
|
1191
|
+
"onThumbs-toggle"?: (() => any) | undefined;
|
|
1192
|
+
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
1193
|
+
searchInputRef: HTMLInputElement;
|
|
1194
|
+
}, HTMLDivElement>;
|
|
1195
|
+
|
|
1196
|
+
export declare function resolveConfig(config: MachReportConfig | null | undefined, presetName?: string): ResolvedConfig;
|
|
1197
|
+
|
|
1198
|
+
export declare type ResolvedConfig = Required<Pick<MachReportDefaults, "showExport" | "showPrint" | "showPdfWindow" | "showParams" | "gapPx">> & {
|
|
1199
|
+
pdfFontUrl: string;
|
|
1200
|
+
theme: MachReportTheme;
|
|
1201
|
+
messages: MachReportMessages;
|
|
1202
|
+
logger: MachReportLogger;
|
|
1203
|
+
preview: Required<MachReportPreviewOptions>;
|
|
1204
|
+
xlsx: XlsxRenderOptions;
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
declare interface RichParagraph {
|
|
1208
|
+
segments: RichSegment[];
|
|
1209
|
+
align?: ComponentStyle["align"];
|
|
1210
|
+
lineHeight?: number;
|
|
1211
|
+
spaceBeforeMm?: number;
|
|
1212
|
+
spaceAfterMm?: number;
|
|
1213
|
+
indentMm?: number;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
declare interface RichSegment {
|
|
1217
|
+
kind?: "text" | "field";
|
|
1218
|
+
text?: string;
|
|
1219
|
+
field?: string;
|
|
1220
|
+
style?: ComponentStyle;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/** 控制器注入:后代组件 useReportPreview() 免模板 ref 编程式访问(与 expose 同面) */
|
|
1224
|
+
/** 编程式设参查询:合并进面板值(面板本地字典经 v-model 同步),可选立即重载 */
|
|
1225
|
+
declare function setParams(values: Record<string, string>, opts?: {
|
|
1226
|
+
reload?: boolean;
|
|
1227
|
+
}): Promise<void>;
|
|
1228
|
+
|
|
1229
|
+
export declare const SILENT_LOGGER: MachReportLogger;
|
|
1230
|
+
|
|
1231
|
+
/** 条件格式规则求值(声明式,见 ListColumn.rules) */
|
|
1232
|
+
declare interface StyleRule {
|
|
1233
|
+
when: {
|
|
1234
|
+
field: string;
|
|
1235
|
+
op: ">" | ">=" | "<" | "<=" | "==" | "!=";
|
|
1236
|
+
value: number | string;
|
|
1237
|
+
};
|
|
1238
|
+
/** 命中时合并进单元格样式(color/bold/backgroundColor 等) */
|
|
1239
|
+
style: Record<string, unknown>;
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
declare type TemplateComponent = PlanComponent | ListComponent;
|
|
1243
|
+
|
|
1244
|
+
declare interface TemplatePage {
|
|
1245
|
+
widthMm: number;
|
|
1246
|
+
heightMm: number;
|
|
1247
|
+
marginTopMm?: number;
|
|
1248
|
+
marginBottomMm?: number;
|
|
1249
|
+
marginLeftMm?: number;
|
|
1250
|
+
marginRightMm?: number;
|
|
1251
|
+
components: TemplateComponent[];
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* 文本测量与折行(分页/Canvas/PDF 共用的唯一折行真相源)。
|
|
1256
|
+
*
|
|
1257
|
+
* 测量模型可注入(TextMeasurer):
|
|
1258
|
+
* - 默认 createHeuristicMeasurer():CJK/拉丁宽度启发式(零依赖、Node 可用)
|
|
1259
|
+
* - 浏览器端可注入 createCanvasMeasurer()(真字体 metrics,消除三端折行差异)
|
|
1260
|
+
*/
|
|
1261
|
+
|
|
1262
|
+
declare interface TextMeasureOptions {
|
|
1263
|
+
fontSizePt: number;
|
|
1264
|
+
bold?: boolean;
|
|
1265
|
+
letterSpacingPt?: number;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/** 宽度测量接口:返回文本在给定字号下的宽度(mm)。实现必须无副作用、可缓存。 */
|
|
1269
|
+
declare interface TextMeasurer {
|
|
1270
|
+
measureMm(text: string, options: TextMeasureOptions): number;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/** theme 对象 → CSS 自定义属性 style 对象(注入组件外壳) */
|
|
1274
|
+
export declare function themeToCssVars(theme: Partial<MachReportTheme>): CSSProperties;
|
|
1275
|
+
|
|
1276
|
+
export declare function toErrorDetail(error: unknown): MachReportErrorDetail;
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* 父组件统一入口,无需手写组件实例类型或可选链:
|
|
1280
|
+
* `const report = useMachReport()` → `<MachReportPreview :ref="report.ref" />`。
|
|
1281
|
+
* 异步组件挂载前/卸载后调用会报告 config 错误;ready 可控制按钮状态。
|
|
1282
|
+
*/
|
|
1283
|
+
export declare function useMachReport(): MachReportHandle;
|
|
1284
|
+
|
|
1285
|
+
/** 组件内部读取当前生效配置层(未提供时返回 null → 走内置缺省) */
|
|
1286
|
+
export declare function useMachReportConfig(): ConfigRef;
|
|
1287
|
+
|
|
1288
|
+
/** 页级虚拟化;页几何按计划引用缓存,滚动仅更新坐标,不遍历整个计划。 */
|
|
1289
|
+
export declare function usePageWindow(plan: Ref<RenderPlan | null>, zoom: Ref<number>, options?: {
|
|
1290
|
+
pxPerMm?: number;
|
|
1291
|
+
gapPx?: number | Ref<number>;
|
|
1292
|
+
overscan?: number | Ref<number>;
|
|
1293
|
+
}): {
|
|
1294
|
+
contentSize: ComputedRef< {
|
|
1295
|
+
w: number;
|
|
1296
|
+
h: number;
|
|
1297
|
+
}>;
|
|
1298
|
+
windowRange: ComputedRef<PageWindow>;
|
|
1299
|
+
visiblePages: ComputedRef< {
|
|
1300
|
+
page: PlanPage;
|
|
1301
|
+
index: number;
|
|
1302
|
+
}[]>;
|
|
1303
|
+
makeScrollHandler: (currentPage: Ref<number>, pageCount: Ref<number>) => (vp: HTMLElement) => void;
|
|
1304
|
+
refreshViewport: (vp: HTMLElement | null) => void;
|
|
1305
|
+
pageOffsetPx: (index: number) => number;
|
|
1306
|
+
destroy: () => void;
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
export declare function usePrintExport(plan: Ref<RenderPlan | null>, hooks: {
|
|
1310
|
+
/** 按导出开始时的配置快照处理,避免输出过程中跟随路由配置变化。 */
|
|
1311
|
+
getXlsxOptions?: () => XlsxRenderOptions;
|
|
1312
|
+
getPdfExporter: () => PdfExporter;
|
|
1313
|
+
onError: (message: string, code?: string) => void;
|
|
1314
|
+
onWarning?: (message: string) => void;
|
|
1315
|
+
onBusy?: (format: string | null) => void;
|
|
1316
|
+
onPrinting?: (printing: boolean) => void;
|
|
1317
|
+
}): {
|
|
1318
|
+
print: () => Promise<void>;
|
|
1319
|
+
exportAs: (format: string) => Promise<void>;
|
|
1320
|
+
exportImages: () => Promise<void>;
|
|
1321
|
+
exportWord: () => void;
|
|
1322
|
+
openPdfWindow: () => void;
|
|
1323
|
+
releasePrintFrame: () => void;
|
|
1324
|
+
dispose: () => void;
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* 在 ReportPreview 的任意后代组件中获取控制器(免模板 ref):
|
|
1329
|
+
*
|
|
1330
|
+
* ```vue
|
|
1331
|
+
* <script setup>
|
|
1332
|
+
* import { useReportPreview } from "@agile-team/mach-report/vue";
|
|
1333
|
+
* const preview = useReportPreview();
|
|
1334
|
+
* </script>
|
|
1335
|
+
* <template><button @click="preview?.print()">打印本单</button></template>
|
|
1336
|
+
*
|
|
1337
|
+
* 不在预览组件内调用时返回 null(不抛错,便于条件渲染场景)。
|
|
1338
|
+
*/
|
|
1339
|
+
export declare function useReportPreview(): MachReportController | null;
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* 缩放状态(transform: scale 方案):
|
|
1343
|
+
* - fit 模式:按视口宽自适应(clamp 0.3~1)
|
|
1344
|
+
* - raw 模式:固定百分比
|
|
1345
|
+
* transform 而非 CSS zoom:标准属性、跨浏览器、零重排。
|
|
1346
|
+
*/
|
|
1347
|
+
export declare function useZoom(getFitInputs: () => {
|
|
1348
|
+
viewport: HTMLElement | null;
|
|
1349
|
+
pageWidthPx: number;
|
|
1350
|
+
} | null): {
|
|
1351
|
+
zoom: Ref<number, number>;
|
|
1352
|
+
zoomMode: Ref<"raw" | "fit", "raw" | "fit">;
|
|
1353
|
+
applyFitZoom: () => void;
|
|
1354
|
+
setZoom: (mode: "fit" | number) => void;
|
|
1355
|
+
};
|
|
1356
|
+
|
|
1357
|
+
/**
|
|
1358
|
+
* RenderPlan → xlsx 导出(B 端第二出口,对齐家族 @agile-team/mach-table-xlsx 路线):
|
|
1359
|
+
* - 网格组件 → 真表格:列宽(mm→Excel 宽度)、行高(mm→pt)、colSpan/rowSpan 合并、
|
|
1360
|
+
* 加粗/对齐/底色/字号直译(resolveGridLayout 复用单真相源几何)
|
|
1361
|
+
* - 文本组件 → 合并标题行(顺序流式输出,保字号/加粗/对齐;非像素级定位,
|
|
1362
|
+
* 目标是"财务能直接用的对账表"而非复刻版面)
|
|
1363
|
+
* - 未支持组件、富文本专有内容与单元格嵌套组件跳过并计入 warnings
|
|
1364
|
+
*/
|
|
1365
|
+
declare interface XlsxRenderOptions {
|
|
1366
|
+
/** 工作表命名(默认 "Sheet1" 起序) */
|
|
1367
|
+
sheetName?: (pageIndex: number) => string;
|
|
1368
|
+
/** 默认 text 保留显示文本;raw 使用列表自动保留的原始数值、布尔、文本与空值。 */
|
|
1369
|
+
valueMode?: "text" | "raw";
|
|
1370
|
+
/** 默认 auto 按计划识别 A3/A4/A5;自定义尺寸回退 A4 并返回告警。 */
|
|
1371
|
+
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
export { }
|