@agile-team/mach-report 2.5.0 → 2.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/README.md +126 -16
- package/dist/ReportPreview-BdvoqdOd.cjs +6 -0
- package/dist/ReportPreview-COFkbeEM.js +3719 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/analytics.cjs +1 -0
- package/dist/analytics.d.cts +276 -0
- package/dist/analytics.d.ts +276 -0
- package/dist/analytics.js +223 -0
- package/dist/assets-B9qJku3V.js +160 -0
- package/dist/assets-RZan7EyL.cjs +1 -0
- package/dist/capabilities-joSutDF8.js +63 -0
- package/dist/capabilities-xGTpnPjJ.cjs +1 -0
- package/dist/designer.cjs +1 -0
- package/dist/designer.d.cts +869 -0
- package/dist/designer.d.ts +869 -0
- package/dist/designer.js +628 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +497 -9
- package/dist/index.d.ts +497 -9
- package/dist/index.js +1088 -1499
- package/dist/param-validation-BWNjLcN0.js +116 -0
- package/dist/param-validation-CiTxFeZ8.cjs +1 -0
- package/dist/pdf.cjs +48 -48
- package/dist/pdf.d.cts +119 -1
- package/dist/pdf.d.ts +119 -1
- package/dist/pdf.js +3932 -3868
- package/dist/{plugin-DMPLDpBY.cjs → plugin-9t_ZFwhz.cjs} +1 -1
- package/dist/{plugin-DDLcFWlk.js → plugin-s8Ay8kKk.js} +2 -2
- package/dist/progress-DD964VAB.js +102 -0
- package/dist/progress-KvhwXZ1Q.cjs +1 -0
- package/dist/render-plan-CckPEQyf.cjs +1 -0
- package/dist/{render-plan-CXBWRog4.js → render-plan-uzZYYSy1.js} +11 -10
- package/dist/report-params-B_VCihAh.js +12 -0
- package/dist/report-params-CjWrjPl6.cjs +1 -0
- package/dist/report-source-BXHNy_AD.js +755 -0
- package/dist/report-source-CCAvFE3t.cjs +1 -0
- package/dist/server/node.d.cts +320 -0
- package/dist/server/node.d.ts +320 -0
- package/dist/server-node.cjs +1 -0
- package/dist/server-node.js +303 -0
- package/dist/server.cjs +1 -0
- package/dist/server.d.cts +668 -0
- package/dist/server.d.ts +668 -0
- package/dist/server.js +245 -0
- package/dist/style-CpwiOPyB.cjs +1 -0
- package/dist/style-Dv5o_x6b.js +67 -0
- package/dist/style.css +1 -1
- package/dist/task-events-DQ276fn2.cjs +1 -0
- package/dist/task-events-Dpsvf_t2.js +47 -0
- package/dist/template-registry-DWExx0gU.cjs +1 -0
- package/dist/template-registry-NpOakidD.js +354 -0
- package/dist/textwrap-CnGsEum6.cjs +4 -0
- package/dist/textwrap-DOl04hCQ.js +110 -0
- package/dist/validate-DfHPD8wX.cjs +1 -0
- package/dist/validate-S6CgIm5d.js +148 -0
- package/dist/vue/async.d.cts +1507 -1538
- package/dist/vue/async.d.ts +1507 -1538
- package/dist/vue/index.d.cts +2376 -2347
- package/dist/vue/index.d.ts +2376 -2347
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +184 -75
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +325 -0
- package/dist/worker.d.ts +325 -0
- package/dist/worker.js +158 -0
- package/dist/xlsx/node.d.cts +47 -0
- package/dist/xlsx/node.d.ts +47 -0
- package/dist/xlsx-node.cjs +221 -0
- package/dist/xlsx-node.js +36409 -0
- package/dist/xlsx.cjs +20 -20
- package/dist/xlsx.d.cts +87 -2
- package/dist/xlsx.d.ts +87 -2
- package/dist/xlsx.js +5987 -5840
- package/package.json +63 -3
- package/dist/ReportPreview-CBKLI--k.js +0 -2188
- package/dist/ReportPreview-ClM8h0pM.cjs +0 -6
- package/dist/grid-geometry-BNIvw52m.cjs +0 -1
- package/dist/grid-geometry-C8hGoe9o.js +0 -130
- package/dist/render-plan-CCTL4F9v.cjs +0 -1
- package/dist/report-params-B3Fia6JO.js +0 -10
- package/dist/report-params-D1gZ1DME.cjs +0 -1
- package/dist/textwrap-nH0UYU6D.js +0 -108
- package/dist/textwrap-oD-t4b4B.cjs +0 -4
package/dist/pdf.d.cts
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
declare interface AssetRenderBudget {
|
|
2
|
+
/** Maximum newly rendered assets, default 1000. Existing imageData is kept unchanged. */
|
|
3
|
+
maxAssets?: number;
|
|
4
|
+
/** Maximum image payload bytes per new asset, default 32 MiB. */
|
|
5
|
+
maxImageBytes?: number;
|
|
6
|
+
/** Maximum total image payload bytes for new assets, default 128 MiB. */
|
|
7
|
+
maxTotalImageBytes?: number;
|
|
8
|
+
/** Wall-clock budget, including adapters that ignore AbortSignal. Default 30 seconds. */
|
|
9
|
+
maxDurationMs?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare interface AssetRenderOptions extends OutputDiagnosticOptions {
|
|
13
|
+
assetRenderers?: Partial<Record<ImageComponentKind, ComponentImageRenderer>>;
|
|
14
|
+
assetBudget?: AssetRenderBudget;
|
|
15
|
+
/** Default throw prevents an incomplete export; placeholder retains the component and emits diagnostics. */
|
|
16
|
+
assetFailure?: "throw" | "placeholder";
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare interface ComponentImageContext {
|
|
21
|
+
readonly component: Readonly<PlanComponent>;
|
|
22
|
+
readonly pageIndex: number;
|
|
23
|
+
readonly componentIndex: number;
|
|
24
|
+
readonly componentPath: readonly number[];
|
|
25
|
+
readonly signal: AbortSignal;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare type ComponentImageRenderer = (context: ComponentImageContext) => string | Promise<string>;
|
|
29
|
+
|
|
1
30
|
declare type ComponentKind = "text" | "image" | "barcode" | "qrcode" | "chart" | "line" | "rect" | "ellipse";
|
|
2
31
|
|
|
3
32
|
declare interface ComponentStyle {
|
|
@@ -24,6 +53,19 @@ declare interface ComponentStyle {
|
|
|
24
53
|
rotateDeg?: number;
|
|
25
54
|
}
|
|
26
55
|
|
|
56
|
+
/** Exact font-byte width adapter. Import from /pdf to keep fontkit outside the core bundle. */
|
|
57
|
+
export declare function createFontBytesMeasurer(options: FontBytesMeasureOptions): TextMeasurer_2;
|
|
58
|
+
|
|
59
|
+
export declare interface FontBytesMeasureOptions {
|
|
60
|
+
regular: Uint8Array | ArrayBuffer;
|
|
61
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
62
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
63
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
64
|
+
/** Optional family guard: other font families use fallback instead of inaccurate metrics. */
|
|
65
|
+
fontFamily?: string;
|
|
66
|
+
fallback?: TextMeasurer_2;
|
|
67
|
+
}
|
|
68
|
+
|
|
27
69
|
export declare interface FontLoadOptions {
|
|
28
70
|
/** 校验字体格式与可解析结构,失败抛出带 cause 的诊断;默认保留旧 API 的 null 降级。 */
|
|
29
71
|
strict?: boolean;
|
|
@@ -40,6 +82,7 @@ declare interface GridCell {
|
|
|
40
82
|
valueType?: "text" | "number" | "boolean";
|
|
41
83
|
/** 单元格级编辑控制;预览仍需显式开启 editing。 */
|
|
42
84
|
editable?: boolean;
|
|
85
|
+
source?: ReportCellSource;
|
|
43
86
|
/** Excel 公式保留元数据;当前引擎不计算公式,公式格始终只读。 */
|
|
44
87
|
formula?: string;
|
|
45
88
|
children?: PlanComponent[];
|
|
@@ -48,6 +91,8 @@ declare interface GridCell {
|
|
|
48
91
|
style?: ComponentStyle;
|
|
49
92
|
}
|
|
50
93
|
|
|
94
|
+
declare type ImageComponentKind = "image" | "chart" | "barcode" | "qrcode";
|
|
95
|
+
|
|
51
96
|
/** 删除已知无效的字体缓存;供字体解析失败后修正同 URL 并重试。 */
|
|
52
97
|
export declare function invalidateFontCache(url: string): Promise<void>;
|
|
53
98
|
|
|
@@ -58,6 +103,34 @@ export declare function invalidateFontCache(url: string): Promise<void>;
|
|
|
58
103
|
*/
|
|
59
104
|
export declare function loadFontWithCache(url: string, options?: FontLoadOptions): Promise<Uint8Array | null>;
|
|
60
105
|
|
|
106
|
+
declare interface OutputDiagnostic {
|
|
107
|
+
code: "missing-image" | "unsupported-component" | "unsupported-image-format" | "unsupported-style" | "rich-text-flattened" | "nested-components-omitted" | "async-image-required" | "image-decode-failed" | "asset-render-failed" | "asset-budget-exceeded";
|
|
108
|
+
severity: "warning";
|
|
109
|
+
format: OutputFormat;
|
|
110
|
+
pageIndex: number;
|
|
111
|
+
componentIndex: number;
|
|
112
|
+
/** Nested grid child location as repeating [rowIndex, columnIndex, childIndex] triples. */
|
|
113
|
+
componentPath?: readonly number[];
|
|
114
|
+
kind: string;
|
|
115
|
+
nid?: string;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare interface OutputDiagnosticOptions extends OutputTaskOptions {
|
|
120
|
+
/** Structured fidelity diagnostics; rendering never silently invents missing content. */
|
|
121
|
+
onDiagnostic?: (diagnostic: OutputDiagnostic) => void;
|
|
122
|
+
/** Reject known unsupported content before creating an incomplete file. Default warn. */
|
|
123
|
+
fidelity?: "warn" | "strict";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare type OutputFormat = "dom" | "canvas" | "pdf" | "xlsx";
|
|
127
|
+
|
|
128
|
+
/** Stage counts are exact completed units; encoding libraries may remain indeterminate. */
|
|
129
|
+
declare interface OutputTaskOptions {
|
|
130
|
+
signal?: AbortSignal;
|
|
131
|
+
onProgress?: (completed: number, total: number) => void;
|
|
132
|
+
}
|
|
133
|
+
|
|
61
134
|
/**
|
|
62
135
|
* PDF 文档句柄(不透明最小面):结构化仅暴露 save(),
|
|
63
136
|
* 避免在公共类型面泄漏 pdf-lib 类型(引擎保持零运行时依赖声明)。
|
|
@@ -66,10 +139,17 @@ export declare type PdfDocumentHandle = {
|
|
|
66
139
|
save(): Promise<Uint8Array>;
|
|
67
140
|
};
|
|
68
141
|
|
|
69
|
-
export declare interface PdfRenderOptions {
|
|
142
|
+
export declare interface PdfRenderOptions extends AssetRenderOptions, OutputTaskOptions {
|
|
70
143
|
/** 嵌入字体字节(TTF,如黑体);缺省用 Helvetica(不支持 CJK) */
|
|
71
144
|
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
72
145
|
customFontName?: string;
|
|
146
|
+
/** Explicit faces preserve bold/italic; missing faces fall back to regular and emit a fidelity warning. */
|
|
147
|
+
customFontFaces?: {
|
|
148
|
+
regular: Uint8Array | ArrayBuffer;
|
|
149
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
150
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
151
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
152
|
+
};
|
|
73
153
|
/** 文本测量器(默认启发式;与分页/Canvas 注入同一实例可消除折行差异) */
|
|
74
154
|
measurer?: TextMeasurer;
|
|
75
155
|
}
|
|
@@ -81,6 +161,7 @@ export declare interface PdfRenderResult {
|
|
|
81
161
|
unsupportedTextCount: number;
|
|
82
162
|
/** 保真度降级清单(富文本转纯文本、图片格式不支持等),供上层提示 */
|
|
83
163
|
fidelityWarnings: string[];
|
|
164
|
+
diagnostics: OutputDiagnostic[];
|
|
84
165
|
}
|
|
85
166
|
|
|
86
167
|
declare interface PlanComponent {
|
|
@@ -96,6 +177,8 @@ declare interface PlanComponent {
|
|
|
96
177
|
lines?: string[];
|
|
97
178
|
richParagraphs?: RichParagraph[];
|
|
98
179
|
imageData?: string;
|
|
180
|
+
/** 明确指定线段方向;省略保持历史水平线行为。 */
|
|
181
|
+
lineDirection?: "down" | "up";
|
|
99
182
|
grid?: PlanGrid;
|
|
100
183
|
table?: PlanTableFragment;
|
|
101
184
|
style?: ComponentStyle;
|
|
@@ -137,6 +220,10 @@ declare interface PlanTableFragment {
|
|
|
137
220
|
columnKeys: string[];
|
|
138
221
|
layout?: "page" | "wide";
|
|
139
222
|
title?: string;
|
|
223
|
+
/** 只有宿主声明稳定 rowKey 时生成,不能用显示顺序替代业务主键。 */
|
|
224
|
+
source?: Omit<ReportCellSource, "field" | "rowKey"> & {
|
|
225
|
+
rowKey?: string | number;
|
|
226
|
+
};
|
|
140
227
|
}
|
|
141
228
|
|
|
142
229
|
declare interface RenderPlan {
|
|
@@ -146,6 +233,15 @@ declare interface RenderPlan {
|
|
|
146
233
|
|
|
147
234
|
export declare function renderPlanToPdf(plan: RenderPlan, options?: PdfRenderOptions): Promise<PdfRenderResult>;
|
|
148
235
|
|
|
236
|
+
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
237
|
+
declare interface ReportCellSource {
|
|
238
|
+
datasetId: string;
|
|
239
|
+
rowKey: string | number;
|
|
240
|
+
field: string;
|
|
241
|
+
revision?: string | number;
|
|
242
|
+
sourceToken?: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
149
245
|
declare interface RichParagraph {
|
|
150
246
|
segments: RichSegment[];
|
|
151
247
|
align?: ComponentStyle["align"];
|
|
@@ -171,7 +267,24 @@ declare interface RichSegment {
|
|
|
171
267
|
*/
|
|
172
268
|
declare interface TextMeasureOptions {
|
|
173
269
|
fontSizePt: number;
|
|
270
|
+
fontFamily?: string;
|
|
271
|
+
bold?: boolean;
|
|
272
|
+
italic?: boolean;
|
|
273
|
+
letterSpacingPt?: number;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 文本测量与折行(分页/Canvas/PDF 共用的唯一折行真相源)。
|
|
278
|
+
*
|
|
279
|
+
* 测量模型可注入(TextMeasurer):
|
|
280
|
+
* - 默认 createHeuristicMeasurer():CJK/拉丁宽度启发式(零依赖、Node 可用)
|
|
281
|
+
* - 浏览器端可注入 createCanvasMeasurer()(真字体 metrics,消除三端折行差异)
|
|
282
|
+
*/
|
|
283
|
+
declare interface TextMeasureOptions_2 {
|
|
284
|
+
fontSizePt: number;
|
|
285
|
+
fontFamily?: string;
|
|
174
286
|
bold?: boolean;
|
|
287
|
+
italic?: boolean;
|
|
175
288
|
letterSpacingPt?: number;
|
|
176
289
|
}
|
|
177
290
|
|
|
@@ -180,4 +293,9 @@ declare interface TextMeasurer {
|
|
|
180
293
|
measureMm(text: string, options: TextMeasureOptions): number;
|
|
181
294
|
}
|
|
182
295
|
|
|
296
|
+
/** 宽度测量接口:返回文本在给定字号下的宽度(mm)。实现必须无副作用、可缓存。 */
|
|
297
|
+
declare interface TextMeasurer_2 {
|
|
298
|
+
measureMm(text: string, options: TextMeasureOptions_2): number;
|
|
299
|
+
}
|
|
300
|
+
|
|
183
301
|
export { }
|
package/dist/pdf.d.ts
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
declare interface AssetRenderBudget {
|
|
2
|
+
/** Maximum newly rendered assets, default 1000. Existing imageData is kept unchanged. */
|
|
3
|
+
maxAssets?: number;
|
|
4
|
+
/** Maximum image payload bytes per new asset, default 32 MiB. */
|
|
5
|
+
maxImageBytes?: number;
|
|
6
|
+
/** Maximum total image payload bytes for new assets, default 128 MiB. */
|
|
7
|
+
maxTotalImageBytes?: number;
|
|
8
|
+
/** Wall-clock budget, including adapters that ignore AbortSignal. Default 30 seconds. */
|
|
9
|
+
maxDurationMs?: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare interface AssetRenderOptions extends OutputDiagnosticOptions {
|
|
13
|
+
assetRenderers?: Partial<Record<ImageComponentKind, ComponentImageRenderer>>;
|
|
14
|
+
assetBudget?: AssetRenderBudget;
|
|
15
|
+
/** Default throw prevents an incomplete export; placeholder retains the component and emits diagnostics. */
|
|
16
|
+
assetFailure?: "throw" | "placeholder";
|
|
17
|
+
signal?: AbortSignal;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare interface ComponentImageContext {
|
|
21
|
+
readonly component: Readonly<PlanComponent>;
|
|
22
|
+
readonly pageIndex: number;
|
|
23
|
+
readonly componentIndex: number;
|
|
24
|
+
readonly componentPath: readonly number[];
|
|
25
|
+
readonly signal: AbortSignal;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare type ComponentImageRenderer = (context: ComponentImageContext) => string | Promise<string>;
|
|
29
|
+
|
|
1
30
|
declare type ComponentKind = "text" | "image" | "barcode" | "qrcode" | "chart" | "line" | "rect" | "ellipse";
|
|
2
31
|
|
|
3
32
|
declare interface ComponentStyle {
|
|
@@ -24,6 +53,19 @@ declare interface ComponentStyle {
|
|
|
24
53
|
rotateDeg?: number;
|
|
25
54
|
}
|
|
26
55
|
|
|
56
|
+
/** Exact font-byte width adapter. Import from /pdf to keep fontkit outside the core bundle. */
|
|
57
|
+
export declare function createFontBytesMeasurer(options: FontBytesMeasureOptions): TextMeasurer_2;
|
|
58
|
+
|
|
59
|
+
export declare interface FontBytesMeasureOptions {
|
|
60
|
+
regular: Uint8Array | ArrayBuffer;
|
|
61
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
62
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
63
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
64
|
+
/** Optional family guard: other font families use fallback instead of inaccurate metrics. */
|
|
65
|
+
fontFamily?: string;
|
|
66
|
+
fallback?: TextMeasurer_2;
|
|
67
|
+
}
|
|
68
|
+
|
|
27
69
|
export declare interface FontLoadOptions {
|
|
28
70
|
/** 校验字体格式与可解析结构,失败抛出带 cause 的诊断;默认保留旧 API 的 null 降级。 */
|
|
29
71
|
strict?: boolean;
|
|
@@ -40,6 +82,7 @@ declare interface GridCell {
|
|
|
40
82
|
valueType?: "text" | "number" | "boolean";
|
|
41
83
|
/** 单元格级编辑控制;预览仍需显式开启 editing。 */
|
|
42
84
|
editable?: boolean;
|
|
85
|
+
source?: ReportCellSource;
|
|
43
86
|
/** Excel 公式保留元数据;当前引擎不计算公式,公式格始终只读。 */
|
|
44
87
|
formula?: string;
|
|
45
88
|
children?: PlanComponent[];
|
|
@@ -48,6 +91,8 @@ declare interface GridCell {
|
|
|
48
91
|
style?: ComponentStyle;
|
|
49
92
|
}
|
|
50
93
|
|
|
94
|
+
declare type ImageComponentKind = "image" | "chart" | "barcode" | "qrcode";
|
|
95
|
+
|
|
51
96
|
/** 删除已知无效的字体缓存;供字体解析失败后修正同 URL 并重试。 */
|
|
52
97
|
export declare function invalidateFontCache(url: string): Promise<void>;
|
|
53
98
|
|
|
@@ -58,6 +103,34 @@ export declare function invalidateFontCache(url: string): Promise<void>;
|
|
|
58
103
|
*/
|
|
59
104
|
export declare function loadFontWithCache(url: string, options?: FontLoadOptions): Promise<Uint8Array | null>;
|
|
60
105
|
|
|
106
|
+
declare interface OutputDiagnostic {
|
|
107
|
+
code: "missing-image" | "unsupported-component" | "unsupported-image-format" | "unsupported-style" | "rich-text-flattened" | "nested-components-omitted" | "async-image-required" | "image-decode-failed" | "asset-render-failed" | "asset-budget-exceeded";
|
|
108
|
+
severity: "warning";
|
|
109
|
+
format: OutputFormat;
|
|
110
|
+
pageIndex: number;
|
|
111
|
+
componentIndex: number;
|
|
112
|
+
/** Nested grid child location as repeating [rowIndex, columnIndex, childIndex] triples. */
|
|
113
|
+
componentPath?: readonly number[];
|
|
114
|
+
kind: string;
|
|
115
|
+
nid?: string;
|
|
116
|
+
message: string;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
declare interface OutputDiagnosticOptions extends OutputTaskOptions {
|
|
120
|
+
/** Structured fidelity diagnostics; rendering never silently invents missing content. */
|
|
121
|
+
onDiagnostic?: (diagnostic: OutputDiagnostic) => void;
|
|
122
|
+
/** Reject known unsupported content before creating an incomplete file. Default warn. */
|
|
123
|
+
fidelity?: "warn" | "strict";
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
declare type OutputFormat = "dom" | "canvas" | "pdf" | "xlsx";
|
|
127
|
+
|
|
128
|
+
/** Stage counts are exact completed units; encoding libraries may remain indeterminate. */
|
|
129
|
+
declare interface OutputTaskOptions {
|
|
130
|
+
signal?: AbortSignal;
|
|
131
|
+
onProgress?: (completed: number, total: number) => void;
|
|
132
|
+
}
|
|
133
|
+
|
|
61
134
|
/**
|
|
62
135
|
* PDF 文档句柄(不透明最小面):结构化仅暴露 save(),
|
|
63
136
|
* 避免在公共类型面泄漏 pdf-lib 类型(引擎保持零运行时依赖声明)。
|
|
@@ -66,10 +139,17 @@ export declare type PdfDocumentHandle = {
|
|
|
66
139
|
save(): Promise<Uint8Array>;
|
|
67
140
|
};
|
|
68
141
|
|
|
69
|
-
export declare interface PdfRenderOptions {
|
|
142
|
+
export declare interface PdfRenderOptions extends AssetRenderOptions, OutputTaskOptions {
|
|
70
143
|
/** 嵌入字体字节(TTF,如黑体);缺省用 Helvetica(不支持 CJK) */
|
|
71
144
|
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
72
145
|
customFontName?: string;
|
|
146
|
+
/** Explicit faces preserve bold/italic; missing faces fall back to regular and emit a fidelity warning. */
|
|
147
|
+
customFontFaces?: {
|
|
148
|
+
regular: Uint8Array | ArrayBuffer;
|
|
149
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
150
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
151
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
152
|
+
};
|
|
73
153
|
/** 文本测量器(默认启发式;与分页/Canvas 注入同一实例可消除折行差异) */
|
|
74
154
|
measurer?: TextMeasurer;
|
|
75
155
|
}
|
|
@@ -81,6 +161,7 @@ export declare interface PdfRenderResult {
|
|
|
81
161
|
unsupportedTextCount: number;
|
|
82
162
|
/** 保真度降级清单(富文本转纯文本、图片格式不支持等),供上层提示 */
|
|
83
163
|
fidelityWarnings: string[];
|
|
164
|
+
diagnostics: OutputDiagnostic[];
|
|
84
165
|
}
|
|
85
166
|
|
|
86
167
|
declare interface PlanComponent {
|
|
@@ -96,6 +177,8 @@ declare interface PlanComponent {
|
|
|
96
177
|
lines?: string[];
|
|
97
178
|
richParagraphs?: RichParagraph[];
|
|
98
179
|
imageData?: string;
|
|
180
|
+
/** 明确指定线段方向;省略保持历史水平线行为。 */
|
|
181
|
+
lineDirection?: "down" | "up";
|
|
99
182
|
grid?: PlanGrid;
|
|
100
183
|
table?: PlanTableFragment;
|
|
101
184
|
style?: ComponentStyle;
|
|
@@ -137,6 +220,10 @@ declare interface PlanTableFragment {
|
|
|
137
220
|
columnKeys: string[];
|
|
138
221
|
layout?: "page" | "wide";
|
|
139
222
|
title?: string;
|
|
223
|
+
/** 只有宿主声明稳定 rowKey 时生成,不能用显示顺序替代业务主键。 */
|
|
224
|
+
source?: Omit<ReportCellSource, "field" | "rowKey"> & {
|
|
225
|
+
rowKey?: string | number;
|
|
226
|
+
};
|
|
140
227
|
}
|
|
141
228
|
|
|
142
229
|
declare interface RenderPlan {
|
|
@@ -146,6 +233,15 @@ declare interface RenderPlan {
|
|
|
146
233
|
|
|
147
234
|
export declare function renderPlanToPdf(plan: RenderPlan, options?: PdfRenderOptions): Promise<PdfRenderResult>;
|
|
148
235
|
|
|
236
|
+
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
237
|
+
declare interface ReportCellSource {
|
|
238
|
+
datasetId: string;
|
|
239
|
+
rowKey: string | number;
|
|
240
|
+
field: string;
|
|
241
|
+
revision?: string | number;
|
|
242
|
+
sourceToken?: string;
|
|
243
|
+
}
|
|
244
|
+
|
|
149
245
|
declare interface RichParagraph {
|
|
150
246
|
segments: RichSegment[];
|
|
151
247
|
align?: ComponentStyle["align"];
|
|
@@ -171,7 +267,24 @@ declare interface RichSegment {
|
|
|
171
267
|
*/
|
|
172
268
|
declare interface TextMeasureOptions {
|
|
173
269
|
fontSizePt: number;
|
|
270
|
+
fontFamily?: string;
|
|
271
|
+
bold?: boolean;
|
|
272
|
+
italic?: boolean;
|
|
273
|
+
letterSpacingPt?: number;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 文本测量与折行(分页/Canvas/PDF 共用的唯一折行真相源)。
|
|
278
|
+
*
|
|
279
|
+
* 测量模型可注入(TextMeasurer):
|
|
280
|
+
* - 默认 createHeuristicMeasurer():CJK/拉丁宽度启发式(零依赖、Node 可用)
|
|
281
|
+
* - 浏览器端可注入 createCanvasMeasurer()(真字体 metrics,消除三端折行差异)
|
|
282
|
+
*/
|
|
283
|
+
declare interface TextMeasureOptions_2 {
|
|
284
|
+
fontSizePt: number;
|
|
285
|
+
fontFamily?: string;
|
|
174
286
|
bold?: boolean;
|
|
287
|
+
italic?: boolean;
|
|
175
288
|
letterSpacingPt?: number;
|
|
176
289
|
}
|
|
177
290
|
|
|
@@ -180,4 +293,9 @@ declare interface TextMeasurer {
|
|
|
180
293
|
measureMm(text: string, options: TextMeasureOptions): number;
|
|
181
294
|
}
|
|
182
295
|
|
|
296
|
+
/** 宽度测量接口:返回文本在给定字号下的宽度(mm)。实现必须无副作用、可缓存。 */
|
|
297
|
+
declare interface TextMeasurer_2 {
|
|
298
|
+
measureMm(text: string, options: TextMeasureOptions_2): number;
|
|
299
|
+
}
|
|
300
|
+
|
|
183
301
|
export { }
|