kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
67 lines (65 loc) • 8.88 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
exports.timeRangeSliderFieldsSelector = timeRangeSliderFieldsSelector;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _timeRangeSlider = _interopRequireDefault(require("../common/time-range-slider"));
var _constants = require("@kepler.gl/constants");
// SPDX-License-Identifier: MIT
// Copyright contributors to the kepler.gl project
/*
* TimeRangeFilter -> TimeRangeSlider -> RangeSlider
*/
function timeRangeSliderFieldsSelector(filter, datasets, layers) {
var hasUserFormat = typeof filter.timeFormat === 'string';
var timeFormat = (hasUserFormat ? filter.timeFormat : filter.defaultTimeFormat) || _constants.DEFAULT_TIME_FORMAT;
return {
id: filter.id,
domain: filter.domain,
timeBins: filter.timeBins,
value: filter.value,
plotType: filter.plotType,
lineChart: filter.lineChart,
yAxis: filter.yAxis,
step: filter.step,
speed: filter.speed,
animationWindow: filter.animationWindow,
isAnimating: filter.isAnimating,
timezone: filter.timezone,
timeFormat: timeFormat,
filter: filter,
datasets: datasets,
layers: layers,
isMinified: filter.view === _constants.FILTER_VIEW_TYPES.minified,
isEnlarged: filter.view === _constants.FILTER_VIEW_TYPES.enlarged
};
}
TimeRangeFilterFactory.deps = [_timeRangeSlider["default"]];
function TimeRangeFilterFactory(TimeRangeSlider) {
var TimeRangeFilterComponent = function TimeRangeFilterComponent(_ref) {
var filter = _ref.filter,
datasets = _ref.datasets,
layers = _ref.layers,
setFilter = _ref.setFilter,
setFilterPlot = _ref.setFilterPlot,
isAnimatable = _ref.isAnimatable,
toggleAnimation = _ref.toggleAnimation,
hideTimeTitle = _ref.hideTimeTitle,
timeline = _ref.timeline;
return /*#__PURE__*/_react["default"].createElement(TimeRangeSlider, (0, _extends2["default"])({}, timeRangeSliderFieldsSelector(filter, datasets, layers), {
onChange: setFilter,
setFilterPlot: setFilterPlot,
toggleAnimation: toggleAnimation,
isAnimatable: isAnimatable,
hideTimeTitle: hideTimeTitle,
timeline: timeline
}));
};
return TimeRangeFilterComponent;
}
var _default = exports["default"] = TimeRangeFilterFactory;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfcmVhY3QiLCJfaW50ZXJvcFJlcXVpcmVEZWZhdWx0IiwicmVxdWlyZSIsIl90aW1lUmFuZ2VTbGlkZXIiLCJfY29uc3RhbnRzIiwidGltZVJhbmdlU2xpZGVyRmllbGRzU2VsZWN0b3IiLCJmaWx0ZXIiLCJkYXRhc2V0cyIsImxheWVycyIsImhhc1VzZXJGb3JtYXQiLCJ0aW1lRm9ybWF0IiwiZGVmYXVsdFRpbWVGb3JtYXQiLCJERUZBVUxUX1RJTUVfRk9STUFUIiwiaWQiLCJkb21haW4iLCJ0aW1lQmlucyIsInZhbHVlIiwicGxvdFR5cGUiLCJsaW5lQ2hhcnQiLCJ5QXhpcyIsInN0ZXAiLCJzcGVlZCIsImFuaW1hdGlvbldpbmRvdyIsImlzQW5pbWF0aW5nIiwidGltZXpvbmUiLCJpc01pbmlmaWVkIiwidmlldyIsIkZJTFRFUl9WSUVXX1RZUEVTIiwibWluaWZpZWQiLCJpc0VubGFyZ2VkIiwiZW5sYXJnZWQiLCJUaW1lUmFuZ2VGaWx0ZXJGYWN0b3J5IiwiZGVwcyIsIlRpbWVSYW5nZVNsaWRlckZhY3RvcnkiLCJUaW1lUmFuZ2VTbGlkZXIiLCJUaW1lUmFuZ2VGaWx0ZXJDb21wb25lbnQiLCJfcmVmIiwic2V0RmlsdGVyIiwic2V0RmlsdGVyUGxvdCIsImlzQW5pbWF0YWJsZSIsInRvZ2dsZUFuaW1hdGlvbiIsImhpZGVUaW1lVGl0bGUiLCJ0aW1lbGluZSIsImNyZWF0ZUVsZW1lbnQiLCJfZXh0ZW5kczIiLCJv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