@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/Table.js
CHANGED
|
@@ -150,11 +150,17 @@ module.exports = require("@splunk/react-ui/Message");
|
|
|
150
150
|
Object.defineProperty(exports, "__esModule", {
|
|
151
151
|
value: true
|
|
152
152
|
});
|
|
153
|
+
|
|
153
154
|
var React = __webpack_require__(1);
|
|
155
|
+
|
|
154
156
|
var styled_components_1 = __webpack_require__(4);
|
|
157
|
+
|
|
155
158
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
159
|
+
|
|
156
160
|
var style_1 = __webpack_require__(14);
|
|
161
|
+
|
|
157
162
|
var colorUtils_1 = __webpack_require__(12);
|
|
163
|
+
|
|
158
164
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
159
165
|
var width = _ref.width;
|
|
160
166
|
return {
|
|
@@ -167,11 +173,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
167
173
|
componentId: "sc-1yhgpod-0"
|
|
168
174
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
169
175
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
170
|
-
});
|
|
171
|
-
|
|
176
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
177
|
+
|
|
172
178
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
173
179
|
var width = _ref2.width,
|
|
174
|
-
|
|
180
|
+
height = _ref2.height;
|
|
175
181
|
return {
|
|
176
182
|
style: Object.assign(Object.assign({}, width && {
|
|
177
183
|
width: (0, style_1.toPx)(width)
|
|
@@ -193,11 +199,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
193
199
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
194
200
|
componentId: "sc-1yhgpod-3"
|
|
195
201
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
202
|
+
|
|
196
203
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
197
204
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
198
205
|
var width = props.width,
|
|
199
|
-
|
|
200
|
-
|
|
206
|
+
height = props.height,
|
|
207
|
+
backgroundColor = props.backgroundColor;
|
|
208
|
+
|
|
201
209
|
if (!height) {
|
|
202
210
|
return React.createElement(Item, {
|
|
203
211
|
"data-test": "item",
|
|
@@ -205,24 +213,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
205
213
|
backgroundColor: backgroundColor
|
|
206
214
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
207
215
|
}
|
|
216
|
+
|
|
208
217
|
return React.createElement(FixSizeItem, {
|
|
209
218
|
"data-test": "fix-size-item",
|
|
210
|
-
"data-splunk-visualization-version": "26.
|
|
219
|
+
"data-splunk-visualization-version": "26.1.0 - fc8bf8d77",
|
|
211
220
|
width: width,
|
|
212
221
|
height: height,
|
|
213
222
|
backgroundColor: backgroundColor
|
|
214
223
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
215
224
|
var newWidth = _ref3.width,
|
|
216
|
-
|
|
225
|
+
newHeight = _ref3.height;
|
|
217
226
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
218
227
|
width: newWidth,
|
|
219
228
|
height: newHeight
|
|
220
229
|
}));
|
|
221
230
|
})));
|
|
222
231
|
};
|
|
232
|
+
|
|
223
233
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
224
234
|
return FixedSizeContainer;
|
|
225
235
|
};
|
|
236
|
+
|
|
226
237
|
exports.default = withFixedSizeContainer;
|
|
227
238
|
|
|
228
239
|
/***/ }),
|
|
@@ -269,9 +280,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
269
280
|
* @param {DashboardVizType} props.Wrapper
|
|
270
281
|
* @param {DashboardVizType} props.Visualization
|
|
271
282
|
*/
|
|
283
|
+
|
|
272
284
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
273
285
|
var Wrapper = _ref.Wrapper,
|
|
274
|
-
|
|
286
|
+
Visualization = _ref.Visualization;
|
|
275
287
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
276
288
|
extendProperties.forEach(function (prop) {
|
|
277
289
|
if (Visualization[prop]) {
|
|
@@ -280,6 +292,7 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
280
292
|
}
|
|
281
293
|
});
|
|
282
294
|
};
|
|
295
|
+
|
|
283
296
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
284
297
|
|
|
285
298
|
/***/ }),
|
|
@@ -298,57 +311,73 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
298
311
|
|
|
299
312
|
|
|
300
313
|
var _slicedToArray = __webpack_require__(17);
|
|
314
|
+
|
|
301
315
|
var __rest = this && this.__rest || function (s, e) {
|
|
302
316
|
var t = {};
|
|
317
|
+
|
|
303
318
|
for (var p in s) {
|
|
304
319
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
305
320
|
}
|
|
321
|
+
|
|
306
322
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
307
323
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
308
324
|
}
|
|
309
325
|
return t;
|
|
310
326
|
};
|
|
327
|
+
|
|
311
328
|
Object.defineProperty(exports, "__esModule", {
|
|
312
329
|
value: true
|
|
313
330
|
});
|
|
314
331
|
exports.config = exports.PureTable = exports.themes = exports.computeVizProps = void 0;
|
|
332
|
+
|
|
315
333
|
var lodash_1 = __webpack_require__(3);
|
|
334
|
+
|
|
316
335
|
var colorUtils_1 = __webpack_require__(12);
|
|
336
|
+
|
|
317
337
|
var config_1 = __webpack_require__(480);
|
|
338
|
+
|
|
318
339
|
exports.config = config_1.default;
|
|
319
|
-
|
|
340
|
+
|
|
341
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
342
|
+
|
|
320
343
|
var PureTable_1 = __webpack_require__(481);
|
|
344
|
+
|
|
321
345
|
exports.PureTable = PureTable_1.default;
|
|
346
|
+
|
|
322
347
|
var computeVizProps = function computeVizProps(_a) {
|
|
323
348
|
var props = __rest(_a, []);
|
|
349
|
+
|
|
324
350
|
var vizProps = Object.assign({}, props);
|
|
351
|
+
|
|
325
352
|
if (vizProps.columnFormat) {
|
|
326
353
|
var columns = vizProps.columnFormat;
|
|
327
354
|
var themeRowBackgroundColorOdd = vizProps.themeFunc('rowBackgroundColorOdd');
|
|
328
355
|
var themeRowBackgroundColorEven = vizProps.themeFunc('rowBackgroundColorEven');
|
|
329
|
-
var themeTextColor = vizProps.themeFunc('textColor');
|
|
330
|
-
|
|
356
|
+
var themeTextColor = vizProps.themeFunc('textColor'); // `columns` looks like { `column title`: { rowBackgroundColors, rowColors... }}
|
|
357
|
+
|
|
331
358
|
Object.entries(columns).forEach(function (_ref) {
|
|
332
359
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
333
|
-
|
|
334
|
-
|
|
360
|
+
columnKey = _ref2[0],
|
|
361
|
+
columnProperties = _ref2[1];
|
|
362
|
+
|
|
335
363
|
var rowBackgroundColors;
|
|
336
|
-
var rowColors;
|
|
337
|
-
// If columns have `rowBackgroundColors` or `rowColors` arrays defined, sanitize them. If there are undefined values after sanitization, these
|
|
364
|
+
var rowColors; // If columns have `rowBackgroundColors` or `rowColors` arrays defined, sanitize them. If there are undefined values after sanitization, these
|
|
338
365
|
// elements are populated with the default values provided by the theme.
|
|
366
|
+
|
|
339
367
|
if (columnProperties.rowBackgroundColors) {
|
|
340
368
|
rowBackgroundColors = (0, colorUtils_1.sanitizeArrayOfColors)(columnProperties.rowBackgroundColors).map(function (color, i) {
|
|
341
|
-
return (
|
|
342
|
-
// using (i + 1) % 2 because 'odd' refers to row number, so index 0 -> row 1 -> odd colored
|
|
369
|
+
return (// using (i + 1) % 2 because 'odd' refers to row number, so index 0 -> row 1 -> odd colored
|
|
343
370
|
color || ((i + 1) % 2 === 0 ? themeRowBackgroundColorEven : themeRowBackgroundColorOdd)
|
|
344
371
|
);
|
|
345
372
|
});
|
|
346
373
|
}
|
|
374
|
+
|
|
347
375
|
if (columnProperties.rowColors) {
|
|
348
376
|
rowColors = (0, colorUtils_1.sanitizeArrayOfColors)(columnProperties.rowColors).map(function (color) {
|
|
349
377
|
return color || themeTextColor;
|
|
350
378
|
});
|
|
351
379
|
}
|
|
380
|
+
|
|
352
381
|
vizProps.columnFormat[columnKey] = Object.assign(Object.assign(Object.assign({}, vizProps.columnFormat[columnKey]), columnProperties.rowBackgroundColors && {
|
|
353
382
|
rowBackgroundColors: rowBackgroundColors
|
|
354
383
|
}), columnProperties.rowColors && {
|
|
@@ -356,9 +385,11 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
356
385
|
});
|
|
357
386
|
});
|
|
358
387
|
}
|
|
388
|
+
|
|
359
389
|
if (vizProps.onOptionsChange) {
|
|
360
390
|
var handleColumnFormatChange = function handleColumnFormatChange(updatedColumnFormat) {
|
|
361
391
|
var _a, _b;
|
|
392
|
+
|
|
362
393
|
var cloneOfExistingColumnFormat = (_b = Object.assign({}, (_a = vizProps === null || vizProps === void 0 ? void 0 : vizProps.options) === null || _a === void 0 ? void 0 : _a.columnFormat)) !== null && _b !== void 0 ? _b : {};
|
|
363
394
|
var keys = Object.keys(updatedColumnFormat);
|
|
364
395
|
var values = Object.values(updatedColumnFormat);
|
|
@@ -366,6 +397,7 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
366
397
|
if (!cloneOfExistingColumnFormat[key]) {
|
|
367
398
|
cloneOfExistingColumnFormat[key] = {};
|
|
368
399
|
}
|
|
400
|
+
|
|
369
401
|
var newWidth = (0, lodash_1.get)(values[index], 'width');
|
|
370
402
|
cloneOfExistingColumnFormat[key] = Object.assign(Object.assign({}, cloneOfExistingColumnFormat[key]), {
|
|
371
403
|
width: newWidth
|
|
@@ -375,10 +407,13 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
375
407
|
columnFormat: cloneOfExistingColumnFormat
|
|
376
408
|
});
|
|
377
409
|
};
|
|
410
|
+
|
|
378
411
|
vizProps.onColumnFormatChange = handleColumnFormatChange;
|
|
379
412
|
}
|
|
413
|
+
|
|
380
414
|
return vizProps;
|
|
381
415
|
};
|
|
416
|
+
|
|
382
417
|
exports.computeVizProps = computeVizProps;
|
|
383
418
|
var Table = (0, withDashboardViz_1.default)({
|
|
384
419
|
ReactViz: PureTable_1.default,
|
|
@@ -427,24 +462,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
427
462
|
|
|
428
463
|
|
|
429
464
|
var _toConsumableArray = __webpack_require__(8);
|
|
465
|
+
|
|
430
466
|
var _defineProperty = __webpack_require__(7);
|
|
467
|
+
|
|
431
468
|
var __rest = this && this.__rest || function (s, e) {
|
|
432
469
|
var t = {};
|
|
470
|
+
|
|
433
471
|
for (var p in s) {
|
|
434
472
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
435
473
|
}
|
|
474
|
+
|
|
436
475
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
437
476
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
438
477
|
}
|
|
439
478
|
return t;
|
|
440
479
|
};
|
|
480
|
+
|
|
441
481
|
Object.defineProperty(exports, "__esModule", {
|
|
442
482
|
value: true
|
|
443
483
|
});
|
|
444
484
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
485
|
+
|
|
445
486
|
var lodash_1 = __webpack_require__(3);
|
|
487
|
+
|
|
446
488
|
var schemaUtils_1 = __webpack_require__(16);
|
|
489
|
+
|
|
447
490
|
var VizBehavior_1 = __webpack_require__(6);
|
|
491
|
+
|
|
448
492
|
var dynamicOptionsDSLType = {
|
|
449
493
|
type: 'string',
|
|
450
494
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -454,20 +498,22 @@ var dynamicOptionsDSLType = {
|
|
|
454
498
|
* @param optionsSchema a visualization's options schema
|
|
455
499
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
456
500
|
*/
|
|
501
|
+
|
|
457
502
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
458
503
|
var enhancedOptionsSchema = {};
|
|
459
504
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
460
505
|
var _a = optionsSchema[key],
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
506
|
+
title = _a.title,
|
|
507
|
+
description = _a.description,
|
|
508
|
+
readOnly = _a.readOnly,
|
|
509
|
+
writeOnly = _a.writeOnly,
|
|
510
|
+
examples = _a.examples,
|
|
511
|
+
defaultValue = _a.default,
|
|
512
|
+
type = _a.type,
|
|
513
|
+
properties = _a.properties,
|
|
514
|
+
patternProperties = _a.patternProperties,
|
|
515
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
516
|
+
|
|
471
517
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
472
518
|
title: title
|
|
473
519
|
}), description !== undefined && {
|
|
@@ -481,12 +527,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
481
527
|
}), defaultValue !== undefined && {
|
|
482
528
|
default: defaultValue
|
|
483
529
|
});
|
|
530
|
+
|
|
484
531
|
if (type === 'object') {
|
|
485
532
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
486
533
|
type: type
|
|
487
534
|
}), properties && {
|
|
488
535
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
489
536
|
});
|
|
537
|
+
|
|
490
538
|
if (patternProperties) {
|
|
491
539
|
var enhancedPatternProperties = {};
|
|
492
540
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -504,6 +552,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
504
552
|
});
|
|
505
553
|
return enhancedOptionsSchema;
|
|
506
554
|
}
|
|
555
|
+
|
|
507
556
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
508
557
|
/**
|
|
509
558
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -512,11 +561,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
512
561
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
513
562
|
* and containing `open: false` for all editor panels in editorConfig
|
|
514
563
|
*/
|
|
564
|
+
|
|
515
565
|
function enhanceConfig(vizConfig) {
|
|
516
566
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
567
|
+
|
|
517
568
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
518
569
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
519
570
|
}
|
|
571
|
+
|
|
520
572
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
521
573
|
return Object.assign(Object.assign({}, config), {
|
|
522
574
|
open: config.open || false
|
|
@@ -524,6 +576,7 @@ function enhanceConfig(vizConfig) {
|
|
|
524
576
|
});
|
|
525
577
|
return enhancedConfig;
|
|
526
578
|
}
|
|
579
|
+
|
|
527
580
|
exports.enhanceConfig = enhanceConfig;
|
|
528
581
|
/**
|
|
529
582
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -531,6 +584,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
531
584
|
* @param vizConfig a Visualization Config
|
|
532
585
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
533
586
|
*/
|
|
587
|
+
|
|
534
588
|
function uncollapseEditorConfig(vizConfig) {
|
|
535
589
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
536
590
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -540,13 +594,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
540
594
|
});
|
|
541
595
|
return editorPanelUncollapsedConfig;
|
|
542
596
|
}
|
|
597
|
+
|
|
543
598
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
599
|
+
|
|
544
600
|
function isDynamicOption(option) {
|
|
545
601
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
546
602
|
}
|
|
547
|
-
|
|
548
|
-
// private helpers to improve readability of getInitialPreset
|
|
603
|
+
|
|
604
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
549
605
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
606
|
+
|
|
550
607
|
/**
|
|
551
608
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
552
609
|
* 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
|
|
@@ -555,6 +612,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
555
612
|
*
|
|
556
613
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
557
614
|
*/
|
|
615
|
+
|
|
558
616
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
559
617
|
var presetContextKeys = Object.keys(presetContext);
|
|
560
618
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -564,6 +622,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
564
622
|
/**
|
|
565
623
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
566
624
|
*/
|
|
625
|
+
|
|
626
|
+
|
|
567
627
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
568
628
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
569
629
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -578,18 +638,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
578
638
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
579
639
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
580
640
|
*/
|
|
641
|
+
|
|
642
|
+
|
|
581
643
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
582
644
|
return presets.find(function (preset) {
|
|
583
645
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
584
646
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
585
647
|
var presetContextKeys = Object.keys(presetContext);
|
|
586
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
587
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
648
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
588
649
|
// if not, then the preset is invalid in config.ts
|
|
650
|
+
|
|
589
651
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
590
652
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
591
653
|
});
|
|
592
654
|
}
|
|
655
|
+
|
|
593
656
|
exports.getInitialPreset = getInitialPreset;
|
|
594
657
|
/**
|
|
595
658
|
* generates number precision values for a Select editor
|
|
@@ -597,6 +660,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
597
660
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
598
661
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
599
662
|
*/
|
|
663
|
+
|
|
600
664
|
function generatePrecisionValues(numPrecisionValues) {
|
|
601
665
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
602
666
|
return {
|
|
@@ -605,6 +669,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
605
669
|
};
|
|
606
670
|
});
|
|
607
671
|
}
|
|
672
|
+
|
|
608
673
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
609
674
|
/**
|
|
610
675
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -614,12 +679,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
614
679
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
615
680
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
616
681
|
*/
|
|
682
|
+
|
|
617
683
|
var insertLayout = function insertLayout(layout, index) {
|
|
618
684
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
619
685
|
layoutItems[_key - 2] = arguments[_key];
|
|
620
686
|
}
|
|
687
|
+
|
|
621
688
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
622
689
|
};
|
|
690
|
+
|
|
623
691
|
exports.insertLayout = insertLayout;
|
|
624
692
|
|
|
625
693
|
/***/ }),
|
|
@@ -690,11 +758,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
690
758
|
value: true
|
|
691
759
|
});
|
|
692
760
|
exports.shouldShowIconPlaceholder = void 0;
|
|
761
|
+
|
|
693
762
|
var React = __webpack_require__(1);
|
|
763
|
+
|
|
694
764
|
var T = __webpack_require__(0);
|
|
765
|
+
|
|
695
766
|
var lodash_1 = __webpack_require__(3);
|
|
767
|
+
|
|
696
768
|
var i18n_1 = __webpack_require__(2);
|
|
769
|
+
|
|
697
770
|
var Message_1 = __webpack_require__(10);
|
|
771
|
+
|
|
698
772
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
699
773
|
/**
|
|
700
774
|
* @method shouldShowIconPlaceholder
|
|
@@ -702,6 +776,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
702
776
|
* @param {boolean} loading
|
|
703
777
|
* @returns {boolean}
|
|
704
778
|
*/
|
|
779
|
+
|
|
780
|
+
|
|
705
781
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
706
782
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
707
783
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -710,6 +786,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
710
786
|
var noFields = fields === undefined;
|
|
711
787
|
return loading || noData || noFields;
|
|
712
788
|
};
|
|
789
|
+
|
|
713
790
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
714
791
|
var propTypes = {
|
|
715
792
|
icon: T.func,
|
|
@@ -724,11 +801,13 @@ var propTypes = {
|
|
|
724
801
|
* @param {IconPlaceholderProps} props
|
|
725
802
|
* @returns {React.ReactElement}
|
|
726
803
|
*/
|
|
804
|
+
|
|
727
805
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
728
806
|
var width = props.width,
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
807
|
+
height = props.height,
|
|
808
|
+
icon = props.icon,
|
|
809
|
+
iconColor = props.iconColor;
|
|
810
|
+
|
|
732
811
|
if (icon) {
|
|
733
812
|
return React.createElement(icon, {
|
|
734
813
|
style: {
|
|
@@ -743,6 +822,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
743
822
|
height: '50%'
|
|
744
823
|
});
|
|
745
824
|
}
|
|
825
|
+
|
|
746
826
|
return React.createElement(Message_1.default, {
|
|
747
827
|
width: width,
|
|
748
828
|
height: height,
|
|
@@ -750,6 +830,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
750
830
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
751
831
|
});
|
|
752
832
|
};
|
|
833
|
+
|
|
753
834
|
IconPlaceholder.propTypes = propTypes;
|
|
754
835
|
IconPlaceholder.defaultProps = {
|
|
755
836
|
width: '100%',
|
|
@@ -766,21 +847,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
766
847
|
|
|
767
848
|
|
|
768
849
|
var _defineProperty = __webpack_require__(7);
|
|
850
|
+
|
|
769
851
|
Object.defineProperty(exports, "__esModule", {
|
|
770
852
|
value: true
|
|
771
853
|
});
|
|
772
854
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
855
|
+
|
|
773
856
|
var T = __webpack_require__(0);
|
|
857
|
+
|
|
774
858
|
var lodash_1 = __webpack_require__(3);
|
|
775
|
-
|
|
859
|
+
|
|
860
|
+
var DataSource_1 = __webpack_require__(34);
|
|
861
|
+
|
|
776
862
|
exports.SortParamsPropTypes = T.shape({
|
|
777
863
|
currentSortKey: T.string,
|
|
778
864
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
779
865
|
onSort: T.func
|
|
780
866
|
});
|
|
867
|
+
|
|
781
868
|
var getSortingParams = function getSortingParams(_ref) {
|
|
782
869
|
var requestParams = _ref.requestParams,
|
|
783
|
-
|
|
870
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
784
871
|
var currentSortKey;
|
|
785
872
|
var currentSortDir;
|
|
786
873
|
var nextSortDirMap = {
|
|
@@ -789,15 +876,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
789
876
|
none: 'asc'
|
|
790
877
|
};
|
|
791
878
|
var onSort;
|
|
879
|
+
|
|
792
880
|
if (typeof onRequestParamsChange === 'function') {
|
|
793
881
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
794
882
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
795
883
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
796
|
-
}
|
|
797
|
-
|
|
884
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
885
|
+
|
|
886
|
+
|
|
798
887
|
onSort = function onSort(e, _ref2) {
|
|
799
888
|
var sortKey = _ref2.sortKey,
|
|
800
|
-
|
|
889
|
+
sortDir = _ref2.sortDir;
|
|
890
|
+
|
|
801
891
|
if (typeof sortKey === 'string') {
|
|
802
892
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
803
893
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -809,12 +899,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
809
899
|
}
|
|
810
900
|
};
|
|
811
901
|
}
|
|
902
|
+
|
|
812
903
|
return {
|
|
813
904
|
currentSortKey: currentSortKey,
|
|
814
905
|
currentSortDir: currentSortDir,
|
|
815
906
|
onSort: onSort
|
|
816
907
|
};
|
|
817
908
|
};
|
|
909
|
+
|
|
818
910
|
exports.getSortingParams = getSortingParams;
|
|
819
911
|
|
|
820
912
|
/***/ }),
|
|
@@ -825,43 +917,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
825
917
|
"use strict";
|
|
826
918
|
|
|
827
919
|
|
|
920
|
+
Object.defineProperty(exports, "__esModule", {
|
|
921
|
+
value: true
|
|
922
|
+
});
|
|
923
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
924
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
925
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
926
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
927
|
+
|
|
928
|
+
/***/ }),
|
|
929
|
+
|
|
930
|
+
/***/ 35:
|
|
931
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
932
|
+
|
|
933
|
+
"use strict";
|
|
934
|
+
|
|
935
|
+
|
|
828
936
|
Object.defineProperty(exports, "__esModule", {
|
|
829
937
|
value: true
|
|
830
938
|
});
|
|
831
939
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
940
|
+
|
|
832
941
|
var T = __webpack_require__(0);
|
|
942
|
+
|
|
833
943
|
var lodash_1 = __webpack_require__(3);
|
|
944
|
+
|
|
834
945
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
835
946
|
isPaging: T.bool,
|
|
836
947
|
current: T.number,
|
|
837
948
|
totalPages: T.number,
|
|
838
949
|
onChange: T.func
|
|
839
950
|
});
|
|
951
|
+
|
|
840
952
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
841
953
|
var requestParams = _ref.requestParams,
|
|
842
|
-
|
|
843
|
-
|
|
954
|
+
meta = _ref.meta,
|
|
955
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
844
956
|
var totalCount = meta && meta.totalCount || 0;
|
|
845
957
|
var offset = requestParams && requestParams.offset || 0;
|
|
846
958
|
var count = requestParams && requestParams.count;
|
|
847
959
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
848
960
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
849
961
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
962
|
+
|
|
850
963
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
851
964
|
var page = _ref2.page,
|
|
852
|
-
|
|
965
|
+
countArg = _ref2.count;
|
|
853
966
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
967
|
+
|
|
854
968
|
if (typeof countArg === 'number') {
|
|
855
969
|
newParams.count = countArg;
|
|
856
970
|
newParams.offset = 0;
|
|
857
971
|
}
|
|
972
|
+
|
|
858
973
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
974
|
+
|
|
859
975
|
if (typeof page === 'number' && page > 0) {
|
|
860
976
|
newParams.count = pageCount;
|
|
861
977
|
newParams.offset = (page - 1) * pageCount;
|
|
862
978
|
}
|
|
979
|
+
|
|
863
980
|
onRequestParamsChange(newParams);
|
|
864
981
|
};
|
|
982
|
+
|
|
865
983
|
return {
|
|
866
984
|
isPaging: isPaging,
|
|
867
985
|
current: current,
|
|
@@ -869,11 +987,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
869
987
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
870
988
|
};
|
|
871
989
|
};
|
|
990
|
+
|
|
872
991
|
exports.getPaginationParams = getPaginationParams;
|
|
873
992
|
|
|
874
993
|
/***/ }),
|
|
875
994
|
|
|
876
|
-
/***/
|
|
995
|
+
/***/ 36:
|
|
877
996
|
/***/ (function(module, exports, __webpack_require__) {
|
|
878
997
|
|
|
879
998
|
"use strict";
|
|
@@ -884,6 +1003,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
884
1003
|
});
|
|
885
1004
|
exports.VizCategory = void 0;
|
|
886
1005
|
var VizCategory;
|
|
1006
|
+
|
|
887
1007
|
(function (VizCategory) {
|
|
888
1008
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
889
1009
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -901,67 +1021,96 @@ var VizCategory;
|
|
|
901
1021
|
|
|
902
1022
|
/***/ }),
|
|
903
1023
|
|
|
904
|
-
/***/
|
|
1024
|
+
/***/ 37:
|
|
905
1025
|
/***/ (function(module, exports, __webpack_require__) {
|
|
906
1026
|
|
|
907
1027
|
"use strict";
|
|
908
1028
|
|
|
909
1029
|
|
|
910
1030
|
var _slicedToArray = __webpack_require__(17);
|
|
1031
|
+
|
|
911
1032
|
Object.defineProperty(exports, "__esModule", {
|
|
912
1033
|
value: true
|
|
913
1034
|
});
|
|
1035
|
+
|
|
914
1036
|
var React = __webpack_require__(1);
|
|
1037
|
+
|
|
915
1038
|
var lodash_1 = __webpack_require__(3);
|
|
916
|
-
|
|
1039
|
+
|
|
1040
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1041
|
+
|
|
917
1042
|
var Options_1 = __webpack_require__(30);
|
|
918
|
-
|
|
1043
|
+
|
|
1044
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1045
|
+
|
|
919
1046
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
920
|
-
|
|
1047
|
+
|
|
1048
|
+
var moment_1 = __webpack_require__(40);
|
|
1049
|
+
|
|
921
1050
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1051
|
+
|
|
922
1052
|
var styled_components_1 = __webpack_require__(4);
|
|
1053
|
+
|
|
923
1054
|
var hocUtils_1 = __webpack_require__(27);
|
|
1055
|
+
|
|
924
1056
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
925
|
-
|
|
1057
|
+
|
|
1058
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1059
|
+
|
|
926
1060
|
var id_1 = __webpack_require__(25);
|
|
927
|
-
|
|
1061
|
+
|
|
1062
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1063
|
+
|
|
928
1064
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1065
|
+
|
|
929
1066
|
var getSorting_1 = __webpack_require__(33);
|
|
930
|
-
|
|
1067
|
+
|
|
1068
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1069
|
+
|
|
931
1070
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1071
|
+
|
|
932
1072
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1073
|
+
|
|
933
1074
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1075
|
+
|
|
934
1076
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
935
1077
|
/**
|
|
936
1078
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
937
1079
|
* @param {DashboardVizOpts} opts
|
|
938
1080
|
* @returns {HOC}
|
|
939
1081
|
*/
|
|
1082
|
+
|
|
1083
|
+
|
|
940
1084
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
941
1085
|
var ReactViz = opts.ReactViz,
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
1086
|
+
vizConfig = opts.vizConfig,
|
|
1087
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1088
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1089
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1090
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1091
|
+
|
|
947
1092
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
948
1093
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1094
|
+
|
|
949
1095
|
var DashboardViz = function DashboardViz(props) {
|
|
950
1096
|
var _a;
|
|
1097
|
+
|
|
951
1098
|
var mode = props.mode,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
1099
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1100
|
+
dataSources = props.dataSources,
|
|
1101
|
+
options = props.options,
|
|
1102
|
+
_props$context = props.context,
|
|
1103
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1104
|
+
width = props.width,
|
|
1105
|
+
height = props.height,
|
|
1106
|
+
onComputedProps = props.onComputedProps,
|
|
1107
|
+
onEventTrigger = props.onEventTrigger,
|
|
1108
|
+
theme = props.theme,
|
|
1109
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1110
|
+
|
|
963
1111
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
964
|
-
|
|
1112
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1113
|
+
|
|
965
1114
|
if (serializedTimezone) {
|
|
966
1115
|
/*
|
|
967
1116
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -975,38 +1124,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
975
1124
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
976
1125
|
}
|
|
977
1126
|
}
|
|
1127
|
+
|
|
978
1128
|
var themeFunc = function themeFunc(themeVar) {
|
|
979
1129
|
var _a, _b;
|
|
1130
|
+
|
|
980
1131
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
981
1132
|
};
|
|
1133
|
+
|
|
982
1134
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1135
|
+
|
|
983
1136
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1137
|
+
theme: theme
|
|
1138
|
+
}),
|
|
1139
|
+
currentThemeFamily = _ref.family,
|
|
1140
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1141
|
+
currentThemeDensity = _ref.density;
|
|
1142
|
+
|
|
989
1143
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1144
|
+
|
|
990
1145
|
var _React$useState = React.useState({}),
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
1146
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1147
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1148
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1149
|
+
|
|
1150
|
+
|
|
994
1151
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1152
|
+
|
|
995
1153
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
996
|
-
|
|
997
|
-
|
|
1154
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1155
|
+
visualizationID = _React$useState4[0];
|
|
1156
|
+
|
|
998
1157
|
var _React$useState5 = React.useState({}),
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1158
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1159
|
+
dataSourcesInState = _React$useState6[0],
|
|
1160
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1161
|
+
|
|
1002
1162
|
var _React$useState7 = React.useState(),
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1163
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1164
|
+
dataFramesInState = _React$useState8[0],
|
|
1165
|
+
setDataFramesInState = _React$useState8[1];
|
|
1166
|
+
|
|
1006
1167
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1168
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1169
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1170
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1171
|
+
|
|
1010
1172
|
var isMounted = React.useRef(true);
|
|
1011
1173
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1012
1174
|
try {
|
|
@@ -1031,11 +1193,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1031
1193
|
});
|
|
1032
1194
|
} else {
|
|
1033
1195
|
var dataFrames = dataFramesInState;
|
|
1196
|
+
|
|
1034
1197
|
if (dataSources !== dataSourcesInState) {
|
|
1035
1198
|
setDataSourcesInState(dataSources);
|
|
1036
1199
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1037
1200
|
setDataFramesInState(dataFrames);
|
|
1038
1201
|
}
|
|
1202
|
+
|
|
1039
1203
|
return Options_1.Options.evaluate({
|
|
1040
1204
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1041
1205
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -1046,21 +1210,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1046
1210
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1047
1211
|
return {};
|
|
1048
1212
|
}
|
|
1213
|
+
|
|
1049
1214
|
return {};
|
|
1050
1215
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1051
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1052
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1216
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1053
1217
|
// 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
|
|
1054
1218
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1219
|
+
|
|
1055
1220
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1056
1221
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1222
|
+
|
|
1057
1223
|
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) {
|
|
1058
1224
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1059
1225
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1060
1226
|
});
|
|
1061
|
-
}
|
|
1062
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1227
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1063
1228
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1229
|
+
|
|
1230
|
+
|
|
1064
1231
|
React.useEffect(function () {
|
|
1065
1232
|
onComputedProps(clonedEvaluatedOptions);
|
|
1066
1233
|
});
|
|
@@ -1070,44 +1237,49 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1070
1237
|
isMounted.current = false;
|
|
1071
1238
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1072
1239
|
}
|
|
1073
|
-
};
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
// present warning message if any required props are missing
|
|
1240
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1241
|
+
}, []); // present warning message if any required props are missing
|
|
1242
|
+
|
|
1077
1243
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1078
|
-
|
|
1079
|
-
|
|
1244
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1245
|
+
supports = vizConfig.supports;
|
|
1080
1246
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1247
|
+
|
|
1081
1248
|
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
|
|
1082
1249
|
) {
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1250
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1251
|
+
"data-test": "missing-props-message",
|
|
1252
|
+
width: width,
|
|
1253
|
+
height: height,
|
|
1254
|
+
missingProps: missing,
|
|
1255
|
+
backgroundColor: bgColorFromTheme
|
|
1256
|
+
});
|
|
1257
|
+
} // events
|
|
1258
|
+
|
|
1259
|
+
|
|
1092
1260
|
var eventCallbackProps = {};
|
|
1261
|
+
|
|
1093
1262
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1094
1263
|
var supportedEvents = vizConfig.events;
|
|
1095
1264
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1096
1265
|
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName));
|
|
1097
|
-
eventCallbackProps[eventCallbackPropName] = null;
|
|
1098
|
-
// todo: refactor single value and single value icon to send payload from viz
|
|
1266
|
+
eventCallbackProps[eventCallbackPropName] = null; // todo: refactor single value and single value icon to send payload from viz
|
|
1099
1267
|
// then remove these lines
|
|
1268
|
+
|
|
1100
1269
|
var payloadKeys = supportedEvents[eventName].payloadKeys;
|
|
1101
1270
|
var payload = {};
|
|
1271
|
+
|
|
1102
1272
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1103
1273
|
payloadKeys.forEach(function (p) {
|
|
1104
1274
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1105
1275
|
});
|
|
1106
1276
|
}
|
|
1277
|
+
|
|
1107
1278
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1108
1279
|
if (ev && ev.payload) {
|
|
1109
1280
|
payload = ev.payload;
|
|
1110
1281
|
}
|
|
1282
|
+
|
|
1111
1283
|
return onEventTrigger({
|
|
1112
1284
|
originalEvent: ev,
|
|
1113
1285
|
payload: payload,
|
|
@@ -1115,8 +1287,9 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1115
1287
|
});
|
|
1116
1288
|
};
|
|
1117
1289
|
});
|
|
1118
|
-
}
|
|
1119
|
-
|
|
1290
|
+
} // compute pure viz props which are not from options
|
|
1291
|
+
|
|
1292
|
+
|
|
1120
1293
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1121
1294
|
themeFunc: themeFunc
|
|
1122
1295
|
}));
|
|
@@ -1134,15 +1307,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1134
1307
|
* In future, we could automatically detect which all datasources are being used
|
|
1135
1308
|
* and bind those magically to pagination/sorting behavior.
|
|
1136
1309
|
*/
|
|
1310
|
+
|
|
1137
1311
|
var dataSourceMetadata = {};
|
|
1138
1312
|
var OptionKey = 'paginateDataSourceKey';
|
|
1139
1313
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1314
|
+
|
|
1140
1315
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1141
1316
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1142
1317
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1318
|
+
|
|
1143
1319
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1144
1320
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1145
1321
|
};
|
|
1322
|
+
|
|
1146
1323
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1147
1324
|
requestParams: requestParams,
|
|
1148
1325
|
meta: meta,
|
|
@@ -1157,115 +1334,132 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1157
1334
|
sortParams: sortParams,
|
|
1158
1335
|
paginatorParams: paginatorParams
|
|
1159
1336
|
};
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1337
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1338
|
+
|
|
1339
|
+
|
|
1162
1340
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1163
1341
|
return null;
|
|
1164
1342
|
}
|
|
1343
|
+
|
|
1165
1344
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1166
1345
|
mode: mode,
|
|
1167
1346
|
width: width,
|
|
1168
1347
|
height: height
|
|
1169
1348
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1170
1349
|
};
|
|
1350
|
+
|
|
1171
1351
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1172
1352
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1173
1353
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1174
1354
|
theme: {}
|
|
1175
|
-
});
|
|
1176
|
-
|
|
1177
|
-
DashboardViz.config = vizConfig;
|
|
1178
|
-
|
|
1355
|
+
}); // attach viz config
|
|
1356
|
+
|
|
1357
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1358
|
+
|
|
1179
1359
|
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1180
1360
|
};
|
|
1361
|
+
|
|
1181
1362
|
exports.default = withDashboardViz;
|
|
1182
1363
|
|
|
1183
1364
|
/***/ }),
|
|
1184
1365
|
|
|
1185
|
-
/***/
|
|
1366
|
+
/***/ 38:
|
|
1186
1367
|
/***/ (function(module, exports) {
|
|
1187
1368
|
|
|
1188
1369
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1189
1370
|
|
|
1190
1371
|
/***/ }),
|
|
1191
1372
|
|
|
1192
|
-
/***/
|
|
1373
|
+
/***/ 39:
|
|
1193
1374
|
/***/ (function(module, exports) {
|
|
1194
1375
|
|
|
1195
1376
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1196
1377
|
|
|
1197
1378
|
/***/ }),
|
|
1198
1379
|
|
|
1199
|
-
/***/
|
|
1380
|
+
/***/ 4:
|
|
1200
1381
|
/***/ (function(module, exports) {
|
|
1201
1382
|
|
|
1202
|
-
module.exports = require("
|
|
1383
|
+
module.exports = require("styled-components");
|
|
1203
1384
|
|
|
1204
1385
|
/***/ }),
|
|
1205
1386
|
|
|
1206
|
-
/***/
|
|
1387
|
+
/***/ 40:
|
|
1207
1388
|
/***/ (function(module, exports) {
|
|
1208
1389
|
|
|
1209
|
-
module.exports = require("
|
|
1390
|
+
module.exports = require("@splunk/moment");
|
|
1210
1391
|
|
|
1211
1392
|
/***/ }),
|
|
1212
1393
|
|
|
1213
|
-
/***/
|
|
1394
|
+
/***/ 41:
|
|
1214
1395
|
/***/ (function(module, exports) {
|
|
1215
1396
|
|
|
1216
1397
|
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1217
1398
|
|
|
1218
1399
|
/***/ }),
|
|
1219
1400
|
|
|
1220
|
-
/***/
|
|
1401
|
+
/***/ 42:
|
|
1221
1402
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1222
1403
|
|
|
1223
1404
|
"use strict";
|
|
1224
1405
|
|
|
1225
1406
|
|
|
1226
1407
|
var _classCallCheck = __webpack_require__(9);
|
|
1408
|
+
|
|
1227
1409
|
Object.defineProperty(exports, "__esModule", {
|
|
1228
1410
|
value: true
|
|
1229
1411
|
});
|
|
1230
1412
|
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1231
1413
|
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1414
|
+
|
|
1232
1415
|
var T = __webpack_require__(0);
|
|
1416
|
+
|
|
1233
1417
|
var lodash_1 = __webpack_require__(3);
|
|
1234
|
-
|
|
1235
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1418
|
+
|
|
1419
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1420
|
+
|
|
1421
|
+
|
|
1236
1422
|
exports.INITIAL_WIDTH = 250;
|
|
1237
1423
|
exports.INITIAL_HEIGHT = 250;
|
|
1238
1424
|
/**
|
|
1239
1425
|
* A Splunk visualization
|
|
1240
1426
|
*/
|
|
1427
|
+
|
|
1241
1428
|
var SplunkVisualization = function SplunkVisualization() {
|
|
1242
1429
|
_classCallCheck(this, SplunkVisualization);
|
|
1243
1430
|
};
|
|
1431
|
+
|
|
1244
1432
|
SplunkVisualization.propTypes = {
|
|
1245
1433
|
/**
|
|
1246
1434
|
* display mode
|
|
1247
1435
|
*/
|
|
1248
1436
|
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1437
|
+
|
|
1249
1438
|
/**
|
|
1250
1439
|
* width in pixel or string, defaults to 100%
|
|
1251
1440
|
*/
|
|
1252
1441
|
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1442
|
+
|
|
1253
1443
|
/**
|
|
1254
1444
|
* height in pixel or string
|
|
1255
1445
|
*/
|
|
1256
1446
|
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1447
|
+
|
|
1257
1448
|
/**
|
|
1258
1449
|
* visualization context used for dynamic option evaluation
|
|
1259
1450
|
*/
|
|
1260
1451
|
context: T.object,
|
|
1452
|
+
|
|
1261
1453
|
/**
|
|
1262
1454
|
* visualization formatting options
|
|
1263
1455
|
*/
|
|
1264
1456
|
options: T.object,
|
|
1457
|
+
|
|
1265
1458
|
/**
|
|
1266
1459
|
* A callback to update formatting options
|
|
1267
1460
|
*/
|
|
1268
1461
|
onOptionsChange: T.func,
|
|
1462
|
+
|
|
1269
1463
|
/**
|
|
1270
1464
|
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1271
1465
|
*/
|
|
@@ -1274,6 +1468,7 @@ SplunkVisualization.propTypes = {
|
|
|
1274
1468
|
* current request params
|
|
1275
1469
|
*/
|
|
1276
1470
|
requestParams: T.object,
|
|
1471
|
+
|
|
1277
1472
|
/**
|
|
1278
1473
|
* current dataset
|
|
1279
1474
|
*/
|
|
@@ -1281,6 +1476,7 @@ SplunkVisualization.propTypes = {
|
|
|
1281
1476
|
fields: T.array,
|
|
1282
1477
|
columns: T.array
|
|
1283
1478
|
}),
|
|
1479
|
+
|
|
1284
1480
|
/**
|
|
1285
1481
|
* error
|
|
1286
1482
|
*/
|
|
@@ -1288,29 +1484,35 @@ SplunkVisualization.propTypes = {
|
|
|
1288
1484
|
level: T.string,
|
|
1289
1485
|
message: T.string
|
|
1290
1486
|
}),
|
|
1487
|
+
|
|
1291
1488
|
/**
|
|
1292
1489
|
* meta data that came with the dataset
|
|
1293
1490
|
*/
|
|
1294
1491
|
meta: T.object
|
|
1295
1492
|
})),
|
|
1493
|
+
|
|
1296
1494
|
/**
|
|
1297
1495
|
* A callback to trigger event
|
|
1298
1496
|
*/
|
|
1299
1497
|
onEventTrigger: T.func,
|
|
1498
|
+
|
|
1300
1499
|
/**
|
|
1301
1500
|
* Inform viz if there are handlers listening to events
|
|
1302
1501
|
*/
|
|
1303
1502
|
hasEventHandlers: T.bool,
|
|
1503
|
+
|
|
1304
1504
|
/**
|
|
1305
1505
|
* A callback to communicate computed props to a consumer
|
|
1306
1506
|
*/
|
|
1307
1507
|
onComputedProps: T.func,
|
|
1508
|
+
|
|
1308
1509
|
/**
|
|
1309
1510
|
* A callback to obtain visualization api
|
|
1310
1511
|
*/
|
|
1311
1512
|
vizActionHandlerRef: T.func,
|
|
1312
1513
|
loading: T.bool,
|
|
1313
1514
|
theme: T.object,
|
|
1515
|
+
|
|
1314
1516
|
/**
|
|
1315
1517
|
* A callback to request new data with updated request params
|
|
1316
1518
|
*/
|
|
@@ -1319,6 +1521,7 @@ SplunkVisualization.propTypes = {
|
|
|
1319
1521
|
/**
|
|
1320
1522
|
*
|
|
1321
1523
|
*/
|
|
1524
|
+
|
|
1322
1525
|
SplunkVisualization.defaultProps = {
|
|
1323
1526
|
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1324
1527
|
width: '100%',
|
|
@@ -1347,26 +1550,29 @@ exports.default = SplunkVisualization;
|
|
|
1347
1550
|
|
|
1348
1551
|
/***/ }),
|
|
1349
1552
|
|
|
1350
|
-
/***/
|
|
1553
|
+
/***/ 43:
|
|
1351
1554
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1352
1555
|
|
|
1353
1556
|
"use strict";
|
|
1354
1557
|
|
|
1355
1558
|
|
|
1356
1559
|
var _classCallCheck = __webpack_require__(9);
|
|
1560
|
+
|
|
1357
1561
|
var _createClass = __webpack_require__(18);
|
|
1562
|
+
|
|
1358
1563
|
Object.defineProperty(exports, "__esModule", {
|
|
1359
1564
|
value: true
|
|
1360
1565
|
});
|
|
1361
1566
|
exports.DefaultVizActionHandler = void 0;
|
|
1567
|
+
|
|
1362
1568
|
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
1363
1569
|
function DefaultVizActionHandler() {
|
|
1364
1570
|
_classCallCheck(this, DefaultVizActionHandler);
|
|
1365
1571
|
}
|
|
1572
|
+
|
|
1366
1573
|
_createClass(DefaultVizActionHandler, [{
|
|
1367
1574
|
key: "focus",
|
|
1368
|
-
value: function focus() {
|
|
1369
|
-
// noop
|
|
1575
|
+
value: function focus() {// noop
|
|
1370
1576
|
}
|
|
1371
1577
|
}, {
|
|
1372
1578
|
key: "snapshot",
|
|
@@ -1374,23 +1580,11 @@ var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
|
1374
1580
|
return null; // noop
|
|
1375
1581
|
}
|
|
1376
1582
|
}]);
|
|
1583
|
+
|
|
1377
1584
|
return DefaultVizActionHandler;
|
|
1378
1585
|
}();
|
|
1379
|
-
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1380
|
-
|
|
1381
|
-
/***/ }),
|
|
1382
|
-
|
|
1383
|
-
/***/ 43:
|
|
1384
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1385
1586
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1390
|
-
value: true
|
|
1391
|
-
});
|
|
1392
|
-
exports.validSortDirs = void 0;
|
|
1393
|
-
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1587
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
1394
1588
|
|
|
1395
1589
|
/***/ }),
|
|
1396
1590
|
|
|
@@ -1404,7 +1598,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1404
1598
|
value: true
|
|
1405
1599
|
});
|
|
1406
1600
|
exports.useDeepMemo = void 0;
|
|
1601
|
+
|
|
1407
1602
|
var react_1 = __webpack_require__(1);
|
|
1603
|
+
|
|
1408
1604
|
var lodash_1 = __webpack_require__(3);
|
|
1409
1605
|
/**
|
|
1410
1606
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -1419,16 +1615,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
1419
1615
|
* @param fn the function to be executed and
|
|
1420
1616
|
* @param dependencies an array of dependencies
|
|
1421
1617
|
*/
|
|
1618
|
+
|
|
1619
|
+
|
|
1422
1620
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
1423
1621
|
var ref = (0, react_1.useRef)();
|
|
1622
|
+
|
|
1424
1623
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
1425
1624
|
ref.current = {
|
|
1426
1625
|
dependencies: dependencies,
|
|
1427
1626
|
value: fn()
|
|
1428
1627
|
};
|
|
1429
1628
|
}
|
|
1629
|
+
|
|
1430
1630
|
return ref.current.value;
|
|
1431
1631
|
};
|
|
1632
|
+
|
|
1432
1633
|
exports.useDeepMemo = useDeepMemo;
|
|
1433
1634
|
|
|
1434
1635
|
/***/ }),
|
|
@@ -1443,19 +1644,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1443
1644
|
value: true
|
|
1444
1645
|
});
|
|
1445
1646
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
1647
|
+
|
|
1446
1648
|
var React = __webpack_require__(1);
|
|
1649
|
+
|
|
1447
1650
|
var T = __webpack_require__(0);
|
|
1651
|
+
|
|
1448
1652
|
var i18n_1 = __webpack_require__(2);
|
|
1653
|
+
|
|
1449
1654
|
var Message_1 = __webpack_require__(10);
|
|
1655
|
+
|
|
1450
1656
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1451
1657
|
/**
|
|
1452
1658
|
* @method isMissing
|
|
1453
1659
|
* @param {any} v
|
|
1454
1660
|
* @returns {boolean} true if the input value === null or undefined
|
|
1455
1661
|
*/
|
|
1662
|
+
|
|
1663
|
+
|
|
1456
1664
|
var isMissing = function isMissing(v) {
|
|
1457
1665
|
return v === null || v === undefined;
|
|
1458
1666
|
};
|
|
1667
|
+
|
|
1459
1668
|
exports.isMissing = isMissing;
|
|
1460
1669
|
/**
|
|
1461
1670
|
* @method misskingKeys
|
|
@@ -1463,11 +1672,13 @@ exports.isMissing = isMissing;
|
|
|
1463
1672
|
* @param {object} target
|
|
1464
1673
|
* @returns {string[]} the keys of missing required props
|
|
1465
1674
|
*/
|
|
1675
|
+
|
|
1466
1676
|
var missingKeys = function missingKeys(keys, target) {
|
|
1467
1677
|
return keys.filter(function (k) {
|
|
1468
1678
|
return (0, exports.isMissing)(target[k]);
|
|
1469
1679
|
});
|
|
1470
1680
|
};
|
|
1681
|
+
|
|
1471
1682
|
exports.missingKeys = missingKeys;
|
|
1472
1683
|
var propTypes = {
|
|
1473
1684
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -1481,10 +1692,11 @@ var propTypes = {
|
|
|
1481
1692
|
* @param {MissingPropsProps} props
|
|
1482
1693
|
* @returns {React.ReactElement}
|
|
1483
1694
|
*/
|
|
1695
|
+
|
|
1484
1696
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
1485
1697
|
var width = props.width,
|
|
1486
|
-
|
|
1487
|
-
|
|
1698
|
+
height = props.height,
|
|
1699
|
+
missingProps = props.missingProps;
|
|
1488
1700
|
return React.createElement(Message_1.default, {
|
|
1489
1701
|
"data-test": "message",
|
|
1490
1702
|
width: width,
|
|
@@ -1492,6 +1704,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
1492
1704
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
1493
1705
|
});
|
|
1494
1706
|
};
|
|
1707
|
+
|
|
1495
1708
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
1496
1709
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
1497
1710
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -1511,15 +1724,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
1511
1724
|
Object.defineProperty(exports, "__esModule", {
|
|
1512
1725
|
value: true
|
|
1513
1726
|
});
|
|
1727
|
+
|
|
1514
1728
|
var React = __webpack_require__(1);
|
|
1729
|
+
|
|
1515
1730
|
var styled_components_1 = __webpack_require__(4);
|
|
1731
|
+
|
|
1516
1732
|
var hocUtils_1 = __webpack_require__(15);
|
|
1733
|
+
|
|
1517
1734
|
var Cover = styled_components_1.default.div.withConfig({
|
|
1518
1735
|
displayName: "withEditModeCover__Cover",
|
|
1519
1736
|
componentId: "sc-1gsbnxb-0"
|
|
1520
1737
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
1521
1738
|
var Blocker = styled_components_1.default.div.attrs({
|
|
1522
|
-
'data-splunk-visualization-version': "26.
|
|
1739
|
+
'data-splunk-visualization-version': "26.1.0 - fc8bf8d77"
|
|
1523
1740
|
}).withConfig({
|
|
1524
1741
|
displayName: "withEditModeCover__Blocker",
|
|
1525
1742
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -1530,6 +1747,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
1530
1747
|
* @param {ExtendedDashViz} Visualization
|
|
1531
1748
|
* @returns {ExtendedDashViz} Wrapper
|
|
1532
1749
|
*/
|
|
1750
|
+
|
|
1533
1751
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
1534
1752
|
var Wrapper = function Wrapper(props) {
|
|
1535
1753
|
var mode = props.mode;
|
|
@@ -1538,12 +1756,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
1538
1756
|
"data-test": "edit-mode-cover"
|
|
1539
1757
|
}));
|
|
1540
1758
|
};
|
|
1759
|
+
|
|
1541
1760
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1542
1761
|
Wrapper: Wrapper,
|
|
1543
1762
|
Visualization: Visualization
|
|
1544
1763
|
});
|
|
1545
1764
|
return Wrapper;
|
|
1546
1765
|
};
|
|
1766
|
+
|
|
1547
1767
|
exports.default = withEditModeCover;
|
|
1548
1768
|
|
|
1549
1769
|
/***/ }),
|
|
@@ -1557,27 +1777,37 @@ exports.default = withEditModeCover;
|
|
|
1557
1777
|
Object.defineProperty(exports, "__esModule", {
|
|
1558
1778
|
value: true
|
|
1559
1779
|
});
|
|
1780
|
+
|
|
1560
1781
|
var React = __webpack_require__(1);
|
|
1782
|
+
|
|
1561
1783
|
var colorUtils_1 = __webpack_require__(12);
|
|
1784
|
+
|
|
1562
1785
|
var variables_1 = __webpack_require__(11);
|
|
1786
|
+
|
|
1563
1787
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
1788
|
+
|
|
1564
1789
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1790
|
+
|
|
1565
1791
|
var hocUtils_1 = __webpack_require__(15);
|
|
1792
|
+
|
|
1566
1793
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
1567
1794
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
1568
1795
|
var config = Visualization.config;
|
|
1569
1796
|
var themes = config.themes;
|
|
1797
|
+
|
|
1570
1798
|
var Wrapper = function Wrapper(props) {
|
|
1571
1799
|
var _a, _b;
|
|
1800
|
+
|
|
1572
1801
|
var dataSources = props.dataSources,
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1802
|
+
loading = props.loading,
|
|
1803
|
+
options = props.options,
|
|
1804
|
+
height = props.height,
|
|
1805
|
+
width = props.width;
|
|
1577
1806
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
1578
1807
|
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);
|
|
1579
1808
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
1580
1809
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
1810
|
+
|
|
1581
1811
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
1582
1812
|
return React.createElement(IconPlaceholder_1.default, {
|
|
1583
1813
|
"data-test": "icon-placeholder",
|
|
@@ -1588,14 +1818,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
1588
1818
|
iconColor: iconColor
|
|
1589
1819
|
});
|
|
1590
1820
|
}
|
|
1821
|
+
|
|
1591
1822
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
1592
1823
|
};
|
|
1824
|
+
|
|
1593
1825
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
1594
1826
|
Wrapper: Wrapper,
|
|
1595
1827
|
Visualization: Visualization
|
|
1596
1828
|
});
|
|
1597
1829
|
return Wrapper;
|
|
1598
1830
|
};
|
|
1831
|
+
|
|
1599
1832
|
exports.default = withPlaceholder;
|
|
1600
1833
|
|
|
1601
1834
|
/***/ }),
|
|
@@ -1609,6 +1842,7 @@ exports.default = withPlaceholder;
|
|
|
1609
1842
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1610
1843
|
if (k2 === undefined) k2 = k;
|
|
1611
1844
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1845
|
+
|
|
1612
1846
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1613
1847
|
desc = {
|
|
1614
1848
|
enumerable: true,
|
|
@@ -1617,25 +1851,30 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
1617
1851
|
}
|
|
1618
1852
|
};
|
|
1619
1853
|
}
|
|
1854
|
+
|
|
1620
1855
|
Object.defineProperty(o, k2, desc);
|
|
1621
1856
|
} : function (o, m, k, k2) {
|
|
1622
1857
|
if (k2 === undefined) k2 = k;
|
|
1623
1858
|
o[k2] = m[k];
|
|
1624
1859
|
});
|
|
1860
|
+
|
|
1625
1861
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1626
1862
|
for (var p in m) {
|
|
1627
1863
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1628
1864
|
}
|
|
1629
1865
|
};
|
|
1866
|
+
|
|
1630
1867
|
Object.defineProperty(exports, "__esModule", {
|
|
1631
1868
|
value: true
|
|
1632
1869
|
});
|
|
1633
|
-
exports.default = void 0;
|
|
1634
|
-
// NOTE: wildcard syntax only works for named exports
|
|
1870
|
+
exports.default = void 0; // NOTE: wildcard syntax only works for named exports
|
|
1635
1871
|
// for some reason, omitting the default export worked before TS v4
|
|
1636
1872
|
// see: https://stackoverflow.com/a/34445175
|
|
1873
|
+
|
|
1637
1874
|
__exportStar(__webpack_require__(168), exports);
|
|
1875
|
+
|
|
1638
1876
|
var Table_1 = __webpack_require__(168);
|
|
1877
|
+
|
|
1639
1878
|
Object.defineProperty(exports, "default", {
|
|
1640
1879
|
enumerable: true,
|
|
1641
1880
|
get: function get() {
|
|
@@ -1659,21 +1898,35 @@ module.exports = require("@babel/runtime/helpers/extends");
|
|
|
1659
1898
|
|
|
1660
1899
|
|
|
1661
1900
|
var _toConsumableArray = __webpack_require__(8);
|
|
1901
|
+
|
|
1662
1902
|
Object.defineProperty(exports, "__esModule", {
|
|
1663
1903
|
value: true
|
|
1664
1904
|
});
|
|
1905
|
+
|
|
1665
1906
|
var i18n_1 = __webpack_require__(2);
|
|
1907
|
+
|
|
1666
1908
|
var lodash_1 = __webpack_require__(3);
|
|
1909
|
+
|
|
1667
1910
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1911
|
+
|
|
1668
1912
|
var colorConstants_1 = __webpack_require__(49);
|
|
1913
|
+
|
|
1669
1914
|
var visualization_icons_1 = __webpack_require__(52);
|
|
1915
|
+
|
|
1670
1916
|
var placeholders_1 = __webpack_require__(50);
|
|
1917
|
+
|
|
1671
1918
|
var variables_1 = __webpack_require__(11);
|
|
1919
|
+
|
|
1672
1920
|
var pick_1 = __webpack_require__(23);
|
|
1921
|
+
|
|
1673
1922
|
var configUtils_1 = __webpack_require__(20);
|
|
1923
|
+
|
|
1674
1924
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1925
|
+
|
|
1675
1926
|
var consts_1 = __webpack_require__(137);
|
|
1676
|
-
|
|
1927
|
+
|
|
1928
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
1929
|
+
|
|
1677
1930
|
var dataContract = {
|
|
1678
1931
|
requiredDataSources: [{
|
|
1679
1932
|
name: 'primary',
|
|
@@ -2150,8 +2403,8 @@ var themes = {
|
|
|
2150
2403
|
enterprise: {
|
|
2151
2404
|
dark: variables_1.default.contentColorInverted(props),
|
|
2152
2405
|
light: variables_1.default.white(props) // equal to textColor in enterpriseDark
|
|
2153
|
-
},
|
|
2154
2406
|
|
|
2407
|
+
},
|
|
2155
2408
|
prisma: variables_1.default.contentColorInverted(props)
|
|
2156
2409
|
})(props);
|
|
2157
2410
|
}
|
|
@@ -2318,7 +2571,7 @@ var editorConfig = [{
|
|
|
2318
2571
|
},
|
|
2319
2572
|
value: function value(_ref) {
|
|
2320
2573
|
var context = _ref.context,
|
|
2321
|
-
|
|
2574
|
+
options = _ref.options;
|
|
2322
2575
|
return {
|
|
2323
2576
|
context: context,
|
|
2324
2577
|
columnFormat: options.columnFormat,
|
|
@@ -2332,16 +2585,19 @@ var editorConfig = [{
|
|
|
2332
2585
|
/**
|
|
2333
2586
|
* visualization configuration
|
|
2334
2587
|
*/
|
|
2588
|
+
|
|
2335
2589
|
var config = {
|
|
2336
2590
|
/**
|
|
2337
2591
|
* unique viz key
|
|
2338
2592
|
*/
|
|
2339
2593
|
key: 'splunk.table',
|
|
2594
|
+
|
|
2340
2595
|
/**
|
|
2341
2596
|
* viz name
|
|
2342
2597
|
*/
|
|
2343
2598
|
name: (0, i18n_1._)('Table'),
|
|
2344
2599
|
category: VizCategory_1.VizCategory.TABLE,
|
|
2600
|
+
|
|
2345
2601
|
/**
|
|
2346
2602
|
* viz icon
|
|
2347
2603
|
*/
|
|
@@ -2371,43 +2627,69 @@ exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
|
2371
2627
|
|
|
2372
2628
|
|
|
2373
2629
|
var _slicedToArray = __webpack_require__(17);
|
|
2630
|
+
|
|
2374
2631
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
2632
|
+
|
|
2375
2633
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
2634
|
+
|
|
2376
2635
|
var __rest = this && this.__rest || function (s, e) {
|
|
2377
2636
|
var t = {};
|
|
2637
|
+
|
|
2378
2638
|
for (var p in s) {
|
|
2379
2639
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2380
2640
|
}
|
|
2641
|
+
|
|
2381
2642
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2382
2643
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2383
2644
|
}
|
|
2384
2645
|
return t;
|
|
2385
2646
|
};
|
|
2647
|
+
|
|
2386
2648
|
Object.defineProperty(exports, "__esModule", {
|
|
2387
2649
|
value: true
|
|
2388
2650
|
});
|
|
2389
2651
|
exports.INITIAL_UNSET_COLUMN_WIDTH = exports.MINIMUM_COLUMN_SIZE = void 0;
|
|
2652
|
+
|
|
2390
2653
|
var React = __webpack_require__(1);
|
|
2654
|
+
|
|
2391
2655
|
var T = __webpack_require__(0);
|
|
2656
|
+
|
|
2392
2657
|
var lodash_1 = __webpack_require__(3);
|
|
2658
|
+
|
|
2393
2659
|
var styled_components_1 = __webpack_require__(4);
|
|
2660
|
+
|
|
2394
2661
|
var i18n_1 = __webpack_require__(2);
|
|
2662
|
+
|
|
2395
2663
|
var Table_1 = __webpack_require__(112);
|
|
2396
|
-
|
|
2664
|
+
|
|
2665
|
+
var Paginator_1 = __webpack_require__(94);
|
|
2666
|
+
|
|
2397
2667
|
var Message_1 = __webpack_require__(124);
|
|
2668
|
+
|
|
2398
2669
|
var colorUtils_1 = __webpack_require__(12);
|
|
2670
|
+
|
|
2399
2671
|
var style_1 = __webpack_require__(14);
|
|
2672
|
+
|
|
2400
2673
|
var pick_1 = __webpack_require__(23);
|
|
2674
|
+
|
|
2401
2675
|
var variables_1 = __webpack_require__(11);
|
|
2676
|
+
|
|
2402
2677
|
var hooks_1 = __webpack_require__(482);
|
|
2678
|
+
|
|
2403
2679
|
var consts_1 = __webpack_require__(137);
|
|
2680
|
+
|
|
2404
2681
|
var cells_1 = __webpack_require__(483);
|
|
2405
|
-
|
|
2682
|
+
|
|
2683
|
+
var getPagination_1 = __webpack_require__(35);
|
|
2684
|
+
|
|
2406
2685
|
var getSorting_1 = __webpack_require__(33);
|
|
2407
|
-
|
|
2408
|
-
// debounce was imported this way due to typing
|
|
2686
|
+
|
|
2687
|
+
var FixedSizeContainer_1 = __webpack_require__(13); // debounce was imported this way due to typing
|
|
2409
2688
|
// eslint-disable-next-line import/order
|
|
2689
|
+
|
|
2690
|
+
|
|
2410
2691
|
var debounce = __webpack_require__(488);
|
|
2692
|
+
|
|
2411
2693
|
exports.MINIMUM_COLUMN_SIZE = 30;
|
|
2412
2694
|
exports.INITIAL_UNSET_COLUMN_WIDTH = 90;
|
|
2413
2695
|
var NonVisibleTableHead = (0, styled_components_1.default)(Table_1.default.Head)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n pointer-events: none;\n & [data-test='head-cell'] > div {\n height: 0;\n padding: 0;\n margin: 0;\n }\n"])));
|
|
@@ -2442,9 +2724,9 @@ var SUITableContainer = styled_components_1.default.div.withConfig({
|
|
|
2442
2724
|
return props.lineHeight;
|
|
2443
2725
|
}, function (_ref3) {
|
|
2444
2726
|
var width = _ref3.width,
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2727
|
+
height = _ref3.height,
|
|
2728
|
+
isPaging = _ref3.isPaging,
|
|
2729
|
+
theme = _ref3.theme;
|
|
2448
2730
|
var padding = (0, pick_1.default)({
|
|
2449
2731
|
enterprise: variables_1.default.spacingHalf({
|
|
2450
2732
|
theme: theme
|
|
@@ -2478,69 +2760,79 @@ var PaginatorContainer = styled_components_1.default.div.withConfig({
|
|
|
2478
2760
|
displayName: "PureTable__PaginatorContainer",
|
|
2479
2761
|
componentId: "tovzjg-2"
|
|
2480
2762
|
})(["position:relative;text-align:right;height:", "px;"], PAGINATOR_CONTAINER_HEIGHT);
|
|
2481
|
-
PaginatorContainer.displayName = 'PaginatorContainer';
|
|
2482
|
-
|
|
2763
|
+
PaginatorContainer.displayName = 'PaginatorContainer'; // allow for early return in case of empty tableBody while still following hook rules
|
|
2764
|
+
|
|
2483
2765
|
var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
|
|
2484
2766
|
// TODO(fkurniawan): add omit type to differentiate WrapperProps from PureTableProps
|
|
2485
2767
|
var Wrapper = function Wrapper(props) {
|
|
2486
2768
|
var headers = props.headers,
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2769
|
+
table = props.table,
|
|
2770
|
+
headerVisibility = props.headerVisibility,
|
|
2771
|
+
showRowNumbers = props.showRowNumbers,
|
|
2772
|
+
showInternalFields = props.showInternalFields,
|
|
2773
|
+
tableFormat = props.tableFormat,
|
|
2774
|
+
columnFormat = props.columnFormat,
|
|
2775
|
+
paginatorParams = props.paginatorParams,
|
|
2776
|
+
count = props.count;
|
|
2777
|
+
|
|
2495
2778
|
var _ref8 = (0, hooks_1.useTable)({
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
}),
|
|
2508
|
-
columnFormat: columnFormat,
|
|
2509
|
-
paginationOffset: paginatorParams === null || paginatorParams === void 0 ? void 0 : paginatorParams.current,
|
|
2510
|
-
count: count
|
|
2779
|
+
headers: headers,
|
|
2780
|
+
table: table,
|
|
2781
|
+
headerVisibility: headerVisibility,
|
|
2782
|
+
showRowNumbers: showRowNumbers,
|
|
2783
|
+
showInternalFields: showInternalFields,
|
|
2784
|
+
tableFormat: Object.assign(Object.assign(Object.assign(Object.assign({}, tableFormat), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.align) && {
|
|
2785
|
+
align: (0, lodash_1.cloneDeep)(tableFormat.align)
|
|
2786
|
+
}), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.cellTypes) && {
|
|
2787
|
+
cellTypes: (0, lodash_1.cloneDeep)(tableFormat.cellTypes)
|
|
2788
|
+
}), (tableFormat === null || tableFormat === void 0 ? void 0 : tableFormat.data) && {
|
|
2789
|
+
data: (0, lodash_1.cloneDeep)(tableFormat.data)
|
|
2511
2790
|
}),
|
|
2512
|
-
|
|
2513
|
-
|
|
2791
|
+
columnFormat: columnFormat,
|
|
2792
|
+
paginationOffset: paginatorParams === null || paginatorParams === void 0 ? void 0 : paginatorParams.current,
|
|
2793
|
+
count: count
|
|
2794
|
+
}),
|
|
2795
|
+
tableHeader = _ref8.tableHeader,
|
|
2796
|
+
tableBody = _ref8.tableBody;
|
|
2797
|
+
|
|
2514
2798
|
if (tableBody.rows.length === 0) {
|
|
2515
2799
|
return React.createElement(Message_1.default, {
|
|
2516
2800
|
type: "warning"
|
|
2517
2801
|
}, (0, i18n_1._)('No data!'));
|
|
2518
2802
|
}
|
|
2803
|
+
|
|
2519
2804
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
2520
2805
|
tableHeader: tableHeader,
|
|
2521
2806
|
tableBody: tableBody
|
|
2522
2807
|
}));
|
|
2523
2808
|
};
|
|
2809
|
+
|
|
2524
2810
|
Wrapper.displayName = 'PureTableWrapper';
|
|
2525
2811
|
return Wrapper;
|
|
2526
2812
|
};
|
|
2813
|
+
|
|
2527
2814
|
var useTableHead = function useTableHead(visibility) {
|
|
2528
2815
|
if (visibility === 'none') {
|
|
2529
2816
|
return NonVisibleTableHead;
|
|
2530
2817
|
}
|
|
2818
|
+
|
|
2531
2819
|
if (visibility === 'fixed') {
|
|
2532
2820
|
return FixedTableHead;
|
|
2533
2821
|
}
|
|
2822
|
+
|
|
2534
2823
|
return Table_1.default.Head;
|
|
2535
2824
|
};
|
|
2825
|
+
|
|
2536
2826
|
var HeadCell = function HeadCell(_a) {
|
|
2537
2827
|
var value = _a.value,
|
|
2538
|
-
|
|
2828
|
+
props = __rest(_a, ["value"]);
|
|
2829
|
+
|
|
2539
2830
|
var cellRef = React.useRef(null);
|
|
2540
2831
|
return React.createElement(TableHeadCell, Object.assign({
|
|
2541
2832
|
elementRef: cellRef
|
|
2542
2833
|
}, props), value);
|
|
2543
2834
|
};
|
|
2835
|
+
|
|
2544
2836
|
var fontMap = {
|
|
2545
2837
|
proportional: 'Splunk Platform Sans',
|
|
2546
2838
|
monospace: 'Splunk Platform Mono'
|
|
@@ -2560,40 +2852,44 @@ var rowHeightMap = {
|
|
|
2560
2852
|
var tableInnerStyle = {
|
|
2561
2853
|
height: '100%'
|
|
2562
2854
|
};
|
|
2855
|
+
|
|
2563
2856
|
var PureTable = function PureTable(props) {
|
|
2564
2857
|
var count = props.count,
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2858
|
+
width = props.width,
|
|
2859
|
+
height = props.height,
|
|
2860
|
+
backgroundColor = props.backgroundColor,
|
|
2861
|
+
tableHeader = props.tableHeader,
|
|
2862
|
+
tableBody = props.tableBody,
|
|
2863
|
+
showRowNumbers = props.showRowNumbers,
|
|
2864
|
+
_props$sortParams = props.sortParams,
|
|
2865
|
+
currentSortKey = _props$sortParams.currentSortKey,
|
|
2866
|
+
currentSortDir = _props$sortParams.currentSortDir,
|
|
2867
|
+
onSort = _props$sortParams.onSort,
|
|
2868
|
+
_a = props.paginatorParams,
|
|
2869
|
+
isPaging = _a.isPaging,
|
|
2870
|
+
paginatorOnChange = _a.onChange,
|
|
2871
|
+
paginatorProps = __rest(_a, ["isPaging", "onChange"]),
|
|
2872
|
+
onCellClick = props.onCellClick,
|
|
2873
|
+
onColumnFormatChange = props.onColumnFormatChange,
|
|
2874
|
+
columnFormat = props.columnFormat,
|
|
2875
|
+
mode = props.mode,
|
|
2876
|
+
headerVisibility = props.headerVisibility,
|
|
2877
|
+
font = props.font,
|
|
2878
|
+
fontSize = props.fontSize;
|
|
2879
|
+
|
|
2586
2880
|
var _React$useState = React.useState(columnFormat),
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2881
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2882
|
+
columns = _React$useState2[0],
|
|
2883
|
+
setColumns = _React$useState2[1];
|
|
2884
|
+
|
|
2590
2885
|
var containerRef = React.useRef(null);
|
|
2591
|
-
var containerRefInner = React.useRef(null);
|
|
2592
|
-
|
|
2886
|
+
var containerRefInner = React.useRef(null); // this state avoids unncessary column sorting when column resize ends
|
|
2887
|
+
|
|
2593
2888
|
var _React$useState3 = React.useState(false),
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2889
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2890
|
+
isResizing = _React$useState4[0],
|
|
2891
|
+
setResizing = _React$useState4[1];
|
|
2892
|
+
|
|
2597
2893
|
var firstRenderCount = React.useRef(count);
|
|
2598
2894
|
React.useEffect(function () {
|
|
2599
2895
|
if (firstRenderCount.current !== count) {
|
|
@@ -2616,6 +2912,7 @@ var PureTable = function PureTable(props) {
|
|
|
2616
2912
|
var TableHead = useTableHead(headerVisibility);
|
|
2617
2913
|
var tableCellClickHandler = React.useCallback(function (e) {
|
|
2618
2914
|
setResizing(false); // The resizing state will be set back to false on any cell click
|
|
2915
|
+
|
|
2619
2916
|
return onCellClick ? drilldownHandler(e) : lodash_1.noop;
|
|
2620
2917
|
}, [onCellClick, showRowNumbers, tableHeader, tableBody]);
|
|
2621
2918
|
var debouncedDrilldown = debounce(function (e, payload) {
|
|
@@ -2628,11 +2925,13 @@ var PureTable = function PureTable(props) {
|
|
|
2628
2925
|
}
|
|
2629
2926
|
}
|
|
2630
2927
|
}, 200);
|
|
2928
|
+
|
|
2631
2929
|
var drilldownHandler = function drilldownHandler(e) {
|
|
2632
2930
|
var element = e.target;
|
|
2633
2931
|
var row = element.getAttribute('data-row-index');
|
|
2634
2932
|
var col = element.getAttribute('data-col-index');
|
|
2635
2933
|
var arrayIndex = element.getAttribute('data-array-index') || -1;
|
|
2934
|
+
|
|
2636
2935
|
if (row && col) {
|
|
2637
2936
|
var cellRefIndex = +col;
|
|
2638
2937
|
var cellIndex = cellRefIndex;
|
|
@@ -2640,16 +2939,18 @@ var PureTable = function PureTable(props) {
|
|
|
2640
2939
|
var fieldValue = tableHeader.cells[cellRefIndex].value;
|
|
2641
2940
|
var cellValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
|
|
2642
2941
|
var cellRawValue = tableBody.rows[rowIndex].cells[cellRefIndex].value;
|
|
2643
|
-
var value = arrayIndex === -1 ? cellValue : cellRawValue[+arrayIndex];
|
|
2644
|
-
// Wish we did not have these if statements for
|
|
2942
|
+
var value = arrayIndex === -1 ? cellValue : cellRawValue[+arrayIndex]; // Wish we did not have these if statements for
|
|
2645
2943
|
// showRowNumbers
|
|
2944
|
+
|
|
2646
2945
|
if (showRowNumbers === true) {
|
|
2647
2946
|
if (cellIndex === 0) {
|
|
2648
2947
|
// no click event for row numbers
|
|
2649
2948
|
return;
|
|
2650
2949
|
}
|
|
2950
|
+
|
|
2651
2951
|
cellIndex -= 1;
|
|
2652
2952
|
}
|
|
2953
|
+
|
|
2653
2954
|
var payload = {
|
|
2654
2955
|
cellIndex: cellIndex,
|
|
2655
2956
|
rowIndex: rowIndex,
|
|
@@ -2666,23 +2967,28 @@ var PureTable = function PureTable(props) {
|
|
|
2666
2967
|
debouncedDrilldown(e.nativeEvent, payload);
|
|
2667
2968
|
}
|
|
2668
2969
|
};
|
|
2970
|
+
|
|
2669
2971
|
var debouncedOnColumnFormatChange = React.useMemo(function () {
|
|
2670
2972
|
return debounce(function (newFormat) {
|
|
2671
2973
|
onColumnFormatChange(newFormat);
|
|
2672
2974
|
}, 300);
|
|
2673
2975
|
}, [onColumnFormatChange]);
|
|
2976
|
+
|
|
2674
2977
|
var handleEventClick = function handleEventClick(e) {
|
|
2675
2978
|
// Hack to target the resize handlers, since the only button within a HeadCell is the resize handlers
|
|
2676
2979
|
if (e.target.tagName.toLowerCase() === 'button') {
|
|
2677
2980
|
e.stopPropagation();
|
|
2678
2981
|
}
|
|
2679
2982
|
};
|
|
2983
|
+
|
|
2680
2984
|
var handleKeyDown = function handleKeyDown(e) {
|
|
2681
2985
|
if (e.keyCode !== 13) {
|
|
2682
2986
|
return;
|
|
2683
2987
|
}
|
|
2988
|
+
|
|
2684
2989
|
drilldownHandler(e);
|
|
2685
2990
|
};
|
|
2991
|
+
|
|
2686
2992
|
var handleResizeColumn = function handleResizeColumn(_event, payload) {
|
|
2687
2993
|
setResizing(true);
|
|
2688
2994
|
var updatedCF = columns;
|
|
@@ -2690,12 +2996,13 @@ var PureTable = function PureTable(props) {
|
|
|
2690
2996
|
updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
|
|
2691
2997
|
width: Math.max(payload.width, exports.MINIMUM_COLUMN_SIZE)
|
|
2692
2998
|
});
|
|
2693
|
-
setColumns(Object.assign({}, updatedCF));
|
|
2694
|
-
|
|
2999
|
+
setColumns(Object.assign({}, updatedCF)); // Updates column json in edit mode
|
|
3000
|
+
|
|
2695
3001
|
if (mode === 'edit') {
|
|
2696
3002
|
debouncedOnColumnFormatChange(updatedCF);
|
|
2697
3003
|
}
|
|
2698
3004
|
};
|
|
3005
|
+
|
|
2699
3006
|
var fontMapped = fontMap[font] || fontMap.proportional;
|
|
2700
3007
|
var fontSizeMapped = fontSizeMap[fontSize] || fontSizeMap.default;
|
|
2701
3008
|
var rowHeightMapped = rowHeightMap[fontSize] || rowHeightMap.default;
|
|
@@ -2710,7 +3017,9 @@ var PureTable = function PureTable(props) {
|
|
|
2710
3017
|
});
|
|
2711
3018
|
var numberOfFixedHeaders = visibleHeaderCells.filter(function (_ref9) {
|
|
2712
3019
|
var value = _ref9.value;
|
|
3020
|
+
|
|
2713
3021
|
var _a, _b;
|
|
3022
|
+
|
|
2714
3023
|
return ((_a = columns[value]) === null || _a === void 0 ? void 0 : _a.width) && ((_b = columns[value]) === null || _b === void 0 ? void 0 : _b.width) !== 'auto';
|
|
2715
3024
|
}).length;
|
|
2716
3025
|
var isFullyFixed = visibleHeaderCells.length === numberOfFixedHeaders;
|
|
@@ -2718,7 +3027,8 @@ var PureTable = function PureTable(props) {
|
|
|
2718
3027
|
return React.createElement(VizTableContainer, {
|
|
2719
3028
|
isCellClickable: Boolean(onCellClick),
|
|
2720
3029
|
backgroundColor: backgroundColor,
|
|
2721
|
-
ref: containerRef
|
|
3030
|
+
ref: containerRef,
|
|
3031
|
+
"data-test": "table-container"
|
|
2722
3032
|
}, React.createElement(SUITableContainer, {
|
|
2723
3033
|
ref: containerRefInner,
|
|
2724
3034
|
width: width,
|
|
@@ -2739,11 +3049,13 @@ var PureTable = function PureTable(props) {
|
|
|
2739
3049
|
onRequestResizeColumn: handleResizeColumn
|
|
2740
3050
|
}, React.createElement(TableHead, null, visibleHeaderCells.map(function (_a) {
|
|
2741
3051
|
var _b, _c;
|
|
3052
|
+
|
|
2742
3053
|
var key = _a.key,
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
3054
|
+
value = _a.value,
|
|
3055
|
+
sortKey = _a.sortKey,
|
|
3056
|
+
style = _a.style,
|
|
3057
|
+
rest = __rest(_a, ["key", "value", "sortKey", "style"]);
|
|
3058
|
+
|
|
2747
3059
|
return React.createElement(HeadCell, Object.assign({
|
|
2748
3060
|
key: key,
|
|
2749
3061
|
columnId: value,
|
|
@@ -2767,6 +3079,7 @@ var PureTable = function PureTable(props) {
|
|
|
2767
3079
|
return c.showCell;
|
|
2768
3080
|
}).map(function (cell) {
|
|
2769
3081
|
var _a, _b;
|
|
3082
|
+
|
|
2770
3083
|
return React.createElement(cells_1.SwitchTableCell, {
|
|
2771
3084
|
key: cell.key,
|
|
2772
3085
|
type: cell.cellType
|
|
@@ -2786,6 +3099,7 @@ var PureTable = function PureTable(props) {
|
|
|
2786
3099
|
onChange: paginatorOnChange
|
|
2787
3100
|
}, paginatorProps))) : null);
|
|
2788
3101
|
};
|
|
3102
|
+
|
|
2789
3103
|
var cellDataType = T.oneOfType([T.string, T.number, T.arrayOf(T.oneOfType([T.string, T.number]))]);
|
|
2790
3104
|
PureTable.propTypes = {
|
|
2791
3105
|
backgroundColor: T.string,
|
|
@@ -2862,17 +3176,24 @@ exports.default = withEmptyTableMessage((0, FixedSizeContainer_1.default)(PureTa
|
|
|
2862
3176
|
|
|
2863
3177
|
|
|
2864
3178
|
var _toConsumableArray = __webpack_require__(8);
|
|
3179
|
+
|
|
2865
3180
|
var _typeof = __webpack_require__(82);
|
|
3181
|
+
|
|
2866
3182
|
Object.defineProperty(exports, "__esModule", {
|
|
2867
3183
|
value: true
|
|
2868
3184
|
});
|
|
2869
3185
|
exports.useTable = exports.getTextOverflowType = exports.getOverflowStyles = void 0;
|
|
3186
|
+
|
|
2870
3187
|
var lodash_1 = __webpack_require__(3);
|
|
3188
|
+
|
|
2871
3189
|
var colorUtils_1 = __webpack_require__(12);
|
|
3190
|
+
|
|
2872
3191
|
var consts_1 = __webpack_require__(137);
|
|
3192
|
+
|
|
2873
3193
|
var isArray = function isArray(v) {
|
|
2874
3194
|
return Array.isArray(v);
|
|
2875
3195
|
};
|
|
3196
|
+
|
|
2876
3197
|
var textOverflowStyles = {
|
|
2877
3198
|
anywhere: {
|
|
2878
3199
|
wordBreak: 'break-all'
|
|
@@ -2889,20 +3210,26 @@ var textOverflowStyles = {
|
|
|
2889
3210
|
}
|
|
2890
3211
|
};
|
|
2891
3212
|
var empty = {};
|
|
3213
|
+
|
|
2892
3214
|
var getOverflowStyles = function getOverflowStyles(_ref) {
|
|
2893
3215
|
var textOverflow = _ref.textOverflow;
|
|
2894
3216
|
return textOverflowStyles[textOverflow] || empty;
|
|
2895
3217
|
};
|
|
3218
|
+
|
|
2896
3219
|
exports.getOverflowStyles = getOverflowStyles;
|
|
3220
|
+
|
|
2897
3221
|
var generateKey = function generateKey() {
|
|
2898
3222
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
2899
3223
|
var i = arguments.length > 1 ? arguments[1] : undefined;
|
|
2900
3224
|
return "".concat(i, "-").concat(value);
|
|
2901
3225
|
};
|
|
3226
|
+
|
|
2902
3227
|
var getTextOverflowType = function getTextOverflowType(columnFormat, currentColumn) {
|
|
2903
3228
|
return (0, lodash_1.get)(columnFormat, ["".concat(currentColumn), 'textOverflow']);
|
|
2904
3229
|
};
|
|
3230
|
+
|
|
2905
3231
|
exports.getTextOverflowType = getTextOverflowType;
|
|
3232
|
+
|
|
2906
3233
|
var generateHeader = function generateHeader(value, i, columnFormat, showInternalFields) {
|
|
2907
3234
|
var ret = {
|
|
2908
3235
|
key: generateKey(value, i),
|
|
@@ -2910,9 +3237,11 @@ var generateHeader = function generateHeader(value, i, columnFormat, showInterna
|
|
|
2910
3237
|
sortKey: value,
|
|
2911
3238
|
showCell: true
|
|
2912
3239
|
};
|
|
3240
|
+
|
|
2913
3241
|
if (!showInternalFields && value.charAt(0) === '_' && value !== '_time') {
|
|
2914
3242
|
ret.showCell = false;
|
|
2915
3243
|
}
|
|
3244
|
+
|
|
2916
3245
|
var textOverflowType = (0, exports.getTextOverflowType)(columnFormat, value);
|
|
2917
3246
|
var textOverflowStyle = (0, exports.getOverflowStyles)({
|
|
2918
3247
|
textOverflow: textOverflowType
|
|
@@ -2922,101 +3251,131 @@ var generateHeader = function generateHeader(value, i, columnFormat, showInterna
|
|
|
2922
3251
|
ret.style = textOverflowStyle;
|
|
2923
3252
|
return ret;
|
|
2924
3253
|
};
|
|
3254
|
+
|
|
2925
3255
|
var getColumnFormatAlign = function getColumnFormatAlign(columnFormat, currentColumn, currentRow) {
|
|
2926
3256
|
var alignOption = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'align']);
|
|
2927
3257
|
var align;
|
|
3258
|
+
|
|
2928
3259
|
if (isArray(alignOption) && (0, lodash_1.includes)(consts_1.validAlignments, alignOption[currentRow])) {
|
|
2929
3260
|
align = alignOption[currentRow];
|
|
2930
3261
|
} else if (typeof alignOption !== 'undefined') {
|
|
2931
3262
|
console.warn("columnFormat.".concat(currentColumn.value, ".align should be an array containing (").concat(consts_1.validAlignments.join(' | '), "). ").concat(JSON.stringify(alignOption), " provided"));
|
|
2932
3263
|
}
|
|
3264
|
+
|
|
2933
3265
|
return align;
|
|
2934
3266
|
};
|
|
3267
|
+
|
|
2935
3268
|
var getColumnFormatCellType = function getColumnFormatCellType(columnFormat, currentColumn, currentRow) {
|
|
2936
3269
|
var cellTypes = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'cellTypes']);
|
|
2937
3270
|
var cellType;
|
|
3271
|
+
|
|
2938
3272
|
if (isArray(cellTypes) && (0, lodash_1.includes)(consts_1.validCellRenderers, cellTypes[currentRow])) {
|
|
2939
3273
|
cellType = cellTypes[currentRow];
|
|
2940
3274
|
} else if (typeof cellTypes !== 'undefined') {
|
|
2941
3275
|
console.warn("columnFormat.".concat(currentColumn.value, ".cellType should be an array containing (").concat(consts_1.validCellRenderers.join(' | '), "). ").concat(JSON.stringify(cellTypes), " provided"));
|
|
2942
3276
|
}
|
|
3277
|
+
|
|
2943
3278
|
return cellType;
|
|
2944
3279
|
};
|
|
3280
|
+
|
|
2945
3281
|
var getColumnFormatSparklineType = function getColumnFormatSparklineType(columnFormat, currentColumn, currentRow) {
|
|
2946
3282
|
var types = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'sparklineTypes']);
|
|
2947
3283
|
var sparklineType;
|
|
3284
|
+
|
|
2948
3285
|
if (isArray(types) && (0, lodash_1.includes)(consts_1.validSparklineTypes, types[currentRow])) {
|
|
2949
3286
|
sparklineType = types[currentRow];
|
|
2950
3287
|
} else if (typeof types !== 'undefined') {
|
|
2951
3288
|
console.warn("columnFormat.".concat(currentColumn.value, ".sparklineTypes should be one of (").concat(consts_1.validSparklineTypes.join(' | '), "). ").concat(JSON.stringify(types), " provided"));
|
|
2952
3289
|
}
|
|
3290
|
+
|
|
2953
3291
|
return sparklineType;
|
|
2954
3292
|
};
|
|
3293
|
+
|
|
2955
3294
|
var getColumnFormatData = function getColumnFormatData(columnFormat, currentColumn, currentRow) {
|
|
2956
3295
|
var data = (0, lodash_1.get)(columnFormat, [currentColumn.value, 'data']);
|
|
2957
3296
|
var datum;
|
|
3297
|
+
|
|
2958
3298
|
if (isArray(data)) {
|
|
2959
3299
|
datum = data[currentRow];
|
|
2960
3300
|
} else if (typeof data !== 'undefined') {
|
|
2961
3301
|
console.warn("columnFormat.".concat(currentColumn.value, ".data should be an array containing formatted data. ").concat(_typeof(data), " provided"));
|
|
2962
3302
|
}
|
|
3303
|
+
|
|
2963
3304
|
return datum;
|
|
2964
3305
|
};
|
|
3306
|
+
|
|
2965
3307
|
var getColumnFormatColor = function getColumnFormatColor(columnFormat, currentColumn, currentRow, field) {
|
|
2966
3308
|
var colors = (0, lodash_1.get)(columnFormat, [currentColumn.value, field]);
|
|
2967
3309
|
var color;
|
|
3310
|
+
|
|
2968
3311
|
if (isArray(colors) && (0, colorUtils_1.isColor)(colors[currentRow])) {
|
|
2969
3312
|
color = colors[currentRow];
|
|
2970
3313
|
} else if (typeof colors !== 'undefined') {
|
|
2971
3314
|
console.warn("columnFormat.".concat(currentColumn.value, ".").concat(field, " should be an array containing valid colors. ").concat(JSON.stringify(colors), " provided"));
|
|
2972
3315
|
}
|
|
3316
|
+
|
|
2973
3317
|
return color;
|
|
2974
3318
|
};
|
|
3319
|
+
|
|
2975
3320
|
var getColumnFormatRowColor = function getColumnFormatRowColor(columnFormat, currentColumn, currentRow) {
|
|
2976
3321
|
return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'rowColors');
|
|
2977
3322
|
};
|
|
3323
|
+
|
|
2978
3324
|
var getColumnFormatRowBgColor = function getColumnFormatRowBgColor(columnFormat, currentColumn, currentRow) {
|
|
2979
3325
|
return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'rowBackgroundColors');
|
|
2980
3326
|
};
|
|
3327
|
+
|
|
2981
3328
|
var getColumnFormatSparklineColor = function getColumnFormatSparklineColor(columnFormat, currentColumn, currentRow) {
|
|
2982
3329
|
return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'sparklineColors');
|
|
2983
3330
|
};
|
|
3331
|
+
|
|
2984
3332
|
var getColumnFormatSparklineAreaColor = function getColumnFormatSparklineAreaColor(columnFormat, currentColumn, currentRow) {
|
|
2985
3333
|
return getColumnFormatColor(columnFormat, currentColumn, currentRow, 'sparklineAreaColors');
|
|
2986
3334
|
};
|
|
3335
|
+
|
|
2987
3336
|
var getTableFormatAlign = function getTableFormatAlign(tableFormat, currentColumn, currentRow) {
|
|
2988
3337
|
var alignOption = (0, lodash_1.get)(tableFormat, 'align');
|
|
2989
3338
|
var align;
|
|
3339
|
+
|
|
2990
3340
|
if (isArray(alignOption) && isArray(alignOption[currentColumn]) && (0, lodash_1.includes)(consts_1.validAlignments, alignOption[currentColumn][currentRow])) {
|
|
2991
3341
|
align = alignOption[currentColumn][currentRow];
|
|
2992
3342
|
} else if (typeof alignOption !== 'undefined') {
|
|
2993
3343
|
console.warn("tableFormat.align should be a 2 dimensional array containing (".concat(consts_1.validAlignments.join(' | '), "). ").concat(JSON.stringify(alignOption), " provided"));
|
|
2994
3344
|
}
|
|
3345
|
+
|
|
2995
3346
|
return align;
|
|
2996
3347
|
};
|
|
3348
|
+
|
|
2997
3349
|
var getTableFormatCellType = function getTableFormatCellType(tableFormat, currentColumn, currentRow) {
|
|
2998
3350
|
var cellTypes = (0, lodash_1.get)(tableFormat, 'cellTypes');
|
|
2999
3351
|
var cellType;
|
|
3352
|
+
|
|
3000
3353
|
if (isArray(cellTypes) && isArray(cellTypes[currentColumn]) && (0, lodash_1.includes)(consts_1.validCellRenderers, cellTypes[currentColumn][currentRow])) {
|
|
3001
3354
|
cellType = cellTypes[currentColumn][currentRow];
|
|
3002
3355
|
} else if (typeof cellTypes !== 'undefined') {
|
|
3003
3356
|
console.warn("tableFormat.cellType should be a 2 dimensional array containing (".concat(consts_1.validCellRenderers.join(' | '), "). ").concat(JSON.stringify(cellTypes), " provided"));
|
|
3004
3357
|
}
|
|
3358
|
+
|
|
3005
3359
|
return cellType;
|
|
3006
3360
|
};
|
|
3361
|
+
|
|
3007
3362
|
var getTableFormatSparklineType = function getTableFormatSparklineType(tableFormat, currentColumn, currentRow) {
|
|
3008
3363
|
var types = (0, lodash_1.get)(tableFormat, 'sparklineTypes');
|
|
3009
3364
|
var sparklineType;
|
|
3365
|
+
|
|
3010
3366
|
if (isArray(types) && isArray(types[currentColumn]) && (0, lodash_1.includes)(consts_1.validSparklineTypes, types[currentColumn][currentRow])) {
|
|
3011
3367
|
sparklineType = types[currentColumn][currentRow];
|
|
3012
3368
|
} else if (typeof types !== 'undefined') {
|
|
3013
3369
|
console.warn("tableFormat.sparklineTypes should be a 2 dimensional array containing one of (".concat(consts_1.validSparklineTypes.join(' | '), "). ").concat(JSON.stringify(types), " provided"));
|
|
3014
3370
|
}
|
|
3371
|
+
|
|
3015
3372
|
return sparklineType;
|
|
3016
3373
|
};
|
|
3374
|
+
|
|
3017
3375
|
var getTableFormatColor = function getTableFormatColor(tableFormat, currentColumn, currentRow, field) {
|
|
3018
3376
|
var colors = (0, lodash_1.get)(tableFormat, field);
|
|
3019
3377
|
var color;
|
|
3378
|
+
|
|
3020
3379
|
if (isArray(colors) && isArray(colors[currentColumn]) && (0, colorUtils_1.isColor)(colors[currentColumn][currentRow])) {
|
|
3021
3380
|
color = colors[currentColumn][currentRow];
|
|
3022
3381
|
} else if (isArray(colors) && (0, colorUtils_1.isColor)(colors[currentRow])) {
|
|
@@ -3024,66 +3383,81 @@ var getTableFormatColor = function getTableFormatColor(tableFormat, currentColum
|
|
|
3024
3383
|
} else if (typeof colors !== 'undefined' && isArray(colors) && isArray(colors[currentColumn]) && colors[currentColumn][currentRow] !== undefined) {
|
|
3025
3384
|
console.warn("tableFormat.".concat(field, " needs to be an array of colors, provided ").concat(JSON.stringify(colors), ". Current value at [").concat(currentColumn, "][").concat(currentRow, "] is ").concat(JSON.stringify(colors[currentRow])));
|
|
3026
3385
|
}
|
|
3386
|
+
|
|
3027
3387
|
return color;
|
|
3028
3388
|
};
|
|
3389
|
+
|
|
3029
3390
|
var getTableFormatRowColor = function getTableFormatRowColor(tableFormat, currentCol, currentRow) {
|
|
3030
3391
|
return getTableFormatColor(tableFormat, currentCol, currentRow, 'rowColors');
|
|
3031
3392
|
};
|
|
3393
|
+
|
|
3032
3394
|
var getTableFormatRowBgColor = function getTableFormatRowBgColor(tableFormat, currentCol, currentRow) {
|
|
3033
3395
|
return getTableFormatColor(tableFormat, currentCol, currentRow, 'rowBackgroundColors');
|
|
3034
3396
|
};
|
|
3397
|
+
|
|
3035
3398
|
var getTableFormatSparklineColor = function getTableFormatSparklineColor(tableFormat, currentCol, currentRow) {
|
|
3036
3399
|
return getTableFormatColor(tableFormat, currentCol, currentRow, 'sparklineColors');
|
|
3037
3400
|
};
|
|
3401
|
+
|
|
3038
3402
|
var getTableFormatSparklineAreaColor = function getTableFormatSparklineAreaColor(tableFormat, currentCol, currentRow) {
|
|
3039
3403
|
return getTableFormatColor(tableFormat, currentCol, currentRow, 'sparklineAreaColors');
|
|
3040
3404
|
};
|
|
3405
|
+
|
|
3041
3406
|
var getTableFormatData = function getTableFormatData(tableFormat, currentCol, currentRow) {
|
|
3042
3407
|
var data = (0, lodash_1.get)(tableFormat, 'data');
|
|
3043
3408
|
var datum;
|
|
3409
|
+
|
|
3044
3410
|
if (isArray(data) && isArray(data[currentCol])) {
|
|
3045
3411
|
datum = data[currentCol][currentRow];
|
|
3046
3412
|
} else if (typeof data !== 'undefined') {
|
|
3047
3413
|
console.warn("tableFormat.data should be a 2 dimensional array containing formatted data to be displayed. ".concat(_typeof(data), " provided"));
|
|
3048
3414
|
}
|
|
3415
|
+
|
|
3049
3416
|
return datum;
|
|
3050
3417
|
};
|
|
3418
|
+
|
|
3051
3419
|
var validValueSelector = function validValueSelector(v1, v2, v3, defaultValue) {
|
|
3052
3420
|
var validTypes = ['string', 'number'];
|
|
3421
|
+
|
|
3053
3422
|
if (validTypes.includes(_typeof(v1)) || isArray(v1)) {
|
|
3054
3423
|
return v1;
|
|
3055
3424
|
}
|
|
3425
|
+
|
|
3056
3426
|
if (validTypes.includes(_typeof(v2)) || isArray(v2)) {
|
|
3057
3427
|
return v2;
|
|
3058
3428
|
}
|
|
3429
|
+
|
|
3059
3430
|
if (validTypes.includes(_typeof(v3)) || isArray(v3)) {
|
|
3060
3431
|
return v3;
|
|
3061
3432
|
}
|
|
3433
|
+
|
|
3062
3434
|
return defaultValue;
|
|
3063
3435
|
};
|
|
3436
|
+
|
|
3064
3437
|
var useTable = function useTable() {
|
|
3065
3438
|
var tableArgs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3066
3439
|
var _tableArgs$table = tableArgs.table,
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3440
|
+
table = _tableArgs$table === void 0 ? [] : _tableArgs$table,
|
|
3441
|
+
_tableArgs$headers = tableArgs.headers,
|
|
3442
|
+
headers = _tableArgs$headers === void 0 ? [] : _tableArgs$headers;
|
|
3070
3443
|
var _tableArgs$headerVisi = tableArgs.headerVisibility,
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3444
|
+
headerVisibility = _tableArgs$headerVisi === void 0 ? 'inline' : _tableArgs$headerVisi,
|
|
3445
|
+
_tableArgs$showRowNum = tableArgs.showRowNumbers,
|
|
3446
|
+
showRowNumbers = _tableArgs$showRowNum === void 0 ? false : _tableArgs$showRowNum,
|
|
3447
|
+
_tableArgs$showIntern = tableArgs.showInternalFields,
|
|
3448
|
+
showInternalFields = _tableArgs$showIntern === void 0 ? true : _tableArgs$showIntern,
|
|
3449
|
+
_tableArgs$tableForma = tableArgs.tableFormat,
|
|
3450
|
+
tableFormat = _tableArgs$tableForma === void 0 ? {} : _tableArgs$tableForma,
|
|
3451
|
+
_tableArgs$columnForm = tableArgs.columnFormat,
|
|
3452
|
+
columnFormat = _tableArgs$columnForm === void 0 ? {} : _tableArgs$columnForm,
|
|
3453
|
+
_tableArgs$pagination = tableArgs.paginationOffset,
|
|
3454
|
+
paginationOffset = _tableArgs$pagination === void 0 ? 0 : _tableArgs$pagination,
|
|
3455
|
+
_tableArgs$count = tableArgs.count,
|
|
3456
|
+
count = _tableArgs$count === void 0 ? 0 : _tableArgs$count;
|
|
3084
3457
|
var longestColumnLength = Math.max.apply(Math, _toConsumableArray(table.map(function (column) {
|
|
3085
3458
|
return column.length;
|
|
3086
3459
|
})));
|
|
3460
|
+
|
|
3087
3461
|
if (showRowNumbers) {
|
|
3088
3462
|
var correctedPaginationOffset = Math.max(0, (paginationOffset - 1) * count);
|
|
3089
3463
|
headers = ['#'].concat(_toConsumableArray(headers));
|
|
@@ -3092,12 +3466,15 @@ var useTable = function useTable() {
|
|
|
3092
3466
|
}, function (v, i) {
|
|
3093
3467
|
return correctedPaginationOffset + i + 1;
|
|
3094
3468
|
})].concat(_toConsumableArray(table));
|
|
3469
|
+
|
|
3095
3470
|
if (isArray(tableFormat.align)) {
|
|
3096
3471
|
tableFormat.align = [new Array(longestColumnLength).fill('left')].concat(_toConsumableArray(tableFormat.align));
|
|
3097
3472
|
}
|
|
3473
|
+
|
|
3098
3474
|
if (isArray(tableFormat.cellTypes)) {
|
|
3099
3475
|
tableFormat.cellTypes = [new Array(longestColumnLength).fill('TextCell')].concat(_toConsumableArray(tableFormat.cellTypes));
|
|
3100
3476
|
}
|
|
3477
|
+
|
|
3101
3478
|
if (isArray(tableFormat.data)) {
|
|
3102
3479
|
tableFormat.data = [Array.from({
|
|
3103
3480
|
length: longestColumnLength
|
|
@@ -3105,32 +3482,39 @@ var useTable = function useTable() {
|
|
|
3105
3482
|
return "".concat(i + 1);
|
|
3106
3483
|
})].concat(_toConsumableArray(tableFormat.data));
|
|
3107
3484
|
}
|
|
3485
|
+
|
|
3108
3486
|
if (isArray(tableFormat.rowBackgroundColors)) {
|
|
3109
3487
|
if (tableFormat.rowBackgroundColors.length > 0 && isArray(tableFormat.rowBackgroundColors[0])) {
|
|
3110
3488
|
tableFormat.rowBackgroundColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.rowBackgroundColors));
|
|
3111
3489
|
}
|
|
3112
3490
|
}
|
|
3491
|
+
|
|
3113
3492
|
if (isArray(tableFormat.rowColors)) {
|
|
3114
3493
|
if (tableFormat.rowColors.length > 0 && isArray(tableFormat.rowColors[0])) {
|
|
3115
3494
|
tableFormat.rowColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.rowColors));
|
|
3116
3495
|
}
|
|
3117
3496
|
}
|
|
3497
|
+
|
|
3118
3498
|
if (isArray(tableFormat.sparklineColors)) {
|
|
3119
3499
|
tableFormat.sparklineColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.sparklineColors));
|
|
3120
3500
|
}
|
|
3501
|
+
|
|
3121
3502
|
if (isArray(tableFormat.sparklineAreaColors)) {
|
|
3122
3503
|
tableFormat.sparklineAreaColors = [new Array(longestColumnLength)].concat(_toConsumableArray(tableFormat.sparklineAreaColors));
|
|
3123
3504
|
}
|
|
3505
|
+
|
|
3124
3506
|
if (isArray(tableFormat.sparklineTypes)) {
|
|
3125
3507
|
tableFormat.sparklineTypes = [new Array(longestColumnLength).fill('area')].concat(_toConsumableArray(tableFormat.sparklineTypes));
|
|
3126
3508
|
}
|
|
3127
3509
|
}
|
|
3510
|
+
|
|
3128
3511
|
var tableHeader = {
|
|
3129
3512
|
visibility: consts_1.validHeaderVisibilities.indexOf(headerVisibility) >= 0 ? headerVisibility : 'inline',
|
|
3130
3513
|
cells: table.map(function (f, i) {
|
|
3131
3514
|
if (i < headers.length) {
|
|
3132
3515
|
return generateHeader(headers[i], i, columnFormat, showInternalFields);
|
|
3133
3516
|
}
|
|
3517
|
+
|
|
3134
3518
|
return generateHeader('', i, columnFormat, showInternalFields);
|
|
3135
3519
|
}),
|
|
3136
3520
|
style: {
|
|
@@ -3141,6 +3525,7 @@ var useTable = function useTable() {
|
|
|
3141
3525
|
var tableBody = {
|
|
3142
3526
|
rows: []
|
|
3143
3527
|
};
|
|
3528
|
+
|
|
3144
3529
|
var _loop = function _loop(currentRow) {
|
|
3145
3530
|
var row = {
|
|
3146
3531
|
key: "row-".concat(currentRow),
|
|
@@ -3166,9 +3551,11 @@ var useTable = function useTable() {
|
|
|
3166
3551
|
});
|
|
3167
3552
|
additionalStyles = Object.assign(Object.assign({}, additionalStyles), textOverflowStyle);
|
|
3168
3553
|
var showCell = true;
|
|
3554
|
+
|
|
3169
3555
|
if (!showInternalFields && currentHeader.value.charAt(0) === '_' && currentHeader.value !== '_time') {
|
|
3170
3556
|
showCell = false;
|
|
3171
3557
|
}
|
|
3558
|
+
|
|
3172
3559
|
row.cells.push({
|
|
3173
3560
|
key: key,
|
|
3174
3561
|
value: value,
|
|
@@ -3190,14 +3577,17 @@ var useTable = function useTable() {
|
|
|
3190
3577
|
});
|
|
3191
3578
|
tableBody.rows.push(row);
|
|
3192
3579
|
};
|
|
3580
|
+
|
|
3193
3581
|
for (var currentRow = 0; currentRow < longestColumnLength; currentRow += 1) {
|
|
3194
3582
|
_loop(currentRow);
|
|
3195
3583
|
}
|
|
3584
|
+
|
|
3196
3585
|
return {
|
|
3197
3586
|
tableHeader: tableHeader,
|
|
3198
3587
|
tableBody: tableBody
|
|
3199
3588
|
};
|
|
3200
3589
|
};
|
|
3590
|
+
|
|
3201
3591
|
exports.useTable = useTable;
|
|
3202
3592
|
|
|
3203
3593
|
/***/ }),
|
|
@@ -3211,6 +3601,7 @@ exports.useTable = useTable;
|
|
|
3211
3601
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
3212
3602
|
if (k2 === undefined) k2 = k;
|
|
3213
3603
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3604
|
+
|
|
3214
3605
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3215
3606
|
desc = {
|
|
3216
3607
|
enumerable: true,
|
|
@@ -3219,22 +3610,29 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
3219
3610
|
}
|
|
3220
3611
|
};
|
|
3221
3612
|
}
|
|
3613
|
+
|
|
3222
3614
|
Object.defineProperty(o, k2, desc);
|
|
3223
3615
|
} : function (o, m, k, k2) {
|
|
3224
3616
|
if (k2 === undefined) k2 = k;
|
|
3225
3617
|
o[k2] = m[k];
|
|
3226
3618
|
});
|
|
3619
|
+
|
|
3227
3620
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
3228
3621
|
for (var p in m) {
|
|
3229
3622
|
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
3230
3623
|
}
|
|
3231
3624
|
};
|
|
3625
|
+
|
|
3232
3626
|
Object.defineProperty(exports, "__esModule", {
|
|
3233
3627
|
value: true
|
|
3234
3628
|
});
|
|
3629
|
+
|
|
3235
3630
|
__exportStar(__webpack_require__(484), exports);
|
|
3631
|
+
|
|
3236
3632
|
__exportStar(__webpack_require__(485), exports);
|
|
3633
|
+
|
|
3237
3634
|
__exportStar(__webpack_require__(486), exports);
|
|
3635
|
+
|
|
3238
3636
|
__exportStar(__webpack_require__(487), exports);
|
|
3239
3637
|
|
|
3240
3638
|
/***/ }),
|
|
@@ -3249,13 +3647,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3249
3647
|
value: true
|
|
3250
3648
|
});
|
|
3251
3649
|
exports.SwitchTableCell = void 0;
|
|
3650
|
+
|
|
3252
3651
|
var SwitchTableCell = function SwitchTableCell(_ref) {
|
|
3253
3652
|
var type = _ref.type,
|
|
3254
|
-
|
|
3653
|
+
children = _ref.children;
|
|
3255
3654
|
return children.filter(function (child) {
|
|
3256
3655
|
return child.type.displayName === type;
|
|
3257
3656
|
});
|
|
3258
3657
|
};
|
|
3658
|
+
|
|
3259
3659
|
exports.SwitchTableCell = SwitchTableCell;
|
|
3260
3660
|
|
|
3261
3661
|
/***/ }),
|
|
@@ -3270,14 +3670,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3270
3670
|
value: true
|
|
3271
3671
|
});
|
|
3272
3672
|
exports.TextCell = void 0;
|
|
3673
|
+
|
|
3273
3674
|
var React = __webpack_require__(1);
|
|
3675
|
+
|
|
3274
3676
|
var Table_1 = __webpack_require__(112);
|
|
3677
|
+
|
|
3275
3678
|
var noop = function noop() {
|
|
3276
3679
|
return undefined;
|
|
3277
3680
|
};
|
|
3681
|
+
|
|
3278
3682
|
var TextCell = function TextCell(_ref) {
|
|
3279
3683
|
var cell = _ref.cell,
|
|
3280
|
-
|
|
3684
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
3281
3685
|
var cellStyle = React.useMemo(function () {
|
|
3282
3686
|
return Object.assign({}, cell.style);
|
|
3283
3687
|
}, [cell.style]);
|
|
@@ -3290,6 +3694,7 @@ var TextCell = function TextCell(_ref) {
|
|
|
3290
3694
|
onClick: useMouseOverEffect ? noop : undefined
|
|
3291
3695
|
}, cell.value.toString());
|
|
3292
3696
|
};
|
|
3697
|
+
|
|
3293
3698
|
exports.TextCell = TextCell;
|
|
3294
3699
|
exports.TextCell.displayName = 'TextCell';
|
|
3295
3700
|
|
|
@@ -3305,14 +3710,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3305
3710
|
value: true
|
|
3306
3711
|
});
|
|
3307
3712
|
exports.ArrayCell = void 0;
|
|
3713
|
+
|
|
3308
3714
|
var React = __webpack_require__(1);
|
|
3715
|
+
|
|
3309
3716
|
var Table_1 = __webpack_require__(112);
|
|
3717
|
+
|
|
3310
3718
|
var noop = function noop() {
|
|
3311
3719
|
return undefined;
|
|
3312
3720
|
};
|
|
3721
|
+
|
|
3313
3722
|
var ArrayCell = function ArrayCell(_ref) {
|
|
3314
3723
|
var cell = _ref.cell,
|
|
3315
|
-
|
|
3724
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
3316
3725
|
var value = React.useMemo(function () {
|
|
3317
3726
|
return Array.isArray(cell.value) ? cell.value : [cell.value];
|
|
3318
3727
|
}, [cell.value]);
|
|
@@ -3333,6 +3742,7 @@ var ArrayCell = function ArrayCell(_ref) {
|
|
|
3333
3742
|
}, v.toString());
|
|
3334
3743
|
}));
|
|
3335
3744
|
};
|
|
3745
|
+
|
|
3336
3746
|
exports.ArrayCell = ArrayCell;
|
|
3337
3747
|
exports.ArrayCell.displayName = 'ArrayCell';
|
|
3338
3748
|
|
|
@@ -3345,15 +3755,21 @@ exports.ArrayCell.displayName = 'ArrayCell';
|
|
|
3345
3755
|
|
|
3346
3756
|
|
|
3347
3757
|
var _slicedToArray = __webpack_require__(17);
|
|
3758
|
+
|
|
3348
3759
|
Object.defineProperty(exports, "__esModule", {
|
|
3349
3760
|
value: true
|
|
3350
3761
|
});
|
|
3351
3762
|
exports.SparklineCell = exports.validSparklineTypes = void 0;
|
|
3763
|
+
|
|
3352
3764
|
var React = __webpack_require__(1);
|
|
3765
|
+
|
|
3353
3766
|
var Table_1 = __webpack_require__(112);
|
|
3767
|
+
|
|
3354
3768
|
var SparkLine_1 = __webpack_require__(95);
|
|
3769
|
+
|
|
3355
3770
|
var paddingLeftRight = 5;
|
|
3356
3771
|
var paddingTopBottom = 3;
|
|
3772
|
+
|
|
3357
3773
|
var parseSparklineData = function parseSparklineData(data) {
|
|
3358
3774
|
return (Array.isArray(data) ? data : [data]).map(function (d) {
|
|
3359
3775
|
return parseInt(d.toString(), 10);
|
|
@@ -3361,34 +3777,44 @@ var parseSparklineData = function parseSparklineData(data) {
|
|
|
3361
3777
|
return isNaN(d) ? null : d;
|
|
3362
3778
|
});
|
|
3363
3779
|
}; // eslint-disable-line no-restricted-globals
|
|
3780
|
+
|
|
3781
|
+
|
|
3364
3782
|
exports.validSparklineTypes = ['line', 'area'];
|
|
3783
|
+
|
|
3365
3784
|
var noop = function noop() {
|
|
3366
3785
|
return undefined;
|
|
3367
3786
|
};
|
|
3787
|
+
|
|
3368
3788
|
var svgStyle = {
|
|
3369
3789
|
height: 0
|
|
3370
3790
|
};
|
|
3371
3791
|
var dummySVG = React.createElement("svg", {
|
|
3372
3792
|
style: svgStyle
|
|
3373
3793
|
});
|
|
3794
|
+
|
|
3374
3795
|
var SparklineCell = function SparklineCell(_ref) {
|
|
3375
3796
|
var cell = _ref.cell,
|
|
3376
|
-
|
|
3377
|
-
|
|
3797
|
+
useMouseOverEffect = _ref.useMouseOverEffect,
|
|
3798
|
+
width = _ref.width;
|
|
3799
|
+
|
|
3378
3800
|
var _React$useState = React.useState(),
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3801
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3802
|
+
cellEl = _React$useState2[0],
|
|
3803
|
+
setEl = _React$useState2[1];
|
|
3804
|
+
|
|
3382
3805
|
var _React$useState3 = React.useState(),
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3806
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3807
|
+
height = _React$useState4[0],
|
|
3808
|
+
setHeight = _React$useState4[1];
|
|
3809
|
+
|
|
3386
3810
|
var data = React.useMemo(function () {
|
|
3387
3811
|
return parseSparklineData(cell.value);
|
|
3388
3812
|
}, [cell.value]);
|
|
3813
|
+
|
|
3389
3814
|
if (cell.value[0] === '##__SPARKLINE__##') {
|
|
3390
3815
|
data = data.slice(1);
|
|
3391
3816
|
}
|
|
3817
|
+
|
|
3392
3818
|
React.useLayoutEffect(function () {
|
|
3393
3819
|
setHeight(cellEl === null || cellEl === void 0 ? void 0 : cellEl.offsetHeight);
|
|
3394
3820
|
}, [cellEl]);
|
|
@@ -3427,6 +3853,7 @@ var SparklineCell = function SparklineCell(_ref) {
|
|
|
3427
3853
|
fillColor: cell.sparklineAreaColor
|
|
3428
3854
|
}) : dummySVG);
|
|
3429
3855
|
};
|
|
3856
|
+
|
|
3430
3857
|
exports.SparklineCell = SparklineCell;
|
|
3431
3858
|
exports.SparklineCell.displayName = 'SparklineCell';
|
|
3432
3859
|
|
|
@@ -3478,6 +3905,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3478
3905
|
});
|
|
3479
3906
|
exports.VizBehavior = void 0;
|
|
3480
3907
|
var VizBehavior;
|
|
3908
|
+
|
|
3481
3909
|
(function (VizBehavior) {
|
|
3482
3910
|
/**
|
|
3483
3911
|
* Dynamic Options Behavior.
|
|
@@ -3497,6 +3925,7 @@ var VizBehavior;
|
|
|
3497
3925
|
* missing.
|
|
3498
3926
|
* @type {string}
|
|
3499
3927
|
*/
|
|
3928
|
+
|
|
3500
3929
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
3501
3930
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
3502
3931
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -3553,7 +3982,7 @@ module.exports = require("@babel/runtime/helpers/typeof");
|
|
|
3553
3982
|
|
|
3554
3983
|
/***/ }),
|
|
3555
3984
|
|
|
3556
|
-
/***/
|
|
3985
|
+
/***/ 88:
|
|
3557
3986
|
/***/ (function(module, exports) {
|
|
3558
3987
|
|
|
3559
3988
|
module.exports = require("@babel/runtime/helpers/assertThisInitialized");
|
|
@@ -3567,7 +3996,7 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
3567
3996
|
|
|
3568
3997
|
/***/ }),
|
|
3569
3998
|
|
|
3570
|
-
/***/
|
|
3999
|
+
/***/ 94:
|
|
3571
4000
|
/***/ (function(module, exports) {
|
|
3572
4001
|
|
|
3573
4002
|
module.exports = require("@splunk/react-ui/Paginator");
|
|
@@ -3585,7 +4014,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3585
4014
|
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__);
|
|
3586
4015
|
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
|
|
3587
4016
|
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__);
|
|
3588
|
-
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
|
|
4017
|
+
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(88);
|
|
3589
4018
|
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__);
|
|
3590
4019
|
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71);
|
|
3591
4020
|
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4__);
|
|
@@ -3617,24 +4046,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3617
4046
|
|
|
3618
4047
|
|
|
3619
4048
|
|
|
4049
|
+
|
|
3620
4050
|
function _createSuper(Derived) {
|
|
3621
4051
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
4052
|
+
|
|
3622
4053
|
return function _createSuperInternal() {
|
|
3623
4054
|
var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(Derived),
|
|
3624
|
-
|
|
4055
|
+
result;
|
|
4056
|
+
|
|
3625
4057
|
if (hasNativeReflectConstruct) {
|
|
3626
4058
|
var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6___default()(this).constructor;
|
|
4059
|
+
|
|
3627
4060
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
3628
4061
|
} else {
|
|
3629
4062
|
result = Super.apply(this, arguments);
|
|
3630
4063
|
}
|
|
4064
|
+
|
|
3631
4065
|
return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5___default()(this, result);
|
|
3632
4066
|
};
|
|
3633
4067
|
}
|
|
4068
|
+
|
|
3634
4069
|
function _isNativeReflectConstruct() {
|
|
3635
4070
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
3636
4071
|
if (Reflect.construct.sham) return false;
|
|
3637
4072
|
if (typeof Proxy === "function") return true;
|
|
4073
|
+
|
|
3638
4074
|
try {
|
|
3639
4075
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
3640
4076
|
return true;
|
|
@@ -3649,6 +4085,7 @@ function _isNativeReflectConstruct() {
|
|
|
3649
4085
|
|
|
3650
4086
|
|
|
3651
4087
|
|
|
4088
|
+
|
|
3652
4089
|
var StyledSvg = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.svg.withConfig({
|
|
3653
4090
|
displayName: "SparkLine__StyledSvg",
|
|
3654
4091
|
componentId: "sc-5oplra-0"
|
|
@@ -3657,21 +4094,29 @@ var StyledTooltip = styled_components__WEBPACK_IMPORTED_MODULE_11___default.a.di
|
|
|
3657
4094
|
displayName: "SparkLine__StyledTooltip",
|
|
3658
4095
|
componentId: "sc-5oplra-1"
|
|
3659
4096
|
})(["padding:3px 8px;font-size:12px;"]);
|
|
4097
|
+
|
|
3660
4098
|
var SparkLine = /*#__PURE__*/function (_Component) {
|
|
3661
4099
|
_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_4___default()(SparkLine, _Component);
|
|
4100
|
+
|
|
3662
4101
|
var _super = _createSuper(SparkLine);
|
|
4102
|
+
|
|
3663
4103
|
function SparkLine(props) {
|
|
3664
4104
|
var _this;
|
|
4105
|
+
|
|
3665
4106
|
_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default()(this, SparkLine);
|
|
4107
|
+
|
|
3666
4108
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3667
4109
|
rest[_key - 1] = arguments[_key];
|
|
3668
4110
|
}
|
|
4111
|
+
|
|
3669
4112
|
_this = _super.call.apply(_super, [this, props].concat(rest));
|
|
4113
|
+
|
|
3670
4114
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3___default()(_this), "handleCursorMount", function (el) {
|
|
3671
4115
|
_this.setState({
|
|
3672
4116
|
anchor: el
|
|
3673
4117
|
});
|
|
3674
4118
|
});
|
|
4119
|
+
|
|
3675
4120
|
_this.state = {
|
|
3676
4121
|
anchor: null,
|
|
3677
4122
|
currentPointX: null,
|
|
@@ -3682,69 +4127,75 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3682
4127
|
_this.titleId = Object(_splunk_ui_utils_id__WEBPACK_IMPORTED_MODULE_14__["createDOMID"])();
|
|
3683
4128
|
return _this;
|
|
3684
4129
|
}
|
|
4130
|
+
|
|
3685
4131
|
_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default()(SparkLine, [{
|
|
3686
4132
|
key: "getMax",
|
|
3687
4133
|
value: function getMax() {
|
|
3688
4134
|
var _this2 = this;
|
|
4135
|
+
|
|
3689
4136
|
var _this$props = this.props,
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
4137
|
+
data = _this$props.data,
|
|
4138
|
+
acceptNull = _this$props.acceptNull,
|
|
4139
|
+
yMax = _this$props.yMax;
|
|
4140
|
+
|
|
3693
4141
|
var dataMax = function dataMax() {
|
|
3694
4142
|
return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(_this2.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["max"])(data);
|
|
3695
4143
|
};
|
|
4144
|
+
|
|
3696
4145
|
return yMax !== undefined ? yMax : dataMax();
|
|
3697
4146
|
}
|
|
3698
4147
|
}, {
|
|
3699
4148
|
key: "getMin",
|
|
3700
4149
|
value: function getMin() {
|
|
3701
4150
|
var _this3 = this;
|
|
4151
|
+
|
|
3702
4152
|
var _this$props2 = this.props,
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
4153
|
+
data = _this$props2.data,
|
|
4154
|
+
acceptNull = _this$props2.acceptNull,
|
|
4155
|
+
yMin = _this$props2.yMin;
|
|
4156
|
+
|
|
3706
4157
|
var dataMin = function dataMin() {
|
|
3707
4158
|
return acceptNull ? Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(_this3.fillNull(data)) : Object(lodash__WEBPACK_IMPORTED_MODULE_10__["min"])(data);
|
|
3708
4159
|
};
|
|
4160
|
+
|
|
3709
4161
|
return yMin !== undefined ? yMin : dataMin();
|
|
3710
4162
|
}
|
|
3711
|
-
|
|
3712
4163
|
/**
|
|
3713
4164
|
* Gets unit value of x axis.
|
|
3714
4165
|
* @param {Number} xMargin - margin of x axis.
|
|
3715
4166
|
* @return {Number} unit value of x axis.
|
|
3716
4167
|
* @private
|
|
3717
4168
|
*/
|
|
4169
|
+
|
|
3718
4170
|
}, {
|
|
3719
4171
|
key: "getXUnit",
|
|
3720
4172
|
value: function getXUnit(xMargin) {
|
|
3721
4173
|
var _this$props3 = this.props,
|
|
3722
|
-
|
|
3723
|
-
|
|
4174
|
+
data = _this$props3.data,
|
|
4175
|
+
width = _this$props3.width; // Calculate xUnit. Width substract the left margin and right margin, then divide by data length.
|
|
4176
|
+
|
|
3724
4177
|
var xUnit = (width - xMargin * 2) / (data.length > 1 ? data.length - 1 : 1);
|
|
3725
4178
|
return Math.max(0, xUnit);
|
|
3726
4179
|
}
|
|
3727
|
-
|
|
3728
4180
|
/**
|
|
3729
4181
|
* Gets unit value of y axis.
|
|
3730
4182
|
* @param {String} yMargin - margin of y axis.
|
|
3731
4183
|
* @return {Number} unit value of y axis.
|
|
3732
4184
|
* @private
|
|
3733
4185
|
*/
|
|
4186
|
+
|
|
3734
4187
|
}, {
|
|
3735
4188
|
key: "getYUnit",
|
|
3736
4189
|
value: function getYUnit(yMargin) {
|
|
3737
4190
|
var height = this.props.height;
|
|
3738
4191
|
var maxValue = this.getMax();
|
|
3739
|
-
var minValue = this.getMin();
|
|
3740
|
-
|
|
3741
|
-
// Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
|
|
4192
|
+
var minValue = this.getMin(); // Calculate yUnit. Height substract the upper margin and bottom margin, then divide by value range of values in data.
|
|
3742
4193
|
// if the maxValue equals minValue, means all values in data are the same, then, we need to set the YUnit at the mid value of Height.
|
|
3743
4194
|
// So, draws sparkline right in the mid of the container.
|
|
4195
|
+
|
|
3744
4196
|
var yUnit = (height - yMargin * 2) / (maxValue - minValue || 2);
|
|
3745
4197
|
return Math.max(0, yUnit);
|
|
3746
4198
|
}
|
|
3747
|
-
|
|
3748
4199
|
/**
|
|
3749
4200
|
* Get a list of arrays of points for drawing lines, based on acceptNull property
|
|
3750
4201
|
* @method getSegmentSets
|
|
@@ -3752,6 +4203,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3752
4203
|
* @param {Array} points
|
|
3753
4204
|
* @returns {Array} List of datapoint sets used for drawing lines
|
|
3754
4205
|
*/
|
|
4206
|
+
|
|
3755
4207
|
}, {
|
|
3756
4208
|
key: "getSegmentSets",
|
|
3757
4209
|
value: function getSegmentSets(data, points) {
|
|
@@ -3764,19 +4216,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3764
4216
|
// need at least 2 points to draw a segment
|
|
3765
4217
|
if (currentLine.length > 1) {
|
|
3766
4218
|
lines.push(currentLine);
|
|
3767
|
-
}
|
|
3768
|
-
|
|
4219
|
+
} // reset for the next segment
|
|
4220
|
+
|
|
4221
|
+
|
|
3769
4222
|
currentLine = [];
|
|
3770
4223
|
} else {
|
|
3771
4224
|
// data is good, add point data
|
|
3772
4225
|
currentLine.push(points[idx]);
|
|
3773
4226
|
}
|
|
3774
|
-
});
|
|
4227
|
+
}); // Add the last line
|
|
3775
4228
|
|
|
3776
|
-
// Add the last line
|
|
3777
4229
|
if (currentLine.length > 1) {
|
|
3778
4230
|
lines.push(currentLine);
|
|
3779
4231
|
}
|
|
4232
|
+
|
|
3780
4233
|
return lines;
|
|
3781
4234
|
}
|
|
3782
4235
|
}, {
|
|
@@ -3792,7 +4245,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3792
4245
|
return value === null ? 0 : value;
|
|
3793
4246
|
});
|
|
3794
4247
|
}
|
|
3795
|
-
|
|
3796
4248
|
/**
|
|
3797
4249
|
* Converts data to points in svg
|
|
3798
4250
|
* @param {Number} xMargin - margin of x axis.
|
|
@@ -3800,6 +4252,7 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3800
4252
|
* @return {Array} points coordination.
|
|
3801
4253
|
* @private
|
|
3802
4254
|
*/
|
|
4255
|
+
|
|
3803
4256
|
}, {
|
|
3804
4257
|
key: "dataToPoints",
|
|
3805
4258
|
value: function dataToPoints(xMargin, yMargin) {
|
|
@@ -3817,7 +4270,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3817
4270
|
return [p.x, p.y];
|
|
3818
4271
|
});
|
|
3819
4272
|
}
|
|
3820
|
-
|
|
3821
4273
|
/**
|
|
3822
4274
|
* Renders rect area for helping figure out which is the nearest point so that
|
|
3823
4275
|
* render related cursor and tooltip.
|
|
@@ -3826,16 +4278,20 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3826
4278
|
* @return {Array} array of svg rect objects
|
|
3827
4279
|
* @private
|
|
3828
4280
|
*/
|
|
4281
|
+
|
|
3829
4282
|
}, {
|
|
3830
4283
|
key: "renderRect",
|
|
3831
4284
|
value: function renderRect(points, xMargin) {
|
|
3832
4285
|
var _this4 = this;
|
|
4286
|
+
|
|
3833
4287
|
var _this$props4 = this.props,
|
|
3834
|
-
|
|
3835
|
-
|
|
4288
|
+
data = _this$props4.data,
|
|
4289
|
+
height = _this$props4.height;
|
|
3836
4290
|
var xUnit = this.getXUnit(xMargin);
|
|
3837
4291
|
return points.map(function (p, i) {
|
|
3838
|
-
return
|
|
4292
|
+
return (
|
|
4293
|
+
/*#__PURE__*/
|
|
4294
|
+
|
|
3839
4295
|
/* eslint-disable react/no-array-index-key */
|
|
3840
4296
|
react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("rect", {
|
|
3841
4297
|
// eslint-disable-line jsx-a11y/mouse-events-have-key-events
|
|
@@ -3858,33 +4314,32 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3858
4314
|
}
|
|
3859
4315
|
})
|
|
3860
4316
|
/* eslint-enable react/no-array-index-key */
|
|
4317
|
+
|
|
3861
4318
|
);
|
|
3862
4319
|
});
|
|
3863
|
-
}
|
|
4320
|
+
} // Renders area chart
|
|
3864
4321
|
|
|
3865
|
-
// Renders area chart
|
|
3866
4322
|
}, {
|
|
3867
4323
|
key: "renderArea",
|
|
3868
4324
|
value: function renderArea(points) {
|
|
3869
4325
|
var _this$props5 = this.props,
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
4326
|
+
data = _this$props5.data,
|
|
4327
|
+
fillColor = _this$props5.fillColor,
|
|
4328
|
+
fillOpacity = _this$props5.fillOpacity,
|
|
4329
|
+
height = _this$props5.height,
|
|
4330
|
+
isArea = _this$props5.isArea;
|
|
4331
|
+
|
|
3875
4332
|
if (!isArea || points.length === 0) {
|
|
3876
4333
|
return null;
|
|
3877
4334
|
}
|
|
4335
|
+
|
|
3878
4336
|
var segments = this.getSegmentSets(data, points);
|
|
3879
4337
|
segments = segments.map(function (s) {
|
|
3880
|
-
return s.concat([[s[s.length - 1][0], height],
|
|
3881
|
-
//
|
|
3882
|
-
[s[0][0], height],
|
|
3883
|
-
// over to below first data point
|
|
4338
|
+
return s.concat([[s[s.length - 1][0], height], // down to bottom of graph
|
|
4339
|
+
[s[0][0], height], // over to below first data point
|
|
3884
4340
|
s[0] // up to first data point to close the box
|
|
3885
4341
|
]);
|
|
3886
4342
|
});
|
|
3887
|
-
|
|
3888
4343
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
|
|
3889
4344
|
"data-test": "area"
|
|
3890
4345
|
}, segments.map(function (s) {
|
|
@@ -3904,11 +4359,11 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3904
4359
|
key: "renderCursor",
|
|
3905
4360
|
value: function renderCursor() {
|
|
3906
4361
|
var _this$props6 = this.props,
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
4362
|
+
cursorStroke = _this$props6.cursorStroke,
|
|
4363
|
+
cursorStrokeWidth = _this$props6.cursorStrokeWidth,
|
|
4364
|
+
cursorStrokeLinecap = _this$props6.cursorStrokeLinecap,
|
|
4365
|
+
cursorStrokeDasharray = _this$props6.cursorStrokeDasharray,
|
|
4366
|
+
height = _this$props6.height;
|
|
3912
4367
|
return this.state.rectArea !== null && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("line", {
|
|
3913
4368
|
"data-test": "cursor",
|
|
3914
4369
|
ref: this.handleCursorMount,
|
|
@@ -3937,7 +4392,6 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3937
4392
|
animation: false
|
|
3938
4393
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(StyledTooltip, null, this.state.anchor !== null ? this.state.tooltip : undefined));
|
|
3939
4394
|
}
|
|
3940
|
-
|
|
3941
4395
|
/**
|
|
3942
4396
|
* Renders one or more svg circles to highlight values on the sparkline
|
|
3943
4397
|
* @method renderEndDots
|
|
@@ -3947,14 +4401,15 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3947
4401
|
* @returns {Object} React representation of SVG group
|
|
3948
4402
|
* @private
|
|
3949
4403
|
*/
|
|
4404
|
+
|
|
3950
4405
|
}, {
|
|
3951
4406
|
key: "renderEndDots",
|
|
3952
4407
|
value: function renderEndDots(points, dotsToShow, xMargin) {
|
|
3953
4408
|
var _this$props7 = this.props,
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
4409
|
+
endDotFillColor = _this$props7.endDotFillColor,
|
|
4410
|
+
endDotRadius = _this$props7.endDotRadius,
|
|
4411
|
+
endDotStroke = _this$props7.endDotStroke,
|
|
4412
|
+
endDotStrokeWidth = _this$props7.endDotStrokeWidth;
|
|
3958
4413
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, points.slice(-dotsToShow).map(function (point) {
|
|
3959
4414
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("circle", {
|
|
3960
4415
|
key: "end-dot".concat(point[0]).concat(point[1]),
|
|
@@ -3970,21 +4425,21 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
3970
4425
|
});
|
|
3971
4426
|
}));
|
|
3972
4427
|
}
|
|
3973
|
-
|
|
3974
4428
|
/**
|
|
3975
4429
|
* Renders the line(s) above the area graph
|
|
3976
4430
|
* @method renderPolyline
|
|
3977
4431
|
* @param {Array} points
|
|
3978
4432
|
* @returns {Object} SVG Group of polylines
|
|
3979
4433
|
*/
|
|
4434
|
+
|
|
3980
4435
|
}, {
|
|
3981
4436
|
key: "renderPolyline",
|
|
3982
4437
|
value: function renderPolyline(points) {
|
|
3983
4438
|
var _this$props8 = this.props,
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4439
|
+
data = _this$props8.data,
|
|
4440
|
+
lineColor = _this$props8.lineColor,
|
|
4441
|
+
lineLength = _this$props8.lineLength,
|
|
4442
|
+
lineStrokeWidth = _this$props8.lineStrokeWidth;
|
|
3988
4443
|
var linePoints = Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(lineLength) && lineLength > 0 ? lineLength : points.length;
|
|
3989
4444
|
var lines = this.getSegmentSets(data.slice(-linePoints), points.slice(-linePoints));
|
|
3990
4445
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", {
|
|
@@ -4008,24 +4463,26 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
4008
4463
|
key: "render",
|
|
4009
4464
|
value: function render() {
|
|
4010
4465
|
var _this5 = this;
|
|
4466
|
+
|
|
4011
4467
|
var _this$props9 = this.props,
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4468
|
+
data = _this$props9.data,
|
|
4469
|
+
elementRef = _this$props9.elementRef,
|
|
4470
|
+
showTooltip = _this$props9.showTooltip,
|
|
4471
|
+
showEndDot = _this$props9.showEndDot,
|
|
4472
|
+
endDotRadius = _this$props9.endDotRadius,
|
|
4473
|
+
endDotStrokeWidth = _this$props9.endDotStrokeWidth,
|
|
4474
|
+
endDotCount = _this$props9.endDotCount,
|
|
4475
|
+
height = _this$props9.height,
|
|
4476
|
+
isArea = _this$props9.isArea,
|
|
4477
|
+
lineStrokeWidth = _this$props9.lineStrokeWidth,
|
|
4478
|
+
width = _this$props9.width,
|
|
4479
|
+
title = _this$props9.title;
|
|
4480
|
+
|
|
4024
4481
|
if (data.length === 0) {
|
|
4025
4482
|
return null;
|
|
4026
|
-
}
|
|
4483
|
+
} // Calculate horizontal and vertical margin so that fit line or end dot.
|
|
4484
|
+
|
|
4027
4485
|
|
|
4028
|
-
// Calculate horizontal and vertical margin so that fit line or end dot.
|
|
4029
4486
|
var xMargin = endDotRadius + endDotStrokeWidth / 2;
|
|
4030
4487
|
var yMargin = Math.max(lineStrokeWidth / 2, endDotRadius + endDotStrokeWidth / 2);
|
|
4031
4488
|
var points = this.dataToPoints(xMargin, yMargin);
|
|
@@ -4055,84 +4512,114 @@ var SparkLine = /*#__PURE__*/function (_Component) {
|
|
|
4055
4512
|
}, title || Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_13__["_"])('Source count over time sparkline trend')), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("g", null, this.renderCursor(), this.renderPolyline(points), this.renderArea(points), dotsToShow ? this.renderEndDots(points, dotsToShow, xMargin) : null, showTooltip ? this.renderRect(points, xMargin) : null, showTooltip ? this.renderTooltip() : null)));
|
|
4056
4513
|
}
|
|
4057
4514
|
}]);
|
|
4515
|
+
|
|
4058
4516
|
return SparkLine;
|
|
4059
4517
|
}(react__WEBPACK_IMPORTED_MODULE_9__["Component"]);
|
|
4518
|
+
|
|
4060
4519
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "propTypes", {
|
|
4061
4520
|
/**
|
|
4062
4521
|
* If true, data can contain `null` as a value and is treated as `0`. If false, this throws error when data contains `null`.
|
|
4063
4522
|
*/
|
|
4064
4523
|
acceptNull: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
4524
|
+
|
|
4065
4525
|
/** Array of numbers. These data numbers are converted to points and show on sparkline. */
|
|
4066
4526
|
data: function data(props) {
|
|
4067
4527
|
if (!Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isArray"])(props.data)) {
|
|
4068
4528
|
return new Error('Data provided to Sparkline must be an array.');
|
|
4069
4529
|
}
|
|
4530
|
+
|
|
4070
4531
|
if (props.acceptNull && !props.data.every(function (value) {
|
|
4071
4532
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isNull"])(value) || Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
|
|
4072
4533
|
})) {
|
|
4073
4534
|
return new Error('Data provided to Sparkline must be finite numbers or null.');
|
|
4074
4535
|
}
|
|
4536
|
+
|
|
4075
4537
|
if (!props.acceptNull && !props.data.every(function (value) {
|
|
4076
4538
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_10__["isFinite"])(value);
|
|
4077
4539
|
})) {
|
|
4078
4540
|
return new Error('Data provided to Sparkline must be finite numbers.');
|
|
4079
4541
|
}
|
|
4542
|
+
|
|
4080
4543
|
return null;
|
|
4081
4544
|
},
|
|
4545
|
+
|
|
4082
4546
|
/** A React ref which is set to the DOM element when the component mounts and `null` when it unmounts. */
|
|
4083
4547
|
elementRef: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.func, prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.object]),
|
|
4548
|
+
|
|
4084
4549
|
/** Sets the number of end dots to display. When showEndDot is set to `true`, endDotCount is at least 1. If set to a positive value, this overrides showEndDot. */
|
|
4085
4550
|
endDotCount: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4551
|
+
|
|
4086
4552
|
/** Fills color to the end dot. */
|
|
4087
4553
|
endDotFillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
4554
|
+
|
|
4088
4555
|
/**
|
|
4089
4556
|
* Sets end dot radius. End dot radius must be less than or equal to the margin. By default, its value equals the margin.
|
|
4090
4557
|
*/
|
|
4091
4558
|
endDotRadius: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4559
|
+
|
|
4092
4560
|
/** Sets end dot circle stroke color. */
|
|
4093
4561
|
endDotStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
4562
|
+
|
|
4094
4563
|
/** Sets end dot circle stroke width in pixels. */
|
|
4095
4564
|
endDotStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4565
|
+
|
|
4096
4566
|
/** Fills color to area. */
|
|
4097
4567
|
fillColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
4568
|
+
|
|
4098
4569
|
/** Fills opacity to area. Value must be in 0 ~ 1. */
|
|
4099
4570
|
fillOpacity: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
4571
|
+
|
|
4100
4572
|
/** Sets cursor stroke color. */
|
|
4101
4573
|
cursorStroke: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
4574
|
+
|
|
4102
4575
|
/** Sets cursor stroke width in pixels. */
|
|
4103
4576
|
cursorStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4577
|
+
|
|
4104
4578
|
/** Sets cursor line cap style. */
|
|
4105
4579
|
cursorStrokeLinecap: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.oneOf(['butt', 'round', 'square']),
|
|
4580
|
+
|
|
4106
4581
|
/** Sets cursor dash array style. */
|
|
4107
4582
|
cursorStrokeDasharray: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
4583
|
+
|
|
4108
4584
|
/**
|
|
4109
4585
|
* Container height. If this value is specified, sparkline calculates the size using this height. If height isn't specified,
|
|
4110
4586
|
* sparkline figures out the container height by itself.
|
|
4111
4587
|
*/
|
|
4112
4588
|
height: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
|
|
4589
|
+
|
|
4113
4590
|
/** When set to `true`, sparkline shows as area. */
|
|
4114
4591
|
isArea: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
4592
|
+
|
|
4115
4593
|
/** The sparkline line color. */
|
|
4116
4594
|
lineColor: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string,
|
|
4595
|
+
|
|
4117
4596
|
/** Allows user to draw only the last data points for the line. */
|
|
4118
4597
|
lineLength: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4598
|
+
|
|
4119
4599
|
/** The sparkline line stroke width in pixels. */
|
|
4120
4600
|
lineStrokeWidth: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4601
|
+
|
|
4121
4602
|
/** Enable to show end dot. */
|
|
4122
4603
|
showEndDot: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
4604
|
+
|
|
4123
4605
|
/** Enable to show tooltip. */
|
|
4124
4606
|
showTooltip: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.bool,
|
|
4607
|
+
|
|
4125
4608
|
/** Sets the data value range and maximum value shown on sparkline. */
|
|
4126
4609
|
yMax: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4610
|
+
|
|
4127
4611
|
/** Sets the data value range and minimum value shown on sparkline. */
|
|
4128
4612
|
yMin: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number,
|
|
4613
|
+
|
|
4129
4614
|
/**
|
|
4130
4615
|
* The width of the container.
|
|
4131
4616
|
*/
|
|
4132
4617
|
width: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.number.isRequired,
|
|
4618
|
+
|
|
4133
4619
|
/** Sets the a11y title text on sparkline. */
|
|
4134
4620
|
title: prop_types__WEBPACK_IMPORTED_MODULE_8___default.a.string
|
|
4135
4621
|
});
|
|
4622
|
+
|
|
4136
4623
|
_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(SparkLine, "defaultProps", {
|
|
4137
4624
|
acceptNull: false,
|
|
4138
4625
|
data: [],
|
|
@@ -4153,6 +4640,7 @@ _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_7___default()(Spa
|
|
|
4153
4640
|
lineColor: '#65a637',
|
|
4154
4641
|
lineStrokeWidth: 1
|
|
4155
4642
|
});
|
|
4643
|
+
|
|
4156
4644
|
/* harmony default export */ __webpack_exports__["default"] = (SparkLine);
|
|
4157
4645
|
|
|
4158
4646
|
/***/ })
|