@splunk/visualizations 27.4.0 → 28.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +26 -21
- package/Area.config.js.map +3 -3
- package/Area.js +88 -36
- package/Area.js.map +3 -3
- package/Bar.config.js +25 -21
- package/Bar.config.js.map +3 -3
- package/Bar.js +83 -37
- package/Bar.js.map +3 -3
- package/Bubble.config.js +46 -44
- package/Bubble.config.js.map +4 -4
- package/Bubble.js +83 -54
- package/Bubble.js.map +4 -4
- package/CHANGELOG.external.md +54 -7
- package/ChoroplethSvg.config.js +47 -43
- package/ChoroplethSvg.config.js.map +4 -4
- package/ChoroplethSvg.js +72 -45
- package/ChoroplethSvg.js.map +4 -4
- package/Column.config.js +22 -20
- package/Column.config.js.map +3 -3
- package/Column.js +76 -33
- package/Column.js.map +3 -3
- package/Ellipse.config.js +16 -7
- package/Ellipse.config.js.map +2 -2
- package/Ellipse.js +104 -20
- package/Ellipse.js.map +4 -4
- package/Events.config.js +38 -27
- package/Events.config.js.map +4 -4
- package/Events.js +122 -101
- package/Events.js.map +4 -4
- package/FEATUREFLAGS.md +9 -7
- package/FillerGauge.config.js +20 -13
- package/FillerGauge.config.js.map +3 -3
- package/FillerGauge.js +76 -27
- package/FillerGauge.js.map +4 -4
- package/Image.config.js +5 -6
- package/Image.config.js.map +2 -2
- package/Image.js +29 -14
- package/Image.js.map +2 -2
- package/Line.config.js +22 -20
- package/Line.config.js.map +3 -3
- package/Line.js +84 -35
- package/Line.js.map +3 -3
- package/LinkGraph.config.js +39 -46
- package/LinkGraph.config.js.map +3 -3
- package/LinkGraph.js +70 -50
- package/LinkGraph.js.map +3 -3
- package/MIGRATION.md +169 -40
- package/Map.config.js +47 -13
- package/Map.config.js.map +4 -4
- package/Map.js +350 -159
- package/Map.js.map +4 -4
- package/Markdown.config.js +4 -5
- package/Markdown.config.js.map +2 -2
- package/Markdown.js +117 -72
- package/Markdown.js.map +3 -3
- package/MarkerGauge.config.js +14 -12
- package/MarkerGauge.config.js.map +3 -3
- package/MarkerGauge.js +107 -69
- package/MarkerGauge.js.map +4 -4
- package/ParallelCoordinates.config.js +14 -12
- package/ParallelCoordinates.config.js.map +3 -3
- package/ParallelCoordinates.js +113 -59
- package/ParallelCoordinates.js.map +3 -3
- package/Pie.config.js +51 -38
- package/Pie.config.js.map +4 -4
- package/Pie.js +116 -88
- package/Pie.js.map +4 -4
- package/Punchcard.config.js +36 -34
- package/Punchcard.config.js.map +4 -4
- package/Punchcard.js +153 -87
- 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 +103 -20
- package/Rectangle.js.map +4 -4
- package/Sankey.config.js +69 -17
- package/Sankey.config.js.map +4 -4
- package/Sankey.js +212 -82
- package/Sankey.js.map +4 -4
- package/Scatter.config.js +44 -42
- package/Scatter.config.js.map +3 -3
- package/Scatter.js +84 -56
- package/Scatter.js.map +3 -3
- package/SingleValue.config.js +32 -18
- package/SingleValue.config.js.map +4 -4
- package/SingleValue.js +238 -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/Table.config.js +71 -51
- package/Table.config.js.map +3 -3
- package/Table.js +282 -145
- package/Table.js.map +3 -3
- package/Timeline.config.js +36 -34
- package/Timeline.config.js.map +4 -4
- package/Timeline.js +67 -59
- package/Timeline.js.map +4 -4
- package/common/Charting.js +8 -3
- 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 +12 -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 +87 -3
- package/common/shapeUtils.js.map +4 -4
- 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 +174 -48
- package/common/utils/mapUtils.js.map +4 -4
- package/common/utils/singleValueUtils.js +9 -3
- 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/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 +25 -8
- package/common/withDashboardViz.js.map +2 -2
- package/package.json +37 -35
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.0.0 - 0c5f07712",
|
|
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.0.0 - 0c5f07712"
|
|
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 {};
|
|
@@ -1269,7 +1282,11 @@ var withDashboardViz = (opts) => {
|
|
|
1269
1282
|
if (ev && ev.payload) {
|
|
1270
1283
|
payload = 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) {
|
|
@@ -1368,7 +1385,7 @@ var d3_collection_default = "default" in defaultImport28 ? defaultImport28.defau
|
|
|
1368
1385
|
|
|
1369
1386
|
// src/Sankey/PureSankey/lib/sankey.js
|
|
1370
1387
|
var d3_sankey = function() {
|
|
1371
|
-
|
|
1388
|
+
let sankey = {}, nodeWidth = 24, nodePadding = 8, size2 = [1, 1], nodes = [], links = [], components = [];
|
|
1372
1389
|
sankey.nodeWidth = function(_7) {
|
|
1373
1390
|
if (!arguments.length) return nodeWidth;
|
|
1374
1391
|
nodeWidth = +_7;
|
|
@@ -1408,9 +1425,9 @@ var d3_sankey = function() {
|
|
|
1408
1425
|
return sankey;
|
|
1409
1426
|
};
|
|
1410
1427
|
sankey.reversibleLink = function() {
|
|
1411
|
-
|
|
1428
|
+
let curvature = 0.5;
|
|
1412
1429
|
function forwardLink(part, d) {
|
|
1413
|
-
|
|
1430
|
+
let x0 = d.source.x + d.source.dx, x1 = d.target.x, xi = (0, d3_interpolate_exports.interpolateNumber)(x0, x1), x2 = xi(curvature), x3 = xi(1 - curvature), y0 = d.source.y + d.sy, y1 = d.target.y + d.ty, y2 = d.source.y + d.sy + d.dy, y3 = d.target.y + d.ty + d.dy;
|
|
1414
1431
|
switch (part) {
|
|
1415
1432
|
case 0:
|
|
1416
1433
|
return "M" + x0 + "," + y0 + "L" + x0 + "," + (y0 + d.dy);
|
|
@@ -1421,15 +1438,15 @@ var d3_sankey = function() {
|
|
|
1421
1438
|
}
|
|
1422
1439
|
}
|
|
1423
1440
|
function backwardLink(part, d) {
|
|
1424
|
-
|
|
1425
|
-
|
|
1441
|
+
let curveExtension = 30;
|
|
1442
|
+
let curveDepth = 15;
|
|
1426
1443
|
function getDir(d2) {
|
|
1427
1444
|
return d2.source.y + d2.sy > d2.target.y + d2.ty ? -1 : 1;
|
|
1428
1445
|
}
|
|
1429
1446
|
function p(x, y) {
|
|
1430
1447
|
return x + "," + y + " ";
|
|
1431
1448
|
}
|
|
1432
|
-
|
|
1449
|
+
let dt = getDir(d) * curveDepth, x0 = d.source.x + d.source.dx, y0 = d.source.y + d.sy, x1 = d.target.x, y1 = d.target.y + d.ty;
|
|
1433
1450
|
switch (part) {
|
|
1434
1451
|
case 0:
|
|
1435
1452
|
return "M" + p(x0, y0) + "C" + p(x0, y0) + p(x0 + curveExtension, y0) + p(x0 + curveExtension, y0 + dt) + "L" + p(x0 + curveExtension, y0 + dt + d.dy) + "C" + p(x0 + curveExtension, y0 + d.dy) + p(x0, y0 + d.dy) + p(x0, y0 + d.dy) + "Z";
|
|
@@ -1450,9 +1467,9 @@ var d3_sankey = function() {
|
|
|
1450
1467
|
};
|
|
1451
1468
|
};
|
|
1452
1469
|
sankey.link = function() {
|
|
1453
|
-
|
|
1470
|
+
let curvature = 0.5;
|
|
1454
1471
|
function link(d) {
|
|
1455
|
-
|
|
1472
|
+
let x0 = d.source.x + d.source.dx, x1 = d.target.x, xi = (0, d3_interpolate_exports.interpolateNumber)(x0, x1), x2 = xi(curvature), x3 = xi(1 - curvature), y0 = d.source.y + d.sy + d.dy / 2, y1 = d.target.y + d.ty + d.dy / 2;
|
|
1456
1473
|
return "M" + x0 + "," + y0 + "C" + x2 + "," + y0 + " " + x3 + "," + y1 + " " + x1 + "," + y1;
|
|
1457
1474
|
}
|
|
1458
1475
|
link.curvature = function(_7) {
|
|
@@ -1468,7 +1485,7 @@ var d3_sankey = function() {
|
|
|
1468
1485
|
node.targetLinks = [];
|
|
1469
1486
|
});
|
|
1470
1487
|
links.forEach(function(link) {
|
|
1471
|
-
|
|
1488
|
+
let source = link.source, target = link.target;
|
|
1472
1489
|
if (typeof source === "number") source = link.source = nodes[link.source];
|
|
1473
1490
|
if (typeof target === "number") target = link.target = nodes[link.target];
|
|
1474
1491
|
source.sourceLinks.push(link);
|
|
@@ -1482,7 +1499,7 @@ var d3_sankey = function() {
|
|
|
1482
1499
|
});
|
|
1483
1500
|
}
|
|
1484
1501
|
function computeNodeStructure() {
|
|
1485
|
-
|
|
1502
|
+
let nodeStack = [], index = 0;
|
|
1486
1503
|
nodes.forEach(function(node) {
|
|
1487
1504
|
if (!node.index) {
|
|
1488
1505
|
connect(node);
|
|
@@ -1495,7 +1512,7 @@ var d3_sankey = function() {
|
|
|
1495
1512
|
nodeStack.push(node);
|
|
1496
1513
|
if (node.sourceLinks) {
|
|
1497
1514
|
node.sourceLinks.forEach(function(sourceLink) {
|
|
1498
|
-
|
|
1515
|
+
let target = sourceLink.target;
|
|
1499
1516
|
if (!target.hasOwnProperty("index")) {
|
|
1500
1517
|
connect(target);
|
|
1501
1518
|
node.lowIndex = Math.min(node.lowIndex, target.lowIndex);
|
|
@@ -1504,7 +1521,7 @@ var d3_sankey = function() {
|
|
|
1504
1521
|
}
|
|
1505
1522
|
});
|
|
1506
1523
|
if (node.lowIndex === node.index) {
|
|
1507
|
-
|
|
1524
|
+
let component = [], currentNode;
|
|
1508
1525
|
do {
|
|
1509
1526
|
currentNode = nodeStack.pop();
|
|
1510
1527
|
currentNode.onStack = false;
|
|
@@ -1528,7 +1545,7 @@ var d3_sankey = function() {
|
|
|
1528
1545
|
layerComponents();
|
|
1529
1546
|
components.forEach(function(component, i) {
|
|
1530
1547
|
bfs(component.root, function(node) {
|
|
1531
|
-
|
|
1548
|
+
let result = node.sourceLinks.filter(function(sourceLink) {
|
|
1532
1549
|
return sourceLink.target.component == i;
|
|
1533
1550
|
}).map(function(sourceLink) {
|
|
1534
1551
|
return sourceLink.target;
|
|
@@ -1536,13 +1553,14 @@ var d3_sankey = function() {
|
|
|
1536
1553
|
return result;
|
|
1537
1554
|
});
|
|
1538
1555
|
});
|
|
1539
|
-
|
|
1540
|
-
|
|
1556
|
+
let max = 0;
|
|
1557
|
+
let componentsByBreadth = (0, d3_collection_exports.nest)().key(function(d) {
|
|
1541
1558
|
return d.x;
|
|
1542
1559
|
}).sortKeys(d3_array_exports.ascending).entries(components).map(function(d) {
|
|
1543
1560
|
return d.values;
|
|
1544
1561
|
});
|
|
1545
|
-
|
|
1562
|
+
max = -1;
|
|
1563
|
+
let nextMax = -1;
|
|
1546
1564
|
componentsByBreadth.forEach(function(c) {
|
|
1547
1565
|
c.forEach(function(component) {
|
|
1548
1566
|
component.x = max + 1;
|
|
@@ -1555,7 +1573,7 @@ var d3_sankey = function() {
|
|
|
1555
1573
|
max = nextMax;
|
|
1556
1574
|
});
|
|
1557
1575
|
nodes.filter(function(node) {
|
|
1558
|
-
|
|
1576
|
+
let outLinks = node.sourceLinks.filter(function(link) {
|
|
1559
1577
|
return link.source.name != link.target.name;
|
|
1560
1578
|
});
|
|
1561
1579
|
return outLinks.length == 0;
|
|
@@ -1567,7 +1585,7 @@ var d3_sankey = function() {
|
|
|
1567
1585
|
return [].concat.apply([], a);
|
|
1568
1586
|
}
|
|
1569
1587
|
function layerComponents() {
|
|
1570
|
-
|
|
1588
|
+
let remainingComponents = components, nextComponents, visitedIndex, x = 0;
|
|
1571
1589
|
while (remainingComponents.length) {
|
|
1572
1590
|
nextComponents = [];
|
|
1573
1591
|
visitedIndex = {};
|
|
@@ -1587,15 +1605,15 @@ var d3_sankey = function() {
|
|
|
1587
1605
|
}
|
|
1588
1606
|
}
|
|
1589
1607
|
function bfs(node, extractTargets) {
|
|
1590
|
-
|
|
1591
|
-
|
|
1608
|
+
let queue = [node], currentCount = 1, nextCount = 0;
|
|
1609
|
+
let x = 0;
|
|
1592
1610
|
while (currentCount > 0) {
|
|
1593
|
-
|
|
1611
|
+
let currentNode = queue.shift();
|
|
1594
1612
|
currentCount--;
|
|
1595
1613
|
if (!currentNode.hasOwnProperty("x")) {
|
|
1596
1614
|
currentNode.x = x;
|
|
1597
1615
|
currentNode.dx = nodeWidth;
|
|
1598
|
-
|
|
1616
|
+
let targets = extractTargets(currentNode);
|
|
1599
1617
|
queue = queue.concat(targets);
|
|
1600
1618
|
nextCount += targets.length;
|
|
1601
1619
|
}
|
|
@@ -1629,21 +1647,21 @@ var d3_sankey = function() {
|
|
|
1629
1647
|
});
|
|
1630
1648
|
}
|
|
1631
1649
|
function computeNodeDepths(iterations) {
|
|
1632
|
-
|
|
1650
|
+
let nodesByBreadth = (0, d3_collection_exports.nest)().key(function(d) {
|
|
1633
1651
|
return d.x;
|
|
1634
1652
|
}).sortKeys(d3_array_exports.ascending).entries(nodes).map(function(d) {
|
|
1635
1653
|
return d.values;
|
|
1636
1654
|
});
|
|
1637
1655
|
initializeNodeDepth();
|
|
1638
1656
|
resolveCollisions();
|
|
1639
|
-
for (
|
|
1657
|
+
for (let alpha = 1; iterations > 0; --iterations) {
|
|
1640
1658
|
relaxRightToLeft(alpha *= 0.99);
|
|
1641
1659
|
resolveCollisions();
|
|
1642
1660
|
relaxLeftToRight(alpha);
|
|
1643
1661
|
resolveCollisions();
|
|
1644
1662
|
}
|
|
1645
1663
|
function initializeNodeDepth() {
|
|
1646
|
-
|
|
1664
|
+
let ky = (0, d3_array_exports.min)(nodesByBreadth, function(nodes2) {
|
|
1647
1665
|
return (size2[1] - (nodes2.length - 1) * nodePadding) / (0, d3_array_exports.sum)(nodes2, value);
|
|
1648
1666
|
});
|
|
1649
1667
|
nodesByBreadth.forEach(function(nodes2) {
|
|
@@ -1656,12 +1674,12 @@ var d3_sankey = function() {
|
|
|
1656
1674
|
link.dy = link.value * ky;
|
|
1657
1675
|
});
|
|
1658
1676
|
}
|
|
1659
|
-
function relaxLeftToRight(
|
|
1677
|
+
function relaxLeftToRight(alpha) {
|
|
1660
1678
|
nodesByBreadth.forEach(function(nodes2, breadth) {
|
|
1661
1679
|
nodes2.forEach(function(node) {
|
|
1662
1680
|
if (node.targetLinks.length) {
|
|
1663
|
-
|
|
1664
|
-
node.y += (y - center(node)) *
|
|
1681
|
+
let y = (0, d3_array_exports.sum)(node.targetLinks, weightedSource) / (0, d3_array_exports.sum)(node.targetLinks, value);
|
|
1682
|
+
node.y += (y - center(node)) * alpha;
|
|
1665
1683
|
}
|
|
1666
1684
|
});
|
|
1667
1685
|
});
|
|
@@ -1669,12 +1687,12 @@ var d3_sankey = function() {
|
|
|
1669
1687
|
return center(link.source) * link.value;
|
|
1670
1688
|
}
|
|
1671
1689
|
}
|
|
1672
|
-
function relaxRightToLeft(
|
|
1690
|
+
function relaxRightToLeft(alpha) {
|
|
1673
1691
|
nodesByBreadth.slice().reverse().forEach(function(nodes2) {
|
|
1674
1692
|
nodes2.forEach(function(node) {
|
|
1675
1693
|
if (node.sourceLinks.length) {
|
|
1676
|
-
|
|
1677
|
-
node.y += (y - center(node)) *
|
|
1694
|
+
let y = (0, d3_array_exports.sum)(node.sourceLinks, weightedTarget) / (0, d3_array_exports.sum)(node.sourceLinks, value);
|
|
1695
|
+
node.y += (y - center(node)) * alpha;
|
|
1678
1696
|
}
|
|
1679
1697
|
});
|
|
1680
1698
|
});
|
|
@@ -1684,7 +1702,7 @@ var d3_sankey = function() {
|
|
|
1684
1702
|
}
|
|
1685
1703
|
function resolveCollisions() {
|
|
1686
1704
|
nodesByBreadth.forEach(function(nodes2) {
|
|
1687
|
-
|
|
1705
|
+
let node, dy, y0 = 0, n = nodes2.length, i;
|
|
1688
1706
|
nodes2.sort(ascendingDepth);
|
|
1689
1707
|
for (i = 0; i < n; ++i) {
|
|
1690
1708
|
node = nodes2[i];
|
|
@@ -1718,7 +1736,7 @@ var d3_sankey = function() {
|
|
|
1718
1736
|
node.targetLinks.sort(ascendingSourceDepth);
|
|
1719
1737
|
});
|
|
1720
1738
|
nodes.forEach(function(node) {
|
|
1721
|
-
|
|
1739
|
+
let sy = 0, ty = 0;
|
|
1722
1740
|
node.sourceLinks.forEach(function(link) {
|
|
1723
1741
|
link.sy = sy;
|
|
1724
1742
|
sy += link.dy;
|
|
@@ -1961,9 +1979,17 @@ var truncateSVGTextWithEllipsis = (textElement, textString, width) => {
|
|
|
1961
1979
|
}
|
|
1962
1980
|
}
|
|
1963
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
|
+
};
|
|
1964
1988
|
|
|
1965
1989
|
// src/Sankey/PureSankey/SankeyNode.tsx
|
|
1966
1990
|
var MAX_NODE_TEXT_WIDTH = 150;
|
|
1991
|
+
var NODE_VALUE_PRECISION = 2;
|
|
1992
|
+
var MIN_NODE_HEIGHT_FOR_LABEL_DISPLAY = 24;
|
|
1967
1993
|
var getNodeOpacity = (nodeIndex, activeNodes) => {
|
|
1968
1994
|
if (!activeNodes || !activeNodes.length) {
|
|
1969
1995
|
return DEFAULT_NODE_OPACITY;
|
|
@@ -1989,11 +2015,13 @@ var NodeText = styled_components_default.text`
|
|
|
1989
2015
|
font-size: 12px;
|
|
1990
2016
|
font-family: ${DEFAULT_FONT_FAMILY};
|
|
1991
2017
|
letter-spacing: 0.02em;
|
|
1992
|
-
fill: ${(props) => props.nodeTextColor};
|
|
2018
|
+
fill: ${(props) => props.isNodeValue && props.nodeValueColor ? props.nodeValueColor : props.nodeTextColor};
|
|
2019
|
+
opacity: ${(props) => props.isNodeValue ? "82%" : "100%"};
|
|
1993
2020
|
`;
|
|
1994
2021
|
var SankeyNode = (props) => {
|
|
1995
2022
|
const {
|
|
1996
2023
|
node,
|
|
2024
|
+
maxNode,
|
|
1997
2025
|
activeNodes,
|
|
1998
2026
|
nodeWidth,
|
|
1999
2027
|
chartWidth,
|
|
@@ -2001,13 +2029,28 @@ var SankeyNode = (props) => {
|
|
|
2001
2029
|
handleMouseLeave,
|
|
2002
2030
|
handleNodeClick,
|
|
2003
2031
|
colorCategoryMapping,
|
|
2004
|
-
nodeTextColor
|
|
2032
|
+
nodeTextColor,
|
|
2033
|
+
nodeValueColor,
|
|
2034
|
+
labelDisplay: labelDisplayInput,
|
|
2035
|
+
unit
|
|
2005
2036
|
} = props;
|
|
2037
|
+
const labelDisplay = labelDisplayInput || "off";
|
|
2006
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
|
+
}
|
|
2007
2049
|
(0, react_exports.useEffect)(() => {
|
|
2008
2050
|
truncateSVGTextWithEllipsis(nodeTextRef.current, node.name, MAX_NODE_TEXT_WIDTH);
|
|
2009
2051
|
});
|
|
2010
2052
|
const nodeClickHandler = (0, react_exports.useCallback)(() => handleNodeClick(node), [node]);
|
|
2053
|
+
const nodeHeight = getNodeHeight(node);
|
|
2011
2054
|
return /* @__PURE__ */ react_exports.createElement(
|
|
2012
2055
|
NodeGroup,
|
|
2013
2056
|
{
|
|
@@ -2023,7 +2066,8 @@ var SankeyNode = (props) => {
|
|
|
2023
2066
|
NodeRect,
|
|
2024
2067
|
{
|
|
2025
2068
|
node,
|
|
2026
|
-
|
|
2069
|
+
"data-test": `node-rect-${node.index}`,
|
|
2070
|
+
height: nodeHeight,
|
|
2027
2071
|
width: nodeWidth,
|
|
2028
2072
|
colorCategoryMapping,
|
|
2029
2073
|
onMouseOver: (ev) => handleMouseOver(ev),
|
|
@@ -2034,13 +2078,31 @@ var SankeyNode = (props) => {
|
|
|
2034
2078
|
{
|
|
2035
2079
|
ref: nodeTextRef,
|
|
2036
2080
|
node,
|
|
2081
|
+
"data-test": `node-text-${node.index}`,
|
|
2037
2082
|
chartWidth,
|
|
2038
2083
|
x: node.x < chartWidth / 2 ? 6 + nodeWidth : -6,
|
|
2039
|
-
y: node.dy / 2,
|
|
2084
|
+
y: labelDisplay !== "off" && nodeHeight >= MIN_NODE_HEIGHT_FOR_LABEL_DISPLAY ? node.dy / 2 - 6.5 : node.dy / 2,
|
|
2040
2085
|
dy: ".35em",
|
|
2041
2086
|
nodeTextColor
|
|
2042
2087
|
},
|
|
2043
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}`
|
|
2044
2106
|
))
|
|
2045
2107
|
);
|
|
2046
2108
|
};
|
|
@@ -2094,7 +2156,7 @@ var SankeyLink = (props) => {
|
|
|
2094
2156
|
handleLinkClick
|
|
2095
2157
|
} = props;
|
|
2096
2158
|
const circlePoints = extractLinkMidPoint(path(1)(link));
|
|
2097
|
-
const linkClickHandler = (0, react_exports.useCallback)(() => handleLinkClick(link), [link]);
|
|
2159
|
+
const linkClickHandler = (0, react_exports.useCallback)(() => handleLinkClick(link), [handleLinkClick, link]);
|
|
2098
2160
|
return /* @__PURE__ */ react_exports.createElement(
|
|
2099
2161
|
StyledSankeyLink,
|
|
2100
2162
|
{
|
|
@@ -2269,7 +2331,9 @@ var SankeyTooltip = (props) => {
|
|
|
2269
2331
|
onRequestClose: () => handleTooltipRequestClose(),
|
|
2270
2332
|
defaultPlacement: getPopoverPlacement(anchor)
|
|
2271
2333
|
},
|
|
2272
|
-
/* @__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) => {
|
|
2273
2337
|
var _a, _b;
|
|
2274
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)) {
|
|
2275
2339
|
return /* @__PURE__ */ react_exports.createElement(
|
|
@@ -2286,7 +2350,9 @@ var SankeyTooltip = (props) => {
|
|
|
2286
2350
|
colorCategoryMapping
|
|
2287
2351
|
}
|
|
2288
2352
|
), /* @__PURE__ */ react_exports.createElement(NodeValue, { "data-test": "source-row-name" }, sNode == null ? void 0 : sNode.name)),
|
|
2289
|
-
/* @__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
|
+
}))
|
|
2290
2356
|
);
|
|
2291
2357
|
}
|
|
2292
2358
|
return null;
|
|
@@ -2307,7 +2373,9 @@ var SankeyTooltip = (props) => {
|
|
|
2307
2373
|
colorCategoryMapping
|
|
2308
2374
|
}
|
|
2309
2375
|
), /* @__PURE__ */ react_exports.createElement(NodeValue, { "data-test": "target-row-name" }, tNode == null ? void 0 : tNode.name)),
|
|
2310
|
-
/* @__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
|
+
}))
|
|
2311
2379
|
);
|
|
2312
2380
|
}
|
|
2313
2381
|
return null;
|
|
@@ -2319,7 +2387,11 @@ var SankeyTooltip = (props) => {
|
|
|
2319
2387
|
if (!link) {
|
|
2320
2388
|
return null;
|
|
2321
2389
|
}
|
|
2322
|
-
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
|
+
}))))));
|
|
2323
2395
|
};
|
|
2324
2396
|
return mode === "node" ? renderNodeToolTip() : renderLinkToolTip();
|
|
2325
2397
|
};
|
|
@@ -2375,14 +2447,17 @@ var PureSankey = (props) => {
|
|
|
2375
2447
|
nodePadding,
|
|
2376
2448
|
resultLimit,
|
|
2377
2449
|
seriesColors,
|
|
2450
|
+
labelDisplay,
|
|
2378
2451
|
linkColors,
|
|
2379
2452
|
linkOpacity,
|
|
2380
2453
|
linkValueField,
|
|
2381
2454
|
backgroundColor,
|
|
2382
2455
|
nodeTextColor,
|
|
2456
|
+
nodeValueColor,
|
|
2383
2457
|
tooltipRowColor,
|
|
2384
2458
|
tooltipLinkHeaderColor,
|
|
2385
2459
|
tooltipHeaderColor,
|
|
2460
|
+
unit,
|
|
2386
2461
|
onNodeClick,
|
|
2387
2462
|
onLinkClick
|
|
2388
2463
|
} = props;
|
|
@@ -2409,17 +2484,20 @@ var PureSankey = (props) => {
|
|
|
2409
2484
|
const sankeyContainerElement = (0, react_exports.useRef)(null);
|
|
2410
2485
|
const [sankeyWidth, setSankeyWidth] = (0, react_exports.useState)(DEFAULT_CHART_WIDTH - margin.left - margin.right);
|
|
2411
2486
|
const [sankeyHeight, setSankeyHeight] = (0, react_exports.useState)(DEFAULT_CHART_HEIGHT - margin.top - margin.bottom);
|
|
2412
|
-
const handleNodeClick = (0, react_exports.useCallback)(
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
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
|
+
);
|
|
2423
2501
|
const handleLinkClick = (0, react_exports.useCallback)(
|
|
2424
2502
|
(link) => {
|
|
2425
2503
|
if (link) {
|
|
@@ -2434,7 +2512,7 @@ var PureSankey = (props) => {
|
|
|
2434
2512
|
});
|
|
2435
2513
|
}
|
|
2436
2514
|
},
|
|
2437
|
-
[fields,
|
|
2515
|
+
[linkValueField, fields, onLinkClick, columns]
|
|
2438
2516
|
);
|
|
2439
2517
|
(0, react_exports.useEffect)(() => {
|
|
2440
2518
|
if (sankeyContainerElement && sankeyContainerElement.current) {
|
|
@@ -2445,7 +2523,7 @@ var PureSankey = (props) => {
|
|
|
2445
2523
|
setSankeyWidth(sWidth - margin.left - margin.right);
|
|
2446
2524
|
setSankeyHeight(sHeight - margin.top - margin.bottom);
|
|
2447
2525
|
}
|
|
2448
|
-
}, [width, height]);
|
|
2526
|
+
}, [width, height, margin.left, margin.right, margin.top, margin.bottom]);
|
|
2449
2527
|
const sankeyData = convertInputToSankeyDataFormat(
|
|
2450
2528
|
columnsFromDataSource,
|
|
2451
2529
|
DEFAULT_SOURCE_INDEX,
|
|
@@ -2526,6 +2604,7 @@ var PureSankey = (props) => {
|
|
|
2526
2604
|
);
|
|
2527
2605
|
});
|
|
2528
2606
|
};
|
|
2607
|
+
const maxNode = getMaxNode(sankeyData.nodes);
|
|
2529
2608
|
const renderNodes = (nodes) => {
|
|
2530
2609
|
const chartWidth = typeof width === "number" ? width : Number.parseInt(width, 10);
|
|
2531
2610
|
return nodes.map((node) => {
|
|
@@ -2533,13 +2612,17 @@ var PureSankey = (props) => {
|
|
|
2533
2612
|
SankeyNode_default,
|
|
2534
2613
|
{
|
|
2535
2614
|
node,
|
|
2615
|
+
maxNode,
|
|
2536
2616
|
key: getNodeId(node),
|
|
2537
2617
|
"data-test": getNodeId(node),
|
|
2538
2618
|
activeNodes,
|
|
2539
2619
|
nodeWidth,
|
|
2540
2620
|
chartWidth,
|
|
2541
2621
|
colorCategoryMapping,
|
|
2622
|
+
labelDisplay,
|
|
2623
|
+
unit,
|
|
2542
2624
|
nodeTextColor,
|
|
2625
|
+
nodeValueColor,
|
|
2543
2626
|
handleMouseOver: (ev) => {
|
|
2544
2627
|
const connections = nodeConnectionsMap[node.index];
|
|
2545
2628
|
setActiveLinks(connections.links);
|
|
@@ -2620,9 +2703,11 @@ PureSankey.propTypes = {
|
|
|
2620
2703
|
linkValueField: prop_types_exports.string,
|
|
2621
2704
|
backgroundColor: prop_types_exports.string,
|
|
2622
2705
|
nodeTextColor: prop_types_exports.string,
|
|
2706
|
+
nodeValueColor: prop_types_exports.string,
|
|
2623
2707
|
tooltipRowColor: prop_types_exports.string,
|
|
2624
2708
|
tooltipLinkHeaderColor: prop_types_exports.string,
|
|
2625
|
-
tooltipHeaderColor: prop_types_exports.string
|
|
2709
|
+
tooltipHeaderColor: prop_types_exports.string,
|
|
2710
|
+
unit: prop_types_exports.string
|
|
2626
2711
|
};
|
|
2627
2712
|
PureSankey.defaultProps = {
|
|
2628
2713
|
columnsFromDataSource: [],
|
|
@@ -2641,11 +2726,13 @@ PureSankey.defaultProps = {
|
|
|
2641
2726
|
linkValueField: "value",
|
|
2642
2727
|
backgroundColor: "#0b0c0e",
|
|
2643
2728
|
nodeTextColor: "rgba(255, 255, 255, 0.98)",
|
|
2729
|
+
nodeValueColor: "rgba(255, 255, 255, 0.98)",
|
|
2644
2730
|
tooltipRowColor: "rgba(255, 255, 255, 0.98)",
|
|
2645
2731
|
tooltipLinkHeaderColor: "rgba(255, 255, 255, 0.98)",
|
|
2646
2732
|
tooltipHeaderColor: "rgba(255, 255, 255, 0.5)",
|
|
2647
2733
|
onNodeClick: lodash_exports.noop,
|
|
2648
|
-
onLinkClick: lodash_exports.noop
|
|
2734
|
+
onLinkClick: lodash_exports.noop,
|
|
2735
|
+
unit: ""
|
|
2649
2736
|
};
|
|
2650
2737
|
var PureSankey_default = PureSankey;
|
|
2651
2738
|
|
|
@@ -2706,11 +2793,9 @@ var configUtils_default = "default" in defaultImport37 ? defaultImport37.default
|
|
|
2706
2793
|
// src/common/utils/configUtils.ts
|
|
2707
2794
|
function enhanceConfig(vizConfig) {
|
|
2708
2795
|
const enhancedConfig = __spreadValues({}, vizConfig);
|
|
2709
|
-
enhancedConfig.editorConfig = vizConfig.editorConfig.map(
|
|
2710
|
-
(config2)
|
|
2711
|
-
|
|
2712
|
-
}
|
|
2713
|
-
);
|
|
2796
|
+
enhancedConfig.editorConfig = vizConfig.editorConfig.map((config2) => {
|
|
2797
|
+
return __spreadProps(__spreadValues({}, config2), { open: config2.open || false });
|
|
2798
|
+
});
|
|
2714
2799
|
return enhancedConfig;
|
|
2715
2800
|
}
|
|
2716
2801
|
|
|
@@ -2768,6 +2853,24 @@ var background = ({
|
|
|
2768
2853
|
];
|
|
2769
2854
|
var BackgroundColor_default = background;
|
|
2770
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
|
+
|
|
2771
2874
|
// src/Sankey/config.ts
|
|
2772
2875
|
var defaultContext = {
|
|
2773
2876
|
linkColorRangeConfig: [
|
|
@@ -2796,18 +2899,13 @@ var size = {
|
|
|
2796
2899
|
initialHeight: 300
|
|
2797
2900
|
};
|
|
2798
2901
|
var themes = {
|
|
2799
|
-
defaultBackgroundColor
|
|
2800
|
-
enterprise: {
|
|
2801
|
-
dark: themes_exports.variables.black(props),
|
|
2802
|
-
light: themes_exports.variables.backgroundColor(props)
|
|
2803
|
-
},
|
|
2804
|
-
prisma: themes_exports.variables.backgroundColorSidebar(props)
|
|
2805
|
-
})(props),
|
|
2902
|
+
defaultBackgroundColor,
|
|
2806
2903
|
nodeTextColor: (props) => (0, themes_exports.pick)({
|
|
2807
|
-
enterprise:
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
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),
|
|
2811
2909
|
prisma: themes_exports.variables.contentColorActive(props)
|
|
2812
2910
|
})(props),
|
|
2813
2911
|
tooltipRowColor: (props) => (0, themes_exports.pick)({
|
|
@@ -2850,6 +2948,34 @@ var editorConfig = [
|
|
|
2850
2948
|
]
|
|
2851
2949
|
]
|
|
2852
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
|
+
},
|
|
2853
2979
|
{
|
|
2854
2980
|
label: (0, i18n_exports._)("Color and style"),
|
|
2855
2981
|
layout: [
|
|
@@ -2867,7 +2993,10 @@ var editorConfig = [
|
|
|
2867
2993
|
}
|
|
2868
2994
|
],
|
|
2869
2995
|
[
|
|
2870
|
-
__spreadProps(__spreadValues({}, getDynamicLinkColorsEditor({
|
|
2996
|
+
__spreadProps(__spreadValues({}, getDynamicLinkColorsEditor({
|
|
2997
|
+
defaultContext,
|
|
2998
|
+
defaultPalettesConfig: PresetPalettes_exports.defaultPalettesConfig
|
|
2999
|
+
})), {
|
|
2871
3000
|
showEditor: ({ options }) => options.colorMode === "dynamic"
|
|
2872
3001
|
})
|
|
2873
3002
|
],
|
|
@@ -2931,6 +3060,7 @@ var computeVizProps = ({
|
|
|
2931
3060
|
const themeColorVariables = [
|
|
2932
3061
|
"defaultBackgroundColor",
|
|
2933
3062
|
"nodeTextColor",
|
|
3063
|
+
"nodeValueColor",
|
|
2934
3064
|
"tooltipRowColor",
|
|
2935
3065
|
"tooltipLinkHeaderColor",
|
|
2936
3066
|
"tooltipHeaderColor"
|