This commit is contained in:
yangchch6 2019-04-18 09:51:55 +08:00
commit 41969fc745
17 changed files with 359 additions and 1213 deletions

View File

@ -4,7 +4,7 @@
font-size: 12px;
color: #212121;
position: relative;
line-height: 1.5;
line-height: 1.33;
overflow: hidden; }
.u-table-body {
position: relative; }
@ -47,13 +47,15 @@
background: rgb(235, 236, 240); }
.u-table th,
.u-table td {
padding: 12px 8px;
padding: 12px 16px;
word-break: break-all; }
.u-table tr.filterable th {
padding-top: 5px !important;
padding-bottom: 5px !important; }
.u-table tr.filterable th .filterContext {
height: 35px; }
.u-table tr.filterable th .u-select-selection--single {
height: 26px; }
.u-table-row-hover {
background: rgb(235, 236, 240); }
.u-table-scroll {
@ -80,7 +82,7 @@
background: rgb(241, 242, 245);
color: rgb(33, 33, 33); }
.u-table.fixed-height td {
padding: 0px 8px; }
padding: 0px 16px; }
.u-table-fixed-header .u-table-body {
background: #fff;
position: relative; }
@ -98,17 +100,17 @@
overflow-y: scroll;
box-sizing: border-box; }
.u-table-title {
padding: 12px 8px;
padding: 12px 16px;
border-top: 1px solid rgb(193, 199, 208); }
.u-table-content {
position: relative; }
.u-table-footer {
padding: 12px 8px;
padding: 12px 16px;
border-bottom: 1px solid rgb(193, 199, 208); }
.u-table-footer .u-table-scroll {
overflow-x: hidden; }
.u-table-footer .u-table {
margin: -12px -8px; }
margin: -12px -16px; }
.u-table-placeholder {
padding: 12px 8px;
background: #fff;
@ -219,13 +221,18 @@
.u-table-thead th .bee-table-column-sorter {
position: relative;
margin-left: 4px;
height: 1em;
height: 16px;
vertical-align: middle;
text-align: center;
display: inline-block; }
display: inline-block;
margin-top: -3px; }
.u-table-thead th .bee-table-column-sorter i {
padding: 0px;
font-weight: 600;
color: #505F79; }
.u-table-thead th .bee-table-column-sorter > .bee-table-column-sorter-down,
.u-table-thead th .bee-table-column-sorter > .bee-table-column-sorter-up, .u-table-thead th .bee-table-column-sorter > .bee-table-column-sorter-flat {
line-height: 6px;
line-height: 16px;
display: block;
width: 34px;
cursor: pointer; }
@ -296,17 +303,18 @@
position: relative; }
.u-table-filter-column-filter-icon {
position: absolute;
top: 8px;
right: 18px;
width: 22px;
height: 25px;
line-height: 25px;
width: 30px;
height: 38px;
line-height: 38px;
right: 12px;
top: 1px;
z-index: 2;
background: rgb(241, 242, 245);
text-align: center;
cursor: pointer; }
.u-table-filter-column-filter-icon i.uf {
padding: 0px; }
padding: 0px;
color: #505F79; }
.u-table-filter-column-pop-cont-item {
margin-top: 8px;
cursor: pointer; }
@ -329,9 +337,14 @@
display: none;
pointer-events: none; }
.u-table .u-checkbox {
height: 16px;
line-height: 16px;
height: 14px;
line-height: 14px;
margin: 0px; }
.u-table .u-checkbox .u-checkbox-label {
line-height: 14px; }
.u-table .u-checkbox .u-checkbox-label:before, .u-table .u-checkbox .u-checkbox-label:after {
width: 14px;
height: 14px; }
.u-table:focus {
outline: none;
@ -521,16 +534,16 @@
.u-filter-dropdown-menu-wrap {
z-index: 1800; }
.u-filter-dropdown-menu-wrap .u-dropdown-menu li.u-dropdown-menu-item {
line-height: 28px;
height: 28px;
line-height: 26px;
height: 26px;
padding: 0px 16px 0 16px;
cursor: pointer; }
.filter-wrap .u-form-control {
height: 28px; }
height: 26px; }
.filter-wrap .u-input-number.u-input-group.simple .u-input-group-btn .icon-group {
height: 28px; }
height: 26px; }
.u-row-hover {
position: absolute;

View File

@ -490,6 +490,7 @@ function bigData(Table) {
if (!_this.props.expandedRowKeys) {
if (expandState) {
expandedRowKeys.push(rowKey);
_this4.setState({ needRender: !needRender });
} else {
var _index = -1;
expandedRowKeys.forEach(function (r, i) {

View File

@ -1,7 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
@ -36,137 +36,137 @@ var cloneDeep = require('lodash.clonedeep');
function dragColumn(Table) {
return function (_Component) {
_inherits(DragColumn, _Component);
return function (_Component) {
_inherits(DragColumn, _Component);
function DragColumn(props) {
_classCallCheck(this, DragColumn);
function DragColumn(props) {
_classCallCheck(this, DragColumn);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
_this.setColumOrderByIndex = function (_column) {
_column.forEach(function (da, i) {
da.dragIndex = i;
da.drgHover = false;
});
return _column;
};
_this.onDrop = function (event, data) {
var dragSource = data.dragSource,
dragTarg = data.dragTarg;
var columns = _this.state.columns;
var sourceIndex = -1,
targetIndex = -1;
sourceIndex = columns.findIndex(function (da, i) {
return da.key == dragSource.key;
});
targetIndex = columns.findIndex(function (da, i) {
return da.key == dragTarg.key;
});
// for (let index = 0; index < columns.length; index++) {
// const da = columns[index];
// if(da.key === dragSource.key){
// columns[index] = dragTargColum;
// }
// if(da.key === dragTarg.key){
// columns[index] = dragSourceColum;
// }
// }
// 向前移动
if (targetIndex < sourceIndex) {
targetIndex = targetIndex + 1;
}
columns.splice(targetIndex, 0, columns.splice(sourceIndex, 1)[0]);
_this.setState({
columns: cloneDeep(columns)
});
if (_this.props.onDrop) {
_this.props.onDrop(event, data, columns);
}
};
_this.getTarget = function (evt) {
return evt.target || evt.srcElement;
};
_this.state = {
columns: _this.setColumOrderByIndex(props.columns)
};
return _this;
}
DragColumn.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.columns != this.props.columns) {
this.setState({
columns: this.setColumOrderByIndex(nextProps.columns)
});
}
};
DragColumn.prototype.cloneDeep = function cloneDeep(obj) {
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || Object.keys(obj).length === 0) {
return obj;
}
var resultData = {};
return this.recursion(obj, resultData);
};
DragColumn.prototype.recursion = function (_recursion) {
function recursion(_x) {
return _recursion.apply(this, arguments);
}
recursion.toString = function () {
return _recursion.toString();
};
return recursion;
}(function (obj) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
for (key in obj) {
if (_typeof(obj[key]) == 'object' && Object.keys(obj[key].length > 0)) {
data[key] = recursion(obj[key]);
} else {
data[key] = obj[key];
}
}
return data;
_this.setColumOrderByIndex = function (_column) {
_column.forEach(function (da, i) {
da.dragIndex = i;
da.drgHover = false;
});
return _column;
};
DragColumn.prototype.render = function render() {
var _props = this.props,
data = _props.data,
dragborder = _props.dragborder,
draggable = _props.draggable,
className = _props.className,
columns = _props.columns,
onDragStart = _props.onDragStart,
onDragEnter = _props.onDragEnter,
onDragOver = _props.onDragOver,
onDrop = _props.onDrop,
others = _objectWithoutProperties(_props, ['data', 'dragborder', 'draggable', 'className', 'columns', 'onDragStart', 'onDragEnter', 'onDragOver', 'onDrop']);
_this.onDrop = function (event, data) {
var dragSource = data.dragSource,
dragTarg = data.dragTarg;
var columns = _this.state.columns;
var key = new Date().getTime();
return _react2["default"].createElement(Table, _extends({}, others, {
columns: this.state.columns,
data: data,
className: className + ' u-table-drag-border',
onDragStart: this.onDragStart,
onDragOver: this.onDragOver,
onDrop: this.onDrop,
onDragEnter: this.onDragEnter,
draggable: draggable,
dragborder: dragborder
// dragborder={false}
, dragborderKey: key
}));
};
var sourceIndex = -1,
targetIndex = -1;
return DragColumn;
}(_react.Component);
sourceIndex = columns.findIndex(function (da, i) {
return da.key == dragSource.key;
});
targetIndex = columns.findIndex(function (da, i) {
return da.key == dragTarg.key;
});
// for (let index = 0; index < columns.length; index++) {
// const da = columns[index];
// if(da.key === dragSource.key){
// columns[index] = dragTargColum;
// }
// if(da.key === dragTarg.key){
// columns[index] = dragSourceColum;
// }
// }
// 向前移动
if (targetIndex < sourceIndex) {
targetIndex = targetIndex + 1;
}
columns.splice(targetIndex, 0, columns.splice(sourceIndex, 1)[0]);
_this.setState({
columns: cloneDeep(columns)
});
if (_this.props.onDrop) {
_this.props.onDrop(event, data, columns);
}
};
_this.getTarget = function (evt) {
return evt.target || evt.srcElement;
};
_this.state = {
columns: _this.setColumOrderByIndex(props.columns)
};
return _this;
}
DragColumn.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.columns != this.props.columns) {
this.setState({
columns: this.setColumOrderByIndex(nextProps.columns)
});
}
};
DragColumn.prototype.cloneDeep = function cloneDeep(obj) {
if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object' || Object.keys(obj).length === 0) {
return obj;
}
var resultData = {};
return this.recursion(obj, resultData);
};
DragColumn.prototype.recursion = function (_recursion) {
function recursion(_x) {
return _recursion.apply(this, arguments);
}
recursion.toString = function () {
return _recursion.toString();
};
return recursion;
}(function (obj) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
for (key in obj) {
if (_typeof(obj[key]) == 'object' && Object.keys(obj[key].length > 0)) {
data[key] = recursion(obj[key]);
} else {
data[key] = obj[key];
}
}
return data;
});
DragColumn.prototype.render = function render() {
var _props = this.props,
data = _props.data,
dragborder = _props.dragborder,
draggable = _props.draggable,
className = _props.className,
columns = _props.columns,
onDragStart = _props.onDragStart,
onDragEnter = _props.onDragEnter,
onDragOver = _props.onDragOver,
onDrop = _props.onDrop,
others = _objectWithoutProperties(_props, ['data', 'dragborder', 'draggable', 'className', 'columns', 'onDragStart', 'onDragEnter', 'onDragOver', 'onDrop']);
var key = new Date().getTime();
return _react2["default"].createElement(Table, _extends({}, others, {
columns: this.state.columns,
data: data,
className: className + ' u-table-drag-border',
onDragStart: this.onDragStart,
onDragOver: this.onDragOver,
onDrop: this.onDrop,
onDragEnter: this.onDragEnter,
draggable: draggable,
dragborder: dragborder
// dragborder={false}
, dragborderKey: key
}));
};
return DragColumn;
}(_react.Component);
}
module.exports = exports['default'];

