@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/vue-async.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./plugin-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./plugin-9t_ZFwhz.cjs");function i(){return Promise.resolve().then(()=>require("./ReportPreview-BdvoqdOd.cjs")).then(e=>e.ReportPreview$1)}const t={install(e,o={}){r.machReportPlugin.install(e,o)}};exports.MachReportPreview=r.MachReportPreview;exports.default=t;exports.machReportAsyncPlugin=t;exports.preloadMachReport=i;
|
package/dist/vue-async.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { m as o } from "./plugin-
|
|
2
|
-
import { M as l } from "./plugin-
|
|
1
|
+
import { m as o } from "./plugin-s8Ay8kKk.js";
|
|
2
|
+
import { M as l } from "./plugin-s8Ay8kKk.js";
|
|
3
3
|
function a() {
|
|
4
|
-
return import("./ReportPreview-
|
|
4
|
+
return import("./ReportPreview-COFkbeEM.js").then((t) => t.z);
|
|
5
5
|
}
|
|
6
6
|
const n = {
|
|
7
7
|
install(t, r = {}) {
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@agile-team/mach-report"),t=require("./ReportPreview-BdvoqdOd.cjs"),l=require("./plugin-9t_ZFwhz.cjs"),P=require("vue");function v(r){const e=p.createReportSource(r),i=async o=>{if(o.reportIds.length===0)throw new t.PlanLoadError("缺少报表 ID");for(const n of o.reportIds)if(!Object.prototype.hasOwnProperty.call(r,n)||!r[n])throw new t.PlanLoadError(`本地模板 ${n} 不存在`);return e(o)};return i.getParamDefs=e.getParamDefs,i}const C=Object.freeze({loading:!1,hasPlan:!1,pageCount:0,currentPage:1,exporting:null,printing:!1,canExport:!1,canPrint:!1,error:null,pdfFont:Object.freeze({status:"unchecked",fontUrl:""})});function M(){const r=P.shallowRef(null),e=()=>r.value?.state??C,i=Object.freeze({get loading(){return e().loading},get hasPlan(){return e().hasPlan},get pageCount(){return e().pageCount},get currentPage(){return e().currentPage},get exporting(){return e().exporting},get printing(){return e().printing},get canExport(){return e().canExport},get canPrint(){return e().canPrint},get error(){return e().error},get pdfFont(){return e().pdfFont},get editing(){return e().editing??!1},get saving(){return e().saving??!1},get importing(){return e().importing??!1},get dirty(){return e().dirty??!1},get pendingLocalChanges(){return e().pendingLocalChanges??!1},get task(){return e().task??null},get diagnostics(){return e().diagnostics??[]},get reportIds(){return e().reportIds??[]},get params(){return e().params??{}},get canUndo(){return e().canUndo??!1},get canRedo(){return e().canRedo??!1},get changeCount(){return e().changeCount??0},get selection(){return e().selection??null}});function o(){if(!r.value)throw new t.MachReportError("config","报表预览尚未挂载,请在 ready 后调用控制器");return r.value}return{ref(n){const a=n;r.value=a&&typeof a.reload=="function"&&typeof a.print=="function"&&typeof a.exportAs=="function"&&typeof a.openPdfWindow=="function"&&typeof a.gotoPage=="function"&&typeof a.setParams=="function"?a:null},ready:P.computed(()=>r.value!==null),state:i,async checkPdfFont(){const n=o();return n.checkPdfFont?n.checkPdfFont():{status:"unverified",fontUrl:"",message:"旧自定义控制器未提供字体检查,请由宿主确认字体配置"}},cancelTask(){o().cancelTask?.()},async confirmDiscard(n){return await o().confirmDiscard?.(n)??!0},getOutputDiagnostics(n){return o().getOutputDiagnostics?.(n)??[]},async reload(){await o().reload()},async print(){await o().print()},async exportAs(n){await o().exportAs(n)},openPdfWindow(){o().openPdfWindow()},gotoPage(n){o().gotoPage(n)},async setParams(n,a){await o().setParams(n,a)},async importExcel(n,a){const f=o();if(!f.importExcel)throw new t.MachReportError("config","旧自定义控制器未提供 Excel 导入");return f.importExcel(n,a)},getPlan(){return o().getPlan?.()??null},getChanges(){return o().getChanges?.()??[]},getDifferences:()=>o().getDifferences?.()??[],undo:async()=>await o().undo?.()??!1,redo:async()=>await o().redo?.()??!1,restoreChanges:async()=>await o().restoreChanges?.()??!1,getSelection:()=>o().getSelection?.()??null,focusCell:async(n,a)=>await o().focusCell?.(n,a)??!1,focusField:async n=>await o().focusField?.(n)??!1,copySelection:()=>o().copySelection?.()??"",pasteSelection:async n=>await o().pasteSelection?.(n)??!1}}function S(){return P.inject(l.MACH_REPORT_CONTROLLER_KEY,null)}function h(r){return!!r&&typeof r=="object"&&!Array.isArray(r)}function A(r){return Array.isArray(r)&&r.every(e=>h(e)&&typeof e.code=="string"&&typeof e.message=="string"&&["info","warning","error"].includes(e.severity)&&(e.path===void 0||typeof e.path=="string"))}function I(r,e){return Array.isArray(r)&&r.every(i=>h(i)&&Number.isSafeInteger(i.editIndex)&&i.editIndex>=0&&i.editIndex<e&&typeof i.code=="string"&&typeof i.message=="string")}function x(r,e){let i;if(!h(r)||typeof r.revision!="string"||!r.revision.trim()?i="非空 revision(请先在适配器解包业务响应)":r.sourceToken!==void 0&&typeof r.sourceToken!="string"?i="字符串 sourceToken":r.diagnostics!==void 0&&!A(r.diagnostics)?i="结构化 diagnostics":r.conflicts!==void 0&&!I(r.conflicts,e)&&(i="有效 editIndex/code/message conflicts"),i)throw new t.MachReportError("edit",`ReportProvider.save 必须返回${i};服务器可能已提交,请重新查询确认后再编辑`)}function y(r){return typeof r=="function"?r():r}function D(r,e){const i=new Set(r.flatMap(o=>o.source?.[e]===void 0?[]:[String(o.source[e])]));return i.size===1?[...i][0]:void 0}function w(r,e,i,o){return typeof r=="function"?r():D(e,i)??o??r}function L(r){return r.requestId??globalThis.crypto?.randomUUID?.()??`mr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function F(r,e){if(!r.save)throw new t.MachReportError("config","ReportProvider.save 未配置,无法启用业务保存");let i="",o,n,a=0;function f(s,c,g){s.conflicts?.length||c!==i||g!==a||(o=s.revision,n=s.sourceToken)}async function m(s,c){if(c.signal.aborted)throw c.signal.reason??new DOMException("Aborted","AbortError");const g=y(e.reportId),T={...y(e.params??{})},R=JSON.stringify([g,T]),O=++a;if(R!==i&&(i=R,o=void 0,n=void 0),e.requireSource!==!1&&s.edits.some(u=>!u.source))throw new p.ReportCellEditError("missing");const d=await r.save({reportId:g,params:T,signal:c.signal,requestId:s.requestId,action:c.action,edits:t.cloneReportSnapshot(s.edits),expectedRevision:w(e.expectedRevision,s.edits,"revision",o),sourceToken:w(e.sourceToken,s.edits,"sourceToken",n)});if(c.signal.aborted)throw c.signal.reason??new DOMException("Aborted","AbortError");x(d,s.edits.length),d.diagnostics?.forEach(u=>e.onDiagnostic?.(u));const E=d.diagnostics?.filter(u=>u.severity==="error");if(E?.length)throw new t.MachReportError("edit",E.map(u=>u.message).join(";"),{diagnostics:E});const _=d.conflicts?.map(u=>({source:s.edits[u.editIndex]?.source,address:s.edits[u.editIndex]?.address,message:u.message}));return f(d,R,O),{revision:d.revision,sourceToken:d.sourceToken,conflicts:_}}return{requireSource:e.requireSource??!0,canEdit:e.canEdit,validate:e.validate,saveBatch:m,save:(s,c)=>m({requestId:L(c),edits:[t.cloneReportSnapshot(s)]},c)}}exports.DEFAULT_MESSAGES=t.DEFAULT_MESSAGES;exports.DEFAULT_THEME=t.DEFAULT_THEME;exports.MachReportError=t.MachReportError;exports.PlanLoadError=t.PlanLoadError;exports.REPORT_EXPORT_FORMATS=t.REPORT_EXPORT_FORMATS;exports.REPORT_PREVIEW_TOOLS=t.REPORT_PREVIEW_TOOLS;exports.ReportParamPanel=t.ReportParamPanel;exports.ReportPreview=t.ReportPreview;exports.ReportToolbar=t.ReportToolbar;exports.SILENT_LOGGER=t.SILENT_LOGGER;exports.buildPrintDocument=t.buildPrintDocument;exports.buildWordHtml=t.buildWordHtml;exports.createDefaultPdfExporter=t.createDefaultPdfExporter;exports.createFetchRequest=t.createFetchRequest;exports.createReportStoragePreferences=t.createReportStoragePreferences;exports.defineMachReportConfig=t.defineMachReportConfig;exports.defineMachReportPreset=t.defineMachReportPreset;exports.joinReportIds=t.joinReportIds;exports.normalizeReportIds=t.normalizeReportIds;exports.normalizeReportLoadError=t.normalizeReportLoadError;exports.printPlans=t.printPlans;exports.provideMachReportConfig=t.provideMachReportConfig;exports.resolveConfig=t.resolveConfig;exports.themeToCssVars=t.themeToCssVars;exports.toErrorDetail=t.toErrorDetail;exports.useMachReportConfig=t.useMachReportConfig;exports.usePageWindow=t.usePageWindow;exports.usePrintExport=t.usePrintExport;exports.useZoom=t.useZoom;exports.MACH_REPORT_CONFIG_KEY=l.MACH_REPORT_CONFIG_KEY;exports.MACH_REPORT_CONTROLLER_KEY=l.MACH_REPORT_CONTROLLER_KEY;exports.MACH_REPORT_FETCHER_KEY=l.MACH_REPORT_FETCHER_KEY;exports.MACH_REPORT_PDF_EXPORTER_KEY=l.MACH_REPORT_PDF_EXPORTER_KEY;exports.MachReportPreview=l.MachReportPreview;exports.machReportPlugin=l.machReportPlugin;exports.createLocalFetcher=v;exports.createProviderEditing=F;exports.useMachReport=M;exports.useReportPreview=S;Object.keys(p).forEach(r=>{r!=="default"&&!Object.prototype.hasOwnProperty.call(exports,r)&&Object.defineProperty(exports,r,{enumerable:!0,get:()=>p[r]})});
|
package/dist/vue.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { createReportSource as
|
|
1
|
+
import { createReportSource as x, ReportCellEditError as S } from "@agile-team/mach-report";
|
|
2
2
|
export * from "@agile-team/mach-report";
|
|
3
|
-
import { P as
|
|
4
|
-
import { D as
|
|
5
|
-
import { a as
|
|
6
|
-
import { b as
|
|
7
|
-
import { shallowRef as
|
|
8
|
-
function
|
|
9
|
-
const e =
|
|
10
|
-
if (r.reportIds.length === 0) throw new
|
|
11
|
-
for (const
|
|
12
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
13
|
-
throw new
|
|
3
|
+
import { P as R, M as f, c as y } from "./ReportPreview-COFkbeEM.js";
|
|
4
|
+
import { D as $, a as V, R as X, b as B, d as J, e as Z, f as Q, S as ee, g as te, h as re, i as ne, j as oe, k as se, l as ae, m as ie, n as ce, o as ue, p as fe, q as de, r as ge, s as le, t as pe, u as me, v as Pe, w as Ee, x as Re, y as ye } from "./ReportPreview-COFkbeEM.js";
|
|
5
|
+
import { a as C } from "./plugin-s8Ay8kKk.js";
|
|
6
|
+
import { b as he, c as Te, d as ve, M as xe, m as Se } from "./plugin-s8Ay8kKk.js";
|
|
7
|
+
import { shallowRef as I, computed as O, inject as A } from "vue";
|
|
8
|
+
function H(t) {
|
|
9
|
+
const e = x(t), o = async (r) => {
|
|
10
|
+
if (r.reportIds.length === 0) throw new R("缺少报表 ID");
|
|
11
|
+
for (const n of r.reportIds)
|
|
12
|
+
if (!Object.prototype.hasOwnProperty.call(t, n) || !t[n])
|
|
13
|
+
throw new R(`本地模板 ${n} 不存在`);
|
|
14
14
|
return e(r);
|
|
15
15
|
};
|
|
16
|
-
return
|
|
16
|
+
return o.getParamDefs = e.getParamDefs, o;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const D = Object.freeze({
|
|
19
19
|
loading: !1,
|
|
20
20
|
hasPlan: !1,
|
|
21
21
|
pageCount: 0,
|
|
@@ -27,8 +27,8 @@ const P = Object.freeze({
|
|
|
27
27
|
error: null,
|
|
28
28
|
pdfFont: Object.freeze({ status: "unchecked", fontUrl: "" })
|
|
29
29
|
});
|
|
30
|
-
function
|
|
31
|
-
const
|
|
30
|
+
function z() {
|
|
31
|
+
const t = I(null), e = () => t.value?.state ?? D, o = Object.freeze({
|
|
32
32
|
get loading() {
|
|
33
33
|
return e().loading;
|
|
34
34
|
},
|
|
@@ -70,23 +70,59 @@ function w() {
|
|
|
70
70
|
},
|
|
71
71
|
get dirty() {
|
|
72
72
|
return e().dirty ?? !1;
|
|
73
|
+
},
|
|
74
|
+
get pendingLocalChanges() {
|
|
75
|
+
return e().pendingLocalChanges ?? !1;
|
|
76
|
+
},
|
|
77
|
+
get task() {
|
|
78
|
+
return e().task ?? null;
|
|
79
|
+
},
|
|
80
|
+
get diagnostics() {
|
|
81
|
+
return e().diagnostics ?? [];
|
|
82
|
+
},
|
|
83
|
+
get reportIds() {
|
|
84
|
+
return e().reportIds ?? [];
|
|
85
|
+
},
|
|
86
|
+
get params() {
|
|
87
|
+
return e().params ?? {};
|
|
88
|
+
},
|
|
89
|
+
get canUndo() {
|
|
90
|
+
return e().canUndo ?? !1;
|
|
91
|
+
},
|
|
92
|
+
get canRedo() {
|
|
93
|
+
return e().canRedo ?? !1;
|
|
94
|
+
},
|
|
95
|
+
get changeCount() {
|
|
96
|
+
return e().changeCount ?? 0;
|
|
97
|
+
},
|
|
98
|
+
get selection() {
|
|
99
|
+
return e().selection ?? null;
|
|
73
100
|
}
|
|
74
101
|
});
|
|
75
102
|
function r() {
|
|
76
|
-
if (!
|
|
77
|
-
throw new
|
|
78
|
-
return
|
|
103
|
+
if (!t.value)
|
|
104
|
+
throw new f("config", "报表预览尚未挂载,请在 ready 后调用控制器");
|
|
105
|
+
return t.value;
|
|
79
106
|
}
|
|
80
107
|
return {
|
|
81
|
-
ref(
|
|
82
|
-
const
|
|
83
|
-
|
|
108
|
+
ref(n) {
|
|
109
|
+
const s = n;
|
|
110
|
+
t.value = s && typeof s.reload == "function" && typeof s.print == "function" && typeof s.exportAs == "function" && typeof s.openPdfWindow == "function" && typeof s.gotoPage == "function" && typeof s.setParams == "function" ? s : null;
|
|
84
111
|
},
|
|
85
|
-
ready:
|
|
86
|
-
state:
|
|
112
|
+
ready: O(() => t.value !== null),
|
|
113
|
+
state: o,
|
|
87
114
|
async checkPdfFont() {
|
|
88
|
-
const
|
|
89
|
-
return
|
|
115
|
+
const n = r();
|
|
116
|
+
return n.checkPdfFont ? n.checkPdfFont() : { status: "unverified", fontUrl: "", message: "旧自定义控制器未提供字体检查,请由宿主确认字体配置" };
|
|
117
|
+
},
|
|
118
|
+
cancelTask() {
|
|
119
|
+
r().cancelTask?.();
|
|
120
|
+
},
|
|
121
|
+
async confirmDiscard(n) {
|
|
122
|
+
return await r().confirmDiscard?.(n) ?? !0;
|
|
123
|
+
},
|
|
124
|
+
getOutputDiagnostics(n) {
|
|
125
|
+
return r().getOutputDiagnostics?.(n) ?? [];
|
|
90
126
|
},
|
|
91
127
|
async reload() {
|
|
92
128
|
await r().reload();
|
|
@@ -94,69 +130,142 @@ function w() {
|
|
|
94
130
|
async print() {
|
|
95
131
|
await r().print();
|
|
96
132
|
},
|
|
97
|
-
async exportAs(
|
|
98
|
-
await r().exportAs(
|
|
133
|
+
async exportAs(n) {
|
|
134
|
+
await r().exportAs(n);
|
|
99
135
|
},
|
|
100
136
|
openPdfWindow() {
|
|
101
137
|
r().openPdfWindow();
|
|
102
138
|
},
|
|
103
|
-
gotoPage(
|
|
104
|
-
r().gotoPage(
|
|
139
|
+
gotoPage(n) {
|
|
140
|
+
r().gotoPage(n);
|
|
105
141
|
},
|
|
106
|
-
async setParams(
|
|
107
|
-
await r().setParams(
|
|
142
|
+
async setParams(n, s) {
|
|
143
|
+
await r().setParams(n, s);
|
|
108
144
|
},
|
|
109
|
-
async importExcel(
|
|
110
|
-
const
|
|
111
|
-
if (!
|
|
112
|
-
return
|
|
145
|
+
async importExcel(n, s) {
|
|
146
|
+
const d = r();
|
|
147
|
+
if (!d.importExcel) throw new f("config", "旧自定义控制器未提供 Excel 导入");
|
|
148
|
+
return d.importExcel(n, s);
|
|
113
149
|
},
|
|
114
150
|
getPlan() {
|
|
115
151
|
return r().getPlan?.() ?? null;
|
|
116
152
|
},
|
|
117
153
|
getChanges() {
|
|
118
154
|
return r().getChanges?.() ?? [];
|
|
119
|
-
}
|
|
155
|
+
},
|
|
156
|
+
getDifferences: () => r().getDifferences?.() ?? [],
|
|
157
|
+
undo: async () => await r().undo?.() ?? !1,
|
|
158
|
+
redo: async () => await r().redo?.() ?? !1,
|
|
159
|
+
restoreChanges: async () => await r().restoreChanges?.() ?? !1,
|
|
160
|
+
getSelection: () => r().getSelection?.() ?? null,
|
|
161
|
+
focusCell: async (n, s) => await r().focusCell?.(n, s) ?? !1,
|
|
162
|
+
focusField: async (n) => await r().focusField?.(n) ?? !1,
|
|
163
|
+
copySelection: () => r().copySelection?.() ?? "",
|
|
164
|
+
pasteSelection: async (n) => await r().pasteSelection?.(n) ?? !1
|
|
120
165
|
};
|
|
121
166
|
}
|
|
122
|
-
function
|
|
123
|
-
return
|
|
167
|
+
function W() {
|
|
168
|
+
return A(C, null);
|
|
169
|
+
}
|
|
170
|
+
function m(t) {
|
|
171
|
+
return !!t && typeof t == "object" && !Array.isArray(t);
|
|
172
|
+
}
|
|
173
|
+
function M(t) {
|
|
174
|
+
return Array.isArray(t) && t.every((e) => m(e) && typeof e.code == "string" && typeof e.message == "string" && ["info", "warning", "error"].includes(e.severity) && (e.path === void 0 || typeof e.path == "string"));
|
|
175
|
+
}
|
|
176
|
+
function _(t, e) {
|
|
177
|
+
return Array.isArray(t) && t.every((o) => m(o) && Number.isSafeInteger(o.editIndex) && o.editIndex >= 0 && o.editIndex < e && typeof o.code == "string" && typeof o.message == "string");
|
|
178
|
+
}
|
|
179
|
+
function k(t, e) {
|
|
180
|
+
let o;
|
|
181
|
+
if (!m(t) || typeof t.revision != "string" || !t.revision.trim() ? o = "非空 revision(请先在适配器解包业务响应)" : t.sourceToken !== void 0 && typeof t.sourceToken != "string" ? o = "字符串 sourceToken" : t.diagnostics !== void 0 && !M(t.diagnostics) ? o = "结构化 diagnostics" : t.conflicts !== void 0 && !_(t.conflicts, e) && (o = "有效 editIndex/code/message conflicts"), o) throw new f("edit", `ReportProvider.save 必须返回${o};服务器可能已提交,请重新查询确认后再编辑`);
|
|
182
|
+
}
|
|
183
|
+
function w(t) {
|
|
184
|
+
return typeof t == "function" ? t() : t;
|
|
185
|
+
}
|
|
186
|
+
function F(t, e) {
|
|
187
|
+
const o = new Set(t.flatMap((r) => r.source?.[e] === void 0 ? [] : [String(r.source[e])]));
|
|
188
|
+
return o.size === 1 ? [...o][0] : void 0;
|
|
189
|
+
}
|
|
190
|
+
function h(t, e, o, r) {
|
|
191
|
+
return typeof t == "function" ? t() : F(e, o) ?? r ?? t;
|
|
192
|
+
}
|
|
193
|
+
function b(t) {
|
|
194
|
+
return t.requestId ?? globalThis.crypto?.randomUUID?.() ?? `mr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
195
|
+
}
|
|
196
|
+
function G(t, e) {
|
|
197
|
+
if (!t.save) throw new f("config", "ReportProvider.save 未配置,无法启用业务保存");
|
|
198
|
+
let o = "", r, n, s = 0;
|
|
199
|
+
function d(a, i, g) {
|
|
200
|
+
a.conflicts?.length || i !== o || g !== s || (r = a.revision, n = a.sourceToken);
|
|
201
|
+
}
|
|
202
|
+
async function P(a, i) {
|
|
203
|
+
if (i.signal.aborted) throw i.signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
204
|
+
const g = w(e.reportId), E = { ...w(e.params ?? {}) }, l = JSON.stringify([g, E]), T = ++s;
|
|
205
|
+
if (l !== o && (o = l, r = void 0, n = void 0), e.requireSource !== !1 && a.edits.some((c) => !c.source)) throw new S("missing");
|
|
206
|
+
const u = await t.save({
|
|
207
|
+
reportId: g,
|
|
208
|
+
params: E,
|
|
209
|
+
signal: i.signal,
|
|
210
|
+
requestId: a.requestId,
|
|
211
|
+
action: i.action,
|
|
212
|
+
edits: y(a.edits),
|
|
213
|
+
expectedRevision: h(e.expectedRevision, a.edits, "revision", r),
|
|
214
|
+
sourceToken: h(e.sourceToken, a.edits, "sourceToken", n)
|
|
215
|
+
});
|
|
216
|
+
if (i.signal.aborted) throw i.signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
217
|
+
k(u, a.edits.length), u.diagnostics?.forEach((c) => e.onDiagnostic?.(c));
|
|
218
|
+
const p = u.diagnostics?.filter((c) => c.severity === "error");
|
|
219
|
+
if (p?.length) throw new f("edit", p.map((c) => c.message).join(";"), { diagnostics: p });
|
|
220
|
+
const v = u.conflicts?.map((c) => ({ source: a.edits[c.editIndex]?.source, address: a.edits[c.editIndex]?.address, message: c.message }));
|
|
221
|
+
return d(u, l, T), { revision: u.revision, sourceToken: u.sourceToken, conflicts: v };
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
requireSource: e.requireSource ?? !0,
|
|
225
|
+
canEdit: e.canEdit,
|
|
226
|
+
validate: e.validate,
|
|
227
|
+
saveBatch: P,
|
|
228
|
+
save: (a, i) => P({ requestId: b(i), edits: [y(a)] }, i)
|
|
229
|
+
};
|
|
124
230
|
}
|
|
125
231
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
232
|
+
$ as DEFAULT_MESSAGES,
|
|
233
|
+
V as DEFAULT_THEME,
|
|
234
|
+
he as MACH_REPORT_CONFIG_KEY,
|
|
235
|
+
C as MACH_REPORT_CONTROLLER_KEY,
|
|
236
|
+
Te as MACH_REPORT_FETCHER_KEY,
|
|
237
|
+
ve as MACH_REPORT_PDF_EXPORTER_KEY,
|
|
238
|
+
f as MachReportError,
|
|
239
|
+
xe as MachReportPreview,
|
|
240
|
+
R as PlanLoadError,
|
|
241
|
+
X as REPORT_EXPORT_FORMATS,
|
|
242
|
+
B as REPORT_PREVIEW_TOOLS,
|
|
243
|
+
J as ReportParamPanel,
|
|
244
|
+
Z as ReportPreview,
|
|
245
|
+
Q as ReportToolbar,
|
|
246
|
+
ee as SILENT_LOGGER,
|
|
247
|
+
te as buildPrintDocument,
|
|
248
|
+
re as buildWordHtml,
|
|
249
|
+
ne as createDefaultPdfExporter,
|
|
250
|
+
oe as createFetchRequest,
|
|
251
|
+
H as createLocalFetcher,
|
|
252
|
+
G as createProviderEditing,
|
|
253
|
+
se as createReportStoragePreferences,
|
|
254
|
+
ae as defineMachReportConfig,
|
|
255
|
+
ie as defineMachReportPreset,
|
|
256
|
+
ce as joinReportIds,
|
|
257
|
+
Se as machReportPlugin,
|
|
258
|
+
ue as normalizeReportIds,
|
|
259
|
+
fe as normalizeReportLoadError,
|
|
260
|
+
de as printPlans,
|
|
261
|
+
ge as provideMachReportConfig,
|
|
262
|
+
le as resolveConfig,
|
|
263
|
+
pe as themeToCssVars,
|
|
264
|
+
me as toErrorDetail,
|
|
265
|
+
z as useMachReport,
|
|
266
|
+
Pe as useMachReportConfig,
|
|
267
|
+
Ee as usePageWindow,
|
|
268
|
+
Re as usePrintExport,
|
|
269
|
+
W as useReportPreview,
|
|
270
|
+
ye as useZoom
|
|
162
271
|
};
|
package/dist/worker.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("./task-events-DQ276fn2.cjs"),A=require("./validate-DfHPD8wX.cjs"),u="mach-report-worker/1";class l extends Error{constructor(r){super(r.message),this.name=r.name,this.code=r.code,this.path=r.path,this.issues=r.issues,this.diagnostics=r.diagnostics}}function p(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function L(e){return p(e)?["rows","pages","cells"].every(r=>typeof e[r]=="number"&&Number.isSafeInteger(e[r])&&e[r]>=0)&&typeof e.durationMs=="number"&&Number.isFinite(e.durationMs)&&e.durationMs>=0:!1}function P(e){return Array.isArray(e)&&e.every(r=>p(r)&&typeof r.code=="string"&&typeof r.message=="string"&&["info","warning","error"].includes(r.severity))}function T(e){return p(e)&&Object.values(e).every(r=>p(r)&&(r.revision===void 0||typeof r.revision=="string")&&(r.sourceToken===void 0||typeof r.sourceToken=="string"))}function v(e,r){if(!p(e)||!L(e.stats)||!P(e.diagnostics)||!T(e.revisions))return!1;if(r==="prepare")return A.validateRenderPlan(e.plan).ok;const t=e.format==="pdf"?"application/pdf":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return e.bytes instanceof Uint8Array&&(e.format==="pdf"||e.format==="xlsx")&&e.contentType===t}function W(e){if(!e||typeof e!="object")return{message:String(e)};const r={};for(const t of["code","path","field","message"]){const o=e[t];typeof o=="string"&&(r[t]=o)}return r}function j(e){const r=W(e);if(!p(e))return r;for(const t of["format","severity","kind","nid"])typeof e[t]=="string"&&(r[t]=e[t]);for(const t of["pageIndex","componentIndex"])Number.isSafeInteger(e[t])&&e[t]>=0&&(r[t]=e[t]);return Array.isArray(e.componentPath)&&e.componentPath.every(t=>Number.isSafeInteger(t)&&t>=0)&&(r.componentPath=e.componentPath),r}function O(e){if(!(e instanceof Error))return{name:"Error",message:String(e)};const r=e;return{name:e.name,message:e.message,...typeof r.code=="string"?{code:r.code}:{},...typeof r.path=="string"?{path:r.path}:{},...Array.isArray(r.issues)?{issues:r.issues.map(W)}:{},...Array.isArray(r.diagnostics)?{diagnostics:r.diagnostics.map(j)}:{}}}function S(e){if(!e||typeof e!="object")return!1;const r=e;return r.protocol===u&&typeof r.id=="string"&&(r.operation==="prepare"||r.operation==="export")&&!!r.input&&typeof r.input=="object"}async function N(e,r,t){try{const o=r.operation==="prepare"?await e.prepare({...r.input,onEvent:t}):await e.export({...r.input,onEvent:t});return{protocol:u,id:r.id,result:o}}catch(o){return{protocol:u,id:r.id,error:O(o)}}}function z(e){const r=e.result;return!r||!("bytes"in r)||!(r.bytes.buffer instanceof ArrayBuffer)?[]:[r.bytes.buffer]}function _(e,r){if(!p(e)||typeof e.taskId!="string"||!e.taskId||r.taskId!==void 0&&e.taskId!==r.taskId||e.correlationId!==r.correlationId||e.reportId!==void 0&&(typeof e.reportId!="string"||!r.reportIds.includes(e.reportId))||!["query","validate","layout","encode"].includes(e.stage)||!["started","completed","failed"].includes(e.status))return!1;for(const t of["completed","total"])if(e[t]!==void 0&&(typeof e[t]!="number"||!Number.isFinite(e[t])||e[t]<0))return!1;return e.completed===void 0||e.total===void 0||e.completed<=e.total}let q=0;function w(e){const r=new Error("报表 Worker 任务已取消");return r.name="AbortError",Object.defineProperty(r,"cause",{value:e}),r}function B(e,r){if(!e||typeof e!="object")return;const t=e;return t.protocol===u&&t.id===r?t:void 0}function F(e,r={}){const t=r.timeoutMs??12e4;if(!Number.isFinite(t)||t<=0||t>2147483647)throw new RangeError("Worker timeoutMs 应为正有限数字,且不能超过 2147483647");const o=(i,c,n,d)=>n?.aborted?Promise.reject(w(n.reason)):new Promise((I,b)=>{let g;try{g=e()}catch(a){b(a);return}const R=`mach-report-${Date.now()}-${++q}`;let y=!1,E=()=>{},k;const f=(a,s)=>{y||(y=!0,k&&clearTimeout(k),E(),n?.removeEventListener("abort",h),Promise.resolve().then(()=>g.terminate()).then(()=>a===void 0?I(s):b(a),m=>b(a??m)))},h=()=>f(w(n?.reason)),M=a=>{const s=B(a,R);if(!(!s||y)){if("type"in s&&s.type==="event"){const m="event"in s?s.event:void 0;_(m,c)?x.notifyReportTaskEvent(d,m,n):f(new Error("报表 Worker 返回无效阶段事件"));return}s.error&&typeof s.error.name=="string"&&typeof s.error.message=="string"?f(new l(s.error)):v(s.result,i)&&(i!=="export"||"format"in s.result&&"format"in c&&s.result.format===c.format)?f(void 0,s.result):f(new Error("报表 Worker 返回无效响应"))}};try{if(E=g.subscribe(M,a=>f(a??new Error("报表 Worker 执行失败"))),y){E();return}if(n?.addEventListener("abort",h,{once:!0}),k=setTimeout(()=>f(new l({name:"ReportRuntimeError",code:"timeout",message:`报表 Worker 执行超过 ${t}ms`})),t),n?.aborted)h();else{const{onEvent:a,signal:s,...m}=c;g.postMessage({protocol:u,id:R,operation:i,input:m})}}catch(a){f(a)}});return{prepare:(i,c,n)=>o("prepare",i,c,n),export:(i,c,n)=>o("export",i,c,n)}}function $(e,r={}){return F(()=>{const t=e();return{postMessage:o=>t.postMessage(o),terminate:()=>t.terminate(),subscribe:(o,i)=>{const c=d=>o(d.data),n=d=>i(d instanceof ErrorEvent?new Error(d.message):new Error("报表 Worker 消息无法解码"));return t.addEventListener("message",c),t.addEventListener("error",n),t.addEventListener("messageerror",n),()=>{t.removeEventListener("message",c),t.removeEventListener("error",n),t.removeEventListener("messageerror",n)}}}},r)}function D(e,r=globalThis){const t=o=>{S(o.data)&&N(e,o.data,i=>r.postMessage({protocol:u,id:o.data.id,type:"event",event:i})).then(i=>r.postMessage(i,z(i)))};return r.addEventListener("message",t),()=>r.removeEventListener("message",t)}exports.ReportWorkerError=l;exports.createBrowserReportExecutor=$;exports.serveReportWorker=D;
|