示例重置

This commit is contained in:
izbz wh 2019-04-03 15:23:36 +08:00
parent de2cd2877f
commit bb7fddd47b
12 changed files with 209 additions and 193 deletions

View File

@ -19,7 +19,7 @@
border-collapse: collapse; border-collapse: collapse;
text-align: left; } text-align: left; }
.u-table th { .u-table th {
font-weight: normal; font-weight: bold;
text-align: left; } text-align: left; }
.u-table th[colspan] { .u-table th[colspan] {
text-align: center; } text-align: center; }
@ -33,6 +33,8 @@
color: #1565c0; } color: #1565c0; }
.u-table td a:active { .u-table td a:active {
color: #1565c0; } color: #1565c0; }
.u-table thead tr:last-child {
border-bottom: 1px solid #C1C7D0; }
.u-table tr:hover td .uf-eye { .u-table tr:hover td .uf-eye {
visibility: visible !important; } visibility: visible !important; }
.u-table tr tr a { .u-table tr tr a {
@ -48,8 +50,8 @@
padding: 12px 8px; padding: 12px 8px;
word-break: break-all; } word-break: break-all; }
.u-table tr.filterable th { .u-table tr.filterable th {
padding-top: 4px; padding-top: 5px !important;
padding-bottom: 4px; } padding-bottom: 5px !important; }
.u-table tr.filterable th .filterContext { .u-table tr.filterable th .filterContext {
height: 35px; } height: 35px; }
.u-table-row-hover { .u-table-row-hover {
@ -60,6 +62,10 @@
border: 1px solid rgb(193, 199, 208); border: 1px solid rgb(193, 199, 208);
box-sizing: border-box; box-sizing: border-box;
table-layout: fixed; } table-layout: fixed; }
.u-table-bordered .u-table-header > table {
border-bottom: 0; }
.u-table-bordered .u-table-header ~ .u-table-body table, .u-table-bordered .u-table-header ~ .u-table-body-outer table {
border-top: 0px; }
.u-table-bordered th { .u-table-bordered th {
border-bottom: 1px solid rgb(193, 199, 208); border-bottom: 1px solid rgb(193, 199, 208);
box-sizing: border-box; } box-sizing: border-box; }
@ -84,8 +90,7 @@
.u-table-fixed-header .u-table-fixed-left .u-table-body-inner { .u-table-fixed-header .u-table-fixed-left .u-table-body-inner {
padding-right: 0px; } padding-right: 0px; }
.u-table-fixed-header .u-table-body-inner { .u-table-fixed-header .u-table-body-inner {
height: 100%; height: 100%; }
overflow: scroll; }
.u-table-fixed-header .u-table-scroll .u-table-header { .u-table-fixed-header .u-table-scroll .u-table-header {
overflow-x: scroll; overflow-x: scroll;
padding-bottom: 20px; padding-bottom: 20px;
@ -281,6 +286,7 @@
overflow-y: scroll; overflow-y: scroll;
color: #212121; } color: #212121; }
.u-table-filter-column-clear-setting { .u-table-filter-column-clear-setting {
cursor: pointer;
margin-bottom: 4px; } margin-bottom: 4px; }
.u-table-filter-column-cont { .u-table-filter-column-cont {
position: relative; } position: relative; }
@ -304,7 +310,9 @@
margin: 0px; } margin: 0px; }
.u-table-filter-column-pop-cont-item > span { .u-table-filter-column-pop-cont-item > span {
margin-left: -3px; margin-left: -3px;
width: 132px; max-width: 132px;
width: auto !important;
min-width: 56px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
@ -509,11 +517,17 @@
.u-filter-dropdown-menu-wrap { .u-filter-dropdown-menu-wrap {
z-index: 1800; } z-index: 1800; }
.u-filter-dropdown-menu-wrap .u-dropdown-menu li.u-dropdown-menu-item { .u-filter-dropdown-menu-wrap .u-dropdown-menu li.u-dropdown-menu-item {
line-height: 32px; line-height: 28px;
height: 32px; height: 28px;
padding: 0px 16px 0 16px; padding: 0px 16px 0 16px;
cursor: pointer; } cursor: pointer; }
.filter-wrap .u-form-control {
height: 28px; }
.filter-wrap .u-input-number.u-input-group.simple .u-input-group-btn .icon-group {
height: 28px; }
.u-row-hover { .u-row-hover {
position: absolute; position: absolute;
right: 24px; right: 24px;

View File

@ -933,7 +933,7 @@ var Table = function (_Component) {
if (this.domWidthDiff <= 0) { if (this.domWidthDiff <= 0) {
headStyle.marginBottom = scrollbarWidth + 'px'; headStyle.marginBottom = scrollbarWidth + 'px';
bodyStyle.marginBottom = '-' + scrollbarWidth + 'px'; // bodyStyle.marginBottom = `-${scrollbarWidth}px`;
} else { } else {
innerBodyStyle.overflowX = 'auto'; innerBodyStyle.overflowX = 'auto';
} }
@ -950,8 +950,8 @@ var Table = function (_Component) {
headStyle.overflow = 'hidden'; headStyle.overflow = 'hidden';
innerBodyStyle.overflowX = 'auto'; //兼容expand场景、子表格含有固定列的场景 innerBodyStyle.overflowX = 'auto'; //兼容expand场景、子表格含有固定列的场景
} else { } else {
bodyStyle.marginBottom = '-' + scrollbarWidth + 'px'; // bodyStyle.marginBottom = `-${scrollbarWidth}px`;
} }
} else { } else {
headStyle.marginBottom = '-' + scrollbarWidth + 'px'; headStyle.marginBottom = '-' + scrollbarWidth + 'px';
} }
@ -1047,7 +1047,8 @@ var Table = function (_Component) {
onTouchStart: this.detectScrollTarget, onTouchStart: this.detectScrollTarget,
onScroll: this.handleBodyScroll onScroll: this.handleBodyScroll
}, },
renderTable(!useFixedHeader) renderTable(!useFixedHeader),
_react2["default"].createElement('div', { className: 'scroll-dom', style: { height: this.scrollbarWidth + 'px' } })
) )
); );
} }

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
Object.defineProperty(exports, "__esModule", { 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; }; 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) { function dragColumn(Table) {
return function (_Component) { return function (_Component) {
_inherits(DragColumn, _Component); _inherits(DragColumn, _Component);
function DragColumn(props) { function DragColumn(props) {
_classCallCheck(this, DragColumn); _classCallCheck(this, DragColumn);
var _this = _possibleConstructorReturn(this, _Component.call(this, props)); var _this = _possibleConstructorReturn(this, _Component.call(this, props));
_this.setColumOrderByIndex = function (_column) { _this.setColumOrderByIndex = function (_column) {
_column.forEach(function (da, i) { _column.forEach(function (da, i) {
da.dragIndex = i; da.dragIndex = i;
da.drgHover = false; 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;
}); });
return _column;
};
DragColumn.prototype.render = function render() { _this.onDrop = function (event, data) {
var _props = this.props, var dragSource = data.dragSource,
data = _props.data, dragTarg = data.dragTarg;
dragborder = _props.dragborder, var columns = _this.state.columns;
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(); var sourceIndex = -1,
return _react2["default"].createElement(Table, _extends({}, others, { targetIndex = -1;
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; sourceIndex = columns.findIndex(function (da, i) {
}(_react.Component); 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']; module.exports = exports['default'];

View File

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

View File

@ -53,7 +53,7 @@ const data5 = [
class Demo5 extends Component { class Demo5 extends Component {
render() { render() {
return <Table columns={columns5} data={data5} scroll={{ x: "110%", y: 140 }} />; return <Table columns={columns5} data={data5} scroll={{ x: "110%", y: 340 }} bodyStyle={{height:'340px'}} />;
} }
} }

File diff suppressed because one or more lines are too long

3
dist/demo.css vendored
View File

@ -90,8 +90,7 @@
.u-table-fixed-header .u-table-fixed-left .u-table-body-inner { .u-table-fixed-header .u-table-fixed-left .u-table-body-inner {
padding-right: 0px; } padding-right: 0px; }
.u-table-fixed-header .u-table-body-inner { .u-table-fixed-header .u-table-body-inner {
height: 100%; height: 100%; }
overflow: scroll; }
.u-table-fixed-header .u-table-scroll .u-table-header { .u-table-fixed-header .u-table-scroll .u-table-header {
overflow-x: scroll; overflow-x: scroll;
padding-bottom: 20px; padding-bottom: 20px;

2
dist/demo.css.map vendored

File diff suppressed because one or more lines are too long

13
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

@ -796,7 +796,7 @@ class Table extends Component {
if(this.domWidthDiff <= 0){ if(this.domWidthDiff <= 0){
headStyle.marginBottom = `${scrollbarWidth}px`; headStyle.marginBottom = `${scrollbarWidth}px`;
bodyStyle.marginBottom = `-${scrollbarWidth}px`; // bodyStyle.marginBottom = `-${scrollbarWidth}px`;
}else{ }else{
innerBodyStyle.overflowX = 'auto'; innerBodyStyle.overflowX = 'auto';
} }
@ -813,7 +813,7 @@ class Table extends Component {
headStyle.overflow = 'hidden'; headStyle.overflow = 'hidden';
innerBodyStyle.overflowX = 'auto'; //兼容expand场景、子表格含有固定列的场景 innerBodyStyle.overflowX = 'auto'; //兼容expand场景、子表格含有固定列的场景
}else{ }else{
bodyStyle.marginBottom = `-${scrollbarWidth}px`; // bodyStyle.marginBottom = `-${scrollbarWidth}px`;
} }
}else{ }else{
@ -908,6 +908,7 @@ class Table extends Component {
onScroll={this.handleBodyScroll} onScroll={this.handleBodyScroll}
> >
{renderTable(!useFixedHeader)} {renderTable(!useFixedHeader)}
<div className="scroll-dom" style={{height:`${this.scrollbarWidth}px`}}></div>
</div> </div>
</div> </div>
); );

View File

@ -184,7 +184,7 @@ $table-head-font-weight: bold;
&-fixed-header &-body-inner { &-fixed-header &-body-inner {
height: 100%; height: 100%;
overflow: scroll; // overflow: scroll;
} }