@agile-team/mach-report 2.10.0 → 2.11.1
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 +6 -2
- package/dist/ExcelBindingWizard-LWX6G1A2.js +1465 -0
- package/dist/ExcelBindingWizard-a4kslPHF.cjs +1 -0
- package/dist/ParamEditor-BLaE5q5W.js +522 -0
- package/dist/ParamEditor-MBBC7lUE.cjs +1 -0
- package/dist/ReportBatchPanel-B5ClP9tm.js +350 -0
- package/dist/ReportBatchPanel-Dc-SDkYA.cjs +1 -0
- package/dist/ReportPreview-DWXROHBP.cjs +6 -0
- package/dist/ReportPreview-DiNXhQI0.js +4138 -0
- package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +1 -0
- package/dist/ReportTemplateLibrary-BZB-XWjj.js +311 -0
- package/dist/RuleEditor-C2QsOHOs.cjs +1 -0
- package/dist/RuleEditor-D9wQHrkf.js +2024 -0
- package/dist/TemplateReviewPanel-BKofGrV9.js +222 -0
- package/dist/TemplateReviewPanel-DwtOcLue.cjs +1 -0
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +2 -0
- package/dist/analytics.d.ts +2 -0
- package/dist/analytics.js +29 -29
- package/dist/batch-Bt3Fd27Z.cjs +1 -0
- package/dist/batch-mRqhhhjt.js +364 -0
- package/dist/computed-Bvk0W15F.js +521 -0
- package/dist/computed-CGV2a809.cjs +1 -0
- package/dist/config-B612mw0x.js +525 -0
- package/dist/config-BRoLo2oj.cjs +1 -0
- package/dist/designer.cjs +2 -2
- package/dist/designer.d.cts +730 -9
- package/dist/designer.d.ts +730 -9
- package/dist/designer.js +2093 -1785
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +161 -3
- package/dist/index.d.ts +161 -3
- package/dist/index.js +486 -431
- package/dist/injection-keys-Db_DyLkm.cjs +1 -0
- package/dist/injection-keys-e85udZCp.js +7 -0
- package/dist/list-cell-BuYn4tGF.cjs +1 -0
- package/dist/{list-cell-Dxyi7DOw.js → list-cell-ClFra1zS.js} +54 -40
- package/dist/matrix-DVyWiYsd.cjs +1 -0
- package/dist/matrix-yZsGnldA.js +227 -0
- package/dist/param-validation-BlHHXs6u.js +153 -0
- package/dist/param-validation-DCK039V1.cjs +1 -0
- package/dist/pdf.cjs +25 -25
- package/dist/pdf.d.cts +3 -0
- package/dist/pdf.d.ts +3 -0
- package/dist/pdf.js +677 -677
- package/dist/plugin-BDTU4D94.cjs +1 -0
- package/dist/plugin-Cd5G2QQn.js +22 -0
- package/dist/region-binding-workflow-CXDmt9Bs.js +977 -0
- package/dist/region-binding-workflow-DhQvu1co.cjs +3 -0
- package/dist/{report-params-B_VCihAh.js → report-params-B44imUd4.js} +1 -1
- package/dist/{report-params-CjWrjPl6.cjs → report-params-SJfhKgaX.cjs} +1 -1
- package/dist/server/node.d.cts +5 -2
- package/dist/server/node.d.ts +5 -2
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +87 -87
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +201 -2
- package/dist/server.d.ts +201 -2
- package/dist/server.js +557 -658
- package/dist/style.css +1 -1
- package/dist/template-registry-WNXdkiET.js +506 -0
- package/dist/template-registry-ukBGlm8N.cjs +1 -0
- package/dist/template-review-BXp2oyqg.cjs +1 -0
- package/dist/template-review-BdcXSYbx.js +1616 -0
- package/dist/tree-BX380Rr7.cjs +1 -0
- package/dist/tree-CqcQ99NM.js +172 -0
- package/dist/{validate-UUy9yP4K.js → validate-7s0yn6ii.js} +44 -44
- package/dist/validate-DsRiNw8h.cjs +1 -0
- package/dist/vue/async.d.cts +93 -4
- package/dist/vue/async.d.ts +93 -4
- package/dist/vue/index.d.cts +145 -7
- package/dist/vue/index.d.ts +145 -7
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +5 -5
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +116 -113
- package/dist/{workbook-session-B-bW5_yR.js → workbook-session-BKOTwcoq.js} +1 -1
- package/dist/{workbook-session-D7RtdNo0.cjs → workbook-session-CLYLhZWu.cjs} +1 -1
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +5 -2
- package/dist/worker.d.ts +5 -2
- package/dist/worker.js +1 -1
- package/dist/xlsx.cjs +3 -3
- package/dist/xlsx.d.cts +129 -2
- package/dist/xlsx.d.ts +129 -2
- package/dist/xlsx.js +336 -242
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-CF7RplWm.cjs +0 -1
- package/dist/ExcelBindingWizard-qhwEderR.js +0 -842
- package/dist/ReportPreview-BE1tCHqE.js +0 -4604
- package/dist/ReportPreview-QKRKQOe3.cjs +0 -6
- package/dist/RuleEditor-BA36yIV6.js +0 -1723
- package/dist/RuleEditor-CczJ6mJm.cjs +0 -1
- package/dist/TemplateReviewPanel-CHi4Alqa.cjs +0 -1
- package/dist/TemplateReviewPanel-Dz0G5o83.js +0 -217
- package/dist/binding-preview-BWsdf_z2.cjs +0 -2
- package/dist/binding-preview-DILq0-0f.js +0 -649
- package/dist/decimal-CI1OAczk.js +0 -87
- package/dist/decimal-CQA0xJex.cjs +0 -1
- package/dist/list-cell-CyM1ZlRN.cjs +0 -1
- package/dist/matrix-BbXarwyk.js +0 -661
- package/dist/matrix-Cm65WLLP.cjs +0 -1
- package/dist/param-validation-BWNjLcN0.js +0 -116
- package/dist/param-validation-CiTxFeZ8.cjs +0 -1
- package/dist/plugin-CThk42vJ.cjs +0 -1
- package/dist/plugin-tGn7-5oF.js +0 -25
- package/dist/template-registry-CGWTLtIA.cjs +0 -1
- package/dist/template-registry-DzlQs3OF.js +0 -434
- package/dist/template-review-D1RoNCPw.cjs +0 -1
- package/dist/template-review-fnteXRng.js +0 -1473
- package/dist/validate-Bf6ccFr2.cjs +0 -1
|
@@ -0,0 +1,222 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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/analytics.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./computed-CGV2a809.cjs"),M=require("./matrix-DVyWiYsd.cjs"),d=["#2563eb","#0d9488","#d97706","#7c3aed","#dc2626","#0284c7"];function y(e){if(e.type!=="bar"&&e.type!=="line")throw new Error("图表 type 应为 bar 或 line");if(!Array.isArray(e.categories)||!Array.isArray(e.series)||!e.categories.length||e.categories.length>200||!e.series.length||e.series.length>12)throw new Error("图表支持 1–200 个分类、1–12 个系列;大数据应先聚合");if(e.categories.some(t=>typeof t!="string"))throw new Error("图表分类应为字符串");D(e);for(const t of e.series)C(t,e.categories.length)}function D(e){for(const t of["leftMm","topMm","widthMm","heightMm"])if(!Number.isFinite(e[t])||e[t]<0)throw new Error(`${t} 应为有限非负数`);if(e.widthMm<45||e.heightMm<35)throw new Error("图表至少需要 45×35mm");if(!Number.isFinite(e.leftMm+e.widthMm)||!Number.isFinite(e.topMm+e.heightMm))throw new Error("图表几何范围溢出")}function C(e,t){if(!e||typeof e.name!="string"||!Array.isArray(e.values)||e.values.length!==t||e.values.some(r=>r!==null&&!Number.isFinite(r)))throw new Error("图表系列应提供名称及逐分类的有限数字或 null");if(e.color!==void 0&&!/^#[\da-f]{6}$/i.test(e.color))throw new Error("图表颜色应为 #RRGGBB")}function b(e,t,r,l,c,a=.8){return{kind:"line",leftMm:Math.min(e,r),topMm:Math.min(t,l),widthMm:Math.abs(r-e),heightMm:Math.abs(l-t),lineDirection:l<t?"up":"down",style:{lineColor:c,lineWidthPt:a}}}function u(e,t,r,l,c="center"){return{kind:"text",text:e,leftMm:t,topMm:r,widthMm:l,heightMm:5,style:{fontSize:8,color:"#475569",align:c,verticalAlign:"middle"}}}function w(e){return Number(e.toPrecision(5)).toString()}function v(e){let t=0,r=0;for(const s of e.series)for(const f of s.values)f!==null&&(t=Math.min(t,f),r=Math.max(r,f));t===r&&(r=t+1);const l=e.leftMm+13,c=e.topMm+8,a=e.widthMm-17,i=e.heightMm-23,n=Math.max(Math.abs(t),Math.abs(r),1),h=t/n,g=r/n-h;return{left:l,top:c,width:a,height:i,min:t,max:r,y:s=>c+i*(1-(s/n-h)/g)}}function x(e,t){const r=[];e.title&&r.push({...u(e.title,e.leftMm,e.topMm,e.widthMm),style:{fontSize:10,bold:!0,align:"left"}});for(let a=0;a<=4;a++){const i=a/4,n=t.min*(1-i)+t.max*i,h=t.y(n);r.push(b(t.left,h,t.left+t.width,h,"#e2e8f0",.4),u(w(n),e.leftMm,h-2.5,11,"right"))}r.push(b(t.left,t.top,t.left,t.top+t.height,"#94a3b8"));const l=Math.max(1,Math.ceil(e.categories.length/Math.max(1,Math.floor(t.width/14))));e.categories.forEach((a,i)=>{i%l===0&&r.push(u(a,t.left+(i+.5)*t.width/e.categories.length-7,t.top+t.height+1,14))});const c=t.width/e.series.length;return e.series.forEach((a,i)=>{r.push({...u(a.name,t.left+i*c,e.topMm+e.heightMm-5,c),style:{fontSize:8,color:a.color??d[i%d.length],align:"center"}})}),r}function k(e,t,r,l){const c=[],a=r.color??d[l%d.length],i=t.width/e.categories.length,n=i*.75/e.series.length;let h;return r.values.forEach((g,s)=>{if(g===null){h=void 0;return}const f=t.left+(s+.5)*i,o=t.y(g);e.type==="bar"?c.push({kind:"rect",leftMm:t.left+s*i+i*.125+l*n,topMm:Math.min(o,t.y(0)),widthMm:n,heightMm:Math.abs(t.y(0)-o),style:{backgroundColor:a,borderTop:!1,borderRight:!1,borderBottom:!1,borderLeft:!1}}):(h&&c.push(b(h.x,h.y,f,o,a,1.2)),c.push({kind:"ellipse",leftMm:f-.7,topMm:o-.7,widthMm:1.4,heightMm:1.4,style:{backgroundColor:a,borderColor:a}}),h={x:f,y:o}),e.showValues&&c.push({...u(w(g),f-i/2,Math.max(t.top,o-5),i),style:{fontSize:7,color:a,align:"center"}})}),c}function A(e){y(e);const t=v(e);return[...x(e,t),...e.series.flatMap((r,l)=>k(e,t,r,l))]}exports.addDecimal=m.addDecimal;exports.aggregateRows=m.aggregateRows;exports.compareDecimal=m.compareDecimal;exports.computeDataset=m.computeDataset;exports.createAggregateAccumulator=m.createAggregateAccumulator;exports.decimalDigits=m.decimalDigits;exports.divideDecimal=m.divideDecimal;exports.formatDecimal=m.formatDecimal;exports.getComputationMetadata=m.getComputationMetadata;exports.multiplyDecimal=m.multiplyDecimal;exports.parseDecimal=m.parseDecimal;exports.printDecimal=m.printDecimal;exports.validateComputedFields=m.validateComputedFields;exports.createCrossTable=M.createCrossTable;exports.createMatrixTable=M.createMatrixTable;exports.estimateMatrixTable=M.estimateMatrixTable;exports.validateMatrixOptions=M.validateMatrixOptions;exports.createChartComponents=A;
|
package/dist/analytics.d.cts
CHANGED
|
@@ -253,6 +253,8 @@ declare interface GridCell {
|
|
|
253
253
|
value?: string | number | boolean | null;
|
|
254
254
|
/** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
|
|
255
255
|
numberFormat?: string;
|
|
256
|
+
/** Physical left inset for hierarchical labels; raw value stays unchanged. */
|
|
257
|
+
indentMm?: number;
|
|
256
258
|
/** 编辑输入类型;省略时只按原始值推断,数字字符串不会被转换为数值。 */
|
|
257
259
|
valueType?: "text" | "number" | "boolean";
|
|
258
260
|
/** 单元格级编辑控制;预览仍需显式开启 editing。 */
|
package/dist/analytics.d.ts
CHANGED
|
@@ -253,6 +253,8 @@ declare interface GridCell {
|
|
|
253
253
|
value?: string | number | boolean | null;
|
|
254
254
|
/** Excel 数字格式(例如 #,##0.00 / 0.00%),不改变 text。 */
|
|
255
255
|
numberFormat?: string;
|
|
256
|
+
/** Physical left inset for hierarchical labels; raw value stays unchanged. */
|
|
257
|
+
indentMm?: number;
|
|
256
258
|
/** 编辑输入类型;省略时只按原始值推断,数字字符串不会被转换为数值。 */
|
|
257
259
|
valueType?: "text" | "number" | "boolean";
|
|
258
260
|
/** 单元格级编辑控制;预览仍需显式开启 editing。 */
|
package/dist/analytics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as A,
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import { a as A, b as S, c as z, d as F, e as N, f as R, g as T, h as W, i as B, m as G, p as L, j as O, v as P } from "./computed-Bvk0W15F.js";
|
|
2
|
+
import { c as j, a as V, e as q, v as H } from "./matrix-yZsGnldA.js";
|
|
3
|
+
const o = ["#2563eb", "#0d9488", "#d97706", "#7c3aed", "#dc2626", "#0284c7"];
|
|
4
4
|
function w(e) {
|
|
5
5
|
if (e.type !== "bar" && e.type !== "line") throw new Error("图表 type 应为 bar 或 line");
|
|
6
6
|
if (!Array.isArray(e.categories) || !Array.isArray(e.series) || !e.categories.length || e.categories.length > 200 || !e.series.length || e.series.length > 12) throw new Error("图表支持 1–200 个分类、1–12 个系列;大数据应先聚合");
|
|
@@ -18,41 +18,41 @@ function y(e, t) {
|
|
|
18
18
|
if (!e || typeof e.name != "string" || !Array.isArray(e.values) || e.values.length !== t || e.values.some((r) => r !== null && !Number.isFinite(r))) throw new Error("图表系列应提供名称及逐分类的有限数字或 null");
|
|
19
19
|
if (e.color !== void 0 && !/^#[\da-f]{6}$/i.test(e.color)) throw new Error("图表颜色应为 #RRGGBB");
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function u(e, t, r, c, h, a = 0.8) {
|
|
22
22
|
return { kind: "line", leftMm: Math.min(e, r), topMm: Math.min(t, c), widthMm: Math.abs(r - e), heightMm: Math.abs(c - t), lineDirection: c < t ? "up" : "down", style: { lineColor: h, lineWidthPt: a } };
|
|
23
23
|
}
|
|
24
24
|
function M(e, t, r, c, h = "center") {
|
|
25
25
|
return { kind: "text", text: e, leftMm: t, topMm: r, widthMm: c, heightMm: 5, style: { fontSize: 8, color: "#475569", align: h, verticalAlign: "middle" } };
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function d(e) {
|
|
28
28
|
return Number(e.toPrecision(5)).toString();
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function v(e) {
|
|
31
31
|
let t = 0, r = 0;
|
|
32
32
|
for (const f of e.series) for (const n of f.values) n !== null && (t = Math.min(t, n), r = Math.max(r, n));
|
|
33
33
|
t === r && (r = t + 1);
|
|
34
34
|
const c = e.leftMm + 13, h = e.topMm + 8, a = e.widthMm - 17, i = e.heightMm - 23, m = Math.max(Math.abs(t), Math.abs(r), 1), l = t / m, g = r / m - l;
|
|
35
35
|
return { left: c, top: h, width: a, height: i, min: t, max: r, y: (f) => h + i * (1 - (f / m - l) / g) };
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function x(e, t) {
|
|
38
38
|
const r = [];
|
|
39
39
|
e.title && r.push({ ...M(e.title, e.leftMm, e.topMm, e.widthMm), style: { fontSize: 10, bold: !0, align: "left" } });
|
|
40
40
|
for (let a = 0; a <= 4; a++) {
|
|
41
41
|
const i = a / 4, m = t.min * (1 - i) + t.max * i, l = t.y(m);
|
|
42
|
-
r.push(
|
|
42
|
+
r.push(u(t.left, l, t.left + t.width, l, "#e2e8f0", 0.4), M(d(m), e.leftMm, l - 2.5, 11, "right"));
|
|
43
43
|
}
|
|
44
|
-
r.push(
|
|
44
|
+
r.push(u(t.left, t.top, t.left, t.top + t.height, "#94a3b8"));
|
|
45
45
|
const c = Math.max(1, Math.ceil(e.categories.length / Math.max(1, Math.floor(t.width / 14))));
|
|
46
46
|
e.categories.forEach((a, i) => {
|
|
47
47
|
i % c === 0 && r.push(M(a, t.left + (i + 0.5) * t.width / e.categories.length - 7, t.top + t.height + 1, 14));
|
|
48
48
|
});
|
|
49
49
|
const h = t.width / e.series.length;
|
|
50
50
|
return e.series.forEach((a, i) => {
|
|
51
|
-
r.push({ ...M(a.name, t.left + i * h, e.topMm + e.heightMm - 5, h), style: { fontSize: 8, color: a.color ??
|
|
51
|
+
r.push({ ...M(a.name, t.left + i * h, e.topMm + e.heightMm - 5, h), style: { fontSize: 8, color: a.color ?? o[i % o.length], align: "center" } });
|
|
52
52
|
}), r;
|
|
53
53
|
}
|
|
54
54
|
function k(e, t, r, c) {
|
|
55
|
-
const h = [], a = r.color ??
|
|
55
|
+
const h = [], a = r.color ?? o[c % o.length], i = t.width / e.categories.length, m = i * 0.75 / e.series.length;
|
|
56
56
|
let l;
|
|
57
57
|
return r.values.forEach((g, f) => {
|
|
58
58
|
if (g === null) {
|
|
@@ -60,31 +60,31 @@ function k(e, t, r, c) {
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const n = t.left + (f + 0.5) * i, s = t.y(g);
|
|
63
|
-
e.type === "bar" ? h.push({ kind: "rect", leftMm: t.left + f * i + i * 0.125 + c * m, topMm: Math.min(s, t.y(0)), widthMm: m, heightMm: Math.abs(t.y(0) - s), style: { backgroundColor: a, borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } }) : (l && h.push(
|
|
63
|
+
e.type === "bar" ? h.push({ kind: "rect", leftMm: t.left + f * i + i * 0.125 + c * m, topMm: Math.min(s, t.y(0)), widthMm: m, heightMm: Math.abs(t.y(0) - s), style: { backgroundColor: a, borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } }) : (l && h.push(u(l.x, l.y, n, s, a, 1.2)), h.push({ kind: "ellipse", leftMm: n - 0.7, topMm: s - 0.7, widthMm: 1.4, heightMm: 1.4, style: { backgroundColor: a, borderColor: a } }), l = { x: n, y: s }), e.showValues && h.push({ ...M(d(g), n - i / 2, Math.max(t.top, s - 5), i), style: { fontSize: 7, color: a, align: "center" } });
|
|
64
64
|
}), h;
|
|
65
65
|
}
|
|
66
66
|
function C(e) {
|
|
67
67
|
w(e);
|
|
68
|
-
const t =
|
|
69
|
-
return [...
|
|
68
|
+
const t = v(e);
|
|
69
|
+
return [...x(e, t), ...e.series.flatMap((r, c) => k(e, t, r, c))];
|
|
70
70
|
}
|
|
71
71
|
export {
|
|
72
72
|
A as addDecimal,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
S as aggregateRows,
|
|
74
|
+
z as compareDecimal,
|
|
75
|
+
F as computeDataset,
|
|
76
|
+
N as createAggregateAccumulator,
|
|
77
77
|
C as createChartComponents,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
78
|
+
j as createCrossTable,
|
|
79
|
+
V as createMatrixTable,
|
|
80
|
+
R as decimalDigits,
|
|
81
|
+
T as divideDecimal,
|
|
82
|
+
q as estimateMatrixTable,
|
|
83
|
+
W as formatDecimal,
|
|
84
|
+
B as getComputationMetadata,
|
|
85
|
+
G as multiplyDecimal,
|
|
86
|
+
L as parseDecimal,
|
|
87
|
+
O as printDecimal,
|
|
88
|
+
P as validateComputedFields,
|
|
89
89
|
H as validateMatrixOptions
|
|
90
90
|
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|