添加示例二级标题

This commit is contained in:
yangchch6 2019-04-18 10:50:38 +08:00
parent 41969fc745
commit 585494a2c4
42 changed files with 65453 additions and 21186 deletions

View File

@ -33,3 +33,9 @@
}
}
.opt-btns .u-button{
background: #505F79;
&:hover, &:active{
background: #344563;
}
}

View File

@ -1,7 +1,7 @@
/**
*
* @title 基本表格
* Tooltip
* @parent 基础 Basic
* @description 鼠标hover行时呼出操作按钮
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 默认无数据展示
* @parent 基础 Basic
* @description 无数据时显示效果展示可自定义
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 固定表头
* @parent 基础 Basic
* @description 设置`scroll.y`指定滚动区域的高度添加纵向滚动条达到固定表头效果
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 隔行换色
* @parent 基础 Basic
* @description 可自定义斑马线颜色
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 表格 Loading 加载
* @parent 基础 Basic
* @description loading可以传boolean或者object对象object为bee-loading组件的参数类型
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 嵌套子表格
* @parent 扩展行 Expanded Row
* @description 通过expandedRowRender参数来实现子表格
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 层级树型展示
* @parent 扩展行 Expanded Row
* @description 通过在data中配置children数据来自动生成树形表格
*
*/

View File

@ -1,7 +1,8 @@
/**
*
* @title 选中行颜色自定义表格标题和表尾
* @description
* @parent 扩展行 Expanded Row
* @description 选中行的样式可自定义
*/
import React, { Component } from "react";

View File

@ -1,6 +1,7 @@
/**
*
* @title 自定义行高
* @parent 扩展行 Expanded Row
* @description 设置`height`属性自定义表格行高设置`headerHeight`属性自定义表头高度
*/

View File

