@agile-team/mach-report 2.17.0 → 2.18.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 +18 -9
- package/dist/{ExcelBindingWizard-Bq6FYME6.cjs → ExcelBindingWizard-Czn3C2yE.cjs} +1 -1
- package/dist/{ExcelBindingWizard-Co1svTsw.js → ExcelBindingWizard-DMGZj6I6.js} +3 -3
- package/dist/ParamEditor-KzDQvbHY.js +732 -0
- package/dist/ParamEditor-oDfD8LgE.cjs +1 -0
- package/dist/{ReportBatchPanel-uQh06usx.js → ReportBatchPanel-BJK7PvZ4.js} +39 -39
- package/dist/ReportBatchPanel-DnmNRssu.cjs +1 -0
- package/dist/ReportParamPanel-mQkeN70Q.js +1020 -0
- package/dist/ReportParamPanel-sOANVRz-.cjs +1 -0
- package/dist/ReportPreview-BxWWTUL5.js +5583 -0
- package/dist/ReportPreview-Yf99omi3.cjs +6 -0
- package/dist/{ReportTemplateLibrary-TIL_Oj2l.js → ReportTemplateLibrary-BFjB08Wu.js} +1 -1
- package/dist/{ReportTemplateLibrary-CnP7_1pH.cjs → ReportTemplateLibrary-BO42QnWd.cjs} +1 -1
- package/dist/RuleEditor-CqxT1a-W.js +2337 -0
- package/dist/RuleEditor-D7YWigD9.cjs +1 -0
- package/dist/{TemplateOutlinePanel-BlLxRrfu.cjs → TemplateOutlinePanel-B0XX350V.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-BouxsuqQ.js → TemplateOutlinePanel-zG0DrsIB.js} +2 -2
- package/dist/{TemplateReusePanel-yxsHSO40.cjs → TemplateReusePanel-BD0HSKp_.cjs} +1 -1
- package/dist/{TemplateReusePanel-BEACLPaN.js → TemplateReusePanel-Czwe5GbC.js} +2 -2
- package/dist/{TemplateReviewPanel-D9Cx0m2N.cjs → TemplateReviewPanel-CA5sdffM.cjs} +1 -1
- package/dist/{TemplateReviewPanel-B1OGRY2i.js → TemplateReviewPanel-NhmQI65C.js} +2 -2
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +100 -41
- package/dist/analytics.d.ts +100 -41
- package/dist/analytics.js +76 -141
- package/dist/artifact-integrity.json +108 -102
- package/dist/assets-2eC3mOcV.js +232 -0
- package/dist/assets-B0Hxn4l6.cjs +1 -0
- package/dist/{auto-DDHflI9v.cjs → auto-B0EZFIK1.cjs} +1 -1
- package/dist/{auto-BIOmtVhk.js → auto-BlchZ1b8.js} +19 -19
- package/dist/{batch-WzDIXJAt.js → batch-DGCt44XM.js} +1 -1
- package/dist/{batch-z6Aw5GEY.cjs → batch-DYcokH4v.cjs} +1 -1
- package/dist/charts-Dlv8j2AG.js +141 -0
- package/dist/charts-aCtoswXq.cjs +1 -0
- package/dist/codes.cjs +9 -9
- package/dist/codes.d.cts +54 -0
- package/dist/codes.d.ts +54 -0
- package/dist/codes.js +12097 -13668
- package/dist/column-visual-BpgQVWwT.js +238 -0
- package/dist/column-visual-CtYxnBCP.cjs +1 -0
- package/dist/component-tree-6TV7W6Yj.cjs +1 -0
- package/dist/component-tree-CvW4lzpv.js +67 -0
- package/dist/computed-4TnxzgIh.cjs +1 -0
- package/dist/computed-C8NRZQss.js +739 -0
- package/dist/data-bar-Ce38juRZ.cjs +1 -0
- package/dist/data-bar-PtjXhMgN.js +9 -0
- package/dist/designer--TKECSEc.cjs +2 -0
- package/dist/designer-d6hJS41w.js +5683 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +710 -42
- package/dist/designer.d.ts +710 -42
- package/dist/designer.js +23 -20
- package/dist/{encoding-BFMFIc4r.cjs → encoding-B--eZpp1.cjs} +1 -1
- package/dist/{encoding-DP_Eaf0A.js → encoding-mctOLocI.js} +2 -2
- package/dist/{font-loader-7FWVlykp.cjs → font-loader-DBBJ5KE9.cjs} +1 -1
- package/dist/{font-loader-CQZowp0I.js → font-loader-DW8tIaNp.js} +1 -1
- package/dist/index-CPh6tqge.js +1575 -0
- package/dist/index-CUNw7dL9.cjs +1 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +361 -15
- package/dist/index.d.ts +361 -15
- package/dist/index.js +876 -835
- package/dist/json-snapshot-By4ZVVUt.js +1967 -0
- package/dist/json-snapshot-jiXff4lc.cjs +2 -0
- package/dist/matrix-0hywp0-F.cjs +1 -0
- package/dist/matrix-Dy-tyY7E.js +381 -0
- package/dist/param-validation-C-8sRJLq.cjs +1 -0
- package/dist/param-validation-CnDEd2l-.js +333 -0
- package/dist/{pdf-l3ea86di.js → pdf-CKROKygt.js} +1851 -1849
- package/dist/{pdf-B8JouyYv.cjs → pdf-DqyxJ96U.cjs} +46 -46
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.d.cts +54 -0
- package/dist/pdf.d.ts +54 -0
- package/dist/pdf.js +2 -2
- package/dist/{plugin-BBp74CQZ.js → plugin-ByjF2kiV.js} +5 -5
- package/dist/{plugin-CtFX9PFG.cjs → plugin-DM1M2wlI.cjs} +1 -1
- package/dist/prefill-B8H9qwE4.js +371 -0
- package/dist/prefill-D7EswyTI.cjs +1 -0
- package/dist/{prepared-CARicKYh.js → prepared-BE-4jfX5.js} +2 -2
- package/dist/{prepared-Ch1x_Gog.cjs → prepared-CGVphji3.cjs} +1 -1
- package/dist/{protocol-B5A2uom4.cjs → protocol-ByRVzzQG.cjs} +1 -1
- package/dist/{protocol-BaiWjq5w.js → protocol-Cr81vFSQ.js} +3 -3
- package/dist/{record-bindings-D4TuMzHs.js → record-bindings-DEJtmo3p.js} +67 -107
- package/dist/record-bindings-ehjnCDHt.cjs +1 -0
- package/dist/{region-binding-workflow-BNasF5kz.js → region-binding-workflow-CBg0l_tj.js} +1 -1
- package/dist/{region-binding-workflow-O2Cni3mF.cjs → region-binding-workflow-D05tOYn3.cjs} +1 -1
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/{report-params-B1RzkhJj.js → report-params-D9tBuM9B.js} +1 -1
- package/dist/{report-params-WDGrA4oP.cjs → report-params-VTg8MoCp.cjs} +1 -1
- package/dist/runtime-CDA6d263.cjs +1 -0
- package/dist/runtime-CEMvybO7.js +170 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server/node.d.cts +75 -7
- package/dist/server/node.d.ts +75 -7
- package/dist/server-node.cjs +4 -4
- package/dist/server-node.js +2692 -1990
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +243 -28
- package/dist/server.d.ts +243 -28
- package/dist/server.js +28 -28
- package/dist/sha256-BDQ1Qk7A.js +158 -0
- package/dist/sha256-DgZAKXqI.cjs +1 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-Cg5oBLFT.cjs +1 -0
- package/dist/template-bindings-TKnXM7ll.js +62 -0
- package/dist/{template-catalog-wT1fNeAP.js → template-catalog-CmbWOJqy.js} +16 -16
- package/dist/{template-catalog-Dua8h9ZA.cjs → template-catalog-Utu4GP09.cjs} +1 -1
- package/dist/{template-fragments-BajTajb4.cjs → template-fragments-C_zSHJAa.cjs} +1 -1
- package/dist/{template-fragments-DmX5XK4N.js → template-fragments-DWgo9tlZ.js} +2 -2
- package/dist/{template-outline-BwRV_eRo.cjs → template-outline-DWkzZXVC.cjs} +1 -1
- package/dist/{template-outline-cnWfT_LK.js → template-outline-DiADphlq.js} +1 -1
- package/dist/{template-registry-u11fPd8D.js → template-registry-BIhIHOab.js} +319 -314
- package/dist/template-registry-DzWswQI5.cjs +1 -0
- package/dist/vue/async.d.cts +528 -33
- package/dist/vue/async.d.ts +528 -33
- package/dist/vue/index.d.cts +616 -64
- package/dist/vue/index.d.ts +616 -64
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +94 -89
- package/dist/{workbook-session-DN5LSA5C.cjs → workbook-session-B94EwVa_.cjs} +1 -1
- package/dist/{workbook-session-B8pNW24X.js → workbook-session-BoScoOg-.js} +2 -2
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +75 -7
- package/dist/worker.d.ts +75 -7
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +4 -4
- package/dist/xlsx.d.cts +120 -13
- package/dist/xlsx.d.ts +120 -13
- package/dist/xlsx.js +313 -279
- package/package.json +1 -1
- package/dist/ParamEditor-B5UZRgxv.cjs +0 -1
- package/dist/ParamEditor-DNNARyeB.js +0 -594
- package/dist/ReportBatchPanel-Ctvs2t_9.cjs +0 -1
- package/dist/ReportPreview-BdQawRh0.js +0 -4879
- package/dist/ReportPreview-CJC_-j2I.cjs +0 -6
- package/dist/RuleEditor-DkRjOLlr.js +0 -2141
- package/dist/RuleEditor-h5anGsDB.cjs +0 -1
- package/dist/assets-BIMVwjQe.js +0 -231
- package/dist/assets-Dfs2ElxI.cjs +0 -1
- package/dist/component-tree-Ca6YYfHq.js +0 -61
- package/dist/component-tree-DkGLEfZC.cjs +0 -1
- package/dist/computed-BW5a8QFk.js +0 -612
- package/dist/computed-C2GD3XcE.cjs +0 -1
- package/dist/config-Dg_o8e7m.cjs +0 -1
- package/dist/config-XQ4qrQ7Q.js +0 -844
- package/dist/designer-D9XAxqSc.js +0 -5178
- package/dist/designer-uCDo5XSK.cjs +0 -2
- package/dist/drill-ByN8COs_.cjs +0 -1
- package/dist/drill-CKW3Xtfa.js +0 -145
- package/dist/json-snapshot-D7PE1NsU.cjs +0 -2
- package/dist/json-snapshot-DYmEe3sO.js +0 -1779
- package/dist/matrix-JLAXlux-.js +0 -302
- package/dist/matrix-gTHpDTGm.cjs +0 -1
- package/dist/param-validation-C3HlcLLO.cjs +0 -1
- package/dist/param-validation-Do7Eg8Zv.js +0 -181
- package/dist/record-bindings-B86Sur_y.cjs +0 -1
- package/dist/runtime-DakRXui3.js +0 -170
- package/dist/runtime-dL5ygIfa.cjs +0 -1
- package/dist/sha256-BshdOkCC.cjs +0 -1
- package/dist/sha256-DTG-Gq8i.js +0 -157
- package/dist/template-bindings-C2SpvsMU.js +0 -58
- package/dist/template-bindings-CEtWyiLX.cjs +0 -1
- package/dist/template-registry-CpysHAxy.cjs +0 -1
- package/dist/tree-CLpxYbKa.cjs +0 -1
- package/dist/tree-DNJorJUf.js +0 -172
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as ve, w as Ke, o as He, f as er } from "./progress-Hc2vxoCs.js";
|
|
2
2
|
import { c as Kt, g as gr } from "./_commonjsHelpers-DaMA6jEr.js";
|
|
3
|
-
import { R as yr } from "./component-tree-
|
|
4
|
-
import { o as Ze, s as cr, r as vr, t as Ge, u as wr, w as _r, x as xr, y as Sr, q as kr } from "./region-binding-workflow-
|
|
3
|
+
import { R as yr } from "./component-tree-CvW4lzpv.js";
|
|
4
|
+
import { o as Ze, s as cr, r as vr, t as Ge, u as wr, w as _r, x as xr, y as Sr, q as kr } from "./region-binding-workflow-CBg0l_tj.js";
|
|
5
5
|
import { c as Cr } from "./media-Y90dHK9z.js";
|
|
6
6
|
import { f as Er } from "./number-format-BA_KwrZe.js";
|
|
7
7
|
function $e(G) {
|
package/dist/worker.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./protocol-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./protocol-ByRVzzQG.cjs"),s=require("./auto-B0EZFIK1.cjs"),R=require("./encoding-B--eZpp1.cjs");function p(n,e=globalThis){const a=t=>{r.isReportWorkerRequest(t.data)&&r.runReportWorkerRequest(n,t.data,o=>e.postMessage({protocol:r.REPORT_WORKER_PROTOCOL,id:t.data.id,type:"event",event:o})).then(o=>e.postMessage(o,r.reportWorkerTransferList(o)))};return e.addEventListener("message",a),()=>e.removeEventListener("message",a)}exports.ReportWorkerError=r.ReportWorkerError;exports.ReportWorkerStartError=s.ReportWorkerStartError;exports.createAutoReportExporter=s.createAutoReportExporter;exports.createBrowserReportExecutor=s.createBrowserReportExecutor;exports.serveReportEncodingWorker=R.serveReportEncodingWorker;exports.serveReportWorker=p;
|
package/dist/worker.d.cts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
2
|
+
|
|
3
|
+
declare interface AggregateRequest {
|
|
4
|
+
op: AggregateOperation;
|
|
5
|
+
field?: string;
|
|
6
|
+
weightField?: string;
|
|
7
|
+
numeric?: "number" | "decimal";
|
|
8
|
+
digits?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
export declare interface BrowserReportWorker {
|
|
2
12
|
postMessage(value: unknown, transfer?: Transferable[]): void;
|
|
3
13
|
terminate(): void;
|
|
@@ -84,6 +94,12 @@ export declare function createAutoReportExporter(options?: ReportExportExecution
|
|
|
84
94
|
export declare function createBrowserReportExecutor(factory: () => BrowserReportWorker, options?: ReportWorkerOptions): ReportRuntimeExecutor;
|
|
85
95
|
|
|
86
96
|
declare interface GridCell {
|
|
97
|
+
/** Resolved visual only. Original value, text, editability and source are unchanged. */
|
|
98
|
+
dataBar?: {
|
|
99
|
+
start: number;
|
|
100
|
+
end: number;
|
|
101
|
+
color: string;
|
|
102
|
+
};
|
|
87
103
|
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
88
104
|
richParagraphs?: RichParagraph[];
|
|
89
105
|
text?: string;
|
|
@@ -123,6 +139,8 @@ declare interface ImageMediaOptions {
|
|
|
123
139
|
}
|
|
124
140
|
|
|
125
141
|
declare interface PlanComponent {
|
|
142
|
+
/** Template-only aggregate binding, expanded into shared primitives during layout. */
|
|
143
|
+
chartBinding?: ReportChartBinding;
|
|
126
144
|
/** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
|
|
127
145
|
code?: CodeOptions;
|
|
128
146
|
/** Template-only binding; resolved and removed before constructing the output plan. */
|
|
@@ -236,6 +254,42 @@ declare interface ReportCellSource {
|
|
|
236
254
|
sourceToken?: string;
|
|
237
255
|
}
|
|
238
256
|
|
|
257
|
+
/** Serializable binding; data and authorization continue to come from the existing report source. */
|
|
258
|
+
declare interface ReportChartBinding {
|
|
259
|
+
dataset: string;
|
|
260
|
+
categoryField: string;
|
|
261
|
+
measures: readonly ReportChartMeasure[];
|
|
262
|
+
type: ReportChartOptions["type"];
|
|
263
|
+
sort?: "asc" | "desc";
|
|
264
|
+
title?: string;
|
|
265
|
+
showValues?: boolean;
|
|
266
|
+
maxRows?: number;
|
|
267
|
+
maxCategories?: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
declare interface ReportChartMeasure extends AggregateRequest {
|
|
271
|
+
label?: string;
|
|
272
|
+
color?: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
declare interface ReportChartOptions {
|
|
276
|
+
type: "bar" | "line" | "stackedBar" | "percentBar";
|
|
277
|
+
categories: readonly string[];
|
|
278
|
+
series: readonly ReportChartSeries[];
|
|
279
|
+
leftMm: number;
|
|
280
|
+
topMm: number;
|
|
281
|
+
widthMm: number;
|
|
282
|
+
heightMm: number;
|
|
283
|
+
title?: string;
|
|
284
|
+
showValues?: boolean;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare interface ReportChartSeries {
|
|
288
|
+
name: string;
|
|
289
|
+
values: readonly (number | null)[];
|
|
290
|
+
color?: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
239
293
|
declare interface ReportDataTarget {
|
|
240
294
|
datasetId: string;
|
|
241
295
|
field: string;
|
|
@@ -303,18 +357,17 @@ export declare interface ReportExportThresholds {
|
|
|
303
357
|
|
|
304
358
|
export declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
|
|
305
359
|
|
|
360
|
+
declare type ReportNumberRange = readonly [number, number];
|
|
361
|
+
|
|
306
362
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
307
363
|
declare interface ReportParamDef {
|
|
308
364
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
309
365
|
field: string;
|
|
310
366
|
/** 显示名(缺省用 field) */
|
|
311
367
|
label?: string;
|
|
312
|
-
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
368
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select" | "multiSelect" | "cascader" | "numberRange";
|
|
313
369
|
/** select 选项 */
|
|
314
|
-
options?:
|
|
315
|
-
label: string;
|
|
316
|
-
value: string;
|
|
317
|
-
}>;
|
|
370
|
+
options?: ReportParamTreeOption[];
|
|
318
371
|
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
319
372
|
optionsSource?: string;
|
|
320
373
|
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
@@ -327,6 +380,9 @@ declare interface ReportParamDef {
|
|
|
327
380
|
max?: number | string;
|
|
328
381
|
minLength?: number;
|
|
329
382
|
maxLength?: number;
|
|
383
|
+
/** multiSelect item count (maximum 100). Cascader paths are bounded to 16 levels. */
|
|
384
|
+
minItems?: number;
|
|
385
|
+
maxItems?: number;
|
|
330
386
|
}
|
|
331
387
|
|
|
332
388
|
declare interface ReportParamIssue {
|
|
@@ -336,14 +392,23 @@ declare interface ReportParamIssue {
|
|
|
336
392
|
message: string;
|
|
337
393
|
}
|
|
338
394
|
|
|
339
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
395
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength" | "minItems" | "maxItems";
|
|
396
|
+
|
|
397
|
+
/** Cascader values are unique within each sibling list. */
|
|
398
|
+
declare interface ReportParamTreeOption {
|
|
399
|
+
label: string;
|
|
400
|
+
value: string;
|
|
401
|
+
children?: ReportParamTreeOption[];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
declare type ReportParamTypedValue = string | number | string[] | ReportNumberRange;
|
|
340
405
|
|
|
341
406
|
declare interface ReportParamValidation {
|
|
342
407
|
ok: boolean;
|
|
343
408
|
/** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
|
|
344
409
|
values: Record<string, string>;
|
|
345
410
|
/** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
|
|
346
|
-
typedValues: Record<string,
|
|
411
|
+
typedValues: Record<string, ReportParamTypedValue>;
|
|
347
412
|
issues: ReportParamIssue[];
|
|
348
413
|
}
|
|
349
414
|
|
|
@@ -371,6 +436,8 @@ declare interface ReportRuntimeBudget {
|
|
|
371
436
|
maxRows?: number;
|
|
372
437
|
maxPages?: number;
|
|
373
438
|
maxCells?: number;
|
|
439
|
+
/** Aggregate bound-chart primitives per prepare, before expansion; default 50000, hard maximum 1000000. */
|
|
440
|
+
maxChartComponents?: number;
|
|
374
441
|
maxOutputBytes?: number;
|
|
375
442
|
/** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
|
|
376
443
|
maxPreparedBytes?: number;
|
|
@@ -393,6 +460,7 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
393
460
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
394
461
|
valueMode?: "text" | "raw";
|
|
395
462
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
463
|
+
maxDataBars?: number;
|
|
396
464
|
sheetName?: (sheetIndex: number) => string;
|
|
397
465
|
};
|
|
398
466
|
}
|
package/dist/worker.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
declare type AggregateOperation = "sum" | "count" | "avg" | "min" | "max" | "weightedAvg";
|
|
2
|
+
|
|
3
|
+
declare interface AggregateRequest {
|
|
4
|
+
op: AggregateOperation;
|
|
5
|
+
field?: string;
|
|
6
|
+
weightField?: string;
|
|
7
|
+
numeric?: "number" | "decimal";
|
|
8
|
+
digits?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
export declare interface BrowserReportWorker {
|
|
2
12
|
postMessage(value: unknown, transfer?: Transferable[]): void;
|
|
3
13
|
terminate(): void;
|
|
@@ -84,6 +94,12 @@ export declare function createAutoReportExporter(options?: ReportExportExecution
|
|
|
84
94
|
export declare function createBrowserReportExecutor(factory: () => BrowserReportWorker, options?: ReportWorkerOptions): ReportRuntimeExecutor;
|
|
85
95
|
|
|
86
96
|
declare interface GridCell {
|
|
97
|
+
/** Resolved visual only. Original value, text, editability and source are unchanged. */
|
|
98
|
+
dataBar?: {
|
|
99
|
+
start: number;
|
|
100
|
+
end: number;
|
|
101
|
+
color: string;
|
|
102
|
+
};
|
|
87
103
|
/** Styled cell content; text remains a plain-text fallback. Imported rich cells are read-only. */
|
|
88
104
|
richParagraphs?: RichParagraph[];
|
|
89
105
|
text?: string;
|
|
@@ -123,6 +139,8 @@ declare interface ImageMediaOptions {
|
|
|
123
139
|
}
|
|
124
140
|
|
|
125
141
|
declare interface PlanComponent {
|
|
142
|
+
/** Template-only aggregate binding, expanded into shared primitives during layout. */
|
|
143
|
+
chartBinding?: ReportChartBinding;
|
|
126
144
|
/** Optional QR/barcode encoding configuration; no encoder is loaded by the core. */
|
|
127
145
|
code?: CodeOptions;
|
|
128
146
|
/** Template-only binding; resolved and removed before constructing the output plan. */
|
|
@@ -236,6 +254,42 @@ declare interface ReportCellSource {
|
|
|
236
254
|
sourceToken?: string;
|
|
237
255
|
}
|
|
238
256
|
|
|
257
|
+
/** Serializable binding; data and authorization continue to come from the existing report source. */
|
|
258
|
+
declare interface ReportChartBinding {
|
|
259
|
+
dataset: string;
|
|
260
|
+
categoryField: string;
|
|
261
|
+
measures: readonly ReportChartMeasure[];
|
|
262
|
+
type: ReportChartOptions["type"];
|
|
263
|
+
sort?: "asc" | "desc";
|
|
264
|
+
title?: string;
|
|
265
|
+
showValues?: boolean;
|
|
266
|
+
maxRows?: number;
|
|
267
|
+
maxCategories?: number;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
declare interface ReportChartMeasure extends AggregateRequest {
|
|
271
|
+
label?: string;
|
|
272
|
+
color?: string;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
declare interface ReportChartOptions {
|
|
276
|
+
type: "bar" | "line" | "stackedBar" | "percentBar";
|
|
277
|
+
categories: readonly string[];
|
|
278
|
+
series: readonly ReportChartSeries[];
|
|
279
|
+
leftMm: number;
|
|
280
|
+
topMm: number;
|
|
281
|
+
widthMm: number;
|
|
282
|
+
heightMm: number;
|
|
283
|
+
title?: string;
|
|
284
|
+
showValues?: boolean;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
declare interface ReportChartSeries {
|
|
288
|
+
name: string;
|
|
289
|
+
values: readonly (number | null)[];
|
|
290
|
+
color?: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
239
293
|
declare interface ReportDataTarget {
|
|
240
294
|
datasetId: string;
|
|
241
295
|
field: string;
|
|
@@ -303,18 +357,17 @@ export declare interface ReportExportThresholds {
|
|
|
303
357
|
|
|
304
358
|
export declare type ReportLocalExport = (input: ReportRuntimePreparedExportInput) => Promise<ReportRuntimeExportResult>;
|
|
305
359
|
|
|
360
|
+
declare type ReportNumberRange = readonly [number, number];
|
|
361
|
+
|
|
306
362
|
/** 报表参数定义(声明式,模板自描述参数面:渲染组件据此生成查询面板) */
|
|
307
363
|
declare interface ReportParamDef {
|
|
308
364
|
/** 参数名(传入 params,与数据集 SQL #{field} 绑定对应) */
|
|
309
365
|
field: string;
|
|
310
366
|
/** 显示名(缺省用 field) */
|
|
311
367
|
label?: string;
|
|
312
|
-
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select";
|
|
368
|
+
type?: "text" | "number" | "date" | "month" | "year" | "dateRange" | "select" | "multiSelect" | "cascader" | "numberRange";
|
|
313
369
|
/** select 选项 */
|
|
314
|
-
options?:
|
|
315
|
-
label: string;
|
|
316
|
-
value: string;
|
|
317
|
-
}>;
|
|
370
|
+
options?: ReportParamTreeOption[];
|
|
318
371
|
/** Opaque host-resolved source key. No URL, credentials or executable code is stored. */
|
|
319
372
|
optionsSource?: string;
|
|
320
373
|
/** Select dependencies must be declared parameters; changing a parent clears descendants. */
|
|
@@ -327,6 +380,9 @@ declare interface ReportParamDef {
|
|
|
327
380
|
max?: number | string;
|
|
328
381
|
minLength?: number;
|
|
329
382
|
maxLength?: number;
|
|
383
|
+
/** multiSelect item count (maximum 100). Cascader paths are bounded to 16 levels. */
|
|
384
|
+
minItems?: number;
|
|
385
|
+
maxItems?: number;
|
|
330
386
|
}
|
|
331
387
|
|
|
332
388
|
declare interface ReportParamIssue {
|
|
@@ -336,14 +392,23 @@ declare interface ReportParamIssue {
|
|
|
336
392
|
message: string;
|
|
337
393
|
}
|
|
338
394
|
|
|
339
|
-
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength";
|
|
395
|
+
declare type ReportParamIssueCode = "definition" | "required" | "type" | "option" | "dependency" | "minimum" | "maximum" | "minLength" | "maxLength" | "minItems" | "maxItems";
|
|
396
|
+
|
|
397
|
+
/** Cascader values are unique within each sibling list. */
|
|
398
|
+
declare interface ReportParamTreeOption {
|
|
399
|
+
label: string;
|
|
400
|
+
value: string;
|
|
401
|
+
children?: ReportParamTreeOption[];
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
declare type ReportParamTypedValue = string | number | string[] | ReportNumberRange;
|
|
340
405
|
|
|
341
406
|
declare interface ReportParamValidation {
|
|
342
407
|
ok: boolean;
|
|
343
408
|
/** 保留历史取数契约的字符串形式;未知参数保留,不能代替接口权限白名单。 */
|
|
344
409
|
values: Record<string, string>;
|
|
345
410
|
/** JSON Schema 对应的规范值:number 参数转换为有限数字。 */
|
|
346
|
-
typedValues: Record<string,
|
|
411
|
+
typedValues: Record<string, ReportParamTypedValue>;
|
|
347
412
|
issues: ReportParamIssue[];
|
|
348
413
|
}
|
|
349
414
|
|
|
@@ -371,6 +436,8 @@ declare interface ReportRuntimeBudget {
|
|
|
371
436
|
maxRows?: number;
|
|
372
437
|
maxPages?: number;
|
|
373
438
|
maxCells?: number;
|
|
439
|
+
/** Aggregate bound-chart primitives per prepare, before expansion; default 50000, hard maximum 1000000. */
|
|
440
|
+
maxChartComponents?: number;
|
|
374
441
|
maxOutputBytes?: number;
|
|
375
442
|
/** Bound the plain JSON snapshot accepted by exportPrepared (default 64 MB). */
|
|
376
443
|
maxPreparedBytes?: number;
|
|
@@ -393,6 +460,7 @@ declare interface ReportRuntimeExportInput extends ReportRuntimeInput {
|
|
|
393
460
|
sheetMode?: "auto" | "pages" | "continuous";
|
|
394
461
|
valueMode?: "text" | "raw";
|
|
395
462
|
paperSize?: "auto" | "a3" | "a4" | "a5";
|
|
463
|
+
maxDataBars?: number;
|
|
396
464
|
sheetName?: (sheetIndex: number) => string;
|
|
397
465
|
};
|
|
398
466
|
}
|
package/dist/worker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { i as a, r as R, R as p, a as n } from "./protocol-
|
|
2
|
-
import { b as W } from "./protocol-
|
|
3
|
-
import { R as g, c as k, a as u } from "./auto-
|
|
4
|
-
import { s as x } from "./encoding-
|
|
1
|
+
import { i as a, r as R, R as p, a as n } from "./protocol-Cr81vFSQ.js";
|
|
2
|
+
import { b as W } from "./protocol-Cr81vFSQ.js";
|
|
3
|
+
import { R as g, c as k, a as u } from "./auto-BlchZ1b8.js";
|
|
4
|
+
import { s as x } from "./encoding-mctOLocI.js";
|
|
5
5
|
function d(s, r = globalThis) {
|
|
6
6
|
const t = (o) => {
|
|
7
7
|
a(o.data) && R(s, o.data, (e) => r.postMessage({ protocol: p, id: o.data.id, type: "event", event: e })).then((e) => r.postMessage(e, n(e)));
|
package/dist/xlsx.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
`}]:[],...o.segments.map(r=>{const
|
|
3
|
-
`)??s.text??""}]}];for(const a of l)r.push({...a,segments:a.segments.map(c=>({...c,style:w.mergeComponentStyles(i,c.style)}))})}return B(r,n)}function G(e,t,o){let n=o*72/25.4;if(!Number.isFinite(n)||t+Math.ceil(n/409)-1>1048576)throw new Error("Excel 图片占位超过工作表行数上限");for(;n>0;){if(t>1048576)throw new Error("Excel 图片占位超过工作表行数上限");const r=Math.min(409,n);e.getRow(t++).height=r,n-=r}return t}function j(e,t,o){let n=Math.round(t*36e3),r=0;if(!Number.isSafeInteger(n))throw new Error("Excel 图片锚点超出安全坐标范围");for(e.properties.defaultColWidth??=8.43;r<16384;){const s=e.getColumn(r+1).width??e.properties.defaultColWidth,i=Math.round(p.excelColumnWidthToMm(s)*36e3);if(!Number.isSafeInteger(i)||i<=0)throw new Error("Excel 图片锚点所在列宽无效");if(n<i)return{col:r+n/i,row:o-1,nativeCol:r,nativeColOff:n,nativeRow:o-1,nativeRowOff:0};n-=i,r++}throw new Error("Excel 图片锚点超过16384列上限")}function D(e,t,o){let n=o*72/25.4;if(!Number.isFinite(n)||Math.abs(n)>1048576*409)throw new Error("Excel 图片纵向偏移超过工作表范围");const r=s=>{const i=e.getRow(s).height??e.properties.defaultRowHeight??15;if(!Number.isFinite(i)||i<=0)throw new Error("Excel 图片锚点所在行高无效");return i};for(;n<0&&t>1;)n+=r(--t);for(;t<=1048576&&n>=r(t);)n-=r(t++);if(t>1048576||n<0)throw new Error("Excel 图片移动到工作表边界之外");return{nativeRow:t-1,nativeRowOff:Math.round(n*25.4/72*36e3)}}function H(e,t,o){const n=N.createImageMediaInspector(t),r=new Map;return{write(s,i,l,a){if(![i.widthMm,i.heightMm,i.leftMm].every(Number.isFinite)||i.widthMm<0||i.heightMm<0||i.leftMm<0)throw new Error("Excel 图片尺寸无效");if(!i.widthMm||!i.heightMm)return l;if(!i.imageData||!/^data:image\/(png|jpe?g);base64,/i.test(i.imageData))return o.push(`${i.nid??i.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`),l;const c=n(i.imageData);let d=r.get(c.dataUrl);d===void 0&&(d=e.addImage({base64:c.dataUrl,extension:c.extension}),r.set(c.dataUrl,d));const g=a?l:G(s,l,i.heightMm);return s.addImage(d,{tl:{...j(s,a?.leftMm??i.leftMm,l),...a?D(s,l,a.offsetMm):{}},ext:{width:i.widthMm*96/25.4,height:i.heightMm*96/25.4},editAs:"oneCell"}),g}}}function F(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function W(e,t){const o=e.meta?.xlsxFlow;if(o===void 0)return;if(!F(o)||o.version!=="1.0"||!Number.isSafeInteger(o.columnStart)||Number(o.columnStart)<0)throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");if(!e.grid)throw new Error("Excel 多区域输出只接受显式网格组件");const n=o,r=e.grid.colWidthsMm;if(!r?.length||n.columnStart+r.length>t.length||r.some((s,i)=>Math.abs(s-t[n.columnStart+i])>.001))throw new Error("Excel 多区域列位置与网格列宽不一致");return n}function P(e){const t=e.meta?.xlsxFlow;if(t===void 0){if(e.components.some(n=>n.meta?.xlsxFlow!==void 0))throw new Error("Excel 多区域页面缺少完整列几何标记");return}const o=_(t,e.meta?.reportScope);for(const n of e.components){const r=W(n,o.widths);if(!r)throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");const s=o.widths.slice(0,r.columnStart).reduce((l,a)=>l+a,e.marginLeftMm??0),i=n.grid.colWidthsMm.reduce((l,a)=>l+a,0);if(Math.abs(s-n.leftMm)>.01||Math.abs(i-n.widthMm)>.01)throw new Error("Excel 多区域标记与真实横向位置不一致")}return o}function _(e,t){if(!F(e)||e.version!=="1.0"||typeof e.sheet!="string"||!e.sheet.trim()||typeof e.templateId!="string"||!e.templateId.trim())throw new Error("Excel 多区域工作表标识无效");if(!Array.isArray(e.fullWidthsMm)||!e.fullWidthsMm.length||e.fullWidthsMm.length>16384||e.fullWidthsMm.some(o=>typeof o!="number"||!Number.isFinite(o)||o<=0||o>2e3))throw new Error("Excel 多区域完整列宽无效");if(t!==void 0&&(typeof t!="string"||!t.trim()))throw new Error("Excel 多区域报表命名空间无效");return{key:JSON.stringify([t??e.templateId,e.sheet]),sheet:e.sheet,widths:e.fullWidthsMm}}function v(e){return Math.round(e*1e6)/1e6}function q(e,t,o,n,r){return e.components.filter(s=>n?s.pageAnchor==="header"?t===0:s.pageAnchor==="footer"?t===o-1:s.table?.role!=="header"?!0:r.has(s.table.id)?!1:(r.add(s.table.id),!0):!0)}function U(e,t,o,n){const r=e.components.filter(i=>!t.includes(i)&&i.table?.role==="header"),s=t.filter(i=>!i.pageAnchor).reduce((i,l)=>Math.max(i,l.topMm+l.heightMm),e.marginTopMm??0);return t.map(i=>{let l=i.topMm;return o&&i.pageAnchor==="footer"&&(l=s),l-=r.filter(a=>a.topMm+a.heightMm<=l+.001).reduce((a,c)=>a+c.heightMm,0),{component:i,layout:A.resolveGridLayout(i.grid,i.widthMm,i.heightMm),top:l,column:W(i,n).columnStart}})}function X(e,t,o){const n=t.length-1;if(n*o.length>1e6)throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");const r=new Map(t.map((l,a)=>[l,a])),s=new Map,i=new Map;for(const l of e)for(const a of l.layout.cells){if(!Object.keys(a.cell).length)continue;const c=r.get(v(l.top+a.yMm)),d=r.get(v(l.top+a.yMm+a.heightMm)),g=l.column+a.ci,u=g+(a.cell.colSpan??1),h=`${c}:${g}`;for(let f=c;f<d;f++)for(let E=g;E<u;E++){const b=`${f}:${E}`;if(i.has(b))throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");i.set(b,h)}s.set(h,{...a.cell,style:w.mergeComponentStyles(l.component.style,a.cell.style),rowSpan:d-c,colSpan:u-g})}return Array.from({length:n},(l,a)=>{const c=[];for(let d=0;d<o.length;d++){const g=`${a}:${d}`,u=s.get(g);u?(c.push(u),d+=(u.colSpan??1)-1):i.has(g)||c.push(null)}return c})}function K(e,t){const o=new Set,n=[];let r;for(const[s,{page:i}]of e.entries()){const l=P(i);if(r&&(l.key!==r.key||l.widths.length!==r.widths.length||l.widths.some((h,f)=>Math.abs(h-r.widths[f])>.001)))throw new Error("Excel 多区域分页的工作表或列结构不一致");r??=l;const a=q(i,s,e.length,t,o),c=U(i,a,t,l.widths);if(!c.length)continue;const d=[...new Set(c.flatMap(h=>[...h.layout.rows.map(f=>v(h.top+f.pos)),v(h.top+h.component.heightMm)]))].sort((h,f)=>h-f),g=X(c,d,l.widths),u=d.slice(1).map((h,f)=>h-d[f]);n.push({kind:"rect",leftMm:0,topMm:0,widthMm:l.widths.reduce((h,f)=>h+f,0),heightMm:u.reduce((h,f)=>h+f,0),grid:{cells:g,colWidthsMm:l.widths,rowHeightsMm:u}})}return n}const $=72/25.4,J=32767,V=253;function M(e,t){if(typeof e!="string")return;if(e.length>J)throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);let o=0;for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10&&++o>V)throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`)}function y(e){if(!e)return;const t=e.replace("#","");return/^[0-9a-fA-F]{6}$/.test(t)?`FF${t.toUpperCase()}`:void 0}function I(e,t={}){e.font={name:t.fontFamily,bold:t.bold===!0,italic:t.italic===!0,underline:t.underline===!0,size:w.resolveFontSize(t).fontSizePt,color:y(t.color)?{argb:y(t.color)}:void 0}}const S={a3:{width:297,height:420,code:8},a4:{width:210,height:297,code:9},a5:{width:148,height:210,code:11}};function Q(e,t,o,n){if(t&&t!=="auto")return S[t].code;const r=Math.min(e.pageWidthMm,e.pageHeightMm),s=Math.max(e.pageWidthMm,e.pageHeightMm),i=Object.values(S).find(l=>Math.abs(r-l.width)<=1&&Math.abs(s-l.height)<=1);return i?i.code:(n.push(`page ${o+1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`),S.a4.code)}function Y(e,t,o,n){const r=typeof t.text=="string"?t.text:"";if(o!=="raw"||!Object.prototype.hasOwnProperty.call(t,"value")){M(r,e.address),e.value=r;return}const s=t.value;if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s)){M(s,e.address),e.value=s,t.numberFormat&&(e.numFmt=t.numberFormat);return}M(r,e.address),e.value=r,n.push(`原始单元格值无效,已保留显示文本:${e.address}`)}function Z(e){const t=P(e);return t?{id:`xlsx-flow:${t.key}`,title:t.sheet,wide:!0,flow:!0}:ee(e)}function ee(e){const o=e.components.filter(n=>n.table!==void 0)[0]?.table;if(!(!o||typeof o.id!="string"||!o.id.trim()||!Array.isArray(o.columnKeys)||!o.columnKeys.length)){for(const n of e.components){if(n.table){if(!n.grid||n.table.id!==o.id)return;continue}if(n.grid||n.kind!=="text"&&!C.isImageBackedComponent(n))return}return{id:o.id,title:o.title,wide:o.layout==="wide"||e.layout==="wide"}}}function te(e,t){const o=new Set;for(const[n,r]of e.pages.entries())if(!t[n])for(const s of r.components)typeof s.table?.id=="string"&&o.add(s.table.id);return o}function k(e){return e.layout==="wide"||e.components.some(t=>t.table?.layout==="wide")}function ne(e,t,o){const n=[],r=e.pages.map(Z),s=te(e,r);for(const[i,l]of e.pages.entries()){const a=r[i],c=a&&!s.has(a.id),d=t==="pages"||!c?void 0:a;if(t==="continuous"&&!d)throw new Error(`page ${i+1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);const g=d!==void 0&&(t==="continuous"||d.wide);!g&&t!=="pages"&&k(l)&&o.push(`page ${i+1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);const u=n[n.length-1];g&&u?.continuous&&u.tableId===d.id?u.pages.push({page:l,index:i}):n.push({pages:[{page:l,index:i}],continuous:g,...g?{tableId:d.id,title:d.title}:{},...a?.flow?{flow:!0,title:a.title}:{}})}return n}function T(e,t,o){return!e||e.length===t.length&&e.every((n,r)=>o(n,t[r]))}function ie(e,t,o,n){const r=e.table,s=t.columns.map(a=>a.size),i=T(n.keys,r.columnKeys,(a,c)=>a===c),l=T(n.widths,s,(a,c)=>Math.abs(a-c)<=.001);if(r.columnKeys.length!==s.length||!i||!l)throw new Error(`page ${o+1}: 连续 Excel 逻辑表 ${r.id} 的列结构或列宽不一致`);if(n.keys??=r.columnKeys,n.widths??=s,r.role==="header"){if(r.rowIndex!==-1)throw new Error(`page ${o+1}: 连续 Excel 表头 rowIndex 必须为 -1`);n.headerSeen=!0}else{if(!["body","group-header","subtotal","grand-total"].includes(r.role)||r.rowIndex!==n.expectedRow)throw new Error(`page ${o+1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${n.expectedRow})`);n.expectedRow+=t.rows.length}}function re(e,t){const o={expectedRow:0,headerSeen:!1};for(const{page:n,index:r}of e.pages)for(const s of n.components){const i=t.get(s);s.table&&i&&ie(s,i,r,o)}if(!o.headerSeen)throw new Error("连续 Excel 逻辑表缺少明确表头来源")}function oe(e,t,o){let n=(e?.replace(/[\\/*?:[\]]/g," ").replace(/\s+/g," ").trim()||`Sheet${t+1}`).slice(0,31).replace(/^'+|'+$/g,"").trim()||`Sheet${t+1}`;n.toLowerCase()==="history"&&(n+=" 报表");let r=n,s=1;for(;o.has(r.toLowerCase());){const i=` (${++s})`;r=n.slice(0,31-i.length)+i}return o.add(r.toLowerCase()),r}function se(e){const t=new Set;function o(n,r,s,i){return n<=r?n:(t.has(s)||(e.push(i),t.add(s)),r)}return{column:n=>o(n,255,"column","Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),row:n=>o(n,409,"row","Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")}}async function le(e,t){const o=e.flow?K(e.pages,e.continuous).map(i=>({comp:i,pageIndex:e.pages[0].index})):e.pages.flatMap(({page:i,index:l},a)=>i.components.filter(c=>!e.continuous||(c.pageAnchor!=="header"||a===0)&&(c.pageAnchor!=="footer"||a===e.pages.length-1)).map(c=>({comp:c,pageIndex:l}))),n=new Map;let r=1,s=0;for(const{comp:i}of o)if(i.grid){const l=A.resolveGridLayout(i.grid,i.widthMm,i.heightMm);n.set(i,l),r=Math.max(r,l.columns.length);const a=t(l.cells.length);a&&await a}else i.kind==="text"&&(s=Math.max(s,i.widthMm));if(r>16384)throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");return{components:o,grids:n,columnCount:r,textWidthMm:s}}function ae(e,t,o){const{page:n,index:r}=e.pages[0],s=t!==void 0&&t!=="auto";return(e.continuous||k(n))&&!s?{}:{pageSetup:{paperSize:Q(n,t,r,o),orientation:n.pageWidthMm>n.pageHeightMm?"landscape":"portrait",fitToPage:!0,...e.continuous?{fitToWidth:1,fitToHeight:0}:{}}}}function ce(e){const t=y(e.borderColor??e.lineColor),o={style:"thin",...t?{color:{argb:t}}:{}};return{...e.borderTop!==!1?{top:o}:{},...e.borderLeft!==!1?{left:o}:{},...e.borderBottom!==!1?{bottom:o}:{},...e.borderRight!==!1?{right:o}:{}}}function de(e,t){e.alignment={horizontal:t.align??"left",vertical:t.verticalAlign??"middle",wrapText:!0};const o=y(t.backgroundColor);o&&(e.fill={type:"pattern",pattern:"solid",fgColor:{argb:o}}),e.border=ce(t),I(e,t)}function he(e,t){for(const[o,n]of t.columns.entries()){const r=e.sheet.getColumn(o+1),s=e.limits.column(p.mmToExcelColumnWidth(n.size));(r.width==null||r.width<s)&&(r.width=s)}}function ge(e,t,o){for(const[n,r]of t.rows.entries()){const s=e.sheet.getRow(o+n),i=e.limits.row(r.size*$);(s.height==null||s.height<i)&&(s.height=i)}}function fe(e,t,o,n){const r=Math.max(1,Math.min(t.cell.colSpan??1,o.columns.length-t.ci)),s=Math.max(1,Math.min(t.cell.rowSpan??1,o.rows.length-t.ri));(r>1||s>1)&&e.mergeCells(n+t.ri,t.ci+1,n+t.ri+s-1,t.ci+r)}async function ue(e,t,o,n){if(n+o.rows.length-1>1048576)throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");ge(e,o,n);for(const r of o.cells){const s=e.sheet.getCell(n+r.ri,r.ci+1);Y(s,r.cell,e.valueMode,e.warnings);const i=L(r.cell,t.style);i&&(M(i.richText.map(c=>c.text).join(""),s.address),s.value=i);const l=t.grid?.paddingMm??.5;for(const c of r.cell.children??[])C.isImageBackedComponent(c)&&!c.grid&&e.images.write(e.sheet,c,n+r.ri,{leftMm:r.xMm+l+(r.cell.indentMm??0)+c.leftMm,offsetMm:l+c.topMm});de(s,w.mergeComponentStyles(t.style,r.cell.style)),r.cell.indentMm&&(s.alignment={...s.alignment,indent:Math.min(250,Math.max(1,Math.round(r.cell.indentMm/2.5)))}),fe(e.sheet,r,o,n);const a=e.schedule();a&&await a}return n+o.rows.length}function me(e,t,o,n){const r=Array.isArray(t.lines)&&t.lines.length>0?t.lines.join(`
|
|
4
|
-
`):t.text??"",
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./progress-B0ctFpKf.cjs"),L=require("./index-CUNw7dL9.cjs"),G=require("./data-bar-Ce38juRZ.cjs"),x=require("./style-C22Pbv3T.cjs"),p=require("./workbook-session-B94EwVa_.cjs"),C=require("./component-tree-6TV7W6Yj.cjs"),j=require("./media-B7vnpD8k.cjs"),T=require("./grid-geometry-CZ_cYB6O.cjs"),R=require("./assets-B0Hxn4l6.cjs"),m=require("./region-binding-workflow-D05tOYn3.cjs");function q(e){const t=L.encodePng({width:1,height:1,channels:4,depth:8,data:new Uint8Array([1,3,5].map(o=>parseInt(e.slice(o,o+2),16)).concat(89))});return`data:image/png;base64,${btoa(String.fromCharCode(...t))}`}function H(e,t,o){const n=new Map;let r=0;return(a,i,s,l)=>{const c=G.dataBarBox(i.cell.dataBar,i.widthMm,i.heightMm,l);if(!c)return;if(++r>t)throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);let d=n.get(c.color);d||(d=q(c.color),n.set(c.color,d)),r===1&&o.push("数据条为静态半透明视觉快照,保留原始单元格值;Excel 编辑不会重算条形,绘图叠加文字的混色与预览可能略有差异。"),e.write(a,{kind:"image",leftMm:0,topMm:0,widthMm:c.width,heightMm:c.height,imageData:d},s,{leftMm:i.xMm+c.x,offsetMm:c.y})}}async function _(e,t,o){const n=e.pages.flatMap(i=>i.components),r=M.createOutputScheduler(o);let a=0;for(;n.length;){const i=n.pop();for(const s of i.grid?.cells??[])for(const l of s){if(l?.dataBar&&l.dataBar.end>l.dataBar.start&&++a>t)throw new Error(`Excel 数据条超过 ${t} 个绘图预算,请缩小范围或调整 maxDataBars`);l?.children&&n.push(...l.children);const c=r();c&&await c}}}function W(e,t){return{richText:e.flatMap((o,n)=>[...n?[{text:`
|
|
2
|
+
`}]:[],...o.segments.map(r=>{const a=x.mergeComponentStyles(t,r.style),i=a.color?.replace(/^#/,"");return{text:r.kind==="field"?r.field??"":r.text??"",font:{name:a.fontFamily,bold:a.bold,italic:a.italic,underline:a.underline,size:x.resolveFontSize(a).fontSizePt,.../^[a-f\d]{6}$/i.test(i??"")?{color:{argb:`FF${i.toUpperCase()}`}}:{}}}})])}}function U(e,t){const o=e.children?.filter(a=>a.kind==="text"&&!a.grid)??[];if(!e.richParagraphs?.length&&!o.length)return;const n=x.mergeComponentStyles(t,e.style),r=e.richParagraphs?.length?[...e.richParagraphs]:e.text?[{segments:[{text:e.text}]}]:[];for(const a of o){const i=x.mergeComponentStyles(n,a.style),s=a.richParagraphs?.length?a.richParagraphs:[{segments:[{text:a.lines?.join(`
|
|
3
|
+
`)??a.text??""}]}];for(const l of s)r.push({...l,segments:l.segments.map(c=>({...c,style:x.mergeComponentStyles(i,c.style)}))})}return W(r,n)}function X(e,t,o){let n=o*72/25.4;if(!Number.isFinite(n)||t+Math.ceil(n/409)-1>1048576)throw new Error("Excel 图片占位超过工作表行数上限");for(;n>0;){if(t>1048576)throw new Error("Excel 图片占位超过工作表行数上限");const r=Math.min(409,n);e.getRow(t++).height=r,n-=r}return t}function K(e,t,o){let n=Math.round(t*36e3),r=0;if(!Number.isSafeInteger(n))throw new Error("Excel 图片锚点超出安全坐标范围");for(e.properties.defaultColWidth??=8.43;r<16384;){const a=e.getColumn(r+1).width??e.properties.defaultColWidth,i=Math.round(p.excelColumnWidthToMm(a)*36e3);if(!Number.isSafeInteger(i)||i<=0)throw new Error("Excel 图片锚点所在列宽无效");if(n<i)return{col:r+n/i,row:o-1,nativeCol:r,nativeColOff:n,nativeRow:o-1,nativeRowOff:0};n-=i,r++}throw new Error("Excel 图片锚点超过16384列上限")}function J(e,t,o){let n=o*72/25.4;if(!Number.isFinite(n)||Math.abs(n)>1048576*409)throw new Error("Excel 图片纵向偏移超过工作表范围");const r=a=>{const i=e.getRow(a).height??e.properties.defaultRowHeight??15;if(!Number.isFinite(i)||i<=0)throw new Error("Excel 图片锚点所在行高无效");return i};for(;n<0&&t>1;)n+=r(--t);for(;t<=1048576&&n>=r(t);)n-=r(t++);if(t>1048576||n<0)throw new Error("Excel 图片移动到工作表边界之外");return{nativeRow:t-1,nativeRowOff:Math.round(n*25.4/72*36e3)}}function V(e,t,o){const n=j.createImageMediaInspector(t),r=new Map;return{write(a,i,s,l){if(![i.widthMm,i.heightMm,i.leftMm].every(Number.isFinite)||i.widthMm<0||i.heightMm<0||i.leftMm<0)throw new Error("Excel 图片尺寸无效");if(!i.widthMm||!i.heightMm)return s;if(!i.imageData||!/^data:image\/(png|jpe?g);base64,/i.test(i.imageData))return o.push(`${i.nid??i.kind}: Excel 图片仅支持 PNG/JPEG data URI,已跳过`),s;const c=n(i.imageData);let d=r.get(c.dataUrl);d===void 0&&(d=e.addImage({base64:c.dataUrl,extension:c.extension}),r.set(c.dataUrl,d));const h=l?s:X(a,s,i.heightMm);return a.addImage(d,{tl:{...K(a,l?.leftMm??i.leftMm,s),...l?J(a,s,l.offsetMm):{}},ext:{width:i.widthMm*96/25.4,height:i.heightMm*96/25.4},editAs:"oneCell"}),h}}}function F(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function $(e,t){const o=e.meta?.xlsxFlow;if(o===void 0)return;if(!F(o)||o.version!=="1.0"||!Number.isSafeInteger(o.columnStart)||Number(o.columnStart)<0)throw new Error("Excel 多区域几何标记无效,不能按列序猜测输出");if(!e.grid)throw new Error("Excel 多区域输出只接受显式网格组件");const n=o,r=e.grid.colWidthsMm;if(!r?.length||n.columnStart+r.length>t.length||r.some((a,i)=>Math.abs(a-t[n.columnStart+i])>.001))throw new Error("Excel 多区域列位置与网格列宽不一致");return n}function P(e){const t=e.meta?.xlsxFlow;if(t===void 0){if(e.components.some(n=>n.meta?.xlsxFlow!==void 0))throw new Error("Excel 多区域页面缺少完整列几何标记");return}const o=Q(t,e.meta?.reportScope);for(const n of e.components){const r=$(n,o.widths);if(!r)throw new Error("Excel 多区域页面混入没有区域几何的组件,请使用独立页面模板");const a=o.widths.slice(0,r.columnStart).reduce((s,l)=>s+l,e.marginLeftMm??0),i=n.grid.colWidthsMm.reduce((s,l)=>s+l,0);if(Math.abs(a-n.leftMm)>.01||Math.abs(i-n.widthMm)>.01)throw new Error("Excel 多区域标记与真实横向位置不一致")}return o}function Q(e,t){if(!F(e)||e.version!=="1.0"||typeof e.sheet!="string"||!e.sheet.trim()||typeof e.templateId!="string"||!e.templateId.trim())throw new Error("Excel 多区域工作表标识无效");if(!Array.isArray(e.fullWidthsMm)||!e.fullWidthsMm.length||e.fullWidthsMm.length>16384||e.fullWidthsMm.some(o=>typeof o!="number"||!Number.isFinite(o)||o<=0||o>2e3))throw new Error("Excel 多区域完整列宽无效");if(t!==void 0&&(typeof t!="string"||!t.trim()))throw new Error("Excel 多区域报表命名空间无效");return{key:JSON.stringify([t??e.templateId,e.sheet]),sheet:e.sheet,widths:e.fullWidthsMm}}function v(e){return Math.round(e*1e6)/1e6}function Y(e,t,o,n,r){return e.components.filter(a=>n?a.pageAnchor==="header"?t===0:a.pageAnchor==="footer"?t===o-1:a.table?.role!=="header"?!0:r.has(a.table.id)?!1:(r.add(a.table.id),!0):!0)}function Z(e,t,o,n){const r=e.components.filter(i=>!t.includes(i)&&i.table?.role==="header"),a=t.filter(i=>!i.pageAnchor).reduce((i,s)=>Math.max(i,s.topMm+s.heightMm),e.marginTopMm??0);return t.map(i=>{let s=i.topMm;return o&&i.pageAnchor==="footer"&&(s=a),s-=r.filter(l=>l.topMm+l.heightMm<=s+.001).reduce((l,c)=>l+c.heightMm,0),{component:i,layout:T.resolveGridLayout(i.grid,i.widthMm,i.heightMm),top:s,column:$(i,n).columnStart}})}function ee(e,t,o){const n=t.length-1;if(n*o.length>1e6)throw new Error("Excel 多区域单页超过 100 万几何单元格,请减小预览分页高度或列数");const r=new Map(t.map((s,l)=>[s,l])),a=new Map,i=new Map;for(const s of e)for(const l of s.layout.cells){if(!Object.keys(l.cell).length)continue;const c=r.get(v(s.top+l.yMm)),d=r.get(v(s.top+l.yMm+l.heightMm)),h=s.column+l.ci,u=h+(l.cell.colSpan??1),g=`${c}:${h}`;for(let f=c;f<d;f++)for(let w=h;w<u;w++){const b=`${f}:${w}`;if(i.has(b))throw new Error("Excel 多区域实际单元格互相覆盖,已终止输出,未覆盖已有内容");i.set(b,g)}a.set(g,{...l.cell,style:x.mergeComponentStyles(s.component.style,l.cell.style),rowSpan:d-c,colSpan:u-h})}return Array.from({length:n},(s,l)=>{const c=[];for(let d=0;d<o.length;d++){const h=`${l}:${d}`,u=a.get(h);u?(c.push(u),d+=(u.colSpan??1)-1):i.has(h)||c.push(null)}return c})}function te(e,t){const o=new Set,n=[];let r;for(const[a,{page:i}]of e.entries()){const s=P(i);if(r&&(s.key!==r.key||s.widths.length!==r.widths.length||s.widths.some((g,f)=>Math.abs(g-r.widths[f])>.001)))throw new Error("Excel 多区域分页的工作表或列结构不一致");r??=s;const l=Y(i,a,e.length,t,o),c=Z(i,l,t,s.widths);if(!c.length)continue;const d=[...new Set(c.flatMap(g=>[...g.layout.rows.map(f=>v(g.top+f.pos)),v(g.top+g.component.heightMm)]))].sort((g,f)=>g-f),h=ee(c,d,s.widths),u=d.slice(1).map((g,f)=>g-d[f]);n.push({kind:"rect",leftMm:0,topMm:0,widthMm:s.widths.reduce((g,f)=>g+f,0),heightMm:u.reduce((g,f)=>g+f,0),grid:{cells:h,colWidthsMm:s.widths,rowHeightsMm:u}})}return n}const I=72/25.4,ne=32767,ie=253;function E(e,t){if(typeof e!="string")return;if(e.length>ne)throw new Error(`Excel 单元格 ${t} 最多支持 32767 个字符,无法无损导出;内容未裁剪`);let o=0;for(let n=0;n<e.length;n++)if(e.charCodeAt(n)===10&&++o>ie)throw new Error(`Excel 单元格 ${t} 最多支持 253 个换行,无法无损导出;内容未改写`)}function y(e){if(!e)return;const t=e.replace("#","");return/^[0-9a-fA-F]{6}$/.test(t)?`FF${t.toUpperCase()}`:void 0}function z(e,t={}){e.font={name:t.fontFamily,bold:t.bold===!0,italic:t.italic===!0,underline:t.underline===!0,size:x.resolveFontSize(t).fontSizePt,color:y(t.color)?{argb:y(t.color)}:void 0}}const S={a3:{width:297,height:420,code:8},a4:{width:210,height:297,code:9},a5:{width:148,height:210,code:11}};function re(e,t,o,n){if(t&&t!=="auto")return S[t].code;const r=Math.min(e.pageWidthMm,e.pageHeightMm),a=Math.max(e.pageWidthMm,e.pageHeightMm),i=Object.values(S).find(s=>Math.abs(r-s.width)<=1&&Math.abs(a-s.height)<=1);return i?i.code:(n.push(`page ${o+1}: 自定义纸张 ${e.pageWidthMm}×${e.pageHeightMm}mm 无对应 Excel 纸型,打印设置回退 A4;可显式配置 paperSize`),S.a4.code)}function oe(e,t,o,n){const r=typeof t.text=="string"?t.text:"";if(o!=="raw"||!Object.prototype.hasOwnProperty.call(t,"value")){E(r,e.address),e.value=r;return}const a=t.value;if(a===null||typeof a=="string"||typeof a=="boolean"||typeof a=="number"&&Number.isFinite(a)){E(a,e.address),e.value=a,t.numberFormat&&(e.numFmt=t.numberFormat);return}E(r,e.address),e.value=r,n.push(`原始单元格值无效,已保留显示文本:${e.address}`)}function ae(e){const t=P(e);return t?{id:`xlsx-flow:${t.key}`,title:t.sheet,wide:!0,flow:!0}:se(e)}function se(e){const o=e.components.filter(n=>n.table!==void 0)[0]?.table;if(!(!o||typeof o.id!="string"||!o.id.trim()||!Array.isArray(o.columnKeys)||!o.columnKeys.length)){for(const n of e.components){if(n.table){if(!n.grid||n.table.id!==o.id)return;continue}if(n.grid||n.kind!=="text"&&!C.isImageBackedComponent(n))return}return{id:o.id,title:o.title,wide:o.layout==="wide"||e.layout==="wide"}}}function le(e,t){const o=new Set;for(const[n,r]of e.pages.entries())if(!t[n])for(const a of r.components)typeof a.table?.id=="string"&&o.add(a.table.id);return o}function B(e){return e.layout==="wide"||e.components.some(t=>t.table?.layout==="wide")}function ce(e,t,o){const n=[],r=e.pages.map(ae),a=le(e,r);for(const[i,s]of e.pages.entries()){const l=r[i],c=l&&!a.has(l.id),d=t==="pages"||!c?void 0:l;if(t==="continuous"&&!d)throw new Error(`page ${i+1}: continuous Excel 需要完整、单一的逻辑表来源;自由布局请使用 sheetMode: 'pages'`);const h=d!==void 0&&(t==="continuous"||d.wide);!h&&t!=="pages"&&B(s)&&o.push(`page ${i+1}: 混合或缺少逻辑表来源,已保留独立 Sheet,未猜测合并内容`);const u=n[n.length-1];h&&u?.continuous&&u.tableId===d.id?u.pages.push({page:s,index:i}):n.push({pages:[{page:s,index:i}],continuous:h,...h?{tableId:d.id,title:d.title}:{},...l?.flow?{flow:!0,title:l.title}:{}})}return n}function A(e,t,o){return!e||e.length===t.length&&e.every((n,r)=>o(n,t[r]))}function de(e,t,o,n){const r=e.table,a=t.columns.map(l=>l.size),i=A(n.keys,r.columnKeys,(l,c)=>l===c),s=A(n.widths,a,(l,c)=>Math.abs(l-c)<=.001);if(r.columnKeys.length!==a.length||!i||!s)throw new Error(`page ${o+1}: 连续 Excel 逻辑表 ${r.id} 的列结构或列宽不一致`);if(n.keys??=r.columnKeys,n.widths??=a,r.role==="header"){if(r.rowIndex!==-1)throw new Error(`page ${o+1}: 连续 Excel 表头 rowIndex 必须为 -1`);n.headerSeen=!0}else{if(!["body","group-header","subtotal","grand-total"].includes(r.role)||r.rowIndex!==n.expectedRow)throw new Error(`page ${o+1}: 连续 Excel 逻辑行来源不连续或重复(期望 ${n.expectedRow})`);n.expectedRow+=t.rows.length}}function he(e,t){const o={expectedRow:0,headerSeen:!1};for(const{page:n,index:r}of e.pages)for(const a of n.components){const i=t.get(a);a.table&&i&&de(a,i,r,o)}if(!o.headerSeen)throw new Error("连续 Excel 逻辑表缺少明确表头来源")}function ge(e,t,o){let n=(e?.replace(/[\\/*?:[\]]/g," ").replace(/\s+/g," ").trim()||`Sheet${t+1}`).slice(0,31).replace(/^'+|'+$/g,"").trim()||`Sheet${t+1}`;n.toLowerCase()==="history"&&(n+=" 报表");let r=n,a=1;for(;o.has(r.toLowerCase());){const i=` (${++a})`;r=n.slice(0,31-i.length)+i}return o.add(r.toLowerCase()),r}function fe(e){const t=new Set;function o(n,r,a,i){return n<=r?n:(t.has(a)||(e.push(i),t.add(a)),r)}return{column:n=>o(n,255,"column","Excel 单列宽度上限为 255 字符,超宽列已收敛至 255;单元格值完整保留,显示范围可能受限"),row:n=>o(n,409,"row","Excel 行高上限为 409pt,超高行已收敛至 409pt;单元格值完整保留,显示范围可能受限")}}async function ue(e,t){const o=e.flow?te(e.pages,e.continuous).map(i=>({comp:i,pageIndex:e.pages[0].index})):e.pages.flatMap(({page:i,index:s},l)=>i.components.filter(c=>!e.continuous||(c.pageAnchor!=="header"||l===0)&&(c.pageAnchor!=="footer"||l===e.pages.length-1)).map(c=>({comp:c,pageIndex:s}))),n=new Map;let r=1,a=0;for(const{comp:i}of o)if(i.grid){const s=T.resolveGridLayout(i.grid,i.widthMm,i.heightMm);n.set(i,s),r=Math.max(r,s.columns.length);const l=t(s.cells.length);l&&await l}else i.kind==="text"&&(a=Math.max(a,i.widthMm));if(r>16384)throw new Error("Excel 最多支持 16384 列,无法无损导出此报表");return{components:o,grids:n,columnCount:r,textWidthMm:a}}function me(e,t,o){const{page:n,index:r}=e.pages[0],a=t!==void 0&&t!=="auto";return(e.continuous||B(n))&&!a?{}:{pageSetup:{paperSize:re(n,t,r,o),orientation:n.pageWidthMm>n.pageHeightMm?"landscape":"portrait",fitToPage:!0,...e.continuous?{fitToWidth:1,fitToHeight:0}:{}}}}function we(e){const t=y(e.borderColor??e.lineColor),o={style:"thin",...t?{color:{argb:t}}:{}};return{...e.borderTop!==!1?{top:o}:{},...e.borderLeft!==!1?{left:o}:{},...e.borderBottom!==!1?{bottom:o}:{},...e.borderRight!==!1?{right:o}:{}}}function xe(e,t){e.alignment={horizontal:t.align??"left",vertical:t.verticalAlign??"middle",wrapText:!0};const o=y(t.backgroundColor);o&&(e.fill={type:"pattern",pattern:"solid",fgColor:{argb:o}}),e.border=we(t),z(e,t)}function pe(e,t){for(const[o,n]of t.columns.entries()){const r=e.sheet.getColumn(o+1),a=e.limits.column(p.mmToExcelColumnWidth(n.size));(r.width==null||r.width<a)&&(r.width=a)}}function Me(e,t,o){for(const[n,r]of t.rows.entries()){const a=e.sheet.getRow(o+n),i=e.limits.row(r.size*I);(a.height==null||a.height<i)&&(a.height=i)}}function Ee(e,t,o,n){const r=Math.max(1,Math.min(t.cell.colSpan??1,o.columns.length-t.ci)),a=Math.max(1,Math.min(t.cell.rowSpan??1,o.rows.length-t.ri));(r>1||a>1)&&e.mergeCells(n+t.ri,t.ci+1,n+t.ri+a-1,t.ci+r)}async function be(e,t,o,n){if(n+o.rows.length-1>1048576)throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");Me(e,o,n);for(const r of o.cells){const a=e.sheet.getCell(n+r.ri,r.ci+1);oe(a,r.cell,e.valueMode,e.warnings);const i=U(r.cell,t.style);i&&(E(i.richText.map(c=>c.text).join(""),a.address),a.value=i);const s=t.grid?.paddingMm??.5;e.dataBars(e.sheet,r,n+r.ri,s);for(const c of r.cell.children??[])C.isImageBackedComponent(c)&&!c.grid&&e.images.write(e.sheet,c,n+r.ri,{leftMm:r.xMm+s+(r.cell.indentMm??0)+c.leftMm,offsetMm:s+c.topMm});xe(a,x.mergeComponentStyles(t.style,r.cell.style)),r.cell.indentMm&&(a.alignment={...a.alignment,indent:Math.min(250,Math.max(1,Math.round(r.cell.indentMm/2.5)))}),Ee(e.sheet,r,o,n);const l=e.schedule();l&&await l}return n+o.rows.length}function ye(e,t,o,n){const r=Array.isArray(t.lines)&&t.lines.length>0?t.lines.join(`
|
|
4
|
+
`):t.text??"",a=e.sheet.getRow(o),i=a.getCell(1);t.richParagraphs?.length||E(r,i.address),i.value=t.richParagraphs?.length?W(t.richParagraphs,t.style):r,typeof i.value=="object"&&i.value&&"richText"in i.value&&E(i.value.richText.map(l=>l.text).join(""),i.address),i.alignment={horizontal:t.style?.align??"left",vertical:t.style?.verticalAlign??"middle",wrapText:!0};const s=y(t.style?.backgroundColor);return s&&(i.fill={type:"pattern",pattern:"solid",fgColor:{argb:s}}),z(i,t.style),n>1&&e.sheet.mergeCells(o,1,o,n),a.height=e.limits.row(t.heightMm*I),o+1}function Se(e,t,o){const n=t+o-1;e.views=[{state:"frozen",ySplit:n,xSplit:0}],e.pageSetup.printTitlesRow=`1:${n}`}async function ve(e,t,o,n){!t.grids.size&&t.textWidthMm>0&&(e.sheet.getColumn(1).width=e.limits.column(p.mmToExcelColumnWidth(t.textWidthMm)));for(const i of t.grids.values()){pe(e,i);const s=e.schedule(i.columns.length);s&&await s}let r=1,a=!1;for(const{comp:i,pageIndex:s}of t.components){const l=o&&i.table?.role==="header";if(l&&a)continue;if(r>1048576)throw new Error("Excel 最多支持 1048576 行,无法无损导出此报表");const c=t.grids.get(i);if(c)l&&(Se(e.sheet,r,c.rows.length),a=!0),r=await be(e,i,c,r);else if(i.kind==="text")r=ye(e,i,r,t.columnCount);else if(C.isImageBackedComponent(i)){const d=p.importedImageOverlay(i,o),h=n.write(e.sheet,i,d?.row??r,d);d||(r=h)}else e.warnings.push(`page ${s+1} ${i.nid??i.kind}: 组件类型 ${i.kind} 暂不支持 xlsx 导出,已跳过`)}}function Ce(e){if(e.maxDataBars!==void 0&&(!Number.isSafeInteger(e.maxDataBars)||e.maxDataBars<0||e.maxDataBars>1e5))throw new Error("xlsx maxDataBars 必须是 0–100000 的整数");if(e.valueMode!==void 0&&e.valueMode!=="text"&&e.valueMode!=="raw")throw new Error("xlsx valueMode 必须是 text 或 raw");if(e.paperSize!==void 0&&e.paperSize!=="auto"&&!Object.prototype.hasOwnProperty.call(S,e.paperSize))throw new Error("xlsx paperSize 必须是 auto、a3、a4 或 a5");if(e.sheetMode!==void 0&&!["auto","pages","continuous"].includes(e.sheetMode))throw new Error("xlsx sheetMode 必须是 auto、pages 或 continuous")}async function Be(e,t={}){Ce(t),M.assertOutputActive(t.signal);const o=t.assetRegistry||t.assetRenderers?await R.resolvePlanAssets(e,{...t,format:"xlsx"}):{plan:e,diagnostics:[]};e=o.plan;const n=[...o.diagnostics,...R.reportOutputDiagnostics(e,"xlsx",t)];await _(e,t.maxDataBars??1e4,t);const r=new p.ExcelJSRuntime.Workbook,a=[],i=V(r,t,a),s=[],l=H(i,t.maxDataBars??1e4,s),c=fe(a),d=ce(e,t.sheetMode,a),h=new Set,u=M.createOutputScheduler(t);for(const[f,w]of d.entries()){const b=await ue(w,u);w.continuous&&!w.flow&&he(w,b.grids);const D=w.pages[0].page,k=t.sheetName?.(f)??ge(w.title,f,h);h.add(k.toLowerCase());const O=r.addWorksheet(k,me(w,t.paperSize,a)),N=t.valueMode??(B(D)||w.continuous||w.flow?"raw":"text");M.assertOutputActive(t.signal),await ve({sheet:O,warnings:a,limits:c,valueMode:N,schedule:u,images:i,dataBars:l},b,w.continuous,i),await M.outputCheckpoint(t,f+1,d.length)}M.assertOutputActive(t.signal);const g=await r.xlsx.writeBuffer();return M.assertOutputActive(t.signal),{workbook:r,buffer:g,warnings:a,diagnostics:n,...s.length?{notes:s}:{}}}exports.importExcelTemplate=p.importExcelTemplate;exports.inspectExcelWorkbook=p.inspectExcelWorkbook;exports.openExcelWorkbook=p.openExcelWorkbook;exports.bindExcelTemplate=m.bindExcelTemplate;exports.createExcelBindingDocument=m.createExcelBindingDocument;exports.createExcelBindingSession=m.createExcelBindingSession;exports.createExcelRegionBindingDocument=m.createExcelRegionBindingDocument;exports.createExcelRegionBindingSession=m.createExcelRegionBindingSession;exports.excelBindingCellRange=m.excelBindingCellRange;exports.excelBindingRowRange=m.excelBindingRowRange;exports.getExcelSheetWindow=m.getExcelSheetWindow;exports.parseExcelBindingSession=m.parseExcelBindingSession;exports.parseExcelRegionBindingSession=m.parseExcelRegionBindingSession;exports.validateExcelBindingFields=m.validateExcelBindingFields;exports.validateExcelBindingRecipe=m.validateExcelBindingRecipe;exports.validateExcelBindingRegions=m.validateExcelBindingRegions;exports.validateExcelRegionBindings=m.validateExcelRegionBindings;exports.validateExcelRegionFields=m.validateExcelRegionFields;exports.validateExcelRegionGeometry=m.validateExcelRegionGeometry;exports.renderPlanToXlsx=Be;
|