@carto/ps-react-ui 4.11.0 → 4.11.2
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/dist/{change-column-BiuuHCDN.js → change-column-DjjwoPt1.js} +256 -269
- package/dist/change-column-DjjwoPt1.js.map +1 -0
- package/dist/{data-zoom-layout--YiY6ko_.js → data-zoom-layout-CkVnm6ej.js} +4 -5
- package/dist/{data-zoom-layout--YiY6ko_.js.map → data-zoom-layout-CkVnm6ej.js.map} +1 -1
- package/dist/echart-BMPpj7n_.js +250 -0
- package/dist/echart-BMPpj7n_.js.map +1 -0
- package/dist/{png-item-CS4z1iSH.js → png-item-BE9uEqlD.js} +2 -2
- package/dist/png-item-BE9uEqlD.js.map +1 -0
- package/dist/{spread-CPis22AE.js → spread-DYNpzgh_.js} +9 -11
- package/dist/{spread-CPis22AE.js.map → spread-DYNpzgh_.js.map} +1 -1
- package/dist/{table-CQCAnDLb.js → table-C9IMbTr0.js} +50 -53
- package/dist/table-C9IMbTr0.js.map +1 -0
- package/dist/types/widgets-v2/echart/edge-label-clamp.d.ts +57 -0
- package/dist/types/widgets-v2/echart/edge-label-clamp.test.d.ts +1 -0
- package/dist/widgets-v2/actions.js +2 -2
- package/dist/widgets-v2/bar.js +91 -105
- package/dist/widgets-v2/bar.js.map +1 -1
- package/dist/widgets-v2/category.js +27 -29
- package/dist/widgets-v2/category.js.map +1 -1
- package/dist/widgets-v2/echart.js +1 -1
- package/dist/widgets-v2/formula.js +24 -25
- package/dist/widgets-v2/formula.js.map +1 -1
- package/dist/widgets-v2/histogram.js +98 -112
- package/dist/widgets-v2/histogram.js.map +1 -1
- package/dist/widgets-v2/markdown.js +25 -27
- package/dist/widgets-v2/markdown.js.map +1 -1
- package/dist/widgets-v2/pie.js +7 -10
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +9 -12
- package/dist/widgets-v2/scatterplot.js.map +1 -1
- package/dist/widgets-v2/spread.js +14 -16
- package/dist/widgets-v2/spread.js.map +1 -1
- package/dist/widgets-v2/table.js +38 -40
- package/dist/widgets-v2/table.js.map +1 -1
- package/dist/widgets-v2/timeseries.js +106 -121
- package/dist/widgets-v2/timeseries.js.map +1 -1
- package/dist/widgets-v2/utils.js +1 -1
- package/dist/widgets-v2.js +43 -46
- package/dist/widgets-v2.js.map +1 -1
- package/package.json +1 -1
- package/src/widgets-v2/actions/brush-toggle/brush-toggle.tsx +1 -1
- package/src/widgets-v2/actions/change-column/sortable-column-item.tsx +1 -1
- package/src/widgets-v2/actions/download/download.tsx +1 -1
- package/src/widgets-v2/actions/download/icons.tsx +1 -1
- package/src/widgets-v2/actions/fullscreen/fullscreen.tsx +3 -3
- package/src/widgets-v2/actions/lock-selection/lock-selection.tsx +2 -2
- package/src/widgets-v2/actions/relative-data/relative-data.tsx +1 -1
- package/src/widgets-v2/actions/searcher/searcher-toggle.tsx +1 -1
- package/src/widgets-v2/actions/searcher/searcher.tsx +2 -2
- package/src/widgets-v2/actions/show-all/show-all.tsx +1 -1
- package/src/widgets-v2/actions/stack-toggle/stack-toggle.tsx +1 -1
- package/src/widgets-v2/actions/zoom-toggle/zoom-toggle.tsx +1 -1
- package/src/widgets-v2/bar/options.test.ts +31 -4
- package/src/widgets-v2/bar/options.ts +18 -22
- package/src/widgets-v2/echart/echart-ui.test.tsx +70 -0
- package/src/widgets-v2/echart/echart-ui.tsx +28 -0
- package/src/widgets-v2/echart/edge-label-clamp.test.ts +198 -0
- package/src/widgets-v2/echart/edge-label-clamp.ts +216 -0
- package/src/widgets-v2/histogram/options.test.ts +11 -4
- package/src/widgets-v2/histogram/options.ts +17 -21
- package/src/widgets-v2/table/table-ui.tsx +4 -4
- package/src/widgets-v2/timeseries/options.test.ts +9 -4
- package/src/widgets-v2/timeseries/options.ts +17 -22
- package/src/widgets-v2/toolbox/toolbox.tsx +1 -1
- package/src/widgets-v2/wrapper/widget-wrapper.tsx +1 -1
- package/dist/change-column-BiuuHCDN.js.map +0 -1
- package/dist/echart-CU0KmClP.js +0 -176
- package/dist/echart-CU0KmClP.js.map +0 -1
- package/dist/png-item-CS4z1iSH.js.map +0 -1
- package/dist/table-CQCAnDLb.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { n as A, d as
|
|
3
|
-
import { jsxs as
|
|
1
|
+
import * as G from "echarts";
|
|
2
|
+
import { n as A, d as K, g as V, c as R, f as Y } from "../option-builders-F-c9ELi1.js";
|
|
3
|
+
import { jsxs as O, jsx as y } from "react/jsx-runtime";
|
|
4
4
|
import { c as q } from "react/compiler-runtime";
|
|
5
|
-
import { Box as S, Skeleton as
|
|
5
|
+
import { Box as S, Skeleton as b } from "@mui/material";
|
|
6
6
|
import "../widget-store-Bw5zRUGg.js";
|
|
7
7
|
import "zustand/shallow";
|
|
8
8
|
import "@mui/icons-material";
|
|
@@ -15,7 +15,6 @@ import "@dnd-kit/core";
|
|
|
15
15
|
import "@dnd-kit/sortable";
|
|
16
16
|
import "@dnd-kit/utilities";
|
|
17
17
|
import "react-dom";
|
|
18
|
-
import "@mui/icons-material/ZoomIn";
|
|
19
18
|
import "../widget-context-DTGO0Yta.js";
|
|
20
19
|
import "zustand";
|
|
21
20
|
import "zustand/vanilla";
|
|
@@ -23,17 +22,15 @@ import "zustand/middleware";
|
|
|
23
22
|
import "zustand/react/shallow";
|
|
24
23
|
import { Z as B } from "../transforms-Cdx4fkU5.js";
|
|
25
24
|
import { m as H, r as U } from "../resolve-theme-color-BdojIw0K.js";
|
|
26
|
-
import { p as W } from "../data-zoom-layout
|
|
27
|
-
import "@mui/icons-material/FileDownload";
|
|
25
|
+
import { p as W } from "../data-zoom-layout-CkVnm6ej.js";
|
|
28
26
|
import { a as J } from "../exports-Cx-f6m6U.js";
|
|
29
|
-
import "
|
|
30
|
-
import { b as Q } from "../png-item-CS4z1iSH.js";
|
|
27
|
+
import { b as Q } from "../png-item-BE9uEqlD.js";
|
|
31
28
|
function X({
|
|
32
29
|
theme: e,
|
|
33
|
-
formatter:
|
|
30
|
+
formatter: i,
|
|
34
31
|
labelFormatter: r
|
|
35
32
|
}) {
|
|
36
|
-
let
|
|
33
|
+
let c = 0, a = 1;
|
|
37
34
|
return {
|
|
38
35
|
grid: {
|
|
39
36
|
left: parseInt(e.spacing(1)),
|
|
@@ -56,13 +53,13 @@ function X({
|
|
|
56
53
|
axisPointer: {
|
|
57
54
|
type: "line"
|
|
58
55
|
},
|
|
59
|
-
position:
|
|
60
|
-
formatter: F(
|
|
56
|
+
position: V(e),
|
|
57
|
+
formatter: F(i, r)
|
|
61
58
|
},
|
|
62
59
|
// Legend styling baked here; `show` is toggled by the merger based on
|
|
63
60
|
// series count.
|
|
64
61
|
legend: {
|
|
65
|
-
...
|
|
62
|
+
...K({
|
|
66
63
|
hasLegend: !1
|
|
67
64
|
})
|
|
68
65
|
},
|
|
@@ -85,14 +82,14 @@ function X({
|
|
|
85
82
|
margin: 0,
|
|
86
83
|
hideOverlap: !0,
|
|
87
84
|
...r && {
|
|
88
|
-
formatter: (
|
|
85
|
+
formatter: (o) => r(new Date(o))
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
88
|
},
|
|
92
89
|
yAxis: {
|
|
93
90
|
type: "value",
|
|
94
|
-
min: (
|
|
95
|
-
max: (
|
|
91
|
+
min: (o) => (c = o.min < 0 ? A(o.min) : 0, c),
|
|
92
|
+
max: (o) => (a = o.max <= 0 ? 1 : A(o.max), a),
|
|
96
93
|
axisLine: {
|
|
97
94
|
show: !1
|
|
98
95
|
},
|
|
@@ -114,129 +111,117 @@ function X({
|
|
|
114
111
|
showMinLabel: !0,
|
|
115
112
|
verticalAlign: "bottom",
|
|
116
113
|
inside: !0,
|
|
117
|
-
formatter: (
|
|
114
|
+
formatter: (o) => o !== a && o !== c || o === 0 ? "" : i ? i(o) : String(o)
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
117
|
};
|
|
121
118
|
}
|
|
122
|
-
function
|
|
119
|
+
function Ie(e) {
|
|
123
120
|
const {
|
|
124
|
-
theme:
|
|
121
|
+
theme: i,
|
|
125
122
|
formatter: r,
|
|
126
|
-
labelFormatter:
|
|
127
|
-
optionsOverride:
|
|
128
|
-
} = e,
|
|
129
|
-
return (t,
|
|
123
|
+
labelFormatter: c,
|
|
124
|
+
optionsOverride: a
|
|
125
|
+
} = e, o = e.series, h = e.smooth ?? !0, g = e.area ?? !1, l = e.selection, m = l && l.length > 0 ? new Set(l) : null, s = (t) => t instanceof Date ? t.getTime() : t;
|
|
126
|
+
return (t, p, k) => {
|
|
130
127
|
if (t == null) {
|
|
131
|
-
const
|
|
132
|
-
theme:
|
|
128
|
+
const n = X({
|
|
129
|
+
theme: i,
|
|
133
130
|
formatter: r,
|
|
134
|
-
labelFormatter:
|
|
131
|
+
labelFormatter: c
|
|
135
132
|
});
|
|
136
|
-
return
|
|
133
|
+
return a ? H(n, a) : n;
|
|
137
134
|
}
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
135
|
+
const w = Array.isArray(p) ? p : [];
|
|
136
|
+
if (w.length === 0)
|
|
140
137
|
return {
|
|
141
138
|
...t,
|
|
142
139
|
dataset: [],
|
|
143
140
|
series: []
|
|
144
141
|
};
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
return !p || b == null || p.has(l(b)) ? u : E.color.modifyAlpha(u, 0.15);
|
|
142
|
+
const v = w.length > 1, j = Array.isArray(t.series) ? t.series : [], N = j[0] ?? {}, M = typeof t.yAxis == "object" && !Array.isArray(t.yAxis) ? t.yAxis : {}, C = typeof t.grid == "object" && !Array.isArray(t.grid) ? t.grid : {}, P = typeof t.tooltip == "object" && !Array.isArray(t.tooltip) ? t.tooltip : {}, Z = typeof t.legend == "object" && !Array.isArray(t.legend) ? t.legend : {}, L = k?.formatter;
|
|
143
|
+
let T = 0, I = 1;
|
|
144
|
+
const D = W(t.dataZoom, v), $ = typeof C.bottom == "number" ? C.bottom : 24, _ = v ? 56 : $, z = D ? _ + B.sliderHeight + B.sliderGap : _, E = {
|
|
145
|
+
color: (n) => {
|
|
146
|
+
const x = n.value?.name, f = n.color;
|
|
147
|
+
return !m || x == null || m.has(s(x)) ? f : G.color.modifyAlpha(f, 0.15);
|
|
152
148
|
}
|
|
153
149
|
};
|
|
154
150
|
return {
|
|
155
151
|
...t,
|
|
156
|
-
dataset:
|
|
157
|
-
source:
|
|
152
|
+
dataset: w.map((n) => ({
|
|
153
|
+
source: n
|
|
158
154
|
})),
|
|
159
|
-
series:
|
|
160
|
-
const
|
|
155
|
+
series: w.map((n, d) => {
|
|
156
|
+
const x = j[d] ?? N, f = U(i, o?.[d]?.color);
|
|
161
157
|
return {
|
|
162
|
-
...typeof
|
|
158
|
+
...typeof x == "object" ? x : {},
|
|
163
159
|
type: "line",
|
|
164
|
-
datasetIndex:
|
|
165
|
-
name:
|
|
160
|
+
datasetIndex: d,
|
|
161
|
+
name: o?.[d]?.name ?? `Series ${d + 1}`,
|
|
166
162
|
encode: {
|
|
167
163
|
x: "name",
|
|
168
164
|
y: "value"
|
|
169
165
|
},
|
|
170
|
-
smooth:
|
|
166
|
+
smooth: h,
|
|
171
167
|
// When a selection is active, surface markers so the per-point
|
|
172
168
|
// color callback has something to dim — a continuous line would
|
|
173
169
|
// hide the visual selection feedback.
|
|
174
|
-
showSymbol:
|
|
175
|
-
...
|
|
170
|
+
showSymbol: m != null,
|
|
171
|
+
...g ? {
|
|
176
172
|
areaStyle: {}
|
|
177
173
|
} : {},
|
|
178
174
|
emphasis: {
|
|
179
175
|
focus: "series"
|
|
180
176
|
},
|
|
181
|
-
itemStyle:
|
|
182
|
-
...
|
|
183
|
-
color:
|
|
177
|
+
itemStyle: E,
|
|
178
|
+
...f ? {
|
|
179
|
+
color: f,
|
|
184
180
|
lineStyle: {
|
|
185
|
-
color:
|
|
181
|
+
color: f
|
|
186
182
|
}
|
|
187
183
|
} : {}
|
|
188
184
|
};
|
|
189
185
|
}),
|
|
190
186
|
legend: {
|
|
191
|
-
...
|
|
192
|
-
show:
|
|
187
|
+
...Z,
|
|
188
|
+
show: v
|
|
193
189
|
},
|
|
194
190
|
grid: {
|
|
195
|
-
...
|
|
196
|
-
bottom:
|
|
191
|
+
...C,
|
|
192
|
+
bottom: z
|
|
197
193
|
},
|
|
198
|
-
...
|
|
199
|
-
dataZoom:
|
|
194
|
+
...D ? {
|
|
195
|
+
dataZoom: D
|
|
200
196
|
} : {},
|
|
201
197
|
yAxis: {
|
|
202
|
-
...
|
|
203
|
-
min:
|
|
204
|
-
max:
|
|
198
|
+
...M,
|
|
199
|
+
min: (n) => (T = n.min < 0 ? A(n.min) : 0, T),
|
|
200
|
+
max: (n) => (I = n.max <= 0 ? 1 : A(n.max), I),
|
|
205
201
|
axisLabel: {
|
|
206
|
-
...
|
|
207
|
-
formatter: (
|
|
202
|
+
...M.axisLabel ?? {},
|
|
203
|
+
formatter: (n) => n !== I && n !== T || n === 0 ? "" : L ? L(n) : String(n)
|
|
208
204
|
}
|
|
209
205
|
},
|
|
210
206
|
tooltip: {
|
|
211
|
-
...
|
|
212
|
-
formatter: F(
|
|
207
|
+
...P,
|
|
208
|
+
formatter: F(L, c)
|
|
213
209
|
}
|
|
214
210
|
};
|
|
215
211
|
};
|
|
216
212
|
}
|
|
217
|
-
function F(e,
|
|
213
|
+
function F(e, i) {
|
|
218
214
|
return Y((r) => {
|
|
219
|
-
const
|
|
215
|
+
const c = r.value, a = c?.value, o = typeof a == "number" && e ? e(a) : a ?? "", h = typeof r.marker == "string" ? r.marker : "", g = r.seriesName ? `${r.seriesName}: ` : "", l = c?.name ?? r.name, m = i && l != null ? i(l instanceof Date ? l : new Date(l)) : l ?? "";
|
|
220
216
|
return {
|
|
221
|
-
name: String(
|
|
222
|
-
seriesName:
|
|
223
|
-
marker:
|
|
224
|
-
value:
|
|
217
|
+
name: String(m),
|
|
218
|
+
seriesName: g,
|
|
219
|
+
marker: h,
|
|
220
|
+
value: o
|
|
225
221
|
};
|
|
226
222
|
});
|
|
227
223
|
}
|
|
228
|
-
|
|
229
|
-
let o = 0, r = -1 / 0;
|
|
230
|
-
for (const n of e)
|
|
231
|
-
for (const c of n)
|
|
232
|
-
typeof c?.value != "number" || !Number.isFinite(c.value) || (c.value < o && (o = c.value), c.value > r && (r = c.value));
|
|
233
|
-
const a = o < 0 ? A(o) : 0, i = r <= 0 ? 1 : A(r);
|
|
234
|
-
return {
|
|
235
|
-
niceMinVal: a,
|
|
236
|
-
niceMaxVal: i
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
const g = {
|
|
224
|
+
const u = {
|
|
240
225
|
container: {
|
|
241
226
|
display: "flex",
|
|
242
227
|
flexDirection: "column",
|
|
@@ -292,68 +277,68 @@ const g = {
|
|
|
292
277
|
}) => e(1.5)
|
|
293
278
|
}
|
|
294
279
|
};
|
|
295
|
-
function
|
|
280
|
+
function De() {
|
|
296
281
|
const e = q(2);
|
|
297
|
-
let
|
|
298
|
-
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
/* @__PURE__ */
|
|
302
|
-
] }), e[0] =
|
|
282
|
+
let i;
|
|
283
|
+
e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ O(S, { sx: u.graph, children: [
|
|
284
|
+
/* @__PURE__ */ y(b, { variant: "rectangular", sx: u.segmentA }),
|
|
285
|
+
/* @__PURE__ */ y(b, { variant: "rectangular", sx: u.segmentB }),
|
|
286
|
+
/* @__PURE__ */ y(b, { variant: "rectangular", sx: u.segmentC })
|
|
287
|
+
] }), e[0] = i) : i = e[0];
|
|
303
288
|
let r;
|
|
304
|
-
return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */
|
|
305
|
-
|
|
306
|
-
/* @__PURE__ */
|
|
289
|
+
return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ O(S, { sx: u.container, children: [
|
|
290
|
+
i,
|
|
291
|
+
/* @__PURE__ */ y(S, { sx: u.legend, children: [0, 1].map(ee) })
|
|
307
292
|
] }), e[1] = r) : r = e[1], r;
|
|
308
293
|
}
|
|
309
|
-
function
|
|
310
|
-
return /* @__PURE__ */
|
|
311
|
-
/* @__PURE__ */
|
|
312
|
-
/* @__PURE__ */
|
|
294
|
+
function ee(e) {
|
|
295
|
+
return /* @__PURE__ */ O(S, { sx: u.legendItem, children: [
|
|
296
|
+
/* @__PURE__ */ y(b, { variant: "circular", width: 8, height: 8 }),
|
|
297
|
+
/* @__PURE__ */ y(b, { width: 48, height: 8 })
|
|
313
298
|
] }, `legend-${e}`);
|
|
314
299
|
}
|
|
315
|
-
function
|
|
316
|
-
const
|
|
317
|
-
return e.getCaptureEl &&
|
|
300
|
+
function Oe(e) {
|
|
301
|
+
const i = [];
|
|
302
|
+
return e.getCaptureEl && i.push(Q({
|
|
318
303
|
filename: e.filename,
|
|
319
304
|
getCaptureEl: e.getCaptureEl,
|
|
320
305
|
pixelRatio: e.pngPixelRatio,
|
|
321
306
|
backgroundColor: e.pngBackgroundColor
|
|
322
|
-
})),
|
|
307
|
+
})), i.push({
|
|
323
308
|
id: "csv",
|
|
324
309
|
label: "Download as CSV",
|
|
325
310
|
resolve: () => {
|
|
326
|
-
const r = e.getData(),
|
|
327
|
-
for (const
|
|
328
|
-
for (const t of
|
|
329
|
-
const
|
|
330
|
-
|
|
311
|
+
const r = e.getData(), c = r.length, a = [], o = /* @__PURE__ */ new Set();
|
|
312
|
+
for (const s of r)
|
|
313
|
+
for (const t of s) {
|
|
314
|
+
const p = String(t.name);
|
|
315
|
+
o.has(p) || (o.add(p), a.push(t.name));
|
|
331
316
|
}
|
|
332
|
-
const
|
|
333
|
-
for (let
|
|
334
|
-
|
|
335
|
-
const
|
|
336
|
-
for (const
|
|
337
|
-
const t = [
|
|
338
|
-
for (const
|
|
339
|
-
|
|
317
|
+
const h = r.map((s) => new Map(s.map((t) => [String(t.name), t.value]))), g = ["time"];
|
|
318
|
+
for (let s = 0; s < c; s++)
|
|
319
|
+
g.push(e.seriesNames?.[s] ?? `series_${s + 1}`);
|
|
320
|
+
const l = [g];
|
|
321
|
+
for (const s of a) {
|
|
322
|
+
const t = [te(s)], p = String(s);
|
|
323
|
+
for (const k of h) t.push(k.get(p) ?? "");
|
|
324
|
+
l.push(t);
|
|
340
325
|
}
|
|
341
|
-
const
|
|
326
|
+
const m = J(l);
|
|
342
327
|
return Promise.resolve({
|
|
343
|
-
url:
|
|
328
|
+
url: m.url,
|
|
344
329
|
filename: `${e.filename}.csv`,
|
|
345
|
-
revoke:
|
|
330
|
+
revoke: m.revoke
|
|
346
331
|
});
|
|
347
332
|
}
|
|
348
|
-
}),
|
|
333
|
+
}), i;
|
|
349
334
|
}
|
|
350
|
-
function
|
|
335
|
+
function te(e) {
|
|
351
336
|
return e instanceof Date ? e.toISOString() : typeof e == "number" ? new Date(e).toISOString() : e;
|
|
352
337
|
}
|
|
353
338
|
export {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
339
|
+
De as TimeseriesSkeleton,
|
|
340
|
+
Oe as createTimeseriesDownloadConfig,
|
|
341
|
+
Ie as createTimeseriesOptionFactory,
|
|
357
342
|
X as timeseriesOptions
|
|
358
343
|
};
|
|
359
344
|
//# sourceMappingURL=timeseries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeseries.js","sources":["../../src/widgets-v2/timeseries/options.ts","../../src/widgets-v2/timeseries/skeleton.tsx","../../src/widgets-v2/timeseries/download.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { positionDataZoomForLegend } from '../utils/data-zoom-layout'\nimport type {\n TimeseriesEChartsOption,\n TimeseriesOptionFactoryInput,\n TimeseriesOptionsInput,\n TimeseriesWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a timeseries widget —\n * time x-axis, value y-axis, themed tooltip, themed legend, CARTO color\n * palette. Mirrors {@link import('../bar/options').barOptions} so all\n * four ECharts widgets share v1 look-and-feel.\n *\n * Intentional deviations from bar (timeseries-specific):\n * - **X-axis is `type: 'time'`** (not 'category'). ECharts handles\n * uneven sample spacing and zoom-level-aware label formatting.\n * `labelFormatter` is wrapped so the consumer sees a `Date`, not\n * a numeric timestamp.\n * - **Tooltip body reads `{ name, value }` rows**, same as bar, but\n * the `name` may arrive as `Date | number | string`. The\n * `labelFormatter` receives a `Date` regardless.\n *\n * Intentionally data-agnostic: no series, no dataset, no `legend.show`\n * (those depend on data and are added by the option factory's merge\n * phase via {@link createTimeseriesOptionFactory}).\n */\nexport function timeseriesOptions({\n theme,\n formatter,\n labelFormatter,\n}: TimeseriesOptionsInput): TimeseriesEChartsOption {\n // Closure shared between yAxis min/max callbacks and the label formatter,\n // so only the rounded extents are labelled (matches v1 + bar).\n let niceMin = 0\n let niceMax = 1\n\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps this when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n trigger: 'axis',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n axisPointer: { type: 'line' },\n position: createTooltipPositioner(theme),\n formatter: buildTimeseriesTooltipFormatter(formatter, labelFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'time',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n margin: 0,\n hideOverlap: true,\n ...(labelFormatter && {\n formatter: (value: number) => labelFormatter(new Date(value)),\n }),\n },\n },\n yAxis: {\n type: 'value',\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate?.fontSize,\n fontFamily: theme.typography.overlineDelicate?.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom',\n inside: true,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n } as TimeseriesEChartsOption\n}\n\n/**\n * Returns the timeseries widget's {@link OptionFactory} — one closure\n * that owns BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link timeseriesOptions}, optionally merging\n * the consumer-supplied `optionsOverride`. Called once by Provider to\n * seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`TimeseriesWidgetData`) into the option via the dataset API: one\n * dataset per series, each series referencing its dataset by index,\n * encoded by `name` (x — time) and `value` (y). Mirrors {@link import('../bar/options').createBarOptionFactory}:\n * series-template merge for `addStack`, reactive formatters from\n * `ctx`, `niceNum`-rounded y-axis bounds at fusion time, and\n * `positionDataZoomForLegend` layout for ZoomToggle sliders.\n */\nexport function createTimeseriesOptionFactory(\n options: TimeseriesOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride } = options\n const series = options.series\n const smooth = options.smooth ?? true\n const area = options.area ?? false\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0\n ? new Set<string | number>(selection)\n : null\n // `name` may be Date | number | string. Normalize to the same type the\n // selection is keyed on (Date → ms) so Set lookups match.\n const normalizeName = (n: Date | number | string): string | number =>\n n instanceof Date ? n.getTime() : n\n return (option, data, ctx) => {\n if (option == null) {\n const structural = timeseriesOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as TimeseriesWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n\n // Reactive (live store) formatter from ctx — distinct from the\n // closure-time `formatter` captured for the structural-build branch\n // above. RelativeData can install a percent formatter on the store\n // after the factory was constructed; the merge phase reads `ctx` to\n // pick that up. `labelFormatter` (Date → string) is structural-only —\n // not relativizable — so the merge branch reads the closure-time value.\n const liveFormatter = ctx?.formatter\n\n const { niceMinVal, niceMaxVal } = computeTimeseriesNiceBounds(seriesArr)\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`, push the\n // slider above the legend (if any) and reserve room in the grid below.\n const dataZoomLayout = positionDataZoomForLegend(option.dataZoom, hasLegend)\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = dataZoomLayout\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n\n // Dim non-selected points via `series.itemStyle.color`. Per-row\n // `itemStyle` on dataset object-rows is silently ignored when\n // `series.encode` is in play.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and points would stay dimmed forever after an external clear.\n // Always emitting lets normal merge swap the callback in place, no\n // `replaceMerge` and no entry-animation flash on selection on/off.\n const dimItemStyle = {\n color: (params: CallbackDataParams) => {\n const datum = params.value as\n | { name?: Date | number | string }\n | undefined\n const raw = datum?.name\n const base = params.color as string\n if (!selectionSet || raw == null) return base\n return selectionSet.has(normalizeName(raw))\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n },\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((_, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n // For line series, set BOTH `series[i].color` (legend swatch +\n // markers) AND `series[i].lineStyle.color` (the line itself) so\n // the override paints everywhere a series has a colour slot.\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n ...(typeof template === 'object' ? template : {}),\n type: 'line' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 'name', y: 'value' },\n smooth,\n // When a selection is active, surface markers so the per-point\n // color callback has something to dim — a continuous line would\n // hide the visual selection feedback.\n showSymbol: selectionSet != null,\n ...(area ? { areaStyle: {} } : {}),\n emphasis: { focus: 'series' },\n itemStyle: dimItemStyle,\n ...(overrideColor\n ? { color: overrideColor, lineStyle: { color: overrideColor } }\n : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: { ...baseGrid, bottom: gridBottom },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout } : {}),\n yAxis: {\n ...baseYAxis,\n min: niceMinVal,\n max: niceMaxVal,\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n formatter: (value: number) => {\n if (value !== niceMaxVal && value !== niceMinVal) return ''\n if (value === 0) return ''\n return liveFormatter ? liveFormatter(value) : String(value)\n },\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n formatter: buildTimeseriesTooltipFormatter(\n liveFormatter,\n labelFormatter,\n ),\n },\n } as EChartsOption\n }\n}\n\n/**\n * Tooltip formatter for the timeseries `{ name, value }` row shape.\n * `name` arrives as `Date | number | string` (the time-axis stores the\n * raw value the consumer supplied). The consumer's `labelFormatter`\n * expects a `Date`, so we coerce non-Date values via `new Date(...)`\n * before invoking it.\n */\nfunction buildTimeseriesTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: Date) => string) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const row = item.value as\n | { name?: Date | number | string; value?: number }\n | undefined\n const raw = row?.value\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const rawName = row?.name ?? item.name\n const name =\n labelFormatter && rawName != null\n ? labelFormatter(rawName instanceof Date ? rawName : new Date(rawName))\n : (rawName ?? '')\n return { name: String(name), seriesName, marker, value: formattedValue }\n })\n}\n\nfunction computeTimeseriesNiceBounds(seriesArr: TimeseriesWidgetData): {\n niceMinVal: number\n niceMaxVal: number\n} {\n let min = 0\n let max = -Infinity\n for (const series of seriesArr) {\n for (const d of series) {\n if (typeof d?.value !== 'number' || !Number.isFinite(d.value)) continue\n if (d.value < min) min = d.value\n if (d.value > max) max = d.value\n }\n }\n const niceMinVal = min < 0 ? niceNum(min) : 0\n const niceMaxVal = max <= 0 ? 1 : niceNum(max)\n return { niceMinVal, niceMaxVal }\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n graph: {\n position: 'relative',\n flex: '1 1 auto',\n width: '100%',\n },\n segmentA: {\n position: 'absolute',\n left: 0,\n right: '70%',\n top: '60%',\n height: 4,\n },\n segmentB: {\n position: 'absolute',\n left: '25%',\n right: '40%',\n top: '35%',\n height: 4,\n },\n segmentC: {\n position: 'absolute',\n left: '55%',\n right: 0,\n top: '50%',\n height: 4,\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\n/**\n * Loading state for the Timeseries widget. Mirrors a line chart's\n * silhouette — three thin horizontal segments at staggered offsets to\n * suggest a moving line, plus a 2-dot legend stub. Sibling-consistent\n * with Bar / Histogram / Scatter skeletons (column-flex container with\n * legend strip below).\n */\nexport function TimeseriesSkeleton() {\n return (\n <Box sx={styles.container}>\n <Box sx={styles.graph}>\n <Skeleton variant='rectangular' sx={styles.segmentA} />\n <Skeleton variant='rectangular' sx={styles.segmentB} />\n <Skeleton variant='rectangular' sx={styles.segmentC} />\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildPngDownloadItem,\n downloadToCSV,\n type DownloadItem,\n} from '../actions/download'\nimport type { TimeseriesWidgetData } from './types'\n\n/**\n * Download menu items for the Timeseries widget. Always includes a CSV\n * item with `time, series_1, series_2, …` columns (one row per unique time\n * across all series; ISO-8601 strings for `Date`/numeric times). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createTimeseriesDownloadConfig(args: {\n filename: string\n getData: () => TimeseriesWidgetData\n seriesNames?: readonly string[]\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: 'csv',\n label: 'Download as CSV',\n resolve: () => {\n const data = args.getData()\n const seriesCount = data.length\n\n // Collect every unique time, preserving insertion order.\n const timeKeys: (Date | number | string)[] = []\n const seenKeys = new Set<string>()\n for (const series of data) {\n for (const point of series) {\n const key = String(point.name)\n if (!seenKeys.has(key)) {\n seenKeys.add(key)\n timeKeys.push(point.name)\n }\n }\n }\n\n // Build a quick lookup per series for O(rows × series) emit.\n const lookups = data.map(\n (series) => new Map(series.map((p) => [String(p.name), p.value])),\n )\n\n const header: unknown[] = ['time']\n for (let i = 0; i < seriesCount; i++) {\n header.push(args.seriesNames?.[i] ?? `series_${i + 1}`)\n }\n const rows: unknown[][] = [header]\n for (const key of timeKeys) {\n const row: unknown[] = [formatTime(key)]\n const lookupKey = String(key)\n for (const lookup of lookups) row.push(lookup.get(lookupKey) ?? '')\n rows.push(row)\n }\n\n const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\n })\n },\n })\n return items\n}\n\nfunction formatTime(v: Date | number | string): string {\n if (v instanceof Date) return v.toISOString()\n if (typeof v === 'number') return new Date(v).toISOString()\n return v\n}\n"],"names":["timeseriesOptions","theme","formatter","labelFormatter","niceMin","niceMax","grid","left","parseInt","spacing","top","right","buildGridConfig","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","axisPointer","type","position","createTooltipPositioner","buildTimeseriesTooltipFormatter","legend","buildLegendConfig","hasLegend","lineStyle","secondary","main","Object","values","qualitative","bold","xAxis","axisLine","show","axisTick","axisLabel","margin","hideOverlap","value","Date","yAxis","min","extent","niceNum","max","splitLine","black","divider","overlineDelicate","showMaxLabel","showMinLabel","verticalAlign","inside","String","createTimeseriesOptionFactory","options","optionsOverride","series","smooth","area","selection","selectionSet","length","Set","normalizeName","n","getTime","option","data","ctx","structural","mergeOptions","seriesArr","Array","isArray","dataset","seriesTemplates","broadcastTemplate","baseYAxis","baseGrid","baseTooltip","baseLegend","liveFormatter","niceMinVal","niceMaxVal","computeTimeseriesNiceBounds","dataZoomLayout","positionDataZoomForLegend","dataZoom","fallbackBottom","bottom","baseBottom","gridBottom","ZOOM_LAYOUT","sliderHeight","sliderGap","dimItemStyle","params","raw","name","base","has","echarts","modifyAlpha","map","s","source","_","i","template","overrideColor","resolveThemeColor","datasetIndex","encode","x","y","showSymbol","areaStyle","emphasis","focus","itemStyle","createTooltipFormatter","item","row","formattedValue","marker","seriesName","rawName","d","Number","isFinite","styles","container","display","flexDirection","justifyContent","gap","height","graph","flex","width","segmentA","segmentB","segmentC","alignItems","legendItem","TimeseriesSkeleton","$","_c","t0","Symbol","for","jsxs","Box","jsx","Skeleton","t1","_temp","createTimeseriesDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","pngBackgroundColor","id","label","resolve","getData","seriesCount","timeKeys","seenKeys","point","key","add","lookups","Map","p","header","seriesN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I1J,KAAK0J,CAAC,EAAEC,YAAAA,IACvCD;AACT;"}
|
|
1
|
+
{"version":3,"file":"timeseries.js","sources":["../../src/widgets-v2/timeseries/options.ts","../../src/widgets-v2/timeseries/skeleton.tsx","../../src/widgets-v2/timeseries/download.ts"],"sourcesContent":["import type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildGridConfig,\n buildLegendConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport { ZOOM_LAYOUT } from '../actions/zoom-toggle'\nimport type { OptionFactory } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport { positionDataZoomForLegend } from '../utils/data-zoom-layout'\nimport type {\n TimeseriesEChartsOption,\n TimeseriesOptionFactoryInput,\n TimeseriesOptionsInput,\n TimeseriesWidgetData,\n} from './types'\n\n/**\n * Builds the **structural** ECharts option for a timeseries widget —\n * time x-axis, value y-axis, themed tooltip, themed legend, CARTO color\n * palette. Mirrors {@link import('../bar/options').barOptions} so all\n * four ECharts widgets share v1 look-and-feel.\n *\n * Intentional deviations from bar (timeseries-specific):\n * - **X-axis is `type: 'time'`** (not 'category'). ECharts handles\n * uneven sample spacing and zoom-level-aware label formatting.\n * `labelFormatter` is wrapped so the consumer sees a `Date`, not\n * a numeric timestamp.\n * - **Tooltip body reads `{ name, value }` rows**, same as bar, but\n * the `name` may arrive as `Date | number | string`. The\n * `labelFormatter` receives a `Date` regardless.\n *\n * Intentionally data-agnostic: no series, no dataset, no `legend.show`\n * (those depend on data and are added by the option factory's merge\n * phase via {@link createTimeseriesOptionFactory}).\n */\nexport function timeseriesOptions({\n theme,\n formatter,\n labelFormatter,\n}: TimeseriesOptionsInput): TimeseriesEChartsOption {\n // Closure shared between yAxis min/max callbacks and the label formatter,\n // so only the rounded extents are labelled (matches v1 + bar).\n let niceMin = 0\n let niceMax = 1\n\n return {\n grid: {\n left: parseInt(theme.spacing(1)),\n top: parseInt(theme.spacing(3)),\n right: parseInt(theme.spacing(1)),\n // Default: no legend. Merger bumps this when there are >1 series.\n ...buildGridConfig(false, theme),\n containLabel: true,\n },\n tooltip: {\n trigger: 'axis',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n axisPointer: { type: 'line' },\n position: createTooltipPositioner(theme),\n formatter: buildTimeseriesTooltipFormatter(formatter, labelFormatter),\n },\n // Legend styling baked here; `show` is toggled by the merger based on\n // series count.\n legend: {\n ...buildLegendConfig({ hasLegend: false }),\n },\n axisPointer: { lineStyle: { color: theme.palette.grey[400] } },\n color: [\n theme.palette.secondary.main,\n ...Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n ],\n xAxis: {\n type: 'time',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n margin: 0,\n hideOverlap: true,\n ...(labelFormatter && {\n formatter: (value: number) => labelFormatter(new Date(value)),\n }),\n },\n },\n yAxis: {\n type: 'value',\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n axisLabel: {\n fontSize: theme.typography.overlineDelicate?.fontSize,\n fontFamily: theme.typography.overlineDelicate?.fontFamily,\n margin: parseInt(theme.spacing(1)),\n show: true,\n showMaxLabel: true,\n showMinLabel: true,\n verticalAlign: 'bottom',\n inside: true,\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n } as TimeseriesEChartsOption\n}\n\n/**\n * Returns the timeseries widget's {@link OptionFactory} — one closure\n * that owns BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link timeseriesOptions}, optionally merging\n * the consumer-supplied `optionsOverride`. Called once by Provider to\n * seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`TimeseriesWidgetData`) into the option via the dataset API: one\n * dataset per series, each series referencing its dataset by index,\n * encoded by `name` (x — time) and `value` (y). Mirrors {@link import('../bar/options').createBarOptionFactory}:\n * series-template merge for `addStack`, reactive formatters from\n * `ctx`, `niceNum`-rounded y-axis bounds at fusion time, and\n * `positionDataZoomForLegend` layout for ZoomToggle sliders.\n */\nexport function createTimeseriesOptionFactory(\n options: TimeseriesOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride } = options\n const series = options.series\n const smooth = options.smooth ?? true\n const area = options.area ?? false\n const selection = options.selection\n const selectionSet =\n selection && selection.length > 0\n ? new Set<string | number>(selection)\n : null\n // `name` may be Date | number | string. Normalize to the same type the\n // selection is keyed on (Date → ms) so Set lookups match.\n const normalizeName = (n: Date | number | string): string | number =>\n n instanceof Date ? n.getTime() : n\n return (option, data, ctx) => {\n if (option == null) {\n const structural = timeseriesOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as TimeseriesWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n const hasLegend = seriesArr.length > 1\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n const baseYAxis =\n typeof option.yAxis === 'object' && !Array.isArray(option.yAxis)\n ? option.yAxis\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n\n // Reactive (live store) formatter from ctx — distinct from the\n // closure-time `formatter` captured for the structural-build branch\n // above. RelativeData can install a percent formatter on the store\n // after the factory was constructed; the merge phase reads `ctx` to\n // pick that up. `labelFormatter` (Date → string) is structural-only —\n // not relativizable — so the merge branch reads the closure-time value.\n const liveFormatter = ctx?.formatter\n\n // Closure shared between the yAxis min/max callbacks and the label\n // formatter, so only the rounded extents are labelled (matches v1 +\n // bar). Delegating the extent to ECharts (rather than precomputing\n // scalars from the raw data) keeps stacked lines inside the plot: when\n // StackToggle marks the series, ECharts feeds the *post-stack* extent\n // to these callbacks, so `niceNum` rounds the stacked total.\n let niceMin = 0\n let niceMax = 1\n\n // Zoom slider layout: when ZoomToggle has installed `dataZoom`, push the\n // slider above the legend (if any) and reserve room in the grid below.\n const dataZoomLayout = positionDataZoomForLegend(option.dataZoom, hasLegend)\n const fallbackBottom =\n typeof baseGrid.bottom === 'number' ? baseGrid.bottom : 24\n const baseBottom = hasLegend ? 56 : fallbackBottom\n const gridBottom = dataZoomLayout\n ? baseBottom + ZOOM_LAYOUT.sliderHeight + ZOOM_LAYOUT.sliderGap\n : baseBottom\n\n // Dim non-selected points via `series.itemStyle.color`. Per-row\n // `itemStyle` on dataset object-rows is silently ignored when\n // `series.encode` is in play.\n //\n // We *always* emit `itemStyle.color` (a passthrough when nothing is\n // selected), not conditionally — dropping the key between renders\n // would let ECharts' default merge keep the previous callback alive\n // and points would stay dimmed forever after an external clear.\n // Always emitting lets normal merge swap the callback in place, no\n // `replaceMerge` and no entry-animation flash on selection on/off.\n const dimItemStyle = {\n color: (params: CallbackDataParams) => {\n const datum = params.value as\n | { name?: Date | number | string }\n | undefined\n const raw = datum?.name\n const base = params.color as string\n if (!selectionSet || raw == null) return base\n return selectionSet.has(normalizeName(raw))\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n },\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((_, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n // For line series, set BOTH `series[i].color` (legend swatch +\n // markers) AND `series[i].lineStyle.color` (the line itself) so\n // the override paints everywhere a series has a colour slot.\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n ...(typeof template === 'object' ? template : {}),\n type: 'line' as const,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n encode: { x: 'name', y: 'value' },\n smooth,\n // When a selection is active, surface markers so the per-point\n // color callback has something to dim — a continuous line would\n // hide the visual selection feedback.\n showSymbol: selectionSet != null,\n ...(area ? { areaStyle: {} } : {}),\n emphasis: { focus: 'series' },\n itemStyle: dimItemStyle,\n ...(overrideColor\n ? { color: overrideColor, lineStyle: { color: overrideColor } }\n : {}),\n }\n }),\n legend: { ...baseLegend, show: hasLegend },\n grid: { ...baseGrid, bottom: gridBottom },\n ...(dataZoomLayout ? { dataZoom: dataZoomLayout } : {}),\n yAxis: {\n ...baseYAxis,\n min: (extent: { min: number }) => {\n niceMin = extent.min < 0 ? niceNum(extent.min) : 0\n return niceMin\n },\n max: (extent: { min: number; max: number }) => {\n niceMax = extent.max <= 0 ? 1 : niceNum(extent.max)\n return niceMax\n },\n axisLabel: {\n ...((baseYAxis as { axisLabel?: object }).axisLabel ?? {}),\n formatter: (value: number) => {\n if (value !== niceMax && value !== niceMin) return ''\n if (value === 0) return ''\n return liveFormatter ? liveFormatter(value) : String(value)\n },\n },\n } as EChartsOption['yAxis'],\n tooltip: {\n ...baseTooltip,\n formatter: buildTimeseriesTooltipFormatter(\n liveFormatter,\n labelFormatter,\n ),\n },\n } as EChartsOption\n }\n}\n\n/**\n * Tooltip formatter for the timeseries `{ name, value }` row shape.\n * `name` arrives as `Date | number | string` (the time-axis stores the\n * raw value the consumer supplied). The consumer's `labelFormatter`\n * expects a `Date`, so we coerce non-Date values via `new Date(...)`\n * before invoking it.\n */\nfunction buildTimeseriesTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: Date) => string) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const row = item.value as\n | { name?: Date | number | string; value?: number }\n | undefined\n const raw = row?.value\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const rawName = row?.name ?? item.name\n const name =\n labelFormatter && rawName != null\n ? labelFormatter(rawName instanceof Date ? rawName : new Date(rawName))\n : (rawName ?? '')\n return { name: String(name), seriesName, marker, value: formattedValue }\n })\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n container: {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'space-between',\n gap: ({ spacing }) => spacing(1),\n height: ({ spacing }) => spacing(38),\n },\n graph: {\n position: 'relative',\n flex: '1 1 auto',\n width: '100%',\n },\n segmentA: {\n position: 'absolute',\n left: 0,\n right: '70%',\n top: '60%',\n height: 4,\n },\n segmentB: {\n position: 'absolute',\n left: '25%',\n right: '40%',\n top: '35%',\n height: 4,\n },\n segmentC: {\n position: 'absolute',\n left: '55%',\n right: 0,\n top: '50%',\n height: 4,\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n height: ({ spacing }) => spacing(5),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\n/**\n * Loading state for the Timeseries widget. Mirrors a line chart's\n * silhouette — three thin horizontal segments at staggered offsets to\n * suggest a moving line, plus a 2-dot legend stub. Sibling-consistent\n * with Bar / Histogram / Scatter skeletons (column-flex container with\n * legend strip below).\n */\nexport function TimeseriesSkeleton() {\n return (\n <Box sx={styles.container}>\n <Box sx={styles.graph}>\n <Skeleton variant='rectangular' sx={styles.segmentA} />\n <Skeleton variant='rectangular' sx={styles.segmentB} />\n <Skeleton variant='rectangular' sx={styles.segmentC} />\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildPngDownloadItem,\n downloadToCSV,\n type DownloadItem,\n} from '../actions/download'\nimport type { TimeseriesWidgetData } from './types'\n\n/**\n * Download menu items for the Timeseries widget. Always includes a CSV\n * item with `time, series_1, series_2, …` columns (one row per unique time\n * across all series; ISO-8601 strings for `Date`/numeric times). When\n * `getCaptureEl` is supplied, prepends a PNG item that rasterises the\n * captured element via `html2canvas`.\n */\nexport function createTimeseriesDownloadConfig(args: {\n filename: string\n getData: () => TimeseriesWidgetData\n seriesNames?: readonly string[]\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: 'csv',\n label: 'Download as CSV',\n resolve: () => {\n const data = args.getData()\n const seriesCount = data.length\n\n // Collect every unique time, preserving insertion order.\n const timeKeys: (Date | number | string)[] = []\n const seenKeys = new Set<string>()\n for (const series of data) {\n for (const point of series) {\n const key = String(point.name)\n if (!seenKeys.has(key)) {\n seenKeys.add(key)\n timeKeys.push(point.name)\n }\n }\n }\n\n // Build a quick lookup per series for O(rows × series) emit.\n const lookups = data.map(\n (series) => new Map(series.map((p) => [String(p.name), p.value])),\n )\n\n const header: unknown[] = ['time']\n for (let i = 0; i < seriesCount; i++) {\n header.push(args.seriesNames?.[i] ?? `series_${i + 1}`)\n }\n const rows: unknown[][] = [header]\n for (const key of timeKeys) {\n const row: unknown[] = [formatTime(key)]\n const lookupKey = String(key)\n for (const lookup of lookups) row.push(lookup.get(lookupKey) ?? '')\n rows.push(row)\n }\n\n const handle = downloadToCSV(rows)\n return Promise.resolve({\n url: handle.url,\n filename: `${args.filename}.csv`,\n revoke: handle.revoke,\n })\n },\n })\n return items\n}\n\nfunction formatTime(v: Date | number | string): string {\n if (v instanceof Date) return v.toISOString()\n if (typeof v === 'number') return new Date(v).toISOString()\n return v\n}\n"],"names":["timeseriesOptions","theme","formatter","labelFormatter","niceMin","niceMax","grid","left","parseInt","spacing","top","right","buildGridConfig","containLabel","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","textStyle","color","common","white","fontSize","fontFamily","typography","caption","axisPointer","type","position","createTooltipPositioner","buildTimeseriesTooltipFormatter","legend","buildLegendConfig","hasLegend","lineStyle","secondary","main","Object","values","qualitative","bold","xAxis","axisLine","show","axisTick","axisLabel","margin","hideOverlap","value","Date","yAxis","min","extent","niceNum","max","splitLine","black","divider","overlineDelicate","showMaxLabel","showMinLabel","verticalAlign","inside","String","createTimeseriesOptionFactory","options","optionsOverride","series","smooth","area","selection","selectionSet","length","Set","normalizeName","n","getTime","option","data","ctx","structural","mergeOptions","seriesArr","Array","isArray","dataset","seriesTemplates","broadcastTemplate","baseYAxis","baseGrid","baseTooltip","baseLegend","liveFormatter","dataZoomLayout","positionDataZoomForLegend","dataZoom","fallbackBottom","bottom","baseBottom","gridBottom","ZOOM_LAYOUT","sliderHeight","sliderGap","dimItemStyle","params","raw","name","base","has","echarts","modifyAlpha","map","s","source","_","i","template","overrideColor","resolveThemeColor","datasetIndex","encode","x","y","showSymbol","areaStyle","emphasis","focus","itemStyle","createTooltipFormatter","item","row","formattedValue","marker","seriesName","rawName","styles","container","display","flexDirection","justifyContent","gap","height","graph","flex","width","segmentA","segmentB","segmentC","alignItems","legendItem","TimeseriesSkeleton","$","_c","t0","Symbol","for","jsxs","Box","jsx","Skeleton","t1","_temp","createTimeseriesDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","pngBackgroundColor","id","label","resolve","getData","seriesCount","timeKeys","seenKeys","point","key","add","lookups","Map","p","header","seriesNames","rows","formatTime","lookupKey","lookup","get","handle","downloadToCSV","Promise","url","revoke","v","toISOString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCO,SAASA,EAAkB;AAAA,EAChCC,OAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,gBAAAA;AACsB,GAA4B;AAGlD,MAAIC,IAAU,GACVC,IAAU;AAEd,SAAO;AAAA,IACLC,MAAM;AAAA,MACJC,MAAMC,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA,MAC/BC,KAAKF,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA,MAC9BE,OAAOH,SAASP,EAAMQ,QAAQ,CAAC,CAAC;AAAA;AAAA,MAEhC,GAAGG,EAAgB,IAAOX,CAAK;AAAA,MAC/BY,cAAc;AAAA,IAAA;AAAA,IAEhBC,SAAS;AAAA,MACPC,SAAS;AAAA,MACTC,iBAAiBf,EAAMgB,QAAQC,KAAK,GAAG;AAAA,MACvCC,aAAa;AAAA,MACbC,SAAS,CAACZ,SAASP,EAAMQ,QAAQ,CAAC,CAAC,GAAGD,SAASP,EAAMQ,QAAQ,CAAC,CAAC,CAAC;AAAA,MAChEY,WAAW;AAAA,QACTC,OAAOrB,EAAMgB,QAAQM,OAAOC;AAAAA,QAC5BC,UAAU;AAAA,QACVC,YAAYzB,EAAM0B,WAAWC,QAAQF;AAAAA,MAAAA;AAAAA,MAEvCG,aAAa;AAAA,QAAEC,MAAM;AAAA,MAAA;AAAA,MACrBC,UAAUC,EAAwB/B,CAAK;AAAA,MACvCC,WAAW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