"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

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

var _web = require("@react-spring/web");

var _react2 = require("@use-gesture/react");

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

var _orderBy = _interopRequireDefault(require("lodash/orderBy"));

var _get = _interopRequireDefault(require("lodash/get"));

var _array = require("../../utils/array");

require("./index.css");

var _excluded = ["render"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

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; }

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); }

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }

function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }

function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }

function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var preCls = 'titaui-table-excel-v2';

function slice(arr, start, end) {
  if (end > start) return arr.slice(start, end);else return arr.slice(end, start);
}

function columnsWidth(columns) {
  return columns.map(function (_ref) {
    var width = _ref.width;
    return width;
  }).reduce(function (prev, curv) {
    return prev + curv;
  }, 0);
}

var findFirstColumn = function findFirstColumn(columns) {
  return columns.find(function (_ref2) {
    var sortOrder = _ref2.sortOrder;
    return sortOrder === 0;
  });
}; // 创建链表结构


var createLink = function createLink(columns) {
  var columnsDic = (0, _array.arr2Dic)(columns, 'sortOrder', {
    alwaysArray: true
  });
  var firstColumn = findFirstColumn(columns);

  if (!firstColumn) {
    console.error('排序格式错误', columns);
    throw new Error('排序格式错误');
  }

  while (firstColumn) {
    var back = firstColumn.sortOrder === 0 ? null : columnsDic[firstColumn.sortOrder - 1][0];
    var next = columnsDic[firstColumn.sortOrder + 1] && columnsDic[firstColumn.sortOrder + 1][0] || null; // @ts-ignore

    firstColumn.back = back;
    firstColumn.next = next;
    firstColumn = next;
  }

  return columns;
};

var columnsToOrderColumns = function columnsToOrderColumns(columns) {
  return (0, _orderBy["default"])(columns, 'sortOrder');
}; // 计算偏移


var createX = function createX(columns) {
  var orderColumns = columnsToOrderColumns(columns);
  return columns.map(function (column, index) {
    // 如果是在移动中，使用 startSortOrder 作为排序位置计算偏移
    var orderIndex = column.moveing ? column.startSortOrder : orderColumns.findIndex(function (_ref3) {
      var key = _ref3.key;
      return key === column.key;
    });
    var offsetX = columnsWidth(slice(orderColumns, index, orderIndex));
    var x = orderIndex >= index ? offsetX : -offsetX;
    return _objectSpread(_objectSpread({}, column), {}, {
      x: x
    });
  });
};

var findColumnIndex = function findColumnIndex(columns, columnKey) {
  return columns.findIndex(function (_ref4) {
    var key = _ref4.key;
    return key === columnKey;
  });
};

var getPinnedLeft = function getPinnedLeft(currentIndex, columns) {
  return columns.slice(0, currentIndex).reduce(function (pre, cur) {
    return pre + cur.width;
  }, 0);
};

var getPinnedRight = function getPinnedRight(currentIndex, columns) {
  return columns.slice(currentIndex).reduce(function (pre, cur) {
    return pre + cur.width;
  }, 0);
};

var getPinnedOption = function getPinnedOption(columns, currentIndex, pinned) {
  if (!pinned) return {
    isPinned: false,
    pinnedStyle: {}
  };
  var columnsLength = columns.length;
  var leftIndex = pinned[0] - 1;
  var rightIndex = columnsLength - ((pinned[1] || 0) - 1);
  var result = {
    isPinned: true,
    pinnedStyle: {},
    pinnedIndex: [leftIndex, rightIndex]
  };

  if (currentIndex <= leftIndex) {
    result.pinnedStyle = {
      position: 'sticky',
      left: getPinnedLeft(currentIndex, columns),
      zIndex: 2
    };
    return result;
  }

  if (currentIndex >= rightIndex) {
    result.pinnedStyle = {
      position: 'sticky',
      right: getPinnedRight(currentIndex, columns),
      zIndex: 2
    };
    return result;
  }

  return {
    isPinned: false,
    pinnedStyle: {}
  };
};

var log = function log(title, columns) {// console.log(title)
  // console.table(
  //   cloneDeep(
  //     columns.map(({ title, sortOrder, moveing, next, back, x }) => ({
  //       title,
  //       moveing,
  //       sortOrder,
  //       x,
  //       back: back?.title || null,
  //       next: next?.title || null,
  //     }))
  //   )
  // )
};

