@splunk/visualizations 28.3.0 → 28.4.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/Area.d.ts.map +1 -1
- package/Area.config.js +0 -1
- package/Area.config.js.map +2 -2
- package/Area.js +495 -99
- package/Area.js.map +3 -3
- package/Bar/Bar.d.ts.map +1 -1
- package/Bar.config.js +0 -1
- package/Bar.config.js.map +2 -2
- package/Bar.js +505 -99
- package/Bar.js.map +3 -3
- package/Bubble.config.js +0 -1
- package/Bubble.config.js.map +2 -2
- package/Bubble.js +494 -86
- package/Bubble.js.map +3 -3
- package/CHANGELOG.external.md +76 -0
- package/ChoroplethSvg/ChoroplethSvg.d.ts +4 -3
- package/ChoroplethSvg/ChoroplethSvg.d.ts.map +1 -1
- package/ChoroplethSvg.config.js +1 -3
- package/ChoroplethSvg.config.js.map +2 -2
- package/ChoroplethSvg.js +539 -103
- package/ChoroplethSvg.js.map +4 -4
- package/Column/Column.d.ts.map +1 -1
- package/Column.config.js +0 -1
- package/Column.config.js.map +2 -2
- package/Column.js +495 -99
- package/Column.js.map +3 -3
- package/Ellipse.js +528 -104
- package/Ellipse.js.map +4 -4
- package/Events/PureEvents/PureEvents.d.ts.map +1 -1
- package/Events.js +612 -149
- package/Events.js.map +4 -4
- package/FillerGauge/FillerGauge.d.ts.map +1 -1
- package/FillerGauge/PureFillerGauge/FillerGauge.d.ts.map +1 -1
- package/FillerGauge.js +535 -140
- package/FillerGauge.js.map +4 -4
- package/Image/Image.d.ts.map +1 -1
- package/Image.js +564 -108
- package/Image.js.map +4 -4
- package/Line/Line.d.ts.map +1 -1
- package/Line/lineUtils.d.ts.map +1 -1
- package/Line/mockdata/LineData.d.ts +59 -0
- package/Line/mockdata/LineData.d.ts.map +1 -1
- package/Line.config.js +0 -1
- package/Line.config.js.map +2 -2
- package/Line.js +601 -100
- package/Line.js.map +3 -3
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts +5 -0
- package/LinkGraph/PureLinkGraph/PureLinkGraph.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/PureLinkGraphUtils.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Graph.d.ts +9 -1
- package/LinkGraph/PureLinkGraph/components/Graph.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/GraphStyles.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Node.d.ts +1 -0
- package/LinkGraph/PureLinkGraph/components/Node.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/components/Nodes.d.ts +1 -0
- package/LinkGraph/PureLinkGraph/components/Nodes.d.ts.map +1 -1
- package/LinkGraph/PureLinkGraph/measurementUtils.d.ts +16 -0
- package/LinkGraph/PureLinkGraph/measurementUtils.d.ts.map +1 -0
- package/LinkGraph/PureLinkGraph/utils/iconLoader.d.ts.map +1 -1
- package/LinkGraph/config.d.ts.map +1 -1
- package/LinkGraph.config.js +15 -1
- package/LinkGraph.config.js.map +2 -2
- package/LinkGraph.js +1355 -654
- package/LinkGraph.js.map +4 -4
- package/Map/Map.d.ts +2 -2
- package/Map/Map.d.ts.map +1 -1
- package/Map/PureMap/BubbleLayer.d.ts +5 -0
- package/Map/PureMap/BubbleLayer.d.ts.map +1 -1
- package/Map/PureMap/LocalChoroplethLayer.d.ts.map +1 -1
- package/Map/PureMap/PureMap.d.ts.map +1 -1
- package/Map/PureMap/PureMapContainer.d.ts.map +1 -1
- package/Map/PureMap/Tooltip.d.ts.map +1 -1
- package/Map/config.d.ts.map +1 -1
- package/Map.config.js +0 -1
- package/Map.config.js.map +2 -2
- package/Map.js +738 -228
- package/Map.js.map +4 -4
- package/Markdown/Markdown.d.ts.map +1 -1
- package/Markdown.js +548 -95
- package/Markdown.js.map +4 -4
- package/MarkerGauge/MarkerGauge.d.ts +5 -1
- package/MarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts +4 -0
- package/MarkerGauge/PureMarkerGauge/MarkerGauge.d.ts.map +1 -1
- package/MarkerGauge/config.d.ts.map +1 -1
- package/MarkerGauge.config.js +121 -3
- package/MarkerGauge.config.js.map +3 -3
- package/MarkerGauge.js +1318 -142
- package/MarkerGauge.js.map +4 -4
- package/NetworkGraph/NetworkGraph.d.ts +22 -0
- package/NetworkGraph/NetworkGraph.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts +60 -0
- package/NetworkGraph/PureNetworkGraph/PureNetworkGraph.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Link.d.ts +19 -0
- package/NetworkGraph/PureNetworkGraph/components/Link.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts +29 -0
- package/NetworkGraph/PureNetworkGraph/components/NetworkGraphSvg.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts +27 -0
- package/NetworkGraph/PureNetworkGraph/components/Node.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts +12 -0
- package/NetworkGraph/PureNetworkGraph/components/Tooltip.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts +13 -0
- package/NetworkGraph/PureNetworkGraph/components/ZoomControls.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts +140 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/data.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts +89 -0
- package/NetworkGraph/PureNetworkGraph/mockdata/datasource.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts +47 -0
- package/NetworkGraph/PureNetworkGraph/utils/forceLayout.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts +78 -0
- package/NetworkGraph/PureNetworkGraph/utils/iconLoader.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts +111 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphShared.d.ts.map +1 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts +123 -0
- package/NetworkGraph/PureNetworkGraph/utils/networkGraphUtils.d.ts.map +1 -0
- package/NetworkGraph/config.d.ts +4 -0
- package/NetworkGraph/config.d.ts.map +1 -0
- package/NetworkGraph/index.d.ts +3 -0
- package/NetworkGraph/index.d.ts.map +1 -0
- package/NetworkGraph.config.js +938 -0
- package/NetworkGraph.config.js.map +7 -0
- package/NetworkGraph.js +6793 -0
- package/NetworkGraph.js.map +7 -0
- package/ParallelCoordinates.js +532 -93
- package/ParallelCoordinates.js.map +4 -4
- package/Pie/Pie.d.ts.map +1 -1
- package/Pie/pieUtils.d.ts.map +1 -1
- package/Pie.js +510 -101
- package/Pie.js.map +3 -3
- package/Punchcard.js +523 -84
- package/Punchcard.js.map +4 -4
- package/Rectangle.js +537 -113
- package/Rectangle.js.map +4 -4
- package/Sankey/PureSankey/SankeyTooltip.d.ts.map +1 -1
- package/Sankey.js +562 -111
- package/Sankey.js.map +4 -4
- package/Scatter/Scatter.d.ts.map +1 -1
- package/Scatter.config.js +0 -1
- package/Scatter.config.js.map +2 -2
- package/Scatter.js +505 -99
- package/Scatter.js.map +3 -3
- package/SingleValue/SingleValue.d.ts.map +1 -1
- package/SingleValue/config.d.ts.map +1 -1
- package/SingleValue.config.js +15 -2
- package/SingleValue.config.js.map +2 -2
- package/SingleValue.js +656 -173
- package/SingleValue.js.map +3 -3
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon/SingleValueIcon.d.ts.map +1 -1
- package/SingleValueIcon/config.d.ts.map +1 -1
- package/SingleValueIcon.config.js +0 -1
- package/SingleValueIcon.config.js.map +2 -2
- package/SingleValueIcon.js +512 -124
- package/SingleValueIcon.js.map +3 -3
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts +0 -8
- package/SingleValueRadial/PureSingleValueRadial/utils/gaugeUtils.d.ts.map +1 -1
- package/SingleValueRadial/SingleValueRadial.d.ts.map +1 -1
- package/SingleValueRadial.config.js +0 -1
- package/SingleValueRadial.config.js.map +2 -2
- package/SingleValueRadial.js +517 -124
- package/SingleValueRadial.js.map +4 -4
- package/SparkLine.js +46 -8
- package/SparkLine.js.map +2 -2
- package/Table/PureTable.d.ts +10 -0
- package/Table/PureTable.d.ts.map +1 -1
- package/Table/cells/SparklineCell.d.ts.map +1 -1
- package/Table/config.d.ts.map +1 -1
- package/Table/hooks.d.ts +4 -0
- package/Table/hooks.d.ts.map +1 -1
- package/Table.config.js +1 -1
- package/Table.config.js.map +2 -2
- package/Table.js +760 -223
- package/Table.js.map +4 -4
- package/Timeline/PureTimeline/src/CursorPlugin.d.ts.map +1 -1
- package/Timeline/PureTimeline/src/TimelineLegend.d.ts.map +1 -1
- package/Timeline/config.d.ts.map +1 -1
- package/Timeline.config.js +31 -12
- package/Timeline.config.js.map +4 -4
- package/Timeline.js +649 -211
- package/Timeline.js.map +4 -4
- package/common/Charting.d.ts +5 -0
- package/common/Charting.d.ts.map +1 -1
- package/common/Charting.js +12 -0
- package/common/Charting.js.map +2 -2
- package/common/OptionsDoc.js.map +1 -1
- package/common/ThemesDoc.js +0 -1
- package/common/ThemesDoc.js.map +2 -2
- package/common/TimeSeriesChartWrapper.d.ts +24 -11
- package/common/TimeSeriesChartWrapper.d.ts.map +1 -1
- package/common/TimeSeriesChartWrapper.js +561 -83
- package/common/TimeSeriesChartWrapper.js.map +4 -4
- package/common/chartingUtils.d.ts +45 -5
- package/common/chartingUtils.d.ts.map +1 -1
- package/common/chartingUtils.js +102 -8
- package/common/chartingUtils.js.map +3 -3
- package/common/editorConfig/AxesChartDataConfig.d.ts.map +1 -1
- package/common/hocs/withTrellis.d.ts.map +1 -1
- package/common/interfaces/DashboardVizProps.d.ts +0 -3
- package/common/interfaces/DashboardVizProps.d.ts.map +1 -1
- package/common/interfaces/DataSource.d.ts +1 -1
- package/common/interfaces/DataSource.d.ts.map +1 -1
- package/common/shapeUtils.js +5 -20
- package/common/shapeUtils.js.map +2 -2
- package/common/utils/dataUtils.d.ts.map +1 -1
- package/common/utils/dataUtils.js +5 -4
- package/common/utils/dataUtils.js.map +2 -2
- package/common/utils/mapUtils.js +16 -9
- package/common/utils/mapUtils.js.map +2 -2
- package/common/utils/singleValueUtils.js +17 -18
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/textUtils.d.ts +20 -0
- package/common/utils/textUtils.d.ts.map +1 -0
- package/common/utils/textUtils.js +76 -0
- package/common/utils/textUtils.js.map +7 -0
- package/common/utils/trellisUtils.d.ts.map +1 -1
- package/common/utils/trellisUtils.js +12 -14
- package/common/utils/trellisUtils.js.map +2 -2
- package/common/withDashboardViz.d.ts.map +1 -1
- package/common/withDashboardViz.js +544 -84
- package/common/withDashboardViz.js.map +4 -4
- package/package.json +33 -26
- package/common/utils/styleUtils.d.ts +0 -2
- package/common/utils/styleUtils.d.ts.map +0 -1
- package/common/utils/styleUtils.js +0 -30
- package/common/utils/styleUtils.js.map +0 -7
package/Events.js
CHANGED
|
@@ -489,7 +489,7 @@ var Cover = styled_components_default.div`
|
|
|
489
489
|
bottom: 0;
|
|
490
490
|
`;
|
|
491
491
|
var Blocker = styled_components_default.div.attrs({
|
|
492
|
-
"data-splunk-visualization-version": "28.
|
|
492
|
+
"data-splunk-visualization-version": "28.4.0 - 002bd482f"
|
|
493
493
|
})`
|
|
494
494
|
position: relative;
|
|
495
495
|
width: 100%;
|
|
@@ -588,7 +588,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
588
588
|
FixSizeItem,
|
|
589
589
|
{
|
|
590
590
|
"data-test": "fix-size-item",
|
|
591
|
-
"data-splunk-visualization-version": "28.
|
|
591
|
+
"data-splunk-visualization-version": "28.4.0 - 002bd482f",
|
|
592
592
|
width,
|
|
593
593
|
height,
|
|
594
594
|
backgroundColor
|
|
@@ -690,7 +690,7 @@ var convertToArrOfObjects = (columns, fields) => {
|
|
|
690
690
|
for (let i = 0; i < columns[0].length; i += 1) {
|
|
691
691
|
const newObj = {};
|
|
692
692
|
fields.forEach((field, index) => {
|
|
693
|
-
const fieldName =
|
|
693
|
+
const fieldName = getFieldName(field);
|
|
694
694
|
if (columns[index][i] === "") {
|
|
695
695
|
newObj[fieldName] = null;
|
|
696
696
|
} else {
|
|
@@ -701,6 +701,7 @@ var convertToArrOfObjects = (columns, fields) => {
|
|
|
701
701
|
}
|
|
702
702
|
return data;
|
|
703
703
|
};
|
|
704
|
+
var getFieldName = (field) => typeof field === "string" ? field : field.name;
|
|
704
705
|
var largestTriangleThreeBuckets = (data, threshold, preferredDownsampleIndices) => {
|
|
705
706
|
const dataLength = data.length;
|
|
706
707
|
const downsampledIndices = [];
|
|
@@ -817,9 +818,9 @@ var tryToCoerceAllDisplayedFields = (ds, xField, yFields, fieldTypes, options) =
|
|
|
817
818
|
let xColumn = [];
|
|
818
819
|
const yColumns = [];
|
|
819
820
|
const canDownsample = !ds.data.fields.some((field, index) => {
|
|
820
|
-
var _a
|
|
821
|
-
const fieldName = (
|
|
822
|
-
const fieldType = (
|
|
821
|
+
var _a;
|
|
822
|
+
const fieldName = getFieldName(field);
|
|
823
|
+
const fieldType = (_a = fieldTypes[index]) != null ? _a : "unknown";
|
|
823
824
|
const column = ds.data.columns[index];
|
|
824
825
|
let hasDisplayedColumnThatCantBeDownsampled = false;
|
|
825
826
|
if (fieldName === xField) {
|
|
@@ -1172,6 +1173,16 @@ var triangleEventAnnotationRenderer = ({
|
|
|
1172
1173
|
eventColor: eventWithColor.color
|
|
1173
1174
|
});
|
|
1174
1175
|
};
|
|
1176
|
+
var shouldEnableSearchZoom = (eventHandlers = [], xField = "") => {
|
|
1177
|
+
const rangeSelectEventHandler = eventHandlers.find(
|
|
1178
|
+
(eventHandler) => {
|
|
1179
|
+
var _a;
|
|
1180
|
+
return (_a = eventHandler.options.events) == null ? void 0 : _a.includes("range.select");
|
|
1181
|
+
}
|
|
1182
|
+
);
|
|
1183
|
+
const xAxisIsTime = xField === "_time";
|
|
1184
|
+
return !!rangeSelectEventHandler && xAxisIsTime;
|
|
1185
|
+
};
|
|
1175
1186
|
var canvasSupportedTimeSeriesCharts = ["splunk.line"];
|
|
1176
1187
|
var isTimeSeriesCanvasRenderSupported = (vizConfigKey) => {
|
|
1177
1188
|
return canvasSupportedTimeSeriesCharts.indexOf(vizConfigKey) > -1;
|
|
@@ -1192,16 +1203,31 @@ var filterChartDataFromInternalFields = (chartData) => {
|
|
|
1192
1203
|
var convert2DArrayToNumbers = (arr) => {
|
|
1193
1204
|
return arr.map((subArray) => subArray.map((element) => parseFloat(element)));
|
|
1194
1205
|
};
|
|
1206
|
+
var parseAxisValue = (val) => {
|
|
1207
|
+
if (val === void 0 || val === null || val === "auto" || val === "") {
|
|
1208
|
+
return void 0;
|
|
1209
|
+
}
|
|
1210
|
+
const num = typeof val === "number" ? val : Number.parseFloat(val);
|
|
1211
|
+
return Number.isNaN(num) ? void 0 : num;
|
|
1212
|
+
};
|
|
1195
1213
|
var SideLegendWidth = 75;
|
|
1196
|
-
var
|
|
1214
|
+
var SeriesCompareLegendWidth = 200;
|
|
1197
1215
|
var getLegend = (props) => {
|
|
1198
1216
|
const legendPlacement = props == null ? void 0 : props.legendDisplay;
|
|
1217
|
+
const { isSeriesCompare } = props;
|
|
1218
|
+
const commonLegendProps = {
|
|
1219
|
+
center: true,
|
|
1220
|
+
fontSize: 12,
|
|
1221
|
+
largerTiles: true,
|
|
1222
|
+
hideSeriesValue: !isSeriesCompare
|
|
1223
|
+
// Show values if in seriesCompare mode
|
|
1224
|
+
};
|
|
1199
1225
|
switch (legendPlacement) {
|
|
1200
1226
|
case "off":
|
|
1201
1227
|
return false;
|
|
1202
1228
|
case "left":
|
|
1203
1229
|
return (0, visualization_canvas_exports.LeftLegendFactory)(__spreadValues({
|
|
1204
|
-
width: SideLegendWidth
|
|
1230
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
1205
1231
|
}, commonLegendProps));
|
|
1206
1232
|
case "bottom":
|
|
1207
1233
|
return (0, visualization_canvas_exports.BottomLegendFactory)(__spreadValues({
|
|
@@ -1213,7 +1239,7 @@ var getLegend = (props) => {
|
|
|
1213
1239
|
}, commonLegendProps));
|
|
1214
1240
|
default:
|
|
1215
1241
|
return (0, visualization_canvas_exports.SideLegendFactory)(__spreadValues({
|
|
1216
|
-
width: SideLegendWidth
|
|
1242
|
+
width: isSeriesCompare ? SeriesCompareLegendWidth : SideLegendWidth
|
|
1217
1243
|
}, commonLegendProps));
|
|
1218
1244
|
}
|
|
1219
1245
|
};
|
|
@@ -1249,22 +1275,25 @@ var ellipsisAxisTitle = (axisTitle, containerSpacing, fontSize = 12) => {
|
|
|
1249
1275
|
const end = axisTitle.slice(-halfChars);
|
|
1250
1276
|
return `${start}...${end}`;
|
|
1251
1277
|
};
|
|
1252
|
-
var
|
|
1278
|
+
var getFieldName2 = (field) => {
|
|
1253
1279
|
const fieldName = typeof field === "object" ? field == null ? void 0 : field.name : field;
|
|
1254
1280
|
return fieldName;
|
|
1255
1281
|
};
|
|
1256
1282
|
var getFieldNames = (fields) => {
|
|
1257
|
-
return fields.map((field) =>
|
|
1283
|
+
return fields.map((field) => getFieldName2(field));
|
|
1258
1284
|
};
|
|
1259
|
-
var getXScaleConfig = (label, xAxisLabelVisibility) => {
|
|
1285
|
+
var getXScaleConfig = (label, xAxisLabelVisibility, xAxisLabelRotation) => {
|
|
1260
1286
|
const xConfig = { x: {} };
|
|
1261
1287
|
xConfig.x.label = label;
|
|
1262
1288
|
if (xAxisLabelVisibility === "hide") {
|
|
1263
1289
|
xConfig.x.hideLabels = true;
|
|
1264
1290
|
}
|
|
1291
|
+
if (xAxisLabelRotation !== void 0) {
|
|
1292
|
+
xConfig.x.labelRotation = xAxisLabelRotation;
|
|
1293
|
+
}
|
|
1265
1294
|
return xConfig;
|
|
1266
1295
|
};
|
|
1267
|
-
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility) => {
|
|
1296
|
+
var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax) => {
|
|
1268
1297
|
const scaleType = yAxisScale != null ? yAxisScale : "linear";
|
|
1269
1298
|
const yConfig = { y: {} };
|
|
1270
1299
|
yConfig.y.label = label;
|
|
@@ -1280,14 +1309,20 @@ var getYScaleConfig = (label, yAxisAbbreviation, yAxisScale, yAxisLabelVisibilit
|
|
|
1280
1309
|
if (yAxisLabelVisibility === "hide") {
|
|
1281
1310
|
yConfig.y.hideLabels = true;
|
|
1282
1311
|
}
|
|
1312
|
+
if (yAxisMin !== void 0 || yAxisMax !== void 0) {
|
|
1313
|
+
yConfig.y.range = (u, dataMin, dataMax) => {
|
|
1314
|
+
const min = yAxisMin != null ? yAxisMin : dataMin;
|
|
1315
|
+
const max = yAxisMax != null ? yAxisMax : dataMax;
|
|
1316
|
+
return [min, max];
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1283
1319
|
return yConfig;
|
|
1284
1320
|
};
|
|
1285
|
-
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility) => {
|
|
1321
|
+
var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInteger, y2AxisLabelVisibility, y2AxisMin, y2AxisMax) => {
|
|
1286
1322
|
const y2Config = { y2: {} };
|
|
1287
1323
|
const scaleType = axisScale != null ? axisScale : "linear";
|
|
1288
1324
|
y2Config.y2.label = label;
|
|
1289
1325
|
y2Config.y2.side = "right";
|
|
1290
|
-
y2Config.y2.showGrid = false;
|
|
1291
1326
|
y2Config.y2.type = scaleType;
|
|
1292
1327
|
if (axisAbbreviation !== "none") {
|
|
1293
1328
|
y2Config.y2.tickFmt = (v) => (0, visualization_canvas_exports.shortenNumber)(v, 1, roundAxisLabelsToInteger);
|
|
@@ -1297,9 +1332,16 @@ var getY2ScaleConfig = (label, axisAbbreviation, axisScale, roundAxisLabelsToInt
|
|
|
1297
1332
|
if (y2AxisLabelVisibility === "hide") {
|
|
1298
1333
|
y2Config.y2.hideLabels = true;
|
|
1299
1334
|
}
|
|
1335
|
+
if (y2AxisMin !== void 0 || y2AxisMax !== void 0) {
|
|
1336
|
+
y2Config.y2.range = (u, dataMin, dataMax) => {
|
|
1337
|
+
const min = y2AxisMin != null ? y2AxisMin : dataMin;
|
|
1338
|
+
const max = y2AxisMax != null ? y2AxisMax : dataMax;
|
|
1339
|
+
return [min, max];
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1300
1342
|
return y2Config;
|
|
1301
1343
|
};
|
|
1302
|
-
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay) => {
|
|
1344
|
+
var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled, nullValueMode, markerDisplay, lineDashStyle, lineDashStylesByField) => {
|
|
1303
1345
|
const seriesConfig = {};
|
|
1304
1346
|
let spanGaps;
|
|
1305
1347
|
let replaceNullsWithZero;
|
|
@@ -1334,12 +1376,96 @@ var getSeriesOverrides = (yfields, y2fields, lineWidth, overlayFields, y2Enabled
|
|
|
1334
1376
|
if (markerDisplay !== void 0) {
|
|
1335
1377
|
seriesConfig[field].markerDisplay = markerDisplay;
|
|
1336
1378
|
}
|
|
1379
|
+
const fieldDashStyle = (lineDashStylesByField == null ? void 0 : lineDashStylesByField[field]) || lineDashStyle;
|
|
1380
|
+
if (fieldDashStyle) {
|
|
1381
|
+
seriesConfig[field].lineDashStyle = fieldDashStyle;
|
|
1382
|
+
}
|
|
1337
1383
|
if (replaceNullsWithZero !== void 0) {
|
|
1338
1384
|
seriesConfig[field].replaceNullsWithZero = replaceNullsWithZero;
|
|
1339
1385
|
}
|
|
1340
1386
|
});
|
|
1341
1387
|
return seriesConfig;
|
|
1342
1388
|
};
|
|
1389
|
+
var findRangeIndices = (xData, startValue, endValue) => {
|
|
1390
|
+
let startXIndex = -1;
|
|
1391
|
+
let endXIndex = -1;
|
|
1392
|
+
const xDataEpoch = xData.map((val) => {
|
|
1393
|
+
if (typeof val === "string") {
|
|
1394
|
+
return new Date(val).getTime() / 1e3;
|
|
1395
|
+
}
|
|
1396
|
+
return val;
|
|
1397
|
+
});
|
|
1398
|
+
for (let i = 0; i < xDataEpoch.length; i += 1) {
|
|
1399
|
+
if (xDataEpoch[i] >= startValue) {
|
|
1400
|
+
startXIndex = i;
|
|
1401
|
+
break;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
if (startXIndex === -1 && xDataEpoch.length > 0) {
|
|
1405
|
+
startXIndex = xDataEpoch.length - 1;
|
|
1406
|
+
}
|
|
1407
|
+
for (let i = xDataEpoch.length - 1; i >= 0; i -= 1) {
|
|
1408
|
+
if (xDataEpoch[i] <= endValue) {
|
|
1409
|
+
endXIndex = i;
|
|
1410
|
+
break;
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
if (endXIndex === -1 && xDataEpoch.length > 0) {
|
|
1414
|
+
endXIndex = 0;
|
|
1415
|
+
}
|
|
1416
|
+
return { startXIndex, endXIndex };
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
// esm-externals:@splunk/visualization-schemas
|
|
1420
|
+
var visualization_schemas_exports = {};
|
|
1421
|
+
__export(visualization_schemas_exports, {
|
|
1422
|
+
default: () => visualization_schemas_default
|
|
1423
|
+
});
|
|
1424
|
+
var defaultImport27 = __toESM(require("@splunk/visualization-schemas"));
|
|
1425
|
+
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
1426
|
+
var visualization_schemas_default = "default" in defaultImport27 ? defaultImport27.default : defaultImport27;
|
|
1427
|
+
|
|
1428
|
+
// src/common/hooks/useTrellisEnabled.ts
|
|
1429
|
+
var useTrellisFeatureFlagOn = () => {
|
|
1430
|
+
const context = (0, react_exports.useContext)(FeatureFlagContext_default);
|
|
1431
|
+
return Boolean(context == null ? void 0 : context.visualizations_enableTrellis);
|
|
1432
|
+
};
|
|
1433
|
+
var useTrellisEnabled = (layoutType = visualization_schemas_exports.LAYOUT_TYPE.Off) => {
|
|
1434
|
+
const trellisFeatureEnabled = useTrellisFeatureFlagOn();
|
|
1435
|
+
return trellisFeatureEnabled && layoutType === visualization_schemas_exports.LAYOUT_TYPE.Trellis;
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
// src/common/components/TrellisTitle.tsx
|
|
1439
|
+
var TRELLIS_TITLE_HEIGHT = 28;
|
|
1440
|
+
var TrellisTitleText = styled_components_default.div`
|
|
1441
|
+
margin-left: 10px;
|
|
1442
|
+
margin-right: 10px;
|
|
1443
|
+
padding-top: 8px;
|
|
1444
|
+
text-overflow: ellipsis;
|
|
1445
|
+
white-space: nowrap;
|
|
1446
|
+
overflow: hidden;
|
|
1447
|
+
`;
|
|
1448
|
+
var TrellisTitleDiv = styled_components_default.div`
|
|
1449
|
+
height: ${TRELLIS_TITLE_HEIGHT}px;
|
|
1450
|
+
font-size: 14px;
|
|
1451
|
+
font-weight: 700;
|
|
1452
|
+
color: ${(props) => props.fontColor};
|
|
1453
|
+
background-color: ${(props) => props.backgroundColor};
|
|
1454
|
+
box-shadow: 0 1px ${(props) => props.backgroundColor}; // this is added to avoid a 1px gap between title and viz divs that showed up intermittently because of pixel rounding error in chrome.
|
|
1455
|
+
`;
|
|
1456
|
+
var TrellisTitle = (props) => {
|
|
1457
|
+
const titleText = String(props.trellisKey).toString();
|
|
1458
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
1459
|
+
TrellisTitleDiv,
|
|
1460
|
+
{
|
|
1461
|
+
fontColor: props.fontColor,
|
|
1462
|
+
backgroundColor: props.backgroundColor,
|
|
1463
|
+
"data-test": "trellis-title",
|
|
1464
|
+
title: titleText
|
|
1465
|
+
},
|
|
1466
|
+
/* @__PURE__ */ react_exports.createElement(TrellisTitleText, null, titleText)
|
|
1467
|
+
);
|
|
1468
|
+
};
|
|
1343
1469
|
|
|
1344
1470
|
// src/common/TimeSeriesChartWrapper.tsx
|
|
1345
1471
|
var TimeSeriesChartContainer = styled_components_default.div`
|
|
@@ -1350,38 +1476,123 @@ var TimeSeriesChartContainer = styled_components_default.div`
|
|
|
1350
1476
|
position: absolute !important; // This is needed for canvas element export pdf/png to work correctly
|
|
1351
1477
|
}
|
|
1352
1478
|
`;
|
|
1353
|
-
var
|
|
1479
|
+
var appendTrellisToPayload = (payload, trellisKey, trellisSplitBy) => {
|
|
1480
|
+
const result = __spreadValues({}, payload);
|
|
1481
|
+
if (trellisSplitBy) {
|
|
1482
|
+
result["trellis.name"] = trellisSplitBy;
|
|
1483
|
+
}
|
|
1484
|
+
if (trellisKey) {
|
|
1485
|
+
result["trellis.value"] = trellisKey;
|
|
1486
|
+
}
|
|
1487
|
+
return result;
|
|
1488
|
+
};
|
|
1489
|
+
var hasMouseoverPayloadChanged = (currentPayload, previousPayload) => {
|
|
1490
|
+
if (!previousPayload) {
|
|
1491
|
+
return true;
|
|
1492
|
+
}
|
|
1493
|
+
if (currentPayload.index !== previousPayload.index) {
|
|
1494
|
+
return true;
|
|
1495
|
+
}
|
|
1496
|
+
if (currentPayload.seriesIndex !== previousPayload.seriesIndex) {
|
|
1497
|
+
return true;
|
|
1498
|
+
}
|
|
1499
|
+
if (currentPayload["trellis.name"] !== previousPayload["trellis.name"]) {
|
|
1500
|
+
return true;
|
|
1501
|
+
}
|
|
1502
|
+
if (currentPayload["trellis.value"] !== previousPayload["trellis.value"]) {
|
|
1503
|
+
return true;
|
|
1504
|
+
}
|
|
1505
|
+
return false;
|
|
1506
|
+
};
|
|
1507
|
+
var handleClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
1354
1508
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(chartEvent, "value", "seriesKey")), {
|
|
1355
1509
|
name: chartEvent.seriesKey
|
|
1356
1510
|
});
|
|
1357
1511
|
delete payload.seriesKey;
|
|
1358
1512
|
if (chartEvent.rowContext) {
|
|
1359
|
-
Object.
|
|
1360
|
-
payload
|
|
1361
|
-
|
|
1513
|
+
Object.assign(
|
|
1514
|
+
payload,
|
|
1515
|
+
Object.keys(chartEvent.rowContext).reduce((acc, fieldName) => {
|
|
1516
|
+
acc[`row.${fieldName}.value`] = chartEvent.rowContext[fieldName];
|
|
1517
|
+
return acc;
|
|
1518
|
+
}, {})
|
|
1519
|
+
);
|
|
1362
1520
|
}
|
|
1521
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1363
1522
|
if (onClick) {
|
|
1364
1523
|
onClick({
|
|
1365
1524
|
type: "point.click",
|
|
1366
1525
|
originalEvent: chartEvent,
|
|
1367
|
-
payload
|
|
1526
|
+
payload: updatedPayload
|
|
1368
1527
|
});
|
|
1369
1528
|
}
|
|
1370
1529
|
};
|
|
1371
|
-
var handleLegendClick = (chartEvent, onClick) => {
|
|
1530
|
+
var handleLegendClick = (chartEvent, onClick, trellisKey, trellisSplitBy) => {
|
|
1372
1531
|
const payload = {
|
|
1373
1532
|
name: chartEvent
|
|
1374
1533
|
};
|
|
1534
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1375
1535
|
if (onClick) {
|
|
1376
1536
|
onClick({
|
|
1377
1537
|
type: "legend.click",
|
|
1378
1538
|
originalEvent: chartEvent,
|
|
1379
|
-
payload
|
|
1539
|
+
payload: updatedPayload
|
|
1540
|
+
});
|
|
1541
|
+
}
|
|
1542
|
+
};
|
|
1543
|
+
var handleRangeSelection = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
1544
|
+
var _a;
|
|
1545
|
+
if (!rangeEvent) {
|
|
1546
|
+
return;
|
|
1547
|
+
}
|
|
1548
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
1549
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
1550
|
+
const payload = {
|
|
1551
|
+
startXIndex,
|
|
1552
|
+
startXValue: rangeEvent.start,
|
|
1553
|
+
endXIndex,
|
|
1554
|
+
endXValue: rangeEvent.end
|
|
1555
|
+
};
|
|
1556
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1557
|
+
if (onSelect) {
|
|
1558
|
+
onSelect({
|
|
1559
|
+
type: "range.selectBeforeZoom",
|
|
1560
|
+
originalEvent: rangeEvent,
|
|
1561
|
+
payload: updatedPayload
|
|
1380
1562
|
});
|
|
1381
1563
|
}
|
|
1382
1564
|
};
|
|
1565
|
+
var handleRangeZoom = (rangeEvent, onSelect, chartData, trellisKey, trellisSplitBy) => {
|
|
1566
|
+
var _a;
|
|
1567
|
+
const xData = ((_a = chartData == null ? void 0 : chartData.columns) == null ? void 0 : _a[0]) || [];
|
|
1568
|
+
const { startXIndex, endXIndex } = findRangeIndices(xData, rangeEvent.start, rangeEvent.end);
|
|
1569
|
+
const payload = {
|
|
1570
|
+
startXIndex,
|
|
1571
|
+
startXValue: rangeEvent.start,
|
|
1572
|
+
endXIndex,
|
|
1573
|
+
endXValue: rangeEvent.end
|
|
1574
|
+
};
|
|
1575
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1576
|
+
if (onSelect) {
|
|
1577
|
+
onSelect({
|
|
1578
|
+
type: "range.select",
|
|
1579
|
+
originalEvent: rangeEvent,
|
|
1580
|
+
payload: updatedPayload
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
var parseArrayOption = (value) => {
|
|
1585
|
+
if (Array.isArray(value)) {
|
|
1586
|
+
return value;
|
|
1587
|
+
}
|
|
1588
|
+
if (value) {
|
|
1589
|
+
return JSON.parse(value);
|
|
1590
|
+
}
|
|
1591
|
+
return void 0;
|
|
1592
|
+
};
|
|
1383
1593
|
var TimeSeriesChartWrapper = (props) => {
|
|
1384
|
-
|
|
1594
|
+
var _b, _c, _d;
|
|
1595
|
+
const _a = props, {
|
|
1385
1596
|
width,
|
|
1386
1597
|
height,
|
|
1387
1598
|
chartData,
|
|
@@ -1394,12 +1605,49 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1394
1605
|
markerDisplay,
|
|
1395
1606
|
onClick,
|
|
1396
1607
|
onPointMouseOver,
|
|
1397
|
-
onPointMouseOut
|
|
1398
|
-
|
|
1399
|
-
|
|
1608
|
+
onPointMouseOut,
|
|
1609
|
+
onSelect,
|
|
1610
|
+
splitByLayout,
|
|
1611
|
+
trellisKey,
|
|
1612
|
+
trellisSplitBy,
|
|
1400
1613
|
backgroundColor,
|
|
1614
|
+
defaultFontColor,
|
|
1615
|
+
additionalTooltipValues,
|
|
1616
|
+
showYAxisWithZero: showYAxisWithZeroFromProps,
|
|
1617
|
+
showY2AxisWithZero: showY2AxisWithZeroFromProps
|
|
1618
|
+
} = _a, otherOptions = __objRest(_a, [
|
|
1619
|
+
"width",
|
|
1620
|
+
"height",
|
|
1621
|
+
"chartData",
|
|
1622
|
+
"options",
|
|
1623
|
+
"userLocale",
|
|
1624
|
+
"annotationX",
|
|
1625
|
+
"annotationLabel",
|
|
1626
|
+
"annotationColor",
|
|
1627
|
+
"legendDisplay",
|
|
1628
|
+
"markerDisplay",
|
|
1629
|
+
"onClick",
|
|
1630
|
+
"onPointMouseOver",
|
|
1631
|
+
"onPointMouseOut",
|
|
1632
|
+
"onSelect",
|
|
1633
|
+
"splitByLayout",
|
|
1634
|
+
"trellisKey",
|
|
1635
|
+
"trellisSplitBy",
|
|
1636
|
+
"backgroundColor",
|
|
1637
|
+
"defaultFontColor",
|
|
1638
|
+
"additionalTooltipValues",
|
|
1639
|
+
// Extract showYAxisWithZero directly from props for accelerated render mode
|
|
1640
|
+
"showYAxisWithZero",
|
|
1641
|
+
"showY2AxisWithZero"
|
|
1642
|
+
]);
|
|
1643
|
+
const { eventHandlers, xField: xFieldFromProps } = otherOptions;
|
|
1644
|
+
const trellisEnabled = useTrellisEnabled(splitByLayout);
|
|
1645
|
+
const {
|
|
1646
|
+
backgroundColor: bgColorFromOptions,
|
|
1401
1647
|
seriesColors: seriesColorsStr,
|
|
1402
1648
|
fieldColors,
|
|
1649
|
+
legendLabels: legendLabelsStr,
|
|
1650
|
+
legendMode,
|
|
1403
1651
|
"axisTitleX.text": xAxisTitleText,
|
|
1404
1652
|
"axisTitleY.text": yAxisTitleText,
|
|
1405
1653
|
"axisTitleY2.text": y2AxisTitleText,
|
|
@@ -1407,8 +1655,11 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1407
1655
|
"axisTitleY.visibility": yAxisTitleVisibility,
|
|
1408
1656
|
"axisTitleY2.visibility": y2AxisTitleVisibility,
|
|
1409
1657
|
"axisLabelsX.majorLabelVisibility": xAxisLabelVisibility,
|
|
1658
|
+
"axisLabelsX.majorLabelStyle.rotation": xAxisLabelRotation,
|
|
1410
1659
|
"axisLabelsY.majorLabelVisibility": yAxisLabelVisibility,
|
|
1660
|
+
"axisLabelsY.majorUnit": yAxisMajorUnitFromSimpleXML,
|
|
1411
1661
|
"axisLabelsY2.majorLabelVisibility": y2AxisLabelVisibility,
|
|
1662
|
+
"axisLabelsY2.majorUnit": y2AxisMajorUnitFromSimpleXML,
|
|
1412
1663
|
"axisY.abbreviation": yAxisAbbreviation,
|
|
1413
1664
|
"axisY.scale": yAxisScale,
|
|
1414
1665
|
"axisY2.abbreviation": y2AxisAbbreviation,
|
|
@@ -1418,10 +1669,63 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1418
1669
|
"axisLabelsY2.integerUnits": y2IntegerUnits,
|
|
1419
1670
|
"chart.overlayFields": overlayFieldsStr,
|
|
1420
1671
|
"chart.nullValueMode": nullValueMode,
|
|
1421
|
-
|
|
1672
|
+
"chart.showDataLabels": showDataLabels,
|
|
1673
|
+
lineWidth,
|
|
1674
|
+
lineDashStyle,
|
|
1675
|
+
fieldDashStyles: lineDashStylesByFieldStr,
|
|
1676
|
+
yAxisMin: yAxisMinRaw,
|
|
1677
|
+
yAxisMax: yAxisMaxRaw,
|
|
1678
|
+
y2AxisMin: y2AxisMinRaw,
|
|
1679
|
+
y2AxisMax: y2AxisMaxRaw,
|
|
1680
|
+
showXMajorGridLines,
|
|
1681
|
+
showYMajorGridLines,
|
|
1682
|
+
showY2MajorGridLines,
|
|
1683
|
+
showYMinorGridLines,
|
|
1684
|
+
showY2MinorGridLines,
|
|
1685
|
+
showLineSmoothing,
|
|
1686
|
+
yAxisMajorTickVisibility,
|
|
1687
|
+
y2AxisMajorTickVisibility,
|
|
1688
|
+
yAxisMajorTickSize,
|
|
1689
|
+
y2AxisMajorTickSize,
|
|
1690
|
+
yAxisMajorTickInterval,
|
|
1691
|
+
y2AxisMajorTickInterval,
|
|
1692
|
+
yAxisMinorTickVisibility,
|
|
1693
|
+
y2AxisMinorTickVisibility,
|
|
1694
|
+
yAxisMinorTickSize,
|
|
1695
|
+
y2AxisMinorTickSize,
|
|
1696
|
+
showYAxisWithZero: showYAxisWithZeroFromOptions,
|
|
1697
|
+
showY2AxisWithZero: showY2AxisWithZeroFromOptions
|
|
1422
1698
|
} = options;
|
|
1699
|
+
const dataValuesDisplay = showDataLabels === "none" ? "off" : showDataLabels;
|
|
1700
|
+
const showYAxisWithZero = showYAxisWithZeroFromProps != null ? showYAxisWithZeroFromProps : showYAxisWithZeroFromOptions;
|
|
1701
|
+
const showY2AxisWithZero = showY2AxisWithZeroFromProps != null ? showY2AxisWithZeroFromProps : showY2AxisWithZeroFromOptions;
|
|
1702
|
+
const showYMajorTicks = yAxisMajorTickVisibility === "show";
|
|
1703
|
+
const showY2MajorTicks = y2AxisMajorTickVisibility === "show";
|
|
1704
|
+
const showYMinorTicks = yAxisMinorTickVisibility === "show";
|
|
1705
|
+
const showY2MinorTicks = y2AxisMinorTickVisibility === "show";
|
|
1706
|
+
const yAxisMin = parseAxisValue(yAxisMinRaw);
|
|
1707
|
+
const yAxisMax = parseAxisValue(yAxisMaxRaw);
|
|
1708
|
+
const y2AxisMin = parseAxisValue(y2AxisMinRaw);
|
|
1709
|
+
const y2AxisMax = parseAxisValue(y2AxisMaxRaw);
|
|
1710
|
+
const parseTickInterval = (simpleXMLValue, canvasValue) => {
|
|
1711
|
+
if (simpleXMLValue) return Number(simpleXMLValue);
|
|
1712
|
+
if (canvasValue) return Number(canvasValue);
|
|
1713
|
+
return void 0;
|
|
1714
|
+
};
|
|
1715
|
+
const yAxisMajorTickIntervalNum = parseTickInterval(yAxisMajorUnitFromSimpleXML, yAxisMajorTickInterval);
|
|
1716
|
+
const y2AxisMajorTickIntervalNum = parseTickInterval(
|
|
1717
|
+
y2AxisMajorUnitFromSimpleXML,
|
|
1718
|
+
y2AxisMajorTickInterval
|
|
1719
|
+
);
|
|
1720
|
+
const yAxisMajorTickSizeNum = yAxisMajorTickSize ? Number(yAxisMajorTickSize) : void 0;
|
|
1721
|
+
const y2AxisMajorTickSizeNum = y2AxisMajorTickSize ? Number(y2AxisMajorTickSize) : void 0;
|
|
1722
|
+
const yAxisMinorTickSizeNum = yAxisMinorTickSize ? Number(yAxisMinorTickSize) : void 0;
|
|
1723
|
+
const y2AxisMinorTickSizeNum = y2AxisMinorTickSize ? Number(y2AxisMinorTickSize) : void 0;
|
|
1423
1724
|
const seriesColors = seriesColorsStr ? JSON.parse(seriesColorsStr) : void 0;
|
|
1424
1725
|
const seriesColorsByField = fieldColors ? JSON.parse(fieldColors) : void 0;
|
|
1726
|
+
const lineDashStylesByField = lineDashStylesByFieldStr ? JSON.parse(lineDashStylesByFieldStr) : void 0;
|
|
1727
|
+
const legendLabels = parseArrayOption(legendLabelsStr);
|
|
1728
|
+
const bgColor = backgroundColor || bgColorFromOptions;
|
|
1425
1729
|
const [containerWidth, setContainerWidth] = react_exports.useState(Number(props.width));
|
|
1426
1730
|
const [containerHeight, setContainerHeight] = react_exports.useState(Number(props.height));
|
|
1427
1731
|
const cachedHandleResize = react_exports.useCallback((w, h) => {
|
|
@@ -1432,31 +1736,64 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1432
1736
|
fields: chartData.fields,
|
|
1433
1737
|
columns: chartData.seriesList
|
|
1434
1738
|
});
|
|
1435
|
-
const xField =
|
|
1739
|
+
const xField = getFieldName2(filteredChartData.fields[0]);
|
|
1436
1740
|
const yFields = getFieldNames(
|
|
1437
1741
|
filteredChartData.fields.length > 1 ? filteredChartData.fields.slice(1) : []
|
|
1438
1742
|
);
|
|
1439
|
-
const y2Fields =
|
|
1440
|
-
|
|
1743
|
+
const y2Fields = (0, react_exports.useMemo)(
|
|
1744
|
+
() => y2FieldsStr ? y2FieldsStr.split(",").map((f) => f.trim()) : [],
|
|
1745
|
+
[y2FieldsStr]
|
|
1746
|
+
);
|
|
1747
|
+
const overlayFields = (0, react_exports.useMemo)(
|
|
1748
|
+
() => overlayFieldsStr ? overlayFieldsStr.split(",").map((f) => f.trim()) : [],
|
|
1749
|
+
[overlayFieldsStr]
|
|
1750
|
+
);
|
|
1441
1751
|
let xAxisTitle = getComputedAxisTitles(xAxisTitleText, [xField], xAxisTitleVisibility);
|
|
1442
1752
|
xAxisTitle = ellipsisAxisTitle(xAxisTitle, containerWidth);
|
|
1443
|
-
|
|
1753
|
+
const yFieldsForTitle = y2Enabled ? yFields.filter((field) => !y2Fields.includes(field)) : yFields;
|
|
1754
|
+
let yAxisTitle = getComputedAxisTitles(yAxisTitleText, yFieldsForTitle, yAxisTitleVisibility);
|
|
1444
1755
|
yAxisTitle = ellipsisAxisTitle(yAxisTitle, containerHeight);
|
|
1445
1756
|
const fieldsForY2Axis = y2Fields.length > 0 ? y2Fields : overlayFields;
|
|
1446
1757
|
let y2AxisTitle = getComputedAxisTitles(y2AxisTitleText, fieldsForY2Axis, y2AxisTitleVisibility);
|
|
1447
1758
|
y2AxisTitle = ellipsisAxisTitle(y2AxisTitle, containerHeight);
|
|
1448
|
-
const xScaleConfig =
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1759
|
+
const xScaleConfig = (0, react_exports.useMemo)(
|
|
1760
|
+
() => getXScaleConfig(xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation),
|
|
1761
|
+
[xAxisTitle, xAxisLabelVisibility, xAxisLabelRotation]
|
|
1762
|
+
);
|
|
1763
|
+
const yScaleConfig = (0, react_exports.useMemo)(
|
|
1764
|
+
() => getYScaleConfig(
|
|
1765
|
+
yAxisTitle,
|
|
1766
|
+
yAxisAbbreviation,
|
|
1767
|
+
yAxisScale,
|
|
1768
|
+
yAxisLabelVisibility,
|
|
1769
|
+
yAxisMin,
|
|
1770
|
+
yAxisMax
|
|
1771
|
+
),
|
|
1772
|
+
[yAxisTitle, yAxisAbbreviation, yAxisScale, yAxisLabelVisibility, yAxisMin, yAxisMax]
|
|
1773
|
+
);
|
|
1774
|
+
const y2ScaleConfig = (0, react_exports.useMemo)(() => {
|
|
1775
|
+
if (y2Enabled) {
|
|
1776
|
+
return getY2ScaleConfig(
|
|
1777
|
+
y2AxisTitle,
|
|
1778
|
+
y2AxisAbbreviation,
|
|
1779
|
+
y2AxisScale,
|
|
1780
|
+
y2IntegerUnits,
|
|
1781
|
+
y2AxisLabelVisibility,
|
|
1782
|
+
y2AxisMin,
|
|
1783
|
+
y2AxisMax
|
|
1784
|
+
);
|
|
1785
|
+
}
|
|
1786
|
+
return {};
|
|
1787
|
+
}, [
|
|
1788
|
+
y2Enabled,
|
|
1789
|
+
y2AxisTitle,
|
|
1790
|
+
y2AxisAbbreviation,
|
|
1791
|
+
y2AxisScale,
|
|
1792
|
+
y2IntegerUnits,
|
|
1793
|
+
y2AxisLabelVisibility,
|
|
1794
|
+
y2AxisMin,
|
|
1795
|
+
y2AxisMax
|
|
1796
|
+
]);
|
|
1460
1797
|
const uplotContainerElement = (0, react_exports.useRef)(null);
|
|
1461
1798
|
const seriesDataFormatted = [
|
|
1462
1799
|
filteredChartData.columns[0],
|
|
@@ -1472,9 +1809,21 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1472
1809
|
overlayFields,
|
|
1473
1810
|
y2Enabled,
|
|
1474
1811
|
nullValueMode,
|
|
1475
|
-
markerDisplay
|
|
1812
|
+
markerDisplay,
|
|
1813
|
+
lineDashStyle,
|
|
1814
|
+
lineDashStylesByField
|
|
1476
1815
|
),
|
|
1477
|
-
[
|
|
1816
|
+
[
|
|
1817
|
+
yFields,
|
|
1818
|
+
y2Fields,
|
|
1819
|
+
lineWidth,
|
|
1820
|
+
overlayFields,
|
|
1821
|
+
y2Enabled,
|
|
1822
|
+
nullValueMode,
|
|
1823
|
+
markerDisplay,
|
|
1824
|
+
lineDashStyle,
|
|
1825
|
+
lineDashStylesByField
|
|
1826
|
+
]
|
|
1478
1827
|
);
|
|
1479
1828
|
const chartingEventAnnotations = (0, react_exports.useMemo)(
|
|
1480
1829
|
() => getAnnotationsForCanvas({
|
|
@@ -1488,25 +1837,54 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1488
1837
|
() => __spreadValues(__spreadValues(__spreadValues({}, xScaleConfig), yScaleConfig), y2ScaleConfig),
|
|
1489
1838
|
[xScaleConfig, yScaleConfig, y2ScaleConfig]
|
|
1490
1839
|
);
|
|
1491
|
-
const legend = (0, react_exports.useMemo)(
|
|
1840
|
+
const legend = (0, react_exports.useMemo)(
|
|
1841
|
+
() => getLegend({ legendDisplay, isSeriesCompare: legendMode === "seriesCompare" }),
|
|
1842
|
+
[legendDisplay, legendMode]
|
|
1843
|
+
);
|
|
1492
1844
|
const handleChartClick = react_exports.useCallback(
|
|
1493
1845
|
(event) => {
|
|
1494
1846
|
if (onClick) {
|
|
1495
|
-
handleClick(event, onClick);
|
|
1847
|
+
handleClick(event, onClick, trellisKey, trellisSplitBy);
|
|
1496
1848
|
}
|
|
1497
1849
|
},
|
|
1498
|
-
[onClick]
|
|
1850
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
1499
1851
|
);
|
|
1500
1852
|
const handleChartLegendClick = react_exports.useCallback(
|
|
1501
1853
|
(event) => {
|
|
1502
1854
|
if (onClick) {
|
|
1503
|
-
handleLegendClick(event, onClick);
|
|
1855
|
+
handleLegendClick(event, onClick, trellisKey, trellisSplitBy);
|
|
1856
|
+
}
|
|
1857
|
+
},
|
|
1858
|
+
[onClick, trellisKey, trellisSplitBy]
|
|
1859
|
+
);
|
|
1860
|
+
const handleChartRangeSelection = react_exports.useCallback(
|
|
1861
|
+
(range2) => {
|
|
1862
|
+
if (onSelect) {
|
|
1863
|
+
handleRangeSelection(range2, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
1864
|
+
}
|
|
1865
|
+
},
|
|
1866
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
1867
|
+
);
|
|
1868
|
+
const handleChartRangeZoom = react_exports.useCallback(
|
|
1869
|
+
(range2) => {
|
|
1870
|
+
if (onSelect) {
|
|
1871
|
+
handleRangeZoom(range2, onSelect, chartData, trellisKey, trellisSplitBy);
|
|
1504
1872
|
}
|
|
1505
1873
|
},
|
|
1506
|
-
[
|
|
1874
|
+
[onSelect, chartData, trellisKey, trellisSplitBy]
|
|
1875
|
+
);
|
|
1876
|
+
const xFieldToUse = xFieldFromProps || xField;
|
|
1877
|
+
const enableSearchZoom = react_exports.useMemo(
|
|
1878
|
+
() => shouldEnableSearchZoom(eventHandlers, xFieldToUse),
|
|
1879
|
+
[eventHandlers, xFieldToUse]
|
|
1507
1880
|
);
|
|
1508
1881
|
const lastPayloadRef = react_exports.useRef(null);
|
|
1509
1882
|
const lastOriginalEventRef = react_exports.useRef(null);
|
|
1883
|
+
const previousMouseoverPayloadRef = react_exports.useRef(null);
|
|
1884
|
+
const additionalTooltipValuesRef = react_exports.useRef(additionalTooltipValues);
|
|
1885
|
+
react_exports.useEffect(() => {
|
|
1886
|
+
additionalTooltipValuesRef.current = additionalTooltipValues;
|
|
1887
|
+
}, [additionalTooltipValues]);
|
|
1510
1888
|
const handleChartCrosshairChange = react_exports.useCallback(
|
|
1511
1889
|
(event) => {
|
|
1512
1890
|
if (onPointMouseOver || onPointMouseOut) {
|
|
@@ -1518,6 +1896,7 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1518
1896
|
payload: lastPayloadRef.current
|
|
1519
1897
|
});
|
|
1520
1898
|
}
|
|
1899
|
+
previousMouseoverPayloadRef.current = null;
|
|
1521
1900
|
return;
|
|
1522
1901
|
}
|
|
1523
1902
|
const payload = __spreadProps(__spreadValues({}, (0, lodash_exports.pick)(event, "value", "seriesKey", "time", "index", "seriesIndex")), {
|
|
@@ -1525,25 +1904,36 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1525
1904
|
});
|
|
1526
1905
|
delete payload.seriesKey;
|
|
1527
1906
|
if (event.rowContext) {
|
|
1528
|
-
Object.
|
|
1529
|
-
payload
|
|
1530
|
-
|
|
1907
|
+
Object.assign(
|
|
1908
|
+
payload,
|
|
1909
|
+
Object.keys(event.rowContext).reduce((acc, fieldName) => {
|
|
1910
|
+
acc[`row.${fieldName}.value`] = event.rowContext[fieldName];
|
|
1911
|
+
return acc;
|
|
1912
|
+
}, {})
|
|
1913
|
+
);
|
|
1531
1914
|
}
|
|
1532
|
-
|
|
1915
|
+
const updatedPayload = appendTrellisToPayload(payload, trellisKey, trellisSplitBy);
|
|
1916
|
+
if (!hasMouseoverPayloadChanged(updatedPayload, previousMouseoverPayloadRef.current)) {
|
|
1917
|
+
return;
|
|
1918
|
+
}
|
|
1919
|
+
lastPayloadRef.current = updatedPayload;
|
|
1533
1920
|
lastOriginalEventRef.current = event;
|
|
1921
|
+
previousMouseoverPayloadRef.current = __spreadValues({}, updatedPayload);
|
|
1534
1922
|
if (onPointMouseOver) {
|
|
1535
1923
|
onPointMouseOver({
|
|
1536
1924
|
type: "point.mouseover",
|
|
1537
1925
|
originalEvent: event,
|
|
1538
|
-
payload
|
|
1926
|
+
payload: updatedPayload
|
|
1539
1927
|
});
|
|
1540
1928
|
}
|
|
1541
1929
|
}
|
|
1542
1930
|
},
|
|
1543
|
-
[onPointMouseOver, onPointMouseOut]
|
|
1931
|
+
[onPointMouseOver, onPointMouseOut, trellisKey, trellisSplitBy]
|
|
1544
1932
|
);
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1933
|
+
const dataKey = `${(_b = chartData.columns[0]) == null ? void 0 : _b[0]}-${(_c = chartData.columns[0]) == null ? void 0 : _c[chartData.columns[0].length - 1]}-${(_d = chartData.columns[0]) == null ? void 0 : _d.length}`;
|
|
1934
|
+
const memoizedChart = (0, react_exports.useMemo)(() => {
|
|
1935
|
+
const computedOnRangeZoom = onSelect ? handleChartRangeZoom : void 0;
|
|
1936
|
+
return /* @__PURE__ */ react_exports.createElement(visualization_canvas_exports.RangeSelectionProvider, { key: dataKey }, /* @__PURE__ */ react_exports.createElement(
|
|
1547
1937
|
visualization_canvas_exports.TimeSeriesChart,
|
|
1548
1938
|
{
|
|
1549
1939
|
data: chartData,
|
|
@@ -1553,49 +1943,107 @@ var TimeSeriesChartWrapper = (props) => {
|
|
|
1553
1943
|
seriesColorsByField,
|
|
1554
1944
|
seriesConfig: seriesOverrides,
|
|
1555
1945
|
legend,
|
|
1946
|
+
legendLabels,
|
|
1947
|
+
isSeriesCompare: legendMode === "seriesCompare",
|
|
1948
|
+
maxSeriesFocus: legendMode === "seriesCompare" ? 0 : void 0,
|
|
1556
1949
|
scaleConfig,
|
|
1557
1950
|
timestampFormat: "expanded",
|
|
1558
1951
|
onCrosshairClick: onClick ? handleChartClick : void 0,
|
|
1559
1952
|
onCrosshairChange: onPointMouseOver || onPointMouseOut ? handleChartCrosshairChange : void 0,
|
|
1560
1953
|
onSeriesClick: onClick ? handleChartLegendClick : void 0,
|
|
1954
|
+
onRangeSelection: handleChartRangeSelection,
|
|
1955
|
+
onRangeZoom: computedOnRangeZoom,
|
|
1956
|
+
serverSideZoom: enableSearchZoom,
|
|
1561
1957
|
userLocale,
|
|
1562
1958
|
events: chartingEventAnnotations,
|
|
1563
|
-
eventsConfig: { renderer: triangleEventAnnotationRenderer }
|
|
1959
|
+
eventsConfig: { renderer: triangleEventAnnotationRenderer },
|
|
1960
|
+
additionalTooltipValuesRef,
|
|
1961
|
+
showXMajorGridLines,
|
|
1962
|
+
showYMajorGridLines,
|
|
1963
|
+
showY2MajorGridLines,
|
|
1964
|
+
showYMinorGridLines,
|
|
1965
|
+
showY2MinorGridLines,
|
|
1966
|
+
showLineSmoothing,
|
|
1967
|
+
dataValuesDisplay,
|
|
1968
|
+
showYMajorTicks,
|
|
1969
|
+
showY2MajorTicks,
|
|
1970
|
+
yAxisMajorTickSize: yAxisMajorTickSizeNum,
|
|
1971
|
+
y2AxisMajorTickSize: y2AxisMajorTickSizeNum,
|
|
1972
|
+
yAxisMajorTickInterval: yAxisMajorTickIntervalNum,
|
|
1973
|
+
y2AxisMajorTickInterval: y2AxisMajorTickIntervalNum,
|
|
1974
|
+
showYMinorTicks,
|
|
1975
|
+
showY2MinorTicks,
|
|
1976
|
+
yAxisMinorTickSize: yAxisMinorTickSizeNum,
|
|
1977
|
+
y2AxisMinorTickSize: y2AxisMinorTickSizeNum,
|
|
1978
|
+
showYAxisWithZero,
|
|
1979
|
+
showY2AxisWithZero
|
|
1564
1980
|
}
|
|
1565
|
-
)
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1981
|
+
));
|
|
1982
|
+
}, [
|
|
1983
|
+
onSelect,
|
|
1984
|
+
handleChartRangeZoom,
|
|
1985
|
+
dataKey,
|
|
1986
|
+
chartData,
|
|
1987
|
+
containerWidth,
|
|
1988
|
+
containerHeight,
|
|
1989
|
+
seriesColors,
|
|
1990
|
+
seriesColorsByField,
|
|
1991
|
+
seriesOverrides,
|
|
1992
|
+
legend,
|
|
1993
|
+
legendLabels,
|
|
1994
|
+
scaleConfig,
|
|
1995
|
+
onClick,
|
|
1996
|
+
handleChartClick,
|
|
1997
|
+
onPointMouseOver,
|
|
1998
|
+
onPointMouseOut,
|
|
1999
|
+
handleChartCrosshairChange,
|
|
2000
|
+
handleChartLegendClick,
|
|
2001
|
+
handleChartRangeSelection,
|
|
2002
|
+
enableSearchZoom,
|
|
2003
|
+
userLocale,
|
|
2004
|
+
chartingEventAnnotations,
|
|
2005
|
+
showXMajorGridLines,
|
|
2006
|
+
showYMajorGridLines,
|
|
2007
|
+
showY2MajorGridLines,
|
|
2008
|
+
showYMinorGridLines,
|
|
2009
|
+
showY2MinorGridLines,
|
|
2010
|
+
showLineSmoothing,
|
|
2011
|
+
dataValuesDisplay,
|
|
2012
|
+
showYMajorTicks,
|
|
2013
|
+
showY2MajorTicks,
|
|
2014
|
+
yAxisMajorTickSizeNum,
|
|
2015
|
+
y2AxisMajorTickSizeNum,
|
|
2016
|
+
yAxisMajorTickIntervalNum,
|
|
2017
|
+
y2AxisMajorTickIntervalNum,
|
|
2018
|
+
showYMinorTicks,
|
|
2019
|
+
showY2MinorTicks,
|
|
2020
|
+
yAxisMinorTickSizeNum,
|
|
2021
|
+
y2AxisMinorTickSizeNum,
|
|
2022
|
+
showYAxisWithZero,
|
|
2023
|
+
showY2AxisWithZero,
|
|
2024
|
+
legendMode
|
|
2025
|
+
]);
|
|
1585
2026
|
const memoizedVisualization = (0, react_exports.useMemo)(() => {
|
|
1586
|
-
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor }, memoizedChart);
|
|
1587
|
-
}, [
|
|
1588
|
-
return /* @__PURE__ */ react_exports.createElement(
|
|
2027
|
+
return /* @__PURE__ */ react_exports.createElement(VizStyleWrapper_default, { backgroundColor: bgColor }, memoizedChart);
|
|
2028
|
+
}, [bgColor, memoizedChart]);
|
|
2029
|
+
return /* @__PURE__ */ react_exports.createElement(react_exports.Fragment, null, trellisEnabled && /* @__PURE__ */ react_exports.createElement(
|
|
2030
|
+
TrellisTitle,
|
|
2031
|
+
{
|
|
2032
|
+
trellisKey,
|
|
2033
|
+
backgroundColor: bgColor,
|
|
2034
|
+
fontColor: defaultFontColor
|
|
2035
|
+
}
|
|
2036
|
+
), /* @__PURE__ */ react_exports.createElement(
|
|
1589
2037
|
TimeSeriesChartContainer,
|
|
1590
2038
|
{
|
|
1591
|
-
height,
|
|
2039
|
+
height: trellisEnabled ? Number(height) - TRELLIS_TITLE_HEIGHT : height,
|
|
1592
2040
|
width,
|
|
1593
2041
|
ref: uplotContainerElement,
|
|
1594
2042
|
"data-test": "timeseries-chart-wrapper"
|
|
1595
2043
|
},
|
|
1596
2044
|
/* @__PURE__ */ react_exports.createElement(SizeAwareWrapper_default, { width, height, onResize: cachedHandleResize }),
|
|
1597
2045
|
memoizedVisualization
|
|
1598
|
-
);
|
|
2046
|
+
));
|
|
1599
2047
|
};
|
|
1600
2048
|
var TimeSeriesChartWrapper_default = TimeSeriesChartWrapper;
|
|
1601
2049
|
|
|
@@ -1890,27 +2338,18 @@ var visualization_icons_exports = {};
|
|
|
1890
2338
|
__export(visualization_icons_exports, {
|
|
1891
2339
|
default: () => visualization_icons_default
|
|
1892
2340
|
});
|
|
1893
|
-
var
|
|
2341
|
+
var defaultImport28 = __toESM(require("@splunk/visualization-icons"));
|
|
1894
2342
|
__reExport(visualization_icons_exports, require("@splunk/visualization-icons"));
|
|
1895
|
-
var visualization_icons_default = "default" in
|
|
2343
|
+
var visualization_icons_default = "default" in defaultImport28 ? defaultImport28.default : defaultImport28;
|
|
1896
2344
|
|
|
1897
2345
|
// esm-externals:@splunk/visualization-icons/placeholders
|
|
1898
2346
|
var placeholders_exports = {};
|
|
1899
2347
|
__export(placeholders_exports, {
|
|
1900
2348
|
default: () => placeholders_default
|
|
1901
2349
|
});
|
|
1902
|
-
var
|
|
2350
|
+
var defaultImport29 = __toESM(require("@splunk/visualization-icons/placeholders"));
|
|
1903
2351
|
__reExport(placeholders_exports, require("@splunk/visualization-icons/placeholders"));
|
|
1904
|
-
var placeholders_default = "default" in
|
|
1905
|
-
|
|
1906
|
-
// esm-externals:@splunk/visualization-schemas
|
|
1907
|
-
var visualization_schemas_exports = {};
|
|
1908
|
-
__export(visualization_schemas_exports, {
|
|
1909
|
-
default: () => visualization_schemas_default
|
|
1910
|
-
});
|
|
1911
|
-
var defaultImport29 = __toESM(require("@splunk/visualization-schemas"));
|
|
1912
|
-
__reExport(visualization_schemas_exports, require("@splunk/visualization-schemas"));
|
|
1913
|
-
var visualization_schemas_default = "default" in defaultImport29 ? defaultImport29.default : defaultImport29;
|
|
2352
|
+
var placeholders_default = "default" in defaultImport29 ? defaultImport29.default : defaultImport29;
|
|
1914
2353
|
|
|
1915
2354
|
// esm-externals:@splunk/visualizations-shared/configUtils
|
|
1916
2355
|
var configUtils_exports = {};
|
|
@@ -2829,30 +3268,51 @@ var PureEvents = (props) => {
|
|
|
2829
3268
|
const [fieldSummaryAnchor, setFieldSummaryAnchor] = react_exports.useState(null);
|
|
2830
3269
|
const [timeValue, setTimeValue] = react_exports.useState(null);
|
|
2831
3270
|
const [timeFieldAnchor, setTimeFieldAnchor] = react_exports.useState(null);
|
|
2832
|
-
|
|
2833
|
-
const
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
});
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
}
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
3271
|
+
react_exports.useEffect(() => {
|
|
3272
|
+
const isPopoverOpen = fieldSummaryAnchor || timeFieldAnchor;
|
|
3273
|
+
if (!isPopoverOpen) return void 0;
|
|
3274
|
+
const handleScroll = () => {
|
|
3275
|
+
if (fieldSummaryAnchor) {
|
|
3276
|
+
setFieldSummaryField(null);
|
|
3277
|
+
setFieldSummaryAnchor(null);
|
|
3278
|
+
}
|
|
3279
|
+
if (timeFieldAnchor) {
|
|
3280
|
+
setTimeValue(null);
|
|
3281
|
+
setTimeFieldAnchor(null);
|
|
3282
|
+
}
|
|
3283
|
+
};
|
|
3284
|
+
window.addEventListener("scroll", handleScroll, { capture: true, passive: true });
|
|
3285
|
+
return () => {
|
|
3286
|
+
window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
3287
|
+
};
|
|
3288
|
+
}, [fieldSummaryAnchor, timeFieldAnchor]);
|
|
3289
|
+
const createEventActionComponent = react_exports.useCallback(
|
|
3290
|
+
(eventActionProps, onMenuItemClick, label) => {
|
|
3291
|
+
const { rowIndex, pageNumber, event } = eventActionProps;
|
|
3292
|
+
const tokenReplacementMap = generateTokenReplacementMap({
|
|
3293
|
+
dataSources,
|
|
3294
|
+
rowIndex,
|
|
3295
|
+
pageNumber,
|
|
3296
|
+
event
|
|
3297
|
+
});
|
|
3298
|
+
const replacedLabel = replaceTokens({
|
|
3299
|
+
text: label,
|
|
3300
|
+
tokenReplacementMap,
|
|
3301
|
+
allowSpecialParametersEscape: false,
|
|
3302
|
+
allowFieldValuesEscape: false
|
|
3303
|
+
});
|
|
3304
|
+
const truncatedLabel = truncateString(replacedLabel);
|
|
3305
|
+
return /* @__PURE__ */ react_exports.createElement(
|
|
3306
|
+
Menu_default.Item,
|
|
3307
|
+
{
|
|
3308
|
+
key: `event-action-${truncatedLabel}`,
|
|
3309
|
+
onClick: (e) => onMenuItemClick(e, eventActionProps, tokenReplacementMap)
|
|
3310
|
+
},
|
|
3311
|
+
truncatedLabel
|
|
3312
|
+
);
|
|
3313
|
+
},
|
|
3314
|
+
[dataSources]
|
|
3315
|
+
);
|
|
2856
3316
|
const renderEventActions = react_exports.useMemo(
|
|
2857
3317
|
() => !Array.isArray(eventActions) ? [] : eventActions.map(({ eventType, label, eventtypeValues = [], fieldFilters = [] }) => {
|
|
2858
3318
|
const onMenuItemClick = (e, eventActionProps, tokenReplacementMap) => {
|
|
@@ -2872,33 +3332,36 @@ var PureEvents = (props) => {
|
|
|
2872
3332
|
eventActionComponent
|
|
2873
3333
|
};
|
|
2874
3334
|
}),
|
|
2875
|
-
[eventActions]
|
|
3335
|
+
[eventActions, createEventActionComponent, onEventTrigger]
|
|
3336
|
+
);
|
|
3337
|
+
const setFieldActionsMapItem = react_exports.useCallback(
|
|
3338
|
+
(currentFieldActions, currentFieldName) => currentFieldActions.map(({ eventType, label, eventtypeValues = [] }) => {
|
|
3339
|
+
const onMenuItemClick = (e, fieldActionProps, tokenReplacementMap) => {
|
|
3340
|
+
const payload = convertToPayloadFormat(fieldActionProps.event, {
|
|
3341
|
+
name: fieldActionProps.field,
|
|
3342
|
+
value: fieldActionProps.value,
|
|
3343
|
+
tokenReplacementMap
|
|
3344
|
+
});
|
|
3345
|
+
onEventTrigger({
|
|
3346
|
+
originalEvent: e,
|
|
3347
|
+
type: eventType,
|
|
3348
|
+
payload
|
|
3349
|
+
});
|
|
3350
|
+
};
|
|
3351
|
+
const fieldActionComponent = (fieldActionProps) => createFieldActionComponent(
|
|
3352
|
+
fieldActionProps,
|
|
3353
|
+
dataSources,
|
|
3354
|
+
label,
|
|
3355
|
+
currentFieldName,
|
|
3356
|
+
onMenuItemClick
|
|
3357
|
+
);
|
|
3358
|
+
return {
|
|
3359
|
+
eventtypeValues,
|
|
3360
|
+
fieldActionComponent
|
|
3361
|
+
};
|
|
3362
|
+
}),
|
|
3363
|
+
[dataSources, onEventTrigger]
|
|
2876
3364
|
);
|
|
2877
|
-
const setFieldActionsMapItem = (currentFieldActions, currentFieldName) => currentFieldActions.map(({ eventType, label, eventtypeValues = [] }) => {
|
|
2878
|
-
const onMenuItemClick = (e, fieldActionProps, tokenReplacementMap) => {
|
|
2879
|
-
const payload = convertToPayloadFormat(fieldActionProps.event, {
|
|
2880
|
-
name: fieldActionProps.field,
|
|
2881
|
-
value: fieldActionProps.value,
|
|
2882
|
-
tokenReplacementMap
|
|
2883
|
-
});
|
|
2884
|
-
onEventTrigger({
|
|
2885
|
-
originalEvent: e,
|
|
2886
|
-
type: eventType,
|
|
2887
|
-
payload
|
|
2888
|
-
});
|
|
2889
|
-
};
|
|
2890
|
-
const fieldActionComponent = (fieldActionProps) => createFieldActionComponent(
|
|
2891
|
-
fieldActionProps,
|
|
2892
|
-
dataSources,
|
|
2893
|
-
label,
|
|
2894
|
-
currentFieldName,
|
|
2895
|
-
onMenuItemClick
|
|
2896
|
-
);
|
|
2897
|
-
return {
|
|
2898
|
-
eventtypeValues,
|
|
2899
|
-
fieldActionComponent
|
|
2900
|
-
};
|
|
2901
|
-
});
|
|
2902
3365
|
const renderFieldActions = react_exports.useMemo(() => {
|
|
2903
3366
|
const fieldActionsMap = {};
|
|
2904
3367
|
Object.entries(fieldActions).forEach(
|
|
@@ -2910,7 +3373,7 @@ var PureEvents = (props) => {
|
|
|
2910
3373
|
}
|
|
2911
3374
|
);
|
|
2912
3375
|
return fieldActionsMap;
|
|
2913
|
-
}, [fieldActions]);
|
|
3376
|
+
}, [fieldActions, setFieldActionsMapItem]);
|
|
2914
3377
|
const suiEventsViewerOptions = {
|
|
2915
3378
|
renderEventActions,
|
|
2916
3379
|
renderFieldActions,
|