@splunk/visualizations 26.0.0 → 26.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +103 -19
- package/Area.config.js.map +1 -1
- package/Area.js +646 -243
- package/Area.js.map +1 -1
- package/Bar.config.js +105 -21
- package/Bar.config.js.map +1 -1
- package/Bar.js +653 -237
- package/Bar.js.map +1 -1
- package/Bubble.config.js +95 -21
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +635 -229
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +66 -15
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +589 -211
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +104 -19
- package/Column.config.js.map +1 -1
- package/Column.js +666 -239
- package/Column.js.map +1 -1
- package/Ellipse.config.js +83 -18
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +444 -156
- package/Ellipse.js.map +1 -1
- package/Events.config.js +101 -19
- package/Events.config.js.map +1 -1
- package/Events.js +792 -322
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +97 -28
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +786 -390
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +63 -19
- package/Image.config.js.map +1 -1
- package/Image.js +439 -164
- package/Image.js.map +1 -1
- package/Line.config.js +107 -23
- package/Line.config.js.map +1 -1
- package/Line.js +841 -456
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +73 -23
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +653 -230
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +244 -99
- package/Map.config.js.map +1 -1
- package/Map.js +1223 -612
- package/Map.js.map +1 -1
- package/Markdown.config.js +71 -21
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +477 -202
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +80 -22
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +819 -418
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +73 -19
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +870 -491
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +76 -23
- package/Pie.config.js.map +1 -1
- package/Pie.js +643 -233
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +82 -30
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +863 -387
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +86 -20
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +449 -159
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +85 -23
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +895 -349
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +97 -23
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +639 -234
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +95 -25
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1198 -656
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +287 -226
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +93 -23
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +991 -522
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +100 -27
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1185 -624
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +127 -68
- package/SparkLine.js.map +1 -1
- package/Table.config.js +74 -21
- package/Table.config.js.map +1 -1
- package/Table.js +827 -329
- package/Table.js.map +1 -1
- package/common/Charting.js +152 -69
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +25 -14
- package/common/ChartingApi.js.map +1 -1
- package/common/DocExampleWithVizSandbox.js +530 -0
- package/common/DocExampleWithVizSandbox.js.map +1 -0
- package/common/EventsDoc.js +139 -104
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +79 -69
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +54 -45
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +178 -87
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +530 -68
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +47 -20
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +15 -9
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +57 -44
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +52 -20
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +139 -7
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +185 -102
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +28 -16
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +50 -15
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +8 -3
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +4 -2
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +2 -1
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +288 -128
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +242 -197
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +10 -1
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +62 -1
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +3 -1
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +389 -192
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +18 -26
package/Map.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright ©
|
|
2
|
+
* Copyright © 2024 Splunk Inc.
|
|
3
3
|
* SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
|
|
4
4
|
* in part without a valid written license from Splunk Inc. is PROHIBITED.
|
|
5
5
|
*/
|
|
@@ -136,15 +136,17 @@ module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
|
136
136
|
Object.defineProperty(exports, "__esModule", {
|
|
137
137
|
value: true
|
|
138
138
|
});
|
|
139
|
-
exports.convertToArrOfObjects = void 0;
|
|
140
|
-
|
|
139
|
+
exports.convertToArrOfObjects = void 0; // TODO: utilize this fn in ParallelCoordinates
|
|
140
|
+
|
|
141
141
|
var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
142
142
|
if (!columns || !columns[0] || !columns[0].length) return [];
|
|
143
143
|
var data = [];
|
|
144
|
+
|
|
144
145
|
var _loop = function _loop(i) {
|
|
145
146
|
var newObj = {};
|
|
146
147
|
fields.forEach(function (field, index) {
|
|
147
148
|
var fieldName = typeof field === 'string' ? field : field.name;
|
|
149
|
+
|
|
148
150
|
if (columns[index][i] === '') {
|
|
149
151
|
newObj[fieldName] = null;
|
|
150
152
|
} else {
|
|
@@ -153,11 +155,14 @@ var convertToArrOfObjects = function convertToArrOfObjects(columns, fields) {
|
|
|
153
155
|
});
|
|
154
156
|
data.push(newObj);
|
|
155
157
|
};
|
|
158
|
+
|
|
156
159
|
for (var i = 0; i < columns[0].length; i += 1) {
|
|
157
160
|
_loop(i);
|
|
158
161
|
}
|
|
162
|
+
|
|
159
163
|
return data;
|
|
160
164
|
};
|
|
165
|
+
|
|
161
166
|
exports.convertToArrOfObjects = convertToArrOfObjects;
|
|
162
167
|
|
|
163
168
|
/***/ }),
|
|
@@ -171,11 +176,17 @@ exports.convertToArrOfObjects = convertToArrOfObjects;
|
|
|
171
176
|
Object.defineProperty(exports, "__esModule", {
|
|
172
177
|
value: true
|
|
173
178
|
});
|
|
179
|
+
|
|
174
180
|
var React = __webpack_require__(1);
|
|
181
|
+
|
|
175
182
|
var styled_components_1 = __webpack_require__(4);
|
|
183
|
+
|
|
176
184
|
var SizeAwareWrapper_1 = __webpack_require__(19);
|
|
185
|
+
|
|
177
186
|
var style_1 = __webpack_require__(14);
|
|
187
|
+
|
|
178
188
|
var colorUtils_1 = __webpack_require__(12);
|
|
189
|
+
|
|
179
190
|
var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
180
191
|
var width = _ref.width;
|
|
181
192
|
return {
|
|
@@ -188,11 +199,11 @@ var Item = styled_components_1.default.div.attrs(function (_ref) {
|
|
|
188
199
|
componentId: "sc-1yhgpod-0"
|
|
189
200
|
})(["position:relative;background-color:", "};"], function (props) {
|
|
190
201
|
return (0, colorUtils_1.isColor)(props.backgroundColor) && props.backgroundColor || props.theme.defaultBackgroundColor;
|
|
191
|
-
});
|
|
192
|
-
|
|
202
|
+
}); // Use `.attrs()` for highly dynamic styles. Ref: https://github.com/styled-components/styled-components/issues/134#issuecomment-312415291
|
|
203
|
+
|
|
193
204
|
var FixSizeItem = styled_components_1.default.div.attrs(function (_ref2) {
|
|
194
205
|
var width = _ref2.width,
|
|
195
|
-
|
|
206
|
+
height = _ref2.height;
|
|
196
207
|
return {
|
|
197
208
|
style: Object.assign(Object.assign({}, width && {
|
|
198
209
|
width: (0, style_1.toPx)(width)
|
|
@@ -214,11 +225,13 @@ var FixSizeItemContent = styled_components_1.default.div.withConfig({
|
|
|
214
225
|
displayName: "FixedSizeContainer__FixSizeItemContent",
|
|
215
226
|
componentId: "sc-1yhgpod-3"
|
|
216
227
|
})(["min-height:0px;flex:1;position:relative;box-sizing:border-box;"]);
|
|
228
|
+
|
|
217
229
|
var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
218
230
|
var FixedSizeContainer = function FixedSizeContainer(props) {
|
|
219
231
|
var width = props.width,
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
height = props.height,
|
|
233
|
+
backgroundColor = props.backgroundColor;
|
|
234
|
+
|
|
222
235
|
if (!height) {
|
|
223
236
|
return React.createElement(Item, {
|
|
224
237
|
"data-test": "item",
|
|
@@ -226,24 +239,27 @@ var withFixedSizeContainer = function withFixedSizeContainer(Viz) {
|
|
|
226
239
|
backgroundColor: backgroundColor
|
|
227
240
|
}, React.createElement(ItemContent, null, React.createElement(Viz, Object.assign({}, props))));
|
|
228
241
|
}
|
|
242
|
+
|
|
229
243
|
return React.createElement(FixSizeItem, {
|
|
230
244
|
"data-test": "fix-size-item",
|
|
231
|
-
"data-splunk-visualization-version": "26.
|
|
245
|
+
"data-splunk-visualization-version": "26.1.1 - b6df0a015",
|
|
232
246
|
width: width,
|
|
233
247
|
height: height,
|
|
234
248
|
backgroundColor: backgroundColor
|
|
235
249
|
}, React.createElement(FixSizeItemContent, null, React.createElement(SizeAwareWrapper_1.default, null, function (_ref3) {
|
|
236
250
|
var newWidth = _ref3.width,
|
|
237
|
-
|
|
251
|
+
newHeight = _ref3.height;
|
|
238
252
|
return React.createElement(Viz, Object.assign({}, props, {
|
|
239
253
|
width: newWidth,
|
|
240
254
|
height: newHeight
|
|
241
255
|
}));
|
|
242
256
|
})));
|
|
243
257
|
};
|
|
258
|
+
|
|
244
259
|
FixedSizeContainer.displayName = 'withFixedSizeContainer';
|
|
245
260
|
return FixedSizeContainer;
|
|
246
261
|
};
|
|
262
|
+
|
|
247
263
|
exports.default = withFixedSizeContainer;
|
|
248
264
|
|
|
249
265
|
/***/ }),
|
|
@@ -255,36 +271,51 @@ exports.default = withFixedSizeContainer;
|
|
|
255
271
|
|
|
256
272
|
|
|
257
273
|
var _slicedToArray = __webpack_require__(17);
|
|
274
|
+
|
|
258
275
|
var _defineProperty = __webpack_require__(7);
|
|
276
|
+
|
|
259
277
|
var _toConsumableArray = __webpack_require__(8);
|
|
278
|
+
|
|
260
279
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
280
|
+
|
|
261
281
|
var _templateObject;
|
|
282
|
+
|
|
262
283
|
Object.defineProperty(exports, "__esModule", {
|
|
263
284
|
value: true
|
|
264
285
|
});
|
|
265
286
|
exports.Bubble = exports.PieSegment = exports.GEO_LAT_AND_LONG_FIELD = exports.GEO_BOUND_PREFIX = void 0;
|
|
287
|
+
|
|
266
288
|
var React = __webpack_require__(1);
|
|
289
|
+
|
|
267
290
|
var styled_components_1 = __webpack_require__(4);
|
|
291
|
+
|
|
268
292
|
var lodash_1 = __webpack_require__(3);
|
|
293
|
+
|
|
269
294
|
var colorUtils_1 = __webpack_require__(12);
|
|
270
|
-
|
|
295
|
+
|
|
296
|
+
var MapUtils_1 = __webpack_require__(92);
|
|
297
|
+
|
|
271
298
|
var MarkerWrapper_1 = __webpack_require__(132);
|
|
299
|
+
|
|
272
300
|
exports.GEO_BOUND_PREFIX = '_geo_bounds_';
|
|
273
301
|
exports.GEO_LAT_AND_LONG_FIELD = ['_geo_long_field', '_geo_lat_field'];
|
|
274
302
|
exports.PieSegment = React.memo(function (_ref) {
|
|
275
303
|
var start = _ref.start,
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
304
|
+
end = _ref.end,
|
|
305
|
+
radius = _ref.radius,
|
|
306
|
+
color = _ref.color,
|
|
307
|
+
themeColor = _ref.themeColor,
|
|
308
|
+
segmentMetadata = _ref.segmentMetadata,
|
|
309
|
+
handleBubbleClick = _ref.handleBubbleClick;
|
|
310
|
+
|
|
282
311
|
var _ref2 = segmentMetadata !== null && segmentMetadata !== void 0 ? segmentMetadata : {},
|
|
283
|
-
|
|
284
|
-
|
|
312
|
+
name = _ref2.name,
|
|
313
|
+
value = _ref2.value;
|
|
314
|
+
|
|
285
315
|
var handleSegmentClick = React.useCallback(function (e) {
|
|
286
316
|
handleBubbleClick(e, name, value);
|
|
287
317
|
}, [name, value, handleBubbleClick]);
|
|
318
|
+
|
|
288
319
|
if (end - start === 1) {
|
|
289
320
|
return React.createElement("circle", {
|
|
290
321
|
onClick: handleSegmentClick,
|
|
@@ -297,6 +328,7 @@ exports.PieSegment = React.memo(function (_ref) {
|
|
|
297
328
|
stroke: color
|
|
298
329
|
});
|
|
299
330
|
}
|
|
331
|
+
|
|
300
332
|
var a0 = 2 * Math.PI * (start - 0.25);
|
|
301
333
|
var a1 = 2 * Math.PI * (end - 0.25);
|
|
302
334
|
var x0 = Math.cos(a0);
|
|
@@ -318,17 +350,17 @@ exports.PieSegment.displayName = 'MapBubblePieSegment';
|
|
|
318
350
|
var StyledMarkerWrapper = (0, styled_components_1.default)(MarkerWrapper_1.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n"])));
|
|
319
351
|
exports.Bubble = React.memo(function (_ref3) {
|
|
320
352
|
var originalValues = _ref3.originalValues,
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
353
|
+
valueRange = _ref3.valueRange,
|
|
354
|
+
colors = _ref3.colors,
|
|
355
|
+
themeColor = _ref3.themeColor,
|
|
356
|
+
isPie = _ref3.isPie,
|
|
357
|
+
latitude = _ref3.latitude,
|
|
358
|
+
longitude = _ref3.longitude,
|
|
359
|
+
bubbleSize = _ref3.bubbleSize,
|
|
360
|
+
_ref3$additionalField = _ref3.additionalFields,
|
|
361
|
+
additionalFields = _ref3$additionalField === void 0 ? [] : _ref3$additionalField,
|
|
362
|
+
map = _ref3.map,
|
|
363
|
+
handleMapClick = _ref3.handleMapClick;
|
|
332
364
|
var onBubbleClick = React.useCallback(function (e, name, value) {
|
|
333
365
|
handleMapClick(e, name, value);
|
|
334
366
|
e.stopPropagation();
|
|
@@ -337,14 +369,16 @@ exports.Bubble = React.memo(function (_ref3) {
|
|
|
337
369
|
var allZeros = originalValues.every(function (v) {
|
|
338
370
|
return v === 0;
|
|
339
371
|
});
|
|
372
|
+
|
|
340
373
|
if (allZeros || !originalValues.length) {
|
|
341
374
|
return null;
|
|
342
|
-
}
|
|
343
|
-
|
|
375
|
+
} // sanitize values
|
|
376
|
+
|
|
377
|
+
|
|
344
378
|
var values = originalValues.map(function (v) {
|
|
345
379
|
return v > 0 ? v : 0;
|
|
346
|
-
});
|
|
347
|
-
|
|
380
|
+
}); // compute offsets for pie segments
|
|
381
|
+
|
|
348
382
|
var offsets = [];
|
|
349
383
|
var total = 0;
|
|
350
384
|
values.forEach(function (count) {
|
|
@@ -378,9 +412,11 @@ exports.Bubble = React.memo(function (_ref3) {
|
|
|
378
412
|
});
|
|
379
413
|
}));
|
|
380
414
|
}, [bubbleSize, colors, isPie, onBubbleClick, originalValues, themeColor, valueRange]);
|
|
415
|
+
|
|
381
416
|
if (!bubble) {
|
|
382
417
|
return null;
|
|
383
418
|
}
|
|
419
|
+
|
|
384
420
|
return React.createElement(StyledMarkerWrapper, {
|
|
385
421
|
longitude: longitude,
|
|
386
422
|
latitude: latitude,
|
|
@@ -390,12 +426,13 @@ exports.Bubble = React.memo(function (_ref3) {
|
|
|
390
426
|
}, bubble);
|
|
391
427
|
});
|
|
392
428
|
exports.Bubble.displayName = 'MapBubble';
|
|
429
|
+
|
|
393
430
|
var BubbleLayer = function BubbleLayer(props) {
|
|
394
431
|
var bubbleLayer = props.bubbleLayer,
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
432
|
+
themeColorScheme = props.themeColorScheme,
|
|
433
|
+
map = props.map,
|
|
434
|
+
zoom = props.zoom,
|
|
435
|
+
onMapClick = props.onMapClick;
|
|
399
436
|
bubbleLayer.seriesColors = bubbleLayer.seriesColors || MapUtils_1.DEFAULT_SERIES_COLORS;
|
|
400
437
|
bubbleLayer.bubbleSize = bubbleLayer.bubbleSize || [];
|
|
401
438
|
var bakedData = React.useMemo(function () {
|
|
@@ -404,20 +441,22 @@ var BubbleLayer = function BubbleLayer(props) {
|
|
|
404
441
|
var staticColors = React.useMemo(function () {
|
|
405
442
|
return (0, MapUtils_1.getStaticColors)(bubbleLayer.bubbleSize.length, bubbleLayer.seriesColors);
|
|
406
443
|
}, [bubbleLayer.bubbleSize.length, bubbleLayer.seriesColors]);
|
|
444
|
+
|
|
407
445
|
var _ref4 = bakedData !== null && bakedData !== void 0 ? bakedData : {},
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
446
|
+
_ref4$data = _ref4.data,
|
|
447
|
+
data = _ref4$data === void 0 ? [] : _ref4$data,
|
|
448
|
+
_ref4$dataRange = _ref4.dataRange,
|
|
449
|
+
dataRange = _ref4$dataRange === void 0 ? [] : _ref4$dataRange,
|
|
450
|
+
resultLimit = _ref4.resultLimit,
|
|
451
|
+
bubbleSizeFields = _ref4.bubbleSizeFields,
|
|
452
|
+
isPie = _ref4.isPie;
|
|
453
|
+
|
|
415
454
|
var _bubbleLayer$addition = bubbleLayer.additionalTooltipFields,
|
|
416
|
-
|
|
455
|
+
additionalTooltipFields = _bubbleLayer$addition === void 0 ? [] : _bubbleLayer$addition;
|
|
417
456
|
var roundedZoom = Math.round(zoom);
|
|
418
457
|
var themeColor = themeColorScheme === 'light' ? '#ffffff' : '#1a1c20';
|
|
419
|
-
var dynamicColors = bubbleLayer.dataColors;
|
|
420
|
-
|
|
458
|
+
var dynamicColors = bubbleLayer.dataColors; // filter data for the current zoom level and sort base on values
|
|
459
|
+
|
|
421
460
|
var dataToRender = React.useMemo(function () {
|
|
422
461
|
return data.reduce(function (acc, datum, i) {
|
|
423
462
|
if (datum.zoom === roundedZoom) {
|
|
@@ -426,14 +465,17 @@ var BubbleLayer = function BubbleLayer(props) {
|
|
|
426
465
|
idx: i
|
|
427
466
|
});
|
|
428
467
|
}
|
|
468
|
+
|
|
429
469
|
return acc;
|
|
430
470
|
}, []).slice(0, resultLimit || MapUtils_1.DEFAULT_RESULT_LIMIT).sort(function (a, b) {
|
|
431
471
|
return (0, lodash_1.sum)(b.data.values) - (0, lodash_1.sum)(a.data.values);
|
|
432
472
|
});
|
|
433
473
|
}, [data, resultLimit, roundedZoom]);
|
|
474
|
+
|
|
434
475
|
var _handleMapClick = React.useCallback(function (e, name, value, i) {
|
|
435
|
-
var _a, _b, _c;
|
|
436
|
-
|
|
476
|
+
var _a, _b, _c; // retrieve metadata from the appropriate datum, indexed by i
|
|
477
|
+
|
|
478
|
+
|
|
437
479
|
var metadata = (_c = (_b = (_a = dataToRender[i]) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.metadata) !== null && _c !== void 0 ? _c : {};
|
|
438
480
|
var payload = Object.keys(metadata).reduce(function (acc, curr) {
|
|
439
481
|
var key = "row.".concat(curr, ".value");
|
|
@@ -448,13 +490,16 @@ var BubbleLayer = function BubbleLayer(props) {
|
|
|
448
490
|
payload: payload
|
|
449
491
|
});
|
|
450
492
|
}, [dataToRender, onMapClick]);
|
|
493
|
+
|
|
451
494
|
return React.createElement(React.Fragment, null, dataToRender.map(function (datum, i) {
|
|
452
495
|
var colors = dynamicColors ? [dataToRender.map(function (obj) {
|
|
453
496
|
return (0, colorUtils_1.isColor)(dynamicColors[obj.idx]) ? dynamicColors[obj.idx] : MapUtils_1.DEFAULT_CLUSTER_COLOR;
|
|
454
497
|
})[i]] : staticColors;
|
|
498
|
+
|
|
455
499
|
var _datum$data$coordinat = _slicedToArray(datum.data.coordinates, 2),
|
|
456
|
-
|
|
457
|
-
|
|
500
|
+
longitude = _datum$data$coordinat[0],
|
|
501
|
+
latitude = _datum$data$coordinat[1];
|
|
502
|
+
|
|
458
503
|
var bubbleSize = datum.data.values.map(function (value, index) {
|
|
459
504
|
return {
|
|
460
505
|
name: bubbleSizeFields[index],
|
|
@@ -486,6 +531,7 @@ var BubbleLayer = function BubbleLayer(props) {
|
|
|
486
531
|
});
|
|
487
532
|
}));
|
|
488
533
|
};
|
|
534
|
+
|
|
489
535
|
exports.default = BubbleLayer;
|
|
490
536
|
|
|
491
537
|
/***/ }),
|
|
@@ -497,39 +543,50 @@ exports.default = BubbleLayer;
|
|
|
497
543
|
|
|
498
544
|
|
|
499
545
|
var _slicedToArray = __webpack_require__(17);
|
|
546
|
+
|
|
500
547
|
var __rest = this && this.__rest || function (s, e) {
|
|
501
548
|
var t = {};
|
|
549
|
+
|
|
502
550
|
for (var p in s) {
|
|
503
551
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
504
552
|
}
|
|
553
|
+
|
|
505
554
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
506
555
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
507
556
|
}
|
|
508
557
|
return t;
|
|
509
558
|
};
|
|
559
|
+
|
|
510
560
|
Object.defineProperty(exports, "__esModule", {
|
|
511
561
|
value: true
|
|
512
562
|
});
|
|
513
|
-
|
|
563
|
+
|
|
564
|
+
var maplibre_gl_1 = __webpack_require__(160);
|
|
565
|
+
|
|
514
566
|
var React = __webpack_require__(1);
|
|
567
|
+
|
|
515
568
|
var Tooltip_1 = __webpack_require__(416);
|
|
569
|
+
|
|
516
570
|
var MarkerWrapper = function MarkerWrapper(_a) {
|
|
517
571
|
var longitude = _a.longitude,
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
572
|
+
latitude = _a.latitude,
|
|
573
|
+
areaId = _a.areaId,
|
|
574
|
+
areaValue = _a.areaValue,
|
|
575
|
+
_a$additionalFields = _a.additionalFields,
|
|
576
|
+
additionalFields = _a$additionalFields === void 0 ? [] : _a$additionalFields,
|
|
577
|
+
map = _a.map,
|
|
578
|
+
isChoroplethTooltipOpen = _a.isChoroplethTooltipOpen,
|
|
579
|
+
children = _a.children,
|
|
580
|
+
otherProps = __rest(_a, ["longitude", "latitude", "areaId", "areaValue", "additionalFields", "map", "isChoroplethTooltipOpen", "children"]);
|
|
581
|
+
|
|
527
582
|
var container = React.useRef();
|
|
528
583
|
var marker = React.useRef();
|
|
584
|
+
|
|
529
585
|
var _React$useState = React.useState(false),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
586
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
587
|
+
isTooltipOpen = _React$useState2[0],
|
|
588
|
+
setTooltipOpenStatus = _React$useState2[1];
|
|
589
|
+
|
|
533
590
|
var isChoroplethTooltip = React.useCallback(function () {
|
|
534
591
|
return isChoroplethTooltipOpen !== undefined;
|
|
535
592
|
}, [isChoroplethTooltipOpen]);
|
|
@@ -588,6 +645,7 @@ var MarkerWrapper = function MarkerWrapper(_a) {
|
|
|
588
645
|
additionalFields: additionalFields
|
|
589
646
|
})));
|
|
590
647
|
};
|
|
648
|
+
|
|
591
649
|
exports.default = MarkerWrapper;
|
|
592
650
|
|
|
593
651
|
/***/ }),
|
|
@@ -622,9 +680,10 @@ exports.extendStaticWrapperProps = void 0;
|
|
|
622
680
|
* @param {DashboardVizType} props.Wrapper
|
|
623
681
|
* @param {DashboardVizType} props.Visualization
|
|
624
682
|
*/
|
|
683
|
+
|
|
625
684
|
var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
626
685
|
var Wrapper = _ref.Wrapper,
|
|
627
|
-
|
|
686
|
+
Visualization = _ref.Visualization;
|
|
628
687
|
var extendProperties = ['propTypes', 'defaultProps', 'config'];
|
|
629
688
|
extendProperties.forEach(function (prop) {
|
|
630
689
|
if (Visualization[prop]) {
|
|
@@ -633,72 +692,89 @@ var extendStaticWrapperProps = function extendStaticWrapperProps(_ref) {
|
|
|
633
692
|
}
|
|
634
693
|
});
|
|
635
694
|
};
|
|
695
|
+
|
|
636
696
|
exports.extendStaticWrapperProps = extendStaticWrapperProps;
|
|
637
697
|
|
|
638
698
|
/***/ }),
|
|
639
699
|
|
|
640
|
-
/***/
|
|
700
|
+
/***/ 159:
|
|
641
701
|
/***/ (function(module, exports) {
|
|
642
702
|
|
|
643
703
|
module.exports = require("chroma-js");
|
|
644
704
|
|
|
645
705
|
/***/ }),
|
|
646
706
|
|
|
647
|
-
/***/
|
|
707
|
+
/***/ 16:
|
|
648
708
|
/***/ (function(module, exports) {
|
|
649
709
|
|
|
650
|
-
module.exports = require("
|
|
710
|
+
module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
651
711
|
|
|
652
712
|
/***/ }),
|
|
653
713
|
|
|
654
|
-
/***/
|
|
714
|
+
/***/ 160:
|
|
655
715
|
/***/ (function(module, exports) {
|
|
656
716
|
|
|
657
|
-
module.exports = require("
|
|
717
|
+
module.exports = require("maplibre-gl");
|
|
658
718
|
|
|
659
719
|
/***/ }),
|
|
660
720
|
|
|
661
|
-
/***/
|
|
721
|
+
/***/ 161:
|
|
662
722
|
/***/ (function(module, exports, __webpack_require__) {
|
|
663
723
|
|
|
664
724
|
"use strict";
|
|
665
725
|
|
|
666
726
|
|
|
667
727
|
var _slicedToArray = __webpack_require__(17);
|
|
728
|
+
|
|
668
729
|
Object.defineProperty(exports, "__esModule", {
|
|
669
730
|
value: true
|
|
670
731
|
});
|
|
671
732
|
exports.Choropleth = exports.cleanupChoropleth = exports.compareChoropleth = exports.compareGeom = void 0;
|
|
733
|
+
|
|
672
734
|
var React = __webpack_require__(1);
|
|
735
|
+
|
|
673
736
|
var lodash_1 = __webpack_require__(3);
|
|
674
|
-
|
|
737
|
+
|
|
738
|
+
var MapUtils_1 = __webpack_require__(92);
|
|
739
|
+
|
|
675
740
|
var MarkerWrapper_1 = __webpack_require__(132);
|
|
741
|
+
|
|
676
742
|
var getShapeId = function getShapeId(id) {
|
|
677
743
|
return "shape-".concat(id);
|
|
678
744
|
};
|
|
745
|
+
|
|
679
746
|
var getSourceId = function getSourceId(id) {
|
|
680
747
|
return "source-".concat(id);
|
|
681
748
|
};
|
|
749
|
+
|
|
682
750
|
var getStrokeId = function getStrokeId(id) {
|
|
683
751
|
return "stroke-".concat(id);
|
|
684
752
|
};
|
|
753
|
+
|
|
685
754
|
var compareGeom = function compareGeom(prev, next) {
|
|
686
755
|
if (prev !== null && next !== null) {
|
|
687
756
|
return prev.type === next.type && (0, lodash_1.isEqual)(prev.coordinates, next.coordinates);
|
|
688
757
|
}
|
|
758
|
+
|
|
689
759
|
return prev === null && next === null;
|
|
690
760
|
};
|
|
761
|
+
|
|
691
762
|
exports.compareGeom = compareGeom;
|
|
763
|
+
|
|
692
764
|
var compareChoropleth = function compareChoropleth(prevProps, nextProps) {
|
|
693
765
|
return (0, exports.compareGeom)(prevProps.geomData, nextProps.geomData) && prevProps.id === nextProps.id && prevProps.map === nextProps.map && prevProps.areaId === nextProps.areaId && prevProps.areaValue === nextProps.areaValue && prevProps.color === nextProps.color && prevProps.opacity === nextProps.opacity && prevProps.strokeColor === nextProps.strokeColor && prevProps.isThemeChanged === nextProps.isThemeChanged && (0, lodash_1.isEqual)(prevProps.additionalFields, nextProps.additionalFields) && prevProps.handleMapClick.toString() === nextProps.handleMapClick.toString();
|
|
694
766
|
};
|
|
767
|
+
|
|
695
768
|
exports.compareChoropleth = compareChoropleth;
|
|
769
|
+
|
|
696
770
|
var cleanupChoropleth = function cleanupChoropleth(shapeId, sourceId, strokeId, map) {
|
|
697
|
-
var _a, _b, _c;
|
|
698
|
-
|
|
771
|
+
var _a, _b, _c; // catch errors where map is undefined
|
|
772
|
+
|
|
773
|
+
|
|
699
774
|
var currLayer;
|
|
700
775
|
var currSource;
|
|
701
776
|
var currStrokeLayer;
|
|
777
|
+
|
|
702
778
|
try {
|
|
703
779
|
currLayer = (_a = map === null || map === void 0 ? void 0 : map.current) === null || _a === void 0 ? void 0 : _a.getLayer(shapeId);
|
|
704
780
|
currStrokeLayer = (_b = map === null || map === void 0 ? void 0 : map.current) === null || _b === void 0 ? void 0 : _b.getLayer(strokeId);
|
|
@@ -706,29 +782,33 @@ var cleanupChoropleth = function cleanupChoropleth(shapeId, sourceId, strokeId,
|
|
|
706
782
|
} catch (_d) {
|
|
707
783
|
return;
|
|
708
784
|
}
|
|
785
|
+
|
|
709
786
|
if (currLayer) {
|
|
710
787
|
map.current.removeLayer(shapeId);
|
|
711
788
|
}
|
|
789
|
+
|
|
712
790
|
if (currStrokeLayer) {
|
|
713
791
|
map.current.removeLayer(strokeId);
|
|
714
792
|
}
|
|
793
|
+
|
|
715
794
|
if (currSource) {
|
|
716
795
|
map.current.removeSource(sourceId);
|
|
717
796
|
}
|
|
718
797
|
};
|
|
798
|
+
|
|
719
799
|
exports.cleanupChoropleth = cleanupChoropleth;
|
|
720
800
|
exports.Choropleth = React.memo(function (_ref) {
|
|
721
801
|
var id = _ref.id,
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
802
|
+
areaId = _ref.areaId,
|
|
803
|
+
areaValue = _ref.areaValue,
|
|
804
|
+
geomData = _ref.geomData,
|
|
805
|
+
map = _ref.map,
|
|
806
|
+
color = _ref.color,
|
|
807
|
+
opacity = _ref.opacity,
|
|
808
|
+
strokeColor = _ref.strokeColor,
|
|
809
|
+
isThemeChanged = _ref.isThemeChanged,
|
|
810
|
+
additionalFields = _ref.additionalFields,
|
|
811
|
+
handleMapClick = _ref.handleMapClick;
|
|
732
812
|
var sourceId = getSourceId(id);
|
|
733
813
|
var shapeId = getShapeId(id);
|
|
734
814
|
var strokeId = getStrokeId(id);
|
|
@@ -736,18 +816,22 @@ exports.Choropleth = React.memo(function (_ref) {
|
|
|
736
816
|
type: 'Feature',
|
|
737
817
|
geometry: geomData
|
|
738
818
|
};
|
|
819
|
+
|
|
739
820
|
var _React$useState = React.useState(false),
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
821
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
822
|
+
isTooltipOpen = _React$useState2[0],
|
|
823
|
+
setTooltipOpenStatus = _React$useState2[1];
|
|
824
|
+
|
|
743
825
|
var _React$useState3 = React.useState(0),
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
826
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
827
|
+
mouseLat = _React$useState4[0],
|
|
828
|
+
setmouseLat = _React$useState4[1];
|
|
829
|
+
|
|
747
830
|
var _React$useState5 = React.useState(0),
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
831
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
832
|
+
mouseLng = _React$useState6[0],
|
|
833
|
+
setmouseLng = _React$useState6[1];
|
|
834
|
+
|
|
751
835
|
var openTooltip = React.useCallback(function () {
|
|
752
836
|
setTooltipOpenStatus(true);
|
|
753
837
|
}, []);
|
|
@@ -757,9 +841,9 @@ exports.Choropleth = React.memo(function (_ref) {
|
|
|
757
841
|
var updateChoropleth = React.useCallback(function () {
|
|
758
842
|
// Apply changes by removing the existing choropleth and creating a new one
|
|
759
843
|
// instead of mutating the current
|
|
760
|
-
(0, exports.cleanupChoropleth)(shapeId, sourceId, strokeId, map);
|
|
761
|
-
// In order to set a different color and opacity to each choropleth region
|
|
844
|
+
(0, exports.cleanupChoropleth)(shapeId, sourceId, strokeId, map); // In order to set a different color and opacity to each choropleth region
|
|
762
845
|
// we are creating a different layer for each region, and each layer requires a source
|
|
846
|
+
|
|
763
847
|
map.current.addSource(sourceId, {
|
|
764
848
|
type: 'geojson',
|
|
765
849
|
data: formattedGeomData
|
|
@@ -774,6 +858,7 @@ exports.Choropleth = React.memo(function (_ref) {
|
|
|
774
858
|
'fill-color': color
|
|
775
859
|
}
|
|
776
860
|
});
|
|
861
|
+
|
|
777
862
|
if (strokeColor !== 'transparent') {
|
|
778
863
|
map.current.addLayer({
|
|
779
864
|
id: strokeId,
|
|
@@ -786,6 +871,7 @@ exports.Choropleth = React.memo(function (_ref) {
|
|
|
786
871
|
}
|
|
787
872
|
});
|
|
788
873
|
}
|
|
874
|
+
|
|
789
875
|
map.current.on('mousemove', shapeId, function (e) {
|
|
790
876
|
var mouseLngLat = e.lngLat;
|
|
791
877
|
setmouseLat(mouseLngLat.lat);
|
|
@@ -793,30 +879,30 @@ exports.Choropleth = React.memo(function (_ref) {
|
|
|
793
879
|
openTooltip();
|
|
794
880
|
map.current.getCanvas().style.cursor = 'pointer'; // eslint-disable-line no-param-reassign
|
|
795
881
|
});
|
|
796
|
-
|
|
797
882
|
map.current.on('mouseleave', shapeId, function () {
|
|
798
883
|
closeTooltip();
|
|
799
884
|
map.current.getCanvas().style.cursor = ''; // eslint-disable-line no-param-reassign
|
|
800
885
|
});
|
|
801
|
-
|
|
802
886
|
map.current.on('click', shapeId, function (e) {
|
|
803
887
|
handleMapClick(e);
|
|
804
888
|
});
|
|
805
889
|
}, [shapeId, sourceId, map, color, opacity, formattedGeomData]);
|
|
806
890
|
React.useEffect(function () {
|
|
807
891
|
updateChoropleth();
|
|
808
|
-
}, [map, geomData, color, opacity, id, strokeColor]);
|
|
809
|
-
|
|
892
|
+
}, [map, geomData, color, opacity, id, strokeColor]); // Clean up on unmount
|
|
893
|
+
|
|
810
894
|
React.useEffect(function () {
|
|
811
895
|
return function () {
|
|
812
896
|
return (0, exports.cleanupChoropleth)(shapeId, sourceId, strokeId, map);
|
|
813
897
|
};
|
|
814
898
|
}, []);
|
|
899
|
+
|
|
815
900
|
if (isThemeChanged) {
|
|
816
901
|
// Theme changes will reset the style layers of the entire map
|
|
817
902
|
// so we need to rerender the choropleths
|
|
818
903
|
updateChoropleth();
|
|
819
904
|
}
|
|
905
|
+
|
|
820
906
|
return React.createElement(MarkerWrapper_1.default, {
|
|
821
907
|
isChoroplethTooltipOpen: isTooltipOpen,
|
|
822
908
|
additionalFields: additionalFields,
|
|
@@ -834,21 +920,23 @@ exports.Choropleth = React.memo(function (_ref) {
|
|
|
834
920
|
}));
|
|
835
921
|
}, exports.compareChoropleth);
|
|
836
922
|
exports.Choropleth.displayName = 'MapChoropleth';
|
|
923
|
+
|
|
837
924
|
var ChoroplethLayer = function ChoroplethLayer(props) {
|
|
838
925
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
926
|
+
|
|
839
927
|
var map = props.map,
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
928
|
+
choroplethLayer = props.choroplethLayer,
|
|
929
|
+
isThemeChanged = props.isThemeChanged,
|
|
930
|
+
setIsThemeChanged = props.setIsThemeChanged,
|
|
931
|
+
onMapClick = props.onMapClick;
|
|
844
932
|
var cfgOpacity = Math.min(Math.max(choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.choroplethOpacity, 0), 1);
|
|
845
933
|
var scaledOpacities = (_a = (0, MapUtils_1.getScaledOpacities)(choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.dataColors, cfgOpacity)) !== null && _a !== void 0 ? _a : [];
|
|
846
934
|
var colors = (_b = choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.dataColors) === null || _b === void 0 ? void 0 : _b.map(function (color) {
|
|
847
935
|
return (color === null || color === void 0 ? void 0 : color.length) > 7 ? color.slice(0, 7) : color;
|
|
848
936
|
});
|
|
849
937
|
var limit = Math.min((_c = choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.areaIds) === null || _c === void 0 ? void 0 : _c.length, (_d = choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.areaValues) === null || _d === void 0 ? void 0 : _d.length, (_f = (_e = choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.geom) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0, (choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.resultLimit) ? choroplethLayer.resultLimit : MapUtils_1.DEFAULT_RESULT_LIMIT);
|
|
850
|
-
var areaIdSliced = (_h = (_g = choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.areaIds) === null || _g === void 0 ? void 0 : _g.slice(0, limit)) !== null && _h !== void 0 ? _h : [];
|
|
851
|
-
|
|
938
|
+
var areaIdSliced = (_h = (_g = choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.areaIds) === null || _g === void 0 ? void 0 : _g.slice(0, limit)) !== null && _h !== void 0 ? _h : []; // generate a unique id if areaIds are not unique
|
|
939
|
+
|
|
852
940
|
var uniqueAreaIdSliced = (0, lodash_1.uniq)(areaIdSliced).length !== areaIdSliced.length ? areaIdSliced.map(function (id, i) {
|
|
853
941
|
return "".concat(id).concat(i);
|
|
854
942
|
}) : areaIdSliced;
|
|
@@ -860,6 +948,7 @@ var ChoroplethLayer = function ChoroplethLayer(props) {
|
|
|
860
948
|
};
|
|
861
949
|
});
|
|
862
950
|
}) : [];
|
|
951
|
+
|
|
863
952
|
var _handleMapClick = function handleMapClick(e, i) {
|
|
864
953
|
var payload = (0, MapUtils_1.formatMetadata)(choroplethLayer, i);
|
|
865
954
|
onMapClick({
|
|
@@ -867,12 +956,15 @@ var ChoroplethLayer = function ChoroplethLayer(props) {
|
|
|
867
956
|
payload: payload
|
|
868
957
|
});
|
|
869
958
|
};
|
|
959
|
+
|
|
870
960
|
if (!map || !choroplethLayer || !choroplethLayer.geom) {
|
|
871
961
|
return React.createElement(React.Fragment, null);
|
|
872
962
|
}
|
|
963
|
+
|
|
873
964
|
if (isThemeChanged) {
|
|
874
965
|
setIsThemeChanged(false);
|
|
875
966
|
}
|
|
967
|
+
|
|
876
968
|
return React.createElement("div", null, uniqueAreaIdSliced.map(function (id, i) {
|
|
877
969
|
var areaId = areaIdSliced[i];
|
|
878
970
|
var areaValue = choroplethLayer.areaValues[i];
|
|
@@ -894,6 +986,7 @@ var ChoroplethLayer = function ChoroplethLayer(props) {
|
|
|
894
986
|
});
|
|
895
987
|
}));
|
|
896
988
|
};
|
|
989
|
+
|
|
897
990
|
exports.default = ChoroplethLayer;
|
|
898
991
|
|
|
899
992
|
/***/ }),
|
|
@@ -933,24 +1026,33 @@ module.exports = require("@splunk/ui-utils/i18n");
|
|
|
933
1026
|
|
|
934
1027
|
|
|
935
1028
|
var _toConsumableArray = __webpack_require__(8);
|
|
1029
|
+
|
|
936
1030
|
var _defineProperty = __webpack_require__(7);
|
|
1031
|
+
|
|
937
1032
|
var __rest = this && this.__rest || function (s, e) {
|
|
938
1033
|
var t = {};
|
|
1034
|
+
|
|
939
1035
|
for (var p in s) {
|
|
940
1036
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
941
1037
|
}
|
|
1038
|
+
|
|
942
1039
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
943
1040
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
944
1041
|
}
|
|
945
1042
|
return t;
|
|
946
1043
|
};
|
|
1044
|
+
|
|
947
1045
|
Object.defineProperty(exports, "__esModule", {
|
|
948
1046
|
value: true
|
|
949
1047
|
});
|
|
950
1048
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
1049
|
+
|
|
951
1050
|
var lodash_1 = __webpack_require__(3);
|
|
1051
|
+
|
|
952
1052
|
var schemaUtils_1 = __webpack_require__(16);
|
|
1053
|
+
|
|
953
1054
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1055
|
+
|
|
954
1056
|
var dynamicOptionsDSLType = {
|
|
955
1057
|
type: 'string',
|
|
956
1058
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -960,20 +1062,22 @@ var dynamicOptionsDSLType = {
|
|
|
960
1062
|
* @param optionsSchema a visualization's options schema
|
|
961
1063
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
962
1064
|
*/
|
|
1065
|
+
|
|
963
1066
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
964
1067
|
var enhancedOptionsSchema = {};
|
|
965
1068
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
966
1069
|
var _a = optionsSchema[key],
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1070
|
+
title = _a.title,
|
|
1071
|
+
description = _a.description,
|
|
1072
|
+
readOnly = _a.readOnly,
|
|
1073
|
+
writeOnly = _a.writeOnly,
|
|
1074
|
+
examples = _a.examples,
|
|
1075
|
+
defaultValue = _a.default,
|
|
1076
|
+
type = _a.type,
|
|
1077
|
+
properties = _a.properties,
|
|
1078
|
+
patternProperties = _a.patternProperties,
|
|
1079
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
1080
|
+
|
|
977
1081
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
978
1082
|
title: title
|
|
979
1083
|
}), description !== undefined && {
|
|
@@ -987,12 +1091,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
987
1091
|
}), defaultValue !== undefined && {
|
|
988
1092
|
default: defaultValue
|
|
989
1093
|
});
|
|
1094
|
+
|
|
990
1095
|
if (type === 'object') {
|
|
991
1096
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
992
1097
|
type: type
|
|
993
1098
|
}), properties && {
|
|
994
1099
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
995
1100
|
});
|
|
1101
|
+
|
|
996
1102
|
if (patternProperties) {
|
|
997
1103
|
var enhancedPatternProperties = {};
|
|
998
1104
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -1010,6 +1116,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
1010
1116
|
});
|
|
1011
1117
|
return enhancedOptionsSchema;
|
|
1012
1118
|
}
|
|
1119
|
+
|
|
1013
1120
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
1014
1121
|
/**
|
|
1015
1122
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -1018,11 +1125,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
1018
1125
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
1019
1126
|
* and containing `open: false` for all editor panels in editorConfig
|
|
1020
1127
|
*/
|
|
1128
|
+
|
|
1021
1129
|
function enhanceConfig(vizConfig) {
|
|
1022
1130
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
1131
|
+
|
|
1023
1132
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
1024
1133
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
1025
1134
|
}
|
|
1135
|
+
|
|
1026
1136
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
1027
1137
|
return Object.assign(Object.assign({}, config), {
|
|
1028
1138
|
open: config.open || false
|
|
@@ -1030,6 +1140,7 @@ function enhanceConfig(vizConfig) {
|
|
|
1030
1140
|
});
|
|
1031
1141
|
return enhancedConfig;
|
|
1032
1142
|
}
|
|
1143
|
+
|
|
1033
1144
|
exports.enhanceConfig = enhanceConfig;
|
|
1034
1145
|
/**
|
|
1035
1146
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -1037,6 +1148,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
1037
1148
|
* @param vizConfig a Visualization Config
|
|
1038
1149
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
1039
1150
|
*/
|
|
1151
|
+
|
|
1040
1152
|
function uncollapseEditorConfig(vizConfig) {
|
|
1041
1153
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
1042
1154
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -1046,13 +1158,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
1046
1158
|
});
|
|
1047
1159
|
return editorPanelUncollapsedConfig;
|
|
1048
1160
|
}
|
|
1161
|
+
|
|
1049
1162
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
1163
|
+
|
|
1050
1164
|
function isDynamicOption(option) {
|
|
1051
1165
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
1052
1166
|
}
|
|
1053
|
-
|
|
1054
|
-
// private helpers to improve readability of getInitialPreset
|
|
1167
|
+
|
|
1168
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
1055
1169
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
1170
|
+
|
|
1056
1171
|
/**
|
|
1057
1172
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
1058
1173
|
* 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
|
|
@@ -1061,6 +1176,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
1061
1176
|
*
|
|
1062
1177
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
1063
1178
|
*/
|
|
1179
|
+
|
|
1064
1180
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
1065
1181
|
var presetContextKeys = Object.keys(presetContext);
|
|
1066
1182
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -1070,6 +1186,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
1070
1186
|
/**
|
|
1071
1187
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
1072
1188
|
*/
|
|
1189
|
+
|
|
1190
|
+
|
|
1073
1191
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
1074
1192
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
1075
1193
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -1084,18 +1202,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
1084
1202
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
1085
1203
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
1086
1204
|
*/
|
|
1205
|
+
|
|
1206
|
+
|
|
1087
1207
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
1088
1208
|
return presets.find(function (preset) {
|
|
1089
1209
|
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
1090
1210
|
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
1091
1211
|
var presetContextKeys = Object.keys(presetContext);
|
|
1092
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
1093
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1212
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
1094
1213
|
// if not, then the preset is invalid in config.ts
|
|
1214
|
+
|
|
1095
1215
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
1096
1216
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
1097
1217
|
});
|
|
1098
1218
|
}
|
|
1219
|
+
|
|
1099
1220
|
exports.getInitialPreset = getInitialPreset;
|
|
1100
1221
|
/**
|
|
1101
1222
|
* generates number precision values for a Select editor
|
|
@@ -1103,6 +1224,7 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
1103
1224
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
1104
1225
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
1105
1226
|
*/
|
|
1227
|
+
|
|
1106
1228
|
function generatePrecisionValues(numPrecisionValues) {
|
|
1107
1229
|
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
1108
1230
|
return {
|
|
@@ -1111,6 +1233,7 @@ function generatePrecisionValues(numPrecisionValues) {
|
|
|
1111
1233
|
};
|
|
1112
1234
|
});
|
|
1113
1235
|
}
|
|
1236
|
+
|
|
1114
1237
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
1115
1238
|
/**
|
|
1116
1239
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -1120,12 +1243,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
1120
1243
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
1121
1244
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
1122
1245
|
*/
|
|
1246
|
+
|
|
1123
1247
|
var insertLayout = function insertLayout(layout, index) {
|
|
1124
1248
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1125
1249
|
layoutItems[_key - 2] = arguments[_key];
|
|
1126
1250
|
}
|
|
1251
|
+
|
|
1127
1252
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
1128
1253
|
};
|
|
1254
|
+
|
|
1129
1255
|
exports.insertLayout = insertLayout;
|
|
1130
1256
|
|
|
1131
1257
|
/***/ }),
|
|
@@ -1189,11 +1315,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1189
1315
|
value: true
|
|
1190
1316
|
});
|
|
1191
1317
|
exports.shouldShowIconPlaceholder = void 0;
|
|
1318
|
+
|
|
1192
1319
|
var React = __webpack_require__(1);
|
|
1320
|
+
|
|
1193
1321
|
var T = __webpack_require__(0);
|
|
1322
|
+
|
|
1194
1323
|
var lodash_1 = __webpack_require__(3);
|
|
1324
|
+
|
|
1195
1325
|
var i18n_1 = __webpack_require__(2);
|
|
1326
|
+
|
|
1196
1327
|
var Message_1 = __webpack_require__(10);
|
|
1328
|
+
|
|
1197
1329
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
1198
1330
|
/**
|
|
1199
1331
|
* @method shouldShowIconPlaceholder
|
|
@@ -1201,6 +1333,8 @@ var FixedSizeContainer_1 = __webpack_require__(13);
|
|
|
1201
1333
|
* @param {boolean} loading
|
|
1202
1334
|
* @returns {boolean}
|
|
1203
1335
|
*/
|
|
1336
|
+
|
|
1337
|
+
|
|
1204
1338
|
var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources) {
|
|
1205
1339
|
var loading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1206
1340
|
var data = (0, lodash_1.get)(dataSources, 'primary.data.columns[0]', undefined);
|
|
@@ -1209,6 +1343,7 @@ var shouldShowIconPlaceholder = function shouldShowIconPlaceholder(dataSources)
|
|
|
1209
1343
|
var noFields = fields === undefined;
|
|
1210
1344
|
return loading || noData || noFields;
|
|
1211
1345
|
};
|
|
1346
|
+
|
|
1212
1347
|
exports.shouldShowIconPlaceholder = shouldShowIconPlaceholder;
|
|
1213
1348
|
var propTypes = {
|
|
1214
1349
|
icon: T.func,
|
|
@@ -1223,11 +1358,13 @@ var propTypes = {
|
|
|
1223
1358
|
* @param {IconPlaceholderProps} props
|
|
1224
1359
|
* @returns {React.ReactElement}
|
|
1225
1360
|
*/
|
|
1361
|
+
|
|
1226
1362
|
var IconPlaceholder = function IconPlaceholder(props) {
|
|
1227
1363
|
var width = props.width,
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1364
|
+
height = props.height,
|
|
1365
|
+
icon = props.icon,
|
|
1366
|
+
iconColor = props.iconColor;
|
|
1367
|
+
|
|
1231
1368
|
if (icon) {
|
|
1232
1369
|
return React.createElement(icon, {
|
|
1233
1370
|
style: {
|
|
@@ -1239,9 +1376,11 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1239
1376
|
transform: 'translate(-50%, -50%)'
|
|
1240
1377
|
},
|
|
1241
1378
|
width: '50%',
|
|
1242
|
-
height: '50%'
|
|
1379
|
+
height: '50%',
|
|
1380
|
+
'data-test': 'icon-placeholder'
|
|
1243
1381
|
});
|
|
1244
1382
|
}
|
|
1383
|
+
|
|
1245
1384
|
return React.createElement(Message_1.default, {
|
|
1246
1385
|
width: width,
|
|
1247
1386
|
height: height,
|
|
@@ -1249,6 +1388,7 @@ var IconPlaceholder = function IconPlaceholder(props) {
|
|
|
1249
1388
|
message: (0, i18n_1._)('No DataSource Connected')
|
|
1250
1389
|
});
|
|
1251
1390
|
};
|
|
1391
|
+
|
|
1252
1392
|
IconPlaceholder.propTypes = propTypes;
|
|
1253
1393
|
IconPlaceholder.defaultProps = {
|
|
1254
1394
|
width: '100%',
|
|
@@ -1265,21 +1405,27 @@ exports.default = (0, FixedSizeContainer_1.default)(IconPlaceholder);
|
|
|
1265
1405
|
|
|
1266
1406
|
|
|
1267
1407
|
var _defineProperty = __webpack_require__(7);
|
|
1408
|
+
|
|
1268
1409
|
Object.defineProperty(exports, "__esModule", {
|
|
1269
1410
|
value: true
|
|
1270
1411
|
});
|
|
1271
1412
|
exports.getSortingParams = exports.SortParamsPropTypes = void 0;
|
|
1413
|
+
|
|
1272
1414
|
var T = __webpack_require__(0);
|
|
1415
|
+
|
|
1273
1416
|
var lodash_1 = __webpack_require__(3);
|
|
1274
|
-
|
|
1417
|
+
|
|
1418
|
+
var DataSource_1 = __webpack_require__(34);
|
|
1419
|
+
|
|
1275
1420
|
exports.SortParamsPropTypes = T.shape({
|
|
1276
1421
|
currentSortKey: T.string,
|
|
1277
1422
|
currentSortDir: T.oneOf(DataSource_1.validSortDirs),
|
|
1278
1423
|
onSort: T.func
|
|
1279
1424
|
});
|
|
1425
|
+
|
|
1280
1426
|
var getSortingParams = function getSortingParams(_ref) {
|
|
1281
1427
|
var requestParams = _ref.requestParams,
|
|
1282
|
-
|
|
1428
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1283
1429
|
var currentSortKey;
|
|
1284
1430
|
var currentSortDir;
|
|
1285
1431
|
var nextSortDirMap = {
|
|
@@ -1288,15 +1434,18 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1288
1434
|
none: 'asc'
|
|
1289
1435
|
};
|
|
1290
1436
|
var onSort;
|
|
1437
|
+
|
|
1291
1438
|
if (typeof onRequestParamsChange === 'function') {
|
|
1292
1439
|
if (requestParams && (0, lodash_1.has)(requestParams, 'sort')) {
|
|
1293
1440
|
currentSortKey = Object.keys(requestParams.sort).shift();
|
|
1294
1441
|
currentSortDir = requestParams.sort[currentSortKey];
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1442
|
+
} // undid memoization since there is a dependency on requestParams, which is a deeply nested object
|
|
1443
|
+
|
|
1444
|
+
|
|
1297
1445
|
onSort = function onSort(e, _ref2) {
|
|
1298
1446
|
var sortKey = _ref2.sortKey,
|
|
1299
|
-
|
|
1447
|
+
sortDir = _ref2.sortDir;
|
|
1448
|
+
|
|
1300
1449
|
if (typeof sortKey === 'string') {
|
|
1301
1450
|
var nextSortDir = (0, lodash_1.has)(nextSortDirMap, sortDir) ? nextSortDirMap[sortDir] : 'none';
|
|
1302
1451
|
onRequestParamsChange(Object.assign(Object.assign({}, requestParams), {
|
|
@@ -1308,12 +1457,14 @@ var getSortingParams = function getSortingParams(_ref) {
|
|
|
1308
1457
|
}
|
|
1309
1458
|
};
|
|
1310
1459
|
}
|
|
1460
|
+
|
|
1311
1461
|
return {
|
|
1312
1462
|
currentSortKey: currentSortKey,
|
|
1313
1463
|
currentSortDir: currentSortDir,
|
|
1314
1464
|
onSort: onSort
|
|
1315
1465
|
};
|
|
1316
1466
|
};
|
|
1467
|
+
|
|
1317
1468
|
exports.getSortingParams = getSortingParams;
|
|
1318
1469
|
|
|
1319
1470
|
/***/ }),
|
|
@@ -1324,43 +1475,69 @@ exports.getSortingParams = getSortingParams;
|
|
|
1324
1475
|
"use strict";
|
|
1325
1476
|
|
|
1326
1477
|
|
|
1478
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1479
|
+
value: true
|
|
1480
|
+
});
|
|
1481
|
+
exports.validOutputModes = exports.validSegmentationModes = exports.validSortDirs = void 0;
|
|
1482
|
+
exports.validSortDirs = ['asc', 'desc', 'none'];
|
|
1483
|
+
exports.validSegmentationModes = ['none', 'inner'];
|
|
1484
|
+
exports.validOutputModes = ['json_cols', 'json'];
|
|
1485
|
+
|
|
1486
|
+
/***/ }),
|
|
1487
|
+
|
|
1488
|
+
/***/ 35:
|
|
1489
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1490
|
+
|
|
1491
|
+
"use strict";
|
|
1492
|
+
|
|
1493
|
+
|
|
1327
1494
|
Object.defineProperty(exports, "__esModule", {
|
|
1328
1495
|
value: true
|
|
1329
1496
|
});
|
|
1330
1497
|
exports.getPaginationParams = exports.PaginatorParamsPropTypes = void 0;
|
|
1498
|
+
|
|
1331
1499
|
var T = __webpack_require__(0);
|
|
1500
|
+
|
|
1332
1501
|
var lodash_1 = __webpack_require__(3);
|
|
1502
|
+
|
|
1333
1503
|
exports.PaginatorParamsPropTypes = T.shape({
|
|
1334
1504
|
isPaging: T.bool,
|
|
1335
1505
|
current: T.number,
|
|
1336
1506
|
totalPages: T.number,
|
|
1337
1507
|
onChange: T.func
|
|
1338
1508
|
});
|
|
1509
|
+
|
|
1339
1510
|
var getPaginationParams = function getPaginationParams(_ref) {
|
|
1340
1511
|
var requestParams = _ref.requestParams,
|
|
1341
|
-
|
|
1342
|
-
|
|
1512
|
+
meta = _ref.meta,
|
|
1513
|
+
onRequestParamsChange = _ref.onRequestParamsChange;
|
|
1343
1514
|
var totalCount = meta && meta.totalCount || 0;
|
|
1344
1515
|
var offset = requestParams && requestParams.offset || 0;
|
|
1345
1516
|
var count = requestParams && requestParams.count;
|
|
1346
1517
|
var totalPages = typeof count === 'number' && count > 0 ? Math.ceil(totalCount / count) : 0;
|
|
1347
1518
|
var current = typeof count === 'number' && count > 0 ? Math.floor(offset / count) + 1 : 0;
|
|
1348
1519
|
var isPaging = totalPages > 1 && typeof onRequestParamsChange === 'function';
|
|
1520
|
+
|
|
1349
1521
|
var onChangeHandler = function onChangeHandler(e, _ref2) {
|
|
1350
1522
|
var page = _ref2.page,
|
|
1351
|
-
|
|
1523
|
+
countArg = _ref2.count;
|
|
1352
1524
|
var newParams = (0, lodash_1.cloneDeep)(requestParams);
|
|
1525
|
+
|
|
1353
1526
|
if (typeof countArg === 'number') {
|
|
1354
1527
|
newParams.count = countArg;
|
|
1355
1528
|
newParams.offset = 0;
|
|
1356
1529
|
}
|
|
1530
|
+
|
|
1357
1531
|
var pageCount = typeof newParams.count === 'number' ? newParams.count : 10;
|
|
1532
|
+
|
|
1358
1533
|
if (typeof page === 'number' && page > 0) {
|
|
1359
1534
|
newParams.count = pageCount;
|
|
1360
1535
|
newParams.offset = (page - 1) * pageCount;
|
|
1361
1536
|
}
|
|
1537
|
+
|
|
1362
1538
|
onRequestParamsChange(newParams);
|
|
1363
1539
|
};
|
|
1540
|
+
|
|
1364
1541
|
return {
|
|
1365
1542
|
isPaging: isPaging,
|
|
1366
1543
|
current: current,
|
|
@@ -1368,11 +1545,12 @@ var getPaginationParams = function getPaginationParams(_ref) {
|
|
|
1368
1545
|
onChange: typeof onRequestParamsChange === 'function' ? onChangeHandler : lodash_1.noop
|
|
1369
1546
|
};
|
|
1370
1547
|
};
|
|
1548
|
+
|
|
1371
1549
|
exports.getPaginationParams = getPaginationParams;
|
|
1372
1550
|
|
|
1373
1551
|
/***/ }),
|
|
1374
1552
|
|
|
1375
|
-
/***/
|
|
1553
|
+
/***/ 36:
|
|
1376
1554
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1377
1555
|
|
|
1378
1556
|
"use strict";
|
|
@@ -1383,6 +1561,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
1383
1561
|
});
|
|
1384
1562
|
exports.VizCategory = void 0;
|
|
1385
1563
|
var VizCategory;
|
|
1564
|
+
|
|
1386
1565
|
(function (VizCategory) {
|
|
1387
1566
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
1388
1567
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -1400,67 +1579,96 @@ var VizCategory;
|
|
|
1400
1579
|
|
|
1401
1580
|
/***/ }),
|
|
1402
1581
|
|
|
1403
|
-
/***/
|
|
1582
|
+
/***/ 37:
|
|
1404
1583
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1405
1584
|
|
|
1406
1585
|
"use strict";
|
|
1407
1586
|
|
|
1408
1587
|
|
|
1409
1588
|
var _slicedToArray = __webpack_require__(17);
|
|
1589
|
+
|
|
1410
1590
|
Object.defineProperty(exports, "__esModule", {
|
|
1411
1591
|
value: true
|
|
1412
1592
|
});
|
|
1593
|
+
|
|
1413
1594
|
var React = __webpack_require__(1);
|
|
1595
|
+
|
|
1414
1596
|
var lodash_1 = __webpack_require__(3);
|
|
1415
|
-
|
|
1597
|
+
|
|
1598
|
+
var getSettingsFromThemedProps_1 = __webpack_require__(38);
|
|
1599
|
+
|
|
1416
1600
|
var Options_1 = __webpack_require__(30);
|
|
1417
|
-
|
|
1601
|
+
|
|
1602
|
+
var SanitizeProps_1 = __webpack_require__(39);
|
|
1603
|
+
|
|
1418
1604
|
var TimezoneContext_1 = __webpack_require__(26);
|
|
1419
|
-
|
|
1605
|
+
|
|
1606
|
+
var moment_1 = __webpack_require__(40);
|
|
1607
|
+
|
|
1420
1608
|
var FeatureFlagContext_1 = __webpack_require__(21);
|
|
1609
|
+
|
|
1421
1610
|
var styled_components_1 = __webpack_require__(4);
|
|
1611
|
+
|
|
1422
1612
|
var hocUtils_1 = __webpack_require__(27);
|
|
1613
|
+
|
|
1423
1614
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
1424
|
-
|
|
1615
|
+
|
|
1616
|
+
var async_dynamic_options_evaluator_1 = __webpack_require__(41);
|
|
1617
|
+
|
|
1425
1618
|
var id_1 = __webpack_require__(25);
|
|
1426
|
-
|
|
1619
|
+
|
|
1620
|
+
var SplunkVisualization_1 = __webpack_require__(42);
|
|
1621
|
+
|
|
1427
1622
|
var VizBehavior_1 = __webpack_require__(6);
|
|
1623
|
+
|
|
1428
1624
|
var getSorting_1 = __webpack_require__(33);
|
|
1429
|
-
|
|
1625
|
+
|
|
1626
|
+
var getPagination_1 = __webpack_require__(35);
|
|
1627
|
+
|
|
1430
1628
|
var useDeepMemo_1 = __webpack_require__(44);
|
|
1629
|
+
|
|
1431
1630
|
var MissingPropsMessage_1 = __webpack_require__(45);
|
|
1631
|
+
|
|
1432
1632
|
var withEditModeCover_1 = __webpack_require__(46);
|
|
1633
|
+
|
|
1433
1634
|
var withPlaceholder_1 = __webpack_require__(47);
|
|
1434
1635
|
/**
|
|
1435
1636
|
* hoc that wraps a pure react visualization in a Dashboard visualization
|
|
1436
1637
|
* @param {DashboardVizOpts} opts
|
|
1437
1638
|
* @returns {HOC}
|
|
1438
1639
|
*/
|
|
1640
|
+
|
|
1641
|
+
|
|
1439
1642
|
var withDashboardViz = function withDashboardViz(opts) {
|
|
1440
1643
|
var ReactViz = opts.ReactViz,
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1644
|
+
vizConfig = opts.vizConfig,
|
|
1645
|
+
_opts$computeVizProps = opts.computeVizProps,
|
|
1646
|
+
computeVizProps = _opts$computeVizProps === void 0 ? function () {} : _opts$computeVizProps,
|
|
1647
|
+
disableEditModeCover = opts.disableEditModeCover,
|
|
1648
|
+
useIconPlaceholder = opts.useIconPlaceholder; // sanitizing props before sending them to reactviz.
|
|
1649
|
+
|
|
1446
1650
|
var SanitizedReactViz = (0, SanitizeProps_1.withSanitizedProps)(ReactViz);
|
|
1447
1651
|
var defaultOptions = (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(vizConfig.optionsSchema, 'default');
|
|
1652
|
+
|
|
1448
1653
|
var DashboardViz = function DashboardViz(props) {
|
|
1449
1654
|
var _a;
|
|
1655
|
+
|
|
1450
1656
|
var mode = props.mode,
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1657
|
+
hasEventHandlers = props.hasEventHandlers,
|
|
1658
|
+
dataSources = props.dataSources,
|
|
1659
|
+
options = props.options,
|
|
1660
|
+
_props$context = props.context,
|
|
1661
|
+
context = _props$context === void 0 ? {} : _props$context,
|
|
1662
|
+
width = props.width,
|
|
1663
|
+
height = props.height,
|
|
1664
|
+
onComputedProps = props.onComputedProps,
|
|
1665
|
+
onEventTrigger = props.onEventTrigger,
|
|
1666
|
+
theme = props.theme,
|
|
1667
|
+
onRequestParamsChange = props.onRequestParamsChange;
|
|
1668
|
+
|
|
1462
1669
|
var _React$useContext = React.useContext(TimezoneContext_1.default),
|
|
1463
|
-
|
|
1670
|
+
serializedTimezone = _React$useContext.serializedTimezone;
|
|
1671
|
+
|
|
1464
1672
|
if (serializedTimezone) {
|
|
1465
1673
|
/*
|
|
1466
1674
|
@splunk/moment currently does not allow us to customize the timezone on a per visualization basis.
|
|
@@ -1474,38 +1682,51 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1474
1682
|
moment_1.default.setDefaultSplunkTimezone(serializedTimezone);
|
|
1475
1683
|
}
|
|
1476
1684
|
}
|
|
1685
|
+
|
|
1477
1686
|
var themeFunc = function themeFunc(themeVar) {
|
|
1478
1687
|
var _a, _b;
|
|
1688
|
+
|
|
1479
1689
|
return (_b = (_a = vizConfig.themes)[themeVar]) === null || _b === void 0 ? void 0 : _b.call(_a, props);
|
|
1480
1690
|
};
|
|
1691
|
+
|
|
1481
1692
|
var bgColorFromTheme = themeFunc('defaultBackgroundColor');
|
|
1693
|
+
|
|
1482
1694
|
var _ref = (0, getSettingsFromThemedProps_1.default)({
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1695
|
+
theme: theme
|
|
1696
|
+
}),
|
|
1697
|
+
currentThemeFamily = _ref.family,
|
|
1698
|
+
currentThemeColorScheme = _ref.colorScheme,
|
|
1699
|
+
currentThemeDensity = _ref.density;
|
|
1700
|
+
|
|
1488
1701
|
var evaluatedOptions = {}; // evaluatedOptions need to be initialized as an empty object
|
|
1702
|
+
|
|
1489
1703
|
var _React$useState = React.useState({}),
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1704
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1705
|
+
evaluatedOptionsAsync = _React$useState2[0],
|
|
1706
|
+
setEvaluatedOptionsAsync = _React$useState2[1]; // evaluatedOptions need to be initialized as an empty object
|
|
1707
|
+
|
|
1708
|
+
|
|
1493
1709
|
var featureFlagContext = React.useContext(FeatureFlagContext_1.default);
|
|
1710
|
+
|
|
1494
1711
|
var _React$useState3 = React.useState("".concat(vizConfig.name, " - ").concat((0, id_1.createGUID)())),
|
|
1495
|
-
|
|
1496
|
-
|
|
1712
|
+
_React$useState4 = _slicedToArray(_React$useState3, 1),
|
|
1713
|
+
visualizationID = _React$useState4[0];
|
|
1714
|
+
|
|
1497
1715
|
var _React$useState5 = React.useState({}),
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1716
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
1717
|
+
dataSourcesInState = _React$useState6[0],
|
|
1718
|
+
setDataSourcesInState = _React$useState6[1];
|
|
1719
|
+
|
|
1501
1720
|
var _React$useState7 = React.useState(),
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1721
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
1722
|
+
dataFramesInState = _React$useState8[0],
|
|
1723
|
+
setDataFramesInState = _React$useState8[1];
|
|
1724
|
+
|
|
1505
1725
|
var _React$useState9 = React.useState(Boolean(featureFlagContext === null || featureFlagContext === void 0 ? void 0 : featureFlagContext.visualizations_useWebWorkersForDSL)),
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1726
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
1727
|
+
useAsyncEvaluatedOptions = _React$useState10[0],
|
|
1728
|
+
setUseAsyncEvaluatedOptions = _React$useState10[1];
|
|
1729
|
+
|
|
1509
1730
|
var isMounted = React.useRef(true);
|
|
1510
1731
|
evaluatedOptions = (0, useDeepMemo_1.useDeepMemo)(function () {
|
|
1511
1732
|
try {
|
|
@@ -1530,11 +1751,13 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1530
1751
|
});
|
|
1531
1752
|
} else {
|
|
1532
1753
|
var dataFrames = dataFramesInState;
|
|
1754
|
+
|
|
1533
1755
|
if (dataSources !== dataSourcesInState) {
|
|
1534
1756
|
setDataSourcesInState(dataSources);
|
|
1535
1757
|
dataFrames = Options_1.Options.dataFrameFromDataSource(dataSources);
|
|
1536
1758
|
setDataFramesInState(dataFrames);
|
|
1537
1759
|
}
|
|
1760
|
+
|
|
1538
1761
|
return Options_1.Options.evaluate({
|
|
1539
1762
|
context: (0, lodash_1.defaultsDeep)({}, context, vizConfig.defaultContext),
|
|
1540
1763
|
options: (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, defaultOptions)
|
|
@@ -1545,21 +1768,24 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1545
1768
|
console.error("unexpected error evaluating options: ".concat(e.message));
|
|
1546
1769
|
return {};
|
|
1547
1770
|
}
|
|
1771
|
+
|
|
1548
1772
|
return {};
|
|
1549
1773
|
}, [currentThemeFamily, currentThemeColorScheme, currentThemeDensity, options, context, dataSources, serializedTimezone, useAsyncEvaluatedOptions]);
|
|
1550
|
-
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync;
|
|
1551
|
-
// trellis specific backgroundColor update for onComputedProps
|
|
1774
|
+
var evaluatedOptionsToUse = !useAsyncEvaluatedOptions ? evaluatedOptions : evaluatedOptionsAsync; // trellis specific backgroundColor update for onComputedProps
|
|
1552
1775
|
// 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
|
|
1553
1776
|
// onComputedProps api should return back trellisBackgroundColor value for backgroundColor option to support coloring of sibling panels (for eg:- title/ description on UDF side)
|
|
1777
|
+
|
|
1554
1778
|
var isTrellisFeatureFlagOn = Boolean(featureFlagContext && featureFlagContext.visualizations_enableTrellis);
|
|
1555
1779
|
var clonedEvaluatedOptions = evaluatedOptionsToUse;
|
|
1780
|
+
|
|
1556
1781
|
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) {
|
|
1557
1782
|
clonedEvaluatedOptions = Object.assign(Object.assign({}, evaluatedOptionsToUse), {
|
|
1558
1783
|
backgroundColor: clonedEvaluatedOptions === null || clonedEvaluatedOptions === void 0 ? void 0 : clonedEvaluatedOptions.trellisBackgroundColor
|
|
1559
1784
|
});
|
|
1560
|
-
}
|
|
1561
|
-
// useEffect hook needs to be initialized before any early returns
|
|
1785
|
+
} // useEffect hook needs to be initialized before any early returns
|
|
1562
1786
|
// this is in accordance with the order of hook calls being the same on each render https://reactjs.org/docs/hooks-rules.html#explanation
|
|
1787
|
+
|
|
1788
|
+
|
|
1563
1789
|
React.useEffect(function () {
|
|
1564
1790
|
onComputedProps(clonedEvaluatedOptions);
|
|
1565
1791
|
});
|
|
@@ -1569,53 +1795,68 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1569
1795
|
isMounted.current = false;
|
|
1570
1796
|
async_dynamic_options_evaluator_1.default.reset(visualizationID);
|
|
1571
1797
|
}
|
|
1572
|
-
};
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
// present warning message if any required props are missing
|
|
1798
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1799
|
+
}, []); // present warning message if any required props are missing
|
|
1800
|
+
|
|
1576
1801
|
var _vizConfig$requiredPr = vizConfig.requiredProps,
|
|
1577
|
-
|
|
1578
|
-
|
|
1802
|
+
requiredProps = _vizConfig$requiredPr === void 0 ? [] : _vizConfig$requiredPr,
|
|
1803
|
+
supports = vizConfig.supports;
|
|
1579
1804
|
var missing = (0, MissingPropsMessage_1.missingKeys)(requiredProps, evaluatedOptionsToUse);
|
|
1805
|
+
|
|
1580
1806
|
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
|
|
1581
1807
|
) {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1808
|
+
return React.createElement(MissingPropsMessage_1.default, {
|
|
1809
|
+
"data-test": "missing-props-message",
|
|
1810
|
+
width: width,
|
|
1811
|
+
height: height,
|
|
1812
|
+
missingProps: missing,
|
|
1813
|
+
backgroundColor: bgColorFromTheme
|
|
1814
|
+
});
|
|
1815
|
+
} // events
|
|
1816
|
+
|
|
1817
|
+
|
|
1591
1818
|
var eventCallbackProps = {};
|
|
1819
|
+
|
|
1592
1820
|
if (hasEventHandlers && mode === 'view' && vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.EVENTS) > -1) {
|
|
1593
1821
|
var supportedEvents = vizConfig.events;
|
|
1594
1822
|
Object.keys(supportedEvents).forEach(function (eventName) {
|
|
1595
|
-
var
|
|
1596
|
-
|
|
1597
|
-
|
|
1823
|
+
var _supportedEvents$even = supportedEvents[eventName],
|
|
1824
|
+
parentKeys = _supportedEvents$even.parentKeys,
|
|
1825
|
+
payloadKeys = _supportedEvents$even.payloadKeys;
|
|
1826
|
+
var eventCallbackPropName = (0, lodash_1.camelCase)("on.".concat(eventName)); // todo: refactor single value and single value icon to send payload from viz
|
|
1598
1827
|
// then remove these lines
|
|
1599
|
-
|
|
1828
|
+
|
|
1600
1829
|
var payload = {};
|
|
1830
|
+
|
|
1601
1831
|
if (Array.isArray(payloadKeys) && payloadKeys.length) {
|
|
1602
1832
|
payloadKeys.forEach(function (p) {
|
|
1603
1833
|
payload[p] = evaluatedOptionsToUse[p];
|
|
1604
1834
|
});
|
|
1605
1835
|
}
|
|
1836
|
+
|
|
1606
1837
|
eventCallbackProps[eventCallbackPropName] = function (ev) {
|
|
1607
1838
|
if (ev && ev.payload) {
|
|
1608
1839
|
payload = ev.payload;
|
|
1609
1840
|
}
|
|
1841
|
+
|
|
1610
1842
|
return onEventTrigger({
|
|
1611
1843
|
originalEvent: ev,
|
|
1612
1844
|
payload: payload,
|
|
1613
1845
|
type: eventName
|
|
1614
1846
|
});
|
|
1615
1847
|
};
|
|
1848
|
+
|
|
1849
|
+
if (parentKeys) {
|
|
1850
|
+
for (var i = parentKeys.length - 1; i >= 0; i -= 1) {
|
|
1851
|
+
var newObject = {};
|
|
1852
|
+
newObject[parentKeys[i]] = eventCallbackProps[eventCallbackPropName];
|
|
1853
|
+
eventCallbackProps[eventCallbackPropName] = newObject;
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1616
1856
|
});
|
|
1617
|
-
}
|
|
1618
|
-
|
|
1857
|
+
} // compute pure viz props which are not from options
|
|
1858
|
+
|
|
1859
|
+
|
|
1619
1860
|
var computedVizProps = computeVizProps(Object.assign(Object.assign(Object.assign(Object.assign({}, props), evaluatedOptionsToUse), eventCallbackProps), {
|
|
1620
1861
|
themeFunc: themeFunc
|
|
1621
1862
|
}));
|
|
@@ -1633,15 +1874,19 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1633
1874
|
* In future, we could automatically detect which all datasources are being used
|
|
1634
1875
|
* and bind those magically to pagination/sorting behavior.
|
|
1635
1876
|
*/
|
|
1877
|
+
|
|
1636
1878
|
var dataSourceMetadata = {};
|
|
1637
1879
|
var OptionKey = 'paginateDataSourceKey';
|
|
1638
1880
|
var paginateDataSourceKey = (0, lodash_1.has)(evaluatedOptionsToUse, OptionKey) && evaluatedOptionsToUse[OptionKey] || 'primary';
|
|
1881
|
+
|
|
1639
1882
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.PAGE_AND_SORT) > -1 && (0, lodash_1.has)(dataSources, paginateDataSourceKey)) {
|
|
1640
1883
|
var requestParams = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'requestParams'], {});
|
|
1641
1884
|
var meta = (0, lodash_1.get)(dataSources, [paginateDataSourceKey, 'meta'], {});
|
|
1885
|
+
|
|
1642
1886
|
var handleRequestParamsChange = function handleRequestParamsChange(payload) {
|
|
1643
1887
|
return onRequestParamsChange(paginateDataSourceKey, payload);
|
|
1644
1888
|
};
|
|
1889
|
+
|
|
1645
1890
|
var sortParams = (0, getSorting_1.getSortingParams)({
|
|
1646
1891
|
requestParams: requestParams,
|
|
1647
1892
|
meta: meta,
|
|
@@ -1656,49 +1901,46 @@ var withDashboardViz = function withDashboardViz(opts) {
|
|
|
1656
1901
|
sortParams: sortParams,
|
|
1657
1902
|
paginatorParams: paginatorParams
|
|
1658
1903
|
};
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1904
|
+
} // if were using webworkers and this is the first render we dont want to show a viz with missing data so we return null
|
|
1905
|
+
|
|
1906
|
+
|
|
1661
1907
|
if (useAsyncEvaluatedOptions && Object.keys(evaluatedOptionsToUse).length === 0) {
|
|
1662
1908
|
return null;
|
|
1663
1909
|
}
|
|
1910
|
+
|
|
1664
1911
|
return React.createElement(SanitizedReactViz, Object.assign({
|
|
1665
1912
|
mode: mode,
|
|
1666
1913
|
width: width,
|
|
1667
1914
|
height: height
|
|
1668
1915
|
}, evaluatedOptionsToUse, computedVizProps, eventCallbackProps, dataSourceMetadata));
|
|
1669
1916
|
};
|
|
1917
|
+
|
|
1670
1918
|
DashboardViz.propTypes = Object.assign(Object.assign({}, SplunkVisualization_1.default.propTypes), ReactViz.propTypes);
|
|
1671
1919
|
DashboardViz.defaultProps = Object.assign(Object.assign(Object.assign({}, SplunkVisualization_1.default.defaultProps), ReactViz.defaultProps), {
|
|
1672
1920
|
// using withTheme requires component to receive theme prop. In case the consumer did not provide ThemeProvider, a default empty object will prevent warnings.
|
|
1673
1921
|
theme: {}
|
|
1674
|
-
});
|
|
1675
|
-
// attach viz config
|
|
1676
|
-
DashboardViz.config = vizConfig;
|
|
1677
|
-
// @ts-ignore: TODO fix sc upgrade TS issues
|
|
1678
|
-
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1679
|
-
};
|
|
1680
|
-
exports.default = withDashboardViz;
|
|
1922
|
+
}); // attach viz config
|
|
1681
1923
|
|
|
1682
|
-
|
|
1924
|
+
DashboardViz.config = vizConfig; // @ts-ignore: TODO fix sc upgrade TS issues
|
|
1683
1925
|
|
|
1684
|
-
|
|
1685
|
-
|
|
1926
|
+
return (0, styled_components_1.withTheme)((0, withPlaceholder_1.default)((0, withEditModeCover_1.default)(DashboardViz, disableEditModeCover), useIconPlaceholder));
|
|
1927
|
+
};
|
|
1686
1928
|
|
|
1687
|
-
|
|
1929
|
+
exports.default = withDashboardViz;
|
|
1688
1930
|
|
|
1689
1931
|
/***/ }),
|
|
1690
1932
|
|
|
1691
1933
|
/***/ 38:
|
|
1692
1934
|
/***/ (function(module, exports) {
|
|
1693
1935
|
|
|
1694
|
-
module.exports = require("@splunk/
|
|
1936
|
+
module.exports = require("@splunk/themes/getSettingsFromThemedProps");
|
|
1695
1937
|
|
|
1696
1938
|
/***/ }),
|
|
1697
1939
|
|
|
1698
1940
|
/***/ 39:
|
|
1699
1941
|
/***/ (function(module, exports) {
|
|
1700
1942
|
|
|
1701
|
-
module.exports = require("@splunk/
|
|
1943
|
+
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
1702
1944
|
|
|
1703
1945
|
/***/ }),
|
|
1704
1946
|
|
|
@@ -1712,137 +1954,14 @@ module.exports = require("styled-components");
|
|
|
1712
1954
|
/***/ 40:
|
|
1713
1955
|
/***/ (function(module, exports) {
|
|
1714
1956
|
|
|
1715
|
-
module.exports = require("@splunk/
|
|
1957
|
+
module.exports = require("@splunk/moment");
|
|
1716
1958
|
|
|
1717
1959
|
/***/ }),
|
|
1718
1960
|
|
|
1719
1961
|
/***/ 41:
|
|
1720
|
-
/***/ (function(module, exports
|
|
1721
|
-
|
|
1722
|
-
"use strict";
|
|
1723
|
-
|
|
1962
|
+
/***/ (function(module, exports) {
|
|
1724
1963
|
|
|
1725
|
-
|
|
1726
|
-
Object.defineProperty(exports, "__esModule", {
|
|
1727
|
-
value: true
|
|
1728
|
-
});
|
|
1729
|
-
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
1730
|
-
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
1731
|
-
var T = __webpack_require__(0);
|
|
1732
|
-
var lodash_1 = __webpack_require__(3);
|
|
1733
|
-
var VizActionHandler_1 = __webpack_require__(42);
|
|
1734
|
-
// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
1735
|
-
exports.INITIAL_WIDTH = 250;
|
|
1736
|
-
exports.INITIAL_HEIGHT = 250;
|
|
1737
|
-
/**
|
|
1738
|
-
* A Splunk visualization
|
|
1739
|
-
*/
|
|
1740
|
-
var SplunkVisualization = function SplunkVisualization() {
|
|
1741
|
-
_classCallCheck(this, SplunkVisualization);
|
|
1742
|
-
};
|
|
1743
|
-
SplunkVisualization.propTypes = {
|
|
1744
|
-
/**
|
|
1745
|
-
* display mode
|
|
1746
|
-
*/
|
|
1747
|
-
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
1748
|
-
/**
|
|
1749
|
-
* width in pixel or string, defaults to 100%
|
|
1750
|
-
*/
|
|
1751
|
-
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
1752
|
-
/**
|
|
1753
|
-
* height in pixel or string
|
|
1754
|
-
*/
|
|
1755
|
-
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
1756
|
-
/**
|
|
1757
|
-
* visualization context used for dynamic option evaluation
|
|
1758
|
-
*/
|
|
1759
|
-
context: T.object,
|
|
1760
|
-
/**
|
|
1761
|
-
* visualization formatting options
|
|
1762
|
-
*/
|
|
1763
|
-
options: T.object,
|
|
1764
|
-
/**
|
|
1765
|
-
* A callback to update formatting options
|
|
1766
|
-
*/
|
|
1767
|
-
onOptionsChange: T.func,
|
|
1768
|
-
/**
|
|
1769
|
-
* datasource state which include data and request params, object key indicate the datasource type.
|
|
1770
|
-
*/
|
|
1771
|
-
dataSources: T.objectOf(T.shape({
|
|
1772
|
-
/**
|
|
1773
|
-
* current request params
|
|
1774
|
-
*/
|
|
1775
|
-
requestParams: T.object,
|
|
1776
|
-
/**
|
|
1777
|
-
* current dataset
|
|
1778
|
-
*/
|
|
1779
|
-
data: T.shape({
|
|
1780
|
-
fields: T.array,
|
|
1781
|
-
columns: T.array
|
|
1782
|
-
}),
|
|
1783
|
-
/**
|
|
1784
|
-
* error
|
|
1785
|
-
*/
|
|
1786
|
-
error: T.shape({
|
|
1787
|
-
level: T.string,
|
|
1788
|
-
message: T.string
|
|
1789
|
-
}),
|
|
1790
|
-
/**
|
|
1791
|
-
* meta data that came with the dataset
|
|
1792
|
-
*/
|
|
1793
|
-
meta: T.object
|
|
1794
|
-
})),
|
|
1795
|
-
/**
|
|
1796
|
-
* A callback to trigger event
|
|
1797
|
-
*/
|
|
1798
|
-
onEventTrigger: T.func,
|
|
1799
|
-
/**
|
|
1800
|
-
* Inform viz if there are handlers listening to events
|
|
1801
|
-
*/
|
|
1802
|
-
hasEventHandlers: T.bool,
|
|
1803
|
-
/**
|
|
1804
|
-
* A callback to communicate computed props to a consumer
|
|
1805
|
-
*/
|
|
1806
|
-
onComputedProps: T.func,
|
|
1807
|
-
/**
|
|
1808
|
-
* A callback to obtain visualization api
|
|
1809
|
-
*/
|
|
1810
|
-
vizActionHandlerRef: T.func,
|
|
1811
|
-
loading: T.bool,
|
|
1812
|
-
theme: T.object,
|
|
1813
|
-
/**
|
|
1814
|
-
* A callback to request new data with updated request params
|
|
1815
|
-
*/
|
|
1816
|
-
onRequestParamsChange: T.func
|
|
1817
|
-
};
|
|
1818
|
-
/**
|
|
1819
|
-
*
|
|
1820
|
-
*/
|
|
1821
|
-
SplunkVisualization.defaultProps = {
|
|
1822
|
-
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
1823
|
-
width: '100%',
|
|
1824
|
-
height: exports.INITIAL_HEIGHT,
|
|
1825
|
-
dataSources: {},
|
|
1826
|
-
onEventTrigger: function onEventTrigger() {
|
|
1827
|
-
return {};
|
|
1828
|
-
},
|
|
1829
|
-
mode: 'view',
|
|
1830
|
-
hasEventHandlers: false,
|
|
1831
|
-
options: {},
|
|
1832
|
-
context: {},
|
|
1833
|
-
onOptionsChange: function onOptionsChange() {
|
|
1834
|
-
return {};
|
|
1835
|
-
},
|
|
1836
|
-
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
1837
|
-
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
1838
|
-
},
|
|
1839
|
-
onComputedProps: function onComputedProps() {
|
|
1840
|
-
return {};
|
|
1841
|
-
},
|
|
1842
|
-
loading: false,
|
|
1843
|
-
onRequestParamsChange: lodash_1.noop
|
|
1844
|
-
};
|
|
1845
|
-
exports.default = SplunkVisualization;
|
|
1964
|
+
module.exports = require("@splunk/async-dynamic-options-evaluator");
|
|
1846
1965
|
|
|
1847
1966
|
/***/ }),
|
|
1848
1967
|
|
|
@@ -1854,74 +1973,98 @@ exports.default = SplunkVisualization;
|
|
|
1854
1973
|
|
|
1855
1974
|
var __rest = this && this.__rest || function (s, e) {
|
|
1856
1975
|
var t = {};
|
|
1976
|
+
|
|
1857
1977
|
for (var p in s) {
|
|
1858
1978
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
1859
1979
|
}
|
|
1980
|
+
|
|
1860
1981
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1861
1982
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
1862
1983
|
}
|
|
1863
1984
|
return t;
|
|
1864
1985
|
};
|
|
1986
|
+
|
|
1865
1987
|
Object.defineProperty(exports, "__esModule", {
|
|
1866
1988
|
value: true
|
|
1867
1989
|
});
|
|
1868
1990
|
exports.PureMap = exports.config = exports.themes = exports.useIconPlaceholder = exports.computeVizProps = void 0;
|
|
1869
1991
|
/* eslint-disable no-sequences */
|
|
1992
|
+
|
|
1870
1993
|
var React = __webpack_require__(1);
|
|
1994
|
+
|
|
1871
1995
|
var colorUtils_1 = __webpack_require__(12);
|
|
1996
|
+
|
|
1872
1997
|
var hocUtils_1 = __webpack_require__(27);
|
|
1998
|
+
|
|
1873
1999
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
2000
|
+
|
|
1874
2001
|
var PureMap_1 = __webpack_require__(411);
|
|
2002
|
+
|
|
1875
2003
|
exports.PureMap = PureMap_1.default;
|
|
2004
|
+
|
|
1876
2005
|
var config_1 = __webpack_require__(421);
|
|
2006
|
+
|
|
1877
2007
|
exports.config = config_1.default;
|
|
1878
|
-
|
|
2008
|
+
|
|
2009
|
+
var withDashboardViz_1 = __webpack_require__(37);
|
|
2010
|
+
|
|
1879
2011
|
var mapUtils_1 = __webpack_require__(422);
|
|
2012
|
+
|
|
1880
2013
|
var BubbleLayer_1 = __webpack_require__(131);
|
|
2014
|
+
|
|
1881
2015
|
var dataUtils_1 = __webpack_require__(121);
|
|
2016
|
+
|
|
1882
2017
|
var formatLayer = function formatLayer(l, dataFields, dataSourceData, transformedData) {
|
|
1883
2018
|
// add key `geobin` to the layer object if the data is returned from geostats commands
|
|
1884
2019
|
// to distinguish geostats commands from table commands
|
|
1885
2020
|
var geobinIdx = dataFields.indexOf('geobin');
|
|
1886
2021
|
var layer = l;
|
|
2022
|
+
|
|
1887
2023
|
if (geobinIdx > -1) {
|
|
1888
2024
|
layer.geobin = dataSourceData.columns[geobinIdx];
|
|
1889
|
-
}
|
|
1890
|
-
|
|
2025
|
+
} // similarly add key `geom` to layer object for choropleths
|
|
2026
|
+
|
|
2027
|
+
|
|
1891
2028
|
var geomIdx = dataFields.indexOf('geom');
|
|
2029
|
+
|
|
1892
2030
|
if (geomIdx > -1) {
|
|
1893
2031
|
layer.geom = dataSourceData.columns[geomIdx].map(function (geomItem) {
|
|
1894
2032
|
return typeof geomItem === 'string' ? JSON.parse(geomItem) : geomItem;
|
|
1895
2033
|
});
|
|
1896
|
-
}
|
|
1897
|
-
|
|
2034
|
+
} // Sanitize colors within layers
|
|
2035
|
+
|
|
2036
|
+
|
|
1898
2037
|
if (Object.prototype.hasOwnProperty.call(layer, 'seriesColors')) {
|
|
1899
2038
|
layer.seriesColors = Array.isArray(layer.seriesColors) ? (0, colorUtils_1.sanitizeArrayOfColors)(layer.seriesColors) : undefined;
|
|
1900
2039
|
}
|
|
2040
|
+
|
|
1901
2041
|
if (Object.prototype.hasOwnProperty.call(layer, 'dataColors')) {
|
|
1902
2042
|
layer.dataColors = Array.isArray(layer.dataColors) ? (0, colorUtils_1.sanitizeArrayOfColors)(layer.dataColors) : undefined;
|
|
1903
2043
|
}
|
|
2044
|
+
|
|
1904
2045
|
layer.metadata = transformedData;
|
|
1905
2046
|
};
|
|
2047
|
+
|
|
1906
2048
|
var computeVizProps = function computeVizProps(props) {
|
|
1907
2049
|
var _a, _b, _c;
|
|
2050
|
+
|
|
1908
2051
|
var themeFunc = props.themeFunc,
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
2052
|
+
theme = props.theme,
|
|
2053
|
+
layers = props.layers,
|
|
2054
|
+
dataSources = props.dataSources,
|
|
2055
|
+
onOptionsChange = props.onOptionsChange,
|
|
2056
|
+
title = props.title;
|
|
1914
2057
|
var themeColorVariables = ['controlBackgroundColor', 'controlForegroundColor'];
|
|
1915
2058
|
var themeColors = {};
|
|
1916
2059
|
themeColorVariables.forEach(function (variable) {
|
|
1917
2060
|
themeColors[variable] = themeFunc(variable);
|
|
1918
|
-
});
|
|
1919
|
-
// Markers use different icons, Bubbles has different styles for light and dark theme
|
|
2061
|
+
}); // Markers use different icons, Bubbles has different styles for light and dark theme
|
|
1920
2062
|
// this prop is passed for that
|
|
2063
|
+
|
|
1921
2064
|
var themeColorScheme = (theme === null || theme === void 0 ? void 0 : theme.splunkThemeV1) ? theme === null || theme === void 0 ? void 0 : theme.splunkThemeV1.colorScheme : 'dark';
|
|
1922
|
-
var dataSourceData = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : {};
|
|
1923
|
-
// transforms data structure into array of objects to allow for indexing metadata at layer level
|
|
2065
|
+
var dataSourceData = (_b = (_a = dataSources === null || dataSources === void 0 ? void 0 : dataSources.primary) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : {}; // transforms data structure into array of objects to allow for indexing metadata at layer level
|
|
1924
2066
|
// TODO: explore any potential changes when multiple layers are supported
|
|
2067
|
+
|
|
1925
2068
|
var transformedData = (0, dataUtils_1.convertToArrOfObjects)(dataSourceData.columns, dataSourceData.fields);
|
|
1926
2069
|
var dataFields = ((_c = dataSourceData.fields) !== null && _c !== void 0 ? _c : []).map(function (field) {
|
|
1927
2070
|
return typeof field === 'string' ? field : field.name;
|
|
@@ -1936,29 +2079,37 @@ var computeVizProps = function computeVizProps(props) {
|
|
|
1936
2079
|
title: title
|
|
1937
2080
|
});
|
|
1938
2081
|
};
|
|
2082
|
+
|
|
1939
2083
|
exports.computeVizProps = computeVizProps;
|
|
2084
|
+
|
|
1940
2085
|
var withTooltipFields = function withTooltipFields(Viz) {
|
|
1941
2086
|
var VizWithTooltipFields = function VizWithTooltipFields(_a) {
|
|
1942
2087
|
var _b, _c, _d;
|
|
2088
|
+
|
|
1943
2089
|
var dataSources = _a.dataSources,
|
|
1944
|
-
|
|
1945
|
-
|
|
2090
|
+
options = _a.options,
|
|
2091
|
+
otherProps = __rest(_a, ["dataSources", "options"]);
|
|
2092
|
+
|
|
1946
2093
|
if (!dataSources || !dataSources.primary || !dataSources.primary.data) {
|
|
1947
2094
|
return React.createElement(Viz, Object.assign({}, otherProps, {
|
|
1948
2095
|
options: options
|
|
1949
2096
|
}));
|
|
1950
2097
|
}
|
|
2098
|
+
|
|
1951
2099
|
var mergedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(config_1.default.optionsSchema, 'default'));
|
|
2100
|
+
|
|
1952
2101
|
if ((_b = mergedOptions.layers) === null || _b === void 0 ? void 0 : _b[0]) {
|
|
1953
2102
|
if (((_d = (_c = mergedOptions.layers) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.type) === 'bubble') {
|
|
1954
2103
|
// make sure bubbleSize and bubbleSizeFields dsl evaluation happen at the last HOC "withDashboardViz".
|
|
1955
2104
|
// so value/type augmentation in the HOCs stay consistent
|
|
1956
2105
|
mergedOptions.layers[0].bubbleSizeFields = '> bubbleSize | getField()';
|
|
1957
2106
|
}
|
|
2107
|
+
|
|
1958
2108
|
var fields = dataSources.primary.data.fields;
|
|
2109
|
+
|
|
1959
2110
|
if (Array.isArray(mergedOptions.layers[0].additionalTooltipFields) && Array.isArray(fields) && fields.length) {
|
|
1960
2111
|
var _mergedOptions$layers = mergedOptions.layers[0].bubbleSizeFields,
|
|
1961
|
-
|
|
2112
|
+
bubbleSizeFields = _mergedOptions$layers === void 0 ? [] : _mergedOptions$layers;
|
|
1962
2113
|
mergedOptions.layers[0].additionalTooltipFields = mergedOptions.layers[0].additionalTooltipFields.filter(function (field) {
|
|
1963
2114
|
return (typeof fields[0] === 'string' ? fields.includes(field) : fields.map(function (f) {
|
|
1964
2115
|
return f.name;
|
|
@@ -1966,38 +2117,46 @@ var withTooltipFields = function withTooltipFields(Viz) {
|
|
|
1966
2117
|
});
|
|
1967
2118
|
}
|
|
1968
2119
|
}
|
|
2120
|
+
|
|
1969
2121
|
return React.createElement(Viz, Object.assign({
|
|
1970
2122
|
dataSources: dataSources,
|
|
1971
2123
|
options: mergedOptions
|
|
1972
2124
|
}, otherProps));
|
|
1973
2125
|
};
|
|
2126
|
+
|
|
1974
2127
|
VizWithTooltipFields.propTypes = Viz.propTypes;
|
|
1975
2128
|
VizWithTooltipFields.defaultProps = Viz.defaultProps;
|
|
1976
2129
|
VizWithTooltipFields.config = Viz.config;
|
|
1977
2130
|
return VizWithTooltipFields;
|
|
1978
|
-
};
|
|
1979
|
-
|
|
2131
|
+
}; // HOC for stripping the internal fields for Maps
|
|
2132
|
+
|
|
2133
|
+
|
|
1980
2134
|
var withoutInternalFields = function withoutInternalFields(Viz) {
|
|
1981
2135
|
// eslint-disable-next-line react/display-name
|
|
1982
2136
|
var VizWithoutInternalFields = function VizWithoutInternalFields(_a) {
|
|
1983
2137
|
var dataSources = _a.dataSources,
|
|
1984
|
-
|
|
2138
|
+
otherProps = __rest(_a, ["dataSources"]);
|
|
2139
|
+
|
|
1985
2140
|
if (!dataSources || !dataSources.primary || !dataSources.primary.data) {
|
|
1986
2141
|
return React.createElement(Viz, Object.assign({}, otherProps));
|
|
1987
2142
|
}
|
|
2143
|
+
|
|
1988
2144
|
var primary = dataSources.primary;
|
|
1989
2145
|
var _primary$data = primary.data,
|
|
1990
|
-
|
|
1991
|
-
|
|
2146
|
+
columns = _primary$data.columns,
|
|
2147
|
+
fields = _primary$data.fields;
|
|
1992
2148
|
var newColumns = [];
|
|
1993
2149
|
var newFields = [];
|
|
2150
|
+
|
|
1994
2151
|
if (fields && columns && fields.length === columns.length) {
|
|
1995
2152
|
// computed sorted index for removal
|
|
1996
2153
|
var indicesToRemove = new Set(fields.reduce(function (arr, e, i) {
|
|
1997
2154
|
var field = typeof e === 'string' ? e : e.name.toString();
|
|
2155
|
+
|
|
1998
2156
|
if (field.startsWith('_') && !field.startsWith(BubbleLayer_1.GEO_BOUND_PREFIX) && !BubbleLayer_1.GEO_LAT_AND_LONG_FIELD.includes(field)) {
|
|
1999
2157
|
arr.push(i);
|
|
2000
2158
|
}
|
|
2159
|
+
|
|
2001
2160
|
return arr;
|
|
2002
2161
|
}, []));
|
|
2003
2162
|
newFields = fields.filter(function (d, i) {
|
|
@@ -2007,6 +2166,7 @@ var withoutInternalFields = function withoutInternalFields(Viz) {
|
|
|
2007
2166
|
return !indicesToRemove.has(i);
|
|
2008
2167
|
});
|
|
2009
2168
|
}
|
|
2169
|
+
|
|
2010
2170
|
var modifiedDatasources = Object.assign(Object.assign({}, dataSources), {
|
|
2011
2171
|
primary: Object.assign(Object.assign({}, primary), {
|
|
2012
2172
|
data: Object.assign(Object.assign({}, primary.data), {
|
|
@@ -2019,38 +2179,45 @@ var withoutInternalFields = function withoutInternalFields(Viz) {
|
|
|
2019
2179
|
dataSources: modifiedDatasources
|
|
2020
2180
|
}, otherProps));
|
|
2021
2181
|
};
|
|
2182
|
+
|
|
2022
2183
|
VizWithoutInternalFields.propTypes = Viz.propTypes;
|
|
2023
2184
|
VizWithoutInternalFields.defaultProps = Viz.defaultProps;
|
|
2024
2185
|
VizWithoutInternalFields.config = Viz.config;
|
|
2025
2186
|
return VizWithoutInternalFields;
|
|
2026
|
-
};
|
|
2027
|
-
// HOC for updating all null values in data columns to zeros
|
|
2187
|
+
}; // HOC for updating all null values in data columns to zeros
|
|
2028
2188
|
// excluding 'latitude', 'longitude' and 'geobin'
|
|
2189
|
+
|
|
2190
|
+
|
|
2029
2191
|
var withNullToZeros = function withNullToZeros(Viz) {
|
|
2030
2192
|
// eslint-disable-next-line react/display-name
|
|
2031
2193
|
var VizWithColumnsNullToZeros = function VizWithColumnsNullToZeros(_a) {
|
|
2032
2194
|
var dataSources = _a.dataSources,
|
|
2033
|
-
|
|
2034
|
-
|
|
2195
|
+
options = _a.options,
|
|
2196
|
+
otherProps = __rest(_a, ["dataSources", "options"]);
|
|
2197
|
+
|
|
2035
2198
|
if (!dataSources || !dataSources.primary || !dataSources.primary.data) {
|
|
2036
2199
|
return React.createElement(Viz, Object.assign({
|
|
2037
2200
|
options: options
|
|
2038
2201
|
}, otherProps));
|
|
2039
2202
|
}
|
|
2203
|
+
|
|
2040
2204
|
var modifiedDatasources = (0, mapUtils_1.columnsNullToZeros)(config_1.default, dataSources, options);
|
|
2041
2205
|
return React.createElement(Viz, Object.assign({
|
|
2042
2206
|
dataSources: modifiedDatasources,
|
|
2043
2207
|
options: options
|
|
2044
2208
|
}, otherProps));
|
|
2045
2209
|
};
|
|
2210
|
+
|
|
2046
2211
|
VizWithColumnsNullToZeros.propTypes = Viz.propTypes;
|
|
2047
2212
|
VizWithColumnsNullToZeros.defaultProps = Viz.defaultProps;
|
|
2048
2213
|
VizWithColumnsNullToZeros.config = Viz.config;
|
|
2049
2214
|
return VizWithColumnsNullToZeros;
|
|
2050
2215
|
};
|
|
2216
|
+
|
|
2051
2217
|
function useIconPlaceholder(dataSources, loading) {
|
|
2052
2218
|
return loading;
|
|
2053
2219
|
}
|
|
2220
|
+
|
|
2054
2221
|
exports.useIconPlaceholder = useIconPlaceholder;
|
|
2055
2222
|
var Map = withoutInternalFields(withTooltipFields(withNullToZeros((0, withDashboardViz_1.default)({
|
|
2056
2223
|
ReactViz: PureMap_1.default,
|
|
@@ -2072,23 +2239,38 @@ exports.default = Map;
|
|
|
2072
2239
|
|
|
2073
2240
|
|
|
2074
2241
|
var _slicedToArray = __webpack_require__(17);
|
|
2242
|
+
|
|
2075
2243
|
Object.defineProperty(exports, "__esModule", {
|
|
2076
2244
|
value: true
|
|
2077
2245
|
});
|
|
2078
2246
|
exports.isLatLng = exports.formatColor = exports.DEFAULT_ZOOM = exports.DEFAULT_SHOW_BASELAYER = exports.DEFAULT_SHOW_ZOOM_CONTROLS = exports.DEFAULT_SHOW_SCALE = exports.DEFAULT_SCALE_UNIT = exports.DEFAULT_CONTROL_FOREGROUND_COLOR = exports.DEFAULT_CONTROL_BACKGROUND_COLOR = exports.DEFAULT_CENTER = void 0;
|
|
2247
|
+
|
|
2079
2248
|
var React = __webpack_require__(1);
|
|
2249
|
+
|
|
2080
2250
|
var lodash_1 = __webpack_require__(3);
|
|
2251
|
+
|
|
2081
2252
|
var react_1 = __webpack_require__(1);
|
|
2253
|
+
|
|
2082
2254
|
var T = __webpack_require__(0);
|
|
2083
|
-
|
|
2084
|
-
var
|
|
2255
|
+
|
|
2256
|
+
var chroma = __webpack_require__(159);
|
|
2257
|
+
|
|
2258
|
+
var maplibre_gl_1 = __webpack_require__(160);
|
|
2259
|
+
|
|
2085
2260
|
var i18n_1 = __webpack_require__(2);
|
|
2261
|
+
|
|
2086
2262
|
var MapContext_1 = __webpack_require__(412);
|
|
2263
|
+
|
|
2087
2264
|
var PureMapContainer_1 = __webpack_require__(413);
|
|
2088
|
-
|
|
2265
|
+
|
|
2266
|
+
var MapUtils_1 = __webpack_require__(92);
|
|
2267
|
+
|
|
2089
2268
|
var ClusterLayer_1 = __webpack_require__(415);
|
|
2090
|
-
|
|
2269
|
+
|
|
2270
|
+
var ChoroplethLayer_1 = __webpack_require__(161);
|
|
2271
|
+
|
|
2091
2272
|
var LocalChoroplethLayer_1 = __webpack_require__(418);
|
|
2273
|
+
|
|
2092
2274
|
exports.DEFAULT_CENTER = [0, 0];
|
|
2093
2275
|
exports.DEFAULT_CONTROL_BACKGROUND_COLOR = '#2b3033';
|
|
2094
2276
|
exports.DEFAULT_CONTROL_FOREGROUND_COLOR = '#B5B5B5';
|
|
@@ -2096,8 +2278,8 @@ exports.DEFAULT_SCALE_UNIT = 'imperial';
|
|
|
2096
2278
|
exports.DEFAULT_SHOW_SCALE = true;
|
|
2097
2279
|
exports.DEFAULT_SHOW_ZOOM_CONTROLS = true;
|
|
2098
2280
|
exports.DEFAULT_SHOW_BASELAYER = true;
|
|
2099
|
-
exports.DEFAULT_ZOOM = 0;
|
|
2100
|
-
|
|
2281
|
+
exports.DEFAULT_ZOOM = 0; // convert rgb/rgba/hex color to encoded color & opacity for SVG strings
|
|
2282
|
+
|
|
2101
2283
|
var formatColor = function formatColor(color) {
|
|
2102
2284
|
var chromaColor = chroma(color);
|
|
2103
2285
|
return {
|
|
@@ -2105,94 +2287,115 @@ var formatColor = function formatColor(color) {
|
|
|
2105
2287
|
opacity: chromaColor.alpha()
|
|
2106
2288
|
};
|
|
2107
2289
|
};
|
|
2290
|
+
|
|
2108
2291
|
exports.formatColor = formatColor;
|
|
2109
2292
|
PureMapContainer_1.default.displayName = 'PureMapContainer';
|
|
2293
|
+
|
|
2110
2294
|
var PureMap = function PureMap(props) {
|
|
2111
2295
|
var width = props.width,
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2296
|
+
height = props.height,
|
|
2297
|
+
backgroundColor = props.backgroundColor,
|
|
2298
|
+
baseLayerTileServer = props.baseLayerTileServer,
|
|
2299
|
+
baseLayerTileServerType = props.baseLayerTileServerType,
|
|
2300
|
+
center = props.center,
|
|
2301
|
+
controlBackgroundColor = props.controlBackgroundColor,
|
|
2302
|
+
controlForegroundColor = props.controlForegroundColor,
|
|
2303
|
+
_props$layers = props.layers,
|
|
2304
|
+
layers = _props$layers === void 0 ? [] : _props$layers,
|
|
2305
|
+
scaleUnit = props.scaleUnit,
|
|
2306
|
+
showScale = props.showScale,
|
|
2307
|
+
showZoomControls = props.showZoomControls,
|
|
2308
|
+
showBaseLayer = props.showBaseLayer,
|
|
2309
|
+
themeColorScheme = props.themeColorScheme,
|
|
2310
|
+
zoom = props.zoom,
|
|
2311
|
+
onMapLoad = props.onMapLoad,
|
|
2312
|
+
onMapClick = props.onMapClick,
|
|
2313
|
+
onOptionsChange = props.onOptionsChange,
|
|
2314
|
+
mode = props.mode,
|
|
2315
|
+
title = props.title;
|
|
2316
|
+
|
|
2132
2317
|
var _ref = (0, react_1.useContext)(MapContext_1.default),
|
|
2133
|
-
|
|
2134
|
-
|
|
2318
|
+
defaultTileConfig = _ref.defaultTileConfig,
|
|
2319
|
+
customTileConfig = _ref.customTileConfig;
|
|
2320
|
+
|
|
2135
2321
|
var basemapContainer = (0, react_1.useRef)(null);
|
|
2136
2322
|
var map = (0, react_1.useRef)(null);
|
|
2137
2323
|
var scaleControl = (0, react_1.useRef)(null);
|
|
2138
2324
|
var zoomControl = (0, react_1.useRef)(null);
|
|
2325
|
+
|
|
2139
2326
|
var _ref2 = (0, react_1.useMemo)(function () {
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2327
|
+
return (0, MapUtils_1.getTilePreset)({
|
|
2328
|
+
defaultTileConfig: defaultTileConfig,
|
|
2329
|
+
customTileConfig: customTileConfig
|
|
2330
|
+
});
|
|
2331
|
+
}, [defaultTileConfig, customTileConfig]),
|
|
2332
|
+
tilePreset = _ref2.tilePreset,
|
|
2333
|
+
defaultTileLight = _ref2.defaultTileLight,
|
|
2334
|
+
defaultTileDark = _ref2.defaultTileDark;
|
|
2335
|
+
|
|
2148
2336
|
var _React$useState = React.useState(zoom !== null && zoom !== void 0 ? zoom : exports.DEFAULT_ZOOM),
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2337
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2338
|
+
currentZoomLevel = _React$useState2[0],
|
|
2339
|
+
_setCurrentZoomLevel = _React$useState2[1];
|
|
2340
|
+
|
|
2152
2341
|
var currentZoomLevelRef = (0, react_1.useRef)(currentZoomLevel);
|
|
2342
|
+
|
|
2153
2343
|
var setCurrentZoomLevel = function setCurrentZoomLevel(newZoom) {
|
|
2154
2344
|
currentZoomLevelRef.current = newZoom;
|
|
2345
|
+
|
|
2155
2346
|
_setCurrentZoomLevel(newZoom);
|
|
2156
2347
|
};
|
|
2348
|
+
|
|
2157
2349
|
var _React$useState3 = React.useState(false),
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2350
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
2351
|
+
isMapLoaded = _React$useState4[0],
|
|
2352
|
+
setMapIsLoaded = _React$useState4[1];
|
|
2353
|
+
|
|
2161
2354
|
var _React$useState5 = React.useState(false),
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2355
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
2356
|
+
isThemeChanged = _React$useState6[0],
|
|
2357
|
+
setIsThemeChanged = _React$useState6[1]; // We are tracking mapMinZoom, which is the smallest zoom the map is capable of doing
|
|
2165
2358
|
// This is because DEFAULT_ZOOM of 0 is sometimes not possible for maps with height > 500.
|
|
2166
2359
|
// The map will do a little shake when it tries, and then auto change zoom value to mapMinZoom.
|
|
2167
2360
|
// Interestingly, the larger the map height, the larger the mapMinZoom is.
|
|
2168
2361
|
// For some reason, map.getMinZoom() is always 0, might be a MapLibre bug.
|
|
2362
|
+
|
|
2363
|
+
|
|
2169
2364
|
var _React$useState7 = React.useState(-1),
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2365
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
2366
|
+
mapMinZoom = _React$useState8[0],
|
|
2367
|
+
_setMapMinZoom = _React$useState8[1];
|
|
2368
|
+
|
|
2173
2369
|
var mapMinZoomRef = (0, react_1.useRef)(mapMinZoom);
|
|
2370
|
+
|
|
2174
2371
|
var setMapMinZoom = function setMapMinZoom(newMinZoom) {
|
|
2175
2372
|
mapMinZoomRef.current = newMinZoom;
|
|
2373
|
+
|
|
2176
2374
|
_setMapMinZoom(newMinZoom);
|
|
2177
|
-
};
|
|
2178
|
-
|
|
2375
|
+
}; // Assign default center when no center is defined
|
|
2376
|
+
|
|
2377
|
+
|
|
2179
2378
|
var lngLatCenter = (0, react_1.useMemo)(function () {
|
|
2180
2379
|
if (!(0, MapUtils_1.isValidLatLon)(center)) {
|
|
2181
2380
|
return exports.DEFAULT_CENTER;
|
|
2182
2381
|
}
|
|
2382
|
+
|
|
2183
2383
|
return [center[1], center[0]];
|
|
2184
|
-
}, [center]);
|
|
2185
|
-
// TODO: take out zoomLevel to use zoom instead (set prop zoom = DEFAULT_ZOOM)
|
|
2384
|
+
}, [center]); // TODO: take out zoomLevel to use zoom instead (set prop zoom = DEFAULT_ZOOM)
|
|
2186
2385
|
// Assign default zoom when no zoom is defined
|
|
2386
|
+
|
|
2187
2387
|
var zoomLevel = (0, react_1.useMemo)(function () {
|
|
2188
2388
|
if (zoom === undefined) {
|
|
2189
2389
|
return exports.DEFAULT_ZOOM;
|
|
2190
2390
|
}
|
|
2391
|
+
|
|
2191
2392
|
return zoom;
|
|
2192
2393
|
}, [zoom]);
|
|
2394
|
+
|
|
2193
2395
|
var setIsThemeChangedCallback = function setIsThemeChangedCallback(isMyThemeChanged) {
|
|
2194
2396
|
setIsThemeChanged(isMyThemeChanged);
|
|
2195
2397
|
};
|
|
2398
|
+
|
|
2196
2399
|
var onOptionsChangeProxy = (0, react_1.useCallback)(function (e) {
|
|
2197
2400
|
if (mode === 'edit') {
|
|
2198
2401
|
onOptionsChange(e);
|
|
@@ -2210,12 +2413,15 @@ var PureMap = function PureMap(props) {
|
|
|
2210
2413
|
// register event listener - zoom
|
|
2211
2414
|
map.current.on('zoomend', function () {
|
|
2212
2415
|
var mapZoomLevel = map.current.getZoom();
|
|
2416
|
+
|
|
2213
2417
|
if (mapZoomLevel < mapMinZoomRef.current) {
|
|
2214
2418
|
setMapMinZoom(mapZoomLevel);
|
|
2215
2419
|
}
|
|
2420
|
+
|
|
2216
2421
|
setCurrentZoomLevel(mapZoomLevel);
|
|
2217
2422
|
});
|
|
2218
2423
|
};
|
|
2424
|
+
|
|
2219
2425
|
map.current = new maplibre_gl_1.Map(Object.assign({
|
|
2220
2426
|
container: basemapContainer.current,
|
|
2221
2427
|
preserveDrawingBuffer: true,
|
|
@@ -2227,9 +2433,9 @@ var PureMap = function PureMap(props) {
|
|
|
2227
2433
|
macHelpText: (0, i18n_1._)('Use ⌘ + scroll to zoom map'),
|
|
2228
2434
|
mobileHelpText: (0, i18n_1._)('Use two fingers to move the map')
|
|
2229
2435
|
}
|
|
2230
|
-
}, (0, MapUtils_1.getZoomConstraintsFromTileConfig)(mapStyle, baseLayerTileServer)));
|
|
2231
|
-
// Fired immediately after all necessary resources have been downloaded
|
|
2436
|
+
}, (0, MapUtils_1.getZoomConstraintsFromTileConfig)(mapStyle, baseLayerTileServer))); // Fired immediately after all necessary resources have been downloaded
|
|
2232
2437
|
// and the first visually complete rendering of the map has occurred.
|
|
2438
|
+
|
|
2233
2439
|
map.current.on('load', function () {
|
|
2234
2440
|
if ((layers === null || layers === void 0 ? void 0 : layers.length) > 0 && center === undefined && zoom === undefined) {
|
|
2235
2441
|
setMapMinZoom(map.current.getZoom());
|
|
@@ -2240,16 +2446,17 @@ var PureMap = function PureMap(props) {
|
|
|
2240
2446
|
} else {
|
|
2241
2447
|
addZoomEndEventListener();
|
|
2242
2448
|
}
|
|
2243
|
-
|
|
2244
|
-
// TODO :- Temp timeout added for onMapLoad event to avoid flaky screenshots caused by
|
|
2449
|
+
|
|
2450
|
+
setMapIsLoaded(true); // TODO :- Temp timeout added for onMapLoad event to avoid flaky screenshots caused by
|
|
2245
2451
|
// https://maplibre.org/maplibre-gl-js-docs/api/map/#map#fitbounds. Need alternate approach to handle the same.
|
|
2452
|
+
|
|
2246
2453
|
setTimeout(function () {
|
|
2247
2454
|
if (onMapLoad && typeof onMapLoad.exec === 'function') {
|
|
2248
2455
|
onMapLoad.exec();
|
|
2249
2456
|
}
|
|
2250
2457
|
}, 500);
|
|
2251
|
-
});
|
|
2252
|
-
|
|
2458
|
+
}); // register event listener - drag
|
|
2459
|
+
|
|
2253
2460
|
map.current.on('dragend', function () {
|
|
2254
2461
|
var newCenter = map.current.getCenter();
|
|
2255
2462
|
onOptionsChangeProxy({
|
|
@@ -2258,15 +2465,15 @@ var PureMap = function PureMap(props) {
|
|
|
2258
2465
|
});
|
|
2259
2466
|
});
|
|
2260
2467
|
map.current.on('resize', function () {
|
|
2261
|
-
var mapZoomLevel = map.current.getZoom();
|
|
2262
|
-
// If the map's zoom value is at the min zoom, and the map did a resize
|
|
2468
|
+
var mapZoomLevel = map.current.getZoom(); // If the map's zoom value is at the min zoom, and the map did a resize
|
|
2263
2469
|
// sometimes the map will have a changed min zoom value.
|
|
2264
2470
|
// Then we want to update the map's min zoom value.
|
|
2471
|
+
|
|
2265
2472
|
if (currentZoomLevelRef.current <= mapMinZoomRef.current && mapZoomLevel !== mapMinZoomRef.current) {
|
|
2266
2473
|
setMapMinZoom(mapZoomLevel);
|
|
2267
2474
|
}
|
|
2268
|
-
});
|
|
2269
|
-
|
|
2475
|
+
}); // add zoom control
|
|
2476
|
+
|
|
2270
2477
|
zoomControl.current = new maplibre_gl_1.NavigationControl({
|
|
2271
2478
|
showCompass: false
|
|
2272
2479
|
});
|
|
@@ -2281,6 +2488,7 @@ var PureMap = function PureMap(props) {
|
|
|
2281
2488
|
}, [scaleUnit]);
|
|
2282
2489
|
var updateScale = (0, react_1.useCallback)(function () {
|
|
2283
2490
|
var _a;
|
|
2491
|
+
|
|
2284
2492
|
if (showScale) {
|
|
2285
2493
|
(_a = scaleControl === null || scaleControl === void 0 ? void 0 : scaleControl.current) === null || _a === void 0 ? void 0 : _a.setUnit(scaleUnit);
|
|
2286
2494
|
}
|
|
@@ -2299,6 +2507,7 @@ var PureMap = function PureMap(props) {
|
|
|
2299
2507
|
if (currentZoomLevel === mapMinZoomRef.current && (zoom === undefined || zoom < mapMinZoomRef.current)) {
|
|
2300
2508
|
return;
|
|
2301
2509
|
}
|
|
2510
|
+
|
|
2302
2511
|
var newCenter = map.current.getCenter();
|
|
2303
2512
|
onOptionsChangeProxy({
|
|
2304
2513
|
// when zooming with mouse/track pad,
|
|
@@ -2315,6 +2524,7 @@ var PureMap = function PureMap(props) {
|
|
|
2315
2524
|
console.warn('Map Tile Server configuration is missing or invalid. Please provide a valid configuration');
|
|
2316
2525
|
return;
|
|
2317
2526
|
}
|
|
2527
|
+
|
|
2318
2528
|
var mapStyle = (0, MapUtils_1.getMapStyle)({
|
|
2319
2529
|
showBaseLayer: showBaseLayer,
|
|
2320
2530
|
baseLayerTileServer: baseLayerTileServer,
|
|
@@ -2324,22 +2534,24 @@ var PureMap = function PureMap(props) {
|
|
|
2324
2534
|
defaultTileLight: defaultTileLight,
|
|
2325
2535
|
defaultTileDark: defaultTileDark
|
|
2326
2536
|
});
|
|
2327
|
-
mapStyle.version = MapUtils_1.MAP_STYLE_VERSION_NUMBER;
|
|
2328
|
-
|
|
2537
|
+
mapStyle.version = MapUtils_1.MAP_STYLE_VERSION_NUMBER; // If the map has already been initialized, we update the styles
|
|
2538
|
+
|
|
2329
2539
|
if (map.current) {
|
|
2330
2540
|
var curr = map.current.getStyle();
|
|
2331
|
-
var next = (0, lodash_1.omit)(mapStyle, ['theme', 'name', 'key']);
|
|
2332
|
-
// In dashboard studio this setStyle function is triggered by zoom changes as well
|
|
2541
|
+
var next = (0, lodash_1.omit)(mapStyle, ['theme', 'name', 'key']); // In dashboard studio this setStyle function is triggered by zoom changes as well
|
|
2333
2542
|
// Since setStyle will reset all style layers on the map including choropleth,
|
|
2334
2543
|
// we ONLY want to this to be called when there are style changes
|
|
2544
|
+
|
|
2335
2545
|
if (!(0, MapUtils_1.compareBaseStyles)(curr, next)) {
|
|
2336
2546
|
// Refer to https://maplibre.org/maplibre-gl-js-docs/api/map/#setstyle-example for options.diff (default is true)
|
|
2337
2547
|
map.current.setStyle((0, lodash_1.omit)(mapStyle, ['theme', 'name', 'key']));
|
|
2338
2548
|
setIsThemeChanged(true);
|
|
2339
2549
|
}
|
|
2550
|
+
|
|
2340
2551
|
var _ref3 = (0, MapUtils_1.getZoomConstraintsFromTileConfig)(mapStyle, baseLayerTileServer),
|
|
2341
|
-
|
|
2342
|
-
|
|
2552
|
+
minZoom = _ref3.minZoom,
|
|
2553
|
+
maxZoom = _ref3.maxZoom;
|
|
2554
|
+
|
|
2343
2555
|
map.current.setMinZoom(minZoom);
|
|
2344
2556
|
map.current.setMaxZoom(maxZoom);
|
|
2345
2557
|
updateScale();
|
|
@@ -2367,8 +2579,10 @@ var PureMap = function PureMap(props) {
|
|
|
2367
2579
|
}
|
|
2368
2580
|
};
|
|
2369
2581
|
}, []);
|
|
2582
|
+
|
|
2370
2583
|
var _layers = _slicedToArray(layers, 1),
|
|
2371
|
-
|
|
2584
|
+
layer = _layers[0];
|
|
2585
|
+
|
|
2372
2586
|
return React.createElement(React.Fragment, null, React.createElement(PureMapContainer_1.default, {
|
|
2373
2587
|
"aria-label": title || (0, i18n_1._)('Map'),
|
|
2374
2588
|
className: "puremap",
|
|
@@ -2403,21 +2617,27 @@ var PureMap = function PureMap(props) {
|
|
|
2403
2617
|
onMapClick: onMapClick
|
|
2404
2618
|
})));
|
|
2405
2619
|
};
|
|
2620
|
+
|
|
2406
2621
|
var isLatLng = function isLatLng(props, propName, componentName) {
|
|
2407
2622
|
if (!props[propName]) {
|
|
2408
2623
|
return null;
|
|
2409
2624
|
}
|
|
2625
|
+
|
|
2410
2626
|
var latAbs = Math.abs(props[propName][0]);
|
|
2411
2627
|
var lonAbs = Math.abs(props[propName][1]);
|
|
2412
2628
|
var latlon = props[propName];
|
|
2629
|
+
|
|
2413
2630
|
if (latAbs > MapUtils_1.MAX_LATITUDE && lonAbs <= MapUtils_1.MAX_LATITUDE) {
|
|
2414
2631
|
throw new Error("".concat(componentName, " ").concat(propName, " may have reversed [lat, lon] ranges."));
|
|
2415
2632
|
}
|
|
2633
|
+
|
|
2416
2634
|
if (!(0, MapUtils_1.isValidLatLon)(latlon)) {
|
|
2417
2635
|
throw new Error("".concat(componentName, " ").concat(propName, " incorrect [lat, lon] ranges."));
|
|
2418
2636
|
}
|
|
2637
|
+
|
|
2419
2638
|
return null;
|
|
2420
2639
|
};
|
|
2640
|
+
|
|
2421
2641
|
exports.isLatLng = isLatLng;
|
|
2422
2642
|
PureMap.propTypes = {
|
|
2423
2643
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
@@ -2492,10 +2712,15 @@ module.exports = require("@splunk/visualization-context/MapContext");
|
|
|
2492
2712
|
Object.defineProperty(exports, "__esModule", {
|
|
2493
2713
|
value: true
|
|
2494
2714
|
});
|
|
2715
|
+
|
|
2495
2716
|
var styled_components_1 = __webpack_require__(4);
|
|
2717
|
+
|
|
2496
2718
|
var lodash_1 = __webpack_require__(3);
|
|
2719
|
+
|
|
2497
2720
|
var style_1 = __webpack_require__(14);
|
|
2721
|
+
|
|
2498
2722
|
var maplibre_gl_css_1 = __webpack_require__(414);
|
|
2723
|
+
|
|
2499
2724
|
var PureMapContainer = styled_components_1.default.div.attrs({
|
|
2500
2725
|
'data-testid': 'puremap-container'
|
|
2501
2726
|
}).withConfig({
|
|
@@ -2550,17 +2775,24 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
2550
2775
|
Object.defineProperty(exports, "__esModule", {
|
|
2551
2776
|
value: true
|
|
2552
2777
|
});
|
|
2778
|
+
|
|
2553
2779
|
var React = __webpack_require__(1);
|
|
2780
|
+
|
|
2554
2781
|
var BubbleLayer_1 = __webpack_require__(131);
|
|
2782
|
+
|
|
2555
2783
|
var MarkerLayer_1 = __webpack_require__(417);
|
|
2556
|
-
|
|
2784
|
+
|
|
2785
|
+
var MapUtils_1 = __webpack_require__(92);
|
|
2786
|
+
|
|
2557
2787
|
var ClusterLayer = function ClusterLayer(_ref) {
|
|
2558
2788
|
var clusterLayer = _ref.clusterLayer,
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2789
|
+
themeColorScheme = _ref.themeColorScheme,
|
|
2790
|
+
zoom = _ref.zoom,
|
|
2791
|
+
map = _ref.map,
|
|
2792
|
+
onMapClick = _ref.onMapClick;
|
|
2793
|
+
|
|
2563
2794
|
var _a;
|
|
2795
|
+
|
|
2564
2796
|
if (((_a = map === null || map === void 0 ? void 0 : map.current) === null || _a === void 0 ? void 0 : _a.isStyleLoaded) && [clusterLayer.longitude, clusterLayer.latitude].every(Array.isArray)) {
|
|
2565
2797
|
if ((clusterLayer === null || clusterLayer === void 0 ? void 0 : clusterLayer.type) === MapUtils_1.LAYER_TYPE.Marker && !('geobin' in clusterLayer)) {
|
|
2566
2798
|
return React.createElement(MarkerLayer_1.default, {
|
|
@@ -2570,6 +2802,7 @@ var ClusterLayer = function ClusterLayer(_ref) {
|
|
|
2570
2802
|
onMapClick: onMapClick
|
|
2571
2803
|
});
|
|
2572
2804
|
}
|
|
2805
|
+
|
|
2573
2806
|
if ((clusterLayer === null || clusterLayer === void 0 ? void 0 : clusterLayer.type) === MapUtils_1.LAYER_TYPE.Bubble && 'geobin' in clusterLayer && 'bubbleSize' in clusterLayer) {
|
|
2574
2807
|
return React.createElement(BubbleLayer_1.default, {
|
|
2575
2808
|
bubbleLayer: clusterLayer,
|
|
@@ -2580,8 +2813,10 @@ var ClusterLayer = function ClusterLayer(_ref) {
|
|
|
2580
2813
|
});
|
|
2581
2814
|
}
|
|
2582
2815
|
}
|
|
2816
|
+
|
|
2583
2817
|
return null;
|
|
2584
2818
|
};
|
|
2819
|
+
|
|
2585
2820
|
exports.default = ClusterLayer;
|
|
2586
2821
|
|
|
2587
2822
|
/***/ }),
|
|
@@ -2593,15 +2828,22 @@ exports.default = ClusterLayer;
|
|
|
2593
2828
|
|
|
2594
2829
|
|
|
2595
2830
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
2831
|
+
|
|
2596
2832
|
var _templateObject;
|
|
2833
|
+
|
|
2597
2834
|
Object.defineProperty(exports, "__esModule", {
|
|
2598
2835
|
value: true
|
|
2599
2836
|
});
|
|
2600
2837
|
exports.convertDegToDMS = void 0;
|
|
2838
|
+
|
|
2601
2839
|
var React = __webpack_require__(1);
|
|
2840
|
+
|
|
2602
2841
|
var styled_components_1 = __webpack_require__(4);
|
|
2842
|
+
|
|
2603
2843
|
var Popover_1 = __webpack_require__(62);
|
|
2844
|
+
|
|
2604
2845
|
var i18n_1 = __webpack_require__(2);
|
|
2846
|
+
|
|
2605
2847
|
var StyledPopover = (0, styled_components_1.default)(Popover_1.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 250px;\n font-size: 12px;\n"])));
|
|
2606
2848
|
var StyledTable = styled_components_1.default.table.withConfig({
|
|
2607
2849
|
displayName: "Tooltip__StyledTable",
|
|
@@ -2621,42 +2863,50 @@ var StyledColorBlock = styled_components_1.default.div.withConfig({
|
|
|
2621
2863
|
})(["background-color:", ";display:inline-block;margin-right:4px;border-radius:2px;width:6px;height:11px;transform:translateY(1px);"], function (props) {
|
|
2622
2864
|
return props.color;
|
|
2623
2865
|
});
|
|
2866
|
+
|
|
2624
2867
|
var convertDegToDMS = function convertDegToDMS(decimalDegree, type) {
|
|
2625
2868
|
var truncate = function truncate(n) {
|
|
2626
2869
|
return n > 0 ? Math.floor(n) : Math.ceil(n);
|
|
2627
2870
|
};
|
|
2871
|
+
|
|
2628
2872
|
var absoluteDegree = Math.abs(decimalDegree);
|
|
2629
2873
|
var degrees = truncate(absoluteDegree);
|
|
2630
2874
|
var minutes = truncate((absoluteDegree - degrees) * 60);
|
|
2631
2875
|
var seconds = Math.round((absoluteDegree - degrees - minutes / 60) * 3600);
|
|
2876
|
+
|
|
2632
2877
|
if (seconds === 60) {
|
|
2633
2878
|
minutes += 1;
|
|
2634
2879
|
seconds = 0;
|
|
2635
2880
|
}
|
|
2881
|
+
|
|
2636
2882
|
if (minutes === 60) {
|
|
2637
2883
|
degrees += 1;
|
|
2638
2884
|
minutes = 0;
|
|
2639
2885
|
}
|
|
2886
|
+
|
|
2640
2887
|
var direction;
|
|
2888
|
+
|
|
2641
2889
|
if (type === 'longitude') {
|
|
2642
2890
|
direction = decimalDegree < 0 ? 'W' : 'E';
|
|
2643
2891
|
} else if (type === 'latitude') {
|
|
2644
2892
|
direction = decimalDegree < 0 ? 'S' : 'N';
|
|
2645
2893
|
}
|
|
2894
|
+
|
|
2646
2895
|
return "".concat(degrees, "\xB0 ").concat(minutes, "' ").concat(seconds, "\" ").concat(direction);
|
|
2647
2896
|
};
|
|
2648
|
-
|
|
2649
|
-
// only want latitude/longitude for marker and bubble
|
|
2897
|
+
|
|
2898
|
+
exports.convertDegToDMS = convertDegToDMS; // only want latitude/longitude for marker and bubble
|
|
2650
2899
|
// omit for choropleth, and put areaid, areavalue instead
|
|
2900
|
+
|
|
2651
2901
|
var Tooltip = function Tooltip(_ref) {
|
|
2652
2902
|
var open = _ref.open,
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2903
|
+
anchor = _ref.anchor,
|
|
2904
|
+
latitude = _ref.latitude,
|
|
2905
|
+
longitude = _ref.longitude,
|
|
2906
|
+
areaId = _ref.areaId,
|
|
2907
|
+
areaValue = _ref.areaValue,
|
|
2908
|
+
_ref$additionalFields = _ref.additionalFields,
|
|
2909
|
+
additionalFields = _ref$additionalFields === void 0 ? [] : _ref$additionalFields;
|
|
2660
2910
|
return React.createElement(StyledPopover, {
|
|
2661
2911
|
open: open,
|
|
2662
2912
|
animation: false,
|
|
@@ -2676,8 +2926,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
2676
2926
|
return value && String(value) !== '0';
|
|
2677
2927
|
}).map(function (_ref3, index) {
|
|
2678
2928
|
var name = _ref3.name,
|
|
2679
|
-
|
|
2680
|
-
|
|
2929
|
+
value = _ref3.value,
|
|
2930
|
+
color = _ref3.color;
|
|
2681
2931
|
return React.createElement("tr", {
|
|
2682
2932
|
key: String(index)
|
|
2683
2933
|
}, React.createElement(StyledTitleColumn, {
|
|
@@ -2690,6 +2940,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
2690
2940
|
}, value));
|
|
2691
2941
|
}))));
|
|
2692
2942
|
};
|
|
2943
|
+
|
|
2693
2944
|
exports.default = Tooltip;
|
|
2694
2945
|
|
|
2695
2946
|
/***/ }),
|
|
@@ -2701,32 +2952,46 @@ exports.default = Tooltip;
|
|
|
2701
2952
|
|
|
2702
2953
|
|
|
2703
2954
|
var _defineProperty = __webpack_require__(7);
|
|
2955
|
+
|
|
2704
2956
|
var _taggedTemplateLiteral = __webpack_require__(59);
|
|
2957
|
+
|
|
2705
2958
|
var _templateObject;
|
|
2959
|
+
|
|
2706
2960
|
var __rest = this && this.__rest || function (s, e) {
|
|
2707
2961
|
var t = {};
|
|
2962
|
+
|
|
2708
2963
|
for (var p in s) {
|
|
2709
2964
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
2710
2965
|
}
|
|
2966
|
+
|
|
2711
2967
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2712
2968
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
2713
2969
|
}
|
|
2714
2970
|
return t;
|
|
2715
2971
|
};
|
|
2972
|
+
|
|
2716
2973
|
Object.defineProperty(exports, "__esModule", {
|
|
2717
2974
|
value: true
|
|
2718
2975
|
});
|
|
2719
2976
|
exports.generateMarkerWrapperProps = exports.MarkerIcon = void 0;
|
|
2977
|
+
|
|
2720
2978
|
var styled_components_1 = __webpack_require__(4);
|
|
2979
|
+
|
|
2721
2980
|
var React = __webpack_require__(1);
|
|
2981
|
+
|
|
2722
2982
|
var colorUtils_1 = __webpack_require__(12);
|
|
2983
|
+
|
|
2723
2984
|
var lodash_1 = __webpack_require__(3);
|
|
2724
|
-
|
|
2985
|
+
|
|
2986
|
+
var MapUtils_1 = __webpack_require__(92);
|
|
2987
|
+
|
|
2725
2988
|
var MarkerWrapper_1 = __webpack_require__(132);
|
|
2989
|
+
|
|
2726
2990
|
var MarkerIcon = function MarkerIcon(_a) {
|
|
2727
2991
|
var theme = _a.theme,
|
|
2728
|
-
|
|
2729
|
-
|
|
2992
|
+
color = _a.color,
|
|
2993
|
+
otherProps = __rest(_a, ["theme", "color"]);
|
|
2994
|
+
|
|
2730
2995
|
var strokeOpacity = theme === 'light' ? 0.7 : 0.15;
|
|
2731
2996
|
return React.createElement("svg", Object.assign({
|
|
2732
2997
|
width: 22,
|
|
@@ -2744,15 +3009,16 @@ var MarkerIcon = function MarkerIcon(_a) {
|
|
|
2744
3009
|
strokeOpacity: strokeOpacity
|
|
2745
3010
|
}));
|
|
2746
3011
|
};
|
|
3012
|
+
|
|
2747
3013
|
exports.MarkerIcon = MarkerIcon;
|
|
2748
3014
|
var Marker = React.memo(function (_ref) {
|
|
2749
3015
|
var latitude = _ref.latitude,
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
3016
|
+
longitude = _ref.longitude,
|
|
3017
|
+
color = _ref.color,
|
|
3018
|
+
themeColorScheme = _ref.themeColorScheme,
|
|
3019
|
+
map = _ref.map,
|
|
3020
|
+
additionalFields = _ref.additionalFields,
|
|
3021
|
+
handleLayerClick = _ref.handleLayerClick;
|
|
2756
3022
|
var icon = React.useMemo(function () {
|
|
2757
3023
|
return React.createElement(exports.MarkerIcon, {
|
|
2758
3024
|
color: color,
|
|
@@ -2770,6 +3036,7 @@ var Marker = React.memo(function (_ref) {
|
|
|
2770
3036
|
});
|
|
2771
3037
|
Marker.displayName = 'MapMarker';
|
|
2772
3038
|
var StyledMarkerWrapper = (0, styled_components_1.default)(MarkerWrapper_1.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 22px;\n height: 28px;\n cursor: pointer;\n"])));
|
|
3039
|
+
|
|
2773
3040
|
var generateMarkerWrapperProps = function generateMarkerWrapperProps(markerLayer) {
|
|
2774
3041
|
var onMapClick = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : lodash_1.noop;
|
|
2775
3042
|
var latArray = markerLayer.latitude;
|
|
@@ -2777,6 +3044,7 @@ var generateMarkerWrapperProps = function generateMarkerWrapperProps(markerLayer
|
|
|
2777
3044
|
var isStaticColor = !markerLayer.dataColors;
|
|
2778
3045
|
var limit = Math.min(latArray.length, lonArray.length, markerLayer.resultLimit ? markerLayer.resultLimit : MapUtils_1.DEFAULT_RESULT_LIMIT);
|
|
2779
3046
|
var markerProps = [];
|
|
3047
|
+
|
|
2780
3048
|
var _loop = function _loop(i) {
|
|
2781
3049
|
var staticColor = markerLayer.seriesColors && (0, colorUtils_1.isColor)(markerLayer.seriesColors[0]) ? markerLayer.seriesColors[0] : MapUtils_1.DEFAULT_CLUSTER_COLOR;
|
|
2782
3050
|
var dynamicColor = markerLayer.dataColors && (0, colorUtils_1.isColor)(markerLayer.dataColors[i]) ? markerLayer.dataColors[i] : MapUtils_1.DEFAULT_CLUSTER_COLOR;
|
|
@@ -2787,8 +3055,10 @@ var generateMarkerWrapperProps = function generateMarkerWrapperProps(markerLayer
|
|
|
2787
3055
|
value: markerLayer.metadata[i][field]
|
|
2788
3056
|
};
|
|
2789
3057
|
}) : [];
|
|
3058
|
+
|
|
2790
3059
|
var handleLayerClick = function handleLayerClick(e) {
|
|
2791
3060
|
var _a;
|
|
3061
|
+
|
|
2792
3062
|
var metadata = (_a = markerLayer === null || markerLayer === void 0 ? void 0 : markerLayer.metadata[i]) !== null && _a !== void 0 ? _a : {};
|
|
2793
3063
|
var payload = Object.keys(metadata).reduce(function (acc, curr) {
|
|
2794
3064
|
var key = "row.".concat(curr, ".value");
|
|
@@ -2800,6 +3070,7 @@ var generateMarkerWrapperProps = function generateMarkerWrapperProps(markerLayer
|
|
|
2800
3070
|
payload: payload
|
|
2801
3071
|
});
|
|
2802
3072
|
};
|
|
3073
|
+
|
|
2803
3074
|
markerProps.push({
|
|
2804
3075
|
latitude: latArray[i],
|
|
2805
3076
|
longitude: lonArray[i],
|
|
@@ -2808,17 +3079,21 @@ var generateMarkerWrapperProps = function generateMarkerWrapperProps(markerLayer
|
|
|
2808
3079
|
handleLayerClick: handleLayerClick
|
|
2809
3080
|
});
|
|
2810
3081
|
};
|
|
3082
|
+
|
|
2811
3083
|
for (var i = 0; i < limit; i += 1) {
|
|
2812
3084
|
_loop(i);
|
|
2813
3085
|
}
|
|
3086
|
+
|
|
2814
3087
|
return markerProps;
|
|
2815
3088
|
};
|
|
3089
|
+
|
|
2816
3090
|
exports.generateMarkerWrapperProps = generateMarkerWrapperProps;
|
|
3091
|
+
|
|
2817
3092
|
var MarkerLayer = function MarkerLayer(props) {
|
|
2818
3093
|
var map = props.map,
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
3094
|
+
themeColorScheme = props.themeColorScheme,
|
|
3095
|
+
markerLayer = props.markerLayer,
|
|
3096
|
+
onMapClick = props.onMapClick;
|
|
2822
3097
|
markerLayer.seriesColors = markerLayer.seriesColors || MapUtils_1.DEFAULT_SERIES_COLORS;
|
|
2823
3098
|
var markerPropsList = React.useMemo(function () {
|
|
2824
3099
|
return (0, exports.generateMarkerWrapperProps)(markerLayer, onMapClick);
|
|
@@ -2831,6 +3106,7 @@ var MarkerLayer = function MarkerLayer(props) {
|
|
|
2831
3106
|
}, markerProps));
|
|
2832
3107
|
}));
|
|
2833
3108
|
};
|
|
3109
|
+
|
|
2834
3110
|
exports.default = MarkerLayer;
|
|
2835
3111
|
|
|
2836
3112
|
/***/ }),
|
|
@@ -2842,51 +3118,66 @@ exports.default = MarkerLayer;
|
|
|
2842
3118
|
|
|
2843
3119
|
|
|
2844
3120
|
var _slicedToArray = __webpack_require__(17);
|
|
3121
|
+
|
|
2845
3122
|
Object.defineProperty(exports, "__esModule", {
|
|
2846
3123
|
value: true
|
|
2847
3124
|
});
|
|
3125
|
+
|
|
2848
3126
|
var React = __webpack_require__(1);
|
|
3127
|
+
|
|
2849
3128
|
var Message_1 = __webpack_require__(10);
|
|
3129
|
+
|
|
2850
3130
|
var GeoRegistry_1 = __webpack_require__(419);
|
|
3131
|
+
|
|
2851
3132
|
var GeoJsonProvider_1 = __webpack_require__(420);
|
|
2852
|
-
|
|
2853
|
-
var
|
|
3133
|
+
|
|
3134
|
+
var MapUtils_1 = __webpack_require__(92);
|
|
3135
|
+
|
|
3136
|
+
var ChoroplethLayer_1 = __webpack_require__(161);
|
|
3137
|
+
|
|
2854
3138
|
var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
2855
3139
|
var _a, _b;
|
|
3140
|
+
|
|
2856
3141
|
var width = props.width,
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
3142
|
+
height = props.height,
|
|
3143
|
+
map = props.map,
|
|
3144
|
+
choroplethLayer = props.choroplethLayer,
|
|
3145
|
+
isThemeChanged = props.isThemeChanged,
|
|
3146
|
+
setIsThemeChanged = props.setIsThemeChanged,
|
|
3147
|
+
onMapClick = props.onMapClick;
|
|
2863
3148
|
var cfgOpacity = Math.min(Math.max(choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.choroplethOpacity, 0), 1);
|
|
3149
|
+
|
|
2864
3150
|
var _React$useState = React.useState({
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
3151
|
+
features: [{
|
|
3152
|
+
properties: {
|
|
3153
|
+
name: ''
|
|
3154
|
+
},
|
|
3155
|
+
geometry: []
|
|
3156
|
+
}]
|
|
3157
|
+
}),
|
|
3158
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3159
|
+
geoJson = _React$useState2[0],
|
|
3160
|
+
setGeoJson = _React$useState2[1];
|
|
3161
|
+
|
|
2875
3162
|
var _React$useState3 = React.useState(true),
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
3163
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3164
|
+
validGeoJson = _React$useState4[0],
|
|
3165
|
+
setValidGeoJson = _React$useState4[1];
|
|
3166
|
+
|
|
2879
3167
|
var _React$useState5 = React.useState({
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
3168
|
+
level: 'info',
|
|
3169
|
+
message: ''
|
|
3170
|
+
}),
|
|
3171
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3172
|
+
geoJsonError = _React$useState6[0],
|
|
3173
|
+
setGeoJsonError = _React$useState6[1]; // load local geoJson registry data
|
|
3174
|
+
|
|
3175
|
+
|
|
2886
3176
|
React.useEffect(function () {
|
|
2887
3177
|
var geoJsonData;
|
|
2888
3178
|
var geoRegistry = GeoRegistry_1.default.create();
|
|
2889
3179
|
geoRegistry.addDefaultProvider(new GeoJsonProvider_1.default());
|
|
3180
|
+
|
|
2890
3181
|
try {
|
|
2891
3182
|
geoJsonData = geoRegistry.getByURL(choroplethLayer.source);
|
|
2892
3183
|
setGeoJson(geoJsonData);
|
|
@@ -2898,9 +3189,10 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
|
2898
3189
|
}, [choroplethLayer.source]);
|
|
2899
3190
|
var updatedPropertyFormat = React.useMemo(function () {
|
|
2900
3191
|
var propertyFormat = 'name';
|
|
3192
|
+
|
|
2901
3193
|
if (choroplethLayer.areaIds && validGeoJson) {
|
|
2902
|
-
var propertyFormats = Object.keys(geoJson.features[0].properties);
|
|
2903
|
-
|
|
3194
|
+
var propertyFormats = Object.keys(geoJson.features[0].properties); // check the state or country format used in dataSource
|
|
3195
|
+
|
|
2904
3196
|
/* Accepted format for countries:
|
|
2905
3197
|
"properties":
|
|
2906
3198
|
{
|
|
@@ -2917,21 +3209,26 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
|
2917
3209
|
"label_en": "Michigan"
|
|
2918
3210
|
},
|
|
2919
3211
|
*/
|
|
3212
|
+
|
|
2920
3213
|
var _loop = function _loop(idx) {
|
|
2921
3214
|
var shapeProperty = geoJson.features[idx].properties;
|
|
2922
3215
|
var formatCheck = propertyFormats.find(function (key) {
|
|
2923
3216
|
return shapeProperty[key] === choroplethLayer.areaIds[0];
|
|
2924
3217
|
});
|
|
3218
|
+
|
|
2925
3219
|
if (formatCheck !== undefined) {
|
|
2926
3220
|
propertyFormat = formatCheck;
|
|
2927
3221
|
return "break";
|
|
2928
3222
|
}
|
|
2929
3223
|
};
|
|
3224
|
+
|
|
2930
3225
|
for (var idx = 0; idx < geoJson.features.length; idx += 1) {
|
|
2931
3226
|
var _ret = _loop(idx);
|
|
3227
|
+
|
|
2932
3228
|
if (_ret === "break") break;
|
|
2933
3229
|
}
|
|
2934
3230
|
}
|
|
3231
|
+
|
|
2935
3232
|
return propertyFormat;
|
|
2936
3233
|
}, [choroplethLayer.areaIds, geoJson]);
|
|
2937
3234
|
var colors = (_a = choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.dataColors) === null || _a === void 0 ? void 0 : _a.map(function (color) {
|
|
@@ -2940,6 +3237,7 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
|
2940
3237
|
var scaledOpacities = (_b = (0, MapUtils_1.getScaledOpacities)(choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.dataColors, cfgOpacity)) !== null && _b !== void 0 ? _b : [];
|
|
2941
3238
|
var updatedAllChoroplethData = React.useMemo(function () {
|
|
2942
3239
|
var allChoroplethData = [];
|
|
3240
|
+
|
|
2943
3241
|
if (validGeoJson) {
|
|
2944
3242
|
for (var idx = 0; idx < geoJson.features.length; idx += 1) {
|
|
2945
3243
|
var el = geoJson.features[idx];
|
|
@@ -2950,11 +3248,12 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
|
2950
3248
|
name: '',
|
|
2951
3249
|
idx: 0
|
|
2952
3250
|
};
|
|
2953
|
-
choroplethData.name = el.properties[updatedPropertyFormat];
|
|
2954
|
-
|
|
3251
|
+
choroplethData.name = el.properties[updatedPropertyFormat]; // check whether dataSource exists
|
|
3252
|
+
|
|
2955
3253
|
if (choroplethLayer.areaIds) {
|
|
2956
3254
|
// store the postion of dataSource in geoJson
|
|
2957
3255
|
var dataIdx = choroplethLayer.areaIds.indexOf(el.properties[updatedPropertyFormat]);
|
|
3256
|
+
|
|
2958
3257
|
if (dataIdx !== -1) {
|
|
2959
3258
|
choroplethData.color = colors[dataIdx];
|
|
2960
3259
|
choroplethData.areaValue = choroplethLayer.areaValues[dataIdx];
|
|
@@ -2964,11 +3263,14 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
|
2964
3263
|
choroplethData.idx = choroplethLayer.areaIds.length;
|
|
2965
3264
|
}
|
|
2966
3265
|
}
|
|
3266
|
+
|
|
2967
3267
|
allChoroplethData.push(choroplethData);
|
|
2968
3268
|
}
|
|
2969
3269
|
}
|
|
3270
|
+
|
|
2970
3271
|
return allChoroplethData;
|
|
2971
3272
|
}, [choroplethLayer.areaIds, choroplethLayer.areaValues, colors, scaledOpacities]);
|
|
3273
|
+
|
|
2972
3274
|
var _handleMapClick = function handleMapClick(e, i) {
|
|
2973
3275
|
var payload = (0, MapUtils_1.formatMetadata)(choroplethLayer, i);
|
|
2974
3276
|
onMapClick({
|
|
@@ -2976,11 +3278,14 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
|
2976
3278
|
payload: payload
|
|
2977
3279
|
});
|
|
2978
3280
|
};
|
|
3281
|
+
|
|
2979
3282
|
if (isThemeChanged) {
|
|
2980
3283
|
setIsThemeChanged(false);
|
|
2981
3284
|
}
|
|
3285
|
+
|
|
2982
3286
|
var additionalFields = (choroplethLayer === null || choroplethLayer === void 0 ? void 0 : choroplethLayer.metadata) ? choroplethLayer.metadata.map(function (choroplethMetadata) {
|
|
2983
3287
|
var _a;
|
|
3288
|
+
|
|
2984
3289
|
return (_a = choroplethLayer.additionalTooltipFields) === null || _a === void 0 ? void 0 : _a.map(function (field) {
|
|
2985
3290
|
return {
|
|
2986
3291
|
name: field,
|
|
@@ -3013,6 +3318,7 @@ var LocalChoroplethLayer = function LocalChoroplethLayer(props) {
|
|
|
3013
3318
|
});
|
|
3014
3319
|
}));
|
|
3015
3320
|
};
|
|
3321
|
+
|
|
3016
3322
|
exports.default = LocalChoroplethLayer;
|
|
3017
3323
|
|
|
3018
3324
|
/***/ }),
|
|
@@ -3031,29 +3337,148 @@ module.exports = require("@splunk/visualization-context/GeoRegistry");
|
|
|
3031
3337
|
|
|
3032
3338
|
|
|
3033
3339
|
var _classCallCheck = __webpack_require__(9);
|
|
3034
|
-
|
|
3340
|
+
|
|
3035
3341
|
Object.defineProperty(exports, "__esModule", {
|
|
3036
3342
|
value: true
|
|
3037
3343
|
});
|
|
3038
|
-
exports.
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3344
|
+
exports.INITIAL_HEIGHT = exports.INITIAL_WIDTH = void 0;
|
|
3345
|
+
/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */
|
|
3346
|
+
|
|
3347
|
+
var T = __webpack_require__(0);
|
|
3348
|
+
|
|
3349
|
+
var lodash_1 = __webpack_require__(3);
|
|
3350
|
+
|
|
3351
|
+
var VizActionHandler_1 = __webpack_require__(43); // this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations
|
|
3352
|
+
|
|
3353
|
+
|
|
3354
|
+
exports.INITIAL_WIDTH = 250;
|
|
3355
|
+
exports.INITIAL_HEIGHT = 250;
|
|
3356
|
+
/**
|
|
3357
|
+
* A Splunk visualization
|
|
3358
|
+
*/
|
|
3359
|
+
|
|
3360
|
+
var SplunkVisualization = function SplunkVisualization() {
|
|
3361
|
+
_classCallCheck(this, SplunkVisualization);
|
|
3362
|
+
};
|
|
3363
|
+
|
|
3364
|
+
SplunkVisualization.propTypes = {
|
|
3365
|
+
/**
|
|
3366
|
+
* display mode
|
|
3367
|
+
*/
|
|
3368
|
+
mode: T.oneOf(['view', 'edit', 'export']).isRequired,
|
|
3369
|
+
|
|
3370
|
+
/**
|
|
3371
|
+
* width in pixel or string, defaults to 100%
|
|
3372
|
+
*/
|
|
3373
|
+
width: T.oneOfType([T.string, T.number]).isRequired,
|
|
3374
|
+
|
|
3375
|
+
/**
|
|
3376
|
+
* height in pixel or string
|
|
3377
|
+
*/
|
|
3378
|
+
height: T.oneOfType([T.string, T.number]).isRequired,
|
|
3379
|
+
|
|
3380
|
+
/**
|
|
3381
|
+
* visualization context used for dynamic option evaluation
|
|
3382
|
+
*/
|
|
3383
|
+
context: T.object,
|
|
3384
|
+
|
|
3385
|
+
/**
|
|
3386
|
+
* visualization formatting options
|
|
3387
|
+
*/
|
|
3388
|
+
options: T.object,
|
|
3389
|
+
|
|
3390
|
+
/**
|
|
3391
|
+
* A callback to update formatting options
|
|
3392
|
+
*/
|
|
3393
|
+
onOptionsChange: T.func,
|
|
3394
|
+
|
|
3395
|
+
/**
|
|
3396
|
+
* datasource state which include data and request params, object key indicate the datasource type.
|
|
3397
|
+
*/
|
|
3398
|
+
dataSources: T.objectOf(T.shape({
|
|
3399
|
+
/**
|
|
3400
|
+
* current request params
|
|
3401
|
+
*/
|
|
3402
|
+
requestParams: T.object,
|
|
3403
|
+
|
|
3404
|
+
/**
|
|
3405
|
+
* current dataset
|
|
3406
|
+
*/
|
|
3407
|
+
data: T.shape({
|
|
3408
|
+
fields: T.array,
|
|
3409
|
+
columns: T.array
|
|
3410
|
+
}),
|
|
3411
|
+
|
|
3412
|
+
/**
|
|
3413
|
+
* error
|
|
3414
|
+
*/
|
|
3415
|
+
error: T.shape({
|
|
3416
|
+
level: T.string,
|
|
3417
|
+
message: T.string
|
|
3418
|
+
}),
|
|
3419
|
+
|
|
3420
|
+
/**
|
|
3421
|
+
* meta data that came with the dataset
|
|
3422
|
+
*/
|
|
3423
|
+
meta: T.object
|
|
3424
|
+
})),
|
|
3425
|
+
|
|
3426
|
+
/**
|
|
3427
|
+
* A callback to trigger event
|
|
3428
|
+
*/
|
|
3429
|
+
onEventTrigger: T.func,
|
|
3430
|
+
|
|
3431
|
+
/**
|
|
3432
|
+
* Inform viz if there are handlers listening to events
|
|
3433
|
+
*/
|
|
3434
|
+
hasEventHandlers: T.bool,
|
|
3435
|
+
|
|
3436
|
+
/**
|
|
3437
|
+
* A callback to communicate computed props to a consumer
|
|
3438
|
+
*/
|
|
3439
|
+
onComputedProps: T.func,
|
|
3440
|
+
|
|
3441
|
+
/**
|
|
3442
|
+
* A callback to obtain visualization api
|
|
3443
|
+
*/
|
|
3444
|
+
vizActionHandlerRef: T.func,
|
|
3445
|
+
loading: T.bool,
|
|
3446
|
+
theme: T.object,
|
|
3447
|
+
|
|
3448
|
+
/**
|
|
3449
|
+
* A callback to request new data with updated request params
|
|
3450
|
+
*/
|
|
3451
|
+
onRequestParamsChange: T.func
|
|
3452
|
+
};
|
|
3453
|
+
/**
|
|
3454
|
+
*
|
|
3455
|
+
*/
|
|
3456
|
+
|
|
3457
|
+
SplunkVisualization.defaultProps = {
|
|
3458
|
+
// BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height
|
|
3459
|
+
width: '100%',
|
|
3460
|
+
height: exports.INITIAL_HEIGHT,
|
|
3461
|
+
dataSources: {},
|
|
3462
|
+
onEventTrigger: function onEventTrigger() {
|
|
3463
|
+
return {};
|
|
3464
|
+
},
|
|
3465
|
+
mode: 'view',
|
|
3466
|
+
hasEventHandlers: false,
|
|
3467
|
+
options: {},
|
|
3468
|
+
context: {},
|
|
3469
|
+
onOptionsChange: function onOptionsChange() {
|
|
3470
|
+
return {};
|
|
3471
|
+
},
|
|
3472
|
+
vizActionHandlerRef: function vizActionHandlerRef() {
|
|
3473
|
+
return new VizActionHandler_1.DefaultVizActionHandler();
|
|
3474
|
+
},
|
|
3475
|
+
onComputedProps: function onComputedProps() {
|
|
3476
|
+
return {};
|
|
3477
|
+
},
|
|
3478
|
+
loading: false,
|
|
3479
|
+
onRequestParamsChange: lodash_1.noop
|
|
3480
|
+
};
|
|
3481
|
+
exports.default = SplunkVisualization;
|
|
3057
3482
|
|
|
3058
3483
|
/***/ }),
|
|
3059
3484
|
|
|
@@ -3073,17 +3498,29 @@ module.exports = require("@splunk/visualization-context/GeoJsonProvider");
|
|
|
3073
3498
|
Object.defineProperty(exports, "__esModule", {
|
|
3074
3499
|
value: true
|
|
3075
3500
|
});
|
|
3501
|
+
|
|
3076
3502
|
var visualization_icons_1 = __webpack_require__(52);
|
|
3503
|
+
|
|
3077
3504
|
var placeholders_1 = __webpack_require__(50);
|
|
3505
|
+
|
|
3078
3506
|
var schemaUtils_1 = __webpack_require__(16);
|
|
3507
|
+
|
|
3079
3508
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
3509
|
+
|
|
3080
3510
|
var themes_1 = __webpack_require__(60);
|
|
3511
|
+
|
|
3081
3512
|
var i18n_1 = __webpack_require__(2);
|
|
3513
|
+
|
|
3082
3514
|
var VizBehavior_1 = __webpack_require__(6);
|
|
3083
|
-
|
|
3515
|
+
|
|
3516
|
+
var VizCategory_1 = __webpack_require__(36);
|
|
3517
|
+
|
|
3084
3518
|
var configUtils_1 = __webpack_require__(20);
|
|
3085
|
-
|
|
3519
|
+
|
|
3520
|
+
var MapUtils_1 = __webpack_require__(92);
|
|
3521
|
+
|
|
3086
3522
|
var BackgroundColor_1 = __webpack_require__(53);
|
|
3523
|
+
|
|
3087
3524
|
var defaultContext = {
|
|
3088
3525
|
colorRangeConfig: [{
|
|
3089
3526
|
to: 20,
|
|
@@ -3443,12 +3880,15 @@ var themes = {
|
|
|
3443
3880
|
})(props);
|
|
3444
3881
|
}
|
|
3445
3882
|
};
|
|
3883
|
+
|
|
3446
3884
|
var checkTypeIsChoropleth = function checkTypeIsChoropleth(options) {
|
|
3447
3885
|
return options.layers && options.layers.length && options.layers[0].type === MapUtils_1.LAYER_TYPE.Choropleth;
|
|
3448
3886
|
};
|
|
3887
|
+
|
|
3449
3888
|
var checkTypeIsLocalChoropleth = function checkTypeIsLocalChoropleth(options) {
|
|
3450
3889
|
return options.layers && options.layers.length && options.layers[0].type === MapUtils_1.LAYER_TYPE.Choropleth && (options.layers[0].source === 'geo://default/us' || options.layers[0].source === 'geo://default/world');
|
|
3451
3890
|
};
|
|
3891
|
+
|
|
3452
3892
|
var EDITOR_LABEL_WIDTH = 140;
|
|
3453
3893
|
var editorConfig = [{
|
|
3454
3894
|
label: (0, i18n_1._)('Data configurations'),
|
|
@@ -3616,8 +4056,7 @@ var editorConfig = [{
|
|
|
3616
4056
|
}]]
|
|
3617
4057
|
}, {
|
|
3618
4058
|
label: (0, i18n_1._)('Color and style'),
|
|
3619
|
-
layout: [
|
|
3620
|
-
// TODO: add support for color mode option and its corresponding editor
|
|
4059
|
+
layout: [// TODO: add support for color mode option and its corresponding editor
|
|
3621
4060
|
// [
|
|
3622
4061
|
// {
|
|
3623
4062
|
// label: _('Color mode'),
|
|
@@ -3639,8 +4078,7 @@ var editorConfig = [{
|
|
|
3639
4078
|
var options = _ref8.options;
|
|
3640
4079
|
return !(options.layers && options.layers.length && options.layers[0].type === 'choropleth');
|
|
3641
4080
|
}
|
|
3642
|
-
}],
|
|
3643
|
-
// TODO: add editor for data colors
|
|
4081
|
+
}], // TODO: add editor for data colors
|
|
3644
4082
|
// [
|
|
3645
4083
|
// {
|
|
3646
4084
|
// label: _('Data colors'),
|
|
@@ -3686,8 +4124,7 @@ var editorConfig = [{
|
|
|
3686
4124
|
themes: themes,
|
|
3687
4125
|
min: 0
|
|
3688
4126
|
}
|
|
3689
|
-
}],
|
|
3690
|
-
// TODO: add support for seriesColorsByField option
|
|
4127
|
+
}], // TODO: add support for seriesColorsByField option
|
|
3691
4128
|
// [
|
|
3692
4129
|
// {
|
|
3693
4130
|
// label: _('Series colors by field name'),
|
|
@@ -3731,17 +4168,20 @@ var editorConfig = [{
|
|
|
3731
4168
|
/**
|
|
3732
4169
|
* visualization configuration
|
|
3733
4170
|
*/
|
|
4171
|
+
|
|
3734
4172
|
var config = {
|
|
3735
4173
|
/**
|
|
3736
4174
|
* unique viz key
|
|
3737
4175
|
*/
|
|
3738
4176
|
key: 'splunk.map',
|
|
4177
|
+
|
|
3739
4178
|
/**
|
|
3740
4179
|
* viz name
|
|
3741
4180
|
*/
|
|
3742
4181
|
name: (0, i18n_1._)('Map'),
|
|
3743
4182
|
category: VizCategory_1.VizCategory.SPATIAL,
|
|
3744
4183
|
status: 'preview',
|
|
4184
|
+
|
|
3745
4185
|
/**
|
|
3746
4186
|
* viz icon
|
|
3747
4187
|
*/
|
|
@@ -3754,7 +4194,8 @@ var config = {
|
|
|
3754
4194
|
editorConfig: editorConfig,
|
|
3755
4195
|
events: {
|
|
3756
4196
|
'map.load': {
|
|
3757
|
-
description: 'triggered when map is fully loaded'
|
|
4197
|
+
description: 'triggered when map is fully loaded',
|
|
4198
|
+
parentKeys: ['exec']
|
|
3758
4199
|
},
|
|
3759
4200
|
'map.click': {
|
|
3760
4201
|
description: 'trigger when user clicks map layer'
|
|
@@ -3778,28 +4219,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3778
4219
|
value: true
|
|
3779
4220
|
});
|
|
3780
4221
|
exports.columnsNullToZeros = void 0;
|
|
3781
|
-
|
|
4222
|
+
|
|
4223
|
+
var types_1 = __webpack_require__(83);
|
|
4224
|
+
|
|
3782
4225
|
var dsl_1 = __webpack_require__(133);
|
|
4226
|
+
|
|
3783
4227
|
var hocUtils_1 = __webpack_require__(27);
|
|
4228
|
+
|
|
3784
4229
|
var JSONSchemaUtils_1 = __webpack_require__(28);
|
|
4230
|
+
|
|
3785
4231
|
var BubbleLayer_1 = __webpack_require__(131);
|
|
4232
|
+
|
|
3786
4233
|
var columnsNullToZeros = function columnsNullToZeros(config, dataSources, options) {
|
|
3787
4234
|
var _a, _b;
|
|
4235
|
+
|
|
3788
4236
|
var primary = dataSources.primary;
|
|
3789
4237
|
var _primary$data = primary.data,
|
|
3790
|
-
|
|
3791
|
-
|
|
4238
|
+
columns = _primary$data.columns,
|
|
4239
|
+
fields = _primary$data.fields;
|
|
3792
4240
|
var newColumns = columns;
|
|
3793
4241
|
var mergedOptions = (0, hocUtils_1.deepMergeWithArrayPrimitiveOverrides)({}, options, (0, JSONSchemaUtils_1.pickFieldFromJSONSchema)(config.optionsSchema, 'default'));
|
|
4242
|
+
|
|
3794
4243
|
if (((_b = (_a = mergedOptions.layers) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.type) === 'bubble') {
|
|
3795
4244
|
var latitudeField = (0, dsl_1.getFieldsFromDSL)(mergedOptions.layers[0].latitude, dataSources)[0] || '';
|
|
3796
4245
|
var longitudeField = (0, dsl_1.getFieldsFromDSL)(mergedOptions.layers[0].longitude, dataSources)[0] || '';
|
|
3797
4246
|
var excludedFields = [latitudeField, longitudeField, 'geobin'].concat(BubbleLayer_1.GEO_LAT_AND_LONG_FIELD);
|
|
3798
4247
|
var indicesToEvaluate = new Set(fields.reduce(function (arr, e, i) {
|
|
3799
4248
|
var field = typeof e === 'string' ? e : e.name.toString();
|
|
4249
|
+
|
|
3800
4250
|
if (!excludedFields.includes(field)) {
|
|
3801
4251
|
arr.push(i);
|
|
3802
4252
|
}
|
|
4253
|
+
|
|
3803
4254
|
return arr;
|
|
3804
4255
|
}, []));
|
|
3805
4256
|
newColumns = columns.map(function (column, i) {
|
|
@@ -3809,9 +4260,11 @@ var columnsNullToZeros = function columnsNullToZeros(config, dataSources, option
|
|
|
3809
4260
|
return !value || !(0, types_1.isNumber)(value) ? 0 : +value;
|
|
3810
4261
|
});
|
|
3811
4262
|
}
|
|
4263
|
+
|
|
3812
4264
|
return column;
|
|
3813
4265
|
});
|
|
3814
4266
|
}
|
|
4267
|
+
|
|
3815
4268
|
var modifiedDatasources = Object.assign(Object.assign({}, dataSources), {
|
|
3816
4269
|
primary: Object.assign(Object.assign({}, primary), {
|
|
3817
4270
|
data: Object.assign(Object.assign({}, primary.data), {
|
|
@@ -3821,6 +4274,7 @@ var columnsNullToZeros = function columnsNullToZeros(config, dataSources, option
|
|
|
3821
4274
|
});
|
|
3822
4275
|
return modifiedDatasources;
|
|
3823
4276
|
};
|
|
4277
|
+
|
|
3824
4278
|
exports.columnsNullToZeros = columnsNullToZeros;
|
|
3825
4279
|
|
|
3826
4280
|
/***/ }),
|
|
@@ -3831,11 +4285,35 @@ exports.columnsNullToZeros = columnsNullToZeros;
|
|
|
3831
4285
|
"use strict";
|
|
3832
4286
|
|
|
3833
4287
|
|
|
4288
|
+
var _classCallCheck = __webpack_require__(9);
|
|
4289
|
+
|
|
4290
|
+
var _createClass = __webpack_require__(18);
|
|
4291
|
+
|
|
3834
4292
|
Object.defineProperty(exports, "__esModule", {
|
|
3835
4293
|
value: true
|
|
3836
4294
|
});
|
|
3837
|
-
exports.
|
|
3838
|
-
|
|
4295
|
+
exports.DefaultVizActionHandler = void 0;
|
|
4296
|
+
|
|
4297
|
+
var DefaultVizActionHandler = /*#__PURE__*/function () {
|
|
4298
|
+
function DefaultVizActionHandler() {
|
|
4299
|
+
_classCallCheck(this, DefaultVizActionHandler);
|
|
4300
|
+
}
|
|
4301
|
+
|
|
4302
|
+
_createClass(DefaultVizActionHandler, [{
|
|
4303
|
+
key: "focus",
|
|
4304
|
+
value: function focus() {// noop
|
|
4305
|
+
}
|
|
4306
|
+
}, {
|
|
4307
|
+
key: "snapshot",
|
|
4308
|
+
value: function snapshot() {
|
|
4309
|
+
return null; // noop
|
|
4310
|
+
}
|
|
4311
|
+
}]);
|
|
4312
|
+
|
|
4313
|
+
return DefaultVizActionHandler;
|
|
4314
|
+
}();
|
|
4315
|
+
|
|
4316
|
+
exports.DefaultVizActionHandler = DefaultVizActionHandler;
|
|
3839
4317
|
|
|
3840
4318
|
/***/ }),
|
|
3841
4319
|
|
|
@@ -3849,7 +4327,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3849
4327
|
value: true
|
|
3850
4328
|
});
|
|
3851
4329
|
exports.useDeepMemo = void 0;
|
|
4330
|
+
|
|
3852
4331
|
var react_1 = __webpack_require__(1);
|
|
4332
|
+
|
|
3853
4333
|
var lodash_1 = __webpack_require__(3);
|
|
3854
4334
|
/**
|
|
3855
4335
|
* This hook evaluates and stores the result of a passed function and only
|
|
@@ -3864,16 +4344,21 @@ var lodash_1 = __webpack_require__(3);
|
|
|
3864
4344
|
* @param fn the function to be executed and
|
|
3865
4345
|
* @param dependencies an array of dependencies
|
|
3866
4346
|
*/
|
|
4347
|
+
|
|
4348
|
+
|
|
3867
4349
|
var useDeepMemo = function useDeepMemo(fn, dependencies) {
|
|
3868
4350
|
var ref = (0, react_1.useRef)();
|
|
4351
|
+
|
|
3869
4352
|
if (!ref.current || !(0, lodash_1.isEqual)(dependencies, ref.current.dependencies)) {
|
|
3870
4353
|
ref.current = {
|
|
3871
4354
|
dependencies: dependencies,
|
|
3872
4355
|
value: fn()
|
|
3873
4356
|
};
|
|
3874
4357
|
}
|
|
4358
|
+
|
|
3875
4359
|
return ref.current.value;
|
|
3876
4360
|
};
|
|
4361
|
+
|
|
3877
4362
|
exports.useDeepMemo = useDeepMemo;
|
|
3878
4363
|
|
|
3879
4364
|
/***/ }),
|
|
@@ -3888,19 +4373,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3888
4373
|
value: true
|
|
3889
4374
|
});
|
|
3890
4375
|
exports.MissingPropsMessage = exports.missingKeys = exports.isMissing = void 0;
|
|
4376
|
+
|
|
3891
4377
|
var React = __webpack_require__(1);
|
|
4378
|
+
|
|
3892
4379
|
var T = __webpack_require__(0);
|
|
4380
|
+
|
|
3893
4381
|
var i18n_1 = __webpack_require__(2);
|
|
4382
|
+
|
|
3894
4383
|
var Message_1 = __webpack_require__(10);
|
|
4384
|
+
|
|
3895
4385
|
var FixedSizeContainer_1 = __webpack_require__(13);
|
|
3896
4386
|
/**
|
|
3897
4387
|
* @method isMissing
|
|
3898
4388
|
* @param {any} v
|
|
3899
4389
|
* @returns {boolean} true if the input value === null or undefined
|
|
3900
4390
|
*/
|
|
4391
|
+
|
|
4392
|
+
|
|
3901
4393
|
var isMissing = function isMissing(v) {
|
|
3902
4394
|
return v === null || v === undefined;
|
|
3903
4395
|
};
|
|
4396
|
+
|
|
3904
4397
|
exports.isMissing = isMissing;
|
|
3905
4398
|
/**
|
|
3906
4399
|
* @method misskingKeys
|
|
@@ -3908,11 +4401,13 @@ exports.isMissing = isMissing;
|
|
|
3908
4401
|
* @param {object} target
|
|
3909
4402
|
* @returns {string[]} the keys of missing required props
|
|
3910
4403
|
*/
|
|
4404
|
+
|
|
3911
4405
|
var missingKeys = function missingKeys(keys, target) {
|
|
3912
4406
|
return keys.filter(function (k) {
|
|
3913
4407
|
return (0, exports.isMissing)(target[k]);
|
|
3914
4408
|
});
|
|
3915
4409
|
};
|
|
4410
|
+
|
|
3916
4411
|
exports.missingKeys = missingKeys;
|
|
3917
4412
|
var propTypes = {
|
|
3918
4413
|
width: T.oneOfType([T.string, T.number]),
|
|
@@ -3926,10 +4421,11 @@ var propTypes = {
|
|
|
3926
4421
|
* @param {MissingPropsProps} props
|
|
3927
4422
|
* @returns {React.ReactElement}
|
|
3928
4423
|
*/
|
|
4424
|
+
|
|
3929
4425
|
var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
3930
4426
|
var width = props.width,
|
|
3931
|
-
|
|
3932
|
-
|
|
4427
|
+
height = props.height,
|
|
4428
|
+
missingProps = props.missingProps;
|
|
3933
4429
|
return React.createElement(Message_1.default, {
|
|
3934
4430
|
"data-test": "message",
|
|
3935
4431
|
width: width,
|
|
@@ -3937,6 +4433,7 @@ var MissingPropsMessage = function MissingPropsMessage(props) {
|
|
|
3937
4433
|
message: (0, i18n_1._)("Missing property: ".concat(missingProps.join(', ')))
|
|
3938
4434
|
});
|
|
3939
4435
|
};
|
|
4436
|
+
|
|
3940
4437
|
exports.MissingPropsMessage = MissingPropsMessage;
|
|
3941
4438
|
exports.MissingPropsMessage.propTypes = propTypes;
|
|
3942
4439
|
exports.MissingPropsMessage.defaultProps = {
|
|
@@ -3956,15 +4453,19 @@ exports.default = (0, FixedSizeContainer_1.default)(exports.MissingPropsMessage)
|
|
|
3956
4453
|
Object.defineProperty(exports, "__esModule", {
|
|
3957
4454
|
value: true
|
|
3958
4455
|
});
|
|
4456
|
+
|
|
3959
4457
|
var React = __webpack_require__(1);
|
|
4458
|
+
|
|
3960
4459
|
var styled_components_1 = __webpack_require__(4);
|
|
4460
|
+
|
|
3961
4461
|
var hocUtils_1 = __webpack_require__(15);
|
|
4462
|
+
|
|
3962
4463
|
var Cover = styled_components_1.default.div.withConfig({
|
|
3963
4464
|
displayName: "withEditModeCover__Cover",
|
|
3964
4465
|
componentId: "sc-1gsbnxb-0"
|
|
3965
4466
|
})(["position:absolute;left:0;right:0;top:0;bottom:0;"]);
|
|
3966
4467
|
var Blocker = styled_components_1.default.div.attrs({
|
|
3967
|
-
'data-splunk-visualization-version': "26.
|
|
4468
|
+
'data-splunk-visualization-version': "26.1.1 - b6df0a015"
|
|
3968
4469
|
}).withConfig({
|
|
3969
4470
|
displayName: "withEditModeCover__Blocker",
|
|
3970
4471
|
componentId: "sc-1gsbnxb-1"
|
|
@@ -3975,6 +4476,7 @@ var Blocker = styled_components_1.default.div.attrs({
|
|
|
3975
4476
|
* @param {ExtendedDashViz} Visualization
|
|
3976
4477
|
* @returns {ExtendedDashViz} Wrapper
|
|
3977
4478
|
*/
|
|
4479
|
+
|
|
3978
4480
|
var withEditModeCover = function withEditModeCover(Visualization, disableEditModeCover) {
|
|
3979
4481
|
var Wrapper = function Wrapper(props) {
|
|
3980
4482
|
var mode = props.mode;
|
|
@@ -3983,12 +4485,14 @@ var withEditModeCover = function withEditModeCover(Visualization, disableEditMod
|
|
|
3983
4485
|
"data-test": "edit-mode-cover"
|
|
3984
4486
|
}));
|
|
3985
4487
|
};
|
|
4488
|
+
|
|
3986
4489
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
3987
4490
|
Wrapper: Wrapper,
|
|
3988
4491
|
Visualization: Visualization
|
|
3989
4492
|
});
|
|
3990
4493
|
return Wrapper;
|
|
3991
4494
|
};
|
|
4495
|
+
|
|
3992
4496
|
exports.default = withEditModeCover;
|
|
3993
4497
|
|
|
3994
4498
|
/***/ }),
|
|
@@ -4002,27 +4506,37 @@ exports.default = withEditModeCover;
|
|
|
4002
4506
|
Object.defineProperty(exports, "__esModule", {
|
|
4003
4507
|
value: true
|
|
4004
4508
|
});
|
|
4509
|
+
|
|
4005
4510
|
var React = __webpack_require__(1);
|
|
4511
|
+
|
|
4006
4512
|
var colorUtils_1 = __webpack_require__(12);
|
|
4513
|
+
|
|
4007
4514
|
var variables_1 = __webpack_require__(11);
|
|
4515
|
+
|
|
4008
4516
|
var IconPlaceholder_1 = __webpack_require__(32);
|
|
4517
|
+
|
|
4009
4518
|
var VizBehavior_1 = __webpack_require__(6);
|
|
4519
|
+
|
|
4010
4520
|
var hocUtils_1 = __webpack_require__(15);
|
|
4521
|
+
|
|
4011
4522
|
var withPlaceholder = function withPlaceholder(Visualization) {
|
|
4012
4523
|
var useIconPlaceholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : IconPlaceholder_1.shouldShowIconPlaceholder;
|
|
4013
4524
|
var config = Visualization.config;
|
|
4014
4525
|
var themes = config.themes;
|
|
4526
|
+
|
|
4015
4527
|
var Wrapper = function Wrapper(props) {
|
|
4016
4528
|
var _a, _b;
|
|
4529
|
+
|
|
4017
4530
|
var dataSources = props.dataSources,
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4531
|
+
loading = props.loading,
|
|
4532
|
+
options = props.options,
|
|
4533
|
+
height = props.height,
|
|
4534
|
+
width = props.width;
|
|
4022
4535
|
var showPlaceholder = useIconPlaceholder(dataSources, loading, options);
|
|
4023
4536
|
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);
|
|
4024
4537
|
var icon = (_b = config.placeholderIcon) !== null && _b !== void 0 ? _b : config.icon;
|
|
4025
4538
|
var iconColor = variables_1.default.contentColorActive(props);
|
|
4539
|
+
|
|
4026
4540
|
if (config.supports.includes(VizBehavior_1.VizBehavior.PLACEHOLDER) && showPlaceholder) {
|
|
4027
4541
|
return React.createElement(IconPlaceholder_1.default, {
|
|
4028
4542
|
"data-test": "icon-placeholder",
|
|
@@ -4033,14 +4547,17 @@ var withPlaceholder = function withPlaceholder(Visualization) {
|
|
|
4033
4547
|
iconColor: iconColor
|
|
4034
4548
|
});
|
|
4035
4549
|
}
|
|
4550
|
+
|
|
4036
4551
|
return React.createElement(Visualization, Object.assign({}, props));
|
|
4037
4552
|
};
|
|
4553
|
+
|
|
4038
4554
|
(0, hocUtils_1.extendStaticWrapperProps)({
|
|
4039
4555
|
Wrapper: Wrapper,
|
|
4040
4556
|
Visualization: Visualization
|
|
4041
4557
|
});
|
|
4042
4558
|
return Wrapper;
|
|
4043
4559
|
};
|
|
4560
|
+
|
|
4044
4561
|
exports.default = withPlaceholder;
|
|
4045
4562
|
|
|
4046
4563
|
/***/ }),
|
|
@@ -4075,11 +4592,13 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
4075
4592
|
Object.defineProperty(exports, "__esModule", {
|
|
4076
4593
|
value: true
|
|
4077
4594
|
});
|
|
4595
|
+
|
|
4078
4596
|
var i18n_1 = __webpack_require__(2);
|
|
4597
|
+
|
|
4079
4598
|
var background = function background(_ref) {
|
|
4080
4599
|
var label = _ref.label,
|
|
4081
|
-
|
|
4082
|
-
|
|
4600
|
+
themes = _ref.themes,
|
|
4601
|
+
labelPosition = _ref.labelPosition;
|
|
4083
4602
|
return [{
|
|
4084
4603
|
label: (0, i18n_1._)(label || 'Background'),
|
|
4085
4604
|
option: 'backgroundColor',
|
|
@@ -4090,6 +4609,7 @@ var background = function background(_ref) {
|
|
|
4090
4609
|
}
|
|
4091
4610
|
}];
|
|
4092
4611
|
};
|
|
4612
|
+
|
|
4093
4613
|
exports.default = background;
|
|
4094
4614
|
|
|
4095
4615
|
/***/ }),
|
|
@@ -4112,6 +4632,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4112
4632
|
});
|
|
4113
4633
|
exports.VizBehavior = void 0;
|
|
4114
4634
|
var VizBehavior;
|
|
4635
|
+
|
|
4115
4636
|
(function (VizBehavior) {
|
|
4116
4637
|
/**
|
|
4117
4638
|
* Dynamic Options Behavior.
|
|
@@ -4131,6 +4652,7 @@ var VizBehavior;
|
|
|
4131
4652
|
* missing.
|
|
4132
4653
|
* @type {string}
|
|
4133
4654
|
*/
|
|
4655
|
+
|
|
4134
4656
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
4135
4657
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
4136
4658
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -4166,6 +4688,13 @@ module.exports = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
4166
4688
|
|
|
4167
4689
|
/***/ }),
|
|
4168
4690
|
|
|
4691
|
+
/***/ 83:
|
|
4692
|
+
/***/ (function(module, exports) {
|
|
4693
|
+
|
|
4694
|
+
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
4695
|
+
|
|
4696
|
+
/***/ }),
|
|
4697
|
+
|
|
4169
4698
|
/***/ 9:
|
|
4170
4699
|
/***/ (function(module, exports) {
|
|
4171
4700
|
|
|
@@ -4173,42 +4702,55 @@ module.exports = require("@babel/runtime/helpers/classCallCheck");
|
|
|
4173
4702
|
|
|
4174
4703
|
/***/ }),
|
|
4175
4704
|
|
|
4176
|
-
/***/
|
|
4705
|
+
/***/ 92:
|
|
4177
4706
|
/***/ (function(module, exports, __webpack_require__) {
|
|
4178
4707
|
|
|
4179
4708
|
"use strict";
|
|
4180
4709
|
|
|
4181
4710
|
|
|
4182
4711
|
var _defineProperty = __webpack_require__(7);
|
|
4712
|
+
|
|
4183
4713
|
var _slicedToArray = __webpack_require__(17);
|
|
4714
|
+
|
|
4184
4715
|
var _toConsumableArray = __webpack_require__(8);
|
|
4716
|
+
|
|
4185
4717
|
Object.defineProperty(exports, "__esModule", {
|
|
4186
4718
|
value: true
|
|
4187
4719
|
});
|
|
4188
4720
|
exports.formatMetadata = exports.compareBaseStyles = exports.getScaledOpacities = exports.getGlobalLayerBoundaries = exports.isValidLatLon = exports.bakeBubbleData = exports.sanitizeValues = exports.transposeArray = exports.matchBubbleSize = exports.getStaticColors = exports.getZoomLevelFromGeobin = exports.getZoomConstraintsFromTileConfig = exports.getMapStyle = exports.getTilePreset = exports.LAYER_TYPE = exports.DEFAULT_OPACITY = exports.MAX_BUBBLE_RADIUS = exports.MIN_BUBBLE_RADIUS = exports.MAP_STYLE_VERSION_NUMBER = exports.DEFAULT_SERIES_COLORS = exports.DEFAULT_CLUSTER_COLOR = exports.DEFAULT_RESULT_LIMIT = exports.MIN_LONGITUDE = exports.MAX_LONGITUDE = exports.MIN_LATITUDE = exports.MAX_LATITUDE = void 0;
|
|
4721
|
+
|
|
4189
4722
|
var lodash_1 = __webpack_require__(3);
|
|
4190
|
-
|
|
4191
|
-
var
|
|
4723
|
+
|
|
4724
|
+
var d3_scale_1 = __webpack_require__(93);
|
|
4725
|
+
|
|
4726
|
+
var chroma = __webpack_require__(159);
|
|
4727
|
+
|
|
4192
4728
|
var colorUtils_1 = __webpack_require__(12);
|
|
4729
|
+
|
|
4193
4730
|
var visualization_color_palettes_1 = __webpack_require__(51);
|
|
4194
|
-
|
|
4731
|
+
|
|
4732
|
+
var types_1 = __webpack_require__(83);
|
|
4733
|
+
|
|
4195
4734
|
exports.MAX_LATITUDE = 90;
|
|
4196
4735
|
exports.MIN_LATITUDE = -90;
|
|
4197
4736
|
exports.MAX_LONGITUDE = 180;
|
|
4198
4737
|
exports.MIN_LONGITUDE = -180;
|
|
4199
4738
|
exports.DEFAULT_RESULT_LIMIT = 1000;
|
|
4200
4739
|
exports.DEFAULT_CLUSTER_COLOR = '#909090';
|
|
4201
|
-
exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL;
|
|
4202
|
-
|
|
4203
|
-
exports.MAP_STYLE_VERSION_NUMBER = 8;
|
|
4204
|
-
// currently using one [min, max] value set for bubbles across all zoom levels
|
|
4740
|
+
exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
|
|
4741
|
+
|
|
4742
|
+
exports.MAP_STYLE_VERSION_NUMBER = 8; // currently using one [min, max] value set for bubbles across all zoom levels
|
|
4205
4743
|
// TODO: design choices on [min, max] bubble size for different zoom levels
|
|
4744
|
+
|
|
4206
4745
|
exports.MIN_BUBBLE_RADIUS = 7.11; // 10px
|
|
4746
|
+
|
|
4207
4747
|
exports.MAX_BUBBLE_RADIUS = 45.26; // 85px
|
|
4748
|
+
|
|
4208
4749
|
exports.DEFAULT_OPACITY = 0.8;
|
|
4209
4750
|
var LONGITUDE = 'longitude';
|
|
4210
4751
|
var LATITUDE = 'latitude';
|
|
4211
4752
|
var LAYER_TYPE;
|
|
4753
|
+
|
|
4212
4754
|
(function (LAYER_TYPE) {
|
|
4213
4755
|
LAYER_TYPE["Marker"] = "marker";
|
|
4214
4756
|
LAYER_TYPE["Bubble"] = "bubble";
|
|
@@ -4222,12 +4764,16 @@ var LAYER_TYPE;
|
|
|
4222
4764
|
* @param {BaseTileConfig[]} args.customTileConfig
|
|
4223
4765
|
* @returns {Object} tile preset
|
|
4224
4766
|
*/
|
|
4767
|
+
|
|
4768
|
+
|
|
4225
4769
|
var getTilePreset = function getTilePreset(_ref) {
|
|
4226
4770
|
var _ref$defaultTileConfi = _ref.defaultTileConfig,
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4771
|
+
defaultTileConfig = _ref$defaultTileConfi === void 0 ? [] : _ref$defaultTileConfi,
|
|
4772
|
+
_ref$customTileConfig = _ref.customTileConfig,
|
|
4773
|
+
customTileConfig = _ref$customTileConfig === void 0 ? [] : _ref$customTileConfig;
|
|
4774
|
+
|
|
4230
4775
|
var _a, _b;
|
|
4776
|
+
|
|
4231
4777
|
var tilePreset = {};
|
|
4232
4778
|
var defaultTileLight = {};
|
|
4233
4779
|
var defaultTileDark = {};
|
|
@@ -4241,6 +4787,7 @@ var getTilePreset = function getTilePreset(_ref) {
|
|
|
4241
4787
|
});
|
|
4242
4788
|
tilePreset[key] = updatedConfig;
|
|
4243
4789
|
});
|
|
4790
|
+
|
|
4244
4791
|
if (defaultTileConfig.length > 0) {
|
|
4245
4792
|
defaultTileLight = (_a = defaultTileConfig.find(function (config) {
|
|
4246
4793
|
return config.theme === 'light';
|
|
@@ -4253,12 +4800,14 @@ var getTilePreset = function getTilePreset(_ref) {
|
|
|
4253
4800
|
return config.theme === undefined;
|
|
4254
4801
|
});
|
|
4255
4802
|
}
|
|
4803
|
+
|
|
4256
4804
|
return {
|
|
4257
4805
|
tilePreset: tilePreset,
|
|
4258
4806
|
defaultTileLight: defaultTileLight,
|
|
4259
4807
|
defaultTileDark: defaultTileDark
|
|
4260
4808
|
};
|
|
4261
4809
|
};
|
|
4810
|
+
|
|
4262
4811
|
exports.getTilePreset = getTilePreset;
|
|
4263
4812
|
/**
|
|
4264
4813
|
* Check if baseLayerTileServer is in tilePreset and config matches current theme, if yes, return.
|
|
@@ -4273,20 +4822,22 @@ exports.getTilePreset = getTilePreset;
|
|
|
4273
4822
|
* @param {BaseTileConfig} args.defaultTileLight
|
|
4274
4823
|
* @returns {BaseTileConfig} mapStyle
|
|
4275
4824
|
*/
|
|
4825
|
+
|
|
4276
4826
|
var getMapStyle = function getMapStyle(_ref2) {
|
|
4277
4827
|
var showBaseLayer = _ref2.showBaseLayer,
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4828
|
+
_ref2$baseLayerTileSe = _ref2.baseLayerTileServer,
|
|
4829
|
+
baseLayerTileServer = _ref2$baseLayerTileSe === void 0 ? '' : _ref2$baseLayerTileSe,
|
|
4830
|
+
_ref2$baseLayerTileSe2 = _ref2.baseLayerTileServerType,
|
|
4831
|
+
baseLayerTileServerType = _ref2$baseLayerTileSe2 === void 0 ? '' : _ref2$baseLayerTileSe2,
|
|
4832
|
+
_ref2$tilePreset = _ref2.tilePreset,
|
|
4833
|
+
tilePreset = _ref2$tilePreset === void 0 ? {} : _ref2$tilePreset,
|
|
4834
|
+
_ref2$colorScheme = _ref2.colorScheme,
|
|
4835
|
+
colorScheme = _ref2$colorScheme === void 0 ? 'light' : _ref2$colorScheme,
|
|
4836
|
+
_ref2$defaultTileLigh = _ref2.defaultTileLight,
|
|
4837
|
+
defaultTileLight = _ref2$defaultTileLigh === void 0 ? {} : _ref2$defaultTileLigh,
|
|
4838
|
+
_ref2$defaultTileDark = _ref2.defaultTileDark,
|
|
4839
|
+
defaultTileDark = _ref2$defaultTileDark === void 0 ? {} : _ref2$defaultTileDark;
|
|
4840
|
+
|
|
4290
4841
|
if (!showBaseLayer) {
|
|
4291
4842
|
return {
|
|
4292
4843
|
version: exports.MAP_STYLE_VERSION_NUMBER,
|
|
@@ -4306,9 +4857,11 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
4306
4857
|
}]
|
|
4307
4858
|
};
|
|
4308
4859
|
}
|
|
4860
|
+
|
|
4309
4861
|
if (baseLayerTileServer && tilePreset[baseLayerTileServer] && (tilePreset[baseLayerTileServer].theme === colorScheme || tilePreset[baseLayerTileServer].theme === 'all')) {
|
|
4310
4862
|
return tilePreset[baseLayerTileServer];
|
|
4311
4863
|
}
|
|
4864
|
+
|
|
4312
4865
|
if (baseLayerTileServer && baseLayerTileServerType) {
|
|
4313
4866
|
var tiles = [];
|
|
4314
4867
|
/**
|
|
@@ -4316,6 +4869,7 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
4316
4869
|
* Subdomains are used to help with browser parallel requests per domain limitation. These subdomains are typically single letters 'a', 'b' and 'c'
|
|
4317
4870
|
* Refer to https://leafletjs.com/SlavaUkraini/reference.html#tilelayer and https://wiki.openstreetmap.org/wiki/Tile_servers
|
|
4318
4871
|
*/
|
|
4872
|
+
|
|
4319
4873
|
if (baseLayerTileServer.match(/^(https?):\/\/{(s|S)}\../)) {
|
|
4320
4874
|
/**
|
|
4321
4875
|
* sXML (Leaflet) allows users to define their own tile server URLs + list of available subdomains
|
|
@@ -4326,8 +4880,9 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
4326
4880
|
tiles = [baseLayerTileServer.replace(/{(s|S)}/, 'a'), baseLayerTileServer.replace(/{(s|S)}/, 'b'), baseLayerTileServer.replace(/{(s|S)}/, 'c')];
|
|
4327
4881
|
} else {
|
|
4328
4882
|
tiles = [baseLayerTileServer];
|
|
4329
|
-
}
|
|
4330
|
-
|
|
4883
|
+
} // TODO: remove hardcoded style when we allow users to pass in layer style through Viz options
|
|
4884
|
+
|
|
4885
|
+
|
|
4331
4886
|
var mapStyle = {
|
|
4332
4887
|
version: exports.MAP_STYLE_VERSION_NUMBER,
|
|
4333
4888
|
sources: {
|
|
@@ -4343,134 +4898,164 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
4343
4898
|
source: 'base-tiles',
|
|
4344
4899
|
minzoom: 0,
|
|
4345
4900
|
maxzoom: 24 // https://maplibre.org/maplibre-gl-js-docs/api/map/
|
|
4901
|
+
|
|
4346
4902
|
}]
|
|
4347
4903
|
};
|
|
4348
|
-
|
|
4349
4904
|
return mapStyle;
|
|
4350
|
-
}
|
|
4351
|
-
|
|
4905
|
+
} // if tile server is not present in the preset AND we can't construct a mapStyle, fall back on defaults
|
|
4906
|
+
|
|
4907
|
+
|
|
4352
4908
|
return colorScheme === 'light' ? defaultTileLight : defaultTileDark;
|
|
4353
4909
|
};
|
|
4910
|
+
|
|
4354
4911
|
exports.getMapStyle = getMapStyle;
|
|
4912
|
+
|
|
4355
4913
|
var getZoomConstraintsFromTileConfig = function getZoomConstraintsFromTileConfig(tileConfig, baseLayerTileServer) {
|
|
4356
4914
|
var sources = tileConfig.sources,
|
|
4357
|
-
|
|
4358
|
-
var matchedBaseLayerTileServer = false;
|
|
4359
|
-
|
|
4915
|
+
layers = tileConfig.layers;
|
|
4916
|
+
var matchedBaseLayerTileServer = false; // check sources for minzoom maxzoom first
|
|
4917
|
+
|
|
4360
4918
|
var sourceKeys = Object.keys(sources);
|
|
4919
|
+
|
|
4361
4920
|
for (var i = 0; i < sourceKeys.length; i += 1) {
|
|
4362
4921
|
var _sources$sourceKeys$i = sources[sourceKeys[i]],
|
|
4363
|
-
|
|
4364
|
-
|
|
4922
|
+
minzoom = _sources$sourceKeys$i.minzoom,
|
|
4923
|
+
maxzoom = _sources$sourceKeys$i.maxzoom;
|
|
4924
|
+
|
|
4365
4925
|
if (baseLayerTileServer && sources[sourceKeys[i]].tiles.indexOf(baseLayerTileServer) !== -1) {
|
|
4366
4926
|
matchedBaseLayerTileServer = true;
|
|
4367
4927
|
}
|
|
4928
|
+
|
|
4368
4929
|
if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(minzoom) && (0, lodash_1.isNumber)(maxzoom)) {
|
|
4369
4930
|
return {
|
|
4370
4931
|
minZoom: minzoom,
|
|
4371
4932
|
maxZoom: maxzoom
|
|
4372
4933
|
};
|
|
4373
4934
|
}
|
|
4374
|
-
}
|
|
4375
|
-
|
|
4935
|
+
} // then check layers
|
|
4936
|
+
|
|
4937
|
+
|
|
4376
4938
|
for (var _i = 0; _i < layers.length; _i += 1) {
|
|
4377
4939
|
var _layers$_i = layers[_i],
|
|
4378
|
-
|
|
4379
|
-
|
|
4940
|
+
_minzoom = _layers$_i.minzoom,
|
|
4941
|
+
_maxzoom = _layers$_i.maxzoom;
|
|
4942
|
+
|
|
4380
4943
|
if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(_minzoom) && (0, lodash_1.isNumber)(_maxzoom)) {
|
|
4381
4944
|
return {
|
|
4382
4945
|
minZoom: _minzoom,
|
|
4383
4946
|
maxZoom: _maxzoom
|
|
4384
4947
|
};
|
|
4385
4948
|
}
|
|
4386
|
-
}
|
|
4387
|
-
|
|
4949
|
+
} // Maplibre default - would reset previous min/maxZoom https://maplibre.org/maplibre-gl-js-docs/api/map/
|
|
4950
|
+
|
|
4951
|
+
|
|
4388
4952
|
return {
|
|
4389
4953
|
minZoom: 0,
|
|
4390
4954
|
maxZoom: 24
|
|
4391
4955
|
};
|
|
4392
4956
|
};
|
|
4957
|
+
|
|
4393
4958
|
exports.getZoomConstraintsFromTileConfig = getZoomConstraintsFromTileConfig;
|
|
4959
|
+
|
|
4394
4960
|
var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
|
|
4395
4961
|
var _a;
|
|
4962
|
+
|
|
4396
4963
|
if (!geobinStr) {
|
|
4397
4964
|
return null;
|
|
4398
|
-
}
|
|
4399
|
-
|
|
4965
|
+
} // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
|
|
4966
|
+
|
|
4967
|
+
|
|
4400
4968
|
var geobinPattern = /bin_id_zl_([0-9]{0,2})?_y_/g;
|
|
4401
4969
|
var match = geobinPattern.exec(geobinStr);
|
|
4402
4970
|
return (_a = (match === null || match === void 0 ? void 0 : match.length) && parseInt(match[1], 10)) !== null && _a !== void 0 ? _a : null;
|
|
4403
4971
|
};
|
|
4404
|
-
|
|
4405
|
-
// Bubble colors - static
|
|
4972
|
+
|
|
4973
|
+
exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
|
|
4974
|
+
|
|
4406
4975
|
var getStaticColors = function getStaticColors(colorCount, colorArray) {
|
|
4407
4976
|
if (colorCount < 0 || !colorCount) {
|
|
4408
4977
|
return [exports.DEFAULT_CLUSTER_COLOR];
|
|
4409
4978
|
}
|
|
4979
|
+
|
|
4410
4980
|
if (!colorArray || !colorArray.length) {
|
|
4411
4981
|
return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
|
|
4412
4982
|
return exports.DEFAULT_SERIES_COLORS[i];
|
|
4413
4983
|
});
|
|
4414
|
-
}
|
|
4415
|
-
// loop through colorArray to pick the first $colorCount colors
|
|
4984
|
+
} // loop through colorArray to pick the first $colorCount colors
|
|
4416
4985
|
// start from begining again if colorCount > colorArray.length
|
|
4986
|
+
|
|
4987
|
+
|
|
4417
4988
|
return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
|
|
4418
4989
|
return (0, colorUtils_1.isColor)(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
|
|
4419
4990
|
});
|
|
4420
4991
|
};
|
|
4421
|
-
|
|
4422
|
-
// Bubble size
|
|
4992
|
+
|
|
4993
|
+
exports.getStaticColors = getStaticColors; // Bubble size
|
|
4994
|
+
|
|
4423
4995
|
var matchBubbleSize = function matchBubbleSize(dataRange, data) {
|
|
4424
4996
|
var size = (0, d3_scale_1.scalePow)().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
|
|
4997
|
+
|
|
4425
4998
|
if (size > exports.MAX_BUBBLE_RADIUS) {
|
|
4426
4999
|
return exports.MAX_BUBBLE_RADIUS;
|
|
4427
5000
|
}
|
|
5001
|
+
|
|
4428
5002
|
if (size < exports.MIN_BUBBLE_RADIUS) {
|
|
4429
5003
|
return exports.MIN_BUBBLE_RADIUS;
|
|
4430
5004
|
}
|
|
5005
|
+
|
|
4431
5006
|
return size;
|
|
4432
5007
|
};
|
|
5008
|
+
|
|
4433
5009
|
exports.matchBubbleSize = matchBubbleSize;
|
|
5010
|
+
|
|
4434
5011
|
var transposeArray = function transposeArray(array) {
|
|
4435
5012
|
if (!array || !array.length || !array[0] || !array[0].length) {
|
|
4436
5013
|
return [];
|
|
4437
5014
|
}
|
|
5015
|
+
|
|
4438
5016
|
return array[0].map(function (_, i) {
|
|
4439
5017
|
return array.map(function (row) {
|
|
4440
5018
|
return row[i];
|
|
4441
5019
|
});
|
|
4442
5020
|
});
|
|
4443
5021
|
};
|
|
4444
|
-
|
|
4445
|
-
// sanitize values: update all null, undefined, or negative values to 0
|
|
5022
|
+
|
|
5023
|
+
exports.transposeArray = transposeArray; // sanitize values: update all null, undefined, or negative values to 0
|
|
5024
|
+
|
|
4446
5025
|
var sanitizeValues = function sanitizeValues(values) {
|
|
4447
5026
|
// null / undefined
|
|
4448
5027
|
if (!values) {
|
|
4449
5028
|
return 0;
|
|
4450
|
-
}
|
|
4451
|
-
|
|
5029
|
+
} // number
|
|
5030
|
+
|
|
5031
|
+
|
|
4452
5032
|
if (!Array.isArray(values)) {
|
|
4453
5033
|
return values > 0 ? values : 0;
|
|
4454
|
-
}
|
|
4455
|
-
|
|
5034
|
+
} // array
|
|
5035
|
+
|
|
5036
|
+
|
|
4456
5037
|
return values.map(function (arr) {
|
|
4457
5038
|
return (0, exports.sanitizeValues)(arr);
|
|
4458
5039
|
});
|
|
4459
5040
|
};
|
|
5041
|
+
|
|
4460
5042
|
exports.sanitizeValues = sanitizeValues;
|
|
5043
|
+
|
|
4461
5044
|
var bakeBubbleData = function bakeBubbleData(layer) {
|
|
4462
5045
|
var _a;
|
|
5046
|
+
|
|
4463
5047
|
if (!layer || !((_a = layer.bubbleSize) === null || _a === void 0 ? void 0 : _a.length) || !layer.geobin || !layer.geobin.length || !layer.latitude || !layer.latitude.length || !layer.longitude || !layer.longitude.length) {
|
|
4464
5048
|
return null;
|
|
4465
|
-
}
|
|
4466
|
-
// if bubbleSize is passed as an array of single number array (data series)
|
|
5049
|
+
} // if bubbleSize is passed as an array of single number array (data series)
|
|
4467
5050
|
// e.g. [value0, value1, ...]
|
|
4468
5051
|
// format each value as an array to unify data operations for data series and frames
|
|
5052
|
+
|
|
5053
|
+
|
|
4469
5054
|
var sanitizedBubbleSize = (0, exports.sanitizeValues)(layer.bubbleSize);
|
|
4470
5055
|
var transposedBubbleSize;
|
|
4471
5056
|
var transposedSanitizedBubbleSize;
|
|
4472
|
-
var isPie = false;
|
|
4473
|
-
|
|
5057
|
+
var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
|
|
5058
|
+
|
|
4474
5059
|
if (Array.isArray(layer.bubbleSize[0])) {
|
|
4475
5060
|
// one-time array transpose,
|
|
4476
5061
|
// e.g. from [column0data, column0data] (multi series)
|
|
@@ -4480,8 +5065,8 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
4480
5065
|
// for easy access of values at each geo location,
|
|
4481
5066
|
// and min max pie size computation
|
|
4482
5067
|
transposedBubbleSize = (0, exports.transposeArray)(layer.bubbleSize);
|
|
4483
|
-
transposedSanitizedBubbleSize = (0, exports.transposeArray)(sanitizedBubbleSize);
|
|
4484
|
-
|
|
5068
|
+
transposedSanitizedBubbleSize = (0, exports.transposeArray)(sanitizedBubbleSize); // if multiple series in the dataframe, set isPie to true
|
|
5069
|
+
|
|
4485
5070
|
if (layer.bubbleSize.length > 1) {
|
|
4486
5071
|
isPie = true;
|
|
4487
5072
|
}
|
|
@@ -4493,9 +5078,11 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
4493
5078
|
return [n];
|
|
4494
5079
|
});
|
|
4495
5080
|
}
|
|
5081
|
+
|
|
4496
5082
|
if (!transposedBubbleSize || !transposedBubbleSize.length) {
|
|
4497
5083
|
return null;
|
|
4498
5084
|
}
|
|
5085
|
+
|
|
4499
5086
|
var data = layer.latitude.map(function (lat, i) {
|
|
4500
5087
|
return {
|
|
4501
5088
|
zoom: (0, exports.getZoomLevelFromGeobin)(layer.geobin[i]),
|
|
@@ -4506,8 +5093,8 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
4506
5093
|
};
|
|
4507
5094
|
}).filter(function (d) {
|
|
4508
5095
|
return Boolean(d.values);
|
|
4509
|
-
});
|
|
4510
|
-
|
|
5096
|
+
}); // compute the min/max value to encode min/max pie or bubble size
|
|
5097
|
+
|
|
4511
5098
|
var min = (0, lodash_1.sum)(transposedSanitizedBubbleSize[0]);
|
|
4512
5099
|
var max = (0, lodash_1.sum)(transposedSanitizedBubbleSize[1]);
|
|
4513
5100
|
transposedSanitizedBubbleSize.forEach(function (row) {
|
|
@@ -4523,22 +5110,29 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
4523
5110
|
bubbleSizeFields: layer.bubbleSizeFields
|
|
4524
5111
|
};
|
|
4525
5112
|
};
|
|
5113
|
+
|
|
4526
5114
|
exports.bakeBubbleData = bakeBubbleData;
|
|
5115
|
+
|
|
4527
5116
|
var isValidLatLon = function isValidLatLon(latlon) {
|
|
4528
5117
|
if (!latlon || !Array.isArray(latlon) || latlon.length !== 2) {
|
|
4529
5118
|
return false;
|
|
4530
5119
|
}
|
|
5120
|
+
|
|
4531
5121
|
var _latlon = _slicedToArray(latlon, 2),
|
|
4532
|
-
|
|
4533
|
-
|
|
5122
|
+
lat = _latlon[0],
|
|
5123
|
+
lon = _latlon[1];
|
|
5124
|
+
|
|
4534
5125
|
if (!(0, types_1.isNumber)(lat) || !(lat >= exports.MIN_LATITUDE && lat <= exports.MAX_LATITUDE)) {
|
|
4535
5126
|
return false;
|
|
4536
5127
|
}
|
|
5128
|
+
|
|
4537
5129
|
if (!(0, types_1.isNumber)(lon) || !(lon >= exports.MIN_LONGITUDE && lon <= exports.MAX_LONGITUDE)) {
|
|
4538
5130
|
return false;
|
|
4539
5131
|
}
|
|
5132
|
+
|
|
4540
5133
|
return true;
|
|
4541
5134
|
};
|
|
5135
|
+
|
|
4542
5136
|
exports.isValidLatLon = isValidLatLon;
|
|
4543
5137
|
/**
|
|
4544
5138
|
* Returns a list of all lat or lon coordinates used in a specified layer
|
|
@@ -4546,10 +5140,12 @@ exports.isValidLatLon = isValidLatLon;
|
|
|
4546
5140
|
* @param {string} field
|
|
4547
5141
|
* @returns {number[]} list of lat coordinates or lon coordinates
|
|
4548
5142
|
*/
|
|
5143
|
+
|
|
4549
5144
|
var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
|
|
4550
5145
|
var getClusterValues = function getClusterValues(clusterLayer) {
|
|
4551
5146
|
return (0, lodash_1.get)(clusterLayer, field, []).slice(0, clusterLayer.type === LAYER_TYPE.Marker && clusterLayer.resultLimit ? clusterLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
|
|
4552
5147
|
};
|
|
5148
|
+
|
|
4553
5149
|
var getChoroplethValues = function getChoroplethValues(choroplethLayer) {
|
|
4554
5150
|
var slicedGeomList = choroplethLayer.geom.slice(0, choroplethLayer.resultLimit);
|
|
4555
5151
|
var flatCoordinates = slicedGeomList.flatMap(function (geomObject) {
|
|
@@ -4559,6 +5155,7 @@ var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
|
|
|
4559
5155
|
return coord[field === LONGITUDE ? 0 : 1];
|
|
4560
5156
|
});
|
|
4561
5157
|
};
|
|
5158
|
+
|
|
4562
5159
|
return layer.type === LAYER_TYPE.Choropleth ? getChoroplethValues(layer) : getClusterValues(layer);
|
|
4563
5160
|
};
|
|
4564
5161
|
/**
|
|
@@ -4566,25 +5163,32 @@ var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
|
|
|
4566
5163
|
* @param {LayerType[]} layers
|
|
4567
5164
|
* @returns {LngLatBoundsLike}
|
|
4568
5165
|
*/
|
|
5166
|
+
|
|
5167
|
+
|
|
4569
5168
|
var getGlobalLayerBoundaries = function getGlobalLayerBoundaries(layers) {
|
|
4570
5169
|
var isLayerValid = function isLayerValid(field) {
|
|
4571
5170
|
return layers.every(function (layer) {
|
|
4572
5171
|
return layer[field] || layer.geom;
|
|
4573
5172
|
});
|
|
4574
5173
|
};
|
|
5174
|
+
|
|
4575
5175
|
var getDefaultMax = function getDefaultMax(field) {
|
|
4576
5176
|
return field === LONGITUDE ? exports.MAX_LONGITUDE : exports.MAX_LATITUDE;
|
|
4577
5177
|
};
|
|
5178
|
+
|
|
4578
5179
|
var getDefaultMin = function getDefaultMin(field) {
|
|
4579
5180
|
return field === LONGITUDE ? exports.MIN_LONGITUDE : exports.MIN_LATITUDE;
|
|
4580
5181
|
};
|
|
5182
|
+
|
|
4581
5183
|
if (!layers || !Array.isArray(layers) || !layers.length) {
|
|
4582
5184
|
return null;
|
|
4583
5185
|
}
|
|
5186
|
+
|
|
4584
5187
|
var getMin = function getMin(field) {
|
|
4585
5188
|
if (!isLayerValid(field)) {
|
|
4586
5189
|
return getDefaultMin(field);
|
|
4587
5190
|
}
|
|
5191
|
+
|
|
4588
5192
|
return layers.reduce(function (prevVal, layer) {
|
|
4589
5193
|
var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(function (x) {
|
|
4590
5194
|
return +x;
|
|
@@ -4592,32 +5196,41 @@ var getGlobalLayerBoundaries = function getGlobalLayerBoundaries(layers) {
|
|
|
4592
5196
|
return (0, lodash_1.min)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
|
|
4593
5197
|
}, getDefaultMax(field));
|
|
4594
5198
|
};
|
|
5199
|
+
|
|
4595
5200
|
var getMax = function getMax(field) {
|
|
4596
5201
|
if (!isLayerValid(field)) {
|
|
4597
5202
|
return getDefaultMax(field);
|
|
4598
5203
|
}
|
|
5204
|
+
|
|
4599
5205
|
return layers.reduce(function (prevVal, layer) {
|
|
4600
5206
|
var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(Number);
|
|
4601
5207
|
return (0, lodash_1.max)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
|
|
4602
5208
|
}, getDefaultMin(field));
|
|
4603
5209
|
};
|
|
5210
|
+
|
|
4604
5211
|
return [[getMin(LONGITUDE), getMin(LATITUDE)], [getMax(LONGITUDE), getMax(LATITUDE)]];
|
|
4605
5212
|
};
|
|
5213
|
+
|
|
4606
5214
|
exports.getGlobalLayerBoundaries = getGlobalLayerBoundaries;
|
|
5215
|
+
|
|
4607
5216
|
var getScaledOpacities = function getScaledOpacities(colors, cfgOpacity) {
|
|
4608
5217
|
// extract opacity information from 8 digit hex codes
|
|
4609
5218
|
var opacities = colors === null || colors === void 0 ? void 0 : colors.map(function (color) {
|
|
4610
5219
|
var _a;
|
|
5220
|
+
|
|
4611
5221
|
return (color === null || color === void 0 ? void 0 : color.length) === 9 ? (_a = chroma(color).alpha()) !== null && _a !== void 0 ? _a : 1 : 1;
|
|
4612
|
-
});
|
|
4613
|
-
|
|
5222
|
+
}); // opacity cannot be greater than configured opacity
|
|
5223
|
+
|
|
4614
5224
|
return opacities === null || opacities === void 0 ? void 0 : opacities.map(function (opacity) {
|
|
4615
5225
|
return opacity * cfgOpacity;
|
|
4616
5226
|
});
|
|
4617
5227
|
};
|
|
5228
|
+
|
|
4618
5229
|
exports.getScaledOpacities = getScaledOpacities;
|
|
5230
|
+
|
|
4619
5231
|
var compareBaseStyles = function compareBaseStyles(curr, next) {
|
|
4620
5232
|
var _a, _b, _c, _d;
|
|
5233
|
+
|
|
4621
5234
|
var currBaseLayer = (_a = curr === null || curr === void 0 ? void 0 : curr.layers) === null || _a === void 0 ? void 0 : _a.find(function (layer) {
|
|
4622
5235
|
return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
|
|
4623
5236
|
});
|
|
@@ -4626,12 +5239,16 @@ var compareBaseStyles = function compareBaseStyles(curr, next) {
|
|
|
4626
5239
|
});
|
|
4627
5240
|
var currBaseSource = (0, lodash_1.get)(curr === null || curr === void 0 ? void 0 : curr.sources, (_c = currBaseLayer === null || currBaseLayer === void 0 ? void 0 : currBaseLayer.source) !== null && _c !== void 0 ? _c : '');
|
|
4628
5241
|
var nextBaseSource = (0, lodash_1.get)(next === null || next === void 0 ? void 0 : next.sources, (_d = nextBaseLayer === null || nextBaseLayer === void 0 ? void 0 : nextBaseLayer.source) !== null && _d !== void 0 ? _d : '');
|
|
5242
|
+
|
|
4629
5243
|
if (!currBaseLayer || !nextBaseLayer || !currBaseSource || !nextBaseSource) {
|
|
4630
5244
|
return false;
|
|
4631
5245
|
}
|
|
5246
|
+
|
|
4632
5247
|
return (0, lodash_1.isEqual)(currBaseLayer, nextBaseLayer) && (0, lodash_1.isEqual)(currBaseSource, nextBaseSource);
|
|
4633
5248
|
};
|
|
5249
|
+
|
|
4634
5250
|
exports.compareBaseStyles = compareBaseStyles;
|
|
5251
|
+
|
|
4635
5252
|
var formatMetadata = function formatMetadata(choroplethLayer, i) {
|
|
4636
5253
|
if (!choroplethLayer || !choroplethLayer.areaIds || !choroplethLayer.areaValues) return {};
|
|
4637
5254
|
if (i >= choroplethLayer.areaIds.length) return {};
|
|
@@ -4648,22 +5265,16 @@ var formatMetadata = function formatMetadata(choroplethLayer, i) {
|
|
|
4648
5265
|
return Object.assign(Object.assign({}, result), _defineProperty({}, key, val));
|
|
4649
5266
|
}, base);
|
|
4650
5267
|
};
|
|
5268
|
+
|
|
4651
5269
|
exports.formatMetadata = formatMetadata;
|
|
4652
5270
|
|
|
4653
5271
|
/***/ }),
|
|
4654
5272
|
|
|
4655
|
-
/***/
|
|
5273
|
+
/***/ 93:
|
|
4656
5274
|
/***/ (function(module, exports) {
|
|
4657
5275
|
|
|
4658
5276
|
module.exports = require("d3-scale");
|
|
4659
5277
|
|
|
4660
|
-
/***/ }),
|
|
4661
|
-
|
|
4662
|
-
/***/ 94:
|
|
4663
|
-
/***/ (function(module, exports) {
|
|
4664
|
-
|
|
4665
|
-
module.exports = require("@splunk/visualization-encoding/utils/types");
|
|
4666
|
-
|
|
4667
5278
|
/***/ })
|
|
4668
5279
|
|
|
4669
5280
|
/******/ });
|