@splunk/visualizations 24.3.2 → 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.
Files changed (64) hide show
  1. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_Tooltip_Dark.png +0 -0
  2. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_basic.png +0 -0
  3. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_bubble_layer_geostats_by.png +0 -0
  4. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_off.png +0 -0
  5. package/.loki/reference/chrome_docker_PureVisualizations_PureMap_scale_unit_metric.png +0 -0
  6. package/.loki/reference/chrome_docker_VisualizationEditors_Editors_Map_Editor.png +0 -0
  7. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Additional_Cases.png +0 -0
  8. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Internal_Fields.png +0 -0
  9. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Bubble_Layer_Geostats_By_Mostly_null.png +0 -0
  10. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Restricted_Zoom.png +0 -0
  11. package/.loki/reference/chrome_docker_Visualizations_Map_Map_Set_Map_tiles.png +0 -0
  12. package/Area.js +121 -65
  13. package/Area.js.map +1 -1
  14. package/Bar.js +121 -65
  15. package/Bar.js.map +1 -1
  16. package/Bubble.js +121 -65
  17. package/Bubble.js.map +1 -1
  18. package/ChoroplethSvg.js +142 -73
  19. package/ChoroplethSvg.js.map +1 -1
  20. package/Column.js +121 -65
  21. package/Column.js.map +1 -1
  22. package/Ellipse.js +121 -65
  23. package/Ellipse.js.map +1 -1
  24. package/FillerGauge.js +121 -65
  25. package/FillerGauge.js.map +1 -1
  26. package/Image.js +125 -69
  27. package/Image.js.map +1 -1
  28. package/Line.js +121 -65
  29. package/Line.js.map +1 -1
  30. package/LinkGraph.js +121 -65
  31. package/LinkGraph.js.map +1 -1
  32. package/Map.config.js +16 -6
  33. package/Map.config.js.map +1 -1
  34. package/Map.js +430 -126
  35. package/Map.js.map +1 -1
  36. package/Markdown.js +131 -75
  37. package/Markdown.js.map +1 -1
  38. package/MarkerGauge.js +135 -79
  39. package/MarkerGauge.js.map +1 -1
  40. package/ParallelCoordinates.js +140 -83
  41. package/ParallelCoordinates.js.map +1 -1
  42. package/Pie.js +133 -77
  43. package/Pie.js.map +1 -1
  44. package/Punchcard.js +144 -87
  45. package/Punchcard.js.map +1 -1
  46. package/Rectangle.js +129 -73
  47. package/Rectangle.js.map +1 -1
  48. package/Sankey.js +204 -148
  49. package/Sankey.js.map +1 -1
  50. package/Scatter.js +131 -75
  51. package/Scatter.js.map +1 -1
  52. package/SingleValue.js +160 -104
  53. package/SingleValue.js.map +1 -1
  54. package/SingleValueIcon.js +135 -78
  55. package/SingleValueIcon.js.map +1 -1
  56. package/SingleValueRadial.js +202 -146
  57. package/SingleValueRadial.js.map +1 -1
  58. package/Table.js +236 -180
  59. package/Table.js.map +1 -1
  60. package/common/utils/hocUtils.js +65 -9
  61. package/common/utils/hocUtils.js.map +1 -1
  62. package/common/withDashboardViz.js +68 -12
  63. package/common/withDashboardViz.js.map +1 -1
  64. package/package.json +9 -9
@@ -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 = 252);
90
+ /******/ return __webpack_require__(__webpack_require__.s = 253);
91
91
  /******/ })
92
92
  /************************************************************************/
