@agile-team/mach-report 2.12.0 → 2.14.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 +27 -3
- package/dist/ExcelBindingWizard-CLT2p7P3.cjs +1 -0
- package/dist/ExcelBindingWizard-CvsWR8Ga.js +1485 -0
- package/dist/{ParamEditor-BLaE5q5W.js → ParamEditor-CflQV3eQ.js} +191 -187
- package/dist/ParamEditor-vIDzvpPV.cjs +1 -0
- package/dist/ReportBatchPanel-DkxTzBkD.cjs +1 -0
- package/dist/{ReportBatchPanel-B5ClP9tm.js → ReportBatchPanel-LqVgiqp7.js} +3 -3
- package/dist/ReportPreview-CvbqLUzM.cjs +6 -0
- package/dist/ReportPreview-D_ywJ_-H.js +4533 -0
- package/dist/{ReportTemplateLibrary-BZB-XWjj.js → ReportTemplateLibrary-MjWEtc7X.js} +1 -1
- package/dist/ReportTemplateLibrary-cQ1sqNYo.cjs +1 -0
- package/dist/RuleEditor-BaR6xUiI.cjs +1 -0
- package/dist/RuleEditor-ChuXMlei.js +2037 -0
- package/dist/TemplateOutlinePanel-BHKP89Xz.cjs +1 -0
- package/dist/TemplateOutlinePanel-Dci6aRn1.js +96 -0
- package/dist/TemplateReusePanel-B7Gmyc1z.js +388 -0
- package/dist/TemplateReusePanel-CY5eO2Sh.cjs +1 -0
- package/dist/TemplateReviewPanel-DjlX3xpt.js +592 -0
- package/dist/TemplateReviewPanel-JvZe9_4G.cjs +1 -0
- package/dist/{batch-mRqhhhjt.js → batch-DzaTNLWI.js} +23 -16
- package/dist/batch-xMkqYiTr.cjs +1 -0
- package/dist/config-0UIohTS7.cjs +1 -0
- package/dist/{config-B612mw0x.js → config-Dt9NtCPl.js} +227 -186
- package/dist/data-explanation-BktvER5B.cjs +1 -0
- package/dist/data-explanation-C_J6jYNi.js +16 -0
- package/dist/designer-Ci1LizA9.js +5020 -0
- package/dist/designer-rtmVIIdN.cjs +2 -0
- package/dist/designer.cjs +1 -2
- package/dist/designer.d.cts +306 -3
- package/dist/designer.d.ts +306 -3
- package/dist/designer.js +21 -4266
- package/dist/font-loader-DHto6Lra.js +297 -0
- package/dist/font-loader-vhCT8znW.cjs +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +182 -1
- package/dist/index.d.ts +182 -1
- package/dist/index.js +728 -628
- package/dist/{template-review-BzpcI-tR.js → json-snapshot-BeFT3Tso.js} +867 -637
- package/dist/json-snapshot-D1NTP2oI.cjs +2 -0
- package/dist/pdf-8UPQebOE.js +36288 -0
- package/dist/pdf-AyJGb22z.cjs +101 -0
- package/dist/pdf.cjs +1 -101
- package/dist/pdf.js +9 -36579
- package/dist/plugin-BGKf-Tqg.js +22 -0
- package/dist/{plugin-BDTU4D94.cjs → plugin-CktLH_Iy.cjs} +1 -1
- package/dist/{region-binding-workflow-CcUq8W2Q.js → region-binding-workflow-DEJbhpCv.js} +1 -1
- package/dist/server/node.d.cts +46 -11
- package/dist/server/node.d.ts +46 -11
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +294 -280
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +107 -12
- package/dist/server.d.ts +107 -12
- package/dist/server.js +713 -453
- package/dist/style.css +1 -1
- package/dist/template-bindings-BJR4k7qZ.cjs +1 -0
- package/dist/template-bindings-Daui7hLF.js +252 -0
- package/dist/template-fragments-CLkGo6To.js +187 -0
- package/dist/template-fragments-DFUpq5QM.cjs +1 -0
- package/dist/template-outline-B3xVkzSv.cjs +1 -0
- package/dist/template-outline-CFenM1PV.js +88 -0
- package/dist/{template-registry-BjE1VS6g.js → template-registry-COXDEJEM.js} +1 -1
- package/dist/{useLocalDraft-C07SYRnC.js → useLocalDraft-BnhcxXk_.js} +1 -1
- package/dist/{useLocalDraft-Yiw1wFgI.cjs → useLocalDraft-CioIfDb6.cjs} +1 -1
- package/dist/{validate-DbgEM1Hh.js → validate-CkQBWCeg.js} +3 -3
- package/dist/vue/async.d.cts +72 -2
- package/dist/vue/async.d.ts +72 -2
- package/dist/vue/index.d.cts +124 -5
- package/dist/vue/index.d.ts +124 -5
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +5 -5
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +78 -71
- package/dist/{workbook-session-BPb3TMnT.js → workbook-session-BfK1yHOO.js} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +46 -11
- package/dist/worker.d.ts +46 -11
- package/dist/worker.js +59 -55
- package/dist/xlsx.js +3 -3
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-CeAf4QSE.js +0 -1465
- package/dist/ExcelBindingWizard-y0mT-AHR.cjs +0 -1
- package/dist/ParamEditor-MBBC7lUE.cjs +0 -1
- package/dist/ReportBatchPanel-Dc-SDkYA.cjs +0 -1
- package/dist/ReportPreview-DWXROHBP.cjs +0 -6
- package/dist/ReportPreview-DiNXhQI0.js +0 -4138
- package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +0 -1
- package/dist/RuleEditor-ChRzNQuF.cjs +0 -1
- package/dist/RuleEditor-DzAmW5YH.js +0 -2024
- package/dist/TemplateReviewPanel-BKofGrV9.js +0 -222
- package/dist/TemplateReviewPanel-DwtOcLue.cjs +0 -1
- package/dist/batch-Bt3Fd27Z.cjs +0 -1
- package/dist/config-BRoLo2oj.cjs +0 -1
- package/dist/plugin-Cd5G2QQn.js +0 -22
- package/dist/record-bindings-By_UKZ2g.cjs +0 -1
- package/dist/record-bindings-D-5jQlTj.js +0 -196
- package/dist/template-review-BfCC8Ng9.cjs +0 -2
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { shallowRef as q, ref as x, computed as M, watch as V, onBeforeUnmount as D, defineComponent as O, openBlock as o, createElementBlock as n, unref as a, createElementVNode as l, toDisplayString as e, createTextVNode as R, withDirectives as z, isRef as B, vModelSelect as P, createCommentVNode as d, Fragment as S, normalizeClass as j, renderList as I, vModelCheckbox as U } from "vue";
|
|
2
|
-
import { reviewReportTemplate as A } from "@agile-team/mach-report";
|
|
3
|
-
import { TEMPLATE_REVIEW_MESSAGES as L } from "./designer.js";
|
|
4
|
-
import { _ as $ } from "./_plugin-vue_export-helper-8SL1F89S.js";
|
|
5
|
-
function F(u) {
|
|
6
|
-
const g = q(), f = x("20"), k = x(!1), t = x(!1), i = x(!1), h = x(""), b = q(), y = M(() => new Set(u.document.template.pages.flatMap((r) => r.components).flatMap((r) => r.kind === "list" && r.tree ? [r.dataset] : []))), w = M(() => y.value.size > 0);
|
|
7
|
-
let p = 0, c;
|
|
8
|
-
function C() {
|
|
9
|
-
p++, clearTimeout(c), t.value = !1, i.value = !!g.value, h.value = "";
|
|
10
|
-
}
|
|
11
|
-
for (const r of [() => u.document, () => u.previous]) V(r, () => {
|
|
12
|
-
k.value = !1, C();
|
|
13
|
-
}, { deep: !0, flush: "sync" });
|
|
14
|
-
for (const r of [() => u.datasets, () => u.dataSchemas, () => u.formats]) V(r, C, { deep: !0, flush: "sync" });
|
|
15
|
-
V([f, k], C, { flush: "sync" }), D(() => {
|
|
16
|
-
p++, clearTimeout(c);
|
|
17
|
-
});
|
|
18
|
-
const T = M(() => g.value?.issues.filter((r) => r.severity === "error").length ?? 0);
|
|
19
|
-
function E() {
|
|
20
|
-
clearTimeout(c);
|
|
21
|
-
const r = p;
|
|
22
|
-
t.value = !0, h.value = "", c = setTimeout(() => {
|
|
23
|
-
if (r !== p) return;
|
|
24
|
-
const m = Number(f.value), v = Object.fromEntries(Object.entries(u.datasets ?? {}).map(([s, _]) => [s, m < 0 || y.value.has(s) ? _ : _.slice(0, m)]));
|
|
25
|
-
try {
|
|
26
|
-
const s = A(u.document, {
|
|
27
|
-
previous: u.previous,
|
|
28
|
-
dataSchemas: u.dataSchemas,
|
|
29
|
-
formats: u.formats,
|
|
30
|
-
allowBreakingChanges: k.value,
|
|
31
|
-
...w.value && m > 0 ? { maxSampleRows: m } : {},
|
|
32
|
-
fixtures: m === 0 ? [] : [{ name: f.value, datasets: v }]
|
|
33
|
-
});
|
|
34
|
-
if (r !== p) return;
|
|
35
|
-
g.value = s, i.value = !1, b.value = { requested: f.value, rows: s.samples.reduce((_, N) => _ + N.rows, 0), datasets: m === 0 ? 0 : Object.keys(v).length, formats: [...u.formats ?? []] };
|
|
36
|
-
} catch (s) {
|
|
37
|
-
h.value = s instanceof Error ? s.message : String(s);
|
|
38
|
-
} finally {
|
|
39
|
-
r === p && (t.value = !1);
|
|
40
|
-
}
|
|
41
|
-
}, 0);
|
|
42
|
-
}
|
|
43
|
-
return { report: g, sampleSize: f, acknowledged: k, running: t, stale: i, failure: h, checkedScope: b, hasTree: w, errors: T, run: E };
|
|
44
|
-
}
|
|
45
|
-
const G = ["aria-label", "aria-busy"], H = ["disabled"], W = { class: "mr-review-controls" }, J = ["aria-label", "disabled"], K = { value: "0" }, Q = { value: "20" }, X = { value: "100" }, Y = { value: "-1" }, Z = {
|
|
46
|
-
key: 0,
|
|
47
|
-
class: "mr-review-note"
|
|
48
|
-
}, ee = {
|
|
49
|
-
key: 1,
|
|
50
|
-
class: "is-error",
|
|
51
|
-
role: "alert"
|
|
52
|
-
}, te = {
|
|
53
|
-
key: 2,
|
|
54
|
-
class: "mr-review-stale",
|
|
55
|
-
role: "status"
|
|
56
|
-
}, se = {
|
|
57
|
-
key: 3,
|
|
58
|
-
class: "mr-review-note"
|
|
59
|
-
}, ae = {
|
|
60
|
-
key: 0,
|
|
61
|
-
class: "mr-review-summary",
|
|
62
|
-
role: "status"
|
|
63
|
-
}, le = {
|
|
64
|
-
key: 0,
|
|
65
|
-
class: "mr-review-note"
|
|
66
|
-
}, oe = {
|
|
67
|
-
key: 1,
|
|
68
|
-
class: "mr-review-note"
|
|
69
|
-
}, ne = {
|
|
70
|
-
key: 2,
|
|
71
|
-
class: "mr-review-list"
|
|
72
|
-
}, re = { key: 0 }, ue = ["onClick"], ie = {
|
|
73
|
-
key: 3,
|
|
74
|
-
class: "mr-review-note"
|
|
75
|
-
}, ce = {
|
|
76
|
-
key: 4,
|
|
77
|
-
class: "mr-review-ack"
|
|
78
|
-
}, ve = {
|
|
79
|
-
key: 0,
|
|
80
|
-
class: "mr-review-note"
|
|
81
|
-
}, de = {
|
|
82
|
-
key: 1,
|
|
83
|
-
class: "mr-review-list"
|
|
84
|
-
}, me = ["onClick"], pe = {
|
|
85
|
-
key: 0,
|
|
86
|
-
class: "mr-review-scope"
|
|
87
|
-
}, fe = { key: 0 }, he = { class: "mr-review-note" }, _e = /* @__PURE__ */ O({
|
|
88
|
-
__name: "TemplateReviewPanel",
|
|
89
|
-
props: {
|
|
90
|
-
document: {},
|
|
91
|
-
previous: {},
|
|
92
|
-
datasets: {},
|
|
93
|
-
dataSchemas: {},
|
|
94
|
-
formats: {},
|
|
95
|
-
messages: {}
|
|
96
|
-
},
|
|
97
|
-
emits: ["locate"],
|
|
98
|
-
setup(u, { emit: g }) {
|
|
99
|
-
const f = u, k = g, t = M(() => ({ ...L, ...f.messages })), { report: i, sampleSize: h, acknowledged: b, running: y, stale: w, failure: p, checkedScope: c, hasTree: C, errors: T, run: E } = F(f);
|
|
100
|
-
function r(m) {
|
|
101
|
-
const v = /\.pages\[(\d+)\]\.components\[(\d+)\]/.exec(m);
|
|
102
|
-
k("locate", { path: m, ...v ? { pageIndex: Number(v[1]), componentIndex: Number(v[2]) } : {} });
|
|
103
|
-
}
|
|
104
|
-
return (m, v) => (o(), n("section", {
|
|
105
|
-
class: "mr-template-review",
|
|
106
|
-
"aria-label": t.value.title,
|
|
107
|
-
"aria-busy": a(y)
|
|
108
|
-
}, [
|
|
109
|
-
l("header", null, [
|
|
110
|
-
l("strong", null, e(t.value.title), 1),
|
|
111
|
-
l("button", {
|
|
112
|
-
type: "button",
|
|
113
|
-
disabled: a(y),
|
|
114
|
-
onClick: v[0] || (v[0] = //@ts-ignore
|
|
115
|
-
(...s) => a(E) && a(E)(...s))
|
|
116
|
-
}, e(a(y) ? t.value.running : t.value.run), 9, H)
|
|
117
|
-
]),
|
|
118
|
-
l("div", W, [
|
|
119
|
-
l("label", null, [
|
|
120
|
-
R(e(t.value.samples), 1),
|
|
121
|
-
z(l("select", {
|
|
122
|
-
"onUpdate:modelValue": v[1] || (v[1] = (s) => B(h) ? h.value = s : null),
|
|
123
|
-
"aria-label": t.value.samples,
|
|
124
|
-
disabled: a(y)
|
|
125
|
-
}, [
|
|
126
|
-
l("option", K, e(t.value.none), 1),
|
|
127
|
-
l("option", Q, e(t.value.first20), 1),
|
|
128
|
-
l("option", X, e(t.value.first100), 1),
|
|
129
|
-
l("option", Y, e(t.value.all), 1)
|
|
130
|
-
], 8, J), [
|
|
131
|
-
[P, a(h)]
|
|
132
|
-
])
|
|
133
|
-
])
|
|
134
|
-
]),
|
|
135
|
-
a(C) ? (o(), n("p", Z, e(t.value.treeHint), 1)) : d("", !0),
|
|
136
|
-
a(p) ? (o(), n("p", ee, e(a(p)), 1)) : d("", !0),
|
|
137
|
-
a(w) ? (o(), n("p", te, e(t.value.stale), 1)) : d("", !0),
|
|
138
|
-
a(i) ? (o(), n(S, { key: 4 }, [
|
|
139
|
-
a(w) ? d("", !0) : (o(), n("div", ae, [
|
|
140
|
-
l("span", {
|
|
141
|
-
class: j({ "is-error": a(T) })
|
|
142
|
-
}, e(a(T)) + " " + e(t.value.errors), 3),
|
|
143
|
-
l("span", null, e(a(i).issues.length - a(T)) + " " + e(t.value.warnings), 1)
|
|
144
|
-
])),
|
|
145
|
-
l("section", null, [
|
|
146
|
-
l("h3", null, [
|
|
147
|
-
R(e(t.value.changes) + " ", 1),
|
|
148
|
-
l("small", null, e(a(i).changes?.totalChanges ?? 0), 1)
|
|
149
|
-
]),
|
|
150
|
-
u.previous ? a(i).changes?.totalChanges ? (o(), n("ol", ne, [
|
|
151
|
-
(o(!0), n(S, null, I(a(i).changes?.changes, (s, _) => (o(), n("li", { key: _ }, [
|
|
152
|
-
l("div", null, [
|
|
153
|
-
l("span", null, e(t.value.categories[s.category]) + " · " + e(t.value.kinds[s.kind]), 1),
|
|
154
|
-
s.breaking ? (o(), n("b", re, e(t.value.breaking), 1)) : d("", !0),
|
|
155
|
-
l("button", {
|
|
156
|
-
type: "button",
|
|
157
|
-
onClick: (N) => r(s.path)
|
|
158
|
-
}, e(t.value.locate), 9, ue)
|
|
159
|
-
]),
|
|
160
|
-
l("code", null, e(s.path), 1),
|
|
161
|
-
l("dl", null, [
|
|
162
|
-
s.before !== void 0 ? (o(), n(S, { key: 0 }, [
|
|
163
|
-
l("dt", null, e(t.value.before), 1),
|
|
164
|
-
l("dd", null, e(s.before), 1)
|
|
165
|
-
], 64)) : d("", !0),
|
|
166
|
-
s.after !== void 0 ? (o(), n(S, { key: 1 }, [
|
|
167
|
-
l("dt", null, e(t.value.after), 1),
|
|
168
|
-
l("dd", null, e(s.after), 1)
|
|
169
|
-
], 64)) : d("", !0)
|
|
170
|
-
])
|
|
171
|
-
]))), 128))
|
|
172
|
-
])) : (o(), n("p", oe, e(t.value.noChanges), 1)) : (o(), n("p", le, e(t.value.baseline), 1)),
|
|
173
|
-
a(i).changes?.truncated ? (o(), n("p", ie, e(t.value.truncated), 1)) : d("", !0),
|
|
174
|
-
a(i).changes?.breakingChanges ? (o(), n("label", ce, [
|
|
175
|
-
z(l("input", {
|
|
176
|
-
"onUpdate:modelValue": v[2] || (v[2] = (s) => B(b) ? b.value = s : null),
|
|
177
|
-
type: "checkbox"
|
|
178
|
-
}, null, 512), [
|
|
179
|
-
[U, a(b)]
|
|
180
|
-
]),
|
|
181
|
-
R(e(t.value.acknowledge), 1)
|
|
182
|
-
])) : d("", !0)
|
|
183
|
-
]),
|
|
184
|
-
l("section", null, [
|
|
185
|
-
l("h3", null, e(t.value.issues), 1),
|
|
186
|
-
a(i).issues.length ? (o(), n("ol", de, [
|
|
187
|
-
(o(!0), n(S, null, I(a(i).issues, (s, _) => (o(), n("li", { key: _ }, [
|
|
188
|
-
l("div", null, [
|
|
189
|
-
l("span", {
|
|
190
|
-
class: j({ "is-error": s.severity === "error" })
|
|
191
|
-
}, e(s.severity === "error" ? t.value.errors : t.value.warnings), 3),
|
|
192
|
-
l("button", {
|
|
193
|
-
type: "button",
|
|
194
|
-
onClick: (N) => k("locate", s)
|
|
195
|
-
}, e(t.value.locate), 9, me)
|
|
196
|
-
]),
|
|
197
|
-
l("p", null, e(s.message), 1),
|
|
198
|
-
l("code", null, e(s.path), 1)
|
|
199
|
-
]))), 128))
|
|
200
|
-
])) : (o(), n("p", ve, e(t.value.noIssues), 1))
|
|
201
|
-
]),
|
|
202
|
-
a(i).samples.length ? (o(), n("section", {
|
|
203
|
-
key: 1,
|
|
204
|
-
class: j({ "is-stale": a(w) })
|
|
205
|
-
}, [
|
|
206
|
-
l("h3", null, e(t.value.results), 1),
|
|
207
|
-
a(c) ? (o(), n("p", pe, [
|
|
208
|
-
R(e(t.value.scope) + " · " + e(a(c).requested === "-1" ? t.value.all : a(c).requested === "0" ? t.value.none : a(c).requested + " " + t.value.rows) + " · " + e(a(c).datasets) + " " + e(t.value.datasets) + " · " + e(a(c).rows) + " " + e(t.value.rows), 1),
|
|
209
|
-
a(c).formats.length ? (o(), n("span", fe, " · " + e(a(c).formats.join(" / ")), 1)) : d("", !0)
|
|
210
|
-
])) : d("", !0),
|
|
211
|
-
(o(!0), n(S, null, I(a(i).samples, (s) => (o(), n("p", {
|
|
212
|
-
key: s.name
|
|
213
|
-
}, e(s.name) + " · " + e(s.rows) + " " + e(t.value.rows) + " · " + e(s.pages) + " " + e(t.value.pages), 1))), 128))
|
|
214
|
-
], 2)) : d("", !0),
|
|
215
|
-
l("p", he, e(t.value.checked), 1)
|
|
216
|
-
], 64)) : (o(), n("p", se, e(t.value.empty), 1))
|
|
217
|
-
], 8, G));
|
|
218
|
-
}
|
|
219
|
-
}), we = /* @__PURE__ */ $(_e, [["__scopeId", "data-v-6d26056b"]]);
|
|
220
|
-
export {
|
|
221
|
-
we as default
|
|
222
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("@agile-team/mach-report"),B=require("./designer.cjs"),V=require("./_plugin-vue_export-helper-BLmdZLlg.cjs");function D(o){const f=e.shallowRef(),u=e.ref("20"),p=e.ref(!1),t=e.ref(!1),a=e.ref(!1),m=e.ref(""),k=e.shallowRef(),v=e.computed(()=>new Set(o.document.template.pages.flatMap(n=>n.components).flatMap(n=>n.kind==="list"&&n.tree?[n.dataset]:[]))),g=e.computed(()=>v.value.size>0);let i=0,r;function y(){i++,clearTimeout(r),t.value=!1,a.value=!!f.value,m.value=""}for(const n of[()=>o.document,()=>o.previous])e.watch(n,()=>{p.value=!1,y()},{deep:!0,flush:"sync"});for(const n of[()=>o.datasets,()=>o.dataSchemas,()=>o.formats])e.watch(n,y,{deep:!0,flush:"sync"});e.watch([u,p],y,{flush:"sync"}),e.onBeforeUnmount(()=>{i++,clearTimeout(r)});const E=e.computed(()=>f.value?.issues.filter(n=>n.severity==="error").length??0);function S(){clearTimeout(r);const n=i;t.value=!0,m.value="",r=setTimeout(()=>{if(n!==i)return;const c=Number(u.value),s=Object.fromEntries(Object.entries(o.datasets??{}).map(([l,d])=>[l,c<0||v.value.has(l)?d:d.slice(0,c)]));try{const l=_.reviewReportTemplate(o.document,{previous:o.previous,dataSchemas:o.dataSchemas,formats:o.formats,allowBreakingChanges:p.value,...g.value&&c>0?{maxSampleRows:c}:{},fixtures:c===0?[]:[{name:u.value,datasets:s}]});if(n!==i)return;f.value=l,a.value=!1,k.value={requested:u.value,rows:l.samples.reduce((d,h)=>d+h.rows,0),datasets:c===0?0:Object.keys(s).length,formats:[...o.formats??[]]}}catch(l){m.value=l instanceof Error?l.message:String(l)}finally{n===i&&(t.value=!1)}},0)}return{report:f,sampleSize:u,acknowledged:p,running:t,stale:a,failure:m,checkedScope:k,hasTree:g,errors:E,run:S}}const N=["aria-label","aria-busy"],w=["disabled"],b={class:"mr-review-controls"},C=["aria-label","disabled"],T={value:"0"},x={value:"20"},R={value:"100"},q={value:"-1"},M={key:0,class:"mr-review-note"},j={key:1,class:"is-error",role:"alert"},z={key:2,class:"mr-review-stale",role:"status"},F={key:3,class:"mr-review-note"},I={key:0,class:"mr-review-summary",role:"status"},L={key:0,class:"mr-review-note"},O={key:1,class:"mr-review-note"},P={key:2,class:"mr-review-list"},U={key:0},A=["onClick"],H={key:3,class:"mr-review-note"},$={key:4,class:"mr-review-ack"},G={key:0,class:"mr-review-note"},W={key:1,class:"mr-review-list"},J=["onClick"],K={key:0,class:"mr-review-scope"},Q={key:0},X={class:"mr-review-note"},Y=e.defineComponent({__name:"TemplateReviewPanel",props:{document:{},previous:{},datasets:{},dataSchemas:{},formats:{},messages:{}},emits:["locate"],setup(o,{emit:f}){const u=o,p=f,t=e.computed(()=>({...B.TEMPLATE_REVIEW_MESSAGES,...u.messages})),{report:a,sampleSize:m,acknowledged:k,running:v,stale:g,failure:i,checkedScope:r,hasTree:y,errors:E,run:S}=D(u);function n(c){const s=/\.pages\[(\d+)\]\.components\[(\d+)\]/.exec(c);p("locate",{path:c,...s?{pageIndex:Number(s[1]),componentIndex:Number(s[2])}:{}})}return(c,s)=>(e.openBlock(),e.createElementBlock("section",{class:"mr-template-review","aria-label":t.value.title,"aria-busy":e.unref(v)},[e.createElementVNode("header",null,[e.createElementVNode("strong",null,e.toDisplayString(t.value.title),1),e.createElementVNode("button",{type:"button",disabled:e.unref(v),onClick:s[0]||(s[0]=(...l)=>e.unref(S)&&e.unref(S)(...l))},e.toDisplayString(e.unref(v)?t.value.running:t.value.run),9,w)]),e.createElementVNode("div",b,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(t.value.samples),1),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[1]||(s[1]=l=>e.isRef(m)?m.value=l:null),"aria-label":t.value.samples,disabled:e.unref(v)},[e.createElementVNode("option",T,e.toDisplayString(t.value.none),1),e.createElementVNode("option",x,e.toDisplayString(t.value.first20),1),e.createElementVNode("option",R,e.toDisplayString(t.value.first100),1),e.createElementVNode("option",q,e.toDisplayString(t.value.all),1)],8,C),[[e.vModelSelect,e.unref(m)]])])]),e.unref(y)?(e.openBlock(),e.createElementBlock("p",M,e.toDisplayString(t.value.treeHint),1)):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createElementBlock("p",j,e.toDisplayString(e.unref(i)),1)):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("p",z,e.toDisplayString(t.value.stale),1)):e.createCommentVNode("",!0),e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.unref(g)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("span",{class:e.normalizeClass({"is-error":e.unref(E)})},e.toDisplayString(e.unref(E))+" "+e.toDisplayString(t.value.errors),3),e.createElementVNode("span",null,e.toDisplayString(e.unref(a).issues.length-e.unref(E))+" "+e.toDisplayString(t.value.warnings),1)])),e.createElementVNode("section",null,[e.createElementVNode("h3",null,[e.createTextVNode(e.toDisplayString(t.value.changes)+" ",1),e.createElementVNode("small",null,e.toDisplayString(e.unref(a).changes?.totalChanges??0),1)]),o.previous?e.unref(a).changes?.totalChanges?(e.openBlock(),e.createElementBlock("ol",P,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).changes?.changes,(l,d)=>(e.openBlock(),e.createElementBlock("li",{key:d},[e.createElementVNode("div",null,[e.createElementVNode("span",null,e.toDisplayString(t.value.categories[l.category])+" · "+e.toDisplayString(t.value.kinds[l.kind]),1),l.breaking?(e.openBlock(),e.createElementBlock("b",U,e.toDisplayString(t.value.breaking),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",onClick:h=>n(l.path)},e.toDisplayString(t.value.locate),9,A)]),e.createElementVNode("code",null,e.toDisplayString(l.path),1),e.createElementVNode("dl",null,[l.before!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("dt",null,e.toDisplayString(t.value.before),1),e.createElementVNode("dd",null,e.toDisplayString(l.before),1)],64)):e.createCommentVNode("",!0),l.after!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("dt",null,e.toDisplayString(t.value.after),1),e.createElementVNode("dd",null,e.toDisplayString(l.after),1)],64)):e.createCommentVNode("",!0)])]))),128))])):(e.openBlock(),e.createElementBlock("p",O,e.toDisplayString(t.value.noChanges),1)):(e.openBlock(),e.createElementBlock("p",L,e.toDisplayString(t.value.baseline),1)),e.unref(a).changes?.truncated?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(t.value.truncated),1)):e.createCommentVNode("",!0),e.unref(a).changes?.breakingChanges?(e.openBlock(),e.createElementBlock("label",$,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[2]||(s[2]=l=>e.isRef(k)?k.value=l:null),type:"checkbox"},null,512),[[e.vModelCheckbox,e.unref(k)]]),e.createTextVNode(e.toDisplayString(t.value.acknowledge),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("section",null,[e.createElementVNode("h3",null,e.toDisplayString(t.value.issues),1),e.unref(a).issues.length?(e.openBlock(),e.createElementBlock("ol",W,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).issues,(l,d)=>(e.openBlock(),e.createElementBlock("li",{key:d},[e.createElementVNode("div",null,[e.createElementVNode("span",{class:e.normalizeClass({"is-error":l.severity==="error"})},e.toDisplayString(l.severity==="error"?t.value.errors:t.value.warnings),3),e.createElementVNode("button",{type:"button",onClick:h=>p("locate",l)},e.toDisplayString(t.value.locate),9,J)]),e.createElementVNode("p",null,e.toDisplayString(l.message),1),e.createElementVNode("code",null,e.toDisplayString(l.path),1)]))),128))])):(e.openBlock(),e.createElementBlock("p",G,e.toDisplayString(t.value.noIssues),1))]),e.unref(a).samples.length?(e.openBlock(),e.createElementBlock("section",{key:1,class:e.normalizeClass({"is-stale":e.unref(g)})},[e.createElementVNode("h3",null,e.toDisplayString(t.value.results),1),e.unref(r)?(e.openBlock(),e.createElementBlock("p",K,[e.createTextVNode(e.toDisplayString(t.value.scope)+" · "+e.toDisplayString(e.unref(r).requested==="-1"?t.value.all:e.unref(r).requested==="0"?t.value.none:e.unref(r).requested+" "+t.value.rows)+" · "+e.toDisplayString(e.unref(r).datasets)+" "+e.toDisplayString(t.value.datasets)+" · "+e.toDisplayString(e.unref(r).rows)+" "+e.toDisplayString(t.value.rows),1),e.unref(r).formats.length?(e.openBlock(),e.createElementBlock("span",Q," · "+e.toDisplayString(e.unref(r).formats.join(" / ")),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).samples,l=>(e.openBlock(),e.createElementBlock("p",{key:l.name},e.toDisplayString(l.name)+" · "+e.toDisplayString(l.rows)+" "+e.toDisplayString(t.value.rows)+" · "+e.toDisplayString(l.pages)+" "+e.toDisplayString(t.value.pages),1))),128))],2)):e.createCommentVNode("",!0),e.createElementVNode("p",X,e.toDisplayString(t.value.checked),1)],64)):(e.openBlock(),e.createElementBlock("p",F,e.toDisplayString(t.value.empty),1))],8,N))}}),Z=V._export_sfc(Y,[["__scopeId","data-v-6d26056b"]]);exports.default=Z;
|
package/dist/batch-Bt3Fd27Z.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";class m extends Error{constructor(t,n,r){super(n),this.code=t,this.path=r,this.name="ReportRuntimeError"}}function x(e){if(!e?.aborted)return;if(e.reason instanceof m)throw e.reason;const t=new Error("报表执行已取消");throw t.name="AbortError",Object.defineProperty(t,"cause",{value:e.reason}),t}function $(e,t,n){if(!Number.isFinite(n)||n<0)throw new m("budget",`${t} 的执行统计无效`,`$.budget.${t}`);const r=e[t];if(r!==void 0&&n>r)throw new m("budget",`${t} 超出预算 ${r}(实际 ${n})`,`$.budget.${t}`)}function q(e){for(const[t,n]of Object.entries(e)){if(n!==void 0&&(!Number.isFinite(n)||n<=0))throw new m("budget",`${t} 应为正有限数字`,`$.budget.${t}`);if(t!=="maxDurationMs"&&n!==void 0&&!Number.isSafeInteger(n))throw new m("budget",`${t} 应为正安全整数`,`$.budget.${t}`);if(t==="maxDurationMs"&&n!==void 0&&n>2147483647)throw new m("budget","maxDurationMs 不能超过 2147483647",`$.budget.${t}`)}}async function T(e,t,n){const r=new AbortController,o=()=>r.abort(e?.reason);e?.addEventListener("abort",o,{once:!0}),e?.aborted&&o();const a=Date.now(),c=t===void 0?void 0:setTimeout(()=>r.abort(new m("timeout",`报表执行超过 ${t}ms`)),t);let d;try{x(r.signal);const g=new Promise((u,i)=>{d=()=>{try{x(r.signal)}catch(h){i(h)}},r.signal.addEventListener("abort",d,{once:!0})}),s=await Promise.race([n(r.signal),g]);if(x(r.signal),t!==void 0&&Date.now()-a>t)throw new m("timeout",`报表执行超过 ${t}ms`);return s}finally{c!==void 0&&clearTimeout(c),d&&r.signal.removeEventListener("abort",d),e?.removeEventListener("abort",o)}}const L=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),y=(e,t)=>e>>>t|e<<32-t;function D(e,t,n){const r=new DataView(e.buffer,e.byteOffset+t,64);for(let o=0;o<16;o++)n[o]=r.getUint32(o*4);for(let o=16;o<64;o++){const a=n[o-15],c=n[o-2],d=y(a,7)^y(a,18)^a>>>3,g=y(c,17)^y(c,19)^c>>>10;n[o]=n[o-16]+d+n[o-7]+g}}function M(e,t){let n=e[0],r=e[1],o=e[2],a=e[3],c=e[4],d=e[5],g=e[6],s=e[7];for(let u=0;u<64;u++){const i=y(c,6)^y(c,11)^y(c,25),h=c&d^~c&g,f=s+i+h+L[u]+t[u]>>>0,b=y(n,2)^y(n,13)^y(n,22),w=n&r^n&o^r&o,S=b+w>>>0;s=g,g=d,d=c,c=a+f>>>0,a=o,o=r,r=n,n=f+S>>>0}e[0]=e[0]+n,e[1]=e[1]+r,e[2]=e[2]+o,e[3]=e[3]+a,e[4]=e[4]+c,e[5]=e[5]+d,e[6]=e[6]+g,e[7]=e[7]+s}function P(e){const t=new Uint8Array(Math.ceil((e.byteLength+9)/64)*64);t.set(e),t[e.byteLength]=128;const n=new DataView(t.buffer);return n.setUint32(t.length-8,Math.floor(e.byteLength/536870912)),n.setUint32(t.length-4,e.byteLength*8>>>0),t}const C=()=>new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),z=e=>Array.from(e,t=>t.toString(16).padStart(8,"0")).join("");async function U(e){const t=P(e),n=C(),r=new Uint32Array(64);for(let o=0;o<t.length;o+=64)o>0&&o%262144===0&&await new Promise(a=>setTimeout(a,0)),D(t,o,r),M(n,r);return z(n)}function _(e={}){const t={maxRecords:e.maxRecords??1e4,maxBytes:e.maxBytes??67108864,maxResultBytes:e.maxResultBytes??262144,controlReserveBytes:e.controlReserveBytes??4096,maxTombstones:e.maxTombstones??1e4,maxTombstoneBytes:e.maxTombstoneBytes??16777216};if(!Object.values(t).every(n=>Number.isSafeInteger(n)&&n>0)||t.controlReserveBytes<4096)throw new l("input","任务容量应为正整数,控制状态预留至少4096字节");return t}function v(e){return new TextEncoder().encode(p(e)).byteLength}function R(e,t){const n={scope:e.scope,id:e.id,revision:1,request:e.request,status:"queued",createdAt:e.createdAt,updatedAt:e.createdAt,attempt:0},r={...e};delete r.result;const o=e.result===void 0?0:v(e.result);if(o>t.maxResultBytes)throw new l("capacity","任务结果超过独立预算,请保存文件引用");return Math.max(v(n)+t.controlReserveBytes,v(r))+o}function N(e){return e.status!=="queued"&&e.status!=="running"}function k(e){const t={...e,tombstoneRetentionMs:e.tombstoneRetentionMs??6048e5,limit:e.limit??100};if(![t.now,t.terminalBefore].every(n=>Number.isSafeInteger(n)&&n>=0)||t.terminalBefore>t.now)throw new l("input","终态清理时间应为不超过当前时间的非负整数");if(![t.tombstoneRetentionMs,t.limit].every(n=>Number.isSafeInteger(n)&&n>0)||!Number.isSafeInteger(t.now+t.tombstoneRetentionMs))throw new l("input","幂等保留期与清理批量应为正整数");return t}async function B(e){const t=new TextEncoder().encode(p(e)),n=globalThis.crypto?.subtle;if(!n)return U(t);const r=await n.digest("SHA-256",t);return Array.from(new Uint8Array(r),o=>o.toString(16).padStart(2,"0")).join("")}async function H(e,t){if(!N(e))throw new l("input","只能归档终态任务");return{scope:e.scope,id:e.id,revision:e.revision,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,attempt:e.attempt,requestHash:await B(e.request),expiresAt:t}}class l extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportJobError"}}function J(e,t){if(typeof e!="string"||!e.trim()||e.length>256||typeof t!="string"||t!==t.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t))throw new l("input","任务范围应非空,ID应为1–128位安全标识")}function Z(e){const t=Array.isArray(e),n=Object.getPrototypeOf(e),r=Object.keys(e);if(n!==(t?Array.prototype:Object.prototype)&&!(n===null&&!t))throw new l("input","任务对象应为普通 JSON 对象");if(Object.getOwnPropertySymbols(e).length)throw new l("input","任务不能包含Symbol");if(Object.getOwnPropertyNames(e).filter(a=>!(t&&a==="length")).length!==r.length)throw new l("input","任务不能包含不可枚举属性");if(t&&(r.length!==e.length||r.some(a=>a!==String(Number(a))||!Number.isSafeInteger(Number(a))||Number(a)<0||Number(a)>=e.length)))throw new l("input","任务数组不能稀疏或包含额外属性");return r.sort()}function F(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(["__proto__","prototype","constructor"].includes(t)||n.get||n.set)throw new l("input","任务不能包含危险键或访问器");return n.value}function p(e,t={}){const n=t.maxNodes??2e4,r=t.maxCharacters??1e6;if(!Number.isSafeInteger(n)||n<1||n>2e4||!Number.isSafeInteger(r)||r<1||r>1e6)throw new l("input","任务JSON预算无效");let o=0,a=0;const c=new Set;function d(s,u){if(++o>n||u>32)throw new l("input","任务数据超过节点或深度预算");if(typeof s=="string"){if(a+=s.length,a>r)throw new l("input","任务文本超过预算");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))return s;if(!s||typeof s!="object"||c.has(s))throw new l("input","任务只允许无循环的有限 JSON 值");const i=Array.isArray(s),h=Z(s);c.add(s);const f=Object.create(null);for(const b of h){if(a+=b.length,a>r)throw new l("input","任务文本超过预算");f[b]=d(F(s,b),u+1)}return c.delete(s),i?Array.from({length:s.length},(b,w)=>f[String(w)]):f}const g=JSON.stringify(d(e,0));if(g.length>r)throw new l("input","任务序列化数据超过字符预算");return g}function A(e){return JSON.parse(JSON.stringify(e))}function E(e,t,n,r){if(J(t,n),e.scope!==t||e.id!==n||e.revision!==(r??0)+1||!Number.isSafeInteger(e.revision))throw new l("input","任务身份或修订不匹配");if(![e.createdAt,e.updatedAt,e.attempt].every(o=>Number.isSafeInteger(o)&&o>=0)||!["queued","running","completed","failed","cancelled"].includes(e.status))throw new l("input","任务状态无效");if(e.lease&&(!e.lease.owner||!Number.isSafeInteger(e.lease.expiresAt)))throw new l("input","任务租约无效");if(!e.request||typeof e.request.kind!="string"||!e.request.kind.trim()||e.request.kind.length>128)throw new l("input","任务类型无效");p(e.request.payload,{maxNodes:19e3,maxCharacters:75e4}),p(e)}function O(e,t){if(e&&(e.createdAt!==t.createdAt||p(e.request)!==p(t.request)))throw new l("input","任务创建时间与请求不可变更,请使用新任务ID")}function j(e,t){return e.status==="queued"||e.status==="running"&&(e.lease?.expiresAt??0)<=t}function V(e={}){const t=new Map,n=new Map,r=_(e);let o=0,a=0,c=Promise.resolve();const d=(s,u)=>JSON.stringify([s,u]),g=s=>{const u=c.then(s);return c=u.then(()=>{},()=>{}),u};return{read:async(s,u)=>{await c;const i=t.get(d(s,u));return i?A(i):void 0},readTombstone:async(s,u)=>{await c;const i=n.get(d(s,u));return i?A(i):void 0},candidates:async(s,u)=>(await c,Array.from(t.values()).filter(i=>j(i,s)).sort((i,h)=>i.createdAt-h.createdAt).slice(0,u).map(A)),compareAndSwap:async(s,u,i,h)=>{E(h,s,u,i);const f=A(h);return g(async()=>{const b=d(s,u),w=t.get(b);if((w?.revision??null)!==i||n.has(b))return!1;O(w,f);const S=o-(w?R(w,r):0)+R(f,r);if(S>r.maxBytes||!w&&t.size>=r.maxRecords)throw new l("capacity","任务容量已满,请清理终态任务或扩大显式预算");return t.set(b,f),o=S,!0})},prune:async s=>{const u=k(s);return g(async()=>{const i={archived:0,expired:0};for(const[h,f]of n)f.expiresAt>u.now||i.expired>=u.limit||(n.delete(h),a-=v(f),i.expired++);for(const[h,f]of t){if(!N(f)||f.updatedAt>u.terminalBefore||i.archived+i.expired>=u.limit)continue;const b=await H(f,u.now+u.tombstoneRetentionMs),w=v(b);if(n.size>=r.maxTombstones||a+w>r.maxTombstoneBytes)break;n.set(h,b),a+=w,t.delete(h),o-=R(f,r),i.archived++}return i})}}}function I(e,t=100){if(!Number.isSafeInteger(t)||t<1||t>1e3||!Array.isArray(e)||e.length>t)throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");const n=JSON.parse(p(e)),r=new Set;for(const o of n){if(!o||typeof o.id!="string"||o.id!==o.id.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(o.id)||r.has(o.id))throw new TypeError("批量行 ID 应唯一且为安全标识");if(!o.params||Array.isArray(o.params)||typeof o.params!="object"||Object.values(o.params).some(a=>typeof a!="string"))throw new TypeError("批量参数应为字符串字典");r.add(o.id)}return n}function K(e,t){if(!t)return;const n={completed:0,total:e.length,failed:0,cancelled:0};for(const r of e)r&&(n.completed++,r.status==="failed"&&n.failed++,r.status==="cancelled"&&n.cancelled++);try{t(n)}catch{}}async function W(e,t,n={}){const r=n.concurrency??2;if(!Number.isSafeInteger(r)||r<1||r>16)throw new RangeError("批量并发应为 1–16");if(n.failure!==void 0&&n.failure!=="continue"&&n.failure!=="stop")throw new TypeError("批量失败策略无效");const o=I(e,n.maxCases??100);if(!o.length)throw new RangeError("批量生成至少需要一组参数");const a=Array.from({length:o.length}),c=new AbortController,d=()=>c.abort(n.signal?.reason);n.signal?.addEventListener("abort",d,{once:!0}),n.signal?.aborted&&d();let g=0,s=!1;async function u(){for(;g<o.length;){const i=g++,h=o[i],f={id:h.id,index:i};if(s||c.signal.aborted)a[i]={...f,status:"cancelled"};else try{x(c.signal);const b=await t(h,{index:i,signal:c.signal});a[i]={...f,status:"completed",value:b}}catch(b){c.signal.aborted?a[i]={...f,status:"cancelled"}:(a[i]={...f,status:"failed",error:{name:b instanceof Error?b.name:"Error",message:b instanceof Error?b.message:String(b)}},n.failure==="stop"&&(s=!0))}K(a,n.onProgress)}}try{await Promise.all(Array.from({length:Math.min(r,o.length)},u))}finally{n.signal?.removeEventListener("abort",d)}return a}exports.ReportJobError=l;exports.ReportRuntimeError=m;exports.assertBudget=$;exports.checkJobIdentity=J;exports.cloneJob=A;exports.controlled=T;exports.createMemoryReportJobStore=V;exports.jobByteLength=v;exports.jobRequestHash=B;exports.runReportBatch=W;exports.runnableJob=j;exports.serializeJobJson=p;exports.snapshotReportBatchCases=I;exports.throwIfAborted=x;exports.validateBudget=q;exports.validateJobRecord=E;exports.validateJobTransition=O;
|
package/dist/config-BRoLo2oj.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const a=require("vue"),y=require("@agile-team/mach-report"),T=require("./_plugin-vue_export-helper-BLmdZLlg.cjs"),C=require("./injection-keys-Db_DyLkm.cjs");class b extends Error{constructor(n,l,r){super(l),this.name="MachReportError",this.code=n,this.cause=r}}function L(e){return e instanceof b?{code:e.code,cause:e.cause}:{code:"render",cause:e}}function N(e){if(e instanceof b)return e;if(e instanceof y.ReportParamValidationError)return new b("param",e.message,e);if(e instanceof y.ReportSourceError)return new b(e.code,e.message,e.cause);if(e instanceof Error){const n={params:"param",config:"config",validate:"validate",fetch:"fetch"},l=e.code;if(typeof l=="string"&&Object.prototype.hasOwnProperty.call(n,l))return new b(n[l],e.message,e)}return new b("fetch",e instanceof Error?e.message:"预览加载失败",e)}let V=0;function O(){return`mrp-params-${++V}`}function S(e,n,l){const r=(Array.isArray(n)?n.find(s=>s?.field===e.field)?.label:void 0)??e.field;return e.code==="required"?l.paramRequired.replace("{label}",r):(l.paramInvalid??"{label}:{message}").replace("{label}",r).replace("{message}",e.message)}function _(e){const n=a.ref({}),l=a.ref(!1);function r(){const p={};for(const f of Array.isArray(e.defs.value)?e.defs.value:[])typeof f?.field=="string"&&Object.defineProperty(p,f.field,{value:e.params()[f.field]??f.defaultValue??"",writable:!0,enumerable:!0,configurable:!0});n.value=p,l.value=!1}r(),a.watch(e.defs,r),a.watch(e.reportIds,r),a.watch(()=>JSON.stringify(e.params()),r);const s=a.computed(()=>y.validateReportParams(e.defs.value,{...e.params(),...n.value})),i=a.computed(()=>!l.value&&s.value.issues.length>0&&s.value.issues.every(p=>p.code==="required"));function g(){const p=s.value;if(!p.ok){const u=p.issues[0];return{quiet:i.value,error:new b(u.code==="definition"?"config":"param",S(u,e.defs.value,e.messages()),{issues:p.issues})}}const f={...p.values},P=new Set(e.defs.value.filter(u=>u.defaultValue!==void 0).map(u=>u.field));for(const[u,x]of Object.entries(f))x===""&&!P.has(u)&&delete f[u];return{params:f,quiet:!1}}return{values:n,attempted:l,validation:s,pendingRequired:i,reset:r,query:g}}const H={key:0,class:"mrp-params-title"},U={class:"mrp-params-grid"},G=["id"],$={key:0,class:"mrp-param-star"},K=["value","disabled","aria-labelledby","aria-invalid","aria-describedby","aria-required","onChange"],j=["disabled","hidden"],W=["value"],z=["aria-labelledby"],J=["value","disabled","min","max","aria-label","aria-invalid","aria-describedby","aria-required","onInput"],Y=["type","inputmode","maxlength","placeholder","value","disabled","min","max","step","aria-labelledby","aria-invalid","aria-describedby","aria-required","onInput"],X=["id"],Q={key:1,class:"mrp-params-actions"},Z=["disabled"],ee=["disabled"],ae=a.defineComponent({__name:"ReportParamPanel",props:{defs:{},modelValue:{},messages:{},attempted:{type:Boolean},issues:{default:void 0},showActions:{type:Boolean,default:!0},showTitle:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","query","reset"],setup(e,{expose:n,emit:l}){const r=e,s=l,i=a.ref({...r.modelValue}),g=a.ref(null),p=O();a.watch(()=>r.modelValue,o=>{i.value={...o}});const f=a.computed(()=>r.issues??y.validateReportParams(r.defs,i.value).issues),P=a.computed(()=>(Array.isArray(r.defs)?r.defs:[]).filter(o=>o&&typeof o.field=="string").map((o,c)=>({def:o,id:`${p}-${c}`,label:o.label??o.field,value:i.value[o.field]??"",error:r.attempted?f.value.find(t=>t.field===o.field):void 0})));function u(o,c){i.value={...i.value,[o]:c},s("update:modelValue",{...i.value})}function x(o){return o.type==="number"?"number":o.type==="date"||o.type==="month"?o.type:"text"}function v(o,c){return o.split("/")[c]??""}function F(o,c,t){return t?!!v(o,0)!=!!v(o,1)?!v(o,c)||void 0:!0:void 0}function D(o,c,t){const d=[v(i.value[o]??"",0),v(i.value[o]??"",1)];d[c]=t,u(o,d.every(h=>!h)?"":d.join("/"))}function w(o){o.isComposing||s("query")}function I(){g.value?.querySelector('[aria-invalid="true"]')?.focus()}return n({focusInvalid:I}),(o,c)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"root",ref:g,class:"mrp-params"},[e.showTitle!==!1?(a.openBlock(),a.createElementBlock("span",H,a.toDisplayString(e.messages.paramsTitle),1)):a.createCommentVNode("",!0),a.createElementVNode("div",U,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(P.value,t=>(a.openBlock(),a.createElementBlock("label",{key:t.id,class:a.normalizeClass(["mrp-param",{"mrp-param-missing":!!t.error}])},[a.createElementVNode("span",{id:`${t.id}-label`,class:"mrp-param-label"},[a.createTextVNode(a.toDisplayString(t.label),1),t.def.required?(a.openBlock(),a.createElementBlock("i",$,"*")):a.createCommentVNode("",!0)],8,G),(t.def.type??"text")==="select"?(a.openBlock(),a.createElementBlock("select",{key:0,class:"mrp-param-input",value:t.value,disabled:e.disabled,"aria-labelledby":`${t.id}-label`,"aria-invalid":t.error?!0:void 0,"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onChange:d=>u(t.def.field,d.target.value),onKeydown:a.withKeys(w,["enter"])},[a.createElementVNode("option",{value:"",disabled:t.def.required,hidden:t.def.required},a.toDisplayString(t.def.placeholder??(e.messages.paramSelectPlaceholder??"请选择{label}").replace("{label}",t.label)),9,j),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.def.options??[],d=>(a.openBlock(),a.createElementBlock("option",{key:d.value,value:d.value},a.toDisplayString(d.label),9,W))),128))],40,K)):t.def.type==="dateRange"?(a.openBlock(),a.createElementBlock("div",{key:1,class:"mrp-param-range",role:"group","aria-labelledby":`${t.id}-label`},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList([e.messages.paramRangeStart??"开始日期",e.messages.paramRangeEnd??"结束日期"],(d,h)=>(a.openBlock(),a.createElementBlock("input",{key:h,class:"mrp-param-input",type:"date",value:v(t.value,h),disabled:e.disabled,min:t.def.min,max:t.def.max,"aria-label":`${t.label} · ${d}`,"aria-invalid":F(t.value,h,t.error),"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onInput:q=>D(t.def.field,h,q.target.value),onKeydown:a.withKeys(w,["enter"])},null,40,J))),128))],8,z)):(a.openBlock(),a.createElementBlock("input",{key:2,class:"mrp-param-input",type:x(t.def),inputmode:t.def.type==="year"?"numeric":void 0,maxlength:t.def.type==="year"?4:void 0,placeholder:t.def.placeholder??(e.messages.paramTextPlaceholder??"请输入{label}").replace("{label}",t.label),value:t.value,disabled:e.disabled,min:t.def.min,max:t.def.max,step:t.def.type==="number"?"any":void 0,"aria-labelledby":`${t.id}-label`,"aria-invalid":t.error?!0:void 0,"aria-describedby":t.error?`${t.id}-error`:void 0,"aria-required":t.def.required||void 0,onInput:d=>u(t.def.field,d.target.value),onKeydown:a.withKeys(w,["enter"])},null,40,Y)),t.error?(a.openBlock(),a.createElementBlock("small",{key:3,id:`${t.id}-error`,class:"mrp-param-error",role:"status"},a.toDisplayString(a.unref(S)(t.error,e.defs,e.messages)),9,X)):a.createCommentVNode("",!0)],2))),128))]),e.showActions!==!1?(a.openBlock(),a.createElementBlock("div",Q,[a.createElementVNode("button",{class:"mrp-nav mrp-param-query",type:"button",disabled:e.disabled,onClick:c[0]||(c[0]=t=>o.$emit("query"))},a.toDisplayString(e.messages.query),9,Z),a.createElementVNode("button",{class:"mrp-nav",type:"button",disabled:e.disabled,onClick:c[1]||(c[1]=t=>o.$emit("reset"))},a.toDisplayString(e.messages.reset),9,ee)])):a.createCommentVNode("",!0)],512))}}),te=T._export_sfc(ae,[["__scopeId","data-v-f64e743f"]]),k={calculationTitle:"选区计算",calculationLocal:"仅本地分析,不写回实绩、不重算原公式。请选取同一单位与量纲的数值。",calculationHint:"点击起点,Shift + 点击终点或方向键扩选。",calculationFormula:"计算方式",calculationExpression:"组合公式",calculationExpressionHint:"支持 SUM、AVERAGE/AVG、MIN、MAX、COUNT、MEDIAN 及 + - * / 和括号,不执行 Excel 公式;采用浮点数,精度仅用于展示。",calculationPrecision:"展示小数位",calculationRun:"计算选区",calculationCancel:"取消计算",calculationResult:"计算结果",calculationIncluded:"参与数值",calculationExcluded:"排除单元格",calculationEmpty:"选区没有可计算数值,计数为 0,其余结果为空。",calculationNoSelection:"先关闭设置并选择数据,再从底部工具栏打开选区计算。",calculationSum:"求和 SUM",calculationAverage:"平均值 AVERAGE",calculationMin:"最小值 MIN",calculationMax:"最大值 MAX",calculationCount:"数值计数 COUNT",calculationMedian:"中位数 MEDIAN",calculationCustom:"组合公式",calculationErrorSelection:"请选择同一明细区域中的数据。",calculationErrorLimit:"选区超过计算预算,请缩小范围后重试。",calculationErrorExpression:"公式无效,请使用支持的摘要名称、运算符与括号。",calculationErrorDivision:"除数不能为 0。",calculationErrorOverflow:"结果超出有效数值范围。",calculationErrorPrecision:"数值超出安全精度,或展示小数位不是 0 至 12 的整数。"};function re(e){const n={...k};for(const l of Object.keys(n)){const r=e[l];typeof r=="string"&&(n[l]=r)}return n}const M={...k,exportMenu:"导出",exportMenuDescription:"选择文件格式",clearSearch:"清除搜索",searchHint:"Enter 下一个 · Shift+Enter 上一个",searchNoMatches:"没有匹配内容",pageJump:"跳至页",pageJumpInvalid:"请输入有效页码",pageJumpHint:"Enter 跳转",pagination:"报表分页",columnSearchHint:"输入列名或字段标识",columnSearchShortcut:"↑ ↓ 选择 · Enter 定位",closeColumnDirectory:"关闭字段目录",columnResultsMore:"{count} 个匹配字段,显示前 {limit} 个;继续输入可缩小范围",columnCount:"{count} 个字段",settingsGeneral:"常规",settingsTools:"工具",settingsAdvanced:"高级",settingsAdvancedDescription:"按需开启分析能力,保持日常阅读简洁。",settingsCalculations:"启用选区计算",settingsCalculationsDescription:"选取数值后计算求和、平均值或组合公式,仅用于本地分析。",title:"报表预览",prevPage:"‹ 上一页",nextPage:"下一页 ›",pageInfo:"{cur} / {total}",fitWidth:"适宽",exportHtml:"导出 HTML",exportPdf:"导出 PDF",exportExcel:"导出 Excel",exportImage:"导出图片",exportWord:"导出 Word",exporting:"正在生成 {format}…",print:"打印",pdfWindow:"PDF 窗口",loading:"报表渲染中…",empty:"暂无预览数据",errorPrefix:"",retry:"重试",pdfFontUnavailable:"PDF 字体尚未就绪,请联系管理员检查字体配置;预览及其它导出仍可使用。",searchPlaceholder:"搜索报表内容",matchInfo:"{cur}/{total}",prevMatch:"‹",nextMatch:"›",thumbnails:"缩略图",paramsTitle:"查询条件",query:"查 询",reset:"重 置",paramRequired:"请填写{label}",paramInvalid:"{label}:{message}",paramPrompt:"请先完善查询条件",paramPromptDescription:"填写必填条件后点击查询,即可生成报表。",paramSelectPlaceholder:"请选择{label}",paramTextPlaceholder:"请输入{label}",paramRangeStart:"开始日期",paramRangeEnd:"结束日期",searching:"搜索中…",importExcel:"导入 Excel 模板",importing:"正在导入 Excel…",editCell:"编辑单元格",editingHint:"双击单元格编辑 · Enter 确认 · Esc 取消",saving:"正在保存修改…",editInvalidNumber:"请输入有效数字;清空表示无值",editInvalidBoolean:"请输入 true / false、是 / 否或 1 / 0",editConflict:"该单元格已变化,请重新打开编辑",settings:"设置",settingsDisplay:"阅读工具",settingsExport:"导出与打印",settingsData:"数据操作",settingsUnavailable:"需由接入方配置启用",settingsReset:"恢复默认",settingsClose:"关闭设置",search:"内容搜索",closeSearch:"关闭搜索",prevSearchMatch:"上一个匹配",nextSearchMatch:"下一个匹配",zoom:"缩放工具",settingsLocal:"按需启用工具,仅作用于当前预览。",editingLocal:"修改为本地草稿;不会自动写入业务数据库。",editingSaved:"修改将通过接入方配置的保存回调提交。",importLocal:"导入仅生成本地预览,不自动替换业务数据。",emptyDescription:"当前查询没有明细,请调整查询条件后重试。",undo:"撤销",redo:"重做",restoreChanges:"恢复来源值",changes:"修改明细",changesCount:"{count} 处修改",changesEmpty:"尚无修改",changesBefore:"来源值",changesAfter:"当前值",editAtomicRequired:"批量保存需要接入方提供原子 saveBatch 回调;本次未写入任何单元格。",clipboardLimit:"单次最多粘贴 10000 个单元格,请分批处理。",preferencesError:"偏好存储不可用,设置仍在当前预览中生效。",freezeHeaders:"冻结表头",frozenColumns:"冻结前列",sections:"工作表与章节",locateField:"定位字段",locateFieldPlaceholder:"输入字段标识,Enter 定位",locateFieldMissing:"未找到该字段,请核对字段标识。",importSummary:"Excel 导入摘要",importPreserved:"已导入 {sheets} 个工作表,保留内容、合并和样式。",importWarnings:"兼容性提示",importReadOnly:"公式、日期及受保护单元格保持只读;公式不重算。",conflicts:"保存冲突",editReadOnly:"选区包含只读或无权限单元格,本次修改未应用。",editMissing:"选区超出报表范围或缺少业务来源,请重新选择。",editRecalculationUnavailable:"此报表缺少重算会话或稳定数据来源,暂不支持编辑;请使用 reports/本地数据源重新加载。",editDuplicate:"选区包含同一业务字段的重复单元格,请缩小选区。",clipboardInvalid:"剪贴板内容无法识别,请使用矩形表格文本重新粘贴。",editSaved:"修改已通过保存回调确认",settingsPanes:"冻结窗格",columnDirectory:"字段目录",columnSearch:"搜索列名或字段",columnNoMatches:"未找到匹配字段",columnResults:"匹配字段",columnGroup:"明细区域",discardTitle:"保留当前修改?",discardDescription:"当前报表有尚未保存的输入或本地草稿,继续操作将替换这些内容。",discardKeep:"继续编辑",discardProceed:"放弃修改并继续",taskQuery:"正在获取数据…",taskValidate:"正在校验数据…",taskLayout:"正在生成版式…",taskAssets:"正在准备图片和字体…",taskEncode:"正在生成文件…",taskDownload:"正在准备下载…",taskPrint:"正在准备打印…",taskCancel:"取消任务",taskCancelled:"任务已取消,可重新操作。",diagnosticsSearch:"搜索提示、错误码或位置",diagnosticsMore:"共 {count} 条匹配,当前展示前 100 条;请搜索缩小范围。",diagnosticsTitle:"输出兼容性提示",diagnosticsLocate:"定位",diagnosticsLocation:"第 {page} 页 · 组件 {component}",diagnosticsStrict:"当前格式存在已知内容降级,请查看兼容性提示或选择其他输出格式。",diagnosticsDetails:"查看技术详情",diagnosticMissingImage:"图片或图表资源尚未准备完成,请重试或联系管理员。",diagnosticUnsupported:"当前输出格式会省略此内容,建议选择 PDF 或图片格式。",diagnosticUnsupportedStyle:"当前格式无法保留部分样式,请查看位置并选择适合的输出格式。",diagnosticImageFormat:"当前图片格式无法直接导出,请转换资源后重试。",diagnosticRichText:"文字内容会保留,部分字体与段落样式将简化。",diagnosticNested:"单元格中的嵌套内容会省略,单元格文字会保留。",diagnosticImageAsync:"图片需要完成加载后才能输出。",diagnosticImageDecode:"图片加载失败,请检查资源后重试。",diagnosticAssetFailed:"图表或图片生成失败,请重试或联系管理员。",diagnosticAssetBudget:"图片资源超出处理范围,请减少资源或缩小报表范围。"},R={emptyAccent:"#79a7e8",shellBg:"#f4f7fc",shellFg:"#334155",toolbarBg:"#ffffff",toolbarBorder:"#e4eaf3",toolbarFg:"#334155",btnFg:"#526078",btnBorder:"#dbe3ef",btnHoverBg:"#edf3ff",btnHoverFg:"#315fba",btnActiveBg:"#3569d4"};function A(e={}){return{...e,defaults:e.defaults??{},presets:e.presets??{}}}function ne(e){return e}const m={showExport:!0,showPrint:!0,showPdfWindow:!0,showSettings:!0,showParams:!0,gapPx:18,pdfFontUrl:"/simhei.ttf",logger:console},oe={warn:()=>{},info:()=>{}};function E(e,n){return{...e,...n,theme:{...e?.theme,...n?.theme},messages:{...e?.messages,...n?.messages},preview:{...e?.preview,...n?.preview},xlsx:{...e?.xlsx,...n?.xlsx},toolbar:{...e?.toolbar,...n?.toolbar},interaction:{...e?.interaction,...n?.interaction},output:{...e?.output,...n?.output}}}function le(e){return{showExport:e.showExport??m.showExport,showPrint:e.showPrint??m.showPrint,showPdfWindow:e.showPdfWindow??m.showPdfWindow,showSettings:e.showSettings??m.showSettings,showParams:e.showParams??m.showParams,gapPx:e.gapPx??m.gapPx}}function se(e,n){const l=n?e?.presets?.[n]:e?.defaultPreset?e?.presets?.[e.defaultPreset]:void 0,r=E(e?.defaults,l);return{...le(r),pdfFontUrl:r.pdfFontUrl??m.pdfFontUrl,theme:{...R,...r.theme},messages:{...M,...r.messages},logger:r.logger??m.logger,preview:{overscanPages:B(r.preview?.overscanPages,1,10,!0),searchDebounceMs:B(r.preview?.searchDebounceMs,200,2e3)},xlsx:{...r.xlsx},editable:r.editable??!1,excelImport:r.excelImport??!1,toolbar:{...r.toolbar},interaction:{...r.interaction},preferences:r.preferences,assets:r.assets,guardChanges:r.guardChanges??!0,beforeDiscard:r.beforeDiscard,output:{...r.output}}}function B(e,n,l,r=!1){if(e==null||!Number.isFinite(e))return n;const s=Math.max(0,Math.min(l,e));return r?Math.floor(s):s}function ie(e){const n={};return e.emptyAccent!=null&&(n["--mrp-empty-accent"]=e.emptyAccent),e.shellBg!=null&&(n["--mrp-shell-bg"]=e.shellBg),e.shellFg!=null&&(n["--mrp-shell-fg"]=e.shellFg),e.toolbarBg!=null&&(n["--mrp-toolbar-bg"]=e.toolbarBg),e.toolbarBorder!=null&&(n["--mrp-toolbar-border"]=e.toolbarBorder),e.toolbarFg!=null&&(n["--mrp-toolbar-fg"]=e.toolbarFg),e.btnFg!=null&&(n["--mrp-btn-fg"]=e.btnFg),e.btnBorder!=null&&(n["--mrp-btn-border"]=e.btnBorder),e.btnHoverBg!=null&&(n["--mrp-btn-hover-bg"]=e.btnHoverBg),e.btnHoverFg!=null&&(n["--mrp-btn-hover-fg"]=e.btnHoverFg),e.btnActiveBg!=null&&(n["--mrp-btn-active-bg"]=e.btnActiveBg),n}function ce(e){const n=a.inject(C.MACH_REPORT_CONFIG_KEY,null),l=a.computed(()=>{const r=n?.value??null,s="defaults"in e||"presets"in e||"defaultPreset"in e?A(e):{defaults:e,presets:{}};if(!r)return s;const i={...r.presets,...s.presets};for(const g of Object.keys(i))i[g]=E(E(r.presets[g],s.defaults),s.presets[g]);return{defaults:E(r.defaults,s.defaults),presets:i,defaultPreset:s.defaultPreset??r.defaultPreset}});a.provide(C.MACH_REPORT_CONFIG_KEY,l)}function de(){return a.inject(C.MACH_REPORT_CONFIG_KEY,a.computed(()=>null))}exports.DEFAULT_CALCULATION_MESSAGES=k;exports.DEFAULT_MESSAGES=M;exports.DEFAULT_THEME=R;exports.MachReportError=b;exports.ReportParamPanel=te;exports.SILENT_LOGGER=oe;exports.defineMachReportConfig=A;exports.defineMachReportPreset=ne;exports.normalizeReportLoadError=N;exports.provideMachReportConfig=ce;exports.resolveCalculationMessages=re;exports.resolveConfig=se;exports.themeToCssVars=ie;exports.toErrorDetail=L;exports.useMachReportConfig=de;exports.useReportParams=_;
|
package/dist/plugin-Cd5G2QQn.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { defineAsyncComponent as c, computed as m } from "vue";
|
|
2
|
-
import { b as i, c as l, a as d } from "./injection-keys-e85udZCp.js";
|
|
3
|
-
import { g as s } from "./report-params-B44imUd4.js";
|
|
4
|
-
const p = c(() => import("./ReportPreview-DiNXhQI0.js").then((r) => r.o)), _ = {
|
|
5
|
-
install(r, e = {}) {
|
|
6
|
-
let t = e.fetcher;
|
|
7
|
-
if (!t && e.reports) {
|
|
8
|
-
const o = e.reports;
|
|
9
|
-
let n;
|
|
10
|
-
t = async (f) => (n ??= import("@agile-team/mach-report").then(({ createReportSource: a }) => a(o)), (await n)(f)), t.getParamDefs = (f) => s(o, f);
|
|
11
|
-
}
|
|
12
|
-
t && r.provide(i, t), e.pdfExporter && r.provide(l, e.pdfExporter), r.provide(d, m(() => {
|
|
13
|
-
if (e.pdfFontUrl === void 0) return e.config ?? null;
|
|
14
|
-
const o = e.config ?? { defaults: {}, presets: {} };
|
|
15
|
-
return { ...o, defaults: { ...o.defaults, pdfFontUrl: e.pdfFontUrl } };
|
|
16
|
-
})), e.globalComponent !== !1 && !r.component("MachReportPreview") && r.component("MachReportPreview", p);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
p as M,
|
|
21
|
-
_ as m
|
|
22
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const y=require("./defaults-xhmcLLrf.cjs"),d=require("./style-UgIJSA1F.cjs"),u=require("./computed-CGV2a809.cjs");function S(e){if(!e||e.kind==="date")return;const t=e.digits;if(!(t!==void 0&&(!Number.isInteger(t)||t<0||t>100))){if(e.kind==="percent"){const r=t??2;return`0${r?`.${"0".repeat(r)}`:""}%`}return t===void 0?e.thousands?"#,##0.###############":void 0:`${e.thousands?"#,##0":"0"}${t?`.${"0".repeat(t)}`:""}`}}function h(e){const t=/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());if(t){const n=new Date(Number(t[1]),Number(t[2])-1,Number(t[3]));return Number.isNaN(n.getTime())?null:n}const r=new Date(e);return Number.isNaN(r.getTime())?null:r}function c(e,t){return e.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:t})}function x(e,t){const r=n=>String(n).padStart(2,"0");return t.replace(/YYYY/g,String(e.getFullYear())).replace(/MM/g,r(e.getMonth()+1)).replace(/DD/g,r(e.getDate())).replace(/hh/g,r(e.getHours())).replace(/mm/g,r(e.getMinutes())).replace(/ss/g,r(e.getSeconds()))}function C(e,t,r){return r!=null?t?c(e,r):e.toFixed(r):t?c(e):String(e)}function g(e){const t=typeof e=="number"?e:Number(String(e).replace(/,/g,""));return Number.isFinite(t)?t:null}function b(e,t){if(e==null||e===""||!t)return String(e??"");switch(t.kind){case"number":{if(typeof e=="string")try{return u.formatDecimal(e,t.digits,t.thousands===!0)}catch{return e}const r=g(e);return r==null?String(e):C(r,t.thousands===!0,t.digits)}case"percent":{if(typeof e=="string")try{return u.formatDecimal(e,t.digits??2,!0,!0)}catch{return e}const r=g(e);return r==null?String(e):`${c(r*100,t.digits??2)}%`}case"date":{const r=t.pattern??"YYYY-MM-DD",n=e instanceof Date?e:h(String(e));return n?x(n,r):String(e)}default:return String(e)}}function p(e,t){const r=e[t.field];if(r==null||r==="")return!1;if(typeof t.value=="number"||t.numeric!==void 0){let a;try{a=u.compareDecimal(u.parseDecimal(r),u.parseDecimal(t.value))}catch{return!1}if(!Number.isFinite(a))return!1;switch(t.op){case">":return a>0;case">=":return a>=0;case"<":return a<0;case"<=":return a<=0;case"==":return a===0;case"!=":return a!==0}}const n=String(r),i=String(t.value);switch(t.op){case"==":return n===i;case"!=":return n!==i;case">":return n>i;case">=":return n>=i;case"<":return n<i;case"<=":return n<=i}return!1}function D(e,t,r,n=e.paddingMm??1){return t.field!==e.tree.labelField?0:Math.min(r.depth*(e.tree.indentMm??3),Math.max(0,t.widthMm-n*2-4))}function N(e,t,r,n){const i=n.tree;(i.input==="nested"||[i.idField,i.parentField].includes(t.field))&&(e.editable=!1),r.hasChildren&&i.parentValues==="leaf-aggregate"&&i.aggregates?.some(a=>a.field===t.field)&&(e.derived=!0,e.editable=!1)}function T(e,t,r){return r==="identifier"||r==="dimension"||r==="date"?"center":r==="measure"?"right":r==="text"?"left":t?.kind==="number"||t?.kind==="percent"?"right":t?.kind==="date"||e instanceof Date||typeof e=="boolean"?"center":typeof e=="number"&&Number.isFinite(e)?"right":"left"}function F(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="boolean")return e?"是":"否";if(e instanceof Date)return e.toISOString().slice(0,10);try{return JSON.stringify(e)}catch{return String(e)}}function M(e,t){let r=d.mergeComponentStyles({fontSize:e.fontSizePt??y.DEFAULT_FONT_PT,bold:e.headerBold??!0,align:"center",verticalAlign:"middle",backgroundColor:e.headerBackgroundColor},t.style);return e.headerAlign!==void 0&&(r.align=e.headerAlign),r=d.mergeComponentStyles(r,e.headerStyle),t.headerAlign!==void 0&&(r.align=t.headerAlign),d.mergeComponentStyles(r,t.headerStyle)}function A(e,t,r){(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"&&Number.isFinite(r))&&(e.value=r);const n=t.format?.kind==="number"||t.format?.kind==="percent";t.valueType!==void 0?e.valueType=t.valueType:n&&(e.valueType="number"),t.editable!==void 0&&(e.editable=t.editable);const i=S(t.format);(typeof e.value=="number"||e.value==null)&&i!==void 0&&(e.numberFormat=i)}function $(e,t,r){const n=!!t.visibleWhen&&!p(r,t.visibleWhen),i=n?null:r[t.field],a=t.align??t.style?.align??e.align??"left";let s=d.mergeComponentStyles({fontSize:e.fontSizePt??y.DEFAULT_FONT_PT,verticalAlign:"middle"},t.style);s.align=a==="auto"?T(i,t.format,t.semanticRole):a;const o=t.rules?.find(f=>p(r,f.when));o&&(s=d.mergeComponentStyles(s,o.style));const l={text:t.format?b(i,t.format):F(i),style:s};return A(l,t,i),e.computed?.some(f=>f.field===t.field)&&(l.derived=!0,l.editable=!1),n&&(l.editable=!1),l}function k(e,t,r){const n=$(e,t,r.row),i=D(e,t,r);return t.field===e.tree.labelField&&(n.style={...n.style,align:"left"}),i&&(n.indentMm=i),N(n,t,r,e),n}function w(e){return typeof e=="string"&&/^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e)}class m extends Error{constructor(t,r,n,i){super(`${t}: ${r}`),this.path=t,this.rowIndex=n,this.field=i,this.code="report-binding",this.name="ReportBindingError"}}function L(e,t,r={}){const n=r.rowIndex??0,a=`$.datasets.${r.dataset??"label"}[${n}].${t}`,s=Object.getOwnPropertyDescriptor(e,t);if(!s||s.get||s.set)throw new m(a,"字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承",n,t);const o=s.value;if(o==null||typeof o=="string"||typeof o=="boolean"||typeof o=="number"&&Number.isFinite(o))return o;throw new m(a,"绑定值应为字符串、有限数字、布尔值或空值",n,t)}function I(e,t,r={}){const n=L(t,e.field,r);return n==null||n===""?e.emptyText??"":`${e.prefix??""}${b(n,e.format)}${e.suffix??""}`}exports.ReportBindingError=m;exports.applyListTreeMetadata=N;exports.evalStyleRule=p;exports.formatValue=b;exports.isLabelImageData=w;exports.listCellText=F;exports.listTreeIndent=D;exports.parseDateLocal=h;exports.readRecordScalar=L;exports.resolveComponentBinding=I;exports.resolveListAutoAlignment=T;exports.resolveListHeaderStyle=M;exports.resolveListSampleCell=$;exports.resolveTreeListSampleCell=k;exports.toExcelNumberFormat=S;exports.toNumber=g;
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { c as h } from "./defaults-DXhiM1ZD.js";
|
|
2
|
-
import { e as d } from "./style-CQ1PK8ZB.js";
|
|
3
|
-
import { c as S, p as l, h as g } from "./computed-Bvk0W15F.js";
|
|
4
|
-
function N(e) {
|
|
5
|
-
if (!e || e.kind === "date") return;
|
|
6
|
-
const t = e.digits;
|
|
7
|
-
if (!(t !== void 0 && (!Number.isInteger(t) || t < 0 || t > 100))) {
|
|
8
|
-
if (e.kind === "percent") {
|
|
9
|
-
const r = t ?? 2;
|
|
10
|
-
return `0${r ? `.${"0".repeat(r)}` : ""}%`;
|
|
11
|
-
}
|
|
12
|
-
return t === void 0 ? e.thousands ? "#,##0.###############" : void 0 : `${e.thousands ? "#,##0" : "0"}${t ? `.${"0".repeat(t)}` : ""}`;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function D(e) {
|
|
16
|
-
const t = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(e.trim());
|
|
17
|
-
if (t) {
|
|
18
|
-
const n = new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3]));
|
|
19
|
-
return Number.isNaN(n.getTime()) ? null : n;
|
|
20
|
-
}
|
|
21
|
-
const r = new Date(e);
|
|
22
|
-
return Number.isNaN(r.getTime()) ? null : r;
|
|
23
|
-
}
|
|
24
|
-
function c(e, t) {
|
|
25
|
-
return e.toLocaleString("en-US", {
|
|
26
|
-
minimumFractionDigits: t,
|
|
27
|
-
maximumFractionDigits: t
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function F(e, t) {
|
|
31
|
-
const r = (n) => String(n).padStart(2, "0");
|
|
32
|
-
return t.replace(/YYYY/g, String(e.getFullYear())).replace(/MM/g, r(e.getMonth() + 1)).replace(/DD/g, r(e.getDate())).replace(/hh/g, r(e.getHours())).replace(/mm/g, r(e.getMinutes())).replace(/ss/g, r(e.getSeconds()));
|
|
33
|
-
}
|
|
34
|
-
function $(e, t, r) {
|
|
35
|
-
return r != null ? t ? c(e, r) : e.toFixed(r) : t ? c(e) : String(e);
|
|
36
|
-
}
|
|
37
|
-
function p(e) {
|
|
38
|
-
const t = typeof e == "number" ? e : Number(String(e).replace(/,/g, ""));
|
|
39
|
-
return Number.isFinite(t) ? t : null;
|
|
40
|
-
}
|
|
41
|
-
function y(e, t) {
|
|
42
|
-
if (e == null || e === "" || !t) return String(e ?? "");
|
|
43
|
-
switch (t.kind) {
|
|
44
|
-
case "number": {
|
|
45
|
-
if (typeof e == "string")
|
|
46
|
-
try {
|
|
47
|
-
return g(e, t.digits, t.thousands === !0);
|
|
48
|
-
} catch {
|
|
49
|
-
return e;
|
|
50
|
-
}
|
|
51
|
-
const r = p(e);
|
|
52
|
-
return r == null ? String(e) : $(r, t.thousands === !0, t.digits);
|
|
53
|
-
}
|
|
54
|
-
case "percent": {
|
|
55
|
-
if (typeof e == "string")
|
|
56
|
-
try {
|
|
57
|
-
return g(e, t.digits ?? 2, !0, !0);
|
|
58
|
-
} catch {
|
|
59
|
-
return e;
|
|
60
|
-
}
|
|
61
|
-
const r = p(e);
|
|
62
|
-
return r == null ? String(e) : `${c(r * 100, t.digits ?? 2)}%`;
|
|
63
|
-
}
|
|
64
|
-
case "date": {
|
|
65
|
-
const r = t.pattern ?? "YYYY-MM-DD", n = e instanceof Date ? e : D(String(e));
|
|
66
|
-
return n ? F(n, r) : String(e);
|
|
67
|
-
}
|
|
68
|
-
default:
|
|
69
|
-
return String(e);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function m(e, t) {
|
|
73
|
-
const r = e[t.field];
|
|
74
|
-
if (r == null || r === "") return !1;
|
|
75
|
-
if (typeof t.value == "number" || t.numeric !== void 0) {
|
|
76
|
-
let a;
|
|
77
|
-
try {
|
|
78
|
-
a = S(l(r), l(t.value));
|
|
79
|
-
} catch {
|
|
80
|
-
return !1;
|
|
81
|
-
}
|
|
82
|
-
if (!Number.isFinite(a)) return !1;
|
|
83
|
-
switch (t.op) {
|
|
84
|
-
case ">":
|
|
85
|
-
return a > 0;
|
|
86
|
-
case ">=":
|
|
87
|
-
return a >= 0;
|
|
88
|
-
case "<":
|
|
89
|
-
return a < 0;
|
|
90
|
-
case "<=":
|
|
91
|
-
return a <= 0;
|
|
92
|
-
case "==":
|
|
93
|
-
return a === 0;
|
|
94
|
-
case "!=":
|
|
95
|
-
return a !== 0;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
const n = String(r), i = String(t.value);
|
|
99
|
-
switch (t.op) {
|
|
100
|
-
case "==":
|
|
101
|
-
return n === i;
|
|
102
|
-
case "!=":
|
|
103
|
-
return n !== i;
|
|
104
|
-
case ">":
|
|
105
|
-
return n > i;
|
|
106
|
-
case ">=":
|
|
107
|
-
return n >= i;
|
|
108
|
-
case "<":
|
|
109
|
-
return n < i;
|
|
110
|
-
case "<=":
|
|
111
|
-
return n <= i;
|
|
112
|
-
}
|
|
113
|
-
return !1;
|
|
114
|
-
}
|
|
115
|
-
function x(e, t, r, n = e.paddingMm ?? 1) {
|
|
116
|
-
return t.field !== e.tree.labelField ? 0 : Math.min(r.depth * (e.tree.indentMm ?? 3), Math.max(0, t.widthMm - n * 2 - 4));
|
|
117
|
-
}
|
|
118
|
-
function M(e, t, r, n) {
|
|
119
|
-
const i = n.tree;
|
|
120
|
-
(i.input === "nested" || [i.idField, i.parentField].includes(t.field)) && (e.editable = !1), r.hasChildren && i.parentValues === "leaf-aggregate" && i.aggregates?.some((a) => a.field === t.field) && (e.derived = !0, e.editable = !1);
|
|
121
|
-
}
|
|
122
|
-
function T(e, t, r) {
|
|
123
|
-
return r === "identifier" || r === "dimension" || r === "date" ? "center" : r === "measure" ? "right" : r === "text" ? "left" : t?.kind === "number" || t?.kind === "percent" ? "right" : t?.kind === "date" || e instanceof Date || typeof e == "boolean" ? "center" : typeof e == "number" && Number.isFinite(e) ? "right" : "left";
|
|
124
|
-
}
|
|
125
|
-
function k(e) {
|
|
126
|
-
if (e == null) return "";
|
|
127
|
-
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
128
|
-
if (typeof e == "boolean") return e ? "是" : "否";
|
|
129
|
-
if (e instanceof Date) return e.toISOString().slice(0, 10);
|
|
130
|
-
try {
|
|
131
|
-
return JSON.stringify(e);
|
|
132
|
-
} catch {
|
|
133
|
-
return String(e);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
function R(e, t) {
|
|
137
|
-
let r = d({ fontSize: e.fontSizePt ?? h, bold: e.headerBold ?? !0, align: "center", verticalAlign: "middle", backgroundColor: e.headerBackgroundColor }, t.style);
|
|
138
|
-
return e.headerAlign !== void 0 && (r.align = e.headerAlign), r = d(r, e.headerStyle), t.headerAlign !== void 0 && (r.align = t.headerAlign), d(r, t.headerStyle);
|
|
139
|
-
}
|
|
140
|
-
function w(e, t, r) {
|
|
141
|
-
(r === null || typeof r == "string" || typeof r == "boolean" || typeof r == "number" && Number.isFinite(r)) && (e.value = r);
|
|
142
|
-
const n = t.format?.kind === "number" || t.format?.kind === "percent";
|
|
143
|
-
t.valueType !== void 0 ? e.valueType = t.valueType : n && (e.valueType = "number"), t.editable !== void 0 && (e.editable = t.editable);
|
|
144
|
-
const i = N(t.format);
|
|
145
|
-
(typeof e.value == "number" || e.value == null) && i !== void 0 && (e.numberFormat = i);
|
|
146
|
-
}
|
|
147
|
-
function A(e, t, r) {
|
|
148
|
-
const n = !!t.visibleWhen && !m(r, t.visibleWhen), i = n ? null : r[t.field], a = t.align ?? t.style?.align ?? e.align ?? "left";
|
|
149
|
-
let s = d({ fontSize: e.fontSizePt ?? h, verticalAlign: "middle" }, t.style);
|
|
150
|
-
s.align = a === "auto" ? T(i, t.format, t.semanticRole) : a;
|
|
151
|
-
const o = t.rules?.find((u) => m(r, u.when));
|
|
152
|
-
o && (s = d(s, o.style));
|
|
153
|
-
const f = { text: t.format ? y(i, t.format) : k(i), style: s };
|
|
154
|
-
return w(f, t, i), e.computed?.some((u) => u.field === t.field) && (f.derived = !0, f.editable = !1), n && (f.editable = !1), f;
|
|
155
|
-
}
|
|
156
|
-
function z(e, t, r) {
|
|
157
|
-
const n = A(e, t, r.row), i = x(e, t, r);
|
|
158
|
-
return t.field === e.tree.labelField && (n.style = { ...n.style, align: "left" }), i && (n.indentMm = i), M(n, t, r, e), n;
|
|
159
|
-
}
|
|
160
|
-
function B(e) {
|
|
161
|
-
return typeof e == "string" && /^data:image\/(png|jpe?g);base64,[A-Za-z0-9+/\r\n]+=*$/.test(e);
|
|
162
|
-
}
|
|
163
|
-
class b extends Error {
|
|
164
|
-
constructor(t, r, n, i) {
|
|
165
|
-
super(`${t}: ${r}`), this.path = t, this.rowIndex = n, this.field = i, this.code = "report-binding", this.name = "ReportBindingError";
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function L(e, t, r = {}) {
|
|
169
|
-
const n = r.rowIndex ?? 0, a = `$.datasets.${r.dataset ?? "label"}[${n}].${t}`, s = Object.getOwnPropertyDescriptor(e, t);
|
|
170
|
-
if (!s || s.get || s.set) throw new b(a, "字段必须是记录的自有数据字段,不能缺失、使用访问器或从原型继承", n, t);
|
|
171
|
-
const o = s.value;
|
|
172
|
-
if (o == null || typeof o == "string" || typeof o == "boolean" || typeof o == "number" && Number.isFinite(o)) return o;
|
|
173
|
-
throw new b(a, "绑定值应为字符串、有限数字、布尔值或空值", n, t);
|
|
174
|
-
}
|
|
175
|
-
function E(e, t, r = {}) {
|
|
176
|
-
const n = L(t, e.field, r);
|
|
177
|
-
return n == null || n === "" ? e.emptyText ?? "" : `${e.prefix ?? ""}${y(n, e.format)}${e.suffix ?? ""}`;
|
|
178
|
-
}
|
|
179
|
-
export {
|
|
180
|
-
b as R,
|
|
181
|
-
z as a,
|
|
182
|
-
E as b,
|
|
183
|
-
R as c,
|
|
184
|
-
p as d,
|
|
185
|
-
m as e,
|
|
186
|
-
y as f,
|
|
187
|
-
L as g,
|
|
188
|
-
T as h,
|
|
189
|
-
B as i,
|
|
190
|
-
x as j,
|
|
191
|
-
M as k,
|
|
192
|
-
k as l,
|
|
193
|
-
D as p,
|
|
194
|
-
A as r,
|
|
195
|
-
N as t
|
|
196
|
-
};
|