kepler.gl
Version:
kepler.gl is a webgl based application to visualize large scale location data in the browser
197 lines (158 loc) • 21 kB
JavaScript
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = exports.FieldListItemFactory = void 0;
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 _getPrototypeOf3 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
var _react = _interopRequireWildcard(require("react"));
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _reselect = require("reselect");
var _itemSelector = _interopRequireDefault(require("./item-selector/item-selector"));
var _fieldToken = _interopRequireDefault(require("../common/field-token"));
var _dropdownList = require("./item-selector/dropdown-list");
function _templateObject() {
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-block;\n margin: 0 4px 0 0;\n"]);
_templateObject = function _templateObject() {
return data;
};
return data;
}
var defaultDisplayOption = function defaultDisplayOption(d) {
return d.name;
};
var StyledToken = _styledComponents["default"].div(_templateObject()); // custom list Item
var FieldListItemFactory = function FieldListItemFactory() {
var showToken = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var FieldListItem = function FieldListItem(_ref) {
var value = _ref.value,
_ref$displayOption = _ref.displayOption,
displayOption = _ref$displayOption === void 0 ? defaultDisplayOption : _ref$displayOption;
return _react["default"].createElement("div", null, showToken ? _react["default"].createElement(StyledToken, null, _react["default"].createElement(_fieldToken["default"], {
type: value.type
})) : null, _react["default"].createElement("span", {
className: _dropdownList.classList.listItemAnchor
}, displayOption(value)));
};
return FieldListItem;
};
exports.FieldListItemFactory = FieldListItemFactory;
var SuggestedFieldHeader = function SuggestedFieldHeader() {
return _react["default"].createElement("div", null, "Suggested Field");
};
var FieldType = _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].string), _propTypes["default"].string, _propTypes["default"].shape({
format: _propTypes["default"].string,
id: _propTypes["default"].string,
name: _propTypes["default"].string,
tableFieldIndex: _propTypes["default"].number,
type: _propTypes["default"].number
})]);
var FieldSelector =
/*#__PURE__*/
function (_Component) {
(0, _inherits2["default"])(FieldSelector, _Component);
function FieldSelector() {
var _getPrototypeOf2;
var _this;
(0, _classCallCheck2["default"])(this, FieldSelector);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = (0, _possibleConstructorReturn2["default"])(this, (_getPrototypeOf2 = (0, _getPrototypeOf3["default"])(FieldSelector)).call.apply(_getPrototypeOf2, [this].concat(args)));
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "fieldsSelector", function (props) {
return props.fields;
});
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "valueSelector", function (props) {
return props.value;
});
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "filterFieldTypesSelector", function (props) {
return props.filterFieldTypes;
});
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "showTokenSelector", function (props) {
return props.showToken;
});
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "selectedItemsSelector", (0, _reselect.createSelector)(_this.fieldsSelector, _this.valueSelector, function (fields, value) {
return fields.filter(function (f) {
return (Array.isArray(value) ? value : [value]).includes(defaultDisplayOption(f));
});
}));
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "fieldOptionsSelector", (0, _reselect.createSelector)(_this.fieldsSelector, _this.filterFieldTypesSelector, function (fields, filterFieldTypes) {
if (!filterFieldTypes) {
return fields;
}
var filters = Array.isArray(filterFieldTypes) ? filterFieldTypes : [filterFieldTypes];
return fields.filter(function (f) {
return filters.includes(f.type);
});
}));
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "fieldListItemSelector", (0, _reselect.createSelector)(_this.showTokenSelector, FieldListItemFactory));
return _this;
}
(0, _createClass2["default"])(FieldSelector, [{
key: "render",
value: function render() {
return _react["default"].createElement("div", {
className: "field-selector"
}, _react["default"].createElement(_itemSelector["default"], {
getOptionValue: function getOptionValue(d) {
return d;
},
closeOnSelect: this.props.closeOnSelect,
displayOption: defaultDisplayOption,
filterOption: 'id',
fixedOptions: this.props.suggested,
inputTheme: this.props.inputTheme,
isError: this.props.error,
selectedItems: this.selectedItemsSelector(this.props),
erasable: this.props.erasable,
options: this.fieldOptionsSelector(this.props),
multiSelect: this.props.multiSelect,
placeholder: this.props.placeholder,
placement: this.props.placement,
onChange: this.props.onSelect,
DropDownLineItemRenderComponent: this.fieldListItemSelector(this.props),
DropdownHeaderComponent: this.props.suggested ? SuggestedFieldHeader : null
}));
}
}]);
return FieldSelector;
}(_react.Component);
(0, _defineProperty2["default"])(FieldSelector, "propTypes", {
fields: _propTypes["default"].oneOfType([_propTypes["default"].array, _propTypes["default"].arrayOf(FieldType)]),
onSelect: _propTypes["default"].func.isRequired,
placement: _propTypes["default"].string,
value: FieldType,
filterFieldTypes: _propTypes["default"].oneOfType([FieldType, _propTypes["default"].arrayOf(FieldType)]),
inputTheme: _propTypes["default"].string,
placeholder: _propTypes["default"].string,
erasable: _propTypes["default"].bool,
error: _propTypes["default"].bool,
multiSelect: _propTypes["default"].bool,
closeOnSelect: _propTypes["default"].bool,
showToken: _propTypes["default"].bool,
suggested: _propTypes["default"].arrayOf(_propTypes["default"].any)
});
(0, _defineProperty2["default"])(FieldSelector, "defaultProps", {
erasable: true,
error: false,
fields: [],
onSelect: function onSelect() {},
placement: 'bottom',
value: null,
multiSelect: false,
closeOnSelect: true,
showToken: true,
placeholder: 'placeholder.selectField'
});
var _default = FieldSelector;
exports["default"] = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jb21wb25lbnRzL2NvbW1vbi9maWVsZC1zZWxlY3Rvci5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0RGlzcGxheU9wdGlvbiIsImQiLCJuYW1lIiwiU3R5bGVkVG9rZW4iLCJzdHlsZWQiLCJkaXYiLCJGaWVsZExpc3RJdGVtRmFjdG9yeSIsInNob3dUb2tlbiIsIkZpZWxkTGlzdEl0ZW0iLCJ2YWx1ZSIsImRpc3BsYXlPcHRpb24iLCJ0eXBlIiwiY2xhc3NMaXN0IiwibGlzdEl0ZW1BbmNob3IiLCJTdWdnZXN0ZWRGaWVsZEhlYWRlciIsIkZpZWxkVHlwZSIsIlByb3BUeXBlcyIsIm9uZU9mVHlwZSIsImFycmF5T2YiLCJzdHJpbmciLCJzaGFwZSIsImZvcm1hdCIsImlkIiwidGFibGVGaWVsZEluZGV4IiwibnVtYmVyIiwiRmllbGRTZWxlY3RvciIsInByb3BzIiwiZmllbGRzIiwiZmlsdGVyRmllbGRUeXBlcyIsImZpZWxkc1NlbGVjdG9yIiwidmFsdWVTZWxlY3RvciIsImZpbHRlciIsImYiLCJBcnJheSIsImlzQXJyYXkiLCJpbmNsdWRlcyIsImZpbHRlckZpZWxkVHlwZXNTZWxlY3RvciIsImZpbHRlcnMiLCJzaG93VG9rZW5TZWxlY3RvciIsImNsb3NlT25TZWxlY3QiLCJzdWdnZXN0ZWQiLCJpbnB1dFRoZW1lIiwiZXJyb3IiLCJzZWxlY3RlZEl0ZW1zU2VsZWN0b3IiLCJlcmFzYWJsZSIsImZpZWxkT3B0aW9uc1NlbGVjdG9yIiw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