@agile-team/mach-report 2.25.2 → 2.26.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 +12 -8
- package/dist/ExcelBindingWizard-B418l44t.js +1578 -0
- package/dist/ExcelBindingWizard-C4FGVsY_.cjs +1 -0
- package/dist/{ParamEditor-CGfaweYX.cjs → ParamEditor-BemJE8n8.cjs} +1 -1
- package/dist/{ParamEditor-B7YVD28E.js → ParamEditor-XvMtf_XQ.js} +2 -2
- package/dist/{ReportBatchPanel-BRJt0TXp.cjs → ReportBatchPanel-CbY4fvXD.cjs} +1 -1
- package/dist/{ReportBatchPanel-BTKHtLTW.js → ReportBatchPanel-Ds0R_uXn.js} +37 -37
- package/dist/{ReportLabelStudio-BvK_WBke.cjs → ReportLabelStudio-DuTwN5er.cjs} +1 -1
- package/dist/{ReportLabelStudio-CZwqyO3t.js → ReportLabelStudio-ZFy79eRv.js} +26 -26
- package/dist/ReportParamPanel-Chxu4MTx.cjs +1 -0
- package/dist/{ReportParamPanel-DGXzBzl2.js → ReportParamPanel-Czm3OPo_.js} +216 -205
- package/dist/{ReportPreview-D1ZC5kzz.js → ReportPreview-C9c0Rp7Y.js} +2938 -2875
- package/dist/ReportPreview-CIMR4ERo.cjs +6 -0
- package/dist/{ReportTemplateLibrary-ClwxhnC0.cjs → ReportTemplateLibrary-C6lByc69.cjs} +1 -1
- package/dist/{ReportTemplateLibrary-C7sB0Jay.js → ReportTemplateLibrary-XJVoTDIz.js} +1 -1
- package/dist/{RuleEditor-CsDGFaWz.js → RuleEditor-CeNFPeOc.js} +5 -5
- package/dist/{RuleEditor-D-OdaGdR.cjs → RuleEditor-gggUkEwB.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-DAqR9zQi.cjs → TemplateOutlinePanel-B0e-umq2.cjs} +1 -1
- package/dist/{TemplateOutlinePanel-CXOT7d1r.js → TemplateOutlinePanel-BWN4Y9iz.js} +2 -2
- package/dist/{TemplateReusePanel-Dcfx3Hba.js → TemplateReusePanel-CR-4OHoU.js} +2 -2
- package/dist/{TemplateReusePanel-ygIi-Ajz.cjs → TemplateReusePanel-Cthig1S1.cjs} +1 -1
- package/dist/{TemplateReviewPanel-COU8FqPq.js → TemplateReviewPanel-BkWzyNL4.js} +2 -2
- package/dist/{TemplateReviewPanel-DyGULVxr.cjs → TemplateReviewPanel-D8o2gDaK.cjs} +1 -1
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.js +5 -5
- package/dist/artifact-integrity.json +106 -102
- package/dist/{assets-C4MIvzQ4.js → assets-BFTP-0WR.js} +2 -2
- package/dist/{assets-BYdpkTIt.cjs → assets-CZiZhTf2.cjs} +1 -1
- package/dist/{auto-j7mr8Kvc.js → auto-C7udkeAa.js} +20 -19
- package/dist/auto-CXd2E2aZ.cjs +1 -0
- package/dist/capabilities-D8UU2clQ.cjs +1 -0
- package/dist/{capabilities-CN_kSVjO.js → capabilities-g0a2j9Yy.js} +50 -46
- package/dist/{charts-Cjw5AYkg.cjs → charts-D-Vg-ak9.cjs} +1 -1
- package/dist/{charts-CxJZ0XaY.js → charts-D48XCefN.js} +1 -1
- package/dist/computed-BQgBrma-.cjs +1 -0
- package/dist/{computed-f3pOqWLX.js → computed-CH3NYPOW.js} +198 -188
- package/dist/{data-bar-Bfh54sT4.js → data-bar-DjOgTLqu.js} +1 -1
- package/dist/{dataset-DL83majE.js → dataset-B8oTsC6o.js} +69 -66
- package/dist/dataset-D3OsyzG1.cjs +1 -0
- package/dist/designer-COuSUxZ1.cjs +2 -0
- package/dist/designer-CT4mlrr0.js +7997 -0
- package/dist/designer.cjs +1 -1
- package/dist/designer.d.cts +83 -4
- package/dist/designer.d.ts +83 -4
- package/dist/designer.js +4 -4
- package/dist/{diagnostic-collector-gB07PHy2.js → diagnostic-collector-C-JBA016.js} +2 -2
- package/dist/dom-DgWc-DY1.js +452 -0
- package/dist/dom-Fk4NF-gN.cjs +1 -0
- package/dist/{encoding-BWEMdzFG.js → encoding-D480EM2r.js} +2 -2
- package/dist/{encoding-DVea2qIR.cjs → encoding-tWc2Wn89.cjs} +1 -1
- package/dist/execution-result-7sG_mdcD.cjs +1 -0
- package/dist/execution-result-Ba65gieT.js +39 -0
- package/dist/{font-loader-p_SyTvqt.cjs → font-loader-BIxme_9g.cjs} +1 -1
- package/dist/{font-loader-D4NLIKJL.js → font-loader-CHmEwkHl.js} +1 -1
- package/dist/{grid-strokes-DkZEZvcI.js → grid-strokes-DsoICRjZ.js} +1 -1
- package/dist/import-range-BwT86Z3j.cjs +1 -0
- package/dist/import-range-D9p_blcb.js +98 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +25 -25
- package/dist/{json-snapshot-DdzALe8q.js → json-snapshot-BZ0CIQln.js} +1041 -887
- package/dist/json-snapshot-DGFeI30h.cjs +2 -0
- package/dist/{matrix-b6T291xo.js → matrix-CB9TqTEy.js} +1 -1
- package/dist/{matrix-DUYPRL7t.cjs → matrix-CcqYOuq_.cjs} +1 -1
- package/dist/{pdf-DU8HelKd.js → pdf-DTR7fAIr.js} +3596 -3517
- package/dist/{pdf-C060D5UY.cjs → pdf-d9oJ6V0P.cjs} +49 -49
- package/dist/pdf.cjs +1 -1
- package/dist/pdf.js +2 -2
- package/dist/{plugin-D5BRHlne.cjs → plugin-B7Bi-1te.cjs} +1 -1
- package/dist/{plugin-FWhTnjr0.js → plugin-OKDFQFS4.js} +1 -1
- package/dist/{prefill-m01IM1hl.js → prefill-C8fF91JB.js} +3 -3
- package/dist/{prefill-DZymomY6.cjs → prefill-C_Bf_AMo.cjs} +1 -1
- package/dist/{prepared-BHu8bIdj.cjs → prepared-BLhV7vdE.cjs} +1 -1
- package/dist/{prepared-DO5pe6Ed.js → prepared-DhgQ0d-h.js} +7 -7
- package/dist/protocol-CZ-BILne.cjs +1 -0
- package/dist/{protocol-CZddmu2n.js → protocol-DHO91-Jt.js} +3 -3
- package/dist/{record-bindings-Cv7lFiof.js → record-bindings-DBrCu6zO.js} +3 -3
- package/dist/{record-bindings-B7djSjNs.cjs → record-bindings-KEs-DKCS.cjs} +1 -1
- package/dist/region-binding-workflow-FSyIZge8.js +882 -0
- package/dist/region-binding-workflow-ikpY1Kbw.cjs +3 -0
- package/dist/report-encoding-worker.cjs +1 -1
- package/dist/report-encoding-worker.js +1 -1
- package/dist/rich-text-layout-BYbIc3eJ.cjs +3 -0
- package/dist/rich-text-layout-BtygMWZC.js +96 -0
- package/dist/runtime-B5HG8poy.cjs +1 -0
- package/dist/runtime-BsvAqz4a.js +204 -0
- package/dist/sbom.cdx.json +1 -1
- package/dist/server-node.cjs +5 -5
- package/dist/server-node.js +2049 -1889
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +35 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.js +340 -328
- package/dist/style.css +1 -1
- package/dist/{template-catalog-DLu814zA.js → template-catalog-BbrN9dgu.js} +5 -5
- package/dist/{template-catalog-Lil5Ryt-.cjs → template-catalog-DDH-5J57.cjs} +1 -1
- package/dist/{template-fragments-BDxdCuMD.js → template-fragments-CUTE8-_I.js} +3 -3
- package/dist/{template-fragments-DbKdxI1z.cjs → template-fragments-cyAQu7aw.cjs} +1 -1
- package/dist/{template-registry-B-AK1oam.cjs → template-registry-D24Z8aQf.cjs} +1 -1
- package/dist/{template-registry-DeVgwEZj.js → template-registry-PSuLsnyq.js} +4 -4
- package/dist/{template-serialization-CqQY4zDg.cjs → template-serialization-BOUidUlh.cjs} +1 -1
- package/dist/{template-serialization-CWmHq7lX.js → template-serialization-BgGWYV_1.js} +1 -1
- package/dist/{textwrap-BywMBMXM.js → textwrap-Bt_tnI6V.js} +1 -1
- package/dist/vue/async.d.cts +46 -3
- package/dist/vue/async.d.ts +46 -3
- package/dist/vue/index.d.cts +215 -24
- package/dist/vue/index.d.ts +215 -24
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +3 -3
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +433 -202
- package/dist/workbook-session-BJfZVp4q.cjs +29 -0
- package/dist/{workbook-session-B6hRjTyX.js → workbook-session-DRnMjIFK.js} +2377 -2350
- package/dist/worker.cjs +1 -1
- package/dist/worker.js +4 -4
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.d.cts +27 -2
- package/dist/xlsx.d.ts +27 -2
- package/dist/xlsx.js +15 -15
- package/package.json +1 -1
- package/dist/ExcelBindingWizard-bs3F4dD8.js +0 -1486
- package/dist/ExcelBindingWizard-jSdjBtWw.cjs +0 -1
- package/dist/ReportParamPanel-B27IGJjk.cjs +0 -1
- package/dist/ReportPreview-DAU-V3Ov.cjs +0 -6
- package/dist/auto-DjmvmcX-.cjs +0 -1
- package/dist/capabilities-D4nfhcvB.cjs +0 -1
- package/dist/computed-DK6BruFz.cjs +0 -1
- package/dist/dataset-IrlXbUvh.cjs +0 -1
- package/dist/designer-B597ZdC0.js +0 -7595
- package/dist/designer-DFIdv_n7.cjs +0 -2
- package/dist/dom-CXWMmwh-.cjs +0 -1
- package/dist/dom-DxdCMLzs.js +0 -452
- package/dist/json-snapshot-L_gJ7KRS.cjs +0 -2
- package/dist/protocol-CymmHWmL.cjs +0 -1
- package/dist/region-binding-workflow-EYxvUYJ-.js +0 -977
- package/dist/region-binding-workflow-NdkMSFCh.cjs +0 -3
- package/dist/rich-text-layout-Ch_N0Ubu.js +0 -52
- package/dist/rich-text-layout-yJGuThtC.cjs +0 -3
- package/dist/runtime-D8AlfJ6S.js +0 -234
- package/dist/runtime-ywf3oLBR.cjs +0 -1
- package/dist/workbook-session-BclW7KKH.cjs +0 -29
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function L(r, e, t) {
|
|
2
2
|
if (!Array.isArray(r) || Object.getPrototypeOf(r) !== Array.prototype || r.length > e) throw new TypeError(`${t}应为有界普通数组`);
|
|
3
3
|
if (Reflect.ownKeys(r).length !== r.length + 1) throw new TypeError(`${t}不支持自定义数组方法或迭代器`);
|
|
4
4
|
const n = [];
|
|
@@ -9,14 +9,14 @@ function G(r, e, t) {
|
|
|
9
9
|
}
|
|
10
10
|
return n;
|
|
11
11
|
}
|
|
12
|
-
const
|
|
13
|
-
function
|
|
14
|
-
if (!Number.isSafeInteger(r) || r < 0 || r >
|
|
12
|
+
const A = 1e3;
|
|
13
|
+
function w(r) {
|
|
14
|
+
if (!Number.isSafeInteger(r) || r < 0 || r > A * 2)
|
|
15
15
|
throw new Error("十进制精度超出预算");
|
|
16
16
|
return 10n ** BigInt(r);
|
|
17
17
|
}
|
|
18
18
|
function j(r) {
|
|
19
|
-
if (r.coefficient.toString().length >
|
|
19
|
+
if (r.coefficient.toString().length > A * 2 || r.scale > A * 2)
|
|
20
20
|
throw new Error("十进制结果超出精度预算");
|
|
21
21
|
return r;
|
|
22
22
|
}
|
|
@@ -24,7 +24,7 @@ function u(r) {
|
|
|
24
24
|
if (typeof r != "string" && !(typeof r == "number" && Number.isFinite(r)))
|
|
25
25
|
throw new Error("十进制参数必须是有限数字或十进制文本");
|
|
26
26
|
const e = String(r);
|
|
27
|
-
if (e.length >
|
|
27
|
+
if (e.length > A) throw new Error("十进制文本超出精度预算");
|
|
28
28
|
const t = /^([+-]?)(\d+)(?:\.(\d*))?(?:[eE]([+-]?\d{1,4}))?$/.exec(
|
|
29
29
|
e
|
|
30
30
|
);
|
|
@@ -33,61 +33,61 @@ function u(r) {
|
|
|
33
33
|
`${t[1] === "-" ? "-" : ""}${t[2]}${n}`
|
|
34
34
|
);
|
|
35
35
|
return j(
|
|
36
|
-
c < 0 ? { coefficient: i *
|
|
36
|
+
c < 0 ? { coefficient: i * w(-c), scale: 0 } : { coefficient: i, scale: c }
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function H(r, e) {
|
|
40
40
|
const t = Math.max(r.scale, e.scale);
|
|
41
41
|
return [
|
|
42
|
-
r.coefficient *
|
|
43
|
-
e.coefficient *
|
|
42
|
+
r.coefficient * w(t - r.scale),
|
|
43
|
+
e.coefficient * w(t - e.scale),
|
|
44
44
|
t
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
const [t, n] =
|
|
47
|
+
function O(r, e) {
|
|
48
|
+
const [t, n] = H(r, e);
|
|
49
49
|
return t < n ? -1 : t > n ? 1 : 0;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
const [t, n, o] =
|
|
51
|
+
function v(r, e) {
|
|
52
|
+
const [t, n, o] = H(r, e);
|
|
53
53
|
return j({ coefficient: t + n, scale: o });
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function $(r, e) {
|
|
56
56
|
return j({
|
|
57
57
|
coefficient: r.coefficient * e.coefficient,
|
|
58
58
|
scale: r.scale + e.scale
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function Q(r, e) {
|
|
62
62
|
const t = r / e, n = r % e, o = (c) => c < 0n ? -c : c;
|
|
63
63
|
return o(n) * 2n < o(e) ? t : t + (r < 0n == e < 0n ? 1n : -1n);
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function y(r) {
|
|
66
66
|
if (!Number.isInteger(r) || r < 0 || r > 100)
|
|
67
67
|
throw new Error("十进制小数位应为 0–100 的整数");
|
|
68
68
|
}
|
|
69
69
|
function k(r, e, t = 20) {
|
|
70
|
-
if (
|
|
71
|
-
const n = e.scale - r.scale + t, o = r.coefficient *
|
|
70
|
+
if (y(t), e.coefficient === 0n) throw new Error("不能除以零");
|
|
71
|
+
const n = e.scale - r.scale + t, o = r.coefficient * w(Math.max(0, n)), c = e.coefficient * w(Math.max(0, -n));
|
|
72
72
|
return j({
|
|
73
|
-
coefficient:
|
|
73
|
+
coefficient: Q(o, c),
|
|
74
74
|
scale: t
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
77
|
function F(r, e) {
|
|
78
78
|
let t = r.coefficient, n = r.scale;
|
|
79
|
-
e !== void 0 && (
|
|
79
|
+
e !== void 0 && (y(e), t = e >= n ? t * w(e - n) : Q(t, w(n - e)), n = e);
|
|
80
80
|
const o = t < 0n, c = (o ? -t : t).toString().padStart(n + 1, "0");
|
|
81
81
|
let i = n ? c.slice(-n) : "";
|
|
82
82
|
return e === void 0 && (i = i.replace(/0+$/, "")), `${o ? "-" : ""}${n ? c.slice(0, -n) : c}${i ? `.${i}` : ""}`;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Br(r, e, t = !1, n = !1) {
|
|
85
85
|
let o = u(r);
|
|
86
|
-
n && (o =
|
|
86
|
+
n && (o = $(o, { coefficient: 100n, scale: 0 }));
|
|
87
87
|
const [c, i] = F(o, e).split(".");
|
|
88
88
|
return `${t ? c.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : c}${i === void 0 ? "" : `.${i}`}${n ? "%" : ""}`;
|
|
89
89
|
}
|
|
90
|
-
const
|
|
90
|
+
const tr = [
|
|
91
91
|
"sum",
|
|
92
92
|
"count",
|
|
93
93
|
"avg",
|
|
@@ -95,17 +95,17 @@ const er = [
|
|
|
95
95
|
"max",
|
|
96
96
|
"weightedAvg"
|
|
97
97
|
];
|
|
98
|
-
function
|
|
98
|
+
function U(r) {
|
|
99
99
|
if (typeof r != "number" || !Number.isFinite(r))
|
|
100
100
|
throw new Error(
|
|
101
101
|
"聚合度量必须是有限数字,不能隐式转换;小数文本请显式选择 decimal"
|
|
102
102
|
);
|
|
103
103
|
return r;
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function N(r, e) {
|
|
106
106
|
return e && Object.prototype.hasOwnProperty.call(r, e) ? r[e] : void 0;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function nr(r) {
|
|
109
109
|
let e = 0, t = 0, n = 0, o = 0, c = 1 / 0, i = -1 / 0;
|
|
110
110
|
const a = (s) => {
|
|
111
111
|
const f = s - n, l = t + f;
|
|
@@ -113,18 +113,18 @@ function tr(r) {
|
|
|
113
113
|
};
|
|
114
114
|
return {
|
|
115
115
|
add(s) {
|
|
116
|
-
const f =
|
|
116
|
+
const f = N(s, r.field);
|
|
117
117
|
if (r.op === "count") {
|
|
118
118
|
(!r.field || f != null) && e++;
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
if (f == null) return;
|
|
122
|
-
const l =
|
|
122
|
+
const l = U(f), g = r.op === "weightedAvg" ? N(s, r.weightField) : 1;
|
|
123
123
|
if (g == null) return;
|
|
124
|
-
const
|
|
125
|
-
if (r.op === "weightedAvg" &&
|
|
124
|
+
const d = U(g);
|
|
125
|
+
if (r.op === "weightedAvg" && d < 0)
|
|
126
126
|
throw new Error("加权平均的权重不能为负数");
|
|
127
|
-
["sum", "avg", "weightedAvg"].includes(r.op) && a(l *
|
|
127
|
+
["sum", "avg", "weightedAvg"].includes(r.op) && a(l * d), o += d, c = Math.min(c, l), i = Math.max(i, l), e++;
|
|
128
128
|
},
|
|
129
129
|
value() {
|
|
130
130
|
if (r.op === "count") return e;
|
|
@@ -136,22 +136,22 @@ function tr(r) {
|
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function or(r) {
|
|
140
140
|
let e = 0, t = u("0"), n = u("0"), o, c;
|
|
141
141
|
return {
|
|
142
142
|
add(i) {
|
|
143
|
-
const a =
|
|
143
|
+
const a = N(i, r.field);
|
|
144
144
|
if (r.op === "count") {
|
|
145
145
|
(!r.field || a != null) && e++;
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
if (a == null) return;
|
|
149
|
-
const s = r.op === "weightedAvg" ?
|
|
149
|
+
const s = r.op === "weightedAvg" ? N(i, r.weightField) : "1";
|
|
150
150
|
if (s == null) return;
|
|
151
151
|
const f = u(a), l = u(s);
|
|
152
152
|
if (r.op === "weightedAvg" && l.coefficient < 0n)
|
|
153
153
|
throw new Error("加权平均的权重不能为负数");
|
|
154
|
-
["sum", "avg", "weightedAvg"].includes(r.op) && (t =
|
|
154
|
+
["sum", "avg", "weightedAvg"].includes(r.op) && (t = v(t, $(f, l))), r.op === "weightedAvg" && (n = v(n, l)), (!o || O(f, o) < 0) && (o = f), (!c || O(f, c) > 0) && (c = f), e++;
|
|
155
155
|
},
|
|
156
156
|
value() {
|
|
157
157
|
if (r.op === "count") return e;
|
|
@@ -162,30 +162,30 @@ function nr(r) {
|
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
if (r.digits !== void 0 &&
|
|
165
|
+
function P(r) {
|
|
166
|
+
if (r.digits !== void 0 && y(r.digits), r.numeric !== void 0 && r.numeric !== "number" && r.numeric !== "decimal")
|
|
167
167
|
throw new Error("未知聚合数值模式");
|
|
168
|
-
if (!
|
|
168
|
+
if (!tr.includes(r.op)) throw new Error("未知聚合操作");
|
|
169
169
|
if (r.op !== "count" && !r.field)
|
|
170
170
|
throw new Error("聚合需要度量字段");
|
|
171
171
|
if (r.op === "weightedAvg" && !r.weightField)
|
|
172
172
|
throw new Error("加权平均需要权重字段");
|
|
173
|
-
return r.numeric === "decimal" ?
|
|
173
|
+
return r.numeric === "decimal" ? or(r) : nr(r);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
const t =
|
|
175
|
+
function V(r, e) {
|
|
176
|
+
const t = P(e);
|
|
177
177
|
for (const n of r) t.add(n);
|
|
178
178
|
return t.value();
|
|
179
179
|
}
|
|
180
|
-
const
|
|
181
|
-
function
|
|
180
|
+
const q = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
181
|
+
function rr(r) {
|
|
182
182
|
if (!r || typeof r != "object" || Array.isArray(r) || ![Object.prototype, null].includes(Object.getPrototypeOf(r))) throw new Error("条件应为普通声明式对象");
|
|
183
|
-
for (const [e, t] of Object.entries(Object.getOwnPropertyDescriptors(r))) if (
|
|
183
|
+
for (const [e, t] of Object.entries(Object.getOwnPropertyDescriptors(r))) if (q.has(e) || !Object.prototype.hasOwnProperty.call(t, "value")) throw new Error("条件不允许访问器或不安全属性");
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
if (typeof r != "string" || !r.trim() || r.length > 512 ||
|
|
185
|
+
function W(r) {
|
|
186
|
+
if (typeof r != "string" || !r.trim() || r.length > 512 || q.has(r)) throw new Error("条件字段应为安全的非空字段名");
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function D(r) {
|
|
189
189
|
if (r !== null && typeof r != "boolean" && typeof r != "string" && !(typeof r == "number" && Number.isFinite(r))) throw new Error("条件常量应为有限 JSON 标量");
|
|
190
190
|
if (typeof r == "string" && r.length > 16384) throw new Error("条件文本超出预算");
|
|
191
191
|
}
|
|
@@ -195,46 +195,46 @@ function R(r) {
|
|
|
195
195
|
if (o.setUTCFullYear(e, t - 1, n), o.setUTCHours(0, 0, 0, 0), o.getUTCFullYear() !== e || o.getUTCMonth() !== t - 1 || o.getUTCDate() !== n) throw new Error("无效日历日");
|
|
196
196
|
return r;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function z(r) {
|
|
199
199
|
return ["string", "boolean"].includes(typeof r) || typeof r == "number" && Number.isFinite(r);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function J(r) {
|
|
202
202
|
return r == null || r === "";
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function ir(r) {
|
|
205
205
|
const e = r.values?.[0] ?? (r.right && "value" in r.right ? r.right.value : r.value);
|
|
206
206
|
return r.valueType ?? r.numeric ?? (typeof e == "number" ? "decimal" : typeof e == "boolean" ? "boolean" : "text");
|
|
207
207
|
}
|
|
208
|
-
function
|
|
209
|
-
if (
|
|
210
|
-
const n =
|
|
208
|
+
function E(r, e, t) {
|
|
209
|
+
if (J(r) || J(e)) return;
|
|
210
|
+
const n = ir(t);
|
|
211
211
|
try {
|
|
212
|
-
if (n === "decimal") return
|
|
212
|
+
if (n === "decimal") return O(u(r), u(e));
|
|
213
213
|
if (n === "number")
|
|
214
|
-
return !["number", "string"].includes(typeof r) || !["number", "string"].includes(typeof e) ? void 0 :
|
|
215
|
-
if (n === "date" && (r = R(r), e = R(e)), n === "boolean" && (typeof r != "boolean" || typeof e != "boolean") || n === "text" && (!
|
|
214
|
+
return !["number", "string"].includes(typeof r) || !["number", "string"].includes(typeof e) ? void 0 : O(u(r), u(e));
|
|
215
|
+
if (n === "date" && (r = R(r), e = R(e)), n === "boolean" && (typeof r != "boolean" || typeof e != "boolean") || n === "text" && (!z(r) || !z(e))) return;
|
|
216
216
|
const o = String(r), c = String(e);
|
|
217
217
|
return o < c ? -1 : o > c ? 1 : 0;
|
|
218
218
|
} catch {
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
if (
|
|
222
|
+
function cr(r) {
|
|
223
|
+
if (W(r.field), ![">", ">=", "<", "<=", "==", "!=", "between", "contains", "isNull", "isNotNull"].includes(r.op)) throw new Error("未知条件运算符");
|
|
224
224
|
if (r.numeric !== void 0 && !["number", "decimal"].includes(r.numeric)) throw new Error("未知条件数值模式");
|
|
225
225
|
if (r.valueType !== void 0 && !["number", "decimal", "text", "date", "boolean"].includes(r.valueType)) throw new Error("未知条件值类型");
|
|
226
226
|
if (!(r.op === "isNull" || r.op === "isNotNull"))
|
|
227
227
|
if (r.op === "between") {
|
|
228
228
|
if (!Array.isArray(r.values) || r.values.length !== 2 || Object.keys(r.values).length !== 2) throw new Error("范围条件需要两个明确边界");
|
|
229
|
-
r.values.forEach(
|
|
230
|
-
const e =
|
|
229
|
+
r.values.forEach(D);
|
|
230
|
+
const e = E(r.values[0], r.values[1], r);
|
|
231
231
|
if (e === void 0 || e > 0) throw new Error("范围边界无效或顺序颠倒");
|
|
232
232
|
} else if (r.right !== void 0) {
|
|
233
|
-
if (
|
|
234
|
-
if ("field" in r.right ?
|
|
235
|
-
} else
|
|
233
|
+
if (rr(r.right), Object.keys(r.right).length !== 1) throw new Error("条件 right 只能指定一个 field 或 value");
|
|
234
|
+
if ("field" in r.right ? W(r.right.field) : D(r.right.value), r.value !== void 0) throw new Error("条件不能同时指定 value 和 right");
|
|
235
|
+
} else D(r.value);
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function M(r, e) {
|
|
238
238
|
if (e === void 0) return !1;
|
|
239
239
|
switch (r) {
|
|
240
240
|
case ">":
|
|
@@ -253,45 +253,45 @@ function D(r, e) {
|
|
|
253
253
|
return !1;
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
|
|
256
|
+
function ar(r) {
|
|
257
|
+
cr(r), r = { ...r, right: r.right ? { ...r.right } : void 0, values: r.values ? [r.values[0], r.values[1]] : void 0 };
|
|
258
258
|
const e = (t, n) => Object.prototype.hasOwnProperty.call(t, n) ? t[n] : void 0;
|
|
259
259
|
return (t) => {
|
|
260
260
|
const n = e(t, r.field);
|
|
261
261
|
if (r.op === "isNull") return n == null;
|
|
262
262
|
if (r.op === "isNotNull") return n != null;
|
|
263
|
-
if (r.op === "between") return
|
|
263
|
+
if (r.op === "between") return M(">=", E(n, r.values[0], r)) && M("<=", E(n, r.values[1], r));
|
|
264
264
|
const o = r.right ? "field" in r.right ? e(t, r.right.field) : r.right.value : r.value;
|
|
265
|
-
return r.op === "contains" ? typeof n == "string" && typeof o == "string" && n.includes(o) :
|
|
265
|
+
return r.op === "contains" ? typeof n == "string" && typeof o == "string" && n.includes(o) : M(r.op, E(n, o, r));
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function h(r, e = { nodes: 0 }, t = 0) {
|
|
269
269
|
if (++e.nodes > 256 || t > 16) throw new Error("条件超出深度或节点预算");
|
|
270
|
-
if (
|
|
270
|
+
if (rr(r), ["all", "any", "not", "field"].filter((o) => Object.prototype.hasOwnProperty.call(r, o)).length !== 1) throw new Error("条件只能指定一种组合或比较");
|
|
271
271
|
if ("not" in r) {
|
|
272
|
-
const o =
|
|
272
|
+
const o = h(r.not, e, t + 1);
|
|
273
273
|
return (c) => !o(c);
|
|
274
274
|
}
|
|
275
275
|
if ("all" in r || "any" in r) {
|
|
276
276
|
const o = "all" in r ? r.all : r.any;
|
|
277
277
|
if (!Array.isArray(o) || o.length < 1 || o.length > 256 || Object.keys(o).length !== o.length) throw new Error("组合条件需要有界、无空位的非空数组");
|
|
278
|
-
const c = o.map((i) =>
|
|
278
|
+
const c = o.map((i) => h(i, e, t + 1));
|
|
279
279
|
return "all" in r ? (i) => c.every((a) => a(i)) : (i) => c.some((a) => a(i));
|
|
280
280
|
}
|
|
281
|
-
return
|
|
281
|
+
return ar(r);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
284
|
-
return
|
|
283
|
+
function _r(r, e) {
|
|
284
|
+
return h(e)(r);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
|
|
286
|
+
function sr(r) {
|
|
287
|
+
h(r);
|
|
288
288
|
const e = /* @__PURE__ */ new Set();
|
|
289
289
|
function t(n) {
|
|
290
290
|
"all" in n ? n.all.forEach(t) : "any" in n ? n.any.forEach(t) : "not" in n ? t(n.not) : (e.add(n.field), n.right && "field" in n.right && e.add(n.right.field));
|
|
291
291
|
}
|
|
292
292
|
return t(r), [...e];
|
|
293
293
|
}
|
|
294
|
-
const
|
|
294
|
+
const fr = [
|
|
295
295
|
{ name: "add", minArgs: 2, maxArgs: 256, input: "numeric", output: "numeric", example: "add(quantity, adjustment)" },
|
|
296
296
|
{ name: "subtract", minArgs: 2, maxArgs: 2, input: "numeric", output: "numeric", example: "subtract(input, output)" },
|
|
297
297
|
{ name: "multiply", minArgs: 2, maxArgs: 256, input: "numeric", output: "numeric", example: "multiply(quantity, price)" },
|
|
@@ -307,13 +307,13 @@ const sr = [
|
|
|
307
307
|
{ name: "dateYear", minArgs: 1, maxArgs: 1, input: "YYYY-MM-DD", output: "number", example: "dateYear(reportDate)" },
|
|
308
308
|
{ name: "dateMonth", minArgs: 1, maxArgs: 1, input: "YYYY-MM-DD", output: "number", example: "dateMonth(reportDate)" },
|
|
309
309
|
{ name: "dateDay", minArgs: 1, maxArgs: 1, input: "YYYY-MM-DD", output: "number", example: "dateDay(reportDate)" }
|
|
310
|
-
], T = Object.freeze(
|
|
311
|
-
function
|
|
310
|
+
], T = Object.freeze(fr.map((r) => Object.freeze(r)));
|
|
311
|
+
function lr(r, e, t, n, o) {
|
|
312
312
|
if (e.some((a) => a == null)) {
|
|
313
313
|
if (o === "error") throw new Error("函数参数包含空值");
|
|
314
314
|
return null;
|
|
315
315
|
}
|
|
316
|
-
if (r === "round" || r === "abs") return
|
|
316
|
+
if (r === "round" || r === "abs") return ur(r, e, t, n);
|
|
317
317
|
if (r.startsWith("date")) {
|
|
318
318
|
const a = R(e[0]);
|
|
319
319
|
return Number(a.slice(r === "dateYear" ? 0 : r === "dateMonth" ? 5 : 8, r === "dateYear" ? 4 : r === "dateMonth" ? 7 : 10));
|
|
@@ -324,7 +324,7 @@ function fr(r, e, t, n, o) {
|
|
|
324
324
|
if (i.length > 1e6) throw new Error("计算文本超出长度预算");
|
|
325
325
|
return i;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function ur(r, e, t, n) {
|
|
328
328
|
const o = e[0];
|
|
329
329
|
if (t !== "decimal" && (typeof o != "number" || !Number.isFinite(o))) throw new Error("普通数值函数需要有限数字");
|
|
330
330
|
const c = u(o);
|
|
@@ -332,27 +332,27 @@ function lr(r, e, t, n) {
|
|
|
332
332
|
const i = r === "round" ? e.length === 2 ? e[1] : n ?? 0 : n;
|
|
333
333
|
if (i !== void 0) {
|
|
334
334
|
if (typeof i != "number") throw new Error("小数位必须为数字");
|
|
335
|
-
|
|
335
|
+
y(i);
|
|
336
336
|
}
|
|
337
337
|
const a = F(c, i), s = Number(a);
|
|
338
338
|
if (t !== "decimal" && !Number.isFinite(s)) throw new Error("计算结果不是有限数字");
|
|
339
339
|
return t === "decimal" ? a : s;
|
|
340
340
|
}
|
|
341
|
-
const
|
|
341
|
+
const mr = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
342
342
|
function m(r) {
|
|
343
|
-
if (typeof r != "string" || !r.trim() ||
|
|
343
|
+
if (typeof r != "string" || !r.trim() || mr.has(r))
|
|
344
344
|
throw new Error("计算字段应为安全的非空字段名");
|
|
345
345
|
}
|
|
346
346
|
function Y(r) {
|
|
347
347
|
return r === null || ["string", "boolean"].includes(typeof r) || typeof r == "number" && Number.isFinite(r);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function gr(r) {
|
|
350
350
|
if (r.some((e) => typeof e != "number" || !Number.isFinite(e)))
|
|
351
351
|
throw new Error("算术参数必须是有限数字;空值和小数文本不会隐式转换");
|
|
352
352
|
return r;
|
|
353
353
|
}
|
|
354
|
-
function
|
|
355
|
-
const t =
|
|
354
|
+
function dr(r, e) {
|
|
355
|
+
const t = gr(e);
|
|
356
356
|
let n;
|
|
357
357
|
if (r === "add") n = t.reduce((o, c) => o + c, 0);
|
|
358
358
|
else if (r === "multiply") n = t.reduce((o, c) => o * c, 1);
|
|
@@ -367,15 +367,15 @@ function gr(r, e) {
|
|
|
367
367
|
function pr(r, e, t) {
|
|
368
368
|
const n = e.map(u);
|
|
369
369
|
let o;
|
|
370
|
-
return r === "add" ? o = n.reduce(
|
|
370
|
+
return r === "add" ? o = n.reduce(v) : r === "multiply" ? o = n.reduce($) : r === "subtract" ? o = v(n[0], {
|
|
371
371
|
...n[1],
|
|
372
372
|
coefficient: -n[1].coefficient
|
|
373
373
|
}) : o = k(n[0], n[1], t), F(o, t);
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
return t.nulls !== "error" && e.some((n) => n == null) || r === "divide" && t.divisionByZero === "null" && (t.numeric === "decimal" ? u(e[1]).coefficient === 0n : e[1] === 0) ? null : t.numeric === "decimal" ? pr(r, e, t.digits) :
|
|
375
|
+
function wr(r, e, t) {
|
|
376
|
+
return t.nulls !== "error" && e.some((n) => n == null) || r === "divide" && t.divisionByZero === "null" && (t.numeric === "decimal" ? u(e[1]).coefficient === 0n : e[1] === 0) ? null : t.numeric === "decimal" ? pr(r, e, t.digits) : dr(r, e);
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function hr(r, e) {
|
|
379
379
|
r.field !== void 0 && m(r.field), r.weightField !== void 0 && m(r.weightField);
|
|
380
380
|
const t = {
|
|
381
381
|
op: r.aggregate,
|
|
@@ -384,13 +384,13 @@ function wr(r, e) {
|
|
|
384
384
|
numeric: e.numeric,
|
|
385
385
|
digits: e.digits
|
|
386
386
|
};
|
|
387
|
-
|
|
387
|
+
V([], t);
|
|
388
388
|
const n = /* @__PURE__ */ new WeakMap();
|
|
389
389
|
return (o) => {
|
|
390
390
|
let c = n.get(o.rows);
|
|
391
391
|
if (!c) {
|
|
392
392
|
try {
|
|
393
|
-
c = { value:
|
|
393
|
+
c = { value: V(o.rows, t) };
|
|
394
394
|
} catch (i) {
|
|
395
395
|
c = {
|
|
396
396
|
error: i instanceof Error ? i : new Error(String(i))
|
|
@@ -402,7 +402,7 @@ function wr(r, e) {
|
|
|
402
402
|
return c.value;
|
|
403
403
|
};
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function yr(r, e) {
|
|
406
406
|
for (const t of r) {
|
|
407
407
|
const n = t(e);
|
|
408
408
|
if (n != null) return n;
|
|
@@ -414,7 +414,7 @@ function B(r, e = {}, t = { nodes: 0 }, n = 0) {
|
|
|
414
414
|
throw new Error("计算表达式超出深度或节点预算");
|
|
415
415
|
if (!r || typeof r != "object" || Array.isArray(r))
|
|
416
416
|
throw new Error("计算表达式应为声明式对象");
|
|
417
|
-
if ("aggregate" in r) return
|
|
417
|
+
if ("aggregate" in r) return hr(r, e);
|
|
418
418
|
if ("field" in r) {
|
|
419
419
|
m(r.field);
|
|
420
420
|
const o = r.field;
|
|
@@ -425,74 +425,74 @@ function B(r, e = {}, t = { nodes: 0 }, n = 0) {
|
|
|
425
425
|
throw new Error("常量应为有限 JSON 标量");
|
|
426
426
|
return () => r.value;
|
|
427
427
|
}
|
|
428
|
-
return
|
|
428
|
+
return Er(r, e, t, n);
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function Er(r, e, t, n) {
|
|
431
431
|
const o = T.find((a) => a.name === r.op);
|
|
432
432
|
if (!o || !Array.isArray(r.args)) throw new Error("未知计算操作");
|
|
433
433
|
if (r.args.length > 256 || Object.keys(r.args).length !== r.args.length) throw new Error("计算参数超出预算或包含空位");
|
|
434
434
|
if (r.args.length < o.minArgs || r.args.length > o.maxArgs) throw new Error("运算参数数量不正确");
|
|
435
|
-
const c = r.op === "if" ?
|
|
435
|
+
const c = r.op === "if" ? h(r.condition, t, n + 1) : void 0;
|
|
436
436
|
if (r.op !== "if" && r.condition !== void 0) throw new Error("仅 IF 运算接受 condition");
|
|
437
437
|
const i = r.args.map(
|
|
438
438
|
(a) => B(a, e, t, n + 1)
|
|
439
439
|
);
|
|
440
|
-
return c ? (a) => i[c(a.row) ? 0 : 1](a) : ["add", "subtract", "multiply", "divide", "coalesce"].includes(r.op) ? r.op === "coalesce" ? (a) =>
|
|
440
|
+
return c ? (a) => i[c(a.row) ? 0 : 1](a) : ["add", "subtract", "multiply", "divide", "coalesce"].includes(r.op) ? r.op === "coalesce" ? (a) => yr(i, a) : (a) => wr(
|
|
441
441
|
r.op,
|
|
442
442
|
i.map((s) => s(a)),
|
|
443
443
|
e
|
|
444
|
-
) : (a) =>
|
|
444
|
+
) : (a) => lr(r.op, i.map((s) => s(a)), e.numeric, e.digits, e.nulls);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function br(r) {
|
|
447
447
|
B(r);
|
|
448
448
|
const e = /* @__PURE__ */ new Set(), t = (n) => {
|
|
449
|
-
"field" in n && n.field && e.add(n.field), "aggregate" in n && n.weightField && e.add(n.weightField), "args" in n && (n.args.forEach(t), n.condition &&
|
|
449
|
+
"field" in n && n.field && e.add(n.field), "aggregate" in n && n.weightField && e.add(n.weightField), "args" in n && (n.args.forEach(t), n.condition && sr(n.condition).forEach((o) => e.add(o)));
|
|
450
450
|
};
|
|
451
451
|
return t(r), [...e];
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function S(r, e, t) {
|
|
454
454
|
if (r === void 0) return e;
|
|
455
455
|
if (!Number.isSafeInteger(r) || Number(r) < 1 || Number(r) > t) throw new RangeError("图表预算超出允许范围");
|
|
456
456
|
return Number(r);
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function Ar(r) {
|
|
459
459
|
if (!r || typeof r != "object" || Array.isArray(r)) throw new TypeError("图表绑定应为对象");
|
|
460
460
|
if (m(r.dataset), m(r.categoryField), !["bar", "line", "stackedBar", "percentBar"].includes(r.type)) throw new TypeError("图表类型无效");
|
|
461
461
|
if (r.sort !== void 0 && !["asc", "desc"].includes(r.sort)) throw new TypeError("图表排序无效");
|
|
462
462
|
if (r.title !== void 0 && (typeof r.title != "string" || r.title.length > 512)) throw new TypeError("图表标题过长");
|
|
463
463
|
if (r.showValues !== void 0 && typeof r.showValues != "boolean") throw new TypeError("图表数值标签应为布尔值");
|
|
464
464
|
if (!Array.isArray(r.measures) || !r.measures.length || r.measures.length > 12) throw new RangeError("图表支持 1–12 个度量");
|
|
465
|
-
for (const e of
|
|
466
|
-
|
|
465
|
+
for (const e of L(r.measures, 12, "图表度量")) Or(e);
|
|
466
|
+
S(r.maxRows, 1e5, 1e5), S(r.maxCategories, 200, 200);
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function Or(r) {
|
|
469
469
|
if (!r || typeof r != "object" || Array.isArray(r)) throw new TypeError("图表度量应为对象");
|
|
470
470
|
if (r.field !== void 0 && m(r.field), r.weightField !== void 0 && m(r.weightField), r.label !== void 0 && (typeof r.label != "string" || r.label.length > 256)) throw new TypeError("图表系列名称过长");
|
|
471
471
|
if (r.color !== void 0 && !/^#[\da-f]{6}$/i.test(r.color)) throw new TypeError("图表颜色应为 #RRGGBB");
|
|
472
|
-
|
|
472
|
+
P(r);
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function vr(r) {
|
|
475
475
|
if (r == null) return { key: "null", label: "—" };
|
|
476
476
|
if (typeof r != "string" && typeof r != "boolean" && !(typeof r == "number" && Number.isFinite(r))) throw new TypeError("图表分类应为文本、布尔或有限数字");
|
|
477
477
|
const e = String(r);
|
|
478
478
|
if (e.length > 512) throw new RangeError("图表分类名称过长");
|
|
479
479
|
return { key: JSON.stringify([typeof r, r]), label: e };
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function Nr(r) {
|
|
482
482
|
if (r === null) return null;
|
|
483
483
|
const e = Number(r);
|
|
484
484
|
if (!Number.isFinite(e)) throw new RangeError("聚合结果超出图表有限数值范围");
|
|
485
485
|
return e;
|
|
486
486
|
}
|
|
487
|
-
function
|
|
487
|
+
function Ir(r, e, t) {
|
|
488
488
|
if (t?.aborted) {
|
|
489
489
|
const a = new Error("图表数据处理已取消");
|
|
490
490
|
throw a.name = "AbortError", a;
|
|
491
491
|
}
|
|
492
|
-
|
|
493
|
-
const n =
|
|
494
|
-
if (!Array.isArray(r) || r.length >
|
|
495
|
-
const o = /* @__PURE__ */ new Map(), c =
|
|
492
|
+
Ar(e);
|
|
493
|
+
const n = L(e.measures, 12, "图表度量");
|
|
494
|
+
if (!Array.isArray(r) || r.length > S(e.maxRows, 1e5, 1e5)) throw new RangeError("图表数据超出行数预算");
|
|
495
|
+
const o = /* @__PURE__ */ new Map(), c = S(e.maxCategories, 200, 200);
|
|
496
496
|
for (let a = 0; a < r.length; a++) {
|
|
497
497
|
if (t?.aborted) {
|
|
498
498
|
const g = new Error("图表数据处理已取消");
|
|
@@ -500,57 +500,57 @@ function Br(r, e, t) {
|
|
|
500
500
|
}
|
|
501
501
|
const s = r[a];
|
|
502
502
|
if (!s || typeof s != "object" || Array.isArray(s)) throw new TypeError("图表数据行应为对象");
|
|
503
|
-
const f =
|
|
503
|
+
const f = vr(Object.prototype.hasOwnProperty.call(s, e.categoryField) ? s[e.categoryField] : null);
|
|
504
504
|
let l = o.get(f.key);
|
|
505
505
|
if (!l) {
|
|
506
506
|
if (o.size >= c) throw new RangeError("图表分类超出预算,请明确筛选或聚合数据");
|
|
507
|
-
l = { label: f.label, accumulators: n.map(
|
|
507
|
+
l = { label: f.label, accumulators: n.map(P) }, o.set(f.key, l);
|
|
508
508
|
}
|
|
509
509
|
l.accumulators.forEach((g) => g.add(s));
|
|
510
510
|
}
|
|
511
511
|
const i = [...o.values()];
|
|
512
512
|
return e.sort && i.sort((a, s) => (e.sort === "desc" ? -1 : 1) * (a.label < s.label ? -1 : a.label > s.label ? 1 : 0)), { categories: i.map((a) => a.label), series: n.map((a, s) => ({
|
|
513
513
|
name: a.label ?? `${a.field ?? "记录"} · ${a.op}`,
|
|
514
|
-
values: i.map((f) =>
|
|
514
|
+
values: i.map((f) => Nr(f.accumulators[s].value())),
|
|
515
515
|
...a.color ? { color: a.color } : {}
|
|
516
516
|
})) };
|
|
517
517
|
}
|
|
518
|
-
const
|
|
519
|
-
function
|
|
518
|
+
const Sr = 16, C = 1024 * 1024, K = 5e5, x = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ Symbol("uncacheable-computation-definition");
|
|
519
|
+
function b(r, e, t = 0) {
|
|
520
520
|
if (++e.nodes > 1e4 || t > 32) throw p;
|
|
521
521
|
if (r == null) return [String(r)];
|
|
522
522
|
if (typeof r == "number") return ["number", Object.is(r, -0) ? "-0" : String(r)];
|
|
523
523
|
if (typeof r == "boolean") return ["boolean", r];
|
|
524
524
|
if (typeof r == "string") {
|
|
525
|
-
if (e.units += r.length, e.units >
|
|
525
|
+
if (e.units += r.length, e.units > C) throw p;
|
|
526
526
|
return ["string", r];
|
|
527
527
|
}
|
|
528
528
|
if (typeof r != "object") throw p;
|
|
529
529
|
if (Array.isArray(r)) {
|
|
530
530
|
if (Object.getPrototypeOf(r) !== Array.prototype || Object.keys(r).length !== r.length) throw p;
|
|
531
|
-
return ["array", Array.from({ length: r.length }, (n, o) =>
|
|
531
|
+
return ["array", Array.from({ length: r.length }, (n, o) => b(X(r, String(o)), e, t + 1))];
|
|
532
532
|
}
|
|
533
533
|
if (Object.getPrototypeOf(r) !== Object.prototype && Object.getPrototypeOf(r) !== null) throw p;
|
|
534
|
-
return ["object", Object.keys(r).map((n) => [
|
|
534
|
+
return ["object", Object.keys(r).map((n) => [b(n, e, t + 1), b(X(r, n), e, t + 1)])];
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function X(r, e) {
|
|
537
537
|
const t = Object.getOwnPropertyDescriptor(r, e);
|
|
538
538
|
if (!t || t.get || t.set) throw p;
|
|
539
539
|
return t.value;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function xr(r) {
|
|
542
542
|
try {
|
|
543
|
-
return JSON.stringify(
|
|
543
|
+
return JSON.stringify(b(r, { nodes: 0, units: 0 }));
|
|
544
544
|
} catch (e) {
|
|
545
545
|
if (e !== p) throw e;
|
|
546
546
|
return;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
549
|
-
function
|
|
550
|
-
|
|
549
|
+
function Ur(r) {
|
|
550
|
+
x.set(r, { programs: /* @__PURE__ */ new Map(), units: 0, slots: 0 });
|
|
551
551
|
}
|
|
552
|
-
function
|
|
553
|
-
const t =
|
|
552
|
+
function Vr(r, e) {
|
|
553
|
+
const t = x.get(r);
|
|
554
554
|
if (!t) return;
|
|
555
555
|
const n = { programs: /* @__PURE__ */ new Map(), units: t.units, slots: t.slots };
|
|
556
556
|
for (const [o, c] of t.programs) {
|
|
@@ -560,18 +560,18 @@ function Ir(r, e) {
|
|
|
560
560
|
f && i.set(a, f);
|
|
561
561
|
}), n.programs.set(o, { ...c, rows: i });
|
|
562
562
|
}
|
|
563
|
-
|
|
563
|
+
x.set(e, n);
|
|
564
564
|
}
|
|
565
565
|
function jr(r, e, t) {
|
|
566
|
-
const n =
|
|
566
|
+
const n = x.get(r);
|
|
567
567
|
if (!n || e.some((f) => typeof f.expression == "string")) return;
|
|
568
|
-
const o =
|
|
569
|
-
if (o === void 0 || o.length >
|
|
568
|
+
const o = xr(e);
|
|
569
|
+
if (o === void 0 || o.length > C) return;
|
|
570
570
|
const c = n.programs.get(o);
|
|
571
571
|
if (c) return c;
|
|
572
|
-
const i = t(), a = r.length * i.reduce((f, l) => f + l.dependencies.length + 1, 0), s = { fields: i, rows: /* @__PURE__ */ new WeakMap(), slots: a, cacheRows: a <=
|
|
572
|
+
const i = t(), a = r.length * i.reduce((f, l) => f + l.dependencies.length + 1, 0), s = { fields: i, rows: /* @__PURE__ */ new WeakMap(), slots: a, cacheRows: a <= K };
|
|
573
573
|
if (!s.cacheRows) return s;
|
|
574
|
-
for (; n.programs.size >=
|
|
574
|
+
for (; n.programs.size >= Sr || n.units + o.length > C || n.slots + a > K; ) {
|
|
575
575
|
const f = n.programs.keys().next().value;
|
|
576
576
|
n.slots -= n.programs.get(f).slots, n.units -= f.length, n.programs.delete(f);
|
|
577
577
|
}
|
|
@@ -582,7 +582,7 @@ function Fr(r, e, t, n) {
|
|
|
582
582
|
const o = r.program?.rows.get(e)?.get(t.definition.field);
|
|
583
583
|
return o?.dependencies.every((c, i) => Object.is(n[t.dependencies[i]], c)) ? o : void 0;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function Dr(r, e, t, n, o) {
|
|
586
586
|
const c = r.program;
|
|
587
587
|
if (!c?.cacheRows || (t.definition.scope ?? "row") !== "row") return;
|
|
588
588
|
let i = r.writes.get(e);
|
|
@@ -597,15 +597,15 @@ function Mr(r) {
|
|
|
597
597
|
throw new Error("未知计算范围");
|
|
598
598
|
if (r.numeric !== void 0 && r.numeric !== "number" && r.numeric !== "decimal")
|
|
599
599
|
throw new Error("未知数值模式");
|
|
600
|
-
if (r.digits !== void 0 &&
|
|
600
|
+
if (r.digits !== void 0 && y(r.digits), r.nulls !== void 0 && r.nulls !== "propagate" && r.nulls !== "error")
|
|
601
601
|
throw new Error("未知空值规则");
|
|
602
602
|
if (r.divisionByZero !== void 0 && r.divisionByZero !== "null" && r.divisionByZero !== "error")
|
|
603
603
|
throw new Error("未知除零规则");
|
|
604
604
|
if (r.scope === "group" && (!Array.isArray(r.groupBy) || !r.groupBy.length))
|
|
605
605
|
throw new Error("分组计算需要 groupBy 字段");
|
|
606
|
-
|
|
606
|
+
kr(r);
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function kr(r) {
|
|
609
609
|
if (r.groupBy !== void 0) {
|
|
610
610
|
if (!Array.isArray(r.groupBy) || r.groupBy.length > 16)
|
|
611
611
|
throw new Error("计算分组最多 16 级");
|
|
@@ -620,12 +620,12 @@ function Dr(r) {
|
|
|
620
620
|
function _(r) {
|
|
621
621
|
return [
|
|
622
622
|
.../* @__PURE__ */ new Set([
|
|
623
|
-
...typeof r.expression == "string" ? r.dependsOn ?? [] :
|
|
623
|
+
...typeof r.expression == "string" ? r.dependsOn ?? [] : br(r.expression),
|
|
624
624
|
...r.groupBy ?? []
|
|
625
625
|
])
|
|
626
626
|
];
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function er(r) {
|
|
629
629
|
if (!Array.isArray(r) || r.length > 2048)
|
|
630
630
|
throw new Error("计算字段应为数组且最多2048项");
|
|
631
631
|
const e = /* @__PURE__ */ new Map();
|
|
@@ -650,9 +650,9 @@ function rr(r) {
|
|
|
650
650
|
}
|
|
651
651
|
return r.forEach(c), o;
|
|
652
652
|
}
|
|
653
|
-
function
|
|
653
|
+
function Wr(r) {
|
|
654
654
|
try {
|
|
655
|
-
const e =
|
|
655
|
+
const e = er(r);
|
|
656
656
|
return {
|
|
657
657
|
valid: !0,
|
|
658
658
|
errors: [],
|
|
@@ -672,7 +672,7 @@ function Ur(r) {
|
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function zr(r = []) {
|
|
676
676
|
return {
|
|
677
677
|
fields: r.map((e) => ({ ...e })),
|
|
678
678
|
functions: T,
|
|
@@ -691,8 +691,8 @@ function Vr(r = []) {
|
|
|
691
691
|
}
|
|
692
692
|
};
|
|
693
693
|
}
|
|
694
|
-
function
|
|
695
|
-
return
|
|
694
|
+
function Z(r) {
|
|
695
|
+
return er(r.fields).map((e) => {
|
|
696
696
|
const t = _(e);
|
|
697
697
|
if (typeof e.expression != "string")
|
|
698
698
|
return {
|
|
@@ -710,7 +710,7 @@ function X(r) {
|
|
|
710
710
|
};
|
|
711
711
|
});
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Rr(r, e) {
|
|
714
714
|
return JSON.stringify(
|
|
715
715
|
e.map((t) => {
|
|
716
716
|
const n = Object.prototype.hasOwnProperty.call(r, t) ? r[t] : null;
|
|
@@ -720,7 +720,7 @@ function kr(r, e) {
|
|
|
720
720
|
})
|
|
721
721
|
);
|
|
722
722
|
}
|
|
723
|
-
function
|
|
723
|
+
function Tr(r, e) {
|
|
724
724
|
if (e.scope === "dataset") return () => r;
|
|
725
725
|
if (e.scope !== "group") {
|
|
726
726
|
const o = /* @__PURE__ */ new WeakMap();
|
|
@@ -731,14 +731,14 @@ function Rr(r, e) {
|
|
|
731
731
|
}
|
|
732
732
|
const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new WeakMap();
|
|
733
733
|
for (const o of r) {
|
|
734
|
-
const c =
|
|
734
|
+
const c = Rr(o, e.groupBy);
|
|
735
735
|
n.set(o, c);
|
|
736
736
|
const i = t.get(c);
|
|
737
737
|
i ? i.push(o) : t.set(c, [o]);
|
|
738
738
|
}
|
|
739
739
|
return (o) => t.get(n.get(o));
|
|
740
740
|
}
|
|
741
|
-
function
|
|
741
|
+
function Cr(r, e) {
|
|
742
742
|
const t = e.maxRows ?? 1e5, n = e.maxCells ?? 2e6;
|
|
743
743
|
if (!Array.isArray(r) || !Number.isSafeInteger(t) || t < 1 || r.length > t)
|
|
744
744
|
throw new Error("计算数据行数超出预算或输入不是数组");
|
|
@@ -747,7 +747,7 @@ function Tr(r, e) {
|
|
|
747
747
|
if (!Number.isSafeInteger(n) || n < 1 || r.length * e.fields.length > n)
|
|
748
748
|
throw new Error("计算单元格超出 maxCells 预算");
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function G(r) {
|
|
751
751
|
if (r?.aborted) {
|
|
752
752
|
const e = new Error("数据计算已取消");
|
|
753
753
|
throw e.name = "AbortError", e;
|
|
@@ -776,44 +776,54 @@ function Pr(r, e, t, n, o, c, i, a) {
|
|
|
776
776
|
return;
|
|
777
777
|
}
|
|
778
778
|
const f = a.length;
|
|
779
|
-
$r(t, n, o, c, i, a),
|
|
780
|
-
}
|
|
781
|
-
function
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
779
|
+
$r(t, n, o, c, i, a), Dr(r, e, t, n, a.length > f ? a[a.length - 1] : void 0);
|
|
780
|
+
}
|
|
781
|
+
function Jr(r, e) {
|
|
782
|
+
const t = Yr(r, e, !1);
|
|
783
|
+
let n = t.next();
|
|
784
|
+
for (; !n.done; ) n = t.next();
|
|
785
|
+
return n.value;
|
|
786
|
+
}
|
|
787
|
+
function* Yr(r, e, t = !0) {
|
|
788
|
+
Cr(r, e), G(e.signal);
|
|
789
|
+
const n = jr(r, e.fields, () => Z(e)), o = { program: n, writes: /* @__PURE__ */ new WeakMap() }, c = n?.fields ?? Z(e), i = [], a = [], s = r.length;
|
|
790
|
+
for (let f = 0; f < s; f++) {
|
|
791
|
+
const l = r[f];
|
|
792
|
+
if (!l || typeof l != "object" || Array.isArray(l))
|
|
793
|
+
throw new Error(`第 ${f + 1} 行应为对象`);
|
|
794
|
+
a.push({ ...l }), t && (yield);
|
|
795
|
+
}
|
|
796
|
+
for (const f of c) {
|
|
797
|
+
const l = Tr(a, f.definition), g = a.length;
|
|
798
|
+
for (let d = 0; d < g; d++) {
|
|
799
|
+
const I = a[d];
|
|
800
|
+
G(e.signal), Pr(o, r[d], f, I, d, l(I), e, i), t && (yield);
|
|
801
|
+
}
|
|
793
802
|
}
|
|
794
|
-
return { rows:
|
|
803
|
+
return { rows: a, issues: i };
|
|
795
804
|
}
|
|
796
805
|
export {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
806
|
+
v as a,
|
|
807
|
+
V as b,
|
|
808
|
+
P as c,
|
|
809
|
+
O as d,
|
|
810
|
+
Jr as e,
|
|
811
|
+
Ir as f,
|
|
812
|
+
y as g,
|
|
804
813
|
k as h,
|
|
805
|
-
|
|
806
|
-
|
|
814
|
+
Br as i,
|
|
815
|
+
zr as j,
|
|
807
816
|
F as k,
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
817
|
+
Ar as l,
|
|
818
|
+
$ as m,
|
|
819
|
+
h as n,
|
|
820
|
+
_r as o,
|
|
812
821
|
u as p,
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
822
|
+
Yr as q,
|
|
823
|
+
sr as r,
|
|
824
|
+
m as s,
|
|
825
|
+
Vr as t,
|
|
826
|
+
Ur as u,
|
|
827
|
+
Wr as v,
|
|
828
|
+
L as w
|
|
819
829
|
};
|