@spider-analyzer/timeline 4.0.3 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -1
- package/README.md +275 -637
- package/dist/index.d.mts +132 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.js +2913 -22
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2906 -0
- package/dist/index.mjs.map +1 -0
- package/dist/timeline-EX2XZ6IP.css +139 -0
- package/package.json +48 -15
- package/src/Cursor.jsx +5 -13
- package/src/TimeLine.tsx +994 -0
- package/src/TimeLineResizer.jsx +2 -8
- package/src/ToolTip.jsx +7 -7
- package/src/cursorElements/CursorIcon.jsx +6 -29
- package/src/cursorElements/CursorSelection.jsx +4 -19
- package/src/cursorElements/DragOverlay.jsx +2 -12
- package/src/cursorElements/LeftHandle.jsx +3 -19
- package/src/cursorElements/LeftToolTip.jsx +2 -7
- package/src/cursorElements/RightHandle.jsx +3 -19
- package/src/cursorElements/RightToolTip.jsx +4 -13
- package/src/cursorElements/ZoomIn.jsx +5 -25
- package/src/cursorElements/ZoomOut.jsx +4 -21
- package/src/cursorElements/utils.js +1 -1
- package/src/index.js +6 -0
- package/src/index.ts +158 -0
- package/src/moment-shim.ts +169 -0
- package/src/styles.ts +15 -0
- package/src/time.ts +52 -0
- package/src/timeLineElements/Button.jsx +5 -30
- package/src/timeLineElements/HistoToolTip.jsx +3 -17
- package/src/timeLineElements/Histogram.jsx +4 -16
- package/src/timeLineElements/Legend.jsx +2 -16
- package/src/timeLineElements/QualityLine.jsx +4 -11
- package/src/timeLineElements/Tools.jsx +1 -1
- package/src/timeLineElements/XAxis.jsx +5 -8
- package/src/timeLineElements/XGrid.jsx +3 -7
- package/src/timeLineElements/YAxis.jsx +4 -7
- package/src/timeLineElements/YGrid.jsx +2 -6
- package/src/timeLineElements/axesStyles.jsx +0 -49
- package/src/timeline.css +139 -0
- package/src/utils.ts +60 -0
- package/.babelrc +0 -8
- package/.gitlab-ci.yml +0 -27
- package/Makefile +0 -20
- package/dist/Cursor.js +0 -290
- package/dist/TimeLine.js +0 -1177
- package/dist/TimeLineResizer.js +0 -70
- package/dist/ToolTip.js +0 -43
- package/dist/cursorElements/CursorIcon.js +0 -98
- package/dist/cursorElements/CursorSelection.js +0 -179
- package/dist/cursorElements/DragOverlay.js +0 -168
- package/dist/cursorElements/LeftHandle.js +0 -95
- package/dist/cursorElements/LeftToolTip.js +0 -70
- package/dist/cursorElements/RightHandle.js +0 -95
- package/dist/cursorElements/RightToolTip.js +0 -75
- package/dist/cursorElements/ZoomIn.js +0 -93
- package/dist/cursorElements/ZoomOut.js +0 -67
- package/dist/cursorElements/commonStyles.js +0 -28
- package/dist/cursorElements/handleHistoHovering.js +0 -79
- package/dist/cursorElements/utils.js +0 -30
- package/dist/theme.js +0 -59
- package/dist/timeLineElements/Button.js +0 -101
- package/dist/timeLineElements/HistoToolTip.js +0 -78
- package/dist/timeLineElements/Histogram.js +0 -110
- package/dist/timeLineElements/Legend.js +0 -70
- package/dist/timeLineElements/QualityLine.js +0 -81
- package/dist/timeLineElements/Tools.js +0 -115
- package/dist/timeLineElements/XAxis.js +0 -76
- package/dist/timeLineElements/XGrid.js +0 -47
- package/dist/timeLineElements/YAxis.js +0 -60
- package/dist/timeLineElements/YGrid.js +0 -46
- package/dist/timeLineElements/axesStyles.js +0 -57
- package/src/TimeLine.jsx +0 -1163
- package/src/cursorElements/commonStyles.js +0 -21
- /package/dist/{tipDark.css → tipDark-BQEJ43KY.css} +0 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2906 @@
|
|
|
1
|
+
import { forwardRef, useRef, useEffect, useState, useCallback, useImperativeHandle } from 'react';
|
|
2
|
+
import { DateTime, Duration } from 'luxon';
|
|
3
|
+
import { scaleLinear, scaleTime } from 'd3-scale';
|
|
4
|
+
import PropTypes11 from 'prop-types';
|
|
5
|
+
import { select, pointer } from 'd3-selection';
|
|
6
|
+
import { drag } from 'd3-drag';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
import clsx3 from 'clsx';
|
|
9
|
+
import './timeline-EX2XZ6IP.css';
|
|
10
|
+
import ToolTipBase from 'rc-tooltip';
|
|
11
|
+
import './tipDark-BQEJ43KY.css';
|
|
12
|
+
import { timeDay } from 'd3-time';
|
|
13
|
+
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17
|
+
var unitMap = {
|
|
18
|
+
ms: "milliseconds",
|
|
19
|
+
milliseconds: "milliseconds",
|
|
20
|
+
millisecond: "milliseconds",
|
|
21
|
+
second: "seconds",
|
|
22
|
+
seconds: "seconds",
|
|
23
|
+
minute: "minutes",
|
|
24
|
+
minutes: "minutes",
|
|
25
|
+
hour: "hours",
|
|
26
|
+
hours: "hours",
|
|
27
|
+
day: "days",
|
|
28
|
+
days: "days",
|
|
29
|
+
month: "months",
|
|
30
|
+
months: "months",
|
|
31
|
+
year: "years",
|
|
32
|
+
years: "years"
|
|
33
|
+
};
|
|
34
|
+
function normalizeUnit(unit) {
|
|
35
|
+
if (!unit) return "milliseconds";
|
|
36
|
+
const norm = unit.toLowerCase();
|
|
37
|
+
return unitMap[norm] ?? norm;
|
|
38
|
+
}
|
|
39
|
+
var DurationLike = class {
|
|
40
|
+
constructor(d) {
|
|
41
|
+
__publicField(this, "d");
|
|
42
|
+
this.d = d;
|
|
43
|
+
}
|
|
44
|
+
asMilliseconds() {
|
|
45
|
+
return this.d.as("milliseconds");
|
|
46
|
+
}
|
|
47
|
+
valueOf() {
|
|
48
|
+
return this.d.as("milliseconds");
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
function toDurationLike(x) {
|
|
52
|
+
if (x instanceof DurationLike) return x;
|
|
53
|
+
if (typeof x === "number") return new DurationLike(Duration.fromMillis(x));
|
|
54
|
+
if (typeof x === "string") return new DurationLike(Duration.fromISO(x));
|
|
55
|
+
if (x && typeof x.asMilliseconds === "function") {
|
|
56
|
+
return new DurationLike(Duration.fromMillis(x.asMilliseconds()));
|
|
57
|
+
}
|
|
58
|
+
return new DurationLike(Duration.fromMillis(0));
|
|
59
|
+
}
|
|
60
|
+
var MomentLike = class _MomentLike {
|
|
61
|
+
constructor(dt) {
|
|
62
|
+
__publicField(this, "_dt");
|
|
63
|
+
this._dt = dt;
|
|
64
|
+
}
|
|
65
|
+
_toDT(other) {
|
|
66
|
+
if (other instanceof _MomentLike) return other._dt;
|
|
67
|
+
if (other instanceof Date) return DateTime.fromJSDate(other);
|
|
68
|
+
if (typeof other === "number") return DateTime.fromMillis(other);
|
|
69
|
+
if (other instanceof DateTime) return other;
|
|
70
|
+
return DateTime.fromJSDate(new Date(other));
|
|
71
|
+
}
|
|
72
|
+
_addMillis(ms) {
|
|
73
|
+
return this._dt.toMillis() + ms;
|
|
74
|
+
}
|
|
75
|
+
isBefore(other) {
|
|
76
|
+
return this._dt.toMillis() < this._toDT(other).toMillis();
|
|
77
|
+
}
|
|
78
|
+
isAfter(other) {
|
|
79
|
+
return this._dt.toMillis() > this._toDT(other).toMillis();
|
|
80
|
+
}
|
|
81
|
+
isSame(other) {
|
|
82
|
+
return this._dt.toMillis() === this._toDT(other).toMillis();
|
|
83
|
+
}
|
|
84
|
+
isSameOrBefore(other) {
|
|
85
|
+
return this._dt.toMillis() <= this._toDT(other).toMillis();
|
|
86
|
+
}
|
|
87
|
+
isSameOrAfter(other) {
|
|
88
|
+
return this._dt.toMillis() >= this._toDT(other).toMillis();
|
|
89
|
+
}
|
|
90
|
+
// moment returns duration by default; library internals always use the
|
|
91
|
+
// no-arg form and treat the result as a number via arithmetic. Return ms.
|
|
92
|
+
diff(other) {
|
|
93
|
+
return this._dt.toMillis() - this._toDT(other).toMillis();
|
|
94
|
+
}
|
|
95
|
+
add(n, unit) {
|
|
96
|
+
const ms = normalizeToMillis(n, unit);
|
|
97
|
+
return new _MomentLike(DateTime.fromMillis(this._addMillis(ms), { zone: this._dt.zone }));
|
|
98
|
+
}
|
|
99
|
+
subtract(n, unit) {
|
|
100
|
+
const ms = normalizeToMillis(n, unit);
|
|
101
|
+
return new _MomentLike(DateTime.fromMillis(this._addMillis(-ms), { zone: this._dt.zone }));
|
|
102
|
+
}
|
|
103
|
+
toDate() {
|
|
104
|
+
return this._dt.toJSDate();
|
|
105
|
+
}
|
|
106
|
+
toISOString() {
|
|
107
|
+
return this._dt.toUTC().toISO() ?? "";
|
|
108
|
+
}
|
|
109
|
+
valueOf() {
|
|
110
|
+
return this._dt.toMillis();
|
|
111
|
+
}
|
|
112
|
+
format(fmt) {
|
|
113
|
+
if (!fmt) return this._dt.toISO() ?? "";
|
|
114
|
+
return this._dt.toFormat(momentFmtToLuxon(fmt));
|
|
115
|
+
}
|
|
116
|
+
// setter chain used in demo: .second(0).millisecond(0)
|
|
117
|
+
second(v) {
|
|
118
|
+
return new _MomentLike(this._dt.set({ second: v }));
|
|
119
|
+
}
|
|
120
|
+
millisecond(v) {
|
|
121
|
+
return new _MomentLike(this._dt.set({ millisecond: v }));
|
|
122
|
+
}
|
|
123
|
+
// Internal (escape hatch — prefer the wrapper API above).
|
|
124
|
+
toLuxon() {
|
|
125
|
+
return this._dt;
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
function normalizeToMillis(n, unit) {
|
|
129
|
+
if (n instanceof DurationLike) return n.asMilliseconds();
|
|
130
|
+
if (n && typeof n.asMilliseconds === "function") return n.asMilliseconds();
|
|
131
|
+
if (typeof n === "number") {
|
|
132
|
+
if (!unit) return n;
|
|
133
|
+
const u = normalizeUnit(unit);
|
|
134
|
+
return Duration.fromObject({ [u]: n }).as("milliseconds");
|
|
135
|
+
}
|
|
136
|
+
return 0;
|
|
137
|
+
}
|
|
138
|
+
function momentFmtToLuxon(fmt) {
|
|
139
|
+
return fmt.replace(/YYYY/g, "yyyy").replace(/YY/g, "yy").replace(/DD/g, "dd").replace(/A/g, "a");
|
|
140
|
+
}
|
|
141
|
+
function toDT(x) {
|
|
142
|
+
if (x === void 0 || x === null) return DateTime.now();
|
|
143
|
+
if (x instanceof MomentLike) return x.toLuxon();
|
|
144
|
+
if (x instanceof Date) return DateTime.fromJSDate(x);
|
|
145
|
+
if (typeof x === "number") return DateTime.fromMillis(x);
|
|
146
|
+
if (typeof x === "string") return DateTime.fromISO(x);
|
|
147
|
+
return DateTime.fromJSDate(new Date(x));
|
|
148
|
+
}
|
|
149
|
+
var moment = function moment2(x) {
|
|
150
|
+
return new MomentLike(toDT(x));
|
|
151
|
+
};
|
|
152
|
+
moment.isMoment = (x) => x instanceof MomentLike;
|
|
153
|
+
moment.isDuration = (x) => x instanceof DurationLike;
|
|
154
|
+
moment.duration = (x, unit) => {
|
|
155
|
+
if (typeof x === "number" && unit) {
|
|
156
|
+
const u = normalizeUnit(unit);
|
|
157
|
+
return new DurationLike(Duration.fromObject({ [u]: x }));
|
|
158
|
+
}
|
|
159
|
+
return toDurationLike(x);
|
|
160
|
+
};
|
|
161
|
+
moment.tz = (x, zone) => {
|
|
162
|
+
const base = toDT(x);
|
|
163
|
+
return new MomentLike(base.setZone(zone));
|
|
164
|
+
};
|
|
165
|
+
var moment_shim_default = moment;
|
|
166
|
+
|
|
167
|
+
// src/utils.ts
|
|
168
|
+
var max = (arr) => arr && arr.length ? Math.max(...arr) : void 0;
|
|
169
|
+
var sum = (arr) => arr ? arr.reduce((acc, v) => acc + v, 0) : 0;
|
|
170
|
+
var floor = (n, precision = 0) => {
|
|
171
|
+
const p = Math.pow(10, precision);
|
|
172
|
+
return Math.floor(n * p) / p;
|
|
173
|
+
};
|
|
174
|
+
var round = (n, precision = 0) => {
|
|
175
|
+
const p = Math.pow(10, precision);
|
|
176
|
+
return Math.round(n * p) / p;
|
|
177
|
+
};
|
|
178
|
+
var clamp = (n, lower, upper) => Math.max(lower, Math.min(upper, n));
|
|
179
|
+
var isFunction = (v) => typeof v === "function";
|
|
180
|
+
function isEqual(a, b) {
|
|
181
|
+
if (a === b) return true;
|
|
182
|
+
if (a == null || b == null) return false;
|
|
183
|
+
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
184
|
+
const ka = Object.keys(a);
|
|
185
|
+
const kb = Object.keys(b);
|
|
186
|
+
if (ka.length !== kb.length) return false;
|
|
187
|
+
for (const k of ka) {
|
|
188
|
+
if (!isEqual(a[k], b[k])) return false;
|
|
189
|
+
}
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
function merge(target, ...sources) {
|
|
193
|
+
for (const src of sources) {
|
|
194
|
+
if (!src || typeof src !== "object") continue;
|
|
195
|
+
for (const k of Object.keys(src)) {
|
|
196
|
+
const v = src[k];
|
|
197
|
+
if (v && typeof v === "object" && !Array.isArray(v) && target[k] && typeof target[k] === "object" && !Array.isArray(target[k])) {
|
|
198
|
+
target[k] = merge({ ...target[k] }, v);
|
|
199
|
+
} else {
|
|
200
|
+
target[k] = v;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return target;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/cursorElements/utils.js
|
|
208
|
+
function hide(element) {
|
|
209
|
+
element.style.opacity = 0;
|
|
210
|
+
element.style.visibility = "hidden";
|
|
211
|
+
}
|
|
212
|
+
function show(element) {
|
|
213
|
+
element.style.opacity = 1;
|
|
214
|
+
element.style.visibility = "visible";
|
|
215
|
+
}
|
|
216
|
+
var resizeToolTip = (height) => clamp(2 * height / 30, 1.9, 4);
|
|
217
|
+
var resizeToolTipText = (height) => clamp(7 * height / 29, 7, 14);
|
|
218
|
+
var resizeToolTipRightDelta = (height) => clamp(4 * height / 30, 4, 9);
|
|
219
|
+
function handleHistoOver({
|
|
220
|
+
showHistoToolTip,
|
|
221
|
+
dragging,
|
|
222
|
+
event,
|
|
223
|
+
dragOverlay,
|
|
224
|
+
marginBottom,
|
|
225
|
+
items,
|
|
226
|
+
height,
|
|
227
|
+
tooltipVisible,
|
|
228
|
+
timer,
|
|
229
|
+
barHovered,
|
|
230
|
+
setTimer,
|
|
231
|
+
setToolTipVisible,
|
|
232
|
+
setBarHovered
|
|
233
|
+
}) {
|
|
234
|
+
if (showHistoToolTip && !dragging && dragOverlay) {
|
|
235
|
+
const [x, y] = pointer(event, dragOverlay.current);
|
|
236
|
+
const margin = marginBottom || 0;
|
|
237
|
+
const index = items.findIndex(
|
|
238
|
+
(element) => element.x1 <= x && element.x2 > x && y >= height - element.height - margin && y < height - margin
|
|
239
|
+
);
|
|
240
|
+
if (!tooltipVisible && !timer) {
|
|
241
|
+
setTimer(setTimeout(() => {
|
|
242
|
+
setToolTipVisible(true);
|
|
243
|
+
setTimer(null);
|
|
244
|
+
}, 1e3));
|
|
245
|
+
} else if (timer && barHovered !== index) {
|
|
246
|
+
clearTimeout(timer);
|
|
247
|
+
setTimer(setTimeout(() => {
|
|
248
|
+
setToolTipVisible(true);
|
|
249
|
+
setTimer(null);
|
|
250
|
+
}, 1e3));
|
|
251
|
+
} else if (index < 0 && tooltipVisible) {
|
|
252
|
+
setToolTipVisible(false);
|
|
253
|
+
}
|
|
254
|
+
if (barHovered !== index) {
|
|
255
|
+
setBarHovered(index);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function handleHistoOut({ setToolTipVisible, setBarHovered, timer, friendTarget }) {
|
|
260
|
+
return (event) => {
|
|
261
|
+
if (event.relatedTarget !== (friendTarget && friendTarget.current)) {
|
|
262
|
+
setToolTipVisible(false);
|
|
263
|
+
setBarHovered(-1);
|
|
264
|
+
}
|
|
265
|
+
if (timer) {
|
|
266
|
+
clearTimeout(timer);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function DragOverlay({
|
|
271
|
+
width,
|
|
272
|
+
height,
|
|
273
|
+
marginBottom,
|
|
274
|
+
showToolTipLeft,
|
|
275
|
+
showToolTipRight,
|
|
276
|
+
onDrawCursor,
|
|
277
|
+
onStartDrawCursor,
|
|
278
|
+
onMovedDomain,
|
|
279
|
+
onMoveDomain,
|
|
280
|
+
onEndCursor,
|
|
281
|
+
dragOverlayRef,
|
|
282
|
+
tooltipVisible,
|
|
283
|
+
items,
|
|
284
|
+
showHistoToolTip,
|
|
285
|
+
dragging,
|
|
286
|
+
barHovered,
|
|
287
|
+
cursorSelection,
|
|
288
|
+
setDragging,
|
|
289
|
+
setToolTipVisible,
|
|
290
|
+
setBarHovered
|
|
291
|
+
}) {
|
|
292
|
+
const dragOverlayContainer = useRef();
|
|
293
|
+
const [timer, setTimer] = useState(null);
|
|
294
|
+
const setOverlayCursor = (event) => {
|
|
295
|
+
if (event.ctrlKey) {
|
|
296
|
+
dragOverlayRef.current.style.cursor = "move";
|
|
297
|
+
} else {
|
|
298
|
+
dragOverlayRef.current.style.cursor = "crosshair";
|
|
299
|
+
}
|
|
300
|
+
handleHistoOver({
|
|
301
|
+
showHistoToolTip,
|
|
302
|
+
dragging,
|
|
303
|
+
event,
|
|
304
|
+
dragOverlay: dragOverlayRef,
|
|
305
|
+
marginBottom,
|
|
306
|
+
items,
|
|
307
|
+
height,
|
|
308
|
+
tooltipVisible,
|
|
309
|
+
timer,
|
|
310
|
+
setTimer,
|
|
311
|
+
setToolTipVisible,
|
|
312
|
+
barHovered,
|
|
313
|
+
setBarHovered
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
useEffect(() => {
|
|
317
|
+
let mode = null;
|
|
318
|
+
select(dragOverlayRef.current).call(
|
|
319
|
+
drag().filter((event) => !event.button).container(dragOverlayContainer.current).on("start", (event) => {
|
|
320
|
+
if (event.sourceEvent.ctrlKey) {
|
|
321
|
+
mode = "DOMAIN";
|
|
322
|
+
} else {
|
|
323
|
+
mode = "CURSOR";
|
|
324
|
+
showToolTipLeft(true);
|
|
325
|
+
onStartDrawCursor(event.x);
|
|
326
|
+
}
|
|
327
|
+
}).on("drag", (event) => {
|
|
328
|
+
if (mode === "DOMAIN") {
|
|
329
|
+
onMoveDomain(event.dx);
|
|
330
|
+
} else if (mode === "CURSOR") {
|
|
331
|
+
showToolTipRight(true);
|
|
332
|
+
onDrawCursor(event.dx, pointer(event, dragOverlayRef.current));
|
|
333
|
+
}
|
|
334
|
+
setDragging(true);
|
|
335
|
+
}).on("end", () => {
|
|
336
|
+
if (mode === "DOMAIN") {
|
|
337
|
+
onMovedDomain();
|
|
338
|
+
} else if (mode === "CURSOR") {
|
|
339
|
+
showToolTipLeft(false);
|
|
340
|
+
showToolTipRight(false);
|
|
341
|
+
onEndCursor();
|
|
342
|
+
}
|
|
343
|
+
mode = null;
|
|
344
|
+
setDragging(false);
|
|
345
|
+
})
|
|
346
|
+
);
|
|
347
|
+
}, []);
|
|
348
|
+
return /* @__PURE__ */ jsx("g", { ref: dragOverlayContainer, children: /* @__PURE__ */ jsx(
|
|
349
|
+
"rect",
|
|
350
|
+
{
|
|
351
|
+
ref: dragOverlayRef,
|
|
352
|
+
className: "tl-dragOverlay",
|
|
353
|
+
x: 0,
|
|
354
|
+
y: 0,
|
|
355
|
+
width,
|
|
356
|
+
height,
|
|
357
|
+
onMouseMove: setOverlayCursor,
|
|
358
|
+
onMouseOver: setOverlayCursor,
|
|
359
|
+
onMouseOut: handleHistoOut({ setToolTipVisible, setBarHovered, timer, friendTarget: cursorSelection })
|
|
360
|
+
}
|
|
361
|
+
) });
|
|
362
|
+
}
|
|
363
|
+
DragOverlay.propTypes = {
|
|
364
|
+
height: PropTypes11.number.isRequired,
|
|
365
|
+
width: PropTypes11.number.isRequired,
|
|
366
|
+
marginBottom: PropTypes11.number,
|
|
367
|
+
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
368
|
+
start: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
369
|
+
end: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
370
|
+
x1: PropTypes11.number,
|
|
371
|
+
x2: PropTypes11.number,
|
|
372
|
+
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
373
|
+
total: PropTypes11.number.isRequired
|
|
374
|
+
})),
|
|
375
|
+
tooltipVisible: PropTypes11.bool,
|
|
376
|
+
barHovered: PropTypes11.number,
|
|
377
|
+
setBarHovered: PropTypes11.func,
|
|
378
|
+
setTooltipVisible: PropTypes11.func,
|
|
379
|
+
showToolTipLeft: PropTypes11.func.isRequired,
|
|
380
|
+
showToolTipRight: PropTypes11.func.isRequired,
|
|
381
|
+
showHistoToolTip: PropTypes11.bool,
|
|
382
|
+
onStartDrawCursor: PropTypes11.func.isRequired,
|
|
383
|
+
onDrawCursor: PropTypes11.func.isRequired,
|
|
384
|
+
onEndCursor: PropTypes11.func.isRequired,
|
|
385
|
+
onMoveDomain: PropTypes11.func,
|
|
386
|
+
onMovedDomain: PropTypes11.func
|
|
387
|
+
};
|
|
388
|
+
function dragOverlayFwd(props, ref) {
|
|
389
|
+
return /* @__PURE__ */ jsx(DragOverlay, { ...props, dragOverlayRef: ref });
|
|
390
|
+
}
|
|
391
|
+
var DragOverlay_default = forwardRef(dragOverlayFwd);
|
|
392
|
+
function cn(name, classes) {
|
|
393
|
+
return clsx3(`tl-${name}`, classes?.[name]);
|
|
394
|
+
}
|
|
395
|
+
var theme = {
|
|
396
|
+
rcToolTipPrefixCls: "rc-tooltip-dark"
|
|
397
|
+
};
|
|
398
|
+
var theme_default = theme;
|
|
399
|
+
var defaultLabels = {
|
|
400
|
+
forwardButtonTip: "Slide forward",
|
|
401
|
+
backwardButtonTip: "Slide backward",
|
|
402
|
+
resetButtonTip: "Reset time span",
|
|
403
|
+
gotoNowButtonTip: "Goto Now",
|
|
404
|
+
doubleClickMaxZoomMsg: "Cannot zoom anymore!",
|
|
405
|
+
scrollMaxZoomMsg: "Cannot zoom anymore!",
|
|
406
|
+
zoomInWithoutChangingSelectionMsg: "Please change time selection before clicking on zoom ;)",
|
|
407
|
+
zoomSelectionResolutionExtended: "You reached maximum zoom level",
|
|
408
|
+
minZoomMsg: "You reached minimum zoom level",
|
|
409
|
+
maxSelectionMsg: "You reached maximum selection",
|
|
410
|
+
maxDomainMsg: "You reached maximum visible time",
|
|
411
|
+
minDomainMsg: "You reached minimum visible time",
|
|
412
|
+
gotoCursor: "Goto Cursor",
|
|
413
|
+
zoomInLabel: "Zoom in",
|
|
414
|
+
zoomOutLabel: "Zoom out"
|
|
415
|
+
};
|
|
416
|
+
var defaultQualityScale = scaleLinear().domain([0, 0.9, 1]).range(["#ff3724", "rgba(255,0,0,0.09)", "rgba(155,249,135,0.94)"]).clamp(true);
|
|
417
|
+
function ToolTip({ overlay, placement = "top", mouseEnterDelay = 0.5, prefixCls, align, visible, hidden, children }) {
|
|
418
|
+
const extraProps = {};
|
|
419
|
+
if (visible) extraProps.open = true;
|
|
420
|
+
if (hidden) extraProps.open = false;
|
|
421
|
+
return /* @__PURE__ */ jsx(
|
|
422
|
+
ToolTipBase,
|
|
423
|
+
{
|
|
424
|
+
placement,
|
|
425
|
+
prefixCls: prefixCls || theme_default.rcToolTipPrefixCls,
|
|
426
|
+
overlay,
|
|
427
|
+
mouseEnterDelay,
|
|
428
|
+
destroyTooltipOnHide: true,
|
|
429
|
+
align,
|
|
430
|
+
...extraProps,
|
|
431
|
+
children
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
ToolTip.propTypes = {
|
|
436
|
+
overlay: PropTypes11.any.isRequired,
|
|
437
|
+
placement: PropTypes11.string,
|
|
438
|
+
mouseEnterDelay: PropTypes11.number
|
|
439
|
+
};
|
|
440
|
+
var zoomOutIcon = "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z";
|
|
441
|
+
function ZoomOut({ classes, origin, zoomOutLabel, onZoomOut, rcToolTipPrefixCls }) {
|
|
442
|
+
const className = (n) => cn(n, classes);
|
|
443
|
+
return /* @__PURE__ */ jsx(
|
|
444
|
+
ToolTip,
|
|
445
|
+
{
|
|
446
|
+
placement: "left",
|
|
447
|
+
overlay: zoomOutLabel,
|
|
448
|
+
children: /* @__PURE__ */ jsxs(
|
|
449
|
+
"g",
|
|
450
|
+
{
|
|
451
|
+
className: "tl-zoomOutContainer",
|
|
452
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
453
|
+
onClick: onZoomOut,
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ jsx(
|
|
456
|
+
"rect",
|
|
457
|
+
{
|
|
458
|
+
className: "tl-zoomArea",
|
|
459
|
+
x: 0,
|
|
460
|
+
y: 0,
|
|
461
|
+
width: 23,
|
|
462
|
+
height: 23
|
|
463
|
+
}
|
|
464
|
+
),
|
|
465
|
+
/* @__PURE__ */ jsx(
|
|
466
|
+
"path",
|
|
467
|
+
{
|
|
468
|
+
className: className("zoomOut"),
|
|
469
|
+
d: zoomOutIcon
|
|
470
|
+
}
|
|
471
|
+
)
|
|
472
|
+
]
|
|
473
|
+
}
|
|
474
|
+
)
|
|
475
|
+
}
|
|
476
|
+
);
|
|
477
|
+
}
|
|
478
|
+
ZoomOut.propTypes = {
|
|
479
|
+
classes: PropTypes11.object.isRequired,
|
|
480
|
+
rcToolTipPrefixCls: PropTypes11.string.isRequired,
|
|
481
|
+
origin: PropTypes11.shape({
|
|
482
|
+
x: PropTypes11.number.isRequired,
|
|
483
|
+
y: PropTypes11.number.isRequired
|
|
484
|
+
}).isRequired,
|
|
485
|
+
zoomOutLabel: PropTypes11.string,
|
|
486
|
+
onZoomOut: PropTypes11.func
|
|
487
|
+
};
|
|
488
|
+
function CursorIcon({
|
|
489
|
+
classes,
|
|
490
|
+
rcToolTipPrefixCls,
|
|
491
|
+
origin,
|
|
492
|
+
position,
|
|
493
|
+
gotoCursorLabel,
|
|
494
|
+
onGotoCursor
|
|
495
|
+
}) {
|
|
496
|
+
const [isOver, setIsOver] = useState(false);
|
|
497
|
+
return /* @__PURE__ */ jsx(
|
|
498
|
+
ToolTip,
|
|
499
|
+
{
|
|
500
|
+
placement: position === "right" ? "left" : "right",
|
|
501
|
+
overlay: gotoCursorLabel,
|
|
502
|
+
children: /* @__PURE__ */ jsxs(
|
|
503
|
+
"g",
|
|
504
|
+
{
|
|
505
|
+
transform: `translate(${origin.x},${origin.y}) scale(2)`,
|
|
506
|
+
style: { cursor: "pointer" },
|
|
507
|
+
onClick: onGotoCursor,
|
|
508
|
+
onMouseOver: () => setIsOver(true),
|
|
509
|
+
onMouseOut: () => setIsOver(false),
|
|
510
|
+
children: [
|
|
511
|
+
/* @__PURE__ */ jsx(
|
|
512
|
+
"rect",
|
|
513
|
+
{
|
|
514
|
+
className: clsx3(
|
|
515
|
+
"tl-cursorIconRect",
|
|
516
|
+
classes.cursorIconRect,
|
|
517
|
+
isOver && "tl-cursorIconRectOver",
|
|
518
|
+
isOver && classes.cursorIconRectOver
|
|
519
|
+
),
|
|
520
|
+
width: "5.5",
|
|
521
|
+
height: "13.72",
|
|
522
|
+
x: "9.56",
|
|
523
|
+
y: "4.76"
|
|
524
|
+
}
|
|
525
|
+
),
|
|
526
|
+
/* @__PURE__ */ jsx(
|
|
527
|
+
"circle",
|
|
528
|
+
{
|
|
529
|
+
className: clsx3(
|
|
530
|
+
"tl-cursorIconCircle",
|
|
531
|
+
classes.cursorIconCircle,
|
|
532
|
+
isOver && "tl-cursorIconCircleOver",
|
|
533
|
+
isOver && classes.cursorIconCircleOver
|
|
534
|
+
),
|
|
535
|
+
cx: "9.63",
|
|
536
|
+
cy: "11.62",
|
|
537
|
+
r: "1.4"
|
|
538
|
+
}
|
|
539
|
+
),
|
|
540
|
+
/* @__PURE__ */ jsx(
|
|
541
|
+
"circle",
|
|
542
|
+
{
|
|
543
|
+
className: clsx3(
|
|
544
|
+
"tl-cursorIconCircle",
|
|
545
|
+
classes.cursorIconCircle,
|
|
546
|
+
isOver && "tl-cursorIconCircleOver",
|
|
547
|
+
isOver && classes.cursorIconCircleOver
|
|
548
|
+
),
|
|
549
|
+
cx: "15",
|
|
550
|
+
cy: "11.70",
|
|
551
|
+
r: "1.4"
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
]
|
|
555
|
+
}
|
|
556
|
+
)
|
|
557
|
+
}
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
CursorIcon.propTypes = {
|
|
561
|
+
classes: PropTypes11.object.isRequired,
|
|
562
|
+
rcToolTipPrefixCls: PropTypes11.string.isRequired,
|
|
563
|
+
origin: PropTypes11.shape({
|
|
564
|
+
x: PropTypes11.number.isRequired,
|
|
565
|
+
y: PropTypes11.number.isRequired
|
|
566
|
+
}).isRequired,
|
|
567
|
+
onGotoCursor: PropTypes11.func,
|
|
568
|
+
gotoCursorLabel: PropTypes11.string.isRequired,
|
|
569
|
+
position: PropTypes11.string.isRequired
|
|
570
|
+
};
|
|
571
|
+
function CursorSelection({
|
|
572
|
+
classes,
|
|
573
|
+
cursor,
|
|
574
|
+
height,
|
|
575
|
+
maxSize,
|
|
576
|
+
zoomIn,
|
|
577
|
+
canZoom,
|
|
578
|
+
dragOverlay,
|
|
579
|
+
onMoveDomain,
|
|
580
|
+
onDragCursor,
|
|
581
|
+
onMovedDomain,
|
|
582
|
+
onEndDragCursor,
|
|
583
|
+
showToolTipLeft,
|
|
584
|
+
showToolTipRight,
|
|
585
|
+
width,
|
|
586
|
+
tooltipVisible,
|
|
587
|
+
items,
|
|
588
|
+
showHistoToolTip,
|
|
589
|
+
dragging,
|
|
590
|
+
barHovered,
|
|
591
|
+
marginBottom,
|
|
592
|
+
setDragging,
|
|
593
|
+
setBarHovered,
|
|
594
|
+
setToolTipVisible
|
|
595
|
+
}) {
|
|
596
|
+
const className = (n) => cn(n, classes);
|
|
597
|
+
const [timer, setTimer] = useState(null);
|
|
598
|
+
const setOverlayCursor = (event) => handleHistoOver({
|
|
599
|
+
showHistoToolTip,
|
|
600
|
+
dragging,
|
|
601
|
+
event,
|
|
602
|
+
dragOverlay,
|
|
603
|
+
marginBottom,
|
|
604
|
+
items,
|
|
605
|
+
height,
|
|
606
|
+
tooltipVisible,
|
|
607
|
+
timer,
|
|
608
|
+
setTimer,
|
|
609
|
+
setToolTipVisible,
|
|
610
|
+
barHovered,
|
|
611
|
+
setBarHovered
|
|
612
|
+
});
|
|
613
|
+
useEffect(
|
|
614
|
+
() => {
|
|
615
|
+
let mode = null;
|
|
616
|
+
select(cursor.current).call(
|
|
617
|
+
drag().filter((event) => !event.button).container(dragOverlay.current).on("start", (event) => {
|
|
618
|
+
if (event.sourceEvent.ctrlKey) {
|
|
619
|
+
mode = "DOMAIN";
|
|
620
|
+
} else {
|
|
621
|
+
mode = "CURSOR";
|
|
622
|
+
showToolTipRight(true);
|
|
623
|
+
showToolTipLeft(true);
|
|
624
|
+
}
|
|
625
|
+
}).on("drag", (event) => {
|
|
626
|
+
if (mode === "DOMAIN" && event.sourceEvent.ctrlKey) {
|
|
627
|
+
onMoveDomain(event.dx);
|
|
628
|
+
} else if (mode === "CURSOR") {
|
|
629
|
+
onDragCursor(event.dx, pointer(event, dragOverlay.current));
|
|
630
|
+
}
|
|
631
|
+
setDragging(true);
|
|
632
|
+
}).on("end", () => {
|
|
633
|
+
if (mode === "DOMAIN") {
|
|
634
|
+
onMovedDomain();
|
|
635
|
+
} else if (mode === "CURSOR") {
|
|
636
|
+
showToolTipRight(false);
|
|
637
|
+
showToolTipLeft(false);
|
|
638
|
+
onEndDragCursor();
|
|
639
|
+
}
|
|
640
|
+
mode = null;
|
|
641
|
+
mode = null;
|
|
642
|
+
setDragging(false);
|
|
643
|
+
})
|
|
644
|
+
);
|
|
645
|
+
},
|
|
646
|
+
[cursor.current]
|
|
647
|
+
);
|
|
648
|
+
return /* @__PURE__ */ jsx(
|
|
649
|
+
"rect",
|
|
650
|
+
{
|
|
651
|
+
ref: cursor,
|
|
652
|
+
className: clsx3(className("cursorArea"), maxSize && "tl--maxSize"),
|
|
653
|
+
x: 0,
|
|
654
|
+
y: -3,
|
|
655
|
+
width,
|
|
656
|
+
height: height + 10,
|
|
657
|
+
onDoubleClick: canZoom ? zoomIn : void 0,
|
|
658
|
+
onMouseMove: setOverlayCursor,
|
|
659
|
+
onMouseOver: setOverlayCursor,
|
|
660
|
+
onMouseOut: handleHistoOut({ setToolTipVisible, setBarHovered, timer, friendTarget: dragOverlay })
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
CursorSelection.propTypes = {
|
|
665
|
+
classes: PropTypes11.object.isRequired,
|
|
666
|
+
width: PropTypes11.number.isRequired,
|
|
667
|
+
height: PropTypes11.number.isRequired,
|
|
668
|
+
maxSize: PropTypes11.bool.isRequired,
|
|
669
|
+
zoomIn: PropTypes11.func.isRequired,
|
|
670
|
+
canZoom: PropTypes11.bool.isRequired,
|
|
671
|
+
dragOverlay: PropTypes11.object.isRequired,
|
|
672
|
+
onMoveDomain: PropTypes11.func.isRequired,
|
|
673
|
+
onMovedDomain: PropTypes11.func.isRequired,
|
|
674
|
+
onDragCursor: PropTypes11.func.isRequired,
|
|
675
|
+
onEndDragCursor: PropTypes11.func.isRequired,
|
|
676
|
+
showToolTipLeft: PropTypes11.func.isRequired,
|
|
677
|
+
showToolTipRight: PropTypes11.func.isRequired,
|
|
678
|
+
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
679
|
+
start: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
680
|
+
end: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
681
|
+
x1: PropTypes11.number,
|
|
682
|
+
x2: PropTypes11.number,
|
|
683
|
+
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
684
|
+
total: PropTypes11.number.isRequired
|
|
685
|
+
})),
|
|
686
|
+
tooltipVisible: PropTypes11.bool,
|
|
687
|
+
barHovered: PropTypes11.number,
|
|
688
|
+
setBarHovered: PropTypes11.func,
|
|
689
|
+
setTooltipVisible: PropTypes11.func
|
|
690
|
+
};
|
|
691
|
+
function CursorSelectionFwd(props, ref) {
|
|
692
|
+
return /* @__PURE__ */ jsx(CursorSelection, { ...props, cursor: ref });
|
|
693
|
+
}
|
|
694
|
+
var CursorSelection_default = forwardRef(CursorSelectionFwd);
|
|
695
|
+
function LeftHandle({
|
|
696
|
+
classes,
|
|
697
|
+
maxSize,
|
|
698
|
+
onResizeLeftCursor,
|
|
699
|
+
onEndResizeCursor,
|
|
700
|
+
dragOverlay,
|
|
701
|
+
showToolTipLeft,
|
|
702
|
+
origin,
|
|
703
|
+
startIsOutOfView,
|
|
704
|
+
setDragging
|
|
705
|
+
}) {
|
|
706
|
+
const className = (n) => cn(n, classes);
|
|
707
|
+
const cursorLeftHandle = useRef();
|
|
708
|
+
useEffect(() => {
|
|
709
|
+
cursorLeftHandle.current && select(cursorLeftHandle.current).call(
|
|
710
|
+
drag().filter((event) => !event.button).container(dragOverlay.current).on("start", () => {
|
|
711
|
+
setDragging(true);
|
|
712
|
+
showToolTipLeft(true);
|
|
713
|
+
}).on("drag", (event) => onResizeLeftCursor(event.dx, pointer(event, dragOverlay.current))).on("end", () => {
|
|
714
|
+
setDragging(false);
|
|
715
|
+
showToolTipLeft(false);
|
|
716
|
+
onEndResizeCursor();
|
|
717
|
+
})
|
|
718
|
+
);
|
|
719
|
+
}, [cursorLeftHandle.current]);
|
|
720
|
+
return /* @__PURE__ */ jsx(
|
|
721
|
+
"circle",
|
|
722
|
+
{
|
|
723
|
+
ref: cursorLeftHandle,
|
|
724
|
+
className: clsx3(className("cursorLeftHandle"), maxSize && "tl--maxSize", startIsOutOfView && "tl--outOfView"),
|
|
725
|
+
r: "4",
|
|
726
|
+
cx: origin.x,
|
|
727
|
+
cy: origin.y
|
|
728
|
+
}
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
LeftHandle.propTypes = {
|
|
732
|
+
classes: PropTypes11.object.isRequired,
|
|
733
|
+
origin: PropTypes11.shape({
|
|
734
|
+
x: PropTypes11.number.isRequired,
|
|
735
|
+
y: PropTypes11.number.isRequired
|
|
736
|
+
}).isRequired,
|
|
737
|
+
maxSize: PropTypes11.bool.isRequired,
|
|
738
|
+
dragOverlay: PropTypes11.object.isRequired,
|
|
739
|
+
startIsOutOfView: PropTypes11.bool.isRequired,
|
|
740
|
+
showToolTipLeft: PropTypes11.func.isRequired,
|
|
741
|
+
onResizeLeftCursor: PropTypes11.func.isRequired,
|
|
742
|
+
onEndResizeCursor: PropTypes11.func.isRequired,
|
|
743
|
+
setDragging: PropTypes11.func.isRequired
|
|
744
|
+
};
|
|
745
|
+
function RightHandle({
|
|
746
|
+
classes,
|
|
747
|
+
maxSize,
|
|
748
|
+
origin,
|
|
749
|
+
onResizeRightCursor,
|
|
750
|
+
onEndResizeCursor,
|
|
751
|
+
dragOverlay,
|
|
752
|
+
showToolTipRight,
|
|
753
|
+
endIsOutOfView,
|
|
754
|
+
setDragging
|
|
755
|
+
}) {
|
|
756
|
+
const className = (n) => cn(n, classes);
|
|
757
|
+
const cursorRightHandle = useRef();
|
|
758
|
+
useEffect(() => {
|
|
759
|
+
cursorRightHandle.current && select(cursorRightHandle.current).call(
|
|
760
|
+
drag().filter((event) => !event.button).container(dragOverlay.current).on("start", () => {
|
|
761
|
+
setDragging(true);
|
|
762
|
+
showToolTipRight(true);
|
|
763
|
+
}).on("drag", (event) => onResizeRightCursor(event.dx, pointer(event, dragOverlay.current))).on("end", () => {
|
|
764
|
+
setDragging(false);
|
|
765
|
+
showToolTipRight(false);
|
|
766
|
+
onEndResizeCursor();
|
|
767
|
+
})
|
|
768
|
+
);
|
|
769
|
+
}, [cursorRightHandle.current]);
|
|
770
|
+
return /* @__PURE__ */ jsx(
|
|
771
|
+
"circle",
|
|
772
|
+
{
|
|
773
|
+
ref: cursorRightHandle,
|
|
774
|
+
className: clsx3(className("cursorRightHandle"), maxSize && "tl--maxSize", endIsOutOfView && "tl--outOfView"),
|
|
775
|
+
r: "4",
|
|
776
|
+
cx: origin.x,
|
|
777
|
+
cy: origin.y
|
|
778
|
+
}
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
RightHandle.propTypes = {
|
|
782
|
+
classes: PropTypes11.object.isRequired,
|
|
783
|
+
origin: PropTypes11.shape({
|
|
784
|
+
x: PropTypes11.number.isRequired,
|
|
785
|
+
y: PropTypes11.number.isRequired
|
|
786
|
+
}).isRequired,
|
|
787
|
+
maxSize: PropTypes11.bool.isRequired,
|
|
788
|
+
dragOverlay: PropTypes11.object.isRequired,
|
|
789
|
+
endIsOutOfView: PropTypes11.bool.isRequired,
|
|
790
|
+
showToolTipRight: PropTypes11.func.isRequired,
|
|
791
|
+
onResizeRightCursor: PropTypes11.func.isRequired,
|
|
792
|
+
onEndResizeCursor: PropTypes11.func.isRequired,
|
|
793
|
+
setDragging: PropTypes11.func.isRequired
|
|
794
|
+
};
|
|
795
|
+
var zoomIcon = "M 15.5 14 h -0.79 l -0.28 -0.27 C 15.41 12.59 16 11.11 16 9.5 C 16 5.91 13.09 3 9.5 3 S 3 5.91 3 9.5 S 5.91 16 9.5 16 c 1.61 0 3.09 -0.59 4.23 -1.57 l 0.27 0.28 v 0.79 l 5 4.99 L 20.49 19 l -4.99 -5 Z m -6 0 C 7.01 14 5 11.99 5 9.5 S 7.01 5 9.5 5 S 14 7.01 14 9.5 S 11.99 14 9.5 14 Z";
|
|
796
|
+
var plusSign = "M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z";
|
|
797
|
+
function ZoomIn({
|
|
798
|
+
classes,
|
|
799
|
+
origin,
|
|
800
|
+
zoomInLabel,
|
|
801
|
+
onZoomIn,
|
|
802
|
+
rcToolTipPrefixCls,
|
|
803
|
+
forwardedRef
|
|
804
|
+
}) {
|
|
805
|
+
const className = (n) => cn(n, classes);
|
|
806
|
+
return /* @__PURE__ */ jsx(
|
|
807
|
+
ToolTip,
|
|
808
|
+
{
|
|
809
|
+
placement: "left",
|
|
810
|
+
overlay: zoomInLabel,
|
|
811
|
+
children: /* @__PURE__ */ jsxs(
|
|
812
|
+
"g",
|
|
813
|
+
{
|
|
814
|
+
className: "tl-zoomInContainer",
|
|
815
|
+
ref: forwardedRef,
|
|
816
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
817
|
+
onClick: onZoomIn,
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ jsx(
|
|
820
|
+
"rect",
|
|
821
|
+
{
|
|
822
|
+
className: "tl-zoomArea",
|
|
823
|
+
x: 0,
|
|
824
|
+
y: 0,
|
|
825
|
+
width: 23,
|
|
826
|
+
height: 23
|
|
827
|
+
}
|
|
828
|
+
),
|
|
829
|
+
/* @__PURE__ */ jsx(
|
|
830
|
+
"path",
|
|
831
|
+
{
|
|
832
|
+
className: className("zoomIn"),
|
|
833
|
+
d: zoomIcon
|
|
834
|
+
}
|
|
835
|
+
),
|
|
836
|
+
/* @__PURE__ */ jsx(
|
|
837
|
+
"path",
|
|
838
|
+
{
|
|
839
|
+
className: className("zoomIn"),
|
|
840
|
+
d: plusSign
|
|
841
|
+
}
|
|
842
|
+
),
|
|
843
|
+
/* @__PURE__ */ jsx(
|
|
844
|
+
"rect",
|
|
845
|
+
{
|
|
846
|
+
className: "tl-zoomArea",
|
|
847
|
+
x: 0,
|
|
848
|
+
y: 0,
|
|
849
|
+
width: 23,
|
|
850
|
+
height: 23
|
|
851
|
+
}
|
|
852
|
+
)
|
|
853
|
+
]
|
|
854
|
+
}
|
|
855
|
+
)
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
}
|
|
859
|
+
ZoomIn.propTypes = {
|
|
860
|
+
classes: PropTypes11.object.isRequired,
|
|
861
|
+
rcToolTipPrefixCls: PropTypes11.string.isRequired,
|
|
862
|
+
origin: PropTypes11.shape({
|
|
863
|
+
x: PropTypes11.number.isRequired,
|
|
864
|
+
y: PropTypes11.number.isRequired
|
|
865
|
+
}).isRequired,
|
|
866
|
+
zoomInLabel: PropTypes11.string,
|
|
867
|
+
onZoomIn: PropTypes11.func
|
|
868
|
+
};
|
|
869
|
+
function zoomInFwd(props, ref) {
|
|
870
|
+
return /* @__PURE__ */ jsx(ZoomIn, { ...props, forwardedRef: ref });
|
|
871
|
+
}
|
|
872
|
+
var ZoomIn_default = forwardRef(zoomInFwd);
|
|
873
|
+
function LeftToolTip({
|
|
874
|
+
classes,
|
|
875
|
+
height,
|
|
876
|
+
origin,
|
|
877
|
+
isVisibleTooltipLeft,
|
|
878
|
+
startText
|
|
879
|
+
}) {
|
|
880
|
+
const className = (n) => cn(n, classes);
|
|
881
|
+
const toolTipLeft = useRef();
|
|
882
|
+
useEffect(() => {
|
|
883
|
+
if (isVisibleTooltipLeft)
|
|
884
|
+
show(toolTipLeft.current);
|
|
885
|
+
else hide(toolTipLeft.current);
|
|
886
|
+
}, [isVisibleTooltipLeft]);
|
|
887
|
+
return /* @__PURE__ */ jsxs(
|
|
888
|
+
"g",
|
|
889
|
+
{
|
|
890
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
891
|
+
className: className("toolTipArea"),
|
|
892
|
+
ref: toolTipLeft,
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ jsxs(
|
|
895
|
+
"g",
|
|
896
|
+
{
|
|
897
|
+
transform: `scale(${resizeToolTip(height)})`,
|
|
898
|
+
children: [
|
|
899
|
+
/* @__PURE__ */ jsx(
|
|
900
|
+
"rect",
|
|
901
|
+
{
|
|
902
|
+
className: className("toolTip"),
|
|
903
|
+
x: -2.5,
|
|
904
|
+
y: -8,
|
|
905
|
+
width: startText.length * 2,
|
|
906
|
+
height: 6.5,
|
|
907
|
+
rx: 1
|
|
908
|
+
}
|
|
909
|
+
),
|
|
910
|
+
/* @__PURE__ */ jsx(
|
|
911
|
+
"path",
|
|
912
|
+
{
|
|
913
|
+
className: className("toolTip"),
|
|
914
|
+
d: "M -1,-1.7 0,-0.5 1,-1.7"
|
|
915
|
+
}
|
|
916
|
+
)
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
/* @__PURE__ */ jsx(
|
|
921
|
+
"text",
|
|
922
|
+
{
|
|
923
|
+
className: className("toolTipText"),
|
|
924
|
+
style: {
|
|
925
|
+
fontSize: resizeToolTipText(height) + "px"
|
|
926
|
+
},
|
|
927
|
+
x: "-2",
|
|
928
|
+
y: -resizeToolTipText(height),
|
|
929
|
+
children: startText
|
|
930
|
+
}
|
|
931
|
+
)
|
|
932
|
+
]
|
|
933
|
+
}
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
LeftToolTip.propTypes = {
|
|
937
|
+
classes: PropTypes11.object.isRequired,
|
|
938
|
+
origin: PropTypes11.shape({
|
|
939
|
+
x: PropTypes11.number.isRequired,
|
|
940
|
+
y: PropTypes11.number.isRequired
|
|
941
|
+
}).isRequired,
|
|
942
|
+
height: PropTypes11.number.isRequired,
|
|
943
|
+
isVisibleTooltipLeft: PropTypes11.bool.isRequired,
|
|
944
|
+
startText: PropTypes11.string.isRequired
|
|
945
|
+
};
|
|
946
|
+
function RightToolTip({
|
|
947
|
+
classes,
|
|
948
|
+
origin,
|
|
949
|
+
isVisibleTooltipRight,
|
|
950
|
+
stopText,
|
|
951
|
+
height
|
|
952
|
+
}) {
|
|
953
|
+
const className = (n) => cn(n, classes);
|
|
954
|
+
const toolTipRight = useRef();
|
|
955
|
+
useEffect(() => {
|
|
956
|
+
if (isVisibleTooltipRight)
|
|
957
|
+
show(toolTipRight.current);
|
|
958
|
+
else hide(toolTipRight.current);
|
|
959
|
+
}, [isVisibleTooltipRight]);
|
|
960
|
+
return /* @__PURE__ */ jsxs(
|
|
961
|
+
"g",
|
|
962
|
+
{
|
|
963
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
964
|
+
className: className("toolTipArea"),
|
|
965
|
+
ref: toolTipRight,
|
|
966
|
+
children: [
|
|
967
|
+
/* @__PURE__ */ jsxs(
|
|
968
|
+
"g",
|
|
969
|
+
{
|
|
970
|
+
transform: `scale(-${resizeToolTip(height)},-${resizeToolTip(height)})`,
|
|
971
|
+
children: [
|
|
972
|
+
/* @__PURE__ */ jsx(
|
|
973
|
+
"rect",
|
|
974
|
+
{
|
|
975
|
+
className: className("toolTip"),
|
|
976
|
+
x: -2.5,
|
|
977
|
+
y: -8,
|
|
978
|
+
width: stopText.length * 2,
|
|
979
|
+
height: 6.5,
|
|
980
|
+
rx: 1
|
|
981
|
+
}
|
|
982
|
+
),
|
|
983
|
+
/* @__PURE__ */ jsx(
|
|
984
|
+
"path",
|
|
985
|
+
{
|
|
986
|
+
className: className("toolTip"),
|
|
987
|
+
d: "M -1,-1.7 0,-0.5 1,-1.7"
|
|
988
|
+
}
|
|
989
|
+
)
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
),
|
|
993
|
+
/* @__PURE__ */ jsx(
|
|
994
|
+
"text",
|
|
995
|
+
{
|
|
996
|
+
className: clsx3(
|
|
997
|
+
"tl-toolTipText",
|
|
998
|
+
classes.toolTipText,
|
|
999
|
+
"tl-toolTipTextRight",
|
|
1000
|
+
classes.toolTipTextRight
|
|
1001
|
+
),
|
|
1002
|
+
style: {
|
|
1003
|
+
fontSize: resizeToolTipText(height) + "px"
|
|
1004
|
+
},
|
|
1005
|
+
x: "2",
|
|
1006
|
+
y: resizeToolTipText(height) + resizeToolTipRightDelta(height),
|
|
1007
|
+
children: stopText
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
]
|
|
1011
|
+
}
|
|
1012
|
+
);
|
|
1013
|
+
}
|
|
1014
|
+
RightToolTip.propTypes = {
|
|
1015
|
+
classes: PropTypes11.object.isRequired,
|
|
1016
|
+
origin: PropTypes11.shape({
|
|
1017
|
+
x: PropTypes11.number.isRequired,
|
|
1018
|
+
y: PropTypes11.number.isRequired
|
|
1019
|
+
}).isRequired,
|
|
1020
|
+
height: PropTypes11.number.isRequired,
|
|
1021
|
+
isVisibleTooltipRight: PropTypes11.bool.isRequired,
|
|
1022
|
+
stopText: PropTypes11.string.isRequired
|
|
1023
|
+
};
|
|
1024
|
+
function Cursor({
|
|
1025
|
+
overlayWidth,
|
|
1026
|
+
overlayHeight,
|
|
1027
|
+
items,
|
|
1028
|
+
setBarHovered = identity,
|
|
1029
|
+
setToolTipVisible = identity,
|
|
1030
|
+
showHistoToolTip,
|
|
1031
|
+
tooltipVisible,
|
|
1032
|
+
barHovered,
|
|
1033
|
+
dragging,
|
|
1034
|
+
setDragging = identity,
|
|
1035
|
+
origin,
|
|
1036
|
+
height,
|
|
1037
|
+
startPos,
|
|
1038
|
+
endPos,
|
|
1039
|
+
canZoom,
|
|
1040
|
+
minZoom,
|
|
1041
|
+
maxZoom,
|
|
1042
|
+
maxSize,
|
|
1043
|
+
zoomOutLabel,
|
|
1044
|
+
zoomOut,
|
|
1045
|
+
cursorIsAfterView,
|
|
1046
|
+
cursorIsBeforeView,
|
|
1047
|
+
gotoCursorLabel,
|
|
1048
|
+
onGotoCursor,
|
|
1049
|
+
rcToolTipPrefixCls,
|
|
1050
|
+
classes = {},
|
|
1051
|
+
onStartDrawCursor,
|
|
1052
|
+
onDrawCursor,
|
|
1053
|
+
onEndCursor,
|
|
1054
|
+
onMoveDomain = identity,
|
|
1055
|
+
onMovedDomain = identity,
|
|
1056
|
+
onDragCursor,
|
|
1057
|
+
onEndDragCursor,
|
|
1058
|
+
startText,
|
|
1059
|
+
stopText,
|
|
1060
|
+
zoomInLabel,
|
|
1061
|
+
zoomIn,
|
|
1062
|
+
startIsOutOfView,
|
|
1063
|
+
endIsOutOfView,
|
|
1064
|
+
tools,
|
|
1065
|
+
onResizeLeftCursor,
|
|
1066
|
+
onResizeRightCursor,
|
|
1067
|
+
onEndResizeCursor
|
|
1068
|
+
}) {
|
|
1069
|
+
const dragOverlay = useRef();
|
|
1070
|
+
const zoomInButton = useRef();
|
|
1071
|
+
const cursorSelection = useRef();
|
|
1072
|
+
const renderIcon = cursorIsAfterView || cursorIsBeforeView;
|
|
1073
|
+
const cursorWidth = endPos - startPos < 1 ? 1 : endPos - startPos;
|
|
1074
|
+
const [isVisibleTTR, setVisibleTTR] = useState(false);
|
|
1075
|
+
const [isVisibleTTL, setVisibleTTL] = useState(false);
|
|
1076
|
+
const originSelection = {
|
|
1077
|
+
x: startPos,
|
|
1078
|
+
y: 0
|
|
1079
|
+
};
|
|
1080
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${origin.x},${origin.y})`, children: [
|
|
1081
|
+
/* @__PURE__ */ jsx(
|
|
1082
|
+
DragOverlay_default,
|
|
1083
|
+
{
|
|
1084
|
+
ref: dragOverlay,
|
|
1085
|
+
width: overlayWidth,
|
|
1086
|
+
height: overlayHeight,
|
|
1087
|
+
showToolTipLeft: setVisibleTTL,
|
|
1088
|
+
showToolTipRight: setVisibleTTR,
|
|
1089
|
+
onDrawCursor,
|
|
1090
|
+
onEndCursor,
|
|
1091
|
+
onMovedDomain,
|
|
1092
|
+
onMoveDomain,
|
|
1093
|
+
onStartDrawCursor,
|
|
1094
|
+
setToolTipVisible,
|
|
1095
|
+
setBarHovered,
|
|
1096
|
+
items,
|
|
1097
|
+
tooltipVisible,
|
|
1098
|
+
barHovered,
|
|
1099
|
+
showHistoToolTip,
|
|
1100
|
+
marginBottom: overlayHeight - height - 4,
|
|
1101
|
+
dragging,
|
|
1102
|
+
setDragging,
|
|
1103
|
+
cursorSelection
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
renderIcon && /* @__PURE__ */ jsx(
|
|
1107
|
+
CursorIcon,
|
|
1108
|
+
{
|
|
1109
|
+
classes,
|
|
1110
|
+
rcToolTipPrefixCls,
|
|
1111
|
+
origin: {
|
|
1112
|
+
x: cursorIsAfterView ? startPos - 17 : startPos - 23,
|
|
1113
|
+
y: height / 2 - 24
|
|
1114
|
+
},
|
|
1115
|
+
position: startPos === 1 ? "left" : "right",
|
|
1116
|
+
gotoCursorLabel,
|
|
1117
|
+
onGotoCursor
|
|
1118
|
+
}
|
|
1119
|
+
),
|
|
1120
|
+
/* @__PURE__ */ jsxs(
|
|
1121
|
+
"g",
|
|
1122
|
+
{
|
|
1123
|
+
style: { display: renderIcon ? "none" : void 0 },
|
|
1124
|
+
transform: `translate(${originSelection.x},${originSelection.y})`,
|
|
1125
|
+
onMouseOver: () => {
|
|
1126
|
+
canZoom && tools.zoomIn !== false && !maxZoom && show(zoomInButton.current);
|
|
1127
|
+
},
|
|
1128
|
+
onMouseOut: () => {
|
|
1129
|
+
canZoom && tools.zoomIn !== false && hide(zoomInButton.current);
|
|
1130
|
+
},
|
|
1131
|
+
children: [
|
|
1132
|
+
/* @__PURE__ */ jsx(
|
|
1133
|
+
CursorSelection_default,
|
|
1134
|
+
{
|
|
1135
|
+
ref: cursorSelection,
|
|
1136
|
+
classes,
|
|
1137
|
+
dragOverlay,
|
|
1138
|
+
maxSize,
|
|
1139
|
+
canZoom,
|
|
1140
|
+
startPos,
|
|
1141
|
+
endPos,
|
|
1142
|
+
height,
|
|
1143
|
+
showToolTipLeft: setVisibleTTL,
|
|
1144
|
+
showToolTipRight: setVisibleTTR,
|
|
1145
|
+
onDragCursor,
|
|
1146
|
+
onEndDragCursor,
|
|
1147
|
+
onMovedDomain,
|
|
1148
|
+
onMoveDomain,
|
|
1149
|
+
zoomIn,
|
|
1150
|
+
width: cursorWidth,
|
|
1151
|
+
setToolTipVisible,
|
|
1152
|
+
setBarHovered,
|
|
1153
|
+
items,
|
|
1154
|
+
tooltipVisible,
|
|
1155
|
+
barHovered,
|
|
1156
|
+
showHistoToolTip,
|
|
1157
|
+
dragging,
|
|
1158
|
+
setDragging
|
|
1159
|
+
}
|
|
1160
|
+
),
|
|
1161
|
+
/* @__PURE__ */ jsx(
|
|
1162
|
+
LeftHandle,
|
|
1163
|
+
{
|
|
1164
|
+
classes,
|
|
1165
|
+
origin: {
|
|
1166
|
+
x: 0,
|
|
1167
|
+
y: height / 2 + 2
|
|
1168
|
+
},
|
|
1169
|
+
maxSize,
|
|
1170
|
+
dragOverlay,
|
|
1171
|
+
startIsOutOfView,
|
|
1172
|
+
showToolTipLeft: setVisibleTTL,
|
|
1173
|
+
onResizeLeftCursor,
|
|
1174
|
+
onEndResizeCursor,
|
|
1175
|
+
setDragging
|
|
1176
|
+
}
|
|
1177
|
+
),
|
|
1178
|
+
/* @__PURE__ */ jsx(
|
|
1179
|
+
RightHandle,
|
|
1180
|
+
{
|
|
1181
|
+
classes,
|
|
1182
|
+
origin: {
|
|
1183
|
+
x: cursorWidth,
|
|
1184
|
+
y: height / 2 + 2
|
|
1185
|
+
},
|
|
1186
|
+
maxSize,
|
|
1187
|
+
dragOverlay,
|
|
1188
|
+
endIsOutOfView,
|
|
1189
|
+
showToolTipRight: setVisibleTTR,
|
|
1190
|
+
onResizeRightCursor,
|
|
1191
|
+
onEndResizeCursor,
|
|
1192
|
+
setDragging
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
canZoom && tools.zoomIn !== false && /* @__PURE__ */ jsx(
|
|
1196
|
+
ZoomIn_default,
|
|
1197
|
+
{
|
|
1198
|
+
ref: zoomInButton,
|
|
1199
|
+
classes,
|
|
1200
|
+
rcToolTipPrefixCls,
|
|
1201
|
+
origin: {
|
|
1202
|
+
x: cursorWidth - 25,
|
|
1203
|
+
y: 0
|
|
1204
|
+
},
|
|
1205
|
+
zoomInLabel,
|
|
1206
|
+
onZoomIn: zoomIn
|
|
1207
|
+
}
|
|
1208
|
+
),
|
|
1209
|
+
/* @__PURE__ */ jsx(
|
|
1210
|
+
LeftToolTip,
|
|
1211
|
+
{
|
|
1212
|
+
classes,
|
|
1213
|
+
origin: {
|
|
1214
|
+
x: 0,
|
|
1215
|
+
y: height / 2
|
|
1216
|
+
},
|
|
1217
|
+
height,
|
|
1218
|
+
startText,
|
|
1219
|
+
isVisibleTooltipLeft: isVisibleTTL
|
|
1220
|
+
}
|
|
1221
|
+
),
|
|
1222
|
+
/* @__PURE__ */ jsx(
|
|
1223
|
+
RightToolTip,
|
|
1224
|
+
{
|
|
1225
|
+
classes,
|
|
1226
|
+
origin: {
|
|
1227
|
+
x: cursorWidth,
|
|
1228
|
+
y: height / 2 + 4
|
|
1229
|
+
},
|
|
1230
|
+
height,
|
|
1231
|
+
stopText,
|
|
1232
|
+
isVisibleTooltipRight: isVisibleTTR
|
|
1233
|
+
}
|
|
1234
|
+
)
|
|
1235
|
+
]
|
|
1236
|
+
}
|
|
1237
|
+
),
|
|
1238
|
+
canZoom && !minZoom && tools.zoomOut !== false && /* @__PURE__ */ jsx(
|
|
1239
|
+
ZoomOut,
|
|
1240
|
+
{
|
|
1241
|
+
classes,
|
|
1242
|
+
rcToolTipPrefixCls,
|
|
1243
|
+
origin: {
|
|
1244
|
+
x: overlayWidth - 10,
|
|
1245
|
+
y: height - 20
|
|
1246
|
+
},
|
|
1247
|
+
zoomOutLabel,
|
|
1248
|
+
onZoomOut: zoomOut
|
|
1249
|
+
}
|
|
1250
|
+
)
|
|
1251
|
+
] });
|
|
1252
|
+
}
|
|
1253
|
+
Cursor.propTypes = {
|
|
1254
|
+
origin: PropTypes11.shape({
|
|
1255
|
+
x: PropTypes11.number.isRequired,
|
|
1256
|
+
y: PropTypes11.number.isRequired
|
|
1257
|
+
}).isRequired,
|
|
1258
|
+
startPos: PropTypes11.number.isRequired,
|
|
1259
|
+
startIsOutOfView: PropTypes11.bool,
|
|
1260
|
+
endPos: PropTypes11.number.isRequired,
|
|
1261
|
+
endIsOutOfView: PropTypes11.bool,
|
|
1262
|
+
height: PropTypes11.number.isRequired,
|
|
1263
|
+
overlayHeight: PropTypes11.number.isRequired,
|
|
1264
|
+
overlayWidth: PropTypes11.number.isRequired,
|
|
1265
|
+
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1266
|
+
start: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
1267
|
+
end: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
1268
|
+
x1: PropTypes11.number,
|
|
1269
|
+
x2: PropTypes11.number,
|
|
1270
|
+
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
1271
|
+
total: PropTypes11.number.isRequired
|
|
1272
|
+
})),
|
|
1273
|
+
tooltipVisible: PropTypes11.bool,
|
|
1274
|
+
barHovered: PropTypes11.number,
|
|
1275
|
+
dragging: PropTypes11.bool,
|
|
1276
|
+
setBarHovered: PropTypes11.func,
|
|
1277
|
+
setToolTipVisible: PropTypes11.func,
|
|
1278
|
+
setDragging: PropTypes11.func,
|
|
1279
|
+
cursorIsBeforeView: PropTypes11.bool,
|
|
1280
|
+
cursorIsAfterView: PropTypes11.bool,
|
|
1281
|
+
maxSize: PropTypes11.bool,
|
|
1282
|
+
startText: PropTypes11.string.isRequired,
|
|
1283
|
+
stopText: PropTypes11.string.isRequired,
|
|
1284
|
+
canZoom: PropTypes11.bool.isRequired,
|
|
1285
|
+
maxZoom: PropTypes11.bool,
|
|
1286
|
+
minZoom: PropTypes11.bool,
|
|
1287
|
+
zoomIn: PropTypes11.func,
|
|
1288
|
+
zoomOut: PropTypes11.func,
|
|
1289
|
+
onResizeLeftCursor: PropTypes11.func.isRequired,
|
|
1290
|
+
onResizeRightCursor: PropTypes11.func.isRequired,
|
|
1291
|
+
onEndResizeCursor: PropTypes11.func.isRequired,
|
|
1292
|
+
onDragCursor: PropTypes11.func.isRequired,
|
|
1293
|
+
onEndDragCursor: PropTypes11.func.isRequired,
|
|
1294
|
+
onStartDrawCursor: PropTypes11.func.isRequired,
|
|
1295
|
+
onDrawCursor: PropTypes11.func.isRequired,
|
|
1296
|
+
onEndCursor: PropTypes11.func.isRequired,
|
|
1297
|
+
onMoveDomain: PropTypes11.func,
|
|
1298
|
+
onMovedDomain: PropTypes11.func,
|
|
1299
|
+
onGotoCursor: PropTypes11.func,
|
|
1300
|
+
gotoCursorLabel: PropTypes11.string,
|
|
1301
|
+
zoomInLabel: PropTypes11.string,
|
|
1302
|
+
zoomOutLabel: PropTypes11.string,
|
|
1303
|
+
classes: PropTypes11.object,
|
|
1304
|
+
rcToolTipPrefixCls: PropTypes11.string.isRequired,
|
|
1305
|
+
tools: PropTypes11.shape({
|
|
1306
|
+
zoomIn: PropTypes11.bool,
|
|
1307
|
+
zoomOut: PropTypes11.bool
|
|
1308
|
+
})
|
|
1309
|
+
};
|
|
1310
|
+
var identity = () => {
|
|
1311
|
+
};
|
|
1312
|
+
function Histogram({
|
|
1313
|
+
classes,
|
|
1314
|
+
items,
|
|
1315
|
+
metricsDefinition,
|
|
1316
|
+
origin,
|
|
1317
|
+
barHovered,
|
|
1318
|
+
tooltipVisible,
|
|
1319
|
+
verticalScale,
|
|
1320
|
+
dragging,
|
|
1321
|
+
HistoToolTip,
|
|
1322
|
+
onFormatMetricLegend,
|
|
1323
|
+
onFormatTimeToolTips
|
|
1324
|
+
}) {
|
|
1325
|
+
if (!items) {
|
|
1326
|
+
return null;
|
|
1327
|
+
}
|
|
1328
|
+
const className = (n) => cn(n, classes);
|
|
1329
|
+
return /* @__PURE__ */ jsx("g", { transform: `translate(${origin.x}, ${origin.y})`, children: items.map((item, i) => /* @__PURE__ */ jsxs("g", { children: [
|
|
1330
|
+
metricsDefinition.colors.map((color, m) => item.metrics[m] > 0 && /* @__PURE__ */ jsx(
|
|
1331
|
+
"rect",
|
|
1332
|
+
{
|
|
1333
|
+
className: className("histoItem"),
|
|
1334
|
+
style: {
|
|
1335
|
+
fill: color.fill,
|
|
1336
|
+
stroke: color.stroke
|
|
1337
|
+
},
|
|
1338
|
+
x: item.x1,
|
|
1339
|
+
y: -verticalScale(sum(item.metrics.slice(0, m + 1))),
|
|
1340
|
+
width: item.x2 - item.x1,
|
|
1341
|
+
height: verticalScale(item.metrics[m])
|
|
1342
|
+
},
|
|
1343
|
+
m
|
|
1344
|
+
)),
|
|
1345
|
+
barHovered === i && !dragging && /* @__PURE__ */ jsx(
|
|
1346
|
+
ToolTip,
|
|
1347
|
+
{
|
|
1348
|
+
overlay: /* @__PURE__ */ jsx(
|
|
1349
|
+
HistoToolTip,
|
|
1350
|
+
{
|
|
1351
|
+
item,
|
|
1352
|
+
metricsDefinition,
|
|
1353
|
+
onFormatTimeToolTips,
|
|
1354
|
+
onFormatMetricLegend,
|
|
1355
|
+
classes
|
|
1356
|
+
}
|
|
1357
|
+
),
|
|
1358
|
+
visible: tooltipVisible,
|
|
1359
|
+
children: /* @__PURE__ */ jsx(
|
|
1360
|
+
"rect",
|
|
1361
|
+
{
|
|
1362
|
+
className: className("histoHovered"),
|
|
1363
|
+
x: item.x1,
|
|
1364
|
+
y: -item.height,
|
|
1365
|
+
width: item.x2 - item.x1,
|
|
1366
|
+
height: item.height
|
|
1367
|
+
}
|
|
1368
|
+
)
|
|
1369
|
+
}
|
|
1370
|
+
)
|
|
1371
|
+
] }, i)) });
|
|
1372
|
+
}
|
|
1373
|
+
Histogram.propTypes = {
|
|
1374
|
+
classes: PropTypes11.object,
|
|
1375
|
+
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1376
|
+
start: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
1377
|
+
end: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
1378
|
+
x1: PropTypes11.number,
|
|
1379
|
+
x2: PropTypes11.number,
|
|
1380
|
+
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
1381
|
+
total: PropTypes11.number.isRequired
|
|
1382
|
+
})),
|
|
1383
|
+
metricsDefinition: PropTypes11.shape({
|
|
1384
|
+
count: PropTypes11.number.isRequired,
|
|
1385
|
+
legends: PropTypes11.arrayOf(PropTypes11.string).isRequired,
|
|
1386
|
+
colors: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1387
|
+
fill: PropTypes11.string.isRequired,
|
|
1388
|
+
stroke: PropTypes11.string.isRequired,
|
|
1389
|
+
text: PropTypes11.string.isRequired
|
|
1390
|
+
})).isRequired
|
|
1391
|
+
}).isRequired,
|
|
1392
|
+
origin: PropTypes11.shape({
|
|
1393
|
+
x: PropTypes11.number.isRequired,
|
|
1394
|
+
y: PropTypes11.number.isRequired
|
|
1395
|
+
}).isRequired,
|
|
1396
|
+
verticalScale: PropTypes11.func.isRequired,
|
|
1397
|
+
onFormatTimeToolTips: PropTypes11.func.isRequired,
|
|
1398
|
+
onFormatMetricLegend: PropTypes11.func.isRequired,
|
|
1399
|
+
HistoToolTip: PropTypes11.elementType,
|
|
1400
|
+
barHovered: PropTypes11.number,
|
|
1401
|
+
tooltipVisible: PropTypes11.bool
|
|
1402
|
+
};
|
|
1403
|
+
|
|
1404
|
+
// src/timeLineElements/axesStyles.jsx
|
|
1405
|
+
var arrow = `m 0,-5 5,5 -5,5`;
|
|
1406
|
+
function XAxis({ min, max: max2, origin, axisWidth, marks, xAxis, classes, arrowPath = arrow, onFormatTimeLegend }) {
|
|
1407
|
+
const now = moment_shim_default();
|
|
1408
|
+
const className = (n) => cn(n, classes);
|
|
1409
|
+
return /* @__PURE__ */ jsxs(
|
|
1410
|
+
"g",
|
|
1411
|
+
{
|
|
1412
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
1413
|
+
children: [
|
|
1414
|
+
/* @__PURE__ */ jsx(
|
|
1415
|
+
"path",
|
|
1416
|
+
{
|
|
1417
|
+
className: className("axis"),
|
|
1418
|
+
d: `M 0,-6 0,6`
|
|
1419
|
+
}
|
|
1420
|
+
),
|
|
1421
|
+
/* @__PURE__ */ jsx(
|
|
1422
|
+
"path",
|
|
1423
|
+
{
|
|
1424
|
+
className: className("axis"),
|
|
1425
|
+
d: `M 0,0 ${axisWidth + 5},0`
|
|
1426
|
+
}
|
|
1427
|
+
),
|
|
1428
|
+
/* @__PURE__ */ jsx("g", { transform: `translate(${axisWidth},0)`, children: /* @__PURE__ */ jsx(
|
|
1429
|
+
"path",
|
|
1430
|
+
{
|
|
1431
|
+
className: className("arrow"),
|
|
1432
|
+
d: arrowPath
|
|
1433
|
+
}
|
|
1434
|
+
) }),
|
|
1435
|
+
marks && marks.map(
|
|
1436
|
+
(m, index) => /* @__PURE__ */ jsxs(
|
|
1437
|
+
"g",
|
|
1438
|
+
{
|
|
1439
|
+
transform: `translate(${xAxis(m)},0)`,
|
|
1440
|
+
children: [
|
|
1441
|
+
/* @__PURE__ */ jsx(
|
|
1442
|
+
"path",
|
|
1443
|
+
{
|
|
1444
|
+
className: className("limitMarker"),
|
|
1445
|
+
d: "M 0,0 0,6"
|
|
1446
|
+
}
|
|
1447
|
+
),
|
|
1448
|
+
/* @__PURE__ */ jsx(
|
|
1449
|
+
"text",
|
|
1450
|
+
{
|
|
1451
|
+
x: 0,
|
|
1452
|
+
y: 15,
|
|
1453
|
+
className: clsx3(className("timeAxisText"), timeDay(m) >= m && className("timeAxisDaysText")),
|
|
1454
|
+
children: onFormatTimeLegend(m)
|
|
1455
|
+
}
|
|
1456
|
+
)
|
|
1457
|
+
]
|
|
1458
|
+
},
|
|
1459
|
+
m.toISOString()
|
|
1460
|
+
)
|
|
1461
|
+
),
|
|
1462
|
+
xAxis && now.isSameOrBefore(max2) && now.isSameOrAfter(min) && /* @__PURE__ */ jsx(
|
|
1463
|
+
"path",
|
|
1464
|
+
{
|
|
1465
|
+
transform: `translate(${xAxis(now)},0)`,
|
|
1466
|
+
className: className("now"),
|
|
1467
|
+
d: `m -3,6 6,0 -3,-6 Z`
|
|
1468
|
+
}
|
|
1469
|
+
)
|
|
1470
|
+
]
|
|
1471
|
+
}
|
|
1472
|
+
);
|
|
1473
|
+
}
|
|
1474
|
+
XAxis.propTypes = {
|
|
1475
|
+
axisWidth: PropTypes11.number.isRequired,
|
|
1476
|
+
classes: PropTypes11.object,
|
|
1477
|
+
min: PropTypes11.instanceOf(moment_shim_default),
|
|
1478
|
+
max: PropTypes11.instanceOf(moment_shim_default),
|
|
1479
|
+
origin: PropTypes11.shape({
|
|
1480
|
+
x: PropTypes11.number.isRequired,
|
|
1481
|
+
y: PropTypes11.number.isRequired
|
|
1482
|
+
}).isRequired,
|
|
1483
|
+
marks: PropTypes11.array,
|
|
1484
|
+
xAxis: PropTypes11.func,
|
|
1485
|
+
arrowPath: PropTypes11.string,
|
|
1486
|
+
onFormatTimeLegend: PropTypes11.func.isRequired
|
|
1487
|
+
};
|
|
1488
|
+
function YAxis({ classes, marks, yAxis, onFormatMetricLegend, maxHeight, origin, arrowPath = arrow }) {
|
|
1489
|
+
const className = (n) => cn(n, classes);
|
|
1490
|
+
return /* @__PURE__ */ jsxs(
|
|
1491
|
+
"g",
|
|
1492
|
+
{
|
|
1493
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
1494
|
+
children: [
|
|
1495
|
+
/* @__PURE__ */ jsx(
|
|
1496
|
+
"path",
|
|
1497
|
+
{
|
|
1498
|
+
className: className("axis"),
|
|
1499
|
+
d: `M 0,0 0, ${-maxHeight - 5}`
|
|
1500
|
+
}
|
|
1501
|
+
),
|
|
1502
|
+
/* @__PURE__ */ jsx("g", { transform: `translate(0, ${-maxHeight}) rotate(270)`, children: /* @__PURE__ */ jsx(
|
|
1503
|
+
"path",
|
|
1504
|
+
{
|
|
1505
|
+
className: className("arrow"),
|
|
1506
|
+
d: arrowPath
|
|
1507
|
+
}
|
|
1508
|
+
) }),
|
|
1509
|
+
marks.map((m, index) => /* @__PURE__ */ jsx(
|
|
1510
|
+
"g",
|
|
1511
|
+
{
|
|
1512
|
+
transform: `translate(0,${-yAxis(m)})`,
|
|
1513
|
+
children: m > 0 && /* @__PURE__ */ jsx(
|
|
1514
|
+
"text",
|
|
1515
|
+
{
|
|
1516
|
+
transform: `translate(0,5)`,
|
|
1517
|
+
className: className("verticalAxisText"),
|
|
1518
|
+
x: -7,
|
|
1519
|
+
y: -3,
|
|
1520
|
+
children: onFormatMetricLegend(m)
|
|
1521
|
+
}
|
|
1522
|
+
)
|
|
1523
|
+
},
|
|
1524
|
+
index
|
|
1525
|
+
))
|
|
1526
|
+
]
|
|
1527
|
+
}
|
|
1528
|
+
);
|
|
1529
|
+
}
|
|
1530
|
+
YAxis.propTypes = {
|
|
1531
|
+
classes: PropTypes11.object,
|
|
1532
|
+
maxHeight: PropTypes11.number.isRequired,
|
|
1533
|
+
origin: PropTypes11.shape({
|
|
1534
|
+
x: PropTypes11.number.isRequired,
|
|
1535
|
+
y: PropTypes11.number.isRequired
|
|
1536
|
+
}).isRequired,
|
|
1537
|
+
marks: PropTypes11.array,
|
|
1538
|
+
yAxis: PropTypes11.func,
|
|
1539
|
+
arrowPath: PropTypes11.string,
|
|
1540
|
+
onFormatMetricLegend: PropTypes11.func.isRequired
|
|
1541
|
+
};
|
|
1542
|
+
function Legend({ classes, metricsDefinition, origin }) {
|
|
1543
|
+
const fill = [...metricsDefinition.colors].reverse();
|
|
1544
|
+
const legends = [...metricsDefinition.legends].reverse();
|
|
1545
|
+
const className = (n) => cn(n, classes);
|
|
1546
|
+
return /* @__PURE__ */ jsx(
|
|
1547
|
+
"g",
|
|
1548
|
+
{
|
|
1549
|
+
transform: `translate(${origin.x},${origin.y})`,
|
|
1550
|
+
children: legends.map((leg, i) => /* @__PURE__ */ jsx(
|
|
1551
|
+
"text",
|
|
1552
|
+
{
|
|
1553
|
+
className: className("legend"),
|
|
1554
|
+
style: {
|
|
1555
|
+
fill: fill[i].text
|
|
1556
|
+
},
|
|
1557
|
+
x: 0,
|
|
1558
|
+
y: 14 * (i + 1),
|
|
1559
|
+
children: /* @__PURE__ */ jsx("tspan", { children: leg })
|
|
1560
|
+
},
|
|
1561
|
+
i
|
|
1562
|
+
))
|
|
1563
|
+
}
|
|
1564
|
+
);
|
|
1565
|
+
}
|
|
1566
|
+
Legend.propTypes = {
|
|
1567
|
+
classes: PropTypes11.object.isRequired,
|
|
1568
|
+
origin: PropTypes11.shape({
|
|
1569
|
+
x: PropTypes11.number.isRequired,
|
|
1570
|
+
y: PropTypes11.number.isRequired
|
|
1571
|
+
}).isRequired,
|
|
1572
|
+
metricsDefinition: PropTypes11.shape({
|
|
1573
|
+
count: PropTypes11.number.isRequired,
|
|
1574
|
+
legends: PropTypes11.arrayOf(PropTypes11.string).isRequired,
|
|
1575
|
+
colors: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1576
|
+
fill: PropTypes11.string.isRequired,
|
|
1577
|
+
stroke: PropTypes11.string.isRequired,
|
|
1578
|
+
text: PropTypes11.string.isRequired
|
|
1579
|
+
})).isRequired
|
|
1580
|
+
}).isRequired
|
|
1581
|
+
};
|
|
1582
|
+
function Button({ tipPlacement, tipOverlay, path, origin, scale, iconSize, onClick, classes, rcToolTipPrefixCls, isActive }) {
|
|
1583
|
+
const [isOver, setOver] = useState(false);
|
|
1584
|
+
return /* @__PURE__ */ jsx(
|
|
1585
|
+
ToolTip,
|
|
1586
|
+
{
|
|
1587
|
+
placement: tipPlacement,
|
|
1588
|
+
overlay: tipOverlay,
|
|
1589
|
+
children: /* @__PURE__ */ jsxs(
|
|
1590
|
+
"g",
|
|
1591
|
+
{
|
|
1592
|
+
className: clsx3(
|
|
1593
|
+
"tl-buttonGroup",
|
|
1594
|
+
classes.buttonGroup,
|
|
1595
|
+
!isActive && "tl-buttonGroupInactive",
|
|
1596
|
+
!isActive && classes.buttonGroupInactive
|
|
1597
|
+
),
|
|
1598
|
+
transform: `translate(${origin.x},${origin.y}) scale(${scale})`,
|
|
1599
|
+
onMouseOver: (event) => {
|
|
1600
|
+
isActive && setOver(true);
|
|
1601
|
+
},
|
|
1602
|
+
onMouseOut: (event) => {
|
|
1603
|
+
isActive && setOver(false);
|
|
1604
|
+
},
|
|
1605
|
+
onClick: () => {
|
|
1606
|
+
isActive && onClick();
|
|
1607
|
+
},
|
|
1608
|
+
children: [
|
|
1609
|
+
/* @__PURE__ */ jsx(
|
|
1610
|
+
"rect",
|
|
1611
|
+
{
|
|
1612
|
+
className: clsx3(
|
|
1613
|
+
"tl-buttonOverShape",
|
|
1614
|
+
classes.buttonOverShape
|
|
1615
|
+
),
|
|
1616
|
+
x: "0",
|
|
1617
|
+
y: "0",
|
|
1618
|
+
height: iconSize,
|
|
1619
|
+
width: iconSize
|
|
1620
|
+
}
|
|
1621
|
+
),
|
|
1622
|
+
/* @__PURE__ */ jsx(
|
|
1623
|
+
"path",
|
|
1624
|
+
{
|
|
1625
|
+
className: clsx3(
|
|
1626
|
+
"tl-buttonIcon",
|
|
1627
|
+
classes.buttonIcon,
|
|
1628
|
+
isOver && "tl-buttonIconOver",
|
|
1629
|
+
isOver && classes.buttonIconOver
|
|
1630
|
+
),
|
|
1631
|
+
d: path
|
|
1632
|
+
}
|
|
1633
|
+
)
|
|
1634
|
+
]
|
|
1635
|
+
}
|
|
1636
|
+
)
|
|
1637
|
+
}
|
|
1638
|
+
);
|
|
1639
|
+
}
|
|
1640
|
+
Button.propTypes = {
|
|
1641
|
+
tipPlacement: PropTypes11.string.isRequired,
|
|
1642
|
+
tipOverlay: PropTypes11.string.isRequired,
|
|
1643
|
+
path: PropTypes11.string.isRequired,
|
|
1644
|
+
origin: PropTypes11.shape({
|
|
1645
|
+
x: PropTypes11.number.isRequired,
|
|
1646
|
+
y: PropTypes11.number.isRequired
|
|
1647
|
+
}).isRequired,
|
|
1648
|
+
scale: PropTypes11.number.isRequired,
|
|
1649
|
+
iconSize: PropTypes11.number.isRequired,
|
|
1650
|
+
onClick: PropTypes11.func.isRequired,
|
|
1651
|
+
classes: PropTypes11.object.isRequired,
|
|
1652
|
+
rcToolTipPrefixCls: PropTypes11.string.isRequired,
|
|
1653
|
+
isActive: PropTypes11.bool.isRequired
|
|
1654
|
+
};
|
|
1655
|
+
var doubleArrowIcon = "m 0,0 5,5 0,-5 5,5 -5,5 0,-5 -5,5 Z";
|
|
1656
|
+
var resetIcon = "M5 15H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zM12 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z";
|
|
1657
|
+
var gotoNowIcon = "M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z";
|
|
1658
|
+
function Tools({
|
|
1659
|
+
tools,
|
|
1660
|
+
classes,
|
|
1661
|
+
rcToolTipPrefixCls,
|
|
1662
|
+
labels,
|
|
1663
|
+
histoWidth,
|
|
1664
|
+
isActive,
|
|
1665
|
+
origin,
|
|
1666
|
+
onResetTime,
|
|
1667
|
+
shiftTimeLine,
|
|
1668
|
+
onGoto
|
|
1669
|
+
}) {
|
|
1670
|
+
return /* @__PURE__ */ jsxs(
|
|
1671
|
+
"g",
|
|
1672
|
+
{
|
|
1673
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
1674
|
+
children: [
|
|
1675
|
+
tools.slideForward !== false && /* @__PURE__ */ jsx(
|
|
1676
|
+
Button,
|
|
1677
|
+
{
|
|
1678
|
+
classes,
|
|
1679
|
+
rcToolTipPrefixCls,
|
|
1680
|
+
tipPlacement: "left",
|
|
1681
|
+
tipOverlay: labels.forwardButtonTip,
|
|
1682
|
+
origin: { x: histoWidth + 22, y: -5 },
|
|
1683
|
+
scale: 1,
|
|
1684
|
+
path: doubleArrowIcon,
|
|
1685
|
+
iconSize: 10,
|
|
1686
|
+
isActive,
|
|
1687
|
+
onClick: () => {
|
|
1688
|
+
shiftTimeLine(-120);
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1691
|
+
),
|
|
1692
|
+
tools.slideBackward !== false && /* @__PURE__ */ jsx(
|
|
1693
|
+
Button,
|
|
1694
|
+
{
|
|
1695
|
+
classes,
|
|
1696
|
+
rcToolTipPrefixCls,
|
|
1697
|
+
tipPlacement: "right",
|
|
1698
|
+
tipOverlay: labels.backwardButtonTip,
|
|
1699
|
+
origin: { x: -7, y: 5 },
|
|
1700
|
+
scale: -1,
|
|
1701
|
+
path: doubleArrowIcon,
|
|
1702
|
+
iconSize: 10,
|
|
1703
|
+
isActive,
|
|
1704
|
+
onClick: () => {
|
|
1705
|
+
shiftTimeLine(120);
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
),
|
|
1709
|
+
tools.resetTimeline !== false && /* @__PURE__ */ jsx(
|
|
1710
|
+
Button,
|
|
1711
|
+
{
|
|
1712
|
+
classes,
|
|
1713
|
+
rcToolTipPrefixCls,
|
|
1714
|
+
tipPlacement: "left",
|
|
1715
|
+
tipOverlay: labels.resetButtonTip,
|
|
1716
|
+
origin: { x: histoWidth + 17, y: -30 },
|
|
1717
|
+
scale: 0.75,
|
|
1718
|
+
path: resetIcon,
|
|
1719
|
+
iconSize: 24,
|
|
1720
|
+
isActive,
|
|
1721
|
+
onClick: onResetTime
|
|
1722
|
+
}
|
|
1723
|
+
),
|
|
1724
|
+
tools.gotoNow !== false && /* @__PURE__ */ jsx(
|
|
1725
|
+
Button,
|
|
1726
|
+
{
|
|
1727
|
+
classes,
|
|
1728
|
+
rcToolTipPrefixCls,
|
|
1729
|
+
tipPlacement: "left",
|
|
1730
|
+
tipOverlay: labels.gotoNowButtonTip,
|
|
1731
|
+
origin: { x: histoWidth + 17, y: tools.resetTimeline !== false ? -53 : -30 },
|
|
1732
|
+
scale: 0.75,
|
|
1733
|
+
path: gotoNowIcon,
|
|
1734
|
+
iconSize: 24,
|
|
1735
|
+
isActive,
|
|
1736
|
+
onClick: onGoto
|
|
1737
|
+
}
|
|
1738
|
+
)
|
|
1739
|
+
]
|
|
1740
|
+
}
|
|
1741
|
+
);
|
|
1742
|
+
}
|
|
1743
|
+
Tools.propTypes = {
|
|
1744
|
+
tools: PropTypes11.shape({
|
|
1745
|
+
slideForward: PropTypes11.bool,
|
|
1746
|
+
slideBackward: PropTypes11.bool,
|
|
1747
|
+
resetTimeline: PropTypes11.bool,
|
|
1748
|
+
gotoNow: PropTypes11.bool,
|
|
1749
|
+
cursor: PropTypes11.bool
|
|
1750
|
+
}).isRequired,
|
|
1751
|
+
classes: PropTypes11.object.isRequired,
|
|
1752
|
+
rcToolTipPrefixCls: PropTypes11.string.isRequired,
|
|
1753
|
+
labels: PropTypes11.shape({
|
|
1754
|
+
forwardButtonTip: PropTypes11.string.isRequired,
|
|
1755
|
+
backwardButtonTip: PropTypes11.string.isRequired,
|
|
1756
|
+
resetButtonTip: PropTypes11.string.isRequired,
|
|
1757
|
+
gotoNowButtonTip: PropTypes11.string.isRequired
|
|
1758
|
+
}).isRequired,
|
|
1759
|
+
histoWidth: PropTypes11.number.isRequired,
|
|
1760
|
+
isActive: PropTypes11.bool.isRequired,
|
|
1761
|
+
origin: PropTypes11.shape({
|
|
1762
|
+
x: PropTypes11.number.isRequired,
|
|
1763
|
+
y: PropTypes11.number.isRequired
|
|
1764
|
+
}).isRequired,
|
|
1765
|
+
onResetTime: PropTypes11.func.isRequired,
|
|
1766
|
+
shiftTimeLine: PropTypes11.func.isRequired,
|
|
1767
|
+
onGoto: PropTypes11.func.isRequired
|
|
1768
|
+
};
|
|
1769
|
+
function HistoTooltip({ metricsDefinition, item, onFormatTimeToolTips, onFormatMetricLegend, classes }) {
|
|
1770
|
+
const className = (n) => cn(n, classes);
|
|
1771
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1772
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1773
|
+
/* @__PURE__ */ jsxs("div", { className: className("innerTipLeft"), children: [
|
|
1774
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
1775
|
+
"\u2192"
|
|
1776
|
+
] }),
|
|
1777
|
+
/* @__PURE__ */ jsxs("div", { className: className("innerTipRight"), children: [
|
|
1778
|
+
onFormatTimeToolTips(item.start),
|
|
1779
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
1780
|
+
onFormatTimeToolTips(item.end)
|
|
1781
|
+
] })
|
|
1782
|
+
] }),
|
|
1783
|
+
/* @__PURE__ */ jsxs("div", { className: className("innerTipMetrics"), children: [
|
|
1784
|
+
metricsDefinition.colors.map((color, m) => {
|
|
1785
|
+
const reversed = metricsDefinition.colors.length - m - 1;
|
|
1786
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1787
|
+
"- ",
|
|
1788
|
+
/* @__PURE__ */ jsx("span", { style: { color: metricsDefinition.colors[reversed].stroke }, children: metricsDefinition.legends[reversed] }),
|
|
1789
|
+
/* @__PURE__ */ jsx("span", { className: className("innerTipRight"), children: onFormatMetricLegend(item.metrics[reversed]) })
|
|
1790
|
+
] }, reversed);
|
|
1791
|
+
}),
|
|
1792
|
+
/* @__PURE__ */ jsx("hr", {}),
|
|
1793
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
1794
|
+
"Total",
|
|
1795
|
+
/* @__PURE__ */ jsx("span", { className: className("innerTipRight"), children: onFormatMetricLegend(item.total) })
|
|
1796
|
+
] })
|
|
1797
|
+
] })
|
|
1798
|
+
] });
|
|
1799
|
+
}
|
|
1800
|
+
HistoTooltip.propTypes = {
|
|
1801
|
+
classes: PropTypes11.object,
|
|
1802
|
+
item: PropTypes11.shape({
|
|
1803
|
+
start: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
1804
|
+
end: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
1805
|
+
x1: PropTypes11.number,
|
|
1806
|
+
x2: PropTypes11.number,
|
|
1807
|
+
metrics: PropTypes11.arrayOf(PropTypes11.number).isRequired,
|
|
1808
|
+
total: PropTypes11.number.isRequired
|
|
1809
|
+
}),
|
|
1810
|
+
metricsDefinition: PropTypes11.shape({
|
|
1811
|
+
count: PropTypes11.number.isRequired,
|
|
1812
|
+
legends: PropTypes11.arrayOf(PropTypes11.string).isRequired,
|
|
1813
|
+
colors: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1814
|
+
fill: PropTypes11.string.isRequired,
|
|
1815
|
+
stroke: PropTypes11.string.isRequired,
|
|
1816
|
+
text: PropTypes11.string.isRequired
|
|
1817
|
+
})).isRequired
|
|
1818
|
+
}).isRequired,
|
|
1819
|
+
onFormatTimeToolTips: PropTypes11.func.isRequired,
|
|
1820
|
+
onFormatMetricLegend: PropTypes11.func.isRequired
|
|
1821
|
+
};
|
|
1822
|
+
var qualityHeight = 3;
|
|
1823
|
+
function QualityLine({ classes, rcToolTipPrefixCls, origin, quality, xAxis, qualityScale }) {
|
|
1824
|
+
const className = (n) => cn(n, classes);
|
|
1825
|
+
return /* @__PURE__ */ jsx("g", { transform: `translate(${origin.x}, ${origin.y})`, children: quality.items.map((item, i) => {
|
|
1826
|
+
const x1 = xAxis(item.time);
|
|
1827
|
+
const x2 = xAxis(moment_shim_default(item.time).add(quality.intervalMin, "minutes"));
|
|
1828
|
+
const rect = /* @__PURE__ */ jsx(
|
|
1829
|
+
"rect",
|
|
1830
|
+
{
|
|
1831
|
+
className: className("qualityCell"),
|
|
1832
|
+
style: {
|
|
1833
|
+
fill: qualityScale(item.quality)
|
|
1834
|
+
},
|
|
1835
|
+
onMouseOver: (event) => {
|
|
1836
|
+
event.target.style.fill = "#00ebeb";
|
|
1837
|
+
},
|
|
1838
|
+
onMouseOut: (event) => {
|
|
1839
|
+
event.target.style.fill = qualityScale(item.quality);
|
|
1840
|
+
},
|
|
1841
|
+
x: x1,
|
|
1842
|
+
y: 1,
|
|
1843
|
+
width: x2 - x1,
|
|
1844
|
+
height: qualityHeight
|
|
1845
|
+
},
|
|
1846
|
+
i
|
|
1847
|
+
);
|
|
1848
|
+
if (item.tip) {
|
|
1849
|
+
return /* @__PURE__ */ jsx(
|
|
1850
|
+
ToolTip,
|
|
1851
|
+
{
|
|
1852
|
+
placement: "bottom",
|
|
1853
|
+
overlay: item.tip,
|
|
1854
|
+
mouseEnterDelay: 0.1,
|
|
1855
|
+
children: rect
|
|
1856
|
+
},
|
|
1857
|
+
i
|
|
1858
|
+
);
|
|
1859
|
+
} else return rect;
|
|
1860
|
+
}) });
|
|
1861
|
+
}
|
|
1862
|
+
QualityLine.propTypes = {
|
|
1863
|
+
classes: PropTypes11.object.isRequired,
|
|
1864
|
+
rcToolTipPrefixCls: PropTypes11.string.isRequired,
|
|
1865
|
+
origin: PropTypes11.shape({
|
|
1866
|
+
x: PropTypes11.number.isRequired,
|
|
1867
|
+
y: PropTypes11.number.isRequired
|
|
1868
|
+
}).isRequired,
|
|
1869
|
+
xAxis: PropTypes11.func.isRequired,
|
|
1870
|
+
quality: PropTypes11.shape({
|
|
1871
|
+
items: PropTypes11.arrayOf(PropTypes11.shape({
|
|
1872
|
+
time: PropTypes11.instanceOf(moment_shim_default).isRequired,
|
|
1873
|
+
quality: PropTypes11.number.isRequired,
|
|
1874
|
+
tip: PropTypes11.node
|
|
1875
|
+
})),
|
|
1876
|
+
intervalMin: PropTypes11.number
|
|
1877
|
+
}).isRequired,
|
|
1878
|
+
qualityScale: PropTypes11.func.isRequired
|
|
1879
|
+
};
|
|
1880
|
+
function YAxis2({ classes, marks, yAxis, origin, xAxisWidth }) {
|
|
1881
|
+
const className = (n) => cn(n, classes);
|
|
1882
|
+
return /* @__PURE__ */ jsx(
|
|
1883
|
+
"g",
|
|
1884
|
+
{
|
|
1885
|
+
transform: `translate(${origin.x}, ${origin.y})`,
|
|
1886
|
+
children: marks.map((m, index) => /* @__PURE__ */ jsx(
|
|
1887
|
+
"g",
|
|
1888
|
+
{
|
|
1889
|
+
transform: `translate(0,${-yAxis(m)})`,
|
|
1890
|
+
children: /* @__PURE__ */ jsx(
|
|
1891
|
+
"path",
|
|
1892
|
+
{
|
|
1893
|
+
className: className("grid"),
|
|
1894
|
+
d: `M -5,0 ${xAxisWidth},0`
|
|
1895
|
+
}
|
|
1896
|
+
)
|
|
1897
|
+
},
|
|
1898
|
+
index
|
|
1899
|
+
))
|
|
1900
|
+
}
|
|
1901
|
+
);
|
|
1902
|
+
}
|
|
1903
|
+
YAxis2.propTypes = {
|
|
1904
|
+
classes: PropTypes11.object,
|
|
1905
|
+
origin: PropTypes11.shape({
|
|
1906
|
+
x: PropTypes11.number.isRequired,
|
|
1907
|
+
y: PropTypes11.number.isRequired
|
|
1908
|
+
}).isRequired,
|
|
1909
|
+
marks: PropTypes11.array,
|
|
1910
|
+
yAxis: PropTypes11.func,
|
|
1911
|
+
xAxisWidth: PropTypes11.number
|
|
1912
|
+
};
|
|
1913
|
+
function XAxis2({ origin, marks, xAxis, classes, yAxisHeight }) {
|
|
1914
|
+
const className = (n) => cn(n, classes);
|
|
1915
|
+
return /* @__PURE__ */ jsx("g", { transform: `translate(${origin.x}, ${origin.y})`, children: marks && marks.map(
|
|
1916
|
+
(m, index) => /* @__PURE__ */ jsx(
|
|
1917
|
+
"g",
|
|
1918
|
+
{
|
|
1919
|
+
transform: `translate(${xAxis(m)},0)`,
|
|
1920
|
+
children: /* @__PURE__ */ jsx(
|
|
1921
|
+
"path",
|
|
1922
|
+
{
|
|
1923
|
+
className: className("grid"),
|
|
1924
|
+
d: `M 0,0 0,${-yAxisHeight}`
|
|
1925
|
+
}
|
|
1926
|
+
)
|
|
1927
|
+
},
|
|
1928
|
+
m.toISOString()
|
|
1929
|
+
)
|
|
1930
|
+
) });
|
|
1931
|
+
}
|
|
1932
|
+
XAxis2.propTypes = {
|
|
1933
|
+
classes: PropTypes11.object,
|
|
1934
|
+
origin: PropTypes11.shape({
|
|
1935
|
+
x: PropTypes11.number.isRequired,
|
|
1936
|
+
y: PropTypes11.number.isRequired
|
|
1937
|
+
}).isRequired,
|
|
1938
|
+
marks: PropTypes11.array,
|
|
1939
|
+
xAxis: PropTypes11.func,
|
|
1940
|
+
yAxisHeight: PropTypes11.number
|
|
1941
|
+
};
|
|
1942
|
+
|
|
1943
|
+
// src/time.ts
|
|
1944
|
+
function toMoment(x, zone) {
|
|
1945
|
+
if (moment_shim_default.isMoment(x)) return x;
|
|
1946
|
+
const m = zone ? moment_shim_default.tz(x, zone) : moment_shim_default(x);
|
|
1947
|
+
return m;
|
|
1948
|
+
}
|
|
1949
|
+
function toDuration(x) {
|
|
1950
|
+
if (moment_shim_default.isDuration(x)) return x;
|
|
1951
|
+
return moment_shim_default.duration(x);
|
|
1952
|
+
}
|
|
1953
|
+
function domainToMoments(d, zone) {
|
|
1954
|
+
return { min: toMoment(d.min, zone), max: toMoment(d.max, zone) };
|
|
1955
|
+
}
|
|
1956
|
+
function timeSpanToMoments(t, zone) {
|
|
1957
|
+
return { start: toMoment(t.start, zone), stop: toMoment(t.stop, zone) };
|
|
1958
|
+
}
|
|
1959
|
+
var Cursor2 = Cursor;
|
|
1960
|
+
var Histogram2 = Histogram;
|
|
1961
|
+
var XAxis3 = XAxis;
|
|
1962
|
+
var YAxis3 = YAxis;
|
|
1963
|
+
var Legend2 = Legend;
|
|
1964
|
+
var Tools2 = Tools;
|
|
1965
|
+
var HistoToolTipDefault = HistoTooltip;
|
|
1966
|
+
var marginDefault = { left: 50, right: 45, top: 5, bottom: 5 };
|
|
1967
|
+
var xAxisDefault = { height: 20, spaceBetweenTicks: 70, barsBetweenTicks: 8 };
|
|
1968
|
+
var defaultZoomOutFactor = 1.25;
|
|
1969
|
+
var defaultTools = {
|
|
1970
|
+
slideForward: true,
|
|
1971
|
+
slideBackward: true,
|
|
1972
|
+
resetTimeline: true,
|
|
1973
|
+
gotoNow: true,
|
|
1974
|
+
cursor: true,
|
|
1975
|
+
zoomIn: true,
|
|
1976
|
+
zoomOut: true
|
|
1977
|
+
};
|
|
1978
|
+
function computeMarginAndWidth(props) {
|
|
1979
|
+
const { margin, showLegend, metricsDefinition, width } = props;
|
|
1980
|
+
const localMargin = { ...marginDefault, ...margin };
|
|
1981
|
+
if (showLegend) {
|
|
1982
|
+
const maxLength = max(metricsDefinition.legends.map((s) => s.length));
|
|
1983
|
+
localMargin.left = max([5 + maxLength * 9, localMargin.left]);
|
|
1984
|
+
}
|
|
1985
|
+
return {
|
|
1986
|
+
margin: localMargin,
|
|
1987
|
+
histoWidth: width - localMargin.left - localMargin.right
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1990
|
+
var momentToDate = (m) => m && m.toDate ? m.toDate() : m ?? null;
|
|
1991
|
+
var TimeLineInner = forwardRef(function TimeLine(props, ref) {
|
|
1992
|
+
const {
|
|
1993
|
+
width,
|
|
1994
|
+
height,
|
|
1995
|
+
histo,
|
|
1996
|
+
quality,
|
|
1997
|
+
qualityScale = defaultQualityScale,
|
|
1998
|
+
metricsDefinition,
|
|
1999
|
+
classes = {},
|
|
2000
|
+
rcToolTipPrefixCls = theme_default.rcToolTipPrefixCls,
|
|
2001
|
+
showLegend = true,
|
|
2002
|
+
tools = defaultTools,
|
|
2003
|
+
onFormatTimeLegend,
|
|
2004
|
+
onFormatMetricLegend,
|
|
2005
|
+
onResetTime,
|
|
2006
|
+
onFormatTimeToolTips,
|
|
2007
|
+
xAxis: xAxisProp = xAxisDefault,
|
|
2008
|
+
yAxis: yAxisProp = {},
|
|
2009
|
+
showHistoToolTip,
|
|
2010
|
+
HistoToolTip = HistoToolTipDefault
|
|
2011
|
+
} = props;
|
|
2012
|
+
const xAxisRef = useRef(null);
|
|
2013
|
+
const timelineElementRef = useRef(null);
|
|
2014
|
+
const autoMoveRef = useRef(null);
|
|
2015
|
+
const isAutoMovingRef = useRef(false);
|
|
2016
|
+
const lastAutoMovingDeltaRef = useRef(0);
|
|
2017
|
+
const movedSinceLastFetchedRef = useRef(0);
|
|
2018
|
+
const widthOfLastUpdateRef = useRef(null);
|
|
2019
|
+
const itemsRef = useRef([]);
|
|
2020
|
+
const labelsRef = useRef(merge({ ...defaultLabels }, props.labels));
|
|
2021
|
+
useEffect(() => {
|
|
2022
|
+
labelsRef.current = merge({ ...defaultLabels }, props.labels);
|
|
2023
|
+
}, [props.labels]);
|
|
2024
|
+
const [state, setStateRaw] = useState(() => {
|
|
2025
|
+
const initial = {
|
|
2026
|
+
isActive: false,
|
|
2027
|
+
start: props.timeSpan.start,
|
|
2028
|
+
stop: props.timeSpan.stop,
|
|
2029
|
+
maxTimespan: false,
|
|
2030
|
+
waitForLoad: false,
|
|
2031
|
+
tooltipVisible: false,
|
|
2032
|
+
barHovered: null,
|
|
2033
|
+
dragging: false,
|
|
2034
|
+
ticks: [],
|
|
2035
|
+
verticalMarks: [],
|
|
2036
|
+
...computeMarginAndWidth(props)
|
|
2037
|
+
};
|
|
2038
|
+
return {
|
|
2039
|
+
...initial,
|
|
2040
|
+
...checkAndCorrectDomainPure({
|
|
2041
|
+
domain: props.domains[0],
|
|
2042
|
+
biggestVisibleDomain: props.biggestVisibleDomain,
|
|
2043
|
+
maxDomain: props.maxDomain,
|
|
2044
|
+
smallestResolution: props.smallestResolution,
|
|
2045
|
+
histoWidth: initial.histoWidth
|
|
2046
|
+
})
|
|
2047
|
+
};
|
|
2048
|
+
});
|
|
2049
|
+
const stateRef = useRef(state);
|
|
2050
|
+
stateRef.current = state;
|
|
2051
|
+
const propsRef = useRef(props);
|
|
2052
|
+
propsRef.current = props;
|
|
2053
|
+
const patchState = useCallback((patch) => {
|
|
2054
|
+
setStateRaw((s) => ({ ...s, ...typeof patch === "function" ? patch(s) : patch }));
|
|
2055
|
+
}, []);
|
|
2056
|
+
const checkAndCorrectDomain = useCallback(({ domain: domain2 }) => {
|
|
2057
|
+
return checkAndCorrectDomainPure({
|
|
2058
|
+
domain: domain2,
|
|
2059
|
+
biggestVisibleDomain: propsRef.current.biggestVisibleDomain,
|
|
2060
|
+
maxDomain: propsRef.current.maxDomain,
|
|
2061
|
+
smallestResolution: propsRef.current.smallestResolution,
|
|
2062
|
+
histoWidth: stateRef.current.histoWidth
|
|
2063
|
+
});
|
|
2064
|
+
}, []);
|
|
2065
|
+
const getItems = useCallback((p, domain2, shouldReload = true) => {
|
|
2066
|
+
const histoWidth2 = computeMarginAndWidth(propsRef.current).histoWidth;
|
|
2067
|
+
const xAxis = scaleTime().domain([domain2.min, domain2.max]).range([0, histoWidth2]);
|
|
2068
|
+
xAxis.clamp(true);
|
|
2069
|
+
xAxisRef.current = xAxis;
|
|
2070
|
+
const ticks2 = xAxis.ticks(floor(histoWidth2 / p.xAxis.spaceBetweenTicks));
|
|
2071
|
+
const intervalMs = max([
|
|
2072
|
+
round(moment_shim_default(ticks2[1]).diff(moment_shim_default(ticks2[0])) / p.xAxis.barsBetweenTicks),
|
|
2073
|
+
propsRef.current.smallestResolution.asMilliseconds()
|
|
2074
|
+
]);
|
|
2075
|
+
patchState({ histoWidth: histoWidth2, isActive: true, ticks: ticks2 });
|
|
2076
|
+
if (shouldReload && intervalMs) {
|
|
2077
|
+
widthOfLastUpdateRef.current = p.width;
|
|
2078
|
+
patchState({ waitForLoad: true });
|
|
2079
|
+
p.onLoadHisto(intervalMs, domain2.min, domain2.max);
|
|
2080
|
+
}
|
|
2081
|
+
}, [patchState]);
|
|
2082
|
+
useEffect(() => {
|
|
2083
|
+
if (stateRef.current.domain) {
|
|
2084
|
+
getItems(propsRef.current, stateRef.current.domain);
|
|
2085
|
+
} else {
|
|
2086
|
+
propsRef.current.onLoadDefaultDomain();
|
|
2087
|
+
}
|
|
2088
|
+
patchState(computeMarginAndWidth(propsRef.current));
|
|
2089
|
+
}, []);
|
|
2090
|
+
const prevMaxTimespanRef = useRef(state.maxTimespan);
|
|
2091
|
+
useEffect(() => {
|
|
2092
|
+
if (!prevMaxTimespanRef.current && state.maxTimespan) {
|
|
2093
|
+
propsRef.current.onShowMessage(labelsRef.current.maxSelectionMsg);
|
|
2094
|
+
}
|
|
2095
|
+
prevMaxTimespanRef.current = state.maxTimespan;
|
|
2096
|
+
}, [state.maxTimespan]);
|
|
2097
|
+
const prevWidthRef = useRef(props.width);
|
|
2098
|
+
const prevMarginRef = useRef(props.margin);
|
|
2099
|
+
useEffect(() => {
|
|
2100
|
+
if (prevWidthRef.current === props.width && isEqual(prevMarginRef.current, props.margin)) {
|
|
2101
|
+
prevWidthRef.current = props.width;
|
|
2102
|
+
prevMarginRef.current = props.margin;
|
|
2103
|
+
return;
|
|
2104
|
+
}
|
|
2105
|
+
const s = stateRef.current;
|
|
2106
|
+
if (s.isActive) {
|
|
2107
|
+
const big = widthOfLastUpdateRef.current !== null && Math.abs((props.width ?? 0) - (widthOfLastUpdateRef.current ?? 0)) > 30;
|
|
2108
|
+
getItems(props, s.domain, big);
|
|
2109
|
+
patchState(computeMarginAndWidth(props));
|
|
2110
|
+
} else {
|
|
2111
|
+
patchState(computeMarginAndWidth(props));
|
|
2112
|
+
}
|
|
2113
|
+
if (stateRef.current.domain) {
|
|
2114
|
+
const res = checkAndCorrectDomain({ domain: stateRef.current.domain });
|
|
2115
|
+
const { maxZoom: maxZoom2, minZoom: minZoom2, domain: domain2, domainHasChanged, minTime, maxTime } = res;
|
|
2116
|
+
if (maxZoom2 !== stateRef.current.maxZoom || minZoom2 !== stateRef.current.minZoom) {
|
|
2117
|
+
patchState({
|
|
2118
|
+
maxZoom: maxZoom2,
|
|
2119
|
+
minZoom: minZoom2,
|
|
2120
|
+
minTime,
|
|
2121
|
+
maxTime,
|
|
2122
|
+
domain: domainHasChanged ? domain2 : stateRef.current.domain
|
|
2123
|
+
});
|
|
2124
|
+
if (domainHasChanged) {
|
|
2125
|
+
const newDomains = [domain2, ...propsRef.current.domains.slice(1)];
|
|
2126
|
+
propsRef.current.onUpdateDomains(newDomains);
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
prevWidthRef.current = props.width;
|
|
2131
|
+
prevMarginRef.current = props.margin;
|
|
2132
|
+
}, [props.width, props.margin, getItems, patchState, checkAndCorrectDomain]);
|
|
2133
|
+
const prevTimeSpanRef = useRef(props.timeSpan);
|
|
2134
|
+
useEffect(() => {
|
|
2135
|
+
const prev = prevTimeSpanRef.current;
|
|
2136
|
+
if (prev.start.isSame(props.timeSpan.start) && prev.stop.isSame(props.timeSpan.stop)) {
|
|
2137
|
+
return;
|
|
2138
|
+
}
|
|
2139
|
+
const newDomains = shiftDomainsPure(props.domains, {
|
|
2140
|
+
min: props.timeSpan.start,
|
|
2141
|
+
max: props.timeSpan.stop
|
|
2142
|
+
}, props.biggestVisibleDomain);
|
|
2143
|
+
if (newDomains !== props.domains) {
|
|
2144
|
+
props.onUpdateDomains(newDomains);
|
|
2145
|
+
}
|
|
2146
|
+
patchState({ start: props.timeSpan.start, stop: props.timeSpan.stop });
|
|
2147
|
+
prevTimeSpanRef.current = props.timeSpan;
|
|
2148
|
+
}, [props.timeSpan, props.domains, props.biggestVisibleDomain, props, patchState]);
|
|
2149
|
+
const prevDomain0Ref = useRef(props.domains[0]);
|
|
2150
|
+
useEffect(() => {
|
|
2151
|
+
const prev = prevDomain0Ref.current;
|
|
2152
|
+
const curr = props.domains[0];
|
|
2153
|
+
const changed = !prev && curr || prev && curr && (!prev.min.isSame(curr.min) || !prev.max.isSame(curr.max));
|
|
2154
|
+
if (!changed) {
|
|
2155
|
+
prevDomain0Ref.current = curr;
|
|
2156
|
+
return;
|
|
2157
|
+
}
|
|
2158
|
+
const res = checkAndCorrectDomain({ domain: curr });
|
|
2159
|
+
const { maxZoom: maxZoom2, minZoom: minZoom2, domain: domain2, domainHasChanged, minTime, maxTime } = res;
|
|
2160
|
+
patchState({ maxZoom: maxZoom2, minZoom: minZoom2, minTime, maxTime, domain: domain2 });
|
|
2161
|
+
if (domainHasChanged) {
|
|
2162
|
+
const newDomains = [domain2, ...propsRef.current.domains.slice(1)];
|
|
2163
|
+
propsRef.current.onUpdateDomains(newDomains);
|
|
2164
|
+
} else {
|
|
2165
|
+
getItems(propsRef.current, domain2);
|
|
2166
|
+
}
|
|
2167
|
+
prevDomain0Ref.current = curr;
|
|
2168
|
+
}, [props.domains, checkAndCorrectDomain, getItems, patchState]);
|
|
2169
|
+
const prevHistoRef = useRef(props.histo);
|
|
2170
|
+
useEffect(() => {
|
|
2171
|
+
if (prevHistoRef.current !== props.histo) {
|
|
2172
|
+
patchState({ waitForLoad: false });
|
|
2173
|
+
prevHistoRef.current = props.histo;
|
|
2174
|
+
}
|
|
2175
|
+
}, [props.histo, patchState]);
|
|
2176
|
+
const prevLegendsRef = useRef(props.metricsDefinition.legends);
|
|
2177
|
+
useEffect(() => {
|
|
2178
|
+
if (prevLegendsRef.current !== props.metricsDefinition.legends) {
|
|
2179
|
+
patchState(computeMarginAndWidth(propsRef.current));
|
|
2180
|
+
prevLegendsRef.current = props.metricsDefinition.legends;
|
|
2181
|
+
}
|
|
2182
|
+
}, [props.metricsDefinition.legends, patchState]);
|
|
2183
|
+
const prepareVerticalScale = useCallback(() => {
|
|
2184
|
+
const items2 = histo && histo.items;
|
|
2185
|
+
const s = stateRef.current;
|
|
2186
|
+
const maxHeight2 = height - s.margin.bottom - s.margin.top - (xAxisProp.height || xAxisDefault.height);
|
|
2187
|
+
const maxScale = items2 ? max(items2.map((i) => i.total)) || 0 : 0;
|
|
2188
|
+
const verticalScale2 = scaleLinear().domain([0, maxScale]).range([0, maxHeight2]);
|
|
2189
|
+
const verticalMarks2 = yAxisProp.spaceBetweenTicks && maxHeight2 > yAxisProp.spaceBetweenTicks * 2 ? verticalScale2.ticks(floor(maxHeight2 / yAxisProp.spaceBetweenTicks)) : [maxScale];
|
|
2190
|
+
return { verticalScale: verticalScale2, verticalMarks: verticalMarks2, maxHeight: maxHeight2 };
|
|
2191
|
+
}, [histo, height, xAxisProp, yAxisProp]);
|
|
2192
|
+
const prepareHistogram = useCallback((args) => {
|
|
2193
|
+
const { domain: domain2, verticalScale: verticalScale2 } = args;
|
|
2194
|
+
const xAxis = xAxisRef.current;
|
|
2195
|
+
if (histo && histo.items && domain2 && xAxis) {
|
|
2196
|
+
const { min, max: max2 } = domain2;
|
|
2197
|
+
return histo.items.filter(
|
|
2198
|
+
(item) => item.total > 0 && item.time.isSameOrAfter(min) && item.time.isBefore(max2)
|
|
2199
|
+
).map((item) => {
|
|
2200
|
+
const start2 = moment_shim_default(item.time);
|
|
2201
|
+
const end = moment_shim_default(item.time).add(histo.intervalMs);
|
|
2202
|
+
return {
|
|
2203
|
+
x1: xAxis(start2),
|
|
2204
|
+
x2: xAxis(end),
|
|
2205
|
+
start: start2,
|
|
2206
|
+
end,
|
|
2207
|
+
metrics: item.metrics,
|
|
2208
|
+
total: item.total,
|
|
2209
|
+
height: verticalScale2(item.total)
|
|
2210
|
+
};
|
|
2211
|
+
});
|
|
2212
|
+
}
|
|
2213
|
+
return [];
|
|
2214
|
+
}, [histo]);
|
|
2215
|
+
const setAutoMove = useCallback((active, action, delta) => {
|
|
2216
|
+
if (active) {
|
|
2217
|
+
if (!autoMoveRef.current || autoMoveRef.current && Math.abs(lastAutoMovingDeltaRef.current - (delta ?? 0)) > 5) {
|
|
2218
|
+
if (autoMoveRef.current) clearInterval(autoMoveRef.current);
|
|
2219
|
+
autoMoveRef.current = setInterval(() => {
|
|
2220
|
+
action(delta);
|
|
2221
|
+
moveTimeLine(-(delta ?? 0));
|
|
2222
|
+
isAutoMovingRef.current = true;
|
|
2223
|
+
lastAutoMovingDeltaRef.current = delta ?? 0;
|
|
2224
|
+
}, 30);
|
|
2225
|
+
}
|
|
2226
|
+
} else {
|
|
2227
|
+
if (autoMoveRef.current) clearInterval(autoMoveRef.current);
|
|
2228
|
+
autoMoveRef.current = null;
|
|
2229
|
+
}
|
|
2230
|
+
}, []);
|
|
2231
|
+
const handleAutoSliding = useCallback((mouse, action) => {
|
|
2232
|
+
if (!mouse) return;
|
|
2233
|
+
const posX = mouse[0];
|
|
2234
|
+
const s = stateRef.current;
|
|
2235
|
+
if (posX < 0) setAutoMove(true, action, posX);
|
|
2236
|
+
else if (posX >= 0 && posX <= s.histoWidth) setAutoMove(false);
|
|
2237
|
+
else if (posX > s.histoWidth) setAutoMove(true, action, posX - s.histoWidth);
|
|
2238
|
+
}, [setAutoMove]);
|
|
2239
|
+
const movedTimeLine = useCallback(() => {
|
|
2240
|
+
movedSinceLastFetchedRef.current = 0;
|
|
2241
|
+
const domain2 = stateRef.current.domain;
|
|
2242
|
+
const p = propsRef.current;
|
|
2243
|
+
const domains = [domain2, ...p.domains.slice(1)];
|
|
2244
|
+
const newDomains = shiftDomainsPure(domains, domain2, p.biggestVisibleDomain);
|
|
2245
|
+
p.onUpdateDomains(newDomains);
|
|
2246
|
+
}, []);
|
|
2247
|
+
const stopAutoMove = useCallback(() => {
|
|
2248
|
+
if (autoMoveRef.current) setAutoMove(false);
|
|
2249
|
+
if (isAutoMovingRef.current) {
|
|
2250
|
+
isAutoMovingRef.current = false;
|
|
2251
|
+
movedTimeLine();
|
|
2252
|
+
}
|
|
2253
|
+
}, [setAutoMove, movedTimeLine]);
|
|
2254
|
+
const moveTimeLineCore = useCallback((delta) => {
|
|
2255
|
+
const p = propsRef.current;
|
|
2256
|
+
const s = stateRef.current;
|
|
2257
|
+
const { maxDomain, onShowMessage } = p;
|
|
2258
|
+
let { domain: currentDomain, minTime = false, maxTime = false } = s;
|
|
2259
|
+
const currentSpan = currentDomain.max.diff(currentDomain.min);
|
|
2260
|
+
if (minTime && delta > 0 || maxTime && delta < 0) {
|
|
2261
|
+
return { ...currentDomain, moved: 0, minTime, maxTime };
|
|
2262
|
+
}
|
|
2263
|
+
const xAxis = xAxisRef.current;
|
|
2264
|
+
let min = moment_shim_default(xAxis.invert(-delta));
|
|
2265
|
+
let max2 = moment_shim_default(xAxis.invert(s.histoWidth - delta));
|
|
2266
|
+
let moved = delta;
|
|
2267
|
+
if (maxDomain.min && min.isBefore(maxDomain.min)) {
|
|
2268
|
+
moved = xAxis(maxDomain.min);
|
|
2269
|
+
min = moment_shim_default(maxDomain.min);
|
|
2270
|
+
max2 = moment_shim_default(min).add(currentSpan);
|
|
2271
|
+
minTime = true;
|
|
2272
|
+
onShowMessage(labelsRef.current.minDomainMsg);
|
|
2273
|
+
}
|
|
2274
|
+
if (maxDomain.max && max2.isAfter(maxDomain.max)) {
|
|
2275
|
+
moved = xAxis(maxDomain.max);
|
|
2276
|
+
max2 = moment_shim_default(maxDomain.max);
|
|
2277
|
+
min = moment_shim_default(max2).subtract(currentSpan);
|
|
2278
|
+
maxTime = true;
|
|
2279
|
+
onShowMessage(labelsRef.current.maxDomainMsg);
|
|
2280
|
+
}
|
|
2281
|
+
return { min, max: max2, moved, minTime, maxTime };
|
|
2282
|
+
}, []);
|
|
2283
|
+
const moveTimeLine = useCallback((delta) => {
|
|
2284
|
+
const xAxis = xAxisRef.current;
|
|
2285
|
+
xAxis.clamp(false);
|
|
2286
|
+
const { min, max: max2, moved, minTime, maxTime } = moveTimeLineCore(delta);
|
|
2287
|
+
if (moved !== 0) {
|
|
2288
|
+
xAxis.domain([min, max2]);
|
|
2289
|
+
xAxis.clamp(true);
|
|
2290
|
+
const p = propsRef.current;
|
|
2291
|
+
const s = stateRef.current;
|
|
2292
|
+
const ticks2 = xAxis.ticks(floor(s.histoWidth / p.xAxis.spaceBetweenTicks));
|
|
2293
|
+
movedSinceLastFetchedRef.current += moved;
|
|
2294
|
+
if (Math.abs(movedSinceLastFetchedRef.current) > 75 && p.fetchWhileSliding) {
|
|
2295
|
+
movedSinceLastFetchedRef.current = 0;
|
|
2296
|
+
getItems(p, { min, max: max2 });
|
|
2297
|
+
}
|
|
2298
|
+
patchState({ domain: { min, max: max2 }, minTime, maxTime, ticks: ticks2 });
|
|
2299
|
+
}
|
|
2300
|
+
}, [moveTimeLineCore, getItems, patchState]);
|
|
2301
|
+
const onResizeLeftCursor = useCallback((delta, mouse) => {
|
|
2302
|
+
const xAxis = xAxisRef.current;
|
|
2303
|
+
const s = stateRef.current;
|
|
2304
|
+
const p = propsRef.current;
|
|
2305
|
+
let newStart = moment_shim_default(xAxis.invert(xAxis(s.start) + delta));
|
|
2306
|
+
let newStop = s.stop;
|
|
2307
|
+
let maxTimespan2 = false;
|
|
2308
|
+
if (newStart.isSameOrAfter(newStop)) {
|
|
2309
|
+
newStop = moment_shim_default(xAxis.invert(xAxis(newStop) + delta));
|
|
2310
|
+
}
|
|
2311
|
+
if (p.biggestTimeSpan) {
|
|
2312
|
+
const min = moment_shim_default(newStop).subtract(p.biggestTimeSpan);
|
|
2313
|
+
if (min.isSameOrAfter(newStart)) {
|
|
2314
|
+
newStart = min;
|
|
2315
|
+
maxTimespan2 = true;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
handleAutoSliding(mouse, onResizeLeftCursor);
|
|
2319
|
+
if (newStop !== s.stop && newStop.isSameOrBefore(s.domain.max) || newStart.isSameOrAfter(s.domain.min)) {
|
|
2320
|
+
patchState({ start: newStart, stop: newStop, maxTimespan: maxTimespan2 });
|
|
2321
|
+
}
|
|
2322
|
+
}, [handleAutoSliding, patchState]);
|
|
2323
|
+
const onResizeRightCursor = useCallback((delta, mouse) => {
|
|
2324
|
+
const xAxis = xAxisRef.current;
|
|
2325
|
+
const s = stateRef.current;
|
|
2326
|
+
const p = propsRef.current;
|
|
2327
|
+
let newStop = moment_shim_default(xAxis.invert(xAxis(s.stop) + delta));
|
|
2328
|
+
let newStart = s.start;
|
|
2329
|
+
let maxTimespan2 = false;
|
|
2330
|
+
if (newStop.isSameOrBefore(newStart)) {
|
|
2331
|
+
newStart = moment_shim_default(xAxis.invert(xAxis(newStart) + delta));
|
|
2332
|
+
}
|
|
2333
|
+
if (p.biggestTimeSpan) {
|
|
2334
|
+
const max2 = moment_shim_default(newStart).add(p.biggestTimeSpan);
|
|
2335
|
+
if (max2.isSameOrBefore(newStop)) {
|
|
2336
|
+
newStop = max2;
|
|
2337
|
+
maxTimespan2 = true;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
handleAutoSliding(mouse, onResizeRightCursor);
|
|
2341
|
+
if (newStop.isSameOrBefore(s.domain.max) && newStart.isSameOrAfter(s.domain.min)) {
|
|
2342
|
+
patchState({ start: newStart, stop: newStop, maxTimespan: maxTimespan2 });
|
|
2343
|
+
}
|
|
2344
|
+
}, [handleAutoSliding, patchState]);
|
|
2345
|
+
const onDragCursor = useCallback((delta, mouse) => {
|
|
2346
|
+
const xAxis = xAxisRef.current;
|
|
2347
|
+
const s = stateRef.current;
|
|
2348
|
+
const p = propsRef.current;
|
|
2349
|
+
xAxis.clamp(false);
|
|
2350
|
+
const duration = s.stop.diff(s.start);
|
|
2351
|
+
let newStart = moment_shim_default(xAxis.invert(xAxis(s.start) + delta));
|
|
2352
|
+
let newStop = moment_shim_default(newStart).add(duration, "milliseconds");
|
|
2353
|
+
xAxis.clamp(true);
|
|
2354
|
+
const { maxDomain } = p;
|
|
2355
|
+
if (maxDomain.min && newStart.isBefore(maxDomain.min)) newStart = moment_shim_default(maxDomain.min);
|
|
2356
|
+
if (maxDomain.max && newStop.isAfter(maxDomain.max)) newStop = moment_shim_default(maxDomain.max);
|
|
2357
|
+
handleAutoSliding(mouse, onDragCursor);
|
|
2358
|
+
patchState({ start: newStart, stop: newStop });
|
|
2359
|
+
}, [handleAutoSliding, patchState]);
|
|
2360
|
+
const onStartDrawCursor = useCallback((pos) => {
|
|
2361
|
+
const xAxis = xAxisRef.current;
|
|
2362
|
+
patchState({
|
|
2363
|
+
start: moment_shim_default(xAxis.invert(pos)),
|
|
2364
|
+
stop: moment_shim_default(xAxis.invert(pos + 1)),
|
|
2365
|
+
maxTimespan: false
|
|
2366
|
+
});
|
|
2367
|
+
}, [patchState]);
|
|
2368
|
+
const onDrawCursor = useCallback((delta, mouse) => {
|
|
2369
|
+
const xAxis = xAxisRef.current;
|
|
2370
|
+
const s = stateRef.current;
|
|
2371
|
+
const p = propsRef.current;
|
|
2372
|
+
let newStop = moment_shim_default(xAxis.invert(xAxis(s.stop) + delta));
|
|
2373
|
+
let newStart = s.start;
|
|
2374
|
+
let maxTimespan2 = false;
|
|
2375
|
+
if (newStop.isSameOrBefore(newStart)) {
|
|
2376
|
+
newStart = moment_shim_default(xAxis.invert(xAxis(newStart) + delta));
|
|
2377
|
+
}
|
|
2378
|
+
if (p.biggestTimeSpan) {
|
|
2379
|
+
const max2 = moment_shim_default(newStart).add(p.biggestTimeSpan);
|
|
2380
|
+
if (max2.isSameOrBefore(newStop)) {
|
|
2381
|
+
newStop = max2;
|
|
2382
|
+
maxTimespan2 = true;
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
handleAutoSliding(mouse, onDrawCursor);
|
|
2386
|
+
if (newStop.isSameOrBefore(s.domain.max) && newStart.isSameOrAfter(s.domain.min)) {
|
|
2387
|
+
patchState({ start: newStart, stop: newStop, maxTimespan: maxTimespan2 });
|
|
2388
|
+
}
|
|
2389
|
+
}, [handleAutoSliding, patchState]);
|
|
2390
|
+
const onEndDrawCursor = useCallback(() => {
|
|
2391
|
+
stopAutoMove();
|
|
2392
|
+
const { onCustomRange, selectBarOnClick } = propsRef.current;
|
|
2393
|
+
const s = stateRef.current;
|
|
2394
|
+
let { start: start2, stop: stop2, barHovered: barHovered2 } = s;
|
|
2395
|
+
if (selectBarOnClick && itemsRef.current && barHovered2 > -1) {
|
|
2396
|
+
const item = itemsRef.current[barHovered2];
|
|
2397
|
+
if (start2.isSameOrAfter(item.start) && stop2.isSameOrBefore(item.end)) {
|
|
2398
|
+
start2 = moment_shim_default(item.start);
|
|
2399
|
+
stop2 = moment_shim_default(item.end);
|
|
2400
|
+
patchState({ start: start2, stop: stop2 });
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
onCustomRange(start2, stop2);
|
|
2404
|
+
}, [stopAutoMove, patchState]);
|
|
2405
|
+
const onEndChangeCursor = useCallback(() => {
|
|
2406
|
+
stopAutoMove();
|
|
2407
|
+
const { onCustomRange } = propsRef.current;
|
|
2408
|
+
const { start: start2, stop: stop2 } = stateRef.current;
|
|
2409
|
+
onCustomRange(start2, stop2);
|
|
2410
|
+
}, [stopAutoMove]);
|
|
2411
|
+
const zoomOnDomain = useCallback((targetDomain) => {
|
|
2412
|
+
const p = propsRef.current;
|
|
2413
|
+
const s = stateRef.current;
|
|
2414
|
+
if (s.waitForLoad) return;
|
|
2415
|
+
if (targetDomain.min.isSame(s.domain.min) && targetDomain.max.isSame(s.domain.max)) {
|
|
2416
|
+
p.onShowMessage(labelsRef.current.zoomInWithoutChangingSelectionMsg);
|
|
2417
|
+
return;
|
|
2418
|
+
}
|
|
2419
|
+
const { maxZoom: maxZoom2, domain: domain2 } = checkAndCorrectDomain({ domain: targetDomain });
|
|
2420
|
+
const { maxZoom: currentMaxZoom } = s;
|
|
2421
|
+
if (maxZoom2 && maxZoom2 !== currentMaxZoom) {
|
|
2422
|
+
p.onShowMessage(labelsRef.current.zoomSelectionResolutionExtended);
|
|
2423
|
+
}
|
|
2424
|
+
const domains = [domain2, ...p.domains];
|
|
2425
|
+
patchState({ maxZoom: maxZoom2, minZoom: false, domain: domain2 });
|
|
2426
|
+
p.onUpdateDomains(domains);
|
|
2427
|
+
}, [checkAndCorrectDomain, patchState]);
|
|
2428
|
+
const zoomOutTo = useCallback((domains) => {
|
|
2429
|
+
const res = checkAndCorrectDomain({ domain: domains[0] });
|
|
2430
|
+
const { minZoom: minZoom2, domain: domain2, domainHasChanged, maxTime, minTime } = res;
|
|
2431
|
+
const p = propsRef.current;
|
|
2432
|
+
if (minZoom2) p.onShowMessage(labelsRef.current.minZoomMsg);
|
|
2433
|
+
if (minTime) p.onShowMessage(labelsRef.current.minDomainMsg);
|
|
2434
|
+
if (maxTime) p.onShowMessage(labelsRef.current.maxDomainMsg);
|
|
2435
|
+
const newDomains = domainHasChanged ? [domain2, ...p.domains.slice(1)] : domains;
|
|
2436
|
+
patchState({ maxZoom: false, minZoom: minZoom2, domain: domain2 });
|
|
2437
|
+
p.onUpdateDomains(newDomains);
|
|
2438
|
+
}, [checkAndCorrectDomain, patchState]);
|
|
2439
|
+
const zoomOnTarget = useCallback((x) => {
|
|
2440
|
+
const xAxis = xAxisRef.current;
|
|
2441
|
+
const [minOrigin, maxOrigin] = xAxis.domain();
|
|
2442
|
+
const target = moment_shim_default(xAxis.invert(x));
|
|
2443
|
+
const min = moment_shim_default(target).subtract(0.25 * target.diff(moment_shim_default(minOrigin)));
|
|
2444
|
+
const max2 = moment_shim_default(target).add(0.25 * moment_shim_default(maxOrigin).diff(target));
|
|
2445
|
+
zoomOnDomain({ min, max: max2 });
|
|
2446
|
+
}, [zoomOnDomain]);
|
|
2447
|
+
const zoomOutOfTarget = useCallback((x) => {
|
|
2448
|
+
const xAxis = xAxisRef.current;
|
|
2449
|
+
const [minOrigin, maxOrigin] = xAxis.domain();
|
|
2450
|
+
const target = moment_shim_default(xAxis.invert(x));
|
|
2451
|
+
const min = moment_shim_default(target).subtract(1.25 * target.diff(moment_shim_default(minOrigin)));
|
|
2452
|
+
const max2 = moment_shim_default(target).add(1.25 * moment_shim_default(maxOrigin).diff(target));
|
|
2453
|
+
zoomOutTo([{ min, max: max2 }]);
|
|
2454
|
+
}, [zoomOutTo]);
|
|
2455
|
+
const zoomIn = useCallback(() => {
|
|
2456
|
+
const s = stateRef.current;
|
|
2457
|
+
if (!s.maxZoom) {
|
|
2458
|
+
zoomOnDomain({ min: s.start, max: s.stop });
|
|
2459
|
+
} else {
|
|
2460
|
+
propsRef.current.onShowMessage(labelsRef.current.doubleClickMaxZoomMsg);
|
|
2461
|
+
}
|
|
2462
|
+
}, [zoomOnDomain]);
|
|
2463
|
+
const zoomOut = useCallback(() => {
|
|
2464
|
+
const s = stateRef.current;
|
|
2465
|
+
if (s.waitForLoad || s.minZoom) return;
|
|
2466
|
+
const p = propsRef.current;
|
|
2467
|
+
const domains = [...p.domains];
|
|
2468
|
+
if (domains.length > 1) {
|
|
2469
|
+
domains.shift();
|
|
2470
|
+
} else {
|
|
2471
|
+
const xAxis = xAxisRef.current;
|
|
2472
|
+
const [minOrigin, maxOrigin] = xAxis.domain();
|
|
2473
|
+
const halfDuration = moment_shim_default(maxOrigin).diff(moment_shim_default(minOrigin)) / 2;
|
|
2474
|
+
const target = moment_shim_default(minOrigin).add(halfDuration);
|
|
2475
|
+
const zoomOutFactor = p.zoomOutFactor ?? defaultZoomOutFactor;
|
|
2476
|
+
const min = moment_shim_default(target).subtract(zoomOutFactor * halfDuration);
|
|
2477
|
+
const max2 = moment_shim_default(target).add(zoomOutFactor * halfDuration);
|
|
2478
|
+
domains[0] = { min, max: max2 };
|
|
2479
|
+
}
|
|
2480
|
+
zoomOutTo(domains);
|
|
2481
|
+
}, [zoomOutTo]);
|
|
2482
|
+
const onWheel = useCallback((event) => {
|
|
2483
|
+
const s = stateRef.current;
|
|
2484
|
+
const p = propsRef.current;
|
|
2485
|
+
event.stopPropagation();
|
|
2486
|
+
const baseX = timelineElementRef.current?.getBoundingClientRect().left ?? 0;
|
|
2487
|
+
const x = event.clientX - baseX - s.margin.left;
|
|
2488
|
+
if (s.waitForLoad) return;
|
|
2489
|
+
if (event.deltaY < -50) {
|
|
2490
|
+
if (s.maxZoom) p.onShowMessage(labelsRef.current.scrollMaxZoomMsg);
|
|
2491
|
+
else zoomOnTarget(x);
|
|
2492
|
+
} else if (event.deltaY > 50) {
|
|
2493
|
+
if (s.minZoom) p.onShowMessage(labelsRef.current.minZoomMsg);
|
|
2494
|
+
else if (p.domains.length > 1) zoomOut();
|
|
2495
|
+
else zoomOutOfTarget(x);
|
|
2496
|
+
}
|
|
2497
|
+
}, [zoomOnTarget, zoomOut, zoomOutOfTarget]);
|
|
2498
|
+
const onGotoCursor = useCallback(() => {
|
|
2499
|
+
const s = stateRef.current;
|
|
2500
|
+
const p = propsRef.current;
|
|
2501
|
+
const middle = moment_shim_default(s.start).add(s.stop.diff(s.start) / 2);
|
|
2502
|
+
const xAxis = xAxisRef.current;
|
|
2503
|
+
xAxis.clamp(false);
|
|
2504
|
+
const currentX = s.histoWidth / 2;
|
|
2505
|
+
const newX = xAxis(middle);
|
|
2506
|
+
const newDomain = moveTimeLineCore(currentX - newX);
|
|
2507
|
+
const domains = [...p.domains];
|
|
2508
|
+
domains.splice(0, 1, newDomain);
|
|
2509
|
+
const newDomains = shiftDomainsPure(domains, newDomain, p.biggestVisibleDomain);
|
|
2510
|
+
p.onUpdateDomains(newDomains);
|
|
2511
|
+
xAxis.clamp(true);
|
|
2512
|
+
}, [moveTimeLineCore]);
|
|
2513
|
+
const onGoto = useCallback((d) => {
|
|
2514
|
+
const s = stateRef.current;
|
|
2515
|
+
const p = propsRef.current;
|
|
2516
|
+
const halfTimeAgg = s.stop.diff(s.start) / 2;
|
|
2517
|
+
const when = d || moment_shim_default();
|
|
2518
|
+
const newStop = moment_shim_default(when).add(halfTimeAgg);
|
|
2519
|
+
const newStart = moment_shim_default(when).subtract(halfTimeAgg);
|
|
2520
|
+
p.onCustomRange(newStart, newStop);
|
|
2521
|
+
}, []);
|
|
2522
|
+
const shiftTimeLine = useCallback((delta) => {
|
|
2523
|
+
const incr = delta / Math.abs(delta) * 8;
|
|
2524
|
+
let i = 0;
|
|
2525
|
+
function step() {
|
|
2526
|
+
moveTimeLine(incr);
|
|
2527
|
+
i += 8;
|
|
2528
|
+
if (i < Math.abs(delta)) setTimeout(step, 10);
|
|
2529
|
+
else movedTimeLine();
|
|
2530
|
+
}
|
|
2531
|
+
step();
|
|
2532
|
+
}, [moveTimeLine, movedTimeLine]);
|
|
2533
|
+
useEffect(() => () => {
|
|
2534
|
+
if (autoMoveRef.current) clearInterval(autoMoveRef.current);
|
|
2535
|
+
}, []);
|
|
2536
|
+
useImperativeHandle(ref, () => ({ zoomIn, zoomOut, shiftTimeLine }), [zoomIn, zoomOut, shiftTimeLine]);
|
|
2537
|
+
const {
|
|
2538
|
+
isActive,
|
|
2539
|
+
domain,
|
|
2540
|
+
histoWidth,
|
|
2541
|
+
margin,
|
|
2542
|
+
start,
|
|
2543
|
+
stop,
|
|
2544
|
+
maxZoom,
|
|
2545
|
+
minZoom,
|
|
2546
|
+
maxTimespan,
|
|
2547
|
+
barHovered,
|
|
2548
|
+
tooltipVisible,
|
|
2549
|
+
ticks,
|
|
2550
|
+
dragging
|
|
2551
|
+
} = state;
|
|
2552
|
+
const xAxisHeight = xAxisProp.height || xAxisDefault.height;
|
|
2553
|
+
const pointZero = { x: 0, y: height - margin.bottom - xAxisHeight };
|
|
2554
|
+
const originCursor = { x: 0, y: margin.top - 5 };
|
|
2555
|
+
if (!isFunction(xAxisRef.current)) return null;
|
|
2556
|
+
const { verticalScale, verticalMarks, maxHeight } = prepareVerticalScale();
|
|
2557
|
+
const items = prepareHistogram({ domain, verticalScale });
|
|
2558
|
+
itemsRef.current = items;
|
|
2559
|
+
return /* @__PURE__ */ jsx(
|
|
2560
|
+
"svg",
|
|
2561
|
+
{
|
|
2562
|
+
ref: timelineElementRef,
|
|
2563
|
+
width,
|
|
2564
|
+
height,
|
|
2565
|
+
onWheel: isActive ? onWheel : void 0,
|
|
2566
|
+
children: /* @__PURE__ */ jsxs("g", { transform: `translate(${margin.left},${margin.top})`, children: [
|
|
2567
|
+
yAxisProp.showGrid && /* @__PURE__ */ jsx(
|
|
2568
|
+
YAxis2,
|
|
2569
|
+
{
|
|
2570
|
+
classes,
|
|
2571
|
+
origin: pointZero,
|
|
2572
|
+
yAxis: verticalScale,
|
|
2573
|
+
marks: verticalMarks,
|
|
2574
|
+
xAxisWidth: histoWidth + 13
|
|
2575
|
+
}
|
|
2576
|
+
),
|
|
2577
|
+
xAxisProp.showGrid && /* @__PURE__ */ jsx(
|
|
2578
|
+
XAxis2,
|
|
2579
|
+
{
|
|
2580
|
+
classes,
|
|
2581
|
+
origin: pointZero,
|
|
2582
|
+
xAxis: xAxisRef.current,
|
|
2583
|
+
marks: ticks,
|
|
2584
|
+
yAxisHeight: maxHeight
|
|
2585
|
+
}
|
|
2586
|
+
),
|
|
2587
|
+
isActive && /* @__PURE__ */ jsx(
|
|
2588
|
+
Histogram2,
|
|
2589
|
+
{
|
|
2590
|
+
classes,
|
|
2591
|
+
origin: pointZero,
|
|
2592
|
+
items,
|
|
2593
|
+
histo,
|
|
2594
|
+
verticalScale,
|
|
2595
|
+
metricsDefinition,
|
|
2596
|
+
barHovered,
|
|
2597
|
+
dragging,
|
|
2598
|
+
tooltipVisible,
|
|
2599
|
+
onFormatTimeToolTips,
|
|
2600
|
+
onFormatMetricLegend,
|
|
2601
|
+
HistoToolTip
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ jsx(
|
|
2605
|
+
XAxis3,
|
|
2606
|
+
{
|
|
2607
|
+
classes,
|
|
2608
|
+
origin: pointZero,
|
|
2609
|
+
axisWidth: histoWidth + 13,
|
|
2610
|
+
min: domain && domain.min,
|
|
2611
|
+
max: domain && domain.max,
|
|
2612
|
+
xAxis: xAxisRef.current,
|
|
2613
|
+
marks: ticks,
|
|
2614
|
+
arrowPath: xAxisProp.arrowPath,
|
|
2615
|
+
yAxisHeight: maxHeight,
|
|
2616
|
+
showGrid: xAxisProp.showGrid,
|
|
2617
|
+
onFormatTimeLegend
|
|
2618
|
+
}
|
|
2619
|
+
),
|
|
2620
|
+
/* @__PURE__ */ jsx(
|
|
2621
|
+
Tools2,
|
|
2622
|
+
{
|
|
2623
|
+
classes,
|
|
2624
|
+
rcToolTipPrefixCls,
|
|
2625
|
+
origin: pointZero,
|
|
2626
|
+
histoWidth,
|
|
2627
|
+
isActive,
|
|
2628
|
+
tools,
|
|
2629
|
+
labels: labelsRef.current,
|
|
2630
|
+
onGoto,
|
|
2631
|
+
onResetTime,
|
|
2632
|
+
shiftTimeLine
|
|
2633
|
+
}
|
|
2634
|
+
),
|
|
2635
|
+
/* @__PURE__ */ jsx(
|
|
2636
|
+
YAxis3,
|
|
2637
|
+
{
|
|
2638
|
+
classes,
|
|
2639
|
+
origin: pointZero,
|
|
2640
|
+
maxHeight,
|
|
2641
|
+
yAxis: verticalScale,
|
|
2642
|
+
marks: verticalMarks,
|
|
2643
|
+
arrowPath: yAxisProp.arrowPath,
|
|
2644
|
+
showGrid: yAxisProp.showGrid,
|
|
2645
|
+
xAxisWidth: histoWidth + 13,
|
|
2646
|
+
onFormatMetricLegend
|
|
2647
|
+
}
|
|
2648
|
+
),
|
|
2649
|
+
showLegend && /* @__PURE__ */ jsx(
|
|
2650
|
+
Legend2,
|
|
2651
|
+
{
|
|
2652
|
+
classes,
|
|
2653
|
+
origin: { x: -5, y: margin.top + 2 },
|
|
2654
|
+
metricsDefinition
|
|
2655
|
+
}
|
|
2656
|
+
),
|
|
2657
|
+
isActive && tools.cursor !== false && /* @__PURE__ */ jsx(
|
|
2658
|
+
Cursor2,
|
|
2659
|
+
{
|
|
2660
|
+
origin: originCursor,
|
|
2661
|
+
rcToolTipPrefixCls,
|
|
2662
|
+
classes,
|
|
2663
|
+
startPos: xAxisRef.current(start),
|
|
2664
|
+
startIsOutOfView: start.isBefore(domain.min) || start.isAfter(domain.max),
|
|
2665
|
+
endPos: xAxisRef.current(stop),
|
|
2666
|
+
endIsOutOfView: stop.isBefore(domain.min) || stop.isAfter(domain.max),
|
|
2667
|
+
cursorIsBeforeView: start.isBefore(domain.min) && stop.isBefore(domain.min),
|
|
2668
|
+
cursorIsAfterView: start.isAfter(domain.max) && stop.isAfter(domain.max),
|
|
2669
|
+
height: maxHeight,
|
|
2670
|
+
overlayHeight: height - margin.top,
|
|
2671
|
+
overlayWidth: histoWidth,
|
|
2672
|
+
tooltipVisible,
|
|
2673
|
+
barHovered,
|
|
2674
|
+
setToolTipVisible: (v) => patchState({ tooltipVisible: v }),
|
|
2675
|
+
setBarHovered: (b) => patchState({ barHovered: b }),
|
|
2676
|
+
items,
|
|
2677
|
+
showHistoToolTip,
|
|
2678
|
+
dragging,
|
|
2679
|
+
setDragging: (d) => patchState({ dragging: d }),
|
|
2680
|
+
canZoom: true,
|
|
2681
|
+
minZoom,
|
|
2682
|
+
maxZoom,
|
|
2683
|
+
startText: onFormatTimeToolTips(start),
|
|
2684
|
+
stopText: onFormatTimeToolTips(stop),
|
|
2685
|
+
maxSize: maxTimespan,
|
|
2686
|
+
tools,
|
|
2687
|
+
gotoCursorLabel: labelsRef.current.gotoCursor,
|
|
2688
|
+
zoomInLabel: labelsRef.current.zoomInLabel,
|
|
2689
|
+
zoomOutLabel: labelsRef.current.zoomOutLabel,
|
|
2690
|
+
zoomIn,
|
|
2691
|
+
zoomOut,
|
|
2692
|
+
onResizeLeftCursor,
|
|
2693
|
+
onResizeRightCursor,
|
|
2694
|
+
onEndResizeCursor: onEndChangeCursor,
|
|
2695
|
+
onDragCursor,
|
|
2696
|
+
onEndDragCursor: onEndChangeCursor,
|
|
2697
|
+
onStartDrawCursor,
|
|
2698
|
+
onDrawCursor,
|
|
2699
|
+
onEndCursor: onEndDrawCursor,
|
|
2700
|
+
onMoveDomain: moveTimeLine,
|
|
2701
|
+
onMovedDomain: movedTimeLine,
|
|
2702
|
+
onGotoCursor
|
|
2703
|
+
}
|
|
2704
|
+
),
|
|
2705
|
+
isActive && quality && quality.items && /* @__PURE__ */ jsx(
|
|
2706
|
+
QualityLine,
|
|
2707
|
+
{
|
|
2708
|
+
classes,
|
|
2709
|
+
rcToolTipPrefixCls,
|
|
2710
|
+
origin: pointZero,
|
|
2711
|
+
quality,
|
|
2712
|
+
qualityScale,
|
|
2713
|
+
xAxis: xAxisRef.current
|
|
2714
|
+
}
|
|
2715
|
+
)
|
|
2716
|
+
] })
|
|
2717
|
+
}
|
|
2718
|
+
);
|
|
2719
|
+
});
|
|
2720
|
+
var TimeLine2 = forwardRef(function TimeLineWrapper(props, ref) {
|
|
2721
|
+
const zone = props.timeZone;
|
|
2722
|
+
const [stack, setStack] = useState(
|
|
2723
|
+
() => props.domain ? [domainToMoments(props.domain, zone)] : []
|
|
2724
|
+
);
|
|
2725
|
+
const prevDomainRef = useRef(props.domain);
|
|
2726
|
+
useEffect(() => {
|
|
2727
|
+
if (prevDomainRef.current === props.domain) return;
|
|
2728
|
+
prevDomainRef.current = props.domain;
|
|
2729
|
+
if (!props.domain) {
|
|
2730
|
+
setStack([]);
|
|
2731
|
+
return;
|
|
2732
|
+
}
|
|
2733
|
+
const m = domainToMoments(props.domain, zone);
|
|
2734
|
+
setStack((prev) => {
|
|
2735
|
+
if (prev.length === 0) return [m];
|
|
2736
|
+
const top = prev[0];
|
|
2737
|
+
if (top.min.isSame(m.min) && top.max.isSame(m.max)) return prev;
|
|
2738
|
+
return [m, ...prev.slice(1)];
|
|
2739
|
+
});
|
|
2740
|
+
}, [props.domain, zone]);
|
|
2741
|
+
const handleUpdateDomains = useCallback((newDomains) => {
|
|
2742
|
+
setStack(newDomains);
|
|
2743
|
+
const top = newDomains[0];
|
|
2744
|
+
if (top && props.onDomainChange) {
|
|
2745
|
+
props.onDomainChange({ min: top.min.toDate(), max: top.max.toDate() });
|
|
2746
|
+
}
|
|
2747
|
+
}, [props.onDomainChange]);
|
|
2748
|
+
const handleLoadDefault = useCallback(() => {
|
|
2749
|
+
const ret = props.onLoadDefaultDomain?.();
|
|
2750
|
+
const apply = (d) => {
|
|
2751
|
+
if (!d) return;
|
|
2752
|
+
const m = domainToMoments(d, zone);
|
|
2753
|
+
setStack([m]);
|
|
2754
|
+
if (props.onDomainChange) {
|
|
2755
|
+
props.onDomainChange({ min: m.min.toDate(), max: m.max.toDate() });
|
|
2756
|
+
}
|
|
2757
|
+
};
|
|
2758
|
+
if (ret && typeof ret.then === "function") ret.then(apply);
|
|
2759
|
+
else if (ret) apply(ret);
|
|
2760
|
+
}, [props.onLoadDefaultDomain, props.onDomainChange, zone]);
|
|
2761
|
+
const innerProps = {
|
|
2762
|
+
...props,
|
|
2763
|
+
domains: stack,
|
|
2764
|
+
timeSpan: props.timeSpan ? timeSpanToMoments(props.timeSpan, zone) : void 0,
|
|
2765
|
+
maxDomain: props.maxDomain ? domainToMoments(props.maxDomain, zone) : void 0,
|
|
2766
|
+
histo: props.histo?.items ? { ...props.histo, items: props.histo.items.map((it) => ({ ...it, time: toMoment(it.time, zone) })) } : props.histo,
|
|
2767
|
+
quality: props.quality?.items ? { ...props.quality, items: props.quality.items.map((it) => ({ ...it, time: toMoment(it.time, zone) })) } : props.quality,
|
|
2768
|
+
biggestVisibleDomain: props.biggestVisibleDomain != null ? toDuration(props.biggestVisibleDomain) : void 0,
|
|
2769
|
+
biggestTimeSpan: props.biggestTimeSpan != null ? toDuration(props.biggestTimeSpan) : void 0,
|
|
2770
|
+
smallestResolution: props.smallestResolution != null ? toDuration(props.smallestResolution) : void 0,
|
|
2771
|
+
onUpdateDomains: handleUpdateDomains,
|
|
2772
|
+
onLoadDefaultDomain: handleLoadDefault,
|
|
2773
|
+
// onLoadHisto: object shape + Date instants
|
|
2774
|
+
onLoadHisto: props.onLoadHisto ? (ms, start, end) => props.onLoadHisto({ intervalMs: ms, start: momentToDate(start), end: momentToDate(end) }) : void 0,
|
|
2775
|
+
// onCustomRange → onTimeSpanChange, object shape
|
|
2776
|
+
onCustomRange: props.onTimeSpanChange ? (start, stop) => props.onTimeSpanChange({ start: momentToDate(start), stop: momentToDate(stop) }) : props.onCustomRange,
|
|
2777
|
+
onFormatTimeToolTips: props.onFormatTimeToolTips ? (t) => props.onFormatTimeToolTips(momentToDate(t)) : void 0,
|
|
2778
|
+
onFormatTimeLegend: props.onFormatTimeLegend ? (t) => props.onFormatTimeLegend(momentToDate(t)) : void 0
|
|
2779
|
+
};
|
|
2780
|
+
return /* @__PURE__ */ jsx(TimeLineInner, { ...innerProps, ref });
|
|
2781
|
+
});
|
|
2782
|
+
var TimeLine_default = TimeLine2;
|
|
2783
|
+
function checkAndCorrectDomainPure({
|
|
2784
|
+
domain,
|
|
2785
|
+
biggestVisibleDomain,
|
|
2786
|
+
maxDomain,
|
|
2787
|
+
smallestResolution,
|
|
2788
|
+
histoWidth
|
|
2789
|
+
}) {
|
|
2790
|
+
if (!domain) {
|
|
2791
|
+
return { domain, maxZoom: false, minZoom: false, domainHasChanged: false };
|
|
2792
|
+
}
|
|
2793
|
+
const newDomain = { ...domain };
|
|
2794
|
+
let domainHasChanged = false;
|
|
2795
|
+
const duration = newDomain.max.diff(newDomain.min);
|
|
2796
|
+
let maxZoom = false;
|
|
2797
|
+
const minRes = smallestResolution.asMilliseconds();
|
|
2798
|
+
if (duration <= histoWidth * minRes / 15) {
|
|
2799
|
+
maxZoom = true;
|
|
2800
|
+
newDomain.max = moment_shim_default(newDomain.min).add(histoWidth * minRes / 15, "ms");
|
|
2801
|
+
}
|
|
2802
|
+
let minTime;
|
|
2803
|
+
let maxTime;
|
|
2804
|
+
if (maxDomain?.min && newDomain.min.isBefore(maxDomain.min)) {
|
|
2805
|
+
newDomain.min = moment_shim_default(maxDomain.min);
|
|
2806
|
+
minTime = true;
|
|
2807
|
+
}
|
|
2808
|
+
if (maxDomain?.max && newDomain.max.isAfter(maxDomain.max)) {
|
|
2809
|
+
newDomain.max = moment_shim_default(maxDomain.max);
|
|
2810
|
+
maxTime = true;
|
|
2811
|
+
}
|
|
2812
|
+
let minZoom = false;
|
|
2813
|
+
if (biggestVisibleDomain && newDomain.max.isSameOrAfter(moment_shim_default(newDomain.min).add(biggestVisibleDomain))) {
|
|
2814
|
+
minZoom = true;
|
|
2815
|
+
newDomain.min = moment_shim_default(newDomain.max).subtract(biggestVisibleDomain);
|
|
2816
|
+
}
|
|
2817
|
+
if (!(newDomain.min.isSame(domain.min) && newDomain.max.isSame(domain.max))) {
|
|
2818
|
+
domainHasChanged = true;
|
|
2819
|
+
}
|
|
2820
|
+
return {
|
|
2821
|
+
domain: domainHasChanged ? newDomain : domain,
|
|
2822
|
+
maxZoom,
|
|
2823
|
+
minZoom,
|
|
2824
|
+
maxTime,
|
|
2825
|
+
minTime,
|
|
2826
|
+
domainHasChanged
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
function shiftDomainsPure(domains, { min, max: max2 }, biggestVisibleDomain) {
|
|
2830
|
+
let toUpdate = false;
|
|
2831
|
+
const newDomains = domains.map((domain, index) => {
|
|
2832
|
+
if (min && min.isBefore(domain.min) || max2 && max2.isAfter(domain.max)) {
|
|
2833
|
+
toUpdate = true;
|
|
2834
|
+
if (index === domains.length - 1) {
|
|
2835
|
+
const newDomain = {
|
|
2836
|
+
min: min && min.isBefore(domain.min) ? min : domain.min,
|
|
2837
|
+
max: max2 && max2.isAfter(domain.max) ? max2 : domain.max
|
|
2838
|
+
};
|
|
2839
|
+
if (biggestVisibleDomain && moment_shim_default(newDomain.min).add(biggestVisibleDomain).isSameOrBefore(newDomain.max)) {
|
|
2840
|
+
if (min.isBefore(domain.min)) newDomain.max = moment_shim_default(min).add(biggestVisibleDomain);
|
|
2841
|
+
else newDomain.min = moment_shim_default(max2).subtract(biggestVisibleDomain);
|
|
2842
|
+
}
|
|
2843
|
+
return newDomain;
|
|
2844
|
+
}
|
|
2845
|
+
if (min && min.isBefore(domain.min)) {
|
|
2846
|
+
return { min, max: moment_shim_default(domain.max).subtract(domain.min.diff(min)) };
|
|
2847
|
+
}
|
|
2848
|
+
return { min: moment_shim_default(domain.min).add(max2.diff(domain.max)), max: max2 };
|
|
2849
|
+
}
|
|
2850
|
+
return domain;
|
|
2851
|
+
});
|
|
2852
|
+
return toUpdate ? newDomains : domains;
|
|
2853
|
+
}
|
|
2854
|
+
var defaultWidth = 900;
|
|
2855
|
+
var defaultHeight = 100;
|
|
2856
|
+
function TimeLineResizer(props) {
|
|
2857
|
+
const [dimensions, setDimensions] = useState({
|
|
2858
|
+
width: defaultWidth,
|
|
2859
|
+
height: defaultHeight
|
|
2860
|
+
});
|
|
2861
|
+
const container = useRef(null);
|
|
2862
|
+
const onViewResize = () => {
|
|
2863
|
+
if (container.current) {
|
|
2864
|
+
setDimensions({
|
|
2865
|
+
width: container.current.clientWidth,
|
|
2866
|
+
height: container.current.clientHeight
|
|
2867
|
+
});
|
|
2868
|
+
}
|
|
2869
|
+
};
|
|
2870
|
+
useEffect(() => {
|
|
2871
|
+
if (container.current) {
|
|
2872
|
+
onViewResize();
|
|
2873
|
+
window.addEventListener("resize", onViewResize);
|
|
2874
|
+
}
|
|
2875
|
+
}, [container.current]);
|
|
2876
|
+
return /* @__PURE__ */ jsx(
|
|
2877
|
+
"div",
|
|
2878
|
+
{
|
|
2879
|
+
ref: container,
|
|
2880
|
+
className: "tl-root tl-timelineContainer",
|
|
2881
|
+
children: /* @__PURE__ */ jsx(
|
|
2882
|
+
TimeLine_default,
|
|
2883
|
+
{
|
|
2884
|
+
ref: props.forwardedRef,
|
|
2885
|
+
width: dimensions.width,
|
|
2886
|
+
height: dimensions.height,
|
|
2887
|
+
...props
|
|
2888
|
+
}
|
|
2889
|
+
)
|
|
2890
|
+
}
|
|
2891
|
+
);
|
|
2892
|
+
}
|
|
2893
|
+
function timeLineFwd(props, ref) {
|
|
2894
|
+
return /* @__PURE__ */ jsx(TimeLineResizer, { ...props, forwardedRef: ref });
|
|
2895
|
+
}
|
|
2896
|
+
var TimeLineResizer_default = forwardRef(timeLineFwd);
|
|
2897
|
+
|
|
2898
|
+
// src/index.ts
|
|
2899
|
+
var _TimeLine = TimeLine_default;
|
|
2900
|
+
var _TimeLineResizer = TimeLineResizer_default;
|
|
2901
|
+
var _Cursor = Cursor;
|
|
2902
|
+
var index_default = _TimeLineResizer;
|
|
2903
|
+
|
|
2904
|
+
export { _Cursor as Cursor, _TimeLine as TimeLine, index_default as default };
|
|
2905
|
+
//# sourceMappingURL=index.mjs.map
|
|
2906
|
+
//# sourceMappingURL=index.mjs.map
|