|
|
@@ -2,124 +2,26 @@ import React from 'react';
|
|
|
import ReactDOM from 'react-dom';
|
|
|
import Table from '../../src/Table/index.js';
|
|
|
import Animate from 'rc-animate';
|
|
|
-import $ from 'jquery';
|
|
|
-import { sort, remove } from '../utils/ArrayUtils.js';
|
|
|
import renders from '../utils/RenderUtils.js';
|
|
|
-import { createFormData } from '../utils/FetchUtil.js';
|
|
|
import '../../assets/Table/index.less';
|
|
|
+import '../../assets/Table/animation.less';
|
|
|
|
|
|
|
|
|
class TableModel extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
- this.sorts = []; // 排序规则
|
|
|
- this.groups = []; // 分组规则
|
|
|
+ this.newProps = props;
|
|
|
this.columns = this.setColumnsRender(props.columns);
|
|
|
this.state = {
|
|
|
- data: props.data || [],
|
|
|
+ data: []
|
|
|
};
|
|
|
- this.initState();
|
|
|
this.timerKeys = []; // 定时器key数组
|
|
|
}
|
|
|
- // 初始化state
|
|
|
- initState() {
|
|
|
- let oriState = this.props.state;
|
|
|
- for (let key in oriState) {
|
|
|
- this.state[key] = oriState[key];
|
|
|
- }
|
|
|
- }
|
|
|
- // 初始化检索columns,获得排序、分组信息
|
|
|
- init() {
|
|
|
- // 先重置
|
|
|
- this.sorts = [];
|
|
|
- this.groups = [];
|
|
|
-
|
|
|
- let cols = this.columns;
|
|
|
- let i = 0;
|
|
|
- for (i; i < cols.length; i++) {
|
|
|
- let col = cols[i];
|
|
|
- if (Math.abs(col['sort']) > 0) {
|
|
|
- this.sorts.push({
|
|
|
- sortKey: col['dataIndex'],
|
|
|
- sortLevel: Math.abs(col['sort']),
|
|
|
- direction: col['sort'] > 0 ? 1 : -1
|
|
|
- });
|
|
|
- }
|
|
|
- if (col['group'] == true) {
|
|
|
- this.groups.push({
|
|
|
- groupIndex: i
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- sort(this.sorts, [{ key: 'sortLevel', direction: 1 }]);
|
|
|
- }
|
|
|
- // 根据sort值分层排序data
|
|
|
- sortData(data) {
|
|
|
- let sortArray = this.sorts.map(function (s, i) {
|
|
|
- return {
|
|
|
- key: s.sortKey,
|
|
|
- direction: s.direction
|
|
|
- };
|
|
|
- });
|
|
|
- if (sortArray) { }
|
|
|
- let sortData = sort(data || [], sortArray);
|
|
|
- return sortData;
|
|
|
- }
|
|
|
- // 合并单元格
|
|
|
- groupCells() {
|
|
|
- let groupIndexs = this.groups.map(function (g, i) {
|
|
|
- return g.groupIndex;
|
|
|
- });
|
|
|
- for (let a = 0; a < groupIndexs.length; a++) {
|
|
|
- let cols = this.columns;
|
|
|
- let col = cols[groupIndexs[a]];
|
|
|
- this.grouping(col);
|
|
|
- }
|
|
|
- }
|
|
|
- // 合并单元格实现
|
|
|
- grouping(col) {
|
|
|
- let data = this.state.data || [];
|
|
|
- let dataIndex = col['dataIndex'];
|
|
|
- let i = 0, j = 0, rowSpan = 1;
|
|
|
- let p = [];
|
|
|
- let oriRender = col.render;
|
|
|
- for (i; i < data.length; i = i + rowSpan) {
|
|
|
- rowSpan = 1;
|
|
|
- // 被比较行内容
|
|
|
- let now_dataValue = oriRender(data[i][dataIndex], data[i]).children;
|
|
|
- for (j = i + 1; j < data.length; j++) {
|
|
|
- // 比较行内容
|
|
|
- let next_dataValue = oriRender(data[j][dataIndex], data[j]).children;
|
|
|
- // 连续的两行内容相同时合并
|
|
|
- if (next_dataValue == now_dataValue) {
|
|
|
- rowSpan++;
|
|
|
- }
|
|
|
- // 只要找到一个不一样的马上跳出
|
|
|
- else if (next_dataValue != now_dataValue) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- // 合并参数
|
|
|
- p.push({ start: i, rowSpan: rowSpan });
|
|
|
- }
|
|
|
- // 重写render方法,设置需要合并的单元格rowSpan
|
|
|
- col.render = function (value, row, index) {
|
|
|
- let obj = oriRender(value, row, index);
|
|
|
- obj.props.rowSpan = 0;
|
|
|
- for (let i = 0; i < p.length; i++) {
|
|
|
- if (index == p[i].start) {
|
|
|
- obj.props.rowSpan = p[i].rowSpan;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- return obj;
|
|
|
- }
|
|
|
- }
|
|
|
// 根据renderName设置每列的render
|
|
|
setColumnsRender(columns) {
|
|
|
let cols = columns;
|
|
|
// 如果需要增加序号列
|
|
|
- if (this.props.index) {
|
|
|
+ if (this.newProps.index) {
|
|
|
cols.unshift({
|
|
|
key: 'index',
|
|
|
title: '序号',
|
|
|
@@ -131,162 +33,15 @@ class TableModel extends React.Component {
|
|
|
let col = cols[i];
|
|
|
let renderFunction = typeof (col.render) == 'string' ? renders[col.render] :
|
|
|
(typeof (col.render) == 'function' ? col.render :
|
|
|
- renders[this.props.render] || function (_v, _r, _i) { return { children: _v, props: {} } });
|
|
|
+ renders[this.newProps.render] || function (_v, _r, _i) { return { children: _v, props: {} } });
|
|
|
col.render = renderFunction;
|
|
|
}
|
|
|
return cols;
|
|
|
}
|
|
|
// 设置排序合并以及表头和表体列对齐
|
|
|
onShow() {
|
|
|
- this.adaptiveScreenSize();
|
|
|
this.adaptiveRowSize();
|
|
|
- this.init();
|
|
|
- let headers = document.getElementsByTagName('th');
|
|
|
- let rows = document.getElementsByClassName('rc-table-row');
|
|
|
- let alignWidth = 0; // 该值等于((@horizontal-padding)*2+(border宽度*2))
|
|
|
- // 如果需要滚动需要调整表头和表体
|
|
|
- if (this.props.scroll && this.state.data && this.state.data.length > 0) {
|
|
|
- if (rows.length > 0) {
|
|
|
- let cells = rows[0].cells || [];
|
|
|
- for (let i = 0; i < (cells.length - 1); i++) {
|
|
|
- headers[i].width = headers[i].width || cells[i].offsetWidth - alignWidth;
|
|
|
- }
|
|
|
- for (let i = 0; i < (cells.length - 1); i++) {
|
|
|
- cells[i].width = headers[i].offsetWidth - alignWidth;
|
|
|
- }
|
|
|
- this.autoScroll('y', rows.length);
|
|
|
- }
|
|
|
- }
|
|
|
- // 如果不需要滚动只需要调整表头
|
|
|
- else {
|
|
|
- if (rows.length > 0) {
|
|
|
- let cells = rows[0].cells || [];
|
|
|
- let oldTrs = document.getElementsByClassName('fade-leave') || [];
|
|
|
- for (let i = 0; i < (cells.length - 1); i++) {
|
|
|
- //headers[i].width = headers[i].width || cells[i].offsetWidth - alignWidth;
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- let firstRow = rows[0];
|
|
|
- let rowHeight = firstRow.offsetHeight;
|
|
|
- let firstRowTop = firstRow.offsetTop;
|
|
|
- let newTds = firstRow.getElementsByTagName('td');
|
|
|
- // 动画效果定位实现部分
|
|
|
- for (let i = 0; i < oldTrs.length; i++) {
|
|
|
- // 先设置旧tr为绝对布局
|
|
|
- oldTrs[i].style.position = 'absolute';
|
|
|
- // 宽度为100%
|
|
|
- oldTrs[i].style.width = '100%';
|
|
|
- // 新tr的位置高度
|
|
|
- let newTrTop = firstRowTop + rowHeight * i;
|
|
|
- // 将旧tr上移覆盖新的tr
|
|
|
- oldTrs[i].style.top = `${newTrTop}px`;
|
|
|
- // 获得旧tds
|
|
|
- let oldTds = oldTrs[i].getElementsByTagName('td');
|
|
|
-
|
|
|
- for (let j = 0; j < oldTds.length; j++) {
|
|
|
- // 设置旧td=新td宽度
|
|
|
- oldTds[j].width = newTds[j].offsetWidth - alignWidth;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // }else {
|
|
|
- // this.groupCells();
|
|
|
- // }
|
|
|
-
|
|
|
- }
|
|
|
- // 设置自动滚动展示(y轴)
|
|
|
- autoScroll(dir, count) {
|
|
|
- let $el = $(".rc-table-body");
|
|
|
-
|
|
|
- if ($el != undefined) {
|
|
|
- $el.scrollTop(0);
|
|
|
- // 默认滚动速度(越小越快)
|
|
|
- let speed = this.props.scrollSpeed || 5;
|
|
|
- // 一次移动行数
|
|
|
- let rows = 2;
|
|
|
- let _self = this;
|
|
|
-
|
|
|
- function anim() {
|
|
|
- stop();
|
|
|
- // 一行高度
|
|
|
- let tdHeight = document.getElementsByClassName('rc-table-row')[0].offsetHeight;
|
|
|
-
|
|
|
- let titleEle = document.getElementsByClassName("rc-table-title")[0];
|
|
|
- let headerEle = document.getElementsByClassName("rc-table-thead")[0];
|
|
|
- let screenHeight = titleEle.parentNode.offsetHeight;
|
|
|
- // body高度
|
|
|
- let bodyHeight = screenHeight - titleEle.offsetHeight - headerEle.offsetHeight;
|
|
|
- let st = $el.scrollTop();// 距离顶部高度
|
|
|
- let sb = $el.prop("scrollHeight") - $el.innerHeight();// 滚动栏总高度
|
|
|
- let scrollSpeed = sb / (bodyHeight / (speed * tdHeight)) * 100;
|
|
|
-
|
|
|
- if (st < sb) {
|
|
|
- $el.animate({ scrollTop: sb }, scrollSpeed * ((sb - st) / sb), 'linear', anim);
|
|
|
- } else {
|
|
|
- let data = _self.state.data;
|
|
|
- // 一次调整两行以规避因单双行颜色不同造成的界面颜色变动
|
|
|
- for (var i = 0; i < rows; i++) {
|
|
|
- let firstRow = data[0];
|
|
|
- data.push(firstRow);
|
|
|
- data.shift();
|
|
|
- }
|
|
|
- _self.setState({
|
|
|
- data: data
|
|
|
- }, function () {
|
|
|
- // 手动设置滚动条上移
|
|
|
- $el.scrollTop(sb - tdHeight * rows);
|
|
|
- anim();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- function stop() {
|
|
|
- $el.stop();
|
|
|
- }
|
|
|
- if ($el.prop("scrollHeight") - $el.innerHeight() > 0) {
|
|
|
- anim();
|
|
|
- $el.hover(stop, anim);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 请求数据
|
|
|
- fetchData(url, params, dataKey, load, callbackFunction) {
|
|
|
- callbackFunction = callbackFunction || function () { };
|
|
|
- let _self = this;
|
|
|
- let time = new Date().getTime();
|
|
|
- fetch(url, {
|
|
|
- credentials: 'include',
|
|
|
- method: 'POST',
|
|
|
- mode: "no-cors",
|
|
|
- headers: {
|
|
|
- "Content-Type": 'application/json;charset=UTF-8'
|
|
|
- },
|
|
|
- body: createFormData(params),
|
|
|
- }).then(function (response) {
|
|
|
- return response.json();
|
|
|
- }).then(function (json) {
|
|
|
- console.log(json);
|
|
|
- let data = json[dataKey];
|
|
|
- if (load) {
|
|
|
- _self.setState({
|
|
|
- data: _self.sortData(data).map(function (record, index) {
|
|
|
- record.key = index + '_' + time;
|
|
|
- return record;
|
|
|
- })
|
|
|
- }, () => {
|
|
|
- callbackFunction(_self, data);
|
|
|
- _self.onShow();
|
|
|
- })
|
|
|
- } else {
|
|
|
- callbackFunction(_self, data);
|
|
|
- }
|
|
|
-
|
|
|
- return data;
|
|
|
- }).catch(function (ex) {
|
|
|
- console.log('parsing failed', ex);
|
|
|
- })
|
|
|
+ this.switchAnimate();
|
|
|
}
|
|
|
|
|
|
// 定时任务
|
|
|
@@ -296,108 +51,125 @@ class TableModel extends React.Component {
|
|
|
}.bind(this), obj.intervalTime || 3000));
|
|
|
}
|
|
|
|
|
|
- // 滚动展示时自适应屏幕大小
|
|
|
- adaptiveScreenSize() {
|
|
|
- return;
|
|
|
- let titleEle = document.getElementsByClassName("rc-table-title")[0];
|
|
|
- let headerEle = document.getElementsByClassName("rc-table-thead")[0];
|
|
|
- let screenHeight = titleEle.parentNode.offsetHeight;
|
|
|
- let bodyHeight = document.getElementsByClassName("rc-table-body")[0].offsetHeight;
|
|
|
- if (this.state.data.length > 0) {
|
|
|
- bodyHeight = screenHeight - (titleEle ? titleEle.offsetHeight : 0) - headerEle.offsetHeight;
|
|
|
- } else {
|
|
|
- let noDataEle = document.getElementsByClassName("rc-table-placeholder")[0];
|
|
|
- bodyHeight = screenHeight - (titleEle ? titleEle.offsetHeight : 0) - headerEle.offsetHeight - noDataEle.offsetHeight;
|
|
|
- }
|
|
|
- let bodyEle = document.getElementsByClassName("rc-table-body")[0];
|
|
|
- if (this.props.scroll) {
|
|
|
- bodyEle.style.height = `${bodyHeight}px`;
|
|
|
- bodyEle.style.marginTop = "17px";
|
|
|
- } else {
|
|
|
- bodyEle.style.height = `${bodyHeight + 40}px`;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 调整行高
|
|
|
+ // 调整行
|
|
|
adaptiveRowSize() {
|
|
|
- return;
|
|
|
- let headerEle = document.getElementsByClassName("rc-table-thead")[0];
|
|
|
- let titleEle = document.getElementsByClassName("rc-table-title")[0];
|
|
|
- // let screenHeight = window.innerHeight;
|
|
|
- let screenHeight = titleEle.parentNode.offsetHeight;
|
|
|
- let bodyHeight = screenHeight - (titleEle ? titleEle.offsetHeight : 0) - headerEle.offsetHeight;
|
|
|
+ var node = this._reactInternalInstance.getHostNode();
|
|
|
+ let bodyHeight = this.cHeight - node.getElementsByClassName('rc-table-title')[0].offsetHeight - node.getElementsByClassName('rc-table-thead')[0].offsetHeight - 4;
|
|
|
let count = this.state.data.length;
|
|
|
if (count == 0) { return; }
|
|
|
- let tds = document.getElementsByTagName('td');
|
|
|
- if (this.props.scroll && this.props.fetch) {
|
|
|
- if (count < ((bodyHeight / tds[0].offsetHeight) + 2) && count > this.props.fetch.params.pageSize) {
|
|
|
- for (let i = 0; i < tds.length; i++) {
|
|
|
- tds[i].style.height = `${bodyHeight / (count - 2) + 0.1}px`;
|
|
|
- }
|
|
|
+ let trs = node.getElementsByClassName('fade-enter');
|
|
|
+ for (let i = 0; i < trs.length; i++) {
|
|
|
+ // trs[i].style.width = `${bodyHeight/this.rowCount}px`;
|
|
|
+ trs[i].style.height = `${bodyHeight/this.rowCount}px`;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ // 切换动画
|
|
|
+ switchAnimate() {
|
|
|
+ var node = this._reactInternalInstance.getHostNode()
|
|
|
+ let headers = node.getElementsByTagName('th');
|
|
|
+ let rows = node.getElementsByClassName('rc-table-row');
|
|
|
+ let alignWidth = 0; // 该值等于((@horizontal-padding)*2+(border宽度*2))
|
|
|
+ if (rows.length > 0) {
|
|
|
+ let cells = rows[0].cells || [];
|
|
|
+ let oldTrs = node.getElementsByClassName('fade-leave') || [];
|
|
|
+ for (let i = 0; i < (cells.length - 1); i++) {
|
|
|
+ //headers[i].width = headers[i].width || cells[i].offsetWidth - alignWidth;
|
|
|
}
|
|
|
- } else {
|
|
|
- for (let i = 0; i < tds.length; i++) {
|
|
|
- if (this.props.fetch) {
|
|
|
- tds[i].style.height = `${bodyHeight / this.state.data.length}px`;
|
|
|
+ let firstRow = rows[0];
|
|
|
+ let rowHeight = firstRow.offsetHeight;
|
|
|
+ let firstRowTop = firstRow.offsetTop + node.getElementsByClassName('rc-table-title')[0].offsetHeight;
|
|
|
+ let newTds = firstRow.getElementsByTagName('td');
|
|
|
+ // 动画效果定位实现部分
|
|
|
+ for (let i = 0; i < oldTrs.length; i++) {
|
|
|
+ // 先设置旧tr为绝对布局
|
|
|
+ oldTrs[i].style.position = 'absolute';
|
|
|
+ // 宽度为100%
|
|
|
+ oldTrs[i].style.width = '100%';
|
|
|
+ // 新tr的位置高度
|
|
|
+ let newTrTop = firstRowTop + rowHeight * i;
|
|
|
+ // 将旧tr上移覆盖新的tr
|
|
|
+ oldTrs[i].style.top = `${newTrTop}px`;
|
|
|
+ // 获得旧tds
|
|
|
+ let oldTds = oldTrs[i].getElementsByTagName('td');
|
|
|
+ for (let j = 0; j < oldTds.length; j++) {
|
|
|
+ // 设置旧td=新td宽度
|
|
|
+ oldTds[j].style.maxWidth = `${newTds[j].offsetWidth - 2}px`;
|
|
|
+ oldTds[j].style.minWidth = `${newTds[j].offsetWidth - 2}px`;
|
|
|
+ oldTds[j].width = newTds[j].offsetWidth - 2;
|
|
|
+ oldTds[j].height = newTds[j].offsetHeight -2;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- componentWillMount() {
|
|
|
- let beforeRenderFunction = this.props.beforeRender;
|
|
|
- if (beforeRenderFunction) {
|
|
|
- beforeRenderFunction(this);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据容器高度分割data展示
|
|
|
+ */
|
|
|
+ splitData() {
|
|
|
+ this.cHeight = this._reactInternalInstance._hostParent._hostNode.offsetHeight;
|
|
|
+ this.cWidth = this._reactInternalInstance._hostParent._hostNode.offsetWidth;
|
|
|
+ this.rowCount = Math.round(this.cHeight/40);
|
|
|
+ this.rowHeight = this.cHeight/this.rowCount;
|
|
|
+ let a = this.newProps.data;
|
|
|
+ let result = [];
|
|
|
+ let j = 0;
|
|
|
+ for(let i = 0; i<a.length;i = i + j){
|
|
|
+ let arr = [];
|
|
|
+ for(j = 0; j < this.rowCount && a[i+j]; j++) {
|
|
|
+ arr.push(a[i+j]);
|
|
|
+ }
|
|
|
+ result.push(arr);
|
|
|
}
|
|
|
+
|
|
|
+ this.dataArr = result;
|
|
|
+ this.dataIndex = 0;
|
|
|
}
|
|
|
- componentDidMount() {
|
|
|
- this.onShow();
|
|
|
- if (this.props.timer) {
|
|
|
- this.props.timer.map(function (obj, index) {
|
|
|
- this.timing(obj);
|
|
|
- }.bind(this));
|
|
|
+
|
|
|
+ setRefresh() {
|
|
|
+ this.changeData();
|
|
|
+ if(this.dataArr.length > 1) {
|
|
|
+ this.timing({
|
|
|
+ intervalFunction: function() {
|
|
|
+ this.changeData();
|
|
|
+ }.bind(this),
|
|
|
+ intervalTime: 2000
|
|
|
+ });
|
|
|
}
|
|
|
- // 如果配置了fetch
|
|
|
- if (this.props.fetch) {
|
|
|
- // 是否自动加载fetch数据(将会覆盖设定的data)
|
|
|
- if (this.props.fetch.autoLoad) {
|
|
|
- this.fetchData(this.props.fetch.url, this.props.fetch.params, this.props.fetch.dataKey, true);
|
|
|
- }
|
|
|
- if (this.props.fetch.autoRefresh > 0) {
|
|
|
- this.fetchParams = Object.assign({}, this.props.fetch.params);
|
|
|
- this.fetchParams.page = this.props.fetch.autoLoad ? 2 : 1;
|
|
|
- let func = function () {
|
|
|
+ }
|
|
|
|
|
|
- this.fetchData(this.props.fetch.url, this.fetchParams, this.props.fetch.dataKey, true, function (th) {
|
|
|
- if (th.state.data.length < th.props.fetch.params.pageSize) {
|
|
|
- th.fetchParams = Object.assign({}, th.props.fetch.params);
|
|
|
- } else {
|
|
|
- th.fetchParams.page = th.fetchParams.page + 1;
|
|
|
- }
|
|
|
- });
|
|
|
- }.bind(this);
|
|
|
- this.timing({
|
|
|
- intervalTime: this.props.fetch.autoRefresh,
|
|
|
- intervalFunction: func.bind(this)
|
|
|
- });
|
|
|
+ changeData() {
|
|
|
+ this.setState({
|
|
|
+ data: this.dataArr[this.dataIndex]
|
|
|
+ }, ()=>{
|
|
|
+ this.onShow();
|
|
|
+ this.dataIndex++;
|
|
|
+ if(this.dataIndex >= this.dataArr.length){
|
|
|
+ this.dataIndex = 0
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
- componentWillUnmount() {
|
|
|
+
|
|
|
+ clearInterval() {
|
|
|
for (let timerKey in this.timerKeys) {
|
|
|
clearInterval(this.timerKeys[timerKey]);
|
|
|
- remove(this.timerKeys, timerKey);
|
|
|
- }
|
|
|
- let $el = $(".rc-table-body");
|
|
|
- if ($el != undefined) {
|
|
|
- $el.stop();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ componentWillMount() {
|
|
|
+ }
|
|
|
+ componentDidMount() {
|
|
|
+ this.splitData();
|
|
|
+ this.setRefresh();
|
|
|
+ }
|
|
|
+ componentWillUnmount() {
|
|
|
+ this.clearInterval();
|
|
|
+ }
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
- this.setState({
|
|
|
- columns: nextProps.columns,
|
|
|
- data: nextProps.data
|
|
|
- });
|
|
|
+ this.clearInterval();
|
|
|
+ this.newProps = nextProps;
|
|
|
+ this.splitData();
|
|
|
+ this.setRefresh();
|
|
|
}
|
|
|
getBodyWrapper(body) {
|
|
|
return (
|
|
|
@@ -411,7 +183,7 @@ class TableModel extends React.Component {
|
|
|
}
|
|
|
|
|
|
getTitle() {
|
|
|
- const { title } = this.props;
|
|
|
+ const { title } = this.newProps;
|
|
|
if (renders[title]) {
|
|
|
return renders[title];
|
|
|
} else {
|
|
|
@@ -426,30 +198,30 @@ class TableModel extends React.Component {
|
|
|
return (
|
|
|
<div style={{height: '100%', overflow: 'hidden'}}>
|
|
|
<Table
|
|
|
- prefixCls={this.props.prefixCls || 'rc-table'}
|
|
|
- className={this.props.className}
|
|
|
- useFixedHeader={this.props.useFixedHeader || false}
|
|
|
- scroll={{ x: false, y: this.props.scroll } || { x: false, y: false }}
|
|
|
- expandIconAsCell={this.props.expandIconAsCell || false}
|
|
|
- expandIconColumnIndex={this.props.expandIconColumnIndex || 0}
|
|
|
- rowKey={this.props.rowKey || 'key'}
|
|
|
- rowClassName={this.props.rowClassName || function () { }}
|
|
|
- rowRef={this.props.rowRef || function () { }}
|
|
|
- defaultExpandedRowKeys={this.props.defaultExpandedRowKeys || []}
|
|
|
- expandedRowKeys={this.props.expandedRowKeys || []}
|
|
|
- defaultExpandAllRows={this.props.defaultExpandAllRows || false}
|
|
|
- onExpandedRowsChange={this.props.onExpandedRowsChange || function () { }}
|
|
|
- onExpand={this.props.onExpand || function () { }}
|
|
|
- expandedRowClassName={this.props.expandedRowClassName || function () { }}
|
|
|
- indentSize={this.props.indentSize || 15}
|
|
|
- onRowClick={this.props.onRowClick || function () { }}
|
|
|
- onRowDoubleClick={this.props.onRowDoubleClick || function () { }}
|
|
|
- onRowMouseEnter={this.props.onRowMouseEnter || function () { }}
|
|
|
- onRowMouseLeave={this.props.onRowMouseLeave || function () { }}
|
|
|
- showHeader={this.props.showHeader || true}
|
|
|
+ prefixCls={this.newProps.prefixCls || 'rc-table'}
|
|
|
+ className={this.newProps.className}
|
|
|
+ useFixedHeader={this.newProps.useFixedHeader || false}
|
|
|
+ scroll={{ x: false, y: this.newProps.scroll } || { x: false, y: false }}
|
|
|
+ expandIconAsCell={this.newProps.expandIconAsCell || false}
|
|
|
+ expandIconColumnIndex={this.newProps.expandIconColumnIndex || 0}
|
|
|
+ rowKey={this.newProps.rowKey || 'key'}
|
|
|
+ rowClassName={this.newProps.rowClassName || function () { }}
|
|
|
+ rowRef={this.newProps.rowRef || function () { }}
|
|
|
+ defaultExpandedRowKeys={this.newProps.defaultExpandedRowKeys || []}
|
|
|
+ expandedRowKeys={this.newProps.expandedRowKeys || []}
|
|
|
+ defaultExpandAllRows={this.newProps.defaultExpandAllRows || false}
|
|
|
+ onExpandedRowsChange={this.newProps.onExpandedRowsChange || function () { }}
|
|
|
+ onExpand={this.newProps.onExpand || function () { }}
|
|
|
+ expandedRowClassName={this.newProps.expandedRowClassName || function () { }}
|
|
|
+ indentSize={this.newProps.indentSize || 15}
|
|
|
+ onRowClick={this.newProps.onRowClick || function () { }}
|
|
|
+ onRowDoubleClick={this.newProps.onRowDoubleClick || function () { }}
|
|
|
+ onRowMouseEnter={this.newProps.onRowMouseEnter || function () { }}
|
|
|
+ onRowMouseLeave={this.newProps.onRowMouseLeave || function () { }}
|
|
|
+ showHeader={this.newProps.showHeader || true}
|
|
|
title={this.getTitle()}
|
|
|
- footer={this.props.footer}
|
|
|
- emptyText={this.props.emptyText || 'No Data'}
|
|
|
+ footer={this.newProps.footer}
|
|
|
+ emptyText={this.newProps.emptyText || 'No Data'}
|
|
|
columns={this.columns || []}
|
|
|
data={this.state.data || []}
|
|
|
getBodyWrapper={this.getBodyWrapper}
|