@orbcharts/core 4.0.0-beta.0 → 4.0.0-beta.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/LICENSE +200 -200
- package/dist/orbcharts-core.es.js +669 -663
- package/dist/orbcharts-core.umd.js +3 -3
- package/package.json +1 -1
- package/src/OrbCharts.ts +34 -34
- package/src/chart/createChart.ts +1030 -1013
- package/src/chart/createGraphData.ts +391 -391
- package/src/chart/createGridData.ts +247 -247
- package/src/chart/createMultivariateData.ts +181 -181
- package/src/chart/createSeriesData.ts +297 -297
- package/src/chart/createTreeData.ts +344 -344
- package/src/chart/defaults.ts +119 -119
- package/src/defineCanvasLayer.ts +23 -23
- package/src/defineCanvasPlugin.ts +38 -38
- package/src/defineSVGLayer.ts +23 -23
- package/src/defineSVGPlugin.ts +38 -38
- package/src/index.ts +8 -8
- package/src/layer/createLayer.ts +137 -137
- package/src/plugin/createPlugin.ts +487 -487
- package/src/test/createGraphData.test.ts +103 -103
- package/src/test/createTreeData.test.ts +97 -97
- package/src/test/simple-graph-test.js +51 -51
- package/src/test/simple-tree-test.js +58 -58
- package/src/types/Chart.ts +62 -62
- package/src/types/ChartContext.ts +41 -41
- package/src/types/Common.ts +4 -4
- package/src/types/Encoding.ts +42 -42
- package/src/types/Event.ts +25 -25
- package/src/types/Layers.ts +92 -92
- package/src/types/ModelData.ts +94 -94
- package/src/types/Plugin.ts +101 -101
- package/src/types/RawData.ts +67 -67
- package/src/types/RenderData.ts +15 -15
- package/src/types/Theme.ts +20 -20
- package/src/types/Validator.ts +35 -35
- package/src/types/index.ts +12 -12
- package/src/utils/aggregateUtils.ts +99 -99
- package/src/utils/colorUtils.ts +63 -63
- package/src/utils/commonUtils.ts +56 -56
- package/src/utils/dom-lifecycle.ts +164 -164
- package/src/utils/dom.ts +54 -54
- package/src/utils/errorMessage.ts +40 -40
- package/src/utils/index.ts +7 -7
- package/src/utils/observables.ts +16 -16
- package/src/utils/orbchartsUtils.ts +8 -8
- package/src/utils/validator.ts +137 -127
|
@@ -24,15 +24,15 @@ function gt(t, e, r, n) {
|
|
|
24
24
|
function a(f) {
|
|
25
25
|
try {
|
|
26
26
|
i(n.next(f));
|
|
27
|
-
} catch (
|
|
28
|
-
u(
|
|
27
|
+
} catch (w) {
|
|
28
|
+
u(w);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
function l(f) {
|
|
32
32
|
try {
|
|
33
33
|
i(n.throw(f));
|
|
34
|
-
} catch (
|
|
35
|
-
u(
|
|
34
|
+
} catch (w) {
|
|
35
|
+
u(w);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function i(f) {
|
|
@@ -142,36 +142,36 @@ function bt(t, e, r) {
|
|
|
142
142
|
return o = Object.create((typeof AsyncIterator == "function" ? AsyncIterator : Object).prototype), a("next"), a("throw"), a("return", u), o[Symbol.asyncIterator] = function() {
|
|
143
143
|
return this;
|
|
144
144
|
}, o;
|
|
145
|
-
function u(
|
|
145
|
+
function u(y) {
|
|
146
146
|
return function(A) {
|
|
147
|
-
return Promise.resolve(A).then(
|
|
147
|
+
return Promise.resolve(A).then(y, w);
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function a(
|
|
151
|
-
n[
|
|
152
|
-
return new Promise(function(
|
|
153
|
-
s.push([
|
|
150
|
+
function a(y, A) {
|
|
151
|
+
n[y] && (o[y] = function(m) {
|
|
152
|
+
return new Promise(function(d, b) {
|
|
153
|
+
s.push([y, m, d, b]) > 1 || l(y, m);
|
|
154
154
|
});
|
|
155
|
-
}, A && (o[
|
|
155
|
+
}, A && (o[y] = A(o[y])));
|
|
156
156
|
}
|
|
157
|
-
function l(
|
|
157
|
+
function l(y, A) {
|
|
158
158
|
try {
|
|
159
|
-
i(n[
|
|
159
|
+
i(n[y](A));
|
|
160
160
|
} catch (m) {
|
|
161
|
-
|
|
161
|
+
S(s[0][3], m);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
function i(
|
|
165
|
-
|
|
164
|
+
function i(y) {
|
|
165
|
+
y.value instanceof ie ? Promise.resolve(y.value.v).then(f, w) : S(s[0][2], y);
|
|
166
166
|
}
|
|
167
|
-
function f(
|
|
168
|
-
l("next",
|
|
167
|
+
function f(y) {
|
|
168
|
+
l("next", y);
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
l("throw",
|
|
170
|
+
function w(y) {
|
|
171
|
+
l("throw", y);
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
173
|
+
function S(y, A) {
|
|
174
|
+
y(A), s.shift(), s.length && l(s[0][0], s[0][1]);
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
function wt(t) {
|
|
@@ -251,12 +251,12 @@ var de = function() {
|
|
|
251
251
|
} catch (m) {
|
|
252
252
|
s = m instanceof xe ? m.errors : [m];
|
|
253
253
|
}
|
|
254
|
-
var
|
|
255
|
-
if (
|
|
254
|
+
var w = this._finalizers;
|
|
255
|
+
if (w) {
|
|
256
256
|
this._finalizers = null;
|
|
257
257
|
try {
|
|
258
|
-
for (var
|
|
259
|
-
var A =
|
|
258
|
+
for (var S = ue(w), y = S.next(); !y.done; y = S.next()) {
|
|
259
|
+
var A = y.value;
|
|
260
260
|
try {
|
|
261
261
|
je(A);
|
|
262
262
|
} catch (m) {
|
|
@@ -267,7 +267,7 @@ var de = function() {
|
|
|
267
267
|
n = { error: m };
|
|
268
268
|
} finally {
|
|
269
269
|
try {
|
|
270
|
-
|
|
270
|
+
y && !y.done && (o = S.return) && o.call(S);
|
|
271
271
|
} finally {
|
|
272
272
|
if (n) throw n.error;
|
|
273
273
|
}
|
|
@@ -873,7 +873,7 @@ function rt(t) {
|
|
|
873
873
|
function nt(t) {
|
|
874
874
|
return L(t == null ? void 0 : t.getReader);
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function ee(t) {
|
|
877
877
|
if (t instanceof R)
|
|
878
878
|
return t;
|
|
879
879
|
if (t != null) {
|
|
@@ -985,7 +985,7 @@ function qt(t, e) {
|
|
|
985
985
|
});
|
|
986
986
|
});
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function ne(t, e, r, n, o) {
|
|
989
989
|
n === void 0 && (n = 0), o === void 0 && (o = !1);
|
|
990
990
|
var s = e.schedule(function() {
|
|
991
991
|
r(), o ? t.add(this.schedule(null, n)) : this.unsubscribe();
|
|
@@ -996,15 +996,15 @@ function re(t, e, r, n, o) {
|
|
|
996
996
|
function st(t, e) {
|
|
997
997
|
return e === void 0 && (e = 0), U(function(r, n) {
|
|
998
998
|
r.subscribe(N(n, function(o) {
|
|
999
|
-
return
|
|
999
|
+
return ne(n, t, function() {
|
|
1000
1000
|
return n.next(o);
|
|
1001
1001
|
}, e);
|
|
1002
1002
|
}, function() {
|
|
1003
|
-
return
|
|
1003
|
+
return ne(n, t, function() {
|
|
1004
1004
|
return n.complete();
|
|
1005
1005
|
}, e);
|
|
1006
1006
|
}, function(o) {
|
|
1007
|
-
return
|
|
1007
|
+
return ne(n, t, function() {
|
|
1008
1008
|
return n.error(o);
|
|
1009
1009
|
}, e);
|
|
1010
1010
|
}));
|
|
@@ -1018,10 +1018,10 @@ function at(t, e) {
|
|
|
1018
1018
|
});
|
|
1019
1019
|
}
|
|
1020
1020
|
function Gt(t, e) {
|
|
1021
|
-
return
|
|
1021
|
+
return ee(t).pipe(at(e), st(e));
|
|
1022
1022
|
}
|
|
1023
1023
|
function Wt(t, e) {
|
|
1024
|
-
return
|
|
1024
|
+
return ee(t).pipe(at(e), st(e));
|
|
1025
1025
|
}
|
|
1026
1026
|
function Yt(t, e) {
|
|
1027
1027
|
return new R(function(r) {
|
|
@@ -1034,8 +1034,8 @@ function Yt(t, e) {
|
|
|
1034
1034
|
function Zt(t, e) {
|
|
1035
1035
|
return new R(function(r) {
|
|
1036
1036
|
var n;
|
|
1037
|
-
return
|
|
1038
|
-
n = t[et](),
|
|
1037
|
+
return ne(r, e, function() {
|
|
1038
|
+
n = t[et](), ne(r, e, function() {
|
|
1039
1039
|
var o, s, u;
|
|
1040
1040
|
try {
|
|
1041
1041
|
o = n.next(), s = o.value, u = o.done;
|
|
@@ -1054,9 +1054,9 @@ function it(t, e) {
|
|
|
1054
1054
|
if (!t)
|
|
1055
1055
|
throw new Error("Iterable cannot be null");
|
|
1056
1056
|
return new R(function(r) {
|
|
1057
|
-
|
|
1057
|
+
ne(r, e, function() {
|
|
1058
1058
|
var n = t[Symbol.asyncIterator]();
|
|
1059
|
-
|
|
1059
|
+
ne(r, e, function() {
|
|
1060
1060
|
n.next().then(function(o) {
|
|
1061
1061
|
o.done ? r.complete() : r.next(o.value);
|
|
1062
1062
|
});
|
|
@@ -1085,7 +1085,7 @@ function Ht(t, e) {
|
|
|
1085
1085
|
throw Xe(t);
|
|
1086
1086
|
}
|
|
1087
1087
|
function Be(t, e) {
|
|
1088
|
-
return e ? Ht(t, e) :
|
|
1088
|
+
return e ? Ht(t, e) : ee(t);
|
|
1089
1089
|
}
|
|
1090
1090
|
function Qt() {
|
|
1091
1091
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
@@ -1141,7 +1141,7 @@ function ur(t, e) {
|
|
|
1141
1141
|
return r[n] = e[o], r;
|
|
1142
1142
|
}, {});
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1144
|
+
function J() {
|
|
1145
1145
|
for (var t = [], e = 0; e < arguments.length; e++)
|
|
1146
1146
|
t[e] = arguments[e];
|
|
1147
1147
|
var r = Ye(t), n = Rt(t), o = ar(t), s = o.args, u = o.keys;
|
|
@@ -1157,9 +1157,9 @@ function lr(t, e, r) {
|
|
|
1157
1157
|
Re(e, function() {
|
|
1158
1158
|
for (var o = t.length, s = new Array(o), u = o, a = o, l = function(f) {
|
|
1159
1159
|
Re(e, function() {
|
|
1160
|
-
var
|
|
1161
|
-
|
|
1162
|
-
s[f] =
|
|
1160
|
+
var w = Be(t[f], e), S = !1;
|
|
1161
|
+
w.subscribe(N(n, function(y) {
|
|
1162
|
+
s[f] = y, S || (S = !0, a--), a || n.next(r(s.slice()));
|
|
1163
1163
|
}, function() {
|
|
1164
1164
|
--u || n.complete();
|
|
1165
1165
|
}));
|
|
@@ -1170,11 +1170,11 @@ function lr(t, e, r) {
|
|
|
1170
1170
|
};
|
|
1171
1171
|
}
|
|
1172
1172
|
function Re(t, e, r) {
|
|
1173
|
-
t ?
|
|
1173
|
+
t ? ne(r, t, e) : e();
|
|
1174
1174
|
}
|
|
1175
1175
|
function cr(t) {
|
|
1176
1176
|
return new R(function(e) {
|
|
1177
|
-
|
|
1177
|
+
ee(t()).subscribe(e);
|
|
1178
1178
|
});
|
|
1179
1179
|
}
|
|
1180
1180
|
function fr(t, e, r) {
|
|
@@ -1194,7 +1194,7 @@ function ae(t) {
|
|
|
1194
1194
|
return U(function(e, r) {
|
|
1195
1195
|
var n = null, o = !1, s;
|
|
1196
1196
|
n = e.subscribe(N(r, void 0, void 0, function(u) {
|
|
1197
|
-
s =
|
|
1197
|
+
s = ee(t(u, ae(t)(e))), n ? (n.unsubscribe(), n = null, s.subscribe(r)) : o = !0;
|
|
1198
1198
|
})), o && (n.unsubscribe(), n = null, s.subscribe(r));
|
|
1199
1199
|
});
|
|
1200
1200
|
}
|
|
@@ -1283,30 +1283,30 @@ function lt(t) {
|
|
|
1283
1283
|
return new oe();
|
|
1284
1284
|
} : e, n = t.resetOnError, o = n === void 0 ? !0 : n, s = t.resetOnComplete, u = s === void 0 ? !0 : s, a = t.resetOnRefCountZero, l = a === void 0 ? !0 : a;
|
|
1285
1285
|
return function(i) {
|
|
1286
|
-
var f,
|
|
1287
|
-
|
|
1288
|
-
},
|
|
1289
|
-
|
|
1290
|
-
},
|
|
1286
|
+
var f, w, S, y = 0, A = !1, m = !1, d = function() {
|
|
1287
|
+
w == null || w.unsubscribe(), w = void 0;
|
|
1288
|
+
}, b = function() {
|
|
1289
|
+
d(), f = S = void 0, A = m = !1;
|
|
1290
|
+
}, T = function() {
|
|
1291
1291
|
var O = f;
|
|
1292
|
-
|
|
1292
|
+
b(), O == null || O.unsubscribe();
|
|
1293
1293
|
};
|
|
1294
|
-
return U(function(O,
|
|
1295
|
-
|
|
1296
|
-
var
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
}),
|
|
1294
|
+
return U(function(O, h) {
|
|
1295
|
+
y++, !m && !A && d();
|
|
1296
|
+
var p = S = S ?? r();
|
|
1297
|
+
h.add(function() {
|
|
1298
|
+
y--, y === 0 && !m && !A && (w = Ae(T, l));
|
|
1299
|
+
}), p.subscribe(h), !f && y > 0 && (f = new he({
|
|
1300
1300
|
next: function(E) {
|
|
1301
|
-
return
|
|
1301
|
+
return p.next(E);
|
|
1302
1302
|
},
|
|
1303
1303
|
error: function(E) {
|
|
1304
|
-
m = !0,
|
|
1304
|
+
m = !0, d(), w = Ae(b, o, E), p.error(E);
|
|
1305
1305
|
},
|
|
1306
1306
|
complete: function() {
|
|
1307
|
-
A = !0,
|
|
1307
|
+
A = !0, d(), w = Ae(b, u), p.complete();
|
|
1308
1308
|
}
|
|
1309
|
-
}),
|
|
1309
|
+
}), ee(O).subscribe(f));
|
|
1310
1310
|
})(i);
|
|
1311
1311
|
};
|
|
1312
1312
|
}
|
|
@@ -1323,10 +1323,10 @@ function Ae(t, e) {
|
|
|
1323
1323
|
o.unsubscribe(), t();
|
|
1324
1324
|
}
|
|
1325
1325
|
});
|
|
1326
|
-
return
|
|
1326
|
+
return ee(e.apply(void 0, ce([], le(r)))).subscribe(o);
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
function
|
|
1329
|
+
function re(t, e, r) {
|
|
1330
1330
|
var n, o = !1;
|
|
1331
1331
|
return n = t, lt({
|
|
1332
1332
|
connector: function() {
|
|
@@ -1345,8 +1345,8 @@ function br(t, e) {
|
|
|
1345
1345
|
r.subscribe(N(n, function(l) {
|
|
1346
1346
|
o == null || o.unsubscribe();
|
|
1347
1347
|
var i = 0, f = s++;
|
|
1348
|
-
|
|
1349
|
-
return n.next(e ? e(l,
|
|
1348
|
+
ee(t(l, f)).subscribe(o = N(n, function(w) {
|
|
1349
|
+
return n.next(e ? e(l, w, f, i++) : w);
|
|
1350
1350
|
}, function() {
|
|
1351
1351
|
o = null, a();
|
|
1352
1352
|
}));
|
|
@@ -1357,7 +1357,7 @@ function br(t, e) {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
function wr(t) {
|
|
1359
1359
|
return U(function(e, r) {
|
|
1360
|
-
|
|
1360
|
+
ee(t).subscribe(N(r, function() {
|
|
1361
1361
|
return r.complete();
|
|
1362
1362
|
}, _e)), !r.closed && e.subscribe(r);
|
|
1363
1363
|
});
|
|
@@ -1437,7 +1437,7 @@ function F(t, e, r) {
|
|
|
1437
1437
|
}
|
|
1438
1438
|
return Or(n, r);
|
|
1439
1439
|
}
|
|
1440
|
-
function
|
|
1440
|
+
function X(t) {
|
|
1441
1441
|
return Object.prototype.toString.call(t) === "[object Object]";
|
|
1442
1442
|
}
|
|
1443
1443
|
function Ir(t) {
|
|
@@ -1447,7 +1447,7 @@ function ct(t) {
|
|
|
1447
1447
|
return !!(t && t.nodeType);
|
|
1448
1448
|
}
|
|
1449
1449
|
function W(t, e) {
|
|
1450
|
-
if (
|
|
1450
|
+
if (X(e) === !1 || X(t) === !1)
|
|
1451
1451
|
return Object.assign({}, t);
|
|
1452
1452
|
const r = (n, o) => {
|
|
1453
1453
|
const s = Object.assign({}, n);
|
|
@@ -1455,7 +1455,7 @@ function W(t, e) {
|
|
|
1455
1455
|
if (!(u in n))
|
|
1456
1456
|
continue;
|
|
1457
1457
|
let a;
|
|
1458
|
-
|
|
1458
|
+
X(o[u]) && X(n[u]) ? (a = r(n[u], o[u]), s[u] = a) : s[u] = o[u];
|
|
1459
1459
|
}
|
|
1460
1460
|
return s;
|
|
1461
1461
|
};
|
|
@@ -1504,12 +1504,12 @@ function fe({ from: t, systemMessage: e }) {
|
|
|
1504
1504
|
return `unexpected error from '${t}':
|
|
1505
1505
|
${e}`;
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1507
|
+
function H({ columnName: t, expectToBe: e, from: r }) {
|
|
1508
1508
|
return `Invalid value: '${t}' must be '${e}'
|
|
1509
1509
|
|
|
1510
1510
|
----> find in '${r}'`;
|
|
1511
1511
|
}
|
|
1512
|
-
function
|
|
1512
|
+
function Q({ columnName: t, expectToBe: e, from: r }) {
|
|
1513
1513
|
return `${ht("warning")} Value is not correct: '${t}' suppose to be '${e}', it may cause unexpected errors.'
|
|
1514
1514
|
|
|
1515
1515
|
----> find in '${r}'`;
|
|
@@ -1536,9 +1536,9 @@ function Lr(t, e) {
|
|
|
1536
1536
|
string: (s) => typeof s == "string",
|
|
1537
1537
|
number: (s) => typeof s == "number",
|
|
1538
1538
|
boolean: (s) => typeof s == "boolean",
|
|
1539
|
-
object: (s) =>
|
|
1539
|
+
object: (s) => X(s),
|
|
1540
1540
|
// 嚴格判斷是否為純物件
|
|
1541
|
-
"object[]": (s) => Array.isArray(s) && s.every((u) =>
|
|
1541
|
+
"object[]": (s) => Array.isArray(s) && s.every((u) => X(u)),
|
|
1542
1542
|
"string[]": (s) => Array.isArray(s) && s.every((u) => typeof u == "string"),
|
|
1543
1543
|
"number[]": (s) => Array.isArray(s) && s.every((u) => typeof u == "number"),
|
|
1544
1544
|
Function: (s) => Ir(s),
|
|
@@ -1550,6 +1550,8 @@ function Lr(t, e) {
|
|
|
1550
1550
|
return Object.keys(t).find((s) => {
|
|
1551
1551
|
if (e[s]) {
|
|
1552
1552
|
const u = e[s], a = t[s];
|
|
1553
|
+
if (a === void 0)
|
|
1554
|
+
return !1;
|
|
1553
1555
|
if (u.toBeTypes) {
|
|
1554
1556
|
if (u.toBeTypes.some((f) => r[f](a)) === !1)
|
|
1555
1557
|
return !0;
|
|
@@ -1734,8 +1736,8 @@ const Ke = {
|
|
|
1734
1736
|
const a = [];
|
|
1735
1737
|
o ? t.forEach((l, i) => {
|
|
1736
1738
|
l.forEach((f) => {
|
|
1737
|
-
const
|
|
1738
|
-
a.includes(
|
|
1739
|
+
const w = f[e.dataset.from] || `dataset-${i}`;
|
|
1740
|
+
a.includes(w) || a.push(w);
|
|
1739
1741
|
});
|
|
1740
1742
|
}) : t.forEach((l) => {
|
|
1741
1743
|
const i = l[e.dataset.from] || "default";
|
|
@@ -1746,82 +1748,82 @@ const Ke = {
|
|
|
1746
1748
|
return s.forEach((a, l) => {
|
|
1747
1749
|
const i = n.get(a), f = /* @__PURE__ */ new Map();
|
|
1748
1750
|
i.forEach((m) => {
|
|
1749
|
-
const
|
|
1750
|
-
f.has(
|
|
1751
|
+
const d = m[e.series.from] || "default";
|
|
1752
|
+
f.has(d) || f.set(d, []), f.get(d).push(m);
|
|
1751
1753
|
});
|
|
1752
|
-
let
|
|
1754
|
+
let w = Array.from(f.keys());
|
|
1753
1755
|
if (Array.isArray(e.series.sort))
|
|
1754
|
-
|
|
1756
|
+
w = e.series.sort.filter((m) => f.has(m)).concat(w.filter((m) => !e.series.sort.includes(m)));
|
|
1755
1757
|
else if (e.series.sort === "original") {
|
|
1756
1758
|
const m = [];
|
|
1757
|
-
i.forEach((
|
|
1758
|
-
const
|
|
1759
|
-
m.includes(
|
|
1760
|
-
}),
|
|
1761
|
-
} else e.series.sort === "alphabetical" &&
|
|
1762
|
-
const
|
|
1759
|
+
i.forEach((d) => {
|
|
1760
|
+
const b = d[e.series.from] || "default";
|
|
1761
|
+
m.includes(b) || m.push(b);
|
|
1762
|
+
}), w = m;
|
|
1763
|
+
} else e.series.sort === "alphabetical" && w.sort((m, d) => m.localeCompare(d, void 0, { numeric: !0 }));
|
|
1764
|
+
const S = [];
|
|
1763
1765
|
if (e.category.sort === "original")
|
|
1764
1766
|
i.forEach((m) => {
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
+
const d = m[e.category.from] || "default";
|
|
1768
|
+
S.includes(d) || S.push(d);
|
|
1767
1769
|
});
|
|
1768
1770
|
else if (e.category.sort === "alphabetical") {
|
|
1769
1771
|
const m = /* @__PURE__ */ new Set();
|
|
1770
|
-
i.forEach((
|
|
1771
|
-
m.add(
|
|
1772
|
-
}),
|
|
1772
|
+
i.forEach((d) => {
|
|
1773
|
+
m.add(d[e.category.from] || "default");
|
|
1774
|
+
}), S.push(...Array.from(m).sort((d, b) => d.localeCompare(b, void 0, { numeric: !0 })));
|
|
1773
1775
|
} else if (Array.isArray(e.category.sort)) {
|
|
1774
1776
|
const m = [];
|
|
1775
|
-
i.forEach((
|
|
1776
|
-
const
|
|
1777
|
-
m.includes(
|
|
1777
|
+
i.forEach((b) => {
|
|
1778
|
+
const T = b[e.category.from] || "default";
|
|
1779
|
+
m.includes(T) || m.push(T);
|
|
1778
1780
|
});
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
...
|
|
1782
|
-
...m.filter((
|
|
1781
|
+
const d = e.category.sort;
|
|
1782
|
+
S.push(
|
|
1783
|
+
...d.filter((b) => m.includes(b)),
|
|
1784
|
+
...m.filter((b) => !d.includes(b))
|
|
1783
1785
|
);
|
|
1784
1786
|
}
|
|
1785
|
-
const
|
|
1786
|
-
|
|
1787
|
-
|
|
1787
|
+
const y = /* @__PURE__ */ new Map();
|
|
1788
|
+
S.forEach((m, d) => {
|
|
1789
|
+
y.set(m, d);
|
|
1788
1790
|
});
|
|
1789
1791
|
const A = [];
|
|
1790
|
-
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
const E =
|
|
1794
|
-
|
|
1792
|
+
w.forEach((m, d) => {
|
|
1793
|
+
const b = f.get(m), T = /* @__PURE__ */ new Map();
|
|
1794
|
+
b.forEach((p) => {
|
|
1795
|
+
const E = p[e.category.from] || "default";
|
|
1796
|
+
T.has(E) || T.set(E, []), T.get(E).push(p);
|
|
1795
1797
|
});
|
|
1796
|
-
const O =
|
|
1797
|
-
e.category.sort === "original" && e.value.aggregate === "none" ? (
|
|
1798
|
-
const
|
|
1799
|
-
|
|
1800
|
-
id:
|
|
1798
|
+
const O = S.filter((p) => T.has(p)), h = [];
|
|
1799
|
+
e.category.sort === "original" && e.value.aggregate === "none" ? (b.forEach((p, E) => {
|
|
1800
|
+
const P = p[e.category.from] || "default", I = y.get(P), c = p[e.value.from];
|
|
1801
|
+
h.push({
|
|
1802
|
+
id: p.id || `${a}-${m}-${P}-${E}`,
|
|
1801
1803
|
index: I,
|
|
1802
1804
|
// Series 模式下 index 對應 categoryIndex
|
|
1803
1805
|
modelType: "series",
|
|
1804
|
-
name:
|
|
1805
|
-
data:
|
|
1806
|
+
name: p.name || "",
|
|
1807
|
+
data: p.data,
|
|
1806
1808
|
value: typeof c == "number" ? c : null,
|
|
1807
1809
|
color: F(e.color.from, {
|
|
1808
1810
|
index: I,
|
|
1809
|
-
seriesIndex:
|
|
1811
|
+
seriesIndex: d,
|
|
1810
1812
|
categoryIndex: I,
|
|
1811
1813
|
datasetIndex: l
|
|
1812
1814
|
}, r),
|
|
1813
1815
|
series: m,
|
|
1814
|
-
seriesIndex:
|
|
1815
|
-
category:
|
|
1816
|
+
seriesIndex: d,
|
|
1817
|
+
category: P,
|
|
1816
1818
|
categoryIndex: I
|
|
1817
1819
|
});
|
|
1818
|
-
}), e.value.sort === "asc" ?
|
|
1819
|
-
const E =
|
|
1820
|
+
}), e.value.sort === "asc" ? h.sort((p, E) => p.value === null && E.value === null ? 0 : p.value === null ? 1 : E.value === null ? -1 : p.value - E.value) : e.value.sort === "desc" && h.sort((p, E) => p.value === null && E.value === null ? 0 : p.value === null ? 1 : E.value === null ? -1 : E.value - p.value)) : O.forEach((p) => {
|
|
1821
|
+
const E = y.get(p), P = T.get(p);
|
|
1820
1822
|
if (e.value.aggregate === "none") {
|
|
1821
|
-
let I =
|
|
1823
|
+
let I = P.map((c, v) => {
|
|
1822
1824
|
const $ = c[e.value.from];
|
|
1823
1825
|
return {
|
|
1824
|
-
id: c.id || `${a}-${m}-${
|
|
1826
|
+
id: c.id || `${a}-${m}-${p}-${v}`,
|
|
1825
1827
|
index: E,
|
|
1826
1828
|
// Series 模式下 index 對應 categoryIndex
|
|
1827
1829
|
modelType: "series",
|
|
@@ -1830,45 +1832,45 @@ const Ke = {
|
|
|
1830
1832
|
value: typeof $ == "number" ? $ : null,
|
|
1831
1833
|
color: F(e.color.from, {
|
|
1832
1834
|
index: E,
|
|
1833
|
-
seriesIndex:
|
|
1835
|
+
seriesIndex: d,
|
|
1834
1836
|
categoryIndex: E,
|
|
1835
1837
|
datasetIndex: l
|
|
1836
1838
|
}, r),
|
|
1837
1839
|
series: m,
|
|
1838
|
-
seriesIndex:
|
|
1839
|
-
category:
|
|
1840
|
+
seriesIndex: d,
|
|
1841
|
+
category: p,
|
|
1840
1842
|
categoryIndex: E
|
|
1841
1843
|
};
|
|
1842
1844
|
});
|
|
1843
|
-
e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value),
|
|
1845
|
+
e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value), h.push(...I);
|
|
1844
1846
|
} else {
|
|
1845
|
-
const I =
|
|
1847
|
+
const I = P.map((C) => {
|
|
1846
1848
|
if (e.value.aggregate === "count")
|
|
1847
1849
|
return 1;
|
|
1848
|
-
const
|
|
1849
|
-
return typeof
|
|
1850
|
-
}), c = pe(I, e.value.aggregate), v =
|
|
1851
|
-
id: v.id || `${a}-${m}-${
|
|
1850
|
+
const g = C[e.value.from];
|
|
1851
|
+
return typeof g == "number" ? g : null;
|
|
1852
|
+
}), c = pe(I, e.value.aggregate), v = P[0], $ = {
|
|
1853
|
+
id: v.id || `${a}-${m}-${p}-aggregated`,
|
|
1852
1854
|
index: E,
|
|
1853
1855
|
// Series 模式下 index 對應 categoryIndex
|
|
1854
1856
|
modelType: "series",
|
|
1855
|
-
name: v.name ||
|
|
1857
|
+
name: v.name || p,
|
|
1856
1858
|
data: v.data,
|
|
1857
1859
|
value: c,
|
|
1858
1860
|
color: F(e.color.from, {
|
|
1859
1861
|
index: E,
|
|
1860
|
-
seriesIndex:
|
|
1862
|
+
seriesIndex: d,
|
|
1861
1863
|
categoryIndex: E,
|
|
1862
1864
|
datasetIndex: l
|
|
1863
1865
|
}, r),
|
|
1864
1866
|
series: m,
|
|
1865
|
-
seriesIndex:
|
|
1866
|
-
category:
|
|
1867
|
+
seriesIndex: d,
|
|
1868
|
+
category: p,
|
|
1867
1869
|
categoryIndex: E
|
|
1868
1870
|
};
|
|
1869
|
-
|
|
1871
|
+
h.push($);
|
|
1870
1872
|
}
|
|
1871
|
-
}), A.push(
|
|
1873
|
+
}), A.push(h);
|
|
1872
1874
|
}), u.push(A);
|
|
1873
1875
|
}), u;
|
|
1874
1876
|
}, Rr = (t, e, r) => {
|
|
@@ -1889,8 +1891,8 @@ const Ke = {
|
|
|
1889
1891
|
const a = [];
|
|
1890
1892
|
o ? t.forEach((l, i) => {
|
|
1891
1893
|
l.forEach((f) => {
|
|
1892
|
-
const
|
|
1893
|
-
a.includes(
|
|
1894
|
+
const w = f[e.dataset.from] || `dataset-${i}`;
|
|
1895
|
+
a.includes(w) || a.push(w);
|
|
1894
1896
|
});
|
|
1895
1897
|
}) : t.forEach((l) => {
|
|
1896
1898
|
const i = l[e.dataset.from] || "default";
|
|
@@ -1900,62 +1902,62 @@ const Ke = {
|
|
|
1900
1902
|
const u = [];
|
|
1901
1903
|
return s.forEach((a, l) => {
|
|
1902
1904
|
const i = n.get(a), f = /* @__PURE__ */ new Map();
|
|
1903
|
-
i.forEach((
|
|
1904
|
-
const
|
|
1905
|
-
f.has(
|
|
1905
|
+
i.forEach((d) => {
|
|
1906
|
+
const b = d[e.series.from] || "default";
|
|
1907
|
+
f.has(b) || f.set(b, []), f.get(b).push(d);
|
|
1906
1908
|
});
|
|
1907
|
-
let
|
|
1909
|
+
let w = Array.from(f.keys());
|
|
1908
1910
|
if (Array.isArray(e.series.sort))
|
|
1909
|
-
|
|
1911
|
+
w = e.series.sort.filter((d) => f.has(d)).concat(w.filter((d) => !e.series.sort.includes(d)));
|
|
1910
1912
|
else if (e.series.sort === "original") {
|
|
1911
|
-
const
|
|
1912
|
-
i.forEach((
|
|
1913
|
-
const
|
|
1914
|
-
|
|
1915
|
-
}),
|
|
1916
|
-
} else e.series.sort === "alphabetical" &&
|
|
1917
|
-
const
|
|
1918
|
-
i.forEach((
|
|
1919
|
-
const
|
|
1920
|
-
|
|
1913
|
+
const d = [];
|
|
1914
|
+
i.forEach((b) => {
|
|
1915
|
+
const T = b[e.series.from] || "default";
|
|
1916
|
+
d.includes(T) || d.push(T);
|
|
1917
|
+
}), w = d;
|
|
1918
|
+
} else e.series.sort === "alphabetical" && w.sort((d, b) => d.localeCompare(b, void 0, { numeric: !0 }));
|
|
1919
|
+
const S = [];
|
|
1920
|
+
i.forEach((d) => {
|
|
1921
|
+
const b = d[e.category.from] || "default";
|
|
1922
|
+
S.includes(b) || S.push(b);
|
|
1921
1923
|
});
|
|
1922
|
-
const
|
|
1923
|
-
let A = Array.from(
|
|
1924
|
-
Array.isArray(e.category.sort) ? A = e.category.sort.filter((
|
|
1924
|
+
const y = new Set(S);
|
|
1925
|
+
let A = Array.from(y);
|
|
1926
|
+
Array.isArray(e.category.sort) ? A = e.category.sort.filter((d) => y.has(d)).concat(A.filter((d) => !e.category.sort.includes(d))) : e.category.sort === "original" ? A = S : e.category.sort === "alphabetical" && A.sort((d, b) => d.localeCompare(b, void 0, { numeric: !0 }));
|
|
1925
1927
|
const m = [];
|
|
1926
|
-
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
const E =
|
|
1930
|
-
O.has(E) || O.set(E, []), O.get(E).push(
|
|
1928
|
+
w.forEach((d, b) => {
|
|
1929
|
+
const T = f.get(d), O = /* @__PURE__ */ new Map();
|
|
1930
|
+
T.forEach((p) => {
|
|
1931
|
+
const E = p[e.category.from] || "default";
|
|
1932
|
+
O.has(E) || O.set(E, []), O.get(E).push(p);
|
|
1931
1933
|
});
|
|
1932
|
-
const
|
|
1933
|
-
A.forEach((
|
|
1934
|
-
const
|
|
1935
|
-
if (!
|
|
1936
|
-
|
|
1937
|
-
id: `${a}-${
|
|
1934
|
+
const h = [];
|
|
1935
|
+
A.forEach((p, E) => {
|
|
1936
|
+
const P = O.get(p);
|
|
1937
|
+
if (!P)
|
|
1938
|
+
h.push({
|
|
1939
|
+
id: `${a}-${d}-${p}-null`,
|
|
1938
1940
|
index: E,
|
|
1939
1941
|
modelType: "grid",
|
|
1940
|
-
name:
|
|
1942
|
+
name: p,
|
|
1941
1943
|
data: void 0,
|
|
1942
1944
|
value: null,
|
|
1943
1945
|
color: F(e.color.from, {
|
|
1944
1946
|
index: E,
|
|
1945
|
-
seriesIndex:
|
|
1947
|
+
seriesIndex: b,
|
|
1946
1948
|
categoryIndex: E,
|
|
1947
1949
|
datasetIndex: l
|
|
1948
1950
|
}, r),
|
|
1949
|
-
series:
|
|
1950
|
-
seriesIndex:
|
|
1951
|
-
category:
|
|
1951
|
+
series: d,
|
|
1952
|
+
seriesIndex: b,
|
|
1953
|
+
category: p,
|
|
1952
1954
|
categoryIndex: E
|
|
1953
1955
|
});
|
|
1954
1956
|
else if (e.value.aggregate === "none") {
|
|
1955
|
-
let I =
|
|
1957
|
+
let I = P.map((c, v) => {
|
|
1956
1958
|
const $ = c[e.value.from];
|
|
1957
1959
|
return {
|
|
1958
|
-
id: c.id || `${a}-${
|
|
1960
|
+
id: c.id || `${a}-${d}-${p}-${v}`,
|
|
1959
1961
|
index: E,
|
|
1960
1962
|
// Grid 模式下 index 對應 categoryIndex
|
|
1961
1963
|
modelType: "grid",
|
|
@@ -1964,45 +1966,45 @@ const Ke = {
|
|
|
1964
1966
|
value: typeof $ == "number" ? $ : null,
|
|
1965
1967
|
color: F(e.color.from, {
|
|
1966
1968
|
index: E,
|
|
1967
|
-
seriesIndex:
|
|
1969
|
+
seriesIndex: b,
|
|
1968
1970
|
categoryIndex: E,
|
|
1969
1971
|
datasetIndex: l
|
|
1970
1972
|
}, r),
|
|
1971
|
-
series:
|
|
1972
|
-
seriesIndex:
|
|
1973
|
-
category:
|
|
1973
|
+
series: d,
|
|
1974
|
+
seriesIndex: b,
|
|
1975
|
+
category: p,
|
|
1974
1976
|
categoryIndex: E
|
|
1975
1977
|
};
|
|
1976
1978
|
});
|
|
1977
|
-
e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value),
|
|
1979
|
+
e.value.sort === "asc" ? I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : c.value - v.value) : e.value.sort === "desc" && I.sort((c, v) => c.value === null && v.value === null ? 0 : c.value === null ? 1 : v.value === null ? -1 : v.value - c.value), h.push(...I);
|
|
1978
1980
|
} else {
|
|
1979
|
-
const I =
|
|
1981
|
+
const I = P.map((C) => {
|
|
1980
1982
|
if (e.value.aggregate === "count")
|
|
1981
1983
|
return 1;
|
|
1982
|
-
const
|
|
1983
|
-
return typeof
|
|
1984
|
-
}), c = pe(I, e.value.aggregate), v =
|
|
1985
|
-
id: v.id || `${a}-${
|
|
1984
|
+
const g = C[e.value.from];
|
|
1985
|
+
return typeof g == "number" ? g : null;
|
|
1986
|
+
}), c = pe(I, e.value.aggregate), v = P[0], $ = {
|
|
1987
|
+
id: v.id || `${a}-${d}-${p}-aggregated`,
|
|
1986
1988
|
index: E,
|
|
1987
1989
|
// Grid 模式下 index 對應 categoryIndex
|
|
1988
1990
|
modelType: "grid",
|
|
1989
|
-
name: v.name ||
|
|
1991
|
+
name: v.name || p,
|
|
1990
1992
|
data: v.data,
|
|
1991
1993
|
value: c,
|
|
1992
1994
|
color: F(e.color.from, {
|
|
1993
1995
|
index: E,
|
|
1994
|
-
seriesIndex:
|
|
1996
|
+
seriesIndex: b,
|
|
1995
1997
|
categoryIndex: E,
|
|
1996
1998
|
datasetIndex: l
|
|
1997
1999
|
}, r),
|
|
1998
|
-
series:
|
|
1999
|
-
seriesIndex:
|
|
2000
|
-
category:
|
|
2000
|
+
series: d,
|
|
2001
|
+
seriesIndex: b,
|
|
2002
|
+
category: p,
|
|
2001
2003
|
categoryIndex: E
|
|
2002
2004
|
};
|
|
2003
|
-
|
|
2005
|
+
h.push($);
|
|
2004
2006
|
}
|
|
2005
|
-
}), m.push(
|
|
2007
|
+
}), m.push(h);
|
|
2006
2008
|
}), u.push(m);
|
|
2007
2009
|
}), u;
|
|
2008
2010
|
}, Kr = (t, e, r) => {
|
|
@@ -2023,8 +2025,8 @@ const Ke = {
|
|
|
2023
2025
|
const a = [];
|
|
2024
2026
|
o ? t.forEach((l, i) => {
|
|
2025
2027
|
l.forEach((f) => {
|
|
2026
|
-
const
|
|
2027
|
-
a.includes(
|
|
2028
|
+
const w = f[e.dataset.from] || `dataset-${i}`;
|
|
2029
|
+
a.includes(w) || a.push(w);
|
|
2028
2030
|
});
|
|
2029
2031
|
}) : t.forEach((l) => {
|
|
2030
2032
|
const i = l[e.dataset.from] || "default";
|
|
@@ -2034,71 +2036,71 @@ const Ke = {
|
|
|
2034
2036
|
const u = [];
|
|
2035
2037
|
return s.forEach((a, l) => {
|
|
2036
2038
|
const i = n.get(a), f = /* @__PURE__ */ new Map();
|
|
2037
|
-
i.forEach((
|
|
2038
|
-
const A =
|
|
2039
|
-
f.has(A) || f.set(A, []), f.get(A).push(
|
|
2039
|
+
i.forEach((y) => {
|
|
2040
|
+
const A = y[e.series.from] || "default";
|
|
2041
|
+
f.has(A) || f.set(A, []), f.get(A).push(y);
|
|
2040
2042
|
});
|
|
2041
|
-
let
|
|
2043
|
+
let w = Array.from(f.keys());
|
|
2042
2044
|
if (Array.isArray(e.series.sort))
|
|
2043
|
-
|
|
2045
|
+
w = e.series.sort.filter((y) => f.has(y)).concat(w.filter((y) => !e.series.sort.includes(y)));
|
|
2044
2046
|
else if (e.series.sort === "original") {
|
|
2045
|
-
const
|
|
2047
|
+
const y = [];
|
|
2046
2048
|
i.forEach((A) => {
|
|
2047
2049
|
const m = A[e.series.from] || "default";
|
|
2048
|
-
|
|
2049
|
-
}),
|
|
2050
|
-
} else e.series.sort === "alphabetical" &&
|
|
2051
|
-
const
|
|
2052
|
-
|
|
2053
|
-
const m = f.get(
|
|
2050
|
+
y.includes(m) || y.push(m);
|
|
2051
|
+
}), w = y;
|
|
2052
|
+
} else e.series.sort === "alphabetical" && w.sort((y, A) => y.localeCompare(A, void 0, { numeric: !0 }));
|
|
2053
|
+
const S = [];
|
|
2054
|
+
w.forEach((y, A) => {
|
|
2055
|
+
const m = f.get(y), d = /* @__PURE__ */ new Map();
|
|
2054
2056
|
m.forEach((O) => {
|
|
2055
|
-
const
|
|
2056
|
-
|
|
2057
|
+
const h = O[e.category.from] || "default";
|
|
2058
|
+
d.has(h) || d.set(h, []), d.get(h).push(O);
|
|
2057
2059
|
});
|
|
2058
|
-
let
|
|
2060
|
+
let b = Array.from(d.keys());
|
|
2059
2061
|
if (Array.isArray(e.category.sort))
|
|
2060
|
-
|
|
2062
|
+
b = e.category.sort.filter((O) => d.has(O)).concat(b.filter((O) => !e.category.sort.includes(O)));
|
|
2061
2063
|
else if (e.category.sort === "original") {
|
|
2062
2064
|
const O = [];
|
|
2063
|
-
m.forEach((
|
|
2064
|
-
const
|
|
2065
|
-
O.includes(
|
|
2066
|
-
}),
|
|
2067
|
-
} else e.category.sort === "alphabetical" &&
|
|
2068
|
-
const
|
|
2069
|
-
|
|
2070
|
-
|
|
2065
|
+
m.forEach((h) => {
|
|
2066
|
+
const p = h[e.category.from] || "default";
|
|
2067
|
+
O.includes(p) || O.push(p);
|
|
2068
|
+
}), b = O;
|
|
2069
|
+
} else e.category.sort === "alphabetical" && b.sort((O, h) => O.localeCompare(h, void 0, { numeric: !0 }));
|
|
2070
|
+
const T = [];
|
|
2071
|
+
b.forEach((O, h) => {
|
|
2072
|
+
d.get(O).forEach((E, P) => {
|
|
2071
2073
|
const I = e.multivariate.map((v, $) => ({
|
|
2072
2074
|
index: $,
|
|
2073
2075
|
name: v.name,
|
|
2074
2076
|
value: (() => {
|
|
2075
|
-
const
|
|
2076
|
-
return typeof
|
|
2077
|
+
const C = E[v.from];
|
|
2078
|
+
return typeof C == "number" ? C : null;
|
|
2077
2079
|
})()
|
|
2078
2080
|
})), c = {
|
|
2079
|
-
id: E.id || `${a}-${
|
|
2080
|
-
index:
|
|
2081
|
+
id: E.id || `${a}-${y}-${O}-${P}`,
|
|
2082
|
+
index: P,
|
|
2081
2083
|
modelType: "multivariate",
|
|
2082
2084
|
name: E.name || "",
|
|
2083
2085
|
data: E.data,
|
|
2084
2086
|
value: null,
|
|
2085
2087
|
// MultivariateData 的主要值在 values 陣列中,這裡設為 null
|
|
2086
2088
|
color: F(e.color.from, {
|
|
2087
|
-
index:
|
|
2089
|
+
index: P,
|
|
2088
2090
|
seriesIndex: A,
|
|
2089
|
-
categoryIndex:
|
|
2091
|
+
categoryIndex: h,
|
|
2090
2092
|
datasetIndex: l
|
|
2091
2093
|
}, r),
|
|
2092
2094
|
multivariate: I,
|
|
2093
|
-
series:
|
|
2095
|
+
series: y,
|
|
2094
2096
|
seriesIndex: A,
|
|
2095
2097
|
category: O,
|
|
2096
|
-
categoryIndex:
|
|
2098
|
+
categoryIndex: h
|
|
2097
2099
|
};
|
|
2098
|
-
|
|
2100
|
+
T.push(c);
|
|
2099
2101
|
});
|
|
2100
|
-
}),
|
|
2101
|
-
}), u.push(
|
|
2102
|
+
}), S.push(T);
|
|
2103
|
+
}), u.push(S);
|
|
2102
2104
|
}), u;
|
|
2103
2105
|
}, Fr = (t, e, r) => {
|
|
2104
2106
|
const n = Array.isArray(t[0]), o = [], s = [];
|
|
@@ -2111,10 +2113,10 @@ const Ke = {
|
|
|
2111
2113
|
});
|
|
2112
2114
|
const u = /* @__PURE__ */ new Map();
|
|
2113
2115
|
n ? t.forEach((i, f) => {
|
|
2114
|
-
i.forEach((
|
|
2115
|
-
if (!
|
|
2116
|
-
const
|
|
2117
|
-
u.has(
|
|
2116
|
+
i.forEach((w) => {
|
|
2117
|
+
if (!w.source || !w.target) {
|
|
2118
|
+
const S = w[e.dataset.from] || `dataset-${f}`;
|
|
2119
|
+
u.has(S) || u.set(S, []), u.get(S).push(w);
|
|
2118
2120
|
}
|
|
2119
2121
|
});
|
|
2120
2122
|
}) : o.forEach((i) => {
|
|
@@ -2126,146 +2128,146 @@ const Ke = {
|
|
|
2126
2128
|
a = e.dataset.sort.filter((i) => u.has(i)).concat(a.filter((i) => !e.dataset.sort.includes(i)));
|
|
2127
2129
|
else if (e.dataset.sort === "original") {
|
|
2128
2130
|
const i = [];
|
|
2129
|
-
n ? t.forEach((f,
|
|
2130
|
-
f.forEach((
|
|
2131
|
-
if (!
|
|
2132
|
-
const
|
|
2133
|
-
i.includes(
|
|
2131
|
+
n ? t.forEach((f, w) => {
|
|
2132
|
+
f.forEach((S) => {
|
|
2133
|
+
if (!S.source || !S.target) {
|
|
2134
|
+
const y = S[e.dataset.from] || `dataset-${w}`;
|
|
2135
|
+
i.includes(y) || i.push(y);
|
|
2134
2136
|
}
|
|
2135
2137
|
});
|
|
2136
2138
|
}) : o.forEach((f) => {
|
|
2137
|
-
const
|
|
2138
|
-
i.includes(
|
|
2139
|
+
const w = f[e.dataset.from] || "default";
|
|
2140
|
+
i.includes(w) || i.push(w);
|
|
2139
2141
|
}), a = i;
|
|
2140
2142
|
} else e.dataset.sort === "alphabetical" && a.sort((i, f) => i.localeCompare(f, void 0, { numeric: !0 }));
|
|
2141
2143
|
const l = [];
|
|
2142
2144
|
return a.forEach((i, f) => {
|
|
2143
|
-
const
|
|
2144
|
-
|
|
2145
|
+
const w = u.get(i), S = [], y = /* @__PURE__ */ new Map();
|
|
2146
|
+
w.forEach((c) => {
|
|
2145
2147
|
const v = c[e.series.from] || "default";
|
|
2146
|
-
|
|
2148
|
+
y.has(v) || y.set(v, []), y.get(v).push(c);
|
|
2147
2149
|
});
|
|
2148
|
-
let A = Array.from(
|
|
2150
|
+
let A = Array.from(y.keys());
|
|
2149
2151
|
if (Array.isArray(e.series.sort))
|
|
2150
|
-
A = e.series.sort.filter((c) =>
|
|
2152
|
+
A = e.series.sort.filter((c) => y.has(c)).concat(A.filter((c) => !e.series.sort.includes(c)));
|
|
2151
2153
|
else if (e.series.sort === "original") {
|
|
2152
2154
|
const c = [];
|
|
2153
|
-
|
|
2155
|
+
w.forEach((v) => {
|
|
2154
2156
|
const $ = v[e.series.from] || "default";
|
|
2155
2157
|
c.includes($) || c.push($);
|
|
2156
2158
|
}), A = c;
|
|
2157
2159
|
} else e.series.sort === "alphabetical" && A.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
|
|
2158
2160
|
A.forEach((c, v) => {
|
|
2159
|
-
const $ =
|
|
2160
|
-
$.forEach((
|
|
2161
|
-
const
|
|
2162
|
-
|
|
2161
|
+
const $ = y.get(c), C = /* @__PURE__ */ new Map();
|
|
2162
|
+
$.forEach((x) => {
|
|
2163
|
+
const _ = x[e.category.from] || "default";
|
|
2164
|
+
C.has(_) || C.set(_, []), C.get(_).push(x);
|
|
2163
2165
|
});
|
|
2164
|
-
let
|
|
2166
|
+
let g = Array.from(C.keys());
|
|
2165
2167
|
if (Array.isArray(e.category.sort))
|
|
2166
|
-
|
|
2168
|
+
g = e.category.sort.filter((x) => C.has(x)).concat(g.filter((x) => !e.category.sort.includes(x)));
|
|
2167
2169
|
else if (e.category.sort === "original") {
|
|
2168
|
-
const
|
|
2169
|
-
$.forEach((
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2172
|
-
}),
|
|
2173
|
-
} else e.category.sort === "alphabetical" &&
|
|
2174
|
-
|
|
2175
|
-
const
|
|
2170
|
+
const x = [];
|
|
2171
|
+
$.forEach((_) => {
|
|
2172
|
+
const B = _[e.category.from] || "default";
|
|
2173
|
+
x.includes(B) || x.push(B);
|
|
2174
|
+
}), g = x;
|
|
2175
|
+
} else e.category.sort === "alphabetical" && g.sort((x, _) => x.localeCompare(_, void 0, { numeric: !0 }));
|
|
2176
|
+
g.forEach((x, _) => {
|
|
2177
|
+
const B = C.get(x);
|
|
2176
2178
|
if (e.value.aggregate === "none") {
|
|
2177
|
-
let j =
|
|
2178
|
-
const K =
|
|
2179
|
+
let j = B.map((k, M) => {
|
|
2180
|
+
const K = k[e.value.from];
|
|
2179
2181
|
return {
|
|
2180
|
-
id:
|
|
2181
|
-
index:
|
|
2182
|
+
id: k.id || `${i}-${c}-${x}-${M}`,
|
|
2183
|
+
index: S.length + M,
|
|
2182
2184
|
// 在所有 nodes 中的索引
|
|
2183
2185
|
modelType: "graph",
|
|
2184
|
-
name:
|
|
2185
|
-
data:
|
|
2186
|
+
name: k.name || "",
|
|
2187
|
+
data: k.data,
|
|
2186
2188
|
value: typeof K == "number" ? K : null,
|
|
2187
2189
|
color: F(e.color.from, {
|
|
2188
|
-
index:
|
|
2190
|
+
index: _,
|
|
2189
2191
|
seriesIndex: v,
|
|
2190
|
-
categoryIndex:
|
|
2192
|
+
categoryIndex: _,
|
|
2191
2193
|
datasetIndex: f
|
|
2192
2194
|
}, r),
|
|
2193
2195
|
series: c,
|
|
2194
2196
|
seriesIndex: v,
|
|
2195
|
-
category:
|
|
2196
|
-
categoryIndex:
|
|
2197
|
+
category: x,
|
|
2198
|
+
categoryIndex: _
|
|
2197
2199
|
};
|
|
2198
2200
|
});
|
|
2199
|
-
e.value.sort === "asc" ? j.sort((
|
|
2201
|
+
e.value.sort === "asc" ? j.sort((k, M) => k.value === null && M.value === null ? 0 : k.value === null ? 1 : M.value === null ? -1 : k.value - M.value) : e.value.sort === "desc" && j.sort((k, M) => k.value === null && M.value === null ? 0 : k.value === null ? 1 : M.value === null ? -1 : M.value - k.value), S.push(...j);
|
|
2200
2202
|
} else {
|
|
2201
|
-
const j =
|
|
2203
|
+
const j = B.map((Z) => {
|
|
2202
2204
|
if (e.value.aggregate === "count")
|
|
2203
2205
|
return 1;
|
|
2204
|
-
const
|
|
2205
|
-
return typeof
|
|
2206
|
-
}),
|
|
2207
|
-
id:
|
|
2208
|
-
index:
|
|
2206
|
+
const te = Z[e.value.from];
|
|
2207
|
+
return typeof te == "number" ? te : null;
|
|
2208
|
+
}), k = pe(j, e.value.aggregate), M = B[0], K = {
|
|
2209
|
+
id: M.id || `${i}-${c}-${x}-aggregated`,
|
|
2210
|
+
index: S.length,
|
|
2209
2211
|
// 在所有 nodes 中的索引
|
|
2210
2212
|
modelType: "graph",
|
|
2211
|
-
name:
|
|
2212
|
-
data:
|
|
2213
|
-
value:
|
|
2213
|
+
name: M.name || x,
|
|
2214
|
+
data: M.data,
|
|
2215
|
+
value: k,
|
|
2214
2216
|
color: F(e.color.from, {
|
|
2215
|
-
index:
|
|
2217
|
+
index: _,
|
|
2216
2218
|
seriesIndex: v,
|
|
2217
|
-
categoryIndex:
|
|
2219
|
+
categoryIndex: _,
|
|
2218
2220
|
datasetIndex: f
|
|
2219
2221
|
}, r),
|
|
2220
2222
|
series: c,
|
|
2221
2223
|
seriesIndex: v,
|
|
2222
|
-
category:
|
|
2223
|
-
categoryIndex:
|
|
2224
|
+
category: x,
|
|
2225
|
+
categoryIndex: _
|
|
2224
2226
|
};
|
|
2225
|
-
|
|
2227
|
+
S.push(K);
|
|
2226
2228
|
}
|
|
2227
2229
|
});
|
|
2228
2230
|
});
|
|
2229
|
-
const m = [],
|
|
2230
|
-
|
|
2231
|
+
const m = [], d = /* @__PURE__ */ new Map();
|
|
2232
|
+
S.forEach((c) => {
|
|
2231
2233
|
const v = o.find(($) => $.id === c.id || $.name === c.name);
|
|
2232
|
-
v != null && v.id &&
|
|
2234
|
+
v != null && v.id && d.set(v.id, c.index), v != null && v.name && d.set(v.name, c.index);
|
|
2233
2235
|
});
|
|
2234
|
-
const
|
|
2235
|
-
|
|
2236
|
-
|
|
2236
|
+
const b = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map();
|
|
2237
|
+
S.forEach((c) => {
|
|
2238
|
+
b.has(c.series) || b.set(c.series, c.seriesIndex), T.has(c.category) || T.set(c.category, c.categoryIndex);
|
|
2237
2239
|
});
|
|
2238
|
-
let O =
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2241
|
-
const v = c.source, $ = c.target,
|
|
2242
|
-
I.has(
|
|
2240
|
+
let O = b.size, h = T.size;
|
|
2241
|
+
const p = (c) => (b.has(c) || b.set(c, O++), b.get(c)), E = (c) => (T.has(c) || T.set(c, h++), T.get(c)), P = s.filter((c) => (c[e.dataset.from] || "default") === i), I = /* @__PURE__ */ new Map();
|
|
2242
|
+
P.forEach((c) => {
|
|
2243
|
+
const v = c.source, $ = c.target, C = c[e.series.from] || "default", g = c[e.category.from] || "default", x = `${v}-${$}-${C}-${g}`;
|
|
2244
|
+
I.has(x) || I.set(x, []), I.get(x).push(c);
|
|
2243
2245
|
}), Array.from(I.entries()).forEach(([c, v], $) => {
|
|
2244
|
-
const
|
|
2245
|
-
if (
|
|
2246
|
+
const C = v[0], g = C.source, x = C.target, _ = d.get(g) ?? -1, B = d.get(x) ?? -1;
|
|
2247
|
+
if (_ >= 0 && B >= 0)
|
|
2246
2248
|
if (e.value.aggregate === "none")
|
|
2247
|
-
v.forEach((j,
|
|
2248
|
-
const
|
|
2249
|
-
id: j.id || `edge-${$}-${
|
|
2249
|
+
v.forEach((j, k) => {
|
|
2250
|
+
const M = j[e.value.from], K = j[e.series.from] || "default", Z = j[e.category.from] || "default", te = p(K), ve = E(Z), Ee = {
|
|
2251
|
+
id: j.id || `edge-${$}-${k}`,
|
|
2250
2252
|
index: m.length,
|
|
2251
2253
|
modelType: "graph",
|
|
2252
2254
|
name: j.name || "",
|
|
2253
2255
|
data: j.data,
|
|
2254
|
-
value: typeof
|
|
2256
|
+
value: typeof M == "number" ? M : null,
|
|
2255
2257
|
color: F(e.color.from, {
|
|
2256
2258
|
index: m.length,
|
|
2257
|
-
seriesIndex:
|
|
2259
|
+
seriesIndex: te,
|
|
2258
2260
|
categoryIndex: ve,
|
|
2259
2261
|
datasetIndex: f
|
|
2260
2262
|
}, r),
|
|
2261
2263
|
series: K,
|
|
2262
|
-
seriesIndex:
|
|
2263
|
-
category:
|
|
2264
|
+
seriesIndex: te,
|
|
2265
|
+
category: Z,
|
|
2264
2266
|
categoryIndex: ve,
|
|
2265
|
-
source:
|
|
2266
|
-
sourceIndex:
|
|
2267
|
-
target:
|
|
2268
|
-
targetIndex:
|
|
2267
|
+
source: g,
|
|
2268
|
+
sourceIndex: _,
|
|
2269
|
+
target: x,
|
|
2270
|
+
targetIndex: B
|
|
2269
2271
|
};
|
|
2270
2272
|
m.push(Ee);
|
|
2271
2273
|
});
|
|
@@ -2275,31 +2277,31 @@ const Ke = {
|
|
|
2275
2277
|
return 1;
|
|
2276
2278
|
const Pe = Ee[e.value.from];
|
|
2277
2279
|
return typeof Pe == "number" ? Pe : null;
|
|
2278
|
-
}),
|
|
2279
|
-
id:
|
|
2280
|
+
}), k = pe(j, e.value.aggregate), M = C[e.series.from] || "default", K = C[e.category.from] || "default", Z = p(M), te = E(K), ve = {
|
|
2281
|
+
id: C.id || `edge-${$}-aggregated`,
|
|
2280
2282
|
index: m.length,
|
|
2281
2283
|
modelType: "graph",
|
|
2282
|
-
name:
|
|
2283
|
-
data:
|
|
2284
|
-
value:
|
|
2284
|
+
name: C.name || "",
|
|
2285
|
+
data: C.data,
|
|
2286
|
+
value: k,
|
|
2285
2287
|
color: F(e.color.from, {
|
|
2286
2288
|
index: m.length,
|
|
2287
|
-
seriesIndex:
|
|
2288
|
-
categoryIndex:
|
|
2289
|
+
seriesIndex: Z,
|
|
2290
|
+
categoryIndex: te,
|
|
2289
2291
|
datasetIndex: f
|
|
2290
2292
|
}, r),
|
|
2291
|
-
series:
|
|
2292
|
-
seriesIndex:
|
|
2293
|
+
series: M,
|
|
2294
|
+
seriesIndex: Z,
|
|
2293
2295
|
category: K,
|
|
2294
|
-
categoryIndex:
|
|
2295
|
-
source:
|
|
2296
|
-
sourceIndex:
|
|
2297
|
-
target:
|
|
2298
|
-
targetIndex:
|
|
2296
|
+
categoryIndex: te,
|
|
2297
|
+
source: g,
|
|
2298
|
+
sourceIndex: _,
|
|
2299
|
+
target: x,
|
|
2300
|
+
targetIndex: B
|
|
2299
2301
|
};
|
|
2300
2302
|
m.push(ve);
|
|
2301
2303
|
}
|
|
2302
|
-
}), l.push({ nodes:
|
|
2304
|
+
}), l.push({ nodes: S, edges: m });
|
|
2303
2305
|
}), l;
|
|
2304
2306
|
}, Dr = (t, e, r) => {
|
|
2305
2307
|
const n = /* @__PURE__ */ new Map(), o = Array.isArray(t[0]);
|
|
@@ -2319,8 +2321,8 @@ const Ke = {
|
|
|
2319
2321
|
const a = [];
|
|
2320
2322
|
o ? t.forEach((l, i) => {
|
|
2321
2323
|
l.forEach((f) => {
|
|
2322
|
-
const
|
|
2323
|
-
a.includes(
|
|
2324
|
+
const w = f[e.dataset.from] || `dataset-${i}`;
|
|
2325
|
+
a.includes(w) || a.push(w);
|
|
2324
2326
|
});
|
|
2325
2327
|
}) : t.forEach((l) => {
|
|
2326
2328
|
const i = l[e.dataset.from] || "default";
|
|
@@ -2334,52 +2336,52 @@ const Ke = {
|
|
|
2334
2336
|
const v = c[e.series.from] || "default";
|
|
2335
2337
|
f.has(v) || f.set(v, []), f.get(v).push(c);
|
|
2336
2338
|
});
|
|
2337
|
-
let
|
|
2339
|
+
let w = Array.from(f.keys());
|
|
2338
2340
|
if (Array.isArray(e.series.sort))
|
|
2339
|
-
|
|
2341
|
+
w = e.series.sort.filter((c) => f.has(c)).concat(w.filter((c) => !e.series.sort.includes(c)));
|
|
2340
2342
|
else if (e.series.sort === "original") {
|
|
2341
2343
|
const c = [];
|
|
2342
2344
|
i.forEach((v) => {
|
|
2343
2345
|
const $ = v[e.series.from] || "default";
|
|
2344
2346
|
c.includes($) || c.push($);
|
|
2345
|
-
}),
|
|
2346
|
-
} else e.series.sort === "alphabetical" &&
|
|
2347
|
-
const
|
|
2347
|
+
}), w = c;
|
|
2348
|
+
} else e.series.sort === "alphabetical" && w.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
|
|
2349
|
+
const S = /* @__PURE__ */ new Map();
|
|
2348
2350
|
i.forEach((c) => {
|
|
2349
2351
|
const v = c[e.category.from] || "default";
|
|
2350
|
-
|
|
2352
|
+
S.has(v) || S.set(v, []), S.get(v).push(c);
|
|
2351
2353
|
});
|
|
2352
|
-
let
|
|
2354
|
+
let y = Array.from(S.keys());
|
|
2353
2355
|
if (Array.isArray(e.category.sort))
|
|
2354
|
-
|
|
2356
|
+
y = e.category.sort.filter((c) => S.has(c)).concat(y.filter((c) => !e.category.sort.includes(c)));
|
|
2355
2357
|
else if (e.category.sort === "original") {
|
|
2356
2358
|
const c = [];
|
|
2357
2359
|
i.forEach((v) => {
|
|
2358
2360
|
const $ = v[e.category.from] || "default";
|
|
2359
2361
|
c.includes($) || c.push($);
|
|
2360
|
-
}),
|
|
2361
|
-
} else e.category.sort === "alphabetical" &&
|
|
2362
|
+
}), y = c;
|
|
2363
|
+
} else e.category.sort === "alphabetical" && y.sort((c, v) => c.localeCompare(v, void 0, { numeric: !0 }));
|
|
2362
2364
|
const A = /* @__PURE__ */ new Map();
|
|
2363
2365
|
i.forEach((c) => {
|
|
2364
2366
|
const v = c.id || "unknown";
|
|
2365
2367
|
A.has(v) || A.set(v, []), A.get(v).push(c);
|
|
2366
2368
|
});
|
|
2367
2369
|
let m = 0;
|
|
2368
|
-
const
|
|
2370
|
+
const d = w[0] || "default", b = w.indexOf(d), T = /* @__PURE__ */ new Map();
|
|
2369
2371
|
Array.from(A.entries()).forEach(([c, v]) => {
|
|
2370
|
-
const $ = v[0],
|
|
2372
|
+
const $ = v[0], C = $[e.series.from] || "default", g = w.indexOf(C), x = $[e.category.from] || "default", _ = y.indexOf(x);
|
|
2371
2373
|
if (e.value.aggregate === "none") {
|
|
2372
|
-
const
|
|
2374
|
+
const B = $[e.value.from], j = {
|
|
2373
2375
|
id: c,
|
|
2374
2376
|
index: m++,
|
|
2375
2377
|
modelType: "tree",
|
|
2376
2378
|
name: $.name || c,
|
|
2377
2379
|
data: $.data,
|
|
2378
|
-
value: typeof
|
|
2380
|
+
value: typeof B == "number" ? B : null,
|
|
2379
2381
|
color: F(e.color.from, {
|
|
2380
2382
|
index: m - 1,
|
|
2381
|
-
seriesIndex:
|
|
2382
|
-
categoryIndex:
|
|
2383
|
+
seriesIndex: g,
|
|
2384
|
+
categoryIndex: _,
|
|
2383
2385
|
datasetIndex: l
|
|
2384
2386
|
}, r),
|
|
2385
2387
|
parent: $.parent || null,
|
|
@@ -2390,19 +2392,19 @@ const Ke = {
|
|
|
2390
2392
|
seq: 0,
|
|
2391
2393
|
// 稍後計算
|
|
2392
2394
|
children: [],
|
|
2393
|
-
series:
|
|
2394
|
-
seriesIndex:
|
|
2395
|
-
category:
|
|
2396
|
-
categoryIndex:
|
|
2395
|
+
series: C,
|
|
2396
|
+
seriesIndex: g,
|
|
2397
|
+
category: x,
|
|
2398
|
+
categoryIndex: _
|
|
2397
2399
|
};
|
|
2398
|
-
|
|
2400
|
+
T.set(c, j);
|
|
2399
2401
|
} else {
|
|
2400
|
-
const
|
|
2402
|
+
const B = v.map((M) => {
|
|
2401
2403
|
if (e.value.aggregate === "count")
|
|
2402
2404
|
return 1;
|
|
2403
|
-
const K =
|
|
2405
|
+
const K = M[e.value.from];
|
|
2404
2406
|
return typeof K == "number" ? K : null;
|
|
2405
|
-
}), j = pe(
|
|
2407
|
+
}), j = pe(B, e.value.aggregate), k = {
|
|
2406
2408
|
id: c,
|
|
2407
2409
|
index: m++,
|
|
2408
2410
|
modelType: "tree",
|
|
@@ -2411,8 +2413,8 @@ const Ke = {
|
|
|
2411
2413
|
value: j,
|
|
2412
2414
|
color: F(e.color.from, {
|
|
2413
2415
|
index: m - 1,
|
|
2414
|
-
seriesIndex:
|
|
2415
|
-
categoryIndex:
|
|
2416
|
+
seriesIndex: g,
|
|
2417
|
+
categoryIndex: _,
|
|
2416
2418
|
datasetIndex: l
|
|
2417
2419
|
}, r),
|
|
2418
2420
|
parent: $.parent || null,
|
|
@@ -2423,32 +2425,32 @@ const Ke = {
|
|
|
2423
2425
|
seq: 0,
|
|
2424
2426
|
// 稍後計算
|
|
2425
2427
|
children: [],
|
|
2426
|
-
series:
|
|
2427
|
-
seriesIndex:
|
|
2428
|
-
category:
|
|
2429
|
-
categoryIndex:
|
|
2428
|
+
series: C,
|
|
2429
|
+
seriesIndex: g,
|
|
2430
|
+
category: x,
|
|
2431
|
+
categoryIndex: _
|
|
2430
2432
|
};
|
|
2431
|
-
|
|
2433
|
+
T.set(c, k);
|
|
2432
2434
|
}
|
|
2433
2435
|
});
|
|
2434
|
-
const O = Array.from(
|
|
2436
|
+
const O = Array.from(T.values()), h = /* @__PURE__ */ new Map();
|
|
2435
2437
|
O.forEach((c) => {
|
|
2436
|
-
|
|
2438
|
+
h.set(c.id, c.index);
|
|
2437
2439
|
}), O.forEach((c) => {
|
|
2438
|
-
c.parent &&
|
|
2440
|
+
c.parent && h.has(c.parent) && (c.parentIndex = h.get(c.parent));
|
|
2439
2441
|
});
|
|
2440
|
-
const
|
|
2442
|
+
const p = [], E = /* @__PURE__ */ new Map();
|
|
2441
2443
|
O.forEach((c) => {
|
|
2442
|
-
c.parent === null ?
|
|
2444
|
+
c.parent === null ? p.push(c) : (E.has(c.parent) || E.set(c.parent, []), E.get(c.parent).push(c));
|
|
2443
2445
|
});
|
|
2444
|
-
function
|
|
2446
|
+
function P(c, v) {
|
|
2445
2447
|
c.depth = v;
|
|
2446
2448
|
const $ = E.get(c.id) || [];
|
|
2447
|
-
return e.value.sort === "asc" ? $.sort((
|
|
2448
|
-
|
|
2449
|
-
}), c.children = $.map((
|
|
2449
|
+
return e.value.sort === "asc" ? $.sort((C, g) => C.value === null && g.value === null ? 0 : C.value === null ? 1 : g.value === null ? -1 : C.value - g.value) : e.value.sort === "desc" && $.sort((C, g) => C.value === null && g.value === null ? 0 : C.value === null ? 1 : g.value === null ? -1 : g.value - C.value), $.forEach((C, g) => {
|
|
2450
|
+
C.seq = g;
|
|
2451
|
+
}), c.children = $.map((C) => P(C, v + 1)), c;
|
|
2450
2452
|
}
|
|
2451
|
-
const I =
|
|
2453
|
+
const I = p.map((c) => P(c, 0));
|
|
2452
2454
|
if (I.length === 0)
|
|
2453
2455
|
u.push({
|
|
2454
2456
|
id: `empty-${a}`,
|
|
@@ -2459,7 +2461,7 @@ const Ke = {
|
|
|
2459
2461
|
value: null,
|
|
2460
2462
|
color: F(e.color.from, {
|
|
2461
2463
|
index: m - 1,
|
|
2462
|
-
seriesIndex:
|
|
2464
|
+
seriesIndex: b < 0 ? 0 : b,
|
|
2463
2465
|
categoryIndex: 0,
|
|
2464
2466
|
datasetIndex: l
|
|
2465
2467
|
}, r),
|
|
@@ -2468,8 +2470,8 @@ const Ke = {
|
|
|
2468
2470
|
depth: 0,
|
|
2469
2471
|
seq: 0,
|
|
2470
2472
|
children: [],
|
|
2471
|
-
series:
|
|
2472
|
-
seriesIndex:
|
|
2473
|
+
series: d,
|
|
2474
|
+
seriesIndex: b < 0 ? 0 : b,
|
|
2473
2475
|
category: "default",
|
|
2474
2476
|
categoryIndex: 0
|
|
2475
2477
|
});
|
|
@@ -2485,7 +2487,7 @@ const Ke = {
|
|
|
2485
2487
|
value: null,
|
|
2486
2488
|
color: F(e.color.from, {
|
|
2487
2489
|
index: m - 1,
|
|
2488
|
-
seriesIndex:
|
|
2490
|
+
seriesIndex: b < 0 ? 0 : b,
|
|
2489
2491
|
categoryIndex: 0,
|
|
2490
2492
|
datasetIndex: l
|
|
2491
2493
|
}, r),
|
|
@@ -2494,11 +2496,11 @@ const Ke = {
|
|
|
2494
2496
|
depth: 0,
|
|
2495
2497
|
seq: 0,
|
|
2496
2498
|
children: I.map((v, $) => {
|
|
2497
|
-
const
|
|
2498
|
-
return
|
|
2499
|
+
const C = (g, x) => (g.depth = x, x === 1 && (g.seq = $), g.children = g.children.map((_) => C(_, x + 1)), g);
|
|
2500
|
+
return C(v, 1);
|
|
2499
2501
|
}),
|
|
2500
|
-
series:
|
|
2501
|
-
seriesIndex:
|
|
2502
|
+
series: d,
|
|
2503
|
+
seriesIndex: b < 0 ? 0 : b,
|
|
2502
2504
|
category: "default",
|
|
2503
2505
|
categoryIndex: 0
|
|
2504
2506
|
};
|
|
@@ -2737,7 +2739,7 @@ function dt(t) {
|
|
|
2737
2739
|
data: {
|
|
2738
2740
|
toBe: "RawDataColumn[] | RawDataColumn[][]",
|
|
2739
2741
|
// 畢免資料量過大檢查不完,不深度檢查
|
|
2740
|
-
test: (r) => Array.isArray(r) && r.every((n) => Array.isArray(n) ||
|
|
2742
|
+
test: (r) => Array.isArray(r) && r.every((n) => Array.isArray(n) || X(n))
|
|
2741
2743
|
}
|
|
2742
2744
|
});
|
|
2743
2745
|
}
|
|
@@ -2745,7 +2747,7 @@ function $e(t) {
|
|
|
2745
2747
|
return V({ plugins: t }, {
|
|
2746
2748
|
plugins: {
|
|
2747
2749
|
toBe: "PluginEntity[]",
|
|
2748
|
-
test: (r) => Array.isArray(r) && r.every((n) =>
|
|
2750
|
+
test: (r) => Array.isArray(r) && r.every((n) => X(n) && typeof n._name == "string" && typeof n._injectContext == "function")
|
|
2749
2751
|
}
|
|
2750
2752
|
});
|
|
2751
2753
|
}
|
|
@@ -2769,7 +2771,7 @@ function qr(t) {
|
|
|
2769
2771
|
},
|
|
2770
2772
|
plugins: {
|
|
2771
2773
|
toBe: "PluginEntity[]",
|
|
2772
|
-
test: (r) => Array.isArray(r) && r.every((n) =>
|
|
2774
|
+
test: (r) => Array.isArray(r) && r.every((n) => X(n) && typeof n._name == "string" && typeof n._injectContext == "function")
|
|
2773
2775
|
}
|
|
2774
2776
|
});
|
|
2775
2777
|
if (e.status === "error")
|
|
@@ -2804,387 +2806,391 @@ function qr(t) {
|
|
|
2804
2806
|
function Gr({ svgElement$: t, canvasElement$: e, pluginsInstance$: r }) {
|
|
2805
2807
|
let n = [], o = [];
|
|
2806
2808
|
const s = (l, i, f) => {
|
|
2807
|
-
const
|
|
2809
|
+
const w = r.getValue().reduce((A, m, d) => (A[m._getId()] = d, A), {}), S = f.map((A) => ({
|
|
2808
2810
|
...A,
|
|
2809
|
-
pluginSeq:
|
|
2811
|
+
pluginSeq: w[A.pluginId]
|
|
2810
2812
|
}));
|
|
2811
2813
|
return (l === "svg" ? n : o).filter((A) => A.pluginId !== i).map((A) => ({
|
|
2812
2814
|
...A,
|
|
2813
|
-
pluginSeq:
|
|
2814
|
-
})).concat(
|
|
2815
|
+
pluginSeq: w[A.pluginId]
|
|
2816
|
+
})).concat(S).sort((A, m) => A.layerIndex - m.layerIndex || A.pluginSeq - m.pluginSeq);
|
|
2815
2817
|
}, u = {}, a = {};
|
|
2816
2818
|
return (l, i, f) => {
|
|
2817
|
-
const
|
|
2818
|
-
if (!
|
|
2819
|
+
const w = l === "svg" ? t.getValue() : e.getValue();
|
|
2820
|
+
if (!w)
|
|
2819
2821
|
return {};
|
|
2820
|
-
const
|
|
2822
|
+
const S = l === "svg" ? u : a, y = s(l, i, f), A = y.map((d) => Mr(d.pluginId, d.layerName));
|
|
2821
2823
|
return l === "svg" ? (Ne(
|
|
2822
|
-
|
|
2824
|
+
w,
|
|
2823
2825
|
A,
|
|
2824
|
-
|
|
2825
|
-
(
|
|
2826
|
-
), n =
|
|
2827
|
-
|
|
2826
|
+
S,
|
|
2827
|
+
(d) => Br(d)
|
|
2828
|
+
), n = y) : (Ne(
|
|
2829
|
+
w,
|
|
2828
2830
|
A,
|
|
2829
|
-
|
|
2830
|
-
(
|
|
2831
|
-
), o =
|
|
2832
|
-
const [O,
|
|
2833
|
-
return
|
|
2831
|
+
S,
|
|
2832
|
+
(d) => ft(d)
|
|
2833
|
+
), o = y), Object.entries(S).reduce((d, [b, T]) => {
|
|
2834
|
+
const [O, h, p] = b.split("-");
|
|
2835
|
+
return h === i && (d[p] = T), d;
|
|
2834
2836
|
}, {});
|
|
2835
2837
|
};
|
|
2836
2838
|
}
|
|
2837
2839
|
const Wr = (t, e) => {
|
|
2838
2840
|
try {
|
|
2839
|
-
const { status:
|
|
2840
|
-
if (
|
|
2841
|
-
throw new Error(
|
|
2842
|
-
columnName:
|
|
2843
|
-
expectToBe:
|
|
2841
|
+
const { status: b, columnName: T, expectToBe: O } = qr(e);
|
|
2842
|
+
if (b === "error")
|
|
2843
|
+
throw new Error(H({
|
|
2844
|
+
columnName: T,
|
|
2845
|
+
expectToBe: O,
|
|
2844
2846
|
from: "Chart.constructor"
|
|
2845
2847
|
}));
|
|
2846
|
-
if (
|
|
2847
|
-
console.warn(
|
|
2848
|
-
columnName:
|
|
2849
|
-
expectToBe:
|
|
2848
|
+
if (b === "warning")
|
|
2849
|
+
console.warn(Q({
|
|
2850
|
+
columnName: T,
|
|
2851
|
+
expectToBe: O,
|
|
2850
2852
|
from: "Chart.constructor"
|
|
2851
2853
|
}));
|
|
2852
2854
|
else {
|
|
2853
|
-
const { status:
|
|
2854
|
-
if (
|
|
2855
|
-
throw new Error(
|
|
2856
|
-
columnName:
|
|
2857
|
-
expectToBe:
|
|
2855
|
+
const { status: h, columnName: p, expectToBe: E } = Ur(t);
|
|
2856
|
+
if (h === "error")
|
|
2857
|
+
throw new Error(H({
|
|
2858
|
+
columnName: p,
|
|
2859
|
+
expectToBe: E,
|
|
2858
2860
|
from: "Chart.constructor"
|
|
2859
2861
|
}));
|
|
2860
|
-
|
|
2861
|
-
columnName:
|
|
2862
|
-
expectToBe:
|
|
2862
|
+
h === "warning" && console.warn(Q({
|
|
2863
|
+
columnName: p,
|
|
2864
|
+
expectToBe: E,
|
|
2863
2865
|
from: "Chart.constructor"
|
|
2864
2866
|
}));
|
|
2865
2867
|
}
|
|
2866
|
-
} catch (
|
|
2867
|
-
throw new Error(
|
|
2868
|
+
} catch (b) {
|
|
2869
|
+
throw new Error(b);
|
|
2868
2870
|
}
|
|
2869
|
-
const r = new oe(), n = new D((e == null ? void 0 : e.data) || []), o = e && e.encoding ? W(Fe, e.encoding) : Fe, s = new D(o), u = e && e.theme ? W(De, e.theme) : De, a = new D(u), l = new D((e == null ? void 0 : e.plugins) || []), i = e && e.size ? W(Ke, e.size) : Ke, f = new D(i),
|
|
2870
|
-
const
|
|
2871
|
-
br((
|
|
2872
|
-
() =>
|
|
2871
|
+
const r = new oe(), n = new D((e == null ? void 0 : e.data) || []), o = e && e.encoding ? W(Fe, e.encoding) : Fe, s = new D(o), u = e && e.theme ? W(De, e.theme) : De, a = new D(u), l = new D((e == null ? void 0 : e.plugins) || []), i = e && e.size ? W(Ke, e.size) : Ke, f = new D(i), w = new D(null), S = new D(null), y = (() => {
|
|
2872
|
+
const b = f.pipe(
|
|
2873
|
+
br((g) => fr(
|
|
2874
|
+
() => g.width === "auto" || g.height === "auto",
|
|
2873
2875
|
// 有 'auto' 的話就監聽element的尺寸
|
|
2874
2876
|
jr(t).pipe(
|
|
2875
2877
|
q((x) => ({
|
|
2876
|
-
width:
|
|
2877
|
-
height:
|
|
2878
|
+
width: g.width === "auto" ? x.width : g.width,
|
|
2879
|
+
height: g.height === "auto" ? x.height <= 0 ? x.width : x.height : g.height
|
|
2878
2880
|
})),
|
|
2879
|
-
G(
|
|
2880
|
-
pr((x,
|
|
2881
|
+
G(g.resizeDebounce),
|
|
2882
|
+
pr((x, _) => JSON.stringify(x) === JSON.stringify(_))
|
|
2881
2883
|
),
|
|
2882
2884
|
Qt({
|
|
2883
|
-
width:
|
|
2884
|
-
height:
|
|
2885
|
+
width: g.width,
|
|
2886
|
+
height: g.height
|
|
2885
2887
|
})
|
|
2886
2888
|
)),
|
|
2887
2889
|
wr(r),
|
|
2888
|
-
|
|
2889
|
-
),
|
|
2890
|
-
|
|
2891
|
-
),
|
|
2890
|
+
re(1)
|
|
2891
|
+
), T = s.asObservable().pipe(
|
|
2892
|
+
re(1)
|
|
2893
|
+
), O = J([
|
|
2892
2894
|
n,
|
|
2893
2895
|
s,
|
|
2894
2896
|
a
|
|
2895
2897
|
]).pipe(
|
|
2896
2898
|
G(0),
|
|
2897
|
-
q(([
|
|
2899
|
+
q(([g, x, _]) => {
|
|
2898
2900
|
try {
|
|
2899
|
-
return Vr(
|
|
2900
|
-
} catch (
|
|
2901
|
+
return Vr(g, x, _);
|
|
2902
|
+
} catch (B) {
|
|
2901
2903
|
throw new Error(fe({
|
|
2902
2904
|
from: "Chart.seriesData$",
|
|
2903
|
-
systemMessage:
|
|
2905
|
+
systemMessage: B
|
|
2904
2906
|
}));
|
|
2905
2907
|
}
|
|
2906
2908
|
}),
|
|
2907
|
-
ae((
|
|
2908
|
-
|
|
2909
|
-
),
|
|
2909
|
+
ae((g) => (console.error(z(g)), se)),
|
|
2910
|
+
re(1)
|
|
2911
|
+
), h = J([
|
|
2910
2912
|
n,
|
|
2911
2913
|
s,
|
|
2912
2914
|
a
|
|
2913
2915
|
]).pipe(
|
|
2914
2916
|
G(0),
|
|
2915
|
-
q(([
|
|
2917
|
+
q(([g, x, _]) => {
|
|
2916
2918
|
try {
|
|
2917
|
-
return Rr(
|
|
2918
|
-
} catch (
|
|
2919
|
+
return Rr(g, x, _);
|
|
2920
|
+
} catch (B) {
|
|
2919
2921
|
throw new Error(fe({
|
|
2920
2922
|
from: "Chart.gridData$",
|
|
2921
|
-
systemMessage:
|
|
2923
|
+
systemMessage: B
|
|
2922
2924
|
}));
|
|
2923
2925
|
}
|
|
2924
2926
|
}),
|
|
2925
|
-
ae((
|
|
2926
|
-
|
|
2927
|
-
),
|
|
2927
|
+
ae((g) => (console.error(z(g)), se)),
|
|
2928
|
+
re(1)
|
|
2929
|
+
), p = J([
|
|
2928
2930
|
n,
|
|
2929
2931
|
s,
|
|
2930
2932
|
a
|
|
2931
2933
|
]).pipe(
|
|
2932
2934
|
G(0),
|
|
2933
|
-
q(([
|
|
2935
|
+
q(([g, x, _]) => {
|
|
2934
2936
|
try {
|
|
2935
|
-
return Kr(
|
|
2936
|
-
} catch (
|
|
2937
|
+
return Kr(g, x, _);
|
|
2938
|
+
} catch (B) {
|
|
2937
2939
|
throw new Error(fe({
|
|
2938
2940
|
from: "Chart.multivariateData$",
|
|
2939
|
-
systemMessage:
|
|
2941
|
+
systemMessage: B
|
|
2940
2942
|
}));
|
|
2941
2943
|
}
|
|
2942
2944
|
}),
|
|
2943
|
-
ae((
|
|
2944
|
-
|
|
2945
|
-
),
|
|
2945
|
+
ae((g) => (console.error(z(g)), se)),
|
|
2946
|
+
re(1)
|
|
2947
|
+
), E = J([
|
|
2946
2948
|
n,
|
|
2947
2949
|
s,
|
|
2948
2950
|
a
|
|
2949
2951
|
]).pipe(
|
|
2950
2952
|
G(0),
|
|
2951
|
-
q(([
|
|
2953
|
+
q(([g, x, _]) => {
|
|
2952
2954
|
try {
|
|
2953
|
-
return Fr(
|
|
2954
|
-
} catch (
|
|
2955
|
+
return Fr(g, x, _);
|
|
2956
|
+
} catch (B) {
|
|
2955
2957
|
throw new Error(fe({
|
|
2956
2958
|
from: "Chart.graphData$",
|
|
2957
|
-
systemMessage:
|
|
2959
|
+
systemMessage: B
|
|
2958
2960
|
}));
|
|
2959
2961
|
}
|
|
2960
2962
|
}),
|
|
2961
|
-
ae((
|
|
2962
|
-
|
|
2963
|
-
),
|
|
2963
|
+
ae((g) => (console.error(z(g)), se)),
|
|
2964
|
+
re(1)
|
|
2965
|
+
), P = J([
|
|
2964
2966
|
n,
|
|
2965
2967
|
s,
|
|
2966
2968
|
a
|
|
2967
2969
|
]).pipe(
|
|
2968
2970
|
G(0),
|
|
2969
|
-
q(([
|
|
2971
|
+
q(([g, x, _]) => {
|
|
2970
2972
|
try {
|
|
2971
|
-
return Dr(
|
|
2972
|
-
} catch (
|
|
2973
|
+
return Dr(g, x, _);
|
|
2974
|
+
} catch (B) {
|
|
2973
2975
|
throw new Error(fe({
|
|
2974
2976
|
from: "Chart.treeData$",
|
|
2975
|
-
systemMessage:
|
|
2977
|
+
systemMessage: B
|
|
2976
2978
|
}));
|
|
2977
2979
|
}
|
|
2978
2980
|
}),
|
|
2979
|
-
ae((
|
|
2980
|
-
|
|
2981
|
-
),
|
|
2982
|
-
l.subscribe((
|
|
2983
|
-
const x = {},
|
|
2981
|
+
ae((g) => (console.error(z(g)), se)),
|
|
2982
|
+
re(1)
|
|
2983
|
+
), I = new D([]);
|
|
2984
|
+
l.subscribe((g) => {
|
|
2985
|
+
const x = {}, _ = g.map((j) => {
|
|
2984
2986
|
var M;
|
|
2985
|
-
let
|
|
2986
|
-
if (x[
|
|
2987
|
-
const
|
|
2988
|
-
|
|
2987
|
+
let k = j._getId();
|
|
2988
|
+
if (x[k]) {
|
|
2989
|
+
const K = ((M = x[k].split("[")[1]) == null ? void 0 : M.split("]")[0]) || "0", Z = parseInt(K) + 1;
|
|
2990
|
+
k = `${k.split("[")[0]}[${Z}]`;
|
|
2989
2991
|
}
|
|
2990
|
-
return x[
|
|
2992
|
+
return x[k] = j._getId(), k;
|
|
2991
2993
|
});
|
|
2992
|
-
|
|
2993
|
-
const
|
|
2994
|
-
id:
|
|
2995
|
-
name:
|
|
2996
|
-
elementType:
|
|
2997
|
-
shownLayers:
|
|
2994
|
+
g.forEach((j, k) => j._setId(_[k]));
|
|
2995
|
+
const B = g.map((j) => ({
|
|
2996
|
+
id: j._getId(),
|
|
2997
|
+
name: j._name,
|
|
2998
|
+
elementType: j._elementType,
|
|
2999
|
+
shownLayers: j.getShownLayerNames()
|
|
2998
3000
|
}));
|
|
2999
|
-
|
|
3001
|
+
I.next(B);
|
|
3000
3002
|
});
|
|
3001
|
-
const
|
|
3002
|
-
|
|
3003
|
-
),
|
|
3003
|
+
const c = a.asObservable().pipe(
|
|
3004
|
+
re(1)
|
|
3005
|
+
), v = new oe(), $ = v.asObservable().pipe(
|
|
3004
3006
|
lt()
|
|
3005
3007
|
);
|
|
3006
3008
|
return {
|
|
3007
3009
|
root: t,
|
|
3008
3010
|
svg: null,
|
|
3009
3011
|
canvas: null,
|
|
3010
|
-
size$:
|
|
3011
|
-
encoding$:
|
|
3012
|
-
seriesData$:
|
|
3013
|
-
gridData$:
|
|
3014
|
-
multivariateData$:
|
|
3015
|
-
graphData$:
|
|
3016
|
-
treeData$:
|
|
3017
|
-
plugins$:
|
|
3018
|
-
theme$:
|
|
3019
|
-
event$:
|
|
3020
|
-
eventTrigger$:
|
|
3012
|
+
size$: b,
|
|
3013
|
+
encoding$: T,
|
|
3014
|
+
seriesData$: O,
|
|
3015
|
+
gridData$: h,
|
|
3016
|
+
multivariateData$: p,
|
|
3017
|
+
graphData$: E,
|
|
3018
|
+
treeData$: P,
|
|
3019
|
+
plugins$: I,
|
|
3020
|
+
theme$: c,
|
|
3021
|
+
event$: $,
|
|
3022
|
+
eventTrigger$: v,
|
|
3021
3023
|
_updateLayerElements: Gr({
|
|
3022
|
-
svgElement$:
|
|
3023
|
-
canvasElement$:
|
|
3024
|
+
svgElement$: w,
|
|
3025
|
+
canvasElement$: S,
|
|
3024
3026
|
pluginsInstance$: l
|
|
3025
3027
|
})
|
|
3026
3028
|
};
|
|
3027
3029
|
})();
|
|
3028
3030
|
let A = null;
|
|
3029
3031
|
const m = () => (A || (A = document.createElement("div"), A.classList.add("orbcharts-container"), A.style.position = "relative", t.appendChild(A)), A);
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
}),
|
|
3035
|
-
|
|
3032
|
+
let d = [];
|
|
3033
|
+
return l.subscribe((b) => {
|
|
3034
|
+
d.filter((p) => !b.includes(p)).forEach((p) => {
|
|
3035
|
+
y._updateLayerElements(p._elementType, p._getId(), []), p.destroy();
|
|
3036
|
+
}), d = b;
|
|
3037
|
+
let O = !1, h = !1;
|
|
3038
|
+
b.forEach((p) => {
|
|
3039
|
+
p._elementType === "svg" ? O = !0 : p._elementType === "canvas" && (h = !0);
|
|
3040
|
+
}), O && !y.svg ? (y.svg = Cr("orbcharts-root-svg"), m().appendChild(y.svg), w.next(y.svg)) : !O && y.svg && (y.svg.remove(), y.svg = null, w.next(null)), h && !y.canvas ? (y.canvas = ft("orbcharts-root-canvas"), m().appendChild(y.canvas), S.next(y.canvas)) : !h && y.canvas && (y.canvas.remove(), y.canvas = null, S.next(null)), b.forEach((p) => {
|
|
3041
|
+
p._injectContext(y);
|
|
3036
3042
|
});
|
|
3037
|
-
}),
|
|
3038
|
-
size:
|
|
3039
|
-
svg:
|
|
3043
|
+
}), J({
|
|
3044
|
+
size: y.size$,
|
|
3045
|
+
svg: w
|
|
3040
3046
|
}).pipe(
|
|
3041
3047
|
G(0),
|
|
3042
|
-
ye(({ svg:
|
|
3043
|
-
).subscribe(({ size:
|
|
3044
|
-
|
|
3045
|
-
}),
|
|
3046
|
-
size:
|
|
3047
|
-
canvas:
|
|
3048
|
+
ye(({ svg: b }) => !!b)
|
|
3049
|
+
).subscribe(({ size: b, svg: T }) => {
|
|
3050
|
+
T && (T.setAttribute("width", b.width.toString()), T.setAttribute("height", b.height.toString()));
|
|
3051
|
+
}), J({
|
|
3052
|
+
size: y.size$,
|
|
3053
|
+
canvas: S
|
|
3048
3054
|
}).pipe(
|
|
3049
3055
|
G(0),
|
|
3050
|
-
ye(({ canvas:
|
|
3051
|
-
).subscribe(({ size:
|
|
3052
|
-
|
|
3056
|
+
ye(({ canvas: b }) => !!b)
|
|
3057
|
+
).subscribe(({ size: b, canvas: T }) => {
|
|
3058
|
+
T && (T.width = b.width, T.height = b.height);
|
|
3053
3059
|
}), /* @__PURE__ */ (() => {
|
|
3054
|
-
function
|
|
3055
|
-
f.next(
|
|
3060
|
+
function b(g) {
|
|
3061
|
+
f.next(g);
|
|
3056
3062
|
}
|
|
3057
|
-
function
|
|
3063
|
+
function T(g) {
|
|
3058
3064
|
try {
|
|
3059
|
-
const { status: x, columnName:
|
|
3065
|
+
const { status: x, columnName: _, expectToBe: B } = dt(g);
|
|
3060
3066
|
if (x === "error")
|
|
3061
|
-
throw new Error(
|
|
3062
|
-
columnName:
|
|
3063
|
-
expectToBe:
|
|
3067
|
+
throw new Error(H({
|
|
3068
|
+
columnName: _,
|
|
3069
|
+
expectToBe: B,
|
|
3064
3070
|
from: "Chart.setData"
|
|
3065
3071
|
}));
|
|
3066
|
-
x === "warning" && console.warn(
|
|
3067
|
-
columnName:
|
|
3068
|
-
expectToBe:
|
|
3072
|
+
x === "warning" && console.warn(Q({
|
|
3073
|
+
columnName: _,
|
|
3074
|
+
expectToBe: B,
|
|
3069
3075
|
from: "Chart.setData"
|
|
3070
3076
|
}));
|
|
3071
3077
|
} catch (x) {
|
|
3072
3078
|
console.error(z(x));
|
|
3073
3079
|
}
|
|
3074
|
-
n.next(
|
|
3080
|
+
n.next(g);
|
|
3075
3081
|
}
|
|
3076
|
-
function
|
|
3082
|
+
function O(g) {
|
|
3077
3083
|
try {
|
|
3078
|
-
const { status:
|
|
3079
|
-
if (
|
|
3080
|
-
throw new Error(
|
|
3081
|
-
columnName:
|
|
3082
|
-
expectToBe:
|
|
3084
|
+
const { status: _, columnName: B, expectToBe: j } = pt(g);
|
|
3085
|
+
if (_ === "error")
|
|
3086
|
+
throw new Error(H({
|
|
3087
|
+
columnName: B,
|
|
3088
|
+
expectToBe: j,
|
|
3083
3089
|
from: "Chart.updateEncoding"
|
|
3084
3090
|
}));
|
|
3085
|
-
|
|
3086
|
-
columnName:
|
|
3087
|
-
expectToBe:
|
|
3091
|
+
_ === "warning" && console.warn(Q({
|
|
3092
|
+
columnName: B,
|
|
3093
|
+
expectToBe: j,
|
|
3088
3094
|
from: "Chart.updateEncoding"
|
|
3089
3095
|
}));
|
|
3090
|
-
} catch (
|
|
3091
|
-
console.error(z(
|
|
3096
|
+
} catch (_) {
|
|
3097
|
+
console.error(z(_));
|
|
3092
3098
|
}
|
|
3093
|
-
const x = W(s.getValue(),
|
|
3099
|
+
const x = W(s.getValue(), g);
|
|
3094
3100
|
s.next(x);
|
|
3095
3101
|
}
|
|
3096
|
-
function
|
|
3097
|
-
s.next(
|
|
3102
|
+
function h(g) {
|
|
3103
|
+
s.next(g);
|
|
3098
3104
|
}
|
|
3099
|
-
function
|
|
3105
|
+
function p() {
|
|
3100
3106
|
return s.getValue();
|
|
3101
3107
|
}
|
|
3102
|
-
function g
|
|
3108
|
+
function E(g) {
|
|
3103
3109
|
try {
|
|
3104
|
-
const { status: x, columnName:
|
|
3110
|
+
const { status: x, columnName: _, expectToBe: B } = $e(g);
|
|
3105
3111
|
if (x === "error")
|
|
3106
|
-
throw new Error(
|
|
3107
|
-
columnName:
|
|
3108
|
-
expectToBe:
|
|
3112
|
+
throw new Error(H({
|
|
3113
|
+
columnName: _,
|
|
3114
|
+
expectToBe: B,
|
|
3109
3115
|
from: "Chart.setPlugins"
|
|
3110
3116
|
}));
|
|
3111
|
-
x === "warning" && console.warn(
|
|
3112
|
-
columnName:
|
|
3113
|
-
expectToBe:
|
|
3117
|
+
x === "warning" && console.warn(Q({
|
|
3118
|
+
columnName: _,
|
|
3119
|
+
expectToBe: B,
|
|
3114
3120
|
from: "Chart.setPlugins"
|
|
3115
3121
|
}));
|
|
3116
3122
|
} catch (x) {
|
|
3117
3123
|
console.error(z(x));
|
|
3118
3124
|
}
|
|
3119
|
-
l.next(
|
|
3125
|
+
l.next(g);
|
|
3120
3126
|
}
|
|
3121
|
-
function
|
|
3127
|
+
function P(g) {
|
|
3122
3128
|
try {
|
|
3123
|
-
const { status: x, columnName:
|
|
3129
|
+
const { status: x, columnName: _, expectToBe: B } = $e([g]);
|
|
3124
3130
|
if (x === "error")
|
|
3125
|
-
throw new Error(
|
|
3126
|
-
columnName:
|
|
3127
|
-
expectToBe:
|
|
3131
|
+
throw new Error(H({
|
|
3132
|
+
columnName: _,
|
|
3133
|
+
expectToBe: B,
|
|
3128
3134
|
from: "Chart.addPlugin"
|
|
3129
3135
|
}));
|
|
3130
|
-
x === "warning" && console.warn(
|
|
3131
|
-
columnName:
|
|
3132
|
-
expectToBe:
|
|
3136
|
+
x === "warning" && console.warn(Q({
|
|
3137
|
+
columnName: _,
|
|
3138
|
+
expectToBe: B,
|
|
3133
3139
|
from: "Chart.addPlugin"
|
|
3134
3140
|
}));
|
|
3135
3141
|
} catch (x) {
|
|
3136
3142
|
console.error(z(x));
|
|
3137
3143
|
}
|
|
3138
|
-
l.next([...l.getValue(),
|
|
3144
|
+
l.next([...l.getValue(), g]);
|
|
3139
3145
|
}
|
|
3140
|
-
function
|
|
3141
|
-
l.next(l.getValue().filter((x) => x._getId() !==
|
|
3146
|
+
function I(g) {
|
|
3147
|
+
l.next(l.getValue().filter((x) => x._getId() !== g));
|
|
3142
3148
|
}
|
|
3143
|
-
function
|
|
3149
|
+
function c(g) {
|
|
3144
3150
|
try {
|
|
3145
|
-
const { status:
|
|
3146
|
-
if (
|
|
3147
|
-
throw new Error(
|
|
3148
|
-
columnName:
|
|
3149
|
-
expectToBe:
|
|
3151
|
+
const { status: _, columnName: B, expectToBe: j } = yt(g);
|
|
3152
|
+
if (_ === "error")
|
|
3153
|
+
throw new Error(H({
|
|
3154
|
+
columnName: B,
|
|
3155
|
+
expectToBe: j,
|
|
3150
3156
|
from: "Chart.updateTheme"
|
|
3151
3157
|
}));
|
|
3152
|
-
|
|
3153
|
-
columnName:
|
|
3154
|
-
expectToBe:
|
|
3158
|
+
_ === "warning" && console.warn(Q({
|
|
3159
|
+
columnName: B,
|
|
3160
|
+
expectToBe: j,
|
|
3155
3161
|
from: "Chart.updateTheme"
|
|
3156
3162
|
}));
|
|
3157
|
-
} catch (
|
|
3158
|
-
console.error(z(
|
|
3163
|
+
} catch (_) {
|
|
3164
|
+
console.error(z(_));
|
|
3159
3165
|
}
|
|
3160
|
-
const x = W(a.getValue(),
|
|
3166
|
+
const x = W(a.getValue(), g);
|
|
3161
3167
|
a.next(x);
|
|
3162
3168
|
}
|
|
3163
|
-
function
|
|
3164
|
-
a.next(
|
|
3169
|
+
function v(g) {
|
|
3170
|
+
a.next(g);
|
|
3165
3171
|
}
|
|
3166
|
-
function
|
|
3172
|
+
function $() {
|
|
3167
3173
|
return a.getValue();
|
|
3168
3174
|
}
|
|
3169
|
-
function
|
|
3175
|
+
function C() {
|
|
3170
3176
|
r.next(void 0), Pr(t), A = null;
|
|
3171
3177
|
}
|
|
3172
3178
|
return {
|
|
3173
|
-
resize:
|
|
3174
|
-
setData:
|
|
3179
|
+
resize: b,
|
|
3180
|
+
setData: T,
|
|
3175
3181
|
// setEncoding,
|
|
3176
|
-
updateEncoding:
|
|
3177
|
-
forceReplaceEncoding:
|
|
3178
|
-
getEncoding:
|
|
3179
|
-
setPlugins:
|
|
3180
|
-
addPlugin:
|
|
3181
|
-
removePlugin:
|
|
3182
|
+
updateEncoding: O,
|
|
3183
|
+
forceReplaceEncoding: h,
|
|
3184
|
+
getEncoding: p,
|
|
3185
|
+
setPlugins: E,
|
|
3186
|
+
addPlugin: P,
|
|
3187
|
+
removePlugin: I,
|
|
3182
3188
|
// setTheme,
|
|
3183
|
-
updateTheme:
|
|
3184
|
-
forceReplaceTheme:
|
|
3185
|
-
getTheme:
|
|
3186
|
-
destroy:
|
|
3187
|
-
context:
|
|
3189
|
+
updateTheme: c,
|
|
3190
|
+
forceReplaceTheme: v,
|
|
3191
|
+
getTheme: $,
|
|
3192
|
+
destroy: C,
|
|
3193
|
+
context: y
|
|
3188
3194
|
};
|
|
3189
3195
|
})();
|
|
3190
3196
|
};
|
|
@@ -3197,72 +3203,72 @@ const mt = (t, e, r) => {
|
|
|
3197
3203
|
let n = e.name, o = () => {
|
|
3198
3204
|
};
|
|
3199
3205
|
const s = new D(null), u = s.pipe(
|
|
3200
|
-
ye((
|
|
3201
|
-
), a = e.layers.map((
|
|
3206
|
+
ye((h) => h !== null)
|
|
3207
|
+
), a = e.layers.map((h) => new h()), l = {
|
|
3202
3208
|
// 將陣列轉成字典
|
|
3203
|
-
...a.reduce((
|
|
3204
|
-
}, i = () => new Set(a.map((
|
|
3205
|
-
if (
|
|
3206
|
-
const
|
|
3207
|
-
return Object.keys(
|
|
3209
|
+
...a.reduce((h, p) => (h[p._name] = p, h), {})
|
|
3210
|
+
}, i = () => new Set(a.map((h) => h._name)), f = (h) => {
|
|
3211
|
+
if (h) {
|
|
3212
|
+
const p = i();
|
|
3213
|
+
return Object.keys(h).filter((P) => p.has(P));
|
|
3208
3214
|
}
|
|
3209
3215
|
return [];
|
|
3210
|
-
},
|
|
3211
|
-
new Set(
|
|
3212
|
-
), A =
|
|
3213
|
-
q((
|
|
3214
|
-
var
|
|
3216
|
+
}, w = a.reduce((h, p) => (p._initShow && h.push(p._name), h), []), S = f(r), y = new D(
|
|
3217
|
+
new Set(S.length > 0 ? S : w)
|
|
3218
|
+
), A = y.pipe(
|
|
3219
|
+
q((h) => Array.from(h).map((E) => {
|
|
3220
|
+
var P;
|
|
3215
3221
|
return [
|
|
3216
3222
|
E,
|
|
3217
|
-
((
|
|
3223
|
+
((P = a.find((I) => I._name === E)) == null ? void 0 : P._layerIndex) ?? -1
|
|
3218
3224
|
];
|
|
3219
|
-
}).filter(([, E]) => E !== -1).sort((E,
|
|
3225
|
+
}).filter(([, E]) => E !== -1).sort((E, P) => E[1] - P[1]).map(([E]) => E))
|
|
3220
3226
|
);
|
|
3221
3227
|
let m = W(
|
|
3222
3228
|
e.defaultParams ?? {},
|
|
3223
3229
|
r ?? {}
|
|
3224
3230
|
);
|
|
3225
|
-
const
|
|
3231
|
+
const d = new D(
|
|
3226
3232
|
r ?? {}
|
|
3227
|
-
),
|
|
3228
|
-
|
|
3233
|
+
), b = new oe(), T = new R((h) => {
|
|
3234
|
+
d.subscribe((p) => {
|
|
3229
3235
|
try {
|
|
3230
|
-
const { status: E, columnName:
|
|
3236
|
+
const { status: E, columnName: P, expectToBe: I } = e.validator(p);
|
|
3231
3237
|
if (E === "error")
|
|
3232
|
-
throw new Error(
|
|
3233
|
-
columnName:
|
|
3238
|
+
throw new Error(H({
|
|
3239
|
+
columnName: P,
|
|
3234
3240
|
expectToBe: I,
|
|
3235
3241
|
from: `${e.name}.params$`
|
|
3236
3242
|
}));
|
|
3237
|
-
E === "warning" && console.warn(
|
|
3238
|
-
columnName:
|
|
3243
|
+
E === "warning" && console.warn(Q({
|
|
3244
|
+
columnName: P,
|
|
3239
3245
|
expectToBe: I,
|
|
3240
3246
|
from: `${e.name}.params$`
|
|
3241
3247
|
}));
|
|
3242
3248
|
} catch (E) {
|
|
3243
3249
|
console.error(z(E));
|
|
3244
3250
|
}
|
|
3245
|
-
|
|
3246
|
-
}),
|
|
3247
|
-
|
|
3251
|
+
h.next(m);
|
|
3252
|
+
}), b.subscribe((p) => {
|
|
3253
|
+
h.next(p);
|
|
3248
3254
|
});
|
|
3249
3255
|
}), O = u.pipe(
|
|
3250
|
-
q((
|
|
3251
|
-
context:
|
|
3256
|
+
q((h) => ({
|
|
3257
|
+
context: h,
|
|
3252
3258
|
// 初始化時 context 有可能被 in place 擴展
|
|
3253
|
-
pluginParams$:
|
|
3259
|
+
pluginParams$: T
|
|
3254
3260
|
})),
|
|
3255
3261
|
gr()
|
|
3256
3262
|
// 只做初始化
|
|
3257
3263
|
);
|
|
3258
|
-
return
|
|
3264
|
+
return J({
|
|
3259
3265
|
pluginSetupProps: O,
|
|
3260
|
-
ShownLayerNameSet:
|
|
3266
|
+
ShownLayerNameSet: y,
|
|
3261
3267
|
shownLayerNamesSeq: A
|
|
3262
3268
|
}).pipe(
|
|
3263
3269
|
G(0)
|
|
3264
|
-
).subscribe(({ pluginSetupProps:
|
|
3265
|
-
const
|
|
3270
|
+
).subscribe(({ pluginSetupProps: h, ShownLayerNameSet: p, shownLayerNamesSeq: E }) => {
|
|
3271
|
+
const P = h.context._updateLayerElements(
|
|
3266
3272
|
t,
|
|
3267
3273
|
n,
|
|
3268
3274
|
E.map((I) => ({
|
|
@@ -3272,25 +3278,25 @@ const mt = (t, e, r) => {
|
|
|
3272
3278
|
layerIndex: l[I]._layerIndex
|
|
3273
3279
|
}))
|
|
3274
3280
|
);
|
|
3275
|
-
e.setup && (o = e.setup(
|
|
3281
|
+
e.setup && (o = e.setup(h)), a.forEach((I) => {
|
|
3276
3282
|
var c, v;
|
|
3277
|
-
if (
|
|
3283
|
+
if (p.has(I._name)) {
|
|
3278
3284
|
const $ = t === "svg" ? {
|
|
3279
3285
|
// svgG: (pluginSetupProps as PluginSetupProps<'svg', ExtendContext, PluginParams>).svgG.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
|
|
3280
|
-
svgG:
|
|
3286
|
+
svgG: P[I._name],
|
|
3281
3287
|
// canvas: context.root.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
|
|
3282
3288
|
// context: Object.assign({}, context) as ChartContext<ExtendContext>,
|
|
3283
|
-
context:
|
|
3284
|
-
pluginParams$:
|
|
3285
|
-
initLayerParams: ((c =
|
|
3289
|
+
context: h.context,
|
|
3290
|
+
pluginParams$: T,
|
|
3291
|
+
initLayerParams: ((c = d.getValue()) == null ? void 0 : c[I._name]) || {}
|
|
3286
3292
|
} : {
|
|
3287
3293
|
// svgG: context.root.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
|
|
3288
3294
|
// canvas: (pluginSetupProps as PluginSetupProps<'canvas', ExtendContext, PluginParams>).canvas.querySelector(`.${createLayerClassName(config.name, layer.name)}`),
|
|
3289
|
-
canvas:
|
|
3295
|
+
canvas: P[I._name],
|
|
3290
3296
|
// context: Object.assign({}, context) as ChartContext<ExtendContext>,
|
|
3291
|
-
context:
|
|
3292
|
-
pluginParams$:
|
|
3293
|
-
initLayerParams: ((v =
|
|
3297
|
+
context: h.context,
|
|
3298
|
+
pluginParams$: T,
|
|
3299
|
+
initLayerParams: ((v = d.getValue()) == null ? void 0 : v[I._name]) || {}
|
|
3294
3300
|
};
|
|
3295
3301
|
I._enable($);
|
|
3296
3302
|
} else
|
|
@@ -3308,55 +3314,55 @@ const mt = (t, e, r) => {
|
|
|
3308
3314
|
// contextExtension,
|
|
3309
3315
|
// layer visibility controls
|
|
3310
3316
|
_getId: () => n,
|
|
3311
|
-
_setId: (
|
|
3312
|
-
n =
|
|
3317
|
+
_setId: (h) => {
|
|
3318
|
+
n = h;
|
|
3313
3319
|
},
|
|
3314
3320
|
// 由 chart 注入 context
|
|
3315
|
-
_injectContext: (
|
|
3316
|
-
s.next(Object.assign({},
|
|
3321
|
+
_injectContext: (h) => {
|
|
3322
|
+
s.next(Object.assign({}, h));
|
|
3317
3323
|
},
|
|
3318
|
-
show: (
|
|
3319
|
-
|
|
3324
|
+
show: (h) => {
|
|
3325
|
+
h = Array.isArray(h) ? h : [h], y.next(/* @__PURE__ */ new Set([...Array.from(y.getValue()), ...h]));
|
|
3320
3326
|
},
|
|
3321
|
-
showOnly: (
|
|
3322
|
-
|
|
3327
|
+
showOnly: (h) => {
|
|
3328
|
+
h = Array.isArray(h) ? h : [h], y.next(/* @__PURE__ */ new Set([...h]));
|
|
3323
3329
|
},
|
|
3324
3330
|
showAll: () => {
|
|
3325
|
-
|
|
3331
|
+
y.next(i());
|
|
3326
3332
|
},
|
|
3327
|
-
hide: (
|
|
3328
|
-
|
|
3333
|
+
hide: (h) => {
|
|
3334
|
+
h = Array.isArray(h) ? h : [h], y.next(/* @__PURE__ */ new Set([...Array.from(y.getValue()).filter((p) => !h.includes(p))]));
|
|
3329
3335
|
},
|
|
3330
3336
|
hideAll: () => {
|
|
3331
|
-
|
|
3337
|
+
y.next(/* @__PURE__ */ new Set());
|
|
3332
3338
|
},
|
|
3333
|
-
toggle: (
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
}),
|
|
3339
|
+
toggle: (h) => {
|
|
3340
|
+
h = Array.isArray(h) ? h : [h], Array.from(y.getValue()).forEach((p) => {
|
|
3341
|
+
h.includes(p) ? h.splice(h.indexOf(p), 1) : h.push(p);
|
|
3342
|
+
}), y.next(new Set(h));
|
|
3337
3343
|
},
|
|
3338
|
-
getShownLayerNames: () => Array.from(
|
|
3344
|
+
getShownLayerNames: () => Array.from(y.getValue()),
|
|
3339
3345
|
// layer params
|
|
3340
3346
|
// setLayers: (partial: DeepPartial<PluginParams>) => {
|
|
3341
3347
|
// params = { ...params, ...partial }
|
|
3342
3348
|
// },
|
|
3343
|
-
updateParams: (
|
|
3344
|
-
m = W(m,
|
|
3345
|
-
const E = l[
|
|
3346
|
-
E && E._updateParams(
|
|
3349
|
+
updateParams: (h) => {
|
|
3350
|
+
m = W(m, h), d.next(h), Object.keys(h).forEach((p) => {
|
|
3351
|
+
const E = l[p];
|
|
3352
|
+
E && E._updateParams(h[p]);
|
|
3347
3353
|
});
|
|
3348
3354
|
},
|
|
3349
|
-
forceReplaceParams: (
|
|
3350
|
-
m =
|
|
3351
|
-
const E = l[
|
|
3352
|
-
E && E._forceReplaceParams(
|
|
3355
|
+
forceReplaceParams: (h) => {
|
|
3356
|
+
m = h, b.next(h), Object.keys(h).forEach((p) => {
|
|
3357
|
+
const E = l[p];
|
|
3358
|
+
E && E._forceReplaceParams(h[p]);
|
|
3353
3359
|
});
|
|
3354
3360
|
},
|
|
3355
3361
|
getParams: () => {
|
|
3356
|
-
const
|
|
3357
|
-
return a.forEach((
|
|
3358
|
-
|
|
3359
|
-
}),
|
|
3362
|
+
const h = Object.assign({}, m);
|
|
3363
|
+
return a.forEach((p) => {
|
|
3364
|
+
h[p._name] = p._getParams();
|
|
3365
|
+
}), h;
|
|
3360
3366
|
},
|
|
3361
3367
|
// layer: <LayerName extends keyof PluginParams>(name: LayerName) => ({
|
|
3362
3368
|
// // set: (partial: DeepPartial<PluginParams[LayerName]>) => {
|
|
@@ -3383,8 +3389,8 @@ const mt = (t, e, r) => {
|
|
|
3383
3389
|
// }
|
|
3384
3390
|
// }),
|
|
3385
3391
|
destroy: () => {
|
|
3386
|
-
o(), s.complete(),
|
|
3387
|
-
|
|
3392
|
+
o(), s.complete(), y.complete(), a.forEach((h) => {
|
|
3393
|
+
h._destroy();
|
|
3388
3394
|
});
|
|
3389
3395
|
}
|
|
3390
3396
|
// // outputs
|
|
@@ -3403,7 +3409,7 @@ const mt = (t, e, r) => {
|
|
|
3403
3409
|
const o = new D(null), s = o.pipe(
|
|
3404
3410
|
ye((u) => u !== null)
|
|
3405
3411
|
);
|
|
3406
|
-
return
|
|
3412
|
+
return J({
|
|
3407
3413
|
layerParams: r,
|
|
3408
3414
|
enabledProps: s
|
|
3409
3415
|
}).pipe(
|
|
@@ -3448,12 +3454,12 @@ const mt = (t, e, r) => {
|
|
|
3448
3454
|
try {
|
|
3449
3455
|
const { status: l, columnName: i, expectToBe: f } = e.validator(u);
|
|
3450
3456
|
if (l === "error")
|
|
3451
|
-
throw new Error(
|
|
3457
|
+
throw new Error(H({
|
|
3452
3458
|
columnName: i,
|
|
3453
3459
|
expectToBe: f,
|
|
3454
3460
|
from: `${e.name}.params$`
|
|
3455
3461
|
}));
|
|
3456
|
-
l === "warning" && console.warn(
|
|
3462
|
+
l === "warning" && console.warn(Q({
|
|
3457
3463
|
columnName: i,
|
|
3458
3464
|
expectToBe: f,
|
|
3459
3465
|
from: `${e.name}.params$`
|
|
@@ -3504,8 +3510,8 @@ export {
|
|
|
3504
3510
|
Cr as createSVG,
|
|
3505
3511
|
Br as createSVGGroup,
|
|
3506
3512
|
fe as createUnexpectedErrorMessage,
|
|
3507
|
-
|
|
3508
|
-
|
|
3513
|
+
H as createValidatorErrorMessage,
|
|
3514
|
+
Q as createValidatorWarningMessage,
|
|
3509
3515
|
W as deepOverwrite,
|
|
3510
3516
|
on as defineCanvasLayer,
|
|
3511
3517
|
rn as defineCanvasPlugin,
|
|
@@ -3516,7 +3522,7 @@ export {
|
|
|
3516
3522
|
Or as getColorByIndex,
|
|
3517
3523
|
ct as isDom,
|
|
3518
3524
|
Ir as isFunction,
|
|
3519
|
-
|
|
3525
|
+
X as isPlainObject,
|
|
3520
3526
|
_r as max,
|
|
3521
3527
|
xr as mean,
|
|
3522
3528
|
Ar as median,
|