diff --git a/build/Table.css b/build/Table.css
index c35964f..c576000 100644
--- a/build/Table.css
+++ b/build/Table.css
@@ -362,8 +362,8 @@
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
- /*
- Introduced in IE 10.
+ /*
+ Introduced in IE 10.
*/
-ms-user-select: none;
user-select: none; }
diff --git a/build/lib/dragColumn.js b/build/lib/dragColumn.js
index c4d1c4d..74ae9b6 100644
--- a/build/lib/dragColumn.js
+++ b/build/lib/dragColumn.js
@@ -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.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;
+ _this.onDrop = function (event, data) {
+ var dragSource = data.dragSource,
+ dragTarg = data.dragTarg;
+ var columns = _this.state.columns;
- var sourceIndex = -1,
- targetIndex = -1;
+ 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;
+ 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;
}
- columns.splice(targetIndex, 0, columns.splice(sourceIndex, 1)[0]);
- _this.setState({
- columns: cloneDeep(columns)
+
+ 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;
});
- if (_this.props.onDrop) {
- _this.props.onDrop(event, data, columns);
- }
- };
- _this.getTarget = function (evt) {
- return evt.target || evt.srcElement;
- };
+ 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.state = {
- columns: _this.setColumOrderByIndex(props.columns)
- };
- return _this;
- }
+ 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
+ }));
+ };
- 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);
+ return DragColumn;
+ }(_react.Component);
}
module.exports = exports['default'];
\ No newline at end of file
diff --git a/build/lib/util.js b/build/lib/util.js
index 9ea2e19..237dba1 100644
--- a/build/lib/util.js
+++ b/build/lib/util.js
@@ -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;
- }
- } else if (typeof prop == 'function') {
- for (; i < len; i++) {
- var _oI = arr[i];
- (props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
- }
- } else {
- throw '参数类型错误';
+ 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;
}
- props.sort();
- for (i = 0; i < len; i++) {
- ret[i] = props[i]._obj;
+ } else if (typeof prop == 'function') {
+ for (; i < len; i++) {
+ var _oI = arr[i];
+ (props[i] = new String(_oI && prop(_oI) || ''))._obj = _oI;
}
- if (desc) ret.reverse();
- return ret;
+ } else {
+ throw '参数类型错误';
+ }
+ 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
*/
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;
}
\ No newline at end of file
diff --git a/demo/TableDemo.scss b/demo/TableDemo.scss
index c47b9c6..2bb6304 100644
--- a/demo/TableDemo.scss
+++ b/demo/TableDemo.scss
@@ -1,25 +1,25 @@
-@import "../node_modules/tinper-bee-core/scss/index.scss";
-@import "../node_modules/bee-panel/src/Panel.scss";
-@import "../node_modules/bee-layout/src/Layout.scss";
-@import "../node_modules/bee-button/src/Button.scss";
-@import "../node_modules/bee-transition/src/Transition.scss";
-@import "../node_modules/bee-popconfirm/src/Popconfirm.scss";
-@import "../node_modules/bee-form-control/src/FormControl.scss";
-@import "../node_modules/bee-pagination/src/Pagination.scss";
-@import "../node_modules/bee-checkbox/src/Checkbox.scss";
-@import "../node_modules/bee-select/src/Select.scss";
-@import "../node_modules/bee-form/src/Form.scss";
-@import "../node_modules/bee-popover/src/Popover.scss";
-@import "../node_modules/bee-tooltip/src/Tooltip.scss";
-@import "../node_modules/bee-message/build/Message.css";
-@import "../node_modules/bee-dropdown/build/Dropdown.css";
-@import "../node_modules/bee-input-number/build/InputNumber.css";
-@import "../node_modules/bee-modal/build/Modal.css";
+// @import "../node_modules/tinper-bee-core/scss/index.scss";
+// @import "../node_modules/bee-panel/src/Panel.scss";
+// @import "../node_modules/bee-layout/src/Layout.scss";
+// @import "../node_modules/bee-button/src/Button.scss";
+// @import "../node_modules/bee-transition/src/Transition.scss";
+// @import "../node_modules/bee-popconfirm/src/Popconfirm.scss";
+// @import "../node_modules/bee-form-control/src/FormControl.scss";
+// @import "../node_modules/bee-pagination/src/Pagination.scss";
+// @import "../node_modules/bee-checkbox/src/Checkbox.scss";
+// @import "../node_modules/bee-select/src/Select.scss";
+// @import "../node_modules/bee-form/src/Form.scss";
+// @import "../node_modules/bee-popover/src/Popover.scss";
+// @import "../node_modules/bee-tooltip/src/Tooltip.scss";
+// @import "../node_modules/bee-message/build/Message.css";
+// @import "../node_modules/bee-dropdown/build/Dropdown.css";
+// @import "../node_modules/bee-input-number/build/InputNumber.css";
+// @import "../node_modules/bee-modal/build/Modal.css";
@import "../src/Table.scss";
//引入日期控件样式文件
-@import "../node_modules/bee-datepicker/src/datepicker.scss";
+// @import "../node_modules/bee-datepicker/src/datepicker.scss";
.selected{
background: rgb(227,242,253);
diff --git a/demo/demolist/Demo2.js b/demo/demolist/Demo2.js
index b3a005f..b570542 100644
--- a/demo/demolist/Demo2.js
+++ b/demo/demolist/Demo2.js
@@ -183,6 +183,7 @@ class Demo2 extends React.Component {
return (