@agile-team/mach-report 2.26.2 → 2.27.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/dist/vue.js CHANGED
@@ -1,91 +1,91 @@
1
1
  import { createReportSource as le, ReportCellEditError as oe } from "@agile-team/mach-report";
2
2
  export * from "@agile-team/mach-report";
3
- import { c as A, R as fe, a as de, b as ge, P as Y, r as pe } from "./ReportPreview-DJqt40zA.js";
4
- import { d as mt, e as vt, _ as yt, f as ht, g as wt, h as Et, i as Pt, j as bt, k as Rt, l as Ct, m as St, n as _t, o as Tt, p as At, q as xt, s as It, t as Ot, u as Dt, v as Mt, w as kt, x as Nt } from "./ReportPreview-DJqt40zA.js";
3
+ import { c as x, R as fe, a as de, b as ge, P as Y, r as pe } from "./ReportPreview-D0UTiSpz.js";
4
+ import { d as vt, e as yt, _ as ht, f as wt, g as Et, h as Pt, i as bt, j as Rt, k as Ct, l as St, m as _t, n as Tt, o as xt, p as At, q as It, s as Ot, t as Dt, u as Mt, v as kt, w as Nt, x as Ft } from "./ReportPreview-D0UTiSpz.js";
5
5
  import { defineComponent as me, computed as D, shallowRef as j, ref as O, watch as ve, onMounted as ye, onUnmounted as he, openBlock as k, createElementBlock as N, normalizeStyle as we, unref as Ee, createElementVNode as J, toDisplayString as F, createCommentVNode as $, createBlock as Pe, withCtx as X, createVNode as Z, inject as be } from "vue";
6
6
  import { a as Re } from "./execution-result-BUPPNlaS.js";
7
- import { z as T, w as B, A as Ce } from "./diagnostic-collector-CZ8DV6wA.js";
8
- import { M as S, u as Se, r as _e, D as Te, t as Ae } from "./ReportParamPanel-jKDJVar2.js";
9
- import { a as Lt, b as Ut, c as jt, d as Bt, e as qt, P as Vt, R as Wt, S as Gt, f as zt, g as Ht, n as Kt, p as Yt, h as Jt, i as $t, j as Xt, s as Zt, k as Qt } from "./ReportParamPanel-jKDJVar2.js";
10
- import { s as Q, v as xe } from "./json-snapshot-DRQmh_k5.js";
11
- import { b as se } from "./template-registry-CIaC6qBW.js";
7
+ import { z as T, w as q, A as Ce } from "./diagnostic-collector-CZ8DV6wA.js";
8
+ import { M as S, u as Se, r as _e, D as Te, t as xe } from "./ReportParamPanel-jKDJVar2.js";
9
+ import { a as Ut, b as jt, c as qt, d as Bt, e as Vt, P as Wt, R as zt, S as Gt, f as Ht, g as Kt, n as Yt, p as Jt, h as $t, i as Xt, j as Zt, s as Qt, k as er } from "./ReportParamPanel-jKDJVar2.js";
10
+ import { s as Q, v as Ae } from "./json-snapshot-DRQmh_k5.js";
11
+ import { b as ae } from "./template-registry-CIaC6qBW.js";
12
12
  import { _ as Ie } from "./usePopoverBounds-C3hn7F1s.js";
13
13
  import { M as Oe } from "./injection-keys-e85udZCp.js";
14
- import { a as tr, b as rr, c as nr } from "./injection-keys-e85udZCp.js";
15
- import { M as sr, m as ar } from "./plugin-BnRcXQzg.js";
14
+ import { a as rr, b as nr, c as or } from "./injection-keys-e85udZCp.js";
15
+ import { M as sr, m as ir } from "./plugin-CK8Mm9VY.js";
16
16
  const De = 3, Me = 8e6, ke = 16e6, Ne = 7;
17
17
  function P(e) {
18
18
  return new S("validate", e);
19
19
  }
20
20
  function Fe(e) {
21
- return !e || ![e.scope, e.id, e.version].every((t) => typeof t == "string" && !!t.trim() && t.length <= 256) || !["building", "complete", "failed"].includes(e.state) || !Number.isSafeInteger(e.pageCount) || e.pageCount < 0 || e.pageCount > 1e5 || e.revision !== e.pageCount + (e.state === "building" ? 0 : 1) || !Number.isSafeInteger(e.bytes) || e.bytes < 0 || !e.plan || "pages" in e.plan || !se({ ...e.plan, pages: [] }).ok ? !1 : e.state !== "failed" || !!e.failure && ["cancelled", "generation"].includes(e.failure.code) && typeof e.failure.message == "string" && e.failure.message.length <= 1024;
21
+ return !e || ![e.scope, e.id, e.version].every((t) => typeof t == "string" && !!t.trim() && t.length <= 256) || !["building", "complete", "failed"].includes(e.state) || !Number.isSafeInteger(e.pageCount) || e.pageCount < 0 || e.pageCount > 1e5 || e.revision !== e.pageCount + (e.state === "building" ? 0 : 1) || !Number.isSafeInteger(e.bytes) || e.bytes < 0 || !e.plan || "pages" in e.plan || !ae({ ...e.plan, pages: [] }).ok ? !1 : e.state !== "failed" || !!e.failure && ["cancelled", "generation"].includes(e.failure.code) && typeof e.failure.message == "string" && e.failure.message.length <= 1024;
22
22
  }
