UNPKG

kepler.gl

Version:

kepler.gl is a webgl based application to visualize large scale location data in the browser

60 lines (46 loc) 7.76 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); var _react = _interopRequireDefault(require("react")); var _styledComponents = require("../../common/styled-components"); var _fieldSelector = _interopRequireDefault(require("../../common/field-selector")); var _datasetTag = _interopRequireDefault(require("../common/dataset-tag")); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } TooltipConfigFactory.deps = [_datasetTag["default"]]; function TooltipConfigFactory(DatasetTag) { var TooltipConfig = function TooltipConfig(_ref) { var config = _ref.config, datasets = _ref.datasets, onChange = _ref.onChange; return _react["default"].createElement("div", null, Object.keys(config.fieldsToShow).map(function (dataId) { return _react["default"].createElement(_styledComponents.SidePanelSection, { key: dataId }, _react["default"].createElement(DatasetTag, { dataset: datasets[dataId] }), _react["default"].createElement(_fieldSelector["default"], { fields: datasets[dataId].fields, value: config.fieldsToShow[dataId], onSelect: function onSelect(fieldsToShow) { var newConfig = _objectSpread({}, config, { fieldsToShow: _objectSpread({}, config.fieldsToShow, (0, _defineProperty2["default"])({}, dataId, fieldsToShow.map(function (d) { return d.name; }))) }); onChange(newConfig); }, closeOnSelect: false, multiSelect: true, inputTheme: "secondary" })); })); }; return TooltipConfig; } var _default = TooltipConfigFactory; exports["default"] = _default; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb21wb25lbnRzL3NpZGUtcGFuZWwvaW50ZXJhY3Rpb24tcGFuZWwvdG9vbHRpcC1jb25maWcuanMiXSwibmFtZXMiOlsiVG9vbHRpcENvbmZpZ0ZhY3RvcnkiLCJkZXBzIiwiRGF0YXNldFRhZ0ZhY3RvcnkiLCJEYXRhc2V0VGFnIiwiVG9vbHRpcENvbmZpZyIsImNvbmZpZyIsImRhdGFzZXRzIiwib25DaGFuZ2UiLCJPYmplY3QiLCJrZXlzIiwiZmllbGRzVG9TaG93IiwibWFwIiwiZGF0YUlkIiwiZmllbGRzIiwibmV3Q29uZmlnIiwiZCIsIm5hbWUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7O0FBb0JBOztBQUNBOztBQUNBOztBQUNBOzs7Ozs7QUFFQUEsb0JBQW9CLENBQUNDLElBQXJCLEdBQTRCLENBQUNDLHNCQUFELENBQTVCOztBQUVBLFNBQVNGLG9CQUFULENBQThCRyxVQUE5QixFQUEwQztBQUN4QyxNQUFNQyxhQUFhLEdBQUcsU0FBaEJBLGFBQWdCO0FBQUEsUUFBRUMsTUFBRixRQUFFQSxNQUFGO0FBQUEsUUFBVUMsUUFBVixRQUFVQSxRQUFWO0FBQUEsUUFBb0JDLFFBQXBCLFFBQW9CQSxRQUFwQjtBQUFBLFdBQ3BCLDZDQUNHQyxNQUFNLENBQUNDLElBQVAsQ0FBWUosTUFBTSxDQUFDSyxZQUFuQixFQUFpQ0MsR0FBakMsQ0FBcUMsVUFBQUMsTUFBTTtBQUFBLGFBQzFDLGdDQUFDLGtDQUFEO0FBQWtCLFFBQUEsR0FBRyxFQUFFQTtBQUF2QixTQUNFLGdDQ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x1ZT17Y29uZmlnLmZpZWxkc1RvU2hvd1tkYXRhSWRdfVxuICAgICAgICAgICAgb25TZWxlY3Q9e2ZpZWxkc1RvU2hvdyA9PiB7XG4gICAgICAgICAgICAgIGNvbnN0IG5ld0NvbmZpZyA9IHtcbiAgICAgICAgICAgICAgICAuLi5jb25maWcsXG4gICAgICAgICAgICAgICAgZmllbGRzVG9TaG93OiB7XG4gICAgICAgICAgICAgICAgICAuLi5jb25maWcuZmllbGRzVG9TaG93LFxuICAgICAgICAgICAgICAgICAgW2RhdGFJZF06IGZpZWxkc1RvU2hvdy5tYXAoZCA9PiBkLm5hbWUpXG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICBvbkNoYW5nZShuZXdDb25maWcpO1xuICAgICAgICAgICAgfX1cbiAgICAgICAgICAgIGNsb3NlT25TZWxlY3Q9e2ZhbHNlfVxuICAgICAgICAgICAgbXVsdGlTZWxlY3RcbiAgICAgICAgICAgIGlucHV0VGhlbWU9XCJzZWNvbmRhcnlcIlxuICAgICAgICAgIC8+XG4gICAgICAgIDwvU2lkZVBhbmVsU2VjdGlvbj5cbiAgICAgICkpfVxuICAgIDwvZGl2PlxuICApO1xuXG4gIHJldHVybiBUb29sdGlwQ29uZmlnO1xufVxuXG5leHBvcnQgZGVmYXVsdCBUb29sdGlwQ29uZmlnRmFjdG9yeTtcbiJdfQ==