function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import PropTypes from "prop-types";
import React from "react";
import DeckGL, { ScreenGridLayer } from "deck.gl";

var ScreenGridMap = function ScreenGridMap(props) {
  var viewport = props.viewport,
      data = props.data,
      getPosition = props.getPosition,
      opacity = props.opacity,
      colorRange = props.colorRange,
      cellSizePixels = props.cellSizePixels,
      autoHighlight = props.autoHighlight,
      onLayerClick = props.onLayerClick,
      visible = props.visible,
      gpuAggregation = props.gpuAggregation,
      getSize = props.getSize;
  return React.createElement("div", null, React.createElement(DeckGL, _extends({
    className: "DeckGL"
  }, viewport), React.createElement(ScreenGridLayer, {
    id: "screengrid-layer",
    className: "ScreenGridMap",
    pickable: true,
    data: data,
    getPosition: getPosition,
    opacity: opacity,
    colorRange: colorRange,
    cellSizePixels: cellSizePixels,
    autoHighlight: autoHighlight,
    onClick: onLayerClick,
    updateTriggers: {
      instanceColors: colorRange
    },
    visible: visible,
    gpuAggregation: gpuAggregation,
    getSize: getSize
  })));
};

ScreenGridMap.propTypes = {
  viewport: PropTypes.shape({}),
  data: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
  getPosition: PropTypes.func,
  opacity: PropTypes.number,
  colorRange: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),
  cellSizePixels: PropTypes.number,
  autoHighlight: PropTypes.bool,
  onLayerClick: PropTypes.func,
  visible: PropTypes.bool,
  gpuAggregation: PropTypes.bool,
  getSize: PropTypes.func
};
ScreenGridMap.defaultProps = {
  getPosition: function getPosition(d) {
    return d.geometry.coordinates;
  },
  opacity: 0.8,
  colorRange: [[255, 255, 204], [161, 218, 180], [65, 182, 196], [34, 94, 168]],
  cellSizePixels: 25,
  autoHighlight: true,
  visible: true,
  gpuAggregation: false,
  getSize: function getSize() {
    return 1;
  }
};
export default ScreenGridMap;