kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
132 lines (131 loc) • 25.1 kB
JavaScript
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
var _react = _interopRequireWildcard(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _lodash = _interopRequireDefault(require("lodash.throttle"));
var _classnames = _interopRequireDefault(require("classnames"));
var _utils = require("@kepler.gl/utils");
var _styles = require("@kepler.gl/styles");
var _constants = require("@kepler.gl/constants");
var _slider = _interopRequireDefault(require("./slider/slider"));
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5; // 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; }
function noop() {
return;
}
var SLIDER_MARGIN_PALM = 6;
var AnimationControlSlider = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n"])));
var SliderWrapper = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n position: relative;\n flex-grow: 1;\n margin: 0 24px;\n\n ", "\n"])), _styles.media.palm(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0 ", "px;\n "])), SLIDER_MARGIN_PALM));
var StyledSlider = (0, _styledComponents["default"])(_slider["default"])(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n .kg-range-slider__bar {\n // change colors\n }\n"])));
var StyledDomain = _styledComponents["default"].div.attrs(function (props) {
return {
className: (0, _classnames["default"])('animation-control__time-domain', props.className)
};
})(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-weight: 400;\n font-size: 10px;\n"])), function (props) {
return props.theme.titleTextColor;
});
var PROGRESS_BAR_HEIGHT = 8;
function TimelineSliderFactory() {
var TimelineSlider = function TimelineSlider(_ref) {
var timeline = _ref.timeline,
setTimelineValue = _ref.setTimelineValue,
_ref$enableBarDrag = _ref.enableBarDrag,
enableBarDrag = _ref$enableBarDrag === void 0 ? true : _ref$enableBarDrag,
_ref$showDomainTimes = _ref.showDomainTimes,
showDomainTimes = _ref$showDomainTimes === void 0 ? true : _ref$showDomainTimes,
_ref$height = _ref.height,
height = _ref$height === void 0 ? PROGRESS_BAR_HEIGHT : _ref$height,
_ref$className = _ref.className,
className = _ref$className === void 0 ? null : _ref$className,
style = _ref.style;
var onThrottleUpdate = (0, _react.useMemo)(function () {
return (0, _lodash["default"])(setTimelineValue, 20);
}, [setTimelineValue]);
var step = timeline.step,
domain = timeline.domain,
value = timeline.value,
timeFormat = timeline.timeFormat,
defaultTimeFormat = timeline.defaultTimeFormat,
timezone = timeline.timezone,
animationWindow = timeline.animationWindow,
marks = timeline.marks;
var isRanged = (0, _react.useMemo)(function () {
return Array.isArray(value) && value.length === 2 && animationWindow !== _constants.ANIMATION_WINDOW.interval;
}, [animationWindow, value]);
var _useMemo = (0, _react.useMemo)(function () {
return [isRanged ? value[0] : null, isRanged ? value[1] : value[0]];
}, [isRanged, value]),
_useMemo2 = (0, _slicedToArray2["default"])(_useMemo, 2),
value0 = _useMemo2[0],
value1 = _useMemo2[1];
var _useMemo3 = (0, _react.useMemo)(function () {
if (!domain) return [noop, noop];
return [isRanged ? function (newValue) {
return onThrottleUpdate([(0, _utils.clamp)(domain, newValue), value1]);
} : noop, isRanged ? function (newValue) {
return onThrottleUpdate([value0, (0, _utils.clamp)(domain, newValue)]);
} : function (newValue) {
return onThrottleUpdate(animationWindow === _constants.ANIMATION_WINDOW.interval ?
// filter requires an array with 2 values
[(0, _utils.clamp)(domain, newValue), (0, _utils.clamp)(domain, newValue)] :
// animationConfig only requires one value
[(0, _utils.clamp)(domain, newValue)]);
}];
}, [animationWindow, domain, isRanged, value0, value1, onThrottleUpdate]),
_useMemo4 = (0, _slicedToArray2["default"])(_useMemo3, 2),
onSlider0Change = _useMemo4[0],
onSlider1Change = _useMemo4[1];
var timelineSliderStyle = (0, _react.useMemo)(function () {
return {
height: "".concat(height, "px")
};
}, [height]);
var _useMemo5 = (0, _react.useMemo)(function () {
if (!showDomainTimes) {
return [null, null];
}
var hasUserFormat = typeof timeFormat === 'string';
var currentFormat = (hasUserFormat ? timeFormat : defaultTimeFormat) || _constants.DEFAULT_TIME_FORMAT;
var dateFunc = (0, _utils.datetimeFormatter)(timezone)(currentFormat);
return [domain ? dateFunc(domain[0]) : '', domain ? dateFunc(domain[1]) : ''];
}, [domain, timezone, timeFormat, defaultTimeFormat, showDomainTimes]),
_useMemo6 = (0, _slicedToArray2["default"])(_useMemo5, 2),
timeStart = _useMemo6[0],
timeEnd = _useMemo6[1];
var requiresRangeSlider = isRanged && animationWindow !== _constants.ANIMATION_WINDOW.interval;
return /*#__PURE__*/_react["default"].createElement(AnimationControlSlider, {
style: style,
className: (0, _classnames["default"])('animation-control__time-slider', className)
}, timeStart ? /*#__PURE__*/_react["default"].createElement(StyledDomain, {
className: "domain-start"
}, /*#__PURE__*/_react["default"].createElement("span", null, timeStart)) : null, /*#__PURE__*/_react["default"].createElement(SliderWrapper, {
className: "animation-control__slider"
}, /*#__PURE__*/_react["default"].createElement(StyledSlider, {
isRanged: requiresRangeSlider,
step: step || undefined,
minValue: domain ? domain[0] : 0,
maxValue: domain ? domain[1] : 1,
enableBarDrag: enableBarDrag,
style: timelineSliderStyle,
onSlider0Change: onSlider0Change,
onSlider1Change: onSlider1Change,
value0: value0,
value1: value1,
marks: marks
})), timeEnd ? /*#__PURE__*/_react["default"].createElement(StyledDomain, {
className: "domain-end"
}, /*#__PURE__*/_react["default"].createElement("span", null, timeEnd)) : null);
};
return TimelineSlider;
}
var _default = exports["default"] = TimelineSliderFactory;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVXaWxkY2FyZCIsInJlcXVpcmUiLCJfc3R5bGVkQ29tcG9uZW50cyIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfbG9kYXNoIiwiX2NsYXNzbmFtZXMiLCJfdXRpbHMiLCJfc3R5bGVzIiwiX2NvbnN0YW50cyIsIl9zbGlkZXIiLCJfdGVtcGxhdGVPYmplY3QiLCJfdGVtcGxhdGVPYmplY3QyIiwiX3RlbXBsYXRlT2JqZWN0MyIsIl90ZW1wbGF0ZU9iamVjdDQiLCJfdGVtcGxhdGVPYmplY3Q1IiwiX2dldFJlcXVpcmVXaWxkY2FyZENhY2hlIiwiZSIsIldlYWtNYXAiLCJyIiwidCIsIl9fZXNNb2R1bGUiLCJfdHlwZW9mIiwiaGFzIiwiZ2V0IiwibiIsIl9fcHJvdG9fXyIsImEiLCJPYmplY3QiLCJkZWZpbmVQcm9wZXJ0eSIsImdldE93blByb3BlcnR5RGVzY3JpcHRvciIsInUiLCJoYXNPd25Qcm9wZXJ0eSIsImNhbGwiLCJpIiwic2V0Iiwibm9vcCIsIlNMSURFUl9NQVJ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