diff --git a/bee-table.rar b/bee-table.rar
deleted file mode 100644
index 2f4a556..0000000
Binary files a/bee-table.rar and /dev/null differ
diff --git a/build/Table.css b/build/Table.css
index 76a4ebf..5a1b347 100644
--- a/build/Table.css
+++ b/build/Table.css
@@ -310,7 +310,7 @@
.u-table-filter-column-pop-cont {
margin: 0px;
max-height: 300px;
- overflow-y: scroll;
+ overflow-y: auto;
color: #212121; }
.u-table-filter-column-clear-setting {
cursor: pointer;
@@ -384,6 +384,11 @@
display: none; }
.u-table ::-webkit-scrollbar-track-piece {
display: none; }
+ .u-table .row-dragg-able {
+ cursor: move; }
+ .u-table .u-table-drag-hidden-cont {
+ width: 100px;
+ height: 40px; }
.u-table:focus {
outline: none;
@@ -617,3 +622,21 @@
.u-table-drag-hidden-cont {
position: absolute;
top: -1000px; }
+
+.u-editable-table .u-table .u-table-row-hover .editable-cell-text-wrapper {
+ padding-left: 4px;
+ border: 1px solid #c1c7d0; }
+
+.u-editable-table .u-table .editable-cell-text-wrapper:hover {
+ padding-left: 4px;
+ border: 1px solid #a5adba; }
+
+.u-editable-table .u-table .editable-cell-input-wrapper:focus {
+ outline: none; }
+
+.u-editable-table-tp .tooltip-arrow {
+ top: 1px !important;
+ border-bottom-color: #F44336 !important; }
+
+.u-editable-table-tp .tooltip-inner {
+ border-color: #F44336 !important; }
diff --git a/build/Table.js b/build/Table.js
index a6e0a95..417f629 100644
--- a/build/Table.js
+++ b/build/Table.js
@@ -173,14 +173,33 @@ var Table = function (_Component) {
});
};
- _this.onDragRow = function (currentIndex, targetIndex) {
- var data = _this.state.data,
- currentObj = data[currentIndex],
- targetObj = data[targetIndex];
+ _this.getTableUID = function () {
+ var uid = "_table_uid_" + new Date().getTime();
+ _this.tableUid = uid;
+ var div = document.createElement("div");
+ // div.className = "u-table-drag-hidden-cont";
+ div.className = "u-table-drag-hidden-cont";
+ div.id = uid;
+ _this.contentTable.appendChild(div);
+ };
- console.log(currentIndex + " ----------onRowDragEnd-------- " + targetIndex);
- data.splice(targetIndex, 0, data.splice(currentIndex, 1).shift());
- console.log(" _data---- ", data);
+ _this.onDragRow = function (currentKey, targetKey) {
+ var data = _this.state.data,
+ currentIndex = void 0,
+ targetIndex = void 0;
+ data.forEach(function (da, i) {
+ if (da.key == currentKey) {
+ currentIndex = i;
+ }
+ if (da.key == targetKey) {
+ targetIndex = i;
+ }
+ });
+ if (currentIndex < targetIndex) {
+ data.splice(targetIndex, 0, data.splice(currentIndex, 1).shift());
+ } else {
+ data.splice(targetIndex + 1, 0, data.splice(currentIndex, 1).shift());
+ }
_this.setState({
data: data
});
@@ -283,10 +302,12 @@ var Table = function (_Component) {
_this.handleRowHover = _this.handleRowHover.bind(_this);
_this.computeTableWidth = _this.computeTableWidth.bind(_this);
_this.onBodyMouseLeave = _this.onBodyMouseLeave.bind(_this);
+ _this.tableUid = null;
return _this;
}
Table.prototype.componentDidMount = function componentDidMount() {
+ this.getTableUID();
_utils.EventUtil.addHandler(this.contentTable, 'keydown', this.onKeyDown);
_utils.EventUtil.addHandler(this.contentTable, 'focus', this.onFocus);
setTimeout(this.resetScrollX, 300);
@@ -786,7 +807,7 @@ var Table = function (_Component) {
indent: indent,
indentSize: props.indentSize,
needIndentSpaced: needIndentSpaced,
- className: className,
+ className: className + ' ' + (this.props.rowDraggAble ? ' row-dragg-able ' : ''),
record: record,
expandIconAsCell: expandIconAsCell,
onDestroy: this.onRowDestroy,
@@ -820,7 +841,8 @@ var Table = function (_Component) {
bodyDisplayInRow: props.bodyDisplayInRow,
rowDraggAble: this.props.rowDraggAble,
onDragRow: this.onDragRow,
- contentTable: this.contentTable
+ contentTable: this.contentTable,
+ tableUid: this.tableUid
})));
this.treeRowIndex++;
var subVisible = visible && isRowExpanded;
diff --git a/build/TableRow.js b/build/TableRow.js
index cb79a73..ccca082 100644
--- a/build/TableRow.js
+++ b/build/TableRow.js
@@ -102,6 +102,11 @@ var TableRow = function (_Component) {
target = _utils.Event.getTarget(event);
_this.currentIndex = target.getAttribute("data-row-key");
_this._dragCurrent = target;
+
+ //TODO 自定义图像后续需要增加。
+ // let crt = this.synchronizeTableTrShadow();
+ // document.getElementById(this.props.tableUid).appendChild(crt);
+ // event.dataTransfer.setDragImage(crt, 0, 0);
event.dataTransfer.effectAllowed = "move";
event.dataTransfer.setData("Text", _this.currentIndex);
};
@@ -119,15 +124,37 @@ var TableRow = function (_Component) {
var event = _utils.Event.getEvent(e),
_target = _utils.Event.getTarget(event),
target = _target.parentNode;
- var currentIndex = target.getAttribute("data-row-key");
- if (!currentIndex || currentIndex === _this.currentIndex) return;
+
+ var currentKey = event.dataTransfer.getData("text");
+ var targetKey = target.getAttribute("data-row-key");
+
+ if (!targetKey || targetKey === currentKey) return;
if (target.nodeName.toUpperCase() === "TR") {
- _this.synchronizeTableTr(_this.currentIndex, null);
+ _this.synchronizeTableTr(currentKey, null);
+ _this.synchronizeTableTr(targetKey, null);
// target.setAttribute("style","");
// this.synchronizeTrStyle(this.currentIndex,false);
}
- var _currentIndex = event.dataTransfer.getData("text");
- onDragRow && onDragRow(parseInt(_this.currentIndex--), parseInt(currentIndex--));
+ onDragRow && onDragRow(currentKey, targetKey);
+ };
+
+ _this.synchronizeTableTrShadow = function () {
+ var _this$props2 = _this.props,
+ contentTable = _this$props2.contentTable,
+ index = _this$props2.index;
+
+
+ var _table_cont = contentTable.querySelector('.u-table-scroll table tbody').getElementsByTagName("tr")[index],
+ _table_trs = _table_cont.getBoundingClientRect(),
+ _table_fixed_left_trs = contentTable.querySelector('.u-table-fixed-left table tbody').getElementsByTagName("tr")[index].getBoundingClientRect(),
+ _table_fixed_right_trs = contentTable.querySelector('.u-table-fixed-right table tbody').getElementsByTagName("tr")[index].getBoundingClientRect();
+
+ var div = document.createElement("div");
+ var style = "wdith:" + (_table_trs.width + _table_fixed_left_trs.width + _table_fixed_right_trs.width) + "px";
+ style += "height:" + _table_trs.height + "px";
+ style += "classname:" + _table_cont.className;
+ div.setAttribute("style", style);
+ return div;
};
_this.synchronizeTableTr = function (currentIndex, type) {
@@ -274,6 +301,12 @@ var TableRow = function (_Component) {
*/
+ /**
+ *同步当前拖拽到阴影
+ * @memberof TableRow
+ */
+
+
/**
* 同步自己,也需要同步当前行的行显示
*/
diff --git a/build/lib/sum.js b/build/lib/sum.js
index d4c452f..5987695 100644
--- a/build/lib/sum.js
+++ b/build/lib/sum.js
@@ -106,9 +106,9 @@ function sum(Table) {
return _this;
}
- /**
- * 获取当前的表格类型。
- *
+ /**
+ * 获取当前的表格类型。
+ *
*/
diff --git a/build/lib/util.js b/build/lib/util.js
index 8d6a331..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; };
@@ -9,71 +9,71 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
exports.sortBy = sortBy;
exports.compare = compare;
exports.ObjectAssign = ObjectAssign;
-/*
-* 快速排序,按某个属性,或按“获取排序依据的函数”,来排序.
-* @method soryBy
-* @static
-* @param {array} arr 待处理数组
-* @param {string|function} prop 排序依据属性,获取
-* @param {boolean} desc 降序
-* @return {array} 返回排序后的新数组
+/*
+* 快速排序,按某个属性,或按“获取排序依据的函数”,来排序.
+* @method soryBy
+* @static
+* @param {array} arr 待处理数组
+* @param {string|function} prop 排序依据属性,获取
+* @param {boolean} desc 降序
+* @return {array} 返回排序后的新数组
*/
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;
};
-/**
- * 数组对象排序
- * console.log(arr.sort(compare('age')))
- * @param {} property
+/**
+ * 数组对象排序
+ * console.log(arr.sort(compare('age')))
+ * @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;
+ };
}
-/**
- * 简单数组数据对象拷贝
- * @param {*} obj 要拷贝的对象
+/**
+ * 简单数组数据对象拷贝
+ * @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/build/render/CheckboxRender.js b/build/render/CheckboxRender.js
index 1e4ba25..8473356 100644
--- a/build/render/CheckboxRender.js
+++ b/build/render/CheckboxRender.js
@@ -19,11 +19,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
-/**
- * 渲染checkbox
- * @param Checkbox
- * @param Icon
- * @returns {CheckboxRender}
+/**
+ * 渲染checkbox
+ * @param Checkbox
+ * @param Icon
+ * @returns {CheckboxRender}
*/
function renderCheckbox(Checkbox, Icon) {
return function (_Component) {
diff --git a/build/render/InputRender.js b/build/render/InputRender.js
index 68f898d..04c7002 100644
--- a/build/render/InputRender.js
+++ b/build/render/InputRender.js
@@ -28,12 +28,12 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
-/**
- * 渲染输入框
- * @param Form
- * @param Input
- * @param Icon
- * @returns {InputRender}
+/**
+ * 渲染输入框
+ * @param Form
+ * @param Input
+ * @param Icon
+ * @returns {InputRender}
*/
function renderInput(Form, Input, Icon) {
var _class, _temp2;
diff --git a/build/render/SelectRender.js b/build/render/SelectRender.js
index d72159b..a1d55db 100644
--- a/build/render/SelectRender.js
+++ b/build/render/SelectRender.js
@@ -26,11 +26,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
-/**
- * 渲染下拉框
- * @param Select
- * @param Icon
- * @returns {SelectRender}
+/**
+ * 渲染下拉框
+ * @param Select
+ * @param Icon
+ * @returns {SelectRender}
*/
function renderSelect(Select, Icon) {
var _class, _temp2;
diff --git a/demo/demolist/Demo1201.js b/demo/demolist/Demo1201.js
index 295b864..d97d3b8 100644
--- a/demo/demolist/Demo1201.js
+++ b/demo/demolist/Demo1201.js
@@ -2,7 +2,7 @@
*
* @title 拖拽改变行顺序
* @parent 行操作-拖拽
-* @description 拖拽改变行顺序
+* @description `rowDraggAble`参数设置是否使用行交换顺序功能
* Demo1201
*/
@@ -38,7 +38,13 @@ const columns = [
const data = [
{ a: "ASVAL_201903280005", b: "小张", c: "男", d: "财务二科", e: "M1", key: "1001" },
{ a: "ASVAL_201903200004", b: "小明", c: "男", d: "财务一科", e: "T1", key: "1002" },
- { a: "ASVAL_201903120002", b: "小红", c: "女", d: "财务一科", e: "T2", key: "1003" }
+ { a: "ASVAL_201903120001", b: "小红", c: "女", d: "财务四科", e: "T3", key: "1003" },
+ { a: "ASVAL_201903120002", b: "小姚", c: "女", d: "财务一科", e: "T2", key: "1004" },
+ { a: "ASVAL_201903120003", b: "小岳", c: "男", d: "财务五科", e: "T2", key: "1005" },
+ { a: "ASVAL_201903120004", b: "小王", c: "男", d: "财务一科", e: "T5", key: "1006" },
+ { a: "ASVAL_201903120005", b: "小绍", c: "男", d: "财务七科", e: "T2", key: "1007" },
+ { a: "ASVAL_201903120006", b: "小郭", c: "男", d: "财务一科", e: "T3", key: "1008" },
+ { a: "ASVAL_201903120007", b: "小杨", c: "女", d: "财务四科", e: "T2", key: "1009" }
];
class Demo1201 extends Component {
diff --git a/demo/demolist/Demo1304.js b/demo/demolist/Demo1304.js
index 860a5f9..88ce06f 100644
--- a/demo/demolist/Demo1304.js
+++ b/demo/demolist/Demo1304.js
@@ -24,7 +24,7 @@ class Demo1304 extends Component {
this.state = {
data: data,
selectedRowIndex: 0,
- selectedValue:"ASVAL_201903200004"
+ selectedValue:"ASVAL_201903280005"
}
}
diff --git a/demo/index.js b/demo/index.js
index 6d9e41f..71504eb 100644
--- a/demo/index.js
+++ b/demo/index.js
@@ -8,7 +8,7 @@ import Button from '../src';
-var Demo0101 = require("./demolist/Demo0101");var Demo0102 = require("./demolist/Demo0102");var Demo0103 = require("./demolist/Demo0103");var Demo0104 = require("./demolist/Demo0104");var Demo0105 = require("./demolist/Demo0105");var Demo0106 = require("./demolist/Demo0106");var Demo0107 = require("./demolist/Demo0107");var Demo0201 = require("./demolist/Demo0201");var Demo0202 = require("./demolist/Demo0202");var Demo0301 = require("./demolist/Demo0301");var Demo0302 = require("./demolist/Demo0302");var Demo0402 = require("./demolist/Demo0402");var Demo0404 = require("./demolist/Demo0404");var Demo0405 = require("./demolist/Demo0405");var Demo0501 = require("./demolist/Demo0501");var Demo0502 = require("./demolist/Demo0502");var Demo0503 = require("./demolist/Demo0503");var Demo0505 = require("./demolist/Demo0505");var Demo0601 = require("./demolist/Demo0601");var Demo0602 = require("./demolist/Demo0602");var Demo0603 = require("./demolist/Demo0603");var Demo0701 = require("./demolist/Demo0701");var Demo0702 = require("./demolist/Demo0702");var Demo0802 = require("./demolist/Demo0802");var Demo0901 = require("./demolist/Demo0901");var Demo0902 = require("./demolist/Demo0902");var Demo0903 = require("./demolist/Demo0903");var Demo1001 = require("./demolist/Demo1001");var Demo1002 = require("./demolist/Demo1002");var Demo1101 = require("./demolist/Demo1101");var Demo1102 = require("./demolist/Demo1102");var Demo1103 = require("./demolist/Demo1103");var Demo1105 = require("./demolist/Demo1105");var Demo1106 = require("./demolist/Demo1106");var Demo1107 = require("./demolist/Demo1107");var Demo1108 = require("./demolist/Demo1108");var Demo1201 = require("./demolist/Demo1201");var Demo1301 = require("./demolist/Demo1301");var Demo1304 = require("./demolist/Demo1304");var Demo1401 = require("./demolist/Demo1401");var Demo1402 = require("./demolist/Demo1402");var Demo1403 = require("./demolist/Demo1403");var Demo1404 = require("./demolist/Demo1404");var Demo1601 = require("./demolist/Demo1601");var DemoArray = [{"example":
{ title }
\r\n{ desc }
\r\n 查看源码 \r\n\r\n { code }
\r\n
\r\n {!!scss_code ?\r\n { scss_code }
\r\n
: null }\r\n