23
- function q(e, t) {
23
+ function B(e, t) {
24
24
  if (Object.is(e, t)) return !0;
25
25
  if (!e || !t || typeof e != "object" || typeof t != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
26
26
  const o = e, r = t, n = Object.keys(o);
27
- return n.length === Object.keys(r).length && n.every((a) => Object.prototype.hasOwnProperty.call(r, a) && q(o[a], r[a]));
27
+ return n.length === Object.keys(r).length && n.every((s) => Object.prototype.hasOwnProperty.call(r, s) && B(o[s], r[s]));
28
28
  }
29
29
  function Le(e, t) {
30
30
  if (t) {
31
31
  if (e.scope !== t.scope || e.id !== t.id || e.version !== t.version) throw P("文档版本已变化,请刷新后重新打开");
32
32
  if (e.revision < t.revision || t.state !== "building" && (e.revision !== t.revision || e.state !== t.state)) throw P("文档修订发生回退或终态被修改");
33
- if (e.pageCount < t.pageCount || e.bytes < t.bytes || !q(e.plan, t.plan)) throw P("文档已提交边界回退或计划头被修改");
34
- if (t.state !== "building" && !q(e, t)) throw P("终态文档清单被修改");
33
+ if (e.pageCount < t.pageCount || e.bytes < t.bytes || !B(e.plan, t.plan)) throw P("文档已提交边界回退或计划头被修改");
34
+ if (t.state !== "building" && !B(e, t)) throw P("终态文档清单被修改");
35
35
  }
36
36
  }
37
37
  function Ue(e, t, o) {
38
38
  const r = Q(e, { maxBytes: Me, check: () => T(t.signal), error: (l, c) => P(c) });
39
39
  if (!Fe(r.manifest) || !Array.isArray(r.pages)) throw P("文档页窗口清单无效");
40
- const { manifest: n, pages: a, nextPage: E } = r;
40
+ const { manifest: n, pages: s, nextPage: E } = r;
41
41
  if (Q(n, { maxBytes: 1e6, error: (l, c) => P(c) }), Le(n, o), t.version !== void 0 && t.version !== n.version) throw P("文档返回了不同版本");
42
42
  const d = Math.min(t.fromPage, n.pageCount);
43
- if (a.length > t.limit || E !== d + a.length || E > n.pageCount || d < n.pageCount && a.length === 0) throw P("文档页窗口边界无效");
44
- if (!se({ ...n.plan, pages: a }).ok) throw P("文档页内容无效");
43
+ if (s.length > t.limit || E !== d + s.length || E > n.pageCount || d < n.pageCount && s.length === 0) throw P("文档页窗口边界无效");
44
+ if (!ae({ ...n.plan, pages: s }).ok) throw P("文档页内容无效");
45
45
  return r;
46
46
  }
47
47
  function ee(e) {
48
48
  const t = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
49
- let r, n = 0, a = 0, E = !1;
50
- function d(s, g) {
51
- const f = new TextEncoder().encode(JSON.stringify(g)).byteLength, w = t.get(s);
52
- for (w && (n -= w.bytes), t.delete(s), t.set(s, { page: g, bytes: f }), n += f; t.size > Ne || n > ke; ) {
49
+ let r, n = 0, s = 0, E = !1;
50
+ function d(a, g) {
51
+ const f = new TextEncoder().encode(JSON.stringify(g)).byteLength, w = t.get(a);
52
+ for (w && (n -= w.bytes), t.delete(a), t.set(a, { page: g, bytes: f }), n += f; t.size > Ne || n > ke; ) {
53
53
  const m = t.keys().next().value;
54
54
  n -= t.get(m).bytes, t.delete(m);
55
55
  }
56
56
  }
57
- function l(s) {
58
- const g = o.get(s);
57
+ function l(a) {
58
+ const g = o.get(a);
59
59
  if (g) return g;
60
- const f = new AbortController(), w = a, m = { fromPage: s, limit: De, version: r?.version, signal: f.signal }, v = { controller: f, users: 0, promise: B(Promise.resolve().then(() => (T(f.signal), e.load({ ...m }))), f.signal).then((y) => {
61
- if (T(f.signal), w !== a) throw P("文档加载已被替换");
60
+ const f = new AbortController(), w = s, m = { fromPage: a, limit: De, version: r?.version, signal: f.signal }, v = { controller: f, users: 0, promise: q(Promise.resolve().then(() => (T(f.signal), e.load({ ...m }))), f.signal).then((y) => {
61
+ if (T(f.signal), w !== s) throw P("文档加载已被替换");
62
62
  const b = Ue(y, m, r);
63
- return r = b.manifest, b.pages.forEach((_, h) => d(s + h, _)), b;
63
+ return r = b.manifest, b.pages.forEach((_, h) => d(a + h, _)), b;
64
64
  }).finally(() => {
65
- o.get(s) === v && o.delete(s);
65
+ o.get(a) === v && o.delete(a);
66
66
  }) };
67
- return o.set(s, v), v;
67
+ return o.set(a, v), v;
68
68
  }
69
- async function c(s, g) {
70
- if (T(g), E || !Number.isSafeInteger(s) || s < 0 || s >= 1e5) throw P("文档页索引无效或预览已关闭");
71
- const f = t.get(s);
69
+ async function c(a, g) {
70
+ if (T(g), E || !Number.isSafeInteger(a) || a < 0 || a >= 1e5) throw P("文档页索引无效或预览已关闭");
71
+ const f = t.get(a);
72
72
  if (f && r)
73
- return t.delete(s), t.set(s, f), A({ manifest: r, page: f.page });
74
- const w = s, m = l(w);
73
+ return t.delete(a), t.set(a, f), x({ manifest: r, page: f.page });
74
+ const w = a, m = l(w);
75
75
  m.users++;
76
76
  try {
77
- const v = await B(m.promise, g);
78
- if (T(g), s >= v.manifest.pageCount && (v.manifest.pageCount > 0 || s > 0)) throw P("页码超出文档范围");
79
- const y = v.pages[s - w];
80
- if (!y && s < v.manifest.pageCount) throw P("目标页未返回,请缩小页窗口");
81
- return A({ manifest: v.manifest, ...y ? { page: y } : {} });
77
+ const v = await q(m.promise, g);
78
+ if (T(g), a >= v.manifest.pageCount && (v.manifest.pageCount > 0 || a > 0)) throw P("页码超出文档范围");
79
+ const y = v.pages[a - w];
80
+ if (!y && a < v.manifest.pageCount) throw P("目标页未返回,请缩小页窗口");
81
+ return x({ manifest: v.manifest, ...y ? { page: y } : {} });
82
82
  } finally {
83
83
  --m.users === 0 && o.get(w) === m && (o.delete(w), m.controller.abort());
84
84
  }
85
85
  }
86
86
  function p() {
87
- a++;
88
- for (const s of o.values()) s.controller.abort();
87
+ s++;
88
+ for (const a of o.values()) a.controller.abort();
89
89
  o.clear(), t.clear(), n = 0, r = void 0;
90
90
  }
91
91
  return { load: c, reset: p, dispose: () => {
@@ -96,10 +96,10 @@ function ee(e) {
96
96
  return n;
97
97
  } };
98
98
  }
99
- const je = ["aria-busy"], Be = {
99
+ const je = ["aria-busy"], qe = {
100
100
  class: "mrp-document-status",
101
101
  role: "status"
102
- }, qe = {
102
+ }, Be = {
103
103
  key: 0,
104
104
  class: "mrp-document-error",
105
105
  role: "alert"
@@ -113,10 +113,10 @@ const je = ["aria-busy"], Be = {
113
113
  },
114
114
  emits: ["loaded", "error", "exported"],
115
115
  setup(e, { expose: t, emit: o }) {
116
- const r = e, n = o, a = Se(), E = D(() => _e(a.value, r.preset)), d = D(() => ({ ...Te, ...E.value.messages, ...r.messages })), l = j(), c = j(), p = O(1), s = O(!1), g = O(!1), f = O(""), w = O(!1);
116
+ const r = e, n = o, s = Se(), E = D(() => _e(s.value, r.preset)), d = D(() => ({ ...Te, ...E.value.messages, ...r.messages })), l = j(), c = j(), p = O(1), a = O(!1), g = O(!1), f = O(""), w = O(!1);
117
117
  let m = ee(r.source), v = 0, y = !1, b, _;
118
- const h = async () => A(c.value), W = O(""), G = D(() => !!r.source.export && l.value?.state === "complete" && l.value.pageCount > 0 && !w.value), ie = D(() => {
119
- if (s.value) return d.value.documentLoading;
118
+ const h = async () => x(c.value), W = O(""), z = D(() => !!r.source.export && l.value?.state === "complete" && l.value.pageCount > 0 && !w.value), ie = D(() => {
119
+ if (a.value) return d.value.documentLoading;
120
120
  const i = l.value;
121
121
  return i ? (i.state === "building" ? d.value.documentBuilding : i.state === "failed" ? d.value.documentFailed : d.value.documentComplete).replace("{pages}", String(i.pageCount)) : "";
122
122
  });
@@ -124,38 +124,38 @@ const je = ["aria-busy"], Be = {
124
124
  f.value = i instanceof Error ? i.message : String(i), n("error", f.value);
125
125
  }
126
126
  function M() {
127
- v++, b?.abort(), _?.abort(), b = void 0, _ = void 0, s.value = !1, g.value = !1;
127
+ v++, b?.abort(), _?.abort(), b = void 0, _ = void 0, a.value = !1, g.value = !1;
128
128
  }
129
129
  function ce(i) {
130
- if (i.target instanceof Element && i.target.closest("input,textarea,select,[contenteditable=true]") || i.ctrlKey || i.metaKey || i.altKey || s.value || g.value || !l.value?.pageCount) return;
130
+ if (i.target instanceof Element && i.target.closest("input,textarea,select,[contenteditable=true]") || i.ctrlKey || i.metaKey || i.altKey || a.value || g.value || !l.value?.pageCount) return;
131
131
  const C = { PageDown: p.value + 1, PageUp: p.value - 1, Home: 1, End: l.value.pageCount }[i.key];
132
- C !== void 0 && (i.preventDefault(), i.stopPropagation(), x(Math.max(1, Math.min(C, l.value.pageCount))));
132
+ C !== void 0 && (i.preventDefault(), i.stopPropagation(), A(Math.max(1, Math.min(C, l.value.pageCount))));
133
133
  }
134
- async function x(i) {
134
+ async function A(i) {
135
135
  if (!Number.isSafeInteger(i) || i < 1 || l.value && i > l.value.pageCount) throw new S("param", d.value.pageJumpInvalid ?? "请输入有效页码");
136
136
  b?.abort();
137
137
  const R = new AbortController(), C = ++v;
138
- b = R, s.value = !0, f.value = "";
138
+ b = R, a.value = !0, f.value = "";
139
139
  try {
140
140
  const u = await m.load(i - 1, R.signal);
141
141
  if (T(R.signal), C !== v) return;
142
- l.value = u.manifest, p.value = i, w.value = !1, c.value = { ...u.manifest.plan, pages: u.page ? [u.page] : [] }, W.value = JSON.stringify([u.manifest.scope, u.manifest.id, u.manifest.version, i]), n("loaded", A(u.manifest));
142
+ l.value = u.manifest, p.value = i, w.value = !1, c.value = { ...u.manifest.plan, pages: u.page ? [u.page] : [] }, W.value = JSON.stringify([u.manifest.scope, u.manifest.id, u.manifest.version, i]), n("loaded", x(u.manifest));
143
143
  } catch (u) {
144
144
  !R.signal.aborted && C === v && (w.value = !0, L(u));
145
145
  } finally {
146
- C === v && (s.value = !1, b = void 0);
146
+ C === v && (a.value = !1, b = void 0);
147
147
  }
148
148
  }
149
- async function z() {
150
- M(), m.reset(), w.value = !!c.value, l.value = void 0, await x(1);
149
+ async function G() {
150
+ M(), m.reset(), w.value = !!c.value, l.value = void 0, await A(1);
151
151
  }
152
152
  async function H(i) {
153
153
  const R = r.source, C = l.value;
154
- if (!R.export || !C || !G.value || s.value || g.value) throw new S("export", d.value.documentFullExport);
154
+ if (!R.export || !C || !z.value || a.value || g.value) throw new S("export", d.value.documentFullExport);
155
155
  const u = new AbortController();
156
156
  _ = u, g.value = !0;
157
157
  try {
158
- const I = await B(R.export({ version: C.version, format: i, signal: u.signal }), u.signal);
158
+ const I = await q(R.export({ version: C.version, format: i, signal: u.signal }), u.signal);
159
159
  if (T(u.signal), Re(I, i), R !== r.source || l.value?.version !== C.version || I.stats.pages !== C.pageCount) throw new S("export", "完整文档导出的版本或页数不一致");
160
160
  return n("exported", I), I;
161
161
  } finally {
@@ -174,30 +174,30 @@ const je = ["aria-busy"], Be = {
174
174
  }
175
175
  }
176
176
  return ve(() => r.source, () => {
177
- M(), m.dispose(), m = ee(r.source), c.value = void 0, l.value = void 0, y && x(1);
177
+ M(), m.dispose(), m = ee(r.source), c.value = void 0, l.value = void 0, y && A(1);
178
178
  }), ye(() => {
179
- y = !0, x(1);
179
+ y = !0, A(1);
180
180
  }), he(() => {
181
181
  y = !1, M(), m.dispose();
182
- }), t({ reload: z, gotoPage: x, cancel: M, export: H, state: D(() => A({ manifest: l.value ?? null, currentPage: p.value, loading: s.value, exporting: g.value, error: f.value })) }), (i, R) => (k(), N("section", {
182
+ }), t({ reload: G, gotoPage: A, cancel: M, export: H, state: D(() => x({ manifest: l.value ?? null, currentPage: p.value, loading: a.value, exporting: g.value, error: f.value })) }), (i, R) => (k(), N("section", {
183
183
  class: "mrp-document",
184
- style: we({ ...Ee(Ae)(E.value.theme), height: e.height }),
185
- "aria-busy": s.value || g.value,
184
+ style: we({ ...Ee(xe)(E.value.theme), height: e.height }),
185
+ "aria-busy": a.value || g.value,
186
186
  onKeydownCapture: ce
187
187
  }, [
188
- J("div", Be, [
188
+ J("div", qe, [
189
189
  J("span", null, F(ie.value), 1),
190
- s.value || g.value ? (k(), N("button", {
190
+ a.value || g.value ? (k(), N("button", {
191
191
  key: 0,
192
192
  type: "button",
193
193
  onClick: M
194
194
  }, F(d.value.documentCancel), 1)) : (k(), N("button", {
195
195
  key: 1,
196
196
  type: "button",
197
- onClick: z
197
+ onClick: G
198
198
  }, F(d.value.documentRefresh), 1))
199
199
  ]),
200
- f.value ? (k(), N("div", qe, F(f.value), 1)) : $("", !0),
200
+ f.value ? (k(), N("div", Be, F(f.value), 1)) : $("", !0),
201
201
  c.value ? (k(), Pe(fe, {
202
202
  key: 1,
203
203
  "report-id": W.value,
@@ -210,7 +210,7 @@ const je = ["aria-busy"], Be = {
210
210
  prefill: !1,
211
211
  "data-comparison": !1,
212
212
  "show-params": !1,
213
- "show-export": G.value,
213
+ "show-export": z.value,
214
214
  "show-print": !1,
215
215
  "show-pdf-window": !1,
216
216
  "show-settings": !1,
@@ -222,7 +222,7 @@ const je = ["aria-busy"], Be = {
222
222
  Z(ge, {
223
223
  messages: d.value,
224
224
  formats: ["pdf", "xlsx"],
225
- busy: s.value || g.value,
225
+ busy: a.value || g.value,
226
226
  onExport: ue
227
227
  }, null, 8, ["messages", "busy"])
228
228
  ]),
@@ -231,16 +231,16 @@ const je = ["aria-busy"], Be = {
231
231
  "page-count": l.value?.pageCount ?? 0,
232
232
  "current-page": p.value,
233
233
  messages: d.value,
234
- busy: s.value || g.value,
235
- onGoto: x
234
+ busy: a.value || g.value,
235
+ onGoto: A
236
236
  }, null, 8, ["page-count", "current-page", "messages", "busy"])
237
237
  ]),
238
238
  _: 1
239
239
  }, 8, ["report-id", "messages", "preset", "show-export"])) : $("", !0)
240
240
  ], 44, je));
241
241
  }
242
- }), ct = /* @__PURE__ */ Ie(Ve, [["__scopeId", "data-v-69238bdb"]]);
243
- function ut(e) {
242
+ }), ut = /* @__PURE__ */ Ie(Ve, [["__scopeId", "data-v-69238bdb"]]);
243
+ function lt(e) {
244
244
  const t = le(e), o = async (r) => {
245
245
  if (r.reportIds.length === 0) throw new Y("缺少报表 ID");
246
246
  for (const n of r.reportIds)
@@ -250,7 +250,10 @@ function ut(e) {
250
250
  };
251
251
  return o.getParamDefs = t.getParamDefs, o;
252
252
  }
253
- const We = Object.freeze({
253
+ function We() {
254
+ return Object.freeze({ query: "", searching: !1, matchIndex: 0, matchCount: 0, current: null });
255
+ }
256
+ const ze = Object.freeze({
254
257
  loading: !1,
255
258
  hasPlan: !1,
256
259
  pageCount: 0,
@@ -262,8 +265,8 @@ const We = Object.freeze({
262
265
  error: null,
263
266
  pdfFont: Object.freeze({ status: "unchecked", fontUrl: "" })
264
267
  });
265
- function lt() {
266
- const e = j(null), t = () => e.value?.state ?? We, o = Object.freeze({
268
+ function ft() {
269
+ const e = j(null), t = () => e.value?.state ?? ze, o = Object.freeze({
267
270
  get loading() {
268
271
  return t().loading;
269
272
  },
@@ -347,8 +350,8 @@ function lt() {
347
350
  }
348
351
  return {
349
352
  ref(n) {
350
- const a = n;
351
- e.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;
353
+ const s = n;
354
+ e.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;
352
355
  },
353
356
  ready: D(() => e.value !== null),
354
357
  state: o,
@@ -380,13 +383,13 @@ function lt() {
380
383
  gotoPage(n) {
381
384
  r().gotoPage(n);
382
385
  },
383
- async setParams(n, a) {
384
- await r().setParams(n, a);
386
+ async setParams(n, s) {
387
+ await r().setParams(n, s);
385
388
  },
386
- async importExcel(n, a) {
389
+ async importExcel(n, s) {
387
390
  const E = r();
388
391
  if (!E.importExcel) throw new S("config", "旧自定义控制器未提供 Excel 导入");
389
- return E.importExcel(n, a);
392
+ return E.importExcel(n, s);
390
393
  },
391
394
  getPlan() {
392
395
  return r().getPlan?.() ?? null;
@@ -399,36 +402,37 @@ function lt() {
399
402
  redo: async () => await r().redo?.() ?? !1,
400
403
  restoreChanges: async () => await r().restoreChanges?.() ?? !1,
401
404
  getSelection: () => r().getSelection?.() ?? null,
402
- focusCell: async (n, a) => await r().focusCell?.(n, a) ?? !1,
405
+ getSearchState: () => r().getSearchState?.() ?? We(),
406
+ focusCell: async (n, s) => await r().focusCell?.(n, s) ?? !1,
403
407
  focusField: async (n) => await r().focusField?.(n) ?? !1,
404
408
  copySelection: () => r().copySelection?.() ?? "",
405
409
  pasteSelection: async (n) => await r().pasteSelection?.(n) ?? !1
406
410
  };
407
411
  }
408
- function ft() {
412
+ function dt() {
409
413
  return be(Oe, null);
410
414
  }
411
415
  function V(e) {
412
416
  return !!e && typeof e == "object" && !Array.isArray(e);
413
417
  }
414
418
  function Ge(e) {
415
- return Array.isArray(e) && e.every((t) => V(t) && typeof t.code == "string" && typeof t.message == "string" && ["info", "warning", "error"].includes(t.severity) && (t.path === void 0 || typeof t.path == "string") && xe(t));
419
+ return Array.isArray(e) && e.every((t) => V(t) && typeof t.code == "string" && typeof t.message == "string" && ["info", "warning", "error"].includes(t.severity) && (t.path === void 0 || typeof t.path == "string") && Ae(t));
416
420
  }
417
- function ae(e) {
421
+ function se(e) {
418
422
  return typeof e == "number" && Number.isFinite(e) && (!Number.isInteger(e) || Number.isSafeInteger(e));
419
423
  }
420
- function ze(e) {
421
- return e == null || typeof e == "string" || typeof e == "boolean" || ae(e);
422
- }
423
424
  function He(e) {
424
- return e === void 0 || typeof e == "string" && !!e.trim() || ae(e);
425
+ return e == null || typeof e == "string" || typeof e == "boolean" || se(e);
425
426
  }
426
- function Ke(e, t) {
427
- return Array.isArray(e) && e.every((o) => V(o) && Number.isSafeInteger(o.editIndex) && o.editIndex >= 0 && o.editIndex < t && typeof o.code == "string" && typeof o.message == "string" && ze(o.currentValue) && He(o.revision));
427
+ function Ke(e) {
428
+ return e === void 0 || typeof e == "string" && !!e.trim() || se(e);
428
429
  }
429
430
  function Ye(e, t) {
431
+ return Array.isArray(e) && e.every((o) => V(o) && Number.isSafeInteger(o.editIndex) && o.editIndex >= 0 && o.editIndex < t && typeof o.code == "string" && typeof o.message == "string" && He(o.currentValue) && Ke(o.revision));
432
+ }
433
+ function Je(e, t) {
430
434
  let o;
431
- if (!V(e) || typeof e.revision != "string" || !e.revision.trim() ? o = "非空 revision(请先在适配器解包业务响应)" : e.sourceToken !== void 0 && typeof e.sourceToken != "string" ? o = "字符串 sourceToken" : e.diagnostics !== void 0 && !Ge(e.diagnostics) ? o = "结构化 diagnostics" : e.conflicts !== void 0 && !Ke(e.conflicts, t) && (o = "有效 editIndex/code/message/currentValue/revision conflicts"), o) throw new S("edit", `ReportProvider.save 必须返回${o};服务器可能已提交,请重新查询确认后再编辑`);
435
+ if (!V(e) || typeof e.revision != "string" || !e.revision.trim() ? o = "非空 revision(请先在适配器解包业务响应)" : e.sourceToken !== void 0 && typeof e.sourceToken != "string" ? o = "字符串 sourceToken" : e.diagnostics !== void 0 && !Ge(e.diagnostics) ? o = "结构化 diagnostics" : e.conflicts !== void 0 && !Ye(e.conflicts, t) && (o = "有效 editIndex/code/message/currentValue/revision conflicts"), o) throw new S("edit", `ReportProvider.save 必须返回${o};服务器可能已提交,请重新查询确认后再编辑`);
432
436
  }
433
437
  function te(e) {
434
438
  return typeof e == "function" ? e() : e;
@@ -437,49 +441,49 @@ function re(e, t) {
437
441
  const o = new Set(e.flatMap((r) => r.source?.[t] === void 0 ? [] : [String(r.source[t])]));
438
442
  return o.size === 1 ? [...o][0] : void 0;
439
443
  }
440
- function ne(e, t, o, r, n, a = !1) {
441
- return typeof e == "function" ? e() : a ? r ?? n?.[o] ?? re(t, o) ?? e : re(t, o) ?? r ?? e ?? n?.[o];
444
+ function ne(e, t, o, r, n, s = !1) {
445
+ return typeof e == "function" ? e() : s ? r ?? n?.[o] ?? re(t, o) ?? e : re(t, o) ?? r ?? e ?? n?.[o];
442
446
  }
443
- function Je(e, t, o) {
447
+ function $e(e, t, o) {
444
448
  const r = t.query, n = e.reportId === void 0;
445
449
  if (n && (!r || r.reportIds.length !== 1)) throw new S("config", "自动业务保存需要当前成功查询的单个报表上下文");
446
- const a = e.reportId === void 0 ? r.reportIds[0] : te(e.reportId);
447
- if (!a.trim()) throw new S("config", "业务保存缺少报表 ID");
450
+ const s = e.reportId === void 0 ? r.reportIds[0] : te(e.reportId);
451
+ if (!s.trim()) throw new S("config", "业务保存缺少报表 ID");
448
452
  if (n && new Set(o.map((c) => c.source?.sourceScope)).size > 1) throw new oe("atomic");
449
- const E = { ...te(e.params ?? r?.params ?? {}) }, d = r?.sources.filter((c) => c.reportId === a) ?? [], l = d.length === 1 ? d[0] : void 0;
453
+ const E = { ...te(e.params ?? r?.params ?? {}) }, d = r?.sources.filter((c) => c.reportId === s) ?? [], l = d.length === 1 ? d[0] : void 0;
450
454
  return {
451
- reportId: a,
455
+ reportId: s,
452
456
  params: E,
453
457
  source: l,
454
458
  automatic: n,
455
- identity: JSON.stringify([a, E, r?.queryId, r?.sources])
459
+ identity: JSON.stringify([s, E, r?.queryId, r?.sources])
456
460
  };
457
461
  }
458
- function $e(e) {
462
+ function Xe(e) {
459
463
  return e.requestId ?? globalThis.crypto?.randomUUID?.() ?? `mr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
460
464
  }
461
- function Xe(e, t = {}) {
465
+ function Ze(e, t = {}) {
462
466
  if (!e.save) throw new S("config", "ReportProvider.save 未配置,无法启用业务保存");
463
- let o = "", r, n, a = 0;
464
- function E(c, p, s) {
465
- c.conflicts?.length || p !== o || s !== a || (r = c.revision, c.sourceToken !== void 0 && (n = c.sourceToken));
467
+ let o = "", r, n, s = 0;
468
+ function E(c, p, a) {
469
+ c.conflicts?.length || p !== o || a !== s || (r = c.revision, c.sourceToken !== void 0 && (n = c.sourceToken));
466
470
  }
467
471
  async function d(c, p) {
468
472
  if (p.signal.aborted) throw p.signal.reason ?? new DOMException("Aborted", "AbortError");
469
- const { reportId: s, params: g, identity: f, source: w, automatic: m } = Je(t, p, c.edits), v = ++a;
473
+ const { reportId: a, params: g, identity: f, source: w, automatic: m } = $e(t, p, c.edits), v = ++s;
470
474
  if (f !== o && (o = f, r = void 0, n = void 0), t.requireSource !== !1 && c.edits.some((h) => !h.source)) throw new oe("missing");
471
475
  const y = await e.save({
472
- reportId: s,
476
+ reportId: a,
473
477
  params: g,
474
478
  signal: p.signal,
475
479
  requestId: c.requestId,
476
480
  action: p.action,
477
- edits: A(c.edits),
481
+ edits: x(c.edits),
478
482
  expectedRevision: ne(t.expectedRevision, c.edits, "revision", r, w, m),
479
483
  sourceToken: ne(t.sourceToken, c.edits, "sourceToken", n, w, m)
480
484
  });
481
485
  if (p.signal.aborted) throw p.signal.reason ?? new DOMException("Aborted", "AbortError");
482
- Ye(y, c.edits.length), y.diagnostics?.forEach((h) => Ce(() => t.onDiagnostic?.(h)));
486
+ Je(y, c.edits.length), y.diagnostics?.forEach((h) => Ce(() => t.onDiagnostic?.(h)));
483
487
  const b = y.diagnostics?.filter((h) => h.severity === "error");
484
488
  if (b?.length) throw new S("edit", b.map((h) => h.message).join(";"), { diagnostics: b });
485
489
  const _ = y.conflicts?.map((h) => ({
@@ -501,66 +505,66 @@ function Xe(e, t = {}) {
501
505
  validation: t.validation,
502
506
  validateBatch: t.validateBatch,
503
507
  saveBatch: d,
504
- save: (c, p) => d({ requestId: $e(p), edits: [A(c)] }, p)
508
+ save: (c, p) => d({ requestId: Xe(p), edits: [x(c)] }, p)
505
509
  };
506
- return pe(l, () => Xe(e, t)), l;
510
+ return pe(l, () => Ze(e, t)), l;
507
511
  }
508
512
  export {
509
- Lt as DEFAULT_CALCULATION_MESSAGES,
510
- Ut as DEFAULT_DATA_REVIEW_MESSAGES,
511
- jt as DEFAULT_MESSAGES,
513
+ Ut as DEFAULT_CALCULATION_MESSAGES,
514
+ jt as DEFAULT_DATA_REVIEW_MESSAGES,
515
+ qt as DEFAULT_MESSAGES,
512
516
  Bt as DEFAULT_PRINT_MESSAGES,
513
- qt as DEFAULT_THEME,
514
- tr as MACH_REPORT_CONFIG_KEY,
517
+ Vt as DEFAULT_THEME,
518
+ rr as MACH_REPORT_CONFIG_KEY,
515
519
  Oe as MACH_REPORT_CONTROLLER_KEY,
516
- rr as MACH_REPORT_FETCHER_KEY,
517
- nr as MACH_REPORT_PDF_EXPORTER_KEY,
520
+ nr as MACH_REPORT_FETCHER_KEY,
521
+ or as MACH_REPORT_PDF_EXPORTER_KEY,
518
522
  S as MachReportError,
519
523
  sr as MachReportPreview,
520
- Vt as PARAM_OPTIONS_MESSAGES,
524
+ Wt as PARAM_OPTIONS_MESSAGES,
521
525
  Y as PlanLoadError,
522
- mt as REPORT_EXPORT_FORMATS,
523
- vt as REPORT_PREVIEW_TOOLS,
524
- yt as ReportDataComparisonPanel,
525
- ct as ReportDocumentPreview,
526
+ vt as REPORT_EXPORT_FORMATS,
527
+ yt as REPORT_PREVIEW_TOOLS,
528
+ ht as ReportDataComparisonPanel,
529
+ ut as ReportDocumentPreview,
526
530
  ge as ReportExportMenu,
527
531
  de as ReportPagination,
528
- Wt as ReportParamPanel,
529
- ht as ReportPrefillPanel,
532
+ zt as ReportParamPanel,
533
+ wt as ReportPrefillPanel,
530
534
  fe as ReportPreview,
531
- wt as ReportPrintResourceError,
532
- Et as ReportTaskStatus,
533
- Pt as ReportToolbar,
534
- bt as ReportValidationPanel,
535
+ Et as ReportPrintResourceError,
536
+ Pt as ReportTaskStatus,
537
+ bt as ReportToolbar,
538
+ Rt as ReportValidationPanel,
535
539
  Gt as SILENT_LOGGER,
536
- Rt as buildPrintDocument,
537
- Ct as buildWordHtml,
538
- St as createDefaultPdfExporter,
539
- _t as createFetchRequest,
540
- ut as createLocalFetcher,
541
- Tt as createPrintCalibrationPlan,
542
- Xe as createProviderEditing,
540
+ Ct as buildPrintDocument,
541
+ St as buildWordHtml,
542
+ _t as createDefaultPdfExporter,
543
+ Tt as createFetchRequest,
544
+ lt as createLocalFetcher,
545
+ xt as createPrintCalibrationPlan,
546
+ Ze as createProviderEditing,
543
547
  At as createReportStoragePreferences,
544
- zt as defineMachReportConfig,
545
- Ht as defineMachReportPreset,
546
- xt as joinReportIds,
547
- ar as machReportPlugin,
548
- It as normalizeReportIds,
549
- Kt as normalizeReportLoadError,
550
- Ot as preparePrintResources,
551
- Yt as printCalibration,
552
- Dt as printPlans,
553
- Jt as provideMachReportConfig,
554
- $t as resolveCalculationMessages,
548
+ Ht as defineMachReportConfig,
549
+ Kt as defineMachReportPreset,
550
+ It as joinReportIds,
551
+ ir as machReportPlugin,
552
+ Ot as normalizeReportIds,
553
+ Yt as normalizeReportLoadError,
554
+ Dt as preparePrintResources,
555
+ Jt as printCalibration,
556
+ Mt as printPlans,
557
+ $t as provideMachReportConfig,
558
+ Xt as resolveCalculationMessages,
555
559
  _e as resolveConfig,
556
- Xt as resolveDataReviewMessages,
557
- Zt as snapshotPrintOptions,
558
- Ae as themeToCssVars,
559
- Qt as toErrorDetail,
560
- lt as useMachReport,
560
+ Zt as resolveDataReviewMessages,
561
+ Qt as snapshotPrintOptions,
562
+ xe as themeToCssVars,
563
+ er as toErrorDetail,
564
+ ft as useMachReport,
561
565
  Se as useMachReportConfig,
562
- Mt as usePageWindow,
563
- kt as usePrintExport,
564
- ft as useReportPreview,
565
- Nt as useZoom
566
+ kt as usePageWindow,
567
+ Nt as usePrintExport,
568
+ dt as useReportPreview,
569
+ Ft as useZoom
566
570
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agile-team/mach-report",
3
- "version": "2.26.2",
3
+ "version": "2.27.0",
4
4
  "description": "独立的 TypeScript 报表引擎:模板分页、DOM/Canvas/PDF/Excel 输出与 Vue 3 预览组件",
5
5
  "type": "module",
6
6
  "sideEffects": [