@splunk/visualizations 28.7.0 → 28.8.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/Area.js +2 -2
- package/Area.js.map +2 -2
- package/Bar.js +2 -2
- package/Bar.js.map +2 -2
- package/Bubble.js +2 -2
- package/Bubble.js.map +2 -2
- package/CHANGELOG.external.md +26 -0
- package/ChoroplethSvg.js +2 -2
- package/ChoroplethSvg.js.map +2 -2
- package/Column.js +2 -2
- package/Column.js.map +2 -2
- package/Ellipse.js +2 -2
- package/Ellipse.js.map +2 -2
- package/Events.js +2 -2
- package/Events.js.map +2 -2
- package/FillerGauge.js +10 -5
- package/FillerGauge.js.map +2 -2
- package/Image.js +2 -2
- package/Image.js.map +2 -2
- package/Line.js +2 -2
- package/Line.js.map +2 -2
- package/LinkGraph.js +2 -2
- package/LinkGraph.js.map +2 -2
- package/Map.js +2 -2
- package/Map.js.map +2 -2
- package/Markdown.config.js +1 -1
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +3 -3
- package/Markdown.js.map +2 -2
- package/MarkerGauge.js +10 -5
- package/MarkerGauge.js.map +2 -2
- package/NetworkGraph.js +2 -2
- package/NetworkGraph.js.map +2 -2
- package/ParallelCoordinates.js +2 -2
- package/ParallelCoordinates.js.map +2 -2
- package/Pie.js +2 -2
- package/Pie.js.map +2 -2
- package/ProcessTree.js +2 -2
- package/ProcessTree.js.map +2 -2
- package/Punchcard.js +2 -2
- package/Punchcard.js.map +2 -2
- package/Rectangle.js +2 -2
- package/Rectangle.js.map +2 -2
- package/RichText/PureRichText/Editor/EditorPanel.d.ts.map +1 -1
- package/RichText/PureRichText/InnerEditor.d.ts +10 -0
- package/RichText/PureRichText/InnerEditor.d.ts.map +1 -1
- package/RichText/PureRichText/PureRichText.d.ts +17 -0
- package/RichText/PureRichText/PureRichText.d.ts.map +1 -1
- package/RichText/PureRichText/PureRichTextContext.d.ts.map +1 -1
- package/RichText/PureRichText/hooks/useContentSave.d.ts +6 -0
- package/RichText/PureRichText/hooks/useContentSave.d.ts.map +1 -1
- package/RichText/PureRichText/hooks/useContentSync.d.ts +13 -1
- package/RichText/PureRichText/hooks/useContentSync.d.ts.map +1 -1
- package/RichText/PureRichText/hooks/useDashboardKeyboardNav.d.ts.map +1 -1
- package/RichText/PureRichText/hooks/useEditorSetup.d.ts.map +1 -1
- package/RichText/PureRichText/hooks/useFakeHighlight.d.ts +1 -16
- package/RichText/PureRichText/hooks/useFakeHighlight.d.ts.map +1 -1
- package/RichText/PureRichText/hooks/useTokenMap.d.ts +37 -35
- package/RichText/PureRichText/hooks/useTokenMap.d.ts.map +1 -1
- package/RichText/PureRichText/renderers/LeafRenderer.d.ts +0 -4
- package/RichText/PureRichText/renderers/LeafRenderer.d.ts.map +1 -1
- package/RichText/PureRichText/types.d.ts +15 -0
- package/RichText/PureRichText/types.d.ts.map +1 -1
- package/RichText/PureRichText/utils/slateUtils.d.ts.map +1 -1
- package/RichText/RichText.d.ts +2 -0
- package/RichText/RichText.d.ts.map +1 -1
- package/RichText/config.d.ts.map +1 -1
- package/RichText.config.js +14 -1
- package/RichText.config.js.map +2 -2
- package/RichText.js +733 -263
- package/RichText.js.map +4 -4
- package/Sankey.js +2 -2
- package/Sankey.js.map +2 -2
- package/Scatter.js +2 -2
- package/Scatter.js.map +2 -2
- package/SingleValue.js +2 -2
- package/SingleValue.js.map +2 -2
- package/SingleValueIcon.js +2 -2
- package/SingleValueIcon.js.map +2 -2
- package/SingleValueRadial.js +2 -2
- package/SingleValueRadial.js.map +2 -2
- package/Table/PureTable.d.ts +2 -0
- package/Table/PureTable.d.ts.map +1 -1
- package/Table/config.d.ts.map +1 -1
- package/Table.config.js +7 -0
- package/Table.config.js.map +2 -2
- package/Table.js +91 -9
- package/Table.js.map +4 -4
- package/Timeline/PureTimeline/PureTimeline.d.ts +6 -5
- package/Timeline/PureTimeline/PureTimeline.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/CursorPlugin.d.ts +1 -0
- package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineLegend.d.ts +10 -7
- package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineTooltip.d.ts +5 -1
- package/Timeline/PureTimeline/src/TimelineTooltip.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineUplot.d.ts +19 -2
- package/Timeline/PureTimeline/src/TimelineUplot.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineYAxis.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/XAxisPlugin.d.ts +1 -0
- package/Timeline/PureTimeline/src/XAxisPlugin.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/utils/timelineUtils.d.ts +8 -0
- package/Timeline/PureTimeline/src/utils/timelineUtils.d.ts.map +1 -1
- package/Timeline.js +449 -211
- package/Timeline.js.map +4 -4
- package/Treemap/PureTreemap/components/PureTreemap.d.ts +42 -0
- package/Treemap/PureTreemap/components/PureTreemap.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapBreadcrumb.d.ts +10 -0
- package/Treemap/PureTreemap/components/TreemapBreadcrumb.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapChildCell.d.ts +28 -0
- package/Treemap/PureTreemap/components/TreemapChildCell.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapHeader.d.ts +19 -0
- package/Treemap/PureTreemap/components/TreemapHeader.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapHoverTarget.d.ts +17 -0
- package/Treemap/PureTreemap/components/TreemapHoverTarget.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapLegend.d.ts +20 -0
- package/Treemap/PureTreemap/components/TreemapLegend.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapNode.d.ts +5 -0
- package/Treemap/PureTreemap/components/TreemapNode.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapParentNode.d.ts +10 -0
- package/Treemap/PureTreemap/components/TreemapParentNode.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapStandaloneNode.d.ts +6 -0
- package/Treemap/PureTreemap/components/TreemapStandaloneNode.d.ts.map +1 -0
- package/Treemap/PureTreemap/components/TreemapTooltip.d.ts +17 -0
- package/Treemap/PureTreemap/components/TreemapTooltip.d.ts.map +1 -0
- package/Treemap/PureTreemap/mockdata/data.d.ts +90 -0
- package/Treemap/PureTreemap/mockdata/data.d.ts.map +1 -0
- package/Treemap/PureTreemap/utils/treemapColorUtils.d.ts +67 -0
- package/Treemap/PureTreemap/utils/treemapColorUtils.d.ts.map +1 -0
- package/Treemap/PureTreemap/utils/treemapDataColorUtils.d.ts +5 -0
- package/Treemap/PureTreemap/utils/treemapDataColorUtils.d.ts.map +1 -0
- package/Treemap/PureTreemap/utils/treemapDataUtils.d.ts +14 -0
- package/Treemap/PureTreemap/utils/treemapDataUtils.d.ts.map +1 -0
- package/Treemap/PureTreemap/utils/treemapLayout.d.ts +49 -0
- package/Treemap/PureTreemap/utils/treemapLayout.d.ts.map +1 -0
- package/Treemap/PureTreemap/utils/treemapNodeUtils.d.ts +81 -0
- package/Treemap/PureTreemap/utils/treemapNodeUtils.d.ts.map +1 -0
- package/Treemap/PureTreemap/utils/treemapTypes.d.ts +37 -0
- package/Treemap/PureTreemap/utils/treemapTypes.d.ts.map +1 -0
- package/Treemap/PureTreemap/utils/treemapUtils.d.ts +76 -0
- package/Treemap/PureTreemap/utils/treemapUtils.d.ts.map +1 -0
- package/Treemap/Treemap.d.ts +12 -0
- package/Treemap/Treemap.d.ts.map +1 -0
- package/Treemap/config.d.ts +4 -0
- package/Treemap/config.d.ts.map +1 -0
- package/Treemap/index.d.ts +3 -0
- package/Treemap/index.d.ts.map +1 -0
- package/Treemap.config.js +465 -0
- package/Treemap.config.js.map +7 -0
- package/Treemap.js +6233 -0
- package/Treemap.js.map +7 -0
- package/common/DocExampleWithVizSandbox.js.map +2 -2
- package/common/GaugeMajorTicks.js.map +2 -2
- package/common/GaugeValueMarker.js +1 -0
- package/common/GaugeValueMarker.js.map +2 -2
- package/common/OverviewDoc.js.map +2 -2
- package/common/docUtils.d.ts.map +1 -1
- package/common/docUtils.js +1 -8
- package/common/docUtils.js.map +2 -2
- package/common/gaugeUtils.d.ts.map +1 -1
- package/common/gaugeUtils.js +7 -3
- package/common/gaugeUtils.js.map +2 -2
- package/common/hocs/FixedSizeContainer.d.ts.map +1 -1
- package/common/hooks/useDynamicHeight.d.ts +67 -0
- package/common/hooks/useDynamicHeight.d.ts.map +1 -0
- package/common/interfaces/VizCategory.d.ts +2 -1
- package/common/interfaces/VizCategory.d.ts.map +1 -1
- package/common/withDashboardViz.js +2 -2
- package/common/withDashboardViz.js.map +2 -2
- package/docs-llm/INDEX.md +1 -0
- package/docs-llm/area/options.md +84 -84
- package/docs-llm/bar/options.md +77 -77
- package/docs-llm/bubble/options.md +51 -51
- package/docs-llm/choropleth-svg/options.md +5 -5
- package/docs-llm/column/options.md +82 -82
- package/docs-llm/ellipse/options.md +6 -6
- package/docs-llm/events/options.md +6 -6
- package/docs-llm/filler-gauge/options.md +16 -16
- package/docs-llm/image/options.md +3 -3
- package/docs-llm/line/options.md +82 -82
- package/docs-llm/link-graph/options.md +16 -16
- package/docs-llm/map/options.md +12 -12
- package/docs-llm/markdown/options.md +7 -7
- package/docs-llm/marker-gauge/options.md +16 -16
- package/docs-llm/network-graph/options.md +39 -39
- package/docs-llm/parallel-coordinates/options.md +4 -4
- package/docs-llm/pie/options.md +23 -23
- package/docs-llm/process-tree/options.md +22 -22
- package/docs-llm/punchcard/options.md +23 -23
- package/docs-llm/pure-rich-text/options.md +6 -5
- package/docs-llm/rectangle/options.md +9 -9
- package/docs-llm/rich-text/options.md +6 -5
- package/docs-llm/sankey/options.md +9 -9
- package/docs-llm/scatter/options.md +57 -57
- package/docs-llm/single-value/options.md +39 -39
- package/docs-llm/single-value-icon/options.md +33 -33
- package/docs-llm/single-value-radial/options.md +31 -31
- package/docs-llm/table/options.md +14 -13
- package/docs-llm/timeline/options.md +17 -17
- package/docs-llm/treemap/examples-json.md +5 -0
- package/docs-llm/treemap/examples-react.md +5 -0
- package/docs-llm/treemap/options.md +26 -0
- package/docs-llm/treemap/overview.md +27 -0
- package/package.json +28 -27
package/Timeline.js
CHANGED
|
@@ -875,7 +875,7 @@ var Cover = styled_components_default.div`
|
|
|
875
875
|
bottom: 0;
|
|
876
876
|
`;
|
|
877
877
|
var Blocker = styled_components_default.div.attrs({
|
|
878
|
-
"data-splunk-visualization-version": "28.
|
|
878
|
+
"data-splunk-visualization-version": "28.8.0 - 633c53372"
|
|
879
879
|
})`
|
|
880
880
|
position: relative;
|
|
881
881
|
width: 100%;
|
|
@@ -956,7 +956,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
956
956
|
FixSizeItem,
|
|
957
957
|
{
|
|
958
958
|
"data-test": "fix-size-item",
|
|
959
|
-
"data-splunk-visualization-version": "28.
|
|
959
|
+
"data-splunk-visualization-version": "28.8.0 - 633c53372",
|
|
960
960
|
width,
|
|
961
961
|
height,
|
|
962
962
|
backgroundColor
|
|
@@ -3116,6 +3116,19 @@ var tooltipLocaleTimeFormat = (displaySeconds) => {
|
|
|
3116
3116
|
year: "numeric"
|
|
3117
3117
|
}, seconds);
|
|
3118
3118
|
};
|
|
3119
|
+
var MAX_TOOLTIP_MOVE_TRANSITION_DISTANCE = 200;
|
|
3120
|
+
var isNearbyTooltipAnchor = ({
|
|
3121
|
+
anchorPoint,
|
|
3122
|
+
previousAnchorPoint
|
|
3123
|
+
}) => {
|
|
3124
|
+
if (!previousAnchorPoint) {
|
|
3125
|
+
return false;
|
|
3126
|
+
}
|
|
3127
|
+
const deltaX = anchorPoint.x - previousAnchorPoint.x;
|
|
3128
|
+
const deltaY = anchorPoint.y - previousAnchorPoint.y;
|
|
3129
|
+
const distance = Math.hypot(deltaX, deltaY);
|
|
3130
|
+
return distance > 0 && distance <= MAX_TOOLTIP_MOVE_TRANSITION_DISTANCE;
|
|
3131
|
+
};
|
|
3119
3132
|
var applyCanvasScale = (u, scaleFactor) => {
|
|
3120
3133
|
var _a;
|
|
3121
3134
|
if (!((_a = u.ctx) == null ? void 0 : _a.canvas)) {
|
|
@@ -3163,9 +3176,22 @@ var ZoomContext_default = "default" in defaultImport39 ? defaultImport39.default
|
|
|
3163
3176
|
|
|
3164
3177
|
// src/Timeline/PureTimeline/src/CursorPlugin.tsx
|
|
3165
3178
|
var FIXED_LANE_HEIGHT = 32;
|
|
3166
|
-
var MIN_BAR_WIDTH =
|
|
3167
|
-
var
|
|
3179
|
+
var MIN_BAR_WIDTH = 1;
|
|
3180
|
+
var MIN_BAR_HOVER_WIDTH = 6;
|
|
3168
3181
|
var CIRCLE_LANE_SCALE_FACTOR = 0.85;
|
|
3182
|
+
var EVENT_VERTICAL_HIT_PADDING = FIXED_LANE_HEIGHT * (1 - CIRCLE_LANE_SCALE_FACTOR) / 2;
|
|
3183
|
+
var TIMELINE_TOOLTIP_WIDTH = 300;
|
|
3184
|
+
var shouldClearOnPointerExit = (event, chartContainer) => {
|
|
3185
|
+
const { relatedTarget } = event;
|
|
3186
|
+
if (event.currentTarget !== chartContainer && relatedTarget !== null) {
|
|
3187
|
+
return false;
|
|
3188
|
+
}
|
|
3189
|
+
if (relatedTarget instanceof Node && chartContainer.contains(relatedTarget)) {
|
|
3190
|
+
return false;
|
|
3191
|
+
}
|
|
3192
|
+
const { target: eventTarget } = event;
|
|
3193
|
+
return eventTarget instanceof Node && chartContainer.contains(eventTarget);
|
|
3194
|
+
};
|
|
3169
3195
|
var CursorPlugin = (props) => {
|
|
3170
3196
|
const {
|
|
3171
3197
|
laneSeries,
|
|
@@ -3177,22 +3203,24 @@ var CursorPlugin = (props) => {
|
|
|
3177
3203
|
setHighlightedLane,
|
|
3178
3204
|
handleEventClick,
|
|
3179
3205
|
tooltipRef,
|
|
3206
|
+
scrollContainerRef,
|
|
3180
3207
|
locale,
|
|
3181
3208
|
scaleFactor
|
|
3182
3209
|
} = props;
|
|
3183
3210
|
let previousTooltipContent = null;
|
|
3211
|
+
const clearTooltip = (chart) => {
|
|
3212
|
+
clearTooltipIfVisible({
|
|
3213
|
+
chart,
|
|
3214
|
+
tooltipRef,
|
|
3215
|
+
setHighlightedLane,
|
|
3216
|
+
setHighlightedEvent,
|
|
3217
|
+
setHighlightedCategory
|
|
3218
|
+
});
|
|
3219
|
+
};
|
|
3184
3220
|
const handleMouseLeave = (u) => {
|
|
3185
3221
|
const xCursorLine = u.root.querySelector(".u-cursor-x");
|
|
3186
3222
|
xCursorLine.classList.add("u-off");
|
|
3187
|
-
|
|
3188
|
-
visible: false,
|
|
3189
|
-
overflow: false,
|
|
3190
|
-
content: "",
|
|
3191
|
-
meta: ""
|
|
3192
|
-
};
|
|
3193
|
-
setHighlightedLane(null);
|
|
3194
|
-
setHighlightedEvent(null);
|
|
3195
|
-
setHighlightedCategory(null);
|
|
3223
|
+
clearTooltip(u);
|
|
3196
3224
|
};
|
|
3197
3225
|
const handleClick2 = () => {
|
|
3198
3226
|
if (tooltipRef.current.visible) {
|
|
@@ -3206,18 +3234,44 @@ var CursorPlugin = (props) => {
|
|
|
3206
3234
|
return {
|
|
3207
3235
|
hooks: {
|
|
3208
3236
|
init: (u) => {
|
|
3237
|
+
var _a;
|
|
3209
3238
|
const chartContainer = u.root;
|
|
3210
3239
|
chartContainer.addEventListener("click", handleClick2);
|
|
3211
3240
|
const pointerExitHandler = (e) => {
|
|
3212
|
-
if (
|
|
3241
|
+
if (shouldClearOnPointerExit(e, chartContainer)) {
|
|
3213
3242
|
handleMouseLeave(u);
|
|
3214
3243
|
}
|
|
3215
3244
|
};
|
|
3245
|
+
const pointerMoveHandler = (e) => {
|
|
3246
|
+
if (!tooltipRef.current.visible || !tooltipRef.current.bounds) {
|
|
3247
|
+
return;
|
|
3248
|
+
}
|
|
3249
|
+
const rect = chartContainer.getBoundingClientRect();
|
|
3250
|
+
const dpr = globalThis.devicePixelRatio || 1;
|
|
3251
|
+
const cursorPosition = getCursorPosition({
|
|
3252
|
+
mouseEvent: e,
|
|
3253
|
+
rect,
|
|
3254
|
+
bbox: u.bbox,
|
|
3255
|
+
scaleFactor,
|
|
3256
|
+
dpr
|
|
3257
|
+
});
|
|
3258
|
+
if (!isCursorWithinBounds({ cursorPosition, bounds: tooltipRef.current.bounds })) {
|
|
3259
|
+
clearTooltip(u);
|
|
3260
|
+
}
|
|
3261
|
+
};
|
|
3262
|
+
const scrollContainer = (_a = scrollContainerRef == null ? void 0 : scrollContainerRef.current) != null ? _a : chartContainer.closest('[data-test="timeline-chart-scroll-area"]');
|
|
3263
|
+
const scrollHandler = () => {
|
|
3264
|
+
clearTooltip(u);
|
|
3265
|
+
};
|
|
3216
3266
|
chartContainer.addEventListener("pointerleave", pointerExitHandler);
|
|
3267
|
+
document.addEventListener("pointermove", pointerMoveHandler, true);
|
|
3217
3268
|
document.addEventListener("pointerout", pointerExitHandler, true);
|
|
3269
|
+
scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", scrollHandler);
|
|
3218
3270
|
return () => {
|
|
3219
3271
|
chartContainer.removeEventListener("pointerleave", pointerExitHandler);
|
|
3272
|
+
document.removeEventListener("pointermove", pointerMoveHandler, true);
|
|
3220
3273
|
document.removeEventListener("pointerout", pointerExitHandler, true);
|
|
3274
|
+
scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", scrollHandler);
|
|
3221
3275
|
chartContainer.removeEventListener("click", handleClick2);
|
|
3222
3276
|
};
|
|
3223
3277
|
},
|
|
@@ -3225,12 +3279,11 @@ var CursorPlugin = (props) => {
|
|
|
3225
3279
|
const mouseEvent = u.cursor.event;
|
|
3226
3280
|
const xCursorLine = u.root.querySelector(".u-cursor-x");
|
|
3227
3281
|
if (!mouseEvent) {
|
|
3228
|
-
tooltipRef.current.visible = false;
|
|
3229
3282
|
toggleCursorLine(xCursorLine, true);
|
|
3230
3283
|
return;
|
|
3231
3284
|
}
|
|
3232
3285
|
const rect = u.root.getBoundingClientRect();
|
|
3233
|
-
const dpr =
|
|
3286
|
+
const dpr = globalThis.devicePixelRatio || 1;
|
|
3234
3287
|
const cursorPosition = getCursorPosition({
|
|
3235
3288
|
mouseEvent,
|
|
3236
3289
|
rect,
|
|
@@ -3241,13 +3294,7 @@ var CursorPlugin = (props) => {
|
|
|
3241
3294
|
u.cursor.left = cursorPosition.x;
|
|
3242
3295
|
u.cursor.top = cursorPosition.y;
|
|
3243
3296
|
if (updateCursorLine(xCursorLine, cursorPosition, u, dpr)) {
|
|
3244
|
-
|
|
3245
|
-
chart: u,
|
|
3246
|
-
tooltipRef,
|
|
3247
|
-
setHighlightedLane,
|
|
3248
|
-
setHighlightedEvent,
|
|
3249
|
-
setHighlightedCategory
|
|
3250
|
-
});
|
|
3297
|
+
clearTooltip(u);
|
|
3251
3298
|
return;
|
|
3252
3299
|
}
|
|
3253
3300
|
const tooltipState = getTooltipState({
|
|
@@ -3261,13 +3308,7 @@ var CursorPlugin = (props) => {
|
|
|
3261
3308
|
chart: u
|
|
3262
3309
|
});
|
|
3263
3310
|
if (!tooltipState) {
|
|
3264
|
-
|
|
3265
|
-
chart: u,
|
|
3266
|
-
tooltipRef,
|
|
3267
|
-
setHighlightedLane,
|
|
3268
|
-
setHighlightedEvent,
|
|
3269
|
-
setHighlightedCategory
|
|
3270
|
-
});
|
|
3311
|
+
clearTooltip(u);
|
|
3271
3312
|
return;
|
|
3272
3313
|
}
|
|
3273
3314
|
applyTooltipState({
|
|
@@ -3353,12 +3394,15 @@ function getTooltipState({
|
|
|
3353
3394
|
if (!lane) {
|
|
3354
3395
|
return null;
|
|
3355
3396
|
}
|
|
3356
|
-
const tooltip =
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3397
|
+
const tooltip = {
|
|
3398
|
+
x: hit.anchorX,
|
|
3399
|
+
y: hit.anchorY,
|
|
3400
|
+
eventWidth: hit.eventWidth,
|
|
3401
|
+
eventHeight: hit.eventHeight,
|
|
3402
|
+
eventAnchorOffsetX: hit.eventAnchorOffsetX,
|
|
3403
|
+
bounds: hit.bounds,
|
|
3404
|
+
overflow: hit.anchorX + hit.eventWidth + TIMELINE_TOOLTIP_WIDTH / 2 > chart.bbox.width / dpr
|
|
3405
|
+
};
|
|
3362
3406
|
const displaySeconds = durationPerTick < 6e4 && hit.event.duration !== 0;
|
|
3363
3407
|
const content = buildTooltipContent({ lane, event: hit.event, locale, displaySeconds });
|
|
3364
3408
|
const meta = buildTooltipMeta(hit.event);
|
|
@@ -3392,6 +3436,7 @@ function findEventHit({
|
|
|
3392
3436
|
widthPerTick,
|
|
3393
3437
|
xScaleMin
|
|
3394
3438
|
}) {
|
|
3439
|
+
const candidates = [];
|
|
3395
3440
|
for (let i = events.length - 1; i >= 0; i -= 1) {
|
|
3396
3441
|
const event = events[i];
|
|
3397
3442
|
const metrics = getEventMetrics({
|
|
@@ -3402,56 +3447,97 @@ function findEventHit({
|
|
|
3402
3447
|
xScaleMin
|
|
3403
3448
|
});
|
|
3404
3449
|
if (metrics && hitTestEvent({ metrics, cursorPosition })) {
|
|
3405
|
-
|
|
3406
|
-
event,
|
|
3407
|
-
tooltipX: metrics.tooltipX,
|
|
3408
|
-
tooltipY: metrics.tooltipY
|
|
3409
|
-
};
|
|
3450
|
+
candidates.push({ event, metrics });
|
|
3410
3451
|
}
|
|
3411
3452
|
}
|
|
3412
|
-
|
|
3453
|
+
if (candidates.length === 0) {
|
|
3454
|
+
return null;
|
|
3455
|
+
}
|
|
3456
|
+
const minWidthCandidates = candidates.filter(({ metrics }) => metrics.isMinWidthBar);
|
|
3457
|
+
const hit = minWidthCandidates.length ? getClosestMinWidthHit({ candidates: minWidthCandidates, cursorPosition }) : candidates[0];
|
|
3458
|
+
return {
|
|
3459
|
+
event: hit.event,
|
|
3460
|
+
anchorX: hit.metrics.anchorX,
|
|
3461
|
+
anchorY: hit.metrics.anchorY,
|
|
3462
|
+
eventWidth: hit.metrics.eventWidth,
|
|
3463
|
+
eventHeight: hit.metrics.eventHeight,
|
|
3464
|
+
eventAnchorOffsetX: hit.metrics.eventAnchorOffsetX,
|
|
3465
|
+
bounds: {
|
|
3466
|
+
xMin: hit.metrics.hitMin,
|
|
3467
|
+
xMax: hit.metrics.hitMax,
|
|
3468
|
+
yMin: hit.metrics.hitYMin,
|
|
3469
|
+
yMax: hit.metrics.hitYMax
|
|
3470
|
+
}
|
|
3471
|
+
};
|
|
3472
|
+
}
|
|
3473
|
+
function getClosestMinWidthHit({ candidates, cursorPosition }) {
|
|
3474
|
+
return candidates.reduce((closest, candidate) => {
|
|
3475
|
+
const closestDistance = Math.abs(cursorPosition.x - closest.metrics.anchorX);
|
|
3476
|
+
const candidateDistance = Math.abs(cursorPosition.x - candidate.metrics.anchorX);
|
|
3477
|
+
return candidateDistance < closestDistance ? candidate : closest;
|
|
3478
|
+
}, candidates[0]);
|
|
3413
3479
|
}
|
|
3414
3480
|
function getEventMetrics({ event, cursorSeriesIndex, durationPerTick, widthPerTick, xScaleMin }) {
|
|
3415
3481
|
const xStartFraction = (event.start - xScaleMin) / durationPerTick;
|
|
3416
3482
|
const xStartBase = xStartFraction * widthPerTick;
|
|
3417
3483
|
const xStart = cursorSeriesIndex - 1 === 0 ? xStartBase + 2 : xStartBase;
|
|
3418
|
-
|
|
3419
|
-
|
|
3484
|
+
const laneTop = (cursorSeriesIndex - 1) * FIXED_LANE_HEIGHT;
|
|
3485
|
+
const laneCenterY = laneTop + FIXED_LANE_HEIGHT / 2;
|
|
3486
|
+
const eventHeight = FIXED_LANE_HEIGHT * CIRCLE_LANE_SCALE_FACTOR;
|
|
3487
|
+
const eventTop = laneCenterY - eventHeight / 2;
|
|
3488
|
+
const eventBottom = eventTop + eventHeight;
|
|
3489
|
+
const hitYMin = eventTop - EVENT_VERTICAL_HIT_PADDING;
|
|
3490
|
+
const hitYMax = eventBottom + EVENT_VERTICAL_HIT_PADDING;
|
|
3491
|
+
if (event.duration === null || event.duration === 0) {
|
|
3492
|
+
const circleRadius = eventHeight / 2;
|
|
3493
|
+
const circleLeft = xStart - circleRadius;
|
|
3420
3494
|
return {
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3495
|
+
anchorX: circleLeft,
|
|
3496
|
+
anchorY: eventTop,
|
|
3497
|
+
eventWidth: eventHeight,
|
|
3498
|
+
eventHeight,
|
|
3499
|
+
eventAnchorOffsetX: circleRadius,
|
|
3500
|
+
hitMin: circleLeft,
|
|
3501
|
+
hitMax: xStart + circleRadius,
|
|
3502
|
+
hitYMin,
|
|
3503
|
+
hitYMax
|
|
3425
3504
|
};
|
|
3426
3505
|
}
|
|
3427
3506
|
const durationWidth = event.duration / durationPerTick * widthPerTick;
|
|
3428
3507
|
const barWidth = Math.max(durationWidth, MIN_BAR_WIDTH);
|
|
3508
|
+
const isMinWidthBar = barWidth <= MIN_BAR_WIDTH;
|
|
3509
|
+
const hitXMin = isMinWidthBar ? xStart - MIN_BAR_HOVER_WIDTH / 2 : xStart;
|
|
3510
|
+
const hitXMax = isMinWidthBar ? xStart + MIN_BAR_HOVER_WIDTH / 2 : xStart + barWidth;
|
|
3429
3511
|
return {
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3512
|
+
anchorX: xStart,
|
|
3513
|
+
anchorY: eventTop,
|
|
3514
|
+
eventWidth: barWidth,
|
|
3515
|
+
eventHeight,
|
|
3516
|
+
eventAnchorOffsetX: 0,
|
|
3517
|
+
hitMin: hitXMin,
|
|
3518
|
+
hitMax: hitXMax,
|
|
3519
|
+
hitYMin,
|
|
3520
|
+
hitYMax,
|
|
3521
|
+
isMinWidthBar
|
|
3434
3522
|
};
|
|
3435
3523
|
}
|
|
3436
3524
|
function hitTestEvent({ metrics, cursorPosition }) {
|
|
3437
|
-
|
|
3438
|
-
|
|
3525
|
+
return isCursorWithinBounds({
|
|
3526
|
+
cursorPosition,
|
|
3527
|
+
bounds: {
|
|
3528
|
+
xMin: metrics.hitMin,
|
|
3529
|
+
xMax: metrics.hitMax,
|
|
3530
|
+
yMin: metrics.hitYMin,
|
|
3531
|
+
yMax: metrics.hitYMax
|
|
3532
|
+
}
|
|
3533
|
+
});
|
|
3439
3534
|
}
|
|
3440
|
-
function
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
overflow = true;
|
|
3447
|
-
adjustedY -= FIXED_LANE_HEIGHT / 2;
|
|
3448
|
-
adjustedX -= event.duration === 0 ? FIXED_LANE_HEIGHT : MIN_BAR_WIDTH;
|
|
3449
|
-
}
|
|
3450
|
-
return {
|
|
3451
|
-
x: adjustedX,
|
|
3452
|
-
y: adjustedY,
|
|
3453
|
-
overflow
|
|
3454
|
-
};
|
|
3535
|
+
function isCursorWithinBounds({
|
|
3536
|
+
cursorPosition,
|
|
3537
|
+
bounds
|
|
3538
|
+
}) {
|
|
3539
|
+
const { x, y } = cursorPosition;
|
|
3540
|
+
return x >= bounds.xMin && x <= bounds.xMax && y >= bounds.yMin && y <= bounds.yMax;
|
|
3455
3541
|
}
|
|
3456
3542
|
function buildTooltipContent({ lane, event, locale, displaySeconds }) {
|
|
3457
3543
|
const startTime = new Date(event.start).toLocaleTimeString(
|
|
@@ -3485,6 +3571,10 @@ function applyTooltipState({
|
|
|
3485
3571
|
visible: true,
|
|
3486
3572
|
x: tooltipState.tooltip.x,
|
|
3487
3573
|
y: tooltipState.tooltip.y,
|
|
3574
|
+
eventWidth: tooltipState.tooltip.eventWidth,
|
|
3575
|
+
eventHeight: tooltipState.tooltip.eventHeight,
|
|
3576
|
+
eventAnchorOffsetX: tooltipState.tooltip.eventAnchorOffsetX,
|
|
3577
|
+
bounds: tooltipState.tooltip.bounds,
|
|
3488
3578
|
overflow: tooltipState.tooltip.overflow,
|
|
3489
3579
|
content: tooltipState.content,
|
|
3490
3580
|
meta: tooltipState.meta
|
|
@@ -3504,12 +3594,9 @@ function clearTooltipIfVisible({
|
|
|
3504
3594
|
return;
|
|
3505
3595
|
}
|
|
3506
3596
|
chart.root.style.cursor = "default";
|
|
3507
|
-
tooltipRef.current = {
|
|
3508
|
-
visible: false
|
|
3509
|
-
|
|
3510
|
-
content: "",
|
|
3511
|
-
meta: ""
|
|
3512
|
-
};
|
|
3597
|
+
tooltipRef.current = __spreadProps(__spreadValues({}, tooltipRef.current), {
|
|
3598
|
+
visible: false
|
|
3599
|
+
});
|
|
3513
3600
|
setHighlightedLane(null);
|
|
3514
3601
|
setHighlightedEvent(null);
|
|
3515
3602
|
setHighlightedCategory(null);
|
|
@@ -3620,7 +3707,7 @@ var TimelinePlugin = ({
|
|
|
3620
3707
|
var TimelinePlugin_default = TimelinePlugin;
|
|
3621
3708
|
|
|
3622
3709
|
// src/Timeline/PureTimeline/src/XAxisPlugin.tsx
|
|
3623
|
-
var X_AXIS_HEIGHT =
|
|
3710
|
+
var X_AXIS_HEIGHT = 50;
|
|
3624
3711
|
var XAxisPlugin = ({
|
|
3625
3712
|
durationPerTick = 0,
|
|
3626
3713
|
numTicks = 0,
|
|
@@ -3660,7 +3747,6 @@ var XAxisPlugin = ({
|
|
|
3660
3747
|
draw: (u) => {
|
|
3661
3748
|
const { ctx } = u;
|
|
3662
3749
|
const scaleMin = u.scales.x.min;
|
|
3663
|
-
const maxLabelWidth = 50;
|
|
3664
3750
|
const ticks = [scaleMin];
|
|
3665
3751
|
for (let i = 1; i <= numTicks; i += 1) {
|
|
3666
3752
|
ticks.push(scaleMin + i * durationPerTick);
|
|
@@ -3716,7 +3802,9 @@ var XAxisPlugin = ({
|
|
|
3716
3802
|
} else {
|
|
3717
3803
|
xTickPosition = i * (u.width / numTicks);
|
|
3718
3804
|
}
|
|
3719
|
-
|
|
3805
|
+
const label = labels[i];
|
|
3806
|
+
const labelPixelWidth = label ? Math.max(...label.map((line) => ctx.measureText(line).width)) : 0;
|
|
3807
|
+
if (xTickPosition + labelPixelWidth > u.width) {
|
|
3720
3808
|
return;
|
|
3721
3809
|
}
|
|
3722
3810
|
const yLabelPosition = xAxisY + tickHeight + labelOffset;
|
|
@@ -3726,7 +3814,6 @@ var XAxisPlugin = ({
|
|
|
3726
3814
|
ctx.strokeStyle = "rgba(144, 144, 144, 0.5)";
|
|
3727
3815
|
ctx.lineWidth = i === 0 ? 1 : 0.5;
|
|
3728
3816
|
ctx.stroke();
|
|
3729
|
-
const label = labels[i];
|
|
3730
3817
|
if (label) {
|
|
3731
3818
|
label.forEach((line, idx) => {
|
|
3732
3819
|
ctx.fillText(line, xTickPosition, yLabelPosition + idx * lineHeight);
|
|
@@ -3802,12 +3889,14 @@ var TimelineYAxis = ({
|
|
|
3802
3889
|
laneTextColor = theme.contentColorActive;
|
|
3803
3890
|
}
|
|
3804
3891
|
}
|
|
3892
|
+
const laneText = lane.toString();
|
|
3805
3893
|
const truncatedText = truncateText(
|
|
3806
|
-
|
|
3894
|
+
laneText,
|
|
3807
3895
|
yAxisLabelWidth - lanePadding,
|
|
3808
3896
|
"ellipsisMiddle",
|
|
3809
3897
|
`14px ${VIZ_FONT_FAMILY}`
|
|
3810
3898
|
);
|
|
3899
|
+
const isTruncated = truncatedText !== laneText;
|
|
3811
3900
|
return /* @__PURE__ */ react_exports.createElement(
|
|
3812
3901
|
YAxisLane,
|
|
3813
3902
|
{
|
|
@@ -3818,6 +3907,7 @@ var TimelineYAxis = ({
|
|
|
3818
3907
|
isEven: (lanes.length - index - 1) % 2 === 0,
|
|
3819
3908
|
backgroundColor,
|
|
3820
3909
|
clickable: !!handleLaneClick,
|
|
3910
|
+
title: isTruncated ? laneText : void 0,
|
|
3821
3911
|
onClick: () => {
|
|
3822
3912
|
handleLaneClick == null ? void 0 : handleLaneClick(lane);
|
|
3823
3913
|
}
|
|
@@ -3834,35 +3924,48 @@ TimelineYAxis.propTypes = {
|
|
|
3834
3924
|
var TimelineYAxis_default = TimelineYAxis;
|
|
3835
3925
|
|
|
3836
3926
|
// src/Timeline/PureTimeline/src/TimelineLegend.tsx
|
|
3837
|
-
var LEGEND_WIDTH =
|
|
3927
|
+
var LEGEND_WIDTH = 79;
|
|
3928
|
+
var SCROLLBAR_GUTTER_WIDTH = 16;
|
|
3838
3929
|
var LEGEND_TEXT_WIDTH = 55;
|
|
3930
|
+
var BOTTOM_LEGEND_MIN_HEIGHT = 34;
|
|
3839
3931
|
var LegendContainer = styled_components_default.div`
|
|
3840
3932
|
display: flex;
|
|
3841
|
-
justify-content: center;
|
|
3933
|
+
justify-content: ${({ legendDisplay, hasVerticalOverflow }) => legendDisplay === "right" && hasVerticalOverflow ? "flex-start" : "center"};
|
|
3842
3934
|
flex-direction: ${({ legendDisplay }) => legendDisplay === "bottom" ? "row" : "column"};
|
|
3843
3935
|
align-items: flex-start;
|
|
3844
3936
|
background-color: ${({ backgroundColor }) => backgroundColor};
|
|
3845
3937
|
color: #fafafa;
|
|
3846
3938
|
font-size: 10px;
|
|
3847
|
-
|
|
3939
|
+
flex-shrink: 0;
|
|
3940
|
+
box-sizing: border-box;
|
|
3941
|
+
padding-right: ${({ scrollbarGutterWidth }) => scrollbarGutterWidth}px;
|
|
3942
|
+
${({ legendDisplay, height, maxHeight, yAxisLabelWidth }) => legendDisplay === "right" ? `
|
|
3848
3943
|
width: ${LEGEND_WIDTH}px;
|
|
3849
|
-
height: ${height}px;
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
margin-
|
|
3944
|
+
min-height: ${Math.min(height, maxHeight)}px;
|
|
3945
|
+
max-height: ${maxHeight}px;
|
|
3946
|
+
align-self: flex-start;
|
|
3947
|
+
margin-left: 9px;
|
|
3853
3948
|
overflow-x: hidden;
|
|
3949
|
+
overflow-y: auto;
|
|
3854
3950
|
` : `
|
|
3855
3951
|
flex-wrap: wrap;
|
|
3856
|
-
|
|
3857
|
-
|
|
3952
|
+
align-content: flex-start;
|
|
3953
|
+
min-height: ${BOTTOM_LEGEND_MIN_HEIGHT}px;
|
|
3954
|
+
max-height: ${maxHeight}px;
|
|
3955
|
+
overflow-y: auto;
|
|
3956
|
+
width: calc(100% - ${yAxisLabelWidth}px);
|
|
3858
3957
|
margin-left: ${yAxisLabelWidth}px;
|
|
3859
|
-
padding-
|
|
3958
|
+
padding-top: 8px;
|
|
3959
|
+
padding-bottom: 0;
|
|
3860
3960
|
`}
|
|
3861
3961
|
`;
|
|
3862
3962
|
var LegendItem = styled_components_default.div`
|
|
3863
3963
|
display: flex;
|
|
3864
3964
|
align-items: ${({ legendTruncation }) => legendTruncation === "ellipsisOff" ? "flex-start" : "center"};
|
|
3865
|
-
margin: ${({ legendDisplay }) => legendDisplay === "bottom" ? "
|
|
3965
|
+
margin: ${({ legendDisplay }) => legendDisplay === "bottom" ? "4px 20px 4px 0px" : "4px"};
|
|
3966
|
+
max-width: 100%;
|
|
3967
|
+
min-width: 0;
|
|
3968
|
+
box-sizing: border-box;
|
|
3866
3969
|
cursor: pointer;
|
|
3867
3970
|
opacity: ${({ isHighlighted }) => isHighlighted ? 1 : 0.5};
|
|
3868
3971
|
transition: opacity 0.2s ease;
|
|
@@ -3889,19 +3992,43 @@ var LegendText = styled_components_default.div`
|
|
|
3889
3992
|
`}
|
|
3890
3993
|
font-size: 10px;
|
|
3891
3994
|
color: ${themes_exports.variables.contentColorActive};
|
|
3995
|
+
max-width: 100%;
|
|
3996
|
+
min-width: 0;
|
|
3892
3997
|
`;
|
|
3893
3998
|
var TimelineLegend = ({
|
|
3894
3999
|
backgroundColor,
|
|
3895
4000
|
categoryColors,
|
|
3896
4001
|
highlightedCategory = null,
|
|
3897
4002
|
setHighlightedCategory,
|
|
3898
|
-
height,
|
|
3899
|
-
width,
|
|
3900
4003
|
handleLegendClick: handleLegendClick2,
|
|
3901
4004
|
legendDisplay = "right",
|
|
3902
4005
|
legendTruncation = "ellipsisEnd",
|
|
4006
|
+
height = 0,
|
|
4007
|
+
maxHeight = height,
|
|
3903
4008
|
yAxisLabelWidth = 0
|
|
3904
4009
|
}) => {
|
|
4010
|
+
const containerRef = react_exports.useRef(null);
|
|
4011
|
+
const [scrollbarGutter, setScrollbarGutter] = react_exports.useState({
|
|
4012
|
+
reservedWidth: 0,
|
|
4013
|
+
paddingRight: 0,
|
|
4014
|
+
hasVerticalOverflow: false
|
|
4015
|
+
});
|
|
4016
|
+
const categoryColorEntries = Array.from(categoryColors.entries());
|
|
4017
|
+
const legendTextWidth = Math.max(0, LEGEND_TEXT_WIDTH - scrollbarGutter.reservedWidth);
|
|
4018
|
+
react_exports.useEffect(() => {
|
|
4019
|
+
const el = containerRef.current;
|
|
4020
|
+
if (!el) return;
|
|
4021
|
+
const hasVerticalOverflow = el.scrollHeight > el.clientHeight;
|
|
4022
|
+
const measuredScrollbarWidth = hasVerticalOverflow ? Math.max(0, el.offsetWidth - el.clientWidth) : 0;
|
|
4023
|
+
const nextGutter = hasVerticalOverflow ? {
|
|
4024
|
+
reservedWidth: Math.max(SCROLLBAR_GUTTER_WIDTH, measuredScrollbarWidth),
|
|
4025
|
+
paddingRight: Math.max(0, SCROLLBAR_GUTTER_WIDTH - measuredScrollbarWidth),
|
|
4026
|
+
hasVerticalOverflow
|
|
4027
|
+
} : { reservedWidth: 0, paddingRight: 0, hasVerticalOverflow };
|
|
4028
|
+
setScrollbarGutter(
|
|
4029
|
+
(current) => current.reservedWidth === nextGutter.reservedWidth && current.paddingRight === nextGutter.paddingRight && current.hasVerticalOverflow === nextGutter.hasVerticalOverflow ? current : nextGutter
|
|
4030
|
+
);
|
|
4031
|
+
}, [categoryColors, height, legendDisplay, legendTruncation, maxHeight]);
|
|
3905
4032
|
const handleMouseEnter = (category) => {
|
|
3906
4033
|
setHighlightedCategory == null ? void 0 : setHighlightedCategory(category);
|
|
3907
4034
|
};
|
|
@@ -3911,31 +4038,36 @@ var TimelineLegend = ({
|
|
|
3911
4038
|
return /* @__PURE__ */ react_exports.createElement(
|
|
3912
4039
|
LegendContainer,
|
|
3913
4040
|
{
|
|
4041
|
+
ref: containerRef,
|
|
3914
4042
|
"data-test": "legend-container",
|
|
3915
4043
|
"data-test-position-value": legendDisplay,
|
|
3916
4044
|
"data-test-truncation-value": legendTruncation,
|
|
3917
4045
|
legendDisplay,
|
|
3918
4046
|
backgroundColor,
|
|
4047
|
+
yAxisLabelWidth,
|
|
3919
4048
|
height,
|
|
3920
|
-
|
|
3921
|
-
|
|
4049
|
+
maxHeight,
|
|
4050
|
+
scrollbarGutterWidth: scrollbarGutter.paddingRight,
|
|
4051
|
+
hasVerticalOverflow: scrollbarGutter.hasVerticalOverflow
|
|
3922
4052
|
},
|
|
3923
|
-
|
|
4053
|
+
categoryColorEntries.map(([category, color]) => {
|
|
3924
4054
|
const isHighlighted = !highlightedCategory || highlightedCategory === category;
|
|
3925
|
-
const truncatedText = legendTruncation === "ellipsisOff" || legendDisplay === "bottom" ? category : truncateText(category,
|
|
4055
|
+
const truncatedText = legendTruncation === "ellipsisOff" || legendDisplay === "bottom" ? category : truncateText(category, legendTextWidth, legendTruncation);
|
|
4056
|
+
const canTruncate = legendTruncation !== "ellipsisOff";
|
|
3926
4057
|
return /* @__PURE__ */ react_exports.createElement(
|
|
3927
4058
|
LegendItem,
|
|
3928
4059
|
{
|
|
3929
4060
|
"data-test": "legend-item",
|
|
3930
4061
|
key: category,
|
|
3931
|
-
color,
|
|
3932
4062
|
isHighlighted,
|
|
3933
4063
|
legendDisplay,
|
|
3934
4064
|
legendTruncation,
|
|
4065
|
+
title: canTruncate ? category : void 0,
|
|
4066
|
+
"aria-label": category,
|
|
3935
4067
|
onMouseEnter: () => handleMouseEnter(category),
|
|
3936
4068
|
onMouseLeave: handleMouseLeave,
|
|
3937
4069
|
onClick: () => {
|
|
3938
|
-
handleLegendClick2(category);
|
|
4070
|
+
handleLegendClick2 == null ? void 0 : handleLegendClick2(category);
|
|
3939
4071
|
}
|
|
3940
4072
|
},
|
|
3941
4073
|
/* @__PURE__ */ react_exports.createElement(
|
|
@@ -3955,104 +4087,133 @@ var TimelineLegend = ({
|
|
|
3955
4087
|
};
|
|
3956
4088
|
TimelineLegend.propTypes = {
|
|
3957
4089
|
backgroundColor: prop_types_exports.string.isRequired,
|
|
3958
|
-
height: prop_types_exports.number
|
|
3959
|
-
legendDisplay: prop_types_exports.oneOf(["right", "bottom"]),
|
|
4090
|
+
height: prop_types_exports.number,
|
|
4091
|
+
legendDisplay: prop_types_exports.oneOf(["right", "bottom", "off"]),
|
|
3960
4092
|
legendTruncation: prop_types_exports.oneOf(["ellipsisEnd", "ellipsisMiddle", "ellipsisStart", "ellipsisOff"]),
|
|
3961
4093
|
categoryColors: prop_types_exports.any,
|
|
3962
4094
|
highlightedCategory: prop_types_exports.string,
|
|
3963
|
-
setHighlightedCategory: prop_types_exports.func
|
|
4095
|
+
setHighlightedCategory: prop_types_exports.func,
|
|
4096
|
+
maxHeight: prop_types_exports.number
|
|
3964
4097
|
};
|
|
3965
4098
|
var TimelineLegend_default = TimelineLegend;
|
|
3966
4099
|
|
|
3967
|
-
// esm-externals:@splunk/
|
|
3968
|
-
var
|
|
3969
|
-
__export(
|
|
3970
|
-
default: () =>
|
|
4100
|
+
// esm-externals:@splunk/react-ui/Popover
|
|
4101
|
+
var Popover_exports = {};
|
|
4102
|
+
__export(Popover_exports, {
|
|
4103
|
+
default: () => Popover_default
|
|
3971
4104
|
});
|
|
3972
|
-
var defaultImport40 = __toESM(require("@splunk/
|
|
3973
|
-
__reExport(
|
|
3974
|
-
var
|
|
4105
|
+
var defaultImport40 = __toESM(require("@splunk/react-ui/Popover"));
|
|
4106
|
+
__reExport(Popover_exports, require("@splunk/react-ui/Popover"));
|
|
4107
|
+
var Popover_default = "default" in defaultImport40 ? defaultImport40.default : defaultImport40;
|
|
3975
4108
|
|
|
3976
4109
|
// src/Timeline/PureTimeline/src/TimelineTooltip.tsx
|
|
3977
|
-
var
|
|
4110
|
+
var TOOLTIP_ANCHOR_GAP = 4;
|
|
4111
|
+
var TOOLTIP_MOVE_TRANSITION = "transform 0.1s ease-out, left 0.1s ease-out, top 0.1s ease-out";
|
|
4112
|
+
var VirtualAnchor = styled_components_default.div`
|
|
3978
4113
|
position: absolute;
|
|
3979
|
-
background-color: ${({ backgroundColor }) => `${backgroundColor}`};
|
|
3980
|
-
box-shadow: ${themes_exports.variables.overlayShadow};
|
|
3981
|
-
padding: 12px 16px;
|
|
3982
|
-
border-radius: 3px;
|
|
3983
4114
|
pointer-events: none;
|
|
3984
|
-
|
|
3985
|
-
|
|
4115
|
+
width: ${({ width }) => `${width}px`};
|
|
4116
|
+
height: ${({ height }) => `${height}px`};
|
|
3986
4117
|
left: ${({ x }) => `${x}px`};
|
|
3987
|
-
top: ${({ y
|
|
3988
|
-
transform: ${({ chartOverflow }) => chartOverflow ? "translate(-100%, -50%);" : "translate(-55%, 0);"}
|
|
3989
|
-
transition: left 0.1s ease-out, top 0.1s ease-out;
|
|
3990
|
-
z-index: 1000;
|
|
3991
|
-
|
|
3992
|
-
::after {
|
|
3993
|
-
content: '';
|
|
3994
|
-
position: absolute;
|
|
3995
|
-
${({ chartOverflow, backgroundColor }) => chartOverflow ? `
|
|
3996
|
-
top: 50%;
|
|
3997
|
-
left: 100%;
|
|
3998
|
-
transform: translateY(-50%);
|
|
3999
|
-
border-width: 5px;
|
|
4000
|
-
border-style: solid;
|
|
4001
|
-
border-bottom-color: transparent;
|
|
4002
|
-
border-top-color: transparent;
|
|
4003
|
-
border-right-color: transparent;
|
|
4004
|
-
border-left-color: ${backgroundColor};
|
|
4005
|
-
` : `
|
|
4006
|
-
bottom: 100%;
|
|
4007
|
-
left: 50%;
|
|
4008
|
-
transform: translateX(-50%);
|
|
4009
|
-
border-width: 5px;
|
|
4010
|
-
border-style: solid;
|
|
4011
|
-
border-bottom-color: ${backgroundColor};
|
|
4012
|
-
border-top-color: transparent;
|
|
4013
|
-
border-right-color: transparent;
|
|
4014
|
-
border-left-color: transparent;
|
|
4015
|
-
`}
|
|
4016
|
-
}
|
|
4118
|
+
top: ${({ y }) => `${y}px`};
|
|
4017
4119
|
`;
|
|
4018
|
-
var
|
|
4019
|
-
|
|
4020
|
-
`;
|
|
4021
|
-
var TooltipValue = styled_components_default.div`
|
|
4022
|
-
color: ${themes_exports.variables.contentColorActive};
|
|
4120
|
+
var TooltipContainer = styled_components_default.div`
|
|
4121
|
+
padding: 12px 16px;
|
|
4023
4122
|
`;
|
|
4024
|
-
var
|
|
4025
|
-
|
|
4026
|
-
flex-direction: row;
|
|
4027
|
-
justify-content: space-between;
|
|
4028
|
-
align-items: center;
|
|
4029
|
-
gap: 16px;
|
|
4123
|
+
var TooltipTable = styled_components_default.table`
|
|
4124
|
+
border-collapse: collapse;
|
|
4030
4125
|
font-weight: 400;
|
|
4031
4126
|
font-size: 12px;
|
|
4032
4127
|
line-height: 16px;
|
|
4128
|
+
max-width: 280px;
|
|
4033
4129
|
`;
|
|
4034
|
-
var
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4130
|
+
var TooltipLabel = styled_components_default.td`
|
|
4131
|
+
color: ${themes_exports.variables.contentColorDefault};
|
|
4132
|
+
overflow-wrap: normal;
|
|
4133
|
+
word-break: normal;
|
|
4134
|
+
white-space: normal;
|
|
4135
|
+
vertical-align: top;
|
|
4136
|
+
padding-right: 16px;
|
|
4137
|
+
padding-bottom: 2px;
|
|
4138
|
+
min-width: 8ch;
|
|
4139
|
+
max-width: 18ch;
|
|
4140
|
+
`;
|
|
4141
|
+
var TooltipValue = styled_components_default.td`
|
|
4142
|
+
color: ${themes_exports.variables.contentColorActive};
|
|
4143
|
+
overflow-wrap: anywhere;
|
|
4144
|
+
word-break: normal;
|
|
4145
|
+
white-space: normal;
|
|
4146
|
+
vertical-align: top;
|
|
4147
|
+
text-align: right;
|
|
4148
|
+
padding-bottom: 2px;
|
|
4149
|
+
`;
|
|
4150
|
+
var POPOVER_STYLE = { pointerEvents: "none" };
|
|
4151
|
+
var TimelineTooltip = ({
|
|
4152
|
+
visible,
|
|
4153
|
+
content,
|
|
4154
|
+
x,
|
|
4155
|
+
y,
|
|
4156
|
+
eventWidth = 0,
|
|
4157
|
+
eventHeight = 0,
|
|
4158
|
+
eventAnchorOffsetX = 0,
|
|
4159
|
+
overflow,
|
|
4160
|
+
scaleFactor = 1
|
|
4161
|
+
}) => {
|
|
4162
|
+
const [anchorEl, setAnchorEl] = react_default.useState(null);
|
|
4163
|
+
const preferredPlacement = overflow ? "left" : "below";
|
|
4164
|
+
const previousAnchorRef = react_default.useRef(null);
|
|
4165
|
+
const anchorX = x - TOOLTIP_ANCHOR_GAP;
|
|
4166
|
+
const anchorY = y - TOOLTIP_ANCHOR_GAP;
|
|
4167
|
+
const anchorWidth = eventWidth + TOOLTIP_ANCHOR_GAP * 2;
|
|
4168
|
+
const anchorHeight = eventHeight + TOOLTIP_ANCHOR_GAP * 2;
|
|
4169
|
+
const pointTo = overflow ? void 0 : { x: (eventAnchorOffsetX + TOOLTIP_ANCHOR_GAP) * scaleFactor };
|
|
4170
|
+
const tooltipRows = Object.entries(content).filter(([, value]) => value !== void 0 && value !== null);
|
|
4171
|
+
const open = visible && anchorEl !== null;
|
|
4172
|
+
const previousAnchor = previousAnchorRef.current;
|
|
4173
|
+
const shouldTransitionTooltipMove = open ? isNearbyTooltipAnchor({
|
|
4174
|
+
anchorPoint: { x: anchorX, y: anchorY },
|
|
4175
|
+
previousAnchorPoint: previousAnchor
|
|
4176
|
+
}) : false;
|
|
4177
|
+
react_default.useEffect(() => {
|
|
4178
|
+
if (!open) {
|
|
4179
|
+
return;
|
|
4180
|
+
}
|
|
4181
|
+
previousAnchorRef.current = { x: anchorX, y: anchorY };
|
|
4182
|
+
}, [anchorX, anchorY, open]);
|
|
4183
|
+
const applyOuterPopoverStyles = react_default.useCallback(
|
|
4184
|
+
(element) => {
|
|
4185
|
+
if (!element) return;
|
|
4186
|
+
const { style } = element;
|
|
4187
|
+
style.pointerEvents = "none";
|
|
4188
|
+
style.minWidth = "0";
|
|
4189
|
+
style.transition = shouldTransitionTooltipMove ? TOOLTIP_MOVE_TRANSITION : "none";
|
|
4190
|
+
},
|
|
4191
|
+
[shouldTransitionTooltipMove]
|
|
4192
|
+
);
|
|
4193
|
+
return /* @__PURE__ */ react_default.createElement(react_default.Fragment, null, /* @__PURE__ */ react_default.createElement(
|
|
4194
|
+
VirtualAnchor,
|
|
4195
|
+
{
|
|
4196
|
+
ref: setAnchorEl,
|
|
4197
|
+
x: anchorX,
|
|
4198
|
+
y: anchorY,
|
|
4199
|
+
width: anchorWidth,
|
|
4200
|
+
height: anchorHeight,
|
|
4201
|
+
"data-test": "timeline-tooltip-anchor"
|
|
4202
|
+
}
|
|
4203
|
+
), /* @__PURE__ */ react_default.createElement(
|
|
4204
|
+
Popover_default,
|
|
4044
4205
|
{
|
|
4045
4206
|
"data-test": "timeline-tooltip",
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4207
|
+
open,
|
|
4208
|
+
anchor: anchorEl,
|
|
4209
|
+
defaultPlacement: preferredPlacement,
|
|
4210
|
+
outerRef: applyOuterPopoverStyles,
|
|
4211
|
+
pointTo,
|
|
4212
|
+
repositionMode: "flip",
|
|
4213
|
+
style: POPOVER_STYLE
|
|
4051
4214
|
},
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
)
|
|
4055
|
-
);
|
|
4215
|
+
/* @__PURE__ */ react_default.createElement(TooltipContainer, null, /* @__PURE__ */ react_default.createElement(TooltipTable, null, /* @__PURE__ */ react_default.createElement("tbody", null, tooltipRows.map(([key, value]) => /* @__PURE__ */ react_default.createElement("tr", { key }, /* @__PURE__ */ react_default.createElement(TooltipLabel, null, key.charAt(0).toUpperCase() + key.slice(1)), /* @__PURE__ */ react_default.createElement(TooltipValue, null, value))))))
|
|
4216
|
+
));
|
|
4056
4217
|
};
|
|
4057
4218
|
var TimelineTooltip_default = TimelineTooltip;
|
|
4058
4219
|
|
|
@@ -4066,18 +4227,66 @@ __reExport(uPlot_min_exports, require("uplot/dist/uPlot.min.css"));
|
|
|
4066
4227
|
var uPlot_min_default = "default" in defaultImport41 ? defaultImport41.default : defaultImport41;
|
|
4067
4228
|
|
|
4068
4229
|
// src/Timeline/PureTimeline/src/TimelineUplot.tsx
|
|
4230
|
+
var TIMELINE_CONTAINER_PADDING = 10;
|
|
4231
|
+
var BOTTOM_LEGEND_SCROLLBAR_GAP = 8;
|
|
4232
|
+
var LANE_HEIGHT = 32;
|
|
4233
|
+
var SCROLLBAR_GUTTER_WIDTH2 = 24;
|
|
4234
|
+
var RIGHT_LEGEND_FOOTPRINT = 88;
|
|
4235
|
+
var getTimelineLayout = ({
|
|
4236
|
+
width,
|
|
4237
|
+
height,
|
|
4238
|
+
yAxisLabelWidth,
|
|
4239
|
+
laneCount,
|
|
4240
|
+
showLegend = false,
|
|
4241
|
+
legendDisplay
|
|
4242
|
+
}) => {
|
|
4243
|
+
const laneBandHeight = LANE_HEIGHT * laneCount;
|
|
4244
|
+
const chartHeight = laneBandHeight + X_AXIS_HEIGHT;
|
|
4245
|
+
const visibleTimelineHeight = Math.max(0, height - TIMELINE_CONTAINER_PADDING * 2);
|
|
4246
|
+
const bottomLegendReservedHeight = showLegend && legendDisplay === "bottom" ? BOTTOM_LEGEND_SCROLLBAR_GAP + BOTTOM_LEGEND_MIN_HEIGHT : 0;
|
|
4247
|
+
const reserveScrollbarGutter = chartHeight > Math.max(0, visibleTimelineHeight - bottomLegendReservedHeight);
|
|
4248
|
+
const legendWidth = showLegend && legendDisplay === "right" ? RIGHT_LEGEND_FOOTPRINT : 0;
|
|
4249
|
+
const chartWidth = Math.max(
|
|
4250
|
+
1,
|
|
4251
|
+
width - yAxisLabelWidth - legendWidth - TIMELINE_CONTAINER_PADDING * 2 - (reserveScrollbarGutter ? SCROLLBAR_GUTTER_WIDTH2 : 0)
|
|
4252
|
+
);
|
|
4253
|
+
const legendMaxHeight = legendDisplay === "bottom" ? Math.max(
|
|
4254
|
+
BOTTOM_LEGEND_MIN_HEIGHT,
|
|
4255
|
+
visibleTimelineHeight - BOTTOM_LEGEND_SCROLLBAR_GAP - chartHeight
|
|
4256
|
+
) : visibleTimelineHeight;
|
|
4257
|
+
return {
|
|
4258
|
+
laneBandHeight,
|
|
4259
|
+
chartHeight,
|
|
4260
|
+
chartWidth,
|
|
4261
|
+
reserveScrollbarGutter,
|
|
4262
|
+
legendMaxHeight
|
|
4263
|
+
};
|
|
4264
|
+
};
|
|
4069
4265
|
var TimelineUplotContainer = styled_components_default.div`
|
|
4070
4266
|
display: flex;
|
|
4071
4267
|
flex-direction: ${({ legendDisplay }) => legendDisplay === "bottom" ? "column" : "row"};
|
|
4072
4268
|
width: 100%;
|
|
4073
4269
|
height: 100%;
|
|
4074
|
-
padding:
|
|
4075
|
-
overflow
|
|
4270
|
+
padding: ${TIMELINE_CONTAINER_PADDING}px ${TIMELINE_CONTAINER_PADDING}px;
|
|
4271
|
+
overflow: visible;
|
|
4272
|
+
box-sizing: border-box;
|
|
4273
|
+
position: relative;
|
|
4274
|
+
${({ legendDisplay }) => legendDisplay === "bottom" ? `gap: ${BOTTOM_LEGEND_SCROLLBAR_GAP}px;` : ""}
|
|
4275
|
+
`;
|
|
4276
|
+
var TimelineChartScrollArea = styled_components_default.div`
|
|
4277
|
+
flex: ${({ hasBottomLegend }) => hasBottomLegend ? "0 0 auto" : "1 1 auto"};
|
|
4278
|
+
max-height: ${({ hasBottomLegend }) => hasBottomLegend ? `calc(100% - ${BOTTOM_LEGEND_SCROLLBAR_GAP + BOTTOM_LEGEND_MIN_HEIGHT}px)` : "none"};
|
|
4279
|
+
min-height: 0;
|
|
4280
|
+
min-width: 0;
|
|
4281
|
+
overflow-y: auto;
|
|
4076
4282
|
overflow-x: hidden;
|
|
4283
|
+
box-sizing: border-box;
|
|
4284
|
+
padding-right: ${({ reserveScrollbarGutter }) => reserveScrollbarGutter ? SCROLLBAR_GUTTER_WIDTH2 : 0}px;
|
|
4077
4285
|
`;
|
|
4078
4286
|
var TimelineUplotWrapper = styled_components_default.div`
|
|
4079
4287
|
width: ${({ width }) => `${width}px`};
|
|
4080
4288
|
position: relative;
|
|
4289
|
+
overflow: visible;
|
|
4081
4290
|
`;
|
|
4082
4291
|
var TimelineChartContainer = styled_components_default.div`
|
|
4083
4292
|
display: flex;
|
|
@@ -4087,6 +4296,7 @@ var TimelineChartContainer = styled_components_default.div`
|
|
|
4087
4296
|
var TimelineUplot = ({
|
|
4088
4297
|
backgroundColor,
|
|
4089
4298
|
width,
|
|
4299
|
+
height,
|
|
4090
4300
|
yAxisLabelWidth,
|
|
4091
4301
|
laneSeries,
|
|
4092
4302
|
lanes,
|
|
@@ -4109,27 +4319,33 @@ var TimelineUplot = ({
|
|
|
4109
4319
|
const fullscreenEl = typeof document !== "undefined" ? document.fullscreenElement : null;
|
|
4110
4320
|
const scaleFactor = fullscreenEl && fullscreenEl.tagName !== "BODY" ? 1 : zoom || 1;
|
|
4111
4321
|
const { version: dprVersion } = (0, visualization_canvas_exports.useDevicePixelRatio)();
|
|
4322
|
+
const scrollContainerRef = react_exports.useRef(null);
|
|
4112
4323
|
const tooltipRef = react_exports.useRef({
|
|
4113
4324
|
visible: false,
|
|
4114
4325
|
x: 0,
|
|
4115
4326
|
y: 0,
|
|
4327
|
+
eventAnchorOffsetX: 0,
|
|
4328
|
+
bounds: null,
|
|
4116
4329
|
overflow: false,
|
|
4117
4330
|
content: {},
|
|
4118
4331
|
meta: {}
|
|
4119
4332
|
});
|
|
4120
|
-
const
|
|
4121
|
-
const
|
|
4122
|
-
const
|
|
4123
|
-
const
|
|
4124
|
-
const
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4333
|
+
const eventStarts = laneSeries.flatMap((lane) => lane.map((dp) => dp.start));
|
|
4334
|
+
const eventEnds = laneSeries.flatMap((lane) => lane.map((dp) => dp.end));
|
|
4335
|
+
const xMin = eventStarts.length ? Math.min(...eventStarts) : 0;
|
|
4336
|
+
const xMax = eventEnds.length ? Math.max(...eventEnds) : 1;
|
|
4337
|
+
const { laneBandHeight, chartHeight, chartWidth, reserveScrollbarGutter, legendMaxHeight } = getTimelineLayout({
|
|
4338
|
+
width,
|
|
4339
|
+
height,
|
|
4340
|
+
yAxisLabelWidth,
|
|
4341
|
+
laneCount: lanes.length,
|
|
4342
|
+
showLegend,
|
|
4343
|
+
legendDisplay
|
|
4344
|
+
});
|
|
4129
4345
|
const granularityMultiplier = convertTickIntervalToMs(tickInterval);
|
|
4130
4346
|
const totalRange = xMax + granularityMultiplier - xMin;
|
|
4131
4347
|
const totalNumberOfTicks = totalRange / granularityMultiplier;
|
|
4132
|
-
const maxNumOfTicks = calculateMaxNumberOfTicks(chartWidth, 50, 10);
|
|
4348
|
+
const maxNumOfTicks = Math.max(1, calculateMaxNumberOfTicks(chartWidth, 50, 10));
|
|
4133
4349
|
const unitsPerTick = Math.ceil(totalNumberOfTicks / maxNumOfTicks);
|
|
4134
4350
|
const numTicks = totalNumberOfTicks / unitsPerTick;
|
|
4135
4351
|
const durationPerTick = granularityMultiplier * unitsPerTick;
|
|
@@ -4193,6 +4409,7 @@ var TimelineUplot = ({
|
|
|
4193
4409
|
setHighlightedLane,
|
|
4194
4410
|
handleEventClick,
|
|
4195
4411
|
tooltipRef,
|
|
4412
|
+
scrollContainerRef,
|
|
4196
4413
|
locale,
|
|
4197
4414
|
scaleFactor
|
|
4198
4415
|
})
|
|
@@ -4221,32 +4438,42 @@ var TimelineUplot = ({
|
|
|
4221
4438
|
setHighlightedLane,
|
|
4222
4439
|
handleEventClick,
|
|
4223
4440
|
tooltipRef,
|
|
4441
|
+
scrollContainerRef,
|
|
4224
4442
|
theme
|
|
4225
4443
|
]
|
|
4226
4444
|
);
|
|
4227
|
-
return /* @__PURE__ */ react_exports.createElement(TimelineUplotContainer, { legendDisplay, "data-test": "timeline-uplot-container" }, /* @__PURE__ */ react_exports.createElement(
|
|
4228
|
-
|
|
4229
|
-
{
|
|
4230
|
-
height: chartHeight,
|
|
4231
|
-
laneHeight,
|
|
4232
|
-
lanes,
|
|
4233
|
-
yAxisLabelWidth,
|
|
4234
|
-
backgroundColor,
|
|
4235
|
-
highlightedLane,
|
|
4236
|
-
handleLaneClick
|
|
4237
|
-
}
|
|
4238
|
-
), /* @__PURE__ */ react_exports.createElement(TimelineUplotWrapper, { width: chartWidth }, /* @__PURE__ */ react_exports.createElement(
|
|
4239
|
-
uplot_react_default,
|
|
4445
|
+
return /* @__PURE__ */ react_exports.createElement(TimelineUplotContainer, { legendDisplay, "data-test": "timeline-uplot-container" }, /* @__PURE__ */ react_exports.createElement(
|
|
4446
|
+
TimelineChartScrollArea,
|
|
4240
4447
|
{
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4448
|
+
ref: scrollContainerRef,
|
|
4449
|
+
"data-test": "timeline-chart-scroll-area",
|
|
4450
|
+
hasBottomLegend: showLegend && legendDisplay === "bottom",
|
|
4451
|
+
reserveScrollbarGutter
|
|
4452
|
+
},
|
|
4453
|
+
/* @__PURE__ */ react_exports.createElement(TimelineChartContainer, { "data-test": "timeline-chart-container" }, /* @__PURE__ */ react_exports.createElement(
|
|
4454
|
+
TimelineYAxis_default,
|
|
4455
|
+
{
|
|
4456
|
+
height: chartHeight,
|
|
4457
|
+
laneHeight: LANE_HEIGHT,
|
|
4458
|
+
lanes,
|
|
4459
|
+
yAxisLabelWidth,
|
|
4460
|
+
backgroundColor,
|
|
4461
|
+
highlightedLane,
|
|
4462
|
+
handleLaneClick
|
|
4463
|
+
}
|
|
4464
|
+
), /* @__PURE__ */ react_exports.createElement(TimelineUplotWrapper, { width: chartWidth }, /* @__PURE__ */ react_exports.createElement(
|
|
4465
|
+
uplot_react_default,
|
|
4466
|
+
{
|
|
4467
|
+
key: `timeline-${dprVersion}-${scaleFactor}`,
|
|
4468
|
+
options: opts,
|
|
4469
|
+
data: [[xMin], ...lanes.map(() => [])]
|
|
4470
|
+
}
|
|
4471
|
+
), /* @__PURE__ */ react_exports.createElement(TimelineTooltip_default, __spreadProps(__spreadValues({}, tooltipRef.current), { scaleFactor }))))
|
|
4472
|
+
), showLegend && /* @__PURE__ */ react_exports.createElement(
|
|
4246
4473
|
TimelineLegend_default,
|
|
4247
4474
|
{
|
|
4248
|
-
height:
|
|
4249
|
-
|
|
4475
|
+
height: laneBandHeight,
|
|
4476
|
+
maxHeight: legendMaxHeight,
|
|
4250
4477
|
yAxisLabelWidth,
|
|
4251
4478
|
backgroundColor,
|
|
4252
4479
|
legendDisplay,
|
|
@@ -4296,6 +4523,15 @@ var PureTimeline = (_a) => {
|
|
|
4296
4523
|
const showLegend = (!dataColors || (dataColors == null ? void 0 : dataColors.length) === 0) && (category == null ? void 0 : category.length) > 0 && (legendDisplay === "right" || legendDisplay === "bottom");
|
|
4297
4524
|
const timezone = react_exports.useContext(TimezoneContext_default);
|
|
4298
4525
|
const theme = (0, themes_exports.useSplunkTheme)();
|
|
4526
|
+
const [containerSize, setContainerSize] = react_exports.useState({
|
|
4527
|
+
width: typeof width === "number" ? width : 0,
|
|
4528
|
+
height: typeof height === "number" ? height : 0
|
|
4529
|
+
});
|
|
4530
|
+
const handleResize = react_exports.useCallback((nextWidth, nextHeight) => {
|
|
4531
|
+
setContainerSize(
|
|
4532
|
+
(current) => current.width === nextWidth && current.height === nextHeight ? current : { width: nextWidth, height: nextHeight }
|
|
4533
|
+
);
|
|
4534
|
+
}, []);
|
|
4299
4535
|
const { laneSeries, lanes, categoricalColors, tickInterval, hasInvalidData } = mapDataToTimeline({
|
|
4300
4536
|
resultLimit,
|
|
4301
4537
|
x,
|
|
@@ -4370,11 +4606,13 @@ var PureTimeline = (_a) => {
|
|
|
4370
4606
|
height,
|
|
4371
4607
|
"data-test-data-colors": JSON.stringify(dataColors)
|
|
4372
4608
|
},
|
|
4609
|
+
/* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: handleResize }),
|
|
4373
4610
|
/* @__PURE__ */ react_exports.createElement(
|
|
4374
4611
|
TimelineUplot_default,
|
|
4375
4612
|
{
|
|
4376
4613
|
backgroundColor: backgroundColor || theme.backgroundColorPage,
|
|
4377
|
-
width,
|
|
4614
|
+
width: containerSize.width,
|
|
4615
|
+
height: containerSize.height,
|
|
4378
4616
|
lanes,
|
|
4379
4617
|
laneSeries,
|
|
4380
4618
|
yAxisLabelWidth,
|
|
@@ -4397,8 +4635,8 @@ PureTimeline.propTypes = {
|
|
|
4397
4635
|
duration: prop_types_exports.arrayOf(prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number])),
|
|
4398
4636
|
category: prop_types_exports.arrayOf(prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number])),
|
|
4399
4637
|
backgroundColor: prop_types_exports.string,
|
|
4400
|
-
width: prop_types_exports.number,
|
|
4401
|
-
height: prop_types_exports.number,
|
|
4638
|
+
width: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
4639
|
+
height: prop_types_exports.oneOfType([prop_types_exports.string, prop_types_exports.number]),
|
|
4402
4640
|
xField: prop_types_exports.string,
|
|
4403
4641
|
yField: prop_types_exports.string,
|
|
4404
4642
|
durationField: prop_types_exports.string,
|