kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
79 lines (78 loc) • 12.8 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Base = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireWildcard(require("react"));
var _excluded = ["height", "width", "viewBox", "style", "children", "predefinedClassName", "className", "colors", "totalColor"];
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; }
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
var getStyleClassFromColor = function getStyleClassFromColor(totalColor, colors) {
return new Array(totalColor).fill(1).reduce(function (accu, c, i) {
return "".concat(accu, ".cr").concat(i + 1, " {fill:").concat(colors[i % colors.length], ";}");
}, '');
};
var nop = function nop() {
return;
};
var Base = exports.Base = /*#__PURE__*/function (_Component) {
function Base() {
(0, _classCallCheck2["default"])(this, Base);
return _callSuper(this, Base, arguments);
}
(0, _inherits2["default"])(Base, _Component);
return (0, _createClass2["default"])(Base, [{
key: "render",
value: function render() {
var _this$props = this.props,
height = _this$props.height,
width = _this$props.width,
viewBox = _this$props.viewBox,
style = _this$props.style,
children = _this$props.children,
predefinedClassName = _this$props.predefinedClassName,
className = _this$props.className,
colors = _this$props.colors,
totalColor = _this$props.totalColor,
props = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
var svgHeight = height;
var svgWidth = width || svgHeight;
var fillStyle = Array.isArray(colors) && totalColor && getStyleClassFromColor(totalColor, colors);
return /*#__PURE__*/_react["default"].createElement("svg", (0, _extends2["default"])({
viewBox: viewBox,
width: svgWidth,
height: svgHeight,
style: style,
className: "".concat(predefinedClassName, " ").concat(className),
onClick: nop
}, props), fillStyle ? /*#__PURE__*/_react["default"].createElement("style", {
type: "text/css"
}, fillStyle) : null, children);
}
}]);
}(_react.Component);
(0, _defineProperty2["default"])(Base, "displayName", 'Base Icon');
(0, _defineProperty2["default"])(Base, "defaultProps", {
height: null,
width: null,
viewBox: '0 0 64 64',
predefinedClassName: '',
className: '',
style: {
fill: 'currentColor'
}
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1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