From d50fad7f6db3166ef0023383e70b160970afe15a Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sat, 29 Sep 2018 15:08:24 +0800 Subject: [PATCH] feat: update table --- components/vc-table/index.js | 2 +- components/vc-table/src/BaseTable.jsx | 12 +++++------- components/vc-table/src/ExpandableTable.jsx | 2 +- components/vc-tree/index.js | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/components/vc-table/index.js b/components/vc-table/index.js index c04ac3c7c..0b3e58caa 100644 --- a/components/vc-table/index.js +++ b/components/vc-table/index.js @@ -1,4 +1,4 @@ -// base rc-table 6.2.8 +// base rc-table 6.2.9 import T from './src/Table' import Column from './src/Column' import ColumnGroup from './src/ColumnGroup' diff --git a/components/vc-table/src/BaseTable.jsx b/components/vc-table/src/BaseTable.jsx index b3a949e85..35988f981 100644 --- a/components/vc-table/src/BaseTable.jsx +++ b/components/vc-table/src/BaseTable.jsx @@ -46,7 +46,7 @@ const BaseTable = { }) }, - renderRows (renderData, indent, rows = [], ancestorKeys = []) { + renderRows (renderData, indent, ancestorKeys = []) { const { columnManager, sComponents: components, prefixCls, @@ -64,6 +64,8 @@ const BaseTable = { } = this.table const { getRowKey, fixed, expander, isAnyColumnsFixed } = this + const rows = [] + for (let i = 0; i < renderData.length; i++) { const record = renderData[i] const key = getRowKey(record, i) @@ -84,16 +86,12 @@ const BaseTable = { } const rowPrefixCls = `${prefixCls}-row` - const rowIndex = rows.filter(row => { - const props = getOptionProps(row) - return !props.expandedRow - }).length const expandableRowProps = { props: { ...expander.props, fixed, - index: rowIndex, + index: i, prefixCls: rowPrefixCls, record, rowKey: key, @@ -112,7 +110,7 @@ const BaseTable = { fixed, indent, record, - index: rowIndex, + index: i, prefixCls: rowPrefixCls, childrenColumnName: childrenColumnName, columns: leafColumns, diff --git a/components/vc-table/src/ExpandableTable.jsx b/components/vc-table/src/ExpandableTable.jsx index cd4afd392..7d100f64a 100644 --- a/components/vc-table/src/ExpandableTable.jsx +++ b/components/vc-table/src/ExpandableTable.jsx @@ -201,7 +201,7 @@ const ExpandableTable = { } if (childrenData) { - renderRows(childrenData, nextIndent, rows, nextAncestorKeys) + rows.push(...renderRows(childrenData, nextIndent, nextAncestorKeys)) } }, }, diff --git a/components/vc-tree/index.js b/components/vc-tree/index.js index 52110baae..94f5145d3 100644 --- a/components/vc-tree/index.js +++ b/components/vc-tree/index.js @@ -1,4 +1,4 @@ -// based on rc-tree 1.12.6 +// based on rc-tree 1.14.6 'use strict' module.exports = require('./src/')