@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.config.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 = 57);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
93
|
/******/ ([
|
|
@@ -114,6 +114,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
114
114
|
});
|
|
115
115
|
exports.VizBehavior = void 0;
|
|
116
116
|
var VizBehavior;
|
|
117
|
+
|
|
117
118
|
(function (VizBehavior) {
|
|
118
119
|
/**
|
|
119
120
|
* Dynamic Options Behavior.
|
|
@@ -133,6 +134,7 @@ var VizBehavior;
|
|
|
133
134
|
* missing.
|
|
134
135
|
* @type {string}
|
|
135
136
|
*/
|
|
137
|
+
|
|
136
138
|
VizBehavior["PLACEHOLDER"] = "placeholder";
|
|
137
139
|
VizBehavior["PAGE_AND_SORT"] = "page-and-sort";
|
|
138
140
|
VizBehavior["TRELLIS"] = "trellis";
|
|
@@ -152,24 +154,33 @@ module.exports = require("@splunk/visualizations-shared/schemaUtils");
|
|
|
152
154
|
|
|
153
155
|
|
|
154
156
|
var _toConsumableArray = __webpack_require__(1);
|
|
157
|
+
|
|
155
158
|
var _defineProperty = __webpack_require__(7);
|
|
159
|
+
|
|
156
160
|
var __rest = this && this.__rest || function (s, e) {
|
|
157
161
|
var t = {};
|
|
162
|
+
|
|
158
163
|
for (var p in s) {
|
|
159
164
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
160
165
|
}
|
|
166
|
+
|
|
161
167
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
162
168
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
163
169
|
}
|
|
164
170
|
return t;
|
|
165
171
|
};
|
|
172
|
+
|
|
166
173
|
Object.defineProperty(exports, "__esModule", {
|
|
167
174
|
value: true
|
|
168
175
|
});
|
|
169
176
|
exports.insertLayout = exports.isDynamicOption = exports.uncollapseEditorConfig = exports.generatePrecisionValues = exports.getInitialPreset = exports.enhanceOptionsSchemaWithDynamicOptions = exports.enhanceConfig = void 0;
|
|
177
|
+
|
|
170
178
|
var lodash_1 = __webpack_require__(6);
|
|
179
|
+
|
|
171
180
|
var schemaUtils_1 = __webpack_require__(3);
|
|
181
|
+
|
|
172
182
|
var VizBehavior_1 = __webpack_require__(2);
|
|
183
|
+
|
|
173
184
|
var dynamicOptionsDSLType = {
|
|
174
185
|
type: 'string',
|
|
175
186
|
pattern: schemaUtils_1.DYNAMIC_OPTIONS_DSL_PATTERN
|
|
@@ -179,20 +190,22 @@ var dynamicOptionsDSLType = {
|
|
|
179
190
|
* @param optionsSchema a visualization's options schema
|
|
180
191
|
* @returns an updated options schema that additionally allows strings starting with > for each option
|
|
181
192
|
*/
|
|
193
|
+
|
|
182
194
|
function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
183
195
|
var enhancedOptionsSchema = {};
|
|
184
196
|
Object.keys(optionsSchema).forEach(function (key) {
|
|
185
197
|
var _a = optionsSchema[key],
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
title = _a.title,
|
|
199
|
+
description = _a.description,
|
|
200
|
+
readOnly = _a.readOnly,
|
|
201
|
+
writeOnly = _a.writeOnly,
|
|
202
|
+
examples = _a.examples,
|
|
203
|
+
defaultValue = _a.default,
|
|
204
|
+
type = _a.type,
|
|
205
|
+
properties = _a.properties,
|
|
206
|
+
patternProperties = _a.patternProperties,
|
|
207
|
+
remainingSchemaEntry = __rest(_a, ["title", "description", "readOnly", "writeOnly", "examples", "default", "type", "properties", "patternProperties"]);
|
|
208
|
+
|
|
196
209
|
var annotations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, title !== undefined && {
|
|
197
210
|
title: title
|
|
198
211
|
}), description !== undefined && {
|
|
@@ -206,12 +219,14 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
206
219
|
}), defaultValue !== undefined && {
|
|
207
220
|
default: defaultValue
|
|
208
221
|
});
|
|
222
|
+
|
|
209
223
|
if (type === 'object') {
|
|
210
224
|
enhancedOptionsSchema[key] = Object.assign(Object.assign(Object.assign(Object.assign({}, remainingSchemaEntry), annotations), {
|
|
211
225
|
type: type
|
|
212
226
|
}), properties && {
|
|
213
227
|
properties: enhanceOptionsSchemaWithDynamicOptions(properties)
|
|
214
228
|
});
|
|
229
|
+
|
|
215
230
|
if (patternProperties) {
|
|
216
231
|
var enhancedPatternProperties = {};
|
|
217
232
|
Object.keys(patternProperties).forEach(function (opt) {
|
|
@@ -229,6 +244,7 @@ function enhanceOptionsSchemaWithDynamicOptions(optionsSchema) {
|
|
|
229
244
|
});
|
|
230
245
|
return enhancedOptionsSchema;
|
|
231
246
|
}
|
|
247
|
+
|
|
232
248
|
exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamicOptions;
|
|
233
249
|
/**
|
|
234
250
|
* Helper function to enhance a Visualization Config as needed based on behaviors specified in supports block
|
|
@@ -237,11 +253,14 @@ exports.enhanceOptionsSchemaWithDynamicOptions = enhanceOptionsSchemaWithDynamic
|
|
|
237
253
|
* @returns an enhanced Visualization Config containing updated config entries based on behaviors it supports
|
|
238
254
|
* and containing `open: false` for all editor panels in editorConfig
|
|
239
255
|
*/
|
|
256
|
+
|
|
240
257
|
function enhanceConfig(vizConfig) {
|
|
241
258
|
var enhancedConfig = Object.assign({}, vizConfig);
|
|
259
|
+
|
|
242
260
|
if (vizConfig.supports.indexOf(VizBehavior_1.VizBehavior.DYNAMIC_OPTIONS) !== -1) {
|
|
243
261
|
enhancedConfig.optionsSchema = enhanceOptionsSchemaWithDynamicOptions(vizConfig.optionsSchema);
|
|
244
262
|
}
|
|
263
|
+
|
|
245
264
|
enhancedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
246
265
|
return Object.assign(Object.assign({}, config), {
|
|
247
266
|
open: config.open || false
|
|
@@ -249,6 +268,7 @@ function enhanceConfig(vizConfig) {
|
|
|
249
268
|
});
|
|
250
269
|
return enhancedConfig;
|
|
251
270
|
}
|
|
271
|
+
|
|
252
272
|
exports.enhanceConfig = enhanceConfig;
|
|
253
273
|
/**
|
|
254
274
|
* Helper function to uncollapse all editor panels by adding `open: true` to the editorConfig
|
|
@@ -256,6 +276,7 @@ exports.enhanceConfig = enhanceConfig;
|
|
|
256
276
|
* @param vizConfig a Visualization Config
|
|
257
277
|
* @returns a Visualization Config containing `open: true` for all editor panels in editorConfig
|
|
258
278
|
*/
|
|
279
|
+
|
|
259
280
|
function uncollapseEditorConfig(vizConfig) {
|
|
260
281
|
var editorPanelUncollapsedConfig = Object.assign({}, vizConfig);
|
|
261
282
|
editorPanelUncollapsedConfig.editorConfig = vizConfig.editorConfig.map(function (config) {
|
|
@@ -265,13 +286,16 @@ function uncollapseEditorConfig(vizConfig) {
|
|
|
265
286
|
});
|
|
266
287
|
return editorPanelUncollapsedConfig;
|
|
267
288
|
}
|
|
289
|
+
|
|
268
290
|
exports.uncollapseEditorConfig = uncollapseEditorConfig;
|
|
291
|
+
|
|
269
292
|
function isDynamicOption(option) {
|
|
270
293
|
return option && typeof option === 'string' && option.trim().startsWith('>') || false;
|
|
271
294
|
}
|
|
272
|
-
|
|
273
|
-
// private helpers to improve readability of getInitialPreset
|
|
295
|
+
|
|
296
|
+
exports.isDynamicOption = isDynamicOption; // private helpers to improve readability of getInitialPreset
|
|
274
297
|
// this shouldn't be tested since this util isn't something that we expect to use outside of getInitialPreset
|
|
298
|
+
|
|
275
299
|
/**
|
|
276
300
|
* this checks to make sure that all values within vizContext are compatible with the given preset's context to determine the initialPreset
|
|
277
301
|
* 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
|
|
@@ -280,6 +304,7 @@ exports.isDynamicOption = isDynamicOption;
|
|
|
280
304
|
*
|
|
281
305
|
* Since the presetConfigs have explicit undefined keys to override the existing config, we need to explicitly check the undefined values
|
|
282
306
|
*/
|
|
307
|
+
|
|
283
308
|
function hasCompatibleContexts(vizContext, presetContext) {
|
|
284
309
|
var presetContextKeys = Object.keys(presetContext);
|
|
285
310
|
return presetContextKeys.every(function (contextKey) {
|
|
@@ -289,6 +314,8 @@ function hasCompatibleContexts(vizContext, presetContext) {
|
|
|
289
314
|
/**
|
|
290
315
|
* Checks to make sure that dynamic (non-dynamic) options in a given preset are also dynamic (non-dynamic) in the vizOptions
|
|
291
316
|
*/
|
|
317
|
+
|
|
318
|
+
|
|
292
319
|
function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
293
320
|
var presetOptionKeys = Object.keys(presetOptions);
|
|
294
321
|
return presetOptionKeys.every(function (optionKey) {
|
|
@@ -303,18 +330,21 @@ function hasCompatibleOptions(vizOptions, presetOptions) {
|
|
|
303
330
|
* @param {Object} vizOptions - the current vizOptions definition
|
|
304
331
|
* @param {PresetEntry[]} presets - the list of presets, one of which can be considered an initialPreset
|
|
305
332
|
*/
|
|
333
|
+
|
|
334
|
+
|
|
306
335
|
function getInitialPreset(vizContext, vizOptions, presets) {
|
|
307
336
|
return presets.find(function (preset) {
|
|
308
|
-
var presetContext = lodash_1.get(preset, ['value', 'context'], {});
|
|
309
|
-
var presetOptions = lodash_1.get(preset, ['value', 'options'], {});
|
|
337
|
+
var presetContext = (0, lodash_1.get)(preset, ['value', 'context'], {});
|
|
338
|
+
var presetOptions = (0, lodash_1.get)(preset, ['value', 'options'], {});
|
|
310
339
|
var presetContextKeys = Object.keys(presetContext);
|
|
311
|
-
var presetOptionKeys = Object.keys(presetOptions);
|
|
312
|
-
// all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
340
|
+
var presetOptionKeys = Object.keys(presetOptions); // all presets have to explicitly specify which options to reset (i.e. need explicitly undefined keys)
|
|
313
341
|
// if not, then the preset is invalid in config.ts
|
|
342
|
+
|
|
314
343
|
if (presetContextKeys.length === 0 || presetOptionKeys.length === 0) return false;
|
|
315
344
|
return hasCompatibleContexts(vizContext, presetContext) && hasCompatibleOptions(vizOptions, presetOptions);
|
|
316
345
|
});
|
|
317
346
|
}
|
|
347
|
+
|
|
318
348
|
exports.getInitialPreset = getInitialPreset;
|
|
319
349
|
/**
|
|
320
350
|
* generates number precision values for a Select editor
|
|
@@ -322,14 +352,16 @@ exports.getInitialPreset = getInitialPreset;
|
|
|
322
352
|
* @param {Number} numPrecisionValues - number of integer precision values to generate
|
|
323
353
|
* @returns {{ label: string; value; string }[]} array of { label, value } tuples
|
|
324
354
|
*/
|
|
355
|
+
|
|
325
356
|
function generatePrecisionValues(numPrecisionValues) {
|
|
326
|
-
return lodash_1.range(0, numPrecisionValues + 1).map(function (i) {
|
|
357
|
+
return (0, lodash_1.range)(0, numPrecisionValues + 1).map(function (i) {
|
|
327
358
|
return {
|
|
328
359
|
label: "".concat(i, " (0").concat(i > 0 ? '.' : '').concat('0'.repeat(i), ")"),
|
|
329
360
|
value: i
|
|
330
361
|
};
|
|
331
362
|
});
|
|
332
363
|
}
|
|
364
|
+
|
|
333
365
|
exports.generatePrecisionValues = generatePrecisionValues;
|
|
334
366
|
/**
|
|
335
367
|
* insert layout in layout array, return a new layout array instead of updating the original
|
|
@@ -339,12 +371,15 @@ exports.generatePrecisionValues = generatePrecisionValues;
|
|
|
339
371
|
* @param {EditorLayoutConfig[][]} layoutItems - the item(s) to insert
|
|
340
372
|
* @returns {EditorLayoutConfig[][]} new editor layout with insertion
|
|
341
373
|
*/
|
|
374
|
+
|
|
342
375
|
var insertLayout = function insertLayout(layout, index) {
|
|
343
376
|
for (var _len = arguments.length, layoutItems = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
344
377
|
layoutItems[_key - 2] = arguments[_key];
|
|
345
378
|
}
|
|
379
|
+
|
|
346
380
|
return [].concat(_toConsumableArray(layout.slice(0, index)), layoutItems, _toConsumableArray(layout.slice(index)));
|
|
347
381
|
};
|
|
382
|
+
|
|
348
383
|
exports.insertLayout = insertLayout;
|
|
349
384
|
|
|
350
385
|
/***/ }),
|
|
@@ -372,6 +407,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
372
407
|
});
|
|
373
408
|
exports.VizCategory = void 0;
|
|
374
409
|
var VizCategory;
|
|
410
|
+
|
|
375
411
|
(function (VizCategory) {
|
|
376
412
|
VizCategory["SINGLE_VALUE"] = "Single Value";
|
|
377
413
|
VizCategory["TRENDS"] = "Trends";
|
|
@@ -411,13 +447,15 @@ module.exports = require("@splunk/visualization-icons");
|
|
|
411
447
|
Object.defineProperty(exports, "__esModule", {
|
|
412
448
|
value: true
|
|
413
449
|
});
|
|
450
|
+
|
|
414
451
|
var i18n_1 = __webpack_require__(0);
|
|
452
|
+
|
|
415
453
|
var background = function background(_ref) {
|
|
416
454
|
var label = _ref.label,
|
|
417
|
-
|
|
418
|
-
|
|
455
|
+
themes = _ref.themes,
|
|
456
|
+
labelPosition = _ref.labelPosition;
|
|
419
457
|
return [{
|
|
420
|
-
label: i18n_1._(label || 'Background'),
|
|
458
|
+
label: (0, i18n_1._)(label || 'Background'),
|
|
421
459
|
option: 'backgroundColor',
|
|
422
460
|
editor: 'editor.color',
|
|
423
461
|
editorProps: {
|
|
@@ -426,6 +464,7 @@ var background = function background(_ref) {
|
|
|
426
464
|
}
|
|
427
465
|
}];
|
|
428
466
|
};
|
|
467
|
+
|
|
429
468
|
exports.default = background;
|
|
430
469
|
|
|
431
470
|
/***/ }),
|
|
@@ -481,7 +520,8 @@ module.exports = require("@splunk/themes");
|
|
|
481
520
|
/* 53 */,
|
|
482
521
|
/* 54 */,
|
|
483
522
|
/* 55 */,
|
|
484
|
-
/* 56
|
|
523
|
+
/* 56 */,
|
|
524
|
+
/* 57 */
|
|
485
525
|
/***/ (function(module, exports, __webpack_require__) {
|
|
486
526
|
|
|
487
527
|
"use strict";
|
|
@@ -490,17 +530,29 @@ module.exports = require("@splunk/themes");
|
|
|
490
530
|
Object.defineProperty(exports, "__esModule", {
|
|
491
531
|
value: true
|
|
492
532
|
});
|
|
533
|
+
|
|
493
534
|
var visualization_icons_1 = __webpack_require__(12);
|
|
535
|
+
|
|
494
536
|
var placeholders_1 = __webpack_require__(11);
|
|
537
|
+
|
|
495
538
|
var schemaUtils_1 = __webpack_require__(3);
|
|
539
|
+
|
|
496
540
|
var visualization_color_palettes_1 = __webpack_require__(14);
|
|
541
|
+
|
|
497
542
|
var themes_1 = __webpack_require__(21);
|
|
543
|
+
|
|
498
544
|
var i18n_1 = __webpack_require__(0);
|
|
545
|
+
|
|
499
546
|
var VizBehavior_1 = __webpack_require__(2);
|
|
547
|
+
|
|
500
548
|
var VizCategory_1 = __webpack_require__(8);
|
|
549
|
+
|
|
501
550
|
var configUtils_1 = __webpack_require__(4);
|
|
502
|
-
|
|
551
|
+
|
|
552
|
+
var MapUtils_1 = __webpack_require__(58);
|
|
553
|
+
|
|
503
554
|
var BackgroundColor_1 = __webpack_require__(13);
|
|
555
|
+
|
|
504
556
|
var defaultContext = {
|
|
505
557
|
colorRangeConfig: [{
|
|
506
558
|
to: 20,
|
|
@@ -553,7 +605,7 @@ var optionsSchema = {
|
|
|
553
605
|
baseLayerTileServerType: {
|
|
554
606
|
type: 'string',
|
|
555
607
|
description: 'Specify the type of tile set for the base map.',
|
|
556
|
-
pattern: schemaUtils_1.getPattern(['vector', 'raster'])
|
|
608
|
+
pattern: (0, schemaUtils_1.getPattern)(['vector', 'raster'])
|
|
557
609
|
},
|
|
558
610
|
center: {
|
|
559
611
|
type: 'array',
|
|
@@ -600,7 +652,7 @@ var optionsSchema = {
|
|
|
600
652
|
type: {
|
|
601
653
|
description: 'Specify the type of data layer method to display points on the map. For example, “bubble”, “marker”, or "choropleth".',
|
|
602
654
|
type: 'string',
|
|
603
|
-
pattern: schemaUtils_1.getPattern([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
|
|
655
|
+
pattern: (0, schemaUtils_1.getPattern)([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
|
|
604
656
|
default: MapUtils_1.LAYER_TYPE.Marker
|
|
605
657
|
},
|
|
606
658
|
latitude: {
|
|
@@ -655,7 +707,7 @@ var optionsSchema = {
|
|
|
655
707
|
type: {
|
|
656
708
|
description: 'Specify the type of data layer method to display points on the map. For example, “bubble”, “marker”, or "choropleth".',
|
|
657
709
|
type: 'string',
|
|
658
|
-
pattern: schemaUtils_1.getPattern([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
|
|
710
|
+
pattern: (0, schemaUtils_1.getPattern)([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
|
|
659
711
|
default: MapUtils_1.LAYER_TYPE.Choropleth
|
|
660
712
|
},
|
|
661
713
|
areaIds: {
|
|
@@ -697,7 +749,7 @@ var optionsSchema = {
|
|
|
697
749
|
},
|
|
698
750
|
source: {
|
|
699
751
|
description: 'Source for the geodata for choropleth layer: "us" or "world", and will override data specified in the SPL geom command.',
|
|
700
|
-
pattern: schemaUtils_1.getPattern(['geo://default/us', 'geo://default/world']),
|
|
752
|
+
pattern: (0, schemaUtils_1.getPattern)(['geo://default/us', 'geo://default/world']),
|
|
701
753
|
type: 'string'
|
|
702
754
|
},
|
|
703
755
|
choroplethEmptyAreaColor: {
|
|
@@ -724,7 +776,7 @@ var optionsSchema = {
|
|
|
724
776
|
type: {
|
|
725
777
|
description: 'Specify the type of data layer method to display points on the map. For example, “bubble”, “marker”, or "choropleth".',
|
|
726
778
|
type: 'string',
|
|
727
|
-
pattern: schemaUtils_1.getPattern([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
|
|
779
|
+
pattern: (0, schemaUtils_1.getPattern)([MapUtils_1.LAYER_TYPE.Marker, MapUtils_1.LAYER_TYPE.Bubble, MapUtils_1.LAYER_TYPE.Choropleth]),
|
|
728
780
|
default: MapUtils_1.LAYER_TYPE.Bubble
|
|
729
781
|
},
|
|
730
782
|
bubbleSize: {
|
|
@@ -788,7 +840,7 @@ var optionsSchema = {
|
|
|
788
840
|
default: 'metric',
|
|
789
841
|
type: 'string',
|
|
790
842
|
description: 'Specify the scale unit to use.',
|
|
791
|
-
pattern: schemaUtils_1.getPattern(['metric', 'imperial'])
|
|
843
|
+
pattern: (0, schemaUtils_1.getPattern)(['metric', 'imperial'])
|
|
792
844
|
},
|
|
793
845
|
showBaseLayer: {
|
|
794
846
|
default: true,
|
|
@@ -812,7 +864,7 @@ var optionsSchema = {
|
|
|
812
864
|
};
|
|
813
865
|
var themes = {
|
|
814
866
|
defaultBackgroundColor: function defaultBackgroundColor(props) {
|
|
815
|
-
return themes_1.pick({
|
|
867
|
+
return (0, themes_1.pick)({
|
|
816
868
|
enterprise: {
|
|
817
869
|
dark: themes_1.variables.black(props),
|
|
818
870
|
light: themes_1.variables.backgroundColor(props)
|
|
@@ -821,7 +873,7 @@ var themes = {
|
|
|
821
873
|
})(props);
|
|
822
874
|
},
|
|
823
875
|
controlBackgroundColor: function controlBackgroundColor(props) {
|
|
824
|
-
return themes_1.pick({
|
|
876
|
+
return (0, themes_1.pick)({
|
|
825
877
|
enterprise: {
|
|
826
878
|
dark: themes_1.variables.gray22(props),
|
|
827
879
|
light: themes_1.variables.white(props)
|
|
@@ -830,13 +882,13 @@ var themes = {
|
|
|
830
882
|
})(props);
|
|
831
883
|
},
|
|
832
884
|
controlForegroundColor: function controlForegroundColor(props) {
|
|
833
|
-
return themes_1.pick({
|
|
885
|
+
return (0, themes_1.pick)({
|
|
834
886
|
enterprise: themes_1.variables.textColor(props),
|
|
835
887
|
prisma: themes_1.variables.contentColorDefault(props)
|
|
836
888
|
})(props);
|
|
837
889
|
},
|
|
838
890
|
defaultChoroplethEmptyAreaColor: function defaultChoroplethEmptyAreaColor(props) {
|
|
839
|
-
return themes_1.pick({
|
|
891
|
+
return (0, themes_1.pick)({
|
|
840
892
|
enterprise: {
|
|
841
893
|
dark: themes_1.variables.gray22(props),
|
|
842
894
|
light: themes_1.variables.gray92(props)
|
|
@@ -848,7 +900,7 @@ var themes = {
|
|
|
848
900
|
})(props);
|
|
849
901
|
},
|
|
850
902
|
defaultGradientMigrationConfig: function defaultGradientMigrationConfig(props) {
|
|
851
|
-
return themes_1.pick({
|
|
903
|
+
return (0, themes_1.pick)({
|
|
852
904
|
enterprise: {
|
|
853
905
|
dark: ['#4D4A5D', themes_1.variables.syntaxPurple(props)],
|
|
854
906
|
light: ['#D2CFDC', themes_1.variables.syntaxPurple(props)]
|
|
@@ -860,33 +912,36 @@ var themes = {
|
|
|
860
912
|
})(props);
|
|
861
913
|
}
|
|
862
914
|
};
|
|
915
|
+
|
|
863
916
|
var checkTypeIsChoropleth = function checkTypeIsChoropleth(options) {
|
|
864
917
|
return options.layers && options.layers.length && options.layers[0].type === MapUtils_1.LAYER_TYPE.Choropleth;
|
|
865
918
|
};
|
|
919
|
+
|
|
866
920
|
var checkTypeIsLocalChoropleth = function checkTypeIsLocalChoropleth(options) {
|
|
867
921
|
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');
|
|
868
922
|
};
|
|
923
|
+
|
|
869
924
|
var EDITOR_LABEL_WIDTH = 140;
|
|
870
925
|
var editorConfig = [{
|
|
871
|
-
label: i18n_1._('Data configurations'),
|
|
926
|
+
label: (0, i18n_1._)('Data configurations'),
|
|
872
927
|
layout: [[{
|
|
873
|
-
label: i18n_1._('Layer type'),
|
|
928
|
+
label: (0, i18n_1._)('Layer type'),
|
|
874
929
|
option: 'layers[0].type',
|
|
875
930
|
editor: 'editor.select',
|
|
876
931
|
editorProps: {
|
|
877
932
|
values: [{
|
|
878
|
-
label: i18n_1._('Bubble'),
|
|
933
|
+
label: (0, i18n_1._)('Bubble'),
|
|
879
934
|
value: MapUtils_1.LAYER_TYPE.Bubble
|
|
880
935
|
}, {
|
|
881
|
-
label: i18n_1._('Marker'),
|
|
936
|
+
label: (0, i18n_1._)('Marker'),
|
|
882
937
|
value: MapUtils_1.LAYER_TYPE.Marker
|
|
883
938
|
}, {
|
|
884
|
-
label: i18n_1._('Choropleth'),
|
|
939
|
+
label: (0, i18n_1._)('Choropleth'),
|
|
885
940
|
value: MapUtils_1.LAYER_TYPE.Choropleth
|
|
886
941
|
}]
|
|
887
942
|
}
|
|
888
943
|
}], [{
|
|
889
|
-
label: i18n_1._('Area IDs'),
|
|
944
|
+
label: (0, i18n_1._)('Area IDs'),
|
|
890
945
|
option: 'layers[0].areaIds',
|
|
891
946
|
editor: 'editor.columnSelector',
|
|
892
947
|
showEditor: function showEditor(_ref) {
|
|
@@ -899,7 +954,7 @@ var editorConfig = [{
|
|
|
899
954
|
filterByTypes: ['string']
|
|
900
955
|
}
|
|
901
956
|
}], [{
|
|
902
|
-
label: i18n_1._('Area values'),
|
|
957
|
+
label: (0, i18n_1._)('Area values'),
|
|
903
958
|
option: 'layers[0].areaValues',
|
|
904
959
|
editor: 'editor.columnSelector',
|
|
905
960
|
showEditor: function showEditor(_ref2) {
|
|
@@ -912,7 +967,7 @@ var editorConfig = [{
|
|
|
912
967
|
filterByTypes: ['number']
|
|
913
968
|
}
|
|
914
969
|
}], [{
|
|
915
|
-
label: i18n_1._('Latitude'),
|
|
970
|
+
label: (0, i18n_1._)('Latitude'),
|
|
916
971
|
option: 'layers[0].latitude',
|
|
917
972
|
editor: 'editor.columnSelector',
|
|
918
973
|
showEditor: function showEditor(_ref3) {
|
|
@@ -924,7 +979,7 @@ var editorConfig = [{
|
|
|
924
979
|
shouldShowInternalFields: false
|
|
925
980
|
}
|
|
926
981
|
}], [{
|
|
927
|
-
label: i18n_1._('Longitude'),
|
|
982
|
+
label: (0, i18n_1._)('Longitude'),
|
|
928
983
|
option: 'layers[0].longitude',
|
|
929
984
|
editor: 'editor.columnSelector',
|
|
930
985
|
showEditor: function showEditor(_ref4) {
|
|
@@ -936,7 +991,7 @@ var editorConfig = [{
|
|
|
936
991
|
shouldShowInternalFields: false
|
|
937
992
|
}
|
|
938
993
|
}], [{
|
|
939
|
-
label: i18n_1._('Bubble size'),
|
|
994
|
+
label: (0, i18n_1._)('Bubble size'),
|
|
940
995
|
option: 'layers[0].bubbleSize',
|
|
941
996
|
editor: 'editor.columnMultiSelector',
|
|
942
997
|
showEditor: function showEditor(_ref5) {
|
|
@@ -949,11 +1004,11 @@ var editorConfig = [{
|
|
|
949
1004
|
excludeByNames: ['latitude', 'longitude', 'geobin']
|
|
950
1005
|
}
|
|
951
1006
|
}], [{
|
|
952
|
-
label: i18n_1._('Additional tooltip fields'),
|
|
1007
|
+
label: (0, i18n_1._)('Additional tooltip fields'),
|
|
953
1008
|
option: 'layers[0].additionalTooltipFields',
|
|
954
1009
|
editor: 'editor.columnMultiSelectionByFieldNameEditor'
|
|
955
1010
|
}], [{
|
|
956
|
-
label: i18n_1._('Result limit'),
|
|
1011
|
+
label: (0, i18n_1._)('Result limit'),
|
|
957
1012
|
option: 'layers[0].resultLimit',
|
|
958
1013
|
editor: 'editor.number',
|
|
959
1014
|
showEditor: function showEditor(_ref6) {
|
|
@@ -967,9 +1022,9 @@ var editorConfig = [{
|
|
|
967
1022
|
}
|
|
968
1023
|
}]]
|
|
969
1024
|
}, {
|
|
970
|
-
label: i18n_1._('Data display'),
|
|
1025
|
+
label: (0, i18n_1._)('Data display'),
|
|
971
1026
|
layout: [[{
|
|
972
|
-
label: i18n_1._('Latitude (initial map location)'),
|
|
1027
|
+
label: (0, i18n_1._)('Latitude (initial map location)'),
|
|
973
1028
|
option: 'center[0]',
|
|
974
1029
|
editor: 'editor.number',
|
|
975
1030
|
editorProps: {
|
|
@@ -979,7 +1034,7 @@ var editorConfig = [{
|
|
|
979
1034
|
max: 90
|
|
980
1035
|
}
|
|
981
1036
|
}], [{
|
|
982
|
-
label: i18n_1._('Longitude (initial map location)'),
|
|
1037
|
+
label: (0, i18n_1._)('Longitude (initial map location)'),
|
|
983
1038
|
option: 'center[1]',
|
|
984
1039
|
editor: 'editor.number',
|
|
985
1040
|
editorProps: {
|
|
@@ -989,7 +1044,7 @@ var editorConfig = [{
|
|
|
989
1044
|
max: 180
|
|
990
1045
|
}
|
|
991
1046
|
}], [{
|
|
992
|
-
label: i18n_1._('Zoom (initial map location)'),
|
|
1047
|
+
label: (0, i18n_1._)('Zoom (initial map location)'),
|
|
993
1048
|
option: 'zoom',
|
|
994
1049
|
editor: 'editor.number',
|
|
995
1050
|
editorProps: {
|
|
@@ -998,7 +1053,7 @@ var editorConfig = [{
|
|
|
998
1053
|
min: 0
|
|
999
1054
|
}
|
|
1000
1055
|
}], [{
|
|
1001
|
-
label: i18n_1._('Show zoom controls'),
|
|
1056
|
+
label: (0, i18n_1._)('Show zoom controls'),
|
|
1002
1057
|
option: 'showZoomControls',
|
|
1003
1058
|
editor: 'editor.checkbox',
|
|
1004
1059
|
editorProps: {
|
|
@@ -1006,7 +1061,7 @@ var editorConfig = [{
|
|
|
1006
1061
|
labelWidth: EDITOR_LABEL_WIDTH
|
|
1007
1062
|
}
|
|
1008
1063
|
}], [{
|
|
1009
|
-
label: i18n_1._('Show scale'),
|
|
1064
|
+
label: (0, i18n_1._)('Show scale'),
|
|
1010
1065
|
option: 'showScale',
|
|
1011
1066
|
editor: 'editor.toggle',
|
|
1012
1067
|
editorProps: {
|
|
@@ -1014,7 +1069,7 @@ var editorConfig = [{
|
|
|
1014
1069
|
labelWidth: EDITOR_LABEL_WIDTH
|
|
1015
1070
|
}
|
|
1016
1071
|
}], [{
|
|
1017
|
-
label: i18n_1._('Scale unit'),
|
|
1072
|
+
label: (0, i18n_1._)('Scale unit'),
|
|
1018
1073
|
option: 'scaleUnit',
|
|
1019
1074
|
editor: 'editor.radioBar',
|
|
1020
1075
|
showEditor: function showEditor(_ref7) {
|
|
@@ -1023,18 +1078,17 @@ var editorConfig = [{
|
|
|
1023
1078
|
},
|
|
1024
1079
|
editorProps: {
|
|
1025
1080
|
values: [{
|
|
1026
|
-
label: i18n_1._('Metric'),
|
|
1081
|
+
label: (0, i18n_1._)('Metric'),
|
|
1027
1082
|
value: 'metric'
|
|
1028
1083
|
}, {
|
|
1029
|
-
label: i18n_1._('Imperial'),
|
|
1084
|
+
label: (0, i18n_1._)('Imperial'),
|
|
1030
1085
|
value: 'imperial'
|
|
1031
1086
|
}]
|
|
1032
1087
|
}
|
|
1033
1088
|
}]]
|
|
1034
1089
|
}, {
|
|
1035
|
-
label: i18n_1._('Color and style'),
|
|
1036
|
-
layout: [
|
|
1037
|
-
// TODO: add support for color mode option and its corresponding editor
|
|
1090
|
+
label: (0, i18n_1._)('Color and style'),
|
|
1091
|
+
layout: [// TODO: add support for color mode option and its corresponding editor
|
|
1038
1092
|
// [
|
|
1039
1093
|
// {
|
|
1040
1094
|
// label: _('Color mode'),
|
|
@@ -1049,15 +1103,14 @@ var editorConfig = [{
|
|
|
1049
1103
|
// },
|
|
1050
1104
|
// ],
|
|
1051
1105
|
[{
|
|
1052
|
-
label: i18n_1._('Series colors'),
|
|
1106
|
+
label: (0, i18n_1._)('Series colors'),
|
|
1053
1107
|
option: 'layers[0].seriesColors',
|
|
1054
1108
|
editor: 'editor.seriesColors',
|
|
1055
1109
|
showEditor: function showEditor(_ref8) {
|
|
1056
1110
|
var options = _ref8.options;
|
|
1057
1111
|
return !(options.layers && options.layers.length && options.layers[0].type === 'choropleth');
|
|
1058
1112
|
}
|
|
1059
|
-
}],
|
|
1060
|
-
// TODO: add editor for data colors
|
|
1113
|
+
}], // TODO: add editor for data colors
|
|
1061
1114
|
// [
|
|
1062
1115
|
// {
|
|
1063
1116
|
// label: _('Data colors'),
|
|
@@ -1070,7 +1123,7 @@ var editorConfig = [{
|
|
|
1070
1123
|
// },
|
|
1071
1124
|
// ],
|
|
1072
1125
|
[{
|
|
1073
|
-
label: i18n_1._('Choropleth empty area'),
|
|
1126
|
+
label: (0, i18n_1._)('Choropleth empty area'),
|
|
1074
1127
|
option: 'layers[0].choroplethEmptyAreaColor',
|
|
1075
1128
|
editor: 'editor.color',
|
|
1076
1129
|
showEditor: function showEditor(_ref9) {
|
|
@@ -1081,7 +1134,7 @@ var editorConfig = [{
|
|
|
1081
1134
|
themes: themes
|
|
1082
1135
|
}
|
|
1083
1136
|
}], [{
|
|
1084
|
-
label: i18n_1._('Choropleth stroke'),
|
|
1137
|
+
label: (0, i18n_1._)('Choropleth stroke'),
|
|
1085
1138
|
option: 'layers[0].choroplethStrokeColor',
|
|
1086
1139
|
editor: 'editor.color',
|
|
1087
1140
|
showEditor: function showEditor(_ref10) {
|
|
@@ -1092,7 +1145,7 @@ var editorConfig = [{
|
|
|
1092
1145
|
themes: themes
|
|
1093
1146
|
}
|
|
1094
1147
|
}], [{
|
|
1095
|
-
label: i18n_1._('Choropleth opacity (%)'),
|
|
1148
|
+
label: (0, i18n_1._)('Choropleth opacity (%)'),
|
|
1096
1149
|
option: 'layers[0].choroplethOpacity',
|
|
1097
1150
|
editor: 'editor.percent',
|
|
1098
1151
|
showEditor: function showEditor(_ref11) {
|
|
@@ -1103,8 +1156,7 @@ var editorConfig = [{
|
|
|
1103
1156
|
themes: themes,
|
|
1104
1157
|
min: 0
|
|
1105
1158
|
}
|
|
1106
|
-
}],
|
|
1107
|
-
// TODO: add support for seriesColorsByField option
|
|
1159
|
+
}], // TODO: add support for seriesColorsByField option
|
|
1108
1160
|
// [
|
|
1109
1161
|
// {
|
|
1110
1162
|
// label: _('Series colors by field name'),
|
|
@@ -1112,14 +1164,14 @@ var editorConfig = [{
|
|
|
1112
1164
|
// editor: 'editor.seriesColorsByField',
|
|
1113
1165
|
// },
|
|
1114
1166
|
// ],
|
|
1115
|
-
BackgroundColor_1.default({
|
|
1167
|
+
(0, BackgroundColor_1.default)({
|
|
1116
1168
|
themes: themes
|
|
1117
1169
|
}), [{
|
|
1118
|
-
label: i18n_1._('Show base layer'),
|
|
1170
|
+
label: (0, i18n_1._)('Show base layer'),
|
|
1119
1171
|
option: 'showBaseLayer',
|
|
1120
1172
|
editor: 'editor.toggle'
|
|
1121
1173
|
}], [{
|
|
1122
|
-
label: i18n_1._('Base layer tile server'),
|
|
1174
|
+
label: (0, i18n_1._)('Base layer tile server'),
|
|
1123
1175
|
option: 'baseLayerTileServer',
|
|
1124
1176
|
editor: 'editor.text',
|
|
1125
1177
|
showEditor: function showEditor(_ref12) {
|
|
@@ -1127,7 +1179,7 @@ var editorConfig = [{
|
|
|
1127
1179
|
return options.showBaseLayer !== false;
|
|
1128
1180
|
}
|
|
1129
1181
|
}], [{
|
|
1130
|
-
label: i18n_1._('Base layer tile server type'),
|
|
1182
|
+
label: (0, i18n_1._)('Base layer tile server type'),
|
|
1131
1183
|
option: 'baseLayerTileServerType',
|
|
1132
1184
|
editor: 'editor.radioBar',
|
|
1133
1185
|
showEditor: function showEditor(_ref13) {
|
|
@@ -1136,10 +1188,10 @@ var editorConfig = [{
|
|
|
1136
1188
|
},
|
|
1137
1189
|
editorProps: {
|
|
1138
1190
|
values: [{
|
|
1139
|
-
label: i18n_1._('Vector'),
|
|
1191
|
+
label: (0, i18n_1._)('Vector'),
|
|
1140
1192
|
value: 'vector'
|
|
1141
1193
|
}, {
|
|
1142
|
-
label: i18n_1._('Raster'),
|
|
1194
|
+
label: (0, i18n_1._)('Raster'),
|
|
1143
1195
|
value: 'raster'
|
|
1144
1196
|
}]
|
|
1145
1197
|
}
|
|
@@ -1148,17 +1200,20 @@ var editorConfig = [{
|
|
|
1148
1200
|
/**
|
|
1149
1201
|
* visualization configuration
|
|
1150
1202
|
*/
|
|
1203
|
+
|
|
1151
1204
|
var config = {
|
|
1152
1205
|
/**
|
|
1153
1206
|
* unique viz key
|
|
1154
1207
|
*/
|
|
1155
1208
|
key: 'splunk.map',
|
|
1209
|
+
|
|
1156
1210
|
/**
|
|
1157
1211
|
* viz name
|
|
1158
1212
|
*/
|
|
1159
|
-
name: i18n_1._('Map'),
|
|
1213
|
+
name: (0, i18n_1._)('Map'),
|
|
1160
1214
|
category: VizCategory_1.VizCategory.SPATIAL,
|
|
1161
1215
|
status: 'preview',
|
|
1216
|
+
|
|
1162
1217
|
/**
|
|
1163
1218
|
* viz icon
|
|
1164
1219
|
*/
|
|
@@ -1181,45 +1236,58 @@ var config = {
|
|
|
1181
1236
|
themes: themes,
|
|
1182
1237
|
requiredProps: []
|
|
1183
1238
|
};
|
|
1184
|
-
exports.default = configUtils_1.enhanceConfig(config);
|
|
1239
|
+
exports.default = (0, configUtils_1.enhanceConfig)(config);
|
|
1185
1240
|
|
|
1186
1241
|
/***/ }),
|
|
1187
|
-
/*
|
|
1242
|
+
/* 58 */
|
|
1188
1243
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1189
1244
|
|
|
1190
1245
|
"use strict";
|
|
1191
1246
|
|
|
1192
1247
|
|
|
1193
1248
|
var _defineProperty = __webpack_require__(7);
|
|
1194
|
-
|
|
1249
|
+
|
|
1250
|
+
var _slicedToArray = __webpack_require__(59);
|
|
1251
|
+
|
|
1195
1252
|
var _toConsumableArray = __webpack_require__(1);
|
|
1253
|
+
|
|
1196
1254
|
Object.defineProperty(exports, "__esModule", {
|
|
1197
1255
|
value: true
|
|
1198
1256
|
});
|
|
1199
1257
|
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;
|
|
1258
|
+
|
|
1200
1259
|
var lodash_1 = __webpack_require__(6);
|
|
1201
|
-
|
|
1202
|
-
var
|
|
1203
|
-
|
|
1260
|
+
|
|
1261
|
+
var d3_scale_1 = __webpack_require__(60);
|
|
1262
|
+
|
|
1263
|
+
var chroma = __webpack_require__(61);
|
|
1264
|
+
|
|
1265
|
+
var colorUtils_1 = __webpack_require__(62);
|
|
1266
|
+
|
|
1204
1267
|
var visualization_color_palettes_1 = __webpack_require__(14);
|
|
1205
|
-
|
|
1268
|
+
|
|
1269
|
+
var types_1 = __webpack_require__(63);
|
|
1270
|
+
|
|
1206
1271
|
exports.MAX_LATITUDE = 90;
|
|
1207
1272
|
exports.MIN_LATITUDE = -90;
|
|
1208
1273
|
exports.MAX_LONGITUDE = 180;
|
|
1209
1274
|
exports.MIN_LONGITUDE = -180;
|
|
1210
1275
|
exports.DEFAULT_RESULT_LIMIT = 1000;
|
|
1211
1276
|
exports.DEFAULT_CLUSTER_COLOR = '#909090';
|
|
1212
|
-
exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL;
|
|
1213
|
-
|
|
1214
|
-
exports.MAP_STYLE_VERSION_NUMBER = 8;
|
|
1215
|
-
// currently using one [min, max] value set for bubbles across all zoom levels
|
|
1277
|
+
exports.DEFAULT_SERIES_COLORS = visualization_color_palettes_1.VIZ_CATEGORICAL; // MapLibre requires a map style specification number which is always 8
|
|
1278
|
+
|
|
1279
|
+
exports.MAP_STYLE_VERSION_NUMBER = 8; // currently using one [min, max] value set for bubbles across all zoom levels
|
|
1216
1280
|
// TODO: design choices on [min, max] bubble size for different zoom levels
|
|
1281
|
+
|
|
1217
1282
|
exports.MIN_BUBBLE_RADIUS = 7.11; // 10px
|
|
1283
|
+
|
|
1218
1284
|
exports.MAX_BUBBLE_RADIUS = 45.26; // 85px
|
|
1285
|
+
|
|
1219
1286
|
exports.DEFAULT_OPACITY = 0.8;
|
|
1220
1287
|
var LONGITUDE = 'longitude';
|
|
1221
1288
|
var LATITUDE = 'latitude';
|
|
1222
1289
|
var LAYER_TYPE;
|
|
1290
|
+
|
|
1223
1291
|
(function (LAYER_TYPE) {
|
|
1224
1292
|
LAYER_TYPE["Marker"] = "marker";
|
|
1225
1293
|
LAYER_TYPE["Bubble"] = "bubble";
|
|
@@ -1233,17 +1301,21 @@ var LAYER_TYPE;
|
|
|
1233
1301
|
* @param {BaseTileConfig[]} args.customTileConfig
|
|
1234
1302
|
* @returns {Object} tile preset
|
|
1235
1303
|
*/
|
|
1304
|
+
|
|
1305
|
+
|
|
1236
1306
|
var getTilePreset = function getTilePreset(_ref) {
|
|
1237
1307
|
var _ref$defaultTileConfi = _ref.defaultTileConfig,
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1308
|
+
defaultTileConfig = _ref$defaultTileConfi === void 0 ? [] : _ref$defaultTileConfi,
|
|
1309
|
+
_ref$customTileConfig = _ref.customTileConfig,
|
|
1310
|
+
customTileConfig = _ref$customTileConfig === void 0 ? [] : _ref$customTileConfig;
|
|
1311
|
+
|
|
1241
1312
|
var _a, _b;
|
|
1313
|
+
|
|
1242
1314
|
var tilePreset = {};
|
|
1243
1315
|
var defaultTileLight = {};
|
|
1244
1316
|
var defaultTileDark = {};
|
|
1245
1317
|
var tileConfigs = [].concat(defaultTileConfig).concat(customTileConfig);
|
|
1246
|
-
lodash_1.forEach(tileConfigs, function (tileConfig) {
|
|
1318
|
+
(0, lodash_1.forEach)(tileConfigs, function (tileConfig) {
|
|
1247
1319
|
var key = tileConfig === null || tileConfig === void 0 ? void 0 : tileConfig.key;
|
|
1248
1320
|
var updatedConfig = Object.assign(Object.assign({
|
|
1249
1321
|
theme: 'all'
|
|
@@ -1252,6 +1324,7 @@ var getTilePreset = function getTilePreset(_ref) {
|
|
|
1252
1324
|
});
|
|
1253
1325
|
tilePreset[key] = updatedConfig;
|
|
1254
1326
|
});
|
|
1327
|
+
|
|
1255
1328
|
if (defaultTileConfig.length > 0) {
|
|
1256
1329
|
defaultTileLight = (_a = defaultTileConfig.find(function (config) {
|
|
1257
1330
|
return config.theme === 'light';
|
|
@@ -1264,12 +1337,14 @@ var getTilePreset = function getTilePreset(_ref) {
|
|
|
1264
1337
|
return config.theme === undefined;
|
|
1265
1338
|
});
|
|
1266
1339
|
}
|
|
1340
|
+
|
|
1267
1341
|
return {
|
|
1268
1342
|
tilePreset: tilePreset,
|
|
1269
1343
|
defaultTileLight: defaultTileLight,
|
|
1270
1344
|
defaultTileDark: defaultTileDark
|
|
1271
1345
|
};
|
|
1272
1346
|
};
|
|
1347
|
+
|
|
1273
1348
|
exports.getTilePreset = getTilePreset;
|
|
1274
1349
|
/**
|
|
1275
1350
|
* Check if baseLayerTileServer is in tilePreset and config matches current theme, if yes, return.
|
|
@@ -1284,20 +1359,22 @@ exports.getTilePreset = getTilePreset;
|
|
|
1284
1359
|
* @param {BaseTileConfig} args.defaultTileLight
|
|
1285
1360
|
* @returns {BaseTileConfig} mapStyle
|
|
1286
1361
|
*/
|
|
1362
|
+
|
|
1287
1363
|
var getMapStyle = function getMapStyle(_ref2) {
|
|
1288
1364
|
var showBaseLayer = _ref2.showBaseLayer,
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1365
|
+
_ref2$baseLayerTileSe = _ref2.baseLayerTileServer,
|
|
1366
|
+
baseLayerTileServer = _ref2$baseLayerTileSe === void 0 ? '' : _ref2$baseLayerTileSe,
|
|
1367
|
+
_ref2$baseLayerTileSe2 = _ref2.baseLayerTileServerType,
|
|
1368
|
+
baseLayerTileServerType = _ref2$baseLayerTileSe2 === void 0 ? '' : _ref2$baseLayerTileSe2,
|
|
1369
|
+
_ref2$tilePreset = _ref2.tilePreset,
|
|
1370
|
+
tilePreset = _ref2$tilePreset === void 0 ? {} : _ref2$tilePreset,
|
|
1371
|
+
_ref2$colorScheme = _ref2.colorScheme,
|
|
1372
|
+
colorScheme = _ref2$colorScheme === void 0 ? 'light' : _ref2$colorScheme,
|
|
1373
|
+
_ref2$defaultTileLigh = _ref2.defaultTileLight,
|
|
1374
|
+
defaultTileLight = _ref2$defaultTileLigh === void 0 ? {} : _ref2$defaultTileLigh,
|
|
1375
|
+
_ref2$defaultTileDark = _ref2.defaultTileDark,
|
|
1376
|
+
defaultTileDark = _ref2$defaultTileDark === void 0 ? {} : _ref2$defaultTileDark;
|
|
1377
|
+
|
|
1301
1378
|
if (!showBaseLayer) {
|
|
1302
1379
|
return {
|
|
1303
1380
|
version: exports.MAP_STYLE_VERSION_NUMBER,
|
|
@@ -1317,9 +1394,11 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
1317
1394
|
}]
|
|
1318
1395
|
};
|
|
1319
1396
|
}
|
|
1397
|
+
|
|
1320
1398
|
if (baseLayerTileServer && tilePreset[baseLayerTileServer] && (tilePreset[baseLayerTileServer].theme === colorScheme || tilePreset[baseLayerTileServer].theme === 'all')) {
|
|
1321
1399
|
return tilePreset[baseLayerTileServer];
|
|
1322
1400
|
}
|
|
1401
|
+
|
|
1323
1402
|
if (baseLayerTileServer && baseLayerTileServerType) {
|
|
1324
1403
|
var tiles = [];
|
|
1325
1404
|
/**
|
|
@@ -1327,6 +1406,7 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
1327
1406
|
* Subdomains are used to help with browser parallel requests per domain limitation. These subdomains are typically single letters 'a', 'b' and 'c'
|
|
1328
1407
|
* Refer to https://leafletjs.com/SlavaUkraini/reference.html#tilelayer and https://wiki.openstreetmap.org/wiki/Tile_servers
|
|
1329
1408
|
*/
|
|
1409
|
+
|
|
1330
1410
|
if (baseLayerTileServer.match(/^(https?):\/\/{(s|S)}\../)) {
|
|
1331
1411
|
/**
|
|
1332
1412
|
* sXML (Leaflet) allows users to define their own tile server URLs + list of available subdomains
|
|
@@ -1337,8 +1417,9 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
1337
1417
|
tiles = [baseLayerTileServer.replace(/{(s|S)}/, 'a'), baseLayerTileServer.replace(/{(s|S)}/, 'b'), baseLayerTileServer.replace(/{(s|S)}/, 'c')];
|
|
1338
1418
|
} else {
|
|
1339
1419
|
tiles = [baseLayerTileServer];
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1420
|
+
} // TODO: remove hardcoded style when we allow users to pass in layer style through Viz options
|
|
1421
|
+
|
|
1422
|
+
|
|
1342
1423
|
var mapStyle = {
|
|
1343
1424
|
version: exports.MAP_STYLE_VERSION_NUMBER,
|
|
1344
1425
|
sources: {
|
|
@@ -1354,134 +1435,164 @@ var getMapStyle = function getMapStyle(_ref2) {
|
|
|
1354
1435
|
source: 'base-tiles',
|
|
1355
1436
|
minzoom: 0,
|
|
1356
1437
|
maxzoom: 24 // https://maplibre.org/maplibre-gl-js-docs/api/map/
|
|
1438
|
+
|
|
1357
1439
|
}]
|
|
1358
1440
|
};
|
|
1359
|
-
|
|
1360
1441
|
return mapStyle;
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1442
|
+
} // if tile server is not present in the preset AND we can't construct a mapStyle, fall back on defaults
|
|
1443
|
+
|
|
1444
|
+
|
|
1363
1445
|
return colorScheme === 'light' ? defaultTileLight : defaultTileDark;
|
|
1364
1446
|
};
|
|
1447
|
+
|
|
1365
1448
|
exports.getMapStyle = getMapStyle;
|
|
1449
|
+
|
|
1366
1450
|
var getZoomConstraintsFromTileConfig = function getZoomConstraintsFromTileConfig(tileConfig, baseLayerTileServer) {
|
|
1367
1451
|
var sources = tileConfig.sources,
|
|
1368
|
-
|
|
1369
|
-
var matchedBaseLayerTileServer = false;
|
|
1370
|
-
|
|
1452
|
+
layers = tileConfig.layers;
|
|
1453
|
+
var matchedBaseLayerTileServer = false; // check sources for minzoom maxzoom first
|
|
1454
|
+
|
|
1371
1455
|
var sourceKeys = Object.keys(sources);
|
|
1456
|
+
|
|
1372
1457
|
for (var i = 0; i < sourceKeys.length; i += 1) {
|
|
1373
1458
|
var _sources$sourceKeys$i = sources[sourceKeys[i]],
|
|
1374
|
-
|
|
1375
|
-
|
|
1459
|
+
minzoom = _sources$sourceKeys$i.minzoom,
|
|
1460
|
+
maxzoom = _sources$sourceKeys$i.maxzoom;
|
|
1461
|
+
|
|
1376
1462
|
if (baseLayerTileServer && sources[sourceKeys[i]].tiles.indexOf(baseLayerTileServer) !== -1) {
|
|
1377
1463
|
matchedBaseLayerTileServer = true;
|
|
1378
1464
|
}
|
|
1379
|
-
|
|
1465
|
+
|
|
1466
|
+
if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(minzoom) && (0, lodash_1.isNumber)(maxzoom)) {
|
|
1380
1467
|
return {
|
|
1381
1468
|
minZoom: minzoom,
|
|
1382
1469
|
maxZoom: maxzoom
|
|
1383
1470
|
};
|
|
1384
1471
|
}
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1472
|
+
} // then check layers
|
|
1473
|
+
|
|
1474
|
+
|
|
1387
1475
|
for (var _i = 0; _i < layers.length; _i += 1) {
|
|
1388
1476
|
var _layers$_i = layers[_i],
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1477
|
+
_minzoom = _layers$_i.minzoom,
|
|
1478
|
+
_maxzoom = _layers$_i.maxzoom;
|
|
1479
|
+
|
|
1480
|
+
if ((baseLayerTileServer && matchedBaseLayerTileServer || !baseLayerTileServer) && (0, lodash_1.isNumber)(_minzoom) && (0, lodash_1.isNumber)(_maxzoom)) {
|
|
1392
1481
|
return {
|
|
1393
1482
|
minZoom: _minzoom,
|
|
1394
1483
|
maxZoom: _maxzoom
|
|
1395
1484
|
};
|
|
1396
1485
|
}
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1486
|
+
} // Maplibre default - would reset previous min/maxZoom https://maplibre.org/maplibre-gl-js-docs/api/map/
|
|
1487
|
+
|
|
1488
|
+
|
|
1399
1489
|
return {
|
|
1400
1490
|
minZoom: 0,
|
|
1401
1491
|
maxZoom: 24
|
|
1402
1492
|
};
|
|
1403
1493
|
};
|
|
1494
|
+
|
|
1404
1495
|
exports.getZoomConstraintsFromTileConfig = getZoomConstraintsFromTileConfig;
|
|
1496
|
+
|
|
1405
1497
|
var getZoomLevelFromGeobin = function getZoomLevelFromGeobin(geobinStr) {
|
|
1406
1498
|
var _a;
|
|
1499
|
+
|
|
1407
1500
|
if (!geobinStr) {
|
|
1408
1501
|
return null;
|
|
1409
|
-
}
|
|
1410
|
-
|
|
1502
|
+
} // geostats cmds return geobin with zoom level 0-18, 0-99 in the geobinPattern covers the range
|
|
1503
|
+
|
|
1504
|
+
|
|
1411
1505
|
var geobinPattern = /bin_id_zl_([0-9]{0,2})?_y_/g;
|
|
1412
1506
|
var match = geobinPattern.exec(geobinStr);
|
|
1413
1507
|
return (_a = (match === null || match === void 0 ? void 0 : match.length) && parseInt(match[1], 10)) !== null && _a !== void 0 ? _a : null;
|
|
1414
1508
|
};
|
|
1415
|
-
|
|
1416
|
-
// Bubble colors - static
|
|
1509
|
+
|
|
1510
|
+
exports.getZoomLevelFromGeobin = getZoomLevelFromGeobin; // Bubble colors - static
|
|
1511
|
+
|
|
1417
1512
|
var getStaticColors = function getStaticColors(colorCount, colorArray) {
|
|
1418
1513
|
if (colorCount < 0 || !colorCount) {
|
|
1419
1514
|
return [exports.DEFAULT_CLUSTER_COLOR];
|
|
1420
1515
|
}
|
|
1516
|
+
|
|
1421
1517
|
if (!colorArray || !colorArray.length) {
|
|
1422
1518
|
return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
|
|
1423
1519
|
return exports.DEFAULT_SERIES_COLORS[i];
|
|
1424
1520
|
});
|
|
1425
|
-
}
|
|
1426
|
-
// loop through colorArray to pick the first $colorCount colors
|
|
1521
|
+
} // loop through colorArray to pick the first $colorCount colors
|
|
1427
1522
|
// start from begining again if colorCount > colorArray.length
|
|
1523
|
+
|
|
1524
|
+
|
|
1428
1525
|
return _toConsumableArray(Array(colorCount).keys()).map(function (i) {
|
|
1429
|
-
return colorUtils_1.isColor(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
|
|
1526
|
+
return (0, colorUtils_1.isColor)(colorArray[i % colorArray.length]) ? colorArray[i % colorArray.length] : exports.DEFAULT_CLUSTER_COLOR;
|
|
1430
1527
|
});
|
|
1431
1528
|
};
|
|
1432
|
-
|
|
1433
|
-
// Bubble size
|
|
1529
|
+
|
|
1530
|
+
exports.getStaticColors = getStaticColors; // Bubble size
|
|
1531
|
+
|
|
1434
1532
|
var matchBubbleSize = function matchBubbleSize(dataRange, data) {
|
|
1435
|
-
var size = d3_scale_1.scalePow().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
|
|
1533
|
+
var size = (0, d3_scale_1.scalePow)().exponent(0.2).domain(dataRange).range([exports.MIN_BUBBLE_RADIUS, exports.MAX_BUBBLE_RADIUS])(data);
|
|
1534
|
+
|
|
1436
1535
|
if (size > exports.MAX_BUBBLE_RADIUS) {
|
|
1437
1536
|
return exports.MAX_BUBBLE_RADIUS;
|
|
1438
1537
|
}
|
|
1538
|
+
|
|
1439
1539
|
if (size < exports.MIN_BUBBLE_RADIUS) {
|
|
1440
1540
|
return exports.MIN_BUBBLE_RADIUS;
|
|
1441
1541
|
}
|
|
1542
|
+
|
|
1442
1543
|
return size;
|
|
1443
1544
|
};
|
|
1545
|
+
|
|
1444
1546
|
exports.matchBubbleSize = matchBubbleSize;
|
|
1547
|
+
|
|
1445
1548
|
var transposeArray = function transposeArray(array) {
|
|
1446
1549
|
if (!array || !array.length || !array[0] || !array[0].length) {
|
|
1447
1550
|
return [];
|
|
1448
1551
|
}
|
|
1552
|
+
|
|
1449
1553
|
return array[0].map(function (_, i) {
|
|
1450
1554
|
return array.map(function (row) {
|
|
1451
1555
|
return row[i];
|
|
1452
1556
|
});
|
|
1453
1557
|
});
|
|
1454
1558
|
};
|
|
1455
|
-
|
|
1456
|
-
// sanitize values: update all null, undefined, or negative values to 0
|
|
1559
|
+
|
|
1560
|
+
exports.transposeArray = transposeArray; // sanitize values: update all null, undefined, or negative values to 0
|
|
1561
|
+
|
|
1457
1562
|
var sanitizeValues = function sanitizeValues(values) {
|
|
1458
1563
|
// null / undefined
|
|
1459
1564
|
if (!values) {
|
|
1460
1565
|
return 0;
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1566
|
+
} // number
|
|
1567
|
+
|
|
1568
|
+
|
|
1463
1569
|
if (!Array.isArray(values)) {
|
|
1464
1570
|
return values > 0 ? values : 0;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1571
|
+
} // array
|
|
1572
|
+
|
|
1573
|
+
|
|
1467
1574
|
return values.map(function (arr) {
|
|
1468
|
-
return exports.sanitizeValues(arr);
|
|
1575
|
+
return (0, exports.sanitizeValues)(arr);
|
|
1469
1576
|
});
|
|
1470
1577
|
};
|
|
1578
|
+
|
|
1471
1579
|
exports.sanitizeValues = sanitizeValues;
|
|
1580
|
+
|
|
1472
1581
|
var bakeBubbleData = function bakeBubbleData(layer) {
|
|
1473
1582
|
var _a;
|
|
1583
|
+
|
|
1474
1584
|
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) {
|
|
1475
1585
|
return null;
|
|
1476
|
-
}
|
|
1477
|
-
// if bubbleSize is passed as an array of single number array (data series)
|
|
1586
|
+
} // if bubbleSize is passed as an array of single number array (data series)
|
|
1478
1587
|
// e.g. [value0, value1, ...]
|
|
1479
1588
|
// format each value as an array to unify data operations for data series and frames
|
|
1480
|
-
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
var sanitizedBubbleSize = (0, exports.sanitizeValues)(layer.bubbleSize);
|
|
1481
1592
|
var transposedBubbleSize;
|
|
1482
1593
|
var transposedSanitizedBubbleSize;
|
|
1483
|
-
var isPie = false;
|
|
1484
|
-
|
|
1594
|
+
var isPie = false; // format array if bubbleSize is passed as an array of array (data frame)
|
|
1595
|
+
|
|
1485
1596
|
if (Array.isArray(layer.bubbleSize[0])) {
|
|
1486
1597
|
// one-time array transpose,
|
|
1487
1598
|
// e.g. from [column0data, column0data] (multi series)
|
|
@@ -1490,9 +1601,9 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
1490
1601
|
// to [[column0data]]
|
|
1491
1602
|
// for easy access of values at each geo location,
|
|
1492
1603
|
// and min max pie size computation
|
|
1493
|
-
transposedBubbleSize = exports.transposeArray(layer.bubbleSize);
|
|
1494
|
-
transposedSanitizedBubbleSize = exports.transposeArray(sanitizedBubbleSize);
|
|
1495
|
-
|
|
1604
|
+
transposedBubbleSize = (0, exports.transposeArray)(layer.bubbleSize);
|
|
1605
|
+
transposedSanitizedBubbleSize = (0, exports.transposeArray)(sanitizedBubbleSize); // if multiple series in the dataframe, set isPie to true
|
|
1606
|
+
|
|
1496
1607
|
if (layer.bubbleSize.length > 1) {
|
|
1497
1608
|
isPie = true;
|
|
1498
1609
|
}
|
|
@@ -1504,12 +1615,14 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
1504
1615
|
return [n];
|
|
1505
1616
|
});
|
|
1506
1617
|
}
|
|
1618
|
+
|
|
1507
1619
|
if (!transposedBubbleSize || !transposedBubbleSize.length) {
|
|
1508
1620
|
return null;
|
|
1509
1621
|
}
|
|
1622
|
+
|
|
1510
1623
|
var data = layer.latitude.map(function (lat, i) {
|
|
1511
1624
|
return {
|
|
1512
|
-
zoom: exports.getZoomLevelFromGeobin(layer.geobin[i]),
|
|
1625
|
+
zoom: (0, exports.getZoomLevelFromGeobin)(layer.geobin[i]),
|
|
1513
1626
|
values: transposedBubbleSize[i],
|
|
1514
1627
|
sanitizedValues: transposedSanitizedBubbleSize[i],
|
|
1515
1628
|
coordinates: [layer.longitude[i], lat],
|
|
@@ -1517,12 +1630,12 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
1517
1630
|
};
|
|
1518
1631
|
}).filter(function (d) {
|
|
1519
1632
|
return Boolean(d.values);
|
|
1520
|
-
});
|
|
1521
|
-
|
|
1522
|
-
var min = lodash_1.sum(transposedSanitizedBubbleSize[0]);
|
|
1523
|
-
var max = lodash_1.sum(transposedSanitizedBubbleSize[1]);
|
|
1633
|
+
}); // compute the min/max value to encode min/max pie or bubble size
|
|
1634
|
+
|
|
1635
|
+
var min = (0, lodash_1.sum)(transposedSanitizedBubbleSize[0]);
|
|
1636
|
+
var max = (0, lodash_1.sum)(transposedSanitizedBubbleSize[1]);
|
|
1524
1637
|
transposedSanitizedBubbleSize.forEach(function (row) {
|
|
1525
|
-
var bubbleSize = lodash_1.sum(row);
|
|
1638
|
+
var bubbleSize = (0, lodash_1.sum)(row);
|
|
1526
1639
|
max = bubbleSize > max ? bubbleSize : max;
|
|
1527
1640
|
min = bubbleSize < min ? bubbleSize : min;
|
|
1528
1641
|
});
|
|
@@ -1534,22 +1647,29 @@ var bakeBubbleData = function bakeBubbleData(layer) {
|
|
|
1534
1647
|
bubbleSizeFields: layer.bubbleSizeFields
|
|
1535
1648
|
};
|
|
1536
1649
|
};
|
|
1650
|
+
|
|
1537
1651
|
exports.bakeBubbleData = bakeBubbleData;
|
|
1652
|
+
|
|
1538
1653
|
var isValidLatLon = function isValidLatLon(latlon) {
|
|
1539
1654
|
if (!latlon || !Array.isArray(latlon) || latlon.length !== 2) {
|
|
1540
1655
|
return false;
|
|
1541
1656
|
}
|
|
1657
|
+
|
|
1542
1658
|
var _latlon = _slicedToArray(latlon, 2),
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1659
|
+
lat = _latlon[0],
|
|
1660
|
+
lon = _latlon[1];
|
|
1661
|
+
|
|
1662
|
+
if (!(0, types_1.isNumber)(lat) || !(lat >= exports.MIN_LATITUDE && lat <= exports.MAX_LATITUDE)) {
|
|
1546
1663
|
return false;
|
|
1547
1664
|
}
|
|
1548
|
-
|
|
1665
|
+
|
|
1666
|
+
if (!(0, types_1.isNumber)(lon) || !(lon >= exports.MIN_LONGITUDE && lon <= exports.MAX_LONGITUDE)) {
|
|
1549
1667
|
return false;
|
|
1550
1668
|
}
|
|
1669
|
+
|
|
1551
1670
|
return true;
|
|
1552
1671
|
};
|
|
1672
|
+
|
|
1553
1673
|
exports.isValidLatLon = isValidLatLon;
|
|
1554
1674
|
/**
|
|
1555
1675
|
* Returns a list of all lat or lon coordinates used in a specified layer
|
|
@@ -1557,10 +1677,12 @@ exports.isValidLatLon = isValidLatLon;
|
|
|
1557
1677
|
* @param {string} field
|
|
1558
1678
|
* @returns {number[]} list of lat coordinates or lon coordinates
|
|
1559
1679
|
*/
|
|
1680
|
+
|
|
1560
1681
|
var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
|
|
1561
1682
|
var getClusterValues = function getClusterValues(clusterLayer) {
|
|
1562
|
-
return lodash_1.get(clusterLayer, field, []).slice(0, clusterLayer.type === LAYER_TYPE.Marker && clusterLayer.resultLimit ? clusterLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
|
|
1683
|
+
return (0, lodash_1.get)(clusterLayer, field, []).slice(0, clusterLayer.type === LAYER_TYPE.Marker && clusterLayer.resultLimit ? clusterLayer.resultLimit : exports.DEFAULT_RESULT_LIMIT);
|
|
1563
1684
|
};
|
|
1685
|
+
|
|
1564
1686
|
var getChoroplethValues = function getChoroplethValues(choroplethLayer) {
|
|
1565
1687
|
var slicedGeomList = choroplethLayer.geom.slice(0, choroplethLayer.resultLimit);
|
|
1566
1688
|
var flatCoordinates = slicedGeomList.flatMap(function (geomObject) {
|
|
@@ -1570,6 +1692,7 @@ var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
|
|
|
1570
1692
|
return coord[field === LONGITUDE ? 0 : 1];
|
|
1571
1693
|
});
|
|
1572
1694
|
};
|
|
1695
|
+
|
|
1573
1696
|
return layer.type === LAYER_TYPE.Choropleth ? getChoroplethValues(layer) : getClusterValues(layer);
|
|
1574
1697
|
};
|
|
1575
1698
|
/**
|
|
@@ -1577,72 +1700,92 @@ var getLatOrLonCoordinates = function getLatOrLonCoordinates(layer, field) {
|
|
|
1577
1700
|
* @param {LayerType[]} layers
|
|
1578
1701
|
* @returns {LngLatBoundsLike}
|
|
1579
1702
|
*/
|
|
1703
|
+
|
|
1704
|
+
|
|
1580
1705
|
var getGlobalLayerBoundaries = function getGlobalLayerBoundaries(layers) {
|
|
1581
1706
|
var isLayerValid = function isLayerValid(field) {
|
|
1582
1707
|
return layers.every(function (layer) {
|
|
1583
1708
|
return layer[field] || layer.geom;
|
|
1584
1709
|
});
|
|
1585
1710
|
};
|
|
1711
|
+
|
|
1586
1712
|
var getDefaultMax = function getDefaultMax(field) {
|
|
1587
1713
|
return field === LONGITUDE ? exports.MAX_LONGITUDE : exports.MAX_LATITUDE;
|
|
1588
1714
|
};
|
|
1715
|
+
|
|
1589
1716
|
var getDefaultMin = function getDefaultMin(field) {
|
|
1590
1717
|
return field === LONGITUDE ? exports.MIN_LONGITUDE : exports.MIN_LATITUDE;
|
|
1591
1718
|
};
|
|
1719
|
+
|
|
1592
1720
|
if (!layers || !Array.isArray(layers) || !layers.length) {
|
|
1593
1721
|
return null;
|
|
1594
1722
|
}
|
|
1723
|
+
|
|
1595
1724
|
var getMin = function getMin(field) {
|
|
1596
1725
|
if (!isLayerValid(field)) {
|
|
1597
1726
|
return getDefaultMin(field);
|
|
1598
1727
|
}
|
|
1728
|
+
|
|
1599
1729
|
return layers.reduce(function (prevVal, layer) {
|
|
1600
1730
|
var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(function (x) {
|
|
1601
1731
|
return +x;
|
|
1602
1732
|
});
|
|
1603
|
-
return lodash_1.min([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
|
|
1733
|
+
return (0, lodash_1.min)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
|
|
1604
1734
|
}, getDefaultMax(field));
|
|
1605
1735
|
};
|
|
1736
|
+
|
|
1606
1737
|
var getMax = function getMax(field) {
|
|
1607
1738
|
if (!isLayerValid(field)) {
|
|
1608
1739
|
return getDefaultMax(field);
|
|
1609
1740
|
}
|
|
1741
|
+
|
|
1610
1742
|
return layers.reduce(function (prevVal, layer) {
|
|
1611
1743
|
var coordinatesNumArr = getLatOrLonCoordinates(layer, field).map(Number);
|
|
1612
|
-
return lodash_1.max([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
|
|
1744
|
+
return (0, lodash_1.max)([prevVal].concat(_toConsumableArray(coordinatesNumArr)));
|
|
1613
1745
|
}, getDefaultMin(field));
|
|
1614
1746
|
};
|
|
1747
|
+
|
|
1615
1748
|
return [[getMin(LONGITUDE), getMin(LATITUDE)], [getMax(LONGITUDE), getMax(LATITUDE)]];
|
|
1616
1749
|
};
|
|
1750
|
+
|
|
1617
1751
|
exports.getGlobalLayerBoundaries = getGlobalLayerBoundaries;
|
|
1752
|
+
|
|
1618
1753
|
var getScaledOpacities = function getScaledOpacities(colors, cfgOpacity) {
|
|
1619
1754
|
// extract opacity information from 8 digit hex codes
|
|
1620
1755
|
var opacities = colors === null || colors === void 0 ? void 0 : colors.map(function (color) {
|
|
1621
1756
|
var _a;
|
|
1757
|
+
|
|
1622
1758
|
return (color === null || color === void 0 ? void 0 : color.length) === 9 ? (_a = chroma(color).alpha()) !== null && _a !== void 0 ? _a : 1 : 1;
|
|
1623
|
-
});
|
|
1624
|
-
|
|
1759
|
+
}); // opacity cannot be greater than configured opacity
|
|
1760
|
+
|
|
1625
1761
|
return opacities === null || opacities === void 0 ? void 0 : opacities.map(function (opacity) {
|
|
1626
1762
|
return opacity * cfgOpacity;
|
|
1627
1763
|
});
|
|
1628
1764
|
};
|
|
1765
|
+
|
|
1629
1766
|
exports.getScaledOpacities = getScaledOpacities;
|
|
1767
|
+
|
|
1630
1768
|
var compareBaseStyles = function compareBaseStyles(curr, next) {
|
|
1631
1769
|
var _a, _b, _c, _d;
|
|
1770
|
+
|
|
1632
1771
|
var currBaseLayer = (_a = curr === null || curr === void 0 ? void 0 : curr.layers) === null || _a === void 0 ? void 0 : _a.find(function (layer) {
|
|
1633
1772
|
return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
|
|
1634
1773
|
});
|
|
1635
1774
|
var nextBaseLayer = (_b = next === null || next === void 0 ? void 0 : next.layers) === null || _b === void 0 ? void 0 : _b.find(function (layer) {
|
|
1636
1775
|
return (layer === null || layer === void 0 ? void 0 : layer.id) === 'base-layer';
|
|
1637
1776
|
});
|
|
1638
|
-
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 : '');
|
|
1639
|
-
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 : '');
|
|
1777
|
+
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 : '');
|
|
1778
|
+
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 : '');
|
|
1779
|
+
|
|
1640
1780
|
if (!currBaseLayer || !nextBaseLayer || !currBaseSource || !nextBaseSource) {
|
|
1641
1781
|
return false;
|
|
1642
1782
|
}
|
|
1643
|
-
|
|
1783
|
+
|
|
1784
|
+
return (0, lodash_1.isEqual)(currBaseLayer, nextBaseLayer) && (0, lodash_1.isEqual)(currBaseSource, nextBaseSource);
|
|
1644
1785
|
};
|
|
1786
|
+
|
|
1645
1787
|
exports.compareBaseStyles = compareBaseStyles;
|
|
1788
|
+
|
|
1646
1789
|
var formatMetadata = function formatMetadata(choroplethLayer, i) {
|
|
1647
1790
|
if (!choroplethLayer || !choroplethLayer.areaIds || !choroplethLayer.areaValues) return {};
|
|
1648
1791
|
if (i >= choroplethLayer.areaIds.length) return {};
|
|
@@ -1655,38 +1798,39 @@ var formatMetadata = function formatMetadata(choroplethLayer, i) {
|
|
|
1655
1798
|
};
|
|
1656
1799
|
return Object.keys(metadata).reduce(function (result, curr) {
|
|
1657
1800
|
var key = "row.".concat(curr, ".value");
|
|
1658
|
-
var val = lodash_1.isObject(metadata[curr]) ? JSON.stringify(metadata[curr]) : String(metadata[curr]);
|
|
1801
|
+
var val = (0, lodash_1.isObject)(metadata[curr]) ? JSON.stringify(metadata[curr]) : String(metadata[curr]);
|
|
1659
1802
|
return Object.assign(Object.assign({}, result), _defineProperty({}, key, val));
|
|
1660
1803
|
}, base);
|
|
1661
1804
|
};
|
|
1805
|
+
|
|
1662
1806
|
exports.formatMetadata = formatMetadata;
|
|
1663
1807
|
|
|
1664
1808
|
/***/ }),
|
|
1665
|
-
/*
|
|
1809
|
+
/* 59 */
|
|
1666
1810
|
/***/ (function(module, exports) {
|
|
1667
1811
|
|
|
1668
1812
|
module.exports = require("@babel/runtime/helpers/slicedToArray");
|
|
1669
1813
|
|
|
1670
1814
|
/***/ }),
|
|
1671
|
-
/*
|
|
1815
|
+
/* 60 */
|
|
1672
1816
|
/***/ (function(module, exports) {
|
|
1673
1817
|
|
|
1674
1818
|
module.exports = require("d3-scale");
|
|
1675
1819
|
|
|
1676
1820
|
/***/ }),
|
|
1677
|
-
/*
|
|
1821
|
+
/* 61 */
|
|
1678
1822
|
/***/ (function(module, exports) {
|
|
1679
1823
|
|
|
1680
1824
|
module.exports = require("chroma-js");
|
|
1681
1825
|
|
|
1682
1826
|
/***/ }),
|
|
1683
|
-
/*
|
|
1827
|
+
/* 62 */
|
|
1684
1828
|
/***/ (function(module, exports) {
|
|
1685
1829
|
|
|
1686
1830
|
module.exports = require("@splunk/visualizations-shared/colorUtils");
|
|
1687
1831
|
|
|
1688
1832
|
/***/ }),
|
|
1689
|
-
/*
|
|
1833
|
+
/* 63 */
|
|
1690
1834
|
/***/ (function(module, exports) {
|
|
1691
1835
|
|
|
1692
1836
|
module.exports = require("@splunk/visualization-encoding/utils/types");
|