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