嵌套表格图标换成箭头、无滚动条时拖拽行报错问题
This commit is contained in:
parent
274ab33ff6
commit
d8dfd8de3e
|
@ -365,6 +365,13 @@ let dataSource = [
|
|||
class Demo0501 extends Component {
|
||||
constructor(props, context) {
|
||||
super(props);
|
||||
this.state = {
|
||||
dataSource: dataSource,
|
||||
editingRowsMap: {},
|
||||
currentIndex: null,
|
||||
errorEditFlag: false
|
||||
};
|
||||
|
||||
this.columns = [
|
||||
{
|
||||
title: "员工编号",
|
||||
|
@ -421,13 +428,6 @@ class Demo0501 extends Component {
|
|||
}
|
||||
];
|
||||
|
||||
this.state = {
|
||||
dataSource: dataSource,
|
||||
editingRowsMap: {},
|
||||
currentIndex: null,
|
||||
errorEditFlag: false
|
||||
};
|
||||
|
||||
this.originData = {};
|
||||
}
|
||||
|
||||
|
@ -448,6 +448,15 @@ class Demo0501 extends Component {
|
|||
this.setState({ editingRowsMap, dataSource });
|
||||
};
|
||||
|
||||
delete = index => () => {
|
||||
if (index === null) return;
|
||||
let { dataSource } = this.state;
|
||||
dataSource.splice(index,1);
|
||||
this.setState({
|
||||
dataSource:dataSource
|
||||
});
|
||||
}
|
||||
|
||||
commitChange = index => () => {
|
||||
if (this.state.errorEditFlag) return;
|
||||
let editingRowsMap = { ...this.state.editingRowsMap };
|
||||
|
@ -487,6 +496,9 @@ class Demo0501 extends Component {
|
|||
<Button colors="dark" onClick={this.edit(currentIndex)}>
|
||||
编辑
|
||||
</Button>
|
||||
<Button colors="dark" onClick={this.delete(currentIndex)}>
|
||||
删除
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -11,28 +11,11 @@ import {Button,Tooltip} from "tinper-bee";
|
|||
import Table from "../../src";
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: "员工编号", dataIndex: "a", key: "a", width: 120, className: "rowClassName",
|
||||
fixed:'left',
|
||||
render: (text, record, index) => {
|
||||
return (
|
||||
<Tooltip inverse overlay={text}>
|
||||
<span tootip={text} style={{
|
||||
display: "block",
|
||||
width: "80px",
|
||||
textOverflow: "ellipsis",
|
||||
overflow: "hidden",
|
||||
whiteSpace: "nowrap",
|
||||
verticalAlign: "middle",
|
||||
}}>{text}</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
},
|
||||
{ title: "员工编号", dataIndex: "a", key: "a", width: 150 },
|
||||
{ title: "员工姓名", dataIndex: "b", key: "b", width:200 },
|
||||
{ title: "性别", dataIndex: "c", key: "c", width: 500 },
|
||||
{ title: "部门", dataIndex: "d", key: "d", width: 100 },
|
||||
{ title: "职级", dataIndex: "e", key: "e", width: 100,fixed:'right'}
|
||||
{ title: "职级", dataIndex: "e", key: "e", width: 100 }
|
||||
];
|
||||
|
||||
const data = [
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -143,25 +143,22 @@
|
|||
cursor: pointer;
|
||||
display: inline-block;
|
||||
margin-right: 0px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
text-align: center;
|
||||
line-height: 14px;
|
||||
border: 1px solid rgb(193, 199, 208);
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
background: #fff;
|
||||
margin-right: 10px; }
|
||||
.u-table-row-expand-icon.uf, .u-table-expanded-row-expand-icon.uf {
|
||||
font-size: 12px;
|
||||
padding: 0; }
|
||||
.u-table-row-spaced, .u-table-expanded-row-spaced {
|
||||
visibility: hidden; }
|
||||
.u-table-row-spaced:after, .u-table-expanded-row-spaced:after {
|
||||
content: "."; }
|
||||
.u-table-row-expanded:after, .u-table-expanded-row-expanded:after {
|
||||
content: "-"; }
|
||||
.u-table-row-collapsed:after, .u-table-expanded-row-collapsed:after {
|
||||
content: "+"; }
|
||||
.u-table-row.selected {
|
||||
background: #FFF7E7; }
|
||||
.u-table tr.u-table-expanded-row {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import shallowequal from 'shallowequal';
|
||||
import Icon from 'bee-icon';
|
||||
|
||||
const propTypes = {
|
||||
record: PropTypes.object,
|
||||
|
@ -23,8 +24,9 @@ class ExpandIcon extends Component{
|
|||
if (expandable && !isHiddenExpandIcon) {
|
||||
const expandClassName = expanded ? 'expanded' : 'collapsed';
|
||||
return (
|
||||
<span
|
||||
<Icon
|
||||
className={`${clsPrefix}-expand-icon ${clsPrefix}-${expandClassName}`}
|
||||
type={expanded ? 'uf-triangle-down' : 'uf-triangle-right'}
|
||||
onClick={(e) => onExpand(!expanded, record, e)}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -267,14 +267,16 @@ $icon-color:#505F79;
|
|||
cursor: pointer;
|
||||
display: inline-block;
|
||||
margin-right: 0px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
text-align: center;
|
||||
line-height: 14px;
|
||||
border: 1px solid $table-border-color;
|
||||
user-select: none;
|
||||
background: #fff;
|
||||
margin-right: 10px;
|
||||
&.uf{
|
||||
font-size: 12px;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
&-spaced {
|
||||
visibility: hidden;
|
||||
|
@ -282,14 +284,6 @@ $icon-color:#505F79;
|
|||
&-spaced:after {
|
||||
content: ".";
|
||||
}
|
||||
|
||||
&-expanded:after {
|
||||
content: "-";
|
||||
}
|
||||
|
||||
&-collapsed:after {
|
||||
content: "+";
|
||||
}
|
||||
}
|
||||
&-row{
|
||||
&.selected{
|
||||
|
|
|
@ -200,6 +200,8 @@ class TableRow extends Component{
|
|||
_table_fixed_left_trs = contentTable.querySelector('.u-table-fixed-left table tbody'),
|
||||
_table_fixed_right_trs = contentTable.querySelector('.u-table-fixed-right table tbody');
|
||||
|
||||
_table_trs = _table_trs?_table_trs:contentTable.querySelector('.u-table table tbody');
|
||||
|
||||
this.synchronizeTrStyle(_table_trs,currentIndex,type);
|
||||
if(_table_fixed_left_trs){
|
||||
this.synchronizeTrStyle(_table_fixed_left_trs,currentIndex,type);
|
||||
|
|
Loading…
Reference in New Issue