@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/index.d.ts
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
/** 复制发生变化的页/组件/行;原计划保持不变,并拒绝覆盖已改变的单元格。 */
|
|
2
2
|
export declare function applyReportCellEdit(plan: RenderPlan, edit: ReportCellEdit): RenderPlan;
|
|
3
3
|
|
|
4
|
+
/** Transactional from the caller's perspective: a later conflict never exposes earlier writes. */
|
|
5
|
+
export declare function applyReportCellEditBatch(plan: RenderPlan, batch: Pick<ReportEditBatch, "edits">): RenderPlan;
|
|
6
|
+
|
|
7
|
+
/** Refresh concurrency metadata without changing values, layout, or the host's source objects. */
|
|
8
|
+
export declare function applyReportEditResult(plan: RenderPlan, batch: ReportEditBatch, result: void | ReportEditResult): RenderPlan;
|
|
9
|
+
|
|
4
10
|
export declare function assertRenderPlan(input: unknown): PlanPage[];
|
|
5
11
|
|
|
12
|
+
export declare function assertReportParams(defs: readonly ReportParamDef[], input?: Record<string, unknown>): Record<string, string>;
|
|
13
|
+
|
|
14
|
+
export declare interface AssetRenderBudget {
|
|
15
|
+
/** Maximum newly rendered assets, default 1000. Existing imageData is kept unchanged. */
|
|
16
|
+
maxAssets?: number;
|
|
17
|
+
/** Maximum image payload bytes per new asset, default 32 MiB. */
|
|
18
|
+
maxImageBytes?: number;
|
|
19
|
+
/** Maximum total image payload bytes for new assets, default 128 MiB. */
|
|
20
|
+
maxTotalImageBytes?: number;
|
|
21
|
+
/** Wall-clock budget, including adapters that ignore AbortSignal. Default 30 seconds. */
|
|
22
|
+
maxDurationMs?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export declare interface AssetRenderOptions extends OutputDiagnosticOptions {
|
|
26
|
+
assetRenderers?: Partial<Record<ImageComponentKind, ComponentImageRenderer>>;
|
|
27
|
+
assetBudget?: AssetRenderBudget;
|
|
28
|
+
/** Default throw prevents an incomplete export; placeholder retains the component and emits diagnostics. */
|
|
29
|
+
assetFailure?: "throw" | "placeholder";
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export declare interface AsyncCanvasRenderOptions extends CanvasRenderOptions, AssetRenderOptions {
|
|
34
|
+
/** Optional image decoder for CORS-aware URLs or custom assets. Browser default supports image data URLs. */
|
|
35
|
+
imageLoader?: CanvasImageLoader;
|
|
36
|
+
}
|
|
37
|
+
|
|
6
38
|
/** 盒子边框语义:四边开关 + 内部网格线(四边全关则内线不画) */
|
|
7
39
|
export declare interface BoxBorders {
|
|
8
40
|
top: boolean;
|
|
@@ -13,6 +45,8 @@ export declare interface BoxBorders {
|
|
|
13
45
|
inner: boolean;
|
|
14
46
|
}
|
|
15
47
|
|
|
48
|
+
export declare type CanvasImageLoader = (source: string, signal?: AbortSignal) => Promise<CanvasImageSource>;
|
|
49
|
+
|
|
16
50
|
export declare interface CanvasPager {
|
|
17
51
|
/** 挂载到滚动容器(viewport,overflow:auto),接管其内容 */
|
|
18
52
|
attach(viewport: HTMLElement): void;
|
|
@@ -24,7 +58,7 @@ export declare interface CanvasPager {
|
|
|
24
58
|
};
|
|
25
59
|
}
|
|
26
60
|
|
|
27
|
-
export declare interface CanvasPagerOptions extends
|
|
61
|
+
export declare interface CanvasPagerOptions extends AsyncCanvasRenderOptions {
|
|
28
62
|
/** 预渲染页数缓冲(窗口两侧各加 N 页),默认 1 */
|
|
29
63
|
overscan?: number;
|
|
30
64
|
/** 页间距 px,默认 18 */
|
|
@@ -33,10 +67,12 @@ export declare interface CanvasPagerOptions extends CanvasRenderOptions {
|
|
|
33
67
|
pagesPerFrame?: number;
|
|
34
68
|
}
|
|
35
69
|
|
|
36
|
-
export declare interface CanvasRenderOptions {
|
|
70
|
+
export declare interface CanvasRenderOptions extends OutputDiagnosticOptions {
|
|
37
71
|
/** 设备像素比,默认取运行环境 devicePixelRatio */
|
|
38
72
|
dpr?: number;
|
|
39
73
|
dpi?: number;
|
|
74
|
+
/** Per-page bitmap allocation guard; default 64 million pixels (about 256 MB RGBA). */
|
|
75
|
+
maxCanvasPixels?: number;
|
|
40
76
|
/** 文本默认字体族 */
|
|
41
77
|
fontFamily?: string;
|
|
42
78
|
/** 文本测量器(默认启发式) */
|
|
@@ -48,6 +84,7 @@ export declare interface CanvasRenderOptions {
|
|
|
48
84
|
|
|
49
85
|
export declare interface CanvasRenderResult {
|
|
50
86
|
canvases: HTMLCanvasElement[];
|
|
87
|
+
diagnostics: OutputDiagnostic[];
|
|
51
88
|
}
|
|
52
89
|
|
|
53
90
|
export declare function charWidthEm(ch: string): number;
|
|
@@ -79,6 +116,19 @@ export declare type ColumnFormat = {
|
|
|
79
116
|
pattern?: string;
|
|
80
117
|
};
|
|
81
118
|
|
|
119
|
+
/** 同一字段契约生成列语义和表头,业务侧无需复制另一份字段清单。 */
|
|
120
|
+
export declare function columnsFromContract(contract: DatasetContract, overrides?: Record<string, Partial<TableTemplateColumn>>): TableTemplateColumn[];
|
|
121
|
+
|
|
122
|
+
export declare interface ComponentImageContext {
|
|
123
|
+
readonly component: Readonly<PlanComponent>;
|
|
124
|
+
readonly pageIndex: number;
|
|
125
|
+
readonly componentIndex: number;
|
|
126
|
+
readonly componentPath: readonly number[];
|
|
127
|
+
readonly signal: AbortSignal;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export declare type ComponentImageRenderer = (context: ComponentImageContext) => string | Promise<string>;
|
|
131
|
+
|
|
82
132
|
export declare type ComponentKind = "text" | "image" | "barcode" | "qrcode" | "chart" | "line" | "rect" | "ellipse";
|
|
83
133
|
|
|
84
134
|
export declare interface ComponentStyle {
|
|
@@ -127,15 +177,30 @@ export declare function createCanvasPager(plan: RenderPlan, options?: CanvasPage
|
|
|
127
177
|
/** 兼容旧 API:默认启发式测量 */
|
|
128
178
|
export declare function createHeuristicMeasurer(): TextMeasurer;
|
|
129
179
|
|
|
180
|
+
/** 单进程参考适配器;多实例服务请实现具备数据库事务/CAS 的持久化适配器。 */
|
|
181
|
+
export declare function createMemoryTemplateStore(): ReportTemplateStore;
|
|
182
|
+
|
|
183
|
+
export declare function createProviderReport(definition: Omit<ReportDefinition, "load" | "datasets"> & {
|
|
184
|
+
provider: ReportProvider;
|
|
185
|
+
}): ReportDefinition;
|
|
186
|
+
|
|
130
187
|
/** 生成可供宿主持久化/审计的补丁;不修改 plan 或宿主业务对象。 */
|
|
131
188
|
export declare function createReportCellEdit(plan: RenderPlan, address: ReportCellAddress, input: ReportCellValue): ReportCellEdit;
|
|
132
189
|
|
|
190
|
+
/** Parse and validate every value before persistence. No plan or source objects are mutated. */
|
|
191
|
+
export declare function createReportCellEditBatch(plan: RenderPlan, inputs: readonly ReportCellInput[], requestId: string): ReportEditBatch;
|
|
192
|
+
|
|
193
|
+
/** Operation-scoped index: avoids repeated geometry work without caching mutable plans globally. */
|
|
194
|
+
export declare function createReportCellResolver(plan: RenderPlan): (address: ReportCellAddress) => ReportCellContext | null;
|
|
195
|
+
|
|
133
196
|
/**
|
|
134
197
|
* 框架无关的报表数据源:注册一次模板与取数,包内完成分页、校验、按 ID 顺序合并。
|
|
135
198
|
* 不缓存业务结果、不推断接口包装、不自动重试;鉴权与完整数据范围由宿主决定。
|
|
136
199
|
*/
|
|
137
200
|
export declare function createReportSource(reports: ReportRegistry, options?: {
|
|
138
201
|
onWarning?: (message: string) => void;
|
|
202
|
+
onDatasets?: (reportId: string, datasets: DatasetRows, template: ReportTemplate) => void;
|
|
203
|
+
maxPages?: number;
|
|
139
204
|
}): ReportSource;
|
|
140
205
|
|
|
141
206
|
/**
|
|
@@ -146,16 +211,48 @@ export declare function createTableTemplate(options: TableTemplateOptions): Repo
|
|
|
146
211
|
|
|
147
212
|
export declare function createTemplate(): TemplateBuilder;
|
|
148
213
|
|
|
214
|
+
/** 持久化和框架无关的发布流程;历史返回快照,回滚会产生新修订而不会覆盖旧历史。 */
|
|
215
|
+
export declare function createTemplateManager(store: ReportTemplateStore, options?: {
|
|
216
|
+
migrate?: (input: unknown) => unknown | Promise<unknown>;
|
|
217
|
+
now?: () => Date;
|
|
218
|
+
}): ReportTemplateManager;
|
|
219
|
+
|
|
149
220
|
/** 存储无关的模板目录;后台 CRUD、权限、发布审批与持久化由宿主接入。 */
|
|
150
221
|
export declare function createTemplateRegistry(documents?: readonly ReportTemplateDocument[]): ReportTemplateRegistry;
|
|
151
222
|
|
|
152
223
|
export declare const CSS_DPI = 96;
|
|
153
224
|
|
|
225
|
+
export declare interface DatasetContract {
|
|
226
|
+
fields: readonly ReportFieldContract[];
|
|
227
|
+
rowKey?: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export declare interface DatasetIssue {
|
|
231
|
+
code: "schema" | "budget" | "row" | "required" | "type" | "enum" | "range" | "row-key";
|
|
232
|
+
path: string;
|
|
233
|
+
message: string;
|
|
234
|
+
rowIndex?: number;
|
|
235
|
+
field?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** 公开JSON Schema供Java DTO/表单/接口文档复用;decimal保持文本以免精度丢失。 */
|
|
239
|
+
export declare function datasetJsonSchema(contract: DatasetContract): Record<string, unknown>;
|
|
240
|
+
|
|
154
241
|
export declare type DatasetRows = Record<string, Record<string, unknown>[]>;
|
|
155
242
|
|
|
243
|
+
export declare interface DatasetValidationOptions {
|
|
244
|
+
path?: string;
|
|
245
|
+
maxRows?: number;
|
|
246
|
+
maxCells?: number;
|
|
247
|
+
maxIssues?: number;
|
|
248
|
+
}
|
|
249
|
+
|
|
156
250
|
/** 默认边框线宽(pt) */
|
|
157
251
|
export declare const DEFAULT_BORDER_PT = 0.75;
|
|
158
252
|
|
|
253
|
+
/** Browser preview, Canvas metrics and pagination use the same fallback font stack. */
|
|
254
|
+
export declare const DEFAULT_FONT_FAMILY = "\"Microsoft YaHei\", sans-serif";
|
|
255
|
+
|
|
159
256
|
/** 默认字号(pt) */
|
|
160
257
|
export declare const DEFAULT_FONT_PT = 10.5;
|
|
161
258
|
|
|
@@ -185,6 +282,9 @@ export declare function evalStyleRule(row: Record<string, unknown>, when: StyleR
|
|
|
185
282
|
/** 同步 text/raw value,所有输出后端读取同一份更新后的 RenderPlan。 */
|
|
186
283
|
export declare function formatReportCellEdit(context: ReportCellContext, value: ReportCellValue): string;
|
|
187
284
|
|
|
285
|
+
/** TSV with Excel-compatible quoting; quoted line breaks remain inside their cells. */
|
|
286
|
+
export declare function formatReportClipboard(rows: readonly (readonly string[])[]): string;
|
|
287
|
+
|
|
188
288
|
/**
|
|
189
289
|
* 应用格式化。非数值/无法解析时原样返回基础文本(降级不报错):
|
|
190
290
|
* - number:digits 小数位 + 可选千分位(12,345.60;thousands 默认 false)
|
|
@@ -195,7 +295,6 @@ export declare function formatValue(value: unknown, format?: ColumnFormat): stri
|
|
|
195
295
|
|
|
196
296
|
declare type Geometry = Partial<Pick<PlanComponent, "leftMm" | "topMm" | "widthMm" | "heightMm">>;
|
|
197
297
|
|
|
198
|
-
/** 缺失、被合并覆盖、显式 null 占位不生成编辑目标。 */
|
|
199
298
|
export declare function getReportCellContext(plan: RenderPlan, address: ReportCellAddress): ReportCellContext | null;
|
|
200
299
|
|
|
201
300
|
export declare interface GridCell {
|
|
@@ -209,6 +308,7 @@ export declare interface GridCell {
|
|
|
209
308
|
valueType?: "text" | "number" | "boolean";
|
|
210
309
|
/** 单元格级编辑控制;预览仍需显式开启 editing。 */
|
|
211
310
|
editable?: boolean;
|
|
311
|
+
source?: ReportCellSource;
|
|
212
312
|
/** Excel 公式保留元数据;当前引擎不计算公式,公式格始终只读。 */
|
|
213
313
|
formula?: string;
|
|
214
314
|
children?: PlanComponent[];
|
|
@@ -253,7 +353,9 @@ export declare interface GridLayout {
|
|
|
253
353
|
/** 启发式测量器:无 Canvas 时的默认宽度估算 */
|
|
254
354
|
export declare const heuristicMeasurer: TextMeasurer;
|
|
255
355
|
|
|
256
|
-
export declare
|
|
356
|
+
export declare type ImageComponentKind = "image" | "chart" | "barcode" | "qrcode";
|
|
357
|
+
|
|
358
|
+
export declare interface ImageRenderOptions extends AsyncCanvasRenderOptions {
|
|
257
359
|
/** 图片格式(默认 png;jpeg 体积更小但无透明) */
|
|
258
360
|
format?: "png" | "jpeg";
|
|
259
361
|
/** jpeg 质量 0-1(默认 0.92,仅 jpeg 生效) */
|
|
@@ -262,10 +364,15 @@ export declare interface ImageRenderOptions extends CanvasRenderOptions {
|
|
|
262
364
|
|
|
263
365
|
export declare interface ImageRenderResult {
|
|
264
366
|
blobs: Blob[];
|
|
367
|
+
diagnostics: OutputDiagnostic[];
|
|
265
368
|
}
|
|
266
369
|
|
|
370
|
+
export declare function inspectOutputCapabilities(plan: RenderPlan, format: OutputFormat): OutputDiagnostic[];
|
|
371
|
+
|
|
267
372
|
export declare function isImageBackedComponent(comp: PlanComponent): boolean;
|
|
268
373
|
|
|
374
|
+
export declare function isReportDate(value: string): boolean;
|
|
375
|
+
|
|
269
376
|
export declare function isRichText(comp: PlanComponent): boolean;
|
|
270
377
|
|
|
271
378
|
/** 默认行高倍数(基线距 = 字号 × 该系数) */
|
|
@@ -293,6 +400,8 @@ export declare interface ListColumn {
|
|
|
293
400
|
editable?: boolean;
|
|
294
401
|
/** 空值列或特殊数据类型可显式声明编辑输入类型。 */
|
|
295
402
|
valueType?: GridCell["valueType"];
|
|
403
|
+
/** 字段语义用于 auto 对齐;明确声明编号,避免把数字编号当成度量。 */
|
|
404
|
+
semanticRole?: "identifier" | "dimension" | "measure" | "date" | "text";
|
|
296
405
|
}
|
|
297
406
|
|
|
298
407
|
export declare interface ListComponent {
|
|
@@ -306,6 +415,10 @@ export declare interface ListComponent {
|
|
|
306
415
|
topMm: number;
|
|
307
416
|
widthMm: number;
|
|
308
417
|
dataset: string;
|
|
418
|
+
/** 数据集中稳定业务主键的字段名;省略时编辑仅有计划内坐标。 */
|
|
419
|
+
rowKey?: string;
|
|
420
|
+
revisionField?: string;
|
|
421
|
+
sourceTokenField?: string;
|
|
309
422
|
columns: ListColumn[];
|
|
310
423
|
fontSizePt?: number;
|
|
311
424
|
headerBold?: boolean;
|
|
@@ -318,6 +431,8 @@ export declare interface ListComponent {
|
|
|
318
431
|
/** 表头默认对齐,列配置可覆盖。 */
|
|
319
432
|
headerAlign?: ComponentStyle["align"];
|
|
320
433
|
headerStyle?: ComponentStyle;
|
|
434
|
+
/** 可选多行合并表头;列宽按列表物理列对齐,供 Excel 业务模板复用。 */
|
|
435
|
+
headerGrid?: PlanGrid;
|
|
321
436
|
border?: boolean;
|
|
322
437
|
/** 分组小计(组头/组尾小计/组头防孤行) */
|
|
323
438
|
groupBy?: ListGroupBy;
|
|
@@ -363,6 +478,46 @@ export declare function mmToPx(value: number, dpi?: number): number;
|
|
|
363
478
|
|
|
364
479
|
export declare function mmToPxFactor(dpi?: number): number;
|
|
365
480
|
|
|
481
|
+
export declare class OutputAssetError extends Error {
|
|
482
|
+
readonly diagnostic: OutputDiagnostic;
|
|
483
|
+
readonly cause: unknown;
|
|
484
|
+
constructor(diagnostic: OutputDiagnostic, cause?: unknown);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export declare interface OutputDiagnostic {
|
|
488
|
+
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";
|
|
489
|
+
severity: "warning";
|
|
490
|
+
format: OutputFormat;
|
|
491
|
+
pageIndex: number;
|
|
492
|
+
componentIndex: number;
|
|
493
|
+
/** Nested grid child location as repeating [rowIndex, columnIndex, childIndex] triples. */
|
|
494
|
+
componentPath?: readonly number[];
|
|
495
|
+
kind: string;
|
|
496
|
+
nid?: string;
|
|
497
|
+
message: string;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export declare interface OutputDiagnosticOptions extends OutputTaskOptions {
|
|
501
|
+
/** Structured fidelity diagnostics; rendering never silently invents missing content. */
|
|
502
|
+
onDiagnostic?: (diagnostic: OutputDiagnostic) => void;
|
|
503
|
+
/** Reject known unsupported content before creating an incomplete file. Default warn. */
|
|
504
|
+
fidelity?: "warn" | "strict";
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export declare class OutputFidelityError extends Error {
|
|
508
|
+
readonly diagnostics: readonly OutputDiagnostic[];
|
|
509
|
+
readonly code = "output-fidelity";
|
|
510
|
+
constructor(diagnostics: readonly OutputDiagnostic[]);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export declare type OutputFormat = "dom" | "canvas" | "pdf" | "xlsx";
|
|
514
|
+
|
|
515
|
+
/** Stage counts are exact completed units; encoding libraries may remain indeterminate. */
|
|
516
|
+
export declare interface OutputTaskOptions {
|
|
517
|
+
signal?: AbortSignal;
|
|
518
|
+
onProgress?: (completed: number, total: number) => void;
|
|
519
|
+
}
|
|
520
|
+
|
|
366
521
|
export declare class PageBuilder {
|
|
367
522
|
private readonly parent;
|
|
368
523
|
private readonly page;
|
|
@@ -408,6 +563,15 @@ export declare interface PaginateOptions {
|
|
|
408
563
|
mmPerRow?: number;
|
|
409
564
|
/** 文本测量器(默认启发式;浏览器端可注入 canvas 测量校准) */
|
|
410
565
|
measurer?: TextMeasurer;
|
|
566
|
+
/** 可选页数上限;在追加超限页前终止,避免先分配全部页面再检查。 */
|
|
567
|
+
maxPages?: number;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export declare class PaginatePageLimitError extends Error {
|
|
571
|
+
readonly limit: number;
|
|
572
|
+
readonly actual: number;
|
|
573
|
+
readonly code = "page-limit";
|
|
574
|
+
constructor(limit: number, actual: number);
|
|
411
575
|
}
|
|
412
576
|
|
|
413
577
|
export declare interface PaginateResult {
|
|
@@ -429,9 +593,15 @@ export declare type PaperName = keyof typeof PAPER_SIZES;
|
|
|
429
593
|
/** 日历日字符串 → 本地 Date(不含时间的纯日期,杜绝 UTC 偏移) */
|
|
430
594
|
export declare function parseDateLocal(input: string): Date | null;
|
|
431
595
|
|
|
596
|
+
/** Core type parsing is authoritative; field controls add restrictions, never coerce IDs or bypass readonly. */
|
|
597
|
+
export declare function parseReportCellFieldInput(context: ReportCellContext, input: ReportCellValue, field?: ReportCellFieldOptions): ReportCellValue;
|
|
598
|
+
|
|
432
599
|
/** 严格解析编辑输入;文本列不隐式推断数值,清空数值/布尔列得到 null。 */
|
|
433
600
|
export declare function parseReportCellInput(context: ReportCellContext, input: ReportCellValue): ReportCellValue;
|
|
434
601
|
|
|
602
|
+
/** Bounded parser for clipboard data; invalid quotes are rejected before edits are built. */
|
|
603
|
+
export declare function parseReportClipboard(text: string, maxCells?: number): string[][];
|
|
604
|
+
|
|
435
605
|
/** 校验文件 JSON 文本或接口返回的未知对象,返回独立模板快照。 */
|
|
436
606
|
export declare function parseReportTemplate(input: unknown): ReportTemplateDocument;
|
|
437
607
|
|
|
@@ -448,6 +618,8 @@ export declare interface PlanComponent {
|
|
|
448
618
|
lines?: string[];
|
|
449
619
|
richParagraphs?: RichParagraph[];
|
|
450
620
|
imageData?: string;
|
|
621
|
+
/** 明确指定线段方向;省略保持历史水平线行为。 */
|
|
622
|
+
lineDirection?: "down" | "up";
|
|
451
623
|
grid?: PlanGrid;
|
|
452
624
|
table?: PlanTableFragment;
|
|
453
625
|
style?: ComponentStyle;
|
|
@@ -495,6 +667,10 @@ export declare interface PlanTableFragment {
|
|
|
495
667
|
columnKeys: string[];
|
|
496
668
|
layout?: "page" | "wide";
|
|
497
669
|
title?: string;
|
|
670
|
+
/** 只有宿主声明稳定 rowKey 时生成,不能用显示顺序替代业务主键。 */
|
|
671
|
+
source?: Omit<ReportCellSource, "field" | "rowKey"> & {
|
|
672
|
+
rowKey?: string | number;
|
|
673
|
+
};
|
|
498
674
|
}
|
|
499
675
|
|
|
500
676
|
export declare function ptToPx(pt: number, dpi?: number): number;
|
|
@@ -505,7 +681,7 @@ export declare const RENDER_PLAN_SCHEMA_VERSION = "1.0.0-mach";
|
|
|
505
681
|
|
|
506
682
|
export declare function renderComponent(comp: PlanComponent, dpi: number, options: RenderOptions, doc: Document): HTMLElement;
|
|
507
683
|
|
|
508
|
-
export declare interface RenderOptions {
|
|
684
|
+
export declare interface RenderOptions extends OutputDiagnosticOptions {
|
|
509
685
|
dpi?: number;
|
|
510
686
|
classNames?: Partial<Record<ClassKey, string>>;
|
|
511
687
|
}
|
|
@@ -528,6 +704,9 @@ export declare function renderPlan(plan: RenderPlan, doc: Document, options?: Re
|
|
|
528
704
|
*/
|
|
529
705
|
export declare function renderPlanToCanvas(plan: RenderPlan, options?: CanvasRenderOptions): CanvasRenderResult;
|
|
530
706
|
|
|
707
|
+
/** Browser async raster output: waits for every image and preserves component paint order. */
|
|
708
|
+
export declare function renderPlanToCanvasAsync(plan: RenderPlan, options?: AsyncCanvasRenderOptions): Promise<CanvasRenderResult>;
|
|
709
|
+
|
|
531
710
|
/**
|
|
532
711
|
* RenderPlan → 每页一张图片 Blob(浏览器环境):
|
|
533
712
|
* 复用位图渲染管线(区间/dpr/字体/测量器均可配),再 toBlob 编码。
|
|
@@ -536,7 +715,7 @@ export declare function renderPlanToCanvas(plan: RenderPlan, options?: CanvasRen
|
|
|
536
715
|
export declare function renderPlanToImages(plan: RenderPlan, options?: ImageRenderOptions): Promise<ImageRenderResult>;
|
|
537
716
|
|
|
538
717
|
/** 模板存储文档版本;与渲染计划版本独立演进。 */
|
|
539
|
-
export declare const REPORT_TEMPLATE_DOCUMENT_VERSION
|
|
718
|
+
export declare const REPORT_TEMPLATE_DOCUMENT_VERSION = "1.0";
|
|
540
719
|
|
|
541
720
|
/** 预览中的物理坐标;合并单元格使用左上角坐标。 */
|
|
542
721
|
export declare interface ReportCellAddress {
|
|
@@ -546,6 +725,11 @@ export declare interface ReportCellAddress {
|
|
|
546
725
|
columnIndex: number;
|
|
547
726
|
}
|
|
548
727
|
|
|
728
|
+
export declare interface ReportCellChoice {
|
|
729
|
+
value: Exclude<ReportCellValue, null>;
|
|
730
|
+
label?: string;
|
|
731
|
+
}
|
|
732
|
+
|
|
549
733
|
export declare interface ReportCellContext {
|
|
550
734
|
address: ReportCellAddress;
|
|
551
735
|
cell: Readonly<GridCell>;
|
|
@@ -553,6 +737,8 @@ export declare interface ReportCellContext {
|
|
|
553
737
|
value: ReportCellValue;
|
|
554
738
|
valueType: ReportCellValueType;
|
|
555
739
|
table?: ReportCellTableIdentity;
|
|
740
|
+
/** Stable business identity. Physical row indices must never be used as database keys. */
|
|
741
|
+
source?: Readonly<ReportCellSource>;
|
|
556
742
|
editable: boolean;
|
|
557
743
|
readOnlyReason?: ReportCellReadOnlyReason;
|
|
558
744
|
}
|
|
@@ -560,6 +746,7 @@ export declare interface ReportCellContext {
|
|
|
560
746
|
export declare interface ReportCellEdit {
|
|
561
747
|
address: ReportCellAddress;
|
|
562
748
|
table?: ReportCellTableIdentity;
|
|
749
|
+
source?: Readonly<ReportCellSource>;
|
|
563
750
|
previousValue: ReportCellValue;
|
|
564
751
|
previousText: string;
|
|
565
752
|
value: ReportCellValue;
|
|
@@ -571,10 +758,65 @@ export declare class ReportCellEditError extends Error {
|
|
|
571
758
|
constructor(code: ReportCellEditErrorCode);
|
|
572
759
|
}
|
|
573
760
|
|
|
574
|
-
export declare type ReportCellEditErrorCode = "missing" | "readonly" | "number" | "boolean" | "conflict";
|
|
761
|
+
export declare type ReportCellEditErrorCode = "missing" | "readonly" | "number" | "boolean" | "conflict" | "duplicate" | "limit" | "atomic" | "clipboard";
|
|
762
|
+
|
|
763
|
+
export declare function reportCellEditKey(edit: Pick<ReportCellEdit, "address" | "source" | "table">): string;
|
|
764
|
+
|
|
765
|
+
declare interface ReportCellFieldBase {
|
|
766
|
+
/** Presentation only; it never grants write permission. */
|
|
767
|
+
label?: string;
|
|
768
|
+
hint?: string;
|
|
769
|
+
unit?: string;
|
|
770
|
+
required?: boolean;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
/** Shared structured validation for browser editors, pasted values and backend adapters. */
|
|
774
|
+
export declare class ReportCellFieldError extends Error {
|
|
775
|
+
readonly code: ReportCellFieldErrorCode;
|
|
776
|
+
readonly field: ReportCellFieldOptions;
|
|
777
|
+
readonly expected?: string | number | undefined;
|
|
778
|
+
constructor(code: ReportCellFieldErrorCode, field: ReportCellFieldOptions, expected?: string | number | undefined);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
export declare type ReportCellFieldErrorCode = "definition" | "type" | "required" | "min" | "max" | "precision" | "length" | "choice" | "date";
|
|
782
|
+
|
|
783
|
+
export declare type ReportCellFieldOptions = ReportCellFieldBase & ({
|
|
784
|
+
type: "text";
|
|
785
|
+
maxLength?: number;
|
|
786
|
+
} | {
|
|
787
|
+
type: "number";
|
|
788
|
+
min?: number;
|
|
789
|
+
max?: number;
|
|
790
|
+
precision?: number;
|
|
791
|
+
} | {
|
|
792
|
+
type: "boolean";
|
|
793
|
+
trueLabel?: string;
|
|
794
|
+
falseLabel?: string;
|
|
795
|
+
} | {
|
|
796
|
+
type: "enum";
|
|
797
|
+
options: readonly ReportCellChoice[];
|
|
798
|
+
} | {
|
|
799
|
+
type: "date";
|
|
800
|
+
min?: string;
|
|
801
|
+
max?: string;
|
|
802
|
+
});
|
|
803
|
+
|
|
804
|
+
export declare interface ReportCellInput {
|
|
805
|
+
address: ReportCellAddress;
|
|
806
|
+
value: ReportCellValue;
|
|
807
|
+
}
|
|
575
808
|
|
|
576
809
|
export declare type ReportCellReadOnlyReason = "cell" | "formula" | "complex" | "structure";
|
|
577
810
|
|
|
811
|
+
/** 可持久化的业务身份与计划坐标独立;权限及并发校验仍由业务服务器执行。 */
|
|
812
|
+
export declare interface ReportCellSource {
|
|
813
|
+
datasetId: string;
|
|
814
|
+
rowKey: string | number;
|
|
815
|
+
field: string;
|
|
816
|
+
revision?: string | number;
|
|
817
|
+
sourceToken?: string;
|
|
818
|
+
}
|
|
819
|
+
|
|
578
820
|
export declare interface ReportCellTableIdentity {
|
|
579
821
|
id: string;
|
|
580
822
|
/** 逻辑表行索引;跨分页的同一行保持不变。 */
|
|
@@ -593,6 +835,11 @@ export declare interface ReportDefinition {
|
|
|
593
835
|
/** 静态数据;load 存在时优先使用 load 的结果。 */
|
|
594
836
|
datasets?: DatasetRows;
|
|
595
837
|
load?: (context: ReportLoadContext) => DatasetRows | Promise<DatasetRows>;
|
|
838
|
+
/** 可选统一适配器;load 存在时仍优先 load,兼容已有定义。 */
|
|
839
|
+
provider?: ReportProvider;
|
|
840
|
+
/** 可选业务数据契约;声明的数据集缺失或字段不合法时,在分页前给出结构化错误。 */
|
|
841
|
+
dataSchema?: Record<string, DatasetContract>;
|
|
842
|
+
dataValidation?: Pick<DatasetValidationOptions, "maxRows" | "maxCells" | "maxIssues">;
|
|
596
843
|
/** 覆盖模板参数定义;动态模板应在此声明查询面板元数据,避免查询前先请求模板。 */
|
|
597
844
|
params?: ReportParamDef[];
|
|
598
845
|
pagination?: PaginateOptions;
|
|
@@ -603,18 +850,63 @@ export declare interface ReportDefinitionOptions<TData> extends Omit<ReportDefin
|
|
|
603
850
|
mapData: (data: TData, context: ReportLoadContext) => DatasetRows;
|
|
604
851
|
}
|
|
605
852
|
|
|
853
|
+
export declare interface ReportDiagnostic {
|
|
854
|
+
code: string;
|
|
855
|
+
message: string;
|
|
856
|
+
path?: string;
|
|
857
|
+
severity: "warning" | "error" | "info";
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
export declare interface ReportEditBatch {
|
|
861
|
+
/** Idempotency identity; the server should bind it to the exact payload. */
|
|
862
|
+
requestId: string;
|
|
863
|
+
edits: ReportCellEdit[];
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
export declare interface ReportEditConflict {
|
|
867
|
+
source?: Readonly<ReportCellSource>;
|
|
868
|
+
address?: ReportCellAddress;
|
|
869
|
+
message: string;
|
|
870
|
+
currentValue?: ReportCellValue;
|
|
871
|
+
revision?: string | number;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
export declare interface ReportEditResult {
|
|
875
|
+
/** A successful result may advance concurrency tokens for the affected dataset. */
|
|
876
|
+
revision?: string | number;
|
|
877
|
+
sourceToken?: string;
|
|
878
|
+
/** Any conflict rejects the entire client batch. A server must also transact atomically. */
|
|
879
|
+
conflicts?: readonly ReportEditConflict[];
|
|
880
|
+
}
|
|
881
|
+
|
|
606
882
|
/** 保持 Promise<RenderPlan> 契约;元数据为可选,旧业务 fetcher 无需改造。 */
|
|
607
883
|
export declare interface ReportFetcher {
|
|
608
884
|
(input: ReportFetchInput): Promise<RenderPlan>;
|
|
609
885
|
getParamDefs?: (reportIds: string[]) => ReportParamDef[];
|
|
610
886
|
}
|
|
611
887
|
|
|
612
|
-
export declare interface ReportFetchInput {
|
|
888
|
+
export declare interface ReportFetchInput extends ReportTaskMonitoring {
|
|
613
889
|
reportIds: string[];
|
|
614
890
|
params: Record<string, string>;
|
|
615
891
|
signal?: AbortSignal;
|
|
616
892
|
/** 本次分页与计划告警;未提供时使用数据源配置的告警通道。 */
|
|
617
893
|
onWarning?: (message: string) => void;
|
|
894
|
+
onQueryResult?: (reportId: string, result: ReportQueryResult) => void;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
export declare interface ReportFieldContract {
|
|
898
|
+
field: string;
|
|
899
|
+
label?: string;
|
|
900
|
+
type: "text" | "number" | "boolean" | "date" | "decimal";
|
|
901
|
+
required?: boolean;
|
|
902
|
+
nullable?: boolean;
|
|
903
|
+
enum?: readonly (string | number | boolean)[];
|
|
904
|
+
min?: number;
|
|
905
|
+
max?: number;
|
|
906
|
+
minLength?: number;
|
|
907
|
+
maxLength?: number;
|
|
908
|
+
semanticRole?: "identifier" | "dimension" | "measure" | "date" | "text";
|
|
909
|
+
unit?: string;
|
|
618
910
|
}
|
|
619
911
|
|
|
620
912
|
/** 取数与排版共同使用的请求上下文;取消只影响本次调用。 */
|
|
@@ -624,6 +916,8 @@ export declare interface ReportLoadContext {
|
|
|
624
916
|
signal?: AbortSignal;
|
|
625
917
|
}
|
|
626
918
|
|
|
919
|
+
export declare function reportOutputDiagnostics(plan: RenderPlan, format: OutputFormat, options: OutputDiagnosticOptions): OutputDiagnostic[];
|
|
920
|
+
|
|
627
921
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
628
922
|
export declare interface ReportParamDef {
|
|
629
923
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
@@ -639,10 +933,87 @@ export declare interface ReportParamDef {
|
|
|
639
933
|
defaultValue?: string;
|
|
640
934
|
required?: boolean;
|
|
641
935
|
placeholder?: string;
|
|
936
|
+
/** 数字上下界;date 参数使用 YYYY-MM-DD 字符串(含边界)。 */
|
|
937
|
+
min?: number | string;
|
|
938
|
+
max?: number | string;
|
|
939
|
+
minLength?: number;
|
|
940
|
+
maxLength?: number;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
export declare interface ReportParamIssue {
|
|
944
|
+
code: ReportParamIssueCode;
|
|
945
|
+
path: string;
|
|
946
|
+
field: string;
|
|
947
|
+
message: string;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
export declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
951
|
+
|
|
952
|
+
/** 描述 typedValues 的 Draft 2020-12 Schema;日期区间额外保留 x-report-* 扩展。 */
|
|
953
|
+
export declare function reportParamsJsonSchema(defs: readonly ReportParamDef[]): Record<string, unknown>;
|
|
954
|
+
|
|
955
|
+
export declare interface ReportParamValidation {
|
|
956
|
+
ok: boolean;
|
|
957
|
+
/** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
|
|
958
|
+
values: Record<string, string>;
|
|
959
|
+
/** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
|
|
960
|
+
typedValues: Record<string, string | number>;
|
|
961
|
+
issues: ReportParamIssue[];
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
export declare class ReportParamValidationError extends Error {
|
|
965
|
+
readonly issues: readonly ReportParamIssue[];
|
|
966
|
+
readonly code = "params";
|
|
967
|
+
constructor(issues: readonly ReportParamIssue[]);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/** 查询是唯一基础能力;权限、HTTP、数据库和事务都留在宿主适配器内。 */
|
|
971
|
+
export declare interface ReportProvider {
|
|
972
|
+
query(context: ReportLoadContext): ReportQueryResult | Promise<ReportQueryResult>;
|
|
973
|
+
save?(input: ReportSaveInput): ReportSaveResult | Promise<ReportSaveResult>;
|
|
974
|
+
export?(input: ReportProviderExportInput): ReportProviderExportResult | Promise<ReportProviderExportResult>;
|
|
975
|
+
templates?: ReportTemplateProvider;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
export declare interface ReportProviderExportInput extends ReportLoadContext {
|
|
979
|
+
format: "pdf" | "xlsx";
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
export declare interface ReportProviderExportResult {
|
|
983
|
+
bytes: Uint8Array;
|
|
984
|
+
contentType: string;
|
|
985
|
+
fileName?: string;
|
|
986
|
+
diagnostics?: ReportDiagnostic[];
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
export declare interface ReportQueryResult {
|
|
990
|
+
datasets: DatasetRows;
|
|
991
|
+
revision?: string;
|
|
992
|
+
sourceToken?: string;
|
|
993
|
+
diagnostics?: ReportDiagnostic[];
|
|
642
994
|
}
|
|
643
995
|
|
|
644
996
|
export declare type ReportRegistry = Record<string, ReportDefinition>;
|
|
645
997
|
|
|
998
|
+
export declare interface ReportSaveInput extends ReportLoadContext {
|
|
999
|
+
requestId: string;
|
|
1000
|
+
expectedRevision?: string;
|
|
1001
|
+
sourceToken?: string;
|
|
1002
|
+
edits: readonly ReportCellEdit[];
|
|
1003
|
+
action?: "edit" | "undo" | "redo" | "restore";
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
export declare interface ReportSaveResult {
|
|
1007
|
+
revision: string;
|
|
1008
|
+
sourceToken?: string;
|
|
1009
|
+
conflicts?: Array<{
|
|
1010
|
+
editIndex: number;
|
|
1011
|
+
code: string;
|
|
1012
|
+
message: string;
|
|
1013
|
+
}>;
|
|
1014
|
+
diagnostics?: ReportDiagnostic[];
|
|
1015
|
+
}
|
|
1016
|
+
|
|
646
1017
|
export declare interface ReportSource extends ReportFetcher {
|
|
647
1018
|
getParamDefs(reportIds: string[]): ReportParamDef[];
|
|
648
1019
|
}
|
|
@@ -653,6 +1024,25 @@ export declare class ReportSourceError extends Error {
|
|
|
653
1024
|
constructor(code: ReportSourceError["code"], message: string, cause?: unknown);
|
|
654
1025
|
}
|
|
655
1026
|
|
|
1027
|
+
/** 阶段事件只包含可序列化值;不表示估算百分比,也不包含业务数据。 */
|
|
1028
|
+
export declare interface ReportTaskEvent {
|
|
1029
|
+
taskId: string;
|
|
1030
|
+
correlationId?: string;
|
|
1031
|
+
stage: "query" | "validate" | "layout" | "encode";
|
|
1032
|
+
status: "started" | "completed" | "failed";
|
|
1033
|
+
reportId?: string;
|
|
1034
|
+
completed?: number;
|
|
1035
|
+
total?: number;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
export declare interface ReportTaskMonitoring {
|
|
1039
|
+
taskId?: string;
|
|
1040
|
+
correlationId?: string;
|
|
1041
|
+
onEvent?: ReportTaskObserver;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
export declare type ReportTaskObserver = (event: ReportTaskEvent) => void;
|
|
1045
|
+
|
|
656
1046
|
export declare interface ReportTemplate {
|
|
657
1047
|
schemaVersion?: string;
|
|
658
1048
|
/** 参数定义(可选;宿主也可经 ReportPreview 的 paramDefs prop 提供,prop 优先) */
|
|
@@ -662,7 +1052,7 @@ export declare interface ReportTemplate {
|
|
|
662
1052
|
|
|
663
1053
|
/** 可存入数据库/文件的纯 JSON 模板;数据、接口与鉴权仍由宿主提供。 */
|
|
664
1054
|
export declare interface ReportTemplateDocument {
|
|
665
|
-
schemaVersion:
|
|
1055
|
+
schemaVersion: "1.0";
|
|
666
1056
|
id: string;
|
|
667
1057
|
name: string;
|
|
668
1058
|
/** 宿主的发布版本/乐观锁标识,不由引擎自动递增。 */
|
|
@@ -678,6 +1068,35 @@ export declare class ReportTemplateError extends Error {
|
|
|
678
1068
|
|
|
679
1069
|
export declare type ReportTemplateLoader = (context: ReportLoadContext) => ReportTemplate | Promise<ReportTemplate>;
|
|
680
1070
|
|
|
1071
|
+
export declare interface ReportTemplateManager {
|
|
1072
|
+
list(signal?: AbortSignal): ReturnType<ReportTemplateStore["list"]>;
|
|
1073
|
+
get(id: string, options?: {
|
|
1074
|
+
draft?: boolean;
|
|
1075
|
+
signal?: AbortSignal;
|
|
1076
|
+
}): Promise<ReportTemplateDocument | undefined>;
|
|
1077
|
+
history(id: string, signal?: AbortSignal): Promise<readonly ReportTemplateVersion[]>;
|
|
1078
|
+
saveDraft(input: unknown, options: TemplateMutationOptions): Promise<ReportTemplateRecord>;
|
|
1079
|
+
publish(id: string, options: TemplateMutationOptions): Promise<ReportTemplateRecord>;
|
|
1080
|
+
rollback(id: string, revision: string, options: TemplateMutationOptions): Promise<ReportTemplateRecord>;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
export declare interface ReportTemplateProvider {
|
|
1084
|
+
list(context: {
|
|
1085
|
+
signal?: AbortSignal;
|
|
1086
|
+
}): Promise<ReportTemplateSummary[]>;
|
|
1087
|
+
get(id: string, context: {
|
|
1088
|
+
signal?: AbortSignal;
|
|
1089
|
+
}): Promise<ReportTemplateDocument | undefined>;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
export declare interface ReportTemplateRecord {
|
|
1093
|
+
id: string;
|
|
1094
|
+
revision: string;
|
|
1095
|
+
draft?: ReportTemplateDocument;
|
|
1096
|
+
publishedRevision?: string;
|
|
1097
|
+
published?: ReportTemplateDocument;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
681
1100
|
export declare interface ReportTemplateRegistry {
|
|
682
1101
|
/** 返回独立快照,调用方编辑不会改变目录中的已注册模板。 */
|
|
683
1102
|
get(id: string): ReportTemplateDocument | undefined;
|
|
@@ -689,8 +1108,34 @@ export declare interface ReportTemplateRegistry {
|
|
|
689
1108
|
remove(id: string): boolean;
|
|
690
1109
|
}
|
|
691
1110
|
|
|
1111
|
+
/** compareAndSwap 必须由宿主数据库/文件适配器保证原子性,不能用先读再无条件写替代。 */
|
|
1112
|
+
export declare interface ReportTemplateStore {
|
|
1113
|
+
read(id: string, signal?: AbortSignal): Promise<ReportTemplateRecord | undefined>;
|
|
1114
|
+
list(signal?: AbortSignal): Promise<Array<{
|
|
1115
|
+
id: string;
|
|
1116
|
+
revision: string;
|
|
1117
|
+
publishedRevision?: string;
|
|
1118
|
+
}>>;
|
|
1119
|
+
history(id: string, signal?: AbortSignal): Promise<ReportTemplateVersion[]>;
|
|
1120
|
+
getVersion(id: string, revision: string, signal?: AbortSignal): Promise<ReportTemplateVersion | undefined>;
|
|
1121
|
+
/** 状态更新和 publication 的不可变追加必须处于同一原子事务;草稿写入不读取历史。 */
|
|
1122
|
+
compareAndSwap(id: string, expectedRevision: string | null, next: ReportTemplateRecord, options: TemplateStoreWriteOptions): Promise<boolean>;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
export declare class ReportTemplateStoreError extends Error {
|
|
1126
|
+
readonly code: "conflict" | "missing" | "draft" | "history";
|
|
1127
|
+
constructor(code: "conflict" | "missing" | "draft" | "history", message: string);
|
|
1128
|
+
}
|
|
1129
|
+
|
|
692
1130
|
export declare type ReportTemplateSummary = Omit<ReportTemplateDocument, "template">;
|
|
693
1131
|
|
|
1132
|
+
export declare interface ReportTemplateVersion {
|
|
1133
|
+
revision: string;
|
|
1134
|
+
publishedAt: string;
|
|
1135
|
+
document: ReportTemplateDocument;
|
|
1136
|
+
restoredFrom?: string;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
694
1139
|
/**
|
|
695
1140
|
* 边框开关解析:
|
|
696
1141
|
* - 未声明(undefined)→ 四边全开(与既有 rect 总有边框的行为兼容)
|
|
@@ -731,6 +1176,19 @@ export declare function resolvePaper(paper: PaperName | {
|
|
|
731
1176
|
heightMm: number;
|
|
732
1177
|
};
|
|
733
1178
|
|
|
1179
|
+
/** Resolve optional third-party chart/barcode/QR adapters once, before any output backend. Input stays immutable. */
|
|
1180
|
+
export declare function resolvePlanAssets(plan: RenderPlan, options?: ResolvePlanAssetsOptions): Promise<{
|
|
1181
|
+
plan: RenderPlan;
|
|
1182
|
+
diagnostics: OutputDiagnostic[];
|
|
1183
|
+
}>;
|
|
1184
|
+
|
|
1185
|
+
export declare interface ResolvePlanAssetsOptions extends AssetRenderOptions {
|
|
1186
|
+
/** Only labels diagnostics; no output library is imported. Default dom. */
|
|
1187
|
+
format?: OutputFormat;
|
|
1188
|
+
start?: number;
|
|
1189
|
+
end?: number;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
734
1192
|
/** 描边解析:颜色 + 线宽(pt) */
|
|
735
1193
|
export declare function resolveStroke(style: Pick<ComponentStyle, "borderColor" | "lineColor" | "lineWidthPt"> | undefined, fallbackColor?: string): {
|
|
736
1194
|
color: string;
|
|
@@ -775,6 +1233,9 @@ export declare interface StyleRule {
|
|
|
775
1233
|
style: Record<string, unknown>;
|
|
776
1234
|
}
|
|
777
1235
|
|
|
1236
|
+
/** Ordered, net changes for review; a change restored to its original value disappears. */
|
|
1237
|
+
export declare function summarizeReportCellEdits(edits: readonly ReportCellEdit[]): ReportCellEdit[];
|
|
1238
|
+
|
|
778
1239
|
/** 明细列:显式 widthMm 优先;纸张模式按 flex 分余量,宽表模式按 flex 放大基准列宽。 */
|
|
779
1240
|
export declare type TableTemplateColumn = Omit<ListColumn, "widthMm"> & {
|
|
780
1241
|
widthMm?: number;
|
|
@@ -842,6 +1303,11 @@ export declare class TemplateBuilder {
|
|
|
842
1303
|
|
|
843
1304
|
export declare type TemplateComponent = PlanComponent | ListComponent;
|
|
844
1305
|
|
|
1306
|
+
export declare interface TemplateMutationOptions {
|
|
1307
|
+
expectedRevision: string | null;
|
|
1308
|
+
signal?: AbortSignal;
|
|
1309
|
+
}
|
|
1310
|
+
|
|
845
1311
|
export declare interface TemplatePage {
|
|
846
1312
|
widthMm: number;
|
|
847
1313
|
heightMm: number;
|
|
@@ -854,6 +1320,11 @@ export declare interface TemplatePage {
|
|
|
854
1320
|
components: TemplateComponent[];
|
|
855
1321
|
}
|
|
856
1322
|
|
|
1323
|
+
export declare interface TemplateStoreWriteOptions {
|
|
1324
|
+
publication?: ReportTemplateVersion;
|
|
1325
|
+
signal?: AbortSignal;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
857
1328
|
/**
|
|
858
1329
|
* 文本测量与折行(分页/Canvas/PDF 共用的唯一折行真相源)。
|
|
859
1330
|
*
|
|
@@ -863,7 +1334,9 @@ export declare interface TemplatePage {
|
|
|
863
1334
|
*/
|
|
864
1335
|
export declare interface TextMeasureOptions {
|
|
865
1336
|
fontSizePt: number;
|
|
1337
|
+
fontFamily?: string;
|
|
866
1338
|
bold?: boolean;
|
|
1339
|
+
italic?: boolean;
|
|
867
1340
|
letterSpacingPt?: number;
|
|
868
1341
|
}
|
|
869
1342
|
|
|
@@ -879,10 +1352,25 @@ export declare function toNumber(value: unknown): number | null;
|
|
|
879
1352
|
|
|
880
1353
|
export declare function validateComponent(comp: unknown, path: string, errors: ValidationError[], warnings?: ValidationError[]): void;
|
|
881
1354
|
|
|
1355
|
+
/** 浏览器/Node共用的只读值校验;返回精确路径,不以0或空数组掩盖接口结构错误。 */
|
|
1356
|
+
export declare function validateDatasetRows(input: unknown, contract: DatasetContract, options?: DatasetValidationOptions): {
|
|
1357
|
+
ok: boolean;
|
|
1358
|
+
issues: DatasetIssue[];
|
|
1359
|
+
};
|
|
1360
|
+
|
|
882
1361
|
export declare function validatePage(page: unknown, path: string, errors: ValidationError[], warnings?: ValidationError[]): void;
|
|
883
1362
|
|
|
884
1363
|
export declare function validateRenderPlan(input: unknown): ValidationResult;
|
|
885
1364
|
|
|
1365
|
+
/** Check configuration before opening an input, including JSON/JavaScript callers. */
|
|
1366
|
+
export declare function validateReportCellFieldDefinition(context: ReportCellContext, field: ReportCellFieldOptions): void;
|
|
1367
|
+
|
|
1368
|
+
/** 模板参数配置错误也统一返回结构化问题,不让无效默认值或边界静默进入后端。 */
|
|
1369
|
+
export declare function validateReportParamDefinitions(defs: readonly ReportParamDef[]): ReportParamIssue[];
|
|
1370
|
+
|
|
1371
|
+
/** 在浏览器或服务端执行相同默认值、必填、类型、枚举及范围规则。 */
|
|
1372
|
+
export declare function validateReportParams(defs: readonly ReportParamDef[], input?: Record<string, unknown>): ReportParamValidation;
|
|
1373
|
+
|
|
886
1374
|
/** 对入库/导入模板做声明式校验,不执行分页或数据请求。 */
|
|
887
1375
|
export declare function validateReportTemplate(input: unknown): ValidationResult;
|
|
888
1376
|
|