@splunk/visualizations 27.5.0 → 28.1.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.config.js +19 -21
- package/Area.config.js.map +3 -3
- package/Area.js +55 -33
- package/Area.js.map +3 -3
- package/Bar.config.js +18 -21
- package/Bar.config.js.map +3 -3
- package/Bar.js +49 -32
- package/Bar.js.map +3 -3
- package/Bubble.config.js +39 -44
- package/Bubble.config.js.map +4 -4
- package/Bubble.js +70 -52
- package/Bubble.js.map +4 -4
- package/CHANGELOG.external.md +63 -7
- package/ChoroplethSvg.config.js +47 -43
- package/ChoroplethSvg.config.js.map +4 -4
- package/ChoroplethSvg.js +85 -54
- package/ChoroplethSvg.js.map +4 -4
- package/Column.config.js +15 -20
- package/Column.config.js.map +3 -3
- package/Column.js +43 -30
- package/Column.js.map +3 -3
- package/Ellipse.config.js +16 -7
- package/Ellipse.config.js.map +2 -2
- package/Ellipse.js +46 -20
- package/Ellipse.js.map +2 -2
- package/Events.config.js +38 -27
- package/Events.config.js.map +4 -4
- package/Events.js +114 -98
- package/Events.js.map +4 -4
- package/FEATUREFLAGS.md +9 -9
- package/FillerGauge.config.js +144 -16
- package/FillerGauge.config.js.map +3 -3
- package/FillerGauge.js +891 -101
- package/FillerGauge.js.map +4 -4
- package/Image.config.js +5 -6
- package/Image.config.js.map +2 -2
- package/Image.js +30 -15
- package/Image.js.map +2 -2
- package/Line.config.js +15 -20
- package/Line.config.js.map +3 -3
- package/Line.js +51 -32
- package/Line.js.map +3 -3
- package/LinkGraph.config.js +39 -46
- package/LinkGraph.config.js.map +3 -3
- package/LinkGraph.js +72 -52
- package/LinkGraph.js.map +3 -3
- package/MIGRATION.md +169 -40
- package/Map.config.js +83 -16
- package/Map.config.js.map +4 -4
- package/Map.js +218 -109
- package/Map.js.map +4 -4
- package/Markdown.config.js +4 -5
- package/Markdown.config.js.map +2 -2
- package/Markdown.js +122 -74
- package/Markdown.js.map +3 -3
- package/MarkerGauge.config.js +14 -12
- package/MarkerGauge.config.js.map +3 -3
- package/MarkerGauge.js +108 -70
- package/MarkerGauge.js.map +4 -4
- package/ParallelCoordinates.config.js +14 -12
- package/ParallelCoordinates.config.js.map +3 -3
- package/ParallelCoordinates.js +114 -60
- package/ParallelCoordinates.js.map +3 -3
- package/Pie.config.js +51 -38
- package/Pie.config.js.map +4 -4
- package/Pie.js +110 -86
- package/Pie.js.map +4 -4
- package/Punchcard.config.js +36 -34
- package/Punchcard.config.js.map +4 -4
- package/Punchcard.js +154 -88
- package/Punchcard.js.map +4 -4
- package/README.internal.md +15 -15
- package/README.md +10 -10
- package/Rectangle.config.js +16 -7
- package/Rectangle.config.js.map +2 -2
- package/Rectangle.js +46 -20
- package/Rectangle.js.map +2 -2
- package/Sankey.config.js +69 -17
- package/Sankey.config.js.map +4 -4
- package/Sankey.js +179 -50
- package/Sankey.js.map +4 -4
- package/Scatter.config.js +37 -42
- package/Scatter.config.js.map +3 -3
- package/Scatter.js +71 -54
- package/Scatter.js.map +3 -3
- package/SingleValue.config.js +32 -18
- package/SingleValue.config.js.map +4 -4
- package/SingleValue.js +240 -94
- package/SingleValue.js.map +4 -4
- package/SingleValueBasic.js +1 -0
- package/SingleValueBasic.js.map +2 -2
- package/SingleValueIcon.config.js +22 -11
- package/SingleValueIcon.config.js.map +2 -2
- package/SingleValueIcon.js +85 -29
- package/SingleValueIcon.js.map +2 -2
- package/SingleValueRadial.config.js +34 -23
- package/SingleValueRadial.config.js.map +3 -3
- package/SingleValueRadial.js +90 -49
- package/SingleValueRadial.js.map +4 -4
- package/SparkLine.js +153 -49
- package/SparkLine.js.map +2 -2
- package/TRELLIS.md +2 -2
- package/Table.config.js +93 -52
- package/Table.config.js.map +3 -3
- package/Table.js +513 -202
- package/Table.js.map +4 -4
- package/Timeline.config.js +36 -34
- package/Timeline.config.js.map +4 -4
- package/Timeline.js +131 -83
- package/Timeline.js.map +4 -4
- package/common/Charting.js +1 -0
- package/common/Charting.js.map +2 -2
- package/common/ChartingApi.js +1 -0
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +7 -2
- package/common/DocExampleWithVizSandbox.js.map +2 -2
- package/common/EventsDoc.js +31 -5
- package/common/EventsDoc.js.map +4 -4
- package/common/GaugeMajorTicks.js +4 -1
- package/common/GaugeMajorTicks.js.map +2 -2
- package/common/GaugeValueMarker.js +31 -3
- package/common/GaugeValueMarker.js.map +4 -4
- package/common/OptionsDoc.js +4 -1
- package/common/OptionsDoc.js.map +2 -2
- package/common/OverviewDoc.js +66 -50
- package/common/OverviewDoc.js.map +4 -4
- package/common/SplunkVisualization.js +1 -0
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +1 -0
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemedDefaults.js +67 -0
- package/common/ThemedDefaults.js.map +7 -0
- package/common/ThemesDoc.js +6 -9
- package/common/ThemesDoc.js.map +2 -2
- package/common/chartingUtils.js +1 -0
- package/common/chartingUtils.js.map +2 -2
- package/common/docUtils.js +6 -1
- package/common/docUtils.js.map +2 -2
- package/common/gaugeUtils.js +6 -1
- package/common/gaugeUtils.js.map +2 -2
- package/common/shapeUtils.js +6 -4
- package/common/shapeUtils.js.map +2 -2
- package/common/utils/configUtils.js +4 -5
- package/common/utils/configUtils.js.map +2 -2
- package/common/utils/dataUtils.js +1 -0
- package/common/utils/dataUtils.js.map +2 -2
- package/common/utils/featureFlagUtils.js +1 -0
- package/common/utils/featureFlagUtils.js.map +1 -1
- package/common/utils/hocUtils.js +1 -0
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/mapUtils.js +35 -22
- package/common/utils/mapUtils.js.map +4 -4
- package/common/utils/singleValueUtils.js +8 -2
- package/common/utils/singleValueUtils.js.map +2 -2
- package/common/utils/styleUtils.js +1 -0
- package/common/utils/styleUtils.js.map +1 -1
- package/common/utils/tableUtils.js +59 -0
- package/common/utils/tableUtils.js.map +7 -0
- package/common/utils/testHelper.js +1 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +1 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +1 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +26 -9
- package/common/withDashboardViz.js.map +2 -2
- package/package.json +41 -39
package/Sankey.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Copyright © 2020 Splunk Inc.
|
|
2
2
|
SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
3
3
|
in part without a valid written license from Splunk Inc. is PROHIBITED. */
|
|
4
|
+
"use strict";
|
|
4
5
|
var __create = Object.create;
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
7
|
var __defProps = Object.defineProperties;
|
|
@@ -449,9 +450,14 @@ var Item = styled_components_default.div.attrs(({ width }) => ({
|
|
|
449
450
|
position: relative;
|
|
450
451
|
background-color: ${(props) => (0, colorUtils_exports.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor}};
|
|
451
452
|
`;
|
|
452
|
-
var FixSizeItem = styled_components_default.div.attrs(
|
|
453
|
-
|
|
454
|
-
|
|
453
|
+
var FixSizeItem = styled_components_default.div.attrs(
|
|
454
|
+
({
|
|
455
|
+
width,
|
|
456
|
+
height
|
|
457
|
+
}) => ({
|
|
458
|
+
style: __spreadValues(__spreadValues({}, width && { width: (0, style_exports.toPx)(width) }), height && { height: (0, style_exports.toPx)(height) })
|
|
459
|
+
})
|
|
460
|
+
)`
|
|
455
461
|
position: relative;
|
|
456
462
|
flex-direction: column;
|
|
457
463
|
flex: 1;
|
|
@@ -485,7 +491,7 @@ var withFixedSizeContainer = (Viz) => {
|
|
|
485
491
|
FixSizeItem,
|
|
486
492
|
{
|
|
487
493
|
"data-test": "fix-size-item",
|
|
488
|
-
"data-splunk-visualization-version": "
|
|
494
|
+
"data-splunk-visualization-version": "28.1.0 - 4a1bff08b",
|
|
489
495
|
width,
|
|
490
496
|
height,
|
|
491
497
|
backgroundColor
|
|
@@ -551,7 +557,7 @@ var Cover = styled_components_default.div`
|
|
|
551
557
|
bottom: 0;
|
|
552
558
|
`;
|
|
553
559
|
var Blocker = styled_components_default.div.attrs({
|
|
554
|
-
"data-splunk-visualization-version": "
|
|
560
|
+
"data-splunk-visualization-version": "28.1.0 - 4a1bff08b"
|
|
555
561
|
})`
|
|
556
562
|
position: relative;
|
|
557
563
|
width: 100%;
|
|
@@ -929,7 +935,12 @@ var useGetXAndYFields = ({
|
|
|
929
935
|
y2Fields: options.y2 ? "> y2 | getField()" : void 0,
|
|
930
936
|
fieldTypes: "> primary | getType()"
|
|
931
937
|
};
|
|
932
|
-
const {
|
|
938
|
+
const {
|
|
939
|
+
xField = "",
|
|
940
|
+
yFields = [],
|
|
941
|
+
y2Fields = [],
|
|
942
|
+
fieldTypes
|
|
943
|
+
} = Options_exports.Options.evaluate(
|
|
933
944
|
{ options: optionsToEvaluate, context },
|
|
934
945
|
dataSourcesWithOnlyOnePoint,
|
|
935
946
|
() => {
|
|
@@ -1210,7 +1221,9 @@ var withDashboardViz = (opts) => {
|
|
|
1210
1221
|
return result;
|
|
1211
1222
|
}
|
|
1212
1223
|
} catch (e) {
|
|
1213
|
-
|
|
1224
|
+
if (e instanceof Error) {
|
|
1225
|
+
console.error(`unexpected error evaluating options: ${e.message}`);
|
|
1226
|
+
}
|
|
1214
1227
|
return {};
|
|
1215
1228
|
}
|
|
1216
1229
|
return {};
|
|
@@ -1267,9 +1280,13 @@ var withDashboardViz = (opts) => {
|
|
|
1267
1280
|
}
|
|
1268
1281
|
eventCallbackProps[eventCallbackPropName] = (ev) => {
|
|
1269
1282
|
if (ev && ev.payload) {
|
|
1270
|
-
payload = ev.payload;
|
|
1283
|
+
payload = __spreadValues({}, ev.payload);
|
|
1271
1284
|
}
|
|
1272
|
-
return onEventTrigger({
|
|
1285
|
+
return onEventTrigger({
|
|
1286
|
+
originalEvent: ev,
|
|
1287
|
+
payload,
|
|
1288
|
+
type: eventName
|
|
1289
|
+
});
|
|
1273
1290
|
};
|
|
1274
1291
|
if (parentKeys) {
|
|
1275
1292
|
for (let i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
@@ -1962,9 +1979,17 @@ var truncateSVGTextWithEllipsis = (textElement, textString, width) => {
|
|
|
1962
1979
|
}
|
|
1963
1980
|
}
|
|
1964
1981
|
};
|
|
1982
|
+
var getMaxNode = (nodes) => {
|
|
1983
|
+
if (!nodes || nodes.length === 0) return void 0;
|
|
1984
|
+
return nodes.reduce(
|
|
1985
|
+
(maxNode, currentNode) => currentNode.value > maxNode.value ? currentNode : maxNode
|
|
1986
|
+
);
|
|
1987
|
+
};
|
|
1965
1988
|
|
|
1966
1989
|
// src/Sankey/PureSankey/SankeyNode.tsx
|
|
1967
1990
|
var MAX_NODE_TEXT_WIDTH = 150;
|
|
1991
|
+
var NODE_VALUE_PRECISION = 2;
|
|
1992
|
+
var MIN_NODE_HEIGHT_FOR_LABEL_DISPLAY = 24;
|
|
1968
1993
|
var getNodeOpacity = (nodeIndex, activeNodes) => {
|
|
1969
1994
|
if (!activeNodes || !activeNodes.length) {
|
|
1970
1995
|
return DEFAULT_NODE_OPACITY;
|
|
@@ -1990,11 +2015,13 @@ var NodeText = styled_components_default.text`
|
|
|
1990
2015
|
font-size: 12px;
|
|
1991
2016
|
font-family: ${DEFAULT_FONT_FAMILY};
|
|
1992
2017
|
letter-spacing: 0.02em;
|
|
1993
|
-
fill: ${(props) => props.nodeTextColor};
|
|
2018
|
+
fill: ${(props) => props.isNodeValue && props.nodeValueColor ? props.nodeValueColor : props.nodeTextColor};
|
|
2019
|
+
opacity: ${(props) => props.isNodeValue ? "82%" : "100%"};
|
|
1994
2020
|
`;
|
|
1995
2021
|
var SankeyNode = (props) => {
|
|
1996
2022
|
const {
|
|
1997
2023
|
node,
|
|
2024
|
+
maxNode,
|
|
1998
2025
|
activeNodes,
|
|
1999
2026
|
nodeWidth,
|
|
2000
2027
|
chartWidth,
|
|
@@ -2002,13 +2029,28 @@ var SankeyNode = (props) => {
|
|
|
2002
2029
|
handleMouseLeave,
|
|
2003
2030
|
handleNodeClick,
|
|
2004
2031
|
colorCategoryMapping,
|
|
2005
|
-
nodeTextColor
|
|
2032
|
+
nodeTextColor,
|
|
2033
|
+
nodeValueColor,
|
|
2034
|
+
labelDisplay: labelDisplayInput,
|
|
2035
|
+
unit
|
|
2006
2036
|
} = props;
|
|
2037
|
+
const labelDisplay = labelDisplayInput || "off";
|
|
2007
2038
|
const nodeTextRef = (0, react_exports.useRef)();
|
|
2039
|
+
const nodeValuePercentRef = (0, react_exports.useRef)();
|
|
2040
|
+
let nodeValueFormatted = "";
|
|
2041
|
+
let nodePercentFormatted = "";
|
|
2042
|
+
if (labelDisplay !== "off" && maxNode) {
|
|
2043
|
+
nodeValueFormatted = (0, numberUtils_exports.formatNumber)(node.value, NODE_VALUE_PRECISION, {
|
|
2044
|
+
useTrendUnits: true
|
|
2045
|
+
});
|
|
2046
|
+
const nodePercent = node.value / maxNode.value * 100;
|
|
2047
|
+
nodePercentFormatted = `${(0, numberUtils_exports.formatNumber)(nodePercent, NODE_VALUE_PRECISION)}%`;
|
|
2048
|
+
}
|
|
2008
2049
|
(0, react_exports.useEffect)(() => {
|
|
2009
2050
|
truncateSVGTextWithEllipsis(nodeTextRef.current, node.name, MAX_NODE_TEXT_WIDTH);
|
|
2010
2051
|
});
|
|
2011
2052
|
const nodeClickHandler = (0, react_exports.useCallback)(() => handleNodeClick(node), [node]);
|
|
2053
|
+
const nodeHeight = getNodeHeight(node);
|
|
2012
2054
|
return /* @__PURE__ */ react_exports.createElement(
|
|
2013
2055
|
NodeGroup,
|
|
2014
2056
|
{
|
|
@@ -2024,7 +2066,8 @@ var SankeyNode = (props) => {
|
|
|
2024
2066
|
NodeRect,
|
|
2025
2067
|
{
|
|
2026
2068
|
node,
|
|
2027
|
-
|
|
2069
|
+
"data-test": `node-rect-${node.index}`,
|
|
2070
|
+
height: nodeHeight,
|
|
2028
2071
|
width: nodeWidth,
|
|
2029
2072
|
colorCategoryMapping,
|
|
2030
2073
|
onMouseOver: (ev) => handleMouseOver(ev),
|
|
@@ -2035,13 +2078,31 @@ var SankeyNode = (props) => {
|
|
|
2035
2078
|
{
|
|
2036
2079
|
ref: nodeTextRef,
|
|
2037
2080
|
node,
|
|
2081
|
+
"data-test": `node-text-${node.index}`,
|
|
2038
2082
|
chartWidth,
|
|
2039
2083
|
x: node.x < chartWidth / 2 ? 6 + nodeWidth : -6,
|
|
2040
|
-
y: node.dy / 2,
|
|
2084
|
+
y: labelDisplay !== "off" && nodeHeight >= MIN_NODE_HEIGHT_FOR_LABEL_DISPLAY ? node.dy / 2 - 6.5 : node.dy / 2,
|
|
2041
2085
|
dy: ".35em",
|
|
2042
2086
|
nodeTextColor
|
|
2043
2087
|
},
|
|
2044
2088
|
node.name
|
|
2089
|
+
), labelDisplay !== "off" && nodeHeight >= MIN_NODE_HEIGHT_FOR_LABEL_DISPLAY && /* @__PURE__ */ react_exports.createElement(
|
|
2090
|
+
NodeText,
|
|
2091
|
+
{
|
|
2092
|
+
ref: nodeValuePercentRef,
|
|
2093
|
+
node,
|
|
2094
|
+
"data-test": `node-label-${node.index}`,
|
|
2095
|
+
chartWidth,
|
|
2096
|
+
x: node.x < chartWidth / 2 ? 6 + nodeWidth : -6,
|
|
2097
|
+
y: node.dy / 2 + 6.5,
|
|
2098
|
+
dy: ".35em",
|
|
2099
|
+
nodeTextColor,
|
|
2100
|
+
isNodeValue: true,
|
|
2101
|
+
nodeValueColor
|
|
2102
|
+
},
|
|
2103
|
+
labelDisplay === "values" && `${unit}${nodeValueFormatted}`,
|
|
2104
|
+
labelDisplay === "percentage" && nodePercentFormatted,
|
|
2105
|
+
labelDisplay === "valuesAndPercentage" && `${nodePercentFormatted} ${unit}${nodeValueFormatted}`
|
|
2045
2106
|
))
|
|
2046
2107
|
);
|
|
2047
2108
|
};
|
|
@@ -2095,7 +2156,7 @@ var SankeyLink = (props) => {
|
|
|
2095
2156
|
handleLinkClick
|
|
2096
2157
|
} = props;
|
|
2097
2158
|
const circlePoints = extractLinkMidPoint(path(1)(link));
|
|
2098
|
-
const linkClickHandler = (0, react_exports.useCallback)(() => handleLinkClick(link), [link]);
|
|
2159
|
+
const linkClickHandler = (0, react_exports.useCallback)(() => handleLinkClick(link), [handleLinkClick, link]);
|
|
2099
2160
|
return /* @__PURE__ */ react_exports.createElement(
|
|
2100
2161
|
StyledSankeyLink,
|
|
2101
2162
|
{
|
|
@@ -2270,7 +2331,9 @@ var SankeyTooltip = (props) => {
|
|
|
2270
2331
|
onRequestClose: () => handleTooltipRequestClose(),
|
|
2271
2332
|
defaultPlacement: getPopoverPlacement(anchor)
|
|
2272
2333
|
},
|
|
2273
|
-
/* @__PURE__ */ react_exports.createElement(StyledTooltipContainer, { className: "sankeyToolTip" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipRow, { rowColor: tooltipRowColor, "data-test": "main-row" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, { "data-test": "main-row-name" }, /* @__PURE__ */ react_exports.createElement(ColorTile, { node, colorCategoryMapping }), /* @__PURE__ */ react_exports.createElement(NodeValue, null, node == null ? void 0 : node.name)), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "main-row-value" }, (0, numberUtils_exports.formatNumber)(node == null ? void 0 : node.value, 0, {
|
|
2334
|
+
/* @__PURE__ */ react_exports.createElement(StyledTooltipContainer, { className: "sankeyToolTip" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipRow, { rowColor: tooltipRowColor, "data-test": "main-row" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, { "data-test": "main-row-name" }, /* @__PURE__ */ react_exports.createElement(ColorTile, { node, colorCategoryMapping }), /* @__PURE__ */ react_exports.createElement(NodeValue, null, node == null ? void 0 : node.name)), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "main-row-value" }, (0, numberUtils_exports.formatNumber)(node == null ? void 0 : node.value, 0, {
|
|
2335
|
+
useTrendUnits: true
|
|
2336
|
+
}))), showSection(connections, node, "source") && /* @__PURE__ */ react_exports.createElement(StyledTooltipHeader, { headerColor: tooltipHeaderColor }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, null, "Source"), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, null, linkValue)), /* @__PURE__ */ react_exports.createElement(StyledTooltipSection, null, connections && connections.sourceNodes.map((sNode, idx) => {
|
|
2274
2337
|
var _a, _b;
|
|
2275
2338
|
if ((sNode == null ? void 0 : sNode.index) !== (node == null ? void 0 : node.index) || ((_a = connections.sourceNodes[idx]) == null ? void 0 : _a.index) === ((_b = connections.targetNodes[idx]) == null ? void 0 : _b.index)) {
|
|
2276
2339
|
return /* @__PURE__ */ react_exports.createElement(
|
|
@@ -2287,7 +2350,9 @@ var SankeyTooltip = (props) => {
|
|
|
2287
2350
|
colorCategoryMapping
|
|
2288
2351
|
}
|
|
2289
2352
|
), /* @__PURE__ */ react_exports.createElement(NodeValue, { "data-test": "source-row-name" }, sNode == null ? void 0 : sNode.name)),
|
|
2290
|
-
/* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "source-row-value" }, (0, numberUtils_exports.formatNumber)(sNode == null ? void 0 : sNode.value, 0, {
|
|
2353
|
+
/* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "source-row-value" }, (0, numberUtils_exports.formatNumber)(sNode == null ? void 0 : sNode.value, 0, {
|
|
2354
|
+
useTrendUnits: true
|
|
2355
|
+
}))
|
|
2291
2356
|
);
|
|
2292
2357
|
}
|
|
2293
2358
|
return null;
|
|
@@ -2308,7 +2373,9 @@ var SankeyTooltip = (props) => {
|
|
|
2308
2373
|
colorCategoryMapping
|
|
2309
2374
|
}
|
|
2310
2375
|
), /* @__PURE__ */ react_exports.createElement(NodeValue, { "data-test": "target-row-name" }, tNode == null ? void 0 : tNode.name)),
|
|
2311
|
-
/* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "target-row-value" }, (0, numberUtils_exports.formatNumber)(tNode == null ? void 0 : tNode.value, 0, {
|
|
2376
|
+
/* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "target-row-value" }, (0, numberUtils_exports.formatNumber)(tNode == null ? void 0 : tNode.value, 0, {
|
|
2377
|
+
useTrendUnits: true
|
|
2378
|
+
}))
|
|
2312
2379
|
);
|
|
2313
2380
|
}
|
|
2314
2381
|
return null;
|
|
@@ -2320,7 +2387,11 @@ var SankeyTooltip = (props) => {
|
|
|
2320
2387
|
if (!link) {
|
|
2321
2388
|
return null;
|
|
2322
2389
|
}
|
|
2323
|
-
return /* @__PURE__ */ react_exports.createElement(Popover_default, { open, anchor, onRequestClose: () => handleTooltipRequestClose() }, /* @__PURE__ */ react_exports.createElement(StyledTooltipContainer, { className: "sankeyToolTip", "data-test": "sankey-tooltip" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLinkHeader, { linkHeaderColor: tooltipLinkHeaderColor, "data-test": "main-row" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, { "data-test": "main-row-name" }, "Link Size"), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "main-row-value" }, (0, numberUtils_exports.formatNumber)(link == null ? void 0 : link.value, 0, {
|
|
2390
|
+
return /* @__PURE__ */ react_exports.createElement(Popover_default, { open, anchor, onRequestClose: () => handleTooltipRequestClose() }, /* @__PURE__ */ react_exports.createElement(StyledTooltipContainer, { className: "sankeyToolTip", "data-test": "sankey-tooltip" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLinkHeader, { linkHeaderColor: tooltipLinkHeaderColor, "data-test": "main-row" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, { "data-test": "main-row-name" }, "Link Size"), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "main-row-value" }, (0, numberUtils_exports.formatNumber)(link == null ? void 0 : link.value, 0, {
|
|
2391
|
+
useTrendUnits: true
|
|
2392
|
+
}))), /* @__PURE__ */ react_exports.createElement(StyledTooltipHeader, { headerColor: tooltipHeaderColor }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, null, "Source"), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, null, linkValue)), /* @__PURE__ */ react_exports.createElement(StyledTooltipSection, null, /* @__PURE__ */ react_exports.createElement(StyledTooltipRow, { rowColor: tooltipRowColor, "data-test": "source-row" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, null, /* @__PURE__ */ react_exports.createElement(ColorTile, { node: link == null ? void 0 : link.source, colorCategoryMapping }), /* @__PURE__ */ react_exports.createElement(NodeValue, { "data-test": "source-row-name" }, (_a = link == null ? void 0 : link.source) == null ? void 0 : _a.name)), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "source-row-value" }, `${(0, numberUtils_exports.formatNumber)((_b = link == null ? void 0 : link.source) == null ? void 0 : _b.value, 0, { useTrendUnits: true })} `))), /* @__PURE__ */ react_exports.createElement(StyledTooltipHeader, { headerColor: tooltipHeaderColor }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, null, "Target"), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, null, linkValue)), /* @__PURE__ */ react_exports.createElement(StyledTooltipSection, null, /* @__PURE__ */ react_exports.createElement(StyledTooltipRow, { rowColor: tooltipRowColor, "data-test": "target-row" }, /* @__PURE__ */ react_exports.createElement(StyledTooltipLeftCell, null, /* @__PURE__ */ react_exports.createElement(ColorTile, { node: link == null ? void 0 : link.target, colorCategoryMapping }), /* @__PURE__ */ react_exports.createElement(NodeValue, { "data-test": "target-row-name" }, (_c = link == null ? void 0 : link.target) == null ? void 0 : _c.name)), /* @__PURE__ */ react_exports.createElement(StyledTooltipRightCell, { "data-test": "target-row-value" }, (0, numberUtils_exports.formatNumber)((_d = link == null ? void 0 : link.target) == null ? void 0 : _d.value, 0, {
|
|
2393
|
+
useTrendUnits: true
|
|
2394
|
+
}))))));
|
|
2324
2395
|
};
|
|
2325
2396
|
return mode === "node" ? renderNodeToolTip() : renderLinkToolTip();
|
|
2326
2397
|
};
|
|
@@ -2376,14 +2447,17 @@ var PureSankey = (props) => {
|
|
|
2376
2447
|
nodePadding,
|
|
2377
2448
|
resultLimit,
|
|
2378
2449
|
seriesColors,
|
|
2450
|
+
labelDisplay,
|
|
2379
2451
|
linkColors,
|
|
2380
2452
|
linkOpacity,
|
|
2381
2453
|
linkValueField,
|
|
2382
2454
|
backgroundColor,
|
|
2383
2455
|
nodeTextColor,
|
|
2456
|
+
nodeValueColor,
|
|
2384
2457
|
tooltipRowColor,
|
|
2385
2458
|
tooltipLinkHeaderColor,
|
|
2386
2459
|
tooltipHeaderColor,
|
|
2460
|
+
unit,
|
|
2387
2461
|
onNodeClick,
|
|
2388
2462
|
onLinkClick
|
|
2389
2463
|
} = props;
|
|
@@ -2410,17 +2484,20 @@ var PureSankey = (props) => {
|
|
|
2410
2484
|
const sankeyContainerElement = (0, react_exports.useRef)(null);
|
|
2411
2485
|
const [sankeyWidth, setSankeyWidth] = (0, react_exports.useState)(DEFAULT_CHART_WIDTH - margin.left - margin.right);
|
|
2412
2486
|
const [sankeyHeight, setSankeyHeight] = (0, react_exports.useState)(DEFAULT_CHART_HEIGHT - margin.top - margin.bottom);
|
|
2413
|
-
const handleNodeClick = (0, react_exports.useCallback)(
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2487
|
+
const handleNodeClick = (0, react_exports.useCallback)(
|
|
2488
|
+
(node) => {
|
|
2489
|
+
if (node) {
|
|
2490
|
+
onNodeClick({
|
|
2491
|
+
type: "node.click",
|
|
2492
|
+
payload: {
|
|
2493
|
+
nodeValue: node.value,
|
|
2494
|
+
nodeName: node.name
|
|
2495
|
+
}
|
|
2496
|
+
});
|
|
2497
|
+
}
|
|
2498
|
+
},
|
|
2499
|
+
[onNodeClick]
|
|
2500
|
+
);
|
|
2424
2501
|
const handleLinkClick = (0, react_exports.useCallback)(
|
|
2425
2502
|
(link) => {
|
|
2426
2503
|
if (link) {
|
|
@@ -2435,7 +2512,7 @@ var PureSankey = (props) => {
|
|
|
2435
2512
|
});
|
|
2436
2513
|
}
|
|
2437
2514
|
},
|
|
2438
|
-
[fields,
|
|
2515
|
+
[linkValueField, fields, onLinkClick, columns]
|
|
2439
2516
|
);
|
|
2440
2517
|
(0, react_exports.useEffect)(() => {
|
|
2441
2518
|
if (sankeyContainerElement && sankeyContainerElement.current) {
|
|
@@ -2446,7 +2523,7 @@ var PureSankey = (props) => {
|
|
|
2446
2523
|
setSankeyWidth(sWidth - margin.left - margin.right);
|
|
2447
2524
|
setSankeyHeight(sHeight - margin.top - margin.bottom);
|
|
2448
2525
|
}
|
|
2449
|
-
}, [width, height]);
|
|
2526
|
+
}, [width, height, margin.left, margin.right, margin.top, margin.bottom]);
|
|
2450
2527
|
const sankeyData = convertInputToSankeyDataFormat(
|
|
2451
2528
|
columnsFromDataSource,
|
|
2452
2529
|
DEFAULT_SOURCE_INDEX,
|
|
@@ -2527,6 +2604,7 @@ var PureSankey = (props) => {
|
|
|
2527
2604
|
);
|
|
2528
2605
|
});
|
|
2529
2606
|
};
|
|
2607
|
+
const maxNode = getMaxNode(sankeyData.nodes);
|
|
2530
2608
|
const renderNodes = (nodes) => {
|
|
2531
2609
|
const chartWidth = typeof width === "number" ? width : Number.parseInt(width, 10);
|
|
2532
2610
|
return nodes.map((node) => {
|
|
@@ -2534,13 +2612,17 @@ var PureSankey = (props) => {
|
|
|
2534
2612
|
SankeyNode_default,
|
|
2535
2613
|
{
|
|
2536
2614
|
node,
|
|
2615
|
+
maxNode,
|
|
2537
2616
|
key: getNodeId(node),
|
|
2538
2617
|
"data-test": getNodeId(node),
|
|
2539
2618
|
activeNodes,
|
|
2540
2619
|
nodeWidth,
|
|
2541
2620
|
chartWidth,
|
|
2542
2621
|
colorCategoryMapping,
|
|
2622
|
+
labelDisplay,
|
|
2623
|
+
unit,
|
|
2543
2624
|
nodeTextColor,
|
|
2625
|
+
nodeValueColor,
|
|
2544
2626
|
handleMouseOver: (ev) => {
|
|
2545
2627
|
const connections = nodeConnectionsMap[node.index];
|
|
2546
2628
|
setActiveLinks(connections.links);
|
|
@@ -2621,9 +2703,11 @@ PureSankey.propTypes = {
|
|
|
2621
2703
|
linkValueField: prop_types_exports.string,
|
|
2622
2704
|
backgroundColor: prop_types_exports.string,
|
|
2623
2705
|
nodeTextColor: prop_types_exports.string,
|
|
2706
|
+
nodeValueColor: prop_types_exports.string,
|
|
2624
2707
|
tooltipRowColor: prop_types_exports.string,
|
|
2625
2708
|
tooltipLinkHeaderColor: prop_types_exports.string,
|
|
2626
|
-
tooltipHeaderColor: prop_types_exports.string
|
|
2709
|
+
tooltipHeaderColor: prop_types_exports.string,
|
|
2710
|
+
unit: prop_types_exports.string
|
|
2627
2711
|
};
|
|
2628
2712
|
PureSankey.defaultProps = {
|
|
2629
2713
|
columnsFromDataSource: [],
|
|
@@ -2642,11 +2726,13 @@ PureSankey.defaultProps = {
|
|
|
2642
2726
|
linkValueField: "value",
|
|
2643
2727
|
backgroundColor: "#0b0c0e",
|
|
2644
2728
|
nodeTextColor: "rgba(255, 255, 255, 0.98)",
|
|
2729
|
+
nodeValueColor: "rgba(255, 255, 255, 0.98)",
|
|
2645
2730
|
tooltipRowColor: "rgba(255, 255, 255, 0.98)",
|
|
2646
2731
|
tooltipLinkHeaderColor: "rgba(255, 255, 255, 0.98)",
|
|
2647
2732
|
tooltipHeaderColor: "rgba(255, 255, 255, 0.5)",
|
|
2648
2733
|
onNodeClick: lodash_exports.noop,
|
|
2649
|
-
onLinkClick: lodash_exports.noop
|
|
2734
|
+
onLinkClick: lodash_exports.noop,
|
|
2735
|
+
unit: ""
|
|
2650
2736
|
};
|
|
2651
2737
|
var PureSankey_default = PureSankey;
|
|
2652
2738
|
|
|
@@ -2707,11 +2793,9 @@ var configUtils_default = "default" in defaultImport37 ? defaultImport37.default
|
|
|
2707
2793
|
// src/common/utils/configUtils.ts
|
|
2708
2794
|
function enhanceConfig(vizConfig) {
|
|
2709
2795
|
const enhancedConfig = __spreadValues({}, vizConfig);
|
|
2710
|
-
enhancedConfig.editorConfig = vizConfig.editorConfig.map(
|
|
2711
|
-
(config2)
|
|
2712
|
-
|
|
2713
|
-
}
|
|
2714
|
-
);
|
|
2796
|
+
enhancedConfig.editorConfig = vizConfig.editorConfig.map((config2) => {
|
|
2797
|
+
return __spreadProps(__spreadValues({}, config2), { open: config2.open || false });
|
|
2798
|
+
});
|
|
2715
2799
|
return enhancedConfig;
|
|
2716
2800
|
}
|
|
2717
2801
|
|
|
@@ -2769,6 +2853,24 @@ var background = ({
|
|
|
2769
2853
|
];
|
|
2770
2854
|
var BackgroundColor_default = background;
|
|
2771
2855
|
|
|
2856
|
+
// esm-externals:@splunk/themes/pick
|
|
2857
|
+
var pick_exports = {};
|
|
2858
|
+
__export(pick_exports, {
|
|
2859
|
+
default: () => pick_default
|
|
2860
|
+
});
|
|
2861
|
+
var defaultImport38 = __toESM(require("@splunk/themes/pick"));
|
|
2862
|
+
__reExport(pick_exports, require("@splunk/themes/pick"));
|
|
2863
|
+
var pick_default = "default" in defaultImport38 ? defaultImport38.default : defaultImport38;
|
|
2864
|
+
|
|
2865
|
+
// src/common/ThemedDefaults.tsx
|
|
2866
|
+
var defaultBackgroundColor = (props) => pick_default({
|
|
2867
|
+
enterprise: {
|
|
2868
|
+
dark: variables_default.black(props),
|
|
2869
|
+
light: variables_default.white(props)
|
|
2870
|
+
},
|
|
2871
|
+
prisma: variables_default.backgroundColorSection(props)
|
|
2872
|
+
})(props);
|
|
2873
|
+
|
|
2772
2874
|
// src/Sankey/config.ts
|
|
2773
2875
|
var defaultContext = {
|
|
2774
2876
|
linkColorRangeConfig: [
|
|
@@ -2797,18 +2899,13 @@ var size = {
|
|
|
2797
2899
|
initialHeight: 300
|
|
2798
2900
|
};
|
|
2799
2901
|
var themes = {
|
|
2800
|
-
defaultBackgroundColor
|
|
2801
|
-
enterprise: {
|
|
2802
|
-
dark: themes_exports.variables.black(props),
|
|
2803
|
-
light: themes_exports.variables.backgroundColor(props)
|
|
2804
|
-
},
|
|
2805
|
-
prisma: themes_exports.variables.backgroundColorSidebar(props)
|
|
2806
|
-
})(props),
|
|
2902
|
+
defaultBackgroundColor,
|
|
2807
2903
|
nodeTextColor: (props) => (0, themes_exports.pick)({
|
|
2808
|
-
enterprise:
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2904
|
+
enterprise: themes_exports.variables.contentColorActive(props),
|
|
2905
|
+
prisma: themes_exports.variables.contentColorActive(props)
|
|
2906
|
+
})(props),
|
|
2907
|
+
nodeValueColor: (props) => (0, themes_exports.pick)({
|
|
2908
|
+
enterprise: themes_exports.variables.contentColorActive(props),
|
|
2812
2909
|
prisma: themes_exports.variables.contentColorActive(props)
|
|
2813
2910
|
})(props),
|
|
2814
2911
|
tooltipRowColor: (props) => (0, themes_exports.pick)({
|
|
@@ -2851,6 +2948,34 @@ var editorConfig = [
|
|
|
2851
2948
|
]
|
|
2852
2949
|
]
|
|
2853
2950
|
},
|
|
2951
|
+
{
|
|
2952
|
+
label: (0, i18n_exports._)("Data display"),
|
|
2953
|
+
layout: [
|
|
2954
|
+
[
|
|
2955
|
+
{
|
|
2956
|
+
option: "labelDisplay",
|
|
2957
|
+
label: (0, i18n_exports._)("Label display"),
|
|
2958
|
+
editor: "editor.select",
|
|
2959
|
+
editorProps: {
|
|
2960
|
+
values: [
|
|
2961
|
+
{ label: (0, i18n_exports._)("Off"), value: "off" },
|
|
2962
|
+
{ label: (0, i18n_exports._)("Values"), value: "values" },
|
|
2963
|
+
{ label: (0, i18n_exports._)("Percent"), value: "percentage" },
|
|
2964
|
+
{ label: (0, i18n_exports._)("Values & Percent"), value: "valuesAndPercentage" }
|
|
2965
|
+
]
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
],
|
|
2969
|
+
[
|
|
2970
|
+
{
|
|
2971
|
+
label: (0, i18n_exports._)("Unit label"),
|
|
2972
|
+
option: "unit",
|
|
2973
|
+
editor: "editor.text",
|
|
2974
|
+
showEditor: ({ options }) => options.labelDisplay === "valuesAndPercentage" || options.labelDisplay === "values"
|
|
2975
|
+
}
|
|
2976
|
+
]
|
|
2977
|
+
]
|
|
2978
|
+
},
|
|
2854
2979
|
{
|
|
2855
2980
|
label: (0, i18n_exports._)("Color and style"),
|
|
2856
2981
|
layout: [
|
|
@@ -2868,7 +2993,10 @@ var editorConfig = [
|
|
|
2868
2993
|
}
|
|
2869
2994
|
],
|
|
2870
2995
|
[
|
|
2871
|
-
__spreadProps(__spreadValues({}, getDynamicLinkColorsEditor({
|
|
2996
|
+
__spreadProps(__spreadValues({}, getDynamicLinkColorsEditor({
|
|
2997
|
+
defaultContext,
|
|
2998
|
+
defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig
|
|
2999
|
+
})), {
|
|
2872
3000
|
showEditor: ({ options }) => options.colorMode === "dynamic"
|
|
2873
3001
|
})
|
|
2874
3002
|
],
|
|
@@ -2932,6 +3060,7 @@ var computeVizProps = ({
|
|
|
2932
3060
|
const themeColorVariables = [
|
|
2933
3061
|
"defaultBackgroundColor",
|
|
2934
3062
|
"nodeTextColor",
|
|
3063
|
+
"nodeValueColor",
|
|
2935
3064
|
"tooltipRowColor",
|
|
2936
3065
|
"tooltipLinkHeaderColor",
|
|
2937
3066
|
"tooltipHeaderColor"
|