View File

@ -1,7 +1,7 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
@ -20,29 +20,29 @@ exports.ObjectAssign = ObjectAssign;
*/
function sortBy(arr, prop, desc) {
var props = [],
ret = [],
i = 0,
len = arr.length;
if (typeof prop == 'string') {
for (; i < len; i++) {
var oI = arr[i];
(props[i] = new String(oI && oI[prop] || ''))._obj = oI;
var props = [],
ret = [],
i = 0,
len = arr.length;
if (typeof prop == 'string') {
for (; i < len; i++) {
var oI = arr[i];
(props[i] = new String(oI && oI[prop] || ''))._obj = oI;
}
} else if (typeof prop == 'function') {
for (; i < len; i++) {
var _oI = arr[i];
(props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
}
} else {
throw '参数类型错误';
}
} else if (typeof prop == 'function') {
for (; i < len; i++) {
var _oI = arr[i];
(props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
props.sort();
for (i = 0; i < len; i++) {
ret[i] = props[i]._obj;
}
} else {
throw '参数类型错误';
}
props.sort();
for (i = 0; i < len; i++) {
ret[i] = props[i]._obj;
}
if (desc) ret.reverse();
return ret;
if (desc) ret.reverse();
return ret;
};
/**
@ -51,11 +51,11 @@ function sortBy(arr, prop, desc) {
* @param {} property
*/
function compare(property) {
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
return value1 - value2;
};
return function (a, b) {
var value1 = a[property];
var value2 = b[property];
return value1 - value2;
};
}
/**
@ -63,17 +63,17 @@ function compare(property) {
* @param {*} obj 要拷贝的对象
*/
function ObjectAssign(obj) {
var b = obj instanceof Array;
var tagObj = b ? [] : {};
if (b) {
//数组
obj.forEach(function (da) {
var _da = {};
_extends(_da, da);
tagObj.push(_da);
});
} else {
_extends(tagObj, obj);
}
return tagObj;
var b = obj instanceof Array;
var tagObj = b ? [] : {};
if (b) {
//数组
obj.forEach(function (da) {
var _da = {};
_extends(_da, da);
tagObj.push(_da);
});
} else {
_extends(tagObj, obj);
}
return tagObj;
}

View File

@ -13,7 +13,7 @@ const columns = [
{
title:'序号',
dataIndex:'index',
width:'50',
width:'60',
key:'index',
render:(text,record,index)=>{
return index

View File

@ -17,7 +17,7 @@ const columns = [
{
title:'序号',
dataIndex:'index',
width:'50',
width:'80',
key:'index',
render:(text,record,index)=>{
return index

View File

@ -1,10 +1,3 @@
/**
*
* @title 树状表滚动加载
* Tooltip
* @description
*/
import React, { Component } from "react";
import {Tooltip} from "tinper-bee";
@ -83,6 +76,7 @@ class Demo34 extends Component {
parentNodeId='parent'
scroll={{y:300}}
height={40}
onExpand={this.onExpand}
onRowClick={(record, index, indent) => {
console.log('currentIndex--'+index);
}}
@ -93,4 +87,4 @@ class Demo34 extends Component {
}
}
export default Demo34;
export default Demo34;

View File

@ -17,7 +17,7 @@ const columns = [
title: "Name",
dataIndex: "name",
key: "name",
width: 100,
width: 120,
fixed: "left"
},
{

View File

@ -74,7 +74,7 @@ const columns24 = [
title: "武功类型",
dataIndex: "g",
key: "g",
width: 100
width: 150
},
{
title: "师傅",

View File

@ -70,7 +70,7 @@ const data13 = [
//拼接成复杂功能的table组件不能在render中定义需要像此例子声明在组件的外侧不然操作state会导致功能出现异常
let ComplexTable = multiSelect(sum(sort(Table, Icon)), Checkbox);
let ComplexTable = multiSelect(sort(sum(Table, Icon)), Checkbox);
class Demo13 extends Component {
constructor(props) {

File diff suppressed because one or more lines are too long

55
dist/demo.css vendored
View File

@ -4,7 +4,7 @@
font-size: 12px;
color: #212121;
position: relative;
line-height: 1.5;
line-height: 1.33;
overflow: hidden; }
.u-table-body {
position: relative; }
@ -47,13 +47,15 @@
background: rgb(235, 236, 240); }
.u-table th,
.u-table td {
padding: 12px 8px;
padding: 12px 16px;
word-break: break-all; }
.u-table tr.filterable th {
padding-top: 5px !important;
padding-bottom: 5px !important; }
.u-table tr.filterable th .filterContext {
height: 35px; }
.u-table tr.filterable th .u-select-selection--single {
height: 26px; }
.u-table-row-hover {
background: rgb(235, 236, 240); }
.u-table-scroll {
@ -80,7 +82,7 @@
background: rgb(241, 242, 245);
color: rgb(33, 33, 33); }
.u-table.fixed-height td {
padding: 0px 8px; }
padding: 0px 16px; }
.u-table-fixed-header .u-table-body {
background: #fff;
position: relative; }
@ -98,17 +100,17 @@
overflow-y: scroll;
box-sizing: border-box; }
.u-table-title {
padding: 12px 8px;
padding: 12px 16px;
border-top: 1px solid rgb(193, 199, 208); }
.u-table-content {
position: relative; }
.u-table-footer {
padding: 12px 8px;
padding: 12px 16px;
border-bottom: 1px solid rgb(193, 199, 208); }
.u-table-footer .u-table-scroll {
overflow-x: hidden; }
.u-table-footer .u-table {
margin: -12px -8px; }
margin: -12px -16px; }
.u-table-placeholder {
padding: 12px 8px;
background: #fff;
@ -224,13 +226,18 @@
.u-table-thead th .bee-table-column-sorter {
position: relative;
margin-left: 4px;
height: 1em;
height: 16px;
vertical-align: middle;
text-align: center;
display: inline-block; }
display: inline-block;
margin-top: -3px; }
.u-table-thead th .bee-table-column-sorter i {
padding: 0px;
font-weight: 600;
color: #505F79; }
.u-table-thead th .bee-table-column-sorter > .bee-table-column-sorter-down,
.u-table-thead th .bee-table-column-sorter > .bee-table-column-sorter-up, .u-table-thead th .bee-table-column-sorter > .bee-table-column-sorter-flat {
line-height: 6px;
line-height: 16px;
display: block;
width: 34px;
cursor: pointer; }
@ -298,17 +305,18 @@
position: relative; }
.u-table-filter-column-filter-icon {
position: absolute;
top: 8px;
right: 18px;
width: 22px;
height: 25px;
line-height: 25px;
width: 30px;
height: 38px;
line-height: 38px;
right: 12px;
top: 1px;
z-index: 2;
background: rgb(241, 242, 245);
text-align: center;
cursor: pointer; }
.u-table-filter-column-filter-icon i.uf {
padding: 0px; }
padding: 0px;
color: #505F79; }
.u-table-filter-column-pop-cont-item {
margin-top: 8px;
cursor: pointer; }
@ -331,9 +339,14 @@
display: none;
pointer-events: none; }
.u-table .u-checkbox {
height: 16px;
line-height: 16px;
height: 14px;
line-height: 14px;
margin: 0px; }
.u-table .u-checkbox .u-checkbox-label {
line-height: 14px; }
.u-table .u-checkbox .u-checkbox-label:before, .u-table .u-checkbox .u-checkbox-label:after {
width: 14px;
height: 14px; }
.u-table:focus {
outline: none;
@ -523,16 +536,16 @@
.u-filter-dropdown-menu-wrap {
z-index: 1800; }
.u-filter-dropdown-menu-wrap .u-dropdown-menu li.u-dropdown-menu-item {
line-height: 28px;
height: 28px;
line-height: 26px;
height: 26px;
padding: 0px 16px 0 16px;
cursor: pointer; }
.filter-wrap .u-form-control {
height: 28px; }
height: 26px; }
.filter-wrap .u-input-number.u-input-group.simple .u-input-group-btn .icon-group {
height: 28px; }
height: 26px; }
.u-row-hover {
position: absolute;

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

1058
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

@ -4,22 +4,23 @@
$text-color: $font-color-base;
$font-size-base: 12px;
$line-height: 1.5;
$line-height: 1.33;
// 主题定制border
$table-border-color: unquote("rgb(#{$table-border-color-base})");
// $table-head-background-color: #f7f7f7;
// $table-head-text-color: #666;
$vertical-padding: 12px;
$horizontal-padding: 8px;
$horizontal-padding: 16px;
// $table-border-color: #e9e9e9;
$table-hover-color: #E7F2FC;
$table-move-in-color: $bg-color-base;
$checkbox-height:16px;
$checkbox-height:14px;
$table-th-bottom-border:#C1C7D0;
$filter-form-control-height:28px;
$filter-form-control-height:26px;
$table-head-font-weight: bold;
$icon-color:#505F79;
.u-table {
font-size: $font-size-base;
color: $text-color;
@ -115,6 +116,9 @@ $table-head-font-weight: bold;
.filterContext{
height: 35px;
}
.u-select-selection--single{
height: 26px;
}
}
}
}
@ -166,7 +170,7 @@ $table-head-font-weight: bold;
}
&.fixed-height td {
padding: 0px 8px;
padding: 0px $horizontal-padding;
}
&-fixed-header &-body {
@ -389,14 +393,20 @@ $table-head-font-weight: bold;
.bee-table-column-sorter {
position: relative;
margin-left: 4px;
height: 1em;
height: 16px;
vertical-align: middle;
text-align: center;
display: inline-block;
margin-top: -3px;
i{
padding: 0px;
font-weight: 600;
color: $icon-color;
}
& > .bee-table-column-sorter-down,
& > .bee-table-column-sorter-up, & > .bee-table-column-sorter-flat {
line-height: 6px;
line-height: 16px;
display: block;
width: 34px;
cursor: pointer;
@ -444,6 +454,7 @@ $table-head-font-weight: bold;
}
.th-drag:hover{
background: $hover-bg-color-base;
}
//为了区分是拖拽宽度还是交换列先注释上面了
// .th-drag:hover{
@ -512,17 +523,18 @@ $table-head-font-weight: bold;
}
&-filter-icon{
position: absolute;
top: 8px;
right: 18px;
width: 22px;
height: 25px;
line-height: 25px;
width: 30px;
height: 38px ;
line-height: 38px;
right: 12px ;
top:1px ;
z-index: 2;
background: $table-head-background-color;
text-align: center;
cursor: pointer;
i.uf{
padding: 0px;
color: $icon-color;
}
}
&-pop-cont-item{
@ -561,6 +573,13 @@ $table-head-font-weight: bold;
height: $checkbox-height;
line-height: $checkbox-height;
margin:0px;
.u-checkbox-label{
line-height: $checkbox-height;
&:before,&:after {
width: $checkbox-height;
height: $checkbox-height;
}
}
}
}
.u-table:focus{

View File

@ -390,7 +390,7 @@ export default function bigData(Table) {
if(!_this.props.expandedRowKeys){
if(expandState){
expandedRowKeys.push(rowKey);
this.setState({ needRender: !needRender });
}else{
let index = -1;
expandedRowKeys.forEach((r, i) => {