@agile-team/mach-report 2.4.1 → 2.6.1
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 +119 -13
- package/dist/ReportPreview-Dk-28QAi.js +2946 -0
- package/dist/ReportPreview-FSvcBLjH.cjs +6 -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-66UBlhES.cjs +1 -0
- package/dist/assets-NVA_sftu.js +163 -0
- package/dist/capabilities-CNjIirfo.js +36 -0
- package/dist/capabilities-D4xeVYSR.cjs +1 -0
- package/dist/designer.cjs +1 -0
- package/dist/designer.d.cts +753 -0
- package/dist/designer.d.ts +753 -0
- package/dist/designer.js +372 -0
- package/dist/grid-geometry-BNptEcMm.js +65 -0
- package/dist/grid-geometry-CZ_cYB6O.cjs +1 -0
- package/dist/index.cjs +8 -5
- package/dist/index.d.cts +413 -8
- package/dist/index.d.ts +413 -8
- package/dist/index.js +1016 -1501
- 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 +111 -1
- package/dist/pdf.d.ts +111 -1
- package/dist/pdf.js +3931 -3868
- package/dist/{plugin-DwKr8oF6.cjs → plugin-BqBkn_kI.cjs} +1 -1
- package/dist/{plugin-CKnSVuVe.js → plugin-Ds10VnQO.js} +2 -2
- 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-B9bENO0F.js +750 -0
- package/dist/report-source-BbNkkBDy.cjs +1 -0
- package/dist/server/node.d.cts +297 -0
- package/dist/server/node.d.ts +297 -0
- package/dist/server-node.cjs +1 -0
- package/dist/server-node.js +270 -0
- package/dist/server.cjs +1 -0
- package/dist/server.d.cts +643 -0
- package/dist/server.d.ts +643 -0
- package/dist/server.js +237 -0
- package/dist/style-CpwiOPyB.cjs +1 -0
- package/dist/style-Dv5o_x6b.js +67 -0
- package/dist/style.css +1 -1
- 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 +694 -54
- package/dist/vue/async.d.ts +694 -54
- package/dist/vue/index.d.cts +1212 -111
- package/dist/vue/index.d.ts +1212 -111
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +167 -80
- package/dist/worker.cjs +1 -0
- package/dist/worker.d.cts +302 -0
- package/dist/worker.d.ts +302 -0
- package/dist/worker.js +133 -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 +78 -1
- package/dist/xlsx.d.ts +78 -1
- package/dist/xlsx.js +5974 -5831
- package/package.json +62 -2
- package/dist/ReportPreview-BVTpw9Tb.cjs +0 -6
- package/dist/ReportPreview-XF8iSUG1.js +0 -1910
- 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,26 @@ 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" | "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 {
|
|
120
|
+
/** Structured fidelity diagnostics; rendering never silently invents missing content. */
|
|
121
|
+
onDiagnostic?: (diagnostic: OutputDiagnostic) => void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare type OutputFormat = "dom" | "canvas" | "pdf" | "xlsx";
|
|
125
|
+
|
|
61
126
|
/**
|
|
62
127
|
* PDF 文档句柄(不透明最小面):结构化仅暴露 save(),
|
|
63
128
|
* 避免在公共类型面泄漏 pdf-lib 类型(引擎保持零运行时依赖声明)。
|
|
@@ -66,10 +131,17 @@ export declare type PdfDocumentHandle = {
|
|
|
66
131
|
save(): Promise<Uint8Array>;
|
|
67
132
|
};
|
|
68
133
|
|
|
69
|
-
export declare interface PdfRenderOptions {
|
|
134
|
+
export declare interface PdfRenderOptions extends AssetRenderOptions {
|
|
70
135
|
/** 嵌入字体字节(TTF,如黑体);缺省用 Helvetica(不支持 CJK) */
|
|
71
136
|
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
72
137
|
customFontName?: string;
|
|
138
|
+
/** Explicit faces preserve bold/italic; missing faces fall back to regular and emit a fidelity warning. */
|
|
139
|
+
customFontFaces?: {
|
|
140
|
+
regular: Uint8Array | ArrayBuffer;
|
|
141
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
142
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
143
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
144
|
+
};
|
|
73
145
|
/** 文本测量器(默认启发式;与分页/Canvas 注入同一实例可消除折行差异) */
|
|
74
146
|
measurer?: TextMeasurer;
|
|
75
147
|
}
|
|
@@ -81,6 +153,7 @@ export declare interface PdfRenderResult {
|
|
|
81
153
|
unsupportedTextCount: number;
|
|
82
154
|
/** 保真度降级清单(富文本转纯文本、图片格式不支持等),供上层提示 */
|
|
83
155
|
fidelityWarnings: string[];
|
|
156
|
+
diagnostics: OutputDiagnostic[];
|
|
84
157
|
}
|
|
85
158
|
|
|
86
159
|
declare interface PlanComponent {
|
|
@@ -96,6 +169,8 @@ declare interface PlanComponent {
|
|
|
96
169
|
lines?: string[];
|
|
97
170
|
richParagraphs?: RichParagraph[];
|
|
98
171
|
imageData?: string;
|
|
172
|
+
/** 明确指定线段方向;省略保持历史水平线行为。 */
|
|
173
|
+
lineDirection?: "down" | "up";
|
|
99
174
|
grid?: PlanGrid;
|
|
100
175
|
table?: PlanTableFragment;
|
|
101
176
|
style?: ComponentStyle;
|
|
@@ -137,6 +212,10 @@ declare interface PlanTableFragment {
|
|
|
137
212
|
columnKeys: string[];
|
|
138
213
|
layout?: "page" | "wide";
|
|
139
214
|
title?: string;
|
|
215
|
+
/** 只有宿主声明稳定 rowKey 时生成,不能用显示顺序替代业务主键。 */
|
|
216
|
+
source?: Omit<ReportCellSource, "field" | "rowKey"> & {
|
|
217
|
+
rowKey?: string | number;
|
|
218
|
+
};
|
|
140
219
|
}
|
|
141
220
|
|
|
142
221
|
declare interface RenderPlan {
|
|
@@ -146,6 +225,15 @@ declare interface RenderPlan {
|
|
|
146
225
|
|
|
147
226
|
export declare function renderPlanToPdf(plan: RenderPlan, options?: PdfRenderOptions): Promise<PdfRenderResult>;
|
|
148
227
|
|
|
228
|
+
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
229
|
+
declare interface ReportCellSource {
|
|
230
|
+
datasetId: string;
|
|
231
|
+
rowKey: string | number;
|
|
232
|
+
field: string;
|
|
233
|
+
revision?: string | number;
|
|
234
|
+
sourceToken?: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
149
237
|
declare interface RichParagraph {
|
|
150
238
|
segments: RichSegment[];
|
|
151
239
|
align?: ComponentStyle["align"];
|
|
@@ -171,7 +259,24 @@ declare interface RichSegment {
|
|
|
171
259
|
*/
|
|
172
260
|
declare interface TextMeasureOptions {
|
|
173
261
|
fontSizePt: number;
|
|
262
|
+
fontFamily?: string;
|
|
174
263
|
bold?: boolean;
|
|
264
|
+
italic?: boolean;
|
|
265
|
+
letterSpacingPt?: number;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* 文本测量与折行(分页/Canvas/PDF 共用的唯一折行真相源)。
|
|
270
|
+
*
|
|
271
|
+
* 测量模型可注入(TextMeasurer):
|
|
272
|
+
* - 默认 createHeuristicMeasurer():CJK/拉丁宽度启发式(零依赖、Node 可用)
|
|
273
|
+
* - 浏览器端可注入 createCanvasMeasurer()(真字体 metrics,消除三端折行差异)
|
|
274
|
+
*/
|
|
275
|
+
declare interface TextMeasureOptions_2 {
|
|
276
|
+
fontSizePt: number;
|
|
277
|
+
fontFamily?: string;
|
|
278
|
+
bold?: boolean;
|
|
279
|
+
italic?: boolean;
|
|
175
280
|
letterSpacingPt?: number;
|
|
176
281
|
}
|
|
177
282
|
|
|
@@ -180,4 +285,9 @@ declare interface TextMeasurer {
|
|
|
180
285
|
measureMm(text: string, options: TextMeasureOptions): number;
|
|
181
286
|
}
|
|
182
287
|
|
|
288
|
+
/** 宽度测量接口:返回文本在给定字号下的宽度(mm)。实现必须无副作用、可缓存。 */
|
|
289
|
+
declare interface TextMeasurer_2 {
|
|
290
|
+
measureMm(text: string, options: TextMeasureOptions_2): number;
|
|
291
|
+
}
|
|
292
|
+
|
|
183
293
|
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,26 @@ 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" | "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 {
|
|
120
|
+
/** Structured fidelity diagnostics; rendering never silently invents missing content. */
|
|
121
|
+
onDiagnostic?: (diagnostic: OutputDiagnostic) => void;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare type OutputFormat = "dom" | "canvas" | "pdf" | "xlsx";
|
|
125
|
+
|
|
61
126
|
/**
|
|
62
127
|
* PDF 文档句柄(不透明最小面):结构化仅暴露 save(),
|
|
63
128
|
* 避免在公共类型面泄漏 pdf-lib 类型(引擎保持零运行时依赖声明)。
|
|
@@ -66,10 +131,17 @@ export declare type PdfDocumentHandle = {
|
|
|
66
131
|
save(): Promise<Uint8Array>;
|
|
67
132
|
};
|
|
68
133
|
|
|
69
|
-
export declare interface PdfRenderOptions {
|
|
134
|
+
export declare interface PdfRenderOptions extends AssetRenderOptions {
|
|
70
135
|
/** 嵌入字体字节(TTF,如黑体);缺省用 Helvetica(不支持 CJK) */
|
|
71
136
|
customFontBytes?: Uint8Array | ArrayBuffer;
|
|
72
137
|
customFontName?: string;
|
|
138
|
+
/** Explicit faces preserve bold/italic; missing faces fall back to regular and emit a fidelity warning. */
|
|
139
|
+
customFontFaces?: {
|
|
140
|
+
regular: Uint8Array | ArrayBuffer;
|
|
141
|
+
bold?: Uint8Array | ArrayBuffer;
|
|
142
|
+
italic?: Uint8Array | ArrayBuffer;
|
|
143
|
+
boldItalic?: Uint8Array | ArrayBuffer;
|
|
144
|
+
};
|
|
73
145
|
/** 文本测量器(默认启发式;与分页/Canvas 注入同一实例可消除折行差异) */
|
|
74
146
|
measurer?: TextMeasurer;
|
|
75
147
|
}
|
|
@@ -81,6 +153,7 @@ export declare interface PdfRenderResult {
|
|
|
81
153
|
unsupportedTextCount: number;
|
|
82
154
|
/** 保真度降级清单(富文本转纯文本、图片格式不支持等),供上层提示 */
|
|
83
155
|
fidelityWarnings: string[];
|
|
156
|
+
diagnostics: OutputDiagnostic[];
|
|
84
157
|
}
|
|
85
158
|
|
|
86
159
|
declare interface PlanComponent {
|
|
@@ -96,6 +169,8 @@ declare interface PlanComponent {
|
|
|
96
169
|
lines?: string[];
|
|
97
170
|
richParagraphs?: RichParagraph[];
|
|
98
171
|
imageData?: string;
|
|
172
|
+
/** 明确指定线段方向;省略保持历史水平线行为。 */
|
|
173
|
+
lineDirection?: "down" | "up";
|
|
99
174
|
grid?: PlanGrid;
|
|
100
175
|
table?: PlanTableFragment;
|
|
101
176
|
style?: ComponentStyle;
|
|
@@ -137,6 +212,10 @@ declare interface PlanTableFragment {
|
|
|
137
212
|
columnKeys: string[];
|
|
138
213
|
layout?: "page" | "wide";
|
|
139
214
|
title?: string;
|
|
215
|
+
/** 只有宿主声明稳定 rowKey 时生成,不能用显示顺序替代业务主键。 */
|
|
216
|
+
source?: Omit<ReportCellSource, "field" | "rowKey"> & {
|
|
217
|
+
rowKey?: string | number;
|
|
218
|
+
};
|
|
140
219
|
}
|
|
141
220
|
|
|
142
221
|
declare interface RenderPlan {
|
|
@@ -146,6 +225,15 @@ declare interface RenderPlan {
|
|
|
146
225
|
|
|
147
226
|
export declare function renderPlanToPdf(plan: RenderPlan, options?: PdfRenderOptions): Promise<PdfRenderResult>;
|
|
148
227
|
|
|
228
|
+
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
229
|
+
declare interface ReportCellSource {
|
|
230
|
+
datasetId: string;
|
|
231
|
+
rowKey: string | number;
|
|
232
|
+
field: string;
|
|
233
|
+
revision?: string | number;
|
|
234
|
+
sourceToken?: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
149
237
|
declare interface RichParagraph {
|
|
150
238
|
segments: RichSegment[];
|
|
151
239
|
align?: ComponentStyle["align"];
|
|
@@ -171,7 +259,24 @@ declare interface RichSegment {
|
|
|
171
259
|
*/
|
|
172
260
|
declare interface TextMeasureOptions {
|
|
173
261
|
fontSizePt: number;
|
|
262
|
+
fontFamily?: string;
|
|
174
263
|
bold?: boolean;
|
|
264
|
+
italic?: boolean;
|
|
265
|
+
letterSpacingPt?: number;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* 文本测量与折行(分页/Canvas/PDF 共用的唯一折行真相源)。
|
|
270
|
+
*
|
|
271
|
+
* 测量模型可注入(TextMeasurer):
|
|
272
|
+
* - 默认 createHeuristicMeasurer():CJK/拉丁宽度启发式(零依赖、Node 可用)
|
|
273
|
+
* - 浏览器端可注入 createCanvasMeasurer()(真字体 metrics,消除三端折行差异)
|
|
274
|
+
*/
|
|
275
|
+
declare interface TextMeasureOptions_2 {
|
|
276
|
+
fontSizePt: number;
|
|
277
|
+
fontFamily?: string;
|
|
278
|
+
bold?: boolean;
|
|
279
|
+
italic?: boolean;
|
|
175
280
|
letterSpacingPt?: number;
|
|
176
281
|
}
|
|
177
282
|
|
|
@@ -180,4 +285,9 @@ declare interface TextMeasurer {
|
|
|
180
285
|
measureMm(text: string, options: TextMeasureOptions): number;
|
|
181
286
|
}
|
|
182
287
|
|
|
288
|
+
/** 宽度测量接口:返回文本在给定字号下的宽度(mm)。实现必须无副作用、可缓存。 */
|
|
289
|
+
declare interface TextMeasurer_2 {
|
|
290
|
+
measureMm(text: string, options: TextMeasureOptions_2): number;
|
|
291
|
+
}
|
|
292
|
+
|
|
183
293
|
export { }
|