super-page-runtime 2.1.95 → 2.1.97
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.
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getValueFromSource as e, formatVariableValue as i, setValueForVariableName as t } from "../page-helper-util.js";
|
|
2
2
|
import { deepCopy as s } from "../common-util.js";
|
|
3
3
|
import { CommonName as o, caculateFormulaValue as a, sortDatas as l, limitDatas as n, executeChartFormula as u } from "./chart-util.js";
|
|
4
4
|
import { handleChartEvent as r } from "../events/event-util.js";
|
|
5
5
|
function c(c2, d, f, p) {
|
|
6
|
-
var _a;
|
|
7
6
|
if (!p || !p.result)
|
|
8
7
|
return;
|
|
9
8
|
r(c2, d, "beforeUpdateChart", f, { resultData: p });
|
|
@@ -11,118 +10,118 @@ function c(c2, d, f, p) {
|
|
|
11
10
|
let h = p && p.groupValue ? p.groupValue : void 0;
|
|
12
11
|
const y = d.serviceDataField;
|
|
13
12
|
let g = null;
|
|
14
|
-
y ? g = m[y] : m && (g = Array.isArray(m) ? m : [m]), g || (g = []),
|
|
13
|
+
y ? g = m[y] : m && (g = Array.isArray(m) ? m : [m]), g || (g = []), d.runtime.dataConfig.runtimeData = g;
|
|
15
14
|
let v = d.props ? d.props.groups : null;
|
|
16
15
|
if (v || (v = []), !h || 0 === h.length) {
|
|
17
16
|
h = [];
|
|
18
17
|
for (const e2 of v)
|
|
19
18
|
h.push(e2.group);
|
|
20
19
|
}
|
|
21
|
-
const F = {},
|
|
20
|
+
const F = {}, D = [], S = [];
|
|
22
21
|
for (const e2 of v)
|
|
23
|
-
F[e2.group] = e2.target, e2.target && !
|
|
22
|
+
F[e2.group] = e2.target, e2.target && !D.includes(e2.target) && (D.push(e2.target), h.includes(e2.group) && S.push(e2.target));
|
|
24
23
|
let x = d.props ? d.props.mulGroupShow : "";
|
|
25
24
|
x = "break" == x ? "\r\n" : " ";
|
|
26
|
-
for (const
|
|
27
|
-
if (!
|
|
25
|
+
for (const i2 of g) {
|
|
26
|
+
if (!i2)
|
|
28
27
|
continue;
|
|
29
|
-
const
|
|
28
|
+
const t2 = [];
|
|
30
29
|
for (const s3 of h) {
|
|
31
|
-
const o2 = F[s3], a2 =
|
|
32
|
-
a2 &&
|
|
30
|
+
const o2 = F[s3], a2 = e(i2, o2, void 0);
|
|
31
|
+
a2 && t2.push(a2);
|
|
33
32
|
}
|
|
34
|
-
const s2 =
|
|
35
|
-
|
|
33
|
+
const s2 = t2.join(x);
|
|
34
|
+
i2[o.X_FIELD_NAME] = s2;
|
|
36
35
|
}
|
|
37
|
-
const N = d.items ? d.items : [], E = [], A = {}, _ = [],
|
|
36
|
+
const N = d.items ? d.items : [], E = [], A = {}, _ = [], b = {}, C = [], I = [], X = [], w = a(N, g, X);
|
|
38
37
|
for (const e2 of X)
|
|
39
|
-
|
|
38
|
+
C.push(e2);
|
|
40
39
|
for (const e2 of N) {
|
|
41
|
-
const
|
|
40
|
+
const i2 = e2.props ? e2.props : {}, t2 = i2.yaxisSource, s2 = i2.yaxisField, o2 = i2.isCumulative;
|
|
42
41
|
let a2 = null;
|
|
43
|
-
if (!s2 ||
|
|
44
|
-
if ("formula" ==
|
|
45
|
-
let
|
|
42
|
+
if (!s2 || t2 && "variable" != t2)
|
|
43
|
+
if ("formula" == t2) {
|
|
44
|
+
let t3 = i2.formula ? i2.formula : "";
|
|
46
45
|
for (const e3 in w)
|
|
47
|
-
|
|
48
|
-
a2 = { uuid: e2.uuid, type: "formula", formula:
|
|
46
|
+
t3 = t3.replace(new RegExp(e3.replace("$", "\\$"), "g"), w[e3]);
|
|
47
|
+
a2 = { uuid: e2.uuid, type: "formula", formula: t3, data: [], dynamicDatas: [] };
|
|
49
48
|
} else
|
|
50
|
-
a2 = { uuid: e2.uuid, type: "fixed", field:
|
|
49
|
+
a2 = { uuid: e2.uuid, type: "fixed", field: i2.yaxisFix, data: [], dynamicDatas: [] };
|
|
51
50
|
else
|
|
52
|
-
a2 = { uuid: e2.uuid, type: "variable", field: s2, isCumulative: o2, data: [], dynamicDatas: [] }, s2 && !
|
|
53
|
-
null != a2 && (E.push(a2), A[e2.uuid] = a2),
|
|
51
|
+
a2 = { uuid: e2.uuid, type: "variable", field: s2, isCumulative: o2, data: [], dynamicDatas: [] }, s2 && !C.includes(s2) && (C.push(s2), I.push(s2)), o2 && !X.includes(s2) && X.push(s2);
|
|
52
|
+
null != a2 && (E.push(a2), A[e2.uuid] = a2), i2.dynamicSeriesField && !_.includes(i2.dynamicSeriesField) && a2 && (a2.dynamicField = i2.dynamicSeriesField, a2.dynamicSeriesTitle = i2.dynamicSeriesTitle, a2.dynamicShowStack = i2.dynamicShowStack, _.push(i2.dynamicSeriesField), b[i2.dynamicSeriesField] = s2);
|
|
54
53
|
}
|
|
55
54
|
const L = {};
|
|
56
55
|
if (_.length > 0) {
|
|
57
|
-
const
|
|
56
|
+
const i2 = [], t2 = {};
|
|
58
57
|
for (const s2 of g)
|
|
59
58
|
if (s2)
|
|
60
|
-
for (const a2 of
|
|
59
|
+
for (const a2 of C) {
|
|
61
60
|
const l2 = s2[o.X_FIELD_NAME];
|
|
62
|
-
let n2 =
|
|
61
|
+
let n2 = t2[l2];
|
|
63
62
|
if (!n2) {
|
|
64
63
|
n2 = {};
|
|
65
|
-
for (const
|
|
66
|
-
n2[
|
|
67
|
-
n2[o.X_FIELD_NAME] = s2[o.X_FIELD_NAME],
|
|
64
|
+
for (const e2 of D)
|
|
65
|
+
n2[e2] = s2[e2];
|
|
66
|
+
n2[o.X_FIELD_NAME] = s2[o.X_FIELD_NAME], t2[l2] = n2, i2.push(n2);
|
|
68
67
|
}
|
|
69
|
-
let u2 =
|
|
68
|
+
let u2 = e(s2, a2, void 0);
|
|
70
69
|
if (!isNaN(u2)) {
|
|
71
|
-
const
|
|
72
|
-
isNaN || (u2 +=
|
|
70
|
+
const e2 = n2[a2];
|
|
71
|
+
isNaN || (u2 += e2), n2[a2] = u2;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
for (const
|
|
74
|
+
for (const i3 of _) {
|
|
76
75
|
const s2 = [];
|
|
77
76
|
for (const a2 of g) {
|
|
78
77
|
if (!a2)
|
|
79
78
|
continue;
|
|
80
|
-
const l2 =
|
|
79
|
+
const l2 = t2[a2[o.X_FIELD_NAME]];
|
|
81
80
|
if (!l2)
|
|
82
81
|
continue;
|
|
83
|
-
let n2 =
|
|
82
|
+
let n2 = e(a2, i3, void 0);
|
|
84
83
|
n2 = null == n2 || null == n2 ? "" : n2, s2.includes(n2) || (s2.push(n2), I.push(n2), X.push(n2));
|
|
85
|
-
const u2 =
|
|
84
|
+
const u2 = b[i3];
|
|
86
85
|
if (void 0 !== u2) {
|
|
87
|
-
const
|
|
88
|
-
let
|
|
89
|
-
void 0 ===
|
|
86
|
+
const i4 = e(a2, u2, void 0);
|
|
87
|
+
let t3 = l2[n2];
|
|
88
|
+
void 0 === t3 ? t3 = i4 : isNaN(i4) || (t3 += i4), l2[n2] = t3;
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
|
-
L[
|
|
91
|
+
L[i3] = s2;
|
|
93
92
|
}
|
|
94
|
-
g =
|
|
93
|
+
g = i2;
|
|
95
94
|
}
|
|
96
|
-
l(c2, d, g), g = n(c2, d, g,
|
|
95
|
+
l(c2, d, g), g = n(c2, d, g, D, I);
|
|
97
96
|
const M = [], j = {};
|
|
98
|
-
for (const
|
|
99
|
-
if (
|
|
100
|
-
for (const
|
|
101
|
-
const s2 =
|
|
102
|
-
let o2 = j[
|
|
103
|
-
void 0 === s2 || isNaN(s2) || (void 0 === o2 ? o2 = s2 : o2 += s2), j[
|
|
97
|
+
for (const i2 of g)
|
|
98
|
+
if (i2) {
|
|
99
|
+
for (const t2 of X) {
|
|
100
|
+
const s2 = e(i2, t2, void 0);
|
|
101
|
+
let o2 = j[t2];
|
|
102
|
+
void 0 === s2 || isNaN(s2) || (void 0 === o2 ? o2 = s2 : o2 += s2), j[t2] = o2;
|
|
104
103
|
}
|
|
105
|
-
M.push(
|
|
106
|
-
for (const
|
|
107
|
-
let s2 =
|
|
108
|
-
const o2 =
|
|
109
|
-
if (
|
|
110
|
-
let a2 = L[
|
|
104
|
+
M.push(i2[o.X_FIELD_NAME]);
|
|
105
|
+
for (const t2 of E) {
|
|
106
|
+
let s2 = t2.data;
|
|
107
|
+
const o2 = t2.dynamicDatas;
|
|
108
|
+
if (t2.dynamicField) {
|
|
109
|
+
let a2 = L[t2.dynamicField];
|
|
111
110
|
a2 = a2 || [];
|
|
112
111
|
for (let l2 = 0; l2 < a2.length; l2++) {
|
|
113
112
|
l2 >= o2.length && o2.push([]), s2 = o2[l2];
|
|
114
113
|
const n2 = a2[l2];
|
|
115
|
-
let u2 =
|
|
116
|
-
|
|
114
|
+
let u2 = e(i2, n2, void 0);
|
|
115
|
+
t2.isCumulative && (u2 = j[n2]), s2.push(u2);
|
|
117
116
|
}
|
|
118
|
-
} else if ("fixed" ===
|
|
119
|
-
s2.push(
|
|
120
|
-
else if ("variable" ===
|
|
121
|
-
let o3 =
|
|
122
|
-
|
|
123
|
-
} else if ("formula" ===
|
|
124
|
-
const
|
|
125
|
-
s2.push(
|
|
117
|
+
} else if ("fixed" === t2.type)
|
|
118
|
+
s2.push(t2.field);
|
|
119
|
+
else if ("variable" === t2.type) {
|
|
120
|
+
let o3 = e(i2, t2.field, void 0);
|
|
121
|
+
t2.isCumulative && (o3 = j[t2.field]), s2.push(o3);
|
|
122
|
+
} else if ("formula" === t2.type) {
|
|
123
|
+
const e2 = u(t2.formula, j, i2, c2);
|
|
124
|
+
s2.push(e2);
|
|
126
125
|
} else
|
|
127
126
|
s2.push(void 0);
|
|
128
127
|
}
|
|
@@ -156,7 +155,7 @@ function c(c2, d, f, p) {
|
|
|
156
155
|
} else
|
|
157
156
|
$ && $.length > 0 && ($[0].data = M), f.xAxis = $, f.yAxis = G;
|
|
158
157
|
const R = d.props ? d.props.selGroupVariable : null;
|
|
159
|
-
!(d.props ? d.props.enableDrill : null) && R && (d.highlightInfos = [],
|
|
158
|
+
!(d.props ? d.props.enableDrill : null) && R && (d.highlightInfos = [], t(c2.entity, R, null)), r(c2, d, "afterUpdateChart", f, { resultData: p }), d.groupFields = S, d.cacheDatas = g, d.rawResult = p;
|
|
160
159
|
}
|
|
161
160
|
export {
|
|
162
161
|
c as updateChartOption
|
|
@@ -95,13 +95,18 @@ function updateChartDatasources(t, e, o, n) {
|
|
|
95
95
|
i.task && Object.assign(l, i.task);
|
|
96
96
|
const c = { entityMap: i.data, additionalParamMap: u, taskMap: l, dataSourceList: s, systemCode: t.systemCode, pageCode: t.code }, p = t.backendUrl, f = getBaseUrl(p, t.isTest) + "/common/common-data/find-chart-datas";
|
|
97
97
|
http.post(f, c).then((e2) => {
|
|
98
|
+
var _a, _b;
|
|
98
99
|
t.chartDataSourceMap || (t.chartDataSourceMap = {});
|
|
99
100
|
for (const o2 in e2) {
|
|
100
101
|
t.chartDataSourceMap[o2] = e2[o2];
|
|
101
102
|
const a2 = getComponentRef(t, o2);
|
|
102
103
|
if (a2) {
|
|
103
|
-
const
|
|
104
|
-
(!n ||
|
|
104
|
+
const r2 = a2.getConfigure();
|
|
105
|
+
if ((!n || r2 && r2.initializationQuery) && a2.updateChartDatas && (a2.updateChartDatas(e2[o2]), (_b = (_a = r2.runtime) == null ? void 0 : _a.dataConfig) == null ? void 0 : _b.resultSet)) {
|
|
106
|
+
const n2 = e2[o2] && e2[o2].length > 0 ? e2[o2][0] : {}, a3 = n2 && n2.result ? n2.result : {};
|
|
107
|
+
let s2 = null;
|
|
108
|
+
r2.serviceDataField ? s2 = a3[r2.serviceDataField] : a3 && (s2 = Array.isArray(a3) ? a3 : [a3]), s2 || (s2 = []), setValueForVariableName(t.entity, r2.runtime.dataConfig.resultSet, s2);
|
|
109
|
+
}
|
|
105
110
|
}
|
|
106
111
|
}
|
|
107
112
|
a(e2);
|