@splunk/visualizations 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
package/Sankey.js
CHANGED
|
@@ -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.0 - fc8bf8d77",
|
|
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
|
/***/ }),
|
|
@@ -855,79 +1001,115 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
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: {
|
|
@@ -1301,6 +1527,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1301
1527
|
height: '50%'
|
|
1302
1528
|
});
|
|
1303
1529
|
}
|
|
1530
|
+
|
|
1304
1531
|
return React.createElement(Message_1.default, {
|
|
1305
1532
|
width: width,
|
|
1306
1533
|
height: height,
|
|
@@ -1308,6 +1535,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1308
1535
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
1309
1536
|
});
|
|
1310
1537
|
};
|
|
1538
|
+
|
|
1311
1539
|
IconPlaceholder.propTypes = propTypes;
|
|
1312
1540
|
IconPlaceholder.defaultProps = {
|
|
1313
1541
|
width: '100%',
|
|
@@ -1324,21 +1552,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
1324
1552
|
|
|
1325
1553
|
|
|
1326
1554
|
var _defineProperty = __webpack_require__(7);
|
|
1555
|
+
|
|
1327
1556
|
Object.defineProperty(exports, "__esModule", {
|
|
1328
1557
|
value: true
|
|
1329
1558
|
});
|
|
1330
1559
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1560
|
+
|
|
1331
1561
|
var T = __webpack_require__(0);
|
|
1562
|
+
|
|
1332
1563
|
var lodash_1 = __webpack_require__(3);
|
|
1333
|
-
|
|
1564
|
+
|
|
1565
|
+
var DataSource_1 = __webpack_require__(34);
|
|
1566
|
+
|
|
1334
1567
|
exports.SortParamsPropTypes = T.shape({
|
|
1335
1568
|
currentSortKey: T.string,
|
|
1336
1569
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
1337
1570
|
onSort: T.func
|
|
1338
1571
|
});
|
|
1572
|
+
|
|
1339
1573
|
var getSortingParams = function getSortingParams(_ref) {
|
|
1340
1574
|
var requestParams = _ref.requestParams,
|
|
1341
|
-
|
|
1575
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1342
1576
|
var currentSortKey;
|
|
1343
1577
|
var currentSortDir;
|
|
1344
1578
|
var nextSortDirMap = {
|
|
@@ -1347,15 +1581,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1347
1581
|
none: 'asc'
|
|
1348
1582
|
};
|
|
1349
1583
|
var onSort;
|
|
1584
|
+
|
|
1350
1585
|
if (typeof onRequestParamsChange === 'function') {
|
|
1351
1586
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
1352
1587
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
1353
1588
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1589
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
1590
|
+
|
|
1591
|
+
|
|
1356
1592
|
onSort = function onSort(e, _ref2) {
|
|
1357
1593
|
var sortKey = _ref2.sortKey,
|
|
1358
|
-
|
|
1594
|
+
sortDir = _ref2.sortDir;
|
|
1595
|
+
|
|
1359
1596
|
if (typeof sortKey === 'string') {
|
|
1360
1597
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
1361
1598
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -1367,12 +1604,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1367
1604
|
}
|
|
1368
1605
|
};
|
|
1369
1606
|
}
|
|
1607
|
+
|
|
1370
1608
|
return {
|
|
1371
1609
|
currentSortKey: currentSortKey,
|
|
1372
1610
|
currentSortDir: currentSortDir,
|
|
1373
1611
|
onSort: onSort
|
|
1374
1612
|
};
|
|
1375
1613
|
};
|
|
1614
|
+
|
|
1376
1615
|
exports.getSortingParams = getSortingParams;
|
|
1377
1616
|
|
|
1378
1617
|
/***/ }),
|
|
@@ -1383,43 +1622,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
1383
1622
|
"use strict";
|
|
1384
1623
|
|
|
1385
1624
|
|
|
1625
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1626
|
+
value: true
|
|
1627
|
+
});
|
|
1628
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1629
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1630
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1631
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
1632
|
+
|
|
1633
|
+
/***/ }),
|
|
1634
|
+
|
|
1635
|
+
/***/ 35:
|
|
1636
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1637
|
+
|
|
1638
|
+
"use strict";
|
|
1639
|
+
|
|
1640
|
+
|
|
1386
1641
|
Object.defineProperty(exports, "__esModule", {
|
|
1387
1642
|
value: true
|
|
1388
1643
|
});
|
|
1389
1644
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1645
|
+
|
|
1390
1646
|
var T = __webpack_require__(0);
|
|
1647
|
+
|
|
1391
1648
|
var lodash_1 = __webpack_require__(3);
|
|
1649
|
+
|
|
1392
1650
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
1393
1651
|
isPaging: T.bool,
|
|
1394
1652
|
current: T.number,
|
|
1395
1653
|
totalPages: T.number,
|
|
1396
1654
|
onChange: T.func
|
|
1397
1655
|
});
|
|
1656
|
+
|
|
1398
1657
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
1399
1658
|
var requestParams = _ref.requestParams,
|
|
1400
|
-
|
|
1401
|
-
|
|
1659
|
+
meta = _ref.meta,
|
|
1660
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1402
1661
|
var totalCount = meta && meta.totalCount || 0;
|
|
1403
1662
|
var offset = requestParams && requestParams.offset || 0;
|
|
1404
1663
|
var count = requestParams && requestParams.count;
|
|
1405
1664
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
1406
1665
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
1407
1666
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
1667
|
+
|
|
1408
1668
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
1409
1669
|
var page = _ref2.page,
|
|
1410
|
-
|
|
1670
|
+
countArg = _ref2.count;
|
|
1411
1671
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
1672
|
+
|
|
1412
1673
|
if (typeof countArg === 'number') {
|
|
1413
1674
|
newParams.count = countArg;
|
|
1414
1675
|
newParams.offset = 0;
|
|
1415
1676
|
}
|
|
1677
|
+
|
|
1416
1678
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
1679
|
+
|
|
1417
1680
|
if (typeof page === 'number' && page > 0) {
|
|
1418
1681
|
newParams.count = pageCount;
|
|
1419
1682
|
newParams.offset = (page - 1) * pageCount;
|
|
1420
1683
|
}
|
|
1684
|
+
|
|
1421
1685
|
onRequestParamsChange(newParams);
|
|
1422
1686
|
};
|
|
1687
|
+
|
|
1423
1688
|
return {
|
|
1424
1689
|
isPaging: isPaging,
|
|
1425
1690
|
current: current,
|
|
@@ -1427,11 +1692,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
1427
1692
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
1428
1693
|
};
|
|
1429
1694
|
};
|
|
1695
|
+
|
|
1430
1696
|
exports.getPaginationParams = getPaginationParams;
|
|
1431
1697
|
|
|
1432
1698
|
/***/ }),
|
|
1433
1699
|
|
|
1434
|
-
/***/
|
|
1700
|
+
/***/ 36:
|
|
1435
1701
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1436
1702
|
|
|
1437
1703
|
"use strict";
|
|
@@ -1442,6 +1708,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1442
1708
|
});
|
|
1443
1709
|
exports.VizCategory = void 0;
|
|
1444
1710
|
var VizCategory;
|
|
1711
|
+
|
|
1445
1712
|
(function (VizCategory) {
|
|
1446
1713
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1447
1714
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -1459,67 +1726,96 @@ var VizCategory;
|
|
|
1459
1726
|
|
|
1460
1727
|
/***/ }),
|
|
1461
1728
|
|
|
1462
|
-
/***/
|
|
1729
|
+
/***/ 37:
|
|
1463
1730
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1464
1731
|
|
|
1465
1732
|
"use strict";
|
|
1466
1733
|
|
|
1467
1734
|
|
|
1468
1735
|
var _slicedToArray = __webpack_require__(17);
|
|
1736
|
+
|
|
1469
1737
|
Object.defineProperty(exports, "__esModule", {
|
|
1470
1738
|
value: true
|
|
1471
1739
|
});
|
|
1740
|
+
|
|
1472
1741
|
var React = __webpack_require__(1);
|
|
1742
|
+
|
|
1473
1743
|
var lodash_1 = __webpack_require__(3);
|
|
1474
|
-
|
|
1744
|
+
|
|
1745
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1746
|
+
|
|
1475
1747
|
var Options_1 = __webpack_require__(30);
|
|
1476
|
-
|
|
1748
|
+
|
|
1749
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1750
|
+
|
|
1477
1751
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
1478
|
-
|
|
1752
|
+
|
|
1753
|
+
var moment_1 = __webpack_require__(40);
|
|
1754
|
+
|
|
1479
1755
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1756
|
+
|
|
1480
1757
|
var styled_components_1 = __webpack_require__(4);
|
|
1758
|
+
|
|
1481
1759
|
var hocUtils_1 = __webpack_require__(27);
|
|
1760
|
+
|
|
1482
1761
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
1483
|
-
|
|
1762
|
+
|
|
1763
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1764
|
+
|
|
1484
1765
|
var id_1 = __webpack_require__(25);
|
|
1485
|
-
|
|
1766
|
+
|
|
1767
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1768
|
+
|
|
1486
1769
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1770
|
+
|
|
1487
1771
|
var getSorting_1 = __webpack_require__(33);
|
|
1488
|
-
|
|
1772
|
+
|
|
1773
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1774
|
+
|
|
1489
1775
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1776
|
+
|
|
1490
1777
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1778
|
+
|
|
1491
1779
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1780
|
+
|
|
1492
1781
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
1493
1782
|
/**
|
|
1494
1783
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1495
1784
|
* @param {DashboardVizOpts} opts
|
|
1496
1785
|
* @returns {HOC}
|
|
1497
1786
|
*/
|
|
1787
|
+
|
|
1788
|
+
|
|
1498
1789
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
1499
1790
|
var ReactViz = opts.ReactViz,
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1791
|
+
vizConfig = opts.vizConfig,
|
|
1792
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1793
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1794
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1795
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1796
|
+
|
|
1505
1797
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
1506
1798
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1799
|
+
|
|
1507
1800
|
var DashboardViz = function DashboardViz(props) {
|
|
1508
1801
|
var _a;
|
|
1802
|
+
|
|
1509
1803
|
var mode = props.mode,
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1804
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1805
|
+
dataSources = props.dataSources,
|
|
1806
|
+
options = props.options,
|
|
1807
|
+
_props$context = props.context,
|
|
1808
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1809
|
+
width = props.width,
|
|
1810
|
+
height = props.height,
|
|
1811
|
+
onComputedProps = props.onComputedProps,
|
|
1812
|
+
onEventTrigger = props.onEventTrigger,
|
|
1813
|
+
theme = props.theme,
|
|
1814
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1815
|
+
|
|
1521
1816
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
1522
|
-
|
|
1817
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1818
|
+
|
|
1523
1819
|
if (serializedTimezone) {
|
|
1524
1820
|
/*
|
|
1525
1821
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -1533,38 +1829,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1533
1829
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1534
1830
|
}
|
|
1535
1831
|
}
|
|
1832
|
+
|
|
1536
1833
|
var themeFunc = function themeFunc(themeVar) {
|
|
1537
1834
|
var _a, _b;
|
|
1835
|
+
|
|
1538
1836
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
1539
1837
|
};
|
|
1838
|
+
|
|
1540
1839
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1840
|
+
|
|
1541
1841
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1842
|
+
theme: theme
|
|
1843
|
+
}),
|
|
1844
|
+
currentThemeFamily = _ref.family,
|
|
1845
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1846
|
+
currentThemeDensity = _ref.density;
|
|
1847
|
+
|
|
1547
1848
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1849
|
+
|
|
1548
1850
|
var _React$useState = React.useState({}),
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1851
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1852
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1853
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1854
|
+
|
|
1855
|
+
|
|
1552
1856
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1857
|
+
|
|
1553
1858
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
1554
|
-
|
|
1555
|
-
|
|
1859
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1860
|
+
visualizationID = _React$useState4[0];
|
|
1861
|
+
|
|
1556
1862
|
var _React$useState5 = React.useState({}),
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1863
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1864
|
+
dataSourcesInState = _React$useState6[0],
|
|
1865
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1866
|
+
|
|
1560
1867
|
var _React$useState7 = React.useState(),
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1868
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1869
|
+
dataFramesInState = _React$useState8[0],
|
|
1870
|
+
setDataFramesInState = _React$useState8[1];
|
|
1871
|
+
|
|
1564
1872
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1873
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1874
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1875
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1876
|
+
|
|
1568
1877
|
var isMounted = React.useRef(true);
|
|
1569
1878
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1570
1879
|
try {
|
|
@@ -1589,11 +1898,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1589
1898
|
});
|
|
1590
1899
|
} else {
|
|
1591
1900
|
var dataFrames = dataFramesInState;
|
|
1901
|
+
|
|
1592
1902
|
if (dataSources !== dataSourcesInState) {
|
|
1593
1903
|
setDataSourcesInState(dataSources);
|
|
1594
1904
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1595
1905
|
setDataFramesInState(dataFrames);
|
|
1596
1906
|
}
|
|
1907
|
+
|
|
1597
1908
|
return Options_1.Options.evaluate({
|
|
1598
1909
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1599
1910
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -1604,21 +1915,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1604
1915
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1605
1916
|
return {};
|
|
1606
1917
|
}
|
|
1918
|
+
|
|
1607
1919
|
return {};
|
|
1608
1920
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1609
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1610
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1921
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1611
1922
|
// 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
1923
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1924
|
+
|
|
1613
1925
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1614
1926
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1927
|
+
|
|
1615
1928
|
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
1929
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1617
1930
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1618
1931
|
});
|
|
1619
|
-
}
|
|
1620
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1932
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1621
1933
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1934
|
+
|
|
1935
|
+
|
|
1622
1936
|
React.useEffect(function () {
|
|
1623
1937
|
onComputedProps(clonedEvaluatedOptions);
|
|
1624
1938
|
});
|
|
@@ -1628,44 +1942,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1628
1942
|
isMounted.current = false;
|
|
1629
1943
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1630
1944
|
}
|
|
1631
|
-
};
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
// present warning message if any required props are missing
|
|
1945
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1946
|
+
}, []); // present warning message if any required props are missing
|
|
1947
|
+
|
|
1635
1948
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1636
|
-
|
|
1637
|
-
|
|
1949
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1950
|
+
supports = vizConfig.supports;
|
|
1638
1951
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1952
|
+
|
|
1639
1953
|
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
1954
|
) {
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1955
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1956
|
+
"data-test": "missing-props-message",
|
|
1957
|
+
width: width,
|
|
1958
|
+
height: height,
|
|
1959
|
+
missingProps: missing,
|
|
1960
|
+
backgroundColor: bgColorFromTheme
|
|
1961
|
+
});
|
|
1962
|
+
} // events
|
|
1963
|
+
|
|
1964
|
+
|
|
1650
1965
|
var eventCallbackProps = {};
|
|
1966
|
+
|
|
1651
1967
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1652
1968
|
var supportedEvents = vizConfig.events;
|
|
1653
1969
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1654
1970
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1655
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1656
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1971
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1657
1972
|
// then remove these lines
|
|
1973
|
+
|
|
1658
1974
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1659
1975
|
var payload = {};
|
|
1976
|
+
|
|
1660
1977
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1661
1978
|
payloadKeys.forEach(function (p) {
|
|
1662
1979
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1663
1980
|
});
|
|
1664
1981
|
}
|
|
1982
|
+
|
|
1665
1983
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1666
1984
|
if (ev && ev.payload) {
|
|
1667
1985
|
payload = ev.payload;
|
|
1668
1986
|
}
|
|
1987
|
+
|
|
1669
1988
|
return onEventTrigger({
|
|
1670
1989
|
originalEvent: ev,
|
|
1671
1990
|
payload: payload,
|
|
@@ -1673,8 +1992,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1673
1992
|
});
|
|
1674
1993
|
};
|
|
1675
1994
|
});
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1995
|
+
} // compute pure viz props which are not from options
|
|
1996
|
+
|
|
1997
|
+
|
|
1678
1998
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1679
1999
|
themeFunc: themeFunc
|
|
1680
2000
|
}));
|
|
@@ -1692,15 +2012,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1692
2012
|
* In future, we could automatically detect which all datasources are being used
|
|
1693
2013
|
* and bind those magically to pagination/sorting behavior.
|
|
1694
2014
|
*/
|
|
2015
|
+
|
|
1695
2016
|
var dataSourceMetadata = {};
|
|
1696
2017
|
var OptionKey = 'paginateDataSourceKey';
|
|
1697
2018
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
2019
|
+
|
|
1698
2020
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1699
2021
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1700
2022
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
2023
|
+
|
|
1701
2024
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1702
2025
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1703
2026
|
};
|
|
2027
|
+
|
|
1704
2028
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1705
2029
|
requestParams: requestParams,
|
|
1706
2030
|
meta: meta,
|
|
@@ -1715,115 +2039,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1715
2039
|
sortParams: sortParams,
|
|
1716
2040
|
paginatorParams: paginatorParams
|
|
1717
2041
|
};
|
|
1718
|
-
}
|
|
1719
|
-
|
|
2042
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
2043
|
+
|
|
2044
|
+
|
|
1720
2045
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1721
2046
|
return null;
|
|
1722
2047
|
}
|
|
2048
|
+
|
|
1723
2049
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1724
2050
|
mode: mode,
|
|
1725
2051
|
width: width,
|
|
1726
2052
|
height: height
|
|
1727
2053
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1728
2054
|
};
|
|
2055
|
+
|
|
1729
2056
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1730
2057
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1731
2058
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1732
2059
|
theme: {}
|
|
1733
|
-
});
|
|
1734
|
-
|
|
1735
|
-
DashboardViz.config = vizConfig;
|
|
1736
|
-
|
|
2060
|
+
}); // attach viz config
|
|
2061
|
+
|
|
2062
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
2063
|
+
|
|
1737
2064
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1738
2065
|
};
|
|
2066
|
+
|
|
1739
2067
|
exports.default = withDashboardViz;
|
|
1740
2068
|
|
|
1741
2069
|
/***/ }),
|
|
1742
2070
|
|
|
1743
|
-
/***/
|
|
2071
|
+
/***/ 38:
|
|
1744
2072
|
/***/ (function(module, exports) {
|
|
1745
2073
|
|
|
1746
2074
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1747
2075
|
|
|
1748
2076
|
/***/ }),
|
|
1749
2077
|
|
|
1750
|
-
/***/
|
|
2078
|
+
/***/ 39:
|
|
1751
2079
|
/***/ (function(module, exports) {
|
|
1752
2080
|
|
|
1753
2081
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1754
2082
|
|
|
1755
2083
|
/***/ }),
|
|
1756
2084
|
|
|
1757
|
-
/***/
|
|
2085
|
+
/***/ 4:
|
|
1758
2086
|
/***/ (function(module, exports) {
|
|
1759
2087
|
|
|
1760
|
-
module.exports = require("
|
|
2088
|
+
module.exports = require("styled-components");
|
|
1761
2089
|
|
|
1762
2090
|
/***/ }),
|
|
1763
2091
|
|
|
1764
|
-
/***/
|
|
2092
|
+
/***/ 40:
|
|
1765
2093
|
/***/ (function(module, exports) {
|
|
1766
2094
|
|
|
1767
|
-
module.exports = require("
|
|
2095
|
+
module.exports = require("@splunk/moment");
|
|
1768
2096
|
|
|
1769
2097
|
/***/ }),
|
|
1770
2098
|
|
|
1771
|
-
/***/
|
|
2099
|
+
/***/ 41:
|
|
1772
2100
|
/***/ (function(module, exports) {
|
|
1773
2101
|
|
|
1774
2102
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1775
2103
|
|
|
1776
2104
|
/***/ }),
|
|
1777
2105
|
|
|
1778
|
-
/***/
|
|
2106
|
+
/***/ 42:
|
|
1779
2107
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1780
2108
|
|
|
1781
2109
|
"use strict";
|
|
1782
2110
|
|
|
1783
2111
|
|
|
1784
2112
|
var _classCallCheck = __webpack_require__(9);
|
|
2113
|
+
|
|
1785
2114
|
Object.defineProperty(exports, "__esModule", {
|
|
1786
2115
|
value: true
|
|
1787
2116
|
});
|
|
1788
2117
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1789
2118
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
2119
|
+
|
|
1790
2120
|
var T = __webpack_require__(0);
|
|
2121
|
+
|
|
1791
2122
|
var lodash_1 = __webpack_require__(3);
|
|
1792
|
-
|
|
1793
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2123
|
+
|
|
2124
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2125
|
+
|
|
2126
|
+
|
|
1794
2127
|
exports.INITIAL_WIDTH = 250;
|
|
1795
2128
|
exports.INITIAL_HEIGHT = 250;
|
|
1796
2129
|
/**
|
|
1797
2130
|
* A Splunk visualization
|
|
1798
2131
|
*/
|
|
2132
|
+
|
|
1799
2133
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1800
2134
|
_classCallCheck(this, SplunkVisualization);
|
|
1801
2135
|
};
|
|
2136
|
+
|
|
1802
2137
|
SplunkVisualization.propTypes = {
|
|
1803
2138
|
/**
|
|
1804
2139
|
* display mode
|
|
1805
2140
|
*/
|
|
1806
2141
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
2142
|
+
|
|
1807
2143
|
/**
|
|
1808
2144
|
* width in pixel or string, defaults to 100%
|
|
1809
2145
|
*/
|
|
1810
2146
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
2147
|
+
|
|
1811
2148
|
/**
|
|
1812
2149
|
* height in pixel or string
|
|
1813
2150
|
*/
|
|
1814
2151
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
2152
|
+
|
|
1815
2153
|
/**
|
|
1816
2154
|
* visualization context used for dynamic option evaluation
|
|
1817
2155
|
*/
|
|
1818
2156
|
context: T.object,
|
|
2157
|
+
|
|
1819
2158
|
/**
|
|
1820
2159
|
* visualization formatting options
|
|
1821
2160
|
*/
|
|
1822
2161
|
options: T.object,
|
|
2162
|
+
|
|
1823
2163
|
/**
|
|
1824
2164
|
* A callback to update formatting options
|
|
1825
2165
|
*/
|
|
1826
2166
|
onOptionsChange: T.func,
|
|
2167
|
+
|
|
1827
2168
|
/**
|
|
1828
2169
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1829
2170
|
*/
|
|
@@ -1832,6 +2173,7 @@ SplunkVisualization.propTypes = {
|
|
|
1832
2173
|
* current request params
|
|
1833
2174
|
*/
|
|
1834
2175
|
requestParams: T.object,
|
|
2176
|
+
|
|
1835
2177
|
/**
|
|
1836
2178
|
* current dataset
|
|
1837
2179
|
*/
|
|
@@ -1839,6 +2181,7 @@ SplunkVisualization.propTypes = {
|
|
|
1839
2181
|
fields: T.array,
|
|
1840
2182
|
columns: T.array
|
|
1841
2183
|
}),
|
|
2184
|
+
|
|
1842
2185
|
/**
|
|
1843
2186
|
* error
|
|
1844
2187
|
*/
|
|
@@ -1846,29 +2189,35 @@ SplunkVisualization.propTypes = {
|
|
|
1846
2189
|
level: T.string,
|
|
1847
2190
|
message: T.string
|
|
1848
2191
|
}),
|
|
2192
|
+
|
|
1849
2193
|
/**
|
|
1850
2194
|
* meta data that came with the dataset
|
|
1851
2195
|
*/
|
|
1852
2196
|
meta: T.object
|
|
1853
2197
|
})),
|
|
2198
|
+
|
|
1854
2199
|
/**
|
|
1855
2200
|
* A callback to trigger event
|
|
1856
2201
|
*/
|
|
1857
2202
|
onEventTrigger: T.func,
|
|
2203
|
+
|
|
1858
2204
|
/**
|
|
1859
2205
|
* Inform viz if there are handlers listening to events
|
|
1860
2206
|
*/
|
|
1861
2207
|
hasEventHandlers: T.bool,
|
|
2208
|
+
|
|
1862
2209
|
/**
|
|
1863
2210
|
* A callback to communicate computed props to a consumer
|
|
1864
2211
|
*/
|
|
1865
2212
|
onComputedProps: T.func,
|
|
2213
|
+
|
|
1866
2214
|
/**
|
|
1867
2215
|
* A callback to obtain visualization api
|
|
1868
2216
|
*/
|
|
1869
2217
|
vizActionHandlerRef: T.func,
|
|
1870
2218
|
loading: T.bool,
|
|
1871
2219
|
theme: T.object,
|
|
2220
|
+
|
|
1872
2221
|
/**
|
|
1873
2222
|
* A callback to request new data with updated request params
|
|
1874
2223
|
*/
|
|
@@ -1877,6 +2226,7 @@ SplunkVisualization.propTypes = {
|
|
|
1877
2226
|
/**
|
|
1878
2227
|
*
|
|
1879
2228
|
*/
|
|
2229
|
+
|
|
1880
2230
|
SplunkVisualization.defaultProps = {
|
|
1881
2231
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1882
2232
|
width: '100%',
|
|
@@ -1905,26 +2255,29 @@ exports.default = SplunkVisualization;
|
|
|
1905
2255
|
|
|
1906
2256
|
/***/ }),
|
|
1907
2257
|
|
|
1908
|
-
/***/
|
|
2258
|
+
/***/ 43:
|
|
1909
2259
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1910
2260
|
|
|
1911
2261
|
"use strict";
|
|
1912
2262
|
|
|
1913
2263
|
|
|
1914
2264
|
var _classCallCheck = __webpack_require__(9);
|
|
2265
|
+
|
|
1915
2266
|
var _createClass = __webpack_require__(18);
|
|
2267
|
+
|
|
1916
2268
|
Object.defineProperty(exports, "__esModule", {
|
|
1917
2269
|
value: true
|
|
1918
2270
|
});
|
|
1919
2271
|
exports.DefaultVizActionHandler = void 0;
|
|
2272
|
+
|
|
1920
2273
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1921
2274
|
function DefaultVizActionHandler() {
|
|
1922
2275
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1923
2276
|
}
|
|
2277
|
+
|
|
1924
2278
|
_createClass(DefaultVizActionHandler, [{
|
|
1925
2279
|
key: "focus",
|
|
1926
|
-
value: function focus() {
|
|
1927
|
-
// noop
|
|
2280
|
+
value: function focus() {// noop
|
|
1928
2281
|
}
|
|
1929
2282
|
}, {
|
|
1930
2283
|
key: "snapshot",
|
|
@@ -1932,23 +2285,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1932
2285
|
return null; // noop
|
|
1933
2286
|
}
|
|
1934
2287
|
}]);
|
|
2288
|
+
|
|
1935
2289
|
return DefaultVizActionHandler;
|
|
1936
2290
|
}();
|
|
1937
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1938
|
-
|
|
1939
|
-
/***/ }),
|
|
1940
|
-
|
|
1941
|
-
/***/ 43:
|
|
1942
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1943
|
-
|
|
1944
|
-
"use strict";
|
|
1945
2291
|
|
|
1946
|
-
|
|
1947
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1948
|
-
value: true
|
|
1949
|
-
});
|
|
1950
|
-
exports.validSortDirs = void 0;
|
|
1951
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
2292
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1952
2293
|
|
|
1953
2294
|
/***/ }),
|
|
1954
2295
|
|
|
@@ -1962,7 +2303,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1962
2303
|
value: true
|
|
1963
2304
|
});
|
|
1964
2305
|
exports.useDeepMemo = void 0;
|
|
2306
|
+
|
|
1965
2307
|
var react_1 = __webpack_require__(1);
|
|
2308
|
+
|
|
1966
2309
|
var lodash_1 = __webpack_require__(3);
|
|
1967
2310
|
/**
|
|
1968
2311
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1977,16 +2320,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1977
2320
|
* @param fn the function to be executed and
|
|
1978
2321
|
* @param dependencies an array of dependencies
|
|
1979
2322
|
*/
|
|
2323
|
+
|
|
2324
|
+
|
|
1980
2325
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1981
2326
|
var ref = (0, react_1.useRef)();
|
|
2327
|
+
|
|
1982
2328
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1983
2329
|
ref.current = {
|
|
1984
2330
|
dependencies: dependencies,
|
|
1985
2331
|
value: fn()
|
|
1986
2332
|
};
|
|
1987
2333
|
}
|
|
2334
|
+
|
|
1988
2335
|
return ref.current.value;
|
|
1989
2336
|
};
|
|
2337
|
+
|
|
1990
2338
|
exports.useDeepMemo = useDeepMemo;
|
|
1991
2339
|
|
|
1992
2340
|
/***/ }),
|
|
@@ -2001,19 +2349,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2001
2349
|
value: true
|
|
2002
2350
|
});
|
|
2003
2351
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
2352
|
+
|
|
2004
2353
|
var React = __webpack_require__(1);
|
|
2354
|
+
|
|
2005
2355
|
var T = __webpack_require__(0);
|
|
2356
|
+
|
|
2006
2357
|
var i18n_1 = __webpack_require__(2);
|
|
2358
|
+
|
|
2007
2359
|
var Message_1 = __webpack_require__(10);
|
|
2360
|
+
|
|
2008
2361
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
2009
2362
|
/**
|
|
2010
2363
|
* @method isMissing
|
|
2011
2364
|
* @param {any} v
|
|
2012
2365
|
* @returns {boolean} true if the input value === null or undefined
|
|
2013
2366
|
*/
|
|
2367
|
+
|
|
2368
|
+
|
|
2014
2369
|
var isMissing = function isMissing(v) {
|
|
2015
2370
|
return v === null || v === undefined;
|
|
2016
2371
|
};
|
|
2372
|
+
|
|
2017
2373
|
exports.isMissing = isMissing;
|
|
2018
2374
|
/**
|
|
2019
2375
|
* @method misskingKeys
|
|
@@ -2021,11 +2377,13 @@ exports.isMissing = isMissing;
|
|
|
2021
2377
|
* @param {object} target
|
|
2022
2378
|
* @returns {string[]} the keys of missing required props
|
|
2023
2379
|
*/
|
|
2380
|
+
|
|
2024
2381
|
var missingKeys = function missingKeys(keys, target) {
|
|
2025
2382
|
return keys.filter(function (k) {
|
|
2026
2383
|
return (0, exports.isMissing)(target[k]);
|
|
2027
2384
|
});
|
|
2028
2385
|
};
|
|
2386
|
+
|
|
2029
2387
|
exports.missingKeys = missingKeys;
|
|
2030
2388
|
var propTypes = {
|
|
2031
2389
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -2039,10 +2397,11 @@ var propTypes = {
|
|
|
2039
2397
|
* @param {MissingPropsProps} props
|
|
2040
2398
|
* @returns {React.ReactElement}
|
|
2041
2399
|
*/
|
|
2400
|
+
|
|
2042
2401
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
2043
2402
|
var width = props.width,
|
|
2044
|
-
|
|
2045
|
-
|
|
2403
|
+
height = props.height,
|
|
2404
|
+
missingProps = props.missingProps;
|
|
2046
2405
|
return React.createElement(Message_1.default, {
|
|
2047
2406
|
"data-test": "message",
|
|
2048
2407
|
width: width,
|
|
@@ -2050,6 +2409,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
2050
2409
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
2051
2410
|
});
|
|
2052
2411
|
};
|
|
2412
|
+
|
|
2053
2413
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
2054
2414
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
2055
2415
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -2069,6 +2429,7 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
2069
2429
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
2070
2430
|
if (k2 === undefined) k2 = k;
|
|
2071
2431
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2432
|
+
|
|
2072
2433
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
2073
2434
|
desc = {
|
|
2074
2435
|
enumerable: true,
|
|
@@ -2077,22 +2438,28 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
2077
2438
|
}
|
|
2078
2439
|
};
|
|
2079
2440
|
}
|
|
2441
|
+
|
|
2080
2442
|
Object.defineProperty(o, k2, desc);
|
|
2081
2443
|
} : function (o, m, k, k2) {
|
|
2082
2444
|
if (k2 === undefined) k2 = k;
|
|
2083
2445
|
o[k2] = m[k];
|
|
2084
2446
|
});
|
|
2447
|
+
|
|
2085
2448
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
2086
2449
|
for (var p in m) {
|
|
2087
2450
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2088
2451
|
}
|
|
2089
2452
|
};
|
|
2453
|
+
|
|
2090
2454
|
Object.defineProperty(exports, "__esModule", {
|
|
2091
2455
|
value: true
|
|
2092
2456
|
});
|
|
2093
2457
|
exports.default = void 0;
|
|
2458
|
+
|
|
2094
2459
|
__exportStar(__webpack_require__(166), exports);
|
|
2460
|
+
|
|
2095
2461
|
var Sankey_1 = __webpack_require__(166);
|
|
2462
|
+
|
|
2096
2463
|
Object.defineProperty(exports, "default", {
|
|
2097
2464
|
enumerable: true,
|
|
2098
2465
|
get: function get() {
|
|
@@ -2115,43 +2482,50 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2115
2482
|
/* harmony import */ var d3_collection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(141);
|
|
2116
2483
|
/* harmony import */ var d3_collection__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(d3_collection__WEBPACK_IMPORTED_MODULE_2__);
|
|
2117
2484
|
// reference link :- https://github.com/csaladenes/sankey
|
|
2485
|
+
|
|
2118
2486
|
/* eslint-disable */
|
|
2119
2487
|
|
|
2120
2488
|
|
|
2121
2489
|
|
|
2122
2490
|
var d3_sankey = function d3_sankey() {
|
|
2123
2491
|
var sankey = {},
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2492
|
+
nodeWidth = 24,
|
|
2493
|
+
nodePadding = 8,
|
|
2494
|
+
size = [1, 1],
|
|
2495
|
+
nodes = [],
|
|
2496
|
+
links = [],
|
|
2497
|
+
components = [];
|
|
2498
|
+
|
|
2130
2499
|
sankey.nodeWidth = function (_) {
|
|
2131
2500
|
if (!arguments.length) return nodeWidth;
|
|
2132
2501
|
nodeWidth = +_;
|
|
2133
2502
|
return sankey;
|
|
2134
2503
|
};
|
|
2504
|
+
|
|
2135
2505
|
sankey.nodePadding = function (_) {
|
|
2136
2506
|
if (!arguments.length) return nodePadding;
|
|
2137
2507
|
nodePadding = +_;
|
|
2138
2508
|
return sankey;
|
|
2139
2509
|
};
|
|
2510
|
+
|
|
2140
2511
|
sankey.nodes = function (_) {
|
|
2141
2512
|
if (!arguments.length) return nodes;
|
|
2142
2513
|
nodes = _;
|
|
2143
2514
|
return sankey;
|
|
2144
2515
|
};
|
|
2516
|
+
|
|
2145
2517
|
sankey.links = function (_) {
|
|
2146
2518
|
if (!arguments.length) return links;
|
|
2147
2519
|
links = _;
|
|
2148
2520
|
return sankey;
|
|
2149
2521
|
};
|
|
2522
|
+
|
|
2150
2523
|
sankey.size = function (_) {
|
|
2151
2524
|
if (!arguments.length) return size;
|
|
2152
2525
|
size = _;
|
|
2153
2526
|
return sankey;
|
|
2154
2527
|
};
|
|
2528
|
+
|
|
2155
2529
|
sankey.layout = function (iterations) {
|
|
2156
2530
|
computeNodeLinks();
|
|
2157
2531
|
computeNodeValues();
|
|
@@ -2161,12 +2535,11 @@ var d3_sankey = function d3_sankey() {
|
|
|
2161
2535
|
computeLinkDepths();
|
|
2162
2536
|
return sankey;
|
|
2163
2537
|
};
|
|
2538
|
+
|
|
2164
2539
|
sankey.relayout = function () {
|
|
2165
2540
|
computeLinkDepths();
|
|
2166
2541
|
return sankey;
|
|
2167
|
-
};
|
|
2168
|
-
|
|
2169
|
-
// A more involved path generator that requires 3 elements to render --
|
|
2542
|
+
}; // A more involved path generator that requires 3 elements to render --
|
|
2170
2543
|
// It draws a starting element, intermediate and end element that are useful
|
|
2171
2544
|
// while drawing reverse links to get an appropriate fill.
|
|
2172
2545
|
//
|
|
@@ -2189,32 +2562,34 @@ var d3_sankey = function d3_sankey() {
|
|
|
2189
2562
|
// .attr("d", path(i))
|
|
2190
2563
|
// .attr("fill", ...)
|
|
2191
2564
|
// }
|
|
2192
|
-
sankey.reversibleLink = function () {
|
|
2193
|
-
var curvature = 0.5;
|
|
2194
2565
|
|
|
2195
|
-
|
|
2566
|
+
|
|
2567
|
+
sankey.reversibleLink = function () {
|
|
2568
|
+
var curvature = 0.5; // Used when source is behind target, the first and last paths are simple
|
|
2196
2569
|
// lines at the start and end node while the second path is the spline
|
|
2570
|
+
|
|
2197
2571
|
function forwardLink(part, d) {
|
|
2198
2572
|
var x0 = d.source.x + d.source.dx,
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2573
|
+
x1 = d.target.x,
|
|
2574
|
+
xi = Object(d3_interpolate__WEBPACK_IMPORTED_MODULE_0__["interpolateNumber"])(x0, x1),
|
|
2575
|
+
x2 = xi(curvature),
|
|
2576
|
+
x3 = xi(1 - curvature),
|
|
2577
|
+
y0 = d.source.y + d.sy,
|
|
2578
|
+
y1 = d.target.y + d.ty,
|
|
2579
|
+
y2 = d.source.y + d.sy + d.dy,
|
|
2580
|
+
y3 = d.target.y + d.ty + d.dy;
|
|
2581
|
+
|
|
2207
2582
|
switch (part) {
|
|
2208
2583
|
case 0:
|
|
2209
2584
|
return 'M' + x0 + ',' + y0 + 'L' + x0 + ',' + (y0 + d.dy);
|
|
2585
|
+
|
|
2210
2586
|
case 1:
|
|
2211
2587
|
return 'M' + x0 + ',' + y0 + 'C' + x2 + ',' + y0 + ' ' + x3 + ',' + y1 + ' ' + x1 + ',' + y1 + 'L' + x1 + ',' + y3 + 'C' + x3 + ',' + y3 + ' ' + x2 + ',' + y2 + ' ' + x0 + ',' + y2 + 'Z';
|
|
2588
|
+
|
|
2212
2589
|
case 2:
|
|
2213
2590
|
return 'M' + x1 + ',' + y1 + 'L' + x1 + ',' + (y1 + d.dy);
|
|
2214
2591
|
}
|
|
2215
|
-
}
|
|
2216
|
-
|
|
2217
|
-
// Used for self loops and when the source is actually in front of the
|
|
2592
|
+
} // Used for self loops and when the source is actually in front of the
|
|
2218
2593
|
// target; the first element is a turning path from the source to the
|
|
2219
2594
|
// destination, the second element connects the two twists and the last
|
|
2220
2595
|
// twists into the target element.
|
|
@@ -2224,29 +2599,38 @@ var d3_sankey = function d3_sankey() {
|
|
|
2224
2599
|
// \----------------------\
|
|
2225
2600
|
// Source--/
|
|
2226
2601
|
//
|
|
2602
|
+
|
|
2603
|
+
|
|
2227
2604
|
function backwardLink(part, d) {
|
|
2228
2605
|
var curveExtension = 30;
|
|
2229
2606
|
var curveDepth = 15;
|
|
2607
|
+
|
|
2230
2608
|
function getDir(d) {
|
|
2231
2609
|
return d.source.y + d.sy > d.target.y + d.ty ? -1 : 1;
|
|
2232
2610
|
}
|
|
2611
|
+
|
|
2233
2612
|
function p(x, y) {
|
|
2234
2613
|
return x + ',' + y + ' ';
|
|
2235
2614
|
}
|
|
2615
|
+
|
|
2236
2616
|
var dt = getDir(d) * curveDepth,
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2617
|
+
x0 = d.source.x + d.source.dx,
|
|
2618
|
+
y0 = d.source.y + d.sy,
|
|
2619
|
+
x1 = d.target.x,
|
|
2620
|
+
y1 = d.target.y + d.ty;
|
|
2621
|
+
|
|
2241
2622
|
switch (part) {
|
|
2242
2623
|
case 0:
|
|
2243
2624
|
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';
|
|
2625
|
+
|
|
2244
2626
|
case 1:
|
|
2245
2627
|
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';
|
|
2628
|
+
|
|
2246
2629
|
case 2:
|
|
2247
2630
|
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
2631
|
}
|
|
2249
2632
|
}
|
|
2633
|
+
|
|
2250
2634
|
return function (part) {
|
|
2251
2635
|
return function (d) {
|
|
2252
2636
|
if (d.source.x < d.target.x) {
|
|
@@ -2256,32 +2640,35 @@ var d3_sankey = function d3_sankey() {
|
|
|
2256
2640
|
}
|
|
2257
2641
|
};
|
|
2258
2642
|
};
|
|
2259
|
-
};
|
|
2260
|
-
|
|
2261
|
-
// The standard link path using a constant width spline that needs a
|
|
2643
|
+
}; // The standard link path using a constant width spline that needs a
|
|
2262
2644
|
// single path element.
|
|
2645
|
+
|
|
2646
|
+
|
|
2263
2647
|
sankey.link = function () {
|
|
2264
2648
|
var curvature = 0.5;
|
|
2649
|
+
|
|
2265
2650
|
function link(d) {
|
|
2266
2651
|
var x0 = d.source.x + d.source.dx,
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2652
|
+
x1 = d.target.x,
|
|
2653
|
+
xi = Object(d3_interpolate__WEBPACK_IMPORTED_MODULE_0__["interpolateNumber"])(x0, x1),
|
|
2654
|
+
x2 = xi(curvature),
|
|
2655
|
+
x3 = xi(1 - curvature),
|
|
2656
|
+
y0 = d.source.y + d.sy + d.dy / 2,
|
|
2657
|
+
y1 = d.target.y + d.ty + d.dy / 2;
|
|
2273
2658
|
return 'M' + x0 + ',' + y0 + 'C' + x2 + ',' + y0 + ' ' + x3 + ',' + y1 + ' ' + x1 + ',' + y1;
|
|
2274
2659
|
}
|
|
2660
|
+
|
|
2275
2661
|
link.curvature = function (_) {
|
|
2276
2662
|
if (!arguments.length) return curvature;
|
|
2277
2663
|
curvature = +_;
|
|
2278
2664
|
return link;
|
|
2279
2665
|
};
|
|
2280
|
-
return link;
|
|
2281
|
-
};
|
|
2282
2666
|
|
|
2283
|
-
|
|
2667
|
+
return link;
|
|
2668
|
+
}; // Populate the sourceLinks and targetLinks for each node.
|
|
2284
2669
|
// Also, if the source and target are not objects, assume they are indices.
|
|
2670
|
+
|
|
2671
|
+
|
|
2285
2672
|
function computeNodeLinks() {
|
|
2286
2673
|
nodes.forEach(function (node) {
|
|
2287
2674
|
node.sourceLinks = [];
|
|
@@ -2289,44 +2676,46 @@ var d3_sankey = function d3_sankey() {
|
|
|
2289
2676
|
});
|
|
2290
2677
|
links.forEach(function (link) {
|
|
2291
2678
|
var source = link.source,
|
|
2292
|
-
|
|
2679
|
+
target = link.target;
|
|
2293
2680
|
if (typeof source === 'number') source = link.source = nodes[link.source];
|
|
2294
2681
|
if (typeof target === 'number') target = link.target = nodes[link.target];
|
|
2295
2682
|
source.sourceLinks.push(link);
|
|
2296
2683
|
target.targetLinks.push(link);
|
|
2297
2684
|
});
|
|
2298
|
-
}
|
|
2685
|
+
} // Compute the value (size) of each node by summing the associated links.
|
|
2686
|
+
|
|
2299
2687
|
|
|
2300
|
-
// Compute the value (size) of each node by summing the associated links.
|
|
2301
2688
|
function computeNodeValues() {
|
|
2302
2689
|
nodes.forEach(function (node) {
|
|
2303
|
-
if (!node.value)
|
|
2304
|
-
//if not already given
|
|
2690
|
+
if (!node.value) //if not already given
|
|
2305
2691
|
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
2692
|
});
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
|
-
// Take the list of nodes and create a DAG of supervertices, each consisting
|
|
2693
|
+
} // Take the list of nodes and create a DAG of supervertices, each consisting
|
|
2310
2694
|
// of a strongly connected component of the graph
|
|
2311
2695
|
//
|
|
2312
2696
|
// Based off:
|
|
2313
2697
|
// http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm
|
|
2698
|
+
|
|
2699
|
+
|
|
2314
2700
|
function computeNodeStructure() {
|
|
2315
2701
|
var nodeStack = [],
|
|
2316
|
-
|
|
2702
|
+
index = 0;
|
|
2317
2703
|
nodes.forEach(function (node) {
|
|
2318
2704
|
if (!node.index) {
|
|
2319
2705
|
connect(node);
|
|
2320
2706
|
}
|
|
2321
2707
|
});
|
|
2708
|
+
|
|
2322
2709
|
function connect(node) {
|
|
2323
2710
|
node.index = index++;
|
|
2324
2711
|
node.lowIndex = node.index;
|
|
2325
2712
|
node.onStack = true;
|
|
2326
2713
|
nodeStack.push(node);
|
|
2714
|
+
|
|
2327
2715
|
if (node.sourceLinks) {
|
|
2328
2716
|
node.sourceLinks.forEach(function (sourceLink) {
|
|
2329
2717
|
var target = sourceLink.target;
|
|
2718
|
+
|
|
2330
2719
|
if (!target.hasOwnProperty('index')) {
|
|
2331
2720
|
connect(target);
|
|
2332
2721
|
node.lowIndex = Math.min(node.lowIndex, target.lowIndex);
|
|
@@ -2334,14 +2723,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2334
2723
|
node.lowIndex = Math.min(node.lowIndex, target.index);
|
|
2335
2724
|
}
|
|
2336
2725
|
});
|
|
2726
|
+
|
|
2337
2727
|
if (node.lowIndex === node.index) {
|
|
2338
2728
|
var component = [],
|
|
2339
|
-
|
|
2729
|
+
currentNode;
|
|
2730
|
+
|
|
2340
2731
|
do {
|
|
2341
2732
|
currentNode = nodeStack.pop();
|
|
2342
2733
|
currentNode.onStack = false;
|
|
2343
2734
|
component.push(currentNode);
|
|
2344
2735
|
} while (currentNode != node);
|
|
2736
|
+
|
|
2345
2737
|
components.push({
|
|
2346
2738
|
root: node,
|
|
2347
2739
|
scc: component
|
|
@@ -2349,16 +2741,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2349
2741
|
}
|
|
2350
2742
|
}
|
|
2351
2743
|
}
|
|
2744
|
+
|
|
2352
2745
|
components.forEach(function (component, i) {
|
|
2353
2746
|
component.index = i;
|
|
2354
2747
|
component.scc.forEach(function (node) {
|
|
2355
2748
|
node.component = i;
|
|
2356
2749
|
});
|
|
2357
2750
|
});
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
// Assign the breadth (x-position) for each strongly connected component,
|
|
2751
|
+
} // Assign the breadth (x-position) for each strongly connected component,
|
|
2361
2752
|
// followed by assigning breadth within the component.
|
|
2753
|
+
|
|
2754
|
+
|
|
2362
2755
|
function computeNodeBreadths() {
|
|
2363
2756
|
layerComponents();
|
|
2364
2757
|
components.forEach(function (component, i) {
|
|
@@ -2378,7 +2771,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2378
2771
|
return d.values;
|
|
2379
2772
|
});
|
|
2380
2773
|
var max = -1,
|
|
2381
|
-
|
|
2774
|
+
nextMax = -1;
|
|
2382
2775
|
componentsByBreadth.forEach(function (c) {
|
|
2383
2776
|
c.forEach(function (component) {
|
|
2384
2777
|
component.x = max + 1;
|
|
@@ -2398,14 +2791,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2398
2791
|
node.x = node.layer ? node.x : max;
|
|
2399
2792
|
});
|
|
2400
2793
|
scaleNodeBreadths((size[0] - nodeWidth) / Math.max(max, 1));
|
|
2794
|
+
|
|
2401
2795
|
function flatten(a) {
|
|
2402
2796
|
return [].concat.apply([], a);
|
|
2403
2797
|
}
|
|
2798
|
+
|
|
2404
2799
|
function layerComponents() {
|
|
2405
2800
|
var remainingComponents = components,
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2801
|
+
nextComponents,
|
|
2802
|
+
visitedIndex,
|
|
2803
|
+
x = 0;
|
|
2804
|
+
|
|
2409
2805
|
while (remainingComponents.length) {
|
|
2410
2806
|
nextComponents = [];
|
|
2411
2807
|
visitedIndex = {};
|
|
@@ -2424,14 +2820,17 @@ var d3_sankey = function d3_sankey() {
|
|
|
2424
2820
|
++x;
|
|
2425
2821
|
}
|
|
2426
2822
|
}
|
|
2823
|
+
|
|
2427
2824
|
function bfs(node, extractTargets) {
|
|
2428
2825
|
var queue = [node],
|
|
2429
|
-
|
|
2430
|
-
|
|
2826
|
+
currentCount = 1,
|
|
2827
|
+
nextCount = 0;
|
|
2431
2828
|
var x = 0;
|
|
2829
|
+
|
|
2432
2830
|
while (currentCount > 0) {
|
|
2433
2831
|
var currentNode = queue.shift();
|
|
2434
2832
|
currentCount--;
|
|
2833
|
+
|
|
2435
2834
|
if (!currentNode.hasOwnProperty('x')) {
|
|
2436
2835
|
currentNode.x = x;
|
|
2437
2836
|
currentNode.dx = nodeWidth;
|
|
@@ -2439,6 +2838,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2439
2838
|
queue = queue.concat(targets);
|
|
2440
2839
|
nextCount += targets.length;
|
|
2441
2840
|
}
|
|
2841
|
+
|
|
2442
2842
|
if (currentCount == 0) {
|
|
2443
2843
|
// level change
|
|
2444
2844
|
x++;
|
|
@@ -2446,9 +2846,8 @@ var d3_sankey = function d3_sankey() {
|
|
|
2446
2846
|
nextCount = 0;
|
|
2447
2847
|
}
|
|
2448
2848
|
}
|
|
2449
|
-
}
|
|
2849
|
+
} //extra code for fixed layout - x part
|
|
2450
2850
|
|
|
2451
|
-
//extra code for fixed layout - x part
|
|
2452
2851
|
/*
|
|
2453
2852
|
if (fixedlayout && fixedlayout.length > 0) {
|
|
2454
2853
|
sankey.nodes().forEach(function (d, i) {
|
|
@@ -2456,6 +2855,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2456
2855
|
});
|
|
2457
2856
|
}
|
|
2458
2857
|
*/
|
|
2858
|
+
|
|
2459
2859
|
}
|
|
2460
2860
|
|
|
2461
2861
|
function moveSourcesRight() {
|
|
@@ -2467,6 +2867,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2467
2867
|
}
|
|
2468
2868
|
});
|
|
2469
2869
|
}
|
|
2870
|
+
|
|
2470
2871
|
function moveSinksRight(x) {
|
|
2471
2872
|
nodes.forEach(function (node) {
|
|
2472
2873
|
if (!node.sourceLinks.length) {
|
|
@@ -2474,11 +2875,13 @@ var d3_sankey = function d3_sankey() {
|
|
|
2474
2875
|
}
|
|
2475
2876
|
});
|
|
2476
2877
|
}
|
|
2878
|
+
|
|
2477
2879
|
function scaleNodeBreadths(kx) {
|
|
2478
2880
|
nodes.forEach(function (node) {
|
|
2479
2881
|
node.x *= kx;
|
|
2480
2882
|
});
|
|
2481
2883
|
}
|
|
2884
|
+
|
|
2482
2885
|
function computeNodeDepths(iterations) {
|
|
2483
2886
|
var nodesByBreadth = Object(d3_collection__WEBPACK_IMPORTED_MODULE_2__["nest"])().key(function (d) {
|
|
2484
2887
|
return d.x;
|
|
@@ -2487,12 +2890,14 @@ var d3_sankey = function d3_sankey() {
|
|
|
2487
2890
|
});
|
|
2488
2891
|
initializeNodeDepth();
|
|
2489
2892
|
resolveCollisions();
|
|
2893
|
+
|
|
2490
2894
|
for (var alpha = 1; iterations > 0; --iterations) {
|
|
2491
2895
|
relaxRightToLeft(alpha *= 0.99);
|
|
2492
2896
|
resolveCollisions();
|
|
2493
2897
|
relaxLeftToRight(alpha);
|
|
2494
2898
|
resolveCollisions();
|
|
2495
2899
|
}
|
|
2900
|
+
|
|
2496
2901
|
function initializeNodeDepth() {
|
|
2497
2902
|
var ky = Object(d3_array__WEBPACK_IMPORTED_MODULE_1__["min"])(nodesByBreadth, function (nodes) {
|
|
2498
2903
|
return (size[1] - (nodes.length - 1) * nodePadding) / Object(d3_array__WEBPACK_IMPORTED_MODULE_1__["sum"])(nodes, value);
|
|
@@ -2507,6 +2912,7 @@ var d3_sankey = function d3_sankey() {
|
|
|
2507
2912
|
link.dy = link.value * ky;
|
|
2508
2913
|
});
|
|
2509
2914
|
}
|
|
2915
|
+
|
|
2510
2916
|
function relaxLeftToRight(alpha) {
|
|
2511
2917
|
nodesByBreadth.forEach(function (nodes, breadth) {
|
|
2512
2918
|
nodes.forEach(function (node) {
|
|
@@ -2516,10 +2922,12 @@ var d3_sankey = function d3_sankey() {
|
|
|
2516
2922
|
}
|
|
2517
2923
|
});
|
|
2518
2924
|
});
|
|
2925
|
+
|
|
2519
2926
|
function weightedSource(link) {
|
|
2520
2927
|
return center(link.source) * link.value;
|
|
2521
2928
|
}
|
|
2522
2929
|
}
|
|
2930
|
+
|
|
2523
2931
|
function relaxRightToLeft(alpha) {
|
|
2524
2932
|
nodesByBreadth.slice().reverse().forEach(function (nodes) {
|
|
2525
2933
|
nodes.forEach(function (node) {
|
|
@@ -2529,35 +2937,38 @@ var d3_sankey = function d3_sankey() {
|
|
|
2529
2937
|
}
|
|
2530
2938
|
});
|
|
2531
2939
|
});
|
|
2940
|
+
|
|
2532
2941
|
function weightedTarget(link) {
|
|
2533
2942
|
return center(link.target) * link.value;
|
|
2534
2943
|
}
|
|
2535
2944
|
}
|
|
2945
|
+
|
|
2536
2946
|
function resolveCollisions() {
|
|
2537
2947
|
nodesByBreadth.forEach(function (nodes) {
|
|
2538
2948
|
var node,
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2949
|
+
dy,
|
|
2950
|
+
y0 = 0,
|
|
2951
|
+
n = nodes.length,
|
|
2952
|
+
i; // Push any overlapping nodes down.
|
|
2543
2953
|
|
|
2544
|
-
// Push any overlapping nodes down.
|
|
2545
2954
|
nodes.sort(ascendingDepth);
|
|
2955
|
+
|
|
2546
2956
|
for (i = 0; i < n; ++i) {
|
|
2547
2957
|
node = nodes[i];
|
|
2958
|
+
|
|
2548
2959
|
if (node) {
|
|
2549
2960
|
dy = y0 - node.y;
|
|
2550
2961
|
if (dy > 0) node.y += dy;
|
|
2551
2962
|
y0 = node.y + node.dy + nodePadding;
|
|
2552
2963
|
}
|
|
2553
|
-
}
|
|
2964
|
+
} // If the bottommost node goes outside the bounds, push it back up.
|
|
2965
|
+
|
|
2554
2966
|
|
|
2555
|
-
// If the bottommost node goes outside the bounds, push it back up.
|
|
2556
2967
|
dy = y0 - nodePadding - size[1];
|
|
2968
|
+
|
|
2557
2969
|
if (node && dy > 0) {
|
|
2558
|
-
y0 = node.y -= dy;
|
|
2970
|
+
y0 = node.y -= dy; // Push any overlapping nodes back up.
|
|
2559
2971
|
|
|
2560
|
-
// Push any overlapping nodes back up.
|
|
2561
2972
|
for (i = n - 2; i >= 0; --i) {
|
|
2562
2973
|
node = nodes[i];
|
|
2563
2974
|
dy = node.y + node.dy + nodePadding - y0;
|
|
@@ -2567,11 +2978,11 @@ var d3_sankey = function d3_sankey() {
|
|
|
2567
2978
|
}
|
|
2568
2979
|
});
|
|
2569
2980
|
}
|
|
2981
|
+
|
|
2570
2982
|
function ascendingDepth(a, b) {
|
|
2571
2983
|
return a.y - b.y;
|
|
2572
|
-
}
|
|
2984
|
+
} //extra code for fixed layout - y part
|
|
2573
2985
|
|
|
2574
|
-
//extra code for fixed layout - y part
|
|
2575
2986
|
/*
|
|
2576
2987
|
if (fixedlayout.length > 0) {
|
|
2577
2988
|
sankey.nodes().forEach(function (d, i) {
|
|
@@ -2579,17 +2990,20 @@ var d3_sankey = function d3_sankey() {
|
|
|
2579
2990
|
});
|
|
2580
2991
|
}
|
|
2581
2992
|
*/
|
|
2993
|
+
|
|
2582
2994
|
}
|
|
2583
2995
|
|
|
2584
2996
|
function computeLinkDepths() {
|
|
2585
2997
|
nodes.forEach(function (node) {
|
|
2586
2998
|
var parallelrendering = false;
|
|
2999
|
+
|
|
2587
3000
|
if (parallelrendering) {} else node.sourceLinks.sort(ascendingTargetDepth);
|
|
3001
|
+
|
|
2588
3002
|
node.targetLinks.sort(ascendingSourceDepth);
|
|
2589
3003
|
});
|
|
2590
3004
|
nodes.forEach(function (node) {
|
|
2591
3005
|
var sy = 0,
|
|
2592
|
-
|
|
3006
|
+
ty = 0;
|
|
2593
3007
|
node.sourceLinks.forEach(function (link) {
|
|
2594
3008
|
link.sy = sy;
|
|
2595
3009
|
sy += link.dy;
|
|
@@ -2599,19 +3013,24 @@ var d3_sankey = function d3_sankey() {
|
|
|
2599
3013
|
ty += link.dy;
|
|
2600
3014
|
});
|
|
2601
3015
|
});
|
|
3016
|
+
|
|
2602
3017
|
function ascendingSourceDepth(a, b) {
|
|
2603
3018
|
return a.source.y - b.source.y;
|
|
2604
3019
|
}
|
|
3020
|
+
|
|
2605
3021
|
function ascendingTargetDepth(a, b) {
|
|
2606
3022
|
return a.target.y - b.target.y;
|
|
2607
3023
|
}
|
|
2608
3024
|
}
|
|
3025
|
+
|
|
2609
3026
|
function center(node) {
|
|
2610
3027
|
return node.y + node.dy / 2;
|
|
2611
3028
|
}
|
|
3029
|
+
|
|
2612
3030
|
function value(link) {
|
|
2613
3031
|
return link.value;
|
|
2614
3032
|
}
|
|
3033
|
+
|
|
2615
3034
|
return sankey;
|
|
2616
3035
|
};
|
|
2617
3036
|
|
|
@@ -2626,29 +3045,40 @@ var d3_sankey = function d3_sankey() {
|
|
|
2626
3045
|
Object.defineProperty(exports, "__esModule", {
|
|
2627
3046
|
value: true
|
|
2628
3047
|
});
|
|
3048
|
+
|
|
2629
3049
|
var React = __webpack_require__(1);
|
|
3050
|
+
|
|
2630
3051
|
var T = __webpack_require__(0);
|
|
3052
|
+
|
|
2631
3053
|
var styled_components_1 = __webpack_require__(4);
|
|
3054
|
+
|
|
2632
3055
|
var react_1 = __webpack_require__(1);
|
|
3056
|
+
|
|
2633
3057
|
var PureSankey_1 = __webpack_require__(111);
|
|
3058
|
+
|
|
2634
3059
|
var SankeyUtils_1 = __webpack_require__(134);
|
|
3060
|
+
|
|
2635
3061
|
var MAX_NODE_TEXT_WIDTH = 150;
|
|
3062
|
+
|
|
2636
3063
|
var getNodeOpacity = function getNodeOpacity(nodeIndex, activeNodes) {
|
|
2637
3064
|
if (!activeNodes || !activeNodes.length) {
|
|
2638
3065
|
return PureSankey_1.DEFAULT_NODE_OPACITY;
|
|
2639
3066
|
}
|
|
3067
|
+
|
|
2640
3068
|
var isActiveNode = activeNodes.find(function (node) {
|
|
2641
3069
|
return node.index === nodeIndex;
|
|
2642
3070
|
});
|
|
2643
3071
|
return isActiveNode ? PureSankey_1.DEFAULT_NODE_OPACITY : PureSankey_1.INACTIVE_OPACITY;
|
|
2644
3072
|
};
|
|
3073
|
+
|
|
2645
3074
|
var getNodeHeight = function getNodeHeight(node) {
|
|
2646
3075
|
return node.dy < 0 ? 1 : node.dy;
|
|
2647
3076
|
};
|
|
3077
|
+
|
|
2648
3078
|
var NodeGroup = styled_components_1.default.g.withConfig({
|
|
2649
3079
|
displayName: "SankeyNode__NodeGroup",
|
|
2650
3080
|
componentId: "sc-1a3nkch-0"
|
|
2651
|
-
})(["opacity:", ";"], function (props) {
|
|
3081
|
+
})(["opacity:", ";&:hover{cursor:pointer;}"], function (props) {
|
|
2652
3082
|
return getNodeOpacity(props.node.index, props.activeNodes);
|
|
2653
3083
|
});
|
|
2654
3084
|
NodeGroup.displayName = 'NodeGroup';
|
|
@@ -2666,26 +3096,32 @@ var NodeText = styled_components_1.default.text.withConfig({
|
|
|
2666
3096
|
}, PureSankey_1.DEFAULT_FONT_FAMILY, function (props) {
|
|
2667
3097
|
return props.nodeTextColor;
|
|
2668
3098
|
});
|
|
3099
|
+
|
|
2669
3100
|
var SankeyNode = function SankeyNode(props) {
|
|
2670
3101
|
var node = props.node,
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
3102
|
+
activeNodes = props.activeNodes,
|
|
3103
|
+
nodeWidth = props.nodeWidth,
|
|
3104
|
+
chartWidth = props.chartWidth,
|
|
3105
|
+
handleMouseOver = props.handleMouseOver,
|
|
3106
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3107
|
+
handleNodeClick = props.handleNodeClick,
|
|
3108
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3109
|
+
nodeTextColor = props.nodeTextColor;
|
|
2678
3110
|
var nodeTextRef = (0, react_1.useRef)();
|
|
2679
3111
|
(0, react_1.useEffect)(function () {
|
|
2680
3112
|
(0, SankeyUtils_1.truncateSVGTextWithEllipsis)(nodeTextRef.current, node.name, MAX_NODE_TEXT_WIDTH);
|
|
2681
3113
|
});
|
|
3114
|
+
var nodeClickHandler = (0, react_1.useCallback)(function () {
|
|
3115
|
+
return handleNodeClick(node);
|
|
3116
|
+
}, [node]);
|
|
2682
3117
|
return React.createElement(NodeGroup, {
|
|
2683
3118
|
node: node,
|
|
2684
3119
|
activeNodes: activeNodes,
|
|
2685
3120
|
className: "node",
|
|
2686
3121
|
key: "node-".concat(node.index),
|
|
2687
3122
|
"data-test": "node-".concat(node.index),
|
|
2688
|
-
transform: "translate(".concat(node.x, ",").concat(node.y, ")")
|
|
3123
|
+
transform: "translate(".concat(node.x, ",").concat(node.y, ")"),
|
|
3124
|
+
onClick: nodeClickHandler
|
|
2689
3125
|
}, React.createElement(React.Fragment, null, React.createElement(NodeRect, {
|
|
2690
3126
|
node: node,
|
|
2691
3127
|
height: getNodeHeight(node),
|
|
@@ -2707,6 +3143,7 @@ var SankeyNode = function SankeyNode(props) {
|
|
|
2707
3143
|
nodeTextColor: nodeTextColor
|
|
2708
3144
|
}, node.name)));
|
|
2709
3145
|
};
|
|
3146
|
+
|
|
2710
3147
|
SankeyNode.propTypes = {
|
|
2711
3148
|
node: T.object,
|
|
2712
3149
|
activeNodes: T.arrayOf(T.object),
|
|
@@ -2734,15 +3171,19 @@ exports.default = SankeyNode;
|
|
|
2734
3171
|
Object.defineProperty(exports, "__esModule", {
|
|
2735
3172
|
value: true
|
|
2736
3173
|
});
|
|
3174
|
+
|
|
2737
3175
|
var React = __webpack_require__(1);
|
|
3176
|
+
|
|
2738
3177
|
var styled_components_1 = __webpack_require__(4);
|
|
3178
|
+
|
|
2739
3179
|
var hocUtils_1 = __webpack_require__(15);
|
|
3180
|
+
|
|
2740
3181
|
var Cover = styled_components_1.default.div.withConfig({
|
|
2741
3182
|
displayName: "withEditModeCover__Cover",
|
|
2742
3183
|
componentId: "sc-1gsbnxb-0"
|
|
2743
3184
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
2744
3185
|
var Blocker = styled_components_1.default.div.attrs({
|
|
2745
|
-
'data-splunk-visualization-version': "26.
|
|
3186
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
2746
3187
|
}).withConfig({
|
|
2747
3188
|
displayName: "withEditModeCover__Blocker",
|
|
2748
3189
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -2753,6 +3194,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
2753
3194
|
* @param {ExtendedDashViz} Visualization
|
|
2754
3195
|
* @returns {ExtendedDashViz} Wrapper
|
|
2755
3196
|
*/
|
|
3197
|
+
|
|
2756
3198
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
2757
3199
|
var Wrapper = function Wrapper(props) {
|
|
2758
3200
|
var mode = props.mode;
|
|
@@ -2761,12 +3203,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
2761
3203
|
"data-test": "edit-mode-cover"
|
|
2762
3204
|
}));
|
|
2763
3205
|
};
|
|
3206
|
+
|
|
2764
3207
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
2765
3208
|
Wrapper: Wrapper,
|
|
2766
3209
|
Visualization: Visualization
|
|
2767
3210
|
});
|
|
2768
3211
|
return Wrapper;
|
|
2769
3212
|
};
|
|
3213
|
+
|
|
2770
3214
|
exports.default = withEditModeCover;
|
|
2771
3215
|
|
|
2772
3216
|
/***/ }),
|
|
@@ -2780,52 +3224,76 @@ exports.default = withEditModeCover;
|
|
|
2780
3224
|
Object.defineProperty(exports, "__esModule", {
|
|
2781
3225
|
value: true
|
|
2782
3226
|
});
|
|
3227
|
+
|
|
2783
3228
|
var React = __webpack_require__(1);
|
|
3229
|
+
|
|
3230
|
+
var react_1 = __webpack_require__(1);
|
|
3231
|
+
|
|
2784
3232
|
var T = __webpack_require__(0);
|
|
3233
|
+
|
|
3234
|
+
var styled_components_1 = __webpack_require__(4);
|
|
3235
|
+
|
|
2785
3236
|
var PureSankey_1 = __webpack_require__(111);
|
|
3237
|
+
|
|
2786
3238
|
var SankeyUtils_1 = __webpack_require__(134);
|
|
3239
|
+
|
|
2787
3240
|
var getLinkFill = function getLinkFill(link, colorCategoryMapping, colorMode) {
|
|
2788
3241
|
if (colorMode === 'categorical') {
|
|
2789
3242
|
return colorCategoryMapping ? colorCategoryMapping(link.source.name) : PureSankey_1.DEFAULT_LINK_COLOR;
|
|
2790
3243
|
}
|
|
3244
|
+
|
|
2791
3245
|
return colorCategoryMapping && colorCategoryMapping[link.index] ? colorCategoryMapping[link.index] : PureSankey_1.DEFAULT_LINK_COLOR;
|
|
2792
3246
|
};
|
|
3247
|
+
|
|
2793
3248
|
var getLinkOpacity = function getLinkOpacity(link, activeLinks, linkOpacity) {
|
|
2794
3249
|
if (!activeLinks || !activeLinks.length) {
|
|
2795
3250
|
return linkOpacity;
|
|
2796
3251
|
}
|
|
3252
|
+
|
|
2797
3253
|
var isActiveLink = activeLinks.find(function (l) {
|
|
2798
3254
|
return l.id === link.id;
|
|
2799
3255
|
});
|
|
2800
3256
|
return isActiveLink ? linkOpacity : PureSankey_1.INACTIVE_OPACITY;
|
|
2801
3257
|
};
|
|
3258
|
+
|
|
3259
|
+
var StyledSankeyLink = styled_components_1.default.g.withConfig({
|
|
3260
|
+
displayName: "SankeyLink__StyledSankeyLink",
|
|
3261
|
+
componentId: "sc-1w9ez3l-0"
|
|
3262
|
+
})(["&:hover{cursor:pointer;}"]);
|
|
3263
|
+
|
|
2802
3264
|
var SankeyLink = function SankeyLink(props) {
|
|
2803
3265
|
var link = props.link,
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
3266
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3267
|
+
activeLinks = props.activeLinks,
|
|
3268
|
+
linkOpacity = props.linkOpacity,
|
|
3269
|
+
colorMode = props.colorMode,
|
|
3270
|
+
path = props.path,
|
|
3271
|
+
handleMouseOver = props.handleMouseOver,
|
|
3272
|
+
handleMouseLeave = props.handleMouseLeave,
|
|
3273
|
+
handleLinkClick = props.handleLinkClick; // This is to draw an invisible circle added to the link's path midpoint,
|
|
2811
3274
|
// which acts as an anchor for the link tooltip
|
|
3275
|
+
|
|
2812
3276
|
var circlePoints = (0, SankeyUtils_1.extractLinkMidPoint)(path(1)(link));
|
|
2813
|
-
|
|
3277
|
+
var linkClickHandler = (0, react_1.useCallback)(function () {
|
|
3278
|
+
return handleLinkClick(link);
|
|
3279
|
+
}, [link]);
|
|
3280
|
+
return React.createElement(StyledSankeyLink, {
|
|
2814
3281
|
className: "link",
|
|
2815
3282
|
key: link.id,
|
|
2816
3283
|
id: link.id,
|
|
2817
3284
|
"data-test": link.id,
|
|
2818
3285
|
fill: getLinkFill(link, colorCategoryMapping, colorMode),
|
|
2819
3286
|
opacity: getLinkOpacity(link, activeLinks, linkOpacity),
|
|
3287
|
+
onClick: linkClickHandler,
|
|
2820
3288
|
onMouseOver: function onMouseOver(ev) {
|
|
2821
3289
|
handleMouseOver(ev);
|
|
2822
3290
|
},
|
|
2823
3291
|
onMouseLeave: function onMouseLeave(ev) {
|
|
2824
3292
|
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.
|
|
3293
|
+
var isRelatedTargetPopover = false; // This is to verify if the mouseLeave is being triggered because of mouseover on a the popover itself.
|
|
2827
3294
|
// In that case the relatedTarget will have the popover elements and this logic will check on the class name used.
|
|
2828
3295
|
// If detects the relatedTarget is a popover, then mouseLeave event handler wont be triggered.
|
|
3296
|
+
|
|
2829
3297
|
if (relatedTarget && relatedTarget.classList) {
|
|
2830
3298
|
var classList = relatedTarget.classList;
|
|
2831
3299
|
classList.forEach(function (name) {
|
|
@@ -2834,6 +3302,7 @@ var SankeyLink = function SankeyLink(props) {
|
|
|
2834
3302
|
}
|
|
2835
3303
|
});
|
|
2836
3304
|
}
|
|
3305
|
+
|
|
2837
3306
|
if (!isRelatedTargetPopover) {
|
|
2838
3307
|
handleMouseLeave(ev);
|
|
2839
3308
|
}
|
|
@@ -2851,6 +3320,7 @@ var SankeyLink = function SankeyLink(props) {
|
|
|
2851
3320
|
fill: "transparent"
|
|
2852
3321
|
}));
|
|
2853
3322
|
};
|
|
3323
|
+
|
|
2854
3324
|
SankeyLink.propTypes = {
|
|
2855
3325
|
link: T.object,
|
|
2856
3326
|
activeLinks: T.arrayOf(T.object),
|
|
@@ -2877,12 +3347,19 @@ exports.default = SankeyLink;
|
|
|
2877
3347
|
Object.defineProperty(exports, "__esModule", {
|
|
2878
3348
|
value: true
|
|
2879
3349
|
});
|
|
3350
|
+
|
|
2880
3351
|
var React = __webpack_require__(1);
|
|
3352
|
+
|
|
2881
3353
|
var T = __webpack_require__(0);
|
|
3354
|
+
|
|
2882
3355
|
var Popover_1 = __webpack_require__(62);
|
|
3356
|
+
|
|
2883
3357
|
var styled_components_1 = __webpack_require__(4);
|
|
3358
|
+
|
|
2884
3359
|
var numberUtils_1 = __webpack_require__(31);
|
|
3360
|
+
|
|
2885
3361
|
var PureSankey_1 = __webpack_require__(111);
|
|
3362
|
+
|
|
2886
3363
|
var DEFAULT_PLACEMENT = 'below';
|
|
2887
3364
|
var StyledTooltipContainer = styled_components_1.default.div.withConfig({
|
|
2888
3365
|
displayName: "SankeyTooltip__StyledTooltipContainer",
|
|
@@ -2928,50 +3405,59 @@ var NodeValue = styled_components_1.default.div.withConfig({
|
|
|
2928
3405
|
displayName: "SankeyTooltip__NodeValue",
|
|
2929
3406
|
componentId: "x563qp-8"
|
|
2930
3407
|
})(["margin-left:8px;max-width:200px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;"]);
|
|
3408
|
+
|
|
2931
3409
|
var SankeyTooltip = function SankeyTooltip(props) {
|
|
2932
3410
|
var mode = props.mode,
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
3411
|
+
node = props.node,
|
|
3412
|
+
link = props.link,
|
|
3413
|
+
open = props.open,
|
|
3414
|
+
connectionsMap = props.connectionsMap,
|
|
3415
|
+
anchor = props.anchor,
|
|
3416
|
+
linkValue = props.linkValue,
|
|
3417
|
+
colorCategoryMapping = props.colorCategoryMapping,
|
|
3418
|
+
width = props.width,
|
|
3419
|
+
tooltipRowColor = props.tooltipRowColor,
|
|
3420
|
+
tooltipLinkHeaderColor = props.tooltipLinkHeaderColor,
|
|
3421
|
+
tooltipHeaderColor = props.tooltipHeaderColor,
|
|
3422
|
+
handleTooltipRequestClose = props.handleTooltipRequestClose;
|
|
3423
|
+
|
|
2945
3424
|
var showSection = function showSection(connection, nodeData, section) {
|
|
2946
3425
|
if (!connection) {
|
|
2947
3426
|
return false;
|
|
2948
3427
|
}
|
|
3428
|
+
|
|
2949
3429
|
var connectionNodes = section === 'source' ? connection.sourceNodes : connection.targetNodes;
|
|
2950
3430
|
var filteredNodes = connectionNodes.filter(function (cNode) {
|
|
2951
3431
|
return cNode.index !== nodeData.index;
|
|
2952
3432
|
});
|
|
2953
3433
|
return filteredNodes.length > 0;
|
|
2954
3434
|
};
|
|
3435
|
+
|
|
2955
3436
|
var getPopoverPlacement = function getPopoverPlacement(anchorElement) {
|
|
2956
3437
|
if (!anchorElement) {
|
|
2957
3438
|
return DEFAULT_PLACEMENT;
|
|
2958
3439
|
}
|
|
2959
|
-
|
|
2960
|
-
// TODO: Depending on the testing result in dashboard reg tooltip position, might need further optimization
|
|
3440
|
+
|
|
3441
|
+
var bBox = anchorElement.getBoundingClientRect(); // TODO: Depending on the testing result in dashboard reg tooltip position, might need further optimization
|
|
2961
3442
|
// If anchorElement is too close to the left border of the chart, place it to the right side of anchorElement
|
|
3443
|
+
|
|
2962
3444
|
if (bBox.x <= 15) {
|
|
2963
3445
|
return 'right';
|
|
2964
3446
|
}
|
|
3447
|
+
|
|
2965
3448
|
if (bBox.x >= width - 15) {
|
|
2966
3449
|
// If anchorElement is too close to the right border of the chart, place it to the right side of anchorElement
|
|
2967
3450
|
return 'left';
|
|
2968
3451
|
}
|
|
3452
|
+
|
|
2969
3453
|
return DEFAULT_PLACEMENT;
|
|
2970
3454
|
};
|
|
3455
|
+
|
|
2971
3456
|
var renderNodeToolTip = function renderNodeToolTip() {
|
|
2972
3457
|
if (!node) {
|
|
2973
3458
|
return null;
|
|
2974
3459
|
}
|
|
3460
|
+
|
|
2975
3461
|
var connections = connectionsMap[node.index];
|
|
2976
3462
|
return React.createElement(Popover_1.default, {
|
|
2977
3463
|
open: open,
|
|
@@ -2998,6 +3484,7 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
2998
3484
|
headerColor: tooltipHeaderColor
|
|
2999
3485
|
}, React.createElement(StyledTooltipLeftCell, null, "Source"), React.createElement(StyledTooltipRightCell, null, linkValue)), React.createElement(StyledTooltipSection, null, connections && connections.sourceNodes.map(function (sNode, idx) {
|
|
3000
3486
|
var _a, _b;
|
|
3487
|
+
|
|
3001
3488
|
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
3489
|
return React.createElement(StyledTooltipRow, {
|
|
3003
3490
|
key: sNode.index,
|
|
@@ -3014,11 +3501,13 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
3014
3501
|
useTrendUnits: true
|
|
3015
3502
|
})));
|
|
3016
3503
|
}
|
|
3504
|
+
|
|
3017
3505
|
return null;
|
|
3018
3506
|
})), showSection(connections, node, 'target') && React.createElement(StyledTooltipHeader, {
|
|
3019
3507
|
headerColor: tooltipHeaderColor
|
|
3020
3508
|
}, React.createElement(StyledTooltipLeftCell, null, "Target"), React.createElement(StyledTooltipRightCell, null, linkValue)), React.createElement(StyledTooltipSection, null, connections && connections.targetNodes.map(function (tNode, idx) {
|
|
3021
3509
|
var _a, _b;
|
|
3510
|
+
|
|
3022
3511
|
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
3512
|
return React.createElement(StyledTooltipRow, {
|
|
3024
3513
|
key: tNode.index,
|
|
@@ -3035,14 +3524,18 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
3035
3524
|
useTrendUnits: true
|
|
3036
3525
|
})));
|
|
3037
3526
|
}
|
|
3527
|
+
|
|
3038
3528
|
return null;
|
|
3039
3529
|
}))));
|
|
3040
3530
|
};
|
|
3531
|
+
|
|
3041
3532
|
var renderLinkToolTip = function renderLinkToolTip() {
|
|
3042
3533
|
var _a, _b, _c, _d;
|
|
3534
|
+
|
|
3043
3535
|
if (!link) {
|
|
3044
3536
|
return null;
|
|
3045
3537
|
}
|
|
3538
|
+
|
|
3046
3539
|
return React.createElement(Popover_1.default, {
|
|
3047
3540
|
open: open,
|
|
3048
3541
|
anchor: anchor,
|
|
@@ -3090,8 +3583,10 @@ var SankeyTooltip = function SankeyTooltip(props) {
|
|
|
3090
3583
|
useTrendUnits: true
|
|
3091
3584
|
}))))));
|
|
3092
3585
|
};
|
|
3586
|
+
|
|
3093
3587
|
return mode === 'node' ? renderNodeToolTip() : renderLinkToolTip();
|
|
3094
3588
|
};
|
|
3589
|
+
|
|
3095
3590
|
SankeyTooltip.propTypes = {
|
|
3096
3591
|
mode: T.string,
|
|
3097
3592
|
node: T.object,
|
|
@@ -3123,18 +3618,31 @@ exports.default = SankeyTooltip;
|
|
|
3123
3618
|
Object.defineProperty(exports, "__esModule", {
|
|
3124
3619
|
value: true
|
|
3125
3620
|
});
|
|
3621
|
+
|
|
3126
3622
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3623
|
+
|
|
3127
3624
|
var placeholders_1 = __webpack_require__(50);
|
|
3625
|
+
|
|
3128
3626
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
3627
|
+
|
|
3129
3628
|
var schemaUtils_1 = __webpack_require__(16);
|
|
3629
|
+
|
|
3130
3630
|
var PresetPalettes_1 = __webpack_require__(61);
|
|
3631
|
+
|
|
3131
3632
|
var themes_1 = __webpack_require__(60);
|
|
3633
|
+
|
|
3132
3634
|
var i18n_1 = __webpack_require__(2);
|
|
3635
|
+
|
|
3133
3636
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3134
|
-
|
|
3637
|
+
|
|
3638
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
3639
|
+
|
|
3135
3640
|
var configUtils_1 = __webpack_require__(20);
|
|
3641
|
+
|
|
3136
3642
|
var DynamicLinkColorsEditor_1 = __webpack_require__(463);
|
|
3643
|
+
|
|
3137
3644
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
3645
|
+
|
|
3138
3646
|
var defaultContext = {
|
|
3139
3647
|
linkColorRangeConfig: [{
|
|
3140
3648
|
to: 20,
|
|
@@ -3312,17 +3820,20 @@ var editorConfig = [{
|
|
|
3312
3820
|
/**
|
|
3313
3821
|
* visualization configuration
|
|
3314
3822
|
*/
|
|
3823
|
+
|
|
3315
3824
|
var config = {
|
|
3316
3825
|
/**
|
|
3317
3826
|
* unique viz key
|
|
3318
3827
|
*/
|
|
3319
3828
|
key: 'splunk.sankey',
|
|
3829
|
+
|
|
3320
3830
|
/**
|
|
3321
3831
|
* viz name
|
|
3322
3832
|
*/
|
|
3323
3833
|
name: (0, i18n_1._)('Sankey'),
|
|
3324
3834
|
category: VizCategory_1.VizCategory.FLOW,
|
|
3325
3835
|
status: 'preview',
|
|
3836
|
+
|
|
3326
3837
|
/**
|
|
3327
3838
|
* viz icon
|
|
3328
3839
|
*/
|
|
@@ -3333,7 +3844,14 @@ var config = {
|
|
|
3333
3844
|
defaultContext: defaultContext,
|
|
3334
3845
|
optionsSchema: optionsSchema,
|
|
3335
3846
|
editorConfig: editorConfig,
|
|
3336
|
-
events: {
|
|
3847
|
+
events: {
|
|
3848
|
+
'node.click': {
|
|
3849
|
+
description: 'Triggered when user clicks on a node'
|
|
3850
|
+
},
|
|
3851
|
+
'link.click': {
|
|
3852
|
+
description: 'Triggered when user clicks on a link'
|
|
3853
|
+
}
|
|
3854
|
+
},
|
|
3337
3855
|
supports: [VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS, VizBehavior_1.VizBehavior.EVENTS, VizBehavior_1.VizBehavior.PLACEHOLDER],
|
|
3338
3856
|
themes: themes,
|
|
3339
3857
|
requiredProps: []
|
|
@@ -3356,7 +3874,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3356
3874
|
|
|
3357
3875
|
var getDynamicLinkColorsEditor = function getDynamicLinkColorsEditor(_ref) {
|
|
3358
3876
|
var defaultContext = _ref.defaultContext,
|
|
3359
|
-
|
|
3877
|
+
defaultPalettesConfig = _ref.defaultPalettesConfig;
|
|
3360
3878
|
return {
|
|
3361
3879
|
label: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_0__["_"])('Link'),
|
|
3362
3880
|
option: 'linkColors',
|
|
@@ -3402,27 +3920,37 @@ var getDynamicLinkColorsEditor = function getDynamicLinkColorsEditor(_ref) {
|
|
|
3402
3920
|
Object.defineProperty(exports, "__esModule", {
|
|
3403
3921
|
value: true
|
|
3404
3922
|
});
|
|
3923
|
+
|
|
3405
3924
|
var React = __webpack_require__(1);
|
|
3925
|
+
|
|
3406
3926
|
var colorUtils_1 = __webpack_require__(12);
|
|
3927
|
+
|
|
3407
3928
|
var variables_1 = __webpack_require__(11);
|
|
3929
|
+
|
|
3408
3930
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
3931
|
+
|
|
3409
3932
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3933
|
+
|
|
3410
3934
|
var hocUtils_1 = __webpack_require__(15);
|
|
3935
|
+
|
|
3411
3936
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
3412
3937
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
3413
3938
|
var config = Visualization.config;
|
|
3414
3939
|
var themes = config.themes;
|
|
3940
|
+
|
|
3415
3941
|
var Wrapper = function Wrapper(props) {
|
|
3416
3942
|
var _a, _b;
|
|
3943
|
+
|
|
3417
3944
|
var dataSources = props.dataSources,
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3945
|
+
loading = props.loading,
|
|
3946
|
+
options = props.options,
|
|
3947
|
+
height = props.height,
|
|
3948
|
+
width = props.width;
|
|
3422
3949
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
3423
3950
|
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
3951
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
3425
3952
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
3953
|
+
|
|
3426
3954
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
3427
3955
|
return React.createElement(IconPlaceholder_1.default, {
|
|
3428
3956
|
"data-test": "icon-placeholder",
|
|
@@ -3433,14 +3961,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
3433
3961
|
iconColor: iconColor
|
|
3434
3962
|
});
|
|
3435
3963
|
}
|
|
3964
|
+
|
|
3436
3965
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
3437
3966
|
};
|
|
3967
|
+
|
|
3438
3968
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3439
3969
|
Wrapper: Wrapper,
|
|
3440
3970
|
Visualization: Visualization
|
|
3441
3971
|
});
|
|
3442
3972
|
return Wrapper;
|
|
3443
3973
|
};
|
|
3974
|
+
|
|
3444
3975
|
exports.default = withPlaceholder;
|
|
3445
3976
|
|
|
3446
3977
|
/***/ }),
|
|
@@ -3475,11 +4006,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
3475
4006
|
Object.defineProperty(exports, "__esModule", {
|
|
3476
4007
|
value: true
|
|
3477
4008
|
});
|
|
4009
|
+
|
|
3478
4010
|
var i18n_1 = __webpack_require__(2);
|
|
4011
|
+
|
|
3479
4012
|
var background = function background(_ref) {
|
|
3480
4013
|
var label = _ref.label,
|
|
3481
|
-
|
|
3482
|
-
|
|
4014
|
+
themes = _ref.themes,
|
|
4015
|
+
labelPosition = _ref.labelPosition;
|
|
3483
4016
|
return [{
|
|
3484
4017
|
label: (0, i18n_1._)(label || 'Background'),
|
|
3485
4018
|
option: 'backgroundColor',
|
|
@@ -3490,6 +4023,7 @@ var background = function background(_ref) {
|
|
|
3490
4023
|
}
|
|
3491
4024
|
}];
|
|
3492
4025
|
};
|
|
4026
|
+
|
|
3493
4027
|
exports.default = background;
|
|
3494
4028
|
|
|
3495
4029
|
/***/ }),
|
|
@@ -3505,6 +4039,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3505
4039
|
});
|
|
3506
4040
|
exports.VizBehavior = void 0;
|
|
3507
4041
|
var VizBehavior;
|
|
4042
|
+
|
|
3508
4043
|
(function (VizBehavior) {
|
|
3509
4044
|
/**
|
|
3510
4045
|
* Dynamic Options Behavior.
|
|
@@ -3524,6 +4059,7 @@ var VizBehavior;
|
|
|
3524
4059
|
* missing.
|
|
3525
4060
|
* @type {string}
|
|
3526
4061
|
*/
|
|
4062
|
+
|
|
3527
4063
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
3528
4064
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
3529
4065
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -3605,24 +4141,24 @@ module.exports = require("@babel/runtime/helpers/typeof");
|
|
|
3605
4141
|
|
|
3606
4142
|
/***/ }),
|
|
3607
4143
|
|
|
3608
|
-
/***/
|
|
4144
|
+
/***/ 83:
|
|
3609
4145
|
/***/ (function(module, exports) {
|
|
3610
4146
|
|
|
3611
|
-
module.exports = require("@
|
|
4147
|
+
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
3612
4148
|
|
|
3613
4149
|
/***/ }),
|
|
3614
4150
|
|
|
3615
|
-
/***/
|
|
4151
|
+
/***/ 9:
|
|
3616
4152
|
/***/ (function(module, exports) {
|
|
3617
4153
|
|
|
3618
|
-
module.exports = require("
|
|
4154
|
+
module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
3619
4155
|
|
|
3620
4156
|
/***/ }),
|
|
3621
4157
|
|
|
3622
|
-
/***/
|
|
4158
|
+
/***/ 93:
|
|
3623
4159
|
/***/ (function(module, exports) {
|
|
3624
4160
|
|
|
3625
|
-
module.exports = require("
|
|
4161
|
+
module.exports = require("d3-scale");
|
|
3626
4162
|
|
|
3627
4163
|
/***/ }),
|
|
3628
4164
|
|