@splunk/visualizations 26.0.0 → 26.1.1
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 +103 -19
- package/Area.config.js.map +1 -1
- package/Area.js +646 -243
- package/Area.js.map +1 -1
- package/Bar.config.js +105 -21
- package/Bar.config.js.map +1 -1
- package/Bar.js +653 -237
- package/Bar.js.map +1 -1
- package/Bubble.config.js +95 -21
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +635 -229
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +66 -15
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +589 -211
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +104 -19
- package/Column.config.js.map +1 -1
- package/Column.js +666 -239
- package/Column.js.map +1 -1
- package/Ellipse.config.js +83 -18
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +444 -156
- package/Ellipse.js.map +1 -1
- package/Events.config.js +101 -19
- package/Events.config.js.map +1 -1
- package/Events.js +792 -322
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +97 -28
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +786 -390
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +63 -19
- package/Image.config.js.map +1 -1
- package/Image.js +439 -164
- package/Image.js.map +1 -1
- package/Line.config.js +107 -23
- package/Line.config.js.map +1 -1
- package/Line.js +841 -456
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +73 -23
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +653 -230
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +244 -99
- package/Map.config.js.map +1 -1
- package/Map.js +1223 -612
- package/Map.js.map +1 -1
- package/Markdown.config.js +71 -21
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +477 -202
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +80 -22
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +819 -418
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +73 -19
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +870 -491
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +76 -23
- package/Pie.config.js.map +1 -1
- package/Pie.js +643 -233
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +82 -30
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +863 -387
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +86 -20
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +449 -159
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +85 -23
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +895 -349
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +97 -23
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +639 -234
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +95 -25
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1198 -656
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +287 -226
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +93 -23
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +991 -522
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +100 -27
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1185 -624
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +127 -68
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -21
- package/Table.config.js.map +1 -1
- package/Table.js +827 -329
- package/Table.js.map +1 -1
- package/common/Charting.js +152 -69
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +25 -14
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +530 -0
- package/common/DocExampleWithVizSandbox.js.map +1 -0
- package/common/EventsDoc.js +139 -104
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +79 -69
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +54 -45
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +178 -87
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +530 -68
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +47 -20
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +15 -9
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +57 -44
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +52 -20
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +139 -7
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +185 -102
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +28 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +50 -15
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +8 -3
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +4 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -1
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +288 -128
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +242 -197
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -1
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +62 -1
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +3 -1
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +389 -192
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +18 -26
package/Sankey.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -127,28 +127,47 @@ module.exports = require("@splunk/themes/variables");
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
var _toConsumableArray = __webpack_require__(8);
|
|
130
|
+
|
|
130
131
|
var _slicedToArray = __webpack_require__(17);
|
|
132
|
+
|
|
131
133
|
Object.defineProperty(exports, "__esModule", {
|
|
132
134
|
value: true
|
|
133
135
|
});
|
|
134
136
|
exports.DEFAULT_LINK_VALUE_INDEX = exports.DEFAULT_TARGET_INDEX = exports.DEFAULT_SOURCE_INDEX = exports.DEFAULT_CHART_HEIGHT = exports.DEFAULT_CHART_WIDTH = exports.CHART_MIN_HEIGHT = exports.CHART_MIN_WIDTH = exports.INACTIVE_OPACITY = exports.DEFAULT_NODE_OPACITY = exports.DEFAULT_LINK_OPACITY = exports.DEFAULT_SERIES_COLOR = exports.DEFAULT_LINK_COLOR = exports.DEFAULT_NODE_COLOR = exports.DEFAULT_FONT_FAMILY = exports.NODE_TEXT_FONT_SIZE = exports.DEFAULT_COLORS = void 0;
|
|
137
|
+
|
|
135
138
|
var React = __webpack_require__(1);
|
|
139
|
+
|
|
136
140
|
var react_1 = __webpack_require__(1);
|
|
141
|
+
|
|
137
142
|
var T = __webpack_require__(0);
|
|
143
|
+
|
|
138
144
|
var lodash_1 = __webpack_require__(3);
|
|
145
|
+
|
|
139
146
|
var styled_components_1 = __webpack_require__(4);
|
|
147
|
+
|
|
140
148
|
var Message_1 = __webpack_require__(10);
|
|
149
|
+
|
|
141
150
|
var i18n_1 = __webpack_require__(2);
|
|
151
|
+
|
|
142
152
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
153
|
+
|
|
143
154
|
var style_1 = __webpack_require__(14);
|
|
144
|
-
|
|
145
|
-
// eslint-disable-next-line camelcase
|
|
155
|
+
|
|
156
|
+
var visualization_color_palettes_1 = __webpack_require__(51); // eslint-disable-next-line camelcase
|
|
157
|
+
|
|
158
|
+
|
|
146
159
|
var sankey_1 = __webpack_require__(458);
|
|
160
|
+
|
|
147
161
|
var VizStyleWrapper_1 = __webpack_require__(73);
|
|
162
|
+
|
|
148
163
|
var SankeyUtils_1 = __webpack_require__(134);
|
|
164
|
+
|
|
149
165
|
var SankeyNode_1 = __webpack_require__(459);
|
|
166
|
+
|
|
150
167
|
var SankeyLink_1 = __webpack_require__(460);
|
|
168
|
+
|
|
151
169
|
var SankeyTooltip_1 = __webpack_require__(461);
|
|
170
|
+
|
|
152
171
|
exports.DEFAULT_COLORS = {
|
|
153
172
|
backgroundColor: '#ffffff',
|
|
154
173
|
nodeTextColor: '#2c2c2c',
|
|
@@ -179,73 +198,116 @@ var SankeyContainer = styled_components_1.default.div.withConfig({
|
|
|
179
198
|
})(["overflow:hidden;", ";"], function (props) {
|
|
180
199
|
return (0, style_1.toDimension)((0, lodash_1.pick)(props, ['width', 'height']));
|
|
181
200
|
});
|
|
201
|
+
|
|
182
202
|
var PureSankey = function PureSankey(props) {
|
|
183
203
|
var width = props.width,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
204
|
+
height = props.height,
|
|
205
|
+
columns = props.columns,
|
|
206
|
+
columnsFromDataSource = props.columnsFromDataSource,
|
|
207
|
+
fields = props.fields,
|
|
208
|
+
colorMode = props.colorMode,
|
|
209
|
+
nodeWidth = props.nodeWidth,
|
|
210
|
+
nodePadding = props.nodePadding,
|
|
211
|
+
resultLimit = props.resultLimit,
|
|
212
|
+
seriesColors = props.seriesColors,
|
|
213
|
+
linkColors = props.linkColors,
|
|
214
|
+
linkOpacity = props.linkOpacity,
|
|
215
|
+
linkValueField = props.linkValueField,
|
|
216
|
+
backgroundColor = props.backgroundColor,
|
|
217
|
+
nodeTextColor = props.nodeTextColor,
|
|
218
|
+
tooltipRowColor = props.tooltipRowColor,
|
|
219
|
+
tooltipLinkHeaderColor = props.tooltipLinkHeaderColor,
|
|
220
|
+
tooltipHeaderColor = props.tooltipHeaderColor,
|
|
221
|
+
onNodeClick = props.onNodeClick,
|
|
222
|
+
onLinkClick = props.onLinkClick;
|
|
199
223
|
var margin = {
|
|
200
224
|
top: 17,
|
|
201
225
|
right: 25,
|
|
202
226
|
bottom: 17,
|
|
203
227
|
left: 30
|
|
204
|
-
};
|
|
205
|
-
// This is to translate the svg's root g based on margin
|
|
228
|
+
}; // This is to translate the svg's root g based on margin
|
|
206
229
|
// The y position is same as margin top & bottom
|
|
207
230
|
// The x position is an avg of margin right & left
|
|
231
|
+
|
|
208
232
|
var translatePos = {
|
|
209
233
|
x: 28,
|
|
210
234
|
y: 17
|
|
211
235
|
};
|
|
236
|
+
|
|
212
237
|
var _ref = (0, react_1.useState)([]),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
238
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
239
|
+
activeLinks = _ref2[0],
|
|
240
|
+
setActiveLinks = _ref2[1];
|
|
241
|
+
|
|
216
242
|
var _ref3 = (0, react_1.useState)([]),
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
243
|
+
_ref4 = _slicedToArray(_ref3, 2),
|
|
244
|
+
activeNodes = _ref4[0],
|
|
245
|
+
setActiveNodes = _ref4[1];
|
|
246
|
+
|
|
220
247
|
var _ref5 = (0, react_1.useState)(null),
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
248
|
+
_ref6 = _slicedToArray(_ref5, 2),
|
|
249
|
+
nodeHovered = _ref6[0],
|
|
250
|
+
setNodeHovered = _ref6[1];
|
|
251
|
+
|
|
224
252
|
var _ref7 = (0, react_1.useState)(null),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
253
|
+
_ref8 = _slicedToArray(_ref7, 2),
|
|
254
|
+
hoveredNodeElement = _ref8[0],
|
|
255
|
+
setHoveredNodeElement = _ref8[1];
|
|
256
|
+
|
|
228
257
|
var _ref9 = (0, react_1.useState)(false),
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
258
|
+
_ref10 = _slicedToArray(_ref9, 2),
|
|
259
|
+
openNodeToolTip = _ref10[0],
|
|
260
|
+
setOpenNodeToolTip = _ref10[1];
|
|
261
|
+
|
|
232
262
|
var _ref11 = (0, react_1.useState)(null),
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
263
|
+
_ref12 = _slicedToArray(_ref11, 2),
|
|
264
|
+
hoveredLinkElement = _ref12[0],
|
|
265
|
+
setHoveredLinkElement = _ref12[1];
|
|
266
|
+
|
|
236
267
|
var _ref13 = (0, react_1.useState)(false),
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
268
|
+
_ref14 = _slicedToArray(_ref13, 2),
|
|
269
|
+
openLinkToolTip = _ref14[0],
|
|
270
|
+
setOpenLinkToolTip = _ref14[1];
|
|
271
|
+
|
|
240
272
|
var sankeyContainerElement = (0, react_1.useRef)(null);
|
|
273
|
+
|
|
241
274
|
var _ref15 = (0, react_1.useState)(exports.DEFAULT_CHART_WIDTH - margin.left - margin.right),
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
275
|
+
_ref16 = _slicedToArray(_ref15, 2),
|
|
276
|
+
sankeyWidth = _ref16[0],
|
|
277
|
+
setSankeyWidth = _ref16[1];
|
|
278
|
+
|
|
245
279
|
var _ref17 = (0, react_1.useState)(exports.DEFAULT_CHART_HEIGHT - margin.top - margin.bottom),
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
280
|
+
_ref18 = _slicedToArray(_ref17, 2),
|
|
281
|
+
sankeyHeight = _ref18[0],
|
|
282
|
+
setSankeyHeight = _ref18[1];
|
|
283
|
+
|
|
284
|
+
var handleNodeClick = (0, react_1.useCallback)(function (node) {
|
|
285
|
+
if (node) {
|
|
286
|
+
onNodeClick({
|
|
287
|
+
type: 'node.click',
|
|
288
|
+
payload: {
|
|
289
|
+
nodeValue: node.value,
|
|
290
|
+
nodeName: node.name
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}, []);
|
|
295
|
+
var handleLinkClick = (0, react_1.useCallback)(function (link) {
|
|
296
|
+
if (link) {
|
|
297
|
+
var payload = {
|
|
298
|
+
name: linkValueField,
|
|
299
|
+
value: link.value
|
|
300
|
+
};
|
|
301
|
+
fields.forEach(function (field, idx) {
|
|
302
|
+
var rowToken = "row.".concat(field, ".value");
|
|
303
|
+
payload[rowToken] = columns[idx][link.index];
|
|
304
|
+
});
|
|
305
|
+
onLinkClick({
|
|
306
|
+
type: 'link.click',
|
|
307
|
+
payload: payload
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
}, [fields, columns, linkValueField]);
|
|
249
311
|
(0, react_1.useEffect)(function () {
|
|
250
312
|
if (sankeyContainerElement && sankeyContainerElement.current) {
|
|
251
313
|
var w = sankeyContainerElement.current.getBoundingClientRect().width;
|
|
@@ -256,8 +318,9 @@ var PureSankey = function PureSankey(props) {
|
|
|
256
318
|
setSankeyHeight(sHeight - margin.top - margin.bottom);
|
|
257
319
|
}
|
|
258
320
|
}, [width, height]);
|
|
259
|
-
var sankeyData = (0, SankeyUtils_1.convertInputToSankeyDataFormat)(
|
|
260
|
-
|
|
321
|
+
var sankeyData = (0, SankeyUtils_1.convertInputToSankeyDataFormat)(columnsFromDataSource, exports.DEFAULT_SOURCE_INDEX, exports.DEFAULT_TARGET_INDEX, exports.DEFAULT_LINK_VALUE_INDEX, resultLimit);
|
|
322
|
+
|
|
323
|
+
if (!sankeyData || !columnsFromDataSource || !Array.isArray(columnsFromDataSource) || columnsFromDataSource.length < 3) {
|
|
261
324
|
return React.createElement(Message_1.default, {
|
|
262
325
|
width: width,
|
|
263
326
|
height: height,
|
|
@@ -265,6 +328,7 @@ var PureSankey = function PureSankey(props) {
|
|
|
265
328
|
level: "info"
|
|
266
329
|
});
|
|
267
330
|
}
|
|
331
|
+
|
|
268
332
|
var sortAndAssignLinkIds = function sortAndAssignLinkIds(links) {
|
|
269
333
|
links.sort(function (a, b) {
|
|
270
334
|
return a.dy - b.dy;
|
|
@@ -274,6 +338,7 @@ var PureSankey = function PureSankey(props) {
|
|
|
274
338
|
link.id = "link-".concat(link.source.index, "-").concat(link.target.index);
|
|
275
339
|
});
|
|
276
340
|
};
|
|
341
|
+
|
|
277
342
|
var d3sankey = (0, sankey_1.d3_sankey)().nodeWidth(nodeWidth).nodePadding(nodePadding).size([sankeyWidth, sankeyHeight]);
|
|
278
343
|
var path = d3sankey.reversibleLink();
|
|
279
344
|
d3sankey.nodes(sankeyData.nodes).links(sankeyData.links).layout(500);
|
|
@@ -286,6 +351,7 @@ var PureSankey = function PureSankey(props) {
|
|
|
286
351
|
seriesColors: seriesColors,
|
|
287
352
|
linkColors: linkColors
|
|
288
353
|
});
|
|
354
|
+
|
|
289
355
|
var resetStates = function resetStates() {
|
|
290
356
|
setActiveLinks([]);
|
|
291
357
|
setActiveNodes([]);
|
|
@@ -295,9 +361,11 @@ var PureSankey = function PureSankey(props) {
|
|
|
295
361
|
setOpenLinkToolTip(false);
|
|
296
362
|
setOpenNodeToolTip(false);
|
|
297
363
|
};
|
|
364
|
+
|
|
298
365
|
var renderVisualization = function renderVisualization(_ref19) {
|
|
299
366
|
var containerWidth = _ref19.width,
|
|
300
|
-
|
|
367
|
+
containerHeight = _ref19.height;
|
|
368
|
+
|
|
301
369
|
if (containerWidth < exports.CHART_MIN_WIDTH || containerHeight < exports.CHART_MIN_HEIGHT) {
|
|
302
370
|
return React.createElement(Message_1.default, {
|
|
303
371
|
width: containerWidth,
|
|
@@ -306,6 +374,7 @@ var PureSankey = function PureSankey(props) {
|
|
|
306
374
|
level: "info"
|
|
307
375
|
});
|
|
308
376
|
}
|
|
377
|
+
|
|
309
378
|
var renderLinks = function renderLinks(links) {
|
|
310
379
|
return links.map(function (link) {
|
|
311
380
|
return React.createElement(SankeyLink_1.default, {
|
|
@@ -326,10 +395,12 @@ var PureSankey = function PureSankey(props) {
|
|
|
326
395
|
},
|
|
327
396
|
handleMouseLeave: function handleMouseLeave() {
|
|
328
397
|
resetStates();
|
|
329
|
-
}
|
|
398
|
+
},
|
|
399
|
+
handleLinkClick: handleLinkClick
|
|
330
400
|
});
|
|
331
401
|
});
|
|
332
402
|
};
|
|
403
|
+
|
|
333
404
|
var renderNodes = function renderNodes(nodes) {
|
|
334
405
|
var chartWidth = typeof width === 'number' ? width : Number.parseInt(width, 10);
|
|
335
406
|
return nodes.map(function (node) {
|
|
@@ -353,10 +424,12 @@ var PureSankey = function PureSankey(props) {
|
|
|
353
424
|
},
|
|
354
425
|
handleMouseLeave: function handleMouseLeave() {
|
|
355
426
|
return resetStates();
|
|
356
|
-
}
|
|
427
|
+
},
|
|
428
|
+
handleNodeClick: handleNodeClick
|
|
357
429
|
});
|
|
358
430
|
});
|
|
359
431
|
};
|
|
432
|
+
|
|
360
433
|
return React.createElement(VizStyleWrapper_1.default, {
|
|
361
434
|
backgroundColor: backgroundColor,
|
|
362
435
|
dataTestKey: "SankeyWrapper",
|
|
@@ -409,6 +482,7 @@ var PureSankey = function PureSankey(props) {
|
|
|
409
482
|
tooltipHeaderColor: tooltipHeaderColor
|
|
410
483
|
})))));
|
|
411
484
|
};
|
|
485
|
+
|
|
412
486
|
return React.createElement(SankeyContainer, {
|
|
413
487
|
height: height,
|
|
414
488
|
width: width,
|
|
@@ -417,8 +491,11 @@ var PureSankey = function PureSankey(props) {
|
|
|
417
491
|
return renderVisualization(containerDimension);
|
|
418
492
|
}));
|
|
419
493
|
};
|
|
494
|
+
|
|
420
495
|
PureSankey.propTypes = {
|
|
421
496
|
columns: T.array,
|
|
497
|
+
columnsFromDataSource: T.array,
|
|
498
|
+
fields: T.array,
|
|
422
499
|
width: T.oneOfType([T.string, T.number]),
|
|
423
500
|
height: T.oneOfType([T.string, T.number]),
|
|
424
501
|
// need this to satisfy props interface
|
|
@@ -439,7 +516,9 @@ PureSankey.propTypes = {
|
|
|
439
516
|
tooltipHeaderColor: T.string
|
|
440
517
|
};
|
|
441
518
|
PureSankey.defaultProps = {
|
|
519
|
+
columnsFromDataSource: [],
|
|
442
520
|
columns: [],
|
|
521
|
+
fields: [],
|
|
443
522
|
width: exports.DEFAULT_CHART_WIDTH,
|
|
444
523
|
height: exports.DEFAULT_CHART_HEIGHT,
|
|
445
524
|
mode: 'view',
|
|
@@ -455,7 +534,9 @@ PureSankey.defaultProps = {
|
|
|
455
534
|
nodeTextColor: 'rgba(255, 255, 255, 0.98)',
|
|
456
535
|
tooltipRowColor: 'rgba(255, 255, 255, 0.98)',
|
|
457
536
|
tooltipLinkHeaderColor: 'rgba(255, 255, 255, 0.98)',
|
|
458
|
-
tooltipHeaderColor: 'rgba(255, 255, 255, 0.5)'
|
|
537
|
+
tooltipHeaderColor: 'rgba(255, 255, 255, 0.5)',
|
|
538
|
+
onNodeClick: lodash_1.noop,
|
|
539
|
+
onLinkClick: lodash_1.noop
|
|
459
540
|
};
|
|
460
541
|
exports.default = PureSankey;
|
|
461
542
|
|
|
@@ -477,11 +558,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
477
558
|
Object.defineProperty(exports, "__esModule", {
|
|
478
559
|
value: true
|
|
479
560
|
});
|
|
561
|
+
|
|
480
562
|
var React = __webpack_require__(1);
|
|
563
|
+
|
|
481
564
|
var styled_components_1 = __webpack_require__(4);
|
|
565
|
+
|
|
482
566
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
567
|
+
|
|
483
568
|
var style_1 = __webpack_require__(14);
|
|
569
|
+
|
|
484
570
|
var colorUtils_1 = __webpack_require__(12);
|
|
571
|
+
|
|
485
572
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
486
573
|
var width = _ref.width;
|
|
487
574
|
return {
|
|
@@ -494,11 +581,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
494
581
|
componentId: "sc-1yhgpod-0"
|
|
495
582
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
496
583
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
497
|
-
});
|
|
498
|
-
|
|
584
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
585
|
+
|
|
499
586
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
500
587
|
var width = _ref2.width,
|
|
501
|
-
|
|
588
|
+
height = _ref2.height;
|
|
502
589
|
return {
|
|
503
590
|
style: Object.assign(Object.assign({}, width && {
|
|
504
591
|
width: (0, style_1.toPx)(width)
|
|
@@ -520,11 +607,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
520
607
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
521
608
|
componentId: "sc-1yhgpod-3"
|
|
522
609
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
610
|
+
|
|
523
611
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
524
612
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
525
613
|
var width = props.width,
|
|
526
|
-
|
|
527
|
-
|
|
614
|
+
height = props.height,
|
|
615
|
+
backgroundColor = props.backgroundColor;
|
|
616
|
+
|
|
528
617
|
if (!height) {
|
|
529
618
|
return React.createElement(Item, {
|
|
530
619
|
"data-test": "item",
|
|
@@ -532,24 +621,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
532
621
|
backgroundColor: backgroundColor
|
|
533
622
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
534
623
|
}
|
|
624
|
+
|
|
535
625
|
return React.createElement(FixSizeItem, {
|
|
536
626
|
"data-test": "fix-size-item",
|
|
537
|
-
"data-splunk-visualization-version": "26.
|
|
627
|
+
"data-splunk-visualization-version": "26.1.1 - b6df0a015",
|
|
538
628
|
width: width,
|
|
539
629
|
height: height,
|
|
540
630
|
backgroundColor: backgroundColor
|
|
541
631
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
542
632
|
var newWidth = _ref3.width,
|
|
543
|
-
|
|
633
|
+
newHeight = _ref3.height;
|
|
544
634
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
545
635
|
width: newWidth,
|
|
546
636
|
height: newHeight
|
|
547
637
|
}));
|
|
548
638
|
})));
|
|
549
639
|
};
|
|
640
|
+
|
|
550
641
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
551
642
|
return FixedSizeContainer;
|
|
552
643
|
};
|
|
644
|
+
|
|
553
645
|
exports.default = withFixedSizeContainer;
|
|
554
646
|
|
|
555
647
|
/***/ }),
|
|
@@ -565,16 +657,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
565
657
|
});
|
|
566
658
|
exports.truncateSVGTextWithEllipsis = exports.checkDigitsOnly = exports.computeAllConnectedLinksToNodes = exports.getAllConnectedLinks = exports.extractLinkMidPoint = exports.getAllNodeNames = exports.getLinkId = exports.getNodeId = exports.convertInputToSankeyDataFormat = exports.getColorCategoryMapping = exports.getNodesIndex = void 0;
|
|
567
659
|
/* eslint-disable no-param-reassign */
|
|
568
|
-
|
|
569
|
-
var
|
|
660
|
+
|
|
661
|
+
var d3_scale_1 = __webpack_require__(93);
|
|
662
|
+
|
|
663
|
+
var types_1 = __webpack_require__(83);
|
|
664
|
+
|
|
570
665
|
var insertNodeIfNotExist = function insertNodeIfNotExist(sankeyData, nodeName) {
|
|
571
666
|
var nodes = sankeyData.nodes;
|
|
572
667
|
nodes = nodes || [];
|
|
668
|
+
|
|
573
669
|
if (typeof nodeName !== 'string') {
|
|
574
670
|
console.error('Node not created, invalid nodename:', nodeName);
|
|
575
671
|
return;
|
|
576
672
|
}
|
|
673
|
+
|
|
577
674
|
nodeName = nodeName.trim();
|
|
675
|
+
|
|
578
676
|
if (!nodes.find(function (node) {
|
|
579
677
|
return node.name.toLocaleLowerCase() === nodeName.toLocaleLowerCase();
|
|
580
678
|
})) {
|
|
@@ -583,6 +681,7 @@ var insertNodeIfNotExist = function insertNodeIfNotExist(sankeyData, nodeName) {
|
|
|
583
681
|
});
|
|
584
682
|
}
|
|
585
683
|
};
|
|
684
|
+
|
|
586
685
|
var insertLink = function insertLink(sankeyData, sourceFieldIdx, targetFieldIdx, linkValue, index) {
|
|
587
686
|
var links = sankeyData.links;
|
|
588
687
|
links = links || [];
|
|
@@ -593,49 +692,60 @@ var insertLink = function insertLink(sankeyData, sourceFieldIdx, targetFieldIdx,
|
|
|
593
692
|
index: index
|
|
594
693
|
});
|
|
595
694
|
};
|
|
695
|
+
|
|
596
696
|
var getNodesIndex = function getNodesIndex(sankeyData, nodeName) {
|
|
597
697
|
if (!sankeyData || !sankeyData.nodes || !sankeyData.nodes.length) {
|
|
598
698
|
return -1;
|
|
599
699
|
}
|
|
700
|
+
|
|
600
701
|
return sankeyData.nodes.findIndex(function (node) {
|
|
601
702
|
return node.name.toLocaleLowerCase() === nodeName.toLocaleLowerCase();
|
|
602
703
|
});
|
|
603
704
|
};
|
|
705
|
+
|
|
604
706
|
exports.getNodesIndex = getNodesIndex;
|
|
707
|
+
|
|
605
708
|
var getColorCategoryMapping = function getColorCategoryMapping(_ref) {
|
|
606
709
|
var category = _ref.category,
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
710
|
+
colorMode = _ref.colorMode,
|
|
711
|
+
seriesColors = _ref.seriesColors,
|
|
712
|
+
linkColors = _ref.linkColors;
|
|
713
|
+
|
|
610
714
|
if (colorMode !== 'categorical') {
|
|
611
715
|
return linkColors;
|
|
612
716
|
}
|
|
717
|
+
|
|
613
718
|
return seriesColors ? (0, d3_scale_1.scaleOrdinal)().domain(category).range(seriesColors).unknown(seriesColors[0]) : null;
|
|
614
719
|
};
|
|
720
|
+
|
|
615
721
|
exports.getColorCategoryMapping = getColorCategoryMapping;
|
|
722
|
+
|
|
616
723
|
var convertInputToSankeyDataFormat = function convertInputToSankeyDataFormat(columns, sourceFieldIdx, targetFieldIdx, linkValueFieldIdx, resultLimit) {
|
|
617
724
|
if (!columns || !Array.isArray(columns) || !columns.length || !columns[sourceFieldIdx] || !columns[targetFieldIdx] || !columns[linkValueFieldIdx] || columns.length < 3 || !Array.isArray(columns[sourceFieldIdx]) || !Array.isArray(columns[targetFieldIdx]) || !Array.isArray(columns[linkValueFieldIdx]) || !columns[sourceFieldIdx] || typeof columns[sourceFieldIdx][0] !== 'string' || !columns[targetFieldIdx] || typeof columns[targetFieldIdx][0] !== 'string') {
|
|
618
725
|
return null;
|
|
619
726
|
}
|
|
727
|
+
|
|
620
728
|
var sankeyData = {
|
|
621
729
|
nodes: [],
|
|
622
730
|
links: []
|
|
623
731
|
};
|
|
624
732
|
var maxlen = Math.min(columns[sourceFieldIdx].length, columns[targetFieldIdx].length, columns[linkValueFieldIdx].length, resultLimit);
|
|
733
|
+
|
|
625
734
|
for (var i = 0; i < maxlen; i += 1) {
|
|
626
735
|
if (typeof columns[sourceFieldIdx][i] === 'string' && typeof columns[targetFieldIdx][i] === 'string' && (0, types_1.isNumber)(columns[linkValueFieldIdx][i])) {
|
|
627
736
|
(function () {
|
|
628
737
|
var sourceNodeName = columns[sourceFieldIdx][i].trim();
|
|
629
738
|
var targetNodeName = columns[targetFieldIdx][i].trim();
|
|
630
739
|
insertNodeIfNotExist(sankeyData, sourceNodeName);
|
|
631
|
-
insertNodeIfNotExist(sankeyData, targetNodeName);
|
|
632
|
-
|
|
740
|
+
insertNodeIfNotExist(sankeyData, targetNodeName); // If same link exists then sum up the value and donot insert new link
|
|
741
|
+
|
|
633
742
|
var sourceNodeIdx = (0, exports.getNodesIndex)(sankeyData, sourceNodeName);
|
|
634
743
|
var targetNodeIdx = (0, exports.getNodesIndex)(sankeyData, targetNodeName);
|
|
635
744
|
var linkExist = sankeyData.links.find(function (link) {
|
|
636
745
|
return link.source === sourceNodeIdx && link.target === targetNodeIdx;
|
|
637
746
|
});
|
|
638
747
|
var linkValue = +columns[linkValueFieldIdx][i];
|
|
748
|
+
|
|
639
749
|
if (linkExist) {
|
|
640
750
|
linkExist.value += linkValue;
|
|
641
751
|
} else {
|
|
@@ -646,53 +756,70 @@ var convertInputToSankeyDataFormat = function convertInputToSankeyDataFormat(col
|
|
|
646
756
|
console.error('Link excluded. Invalid type in column input, row :- ', i, "[".concat(columns[sourceFieldIdx][i], ", ").concat(columns[targetFieldIdx][i], ", ").concat(columns[linkValueFieldIdx][i], "]"));
|
|
647
757
|
}
|
|
648
758
|
}
|
|
759
|
+
|
|
649
760
|
return sankeyData;
|
|
650
761
|
};
|
|
762
|
+
|
|
651
763
|
exports.convertInputToSankeyDataFormat = convertInputToSankeyDataFormat;
|
|
764
|
+
|
|
652
765
|
var getNodeId = function getNodeId(node) {
|
|
653
766
|
if (!node) {
|
|
654
767
|
return '';
|
|
655
768
|
}
|
|
769
|
+
|
|
656
770
|
return "node-".concat(node.index);
|
|
657
771
|
};
|
|
772
|
+
|
|
658
773
|
exports.getNodeId = getNodeId;
|
|
774
|
+
|
|
659
775
|
var getLinkId = function getLinkId(link) {
|
|
660
776
|
if (!link) {
|
|
661
777
|
return '';
|
|
662
778
|
}
|
|
779
|
+
|
|
663
780
|
return "link-".concat(link.id);
|
|
664
781
|
};
|
|
782
|
+
|
|
665
783
|
exports.getLinkId = getLinkId;
|
|
784
|
+
|
|
666
785
|
var getAllNodeNames = function getAllNodeNames(sankeyData) {
|
|
667
786
|
if (!sankeyData || !sankeyData.nodes || !sankeyData.nodes.length) {
|
|
668
787
|
return [];
|
|
669
788
|
}
|
|
789
|
+
|
|
670
790
|
return sankeyData.nodes.map(function (node) {
|
|
671
791
|
return node.name;
|
|
672
792
|
});
|
|
673
793
|
};
|
|
794
|
+
|
|
674
795
|
exports.getAllNodeNames = getAllNodeNames;
|
|
796
|
+
|
|
675
797
|
var extractLinkMidPoint = function extractLinkMidPoint(pathStr) {
|
|
676
798
|
if (!pathStr) {
|
|
677
799
|
return null;
|
|
678
800
|
}
|
|
801
|
+
|
|
679
802
|
var mIndex = pathStr.indexOf('M');
|
|
680
803
|
var cIndexFirst = pathStr.indexOf('C');
|
|
681
804
|
var lIndex = pathStr.indexOf('L');
|
|
682
805
|
var cIndexLast = pathStr.lastIndexOf('C');
|
|
683
806
|
var zIndex = pathStr.lastIndexOf('Z');
|
|
807
|
+
|
|
684
808
|
if (mIndex < 0 || cIndexLast < 0 || cIndexLast < 0 || zIndex < 0) {
|
|
685
809
|
console.error('Extract link midpoint error. Invalid path -', pathStr);
|
|
686
810
|
return null;
|
|
687
811
|
}
|
|
812
|
+
|
|
688
813
|
var section1 = pathStr.slice(mIndex + 1, cIndexFirst).trim();
|
|
689
814
|
var section2 = pathStr.slice(cIndexFirst + 1, lIndex).trim();
|
|
690
815
|
var section3 = pathStr.slice(lIndex + 1, cIndexLast).trim();
|
|
691
816
|
var section4 = pathStr.slice(cIndexLast + 1, zIndex).trim();
|
|
817
|
+
|
|
692
818
|
if (!section1.length || !section2.length || !section3.length || !section4.length) {
|
|
693
819
|
console.error('Extract link midpoint error. Invalid path -', pathStr);
|
|
694
820
|
return null;
|
|
695
821
|
}
|
|
822
|
+
|
|
696
823
|
var points = [];
|
|
697
824
|
points.push(section1.split(',').map(function (i) {
|
|
698
825
|
return Number.parseFloat(i);
|
|
@@ -717,33 +844,42 @@ var extractLinkMidPoint = function extractLinkMidPoint(pathStr) {
|
|
|
717
844
|
y: y
|
|
718
845
|
};
|
|
719
846
|
};
|
|
847
|
+
|
|
720
848
|
exports.extractLinkMidPoint = extractLinkMidPoint;
|
|
849
|
+
|
|
721
850
|
var getAllConnectedLinks = function getAllConnectedLinks(links, nodeIdx) {
|
|
722
851
|
var result = {
|
|
723
852
|
links: [],
|
|
724
853
|
sourceNodes: [],
|
|
725
854
|
targetNodes: []
|
|
726
855
|
};
|
|
856
|
+
|
|
727
857
|
if (!links || !links.length) {
|
|
728
858
|
return result;
|
|
729
859
|
}
|
|
860
|
+
|
|
730
861
|
links.forEach(function (link) {
|
|
731
862
|
if (link.source.index === nodeIdx || link.target.index === nodeIdx) {
|
|
732
863
|
var linkAdded = result.links.find(function (l) {
|
|
733
864
|
return l.id === link.id;
|
|
734
865
|
});
|
|
866
|
+
|
|
735
867
|
if (!linkAdded) {
|
|
736
868
|
result.links.push(link);
|
|
737
869
|
}
|
|
870
|
+
|
|
738
871
|
var sourceNodeAdded = result.sourceNodes.find(function (n) {
|
|
739
872
|
return n.index === link.source.index;
|
|
740
873
|
});
|
|
874
|
+
|
|
741
875
|
if (!sourceNodeAdded) {
|
|
742
876
|
result.sourceNodes.push(link.source);
|
|
743
877
|
}
|
|
878
|
+
|
|
744
879
|
var targetNodeAdded = result.targetNodes.find(function (n) {
|
|
745
880
|
return n.index === link.target.index;
|
|
746
881
|
});
|
|
882
|
+
|
|
747
883
|
if (!targetNodeAdded) {
|
|
748
884
|
result.targetNodes.push(link.target);
|
|
749
885
|
}
|
|
@@ -751,28 +887,35 @@ var getAllConnectedLinks = function getAllConnectedLinks(links, nodeIdx) {
|
|
|
751
887
|
});
|
|
752
888
|
return result;
|
|
753
889
|
};
|
|
890
|
+
|
|
754
891
|
exports.getAllConnectedLinks = getAllConnectedLinks;
|
|
892
|
+
|
|
755
893
|
var computeAllConnectedLinksToNodes = function computeAllConnectedLinksToNodes(nodes, links) {
|
|
756
894
|
var connectionsMap = {};
|
|
895
|
+
|
|
757
896
|
if (!nodes || !links) {
|
|
758
897
|
return connectionsMap;
|
|
759
898
|
}
|
|
899
|
+
|
|
760
900
|
nodes.forEach(function (node) {
|
|
761
901
|
var connections = (0, exports.getAllConnectedLinks)(links, node.index);
|
|
762
902
|
connectionsMap[node.index] = connections;
|
|
763
903
|
});
|
|
764
904
|
return connectionsMap;
|
|
765
905
|
};
|
|
906
|
+
|
|
766
907
|
exports.computeAllConnectedLinksToNodes = computeAllConnectedLinksToNodes;
|
|
908
|
+
|
|
767
909
|
var checkDigitsOnly = function checkDigitsOnly(input) {
|
|
768
910
|
return /^\d+$/.test(input);
|
|
769
911
|
};
|
|
770
|
-
|
|
771
|
-
// Truncate the node text and show ellipsis at the end if text string width exceeds the max limit
|
|
912
|
+
|
|
913
|
+
exports.checkDigitsOnly = checkDigitsOnly; // Truncate the node text and show ellipsis at the end if text string width exceeds the max limit
|
|
914
|
+
|
|
772
915
|
var truncateSVGTextWithEllipsis = function truncateSVGTextWithEllipsis(textElement, textString, width) {
|
|
773
916
|
if (textElement && textElement.getSubStringLength !== undefined) {
|
|
774
|
-
textElement.textContent = textString;
|
|
775
|
-
|
|
917
|
+
textElement.textContent = textString; // ellipsis is needed
|
|
918
|
+
|
|
776
919
|
if (textElement.getSubStringLength(0, textString.length) >= width) {
|
|
777
920
|
for (var x = textString.length - 3; x > 0; x -= 3) {
|
|
778
921
|
if (textElement.getSubStringLength(0, x) <= width) {
|
|
@@ -780,6 +923,7 @@ var truncateSVGTextWithEllipsis = function truncateSVGTextWithEllipsis(textEleme
|
|
|
780
923
|
return;
|
|
781
924
|
}
|
|
782
925
|
}
|
|
926
|
+
|
|
783
927
|
textElement.textContent = '...'; // can't place at all
|
|
784
928
|
}
|
|
785
929
|
}
|
|
@@ -826,9 +970,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
826
970
|
* @param {DashboardVizType} props.Wrapper
|
|
827
971
|
* @param {DashboardVizType} props.Visualization
|
|
828
972
|
*/
|
|
973
|
+
|
|
829
974
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
830
975
|
var Wrapper = _ref.Wrapper,
|
|
831
|
-
|
|
976
|
+
Visualization = _ref.Visualization;
|
|
832
977
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
833
978
|
extendProperties.forEach(function (prop) {
|
|
834
979
|
if (Visualization[prop]) {
|
|
@@ -837,6 +982,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
837
982
|
}
|
|
838
983
|
});
|
|
839
984
|
};
|
|
985
|
+
|
|
840
986
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
841
987
|
|
|
842
988
|
/***/ }),
|
|
@@ -848,86 +994,122 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
848
994
|
|
|
849
995
|
/***/ }),
|
|
850
996
|
|
|
851
|
-
/***/
|
|
997
|
+
/***/ 167:
|
|
852
998
|
/***/ (function(module, exports, __webpack_require__) {
|
|
853
999
|
|
|
854
1000
|
"use strict";
|
|
855
1001
|
|
|
856
1002
|
|
|
857
1003
|
var _typeof = __webpack_require__(82);
|
|
1004
|
+
|
|
858
1005
|
Object.defineProperty(exports, "__esModule", {
|
|
859
1006
|
value: true
|
|
860
1007
|
});
|
|
861
1008
|
exports.PureSankey = exports.config = exports.themes = exports.computeVizProps = exports.showPlaceHolderIcon = void 0;
|
|
1009
|
+
|
|
862
1010
|
var lodash_1 = __webpack_require__(3);
|
|
1011
|
+
|
|
863
1012
|
var dataSourceUtils_1 = __webpack_require__(97);
|
|
1013
|
+
|
|
864
1014
|
var colorUtils_1 = __webpack_require__(12);
|
|
865
|
-
|
|
1015
|
+
|
|
1016
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
1017
|
+
|
|
866
1018
|
var PureSankey_1 = __webpack_require__(111);
|
|
1019
|
+
|
|
867
1020
|
exports.PureSankey = PureSankey_1.default;
|
|
1021
|
+
|
|
868
1022
|
var config_1 = __webpack_require__(462);
|
|
1023
|
+
|
|
869
1024
|
exports.config = config_1.default;
|
|
870
1025
|
/**
|
|
871
1026
|
* @method showPlaceHolderIcon
|
|
872
1027
|
* @param {Object} dataSources
|
|
873
1028
|
* @returns {Boolean} return true if loading, error, non existent state or without columns in dataSources
|
|
874
1029
|
*/
|
|
1030
|
+
|
|
875
1031
|
var showPlaceHolderIcon = function showPlaceHolderIcon(dataSources) {
|
|
876
1032
|
var columns = (0, lodash_1.get)(dataSources, 'primary.data.columns', undefined);
|
|
877
1033
|
var noColumns = columns === undefined;
|
|
878
1034
|
var dataSourceState = (0, dataSourceUtils_1.getDataSourceStateInfo)(dataSources);
|
|
879
1035
|
return dataSourceState === dataSourceUtils_1.DataSourceState.ERROR || dataSourceState === dataSourceUtils_1.DataSourceState.LOADING || dataSourceState === dataSourceUtils_1.DataSourceState.NONEXISTENT || noColumns;
|
|
880
1036
|
};
|
|
1037
|
+
|
|
881
1038
|
exports.showPlaceHolderIcon = showPlaceHolderIcon;
|
|
1039
|
+
|
|
882
1040
|
var computeVizProps = function computeVizProps(_ref) {
|
|
883
1041
|
var themeFunc = _ref.themeFunc,
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
1042
|
+
dataSources = _ref.dataSources,
|
|
1043
|
+
linkValues = _ref.linkValues,
|
|
1044
|
+
seriesColors = _ref.seriesColors,
|
|
1045
|
+
linkColors = _ref.linkColors,
|
|
1046
|
+
onNodeClick = _ref.onNodeClick,
|
|
1047
|
+
onLinkClick = _ref.onLinkClick;
|
|
1048
|
+
|
|
1049
|
+
var _a, _b, _c, _d, _e; // Compute all themeColor variables needed for PureSankey
|
|
1050
|
+
|
|
1051
|
+
|
|
890
1052
|
var themeColorVariables = ['defaultBackgroundColor', 'nodeTextColor', 'tooltipRowColor', 'tooltipLinkHeaderColor', 'tooltipHeaderColor'];
|
|
891
1053
|
var themeColors = {};
|
|
892
1054
|
themeColorVariables.forEach(function (variable) {
|
|
893
1055
|
themeColors[variable] = themeFunc(variable);
|
|
894
|
-
});
|
|
895
|
-
// Sanitize linkColors prop
|
|
1056
|
+
}); // Sanitize linkColors prop
|
|
896
1057
|
// eslint-disable-next-line no-param-reassign
|
|
897
|
-
|
|
898
|
-
// Sanitize seriesColors prop
|
|
1058
|
+
|
|
1059
|
+
linkColors = (0, colorUtils_1.sanitizeArrayOfColors)(linkColors); // Sanitize seriesColors prop
|
|
899
1060
|
// (Note:- This is handled outside SanitizeProps because it would impact seriesColors option used in splunk-charting viz as the types are different.
|
|
900
1061
|
// The type used in splunk-charting viz expects a string of comma separated colors, but here the type is an array of string)
|
|
901
1062
|
// eslint-disable-next-line no-param-reassign
|
|
902
|
-
|
|
903
|
-
// Compute the columns props and linkValueField props for pure Sankey
|
|
1063
|
+
|
|
1064
|
+
seriesColors = (0, colorUtils_1.isArrayOfColors)(seriesColors) ? seriesColors : undefined; // Compute the columns props and linkValueField props for pure Sankey
|
|
904
1065
|
// The columns props is computed as [primary.data.columns[0], primary.data.columns[1], linkValues].
|
|
905
1066
|
// The source and target columns are the default as columns[0] and columns[1] respectively
|
|
906
1067
|
// The linkValueField props is the fieldName which is set as the source of linkValues
|
|
1068
|
+
|
|
1069
|
+
var _dataSources$primary$ = dataSources.primary.data,
|
|
1070
|
+
columns = _dataSources$primary$.columns,
|
|
1071
|
+
fields = _dataSources$primary$.fields;
|
|
907
1072
|
var columnsFromDataSource = [];
|
|
908
1073
|
var linkValueField = '';
|
|
1074
|
+
var fieldNames = [];
|
|
1075
|
+
|
|
909
1076
|
if (((_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.columns) && ((_e = (_d = (_c = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns) === null || _e === void 0 ? void 0 : _e.length) >= 2 && Array.isArray(linkValues)) {
|
|
910
|
-
var columns = dataSources.primary.data.columns;
|
|
911
1077
|
columnsFromDataSource = columns ? [columns[0], columns[1], linkValues] : null;
|
|
912
1078
|
var linkIndex = columns.findIndex(function (col) {
|
|
913
1079
|
return (0, lodash_1.isEqual)(col, linkValues);
|
|
914
1080
|
});
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1081
|
+
|
|
1082
|
+
if (fields) {
|
|
1083
|
+
fields.forEach(function (field, idx) {
|
|
1084
|
+
var fieldName = '';
|
|
1085
|
+
|
|
1086
|
+
if (_typeof(field) === 'object' && field !== null) {
|
|
1087
|
+
fieldName = field.name;
|
|
1088
|
+
} else {
|
|
1089
|
+
fieldName = field !== null && field !== void 0 ? field : '';
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
if (idx === linkIndex) {
|
|
1093
|
+
linkValueField = fieldName;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
fieldNames.push(fieldName);
|
|
1097
|
+
});
|
|
922
1098
|
}
|
|
923
1099
|
}
|
|
1100
|
+
|
|
924
1101
|
return Object.assign(Object.assign({}, themeColors), {
|
|
925
|
-
columns:
|
|
1102
|
+
columns: columns,
|
|
1103
|
+
fields: fieldNames,
|
|
1104
|
+
columnsFromDataSource: columnsFromDataSource,
|
|
926
1105
|
linkValueField: linkValueField,
|
|
927
1106
|
seriesColors: seriesColors,
|
|
928
|
-
linkColors: linkColors
|
|
1107
|
+
linkColors: linkColors,
|
|
1108
|
+
onNodeClick: onNodeClick,
|
|
1109
|
+
onLinkClick: onLinkClick
|
|
929
1110
|
});
|
|
930
1111
|
};
|
|
1112
|
+
|
|
931
1113
|
exports.computeVizProps = computeVizProps;
|
|
932
1114
|
var Sankey = (0, withDashboardViz_1.default)({
|
|
933
1115
|
ReactViz: PureSankey_1.default,
|
|
@@ -978,24 +1160,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
978
1160
|
|
|
979
1161
|
|
|
980
1162
|
var _toConsumableArray = __webpack_require__(8);
|
|
1163
|
+
|
|
981
1164
|
var _defineProperty = __webpack_require__(7);
|
|
1165
|
+
|
|
982
1166
|
var __rest = this && this.__rest || function (s, e) {
|
|
983
1167
|
var t = {};
|
|
1168
|
+
|
|
984
1169
|
for (var p in s) {
|
|
985
1170
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
986
1171
|
}
|
|
1172
|
+
|
|
987
1173
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
988
1174
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
989
1175
|
}
|
|
990
1176
|
return t;
|
|
991
1177
|
};
|
|
1178
|
+
|
|
992
1179
|
Object.defineProperty(exports, "__esModule", {
|
|
993
1180
|
value: true
|
|
994
1181
|
});
|
|
995
1182
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
1183
|
+
|
|
996
1184
|
var lodash_1 = __webpack_require__(3);
|
|
1185
|
+
|
|
997
1186
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1187
|
+
|
|
998
1188
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1189
|
+
|
|
999
1190
|
var dynamicOptionsDSLType = {
|
|
1000
1191
|
type: 'string',
|
|
1001
1192
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -1005,20 +1196,22 @@ var dynamicOptionsDSLType = {
|
|
|
1005
1196
|
* @param optionsSchema a visualization's options schema
|
|
1006
1197
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
1007
1198
|
*/
|
|
1199
|
+
|
|
1008
1200
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
1009
1201
|
var enhancedOptionsSchema = {};
|
|
1010
1202
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
1011
1203
|
var _a = optionsSchema[key],
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1204
|
+
title = _a.title,
|
|
1205
|
+
description = _a.description,
|
|
1206
|
+
readOnly = _a.readOnly,
|
|
1207
|
+
writeOnly = _a.writeOnly,
|
|
1208
|
+
examples = _a.examples,
|
|
1209
|
+
defaultValue = _a.default,
|
|
1210
|
+
type = _a.type,
|
|
1211
|
+
properties = _a.properties,
|
|
1212
|
+
patternProperties = _a.patternProperties,
|
|
1213
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
1214
|
+
|
|
1022
1215
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
1023
1216
|
title: title
|
|
1024
1217
|
}), description !== undefined && {
|
|
@@ -1032,12 +1225,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1032
1225
|
}), defaultValue !== undefined && {
|
|
1033
1226
|
default: defaultValue
|
|
1034
1227
|
});
|
|
1228
|
+
|
|
1035
1229
|
if (type === 'object') {
|
|
1036
1230
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
1037
1231
|
type: type
|
|
1038
1232
|
}), properties && {
|
|
1039
1233
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
1040
1234
|
});
|
|
1235
|
+
|
|
1041
1236
|
if (patternProperties) {
|
|
1042
1237
|
var enhancedPatternProperties = {};
|
|
1043
1238
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -1055,6 +1250,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1055
1250
|
});
|
|
1056
1251
|
return enhancedOptionsSchema;
|
|
1057
1252
|
}
|
|
1253
|
+
|
|
1058
1254
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
1059
1255
|
/**
|
|
1060
1256
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -1063,11 +1259,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
1063
1259
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
1064
1260
|
* and containing `open: false` for all editor panels in editorConfig
|
|
1065
1261
|
*/
|
|
1262
|
+
|
|
1066
1263
|
function enhanceConfig(vizConfig) {
|
|
1067
1264
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
1265
|
+
|
|
1068
1266
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
1069
1267
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
1070
1268
|
}
|
|
1269
|
+
|
|
1071
1270
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
1072
1271
|
return Object.assign(Object.assign({}, config), {
|
|
1073
1272
|
open: config.open || false
|
|
@@ -1075,6 +1274,7 @@ function enhanceConfig(vizConfig) {
|
|
|
1075
1274
|
});
|
|
1076
1275
|
return enhancedConfig;
|
|
1077
1276
|
}
|
|
1277
|
+
|
|
1078
1278
|
exports.enhanceConfig = enhanceConfig;
|
|
1079
1279
|
/**
|
|
1080
1280
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -1082,6 +1282,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
1082
1282
|
* @param vizConfig a Visualization Config
|
|
1083
1283
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
1084
1284
|
*/
|
|
1285
|
+
|
|
1085
1286
|
function uncollapseEditorConfig(vizConfig) {
|
|
1086
1287
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
1087
1288
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -1091,13 +1292,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
1091
1292
|
});
|
|
1092
1293
|
return editorPanelUncollapsedConfig;
|
|
1093
1294
|
}
|
|
1295
|
+
|
|
1094
1296
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
1297
|
+
|
|
1095
1298
|
function isDynamicOption(option) {
|
|
1096
1299
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
1097
1300
|
}
|
|
1098
|
-
|
|
1099
|
-
// private helpers to improve readability of getInitialPreset
|
|
1301
|
+
|
|
1302
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
1100
1303
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
1304
|
+
|
|
1101
1305
|
/**
|
|
1102
1306
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
1103
1307
|
* if a preset has explicitly specified a key as being undefined, the vizContext must also has that key as undefined, or else this CANNOT be the initialPreset
|
|
@@ -1106,6 +1310,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
1106
1310
|
*
|
|
1107
1311
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
1108
1312
|
*/
|
|
1313
|
+
|
|
1109
1314
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
1110
1315
|
var presetContextKeys = Object.keys(presetContext);
|
|
1111
1316
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -1115,6 +1320,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
1115
1320
|
/**
|
|
1116
1321
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
1117
1322
|
*/
|
|
1323
|
+
|
|
1324
|
+
|
|
1118
1325
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
1119
1326
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
1120
1327
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -1129,18 +1336,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
1129
1336
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
1130
1337
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
1131
1338
|
*/
|
|
1339
|
+
|
|
1340
|
+
|
|
1132
1341
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
1133
1342
|
return presets.find(function (preset) {
|
|
1134
1343
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
1135
1344
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
1136
1345
|
var presetContextKeys = Object.keys(presetContext);
|
|
1137
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
1138
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1346
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1139
1347
|
// if not, then the preset is invalid in config.ts
|
|
1348
|
+
|
|
1140
1349
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
1141
1350
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
1142
1351
|
});
|
|
1143
1352
|
}
|
|
1353
|
+
|
|
1144
1354
|
exports.getInitialPreset = getInitialPreset;
|
|
1145
1355
|
/**
|
|
1146
1356
|
* generates number precision values for a Select editor
|
|
@@ -1148,6 +1358,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
1148
1358
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
1149
1359
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
1150
1360
|
*/
|
|
1361
|
+
|
|
1151
1362
|
function generatePrecisionValues(numPrecisionValues) {
|
|
1152
1363
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
1153
1364
|
return {
|
|
@@ -1156,6 +1367,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
1156
1367
|
};
|
|
1157
1368
|
});
|
|
1158
1369
|
}
|
|
1370
|
+
|
|
1159
1371
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
1160
1372
|
/**
|
|
1161
1373
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -1165,12 +1377,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
1165
1377
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
1166
1378
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
1167
1379
|
*/
|
|
1380
|
+
|
|
1168
1381
|
var insertLayout = function insertLayout(layout, index) {
|
|
1169
1382
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1170
1383
|
layoutItems[_key - 2] = arguments[_key];
|
|
1171
1384
|
}
|
|
1385
|
+
|
|
1172
1386
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
1173
1387
|
};
|
|
1388
|
+
|
|
1174
1389
|
exports.insertLayout = insertLayout;
|
|
1175
1390
|
|
|
1176
1391
|
/***/ }),
|
|
@@ -1248,11 +1463,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1248
1463
|
value: true
|
|
1249
1464
|
});
|
|
1250
1465
|
exports.shouldShowIconPlaceholder = void 0;
|
|
1466
|
+
|
|
1251
1467
|
var React = __webpack_require__(1);
|
|
1468
|
+
|
|
1252
1469
|
var T = __webpack_require__(0);
|
|
1470
|
+
|
|
1253
1471
|
var lodash_1 = __webpack_require__(3);
|
|
1472
|
+
|
|
1254
1473
|
var i18n_1 = __webpack_require__(2);
|
|
1474
|
+
|
|
1255
1475
|
var Message_1 = __webpack_require__(10);
|
|
1476
|
+
|
|
1256
1477
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1257
1478
|
/**
|
|
1258
1479
|
* @method shouldShowIconPlaceholder
|
|
@@ -1260,6 +1481,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
1260
1481
|
* @param {boolean} loading
|
|
1261
1482
|
* @returns {boolean}
|
|
1262
1483
|
*/
|
|
1484
|
+
|
|
1485
|
+
|
|
1263
1486
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
1264
1487
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1265
1488
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -1268,6 +1491,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
1268
1491
|
var noFields = fields === undefined;
|
|
1269
1492
|
return loading || noData || noFields;
|
|
1270
1493
|
};
|
|
1494
|
+
|
|
1271
1495
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
1272
1496
|
var propTypes = {
|
|
1273
1497
|
icon: T.func,
|
|
@@ -1282,11 +1506,13 @@ var propTypes = {
|
|
|
1282
1506
|
* @param {IconPlaceholderProps} props
|
|
1283
1507
|
* @returns {React.ReactElement}
|
|
1284
1508
|
*/
|
|
1509
|
+
|
|
1285
1510
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
1286
1511
|
var width = props.width,
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1512
|
+
height = props.height,
|
|
1513
|
+
icon = props.icon,
|
|
1514
|
+
iconColor = props.iconColor;
|
|
1515
|
+
|
|
1290
1516
|
if (icon) {
|
|
1291
1517
|
return React.createElement(icon, {
|
|
1292
1518
|
style: {
|
|
@@ -1298,9 +1524,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1298
1524
|
transform: 'translate(-50%, -50%)'
|
|
1299
1525
|
},
|
|
1300
1526
|
width: '50%',
|
|
1301
|
-
height: '50%'
|
|
1527
|
+
height: '50%',
|
|
1528
|
+
'data-test': 'icon-placeholder'
|
|
1302
1529
|
});
|
|
1303
1530
|
}
|
|
1531
|
+
|
|
1304
1532
|
return React.createElement(Message_1.default, {
|
|
1305
1533
|
width: width,
|
|
1306
1534
|
height: height,
|
|
@@ -1308,6 +1536,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1308
1536
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
1309
1537
|
});
|
|
1310
1538
|
};
|
|
1539
|
+
|
|
1311
1540
|
IconPlaceholder.propTypes = propTypes;
|
|
1312
1541
|
IconPlaceholder.defaultProps = {
|
|
1313
1542
|
width: '100%',
|
|
@@ -1324,21 +1553,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
1324
1553
|
|
|
1325
1554
|
|
|
1326
1555
|
var _defineProperty = __webpack_require__(7);
|
|
1556
|
+
|
|
1327
1557
|
Object.defineProperty(exports, "__esModule", {
|
|
1328
1558
|
value: true
|
|
1329
1559
|
});
|
|
1330
1560
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1561
|
+
|
|
1331
1562
|
var T = __webpack_require__(0);
|
|
1563
|
+
|
|
1332
1564
|
var lodash_1 = __webpack_require__(3);
|
|
1333
|
-
|
|
1565
|
+
|
|
1566
|
+
var DataSource_1 = __webpack_require__(34);
|
|
1567
|
+
|
|
1334
1568
|
exports.SortParamsPropTypes = T.shape({
|
|
1335
1569
|
currentSortKey: T.string,
|
|
1336
1570
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
1337
1571
|
onSort: T.func
|
|
1338
1572
|
});
|
|
1573
|
+
|
|
1339
1574
|
var getSortingParams = function getSortingParams(_ref) {
|
|
1340
1575
|
var requestParams = _ref.requestParams,
|
|
1341
|
-
|
|
1576
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1342
1577
|
var currentSortKey;
|
|
1343
1578
|
var currentSortDir;
|
|
1344
1579
|
var nextSortDirMap = {
|
|
@@ -1347,15 +1582,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1347
1582
|
none: 'asc'
|
|
1348
1583
|
};
|
|
1349
1584
|
var onSort;
|
|
1585
|
+
|
|
1350
1586
|
if (typeof onRequestParamsChange === 'function') {
|
|
1351
1587
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
1352
1588
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
1353
1589
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1590
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
1591
|
+
|
|
1592
|
+
|
|
1356
1593
|
onSort = function onSort(e, _ref2) {
|
|
1357
1594
|
var sortKey = _ref2.sortKey,
|
|
1358
|
-
|
|
1595
|
+
sortDir = _ref2.sortDir;
|
|
1596
|
+
|
|
1359
1597
|
if (typeof sortKey === 'string') {
|
|
1360
1598
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
1361
1599
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -1367,12 +1605,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1367
1605
|
}
|
|
1368
1606
|
};
|
|
1369
1607
|
}
|
|
1608
|
+
|
|
1370
1609
|
return {
|
|
1371
1610
|
currentSortKey: currentSortKey,
|
|
1372
1611
|
currentSortDir: currentSortDir,
|
|
1373
1612
|
onSort: onSort
|
|
1374
1613
|
};
|
|
1375
1614
|
};
|
|
1615
|
+
|
|
1376
1616
|
exports.getSortingParams = getSortingParams;
|
|
1377
1617
|
|
|
1378
1618
|
/***/ }),
|
|
@@ -1383,43 +1623,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
1383
1623
|
"use strict";
|
|
1384
1624
|
|
|
1385
1625
|
|
|
1626
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1627
|
+
value: true
|
|
1628
|
+
});
|
|
1629
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1630
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1631
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1632
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
1633
|
+
|
|
1634
|
+
/***/ }),
|
|
1635
|
+
|
|
1636
|
+
/***/ 35:
|
|
1637
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1638
|
+
|
|
1639
|
+
"use strict";
|
|
1640
|
+
|
|
1641
|
+
|
|
1386
1642
|
Object.defineProperty(exports, "__esModule", {
|
|
1387
1643
|
value: true
|
|
1388
1644
|
});
|
|
1389
1645
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1646
|
+
|
|
1390
1647
|
var T = __webpack_require__(0);
|
|
1648
|
+
|
|
1391
1649
|
var lodash_1 = __webpack_require__(3);
|
|
1650
|
+
|
|
1392
1651
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
1393
1652
|
isPaging: T.bool,
|
|
1394
1653
|
current: T.number,
|
|
1395
1654
|
totalPages: T.number,
|
|
1396
1655
|
onChange: T.func
|
|
1397
1656
|
});
|
|
1657
|
+
|
|
1398
1658
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
1399
1659
|
var requestParams = _ref.requestParams,
|
|
1400
|
-
|
|
1401
|
-
|
|
1660
|
+
meta = _ref.meta,
|
|
1661
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1402
1662
|
var totalCount = meta && meta.totalCount || 0;
|
|
1403
1663
|
var offset = requestParams && requestParams.offset || 0;
|
|
1404
1664
|
var count = requestParams && requestParams.count;
|
|
1405
1665
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
1406
1666
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
1407
1667
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
1668
|
+
|
|
1408
1669
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
1409
1670
|
var page = _ref2.page,
|
|
1410
|
-
|
|
1671
|
+
countArg = _ref2.count;
|
|
1411
1672
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
1673
|
+
|
|
1412
1674
|
if (typeof countArg === 'number') {
|
|
1413
1675
|
newParams.count = countArg;
|
|
1414
1676
|
newParams.offset = 0;
|
|
1415
1677
|
}
|
|
1678
|
+
|
|
1416
1679
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
1680
|
+
|
|
1417
1681
|
if (typeof page === 'number' && page > 0) {
|
|
1418
1682
|
newParams.count = pageCount;
|
|
1419
1683
|
newParams.offset = (page - 1) * pageCount;
|
|
1420
1684
|
}
|
|
1685
|
+
|
|
1421
1686
|
onRequestParamsChange(newParams);
|
|
1422
1687
|
};
|
|
1688
|
+
|
|
1423
1689
|
return {
|
|
1424
1690
|
isPaging: isPaging,
|
|
1425
1691
|
current: current,
|
|
@@ -1427,11 +1693,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
1427
1693
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
1428
1694
|
};
|
|
1429
1695
|
};
|
|
1696
|
+
|
|
1430
1697
|
exports.getPaginationParams = getPaginationParams;
|
|
1431
1698
|
|
|
1432
1699
|
/***/ }),
|
|
1433
1700
|
|
|
1434
|
-
/***/
|
|
1701
|
+
/***/ 36:
|
|
1435
1702
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1436
1703
|
|
|
1437
1704
|
"use strict";
|
|
@@ -1442,6 +1709,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1442
1709
|
});
|
|
1443
1710
|
exports.VizCategory = void 0;
|
|
1444
1711
|
var VizCategory;
|
|
1712
|
+
|
|
1445
1713
|
(function (VizCategory) {
|
|
1446
1714
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1447
1715
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -1459,67 +1727,96 @@ var VizCategory;
|
|
|
1459
1727
|
|
|
1460
1728
|
/***/ }),
|
|
1461
1729
|
|
|
1462
|
-
/***/
|
|
1730
|
+
/***/ 37:
|
|
1463
1731
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1464
1732
|
|
|
1465
1733
|
"use strict";
|
|
1466
1734
|
|
|
1467
1735
|
|
|
1468
1736
|
var _slicedToArray = __webpack_require__(17);
|
|
1737
|
+
|
|
1469
1738
|
Object.defineProperty(exports, "__esModule", {
|
|
1470
1739
|
value: true
|
|
1471
1740
|
});
|
|
1741
|
+
|
|
1472
1742
|
var React = __webpack_require__(1);
|
|
1743
|
+
|
|
1473
1744
|
var lodash_1 = __webpack_require__(3);
|
|
1474
|
-
|
|
1745
|
+
|
|
1746
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1747
|
+
|
|
1475
1748
|
var Options_1 = __webpack_require__(30);
|
|
1476
|
-
|
|
1749
|
+
|
|
1750
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1751
|
+
|
|
1477
1752
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
1478
|
-
|
|
1753
|
+
|
|
1754
|
+
var moment_1 = __webpack_require__(40);
|
|
1755
|
+
|
|
1479
1756
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1757
|
+
|
|
1480
1758
|
var styled_components_1 = __webpack_require__(4);
|
|
1759
|
+
|
|
1481
1760
|
var hocUtils_1 = __webpack_require__(27);
|
|
1761
|
+
|
|
1482
1762
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
1483
|
-
|
|
1763
|
+
|
|
1764
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1765
|
+
|
|
1484
1766
|
var id_1 = __webpack_require__(25);
|
|
1485
|
-
|
|
1767
|
+
|
|
1768
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1769
|
+
|
|
1486
1770
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1771
|
+
|
|
1487
1772
|
var getSorting_1 = __webpack_require__(33);
|
|
1488
|
-
|
|
1773
|
+
|
|
1774
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1775
|
+
|
|
1489
1776
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1777
|
+
|
|
1490
1778
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1779
|
+
|
|
1491
1780
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1781
|
+
|
|
1492
1782
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
1493
1783
|
/**
|
|
1494
1784
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1495
1785
|
* @param {DashboardVizOpts} opts
|
|
1496
1786
|
* @returns {HOC}
|
|
1497
1787
|
*/
|
|
1788
|
+
|
|
1789
|
+
|
|
1498
1790
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
1499
1791
|
var ReactViz = opts.ReactViz,
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1792
|
+
vizConfig = opts.vizConfig,
|
|
1793
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1794
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1795
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1796
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1797
|
+
|
|
1505
1798
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
1506
1799
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1800
|
+
|
|
1507
1801
|
var DashboardViz = function DashboardViz(props) {
|
|
1508
1802
|
var _a;
|
|
1803
|
+
|
|
1509
1804
|
var mode = props.mode,
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1805
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1806
|
+
dataSources = props.dataSources,
|
|
1807
|
+
options = props.options,
|
|
1808
|
+
_props$context = props.context,
|
|
1809
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1810
|
+
width = props.width,
|
|
1811
|
+
height = props.height,
|
|
1812
|
+
onComputedProps = props.onComputedProps,
|
|
1813
|
+
onEventTrigger = props.onEventTrigger,
|
|
1814
|
+
theme = props.theme,
|
|
1815
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1816
|
+
|
|
1521
1817
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
1522
|
-
|
|
1818
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1819
|
+
|
|
1523
1820
|
if (serializedTimezone) {
|
|
1524
1821
|
/*
|
|
1525
1822
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -1533,38 +1830,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1533
1830
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1534
1831
|
}
|
|
1535
1832
|
}
|
|
1833
|
+
|
|
1536
1834
|
var themeFunc = function themeFunc(themeVar) {
|
|
1537
1835
|
var _a, _b;
|
|
1836
|
+
|
|
1538
1837
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
1539
1838
|
};
|
|
1839
|
+
|
|
1540
1840
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1841
|
+
|
|
1541
1842
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1843
|
+
theme: theme
|
|
1844
|
+
}),
|
|
1845
|
+
currentThemeFamily = _ref.family,
|
|
1846
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1847
|
+
currentThemeDensity = _ref.density;
|
|
1848
|
+
|
|
1547
1849
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1850
|
+
|
|
1548
1851
|
var _React$useState = React.useState({}),
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1852
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1853
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1854
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1855
|
+
|
|
1856
|
+
|
|
1552
1857
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1858
|
+
|
|
1553
1859
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
1554
|
-
|
|
1555
|
-
|
|
1860
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1861
|
+
visualizationID = _React$useState4[0];
|
|
1862
|
+
|
|
1556
1863
|
var _React$useState5 = React.useState({}),
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1864
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1865
|
+
dataSourcesInState = _React$useState6[0],
|
|
1866
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1867
|
+
|
|
1560
1868
|
var _React$useState7 = React.useState(),
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1869
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1870
|
+
dataFramesInState = _React$useState8[0],
|
|
1871
|
+
setDataFramesInState = _React$useState8[1];
|
|
1872
|
+
|
|
1564
1873
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1874
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1875
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1876
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1877
|
+
|
|
1568
1878
|
var isMounted = React.useRef(true);
|
|
1569
1879
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1570
1880
|
try {
|
|
@@ -1589,11 +1899,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1589
1899
|
});
|
|
1590
1900
|
} else {
|
|
1591
1901
|
var dataFrames = dataFramesInState;
|
|
1902
|
+
|
|
1592
1903
|
if (dataSources !== dataSourcesInState) {
|
|
1593
1904
|
setDataSourcesInState(dataSources);
|
|
1594
1905
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1595
1906
|
setDataFramesInState(dataFrames);
|
|
1596
1907
|
}
|
|
1908
|
+
|
|
1597
1909
|
return Options_1.Options.evaluate({
|
|
1598
1910
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1599
1911
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -1604,21 +1916,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1604
1916
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1605
1917
|
return {};
|
|
1606
1918
|
}
|
|
1919
|
+
|
|
1607
1920
|
return {};
|
|
1608
1921
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1609
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1610
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1922
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1611
1923
|
// if trellis is enabled following these three criteria - 1) trellis feature flag is enabled 2) vizConfig supports array has 'trellis' 3) option 'splitByLayout' is set to 'trellis
|
|
1612
1924
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1925
|
+
|
|
1613
1926
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1614
1927
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1928
|
+
|
|
1615
1929
|
if (isTrellisFeatureFlagOn && ((_a = vizConfig === null || vizConfig === void 0 ? void 0 : vizConfig.supports) === null || _a === void 0 ? void 0 : _a.includes(VizBehavior_1.VizBehavior.TRELLIS)) && (clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.splitByLayout) === VizBehavior_1.VizBehavior.TRELLIS) {
|
|
1616
1930
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1617
1931
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1618
1932
|
});
|
|
1619
|
-
}
|
|
1620
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1933
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1621
1934
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1935
|
+
|
|
1936
|
+
|
|
1622
1937
|
React.useEffect(function () {
|
|
1623
1938
|
onComputedProps(clonedEvaluatedOptions);
|
|
1624
1939
|
});
|
|
@@ -1628,53 +1943,68 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1628
1943
|
isMounted.current = false;
|
|
1629
1944
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1630
1945
|
}
|
|
1631
|
-
};
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
// present warning message if any required props are missing
|
|
1946
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1947
|
+
}, []); // present warning message if any required props are missing
|
|
1948
|
+
|
|
1635
1949
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1636
|
-
|
|
1637
|
-
|
|
1950
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1951
|
+
supports = vizConfig.supports;
|
|
1638
1952
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1953
|
+
|
|
1639
1954
|
if (missing.length > 0 && supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && vizConfig.key !== 'splunk.singlevalue' // For SV missing props msg is not displayed if required props majorValue is missing, instead this will be handled from the component, instead handled within component
|
|
1640
1955
|
) {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1956
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1957
|
+
"data-test": "missing-props-message",
|
|
1958
|
+
width: width,
|
|
1959
|
+
height: height,
|
|
1960
|
+
missingProps: missing,
|
|
1961
|
+
backgroundColor: bgColorFromTheme
|
|
1962
|
+
});
|
|
1963
|
+
} // events
|
|
1964
|
+
|
|
1965
|
+
|
|
1650
1966
|
var eventCallbackProps = {};
|
|
1967
|
+
|
|
1651
1968
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1652
1969
|
var supportedEvents = vizConfig.events;
|
|
1653
1970
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1654
|
-
var
|
|
1655
|
-
|
|
1656
|
-
|
|
1971
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
1972
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
1973
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
1974
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1657
1975
|
// then remove these lines
|
|
1658
|
-
|
|
1976
|
+
|
|
1659
1977
|
var payload = {};
|
|
1978
|
+
|
|
1660
1979
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1661
1980
|
payloadKeys.forEach(function (p) {
|
|
1662
1981
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1663
1982
|
});
|
|
1664
1983
|
}
|
|
1984
|
+
|
|
1665
1985
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1666
1986
|
if (ev && ev.payload) {
|
|
1667
1987
|
payload = ev.payload;
|
|
1668
1988
|
}
|
|
1989
|
+
|
|
1669
1990
|
return onEventTrigger({
|
|
1670
1991
|
originalEvent: ev,
|
|
1671
1992
|
payload: payload,
|
|
1672
1993
|
type: eventName
|
|
1673
1994
|
});
|
|
1674
1995
|
};
|
|
1996
|
+
|
|
1997
|
+
if (parentKeys) {
|
|
1998
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
1999
|
+
var newObject = {};
|
|
2000
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
2001
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
1675
2004
|
});
|
|
1676
|
-
}
|
|
1677
|
-
|
|
2005
|
+
} // compute pure viz props which are not from options
|
|
2006
|
+
|
|
2007
|
+
|
|
1678
2008
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1679
2009
|
themeFunc: themeFunc
|
|
1680
2010
|
}));
|
|
@@ -1692,15 +2022,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1692
2022
|
* In future, we could automatically detect which all datasources are being used
|
|
1693
2023
|
* and bind those magically to pagination/sorting behavior.
|
|
1694
2024
|
*/
|
|
2025
|
+
|
|
1695
2026
|
var dataSourceMetadata = {};
|
|
1696
2027
|
var OptionKey = 'paginateDataSourceKey';
|
|
1697
2028
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
2029
|
+
|
|
1698
2030
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1699
2031
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1700
2032
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
2033
|
+
|
|
1701
2034
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1702
2035
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1703
2036
|
};
|
|
2037
|
+
|
|
1704
2038
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1705
2039
|
requestParams: requestParams,
|
|
1706
2040
|
meta: meta,
|
|
@@ -1715,115 +2049,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1715
2049
|
sortParams: sortParams,
|
|
1716
2050
|
paginatorParams: paginatorParams
|
|
1717
2051
|
};
|
|
1718
|
-
}
|
|
1719
|
-
|
|
2052
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
2053
|
+
|
|
2054
|
+
|
|
1720
2055
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1721
2056
|
return null;
|
|
1722
2057
|
}
|
|
2058
|
+
|
|
1723
2059
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1724
2060
|
mode: mode,
|
|
1725
2061
|
width: width,
|
|
1726
2062
|
height: height
|
|
1727
2063
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1728
2064
|
};
|
|
2065
|
+
|
|
1729
2066
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1730
2067
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1731
2068
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1732
2069
|
theme: {}
|
|
1733
|
-
});
|
|
1734
|
-
|
|
1735
|
-
DashboardViz.config = vizConfig;
|
|
1736
|
-
|
|
2070
|
+
}); // attach viz config
|
|
2071
|
+
|
|
2072
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
2073
|
+
|
|
1737
2074
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1738
2075
|
};
|
|
2076
|
+
|
|
1739
2077
|
exports.default = withDashboardViz;
|
|
1740
2078
|
|
|
1741
2079
|
/***/ }),
|
|
1742
2080
|
|
|
1743
|
-
/***/
|
|
2081
|
+
/***/ 38:
|
|
1744
2082
|
/***/ (function(module, exports) {
|
|
1745
2083
|
|
|
1746
2084
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1747
2085
|
|
|
1748
2086
|
/***/ }),
|
|
1749
2087
|
|
|
1750
|
-
/***/
|
|
2088
|
+
/***/ 39:
|
|
1751
2089
|
/***/ (function(module, exports) {
|
|
1752
2090
|
|
|
1753
2091
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1754
2092
|
|
|
1755
2093
|
/***/ }),
|
|
1756
2094
|
|
|
1757
|
-
/***/
|
|
2095
|
+
/***/ 4:
|
|
1758
2096
|
/***/ (function(module, exports) {
|
|
1759
2097
|
|
|
1760
|
-
module.exports = require("
|
|
2098
|
+
module.exports = require("styled-components");
|
|
1761
2099
|
|
|
1762
2100
|
/***/ }),
|
|
1763
2101
|
|
|
1764
|
-
/***/
|
|
2102
|
+
/***/ 40:
|
|
1765
2103
|
/***/ (function(module, exports) {
|
|
1766
2104
|
|
|
1767
|
-
module.exports = require("
|
|
2105
|
+
module.exports = require("@splunk/moment");
|
|
1768
2106
|
|
|
1769
2107
|
/***/ }),
|
|
1770
2108
|
|
|
1771
|
-
/***/
|
|
2109
|
+
/***/ 41:
|
|
1772
2110
|
/***/ (function(module, exports) {
|
|
1773
2111
|
|
|
1774
2112
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1775
2113
|
|
|
1776
2114
|
/***/ }),
|
|
1777
2115
|
|
|
1778
|
-
/***/
|
|
2116
|
+
/***/ 42:
|
|
1779
2117
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1780
2118
|
|
|
1781
2119
|
"use strict";
|
|
1782
2120
|
|
|
1783
2121
|
|
|
1784
2122
|
var _classCallCheck = __webpack_require__(9);
|
|
2123
|
+
|
|
1785
2124
|
Object.defineProperty(exports, "__esModule", {
|
|
1786
2125
|
value: true
|
|
1787
2126
|
});
|
|
1788
2127
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1789
2128
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
2129
|
+
|
|
1790
2130
|
var T = __webpack_require__(0);
|
|
2131
|
+
|
|
1791
2132
|
var lodash_1 = __webpack_require__(3);
|
|
1792
|
-
|
|
1793
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2133
|
+
|
|
2134
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2135
|
+
|
|
2136
|
+
|
|
1794
2137
|
exports.INITIAL_WIDTH = 250;
|
|
1795
2138
|
exports.INITIAL_HEIGHT = 250;
|
|
1796
2139
|
/**
|
|
1797
2140
|
* A Splunk visualization
|
|
1798
2141
|
*/
|
|
2142
|
+
|
|
1799
2143
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1800
2144
|
_classCallCheck(this, SplunkVisualization);
|
|
1801
2145
|
};
|
|
2146
|
+
|
|
1802
2147
|
SplunkVisualization.propTypes = {
|
|
1803
2148
|
/**
|
|
1804
2149
|
* display mode
|
|
1805
2150
|
*/
|
|
1806
2151
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
2152
|
+
|
|
1807
2153
|
/**
|
|
1808
2154
|
* width in pixel or string, defaults to 100%
|
|
1809
2155
|
*/
|
|
1810
2156
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2157
|
+
|
|
1811
2158
|
/**
|
|
1812
2159
|
* height in pixel or string
|
|
1813
2160
|
*/
|
|
1814
2161
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2162
|
+
|
|
1815
2163
|
/**
|
|
1816
2164
|
* visualization context used for dynamic option evaluation
|
|
1817
2165
|
*/
|
|
1818
2166
|
context: T.object,
|
|
2167
|
+
|
|
1819
2168
|
/**
|
|
1820
2169
|
* visualization formatting options
|
|
1821
2170
|
*/
|
|
1822
2171
|
options: T.object,
|
|
2172
|
+
|
|
1823
2173
|
/**
|
|
1824
2174
|
* A callback to update formatting options
|
|
1825
2175
|
*/
|
|
1826
2176
|
onOptionsChange: T.func,
|
|
2177
|
+
|
|
1827
2178
|
/**
|
|
1828
2179
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1829
2180
|
*/
|
|
@@ -1832,6 +2183,7 @@ SplunkVisualization.propTypes = {
|
|
|
1832
2183
|
* current request params
|
|
1833
2184
|
*/
|
|
1834
2185
|
requestParams: T.object,
|
|
2186
|
+
|
|
1835
2187
|
/**
|
|
1836
2188
|
* current dataset
|
|
1837
2189
|
*/
|
|
@@ -1839,6 +2191,7 @@ SplunkVisualization.propTypes = {
|
|
|
1839
2191
|
fields: T.array,
|
|
1840
2192
|
columns: T.array
|
|
1841
2193
|
}),
|
|
2194
|
+
|
|
1842
2195
|
/**
|
|
1843
2196
|
* error
|
|
1844
2197
|
*/
|
|
@@ -1846,29 +2199,35 @@ SplunkVisualization.propTypes = {
|
|
|
1846
2199
|
level: T.string,
|
|
1847
2200
|
message: T.string
|
|
1848
2201
|
}),
|
|
2202
|
+
|
|
1849
2203
|
/**
|
|
1850
2204
|
* meta data that came with the dataset
|
|
1851
2205
|
*/
|
|
1852
2206
|
meta: T.object
|
|
1853
2207
|
})),
|
|
2208
|
+
|
|
1854
2209
|
/**
|
|
1855
2210
|
* A callback to trigger event
|
|
1856
2211
|
*/
|
|
1857
2212
|
onEventTrigger: T.func,
|
|
2213
|
+
|
|
1858
2214
|
/**
|
|
1859
2215
|
* Inform viz if there are handlers listening to events
|
|
1860
2216
|
*/
|
|
1861
2217
|
hasEventHandlers: T.bool,
|
|
2218
|
+
|
|
1862
2219
|
/**
|
|
1863
2220
|
* A callback to communicate computed props to a consumer
|
|
1864
2221
|
*/
|
|
1865
2222
|
onComputedProps: T.func,
|
|
2223
|
+
|
|
1866
2224
|
/**
|
|
1867
2225
|
* A callback to obtain visualization api
|
|
1868
2226
|
*/
|
|
1869
2227
|
vizActionHandlerRef: T.func,
|
|
1870
2228
|
loading: T.bool,
|
|
1871
2229
|
theme: T.object,
|
|
2230
|
+
|
|
1872
2231
|
/**
|
|
1873
2232
|
* A callback to request new data with updated request params
|
|
1874
2233
|
*/
|
|
@@ -1877,6 +2236,7 @@ SplunkVisualization.propTypes = {
|
|
|
1877
2236
|
/**
|
|
1878
2237
|
*
|
|
1879
2238
|
*/
|
|
2239
|
+
|
|
1880
2240
|
SplunkVisualization.defaultProps = {
|
|
1881
2241
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1882
2242
|
width: '100%',
|
|
@@ -1905,26 +2265,29 @@ exports.default = SplunkVisualization;
|
|
|
1905
2265
|
|
|
1906
2266
|
/***/ }),
|
|
1907
2267
|
|
|
1908
|
-
/***/
|
|
2268
|
+
/***/ 43:
|
|
1909
2269
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1910
2270
|
|
|
1911
2271
|
"use strict";
|
|
1912
2272
|
|
|
1913
2273
|
|
|
1914
2274
|
var _classCallCheck = __webpack_require__(9);
|
|
2275
|
+
|
|
1915
2276
|
var _createClass = __webpack_require__(18);
|
|
2277
|
+
|
|
1916
2278
|
Object.defineProperty(exports, "__esModule", {
|
|
1917
2279
|
value: true
|
|
1918
2280
|
});
|
|
1919
2281
|
exports.DefaultVizActionHandler = void 0;
|
|
2282
|
+
|
|
1920
2283
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1921
2284
|
function DefaultVizActionHandler() {
|
|
1922
2285
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1923
2286
|
}
|
|
2287
|
+
|
|
1924
2288
|
_createClass(DefaultVizActionHandler, [{
|
|
1925
2289
|
key: "focus",
|
|
1926
|
-
value: function focus() {
|
|
1927
|
-
// noop
|
|
2290
|
+
value: function focus() {// noop
|
|
1928
2291
|
}
|
|
1929
2292
|
}, {
|
|
1930
2293
|
key: "snapshot",
|
|
@@ -1932,23 +2295,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1932
2295
|
return null; // noop
|
|
1933
2296
|
}
|
|
1934
2297
|
}]);
|
|
2298
|
+
|
|
1935
2299
|
return DefaultVizActionHandler;
|
|
1936
2300
|
}();
|
|
1937
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1938
|
-
|
|
1939
|
-
/***/ }),
|
|
1940
|
-
|
|
1941
|
-
/***/ 43:
|
|
1942
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1943
|
-
|
|
1944
|
-
"use strict";
|
|
1945
2301
|
|
|
1946
|
-
|
|
1947
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1948
|
-
value: true
|
|
1949
|
-
});
|
|
1950
|
-
exports.validSortDirs = void 0;
|
|
1951
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
2302
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1952
2303
|
|
|
1953
2304
|
/***/ }),
|
|
1954
2305
|
|
|
@@ -1962,7 +2313,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1962
2313
|
value: true
|
|
1963
2314
|
});
|
|
1964
2315
|
exports.useDeepMemo = void 0;
|
|
2316
|
+
|
|
1965
2317
|
var react_1 = __webpack_require__(1);
|
|
2318
|
+
|
|
1966
2319
|
var lodash_1 = __webpack_require__(3);
|
|
1967
2320
|
/**
|
|
1968
2321
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1977,16 +2330,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1977
2330
|
* @param fn the function to be executed and
|
|
1978
2331
|
* @param dependencies an array of dependencies
|
|
1979
2332
|
*/
|
|
2333
|
+
|
|
2334
|
+
|
|
1980
2335
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1981
2336
|
var ref = (0, react_1.useRef)();
|
|
2337
|
+
|
|
1982
2338
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1983
2339
|
ref.current = {
|
|
1984
2340
|
dependencies: dependencies,
|
|
1985
2341
|
value: fn()
|
|
1986
2342
|
};
|
|
1987
2343
|
}
|
|
2344
|
+
|
|
1988
2345
|
return ref.current.value;
|
|
1989
2346
|
};
|
|
2347
|
+
|
|
1990
2348
|
exports.useDeepMemo = useDeepMemo;
|
|
1991
2349
|
|
|
1992
2350
|
/***/ }),
|
|
@@ -2001,19 +2359,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2001
2359
|
value: true
|
|
2002
2360
|
});
|
|
2003
2361
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2362
|
+
|
|
2004
2363
|
var React = __webpack_require__(1);
|
|
2364
|
+
|
|
2005
2365
|
var T = __webpack_require__(0);
|
|
2366
|
+
|
|
2006
2367
|
var i18n_1 = __webpack_require__(2);
|
|
2368
|
+
|
|
2007
2369
|
var Message_1 = __webpack_require__(10);
|
|
2370
|
+
|
|
2008
2371
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2009
2372
|
/**
|
|
2010
2373
|
* @method isMissing
|
|
2011
2374
|
* @param {any} v
|
|
2012
2375
|
* @returns {boolean} true if the input value === null or undefined
|
|
2013
2376
|
*/
|
|
2377
|
+
|
|
2378
|
+
|
|
2014
2379
|
var isMissing = function isMissing(v) {
|
|
2015
2380
|
return v === null || v === undefined;
|
|
2016
2381
|
};
|
|
2382
|
+
|
|
2017
2383
|
exports.isMissing = isMissing;
|
|
2018
2384
|
/**
|
|
2019
2385
|
* @method misskingKeys
|
|
@@ -2021,11 +2387,13 @@ exports.isMissing = isMissing;
|
|
|
2021
2387
|
* @param {object} target
|
|
2022
2388
|
* @returns {string[]} the keys of missing required props
|
|
2023
2389
|
*/
|
|
2390
|
+
|
|
2024
2391
|
var missingKeys = function missingKeys(keys, target) {
|
|
2025
2392
|
return keys.filter(function (k) {
|
|
2026
2393
|
return (0, exports.isMissing)(target[k]);
|
|
2027
2394
|
});
|
|
2028
2395
|
};
|
|
2396
|
+
|
|
2029
2397
|
exports.missingKeys = missingKeys;
|
|
2030
2398
|
var propTypes = {
|
|
2031
2399
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -2039,10 +2407,11 @@ var propTypes = {
|
|
|
2039
2407
|
* @param {MissingPropsProps} props
|
|
2040
2408
|
* @returns {React.ReactElement}
|
|
2041
2409
|
*/
|
|
2410
|
+
|
|
2042
2411
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
2043
2412
|
var width = props.width,
|
|
2044
|
-
|
|
2045
|
-
|
|
2413
|
+
height = props.height,
|
|
2414
|
+
missingProps = props.missingProps;
|
|
2046
2415
|
return React.createElement(Message_1.default, {
|
|
2047
2416
|
"data-test": "message",
|
|
2048
2417
|
width: width,
|
|
@@ -2050,6 +2419,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
2050
2419
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
2051
2420
|
});
|
|
2052
2421
|
};
|
|
2422
|
+
|
|
2053
2423
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
2054
2424
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
2055
2425
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -2069,6 +2439,7 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
2069
2439
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
2070
2440
|
if (k2 === undefined) k2 = k;
|
|
2071
2441
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2442
|
+
|
|
2072
2443
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2073
2444
|
desc = {
|
|
2074
2445
|
enumerable: true,
|
|
@@ -2077,22 +2448,28 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
2077
2448
|
}
|
|
2078
2449
|
};
|
|
2079
2450
|
}
|
|
2451
|
+
|
|
2080
2452
|
Object.defineProperty(o, k2, desc);
|
|
2081
2453
|
} : function (o, m, k, k2) {
|
|
2082
2454
|
if (k2 === undefined) k2 = k;
|
|
2083
2455
|
o[k2] = m[k];
|
|
2084
2456
|
});
|
|
2457
|
+
|
|
2085
2458
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
2086
2459
|
for (var p in m) {
|
|
2087
2460
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2088
2461
|
}
|
|
2089
2462
|
};
|
|
2463
|
+
|
|
2090
2464
|
Object.defineProperty(exports, "__esModule", {
|
|
2091
2465
|
value: true
|
|
2092
2466
|
});
|
|
2093
2467
|
exports.default = void 0;
|
|
2094
|
-
|
|
2095
|
-
|
|
2468
|
+
|
|
2469
|
+
__exportStar(__webpack_require__(167), exports);
|
|
2470
|
+
|
|
2471
|
+
var Sankey_1 = __webpack_require__(167);
|
|
2472
|
+
|
|
2096
2473
|
Object.defineProperty(exports, "default", {
|
|
2097
2474
|
enumerable: true,
|
|
2098
2475
|
get: function get() {
|
|
@@ -2115,43 +2492,50 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2115
2492
|
/* harmony import */ var d3_collection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(141);
|
|
2116
2493
|
/* harmony import */ var d3_collection__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(d3_collection__WEBPACK_IMPORTED_MODULE_2__);
|
|
2117
2494
|
// reference link :- https://github.com/csaladenes/sankey
|
|
2495
|
+
|
|
2118
2496
|
/* eslint-disable */
|
|
2119
2497
|
|
|
2120
2498
|
|
|
2121
2499
|
|
|
2122
2500
|
var d3_sankey = function d3_sankey() {
|
|
2123
2501
|
var sankey = {},
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2502
|
+
nodeWidth = 24,
|
|
2503
|
+
nodePadding = 8,
|
|
2504
|
+
size = [1, 1],
|
|
2505
|
+
nodes = [],
|
|
2506
|
+
links = [],
|
|
2507
|
+
components = [];
|
|
2508
|
+
|
|
2130
2509
|
sankey.nodeWidth = function (_) {
|
|
2131
2510
|
if (!arguments.length) return nodeWidth;
|
|
2132
2511
|
nodeWidth = +_;
|
|
2133
2512
|
return sankey;
|
|
2134
2513
|
};
|
|
2514
|
+
|
|
2135
2515
|
sankey.nodePadding = function (_) {
|
|
2136
2516
|
if (!arguments.length) return nodePadding;
|
|
2137
2517
|
nodePadding = +_;
|
|
2138
2518
|
return sankey;
|
|
2139
2519
|
};
|
|
2520
|
+
|
|
2140
2521
|
sankey.nodes = function (_) {
|
|
2141
2522
|
if (!arguments.length) return nodes;
|
|
2142
2523
|
nodes = _;
|
|
2143
2524
|
return sankey;
|
|
2144
2525
|
};
|
|
2526
|
+
|
|
2145
2527
|
sankey.links = function (_) {
|
|
2146
2528
|
if (!arguments.length) return links;
|
|
2147
2529
|
links = _;
|
|
2148
2530
|
return sankey;
|
|
2149
2531
|
};
|
|
2532
|
+
|
|
2150
2533
|
sankey.size = function (_) {
|
|
2151
2534
|
if (!arguments.length) return size;
|
|
2152
2535
|
size = _;
|
|
2153
2536
|
return sankey;
|
|
2154
2537
|
};
|
|
2538
|
+
|
|
2155
2539
|
sankey.layout = function (iterations) {
|
|
2156
2540
|
computeNodeLinks();
|
|
2157
2541
|
computeNodeValues();
|
|
@@ -2161,12 +2545,11 @@ var d3_sankey = function d3_sankey() {
|
|
|
2161
2545
|
computeLinkDepths();
|
|
2162
2546
|
return sankey;
|
|
2163
2547
|
};
|
|
2548
|
+
|
|
2164
2549
|
sankey.relayout = function () {
|
|
2165
2550
|
computeLinkDepths();
|
|
2166
2551
|
return sankey;
|
|
2167
|
-
};
|
|
2168
|
-
|
|
2169
|
-
// A more involved path generator that requires 3 elements to render --
|
|
2552
|
+
}; // A more involved path generator that requires 3 elements to render --
|
|
2170
2553
|
// It draws a starting element, intermediate and end element that are useful
|
|
2171
2554
|
// while drawing reverse links to get an appropriate fill.
|
|
2172
2555
|
//
|
|
@@ -2189,32 +2572,34 @@ var d3_sankey = function d3_sankey() {
|
|
|
2189
2572
|
// .attr("d", path(i))
|
|
2190
2573
|
// .attr("fill", ...)
|
|
2191
2574
|
// }
|
|
2192
|
-
sankey.reversibleLink = function () {
|
|
2193
|
-
var curvature = 0.5;
|
|
2194
2575
|
|
|
2195
|
-
|
|
2576
|
+
|
|
2577
|
+
sankey.reversibleLink = function () {
|
|
2578
|
+
var curvature = 0.5; // Used when source is behind target, the first and last paths are simple
|
|
2196
2579
|
// lines at the start and end node while the second path is the spline
|
|
2580
|
+
|
|
2197
2581
|
function forwardLink(part, d) {
|
|
2198
2582
|
var x0 = d.source.x + d.source.dx,
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2583
|
+
x1 = d.target.x,
|
|
2584
|
+
xi = Object(d3_interpolate__WEBPACK_IMPORTED_MODULE_0__["interpolateNumber"])(x0, x1),
|
|
2585
|
+
x2 = xi(curvature),
|
|
2586
|
+
x3 = xi(1 - curvature),
|
|
2587
|
+
y0 = d.source.y + d.sy,
|
|
2588
|
+
y1 = d.target.y + d.ty,
|
|
2589
|
+
y2 = d.source.y + d.sy + d.dy,
|
|
2590
|
+
y3 = d.target.y + d.ty + d.dy;
|
|
2591
|
+
|
|
2207
2592
|
switch (part) {
|
|
2208
2593
|
case 0:
|
|
2209
2594
|
return 'M' + x0 + ',' + y0 + 'L' + x0 + ',' + (y0 + d.dy);
|
|
2595
|
+
|
|
2210
2596
|
case 1:
|
|
2211
2597
|
return 'M' + x0 + ',' + y0 + 'C' + x2 + ',' + y0 + ' ' + x3 + ',' + y1 + ' ' + x1 + ',' + y1 + 'L' + x1 + ',' + y3 + 'C' + x3 + ',' + y3 + ' ' + x2 + ',' + y2 + ' ' + x0 + ',' + y2 + 'Z';
|
|
2598
|
+
|
|
2212
2599
|
case 2:
|
|
2213
2600
|
return 'M' + x1 + ',' + y1 + 'L' + x1 + ',' + (y1 + d.dy);
|
|
2214
2601
|
}
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
// Used for self loops and when the source is actually in front of the
|
|
2602
|
+
} // Used for self loops and when the source is actually in front of the
|
|
2218
2603
|
// target; the first element is a turning path from the source to the
|
|
2219
2604
|
// destination, the second element connects the two twists and the last
|
|
2220
2605
|
// twists into the target element.
|
|
@@ -2224,29 +2609,38 @@ var d3_sankey = function d3_sankey() {
|
|
|
2224
2609
|
// \----------------------\
|
|
2225
2610
|
// Source--/
|
|
2226
2611
|
//
|
|
2612
|
+
|
|
2613
|
+
|
|
2227
2614
|
function backwardLink(part, d) {
|
|
2228
2615
|
var curveExtension = 30;
|
|
2229
2616
|
var curveDepth = 15;
|
|
2617
|
+
|
|
2230
2618
|
function getDir(d) {
|
|
2231
2619
|
return d.source.y + d.sy > d.target.y + d.ty ? -1 : 1;
|
|
2232
2620
|
}
|
|
2621
|
+
|
|
2233
2622
|
function p(x, y) {
|
|
2234
2623
|
return x + ',' + y + ' ';
|
|
2235
2624
|
}
|
|
2625
|
+
|
|
2236
2626
|
var dt = getDir(d) * curveDepth,
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2627
|
+
x0 = d.source.x + d.source.dx,
|
|
2628
|
+
y0 = d.source.y + d.sy,
|
|
2629
|
+
x1 = d.target.x,
|
|
2630
|
+
y1 = d.target.y + d.ty;
|
|
2631
|
+
|
|
2241
2632
|
switch (part) {
|
|
2242
2633
|
case 0:
|
|
2243
2634
|
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';
|
|
2635
|
+
|
|
2244
2636
|
case 1:
|
|
2245
2637
|
return 'M' + p(x0 + curveExtension, y0 + dt) + 'C' + p(x0 + curveExtension, y0 + 3 * dt) + p(x1 - curveExtension, y1 - 3 * dt) + p(x1 - curveExtension, y1 - dt) + 'L' + p(x1 - curveExtension, y1 - dt + d.dy) + 'C' + p(x1 - curveExtension, y1 - 3 * dt + d.dy) + p(x0 + curveExtension, y0 + 3 * dt + d.dy) + p(x0 + curveExtension, y0 + dt + d.dy) + 'Z';
|
|
2638
|
+
|
|
2246
2639
|
case 2:
|
|
2247
2640
|
return 'M' + p(x1 - curveExtension, y1 - dt) + 'C' + p(x1 - curveExtension, y1) + p(x1, y1) + p(x1, y1) + 'L' + p(x1, y1 + d.dy) + 'C' + p(x1, y1 + d.dy) + p(x1 - curveExtension, y1 + d.dy) + p(x1 - curveExtension, y1 + d.dy - dt) + 'Z';
|
|
2248
2641
|
}
|
|
2249
2642
|
}
|
|
2643
|
+
|
|
2250
2644
|
return function (part) {
|
|
2251
2645
|
return function (d) {
|
|
2252
2646
|
if (d.source.x < d.target.x) {
|
|
@@ -2256,32 +2650,35 @@ var d3_sankey = function d3_sankey() {
|
|
|
2256
2650
|
}
|
|
2257
2651
|
};
|
|
2258
2652
|
};
|
|
2259
|
-
};
|
|
2260
|
-
|
|
2261
|
-
// The standard link path using a constant width spline that needs a
|
|
2653
|
+
}; // The standard link path using a constant width spline that needs a
|
|
2262
2654
|
// single path element.
|
|
2655
|
+
|
|
2656
|
+
|
|
2263
2657
|
sankey.link = function () {
|
|
2264
2658
|
var curvature = 0.5;
|
|
2659
|
+
|
|
2265
2660
|
function link(d) {
|
|
2266
2661
|
var x0 = d.source.x + d.source.dx,
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2662
|
+
x1 = d.target.x,
|
|
2663
|
+
xi = Object(d3_interpolate__WEBPACK_IMPORTED_MODULE_0__["interpolateNumber"])(x0, x1),
|
|
2664
|
+
x2 = xi(curvature),
|
|
2665
|
+
x3 = xi(1 - curvature),
|
|
2666
|
+
y0 = d.source.y + d.sy + d.dy / 2,
|
|
2667
|
+
y1 = d.target.y + d.ty + d.dy / 2;
|
|
2273
2668
|
return 'M' + x0 + ',' + y0 + 'C' + x2 + ',' + y0 + ' ' + x3 + ',' + y1 + ' ' + x1 + ',' + y1;
|
|
2274
2669
|
}
|
|
2670
|
+
|
|
2275
2671
|
link.curvature = function (_) {
|
|
2276
2672
|
if (!arguments.length) return curvature;
|
|
2277
2673
|
curvature = +_;
|
|
2278
2674
|
return link;
|
|
2279
2675
|
};
|
|
2280
|
-
return link;
|
|
2281
|
-
};
|
|
2282
2676
|
|
|
2283
|
-
|
|
2677
|
+
return link;
|
|
2678
|
+
}; // Populate the sourceLinks and targetLinks for each node.
|
|
2284
2679
|
// Also, if the source and target are not objects, assume they are indices.
|
|
2680
|
+
|
|
2681
|
+
|
|
2285
2682
|
function computeNodeLinks() {
|
|
2286
2683
|
nodes.forEach(function (node) {
|
|
2287
2684
|
node.sourceLinks = [];
|
|
@@ -2289,44 +2686,46 @@ var d3_sankey = function d3_sankey() {
|
|
|
2289
2686
|
});
|
|
2290
2687
|
links.forEach(function (link) {
|
|
2291
2688
|
var source = link.source,
|
|
2292
|
-
|
|
2689
|
+
target = link.target;
|
|
2293
2690
|
if (typeof source === 'number') source = link.source = nodes[link.source];
|
|
2294
2691
|
if (typeof target === 'number') target = link.target = nodes[link.target];
|
|
2295
2692
|
source.sourceLinks.push(link);
|
|
2296
2693
|
target.targetLinks.push(link);
|
|
2297
2694
|
});
|
|
2298
|
-
}
|
|
2695
|
+
} // Compute the value (size) of each node by summing the associated links.
|
|
2696
|
+
|
|
2299
2697
|
|
|
2300
|
-
// Compute the value (size) of each node by summing the associated links.
|
|
2301
2698
|
function computeNodeValues() {
|
|
2302
2699
|
nodes.forEach(function (node) {
|
|
2303
|
-
if (!node.value)
|
|
2304
|
-
//if not already given
|
|
2700
|
+
if (!node.value) //if not already given
|
|
2305
2701
|
node.value = Math.max(Object(d3_array__WEBPACK_IMPORTED_MODULE_1__["sum"])(node.sourceLinks, value), Object(d3_array__WEBPACK_IMPORTED_MODULE_1__["sum"])(node.targetLinks, value));
|
|
2306
2702
|
});
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
// Take the list of nodes and create a DAG of supervertices, each consisting
|
|
2703
|
+
} // Take the list of nodes and create a DAG of supervertices, each consisting
|
|
2310
2704
|
// of a strongly connected component of the graph
|
|
2311
2705
|
//
|
|
2312
2706
|
// Based off:
|
|
2313
2707
|
// http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm
|
|
2708
|
+
|
|
2709
|
+
|
|
2314
2710
|
function computeNodeStructure() {
|
|
2315
2711
|
var nodeStack = [],
|
|
2316
|
-
|
|
2712
|
+
index = 0;
|
|
2317
2713
|
nodes.forEach(function (node) {
|
|
2318
2714
|
if (!node.index) {
|
|
2319
2715
|
connect(node);
|
|
2320
2716
|
}
|
|
2321
2717
|
});
|
|
2718
|
+
|
|
2322
2719
|
function connect(node) {
|
|
2323
2720
|
node.index = index++;
|
|
2324
2721
|
node.lowIndex = node.index;
|
|
2325
2722
|
node.onStack = true;
|
|
2326
2723
|
nodeStack.push(node);
|
|
2724
|
+
|
|
2327
2725
|
if (node.sourceLinks) {
|
|
2328
2726
|
node.sourceLinks.forEach(function (sourceLink) {
|
|
2329
2727
|
var target = sourceLink.target;
|
|
2728
|
+
|
|
2330
2729
|
if (!target.hasOwnProperty('index')) {
|
|
2331
2730
|
connect(target);
|
|
2332
2731
|
node.lowIndex = Math.min(node.lowIndex, target.lowIndex);
|
|
@@ -2334,14 +2733,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2334
2733
|
node.lowIndex = Math.min(node.lowIndex, target.index);
|
|
2335
2734
|
}
|
|
2336
2735
|
});
|
|
2736
|
+
|
|
2337
2737
|
if (node.lowIndex === node.index) {
|
|
2338
2738
|
var component = [],
|
|
2339
|
-
|
|
2739
|
+
currentNode;
|
|
2740
|
+
|
|
2340
2741
|
do {
|
|
2341
2742
|
currentNode = nodeStack.pop();
|
|
2342
2743
|
currentNode.onStack = false;
|
|
2343
2744
|
component.push(currentNode);
|
|
2344
2745
|
} while (currentNode != node);
|
|
2746
|
+
|
|
2345
2747
|
components.push({
|
|
2346
2748
|
root: node,
|
|
2347
2749
|
scc: component
|
|
@@ -2349,16 +2751,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2349
2751
|
}
|
|
2350
2752
|
}
|
|
2351
2753
|
}
|
|
2754
|
+
|
|
2352
2755
|
components.forEach(function (component, i) {
|
|
2353
2756
|
component.index = i;
|
|
2354
2757
|
component.scc.forEach(function (node) {
|
|
2355
2758
|
node.component = i;
|
|
2356
2759
|
});
|
|
2357
2760
|
});
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
// Assign the breadth (x-position) for each strongly connected component,
|
|
2761
|
+
} // Assign the breadth (x-position) for each strongly connected component,
|
|
2361
2762
|
// followed by assigning breadth within the component.
|
|
2763
|
+
|
|
2764
|
+
|
|
2362
2765
|
function computeNodeBreadths() {
|
|
2363
2766
|
layerComponents();
|
|
2364
2767
|
components.forEach(function (component, i) {
|
|
@@ -2378,7 +2781,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2378
2781
|
return d.values;
|
|
2379
2782
|
});
|
|
2380
2783
|
var max = -1,
|
|
2381
|
-
|
|
2784
|
+
nextMax = -1;
|
|
2382
2785
|
componentsByBreadth.forEach(function (c) {
|
|
2383
2786
|
c.forEach(function (component) {
|
|
2384
2787
|
component.x = max + 1;
|
|
@@ -2398,14 +2801,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2398
2801
|
node.x = node.layer ? node.x : max;
|
|
2399
2802
|
});
|
|
2400
2803
|
scaleNodeBreadths((size[0] - nodeWidth) / Math.max(max, 1));
|
|
2804
|
+
|
|
2401
2805
|
function flatten(a) {
|
|
2402
2806
|
return [].concat.apply([], a);
|
|
2403
2807
|
}
|
|
2808
|
+
|
|
2404
2809
|
function layerComponents() {
|
|
2405
2810
|
var remainingComponents = components,
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2811
|
+
nextComponents,
|
|
2812
|
+
visitedIndex,
|
|
2813
|
+
x = 0;
|
|
2814
|
+
|
|
2409
2815
|
while (remainingComponents.length) {
|
|
2410
2816
|
nextComponents = [];
|
|
2411
2817
|
visitedIndex = {};
|
|
@@ -2424,14 +2830,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2424
2830
|
++x;
|
|
2425
2831
|
}
|
|
2426
2832
|
}
|
|
2833
|
+
|
|
2427
2834
|
function bfs(node, extractTargets) {
|
|
2428
2835
|
var queue = [node],
|
|
2429
|
-
|
|
2430
|
-
|
|
2836
|
+
currentCount = 1,
|
|
2837
|
+
nextCount = 0;
|
|
2431
2838
|
var x = 0;
|
|
2839
|
+
|
|
2432
2840
|
while (currentCount > 0) {
|
|
2433
2841
|
var currentNode = queue.shift();
|
|
2434
2842
|
currentCount--;
|
|
2843
|
+
|
|
2435
2844
|
if (!currentNode.hasOwnProperty('x')) {
|
|
2436
2845
|
currentNode.x = x;
|
|
2437
2846
|
currentNode.dx = nodeWidth;
|
|
@@ -2439,6 +2848,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2439
2848
|
queue = queue.concat(targets);
|
|
2440
2849
|
nextCount += targets.length;
|
|
2441
2850
|
}
|
|
2851
|
+
|
|
2442
2852
|
if (currentCount == 0) {
|
|
2443
2853
|
// level change
|
|
2444
2854
|
x++;
|
|
@@ -2446,9 +2856,8 @@ var d3_sankey = function d3_sankey() {
|
|
|
2446
2856
|
nextCount = 0;
|
|
2447
2857
|
}
|
|
2448
2858
|
}
|
|
2449
|
-
}
|
|
2859
|
+
} //extra code for fixed layout - x part
|
|
2450
2860
|
|
|
2451
|
-
//extra code for fixed layout - x part
|
|
2452
2861
|
/*
|
|
2453
2862
|
if (fixedlayout && fixedlayout.length > 0) {
|
|
2454
2863
|
sankey.nodes().forEach(function (d, i) {
|
|
@@ -2456,6 +2865,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2456
2865
|
});
|
|
2457
2866
|
}
|
|
2458
2867
|
*/
|
|
2868
|
+
|
|
2459
2869
|
}
|
|
2460
2870
|
|
|
2461
2871
|
function moveSourcesRight() {
|
|
@@ -2467,6 +2877,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2467
2877
|
}
|
|
2468
2878
|
});
|
|
2469
2879
|
}
|
|
2880
|
+
|
|
2470
2881
|
function moveSinksRight(x) {
|
|
2471
2882
|
nodes.forEach(function (node) {
|
|
2472
2883
|
if (!node.sourceLinks.length) {
|
|
@@ -2474,11 +2885,13 @@ var d3_sankey = function d3_sankey() {
|
|
|
2474
2885
|
}
|
|
2475
2886
|
});
|
|
2476
2887
|
}
|
|
2888
|
+
|
|
2477
2889
|
function scaleNodeBreadths(kx) {
|
|
2478
2890
|
nodes.forEach(function (node) {
|
|
2479
2891
|
node.x *= kx;
|
|
2480
2892
|
});
|
|
2481
2893
|
}
|
|
2894
|
+
|
|
2482
2895
|
function computeNodeDepths(iterations) {
|
|
2483
2896
|
var nodesByBreadth = Object(d3_collection__WEBPACK_IMPORTED_MODULE_2__["nest"])().key(function (d) {
|
|
2484
2897
|
return d.x;
|
|
@@ -2487,12 +2900,14 @@ var d3_sankey = function d3_sankey() {
|
|
|
2487
2900
|
});
|
|
2488
2901
|
initializeNodeDepth();
|
|
2489
2902
|
resolveCollisions();
|
|
2903
|
+
|
|
2490
2904
|
for (var alpha = 1; iterations > 0; --iterations) {
|
|
2491
2905
|
relaxRightToLeft(alpha *= 0.99);
|
|
2492
2906
|
resolveCollisions();
|
|
2493
2907
|
relaxLeftToRight(alpha);
|
|
2494
2908
|
resolveCollisions();
|
|
2495
2909
|
}
|
|
2910
|
+
|
|
2496
2911
|
function initializeNodeDepth() {
|
|
2497
2912
|
var ky = Object(d3_array__WEBPACK_IMPORTED_MODULE_1__["min"])(nodesByBreadth, function (nodes) {
|
|
2498
2913
|
return (size[1] - (nodes.length - 1) * nodePadding) / Object(d3_array__WEBPACK_IMPORTED_MODULE_1__["sum"])(nodes, value);
|
|
@@ -2507,6 +2922,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2507
2922
|
link.dy = link.value * ky;
|
|
2508
2923
|
});
|
|
2509
2924
|
}
|
|
2925
|
+
|
|
2510
2926
|
function relaxLeftToRight(alpha) {
|
|
2511
2927
|
nodesByBreadth.forEach(function (nodes, breadth) {
|
|
2512
2928
|
nodes.forEach(function (node) {
|
|
@@ -2516,10 +2932,12 @@ var d3_sankey = function d3_sankey() {
|
|
|
2516
2932
|
}
|
|
2517
2933
|
});
|
|
2518
2934
|
});
|
|
2935
|
+
|
|
2519
2936
|
function weightedSource(link) {
|
|
2520
2937
|
return center(link.source) * link.value;
|
|
2521
2938
|
}
|
|
2522
2939
|
}
|
|
2940
|
+
|
|
2523
2941
|
function relaxRightToLeft(alpha) {
|
|
2524
2942
|
nodesByBreadth.slice().reverse().forEach(function (nodes) {
|
|
2525
2943
|
nodes.forEach(function (node) {
|
|
@@ -2529,35 +2947,38 @@ var d3_sankey = function d3_sankey() {
|
|
|
2529
2947
|
}
|
|
2530
2948
|
});
|
|
2531
2949
|
});
|
|
2950
|
+
|
|
2532
2951
|
function weightedTarget(link) {
|
|
2533
2952
|
return center(link.target) * link.value;
|
|
2534
2953
|
}
|
|
2535
2954
|
}
|
|
2955
|
+
|
|
2536
2956
|
function resolveCollisions() {
|
|
2537
2957
|
nodesByBreadth.forEach(function (nodes) {
|
|
2538
2958
|
var node,
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2959
|
+
dy,
|
|
2960
|
+
y0 = 0,
|
|
2961
|
+
n = nodes.length,
|
|
2962
|
+
i; // Push any overlapping nodes down.
|
|
2543
2963
|
|
|
2544
|
-
// Push any overlapping nodes down.
|
|
2545
2964
|
nodes.sort(ascendingDepth);
|
|
2965
|
+
|
|
2546
2966
|
for (i = 0; i < n; ++i) {
|
|
2547
2967
|
node = nodes[i];
|
|
2968
|
+
|
|
2548
2969
|
if (node) {
|
|
2549
2970
|
dy = y0 - node.y;
|
|
2550
2971
|
if (dy > 0) node.y += dy;
|
|
2551
2972
|
y0 = node.y + node.dy + nodePadding;
|
|
2552
2973
|
}
|
|
2553
|
-
}
|
|
2974
|
+
} // If the bottommost node goes outside the bounds, push it back up.
|
|
2975
|
+
|
|
2554
2976
|
|
|
2555
|
-
// If the bottommost node goes outside the bounds, push it back up.
|
|
2556
2977
|
dy = y0 - nodePadding - size[1];
|
|
2978
|
+
|
|
2557
2979
|
if (node && dy > 0) {
|
|
2558
|
-
y0 = node.y -= dy;
|
|
2980
|
+
y0 = node.y -= dy; // Push any overlapping nodes back up.
|
|
2559
2981
|
|
|
2560
|
-
// Push any overlapping nodes back up.
|
|
2561
2982
|
for (i = n - 2; i >= 0; --i) {
|
|
2562
2983
|
node = nodes[i];
|
|
2563
2984
|
dy = node.y + node.dy + nodePadding - y0;
|
|
@@ -2567,11 +2988,11 @@ var d3_sankey = function d3_sankey() {
|
|
|
2567
2988
|
}
|
|
2568
2989
|
});
|
|
2569
2990
|
}
|
|
2991
|
+
|
|
2570
2992
|
function ascendingDepth(a, b) {
|
|
2571
2993
|
return a.y - b.y;
|
|
2572
|
-
}
|
|
2994
|
+
} //extra code for fixed layout - y part
|
|
2573
2995
|
|
|
2574
|
-
//extra code for fixed layout - y part
|
|
2575
2996
|
/*
|
|
2576
2997
|
if (fixedlayout.length > 0) {
|
|
2577
2998
|
sankey.nodes().forEach(function (d, i) {
|
|
@@ -2579,17 +3000,20 @@ var d3_sankey = function d3_sankey() {
|
|
|
2579
3000
|
});
|
|
2580
3001
|
}
|
|
2581
3002
|
*/
|
|
3003
|
+
|
|
2582
3004
|
}
|
|
2583
3005
|
|
|
2584
3006
|
function computeLinkDepths() {
|
|
2585
3007
|
nodes.forEach(function (node) {
|
|
2586
3008
|
var parallelrendering = false;
|
|
3009
|
+
|
|
2587
3010
|
if (parallelrendering) {} else node.sourceLinks.sort(ascendingTargetDepth);
|
|
3011
|
+
|
|
2588
3012
|
node.targetLinks.sort(ascendingSourceDepth);
|
|
2589
3013
|
});
|
|
2590
3014
|
nodes.forEach(function (node) {
|
|
2591
3015
|
var sy = 0,
|
|
2592
|
-
|
|
3016
|
+
ty = 0;
|
|
2593
3017
|
node.sourceLinks.forEach(function (link) {
|
|
2594
3018
|
link.sy = sy;
|
|
2595
3019
|
sy += link.dy;
|
|
@@ -2599,19 +3023,24 @@ var d3_sankey = function d3_sankey() {
|
|
|
2599
3023
|
ty += link.dy;
|
|
2600
3024
|
});
|
|
2601
3025
|
});
|
|
3026
|
+
|
|
2602
3027
|
function ascendingSourceDepth(a, b) {
|
|
2603
3028
|
return a.source.y - b.source.y;
|
|
2604
3029
|
}
|
|
3030
|
+
|
|
2605
3031
|
function ascendingTargetDepth(a, b) {
|
|
2606
3032
|
return a.target.y - b.target.y;
|
|
2607
3033
|
}
|
|
2608
3034
|
}
|
|
3035
|
+
|
|
2609
3036
|
function center(node) {
|
|
2610
3037
|
return node.y + node.dy / 2;
|
|
2611
3038
|
}
|
|
3039
|
+
|
|
2612
3040
|
function value(link) {
|
|
2613
3041
|
return link.value;
|
|
2614
3042
|
}
|
|
3043
|
+
|
|
2615
3044
|
return sankey;
|
|
2616
3045
|
};
|
|
2617
3046
|
|
|
@@ -2626,29 +3055,40 @@ var d3_sankey = function d3_sankey() {
|
|
|
2626
3055
|
Object.defineProperty(exports, "__esModule", {
|
|
2627
3056
|
value: true
|
|
2628
3057
|
});
|
|
3058
|
+
|
|
2629
3059
|
var React = __webpack_require__(1);
|
|
3060
|
+
|
|
2630
3061
|
var T = __webpack_require__(0);
|
|
3062
|
+
|
|
2631
3063
|
var styled_components_1 = __webpack_require__(4);
|
|
3064
|
+
|
|
2632
3065
|
var react_1 = __webpack_require__(1);
|
|
3066
|
+
|
|
2633
3067
|
var PureSankey_1 = __webpack_require__(111);
|
|
3068
|
+
|
|
2634
3069
|
var SankeyUtils_1 = __webpack_require__(134);
|
|
3070
|
+
|
|
2635
3071
|
var MAX_NODE_TEXT_WIDTH = 150;
|
|
3072
|
+
|
|
2636
3073
|
var getNodeOpacity = function getNodeOpacity(nodeIndex, activeNodes) {
|
|
2637
3074
|
if (!activeNodes || !activeNodes.length) {
|
|
2638
3075
|
return PureSankey_1.DEFAULT_NODE_OPACITY;
|
|
2639
3076
|
}
|
|
3077
|
+
|
|
2640
3078
|
var isActiveNode = activeNodes.find(function (node) {
|
|
2641
3079
|
return node.index === nodeIndex;
|
|
2642
3080
|
});
|
|
2643
3081
|
return isActiveNode ? PureSankey_1.DEFAULT_NODE_OPACITY : PureSankey_1.INACTIVE_OPACITY;
|
|
2644
3082
|
};
|
|
3083
|
+
|
|
2645
3084
|
var getNodeHeight = function getNodeHeight(node) {
|
|
2646
3085
|
return node.dy < 0 ? 1 : node.dy;
|
|
2647
3086
|
};
|
|
3087
|
+
|
|
2648
3088
|
var NodeGroup = styled_components_1.default.g.withConfig({
|
|
2649
3089
|
displayName: "SankeyNode__NodeGroup",
|
|
2650
3090
|
componentId: "sc-1a3nkch-0"
|
|
2651
|
-
})(["opacity:", ";"], function (props) {
|
|
3091
|
+
})(["opacity:", ";&:hover{cursor:pointer;}"], function (props) {
|
|
2652
3092
|
return getNodeOpacity(props.node.index, props.activeNodes);
|
|
2653
3093
|
});
|
|
2654
3094
|
NodeGroup.displayName = 'NodeGroup';
|
|
@@ -2666,26 +3106,32 @@ var NodeText = styled_components_1.default.text.withConfig({
|
|
|
2666
3106
|
}, PureSankey_1.DEFAULT_FONT_FAMILY, function (props) {
|
|
2667
3107
|
return props.nodeTextColor;
|
|
2668
3108
|
});
|
|
3109
|
+
|
|
2669
3110
|
var SankeyNode = function SankeyNode(props) {
|
|
2670
3111
|
var node = props.node,
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
3112
|
+
activeNodes = props.activeNodes,
|
|
3113
|
+
nodeWidth = props.nodeWidth,
|
|
3114
|
+
chartWidth = props.chartWidth,
|
|
3115
|
+
handleMouseOver = props.handleMouseOver,
|
|
3116
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3117
|
+
handleNodeClick = props.handleNodeClick,
|
|
3118
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3119
|
+
nodeTextColor = props.nodeTextColor;
|
|
2678
3120
|
var nodeTextRef = (0, react_1.useRef)();
|
|
2679
3121
|
(0, react_1.useEffect)(function () {
|
|
2680
3122
|
(0, SankeyUtils_1.truncateSVGTextWithEllipsis)(nodeTextRef.current, node.name, MAX_NODE_TEXT_WIDTH);
|
|
2681
3123
|
});
|
|
3124
|
+
var nodeClickHandler = (0, react_1.useCallback)(function () {
|
|
3125
|
+
return handleNodeClick(node);
|
|
3126
|
+
}, [node]);
|
|
2682
3127
|
return React.createElement(NodeGroup, {
|
|
2683
3128
|
node: node,
|
|
2684
3129
|
activeNodes: activeNodes,
|
|
2685
3130
|
className: "node",
|
|
2686
3131
|
key: "node-".concat(node.index),
|
|
2687
3132
|
"data-test": "node-".concat(node.index),
|
|
2688
|
-
transform: "translate(".concat(node.x, ",").concat(node.y, ")")
|
|
3133
|
+
transform: "translate(".concat(node.x, ",").concat(node.y, ")"),
|
|
3134
|
+
onClick: nodeClickHandler
|
|
2689
3135
|
}, React.createElement(React.Fragment, null, React.createElement(NodeRect, {
|
|
2690
3136
|
node: node,
|
|
2691
3137
|
height: getNodeHeight(node),
|
|
@@ -2707,6 +3153,7 @@ var SankeyNode = function SankeyNode(props) {
|
|
|
2707
3153
|
nodeTextColor: nodeTextColor
|
|
2708
3154
|
}, node.name)));
|
|
2709
3155
|
};
|
|
3156
|
+
|
|
2710
3157
|
SankeyNode.propTypes = {
|
|
2711
3158
|
node: T.object,
|
|
2712
3159
|
activeNodes: T.arrayOf(T.object),
|
|
@@ -2734,15 +3181,19 @@ exports.default = SankeyNode;
|
|
|
2734
3181
|
Object.defineProperty(exports, "__esModule", {
|
|
2735
3182
|
value: true
|
|
2736
3183
|
});
|
|
3184
|
+
|
|
2737
3185
|
var React = __webpack_require__(1);
|
|
3186
|
+
|
|
2738
3187
|
var styled_components_1 = __webpack_require__(4);
|
|
3188
|
+
|
|
2739
3189
|
var hocUtils_1 = __webpack_require__(15);
|
|
3190
|
+
|
|
2740
3191
|
var Cover = styled_components_1.default.div.withConfig({
|
|
2741
3192
|
displayName: "withEditModeCover__Cover",
|
|
2742
3193
|
componentId: "sc-1gsbnxb-0"
|
|
2743
3194
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
2744
3195
|
var Blocker = styled_components_1.default.div.attrs({
|
|
2745
|
-
'data-splunk-visualization-version': "26.
|
|
3196
|
+
'data-splunk-visualization-version': "26.1.1 - b6df0a015"
|
|
2746
3197
|
}).withConfig({
|
|
2747
3198
|
displayName: "withEditModeCover__Blocker",
|
|
2748
3199
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2753,6 +3204,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
2753
3204
|
* @param {ExtendedDashViz} Visualization
|
|
2754
3205
|
* @returns {ExtendedDashViz} Wrapper
|
|
2755
3206
|
*/
|
|
3207
|
+
|
|
2756
3208
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
2757
3209
|
var Wrapper = function Wrapper(props) {
|
|
2758
3210
|
var mode = props.mode;
|
|
@@ -2761,12 +3213,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
2761
3213
|
"data-test": "edit-mode-cover"
|
|
2762
3214
|
}));
|
|
2763
3215
|
};
|
|
3216
|
+
|
|
2764
3217
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2765
3218
|
Wrapper: Wrapper,
|
|
2766
3219
|
Visualization: Visualization
|
|
2767
3220
|
});
|
|
2768
3221
|
return Wrapper;
|
|
2769
3222
|
};
|
|
3223
|
+
|
|
2770
3224
|
exports.default = withEditModeCover;
|
|
2771
3225
|
|
|
2772
3226
|
/***/ }),
|
|
@@ -2780,52 +3234,76 @@ exports.default = withEditModeCover;
|
|
|
2780
3234
|
Object.defineProperty(exports, "__esModule", {
|
|
2781
3235
|
value: true
|
|
2782
3236
|
});
|
|
3237
|
+
|
|
2783
3238
|
var React = __webpack_require__(1);
|
|
3239
|
+
|
|
3240
|
+
var react_1 = __webpack_require__(1);
|
|
3241
|
+
|
|
2784
3242
|
var T = __webpack_require__(0);
|
|
3243
|
+
|
|
3244
|
+
var styled_components_1 = __webpack_require__(4);
|
|
3245
|
+
|
|
2785
3246
|
var PureSankey_1 = __webpack_require__(111);
|
|
3247
|
+
|
|
2786
3248
|
var SankeyUtils_1 = __webpack_require__(134);
|
|
3249
|
+
|
|
2787
3250
|
var getLinkFill = function getLinkFill(link, colorCategoryMapping, colorMode) {
|
|
2788
3251
|
if (colorMode === 'categorical') {
|
|
2789
3252
|
return colorCategoryMapping ? colorCategoryMapping(link.source.name) : PureSankey_1.DEFAULT_LINK_COLOR;
|
|
2790
3253
|
}
|
|
3254
|
+
|
|
2791
3255
|
return colorCategoryMapping && colorCategoryMapping[link.index] ? colorCategoryMapping[link.index] : PureSankey_1.DEFAULT_LINK_COLOR;
|
|
2792
3256
|
};
|
|
3257
|
+
|
|
2793
3258
|
var getLinkOpacity = function getLinkOpacity(link, activeLinks, linkOpacity) {
|
|
2794
3259
|
if (!activeLinks || !activeLinks.length) {
|
|
2795
3260
|
return linkOpacity;
|
|
2796
3261
|
}
|
|
3262
|
+
|
|
2797
3263
|
var isActiveLink = activeLinks.find(function (l) {
|
|
2798
3264
|
return l.id === link.id;
|
|
2799
3265
|
});
|
|
2800
3266
|
return isActiveLink ? linkOpacity : PureSankey_1.INACTIVE_OPACITY;
|
|
2801
3267
|
};
|
|
3268
|
+
|
|
3269
|
+
var StyledSankeyLink = styled_components_1.default.g.withConfig({
|
|
3270
|
+
displayName: "SankeyLink__StyledSankeyLink",
|
|
3271
|
+
componentId: "sc-1w9ez3l-0"
|
|
3272
|
+
})(["&:hover{cursor:pointer;}"]);
|
|
3273
|
+
|
|
2802
3274
|
var SankeyLink = function SankeyLink(props) {
|
|
2803
3275
|
var link = props.link,
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
3276
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3277
|
+
activeLinks = props.activeLinks,
|
|
3278
|
+
linkOpacity = props.linkOpacity,
|
|
3279
|
+
colorMode = props.colorMode,
|
|
3280
|
+
path = props.path,
|
|
3281
|
+
handleMouseOver = props.handleMouseOver,
|
|
3282
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3283
|
+
handleLinkClick = props.handleLinkClick; // This is to draw an invisible circle added to the link's path midpoint,
|
|
2811
3284
|
// which acts as an anchor for the link tooltip
|
|
3285
|
+
|
|
2812
3286
|
var circlePoints = (0, SankeyUtils_1.extractLinkMidPoint)(path(1)(link));
|
|
2813
|
-
|
|
3287
|
+
var linkClickHandler = (0, react_1.useCallback)(function () {
|
|
3288
|
+
return handleLinkClick(link);
|
|
3289
|
+
}, [link]);
|
|
3290
|
+
return React.createElement(StyledSankeyLink, {
|
|
2814
3291
|
className: "link",
|
|
2815
3292
|
key: link.id,
|
|
2816
3293
|
id: link.id,
|
|
2817
3294
|
"data-test": link.id,
|
|
2818
3295
|
fill: getLinkFill(link, colorCategoryMapping, colorMode),
|
|
2819
3296
|
opacity: getLinkOpacity(link, activeLinks, linkOpacity),
|
|
3297
|
+
onClick: linkClickHandler,
|
|
2820
3298
|
onMouseOver: function onMouseOver(ev) {
|
|
2821
3299
|
handleMouseOver(ev);
|
|
2822
3300
|
},
|
|
2823
3301
|
onMouseLeave: function onMouseLeave(ev) {
|
|
2824
3302
|
var relatedTarget = ev.relatedTarget;
|
|
2825
|
-
var isRelatedTargetPopover = false;
|
|
2826
|
-
// This is to verify if the mouseLeave is being triggered because of mouseover on a the popover itself.
|
|
3303
|
+
var isRelatedTargetPopover = false; // This is to verify if the mouseLeave is being triggered because of mouseover on a the popover itself.
|
|
2827
3304
|
// In that case the relatedTarget will have the popover elements and this logic will check on the class name used.
|
|
2828
3305
|
// If detects the relatedTarget is a popover, then mouseLeave event handler wont be triggered.
|
|
3306
|
+
|
|
2829
3307
|
if (relatedTarget && relatedTarget.classList) {
|
|
2830
3308
|
var classList = relatedTarget.classList;
|
|
2831
3309
|
classList.forEach(function (name) {
|
|
@@ -2834,6 +3312,7 @@ var SankeyLink = function SankeyLink(props) {
|
|
|
2834
3312
|
}
|
|
2835
3313
|
});
|
|
2836
3314
|
}
|
|
3315
|
+
|
|
2837
3316
|
if (!isRelatedTargetPopover) {
|
|
2838
3317
|
handleMouseLeave(ev);
|
|
2839
3318
|
}
|
|
@@ -2851,6 +3330,7 @@ var SankeyLink = function SankeyLink(props) {
|
|
|
2851
3330
|
fill: "transparent"
|
|
2852
3331
|
}));
|
|
2853
3332
|
};
|
|
3333
|
+
|
|
2854
3334
|
SankeyLink.propTypes = {
|
|
2855
3335
|
link: T.object,
|
|
2856
3336
|
activeLinks: T.arrayOf(T.object),
|
|
@@ -2877,12 +3357,19 @@ exports.default = SankeyLink;
|
|
|
2877
3357
|
Object.defineProperty(exports, "__esModule", {
|
|
2878
3358
|
value: true
|
|
2879
3359
|
});
|
|
3360
|
+
|
|
2880
3361
|
var React = __webpack_require__(1);
|
|
3362
|
+
|
|
2881
3363
|
var T = __webpack_require__(0);
|
|
3364
|
+
|
|
2882
3365
|
var Popover_1 = __webpack_require__(62);
|
|
3366
|
+
|
|
2883
3367
|
var styled_components_1 = __webpack_require__(4);
|
|
3368
|
+
|
|
2884
3369
|
var numberUtils_1 = __webpack_require__(31);
|
|
3370
|
+
|
|
2885
3371
|
var PureSankey_1 = __webpack_require__(111);
|
|
3372
|
+
|
|
2886
3373
|
var DEFAULT_PLACEMENT = 'below';
|
|
2887
3374
|
var StyledTooltipContainer = styled_components_1.default.div.withConfig({
|
|
2888
3375
|
displayName: "SankeyTooltip__StyledTooltipContainer",
|
|
@@ -2928,50 +3415,59 @@ var NodeValue = styled_components_1.default.div.withConfig({
|
|
|
2928
3415
|
displayName: "SankeyTooltip__NodeValue",
|
|
2929
3416
|
componentId: "x563qp-8"
|
|
2930
3417
|
})(["margin-left:8px;max-width:200px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;"]);
|
|
3418
|
+
|
|
2931
3419
|
var SankeyTooltip = function SankeyTooltip(props) {
|
|
2932
3420
|
var mode = props.mode,
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
3421
|
+
node = props.node,
|
|
3422
|
+
link = props.link,
|
|
3423
|
+
open = props.open,
|
|
3424
|
+
connectionsMap = props.connectionsMap,
|
|
3425
|
+
anchor = props.anchor,
|
|
3426
|
+
linkValue = props.linkValue,
|
|
3427
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3428
|
+
width = props.width,
|
|
3429
|
+
tooltipRowColor = props.tooltipRowColor,
|
|
3430
|
+
tooltipLinkHeaderColor = props.tooltipLinkHeaderColor,
|
|
3431
|
+
tooltipHeaderColor = props.tooltipHeaderColor,
|
|
3432
|
+
handleTooltipRequestClose = props.handleTooltipRequestClose;
|
|
3433
|
+
|
|
2945
3434
|
var showSection = function showSection(connection, nodeData, section) {
|
|
2946
3435
|
if (!connection) {
|
|
2947
3436
|
return false;
|
|
2948
3437
|
}
|
|
3438
|
+
|
|
2949
3439
|
var connectionNodes = section === 'source' ? connection.sourceNodes : connection.targetNodes;
|
|
2950
3440
|
var filteredNodes = connectionNodes.filter(function (cNode) {
|
|
2951
3441
|
return cNode.index !== nodeData.index;
|
|
2952
3442
|
});
|
|
2953
3443
|
return filteredNodes.length > 0;
|
|
2954
3444
|
};
|
|
3445
|
+
|
|
2955
3446
|
var getPopoverPlacement = function getPopoverPlacement(anchorElement) {
|
|
2956
3447
|
if (!anchorElement) {
|
|
2957
3448
|
return DEFAULT_PLACEMENT;
|
|
2958
3449
|
}
|
|
2959
|
-
|
|
2960
|
-
// TODO: Depending on the testing result in dashboard reg tooltip position, might need further optimization
|
|
3450
|
+
|
|
3451
|
+
var bBox = anchorElement.getBoundingClientRect(); // TODO: Depending on the testing result in dashboard reg tooltip position, might need further optimization
|
|
2961
3452
|
// If anchorElement is too close to the left border of the chart, place it to the right side of anchorElement
|
|
3453
|
+
|
|
2962
3454
|
if (bBox.x <= 15) {
|
|
2963
3455
|
return 'right';
|
|
2964
3456
|
}
|
|
3457
|
+
|
|
2965
3458
|
if (bBox.x >= width - 15) {
|
|
2966
3459
|
// If anchorElement is too close to the right border of the chart, place it to the right side of anchorElement
|
|
2967
3460
|
return 'left';
|
|
2968
3461
|
}
|
|
3462
|
+
|
|
2969
3463
|
return DEFAULT_PLACEMENT;
|
|
2970
3464
|
};
|
|
3465
|
+
|
|
2971
3466
|
var renderNodeToolTip = function renderNodeToolTip() {
|
|
2972
3467
|
if (!node) {
|
|
2973
3468
|
return null;
|
|
2974
3469
|
}
|
|
3470
|
+
|
|
2975
3471
|
var connections = connectionsMap[node.index];
|
|
2976
3472
|
return React.createElement(Popover_1.default, {
|
|
2977
3473
|
open: open,
|
|
@@ -2998,6 +3494,7 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
2998
3494
|
headerColor: tooltipHeaderColor
|
|
2999
3495
|
}, React.createElement(StyledTooltipLeftCell, null, "Source"), React.createElement(StyledTooltipRightCell, null, linkValue)), React.createElement(StyledTooltipSection, null, connections && connections.sourceNodes.map(function (sNode, idx) {
|
|
3000
3496
|
var _a, _b;
|
|
3497
|
+
|
|
3001
3498
|
if ((sNode === null || sNode === void 0 ? void 0 : sNode.index) !== (node === null || node === void 0 ? void 0 : node.index) || ((_a = connections.sourceNodes[idx]) === null || _a === void 0 ? void 0 : _a.index) === ((_b = connections.targetNodes[idx]) === null || _b === void 0 ? void 0 : _b.index)) {
|
|
3002
3499
|
return React.createElement(StyledTooltipRow, {
|
|
3003
3500
|
key: sNode.index,
|
|
@@ -3014,11 +3511,13 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
3014
3511
|
useTrendUnits: true
|
|
3015
3512
|
})));
|
|
3016
3513
|
}
|
|
3514
|
+
|
|
3017
3515
|
return null;
|
|
3018
3516
|
})), showSection(connections, node, 'target') && React.createElement(StyledTooltipHeader, {
|
|
3019
3517
|
headerColor: tooltipHeaderColor
|
|
3020
3518
|
}, React.createElement(StyledTooltipLeftCell, null, "Target"), React.createElement(StyledTooltipRightCell, null, linkValue)), React.createElement(StyledTooltipSection, null, connections && connections.targetNodes.map(function (tNode, idx) {
|
|
3021
3519
|
var _a, _b;
|
|
3520
|
+
|
|
3022
3521
|
if ((tNode === null || tNode === void 0 ? void 0 : tNode.index) !== (node === null || node === void 0 ? void 0 : node.index) || ((_a = connections.sourceNodes[idx]) === null || _a === void 0 ? void 0 : _a.index) === ((_b = connections.targetNodes[idx]) === null || _b === void 0 ? void 0 : _b.index)) {
|
|
3023
3522
|
return React.createElement(StyledTooltipRow, {
|
|
3024
3523
|
key: tNode.index,
|
|
@@ -3035,14 +3534,18 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
3035
3534
|
useTrendUnits: true
|
|
3036
3535
|
})));
|
|
3037
3536
|
}
|
|
3537
|
+
|
|
3038
3538
|
return null;
|
|
3039
3539
|
}))));
|
|
3040
3540
|
};
|
|
3541
|
+
|
|
3041
3542
|
var renderLinkToolTip = function renderLinkToolTip() {
|
|
3042
3543
|
var _a, _b, _c, _d;
|
|
3544
|
+
|
|
3043
3545
|
if (!link) {
|
|
3044
3546
|
return null;
|
|
3045
3547
|
}
|
|
3548
|
+
|
|
3046
3549
|
return React.createElement(Popover_1.default, {
|
|
3047
3550
|
open: open,
|
|
3048
3551
|
anchor: anchor,
|
|
@@ -3090,8 +3593,10 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
3090
3593
|
useTrendUnits: true
|
|
3091
3594
|
}))))));
|
|
3092
3595
|
};
|
|
3596
|
+
|
|
3093
3597
|
return mode === 'node' ? renderNodeToolTip() : renderLinkToolTip();
|
|
3094
3598
|
};
|
|
3599
|
+
|
|
3095
3600
|
SankeyTooltip.propTypes = {
|
|
3096
3601
|
mode: T.string,
|
|
3097
3602
|
node: T.object,
|
|
@@ -3123,18 +3628,31 @@ exports.default = SankeyTooltip;
|
|
|
3123
3628
|
Object.defineProperty(exports, "__esModule", {
|
|
3124
3629
|
value: true
|
|
3125
3630
|
});
|
|
3631
|
+
|
|
3126
3632
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3633
|
+
|
|
3127
3634
|
var placeholders_1 = __webpack_require__(50);
|
|
3635
|
+
|
|
3128
3636
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
3637
|
+
|
|
3129
3638
|
var schemaUtils_1 = __webpack_require__(16);
|
|
3639
|
+
|
|
3130
3640
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
3641
|
+
|
|
3131
3642
|
var themes_1 = __webpack_require__(60);
|
|
3643
|
+
|
|
3132
3644
|
var i18n_1 = __webpack_require__(2);
|
|
3645
|
+
|
|
3133
3646
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3134
|
-
|
|
3647
|
+
|
|
3648
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
3649
|
+
|
|
3135
3650
|
var configUtils_1 = __webpack_require__(20);
|
|
3651
|
+
|
|
3136
3652
|
var DynamicLinkColorsEditor_1 = __webpack_require__(463);
|
|
3653
|
+
|
|
3137
3654
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
3655
|
+
|
|
3138
3656
|
var defaultContext = {
|
|
3139
3657
|
linkColorRangeConfig: [{
|
|
3140
3658
|
to: 20,
|
|
@@ -3312,17 +3830,20 @@ var editorConfig = [{
|
|
|
3312
3830
|
/**
|
|
3313
3831
|
* visualization configuration
|
|
3314
3832
|
*/
|
|
3833
|
+
|
|
3315
3834
|
var config = {
|
|
3316
3835
|
/**
|
|
3317
3836
|
* unique viz key
|
|
3318
3837
|
*/
|
|
3319
3838
|
key: 'splunk.sankey',
|
|
3839
|
+
|
|
3320
3840
|
/**
|
|
3321
3841
|
* viz name
|
|
3322
3842
|
*/
|
|
3323
3843
|
name: (0, i18n_1._)('Sankey'),
|
|
3324
3844
|
category: VizCategory_1.VizCategory.FLOW,
|
|
3325
3845
|
status: 'preview',
|
|
3846
|
+
|
|
3326
3847
|
/**
|
|
3327
3848
|
* viz icon
|
|
3328
3849
|
*/
|
|
@@ -3333,7 +3854,14 @@ var config = {
|
|
|
3333
3854
|
defaultContext: defaultContext,
|
|
3334
3855
|
optionsSchema: optionsSchema,
|
|
3335
3856
|
editorConfig: editorConfig,
|
|
3336
|
-
events: {
|
|
3857
|
+
events: {
|
|
3858
|
+
'node.click': {
|
|
3859
|
+
description: 'Triggered when user clicks on a node'
|
|
3860
|
+
},
|
|
3861
|
+
'link.click': {
|
|
3862
|
+
description: 'Triggered when user clicks on a link'
|
|
3863
|
+
}
|
|
3864
|
+
},
|
|
3337
3865
|
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PLACEHOLDER],
|
|
3338
3866
|
themes: themes,
|
|
3339
3867
|
requiredProps: []
|
|
@@ -3356,7 +3884,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3356
3884
|
|
|
3357
3885
|
var getDynamicLinkColorsEditor = function getDynamicLinkColorsEditor(_ref) {
|
|
3358
3886
|
var defaultContext = _ref.defaultContext,
|
|
3359
|
-
|
|
3887
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
3360
3888
|
return {
|
|
3361
3889
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Link'),
|
|
3362
3890
|
option: 'linkColors',
|
|
@@ -3402,27 +3930,37 @@ var getDynamicLinkColorsEditor = function getDynamicLinkColorsEditor(_ref) {
|
|
|
3402
3930
|
Object.defineProperty(exports, "__esModule", {
|
|
3403
3931
|
value: true
|
|
3404
3932
|
});
|
|
3933
|
+
|
|
3405
3934
|
var React = __webpack_require__(1);
|
|
3935
|
+
|
|
3406
3936
|
var colorUtils_1 = __webpack_require__(12);
|
|
3937
|
+
|
|
3407
3938
|
var variables_1 = __webpack_require__(11);
|
|
3939
|
+
|
|
3408
3940
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
3941
|
+
|
|
3409
3942
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3943
|
+
|
|
3410
3944
|
var hocUtils_1 = __webpack_require__(15);
|
|
3945
|
+
|
|
3411
3946
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3412
3947
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3413
3948
|
var config = Visualization.config;
|
|
3414
3949
|
var themes = config.themes;
|
|
3950
|
+
|
|
3415
3951
|
var Wrapper = function Wrapper(props) {
|
|
3416
3952
|
var _a, _b;
|
|
3953
|
+
|
|
3417
3954
|
var dataSources = props.dataSources,
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3955
|
+
loading = props.loading,
|
|
3956
|
+
options = props.options,
|
|
3957
|
+
height = props.height,
|
|
3958
|
+
width = props.width;
|
|
3422
3959
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3423
3960
|
var bgColorFromTheme = (0, colorUtils_1.isColor)(options === null || options === void 0 ? void 0 : options.backgroundColor) ? options === null || options === void 0 ? void 0 : options.backgroundColor : (_a = themes === null || themes === void 0 ? void 0 : themes.defaultBackgroundColor) === null || _a === void 0 ? void 0 : _a.call(themes, props);
|
|
3424
3961
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3425
3962
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
3963
|
+
|
|
3426
3964
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3427
3965
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3428
3966
|
"data-test": "icon-placeholder",
|
|
@@ -3433,14 +3971,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3433
3971
|
iconColor: iconColor
|
|
3434
3972
|
});
|
|
3435
3973
|
}
|
|
3974
|
+
|
|
3436
3975
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3437
3976
|
};
|
|
3977
|
+
|
|
3438
3978
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3439
3979
|
Wrapper: Wrapper,
|
|
3440
3980
|
Visualization: Visualization
|
|
3441
3981
|
});
|
|
3442
3982
|
return Wrapper;
|
|
3443
3983
|
};
|
|
3984
|
+
|
|
3444
3985
|
exports.default = withPlaceholder;
|
|
3445
3986
|
|
|
3446
3987
|
/***/ }),
|
|
@@ -3475,11 +4016,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
3475
4016
|
Object.defineProperty(exports, "__esModule", {
|
|
3476
4017
|
value: true
|
|
3477
4018
|
});
|
|
4019
|
+
|
|
3478
4020
|
var i18n_1 = __webpack_require__(2);
|
|
4021
|
+
|
|
3479
4022
|
var background = function background(_ref) {
|
|
3480
4023
|
var label = _ref.label,
|
|
3481
|
-
|
|
3482
|
-
|
|
4024
|
+
themes = _ref.themes,
|
|
4025
|
+
labelPosition = _ref.labelPosition;
|
|
3483
4026
|
return [{
|
|
3484
4027
|
label: (0, i18n_1._)(label || 'Background'),
|
|
3485
4028
|
option: 'backgroundColor',
|
|
@@ -3490,6 +4033,7 @@ var background = function background(_ref) {
|
|
|
3490
4033
|
}
|
|
3491
4034
|
}];
|
|
3492
4035
|
};
|
|
4036
|
+
|
|
3493
4037
|
exports.default = background;
|
|
3494
4038
|
|
|
3495
4039
|
/***/ }),
|
|
@@ -3505,6 +4049,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3505
4049
|
});
|
|
3506
4050
|
exports.VizBehavior = void 0;
|
|
3507
4051
|
var VizBehavior;
|
|
4052
|
+
|
|
3508
4053
|
(function (VizBehavior) {
|
|
3509
4054
|
/**
|
|
3510
4055
|
* Dynamic Options Behavior.
|
|
@@ -3524,6 +4069,7 @@ var VizBehavior;
|
|
|
3524
4069
|
* missing.
|
|
3525
4070
|
* @type {string}
|
|
3526
4071
|
*/
|
|
4072
|
+
|
|
3527
4073
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
3528
4074
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
3529
4075
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -3605,24 +4151,24 @@ module.exports = require("@babel/runtime/helpers/typeof");
|
|
|
3605
4151
|
|
|
3606
4152
|
/***/ }),
|
|
3607
4153
|
|
|
3608
|
-
/***/
|
|
4154
|
+
/***/ 83:
|
|
3609
4155
|
/***/ (function(module, exports) {
|
|
3610
4156
|
|
|
3611
|
-
module.exports = require("@
|
|
4157
|
+
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
3612
4158
|
|
|
3613
4159
|
/***/ }),
|
|
3614
4160
|
|
|
3615
|
-
/***/
|
|
4161
|
+
/***/ 9:
|
|
3616
4162
|
/***/ (function(module, exports) {
|
|
3617
4163
|
|
|
3618
|
-
module.exports = require("
|
|
4164
|
+
module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
3619
4165
|
|
|
3620
4166
|
/***/ }),
|
|
3621
4167
|
|
|
3622
|
-
/***/
|
|
4168
|
+
/***/ 93:
|
|
3623
4169
|
/***/ (function(module, exports) {
|
|
3624
4170
|
|
|
3625
|
-
module.exports = require("
|
|
4171
|
+
module.exports = require("d3-scale");
|
|
3626
4172
|
|
|
3627
4173
|
/***/ }),
|
|
3628
4174
|
|