publish 1.1.2

This commit is contained in:
jonyshi 2018-04-24 10:40:10 +08:00
parent 64ce46003a
commit c174915f0d
7 changed files with 115 additions and 40 deletions

View File

@ -169,6 +169,15 @@ function sum(Table) {
_this.tableType = "array";
return _this;
}
SumTable.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var columns = this.props.columns;
if (columns != nextProps.columns) {
this.setFooterRender();
}
};
//合计数字列,并将计算所得数据存储到一个obj对象中

View File

@ -6,6 +6,7 @@
*/
import React, { Component } from "react";
import Button from "bee-button";
import Table from "../../src";
import sum from "../../src/lib/sum.js";
@ -84,29 +85,51 @@ const columns = [
}
];
const data = [];
for (let i = 0; i < 5; i++) {
data.push({
key: i,
name: "John Brown",
age: i + 1,
street: "Lake Park",
building: "C",
number: 2035,
companyAddress: "Lake Street 42",
companyName: "SoftLake Co",
gender: "M"
});
function getData(){
const data = [];
for (let i = 0; i < 5; i++) {
data.push({
key: i,
name: "John Brown"+i,
age: i + Math.floor(Math.random()*10),
street: "Lake Park",
building: "C",
number: 20 * Math.floor(Math.random()*10),
companyAddress: "Lake Street 42",
companyName: "SoftLake Co",
gender: "M"
});
}
return data;
}
class Demo18 extends Component {
render() {
let multiObj = {
type: "checkbox"
constructor(props) {
super(props);
this.state = {
data: getData()
};
}
changeData = ()=>{
this.setState({
data: getData()
});
}
render() {
const {data} = this.state;
return (
<div>
<Button
className="editable-add-btn"
type="ghost"
onClick={this.changeData}
>
动态设置数据源
</Button>
<ComplexTable
columns={columns}
data={data}

File diff suppressed because one or more lines are too long

75
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "bee-table",
"version": "1.1.1",
"version": "1.1.2",
"description": "Table ui component for react",
"keywords": [
"react",

View File

@ -15,6 +15,14 @@ export default function sum(Table) {
//array , tree
this.tableType = "array";
}
componentWillReceiveProps(nextProps){
const {columns} = this.props;
if(columns != nextProps.columns){
this.setFooterRender();
}
}
//合计数字列,并将计算所得数据存储到一个obj对象中
currentFooter = () => {
let data_2 = this.props.data;