1 Star 0 Fork 0

animalcoder/Vue

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
mapDataUsingRowHeightIndex.js.flow 902 Bytes
一键复制 编辑 原始数据 按行查看 历史
animalcoder 提交于 2020-03-23 09:59 +08:00 . Vue6
import _ from 'lodash';
import wrapCell from './wrapCell';
/**
* @param {Array} unmappedRows
* @param {number[]} rowHeightIndex
* @param {Object} config
* @returns {Array}
*/
export default (unmappedRows, rowHeightIndex, config) => {
const tableWidth = unmappedRows[0].length;
const mappedRows = unmappedRows.map((cells, index0) => {
const rowHeight = _.times(rowHeightIndex[index0], () => {
return new Array(tableWidth).fill('');
});
// rowHeight
// [{row index within rowSaw; index2}]
// [{cell index within a virtual row; index1}]
cells.forEach((value, index1) => {
const cellLines = wrapCell(value, config.columns[index1].width, config.columns[index1].wrapWord);
cellLines.forEach((cellLine, index2) => {
rowHeight[index2][index1] = cellLine;
});
});
return rowHeight;
});
return _.flatten(mappedRows);
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/animalcoder/Vue.git
git@gitee.com:animalcoder/Vue.git
animalcoder
Vue
Vue
master

搜索帮助