var MemoRender = /*#__PURE__*/_react["default"].memo(function (_ref5) {
  var render = _ref5.render,
      restProps = _objectWithoutProperties(_ref5, _excluded);

  var data = restProps.data,
      dataIndex = restProps.dataIndex,
      rowIdx = restProps.rowIdx,
      rootData = restProps.rootData,
      rootIdx = restProps.rootIdx;
  var content = (0, _react.useMemo)(function () {
    var Render = render;
    return Render ? /*#__PURE__*/_react["default"].createElement(Render, {
      value: (0, _get["default"])(data, dataIndex),
      data: data,
      rowIdx: rowIdx,
      rootData: rootData,
      rootIdx: rootIdx
    }) : (0, _get["default"])(data, dataIndex);
  }, [render, data, dataIndex, rowIdx, rootData, rootIdx]);
  return content;
});

var TableExcelV2 = function TableExcelV2(_ref6) {
  var className = _ref6.className,
      style = _ref6.style,
      columns = _ref6.columns,
      dataSource = _ref6.dataSource,
      rowKey = _ref6.rowKey,
      _ref6$fixedHeader = _ref6.fixedHeader,
      fixedHeader = _ref6$fixedHeader === void 0 ? false : _ref6$fixedHeader,
      footer = _ref6.footer,
      rowLastNode = _ref6.rowLastNode,
      pinned = _ref6.pinned;

  var _useState = (0, _react.useState)([]),
      _useState2 = _slicedToArray(_useState, 2),
      renderColumns = _useState2[0],
      setRenderColumns = _useState2[1];

  var _useState3 = (0, _react.useState)([]),
      _useState4 = _slicedToArray(_useState3, 2),
      _columns = _useState4[0],
      setColumns = _useState4[1];

  var _useState5 = (0, _react.useState)(false),
      _useState6 = _slicedToArray(_useState5, 2),
      showHeaderShadow = _useState6[0],
      setShowHeaderShadow = _useState6[1];

  var _useState7 = (0, _react.useState)(false),
      _useState8 = _slicedToArray(_useState7, 2),
      showPinnedLeftShadow = _useState8[0],
      setShowPinnedLeftShadow = _useState8[1];

  var _useState9 = (0, _react.useState)(false),
      _useState10 = _slicedToArray(_useState9, 2),
      showPinnedRightShadow = _useState10[0],
      setShowPinnedRightShadow = _useState10[1];

  (0, _react.useEffect)(function () {
    log('_columns update', _columns);
  }, [_columns]);
  (0, _react.useEffect)(function () {
    var hasSortOrderColumns = columns.filter(function (_ref7) {
      var _ref7$hidden = _ref7.hidden,
          hidden = _ref7$hidden === void 0 ? false : _ref7$hidden;
      return !hidden;
    }).map(function (column, i) {
      return _objectSpread(_objectSpread({}, column), {}, {
        level: column.level || 1,
        sortOrder: column.sortOrder !== undefined ? column.sortOrder : i
      });
    });
    setColumns(createX(createLink(hasSortOrderColumns)));
    var levelColumnDic = (0, _array.arr2Dic)(hasSortOrderColumns, 'level', {
      alwaysArray: true
    });
    var levelColumnArr = Object.entries(levelColumnDic).map(function (_ref8) {
      var _ref9 = _slicedToArray(_ref8, 2),
          level = _ref9[0],
          columns = _ref9[1];

      return {
        level: level,
        columns: columns
      };
    });
    var renderColumns = (0, _orderBy["default"])(levelColumnArr, 'level').map(function (_ref10) {
      var columns = _ref10.columns;
      return columns;
    });
    setRenderColumns(renderColumns);
  }, [columns]);

  var _useSprings = (0, _web.useSprings)(_columns.length, function (i) {
    return {
      x: _columns[i].x || 0
    };
  }),
      _useSprings2 = _slicedToArray(_useSprings, 2),
      positions = _useSprings2[0],
      api = _useSprings2[1];

  var _useState11 = (0, _react.useState)({
    colIdx: -1,
    down: false
  }),
      _useState12 = _slicedToArray(_useState11, 2),
      moveInfo = _useState12[0],
      setMoveInfo = _useState12[1];

  var offsetCenterWidth = (0, _react.useRef)({
    // 永远是正值
    offsetWidth: 0
  });
  var moveColBind = (0, _react2.useDrag)(function (_ref11) {
    var _ref11$movement = _slicedToArray(_ref11.movement, 1),
        mx = _ref11$movement[0],
        _ref11$args = _slicedToArray(_ref11.args, 1),
        colIndex = _ref11$args[0].colIndex,
        active = _ref11.active,
        direction = _ref11.direction,
        first = _ref11.first,
        down = _ref11.down;

    var isRight = mx > 0;
    var isLeft = mx < 0;
    var isMoveRight = direction[0] > 0;
    var isMoveLeft = direction[0] < 0;
    var currentColumn = _columns[colIndex];
    var offsetWidth = offsetCenterWidth.current.offsetWidth;

    if (first) {
      setMoveInfo({
        colIdx: colIndex,
        down: true
      });
      currentColumn.moveing = true;
      currentColumn.startSortOrder = currentColumn.sortOrder;
    }

    if (isRight && isMoveRight && currentColumn.next) {
      var currentMx = mx - offsetWidth;
      var boundary = (currentColumn.width + currentColumn.next.width) / 2;

      if (currentMx > boundary) {
        // 交换排序
        var tempSortOrder = currentColumn.sortOrder;
        currentColumn.sortOrder = currentColumn.next.sortOrder;
        var nextColumnIndex = findColumnIndex(_columns, currentColumn.next.key);
        _columns[nextColumnIndex].sortOrder = tempSortOrder;
        offsetCenterWidth.current.offsetWidth += currentColumn.next.width;
        setColumns(createX(createLink(_toConsumableArray(_columns))));
      }
    } else if (isLeft && isMoveLeft && currentColumn.back) {
      var _currentMx = mx + offsetWidth;

      var _boundary = (currentColumn.width + currentColumn.back.width) / 2;

      if (Math.abs(_currentMx) > _boundary) {
        // 交换排序
        var _tempSortOrder = currentColumn.sortOrder;
        currentColumn.sortOrder = currentColumn.back.sortOrder;
        var backColumnIndex = findColumnIndex(_columns, currentColumn.back.key);
        _columns[backColumnIndex].sortOrder = _tempSortOrder;
        offsetCenterWidth.current.offsetWidth += currentColumn.back.width;
        setColumns(createX(createLink(_toConsumableArray(_columns))));
      }
    } else if (isRight && isMoveLeft && currentColumn.back) {
      var _currentMx2 = mx - offsetWidth;

      var _boundary2 = (currentColumn.width + currentColumn.back.width) / 2 - 10;

      if (_currentMx2 < -_boundary2) {
        // 交换排序
        var _tempSortOrder2 = currentColumn.sortOrder;
        currentColumn.sortOrder = currentColumn.back.sortOrder;

        var _backColumnIndex = findColumnIndex(_columns, currentColumn.back.key);

        _columns[_backColumnIndex].sortOrder = _tempSortOrder2;
        offsetCenterWidth.current.offsetWidth -= currentColumn.back.width;
        setColumns(createX(createLink(_toConsumableArray(_columns))));
      }
    } else if (isLeft && isMoveRight && currentColumn.next) {
      var _currentMx3 = mx + offsetWidth;

      var _boundary3 = (currentColumn.width + currentColumn.next.width) / 2 - 10;

      if (Math.abs(_currentMx3) > _boundary3) {
        // 交换排序
        var _tempSortOrder3 = currentColumn.sortOrder;
        currentColumn.sortOrder = currentColumn.next.sortOrder;

        var _backColumnIndex2 = findColumnIndex(_columns, currentColumn.next.key);

        _columns[_backColumnIndex2].sortOrder = _tempSortOrder3;
        offsetCenterWidth.current.offsetWidth -= currentColumn.next.width;
        setColumns(createX(createLink(_toConsumableArray(_columns))));
      }
    }

    if (!active) {
      _columns[colIndex].moveing = false;
      _columns[colIndex].startSortOrder = undefined;
      _columns = createX(createLink(_columns));
      setColumns(_columns);
      setMoveInfo({
        colIdx: colIndex,
        down: false
      });
      offsetCenterWidth.current.offsetWidth = 0;
    }

    api.start(function (i) {
      if (i === colIndex && down) {
        // @ts-ignore
        return {
          x: _columns[i].x + mx
        };
      } else {
        return {
          x: _columns[i].x
        };
      }
    });
  });

  var _useSprings3 = (0, _web.useSprings)(_columns.length, function (i) {
    var opsition = {
      width: _columns[i].width
    };
    return opsition;
  }),
      _useSprings4 = _slicedToArray(_useSprings3, 2),
      colSizes = _useSprings4[0],
      colSizesApi = _useSprings4[1];

  var resizeColBind = (0, _react2.useDrag)(function (_ref12) {
    var _ref12$movement = _slicedToArray(_ref12.movement, 1),
        mx = _ref12$movement[0],
        _ref12$args = _slicedToArray(_ref12.args, 1),
        colIndex = _ref12$args[0],
        active = _ref12.active,
        event = _ref12.event;

    event.stopPropagation();

    if (!active) {
      _columns[colIndex].width += mx;
      setColumns(_toConsumableArray(_columns));
    }

    colSizesApi.start(function (i) {
      if (i === colIndex && active) {
        return {
          width: _columns[i].width + mx
        };
      } else {
        return {
          width: _columns[i].width
        };
      }
    });
  });

  var renderChilds = function renderChilds(childs, currentLevel, rootData, rootIdx, parentColNum) {
    return childs.map(function (data, rowIdx) {
      return /*#__PURE__*/_react["default"].createElement("div", {
        key: rowKey ? data[rowKey] : rowIdx,
        className: "".concat(preCls, "__row")
      }, renderRow({
        data: data,
        rowIdx: rowIdx,
        currentLevel: currentLevel + 1,
        rootData: rootData,
        rootIdx: rootIdx,
        parentColNum: parentColNum
      }));
    });
  };

  var renderRow = (0, _react.useCallback)(function (_ref13) {
    var data = _ref13.data,
        rowIdx = _ref13.rowIdx,
        _ref13$currentLevel = _ref13.currentLevel,
        currentLevel = _ref13$currentLevel === void 0 ? 1 : _ref13$currentLevel,
        rootData = _ref13.rootData,
        rootIdx = _ref13.rootIdx,
        _ref13$parentColNum = _ref13.parentColNum,
        parentColNum = _ref13$parentColNum === void 0 ? 0 : _ref13$parentColNum;
    if (!renderColumns[currentLevel - 1]) return;
    return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, renderColumns[currentLevel - 1].map(function (columnOption, colIdx) {
      var _classNames;

      var render = columnOption.render,
          dataIndex = columnOption.dataIndex,
          renderFill = columnOption.renderFill,
          _columnOption$align = columnOption.align,
          align = _columnOption$align === void 0 ? 'left' : _columnOption$align;

      var content = /*#__PURE__*/_react["default"].createElement(MemoRender, {
        render: render,
        data: data,
        dataIndex: dataIndex,
        rowIdx: rowIdx,
        rootData: rootData,
        rootIdx: rootIdx
      });

      var index = parentColNum + colIdx;

      var _getPinnedOption = getPinnedOption(_columns, index, pinned),
          pinnedStyle = _getPinnedOption.pinnedStyle,
          pinnedIndex = _getPinnedOption.pinnedIndex,
          isPinned = _getPinnedOption.isPinned;

      return /*#__PURE__*/_react["default"].createElement(_web.animated.div, {
        key: dataIndex,
        className: (0, _classnames["default"])("".concat(preCls, "__box"), (_classNames = {}, _defineProperty(_classNames, "".concat(preCls, "__isPinned--left"), isPinned && index === pinnedIndex[0]), _defineProperty(_classNames, "".concat(preCls, "__isPinned--right"), isPinned && index === pinnedIndex[1]), _defineProperty(_classNames, "".concat(preCls, "__isPinned--left-shadow"), isPinned && showPinnedLeftShadow && index === pinnedIndex[0]), _defineProperty(_classNames, "".concat(preCls, "__isPinned--right-shadow"), isPinned && showPinnedRightShadow && index === pinnedIndex[1]), _classNames)),
        style: _objectSpread(_objectSpread({
          width: colSizes[index].width,
          zIndex: moveInfo.colIdx === index ? 2 : undefined,
          borderLeft: moveInfo.colIdx === index && moveInfo.down && '1px solid #e2e2e2' || undefined
        }, pinnedStyle), positions[index])
      }, renderFill && content, !renderFill && /*#__PURE__*/_react["default"].createElement("div", {
        className: (0, _classnames["default"])("".concat(preCls, "__box-content"), "".concat(preCls, "__box-content--aligin-").concat(align))
      }, content));
    }), renderColumns[currentLevel] && /*#__PURE__*/_react["default"].createElement("div", {
      className: "".concat(preCls, "__childs")
    }, data.childs && !!data.childs.length ? renderChilds(data.childs, currentLevel, rootData, rootIdx, parentColNum + renderColumns[currentLevel - 1].length) : /*#__PURE__*/_react["default"].createElement(_web.animated.div, {
      className: "".concat(preCls, "__box"),
      style: _objectSpread(_objectSpread({
        width: colSizes[parentColNum + 1].width,
        zIndex: moveInfo.colIdx === parentColNum + 1 ? 2 : undefined,
        borderLeft: moveInfo.colIdx === parentColNum + 1 && moveInfo.down && '1px solid #e2e2e2' || undefined
      }, getPinnedOption(_columns, parentColNum + 1, pinned).pinnedStyle), positions[parentColNum + 1])
    })));
  }, [renderColumns, moveInfo, showPinnedLeftShadow]);
  var onScrollContentHandler = (0, _react.useCallback)(function (e) {
    setShowHeaderShadow(e.target.scrollTop > 0);
    setShowPinnedLeftShadow(e.target.scrollLeft > 0);
  }, []);
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, " ").concat(className), _defineProperty({}, "".concat(preCls, "--header-fixed"), fixedHeader)),
    style: style,
    onScroll: onScrollContentHandler
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__main")
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(preCls, "__header"), _defineProperty({}, "".concat(preCls, "__header--shadow"), showHeaderShadow))
  }, _columns.map(function (_ref14, i) {
    var _classNames4;

    var title = _ref14.title,
        _ref14$align = _ref14.align,
        align = _ref14$align === void 0 ? 'left' : _ref14$align,
        key = _ref14.key;

    var _getPinnedOption2 = getPinnedOption(_columns, i, pinned),
        pinnedStyle = _getPinnedOption2.pinnedStyle,
        isPinned = _getPinnedOption2.isPinned,
        pinnedIndex = _getPinnedOption2.pinnedIndex;

    return /*#__PURE__*/_react["default"].createElement(_web.animated.div, {
      key: key,
      className: (0, _classnames["default"])("".concat(preCls, "__header__item"), "".concat(preCls, "__header__item--aligin-").concat(align), (_classNames4 = {}, _defineProperty(_classNames4, "".concat(preCls, "__isPinned--left"), isPinned && i === pinnedIndex[0]), _defineProperty(_classNames4, "".concat(preCls, "__isPinned--right"), isPinned && i === pinnedIndex[1]), _defineProperty(_classNames4, "".concat(preCls, "__isPinned--left-shadow"), isPinned && showPinnedLeftShadow && i === pinnedIndex[0]), _defineProperty(_classNames4, "".concat(preCls, "__isPinned--right-shadow"), isPinned && showPinnedRightShadow && i === pinnedIndex[1]), _classNames4)) // {...moveColBind({ colIndex: i })}
      ,
      style: _objectSpread(_objectSpread({
        width: colSizes[i].width,
        x: positions[i].x,
        zIndex: moveInfo.colIdx === i ? 2 : 1
      }, pinnedStyle), {}, {
        borderRight: _columns[i].next === null && '1px solid #e2e2e2' || undefined
      })
    }, /*#__PURE__*/_react["default"].createElement("div", _extends({}, resizeColBind(i), {
      className: "".concat(preCls, "__header__drag-size-bar")
    })), title);
  })), dataSource.map(function (data, rowIdx) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      key: rowKey ? data[rowKey] : rowIdx,
      className: "".concat(preCls, "__row ").concat(preCls, "__row--root")
    }, renderRow({
      data: data,
      rowIdx: rowIdx,
      currentLevel: 1,
      rootData: data,
      rootIdx: rowIdx
    }));
  }), rowLastNode));
};

var _default = /*#__PURE__*/_react["default"].memo(TableExcelV2);

exports["default"] = _default;