@splunk/visualizations 24.3.0 → 24.3.3
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/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Dark.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_geostats_by.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
- package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
- package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Additional_Cases.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Internal_Fields.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Mostly_null.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Restricted_Zoom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Markdown_Markdown_Markdown_with_number_as_DSL.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_By_Type_Custom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Default.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Kitchen_Sink.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Right.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Align_Single_Column.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Color_light_blue.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_No_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Background_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Basic_Table_With_No_Click.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Cell_Types.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Gradient.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Column_Override.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Count_2.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Header_Colors.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Row_Colors.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Custom_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_No_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Dark_Background_Stripe.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Format_Number_Adv.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_fixed.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Header_Visibility_none.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Height_Percentage_100_no_paginator.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Invalid_Background_Color.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Multi_Value_Field.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_No_Stripes_Row_Numbers.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Show_Row_Numbers_true.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Custom.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparkline_Width.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Sparklines_Adv.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Formatting.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Table_Gradient.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Time_Formatting.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Height.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Percentage.png +0 -0
- package/.loki/reference/chrome_docker_Visualizations_Table_Table_Width_Px.png +0 -0
- package/Area.js +121 -65
- package/Area.js.map +1 -1
- package/Bar.js +121 -65
- package/Bar.js.map +1 -1
- package/Bubble.js +121 -65
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.js +145 -76
- package/ChoroplethSvg.js.map +1 -1
- package/Column.js +121 -65
- package/Column.js.map +1 -1
- package/Ellipse.js +124 -68
- package/Ellipse.js.map +1 -1
- package/FillerGauge.js +124 -68
- package/FillerGauge.js.map +1 -1
- package/Image.js +125 -69
- package/Image.js.map +1 -1
- package/Line.js +121 -65
- package/Line.js.map +1 -1
- package/LinkGraph.js +124 -68
- package/LinkGraph.js.map +1 -1
- package/Map.config.js +16 -6
- package/Map.config.js.map +1 -1
- package/Map.js +480 -172
- package/Map.js.map +1 -1
- package/Markdown.js +136 -78
- package/Markdown.js.map +1 -1
- package/MarkerGauge.js +135 -79
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.js +143 -86
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.js +133 -77
- package/Pie.js.map +1 -1
- package/Punchcard.js +149 -92
- package/Punchcard.js.map +1 -1
- package/Rectangle.js +131 -75
- package/Rectangle.js.map +1 -1
- package/Sankey.js +208 -152
- package/Sankey.js.map +1 -1
- package/Scatter.js +131 -75
- package/Scatter.js.map +1 -1
- package/SingleValue.js +162 -106
- package/SingleValue.js.map +1 -1
- package/SingleValueIcon.js +138 -81
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.js +204 -148
- package/SingleValueRadial.js.map +1 -1
- package/Table.config.js +1 -2
- package/Table.config.js.map +1 -1
- package/Table.js +301 -347
- package/Table.js.map +1 -1
- package/common/utils/hocUtils.js +65 -9
- package/common/utils/hocUtils.js.map +1 -1
- package/common/withDashboardViz.js +68 -12
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +10 -10
package/Table.js
CHANGED
|
@@ -87,7 +87,7 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 256);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ({
|
|
@@ -220,7 +220,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
220
220
|
|
|
221
221
|
return React.createElement(FixSizeItem, {
|
|
222
222
|
"data-test": "fix-size-item",
|
|
223
|
-
"data-splunk-visualization-version": "24.3.
|
|
223
|
+
"data-splunk-visualization-version": "24.3.3 - 8d441d88c",
|
|
224
224
|
width: width,
|
|
225
225
|
height: height,
|
|
226
226
|
backgroundColor: backgroundColor
|
|
@@ -255,7 +255,7 @@ module.exports = require("@splunk/visualizations-shared/style");
|
|
|
255
255
|
"use strict";
|
|
256
256
|
|
|
257
257
|
|
|
258
|
-
var _slicedToArray = __webpack_require__(
|
|
258
|
+
var _slicedToArray = __webpack_require__(49);
|
|
259
259
|
|
|
260
260
|
var __rest = this && this.__rest || function (s, e) {
|
|
261
261
|
var t = {};
|
|
@@ -275,30 +275,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
275
275
|
});
|
|
276
276
|
exports.config = exports.PureTable = exports.themes = exports.computeVizProps = void 0;
|
|
277
277
|
|
|
278
|
-
var lodash_1 = __webpack_require__(2);
|
|
279
|
-
|
|
280
278
|
var colorUtils_1 = __webpack_require__(11);
|
|
281
279
|
|
|
282
|
-
var config_1 = __webpack_require__(
|
|
280
|
+
var config_1 = __webpack_require__(257);
|
|
283
281
|
|
|
284
282
|
exports.config = config_1.default;
|
|
285
283
|
|
|
286
|
-
var withDashboardViz_1 = __webpack_require__(
|
|
284
|
+
var withDashboardViz_1 = __webpack_require__(28);
|
|
287
285
|
|
|
288
|
-
var PureTable_1 = __webpack_require__(
|
|
286
|
+
var PureTable_1 = __webpack_require__(258);
|
|
289
287
|
|
|
290
288
|
exports.PureTable = PureTable_1.default;
|
|
291
289
|
|
|
292
290
|
var computeVizProps = function computeVizProps(_a) {
|
|
293
291
|
var props = __rest(_a, []);
|
|
294
292
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
var
|
|
299
|
-
var
|
|
300
|
-
var themeRowBackgroundColorEven = vizProps.themeFunc('rowBackgroundColorEven');
|
|
301
|
-
var themeTextColor = vizProps.themeFunc('textColor'); // `columns` looks like { `column title`: { rowBackgroundColors, rowColors... }}
|
|
293
|
+
if (props.columnFormat) {
|
|
294
|
+
var columns = props.columnFormat;
|
|
295
|
+
var themeRowBackgroundColorOdd = props.themeFunc('rowBackgroundColorOdd');
|
|
296
|
+
var themeRowBackgroundColorEven = props.themeFunc('rowBackgroundColorEven');
|
|
297
|
+
var themeTextColor = props.themeFunc('textColor'); // `columns` looks like { `column title`: { rowBackgroundColors, rowColors... }}
|
|
302
298
|
|
|
303
299
|
Object.entries(columns).forEach(function (_ref) {
|
|
304
300
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -321,9 +317,10 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
321
317
|
rowColors = colorUtils_1.sanitizeArrayOfColors(columnProperties.rowColors).map(function (color) {
|
|
322
318
|
return color || themeTextColor;
|
|
323
319
|
});
|
|
324
|
-
}
|
|
320
|
+
} // eslint-disable-next-line no-param-reassign
|
|
321
|
+
|
|
325
322
|
|
|
326
|
-
|
|
323
|
+
props.columnFormat[columnKey] = Object.assign(Object.assign(Object.assign({}, props.columnFormat[columnKey]), columnProperties.rowBackgroundColors && {
|
|
327
324
|
rowBackgroundColors: rowBackgroundColors
|
|
328
325
|
}), columnProperties.rowColors && {
|
|
329
326
|
rowColors: rowColors
|
|
@@ -331,52 +328,44 @@ var computeVizProps = function computeVizProps(_a) {
|
|
|
331
328
|
});
|
|
332
329
|
}
|
|
333
330
|
|
|
334
|
-
if (
|
|
335
|
-
var handleColumnFormatChange = function handleColumnFormatChange(updatedColumnFormat) {
|
|
336
|
-
vizProps.onOptionsChange({
|
|
337
|
-
columnFormat: updatedColumnFormat
|
|
338
|
-
});
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
vizProps.onColumnFormatChange = handleColumnFormatChange;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
if (!vizProps.showInternalFields) {
|
|
331
|
+
if (!props.showInternalFields) {
|
|
345
332
|
var filteredFields = [];
|
|
346
333
|
var filteredTable = [];
|
|
347
334
|
var filteredIndexes = [];
|
|
348
|
-
|
|
335
|
+
props.headers.forEach(function (fieldIn, index) {
|
|
349
336
|
var _a;
|
|
350
337
|
|
|
351
338
|
var field = (_a = fieldIn.name) !== null && _a !== void 0 ? _a : fieldIn;
|
|
352
339
|
|
|
353
340
|
if (field.charAt(0) !== '_' || field === '_time') {
|
|
354
341
|
filteredFields.push(field);
|
|
355
|
-
filteredTable.push(
|
|
342
|
+
filteredTable.push(props.table[index]);
|
|
356
343
|
filteredIndexes.push(index);
|
|
357
344
|
}
|
|
358
345
|
});
|
|
359
346
|
var filteredTableFormat = null;
|
|
360
347
|
|
|
361
|
-
if (
|
|
348
|
+
if (props.tableFormat) {
|
|
362
349
|
filteredTableFormat = {};
|
|
363
|
-
Object.keys(
|
|
364
|
-
if (Array.isArray(
|
|
365
|
-
filteredTableFormat[tableFormatKey] =
|
|
350
|
+
Object.keys(props.tableFormat).forEach(function (tableFormatKey) {
|
|
351
|
+
if (Array.isArray(props.tableFormat[tableFormatKey])) {
|
|
352
|
+
filteredTableFormat[tableFormatKey] = props.tableFormat[tableFormatKey].filter(function (tableFormatItem, tableFormatItemIndex) {
|
|
366
353
|
return filteredIndexes.indexOf(tableFormatItemIndex) !== -1;
|
|
367
354
|
});
|
|
368
355
|
} else {
|
|
369
|
-
filteredTableFormat[tableFormatKey] =
|
|
356
|
+
filteredTableFormat[tableFormatKey] = props.tableFormat[tableFormatKey];
|
|
370
357
|
}
|
|
371
358
|
});
|
|
372
359
|
}
|
|
373
360
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
361
|
+
return Object.assign(Object.assign({}, props), {
|
|
362
|
+
headers: filteredFields,
|
|
363
|
+
table: filteredTable,
|
|
364
|
+
tableFormat: filteredTableFormat
|
|
365
|
+
});
|
|
377
366
|
}
|
|
378
367
|
|
|
379
|
-
return
|
|
368
|
+
return props;
|
|
380
369
|
};
|
|
381
370
|
|
|
382
371
|
exports.computeVizProps = computeVizProps;
|
|
@@ -457,7 +446,7 @@ var T = __webpack_require__(0);
|
|
|
457
446
|
|
|
458
447
|
var lodash_1 = __webpack_require__(2);
|
|
459
448
|
|
|
460
|
-
var DataSource_1 = __webpack_require__(
|
|
449
|
+
var DataSource_1 = __webpack_require__(34);
|
|
461
450
|
|
|
462
451
|
exports.SortParamsPropTypes = T.shape({
|
|
463
452
|
currentSortKey: T.string,
|
|
@@ -585,87 +574,32 @@ exports.getPaginationParams = getPaginationParams;
|
|
|
585
574
|
Object.defineProperty(exports, "__esModule", {
|
|
586
575
|
value: true
|
|
587
576
|
});
|
|
588
|
-
exports.
|
|
589
|
-
|
|
590
|
-
var React = __webpack_require__(1);
|
|
591
|
-
|
|
592
|
-
var T = __webpack_require__(0);
|
|
577
|
+
exports.pickFieldFromJSONSchema = void 0;
|
|
593
578
|
|
|
594
579
|
var lodash_1 = __webpack_require__(2);
|
|
595
580
|
|
|
596
|
-
var
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
* @param {object} dataSources
|
|
604
|
-
* @param {boolean} loading
|
|
605
|
-
* @returns {boolean}
|
|
606
|
-
*/
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
610
|
-
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
611
|
-
var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
|
|
612
|
-
var noData = data === undefined;
|
|
613
|
-
var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
|
|
614
|
-
var noFields = fields === undefined;
|
|
615
|
-
return loading || noData || noFields;
|
|
616
|
-
};
|
|
617
|
-
|
|
618
|
-
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
619
|
-
var propTypes = {
|
|
620
|
-
icon: T.func,
|
|
621
|
-
width: T.oneOfType([T.string, T.number]),
|
|
622
|
-
height: T.oneOfType([T.string, T.number]),
|
|
623
|
-
// eslint-disable-next-line react/no-unused-prop-types
|
|
624
|
-
backgroundColor: T.string
|
|
625
|
-
};
|
|
626
|
-
/**
|
|
627
|
-
* @method IconPlaceholder
|
|
628
|
-
* @param {IconPlaceholderProps} props
|
|
629
|
-
* @returns {React.ReactElement}
|
|
630
|
-
*/
|
|
631
|
-
|
|
632
|
-
var IconPlaceholder = function IconPlaceholder(props) {
|
|
633
|
-
var width = props.width,
|
|
634
|
-
height = props.height,
|
|
635
|
-
icon = props.icon;
|
|
581
|
+
var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
|
|
582
|
+
var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
583
|
+
return Object.keys(optionsSchema).reduce(function (accum, k) {
|
|
584
|
+
if (lodash_1.has(optionsSchema[k], fieldName)) {
|
|
585
|
+
accum[k] = optionsSchema[k][fieldName];
|
|
586
|
+
} else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
|
|
587
|
+
var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
|
|
636
588
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
top: '50%',
|
|
642
|
-
color: 'grey',
|
|
643
|
-
position: 'absolute',
|
|
644
|
-
transform: 'translate(-50%, -50%)'
|
|
645
|
-
},
|
|
646
|
-
width: '50%',
|
|
647
|
-
height: '50%'
|
|
648
|
-
});
|
|
649
|
-
}
|
|
589
|
+
if (!lodash_1.isEmpty(nestedSchema)) {
|
|
590
|
+
accum[k] = nestedSchema;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
650
593
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
height: height,
|
|
654
|
-
level: "warning",
|
|
655
|
-
message: i18n_1._('No DataSource Connected')
|
|
656
|
-
});
|
|
594
|
+
return accum;
|
|
595
|
+
}, {});
|
|
657
596
|
};
|
|
658
597
|
|
|
659
|
-
|
|
660
|
-
IconPlaceholder.defaultProps = {
|
|
661
|
-
width: '100%',
|
|
662
|
-
height: 250
|
|
663
|
-
};
|
|
664
|
-
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
598
|
+
exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
|
|
665
599
|
|
|
666
600
|
/***/ }),
|
|
667
601
|
|
|
668
|
-
/***/
|
|
602
|
+
/***/ 256:
|
|
669
603
|
/***/ (function(module, exports, __webpack_require__) {
|
|
670
604
|
|
|
671
605
|
"use strict";
|
|
@@ -710,7 +644,7 @@ Object.defineProperty(exports, "default", {
|
|
|
710
644
|
|
|
711
645
|
/***/ }),
|
|
712
646
|
|
|
713
|
-
/***/
|
|
647
|
+
/***/ 257:
|
|
714
648
|
/***/ (function(module, exports, __webpack_require__) {
|
|
715
649
|
|
|
716
650
|
"use strict";
|
|
@@ -742,7 +676,7 @@ var VizBehavior_1 = __webpack_require__(5);
|
|
|
742
676
|
|
|
743
677
|
var consts_1 = __webpack_require__(105);
|
|
744
678
|
|
|
745
|
-
var VizCategory_1 = __webpack_require__(
|
|
679
|
+
var VizCategory_1 = __webpack_require__(27);
|
|
746
680
|
|
|
747
681
|
var dataContract = {
|
|
748
682
|
requiredDataSources: [{
|
|
@@ -975,8 +909,7 @@ var optionsSchema = {
|
|
|
975
909
|
},
|
|
976
910
|
width: {
|
|
977
911
|
description: 'Controls how wide in pixels (where 1px = 1/96th of 1in) the column should be displayed.',
|
|
978
|
-
type: 'number'
|
|
979
|
-
minimum: 30
|
|
912
|
+
type: 'number'
|
|
980
913
|
}
|
|
981
914
|
}
|
|
982
915
|
}
|
|
@@ -1386,14 +1319,12 @@ exports.default = configUtils_1.enhanceConfig(config);
|
|
|
1386
1319
|
|
|
1387
1320
|
/***/ }),
|
|
1388
1321
|
|
|
1389
|
-
/***/
|
|
1322
|
+
/***/ 258:
|
|
1390
1323
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1391
1324
|
|
|
1392
1325
|
"use strict";
|
|
1393
1326
|
|
|
1394
1327
|
|
|
1395
|
-
var _slicedToArray = __webpack_require__(48);
|
|
1396
|
-
|
|
1397
1328
|
var _taggedTemplateLiteral = __webpack_require__(101);
|
|
1398
1329
|
|
|
1399
1330
|
var _templateObject, _templateObject2;
|
|
@@ -1427,9 +1358,9 @@ var i18n_1 = __webpack_require__(3);
|
|
|
1427
1358
|
|
|
1428
1359
|
var Table_1 = __webpack_require__(82);
|
|
1429
1360
|
|
|
1430
|
-
var Paginator_1 = __webpack_require__(
|
|
1361
|
+
var Paginator_1 = __webpack_require__(259);
|
|
1431
1362
|
|
|
1432
|
-
var Message_1 = __webpack_require__(
|
|
1363
|
+
var Message_1 = __webpack_require__(260);
|
|
1433
1364
|
|
|
1434
1365
|
var colorUtils_1 = __webpack_require__(11);
|
|
1435
1366
|
|
|
@@ -1439,11 +1370,11 @@ var pick_1 = __webpack_require__(21);
|
|
|
1439
1370
|
|
|
1440
1371
|
var variables_1 = __webpack_require__(19);
|
|
1441
1372
|
|
|
1442
|
-
var hooks_1 = __webpack_require__(
|
|
1373
|
+
var hooks_1 = __webpack_require__(261);
|
|
1443
1374
|
|
|
1444
1375
|
var consts_1 = __webpack_require__(105);
|
|
1445
1376
|
|
|
1446
|
-
var cells_1 = __webpack_require__(
|
|
1377
|
+
var cells_1 = __webpack_require__(262);
|
|
1447
1378
|
|
|
1448
1379
|
var getPagination_1 = __webpack_require__(24);
|
|
1449
1380
|
|
|
@@ -1453,24 +1384,15 @@ var FixedSizeContainer_1 = __webpack_require__(12); // debounce was imported thi
|
|
|
1453
1384
|
// eslint-disable-next-line import/order
|
|
1454
1385
|
|
|
1455
1386
|
|
|
1456
|
-
var debounce = __webpack_require__(
|
|
1387
|
+
var debounce = __webpack_require__(267);
|
|
1457
1388
|
|
|
1458
|
-
var
|
|
1459
|
-
var StyledTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
|
|
1460
|
-
displayName: "PureTable__StyledTableHead",
|
|
1461
|
-
componentId: "tovzjg-0"
|
|
1462
|
-
})(["& > tr > th:last-child > div > button{display:none;}"]);
|
|
1463
|
-
var NonVisibleTableHead = styled_components_1.default(StyledTableHead).withConfig({
|
|
1389
|
+
var NonVisibleTableHead = styled_components_1.default(Table_1.default.Head).withConfig({
|
|
1464
1390
|
displayName: "PureTable__NonVisibleTableHead",
|
|
1465
|
-
componentId: "tovzjg-
|
|
1391
|
+
componentId: "tovzjg-0"
|
|
1466
1392
|
})(["display:none;"]);
|
|
1467
|
-
var FixedTableHead = styled_components_1.default(StyledTableHead).withConfig({
|
|
1468
|
-
displayName: "PureTable__FixedTableHead",
|
|
1469
|
-
componentId: "tovzjg-2"
|
|
1470
|
-
})(["position:sticky;top:0;"]);
|
|
1471
1393
|
var VizTableContainer = styled_components_1.default.div.withConfig({
|
|
1472
1394
|
displayName: "PureTable__VizTableContainer",
|
|
1473
|
-
componentId: "tovzjg-
|
|
1395
|
+
componentId: "tovzjg-1"
|
|
1474
1396
|
})(["box-sizing:border-box;padding:", ";background-color:", ";display:flex;flex-flow:column nowrap;overflow:hidden;"], pick_1.default({
|
|
1475
1397
|
enterprise: variables_1.default.spacingHalf,
|
|
1476
1398
|
prisma: variables_1.default.spacingSmall
|
|
@@ -1482,7 +1404,7 @@ var PAGINATOR_CONTAINER_HEIGHT = 38;
|
|
|
1482
1404
|
var PAGINATOR_SPACING = 5;
|
|
1483
1405
|
var SUITableContainer = styled_components_1.default.div.withConfig({
|
|
1484
1406
|
displayName: "PureTable__SUITableContainer",
|
|
1485
|
-
componentId: "tovzjg-
|
|
1407
|
+
componentId: "tovzjg-2"
|
|
1486
1408
|
})(["box-sizing:border-box;flex-grow:1;overflow:hidden;", ";", ";", " ", ""], function (_ref) {
|
|
1487
1409
|
var width = _ref.width,
|
|
1488
1410
|
height = _ref.height,
|
|
@@ -1516,7 +1438,7 @@ var SUITableContainer = styled_components_1.default.div.withConfig({
|
|
|
1516
1438
|
SUITableContainer.displayName = 'SUITableContainer';
|
|
1517
1439
|
var PaginatorContainer = styled_components_1.default.div.withConfig({
|
|
1518
1440
|
displayName: "PureTable__PaginatorContainer",
|
|
1519
|
-
componentId: "tovzjg-
|
|
1441
|
+
componentId: "tovzjg-3"
|
|
1520
1442
|
})(["position:relative;text-align:right;height:", "px;"], PAGINATOR_CONTAINER_HEIGHT);
|
|
1521
1443
|
PaginatorContainer.displayName = 'PaginatorContainer'; // allow for early return in case of empty tableBody while still following hook rules
|
|
1522
1444
|
|
|
@@ -1563,20 +1485,6 @@ var withEmptyTableMessage = function withEmptyTableMessage(Viz) {
|
|
|
1563
1485
|
return Wrapper;
|
|
1564
1486
|
};
|
|
1565
1487
|
|
|
1566
|
-
var useTableHead = function useTableHead(visibility, mode) {
|
|
1567
|
-
if (visibility === 'none') {
|
|
1568
|
-
return NonVisibleTableHead;
|
|
1569
|
-
} // @TODO
|
|
1570
|
-
// Stacking context conflicts with editModeCover; temporary fix
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
if (visibility === 'fixed' && mode === 'view') {
|
|
1574
|
-
return FixedTableHead;
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
return StyledTableHead;
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
1488
|
var PureTable = function PureTable(props) {
|
|
1581
1489
|
var count = props.count,
|
|
1582
1490
|
width = props.width,
|
|
@@ -1592,16 +1500,7 @@ var PureTable = function PureTable(props) {
|
|
|
1592
1500
|
_a = props.paginatorParams,
|
|
1593
1501
|
isPaging = _a.isPaging,
|
|
1594
1502
|
paginatorProps = __rest(_a, ["isPaging"]),
|
|
1595
|
-
onCellClick = props.onCellClick
|
|
1596
|
-
onColumnFormatChange = props.onColumnFormatChange,
|
|
1597
|
-
columnFormat = props.columnFormat,
|
|
1598
|
-
mode = props.mode,
|
|
1599
|
-
headerVisibility = props.headerVisibility;
|
|
1600
|
-
|
|
1601
|
-
var _React$useState = React.useState(columnFormat),
|
|
1602
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1603
|
-
columns = _React$useState2[0],
|
|
1604
|
-
setColumns = _React$useState2[1];
|
|
1503
|
+
onCellClick = props.onCellClick;
|
|
1605
1504
|
|
|
1606
1505
|
var firstRenderCount = React.useRef(count);
|
|
1607
1506
|
React.useEffect(function () {
|
|
@@ -1612,11 +1511,7 @@ var PureTable = function PureTable(props) {
|
|
|
1612
1511
|
});
|
|
1613
1512
|
}
|
|
1614
1513
|
}, [count, paginatorProps]);
|
|
1615
|
-
var
|
|
1616
|
-
React.useEffect(function () {
|
|
1617
|
-
setColumns(columnFormat);
|
|
1618
|
-
}, [mode, stringifiedColumnFormat]);
|
|
1619
|
-
var TableHead = useTableHead(headerVisibility, mode);
|
|
1514
|
+
var TableHead = tableHeader.visibility === 'none' ? NonVisibleTableHead : Table_1.default.Head;
|
|
1620
1515
|
var debouncedDrilldown = debounce(function (e, payload) {
|
|
1621
1516
|
if (window.getSelection().toString() === '') {
|
|
1622
1517
|
if (lodash_1.isFunction(onCellClick)) {
|
|
@@ -1668,47 +1563,6 @@ var PureTable = function PureTable(props) {
|
|
|
1668
1563
|
debouncedDrilldown(e.nativeEvent, payload);
|
|
1669
1564
|
}
|
|
1670
1565
|
}, [onCellClick, showRowNumbers, tableHeader, tableBody]);
|
|
1671
|
-
var debouncedOnColumnFormatChange = React.useMemo(function () {
|
|
1672
|
-
return debounce(function (newFormat) {
|
|
1673
|
-
onColumnFormatChange(newFormat);
|
|
1674
|
-
}, 300);
|
|
1675
|
-
}, [onColumnFormatChange]);
|
|
1676
|
-
|
|
1677
|
-
var sumColumnWidths = function sumColumnWidths(allColumns) {
|
|
1678
|
-
return Object.keys(allColumns).reduce(function (prev, key) {
|
|
1679
|
-
var _a, _b, _c;
|
|
1680
|
-
|
|
1681
|
-
if (((_a = allColumns[key]) === null || _a === void 0 ? void 0 : _a.width) === 'auto' || ((_b = allColumns[key]) === null || _b === void 0 ? void 0 : _b.width) === undefined) {
|
|
1682
|
-
return prev + MINIMUM_COLUMN_SIZE; // Columns with no width defined are automatically size 30
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
return prev + ((_c = allColumns[key]) === null || _c === void 0 ? void 0 : _c.width);
|
|
1686
|
-
}, 0) + // Add all remaining columns that do not have a columnFormat
|
|
1687
|
-
(tableHeader.cells.length - Object.keys(allColumns).length) * MINIMUM_COLUMN_SIZE;
|
|
1688
|
-
};
|
|
1689
|
-
|
|
1690
|
-
var handleResizeColumn = React.useCallback(function (_event, payload) {
|
|
1691
|
-
var updatedCF = lodash_1.cloneDeep(columns);
|
|
1692
|
-
var field = payload.columnId.split('-')[1];
|
|
1693
|
-
updatedCF[field] = Object.assign(Object.assign({}, updatedCF[field]), {
|
|
1694
|
-
width: Math.max(payload.width, MINIMUM_COLUMN_SIZE)
|
|
1695
|
-
}); // Prevent the user from expanding the columns too far
|
|
1696
|
-
|
|
1697
|
-
if (sumColumnWidths(updatedCF) > width) {
|
|
1698
|
-
return;
|
|
1699
|
-
}
|
|
1700
|
-
|
|
1701
|
-
setColumns(updatedCF); // Updates column json in edit mode
|
|
1702
|
-
|
|
1703
|
-
if (mode === 'edit') {
|
|
1704
|
-
debouncedOnColumnFormatChange(updatedCF);
|
|
1705
|
-
}
|
|
1706
|
-
}, [mode, columns, width, debouncedOnColumnFormatChange]);
|
|
1707
|
-
|
|
1708
|
-
var handleEventClick = function handleEventClick(e) {
|
|
1709
|
-
e.stopPropagation();
|
|
1710
|
-
};
|
|
1711
|
-
|
|
1712
1566
|
return React.createElement(VizTableContainer, {
|
|
1713
1567
|
backgroundColor: backgroundColor
|
|
1714
1568
|
}, React.createElement(SUITableContainer, {
|
|
@@ -1717,7 +1571,7 @@ var PureTable = function PureTable(props) {
|
|
|
1717
1571
|
isPaging: isPaging,
|
|
1718
1572
|
headerStyle: tableHeader.style
|
|
1719
1573
|
}, React.createElement(Table_1.default, {
|
|
1720
|
-
headType: tableHeader.visibility !== 'none' ?
|
|
1574
|
+
headType: tableHeader.visibility !== 'none' ? tableHeader.visibility : undefined,
|
|
1721
1575
|
innerStyle: {
|
|
1722
1576
|
height: '100%'
|
|
1723
1577
|
},
|
|
@@ -1725,12 +1579,8 @@ var PureTable = function PureTable(props) {
|
|
|
1725
1579
|
height: '100%',
|
|
1726
1580
|
cursor: onCellClick ? 'pointer' : 'unset'
|
|
1727
1581
|
},
|
|
1728
|
-
onClick: onCellClick ? drilldownHandler : lodash_1.noop
|
|
1729
|
-
onRequestResizeColumn: handleResizeColumn,
|
|
1730
|
-
resizableFillLayout: true
|
|
1582
|
+
onClick: onCellClick ? drilldownHandler : lodash_1.noop
|
|
1731
1583
|
}, React.createElement(TableHead, null, tableHeader.cells.map(function (_a) {
|
|
1732
|
-
var _b;
|
|
1733
|
-
|
|
1734
1584
|
var key = _a.key,
|
|
1735
1585
|
value = _a.value,
|
|
1736
1586
|
sortKey = _a.sortKey,
|
|
@@ -1738,10 +1588,7 @@ var PureTable = function PureTable(props) {
|
|
|
1738
1588
|
|
|
1739
1589
|
return React.createElement(Table_1.default.HeadCell, Object.assign({
|
|
1740
1590
|
key: key,
|
|
1741
|
-
|
|
1742
|
-
sortDir: sortKey === currentSortKey ? currentSortDir : 'none',
|
|
1743
|
-
width: ((_b = columns[value]) === null || _b === void 0 ? void 0 : _b.width) || 'auto',
|
|
1744
|
-
onMouseDown: handleEventClick
|
|
1591
|
+
sortDir: sortKey === currentSortKey ? currentSortDir : 'none'
|
|
1745
1592
|
}, Object.assign({
|
|
1746
1593
|
sortKey: sortKey,
|
|
1747
1594
|
onSort: onSort
|
|
@@ -1750,23 +1597,18 @@ var PureTable = function PureTable(props) {
|
|
|
1750
1597
|
return React.createElement(Table_1.default.Row, {
|
|
1751
1598
|
key: row.key
|
|
1752
1599
|
}, row.cells.map(function (cell) {
|
|
1753
|
-
var _a, _b, _c;
|
|
1754
|
-
|
|
1755
1600
|
return React.createElement(cells_1.SwitchTableCell, {
|
|
1756
1601
|
key: cell.key,
|
|
1757
1602
|
type: cell.cellType
|
|
1758
1603
|
}, React.createElement(cells_1.TextCell, {
|
|
1759
1604
|
cell: cell,
|
|
1760
|
-
useMouseOverEffect: !!onCellClick
|
|
1761
|
-
width: ((_a = columns[cell.header]) === null || _a === void 0 ? void 0 : _a.width) || 'auto'
|
|
1605
|
+
useMouseOverEffect: !!onCellClick
|
|
1762
1606
|
}), React.createElement(cells_1.SparklineCell, {
|
|
1763
1607
|
cell: cell,
|
|
1764
|
-
useMouseOverEffect: !!onCellClick
|
|
1765
|
-
width: ((_b = columns[cell.header]) === null || _b === void 0 ? void 0 : _b.width) || 'auto'
|
|
1608
|
+
useMouseOverEffect: !!onCellClick
|
|
1766
1609
|
}), React.createElement(cells_1.ArrayCell, {
|
|
1767
1610
|
cell: cell,
|
|
1768
|
-
useMouseOverEffect: !!onCellClick
|
|
1769
|
-
width: ((_c = columns[cell.header]) === null || _c === void 0 ? void 0 : _c.width) || 'auto'
|
|
1611
|
+
useMouseOverEffect: !!onCellClick
|
|
1770
1612
|
}));
|
|
1771
1613
|
}));
|
|
1772
1614
|
})))), isPaging ? React.createElement(PaginatorContainer, null, React.createElement(Paginator_1.default, Object.assign({}, paginatorProps))) : null);
|
|
@@ -1808,8 +1650,7 @@ PureTable.propTypes = {
|
|
|
1808
1650
|
sparklineTypes: T.arrayOf(T.arrayOf(T.oneOf(consts_1.validSparklineTypes)))
|
|
1809
1651
|
}),
|
|
1810
1652
|
theme: T.any,
|
|
1811
|
-
width: T.oneOfType([T.number])
|
|
1812
|
-
onColumnFormatChange: T.func
|
|
1653
|
+
width: T.oneOfType([T.number])
|
|
1813
1654
|
};
|
|
1814
1655
|
PureTable.defaultProps = {
|
|
1815
1656
|
columnFormat: {},
|
|
@@ -1829,25 +1670,17 @@ PureTable.defaultProps = {
|
|
|
1829
1670
|
table: [],
|
|
1830
1671
|
tableFormat: {},
|
|
1831
1672
|
theme: {},
|
|
1832
|
-
width: 300
|
|
1833
|
-
onColumnFormatChange: lodash_1.noop
|
|
1673
|
+
width: 300
|
|
1834
1674
|
};
|
|
1835
1675
|
PureTable.displayName = 'VizTable';
|
|
1836
1676
|
exports.default = withEmptyTableMessage(FixedSizeContainer_1.default(PureTable));
|
|
1837
1677
|
|
|
1838
1678
|
/***/ }),
|
|
1839
1679
|
|
|
1840
|
-
/***/ 258:
|
|
1841
|
-
/***/ (function(module, exports) {
|
|
1842
|
-
|
|
1843
|
-
module.exports = require("@splunk/react-ui/Paginator");
|
|
1844
|
-
|
|
1845
|
-
/***/ }),
|
|
1846
|
-
|
|
1847
1680
|
/***/ 259:
|
|
1848
1681
|
/***/ (function(module, exports) {
|
|
1849
1682
|
|
|
1850
|
-
module.exports = require("@splunk/react-ui/
|
|
1683
|
+
module.exports = require("@splunk/react-ui/Paginator");
|
|
1851
1684
|
|
|
1852
1685
|
/***/ }),
|
|
1853
1686
|
|
|
@@ -1860,27 +1693,94 @@ module.exports = require("@splunk/react-ui/Message");
|
|
|
1860
1693
|
Object.defineProperty(exports, "__esModule", {
|
|
1861
1694
|
value: true
|
|
1862
1695
|
});
|
|
1863
|
-
exports.
|
|
1864
|
-
var VizCategory;
|
|
1696
|
+
exports.shouldShowIconPlaceholder = void 0;
|
|
1865
1697
|
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1698
|
+
var React = __webpack_require__(1);
|
|
1699
|
+
|
|
1700
|
+
var T = __webpack_require__(0);
|
|
1701
|
+
|
|
1702
|
+
var lodash_1 = __webpack_require__(2);
|
|
1703
|
+
|
|
1704
|
+
var i18n_1 = __webpack_require__(3);
|
|
1705
|
+
|
|
1706
|
+
var Message_1 = __webpack_require__(9);
|
|
1707
|
+
|
|
1708
|
+
var FixedSizeContainer_1 = __webpack_require__(12);
|
|
1709
|
+
/**
|
|
1710
|
+
* @method shouldShowIconPlaceholder
|
|
1711
|
+
* @param {object} dataSources
|
|
1712
|
+
* @param {boolean} loading
|
|
1713
|
+
* @returns {boolean}
|
|
1714
|
+
*/
|
|
1715
|
+
|
|
1716
|
+
|
|
1717
|
+
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
1718
|
+
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1719
|
+
var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
|
|
1720
|
+
var noData = data === undefined;
|
|
1721
|
+
var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
|
|
1722
|
+
var noFields = fields === undefined;
|
|
1723
|
+
return loading || noData || noFields;
|
|
1724
|
+
};
|
|
1725
|
+
|
|
1726
|
+
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
1727
|
+
var propTypes = {
|
|
1728
|
+
icon: T.func,
|
|
1729
|
+
width: T.oneOfType([T.string, T.number]),
|
|
1730
|
+
height: T.oneOfType([T.string, T.number]),
|
|
1731
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
1732
|
+
backgroundColor: T.string
|
|
1733
|
+
};
|
|
1734
|
+
/**
|
|
1735
|
+
* @method IconPlaceholder
|
|
1736
|
+
* @param {IconPlaceholderProps} props
|
|
1737
|
+
* @returns {React.ReactElement}
|
|
1738
|
+
*/
|
|
1739
|
+
|
|
1740
|
+
var IconPlaceholder = function IconPlaceholder(props) {
|
|
1741
|
+
var width = props.width,
|
|
1742
|
+
height = props.height,
|
|
1743
|
+
icon = props.icon;
|
|
1744
|
+
|
|
1745
|
+
if (icon) {
|
|
1746
|
+
return React.createElement(icon, {
|
|
1747
|
+
style: {
|
|
1748
|
+
left: '50%',
|
|
1749
|
+
top: '50%',
|
|
1750
|
+
color: 'grey',
|
|
1751
|
+
position: 'absolute',
|
|
1752
|
+
transform: 'translate(-50%, -50%)'
|
|
1753
|
+
},
|
|
1754
|
+
width: '50%',
|
|
1755
|
+
height: '50%'
|
|
1756
|
+
});
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
return React.createElement(Message_1.default, {
|
|
1760
|
+
width: width,
|
|
1761
|
+
height: height,
|
|
1762
|
+
level: "warning",
|
|
1763
|
+
message: i18n_1._('No DataSource Connected')
|
|
1764
|
+
});
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1767
|
+
IconPlaceholder.propTypes = propTypes;
|
|
1768
|
+
IconPlaceholder.defaultProps = {
|
|
1769
|
+
width: '100%',
|
|
1770
|
+
height: 250
|
|
1771
|
+
};
|
|
1772
|
+
exports.default = FixedSizeContainer_1.default(IconPlaceholder);
|
|
1880
1773
|
|
|
1881
1774
|
/***/ }),
|
|
1882
1775
|
|
|
1883
1776
|
/***/ 260:
|
|
1777
|
+
/***/ (function(module, exports) {
|
|
1778
|
+
|
|
1779
|
+
module.exports = require("@splunk/react-ui/Message");
|
|
1780
|
+
|
|
1781
|
+
/***/ }),
|
|
1782
|
+
|
|
1783
|
+
/***/ 261:
|
|
1884
1784
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1885
1785
|
|
|
1886
1786
|
"use strict";
|
|
@@ -1899,6 +1799,8 @@ var lodash_1 = __webpack_require__(2);
|
|
|
1899
1799
|
|
|
1900
1800
|
var colorUtils_1 = __webpack_require__(11);
|
|
1901
1801
|
|
|
1802
|
+
var style_1 = __webpack_require__(13);
|
|
1803
|
+
|
|
1902
1804
|
var consts_1 = __webpack_require__(105);
|
|
1903
1805
|
|
|
1904
1806
|
var isArray = function isArray(v) {
|
|
@@ -1906,7 +1808,8 @@ var isArray = function isArray(v) {
|
|
|
1906
1808
|
};
|
|
1907
1809
|
|
|
1908
1810
|
var getOverflowStyles = function getOverflowStyles(_ref) {
|
|
1909
|
-
var textOverflow = _ref.textOverflow
|
|
1811
|
+
var textOverflow = _ref.textOverflow,
|
|
1812
|
+
variables = _ref.variables;
|
|
1910
1813
|
var styles = {
|
|
1911
1814
|
anywhere: {
|
|
1912
1815
|
wordBreak: 'break-all'
|
|
@@ -1917,6 +1820,7 @@ var getOverflowStyles = function getOverflowStyles(_ref) {
|
|
|
1917
1820
|
overflowWrap: 'break-word'
|
|
1918
1821
|
},
|
|
1919
1822
|
ellipsis: {
|
|
1823
|
+
maxWidth: style_1.toPx(variables && variables.width || 100),
|
|
1920
1824
|
whiteSpace: 'nowrap',
|
|
1921
1825
|
overflow: 'hidden',
|
|
1922
1826
|
textOverflow: 'ellipsis'
|
|
@@ -1950,8 +1854,12 @@ var generateHeader = function generateHeader(value, i, columnFormat) {
|
|
|
1950
1854
|
if (lodash_1.isNumber(columnWidth)) {
|
|
1951
1855
|
var textOverflowType = exports.getTextOverflowType({}, value, 'ellipsis');
|
|
1952
1856
|
var textOverflowStyle = exports.getOverflowStyles({
|
|
1953
|
-
textOverflow: textOverflowType
|
|
1857
|
+
textOverflow: textOverflowType,
|
|
1858
|
+
variables: {
|
|
1859
|
+
width: columnWidth
|
|
1860
|
+
}
|
|
1954
1861
|
});
|
|
1862
|
+
ret.width = columnWidth;
|
|
1955
1863
|
ret.truncate = true;
|
|
1956
1864
|
ret.style = textOverflowStyle;
|
|
1957
1865
|
}
|
|
@@ -2233,8 +2141,6 @@ var useTable = function useTable() {
|
|
|
2233
2141
|
cells: []
|
|
2234
2142
|
};
|
|
2235
2143
|
table.forEach(function (column, i) {
|
|
2236
|
-
var _a;
|
|
2237
|
-
|
|
2238
2144
|
var currentHeader = tableHeader.cells[i];
|
|
2239
2145
|
var value = validValueSelector(getColumnFormatData(columnFormat, currentHeader, currentRow), getTableFormatData(tableFormat, i, currentRow), column[currentRow], '');
|
|
2240
2146
|
var rawValue = column[currentRow];
|
|
@@ -2248,12 +2154,17 @@ var useTable = function useTable() {
|
|
|
2248
2154
|
var key = generateKey(value, "".concat(currentRow, "-").concat(i));
|
|
2249
2155
|
var additionalStyles = {};
|
|
2250
2156
|
|
|
2251
|
-
if (lodash_1.isNumber(
|
|
2157
|
+
if (lodash_1.isNumber(currentHeader.width)) {
|
|
2252
2158
|
var textOverflowType = exports.getTextOverflowType(columnFormat, currentHeader.value, 'ellipsis');
|
|
2253
2159
|
var textOverflowStyle = exports.getOverflowStyles({
|
|
2254
|
-
textOverflow: textOverflowType
|
|
2160
|
+
textOverflow: textOverflowType,
|
|
2161
|
+
variables: {
|
|
2162
|
+
width: currentHeader.width
|
|
2163
|
+
}
|
|
2164
|
+
});
|
|
2165
|
+
additionalStyles = Object.assign(Object.assign(Object.assign({}, additionalStyles), textOverflowStyle), {
|
|
2166
|
+
width: style_1.toPx(currentHeader.width)
|
|
2255
2167
|
});
|
|
2256
|
-
additionalStyles = Object.assign(Object.assign({}, additionalStyles), textOverflowStyle);
|
|
2257
2168
|
}
|
|
2258
2169
|
|
|
2259
2170
|
row.cells.push({
|
|
@@ -2267,7 +2178,6 @@ var useTable = function useTable() {
|
|
|
2267
2178
|
sparklineColor: sparklineColor,
|
|
2268
2179
|
sparklineAreaColor: sparklineAreaColor,
|
|
2269
2180
|
sparklineType: sparklineType,
|
|
2270
|
-
header: currentHeader.value,
|
|
2271
2181
|
style: Object.assign({
|
|
2272
2182
|
backgroundColor: rowBackgroundColor,
|
|
2273
2183
|
color: rowColor
|
|
@@ -2291,7 +2201,7 @@ exports.useTable = useTable;
|
|
|
2291
2201
|
|
|
2292
2202
|
/***/ }),
|
|
2293
2203
|
|
|
2294
|
-
/***/
|
|
2204
|
+
/***/ 262:
|
|
2295
2205
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2296
2206
|
|
|
2297
2207
|
"use strict";
|
|
@@ -2320,17 +2230,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
2320
2230
|
value: true
|
|
2321
2231
|
});
|
|
2322
2232
|
|
|
2323
|
-
__exportStar(__webpack_require__(262), exports);
|
|
2324
|
-
|
|
2325
2233
|
__exportStar(__webpack_require__(263), exports);
|
|
2326
2234
|
|
|
2327
2235
|
__exportStar(__webpack_require__(264), exports);
|
|
2328
2236
|
|
|
2329
2237
|
__exportStar(__webpack_require__(265), exports);
|
|
2330
2238
|
|
|
2239
|
+
__exportStar(__webpack_require__(266), exports);
|
|
2240
|
+
|
|
2331
2241
|
/***/ }),
|
|
2332
2242
|
|
|
2333
|
-
/***/
|
|
2243
|
+
/***/ 263:
|
|
2334
2244
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2335
2245
|
|
|
2336
2246
|
"use strict";
|
|
@@ -2353,7 +2263,7 @@ exports.SwitchTableCell = SwitchTableCell;
|
|
|
2353
2263
|
|
|
2354
2264
|
/***/ }),
|
|
2355
2265
|
|
|
2356
|
-
/***/
|
|
2266
|
+
/***/ 264:
|
|
2357
2267
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2358
2268
|
|
|
2359
2269
|
"use strict";
|
|
@@ -2370,12 +2280,9 @@ var Table_1 = __webpack_require__(82);
|
|
|
2370
2280
|
|
|
2371
2281
|
var TextCell = function TextCell(_ref) {
|
|
2372
2282
|
var cell = _ref.cell,
|
|
2373
|
-
useMouseOverEffect = _ref.useMouseOverEffect
|
|
2374
|
-
width = _ref.width;
|
|
2283
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
2375
2284
|
return React.createElement(Table_1.default.Cell, {
|
|
2376
|
-
style:
|
|
2377
|
-
width: width
|
|
2378
|
-
}),
|
|
2285
|
+
style: cell.style,
|
|
2379
2286
|
align: cell.align,
|
|
2380
2287
|
"data-test-cell-type": "TextCell",
|
|
2381
2288
|
"data-row-index": cell.rowIndex,
|
|
@@ -2389,7 +2296,7 @@ exports.TextCell.displayName = 'TextCell';
|
|
|
2389
2296
|
|
|
2390
2297
|
/***/ }),
|
|
2391
2298
|
|
|
2392
|
-
/***/
|
|
2299
|
+
/***/ 265:
|
|
2393
2300
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2394
2301
|
|
|
2395
2302
|
"use strict";
|
|
@@ -2406,13 +2313,10 @@ var Table_1 = __webpack_require__(82);
|
|
|
2406
2313
|
|
|
2407
2314
|
var ArrayCell = function ArrayCell(_ref) {
|
|
2408
2315
|
var cell = _ref.cell,
|
|
2409
|
-
useMouseOverEffect = _ref.useMouseOverEffect
|
|
2410
|
-
width = _ref.width;
|
|
2316
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
2411
2317
|
var value = Array.isArray(cell.value) ? cell.value : [cell.value];
|
|
2412
2318
|
return React.createElement(Table_1.default.Cell, {
|
|
2413
|
-
style:
|
|
2414
|
-
width: width
|
|
2415
|
-
}),
|
|
2319
|
+
style: cell.style,
|
|
2416
2320
|
align: cell.align,
|
|
2417
2321
|
"data-test-cell-type": "ArrayCell",
|
|
2418
2322
|
onClick: useMouseOverEffect ? function () {} : undefined
|
|
@@ -2431,13 +2335,13 @@ exports.ArrayCell.displayName = 'ArrayCell';
|
|
|
2431
2335
|
|
|
2432
2336
|
/***/ }),
|
|
2433
2337
|
|
|
2434
|
-
/***/
|
|
2338
|
+
/***/ 266:
|
|
2435
2339
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2436
2340
|
|
|
2437
2341
|
"use strict";
|
|
2438
2342
|
|
|
2439
2343
|
|
|
2440
|
-
var _slicedToArray = __webpack_require__(
|
|
2344
|
+
var _slicedToArray = __webpack_require__(49);
|
|
2441
2345
|
|
|
2442
2346
|
Object.defineProperty(exports, "__esModule", {
|
|
2443
2347
|
value: true
|
|
@@ -2466,8 +2370,7 @@ exports.validSparklineTypes = ['line', 'area'];
|
|
|
2466
2370
|
|
|
2467
2371
|
var SparklineCell = function SparklineCell(_ref) {
|
|
2468
2372
|
var cell = _ref.cell,
|
|
2469
|
-
useMouseOverEffect = _ref.useMouseOverEffect
|
|
2470
|
-
width = _ref.width;
|
|
2373
|
+
useMouseOverEffect = _ref.useMouseOverEffect;
|
|
2471
2374
|
|
|
2472
2375
|
var _React$useState = React.useState(React.createRef()),
|
|
2473
2376
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -2489,7 +2392,7 @@ var SparklineCell = function SparklineCell(_ref) {
|
|
|
2489
2392
|
style: Object.assign(Object.assign({}, cell.style), {
|
|
2490
2393
|
padding: 0,
|
|
2491
2394
|
margin: 0,
|
|
2492
|
-
width:
|
|
2395
|
+
width: "".concat(cellRef.offsetWidth, "px"),
|
|
2493
2396
|
height: "".concat(height, "px")
|
|
2494
2397
|
}),
|
|
2495
2398
|
align: cell.align,
|
|
@@ -2524,7 +2427,7 @@ exports.SparklineCell.displayName = 'SparklineCell';
|
|
|
2524
2427
|
|
|
2525
2428
|
/***/ }),
|
|
2526
2429
|
|
|
2527
|
-
/***/
|
|
2430
|
+
/***/ 267:
|
|
2528
2431
|
/***/ (function(module, exports) {
|
|
2529
2432
|
|
|
2530
2433
|
module.exports = require("lodash/debounce");
|
|
@@ -2537,6 +2440,35 @@ module.exports = require("lodash/debounce");
|
|
|
2537
2440
|
"use strict";
|
|
2538
2441
|
|
|
2539
2442
|
|
|
2443
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2444
|
+
value: true
|
|
2445
|
+
});
|
|
2446
|
+
exports.VizCategory = void 0;
|
|
2447
|
+
var VizCategory;
|
|
2448
|
+
|
|
2449
|
+
(function (VizCategory) {
|
|
2450
|
+
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
2451
|
+
VizCategory["TRENDS"] = "Trends";
|
|
2452
|
+
VizCategory["COMPARISONS"] = "Comparisons";
|
|
2453
|
+
VizCategory["TABLE"] = "Table";
|
|
2454
|
+
VizCategory["GAUGE"] = "Gauge";
|
|
2455
|
+
VizCategory["DISTRIBUTIONS"] = "Distributions";
|
|
2456
|
+
VizCategory["CHOROPLETH"] = "Choropleth Maps";
|
|
2457
|
+
VizCategory["SHAPES"] = "Shapes";
|
|
2458
|
+
VizCategory["MISC"] = "misc";
|
|
2459
|
+
VizCategory["FLOW"] = "Flow";
|
|
2460
|
+
VizCategory["CORRELATION"] = "Correlation";
|
|
2461
|
+
VizCategory["SPATIAL"] = "Spatial";
|
|
2462
|
+
})(VizCategory = exports.VizCategory || (exports.VizCategory = {}));
|
|
2463
|
+
|
|
2464
|
+
/***/ }),
|
|
2465
|
+
|
|
2466
|
+
/***/ 28:
|
|
2467
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2468
|
+
|
|
2469
|
+
"use strict";
|
|
2470
|
+
|
|
2471
|
+
|
|
2540
2472
|
Object.defineProperty(exports, "__esModule", {
|
|
2541
2473
|
value: true
|
|
2542
2474
|
});
|
|
@@ -2545,15 +2477,15 @@ var React = __webpack_require__(1);
|
|
|
2545
2477
|
|
|
2546
2478
|
var lodash_1 = __webpack_require__(2);
|
|
2547
2479
|
|
|
2548
|
-
var getSettingsFromThemedProps_1 = __webpack_require__(
|
|
2480
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(29);
|
|
2549
2481
|
|
|
2550
|
-
var Options_1 = __webpack_require__(
|
|
2482
|
+
var Options_1 = __webpack_require__(30);
|
|
2551
2483
|
|
|
2552
|
-
var SanitizeProps_1 = __webpack_require__(
|
|
2484
|
+
var SanitizeProps_1 = __webpack_require__(31);
|
|
2553
2485
|
|
|
2554
2486
|
var styled_components_1 = __webpack_require__(4);
|
|
2555
2487
|
|
|
2556
|
-
var SplunkVisualization_1 = __webpack_require__(
|
|
2488
|
+
var SplunkVisualization_1 = __webpack_require__(32);
|
|
2557
2489
|
|
|
2558
2490
|
var VizBehavior_1 = __webpack_require__(5);
|
|
2559
2491
|
|
|
@@ -2561,9 +2493,9 @@ var getSorting_1 = __webpack_require__(23);
|
|
|
2561
2493
|
|
|
2562
2494
|
var getPagination_1 = __webpack_require__(24);
|
|
2563
2495
|
|
|
2564
|
-
var useDeepMemo_1 = __webpack_require__(
|
|
2496
|
+
var useDeepMemo_1 = __webpack_require__(35);
|
|
2565
2497
|
|
|
2566
|
-
var JSONSchemaUtils_1 = __webpack_require__(
|
|
2498
|
+
var JSONSchemaUtils_1 = __webpack_require__(25);
|
|
2567
2499
|
|
|
2568
2500
|
var MissingPropsMessage_1 = __webpack_require__(36);
|
|
2569
2501
|
|
|
@@ -2625,7 +2557,7 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
2625
2557
|
try {
|
|
2626
2558
|
return Options_1.Options.evaluate({
|
|
2627
2559
|
context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
|
|
2628
|
-
options: hocUtils_1.
|
|
2560
|
+
options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
|
|
2629
2561
|
}, dataSources, themeFunc);
|
|
2630
2562
|
} catch (e) {
|
|
2631
2563
|
// eslint-disable-next-line no-console
|
|
@@ -2756,35 +2688,35 @@ exports.default = withDashboardViz;
|
|
|
2756
2688
|
|
|
2757
2689
|
/***/ }),
|
|
2758
2690
|
|
|
2759
|
-
/***/
|
|
2691
|
+
/***/ 29:
|
|
2760
2692
|
/***/ (function(module, exports) {
|
|
2761
2693
|
|
|
2762
2694
|
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
2763
2695
|
|
|
2764
2696
|
/***/ }),
|
|
2765
2697
|
|
|
2766
|
-
/***/
|
|
2698
|
+
/***/ 3:
|
|
2767
2699
|
/***/ (function(module, exports) {
|
|
2768
2700
|
|
|
2769
|
-
module.exports = require("@splunk/
|
|
2701
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
2770
2702
|
|
|
2771
2703
|
/***/ }),
|
|
2772
2704
|
|
|
2773
|
-
/***/
|
|
2705
|
+
/***/ 30:
|
|
2774
2706
|
/***/ (function(module, exports) {
|
|
2775
2707
|
|
|
2776
|
-
module.exports = require("@splunk/
|
|
2708
|
+
module.exports = require("@splunk/visualization-encoding/Options");
|
|
2777
2709
|
|
|
2778
2710
|
/***/ }),
|
|
2779
2711
|
|
|
2780
|
-
/***/
|
|
2712
|
+
/***/ 31:
|
|
2781
2713
|
/***/ (function(module, exports) {
|
|
2782
2714
|
|
|
2783
2715
|
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
2784
2716
|
|
|
2785
2717
|
/***/ }),
|
|
2786
2718
|
|
|
2787
|
-
/***/
|
|
2719
|
+
/***/ 32:
|
|
2788
2720
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2789
2721
|
|
|
2790
2722
|
"use strict";
|
|
@@ -2802,7 +2734,7 @@ var T = __webpack_require__(0);
|
|
|
2802
2734
|
|
|
2803
2735
|
var lodash_1 = __webpack_require__(2);
|
|
2804
2736
|
|
|
2805
|
-
var VizActionHandler_1 = __webpack_require__(
|
|
2737
|
+
var VizActionHandler_1 = __webpack_require__(33); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
2806
2738
|
|
|
2807
2739
|
|
|
2808
2740
|
exports.INITIAL_WIDTH = 250;
|
|
@@ -2936,7 +2868,7 @@ exports.default = SplunkVisualization;
|
|
|
2936
2868
|
|
|
2937
2869
|
/***/ }),
|
|
2938
2870
|
|
|
2939
|
-
/***/
|
|
2871
|
+
/***/ 33:
|
|
2940
2872
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2941
2873
|
|
|
2942
2874
|
"use strict";
|
|
@@ -2974,7 +2906,7 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
|
2974
2906
|
|
|
2975
2907
|
/***/ }),
|
|
2976
2908
|
|
|
2977
|
-
/***/
|
|
2909
|
+
/***/ 34:
|
|
2978
2910
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2979
2911
|
|
|
2980
2912
|
"use strict";
|
|
@@ -2988,7 +2920,7 @@ exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
|
2988
2920
|
|
|
2989
2921
|
/***/ }),
|
|
2990
2922
|
|
|
2991
|
-
/***/
|
|
2923
|
+
/***/ 35:
|
|
2992
2924
|
/***/ (function(module, exports, __webpack_require__) {
|
|
2993
2925
|
|
|
2994
2926
|
"use strict";
|
|
@@ -3034,40 +2966,6 @@ exports.useDeepMemo = useDeepMemo;
|
|
|
3034
2966
|
|
|
3035
2967
|
/***/ }),
|
|
3036
2968
|
|
|
3037
|
-
/***/ 35:
|
|
3038
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3039
|
-
|
|
3040
|
-
"use strict";
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3044
|
-
value: true
|
|
3045
|
-
});
|
|
3046
|
-
exports.pickFieldFromJSONSchema = void 0;
|
|
3047
|
-
|
|
3048
|
-
var lodash_1 = __webpack_require__(2);
|
|
3049
|
-
|
|
3050
|
-
var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
|
|
3051
|
-
var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
|
|
3052
|
-
return Object.keys(optionsSchema).reduce(function (accum, k) {
|
|
3053
|
-
if (lodash_1.has(optionsSchema[k], fieldName)) {
|
|
3054
|
-
accum[k] = optionsSchema[k][fieldName];
|
|
3055
|
-
} else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
|
|
3056
|
-
var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
|
|
3057
|
-
|
|
3058
|
-
if (!lodash_1.isEmpty(nestedSchema)) {
|
|
3059
|
-
accum[k] = nestedSchema;
|
|
3060
|
-
}
|
|
3061
|
-
}
|
|
3062
|
-
|
|
3063
|
-
return accum;
|
|
3064
|
-
}, {});
|
|
3065
|
-
};
|
|
3066
|
-
|
|
3067
|
-
exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
|
|
3068
|
-
|
|
3069
|
-
/***/ }),
|
|
3070
|
-
|
|
3071
2969
|
/***/ 36:
|
|
3072
2970
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3073
2971
|
|
|
@@ -3170,7 +3068,7 @@ var Cover = styled_components_1.default.div.withConfig({
|
|
|
3170
3068
|
componentId: "sc-1gsbnxb-0"
|
|
3171
3069
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3172
3070
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3173
|
-
'data-splunk-visualization-version': "24.3.
|
|
3071
|
+
'data-splunk-visualization-version': "24.3.3 - 8d441d88c"
|
|
3174
3072
|
}).withConfig({
|
|
3175
3073
|
displayName: "withEditModeCover__Blocker",
|
|
3176
3074
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3216,7 +3114,7 @@ var React = __webpack_require__(1);
|
|
|
3216
3114
|
|
|
3217
3115
|
var colorUtils_1 = __webpack_require__(11);
|
|
3218
3116
|
|
|
3219
|
-
var IconPlaceholder_1 = __webpack_require__(
|
|
3117
|
+
var IconPlaceholder_1 = __webpack_require__(26);
|
|
3220
3118
|
|
|
3221
3119
|
var VizBehavior_1 = __webpack_require__(5);
|
|
3222
3120
|
|
|
@@ -3290,7 +3188,7 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
3290
3188
|
|
|
3291
3189
|
/***/ }),
|
|
3292
3190
|
|
|
3293
|
-
/***/
|
|
3191
|
+
/***/ 49:
|
|
3294
3192
|
/***/ (function(module, exports) {
|
|
3295
3193
|
|
|
3296
3194
|
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
@@ -3538,7 +3436,7 @@ var _typeof = __webpack_require__(20);
|
|
|
3538
3436
|
Object.defineProperty(exports, "__esModule", {
|
|
3539
3437
|
value: true
|
|
3540
3438
|
});
|
|
3541
|
-
exports.
|
|
3439
|
+
exports.findClosestMatchFromDefaultList = exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
|
|
3542
3440
|
|
|
3543
3441
|
var lodash_1 = __webpack_require__(2);
|
|
3544
3442
|
/**
|
|
@@ -3564,17 +3462,19 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
3564
3462
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
3565
3463
|
/**
|
|
3566
3464
|
* helper to deeply merge objects while preserving arrays in earlier source objects
|
|
3567
|
-
* deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays will be preserved if already present in the resultant merged object
|
|
3568
|
-
* this prevents default arrays from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one)
|
|
3465
|
+
* deeply nested primitive keys are merged similarly to lodash's defaultsDeep, while keys with arrays of primitives will be preserved if already present in the resultant merged object
|
|
3466
|
+
* this prevents default arrays of primitives from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one).
|
|
3467
|
+
* Array of objects gets merged with the defaults, where the defaults can be an array of objects. Closest matching default object from the defaults list based on key - value pair
|
|
3468
|
+
* will be used for merging defaults for each object in the array. If no closest match found, first object in default array list used for merging.
|
|
3569
3469
|
*
|
|
3570
|
-
* @method
|
|
3470
|
+
* @method deepMergeWithArrayPrimitiveOverrides
|
|
3571
3471
|
* @param {Object} initial - target object to merge values into
|
|
3572
3472
|
* @param {Object[]} sources - other default options to be merged into the resultant object if no explicit value is provided, with earlier args taking precedence over later ones
|
|
3573
3473
|
*
|
|
3574
3474
|
* @returns {Object}
|
|
3575
3475
|
*/
|
|
3576
3476
|
|
|
3577
|
-
var
|
|
3477
|
+
var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
|
|
3578
3478
|
var clone = lodash_1.cloneDeep(initial);
|
|
3579
3479
|
|
|
3580
3480
|
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -3585,18 +3485,72 @@ var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial)
|
|
|
3585
3485
|
Object.keys(sourceToApply).forEach(function (sourceKey) {
|
|
3586
3486
|
if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
|
|
3587
3487
|
clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
|
|
3588
|
-
}
|
|
3589
|
-
|
|
3488
|
+
}
|
|
3590
3489
|
|
|
3591
3490
|
if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
|
|
3592
|
-
clone[sourceKey] = exports.
|
|
3491
|
+
clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
|
|
3492
|
+
} else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
|
|
3493
|
+
// If option is an array of objects
|
|
3494
|
+
for (var i = 0; i < clone[sourceKey].length; i += 1) {
|
|
3495
|
+
if (_typeof(clone[sourceKey][i]) === 'object') {
|
|
3496
|
+
var closestMatchIdx = exports.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
|
|
3497
|
+
|
|
3498
|
+
if (closestMatchIdx > -1) {
|
|
3499
|
+
clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
|
|
3500
|
+
}
|
|
3501
|
+
}
|
|
3502
|
+
}
|
|
3593
3503
|
}
|
|
3594
3504
|
});
|
|
3595
3505
|
});
|
|
3596
3506
|
return clone;
|
|
3597
3507
|
};
|
|
3598
3508
|
|
|
3599
|
-
exports.
|
|
3509
|
+
exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
|
|
3510
|
+
/**
|
|
3511
|
+
* Finds the closest matching object from the list, which has the max same key value pairs.
|
|
3512
|
+
* Returns the index of match if found, or -1
|
|
3513
|
+
* For eg :-
|
|
3514
|
+
const list = [{
|
|
3515
|
+
type: "marker",
|
|
3516
|
+
lat: "value1"
|
|
3517
|
+
}, {
|
|
3518
|
+
type: "bubble",
|
|
3519
|
+
size: "value2"
|
|
3520
|
+
}];
|
|
3521
|
+
|
|
3522
|
+
const obj = {
|
|
3523
|
+
type: 'bubble'
|
|
3524
|
+
};
|
|
3525
|
+
|
|
3526
|
+
findClosestMatch(list, obj) -> returns index 1.
|
|
3527
|
+
*/
|
|
3528
|
+
|
|
3529
|
+
var findClosestMatchFromDefaultList = function findClosestMatchFromDefaultList(searchList, inputObj) {
|
|
3530
|
+
if (!Array.isArray(searchList) || searchList.length === 0) {
|
|
3531
|
+
return -1;
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
var keys = Object.keys(inputObj);
|
|
3535
|
+
var maxMatchCnt = 0;
|
|
3536
|
+
var maxMatchIdx = 0;
|
|
3537
|
+
searchList.forEach(function (item, idx) {
|
|
3538
|
+
var matchCnt = 0;
|
|
3539
|
+
keys.forEach(function (key) {
|
|
3540
|
+
if (item[key] === inputObj[key]) {
|
|
3541
|
+
matchCnt += 1;
|
|
3542
|
+
}
|
|
3543
|
+
});
|
|
3544
|
+
|
|
3545
|
+
if (Math.max(maxMatchCnt, matchCnt) > maxMatchCnt) {
|
|
3546
|
+
maxMatchCnt = matchCnt;
|
|
3547
|
+
maxMatchIdx = idx;
|
|
3548
|
+
}
|
|
3549
|
+
});
|
|
3550
|
+
return maxMatchIdx;
|
|
3551
|
+
};
|
|
3552
|
+
|
|
3553
|
+
exports.findClosestMatchFromDefaultList = findClosestMatchFromDefaultList;
|
|
3600
3554
|
|
|
3601
3555
|
/***/ }),
|
|
3602
3556
|
|