Skip to content

Commit

Permalink
feat(表格拖拽交换列、表头过滤、issues的示例): 表格拖拽交换列、表头过滤、issues的示例
Browse files Browse the repository at this point in the history
表格拖拽交换列、表头过滤、issues的示例

BREAKING CHANGE: 表格拖拽交换列、表头过滤、issues的示例
  • Loading branch information
jonyshi committed May 11, 2018
1 parent 96250f8 commit 903d1a8
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 297 deletions.
3 changes: 0 additions & 3 deletions build/ResizableTh.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ var ResizableTh = function (_Component) {

_this.onMouseDown = function (event, data) {
_this.mouse = true;
console.log(event.screenX);
_this.dragBorderObj.startScreenX = event.screenX;
};

Expand All @@ -63,7 +62,6 @@ var ResizableTh = function (_Component) {
});
if (!currObj) return;
currObj.width = currObj.width ? currObj.width + endx : endx;
console.log("currObj.width--", currObj.width);
_this.setState({
columns: columns
});
Expand All @@ -75,7 +73,6 @@ var ResizableTh = function (_Component) {

_this.onMouseUp = function (event, data) {
var endx = event.screenX - _this.dragBorderObj.startScreenX;
console.log("onmouseup-", endx);
_this.mouse = false;
};

Expand Down
3 changes: 1 addition & 2 deletions build/Table.css
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@
position: absolute;
top: 0px;
left: 0px;
height: 10px;
border: 1px solid; }
height: 10px; }
.u-table table {
width: 100%;
border-collapse: collapse;
Expand Down
4 changes: 3 additions & 1 deletion build/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ var Table = function (_Component) {
_this.renderDragHideTable = function () {
var columns = _this.props.columns;

debugger;
var sum = 0;
return _react2["default"].createElement(
'div',
Expand Down Expand Up @@ -348,6 +347,9 @@ var Table = function (_Component) {
drgHover: column.drgHover,
width: column.width
};
if (column.onHeadCellClick) {
cell.onClick = column.onHeadCellClick;
}
if (column.children) {
_this2.getHeaderRows(column.children, currentRow + 1, rows);
}
Expand Down
26 changes: 18 additions & 8 deletions build/TableHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ var TableHeader = function (_Component) {
if (_this.border) return;
var clsPrefix = _this.props.clsPrefix;

console.log("00-----");
if (_this.border) {
var x = event.pageX - _this.drag.initPageLeftX + _this.drag.initLeft;
console.log("00-----", x);
} else {
event.target.className = clsPrefix + '-thead-th-drag-gap th-drag-gap-hover';
}
Expand Down Expand Up @@ -153,8 +151,9 @@ var TableHeader = function (_Component) {
{ key: index, style: rowStyle },
row.map(function (da, i) {
var thHover = da.drgHover ? ' ' + clsPrefix + '-thead th-drag-hover' : "";
delete da.drgHover;
if (draggable) {
return _react2["default"].createElement('th', {
return _react2["default"].createElement('th', _extends({}, da, {
onDragStart: function onDragStart(event) {
_this2.onDragStart(event, da);
},
Expand All @@ -169,14 +168,22 @@ var TableHeader = function (_Component) {
},
draggable: draggable,
className: da.className + ' ' + clsPrefix + '-thead th-drag ' + thHover,
key: i });
key: da.key }));
} else if (dragborder) {
console.log(da);
return _react2["default"].createElement(
'th',
_extends({}, da, {
{
// onDragStart={(event)=>{this.onDragGapStart(event,da)}}
// onDragOver={(event)=>{this.onDragGapOver(event,da)}}
// onDrop={(event)=>{this.onDropGap(event,da)}}
// onDragEnter={(event)=>{this.onDragGapEnter(event,da)}}

// onMouseDown={(event)=>{onMouseDown(event,da)}}

// onMouseUp={(event)=>{onMouseUp(event,da)}}
// {...da}
className: da.className + ' ' + clsPrefix + '-thead-th ',
key: i }),
key: i },
da.children,
_react2["default"].createElement('div', { ref: function ref(el) {
return _this2.gap = el;
Expand All @@ -196,7 +203,10 @@ var TableHeader = function (_Component) {
className: clsPrefix + '-thead-th-drag-gap ' })
);
} else {
return _react2["default"].createElement('th', _extends({}, da, { key: i }));
var th = da.onClick ? _react2["default"].createElement('th', _extends({}, da, { key: i, onClick: function onClick(event) {
da.onClick(da, event);
} })) : _react2["default"].createElement('th', _extends({}, da, { key: i }));
return th;
}
})
);
Expand Down
3 changes: 0 additions & 3 deletions build/lib/dragColumn.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ function dragColumn(Table) {

this.onMouseDown = function (event, data) {
_this2.mouse = true;
console.log(event.screenX);
_this2.dragBorderObj.startScreenX = event.screenX;
};

Expand All @@ -197,7 +196,6 @@ function dragColumn(Table) {
});
if (!currObj) return;
currObj.width = currObj.width ? currObj.width + endx : endx;
console.log("currObj.width--", currObj.width);
_this2.setState({
columns: columns
});
Expand All @@ -209,7 +207,6 @@ function dragColumn(Table) {

this.onMouseUp = function (event, data) {
var endx = event.screenX - _this2.dragBorderObj.startScreenX;
console.log("onmouseup-", endx);
_this2.mouse = false;
};
}, _temp;
Expand Down
3 changes: 0 additions & 3 deletions build/lib/dragColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ function dragColumn(Table) {

this.onMouseDown = function (event, data) {
_this2.mouse = true;
console.log(event.screenX);
_this2.dragBorderObj.startScreenX = event.screenX;
};

Expand All @@ -194,7 +193,6 @@ function dragColumn(Table) {
});
if (!currObj) return;
currObj.width = currObj.width ? currObj.width + endx : endx;
console.log("currObj.width--", currObj.width);
_this2.setState({
columns: columns
});
Expand All @@ -206,7 +204,6 @@ function dragColumn(Table) {

this.onMouseUp = function (event, data) {
var endx = event.screenX - _this2.dragBorderObj.startScreenX;
console.log("onmouseup-", endx);
_this2.mouse = false;
};
}, _temp;
Expand Down
5 changes: 1 addition & 4 deletions build/render/InputRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ var InputRender = function (_Component) {
var value = e;
_this.setState({ value: value });
}, _this.check = function () {
console.log('1');
if (typeof _this.flag === "undefined" || _this.flag) {
_this.props.check(_this.flag, _this.obj);
_this.setState({ editable: false });
Expand All @@ -88,9 +87,7 @@ var InputRender = function (_Component) {
}, _this.handleKeydown = function (event) {
if (event.keyCode == 13) {
_this.check();
} else if (event.keyCode == 9) {
debugger;
}
} else if (event.keyCode == 9) {}
}, _this.formatCurrency = function (money) {
if (money && money != null && !!Number(money)) {
money = String(money);
Expand Down
67 changes: 0 additions & 67 deletions demo/demolist/Demo23.js

This file was deleted.

2 changes: 1 addition & 1 deletion demo/index.js

Large diffs are not rendered by default.

131 changes: 15 additions & 116 deletions dist/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/demo.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 903d1a8

Please sign in to comment.