@ -1,122 +1,120 @@
/**
*
* @title 自定义行列合并
* @description 表头只支持列合并使用 column 里的 colSpan 进行设置表格支持行/列合并使用 render 里的单元格属性 colSpan 或者 rowSpan 设值为 0 设置的表格不会渲染
*
* @title 根据内容自动撑开行高
* @parent 扩展行 Expanded Row
* @description 表格行含有图片时的展示
*/
import React, { Component } from "react";
import {Button,Tooltip} from "tinper-bee";
import Table from "../../src";
const renderContent = (value, row, index) => {
const obj = {
children: value,
props: {},
};
if (index === 4) {
obj.props.colSpan = 0;
const columns = [
{
title: "序号",
dataIndex: "index",
key: "index",
width: 80,
render(record, text, index) {
return index + 1;
}
},
{
title: "组织部门",
dataIndex: "orgDept",
key: "orgDept",
width: 100,
},
{
title: "设施管理部门",
dataIndex: "facilityManageUnit",
key: "facilityManageUnit",
width: 100,
},
{
title: "案卷编号",
dataIndex: "docketnum",
key: "docketnum",
width: 100,
},
{
title: "数量",
dataIndex: "num",
key: "num",
width: 100,
},
{
title: "首次发现时间",
dataIndex: "discoveryTime",
key: "discoveryTime",
width: 100,
},
{
title: "实际修复时间",
dataIndex: "repairTime",
key: "repairTime",
width: 100,
},
{
title: "图样",
dataIndex: "picture",
key: "picture",
width: 100,
},
{
title: "申请单号",
dataIndex: "billcode",
key: "billcode",
width: 100,
},
{
title: "设施名称",
dataIndex: "facilityName",
key: "facilityName",
width: 100,
}
];
const data = [
{ orgDept: "", facilityManageUnit: "", docketnum: 41, num: "1", discoveryTime: "", repairTime: "", picture: "", billcode: "", facilityName:""},
{ orgDept: "", facilityManageUnit: "", docketnum: 41, num: "1", discoveryTime: "", repairTime: "", picture: "", billcode: "", facilityName:""},
{ orgDept: "", facilityManageUnit: "", docketnum: 41, num: "1", discoveryTime: "", repairTime: "", picture: "", billcode: "", facilityName:""}
];
class Demo105 extends Component {
constructor(props) {
super(props);
this.state = {
data: data,
selectedRowIndex: 0
}
}
handleClick = () => {
console.log('这是第' , this.currentIndex , '行');
console.log('内容:' , this.currentRecord);
}
return obj;
};
const columns = [{
title: 'Name',
key: "name",
dataIndex: 'name',
render: (text, row, index) => {
if (index < 4) {
return <a href="#">{text}</a>;
}
return {
children: <a href="#">{text}</a>,
props: {
colSpan: 5,
},
};
},
}, {
title: 'Age',
key: "Age",
dataIndex: 'age',
render: renderContent,
}, {
title: 'Home phone',
colSpan: 2,
key: "tel",
dataIndex: 'tel',
render: (value, row, index) => {
const obj = {
children: value,
props: {},
};
if (index === 2) {
obj.props.rowSpan = 2;
}
if (index === 3) {
obj.props.rowSpan = 0;
}
if (index === 4) {
obj.props.colSpan = 0;
}
return obj;
},
}, {
title: 'Phone',
colSpan: 0,
key: "phone",
dataIndex: 'phone',
render: renderContent,
}, {
title: 'Address',
key: "address",
dataIndex: 'address',
render: renderContent,
}];
onRowHover=(index,record)=>{
this.currentIndex = index;
this.currentRecord = record;
}
const data = [{
key: '1',
name: 'John Brown',
age: 32,
tel: '0571-22098909',
phone: 18889898989,
address: 'New York No. 1 Lake Park',
}, {
key: '2',
name: 'Jim Green',
tel: '0571-22098333',
phone: 18889898888,
age: 42,
address: 'London No. 1 Lake Park',
}, {
key: '3',
name: 'Joe Black',
age: 32,
tel: '0575-22098909',
phone: 18900010002,
address: 'Sidney No. 1 Lake Park',
}, {
key: '4',
name: 'Jim Red',
age: 18,
tel: '0575-22098909',
phone: 18900010002,
address: 'London No. 2 Lake Park',
}, {
key: '5',
name: 'Jake White',
age: 18,
tel: '0575-22098909',
phone: 18900010002,
address: 'Dublin No. 2 Lake Park',
}];
getHoverContent=()=>{
return <div className="opt-btns"><Button size="sm" onClick={this.handleClick}>一些操作</Button> </div>
}
class Demo15 extends Component {
render() {
return (
<Table columns={columns} data={data}/>
<Table
columns={columns}
data={data}
parentNodeId='parent'
hoverContent={this.getHoverContent}
onRowHover={this.onRowHover}
/>
);
}
}
export default Demo15;
export default Demo105;

123
demo/demolist/Demo106.js Normal file
View File

@ -0,0 +1,123 @@
/**
*
* @title 自定义行列合并
* @parent 扩展行 Expanded Row
* @description 表头只支持列合并使用 column 里的 colSpan 进行设置表格支持行/列合并使用 render 里的单元格属性 colSpan 或者 rowSpan 设值为 0 设置的表格不会渲染
*
*/
import React, { Component } from "react";
import Table from "../../src";
const renderContent = (value, row, index) => {
const obj = {
children: value,
props: {},
};
if (index === 4) {
obj.props.colSpan = 0;
}
return obj;
};
const columns = [{
title: 'Name',
key: "name",
dataIndex: 'name',
render: (text, row, index) => {
if (index < 4) {
return <a href="#">{text}</a>;
}
return {
children: <a href="#">{text}</a>,
props: {
colSpan: 5,
},
};
},
}, {
title: 'Age',
key: "Age",
dataIndex: 'age',
render: renderContent,
}, {
title: 'Home phone',
colSpan: 2,
key: "tel",
dataIndex: 'tel',
render: (value, row, index) => {
const obj = {
children: value,
props: {},
};
if (index === 2) {
obj.props.rowSpan = 2;
}
if (index === 3) {
obj.props.rowSpan = 0;
}
if (index === 4) {
obj.props.colSpan = 0;
}
return obj;
},
}, {
title: 'Phone',
colSpan: 0,
key: "phone",
dataIndex: 'phone',
render: renderContent,
}, {
title: 'Address',
key: "address",
dataIndex: 'address',
render: renderContent,
}];
const data = [{
key: '1',
name: 'John Brown',
age: 32,
tel: '0571-22098909',
phone: 18889898989,
address: 'New York No. 1 Lake Park',
}, {
key: '2',
name: 'Jim Green',
tel: '0571-22098333',
phone: 18889898888,
age: 42,
address: 'London No. 1 Lake Park',
}, {
key: '3',
name: 'Joe Black',
age: 32,
tel: '0575-22098909',
phone: 18900010002,
address: 'Sidney No. 1 Lake Park',
}, {
key: '4',
name: 'Jim Red',
age: 18,
tel: '0575-22098909',
phone: 18900010002,
address: 'London No. 2 Lake Park',
}, {
key: '5',
name: 'Jake White',
age: 18,
tel: '0575-22098909',
phone: 18900010002,
address: 'Dublin No. 2 Lake Park',
}];
class Demo15 extends Component {
render() {
return (
<Table columns={columns} data={data}/>
);
}
}
export default Demo15;

View File

@ -1,6 +1,7 @@
/**
*
* @title 横向滚动条
* @parent 滚动 Scroll View
* @description 设置`scroll`属性支持横向或纵向滚动x/y的取值可以是正整数百分比布尔值
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 纵向滚动条
* @parent 滚动 Scroll View
* @description 设置`scroll`属性支持横向或纵向滚动x/y的取值可以是正整数百分比布尔值
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 多选表格
* @parent 行操作-选择
* @description 点击表格左列按钮即可选中并且在选中的回调函数中能获取到选中的数据支持多选全选和禁止选择
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 无限滚动 Infinite Scroll
* @title 万行以上数据渲染
* @parent 无限滚动 Infinite-scroll
* @description 万行数据渲染
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 嵌套子表格滚动加载
* @parent 无限滚动 Infinite-scroll
* @description 通过expandedRowRender参数来实现子表格
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 多功能表格滚动加载
* @parent 无限滚动 Infinite-scroll
* @description
*/

View File

@ -1,3 +1,8 @@
/**
* @title 层级树大数据场景
* @parent 无限滚动 Infinite-scroll
* @description
*/
import React, { Component } from "react";
import {Tooltip} from "tinper-bee";

View File

@ -1,6 +1,6 @@
/**
*
* @title 表格+分页
* @parent 分页 Pagination
* @description 点击分页联动表格
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 表格+搜索
* @parent 搜索 search
* @description 搜索刷新表格数据
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 渲染本地数据
* @parent 数据操作 Data Opetation
* @description
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 多列表头
* @parent 列渲染 Custom Render
* @description columns[n] 可以内嵌 children以渲染分组表头
* 自定义表头高度需要传headerHeight修改th的padding top和bottom置为0否则会有影响
*

View File

@ -1,6 +1,7 @@
/**
*
* @title 合并列后合计
* @parent 列渲染 Custom Render
* @description 合并标题后的合计,且支持多字段统计通过使用的封装好的功能方法实现复杂功能简单易用
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 编辑态表格
* @parent 编辑 Editor
* @description 这是带有多种不同格式的编辑态表格编辑态是通过使用不同的render来达到不同编辑格式
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 左侧固定列
* @parent 列操作-锁定 Fixed
* @description 固定列到表格的左侧
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 右侧固定列
* @parent 列操作-锁定 Fixed
* @description 固定列到表格的右侧
*
*/

View File

@ -1,8 +1,8 @@
/**
*
* @title 动态设置列锁定解除锁定
* @description 动态设置固取消固定列
* @description 动态固定列设置 一个table动态设置一个方向fixed: "left"fixed: "right"
* @parent 列操作-锁定 Fixed
* @description 动态设置columns中数据的fixed属性值fixed: "left"fixed: "right"
*
*/
import React, { Component } from 'react';
@ -11,25 +11,6 @@ import {Icon,Menu,Dropdown} from "tinper-bee";
import Table from '../../src';
const { Item } = Menu;
// const columns24 = [
// {
// title: "Full Name",
// width: 100,
// dataIndex: "name",
// key: "name",
// fixed: "left",
// },
// { title: "Age", width: 100, dataIndex: "age", key: "age", fixed: "left" },
// { title: "Column 1", dataIndex: "address", key: "1" },
// { title: "Column 2", dataIndex: "address2", key: "2" },
// { title: "Column 3", dataIndex: "address", key: "3" },
// { title: "Column 4", dataIndex: "address", key: "4" },
// { title: "Column 24", dataIndex: "address", key: "24" },
// { title: "Column 6", dataIndex: "address", key: "6" },
// { title: "Column 7", dataIndex: "address", key: "7" },
// { title: "Column 8", dataIndex: "address", key: "8" }
// ];
const columns24 = [
{
@ -105,27 +86,26 @@ class Demo24 extends Component {
columns:columns24
}
}
onSelect = ({key,item})=>{
console.log(`${key} selected`); //获取key
let currentObject = item.props.data; //获取选中对象的数据
let {columns} = this.state;
let fixedCols = [];
let nonColums = [];
columns.find(da=>{
if(da.key == key){
da.fixed?delete da.fixed:da.fixed = 'left';
}
da.fixed?fixedCols.push(da):nonColums.push(da);
});
columns = [...fixedCols,...nonColums]
onSelect = ({key,item})=>{
console.log(`${key} selected`); //获取key
let currentObject = item.props.data; //获取选中对象的数据
let {columns} = this.state;
let fixedCols = [];
let nonColums = [];
columns.find(da=>{
if(da.key == key){
da.fixed?delete da.fixed:da.fixed = 'left';
}
da.fixed?fixedCols.push(da):nonColums.push(da);
});
columns = [...fixedCols,...nonColums]
this.setState({
columns
});
}
this.setState({
columns
});
}
//表头增加下拉菜单
renderColumnsDropdown(columns) {
const icon ='uf-arrow-down';
@ -166,10 +146,12 @@ class Demo24 extends Component {
render() {
let {columns} = this.state;
columns = this.renderColumnsDropdown(columns);
return <div className="demo24">
<Table columns={columns} data={data24} scroll={{ x: "110%", y: 240 }}/>
</div>;
columns = this.renderColumnsDropdown(columns);
return(
<div className="demo24">
<Table columns={columns} data={data24} scroll={{ x: "110%", y: 240 }}/>
</div>
)
}
}

View File

@ -1,6 +1,7 @@
/**
*
* @title 按条件值过滤
* @parent 列操作-过滤 Filter
* @description 可以根据输入项目以及判断条件对表格内的数据进行过滤
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 复杂表格中行过滤
* @parent 列操作-过滤 Filter
* @description 在过滤数据行的基础上增加列拖拽动态菜单显示下拉条件动态传入自定义等
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 列过滤面板
* @parent 列操作-隐藏 Hide
* @description 点击表格右侧按钮进行表格列的数据过滤可以自定义设置显示某列通过ifshow属性控制默认为true都显示afterFilter为过滤之后的回调函数
*
*/

View File

@ -1,5 +1,6 @@
/**
* @title 列排序
* @parent 列操作-排序 Sort
* @description column中增加sorter: (a, b) => a.c - b.c 这里的a,b代表前后两个数据c代表比较当前对象的字段名称
*
*/

View File

@ -1,6 +1,7 @@
/**
* @title 后端列排序
*
* @parent 列操作-排序 Sort
* @description 将控制台打印的参数传递给后端即可进行列排序
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 多列排序
* @parent 列操作-排序 Sort
* @description 多列排序全选功能合计通过使用的封装好的功能方法实现复杂功能简单易用新增回调函数(sorterClick)
*
*/

View File

@ -1,6 +1,7 @@
/**
*
* @title 拖拽改变列顺序
* @parent 列操作-拖拽 Drag
* @description 点击列的表头进行左右拖拽注意固定列不可以交换
*/
import React, { Component } from 'react';

View File

@ -1,6 +1,7 @@
/**
*
* @title 拖拽改变列宽度
* @parent 列操作-拖拽 Drag
* @description 不支持tree结构的表头合并表头的table
*/
import React, { Component } from 'react';

File diff suppressed because one or more lines are too long

5
dist/demo.css vendored
View File

@ -591,6 +591,11 @@
.demo25 .u-table-filter-column-filter-icon {
right: 15px; }
.opt-btns .u-button {
background: #505F79; }
.opt-btns .u-button:hover, .opt-btns .u-button:active {
background: #344563; }
.demo02 .u-table-placeholder i {
font-size: 60px; }

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

86175
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

@ -90,4 +90,4 @@
"react-dom": "^16.6.3",
"tinper-bee": "latest"
}
}
}