UNPKG

kepler.gl

Version:

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

112 lines (85 loc) 12.3 kB
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral")); var _react = _interopRequireWildcard(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _styledComponents = _interopRequireDefault(require("styled-components")); var _lodash = _interopRequireDefault(require("lodash.get")); var _fileUpload = _interopRequireDefault(require("../common/file-uploader/file-upload")); var _loadStorageMap = _interopRequireDefault(require("./load-storage-map")); var _modalTabs = _interopRequireDefault(require("./modal-tabs")); var _loadingDialog = _interopRequireDefault(require("./loading-dialog")); var _defaultSettings = require("../../constants/default-settings"); function _templateObject() { var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: ", ";\n min-height: 440px;\n display: flex;\n flex-direction: column;\n"]); _templateObject = function _templateObject() { return data; }; return data; } var StyledLoadDataModal = _styledComponents["default"].div.attrs({ className: 'load-data-modal' })(_templateObject(), function (props) { return props.theme.modalPadding; }); var noop = function noop() {}; var getDefaultMethod = function getDefaultMethod(methods) { return Array.isArray(methods) ? (0, _lodash["default"])(methods, [0]) : null; }; LoadDataModalFactory.deps = [_modalTabs["default"], _fileUpload["default"], _loadStorageMap["default"]]; function LoadDataModalFactory(ModalTabs, FileUpload, LoadStorageMap) { var LoadDataModal = function LoadDataModal(props) { var fileLoading = props.fileLoading, loadingMethods = props.loadingMethods, isCloudMapLoading = props.isCloudMapLoading; var _useState = (0, _react.useState)(getDefaultMethod(loadingMethods)), _useState2 = (0, _slicedToArray2["default"])(_useState, 2), currentMethod = _useState2[0], toggleMethod = _useState2[1]; return _react["default"].createElement(StyledLoadDataModal, null, _react["default"].createElement(ModalTabs, { currentMethod: currentMethod.id, loadingMethods: loadingMethods, toggleMethod: toggleMethod }), fileLoading || isCloudMapLoading ? _react["default"].createElement(_loadingDialog["default"], { size: 64 }) : currentMethod && _react["default"].createElement(currentMethod.elementType, (0, _extends2["default"])({ key: currentMethod.id }, props))); }; LoadDataModal.propTypes = { // call backs onFileUpload: _propTypes["default"].func.isRequired, onLoadCloudMap: _propTypes["default"].func.isRequired, fileLoading: _propTypes["default"].bool, loadingMethods: _propTypes["default"].arrayOf(_propTypes["default"].shape({ id: _propTypes["default"].string, label: _propTypes["default"].string, elementType: _propTypes["default"].elementType, tabElementType: _propTypes["default"].elementType })) }; LoadDataModal.defaultProps = { onFileUpload: noop, fileLoading: false, loadingMethods: [{ id: _defaultSettings.LOADING_METHODS.upload, label: 'modal.loadData.upload', elementType: FileUpload }, { id: _defaultSettings.LOADING_METHODS.storage, label: 'modal.loadData.storage', elementType: LoadStorageMap }] }; return LoadDataModal; } var _default = LoadDataModalFactory; exports["default"] = _default; //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL21vZGFscy9sb2FkLWRhdGEtbW9kYWwuanMiXSwibmFtZXMiOlsiU3R5bGVkTG9hZERhdGFNb2RhbCIsInN0eWxlZCIsImRpdiIsImF0dHJzIiwiY2xhc3NOYW1lIiwicHJvcHMiLCJ0aGVtZSIsIm1vZGFsUGFkZGluZyIsIm5vb3AiLCJnZXREZWZhdWx0TWV0aG9kIiwibWV0aG9kcyIsIkFycmF5IiwiaXNBcnJheSIsIkxvYWREYXRhTW9kYWxGYWN0b3J5IiwiZGVwcyIsIk1vZGFsVGFic0ZhY3RvcnkiLCJGaWxlVXBsb2FkRmFjdG9yeSIsIkxvYWRTdG9yYWdlTWFwRmFjdG9yeSIsIk1vZGFsVGFicyIsIkZpbGV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