kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
60 lines (58 loc) • 9.67 kB
JavaScript
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/node_modules/react"));
var _reactIntl = require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/node_modules/react-intl");
var _src = require("/Users/ihordykhta/Desktop/unfolded/kepler.gl/src/utils/src");
var _fieldSelector = _interopRequireDefault(require("../../common/field-selector"));
var _infoHelper = _interopRequireDefault(require("../../common/info-helper"));
var _styledComponents = require("../../common/styled-components");
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
VisConfigByFieldSelectorFactory.deps = [_infoHelper["default"], _fieldSelector["default"]];
function VisConfigByFieldSelectorFactory(InfoHelper, FieldSelector) {
var VisConfigByFieldSelector = function VisConfigByFieldSelector(_ref) {
var id = _ref.id,
property = _ref.property,
selectedField = _ref.selectedField,
description = _ref.description,
label = _ref.label,
intl = _ref.intl,
updateField = _ref.updateField,
fields = _ref.fields,
placeholder = _ref.placeholder,
disabled = _ref.disabled;
return /*#__PURE__*/_react["default"].createElement(_styledComponents.SidePanelSection, {
disabled: disabled
}, /*#__PURE__*/_react["default"].createElement(_styledComponents.PanelLabelWrapper, null, /*#__PURE__*/_react["default"].createElement(_styledComponents.PanelLabel, null, label && /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
id: label
}) || /*#__PURE__*/_react["default"].createElement(_reactIntl.FormattedMessage, {
id: "layer.propertyBasedOn",
values: {
property: intl.formatMessage({
id: "property.".concat((0, _src.camelize)(property)),
defaultMessage: property
})
}
})), description && /*#__PURE__*/_react["default"].createElement(InfoHelper, {
description: description,
property: property,
id: "".concat(id, "-").concat(property)
})), /*#__PURE__*/_react["default"].createElement(FieldSelector, {
fields: fields,
value: selectedField && selectedField.name,
placeholder: placeholder,
onSelect: function onSelect(items) {
return updateField(Array.isArray(items) ? items === null || items === void 0 ? void 0 : items[0] : items);
},
disabled: disabled,
erasable: true
}));
};
return (0, _reactIntl.injectIntl)(VisConfigByFieldSelector);
}
var _default = exports["default"] = VisConfigByFieldSelectorFactory;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwicmVxdWlyZSIsIl9yZWFjdEludGwiLCJfc3JjIiwiX2ZpZWxkU2VsZWN0b3IiLCJfaW5mb0hlbHBlciIsIl9zdHlsZWRDb21wb25lbnRzIiwiVmlzQ29uZmlnQnlGaWVsZFNlbGVjdG9yRmFjdG9yeSIsImRlcHMiLCJJbmZvSGVscGVyRmFjdG9yeSIsIkZpZWxkU2VsZWN0b3JGYWN0b3J5IiwiSW5mb0hlbHBlciIsIkZpZWxkU2VsZWN0b3IiLCJWaXNDb25maWdCeUZpZWxkU2VsZWN0b3IiLCJfcmVmIiwiaWQiLCJwcm9wZXJ0eSIsInNlbGVjdGVkRmllbGQiLCJkZXNjcmlwdGlvbiIsImxhYmVsIiwiaW50bCIsInVwZGF0ZUZpZWxkIiwiZmllbGRzIiwicGxhY2Vob2xkZXIiLCJkaXNhYmxlZCIsImNyZWF0ZUVsZW1lbnQiLCJTaWRlUGFuZWxTZWN0aW9uIiwiUGFuZWxMYWJlbFdyYXBwZXIiLCJQYW5lbExhYmVsIiwiRm9ybWF0dGVkTWVzc2FnZSIsInZhbHVlcyIsImZvcm1hdE1lc3NhZ2UiLCJjb25jYXQiLCJjYW1lbGl6ZSIsImRlZmF1bHRNZXNzYWdlIiwidmFsdWUiLCJuYW1lIiwib25TZWxlY3QiLCJpdGVtcyIsIkFycmF5IiwiaXNBcnJheSIsImVyYXNhYmxlIiwiaW5qZWN0SW50bCIsIl9kZWZhdWx0IiwiZXhwb3J0cyJdLCJzb3VyY2VzIjpbIi4u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xuICAgICAgICAgICAgICAgIGlkPVwibGF5ZXIucHJvcGVydHlCYXNlZE9uXCJcbiAgICAgICAgICAgICAgICB2YWx1ZXM9e3tcbiAgICAgICAgICAgICAgICAgIHByb3BlcnR5OiBpbnRsLmZvcm1hdE1lc3NhZ2Uoe1xuICAgICAgICAgICAgICAgICAgICBpZDogYHByb3BlcnR5LiR7Y2FtZWxpemUocHJvcGVydHkpfWAsXG4gICAgICAgICAgICAgICAgICAgIGRlZmF1bHRNZXNzYWdlOiBwcm9wZXJ0eVxuICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICB9fVxuICAgICAgICAgICAgICAvPlxuICAgICAgICAgICAgKX1cbiAgICAgICAgICA8L1BhbmVsTGFiZWw+XG4gICAgICAgICAge2Rlc2NyaXB0aW9uICYmIChcbiAgICAgICAgICAgIDxJbmZvSGVscGVyIGRlc2NyaXB0aW9uPXtkZXNjcmlwdGlvbn0gcHJvcGVydHk9e3Byb3BlcnR5fSBpZD17YCR7aWR9LSR7cHJvcGVydHl9YH0gLz5cbiAgICAgICAgICApfVxuICAgICAgICA8L1BhbmVsTGFiZWxXcmFwcGVyPlxuICAgICAgICA8RmllbGRTZWxlY3RvclxuICAgICAgICAgIGZpZWxkcz17ZmllbGRzfVxuICAgICAgICAgIHZhbHVlPXtzZWxlY3RlZEZpZWxkICYmIHNlbGVjdGVkRmllbGQubmFtZX1cbiAgICAgICAgICBwbGFjZWhvbGRlcj17cGxhY2Vob2xkZXJ9XG4gICAgICAgICAgb25TZWxlY3Q9e2l0ZW1zID0+IHVwZGF0ZUZpZWxkKEFycmF5LmlzQXJyYXkoaXRlbXMpID8gaXRlbXM/LlswXSA6IGl0ZW1zKX1cbiAgICAgICAgICBkaXNhYmxlZD17ZGlzYWJsZWR9XG4gICAgICAgICAgZXJhc2FibGVcbiAgICAgICAgLz5cbiAgICAgIDwvU2lkZVBhbmVsU2VjdGlvbj5cbiAgICApO1xuICB9O1xuICByZXR1cm4gaW5qZWN0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