UNPKG

choerodon-ui

Version:

An enterprise-class UI design language and React-based implementation

26 lines (21 loc) 731 B
import * as React from 'react'; /** * 重置数组中所有 cell 的相对 left 的距离。 * @param cells * @param extraWidth 额外为最后一个元素添加的的宽度,当存在纵向滚动条的时候设置。 */ export default function resetLeftForCells(cells, extraWidth) { var left = 0; var nextCells = []; for (var i = 0; i < cells.length; i++) { var cell = cells[i]; var nextCell = /*#__PURE__*/React.cloneElement(cell, { left: left, width: i === cells.length - 1 && extraWidth ? cell.props.width + extraWidth : cell.props.width }); left += cell.props.width; // @ts-ignore nextCells.push(nextCell); } return nextCells; } //# sourceMappingURL=resetLeftForCells.js.map