import _Button from "antd/es/button";
import "./index.css";
import ExportJsonExcel from 'js-export-excel';
export default function ExportXlsxComponent(props) {
  var source = props.source,
    title = props.title,
    header = props.header;
  var downloadExcel = function downloadExcel() {
    var option = {};
    var item;
    if (Array.isArray(source)) {
      item = source[0];
    }
    // item = Array.isArray(datas) && datas[0];
    var keys = Object.keys(item);
    var values = Object.values(item);
    option.fileName = title;
    option.datas = [{
      sheetData: source,
      sheetName: 'sheet',
      sheetFilter: keys,
      sheetHeader: header || keys
    }];
    var toExcel = new ExportJsonExcel(option);
    toExcel.saveExcel();
  };
  return /*#__PURE__*/React.createElement("div", {
    className: "Editor"
  }, /*#__PURE__*/React.createElement(_Button, {
    onClick: downloadExcel
  }, "\u5BFC\u51FAExcel"));
}