"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

exports.__esModule = true;
exports["default"] = void 0;

var _react = _interopRequireWildcard(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _lodash = require("lodash");

var _echart = _interopRequireDefault(require("../echart"));

var _context = _interopRequireDefault(require("../context"));

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var OPTIONS = {
  xAxis: {
    show: false,
    type: 'category',
    boundaryGap: false
  },
  yAxis: {
    show: false,
    type: 'value'
  },
  grid: {
    show: false,
    top: 0,
    bottom: 0,
    left: 0,
    right: 0
  },
  series: [{
    type: 'line',
    symbol: 'none',
    lineStyle: {
      color: '#3B81FF'
    },
    areaStyle: {
      color: {
        type: 'linear',
        x: 0,
        y: 0,
        x2: 0,
        y2: 1,
        colorStops: [{
          offset: 0,
          color: 'rgba(0, 112, 204, 0.5)'
        }, {
          offset: 1,
          color: 'rgba(0, 112, 204, 0)'
        }]
      }
    }
  }]
};

var MiniLineChart = function MiniLineChart(props) {
  var _useContext = (0, _react.useContext)(_context["default"]),
      _cssPrefix = _useContext._cssPrefix;

  var className = props.className,
      universalStyle = props.universalStyle,
      dataSource = props.dataSource,
      options = props.options;
  return /*#__PURE__*/_react["default"].createElement(_echart["default"], {
    className: (0, _classnames["default"])(className, _cssPrefix + "min-line-chart-wrapper"),
    universalStyle: universalStyle,
    options: (0, _lodash.merge)({
      series: [{
        data: dataSource
      }]
    }, options, OPTIONS)
  });
};

var _default = MiniLineChart;
exports["default"] = _default;