93
93
  /******/ ({
@@ -195,7 +195,7 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
195
195
 
196
196
  return React.createElement(FixSizeItem, {
197
197
  "data-test": "fix-size-item",
198
- "data-splunk-visualization-version": "24.3.2 - 1cf892b72",
198
+ "data-splunk-visualization-version": "24.3.3 - 8d441d88c",
199
199
  width: width,
200
200
  height: height,
201
201
  backgroundColor: backgroundColor
@@ -1313,7 +1313,7 @@ var T = __webpack_require__(0);
1313
1313
 
1314
1314
  var lodash_1 = __webpack_require__(2);
1315
1315
 
1316
- var DataSource_1 = __webpack_require__(33);
1316
+ var DataSource_1 = __webpack_require__(34);
1317
1317
 
1318
1318
  exports.SortParamsPropTypes = T.shape({
1319
1319
  currentSortKey: T.string,
@@ -1441,87 +1441,32 @@ exports.getPaginationParams = getPaginationParams;
1441
1441
  Object.defineProperty(exports, "__esModule", {
1442
1442
  value: true
1443
1443
  });
1444
- exports.shouldShowIconPlaceholder = void 0;
1445
-
1446
- var React = __webpack_require__(1);
1447
-
1448
- var T = __webpack_require__(0);
1444
+ exports.pickFieldFromJSONSchema = void 0;
1449
1445
 
1450
1446
  var lodash_1 = __webpack_require__(2);
1451
1447
 
1452
- var i18n_1 = __webpack_require__(3);
1453
-
1454
- var Message_1 = __webpack_require__(9);
1455
-
1456
- var FixedSizeContainer_1 = __webpack_require__(12);
1457
- /**
1458
- * @method shouldShowIconPlaceholder
1459
- * @param {object} dataSources
1460
- * @param {boolean} loading
1461
- * @returns {boolean}
1462
- */
1463
-
1464
-
1465
- var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
1466
- var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1467
- var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
1468
- var noData = data === undefined;
1469
- var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
1470
- var noFields = fields === undefined;
1471
- return loading || noData || noFields;
1472
- };
1473
-
1474
- exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
1475
- var propTypes = {
1476
- icon: T.func,
1477
- width: T.oneOfType([T.string, T.number]),
1478
- height: T.oneOfType([T.string, T.number]),
1479
- // eslint-disable-next-line react/no-unused-prop-types
1480
- backgroundColor: T.string
1481
- };
1482
- /**
1483
- * @method IconPlaceholder
1484
- * @param {IconPlaceholderProps} props
1485
- * @returns {React.ReactElement}
1486
- */
1487
-
1488
- var IconPlaceholder = function IconPlaceholder(props) {
1489
- var width = props.width,
1490
- height = props.height,
1491
- icon = props.icon;
1448
+ var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
1449
+ var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
1450
+ return Object.keys(optionsSchema).reduce(function (accum, k) {
1451
+ if (lodash_1.has(optionsSchema[k], fieldName)) {
1452
+ accum[k] = optionsSchema[k][fieldName];
1453
+ } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
1454
+ var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
1492
1455
 
1493
- if (icon) {
1494
- return React.createElement(icon, {
1495
- style: {
1496
- left: '50%',
1497
- top: '50%',
1498
- color: 'grey',
1499
- position: 'absolute',
1500
- transform: 'translate(-50%, -50%)'
1501
- },
1502
- width: '50%',
1503
- height: '50%'
1504
- });
1505
- }
1456
+ if (!lodash_1.isEmpty(nestedSchema)) {
1457
+ accum[k] = nestedSchema;
1458
+ }
1459
+ }
1506
1460
 
1507
- return React.createElement(Message_1.default, {
1508
- width: width,
1509
- height: height,
1510
- level: "warning",
1511
- message: i18n_1._('No DataSource Connected')
1512
- });
1461
+ return accum;
1462
+ }, {});
1513
1463
  };
1514
1464
 
1515
- IconPlaceholder.propTypes = propTypes;
1516
- IconPlaceholder.defaultProps = {
1517
- width: '100%',
1518
- height: 250
1519
- };
1520
- exports.default = FixedSizeContainer_1.default(IconPlaceholder);
1465
+ exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
1521
1466
 
1522
1467
  /***/ }),
1523
1468
 
1524
- /***/ 252:
1469
+ /***/ 253:
1525
1470
  /***/ (function(module, exports, __webpack_require__) {
1526
1471
 
1527
1472
  "use strict";
@@ -1532,11 +1477,11 @@ Object.defineProperty(exports, "__esModule", {
1532
1477
  });
1533
1478
  exports.PureSingleValueRadialThemes = exports.PureSingleValueRadial = exports.config = void 0;
1534
1479
 
1535
- var SingleValueRadial_1 = __webpack_require__(269);
1480
+ var SingleValueRadial_1 = __webpack_require__(270);
1536
1481
 
1537
- var withDashboardViz_1 = __webpack_require__(27);
1482
+ var withDashboardViz_1 = __webpack_require__(28);
1538
1483
 
1539
- var config_1 = __webpack_require__(253);
1484
+ var config_1 = __webpack_require__(254);
1540
1485
 
1541
1486
  exports.config = config_1.default;
1542
1487
  exports.PureSingleValueRadial = SingleValueRadial_1.default; // TODO: proper theming support for SVR when we come back to SVR viz
@@ -1549,7 +1494,7 @@ exports.default = withDashboardViz_1.default({
1549
1494
 
1550
1495
  /***/ }),
1551
1496
 
1552
- /***/ 253:
1497
+ /***/ 254:
1553
1498
  /***/ (function(module, exports, __webpack_require__) {
1554
1499
 
1555
1500
  "use strict";
@@ -1575,7 +1520,7 @@ var VizBehavior_1 = __webpack_require__(5);
1575
1520
 
1576
1521
  var configUtils_1 = __webpack_require__(6);
1577
1522
 
1578
- var VizCategory_1 = __webpack_require__(26);
1523
+ var VizCategory_1 = __webpack_require__(27);
1579
1524
 
1580
1525
  var DynamicMajorColorEditor_1 = __webpack_require__(76);
1581
1526
 
@@ -1589,7 +1534,7 @@ var StaticTrendColorEditor_1 = __webpack_require__(80);
1589
1534
 
1590
1535
  var StaticBackgroundColorEditor_1 = __webpack_require__(68);
1591
1536
 
1592
- var RadialBackgroundColor_1 = __webpack_require__(254);
1537
+ var RadialBackgroundColor_1 = __webpack_require__(255);
1593
1538
 
1594
1539
  var dataContract = {
1595
1540
  requiredDataSources: [{
@@ -1949,7 +1894,7 @@ exports.default = configUtils_1.enhanceConfig(config);
1949
1894
 
1950
1895
  /***/ }),
1951
1896
 
1952
- /***/ 254:
1897
+ /***/ 255:
1953
1898
  /***/ (function(module, exports, __webpack_require__) {
1954
1899
 
1955
1900
  "use strict";
@@ -1986,6 +1931,95 @@ exports.default = radialBackground;
1986
1931
  "use strict";
1987
1932
 
1988
1933
 
1934
+ Object.defineProperty(exports, "__esModule", {
1935
+ value: true
1936
+ });
1937
+ exports.shouldShowIconPlaceholder = void 0;
1938
+
1939
+ var React = __webpack_require__(1);
1940
+
1941
+ var T = __webpack_require__(0);
1942
+
1943
+ var lodash_1 = __webpack_require__(2);
1944
+
1945
+ var i18n_1 = __webpack_require__(3);
1946
+
1947
+ var Message_1 = __webpack_require__(9);
1948
+
1949
+ var FixedSizeContainer_1 = __webpack_require__(12);
1950
+ /**
1951
+ * @method shouldShowIconPlaceholder
1952
+ * @param {object} dataSources
1953
+ * @param {boolean} loading
1954
+ * @returns {boolean}
1955
+ */
1956
+
1957
+
1958
+ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
1959
+ var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1960
+ var data = lodash_1.get(dataSources, 'primary.data.columns[0]', undefined);
1961
+ var noData = data === undefined;
1962
+ var fields = lodash_1.get(dataSources, 'primary.data.fields[0]', undefined);
1963
+ var noFields = fields === undefined;
1964
+ return loading || noData || noFields;
1965
+ };
1966
+
1967
+ exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
1968
+ var propTypes = {
1969
+ icon: T.func,
1970
+ width: T.oneOfType([T.string, T.number]),
1971
+ height: T.oneOfType([T.string, T.number]),
1972
+ // eslint-disable-next-line react/no-unused-prop-types
1973
+ backgroundColor: T.string
1974
+ };
1975
+ /**
1976
+ * @method IconPlaceholder
1977
+ * @param {IconPlaceholderProps} props
1978
+ * @returns {React.ReactElement}
1979
+ */
1980
+
1981
+ var IconPlaceholder = function IconPlaceholder(props) {
1982
+ var width = props.width,
1983
+ height = props.height,
1984
+ icon = props.icon;
1985
+
1986
+ if (icon) {
1987
+ return React.createElement(icon, {
1988
+ style: {
1989
+ left: '50%',
1990
+ top: '50%',
1991
+ color: 'grey',
1992
+ position: 'absolute',
1993
+ transform: 'translate(-50%, -50%)'
1994
+ },
1995
+ width: '50%',
1996
+ height: '50%'
1997
+ });
1998
+ }
1999
+
2000
+ return React.createElement(Message_1.default, {
2001
+ width: width,
2002
+ height: height,
2003
+ level: "warning",
2004
+ message: i18n_1._('No DataSource Connected')
2005
+ });
2006
+ };
2007
+
2008
+ IconPlaceholder.propTypes = propTypes;
2009
+ IconPlaceholder.defaultProps = {
2010
+ width: '100%',
2011
+ height: 250
2012
+ };
2013
+ exports.default = FixedSizeContainer_1.default(IconPlaceholder);
2014
+
2015
+ /***/ }),
2016
+
2017
+ /***/ 27:
2018
+ /***/ (function(module, exports, __webpack_require__) {
2019
+
2020
+ "use strict";
2021
+
2022
+
1989
2023
  Object.defineProperty(exports, "__esModule", {
1990
2024
  value: true
1991
2025
  });
@@ -2009,7 +2043,7 @@ var VizCategory;
2009
2043
 
2010
2044
  /***/ }),
2011
2045
 
2012
- /***/ 269:
2046
+ /***/ 270:
2013
2047
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2014
2048
 
2015
2049
  "use strict";
@@ -2703,7 +2737,7 @@ SingleValueRadial_SingleValueRadial.defaultProps = {
2703
2737
 
2704
2738
  /***/ }),
2705
2739
 
2706
- /***/ 27:
2740
+ /***/ 28:
2707
2741
  /***/ (function(module, exports, __webpack_require__) {
2708
2742
 
2709
2743
  "use strict";
@@ -2717,15 +2751,15 @@ var React = __webpack_require__(1);
2717
2751
 
2718
2752
  var lodash_1 = __webpack_require__(2);
2719
2753
 
2720
- var getSettingsFromThemedProps_1 = __webpack_require__(28);
2754
+ var getSettingsFromThemedProps_1 = __webpack_require__(29);
2721
2755
 
2722
- var Options_1 = __webpack_require__(29);
2756
+ var Options_1 = __webpack_require__(30);
2723
2757
 
2724
- var SanitizeProps_1 = __webpack_require__(30);
2758
+ var SanitizeProps_1 = __webpack_require__(31);
2725
2759
 
2726
2760
  var styled_components_1 = __webpack_require__(4);
2727
2761
 
2728
- var SplunkVisualization_1 = __webpack_require__(31);
2762
+ var SplunkVisualization_1 = __webpack_require__(32);
2729
2763
 
2730
2764
  var VizBehavior_1 = __webpack_require__(5);
2731
2765
 
@@ -2733,9 +2767,9 @@ var getSorting_1 = __webpack_require__(23);
2733
2767
 
2734
2768
  var getPagination_1 = __webpack_require__(24);
2735
2769
 
2736
- var useDeepMemo_1 = __webpack_require__(34);
2770
+ var useDeepMemo_1 = __webpack_require__(35);
2737
2771
 
2738
- var JSONSchemaUtils_1 = __webpack_require__(35);
2772
+ var JSONSchemaUtils_1 = __webpack_require__(25);
2739
2773
 
2740
2774
  var MissingPropsMessage_1 = __webpack_require__(36);
2741
2775
 
@@ -2797,7 +2831,7 @@ var withDashboardViz = function withDashboardViz(opts) {
2797
2831
  try {
2798
2832
  return Options_1.Options.evaluate({
2799
2833
  context: lodash_1.defaultsDeep({}, context, vizConfig.defaultContext),
2800
- options: hocUtils_1.deepMergeWithArrayOverrides({}, options, defaultOptions)
2834
+ options: hocUtils_1.deepMergeWithArrayPrimitiveOverrides({}, options, defaultOptions)
2801
2835
  }, dataSources, themeFunc);
2802
2836
  } catch (e) {
2803
2837
  // eslint-disable-next-line no-console
@@ -2928,35 +2962,35 @@ exports.default = withDashboardViz;
2928
2962
 
2929
2963
  /***/ }),
2930
2964
 
2931
- /***/ 28:
2965
+ /***/ 29:
2932
2966
  /***/ (function(module, exports) {
2933
2967
 
2934
2968
  module.exports = require("@splunk/themes/getSettingsFromThemedProps");
2935
2969
 
2936
2970
  /***/ }),
2937
2971
 
2938
- /***/ 29:
2972
+ /***/ 3:
2939
2973
  /***/ (function(module, exports) {
2940
2974
 
2941
- module.exports = require("@splunk/visualization-encoding/Options");
2975
+ module.exports = require("@splunk/ui-utils/i18n");
2942
2976
 
2943
2977
  /***/ }),
2944
2978
 
2945
- /***/ 3:
2979
+ /***/ 30:
2946
2980
  /***/ (function(module, exports) {
2947
2981
 
2948
- module.exports = require("@splunk/ui-utils/i18n");
2982
+ module.exports = require("@splunk/visualization-encoding/Options");
2949
2983
 
2950
2984
  /***/ }),
2951
2985
 
2952
- /***/ 30:
2986
+ /***/ 31:
2953
2987
  /***/ (function(module, exports) {
2954
2988
 
2955
2989
  module.exports = require("@splunk/visualizations-shared/SanitizeProps");
2956
2990
 
2957
2991
  /***/ }),
2958
2992
 
2959
- /***/ 31:
2993
+ /***/ 32:
2960
2994
  /***/ (function(module, exports, __webpack_require__) {
2961
2995
 
2962
2996
  "use strict";
@@ -2974,7 +3008,7 @@ var T = __webpack_require__(0);
2974
3008
 
2975
3009
  var lodash_1 = __webpack_require__(2);
2976
3010
 
2977
- var VizActionHandler_1 = __webpack_require__(32); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
3011
+ var VizActionHandler_1 = __webpack_require__(33); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
2978
3012
 
2979
3013
 
2980
3014
  exports.INITIAL_WIDTH = 250;
@@ -3108,7 +3142,7 @@ exports.default = SplunkVisualization;
3108
3142
 
3109
3143
  /***/ }),
3110
3144
 
3111
- /***/ 32:
3145
+ /***/ 33:
3112
3146
  /***/ (function(module, exports, __webpack_require__) {
3113
3147
 
3114
3148
  "use strict";
@@ -3146,7 +3180,7 @@ exports.DefaultVizActionHandler = DefaultVizActionHandler;
3146
3180
 
3147
3181
  /***/ }),
3148
3182
 
3149
- /***/ 33:
3183
+ /***/ 34:
3150
3184
  /***/ (function(module, exports, __webpack_require__) {
3151
3185
 
3152
3186
  "use strict";
@@ -3160,7 +3194,7 @@ exports.validSortDirs = ['asc', 'desc', 'none'];
3160
3194
 
3161
3195
  /***/ }),
3162
3196
 
3163
- /***/ 34:
3197
+ /***/ 35:
3164
3198
  /***/ (function(module, exports, __webpack_require__) {
3165
3199
 
3166
3200
  "use strict";
@@ -3206,40 +3240,6 @@ exports.useDeepMemo = useDeepMemo;
3206
3240
 
3207
3241
  /***/ }),
3208
3242
 
3209
- /***/ 35:
3210
- /***/ (function(module, exports, __webpack_require__) {
3211
-
3212
- "use strict";
3213
-
3214
-
3215
- Object.defineProperty(exports, "__esModule", {
3216
- value: true
3217
- });
3218
- exports.pickFieldFromJSONSchema = void 0;
3219
-
3220
- var lodash_1 = __webpack_require__(2);
3221
-
3222
- var pickFieldFromJSONSchema = function pickFieldFromJSONSchema(optionsSchema) {
3223
- var fieldName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
3224
- return Object.keys(optionsSchema).reduce(function (accum, k) {
3225
- if (lodash_1.has(optionsSchema[k], fieldName)) {
3226
- accum[k] = optionsSchema[k][fieldName];
3227
- } else if (lodash_1.get(optionsSchema, [k, 'type']) === 'object' && lodash_1.has(optionsSchema[k], 'properties')) {
3228
- var nestedSchema = exports.pickFieldFromJSONSchema(optionsSchema[k].properties, fieldName);
3229
-
3230
- if (!lodash_1.isEmpty(nestedSchema)) {
3231
- accum[k] = nestedSchema;
3232
- }
3233
- }
3234
-
3235
- return accum;
3236
- }, {});
3237
- };
3238
-
3239
- exports.pickFieldFromJSONSchema = pickFieldFromJSONSchema;
3240
-
3241
- /***/ }),
3242
-
3243
3243
  /***/ 36:
3244
3244
  /***/ (function(module, exports, __webpack_require__) {
3245
3245
 
@@ -3342,7 +3342,7 @@ var Cover = styled_components_1.default.div.withConfig({
3342
3342
  componentId: "sc-1gsbnxb-0"
3343
3343
  })(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
3344
3344
  var Blocker = styled_components_1.default.div.attrs({
3345
- 'data-splunk-visualization-version': "24.3.2 - 1cf892b72"
3345
+ 'data-splunk-visualization-version': "24.3.3 - 8d441d88c"
3346
3346
  }).withConfig({
3347
3347
  displayName: "withEditModeCover__Blocker",
3348
3348
  componentId: "sc-1gsbnxb-1"
@@ -3388,7 +3388,7 @@ var React = __webpack_require__(1);
3388
3388
 
3389
3389
  var colorUtils_1 = __webpack_require__(11);
3390
3390
 
3391
- var IconPlaceholder_1 = __webpack_require__(25);
3391
+ var IconPlaceholder_1 = __webpack_require__(26);
3392
3392
 
3393
3393
  var VizBehavior_1 = __webpack_require__(5);
3394
3394
 
@@ -4089,7 +4089,7 @@ var _typeof = __webpack_require__(20);
4089
4089
  Object.defineProperty(exports, "__esModule", {
4090
4090
  value: true
4091
4091
  });
4092
- exports.deepMergeWithArrayOverrides = exports.extendStaticWrapperProps = void 0;
4092
+ exports.findClosestMatchFromDefaultList = exports.deepMergeWithArrayPrimitiveOverrides = exports.extendStaticWrapperProps = void 0;
4093
4093
 
4094
4094
  var lodash_1 = __webpack_require__(2);
4095
4095
  /**
@@ -4115,17 +4115,19 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
4115
4115
  exports.extendStaticWrapperProps = extendStaticWrapperProps;
4116
4116
  /**
4117
4117
  * helper to deeply merge objects while preserving arrays in earlier source objects
4118
- * 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
4119
- * this prevents default arrays from appending values to user-defined arrays (this occurs if the default array is longer than the user-defined one)
4118
+ * 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
4119
+ * 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).
4120
+ * 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
4121
+ * 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.
4120
4122
  *
4121
- * @method deepMergeWithArrayOverrides
4123
+ * @method deepMergeWithArrayPrimitiveOverrides
4122
4124
  * @param {Object} initial - target object to merge values into
4123
4125
  * @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
4124
4126
  *
4125
4127
  * @returns {Object}
4126
4128
  */
4127
4129
 
4128
- var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial) {
4130
+ var deepMergeWithArrayPrimitiveOverrides = function deepMergeWithArrayPrimitiveOverrides(initial) {
4129
4131
  var clone = lodash_1.cloneDeep(initial);
4130
4132
 
4131
4133
  for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -4136,18 +4138,72 @@ var deepMergeWithArrayOverrides = function deepMergeWithArrayOverrides(initial)
4136
4138
  Object.keys(sourceToApply).forEach(function (sourceKey) {
4137
4139
  if (!Object.prototype.hasOwnProperty.call(clone, sourceKey)) {
4138
4140
  clone[sourceKey] = lodash_1.cloneDeep(sourceToApply[sourceKey]);
4139
- } // object merging excluding arrays
4140
-
4141
+ }
4141
4142
 
4142
4143
  if (clone[sourceKey] && _typeof(clone[sourceKey]) === 'object' && !Array.isArray(clone[sourceKey]) && _typeof(sourceToApply[sourceKey]) === 'object') {
4143
- clone[sourceKey] = exports.deepMergeWithArrayOverrides(clone[sourceKey], sourceToApply[sourceKey]);
4144
+ clone[sourceKey] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey], sourceToApply[sourceKey]);
4145
+ } else if (Array.isArray(clone[sourceKey]) && _typeof(clone[sourceKey][0]) === 'object' && !Array.isArray(clone[sourceKey][0])) {
4146
+ // If option is an array of objects
4147
+ for (var i = 0; i < clone[sourceKey].length; i += 1) {
4148
+ if (_typeof(clone[sourceKey][i]) === 'object') {
4149
+ var closestMatchIdx = exports.findClosestMatchFromDefaultList(sourceToApply[sourceKey], clone[sourceKey][i]);
4150
+
4151
+ if (closestMatchIdx > -1) {
4152
+ clone[sourceKey][i] = exports.deepMergeWithArrayPrimitiveOverrides(clone[sourceKey][i], sourceToApply[sourceKey][closestMatchIdx]);
4153
+ }
4154
+ }
4155
+ }
4144
4156
  }
4145
4157
  });
4146
4158
  });
4147
4159
  return clone;
4148
4160
  };
4149
4161
 
4150
- exports.deepMergeWithArrayOverrides = deepMergeWithArrayOverrides;
4162
+ exports.deepMergeWithArrayPrimitiveOverrides = deepMergeWithArrayPrimitiveOverrides;
4163
+ /**
4164
+ * Finds the closest matching object from the list, which has the max same key value pairs.
4165
+ * Returns the index of match if found, or -1
4166
+ * For eg :-
4167
+ const list = [{
4168
+ type: "marker",
4169
+ lat: "value1"
4170
+ }, {
4171
+ type: "bubble",
4172
+ size: "value2"
4173
+ }];
4174
+
4175
+ const obj = {
4176
+ type: 'bubble'
4177
+ };
4178
+
4179
+ findClosestMatch(list, obj) -> returns index 1.
4180
+ */
4181
+
4182
+ var findClosestMatchFromDefaultList = function findClosestMatchFromDefaultList(searchList, inputObj) {
4183
+ if (!Array.isArray(searchList) || searchList.length === 0) {
4184
+ return -1;
4185
+ }
4186
+
4187
+ var keys = Object.keys(inputObj);
4188
+ var maxMatchCnt = 0;
4189
+ var maxMatchIdx = 0;
4190
+ searchList.forEach(function (item, idx) {
4191
+ var matchCnt = 0;
4192
+ keys.forEach(function (key) {
4193
+ if (item[key] === inputObj[key]) {
4194
+ matchCnt += 1;
4195
+ }
4196
+ });
4197
+
4198
+ if (Math.max(maxMatchCnt, matchCnt) > maxMatchCnt) {
4199
+ maxMatchCnt = matchCnt;
4200
+ maxMatchIdx = idx;
4201
+ }
4202
+ });
4203
+ return maxMatchIdx;
4204
+ };
4205
+
4206
+ exports.findClosestMatchFromDefaultList = findClosestMatchFromDefaultList;
4151
4207
 
4152
4208
  /***/ }),
4153
4209