From 87ed08a7245161fc9675981be01a6effe661b803 Mon Sep 17 00:00:00 2001 From: gx Date: Fri, 9 Apr 2021 17:17:42 +0800 Subject: [PATCH] fix: remove loading --- build/Table.css | 4 +- build/TableRow.js | 11 +-- build/lib/dragColumn.js | 208 ++++++++++++++++++++-------------------- build/lib/util.js | 80 ++++++++-------- package.json | 2 +- src/TableRow.js | 9 +- 6 files changed, 152 insertions(+), 162 deletions(-) diff --git a/build/Table.css b/build/Table.css index 8edd6d6..4afde28 100644 --- a/build/Table.css +++ b/build/Table.css @@ -460,8 +460,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/TableRow.js b/build/TableRow.js index 267d59e..0d09463 100644 --- a/build/TableRow.js +++ b/build/TableRow.js @@ -709,15 +709,8 @@ var TableRow = function (_Component) { // key={hoverKey} , ref: this.bindElement }, - cells.length > 0 ? cells : isEmptyTr ? _react2["default"].createElement( - 'td', - { className: 'loading-td ' + (isPre ? 'pre-td' : 'suf-td'), style: { width: tdStyle.width || 1200, height: tdStyle.height || 100 } }, - _react2["default"].createElement( - 'div', - { style: { left: (containerWidth || 1200) / 2 - 23 }, className: 'loading-div ' + (isPre ? 'pre' : 'suf') }, - '\u52A0\u8F7D\u4E2D...' - ) - ) : _react2["default"].createElement('td', { style: { width: 0, padding: 0 } }) + cells.length > 0 ? cells : isEmptyTr ? // loading暂时去掉 + _react2["default"].createElement('td', { style: { width: 0, padding: 0 } }) : _react2["default"].createElement('td', { style: { width: 0, padding: 0 } }) ); }; diff --git a/build/lib/dragColumn.js b/build/lib/dragColumn.js index 03bc53e..ea9fc27 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 _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; @@ -35,115 +35,115 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" 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.onDragEnd = 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; - }); - // 向前移动 - if (targetIndex < sourceIndex) { - targetIndex = targetIndex + 1; - } - columns.splice(targetIndex, 0, columns.splice(sourceIndex, 1)[0]); - var _newColumns = []; - columns.forEach(function (da, i) { - var newDate = _extends(da, {}); - newDate.title = da.title; - _newColumns.push(newDate); - }); - _this.setState({ - columns: _newColumns //cloneDeep(columns) - }); - if (_this.props.onDragEnd) { - _this.props.onDragEnd(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.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, - others = _objectWithoutProperties(_props, ['data', 'dragborder', 'draggable', 'className']); + _this.onDragEnd = function (event, data) { + var dragSource = data.dragSource, + dragTarg = data.dragTarg; + var columns = _this.state.columns; - return _react2["default"].createElement(Table, _extends({}, others, { - columns: this.state.columns, - data: data, - className: className + ' u-table-drag-border', - onDragEnd: this.onDragEnd, - draggable: draggable, - dragborder: dragborder - })); - }; + 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; + }); + // 向前移动 + if (targetIndex < sourceIndex) { + targetIndex = targetIndex + 1; + } + columns.splice(targetIndex, 0, columns.splice(sourceIndex, 1)[0]); + var _newColumns = []; + columns.forEach(function (da, i) { + var newDate = _extends(da, {}); + newDate.title = da.title; + _newColumns.push(newDate); + }); + _this.setState({ + columns: _newColumns //cloneDeep(columns) + }); + if (_this.props.onDragEnd) { + _this.props.onDragEnd(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.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, + others = _objectWithoutProperties(_props, ['data', 'dragborder', 'draggable', 'className']); + + return _react2["default"].createElement(Table, _extends({}, others, { + columns: this.state.columns, + data: data, + className: className + ' u-table-drag-border', + onDragEnd: this.onDragEnd, + draggable: draggable, + dragborder: dragborder + })); + }; + + 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 237dba1..9ea2e19 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; + 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; } \ No newline at end of file diff --git a/package.json b/package.json index 8b1d553..6bcb255 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bee-table", - "version": "2.3.15-beta.19", + "version": "2.3.15-beta.20", "description": "Table ui component for react", "keywords": [ "react", diff --git a/src/TableRow.js b/src/TableRow.js index 75a969c..2483e16 100644 --- a/src/TableRow.js +++ b/src/TableRow.js @@ -580,12 +580,9 @@ class TableRow extends Component{ // key={hoverKey} ref={this.bindElement} > - {cells.length > 0 ? cells : isEmptyTr ? - -
- 加载中... -
- : + {cells.length > 0 ? cells : isEmptyTr ? // loading暂时去掉 + + : } );