UNPKG

kepler.gl

Version:

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

58 lines (57 loc) 11.8 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral")); var _react = _interopRequireWildcard(require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/node_modules/react")); var _styledComponents = _interopRequireWildcard(require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/node_modules/styled-components")); var _layerTypeDropdownList = _interopRequireDefault(require("./layer-type-dropdown-list")); var _layerTypeListItem = _interopRequireDefault(require("./layer-type-list-item")); var _itemSelector = _interopRequireDefault(require("../../common/item-selector/item-selector")); var _styledComponents2 = require("../../common/styled-components"); var _templateObject; // SPDX-License-Identifier: MIT // Copyright contributors to the kepler.gl project function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; } var StyledLayerTypeSelector = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n .item-selector .item-selector__dropdown {\n padding: 4px 10px 4px 10px;\n }\n"]))); LayerTypeSelectorFactory.deps = [_layerTypeListItem["default"], _layerTypeDropdownList["default"]]; var getDisplayOption = function getDisplayOption(op) { return op.label; }; var getOptionValue = function getOptionValue(op) { return op.id; }; function LayerTypeSelectorFactory(LayerTypeListItem, LayerTypeDropdownList) { var LayerTypeSelector = function LayerTypeSelector(_ref) { var selected = _ref.selected, options = _ref.options, onSelect = _ref.onSelect, disabled = _ref.disabled; var selectedItems = (0, _react.useMemo)(function () { return options.find(function (op) { return op.id === selected; }); }, [options, selected]); return /*#__PURE__*/_react["default"].createElement(_styledComponents2.SidePanelSection, null, /*#__PURE__*/_react["default"].createElement(StyledLayerTypeSelector, { className: "layer-config__type" }, /*#__PURE__*/_react["default"].createElement(_itemSelector["default"], { selectedItems: selectedItems, options: options, multiSelect: false, disabled: disabled, placeholder: "placeholder.selectType", onChange: onSelect, getOptionValue: getOptionValue, filterOption: "label", displayOption: getDisplayOption, DropDownLineItemRenderComponent: LayerTypeListItem, DropDownRenderComponent: LayerTypeDropdownList }))); }; return (0, _styledComponents.withTheme)(LayerTypeSelector); } var _default = exports["default"] = LayerTypeSelectorFactory; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfc3R5bGVkQ29tcG9uZW50cyIsIl9sYXllclR5cGVEcm9wZG93bkxpc3QiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwiX2xheWVyVHlwZUxpc3RJdGVtIiwiX2l0ZW1TZWxlY3RvciIsIl9zdHlsZWRDb21wb25lbnRzMiIsIl90ZW1wbGF0ZU9iamVjdCIsIl9nZXRSZXF1aXJlV2lsZGNhcmRDYWNoZSIsImUiLCJXZWFrTWFwIiwiciIsInQiLCJfX2VzTW9kdWxlIiwiX3R5cGVvZiIsImhhcyIsImdldCIsIm4iLCJfX3Byb3RvX18iLCJhIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJnZXRPd25Qcm9wZXJ0eURlc2Nya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